import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","groups","disabled","getItemLabel","getItemKey","isLoading","getItemGroupKey","getGroupKey","getGroupLabel","inputRef","onFocus","dropdownRef","dropdownClassName","dropdownForm","value","form","view","size","onChange","style","renderItem","searchFunction","id","name","className","virtualScroll","onScrollToBottom","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","onInputChange","inputValue","onBlur"];import React,{forwardRef,useRef}from"react";import{SelectDropdown}from"../../SelectComponents/SelectDropdown";import{defaultPropForm,defaultPropSize,defaultPropView}from"../../SelectComponentsDeprecated/types";import{TextFieldTypeTextArray}from"../../TextFieldCanary";import{useForkRef}from"../../../hooks/useForkRef";import{withDefaultGetters}from"../helpers";import{useAutoComplete}from"../useAutoComplete";import{useRenderItemDefault}from"../useRenderItemDefault";export var AutoCompleteTypeTextArray=forwardRef(function(a,b){var c=withDefaultGetters(a),d=c.items,e=void 0===d?[]:d,f=c.groups,g=void 0===f?[]:f,h=c.disabled,i=void 0!==h&&h,j=c.getItemLabel,k=c.getItemKey,l=c.isLoading,m=c.getItemGroupKey,n=c.getGroupKey,o=c.getGroupLabel,p=c.inputRef,q=c.onFocus,r=c.dropdownRef,s=c.dropdownClassName,t=c.dropdownForm,u=void 0===t?"default":t,v=c.value,w=c.form,x=void 0===w?defaultPropForm:w,y=c.view,z=void 0===y?defaultPropView:y,A=c.size,B=void 0===A?defaultPropSize:A,C=c.onChange,D=c.style,E=c.renderItem,F=c.searchFunction,G=c.id,H=c.name,I=c.className,J=c.virtualScroll,K=c.onScrollToBottom,L=c.onDropdownOpen,M=c.dropdownOpen,N=c.ignoreOutsideClicksRefs,O=c.onInputChange,P=c.inputValue,Q=c.onBlur,R=_objectWithoutProperties(c,_excluded),S=useRef(null),T=useRef(null),U=useAutoComplete({items:e,groups:g,onChange:O,dropdownRef:S,disabled:i,searchValue:P||"",getItemLabel:j,getItemKey:k,getItemGroupKey:m,getGroupKey:n,onFocus:q,searchFunction:F,onBlur:Q,isLoading:l,onDropdownOpen:L,dropdownOpen:M,ignoreOutsideClicksRefs:[T].concat(_toConsumableArray(N||[]))}),V=U.getOptionProps,W=U.isOpen,X=U.getKeyProps,Y=U.visibleItems,Z=U.handleInputFocus,$=U.inputRef,_=U.optionsRefs,aa=U.handleChange,ba=U.handleInputBlur,ca=U.highlightedIndex,da=useRenderItemDefault(j,i,B,u);return React.createElement(React.Fragment,null,React.createElement(TextFieldTypeTextArray,Object.assign({},X(),{form:x,view:z,id:G,className:I,name:H,disabled:i,ref:useForkRef([T,b]),inputRef:useForkRef([p,$]),onFocus:Z,onBlur:ba,onChange:0>ca?C:void 0,onInputChange:aa,value:v,style:D,size:B,inputValue:P},R)),React.createElement(SelectDropdown,{isOpen:W,size:B,controlRef:T,getOptionProps:V,dropdownRef:useForkRef([S,r]),form:u,className:s,renderItem:E||da,getGroupLabel:o,visibleItems:Y,isLoading:l,hasItems:0!==e.length,itemsRefs:_,virtualScroll:!0,style:"number"==typeof(null===D||void 0===D?void 0:D.zIndex)?{zIndex:D.zIndex+1}:void 0,onScrollToBottom:K}))});
//# sourceMappingURL=AutoCompleteTypeTextArray.js.map