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) • 21.8 kB
JavaScript
this.primereact=this.primereact||{},this.primereact.listbox=function(e,t,n,r,o,l,i,a,u,c,s){"use strict";function p(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 f=p(t);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(null,arguments)}function m(e){return m="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},m(e)}function b(e,t){if("object"!=m(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function v(e){var t=b(e,"string");return"symbol"==m(t)?t:t+""}function y(e,t,n){return(t=v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e){if(Array.isArray(e))return h(e)}function O(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function x(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.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)?h(e,t):void 0}}function j(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function I(e){return g(e)||O(e)||x(e)||j()}function E(e){if(Array.isArray(e))return e}function S(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l,i,a=[],u=!0,c=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=l.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return a}}function D(){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 w(e,t){return E(e)||S(e,t)||x(e,t)||D()}var P=r.ComponentBase.extend({defaultProps:{__TYPE:"ListBox",className:null,dataKey:null,disabled:null,emptyFilterMessage:null,emptyMessage:null,filter:!1,filterIcon:null,filterBy:null,filterInputProps:null,filterLocale:void 0,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,filterValue:null,focusOnHover:!0,id:null,itemTemplate:null,invalid:!1,listClassName:null,listStyle:null,metaKeySelection:!1,selectOnFocus:!1,autoOptionFocus:!1,multiple:!1,onChange:null,onFilterValueChange:null,optionDisabled:null,optionGroupChildren:null,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,style:null,tabIndex:0,tooltip:null,tooltipOptions:null,value:null,virtualScrollerOptions:null,children:void 0},css:{classes:{itemGroup:"p-listbox-item-group",emptyMessage:"p-listbox-empty-message",list:"p-listbox-list",wrapper:function(e){return i.classNames("p-listbox-list-wrapper",e.props.listClassName)},root:function(e){var t=e.props;return i.classNames("p-listbox p-component",{"p-disabled":t.disabled,"p-invalid":t.invalid},t.className)},item:function(e){var t=e.props;return i.classNames("p-listbox-item",{"p-highlight":t.selected,"p-focus":t.focusedOptionIndex===t.index,"p-disabled":t.disabled},t.option.className)},filterContainer:"p-listbox-filter-container",filterIcon:"p-listbox-filter-icon",filterInput:"p-listbox-filter",header:"p-listbox-header"},styles:"\n@layer primereact {\n .p-listbox-list-wrapper {\n overflow: auto;\n }\n \n .p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n }\n \n .p-listbox-item {\n cursor: pointer;\n position: relative;\n overflow: hidden;\n outline: none;\n }\n \n .p-listbox-filter-container {\n position: relative;\n }\n \n .p-listbox-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-listbox-filter {\n width: 100%;\n }\n}\n",inlineStyles:{itemGroup:function(e){var t=e.scrollerOptions;return{height:t.props?t.props.itemSize:void 0}},list:function(e){return e.props.virtualScrollerOptions?e.options.style:void 0}}}});function F(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 L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var N=f.memo((function(e){var t=o.useMergeProps(),n=e.ptCallbacks,r=n.ptm,l=n.cx,a=function(t,n){return r(t,L({hostName:e.hostName},n))},s={filter:function(e){return p(e)},reset:function(){return e.resetFilter()}},p=function(t){e.onFilter&&e.onFilter({originalEvent:t,value:t.target.value})},m=function(){var n=t({className:l("filterIcon")},a("filterIcon")),o=i.IconUtils.getJSXIcon(e.filterIcon||f.createElement(u.SearchIcon,n),L({},n),{props:e}),m=t({className:l("header")},a("header")),b=t({className:l("filterContainer")},a("filterContainer")),v=f.createElement("div",b,f.createElement(c.InputText,d({type:"text",value:e.filter,onChange:p,className:l("filterInput"),disabled:e.disabled,placeholder:e.filterPlaceholder},e.filterInputProps,{pt:r("filterInput"),unstyled:e.unstyled,__parentMetadata:{parent:e.metaData}})),o);e.filterTemplate&&(v=i.ObjectUtils.getJSXElement(e.filterTemplate,{className:"p-listbox-filter-container",element:v,filterOptions:s,filterInputChange:p,filterIconClassName:"p-dropdown-filter-icon",props:e}));return f.createElement("div",m,v)}();return f.createElement(f.Fragment,null,m)}));N.displayName="ListBoxHeader";var M=f.memo((function(e){var t=w(f.useState(!1),2),n=t[0],r=t[1],l=o.useMergeProps(),a=e.ptCallbacks,u=a.ptm,c=a.cx,p=e.template?i.ObjectUtils.getJSXElement(e.template,e.option):e.label,m=l({id:e.id,className:c("item",{props:e}),style:e.style,onClick:function(t){return e.onClick(t,e.option,e.index)},onTouchEnd:function(t){e.onTouchEnd&&e.onTouchEnd({originalEvent:t,option:e.option})},onFocus:function(e){r(!0)},onBlur:function(e){r(!1)},tabIndex:"-1",onMouseDown:function(t){return e.onOptionMouseDown(t,e.index)},onMouseMove:function(t){return e.onOptionMouseMove(t,e.index)},"aria-label":e.label,role:"option","aria-selected":e.selected,"aria-disabled":e.disabled,"data-p-disabled":e.disabled},u("item",{hostName:e.hostName,context:{selected:e.selected,disabled:e.disabled,focused:n,focusedOptionIndex:e.focusedOptionIndex}}));return f.createElement("li",d({},m,{key:e.optionKey}),p,f.createElement(s.Ripple,null))}));function C(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 T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function U(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=k(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 k(e,t){if(e){if("string"==typeof e)return K(e,t);var n={}.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)?K(e,t):void 0}}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}M.displayName="ListBoxItem";var G=f.memo(f.forwardRef((function(e,t){var u=o.useMergeProps(),c=f.useContext(n.PrimeReactContext),s=P.getProps(e,c),p=w(f.useState(null),2),m=p[0],b=p[1],v=f.useRef(null),y=f.useRef(null),h=f.useRef(null),g=w(f.useState(-1),2),O=g[0],x=g[1],j=w(f.useState(!1),2),E=j[0],S=j[1],D=w(f.useState(""),2),F=D[0],L=D[1],C=w(f.useState(""),2),k=C[0],K=C[1],G=f.useRef(null),A=f.useRef(null),R=f.useRef(null),B=f.useRef(null),H=f.useRef(!1),V=(s.onFilterValueChange?s.filterValue:F)||"",_=V&&V.trim().length>0,q={props:s,state:{filterValue:V}},z=P.setMetaData(q);r.useHandleStyle(P.css.styles,z.isUnstyled,{name:"listbox"});var J=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;s.disabled||Ke(t)||(s.multiple?Q(e.originalEvent,t):Y(e.originalEvent,t),H.current=!1,-1!==n&&b(n))},X=function(e,t){de(e,t)},$=function(e,t){s.focusOnHover&&E&&de(e,t)},W=function(){s.disabled||(H.current=!0)},Y=function(e,t){var n=Ce(t),r=!1,o=null;!H.current&&s.metaKeySelection?n?(e.metaKey||e.ctrlKey)&&(o=null,r=!0):(o=Ue(t),r=!0):(o=n?null:Ue(t),r=!0);r&&we(e,o)},Q=function(e,t){var n=Ce(t),r=!1,o=null;if(!H&&s.metaKeySelection){var l=e.metaKey||e.ctrlKey;n?(o=l?Pe(t):[Ue(t)],r=!0):(o=[].concat(I(o=l&&s.value||[]),[Ue(t)]),r=!0)}else o=n?Pe(t):[].concat(I(s.value||[]),[Ue(t)]),r=!0;r&&s.onChange({originalEvent:e,value:o,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:s.name,id:s.id,value:o}})},Z=function(){return i.ObjectUtils.isNotEmpty(s.value)},ee=function(e){return s.optionGroupLabel&&e.optionGroup&&e.group},te=function(e){return i.ObjectUtils.isNotEmpty(e)&&!(Ke(e)||ee(e))},ne=function(e){return te(e)&&Ce(e)},re=function(){return ze.findIndex((function(e){return te(e)}))},oe=function(){if(Z()){if(!s.multiple)return ze.findIndex((function(e){return ne(e)}));for(var e,t=function(){var e=s.value[n],t=ze.findIndex((function(t){return ne(t)&&Me(e,Ue(t))}));if(t>-1)return{v:t}},n=s.value.length-1;n>=0;n--)if(e=t())return e.v}return-1},le=function(){return i.ObjectUtils.findLastIndex(ze,(function(e){return te(e)}))},ie=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=-1;return Z()&&(n=t?-1===(n=se(e))?ce(e):n:-1===(n=ce(e))?se(e):n),n>-1?n:e},ae=function(e){var t;return te(e)&&(null===(t=Te(e))||void 0===t?void 0:t.toLocaleLowerCase(s.filterLocale).startsWith(k.toLocaleLowerCase(s.filterLocale)))},ue=function(e,t){K((k||"")+t);var n=-1;i.ObjectUtils.isNotEmpty(k)&&(-1===(n=-1!==m?-1===(n=ze.slice(m).findIndex((function(e){return ae(e)})))?ze.slice(0,m).findIndex((function(e){return ae(e)})):n+m:ze.findIndex((function(e){return ae(e)})))&&-1===m&&(n=fe()),-1!==n&&de(e,n)),v.current&&clearTimeout(v.current),v.current=setTimeout((function(){K(""),v.current=null}),500)},ce=function(e){var t=Z()&&e<ze.length-1?ze.slice(e+1).findIndex((function(e){return ne(e)})):-1;return t>-1?t+e+1:-1},se=function(e){var t=Z()&&e>0?i.ObjectUtils.findLastIndex(ze.slice(0,e),(function(e){return ne(e)})):-1;return t>-1?t:-1},pe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-1===t&&(t=ie(n,!0)),-1===n&&(n=ie(t)),-1!==t&&-1!==n){var r=Math.min(t,n),o=Math.max(t,n),l=ze.slice(r,o+1).filter((function(e){return te(e)})).map((function(e){return Ue(e)}));we(e,l)}},fe=function(){var e=Z()?ze.findIndex((function(e){return ne(e)})):-1;return e<0?re():e},de=function(e,t){m!==t&&(b(t),Ie(),e&&s.selectOnFocus&&!s.multiple&&J(e,ze[t]))},me=function(e){var t,n,r=-1!==m?(n=(t=m)<ze.length-1?ze.slice(t+1).findIndex((function(e){return te(e)})):-1)>-1?n+t+1:t:fe();s.multiple&&e.shiftKey&&pe(e,O,r),de(e,r),e.preventDefault()},be=function(e){var t,n,r,o=-1!==m?(r=(n=m)>0?i.ObjectUtils.findLastIndex(ze.slice(0,n),(function(e){return te(e)})):-1)>-1?r:n:(t=Z()?i.ObjectUtils.findLastIndex(ze,(function(e){return ne(e)})):-1)<0?le():t;s.multiple&&e.shiftKey&&pe(e,o,O),de(e,o),e.preventDefault()},ve=function(e){-1!==m&&(s.multiple&&e.shiftKey?pe(e,m):J(e,ze[m])),e.preventDefault()},ye=function(e){ve(e)},he=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])e.currentTarget.setSelectionRange(0,0),b(-1);else{var t=e.metaKey||e.ctrlKey,n=re();s.multiple&&e.shiftKey&&t&&pe(e,n,O),de(e,n)}e.preventDefault()},ge=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,n=t.value.length;t.setSelectionRange(n,n),b(-1)}else{var r=e.metaKey||e.ctrlKey,o=le();s.multiple&&e.shiftKey&&r&&pe(e,O,o),de(e,o)}e.preventDefault()},Oe=function(e){Ie(0),e.preventDefault()},xe=function(e){Ie(ze.length-1),e.preventDefault()},je=function(e){var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":me(e);break;case"ArrowUp":be(e);break;case"Home":he(e);break;case"End":ge(e);break;case"PageDown":xe(e);break;case"PageUp":Oe(e);break;case"Enter":case"NumpadEnter":case"Space":ye(e),e.preventDefault();break;case"Tab":break;case"ShiftLeft":case"ShiftRight":x(m);break;default:if(s.multiple&&"a"===e.key&&t){var n=ze.filter((function(e){return te(e)})).map((function(e){return Ue(e)}));we(e,n),e.preventDefault();break}!t&&i.ObjectUtils.isPrintableCharacter(e.key)&&(ue(e,e.key),e.preventDefault())}},Ie=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;setTimeout((function(){if(B.current){var t=-1!==e?"".concat(R.current,"_").concat(e):-1!==m?"".concat(R.current,"_").concat(m):null,n=B.current.querySelector('li[id="'.concat(t,'"]'));n?n.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"}):s.virtualScrollerOptions&&A.current&&A.current.scrollToIndex(-1!==e?e:m)}}),0)},Ee=function(e){A.current&&A.current.scrollToIndex(0);var t=e.value;s.onFilterValueChange?s.onFilterValueChange({originalEvent:e.originalEvent,value:t}):L(t)},Se=function(){L(""),s.onFilter&&s.onFilter({filter:""})},De=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E;if(s.selectOnFocus&&s.autoOptionFocus&&!Z()&&!s.multiple&&e){var t=fe();J(null,ze[t]),b(t)}},we=function(e,t){s.onChange&&s.onChange({originalEvent:e,value:t,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:s.name,id:s.id,value:t}})},Pe=function(e){return s.value.filter((function(t){return!i.ObjectUtils.equals(t,Ue(e),s.dataKey)}))},Fe=function(){if(null!=s.value&&ze){if(!s.optionGroupLabel)return Ne(s.value,ze);for(var e=0;e<ze.length;e++){var t=Ne(s.value,Be(ze[e]));if(-1!==t)return{group:e,option:t}}}return-1},Le=function(){return s.optionValue?null:s.dataKey},Ne=function(e,t){var n=Le();return t.findIndex((function(t){return i.ObjectUtils.equals(e,Ue(t),n)}))},Me=function(e,t){return i.ObjectUtils.equals(e,t,Le())},Ce=function(e){var t=Ue(e);return s.multiple?(s.value||[]).some((function(e){return Me(e,t)})):Me(s.value,t)},Te=function(e){return s.optionLabel?i.ObjectUtils.resolveFieldData(e,s.optionLabel):e&&void 0!==e.label?e.label:e},Ue=function(e){return s.optionValue?i.ObjectUtils.resolveFieldData(e,s.optionValue):e&&void 0!==e.value?e.value:e},ke=function(e){return s.dataKey?i.ObjectUtils.resolveFieldData(e,s.dataKey):Te(e)},Ke=function(e){return s.optionDisabled?i.ObjectUtils.isFunction(s.optionDisabled)?s.optionDisabled(e):i.ObjectUtils.resolveFieldData(e,s.optionDisabled):!(!e||void 0===e.disabled)&&e.disabled},Ge=function(){S(!0),b(-1!==m?m:s.autoOptionFocus?fe():oe()),De(!0)},Ae=function(){S(!1),b(-1),x(-1),K("")},Re=function(e){return i.ObjectUtils.resolveFieldData(e,s.optionGroupLabel)},Be=function(e){return i.ObjectUtils.resolveFieldData(e,s.optionGroupChildren)},He=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=Be(t);return r&&r.forEach((function(t){return e.push(t)})),e}),[])},Ve=function(){if(A.current){var e=Fe();-1!==e&&setTimeout((function(){return A.current.scrollToIndex(e)}),0)}};f.useImperativeHandle(t,(function(){return{props:s,focus:function(){return i.DomHandler.focusFirstElement(G.current)},getElement:function(){return G.current},getVirtualScroller:function(){return A.current}}})),o.useMountEffect((function(){Ve(),R.current=i.UniqueComponentId()}));var _e=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={height:n.props?n.props.itemSize:void 0};if(e.group&&e.optionGroup&&s.optionGroupLabel){var o=s.optionGroupTemplate?i.ObjectUtils.getJSXElement(s.optionGroupTemplate,e,t):i.ObjectUtils.resolveFieldData(e,s.optionGroupLabel),l=t+"_"+Re(e),a=u({className:z.cx("itemGroup"),style:z.sx("itemGroup",{scrollerOptions:n}),role:"group"},z.ptm("itemGroup"));return f.createElement("li",d({},a,{key:l}),o)}var c=Te(e),p=t+"_"+ke(e),b=Ke(e);return f.createElement(M,{id:R.current+"_"+t,hostName:"ListBox",optionKey:p,key:p,label:c,index:t,onOptionMouseDown:X,onOptionMouseMove:$,focusedOptionIndex:m,option:e,style:r,template:s.itemTemplate,selected:Ce(e),onClick:J,onTouchEnd:W,disabled:b,ptCallbacks:z,metaData:q})},qe=function(e,t){var r=u({className:z.cx("emptyMessage")},z.ptm("emptyMessage")),o=i.ObjectUtils.getJSXElement(e,s)||n.localeOption(t?"emptyFilterMessage":"emptyMessage");return f.createElement("li",r,o)},ze=function(){var e=s.optionGroupLabel?He(s.options):s.options;if(_){var t=V.trim().toLocaleLowerCase(s.filterLocale),r=s.filterBy?s.filterBy.split(","):[s.optionLabel||"label"];if(s.optionGroupLabel){var o,l=[],i=U(s.options);try{for(i.s();!(o=i.n()).done;){var a=o.value,u=n.FilterService.filter(Be(a),r,t,s.filterMatchMode,s.filterLocale);u&&u.length&&l.push(T(T({},a),{items:u}))}}catch(e){i.e(e)}finally{i.f()}return He(l)}return n.FilterService.filter(e,r,t,s.filterMatchMode,s.filterLocale)}return e}(),Je=i.ObjectUtils.isNotEmpty(s.tooltip),Xe=P.getOtherProps(s),$e=i.ObjectUtils.reduceKeys(Xe,i.DomHandler.ARIA_PROPS),We=function(){if(s.virtualScrollerOptions){var e=T(T({},s.virtualScrollerOptions),{items:ze,onLazyLoad:function(e){return s.virtualScrollerOptions.onLazyLoad(T(T({},e),{filter:ze}))},itemTemplate:function(e,t){return e&&_e(e,t.index,t)},contentTemplate:function(e){var t=u(T({ref:B,style:z.sx("list",{options:e}),className:z.cx("list",{options:e}),role:"listbox",tabIndex:"-1","aria-multiselectable":s.multiple,onFocus:Ge,onBlur:Ae,onKeyDown:je},$e),z.ptm("list"));return f.createElement("ul",t,e.children)}});return f.createElement(a.VirtualScroller,d({ref:A},e,{pt:z.ptm("virtualScroller")}))}var t=i.ObjectUtils.isNotEmpty(ze)?ze.map(_e):_?qe(s.emptyFilterMessage,!0):qe(s.emptyMessage),n=u(T({ref:B,className:z.cx("list"),role:"listbox","aria-multiselectable":s.multiple,tabIndex:"-1",onFocus:Ge,onBlur:Ae,onKeyDown:je},$e),z.ptm("list"));return f.createElement("ul",n,t)}(),Ye=s.filter?f.createElement(N,{hostName:"ListBox",filter:V,filterIcon:s.filterIcon,onFilter:Ee,resetFilter:Se,filterTemplate:s.filterTemplate,disabled:s.disabled,filterPlaceholder:s.filterPlaceholder,filterInputProps:s.filterInputProps,ptCallbacks:z,metaData:q}):null,Qe=u({className:z.cx("wrapper"),style:s.listStyle},z.ptm("wrapper")),Ze=u({ref:G,id:s.id,className:z.cx("root"),style:s.style},P.getOtherProps(s),z.ptm("root")),et=u({ref:y,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:s.disabled?-1:s.tabIndex,onFocus:function(){i.DomHandler.focus(B.current);var e=i.DomHandler.getFirstFocusableElement(G.current,':not([data-p-hidden-focusable="true"])');h.current.tabIndex=i.DomHandler.isElement(e)?void 0:-1,y.current.tabIndex=-1,de(null,0)},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},z.ptm("hiddenFirstFocusableEl")),tt=u({ref:h,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:s.disabled?-1:s.tabIndex,onFocus:function(e){if(e.relatedTarget===B.current){var t=i.DomHandler.getFirstFocusableElement(G.current,':not([data-p-hidden-focusable="true"])');i.DomHandler.focus(t),y.current.tabIndex=void 0}else i.DomHandler.focus(y.current);h.current.tabIndex=-1},"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},z.ptm("hiddenLastFocusableEl"));return f.createElement(f.Fragment,null,f.createElement("div",Ze,f.createElement("span",et),Ye,f.createElement("div",Qe,We),f.createElement("span",tt)),Je&&f.createElement(l.Tooltip,d({target:G,content:s.tooltip,pt:z.ptm("tooltip")},s.tooltipOptions)))})));return G.displayName="ListBox",e.ListBox=G,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.tooltip,primereact.utils,primereact.virtualscroller,primereact.icons.search,primereact.inputtext,primereact.ripple);