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","onBlur"];import React,{forwardRef,useRef}from"react";import{SelectDropdown}from"../../SelectComponents/SelectDropdown";import{defaultPropForm,defaultPropSize,defaultPropView}from"../../SelectComponentsDeprecated/types";import{TextFieldTypeText}from"../../TextFieldCanary";import{useForkRef}from"../../../hooks/useForkRef";import{withDefaultGetters}from"../helpers";import{useAutoComplete}from"../useAutoComplete";import{useRenderItemDefault}from"../useRenderItemDefault";export var AutoCompleteTypeText=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.onBlur,P=_objectWithoutProperties(c,_excluded),Q=useRef(null),R=useRef(null),S=useAutoComplete({items:e,groups:g,onChange:C,dropdownRef:Q,disabled:i,searchValue:v||"",getItemLabel:j,getItemKey:k,getItemGroupKey:m,getGroupKey:n,onFocus:q,onBlur:O,searchFunction:F,isLoading:l,onDropdownOpen:L,dropdownOpen:M,ignoreOutsideClicksRefs:[R].concat(_toConsumableArray(N||[]))}),T=S.getOptionProps,U=S.isOpen,V=S.getKeyProps,W=S.visibleItems,X=S.handleInputFocus,Y=S.handleInputBlur,Z=S.inputRef,$=S.optionsRefs,_=S.handleChange,aa=useRenderItemDefault(j,i,B,u);return React.createElement(React.Fragment,null,React.createElement(TextFieldTypeText,Object.assign({},V(),{form:x,view:z,id:G,className:I,name:H,disabled:i,ref:useForkRef([R,b]),inputRef:useForkRef([p,Z]),onChange:_,onFocus:X,onBlur:Y,value:v,style:D,size:B},P)),React.createElement(SelectDropdown,{isOpen:U,size:B,controlRef:R,getOptionProps:T,dropdownRef:useForkRef([Q,r]),form:u,className:s,renderItem:E||aa,getGroupLabel:o,visibleItems:W,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=AutoCompleteTypeText.js.map