UNPKG

primereact

Version:

PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime

2 lines (1 loc) 32.7 kB
this.primereact=this.primereact||{},this.primereact.dropdown=function(e,t,n,r,o,l,i,a,c,u,s,p,d,f,m,v,b,g){"use strict";function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function y(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var w=y(t),O=h(n);function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},I.apply(this,arguments)}function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function x(e,t){if("object"!==E(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function S(e){var t=x(e,"string");return"symbol"===E(t)?t:String(t)}function D(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e){if(Array.isArray(e))return e}function F(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],c=!0,u=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return a}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function C(e,t){if(e){if("string"==typeof e)return N(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N(e,t):void 0}}function k(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e,t){return j(e)||F(e,t)||C(e,t)||k()}var P=r.ComponentBase.extend({defaultProps:{__TYPE:"Dropdown",__parentMetadata:null,appendTo:null,ariaLabel:null,ariaLabelledBy:null,autoFocus:!1,children:void 0,className:null,clearIcon:null,dataKey:null,disabled:!1,dropdownIcon:null,editable:!1,emptyFilterMessage:null,highlightOnSelect:!0,checkmark:!1,emptyMessage:null,filter:!1,filterBy:null,filterClearIcon:null,filterIcon:null,filterInputAutoFocus:!1,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,focusInputRef:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,itemTemplate:null,loading:!1,loadingIcon:null,maxLength:null,name:null,onBlur:null,onChange:null,onContextMenu:null,onFilter:null,onFocus:null,onHide:null,onMouseDown:null,onShow:null,optionDisabled:null,optionGroupChildren:"items",selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,panelClassName:null,panelFooterTemplate:null,panelStyle:null,placeholder:null,required:!1,resetFilterOnHide:!1,scrollHeight:"200px",showClear:!1,showFilterClear:!1,showOnFocus:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,transitionOptions:null,value:null,valueTemplate:null,virtualScrollerOptions:null},css:{classes:{root:function(e){var t=e.props,n=e.focusedState,r=e.overlayVisibleState,o=e.context;return s.classNames("p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-invalid":t.invalid,"p-focus":n,"p-variant-filled":t.variant?"filled"===t.variant:o&&"filled"===o.inputStyle,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-inputwrapper-filled":s.ObjectUtils.isNotEmpty(t.value),"p-inputwrapper-focus":n||r})},input:function(e){var t=e.props,n=e.label;return t.editable?"p-dropdown-label p-inputtext":s.classNames("p-dropdown-label p-inputtext",{"p-placeholder":null===n&&t.placeholder,"p-dropdown-label-empty":null===n&&!t.placeholder})},trigger:"p-dropdown-trigger",emptyMessage:"p-dropdown-empty-message",itemGroup:function(e){var t=e.optionGroupLabel;return s.classNames("p-dropdown-item-group",{"p-dropdown-item-empty":!t||0===t.length})},itemGroupLabel:"p-dropdown-item-group-label",dropdownIcon:"p-dropdown-trigger-icon p-clickable",loadingIcon:"p-dropdown-trigger-icon p-clickable",clearIcon:"p-dropdown-clear-icon p-clickable",filterIcon:"p-dropdown-filter-icon",filterClearIcon:"p-dropdown-filter-clear-icon",filterContainer:function(e){return s.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!e.clearIcon})},filterInput:function(e){var t=e.props,n=e.context;return s.classNames("p-dropdown-filter p-inputtext p-component",{"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})},list:function(e){return"p-dropdown-items"},panel:function(e){var t=e.context;return s.classNames("p-dropdown-panel p-component",{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===O.default.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===O.default.ripple})},item:function(e){var t=e.label;return s.classNames("p-dropdown-item",{"p-highlight":e.selected&&e.highlightOnSelect,"p-disabled":e.disabled,"p-focus":e.index===e.focusedOptionIndex,"p-dropdown-item-empty":!t||0===t.length})},itemLabel:"p-dropdown-item-label",checkIcon:"p-dropdown-check-icon",blankIcon:"p-dropdown-blank-icon",wrapper:"p-dropdown-items-wrapper",header:"p-dropdown-header",footer:"p-dropdown-footer",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n }\n \n .p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n \n .p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n }\n \n .p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n input.p-dropdown-label {\n cursor: default;\n }\n \n .p-dropdown .p-dropdown-panel {\n min-width: 100%;\n }\n \n .p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n }\n \n .p-dropdown-items-wrapper {\n overflow: auto;\n }\n \n .p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-dropdown-filter {\n width: 100%;\n }\n \n .p-dropdown-filter-container {\n position: relative;\n }\n \n .p-dropdown-clear-icon,\n .p-dropdown-filter-icon,\n .p-dropdown-filter-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-fluid .p-dropdown {\n display: flex;\n }\n \n .p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n }\n}\n",inlineStyles:{wrapper:function(e){return{maxHeight:e.props.scrollHeight||"auto"}},panel:function(e){}}}}),U=w.memo(w.forwardRef((function(e,t){var n=g.IconBase.getPTI(e);return w.createElement("svg",I({ref:t,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),w.createElement("rect",{width:"1",height:"1",fill:"currentColor",fillOpacity:"0"}))})));U.displayName="BlankIcon";var R=w.memo((function(e){var t=o.useMergeProps(),n=e.ptm,r=e.cx,l=e.selected,i=e.disabled,a=e.option,c=e.label,u=e.index,p=e.focusedOptionIndex,d=e.checkmark,f=e.highlightOnSelect,m=function(e){return n(e,{context:{selected:l,disabled:i}})},g=e.template?s.ObjectUtils.getJSXElement(e.template,e.option):e.label,h=t({role:"option",key:e.label,className:s.classNames(a.className,r("item",{selected:l,disabled:i,label:c,index:u,focusedOptionIndex:p,highlightOnSelect:f})),style:e.style,onClick:function(t){return n=t,void(e.onClick&&e.onClick({originalEvent:n,option:a}));var n},onMouseMove:function(t){return null==e?void 0:e.onMouseMove(t,u)},"aria-label":c,"aria-selected":l,"data-p-highlight":l,"data-p-focused":p===u,"data-p-disabled":i},m("item")),y=t({className:r("itemLabel")},m("itemLabel"));return w.createElement("li",h,d&&function(){if(l){var e=t({className:r("checkIcon")},m("checkIcon"));return w.createElement(b.CheckIcon,e)}var n=t({className:r("blankIcon")},m("blankIcon"));return w.createElement(U,n)}(),w.createElement("span",y,g),w.createElement(v.Ripple,null))}));function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}R.displayName="DropdownItem";var H=w.memo(w.forwardRef((function(e,t){var r,l,i,c,u,v=o.useMergeProps(),b=e.ptm,g=e.cx,h=e.sx,y=w.useContext(n.PrimeReactContext),O=w.useRef(null),E=!(e.visibleOptions&&e.visibleOptions.length)&&e.hasFilter,x={filter:function(e){return F(e)},reset:function(){return e.resetFilter()}},S=function(t,n){return b(t,M({hostName:e.hostName},n))},D=function(){e.onEnter((function(){if(e.virtualScrollerRef.current){var t=e.getSelectedOptionIndex();-1!==t&&setTimeout((function(){return e.virtualScrollerRef.current.scrollToIndex(t)}),0)}}))},j=function(){e.onEntered((function(){e.filter&&e.filterInputAutoFocus&&s.DomHandler.focus(O.current,!1)}))},F=function(t){e.virtualScrollerRef.current&&e.virtualScrollerRef.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(t)},N=function(){if(e.panelFooterTemplate){var t=s.ObjectUtils.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide),n=v({className:g("footer")},S("footer"));return w.createElement("div",n,t)}return null},C=function(t,n){var r;e.focusOnHover&&(null==e||null===(r=e.changeFocusedOptionIndex)||void 0===r||r.call(e,t,n))},k=function(t,r){var o=s.ObjectUtils.getJSXElement(t,e)||n.localeOption(r?"emptyFilterMessage":"emptyMessage"),l=v({className:g("emptyMessage")},S("emptyMessage"));return w.createElement("li",l,o)},L=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={height:r.props?r.props.itemSize:void 0};if(o=M(M({},o),t.style),t.group&&t.optionGroup&&e.optionGroupLabel){var l=e.optionGroupLabel,i=e.optionGroupTemplate?s.ObjectUtils.getJSXElement(e.optionGroupTemplate,t,n):e.getOptionGroupLabel(t),a=n+"_"+e.getOptionGroupRenderKey(t),c=v({className:g("itemGroup",{optionGroupLabel:l}),style:o,"data-p-highlight":e.selected},S("itemGroup")),u=v({className:g("itemGroupLabel")},S("itemGroupLabel"));return w.createElement("li",I({key:a},c),w.createElement("span",u,i))}var p=e.getOptionRenderKey(t)+"_"+n,d=e.getOptionLabel(t),f=e.isOptionDisabled(t);return w.createElement(R,{key:p,label:d,index:n,focusedOptionIndex:e.focusedOptionIndex,option:t,style:o,template:e.itemTemplate,selected:e.isSelected(t),highlightOnSelect:e.highlightOnSelect,disabled:f,onClick:e.onOptionClick,onMouseMove:C,ptm:b,cx:g,checkmark:e.checkmark})},P=function(){if(e.showFilterClear&&e.filterValue){var t=n.localeOption("clear"),r=v({className:g("filterClearIcon"),"aria-label":t,onClick:function(){return e.onFilterClearIconClick((function(){return s.DomHandler.focus(O.current)}))}},S("filterClearIcon"));return s.IconUtils.getJSXIcon(e.filterClearIcon||w.createElement(a.TimesIcon,r),M({},r),{props:e})}return null},U=function(){if(e.filter){var t=P(),n=v({className:g("filterIcon")},S("filterIcon")),r=s.IconUtils.getJSXIcon(e.filterIcon||w.createElement(d.SearchIcon,n),M({},n),{props:e}),o=v({className:g("filterContainer",{clearIcon:t})},S("filterContainer")),l=v({ref:O,type:"text",autoComplete:"off",className:g("filterInput",{context:y}),placeholder:e.filterPlaceholder,onKeyDown:e.onFilterInputKeyDown,onChange:function(e){return F(e)},value:e.filterValue},S("filterInput")),i=w.createElement("div",o,w.createElement("input",l),t,r);if(e.filterTemplate){var a={className:s.classNames("p-dropdown-filter-container",{"p-dropdown-clearable-filter":!!t}),element:i,filterOptions:x,filterInputKeyDown:e.onFilterInputKeyDown,filterInputChange:F,filterIconClassName:"p-dropdown-filter-icon",clearIcon:t,props:e};i=s.ObjectUtils.getJSXElement(e.filterTemplate,a)}var c=v({className:g("header")},S("header"));return w.createElement("div",c,i)}return null},T=function(){if(e.virtualScrollerOptions){var t=M(M({},e.virtualScrollerOptions),{style:M(M({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:s.classNames("p-dropdown-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(t){return e.virtualScrollerOptions.onLazyLoad(M(M({},t),{filter:e.filterValue}))},itemTemplate:function(e,t){return e&&L(e,t.index,t)},contentTemplate:function(t){var n=E?k(e.hasFilter?e.emptyFilterMessage:e.emptyMessage):t.children,r=v({ref:t.contentRef,style:t.style,className:s.classNames(t.className,g("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox"},S("list"));return w.createElement("ul",r,n)}});return w.createElement(m.VirtualScroller,I({ref:e.virtualScrollerRef},t,{pt:b("virtualScroller")}))}var n=s.ObjectUtils.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(L):e.hasFilter?k(e.emptyFilterMessage,!0):k(e.emptyMessage),r=v({className:g("wrapper"),style:h("wrapper")},S("wrapper")),o=v({className:g("list"),role:"listbox"},S("list"));return w.createElement("div",r,w.createElement("ul",o,n))},H=(r=U(),l=T(),i=N(),c=v({className:s.classNames(e.panelClassName,g("panel",{context:y})),style:h("panel"),onClick:e.onClick},S("panel")),u=v({classNames:g("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,unmountOnExit:!0,onEnter:D,onEntered:j,onExit:e.onExit,onExited:e.onExited},S("transition")),w.createElement(p.CSSTransition,I({nodeRef:t},u),w.createElement("div",I({ref:t},c),e.firstFocusableElement,r,l,i,e.lastFocusableElement)));return w.createElement(f.Portal,{element:H,appendTo:e.appendTo})})));function G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=A(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw l}}}}function A(e,t){if(e){if("string"==typeof e)return V(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?V(e,t):void 0}}function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}H.displayName="DropdownPanel";var _=w.memo(w.forwardRef((function(e,t){var p=o.useMergeProps(),d=w.useContext(n.PrimeReactContext),f=P.getProps(e,d),m=L(w.useState(""),2),v=m[0],b=m[1],g=L(w.useState(!1),2),h=g[0],y=g[1],x=L(w.useState(-1),2),S=x[0],j=x[1],F=L(w.useState(!1),2),N=F[0],C=F[1],k=w.useRef(!1),U=w.useRef(null),R=w.useRef(null),T=w.useRef(null),M=w.useRef(null),A=w.useRef(f.inputRef),V=w.useRef(f.focusInputRef),K=w.useRef(null),_=w.useRef(null),J=w.useRef(null);w.useRef(null);var X=f.virtualScrollerOptions&&f.virtualScrollerOptions.lazy,z=s.ObjectUtils.isNotEmpty(v),q=f.appendTo||d&&d.appendTo||O.default.appendTo,Z=P.setMetaData(B(B({props:f},f.__parentMetadata),{},{state:{filter:v,focused:h,overlayVisible:N}})),W=Z.ptm,$=Z.cx,Y=Z.sx;r.useHandleStyle(P.css.styles,Z.isUnstyled,{name:"dropdown"});var Q=L(o.useOverlayListener({target:U,overlay:R,listener:function(e,t){t.valid&&("outside"===t.type?!re(e)&&Ae():Ae())},when:N}),2),ee=Q[0],te=Q[1],ne=function(e){return(e||[]).reduce((function(e,t,n){e.push({optionGroup:t,group:!0,index:n,code:t.code,label:t.label});var r=qe(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},re=function(e){return s.DomHandler.isAttributeEquals(e.target,"data-pc-section","clearicon")||s.DomHandler.isAttributeEquals(e.target.parentElement||e.target,"data-pc-section","filterclearicon")},oe=function(e){f.showOnFocus&&!N&&Ge(),y(!0),f.onFocus&&f.onFocus(e)},le=function(e){y(!1),f.onBlur&&setTimeout((function(){var t=A.current?A.current.value:void 0;f.onBlur({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}})}),200)},ie=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Ue({originalEvent:e,option:t}),n&&Ae()},ae=function(e){if(f.disabled||s.DomHandler.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,f.editable);break;case"Home":Oe(e);break;case"End":Ie(e);break;case"PageDown":xe(e);break;case"PageUp":Ee(e);break;case"Space":Se(e,f.editable);break;case"NumpadEnter":case"Enter":De(e);break;case"Escape":je(e);break;case"Tab":Fe(e);break;case"Backspace":Ne(e,f.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&s.ObjectUtils.isPrintableCharacter(e.key)&&(!N&&!f.editable&&Ge(),!f.editable&&me(e,e.key))}k.current=!1}},ce=function(e){var t;return ue(e)&&(null===(t=_e(e))||void 0===t?void 0:t.toLocaleLowerCase(f.filterLocale).startsWith(J.current.toLocaleLowerCase(f.filterLocale)))},ue=function(e){return s.ObjectUtils.isNotEmpty(e)&&!(ze(e)||Xe(e))},se=function(){return s.ObjectUtils.isNotEmpty(f.value)},pe=function(e){return ue(e)&&He(e)},de=function(){return se?nt.findIndex((function(e){return pe(e)})):-1},fe=function(){var e=de();return e<0?ve():e},me=function(e,t){J.current=(J.current||"")+t;var n=-1,r=!1;return s.ObjectUtils.isNotEmpty(J.current)&&(-1!==(n=-1!==S?-1===(n=nt.slice(S).findIndex((function(e){return ce(e)})))?nt.slice(0,S).findIndex((function(e){return ce(e)})):n+S:nt.findIndex((function(e){return ce(e)})))&&(r=!0),-1===n&&-1===S&&(n=fe()),-1!==n&&ge(e,n)),_.current&&clearTimeout(_.current),_.current=setTimeout((function(){J.current="",_.current=null}),500),r},ve=function(){return nt.findIndex((function(e){return ue(e)}))},be=function(){return s.ObjectUtils.findLastIndex(nt,(function(e){return ue(e)}))},ge=function(e,t){S!==t&&(j(t),f.selectOnFocus&&ie(e,nt[t],!1))},he=function(e){if(N){var t=-1!==S?(r=(n=S)<nt.length-1?nt.slice(n+1).findIndex((function(e){return ue(e)})):-1)>-1?r+n+1:n:k.current?ve():fe();ge(e,t)}else Ge(),f.editable&&ge(e,de());var n,r;e.preventDefault()},ye=function(e){var t,n,r;if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==S&&ie(e,nt[S]),state.overlayVisible&&Ae(),e.preventDefault();else{var o=-1!==S?(r=(n=S)>0?s.ObjectUtils.findLastIndex(nt.slice(0,n),(function(e){return ue(e)})):-1)>-1?r:n:k.current?be():(t=de())<0?be():t;ge(e,o),!N&&Ge(),e.preventDefault()}},we=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&j(-1)},Oe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),j(-1)):(ge(e,ve()),!N&&Ge()),e.preventDefault()},Ie=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),j(-1)}else ge(e,be()),!N&&Ge();e.preventDefault()},Ee=function(e){e.preventDefault()},xe=function(e){e.preventDefault()},Se=function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&De(e)},De=function(e){N?(-1!==S&&ie(e,nt[S]),Ae()):(j(-1),he(e)),e.preventDefault()},je=function(e){N&&Ae(),e.preventDefault()},Fe=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(!N||s.DomHandler.getFocusableElements(R.current,':not([data-p-hidden-focusable="true"])').length>0?(-1!==S&&ie(e,nt[S]),N&&Ae()):(s.DomHandler.focus(T.current),e.preventDefault()))},Ne=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!N&&Ge()},Ce=function(e){!N&&Ge();var t=null;e.target.value&&nt&&(t=nt.findIndex((function(t){return _e(t).toLocaleLowerCase().startsWith(e.target.value.toLocaleLowerCase())}))),j(t),f.onChange&&f.onChange({originalEvent:e.originalEvent,value:e.target.value,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:e.target.value}})},ke=function(e){y(!0),Ae(),f.onFocus&&f.onFocus(e)},Le=function(e){b(""),f.onFilter&&f.onFilter({filter:""}),e&&e()},Pe=function(e){f.onChange&&f.onChange({originalEvent:e,value:void 0,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:f.name,id:f.id,value:void 0}}),f.filter&&Le(),Be()},Ue=function(e){if(rt!==e.option){Be(e.option),j(-1);var t=Je(e.option),n=Me(e.option,nt);f.onChange&&f.onChange({originalEvent:e.originalEvent,value:t,stopPropagation:function(){e.originalEvent.stopPropagation()},preventDefault:function(){e.originalEvent.preventDefault()},target:{name:f.name,id:f.id,value:t}}),ge(e.originalEvent,n)}},Re=function(e){if(e=e||nt,null!=f.value&&e){if(!f.optionGroupLabel)return Me(f.value,e);for(var t=0;t<e.length;t++){var n=Me(f.value,qe(e[t]));if(-1!==n)return{group:t,option:n}}}return-1},Te=function(){return f.optionValue?null:f.dataKey},Me=function(e,t){var n=Te();return t.findIndex((function(t){return s.ObjectUtils.equals(e,Je(t),n)}))},He=function(e){return s.ObjectUtils.equals(f.value,Je(e),Te())},Ge=function(){j(-1!==S?S:f.autoOptionFocus?fe():f.editable?-1:de()),C(!0)},Ae=function(){C(!1),k.current=!1},Ve=function(){s.DomHandler.alignOverlay(R.current,A.current.parentElement,f.appendTo||d&&d.appendTo||O.default.appendTo)},Ke=function(){var e=s.DomHandler.findSingle(R.current,'li[data-p-focused="true"]');if(e&&e.scrollIntoView)e.scrollIntoView({block:"nearest",inline:"nearest"});else{var t=s.DomHandler.findSingle(R.current,'li[data-p-highlight="true"]');t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"})}},Be=function(e){A.current&&(A.current.value=e?_e(e):f.value||"",V.current&&(V.current.value=A.current.value))},_e=function(e){var t=s.ObjectUtils.resolveFieldData(e,f.optionLabel?f.optionLabel:"label");return s.ObjectUtils.isNotEmpty(t)?t:e},Je=function(e){var t=s.ObjectUtils.resolveFieldData(e,f.OptionValue?f.optionValue:"value");return s.ObjectUtils.isNotEmpty(t)?t:e},Xe=function(e){return f.optionGroupLabel&&e.optionGroup&&e.group},ze=function(e){return f.optionDisabled?s.ObjectUtils.isFunction(f.optionDisabled)?f.optionDisabled(e):s.ObjectUtils.resolveFieldData(e,f.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},qe=function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupChildren)},Ze=function(){if(f.editable&&A.current){var e=(rt?_e(rt):null)||f.value||"";A.current.value=e,V.current&&(V.current.value=e)}};w.useImperativeHandle(t,(function(){return{props:f,show:Ge,hide:Ae,clear:Pe,focus:function(){return s.DomHandler.focus(V.current)},getElement:function(){return U.current},getOverlay:function(){return R.current},getInput:function(){return A.current},getFocusInput:function(){return V.current},getVirtualScroller:function(){return K.current}}})),w.useEffect((function(){s.ObjectUtils.combinedRefs(A,f.inputRef),s.ObjectUtils.combinedRefs(V,f.focusInputRef)}),[A,f.inputRef,V,f.focusInputRef]),o.useMountEffect((function(){f.autoFocus&&s.DomHandler.focus(V.current,f.autoFocus),Ve()})),o.useUpdateEffect((function(){N&&(f.value||S>=0)&&Ke()}),[N,f.value,S]),o.useUpdateEffect((function(){N&&v&&f.filter&&Ve()}),[N,v,f.filter]),o.useUpdateEffect((function(){!v||f.options&&0!==f.options.length||b(""),Ze(),A.current&&(A.current.selectedIndex=1)})),o.useUnmountEffect((function(){s.ZIndexUtils.clear(R.current)}));var We,$e,Ye,Qe,et,tt=function(e){"Enter"!==e.key&&"Space"!==e.code||(Pe(e),e.preventDefault())},nt=function(){var e=f.optionGroupLabel?ne(f.options):f.options;if(z&&!X){var t=v.trim().toLocaleLowerCase(f.filterLocale),r=f.filterBy?f.filterBy.split(","):[f.optionLabel||"label"];if(f.optionGroupLabel){var o,l=[],i=G(f.options);try{for(i.s();!(o=i.n()).done;){var a=o.value,c=n.FilterService.filter(qe(a),r,t,f.filterMatchMode,f.filterLocale);c&&c.length&&l.push(B(B({},a),D({},"".concat(f.optionGroupChildren),c)))}}catch(e){i.e(e)}finally{i.f()}return ne(l)}return n.FilterService.filter(e,r,t,f.filterMatchMode,f.filterLocale)}return e}(),rt=-1!==(We=Re(f.options))?f.optionGroupLabel?qe(f.options[We.group])[We.option]:f.options[We]:null,ot=s.ObjectUtils.isNotEmpty(f.tooltip),lt=P.getOtherProps(f),it=s.ObjectUtils.reduceKeys(lt,s.DomHandler.ARIA_PROPS),at=function(){var e={value:"",label:f.placeholder};if(rt){var t=Je(rt);e={value:"object"===E(t)?f.options.findIndex((function(e){return e===t})):t,label:_e(rt)}}var n=p({className:"p-hidden-accessible p-dropdown-hidden-select"},W("hiddenSelectedMessage")),r=p({ref:A,required:f.required,defaultValue:e.value,name:f.name,tabIndex:-1,"aria-hidden":"true"},W("select")),o=p({value:e.value},W("option"));return w.createElement("div",n,w.createElement("select",r,w.createElement("option",o,e.label)))}(),ct=function(){var e=s.ObjectUtils.isNotEmpty(rt)?_e(rt):null;f.editable&&(e=e||f.value||"");var t=p({className:"p-hidden-accessible"},W("hiddenSelectedMessage")),n=p(B({ref:V,id:f.inputId,defaultValue:e,type:"text",readOnly:!0,"aria-haspopup":"listbox",onFocus:oe,onBlur:le,onKeyDown:ae,disabled:f.disabled,tabIndex:f.disabled?-1:f.tabIndex||0},it),W("input"));return w.createElement("div",t,w.createElement("input",n))}(),ut=function(){var e=s.ObjectUtils.isNotEmpty(rt)?_e(rt):null;if(f.editable){var t=p(B({ref:A,type:"text",defaultValue:e||f.value||"",className:$("input",{label:e}),disabled:f.disabled,placeholder:f.placeholder,maxLength:f.maxLength,onInput:Ce,onFocus:ke,onKeyDown:ae,onBlur:le,tabIndex:f.disabled?-1:f.tabIndex||0,"aria-haspopup":"listbox"},it),W("input"));return w.createElement("input",t)}var n=f.valueTemplate?s.ObjectUtils.getJSXElement(f.valueTemplate,rt,f):e||f.placeholder||f.emptyMessage||w.createElement(w.Fragment,null," "),r=p({ref:A,className:$("input",{label:e}),tabIndex:"-1"},W("input"));return w.createElement("span",r,n)}(),st=f.loading?($e=p({className:$("loadingIcon"),"data-pr-overlay-visible":N},W("loadingIcon")),Ye=s.IconUtils.getJSXIcon(f.loadingIcon||w.createElement(i.SpinnerIcon,{spin:!0}),B({},$e),{props:f}),Qe=f.placeholder||f.ariaLabel,et=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":Qe},W("trigger")),w.createElement("div",et,Ye)):function(){var e=p({className:$("dropdownIcon"),"data-pr-overlay-visible":N},W("dropdownIcon")),t=s.IconUtils.getJSXIcon(f.dropdownIcon||w.createElement(l.ChevronDownIcon,e),B({},e),{props:f}),n=f.placeholder||f.ariaLabel,r=p({className:$("trigger"),role:"button","aria-haspopup":"listbox","aria-expanded":N,"aria-label":n},W("trigger"));return w.createElement("div",r,t)}(),pt=function(){if(null!=f.value&&f.showClear&&!f.disabled){var e=p({className:$("clearIcon"),onPointerUp:Pe,tabIndex:f.tabIndex||"0",onKeyDown:tt,"aria-label":n.localeOption("clear")},W("clearIcon"));return s.IconUtils.getJSXIcon(f.clearIcon||w.createElement(a.TimesIcon,e),B({},e),{props:f})}return null}(),dt=p({id:f.id,ref:U,className:s.classNames(f.className,$("root",{context:d,focusedState:h,overlayVisibleState:N})),style:f.style,onClick:function(e){return t=e,void(f.disabled||f.loading||(f.onClick&&f.onClick(t),t.defaultPrevented||re(t)||"INPUT"===t.target.tagName||(R.current&&R.current&&R.current.contains(t.target)||(s.DomHandler.focus(V.current),N?Ae():Ge()),k.current=!0)));var t},onMouseDown:f.onMouseDown,onContextMenu:f.onContextMenu,onFocus:function(){f.editable&&!N&&!1===k.current&&s.DomHandler.focus(A.current)},"data-p-disabled":f.disabled,"data-p-focus":h},lt,W("root")),ft=p({ref:T,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===V.current?s.DomHandler.getFirstFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):V.current;s.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenFirstFocusableEl")),mt=p({ref:M,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:function(e){var t=e.relatedTarget===V.current?s.DomHandler.getLastFocusableElement(R.current,':not([data-p-hidden-focusable="true"])'):V.current;s.DomHandler.focus(t)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},W("hiddenLastFocusableEl"));return w.createElement(w.Fragment,null,w.createElement("div",dt,ct,at,ut,pt,st,w.createElement(H,I({hostName:"Dropdown",ref:R,visibleOptions:nt,virtualScrollerRef:K},f,{appendTo:q,cx:$,filterValue:v,focusedOptionIndex:S,getOptionGroupChildren:qe,getOptionGroupLabel:function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionGroupRenderKey:function(e){return s.ObjectUtils.resolveFieldData(e,f.optionGroupLabel)},getOptionLabel:_e,getOptionRenderKey:function(e){return f.dataKey?s.ObjectUtils.resolveFieldData(e,f.dataKey):_e(e)},getSelectedOptionIndex:Re,hasFilter:z,in:N,isOptionDisabled:ze,isSelected:He,onClick:function(e){c.OverlayService.emit("overlay-click",{originalEvent:e,target:U.current})},onEnter:function(e){s.ZIndexUtils.set("overlay",R.current,d&&d.autoZIndex||O.default.autoZIndex,d&&d.zIndex.overlay||O.default.zIndex.overlay),s.DomHandler.addStyles(R.current,{position:"absolute",top:"0",left:"0"}),Ve(),e&&e()},onEntered:function(e){e&&e(),ee(),f.onShow&&f.onShow()},onExit:function(){te()},onExited:function(){f.filter&&f.resetFilterOnHide&&Le(),s.ZIndexUtils.clear(R.current),f.onHide&&f.onHide()},onFilterClearIconClick:function(e){Le(e)},onFilterInputChange:function(e){var t=e.target.value;b(t),f.onFilter&&f.onFilter({originalEvent:e,filter:t})},onFilterInputKeyDown:function(e){switch(e.code){case"ArrowDown":he(e);break;case"ArrowUp":ye(e);break;case"ArrowLeft":case"ArrowRight":we(e,!0);break;case"Escape":case"Enter":case"NumpadEnter":De(e),e.preventDefault()}},onOptionClick:function(e){e.option.disabled||(Ue(e),s.DomHandler.focus(V.current)),Ae()},ptm:W,resetFilter:Le,changeFocusedOptionIndex:ge,firstFocusableElement:w.createElement("span",ft),lastFocusableElement:w.createElement("span",mt),sx:Y}))),ot&&w.createElement(u.Tooltip,I({target:U,content:f.tooltip,pt:W("tooltip")},f.tooltipOptions)))})));return _.displayName="Dropdown",e.Dropdown=_,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.icons.chevrondown,primereact.icons.spinner,primereact.icons.times,primereact.overlayservice,primereact.tooltip,primereact.utils,primereact.csstransition,primereact.icons.search,primereact.portal,primereact.virtualscroller,primereact.ripple,primereact.icons.check,primereact.iconbase);