@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
} ;
10
10
return __assign . apply ( this , arguments ) ;
11
11
} ;
12
+ var __rest = ( this && this . __rest ) || function ( s , e ) {
13
+ var t = { } ;
14
+ for ( var p in s ) if ( Object . prototype . hasOwnProperty . call ( s , p ) && e . indexOf ( p ) < 0 )
15
+ t [ p ] = s [ p ] ;
16
+ if ( s != null && typeof Object . getOwnPropertySymbols === "function" )
17
+ for ( var i = 0 , p = Object . getOwnPropertySymbols ( s ) ; i < p . length ; i ++ ) {
18
+ if ( e . indexOf ( p [ i ] ) < 0 && Object . prototype . propertyIsEnumerable . call ( s , p [ i ] ) )
19
+ t [ p [ i ] ] = s [ p [ i ] ] ;
20
+ }
21
+ return t ;
22
+ } ;
12
23
import { jsx as _jsx } from "react/jsx-runtime" ;
13
24
import { createElement as _createElement } from "react" ;
14
25
/**
@@ -19,12 +30,12 @@ import { createElement as _createElement } from "react";
19
30
*/
20
31
import { Autocomplete as MUIAutocomplete , TextField } from '@mui/material' ;
21
32
import { useController , useFormContext } from 'react-hook-form' ;
22
- import { getHighlightBackgroundColor , shouldHighlightBackground , shouldShowRequiredLabel } from '../util' ;
33
+ import { getHighlightBackgroundColor , shouldHighlightBackground , shouldShowRequiredLabel , } from '../util' ;
23
34
import parse from 'autosuggest-highlight/parse' ;
24
35
import match from 'autosuggest-highlight/match' ;
25
36
export var Autocomplete = function ( _a ) {
26
37
var _b ;
27
- var _c = _a . customProperties , _d = _c . options , options = _d === void 0 ? [ ] : _d , registerReturn = _c . registerReturn , fieldId = _a . fieldId , _e = _a . uiSettings , disabled = _e . disabled , description = _e . description , label = _e . label , placeholder = _e . placeholder , size = _e . size , variant = _e . variant , validation = _a . validation ;
38
+ var _c = _a . customProperties , _d = _c . options , options = _d === void 0 ? [ ] : _d , registerReturn = _c . registerReturn , rest = __rest ( _c , [ "options" , "registerReturn" ] ) , fieldId = _a . fieldId , _e = _a . uiSettings , disabled = _e . disabled , description = _e . description , label = _e . label , placeholder = _e . placeholder , size = _e . size , variant = _e . variant , validation = _a . validation ;
28
39
var register = useFormContext ( ) . register ;
29
40
if ( register === undefined && registerReturn === undefined ) {
30
41
throw new Error ( 'Either register or registerReturn must be supplied' ) ;
@@ -46,8 +57,8 @@ export var Autocomplete = function (_a) {
46
57
var isRequired = required !== false ;
47
58
var showRequiredLabel = shouldShowRequiredLabel ( isRequired , disabled ) ;
48
59
var highlightBackground = shouldHighlightBackground ( value , isRequired , disabled ) ;
49
- return _jsx ( MUIAutocomplete , { disabled : disabled , fullWidth : true , id : ' combo-box-demo' , options : options , onBlur : onBlur , onChange : handleChange , renderInput : function ( params ) {
50
- return _createElement ( TextField , __assign ( { } , params , { error : isErroneous , helperText : isErroneous ? error . message : description , InputLabelProps : { required : showRequiredLabel , shrink : true } , key : fieldId , label : label , name : fieldId , placeholder : placeholder , variant : variant } ) ) ;
60
+ return ( _jsx ( MUIAutocomplete , __assign ( { } , rest , { disabled : disabled , fullWidth : true , id : " combo-box-demo" , options : options , onBlur : onBlur , onChange : handleChange , renderInput : function ( params ) {
61
+ return ( _createElement ( TextField , __assign ( { } , params , { error : isErroneous , helperText : isErroneous ? error . message : description , InputLabelProps : { required : showRequiredLabel , shrink : true } , key : fieldId , label : label , name : fieldId , placeholder : placeholder , variant : variant } ) ) ) ;
51
62
} , renderOption : function ( props , option , _a ) {
52
63
var inputValue = _a . inputValue ;
53
64
var matches = match ( option . label , inputValue ) ;
@@ -57,6 +68,6 @@ export var Autocomplete = function (_a) {
57
68
} } , { children : part . text } ) , index ) ) ; } ) } ) } ) ) ) ;
58
69
} , size : size , sx : function ( theme ) { return ( {
59
70
backgroundColor : getHighlightBackgroundColor ( theme , highlightBackground ) ,
60
- } ) ; } , value : ( _b = options . find ( function ( option ) { return option . value === value ; } ) ) !== null && _b !== void 0 ? _b : null } ) ;
71
+ } ) ; } , value : ( _b = options . find ( function ( option ) { return option . value === value ; } ) ) !== null && _b !== void 0 ? _b : null } ) ) ) ;
61
72
} ;
62
73
export default Autocomplete ;
0 commit comments