import{slicedToArray as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import o,{useState as n}from"react";import t from"../hooks/useDropdownMultiCombobox.js";import l from"../components/DropdownWrapperUI.js";var i=function(i){var r=i.options,u=i.isMenuOpen,s=i.autoFocus,d=i.defaultValue,a=i.value,p=i.inputValue,c=i.onChange,g=i.onInputChange,m=i.onMenuClose,v=i.onMenuOpen,O=i.onOptionSelect,f=i.filterOption,b=i.showSelectedOptions,I=void 0===b||b,P=i.clearable,h=void 0===P||P,M=i.searchable,w=void 0===M||M,x=i.multi,S=void 0===x||x,j=i.closeMenuOnSelect,y=void 0===j||j,D=i.dropdownRef,B=i.onFocus,C=i.onBlur,F=i.onKeyDown,V=i.onClear,R=i.onOptionRemove,A=i.loading,K=void 0!==A&&A,T=i.size,z=void 0===T?"medium":T,L=i.id,_=i.boxMode,k=void 0!==_&&_,E=n(Array.isArray(d)?d:[]),H=e(E,2),U=H[0],W=H[1],q=n(!1),G=e(q,2),J=G[0],N=G[1],Q=t(r,U,W,k?void 0:u,s,d,a,p,c,g,m,v,O,f,I,L),X=Q.isOpen,Y=Q.inputValue,Z=Q.highlightedIndex,$=Q.getToggleButtonProps,ee=Q.getLabelProps,oe=Q.getMenuProps,ne=Q.getItemProps,te=Q.getInputProps,le=Q.reset,ie=Q.toggleMenu,re=Q.filteredOptions,ue=Q.selectedItems,se=Q.addSelectedItem,de=Q.removeSelectedItem,ae=Q.getDropdownProps,pe=Object.assign(Object.assign({},i),{isOpen:!!k||X,inputValue:null!=Y?Y:null,highlightedIndex:Z,selectedItems:ue||[],filteredOptions:re,getToggleButtonProps:$,getLabelProps:ee,getMenuProps:oe,getItemProps:ne,getInputProps:function(e){return te(Object.assign(Object.assign({},e||{}),{disabled:i.readOnly||i.disabled,onFocus:function(o){var n;N(!0),null==B||B(o),null===(n=null==e?void 0:e.onFocus)||void 0===n||n.call(e,o)},onBlur:function(o){var n;N(!1),null==C||C(o),null===(n=null==e?void 0:e.onBlur)||void 0===n||n.call(e,o)},onKeyDown:function(o){var n;null==F||F(o),null===(n=null==e?void 0:e.onKeyDown)||void 0===n||n.call(e,o)}}))},reset:le,contextOnClear:function(){le(),void 0===a&&W([]),null==V||V()},contextOnOptionRemove:function(e){de&&de(e),null==R||R(e)},addSelectedItem:se,removeSelectedItem:de,isFocused:J,clearable:h,searchable:w,multi:S,closeMenuOnSelect:y,size:z,getDropdownProps:ae,toggleMenu:ie,loading:K});return o.createElement(l,{contextValue:pe,dropdownRef:D})};export{i as default};
//# sourceMappingURL=DropdownMultiComboboxController.js.map
