@progress/kendo-react-dropdowns
Version:
React DropDowns offer an interface for users to select different items from a list and more. KendoReact Dropdowns package
15 lines • 124 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-labels"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-popup"),require("@progress/kendo-react-inputs"),require("@progress/kendo-react-intl"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-treeview")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-labels","@progress/kendo-svg-icons","@progress/kendo-react-popup","@progress/kendo-react-inputs","@progress/kendo-react-intl","@progress/kendo-react-buttons","@progress/kendo-react-layout","@progress/kendo-react-treeview"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactDropdowns={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoReactLabels,e.KendoSvgIcons,e.KendoReactPopup,e.KendoReactInputs,e.KendoReactIntl,e.KendoReactButtons,e.KendoReactLayout,e.KendoReactTreeview)}(this,(function(e,t,s,i,n,a,o,l,r,d,u,p){"use strict";function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var h=c(t);const g=e=>{const{children:t,width:s,dir:n,itemsCount:a,popupSettings:l}=e,r=h.useContext(i.ZIndexContext),d=r?r+2e3:12e3;return h.createElement(i.ZIndexContext.Provider,{value:d},h.createElement(o.Popup,{style:{width:s,direction:n},contentKey:a&&a.join(),...l},t))},v=h.forwardRef(((e,t)=>{const s=h.useRef(null),{renderListFilterWrapper:n=!1,renderPrefixSeparator:o=!1,placeholder:r,...d}=e,u=i.useUnstyled(),p=u&&u.uDropDownsBase;h.useImperativeHandle(t,(()=>s.current));const c=h.createElement(l.TextBox,{...d,ref:s,className:i.classNames(i.uDropDownsBase.searchbox({c:p})),value:e.value||"",onChange:e.onChange,onKeyDown:e.onKeyDown,tabIndex:e.tabIndex,onClick:e=>e.stopPropagation(),size:e.size,fillMode:e.fillMode,rounded:e.rounded,prefix:()=>h.createElement(h.Fragment,null,h.createElement(l.InputPrefix,null,h.createElement(i.IconWrap,{name:"search",icon:a.searchIcon,className:i.classNames(i.uDropDownsBase.inputIcon({c:p}))})),o&&h.createElement(l.InputSeparator,null)),placeholder:r});return n?h.createElement("div",{className:i.classNames(i.uDropDownsBase.listFilter({c:p}))}," ",c," "):c}));v.propTypes={value:s.oneOfType([s.string,s.number,s.array]),tabIndex:s.number,onChange:s.func,onKeyDown:s.func,size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),fillMode:s.oneOf([null,"solid","flat","outline"]),renderListFilterWrapper:s.bool,placeholder:s.string,renderPrefixSeparator:s.bool},v.displayName="KendoReactListFilter";const m=e=>{const{group:t,groupMode:s,render:n}=e,a=i.useUnstyled(),o=a&&a.uDropDownsBase,l=h.createElement("div",{className:i.classNames(i.uDropDownsBase.groupStickyHeader({c:o}))},"classic"===s?t:h.createElement("div",{className:i.classNames(i.uDropDownsBase.listHeaderText({c:o}))},t));return void 0!==n?n.call(void 0,l,e):l},f=e=>null!=e,b=(e,t,s)=>{if(!f(e))return!1;let i=String(e);return s&&(i=i.toLowerCase()),0===i.indexOf(t)},y=(e,t,s,i,n)=>{const a=e.offsetHeight,o=t.children.item(s),l=o.offsetTop+(n?i-e.scrollTop:0),r=o.offsetHeight;if(n){let t=0;l+r>a?t=l+r-a:l<0&&(t=l),0!==t?e.scrollTop+=t:0===e.scrollTop&&0!==i&&(e.scrollTop=i)}else l+r>a+e.scrollTop?e.scrollTop=l+r-a:l<e.scrollTop&&(e.scrollTop-=e.scrollTop-l)},C=(e,t,s)=>{let i=-1;if(t){t=t.toLowerCase();for(let n=0;n<e.length;n++){const a=(I(e[n],s)||"")+"";if(a&&a.toLowerCase().startsWith(t)){i=n;break}}}return i},x=(e,t,s,i=!1)=>{const n=e=>i?e:e.toLowerCase();return e.findIndex((e=>s?n(I(e,s))===n(t):n(t)===n(e.toString())))},I=(e,t)=>{if(t&&f(e)){const s=t.split(".");let i=e;return s.forEach((e=>{i=i?i[e]:void 0})),i}return e},k=(e,t,s)=>{t.forEach((t=>{const i=e.findIndex((e=>w(e,t,s)));-1!==i&&e.splice(i,1)}))},w=(e,t,s)=>e===t||f(e)===f(t)&&I(e,s)===I(t,s),S=(e,t,s)=>{if(t){const i=x(e,t,s,!0);return-1!==i?e[i]:e[C(e,t,s)]}return e[0]},E=e=>{"INPUT"!==e.target.nodeName&&e.preventDefault()},D=(e,t,s)=>!!e==!!t&&e.text===t.text&&(e===t||((e=[],t=[],s)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!w(e[i],t[i],s))return!1;return!0})(e.data,t.data,s)),F=e=>{const{data:t=[],groupField:s}=e;return s?t.filter((e=>s&&void 0!==e[s])):t},M=e=>e.preventDefault(),K=e=>{const{selected:t,defaultItem:s,textField:n}=e,a=i.useUnstyled(),o=a&&a.uDropDownsBase;return h.createElement("div",{onClick:e.onClick,onMouseDown:M,style:{position:"unset"},className:i.classNames(i.uDropDownsBase.optionLabel({c:o,selected:t}))},I(s,n)||"")},N=e=>{const{selected:t,group:s,dataItem:n,virtual:a,groupMode:o,disabled:l,id:r,focused:d,render:u}=e,p=i.useUnstyled(),c=p&&p.uDropDownsBase,g=h.createElement("li",{id:r,role:"option","aria-selected":t,"aria-disabled":!!l||void 0,className:i.classNames(i.uDropDownsBase.li({c:c,selected:t,focused:d,first:!!s&&"classic"===o,disabled:l})),onClick:t=>e.onClick(e.index,t),style:{position:a?"relative":"unset"}},h.createElement("span",{className:i.classNames(i.uDropDownsBase.itemText({c:c}))},I(n,e.textField).toString()),void 0!==s&&"classic"===o?h.createElement("div",{className:i.classNames(i.uDropDownsBase.itemGroupLabel({c:c}))},s):null);return void 0!==u?u.call(void 0,g,e):g},T=e=>{const{group:t,virtual:s,render:n,isMultiColumn:a=!1,id:o}=e,l=i.useUnstyled(),r=l&&l.uDropDownsBase,d=h.createElement("li",{id:o,role:"group",className:i.classNames(i.uDropDownsBase.groupLi({c:r,isMultiColumn:a})),style:a?{boxSizing:"inherit",position:s?"relative":"unset"}:{position:s?"relative":"unset"}},h.createElement("span",{className:n?void 0:i.classNames(i.uDropDownsBase.groupItemText({c:r,isMultiColumn:a}))},t));return void 0!==n?n.call(void 0,d,e):d},P="dropdowns.nodata",R="dropdowns.clear",O="dropdowns.comboArrowBtnAriaLabelExpand",B="dropdowns.comboArrowBtnAriaLabelCollapse",L="dropdowns.dropDownListArrowBtnAriaLabel",_="dropdowns.dropDownListAdaptiveFilterPlaceholder",z={[R]:"clear",[P]:"NO DATA FOUND.",[O]:"expand combobox",[B]:"collapse combobox",[L]:"select",[_]:"Filter","dropdowns.apply":"Apply","dropdowns.cancel":"Cancel"},H=e=>{const t=r.useLocalization(),s=i.useUnstyled(),n=s&&s.uDropDownsBase,{id:a,show:o,wrapperCssClass:l,wrapperStyle:d,listStyle:u,listRef:p,wrapperRef:c,listClassName:g,ariaSetSize:v}=e,m=(()=>{const{textField:t,valueField:s,groupField:i,groupMode:n,isMultiColumn:a,optionsGuid:o,skip:l=0,virtual:r,focusedIndex:d,hasDuplicates:u,highlightSelected:p=!0,value:c,data:g,itemRender:v,groupHeaderItemRender:m}=e,f=Array.isArray(c);let b=0;return g.map(((y,C)=>{const x=l+C,k=l+C+b,S=u?!!c&&d===C:!y.disabled&&(p&&(!f&&w(y,c,s)||f&&-1!==c.findIndex((e=>w(e,y,s)))));let E,D,F;C>0&&void 0!==i&&(D=I(y,i),F=I(g[C-1],i),D&&F&&D!==F&&(E=D));const M=void 0!==E&&"modern"===n;return M?b+=1:b=0,[M&&h.createElement(T,{id:`option-${o}-${k}`,virtual:r,key:x+"-group-item",group:E,isMultiColumn:a,render:m}),h.createElement(N,{id:`option-${o}-${M?k+1:k}`,virtual:r,dataItem:y,groupMode:n,selected:S,focused:d===C,index:x,key:x,onClick:e.onClick,textField:t,group:E,render:v,disabled:y.disabled})]}))})();return m.length?h.createElement("div",{className:l,style:d,ref:c,onMouseDown:e.onMouseDown,onBlur:e.onBlur,onScroll:e.onScroll,unselectable:"on"},h.createElement("ul",{id:a,role:"listbox","aria-hidden":!o||void 0,"aria-setsize":v,className:g||i.classNames(i.uDropDownsBase.ul({c:n})),ref:p,style:u},m),e.scroller&&h.createElement("div",{className:i.classNames(i.uDropDownsBase.heightContainer({c:n}))},e.scroller)):(()=>{const s=e.noDataRender,a=h.createElement("div",{className:i.classNames(i.uDropDownsBase.noData({c:n}))},h.createElement("div",null,t.toLanguageString(P,z[P])));return s?s.call(void 0,a):a})()},V="undefined"!=typeof window&&/Firefox/.test(window.navigator.userAgent);let q=class{constructor(){this.table=null,this.total=0,this.enabled=!1,this.skip=0,this.pageSize=0,this.PageChange=null,this.scrollElement=null,this.listTransform="",this.itemHeight=0,this.containerHeight=0,this.reactVersion=Number.parseFloat(h.version),this.scrollSyncing=!1,this.lastLoaded=0,this.firstLoaded=0,this.lastScrollTop=0,this.listTranslate=0,this.list=null,this.container=null,this.calcScrollElementHeight=()=>{var e;this.scrollSyncing=!0;let t=!1;this.itemHeight=this.list?this.list.children[0].offsetHeight:this.itemHeight;const s=this.itemHeight*this.total-((null==(e=this.list)?void 0:e.offsetHeight)||0);this.containerHeight=V?Math.min(17895697,s):s;const i=this.containerHeight;return this.scrollElement&&(t=this.scrollElement.style.height!==i+"px",t&&(this.scrollElement.style.height=i+"px")),this.scrollSyncing=!1,t},this.scrollerRef=e=>{this.container=e,e&&(e.setAttribute("unselectable","on"),window.setTimeout(this.calcScrollElementHeight.bind(this),0))},this.getRowHeightService=i.memoizeOne(((e,t)=>new i.RowHeightService(t,e))),this.firstLoaded=this.pageSize,this.lastLoaded=this.skip+this.pageSize,this.scrollHandler=this.scrollHandler.bind(this)}get translate(){return this.listTranslate}translateTo(e,t){this.listTranslate=e,this.enabled&&this.list&&(V||this.reactVersion<=17||t?this.list.style.transform="translateY("+e+"px)":this.listTransform="translateY("+e+"px)")}changePage(e,t){const s=Math.min(Math.max(0,e),this.total-this.pageSize);s!==this.skip&&this.PageChange&&this.PageChange({skip:s,take:this.pageSize},t)}reset(){this.container&&(this.calcScrollElementHeight(),this.container.scrollTop=0,this.translateTo(0,!0))}scrollToEnd(){if(this.container&&this.list){this.calcScrollElementHeight();const{scrollHeight:e,offsetHeight:t}=this.container;this.container.scrollTop=e,this.translateTo(e-t,!0)}}scrollHandler(e){if(!this.enabled||!this.container||!this.list)return;if(this.scrollSyncing)return void(this.scrollSyncing=!1);this.rowHeightService=this.getRowHeightService(this.itemHeight,this.total);const t=this.container.scrollTop,s=this.lastScrollTop>=t,i=!s,n=Math.abs(t-this.lastScrollTop);this.lastScrollTop=t;let a=this.rowHeightService.index(t),o=this.rowHeightService.offset(a);const{offsetHeight:l}=this.container,r=this.rowHeightService.index(t+l);if(i&&r>=this.lastLoaded&&this.lastLoaded<this.total){const t=a+this.pageSize-this.total;t>0&&(a-=t,o=this.rowHeightService.offset(a)),this.firstLoaded=a,this.translateTo(o);const s=this.firstLoaded+this.pageSize;this.lastLoaded=Math.min(s,this.total),this.changePage(this.firstLoaded,e)}else if(s&&a-1<=this.firstLoaded){const t=n===this.itemHeight;if(0===this.skip&&t)this.lastScrollTop=0,this.firstLoaded=0,this.lastLoaded=this.pageSize,this.container.scrollTop=0,this.translateTo(0,!0);else{const t=Math.floor(.3*this.pageSize);this.firstLoaded=Math.max(a-t,0),this.translateTo(this.rowHeightService.offset(this.firstLoaded)),this.lastLoaded=Math.min(this.firstLoaded+this.pageSize,this.total),this.changePage(this.firstLoaded,e)}}}};class W{navigate(e){const t=e.keyCode;return t===i.Keys.up||t===i.Keys.left?this.next({current:e.current,min:e.min,max:e.max,step:e.skipItems?e.skipItems:-1}):t===i.Keys.down||t===i.Keys.right?this.next({current:e.current,min:e.min,max:e.max,step:e.skipItems?e.skipItems:1}):t===i.Keys.home?0:t===i.Keys.end?e.max:void 0}next(e){return f(e.current)?Math.min(e.max,Math.max(e.current+e.step,e.min)):e.min}}const A=class e{constructor(e){this.wrapper=null,this.list=null,this.vs=new q,this.navigation=new W,this.handleItemClick=(e,t)=>{const s=this.initState();s.syntheticEvent=t,t.stopPropagation(),this.component.handleItemSelect(e,s),this.togglePopup(s),this.applyState(s)},this.handleFocus=e=>{if(!this.component.state.focused){const t=this.initState();t.data.focused=!0,t.events.push({type:"onFocus"}),t.syntheticEvent=e,this.applyState(t)}},this.filterChanged=(e,t)=>{const{textField:s,filterable:i}=this.component.props;i&&t.events.push({type:"onFilterChange",filter:{field:s,operator:"contains",ignoreCase:!0,value:e}})},this.togglePopup=e=>{const t=this.component.props,s=void 0!==t.opened?t.opened:this.component.state.opened;void 0===t.opened&&(e.data.opened=!s),s?e.events.push({type:"onClose"}):(e.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(e,t)=>{const s=this.initState();s.syntheticEvent=t,this.triggerOnPageChange(s,e.skip,e.take),this.applyState(s)},this.scrollToVirtualItem=(e,t)=>{const s=this.vs;if(0===e.skip)s.reset();else{let i=s.translate;0===i&&(s.calcScrollElementHeight(),i=s.itemHeight*e.skip,s.translateTo(i,!0)),t<0&&i>0&&(i+=s.itemHeight*(e.pageSize/4)),s.container&&(s.container.scrollTop=i),this.scrollToItem(t,!0)}},this.scrollPopupByPageSize=e=>{var t,s,i,n,a,o;const l=this.vs,r=null==(s=null==(t=this.list)?void 0:t.parentElement)?void 0:s.scrollTop,d=l.enabled&&l.itemHeight?l.itemHeight:this.list?this.list.children[0].offsetHeight:0,u=null==(n=null==(i=this.list)?void 0:i.parentElement)?void 0:n.offsetHeight;void 0!==r&&void 0!==u&&(null==(o=null==(a=this.list)?void 0:a.parentElement)||o.scroll({top:r+e*Math.floor(u/d)*d}))},this.renderScrollElement=()=>{const e=this.vs;return e.enabled&&h.createElement("div",{ref:t=>{e.scrollElement=t},key:"scrollElementKey"})},this.resetGroupStickyHeader=(e,t)=>{e!==t.state.group&&t.setState({group:e})},this.listBoxId=e.props.id+"list",this.guid=e.props.id,this.component=e,this.vs.PageChange=this.pageChange}didUpdate(){this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="")}didMount(){const e=this.component.props,t=e.popupSettings||{},s=e.style||{},i=t.width;let n=!0===e.opened;void 0===i&&this.calculatePopupWidth(),void 0===e.dir&&void 0===s.direction&&(this.calculateDir(),n=!0),n&&this.component.forceUpdate()}calculateDir(){const e=this.component.element;e&&e.ownerDocument&&e.ownerDocument.defaultView&&(this.dirCalculated=e.ownerDocument.defaultView.getComputedStyle(e).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(e,t,s){const i=this.list||this.vs.list;if(!i&&!s&&setTimeout((()=>{this.scrollToItem(e,t,!0)}),10),0===e&&t&&0===this.vs.skip)this.vs.reset();else if(i&&e>=0){const s=this.vs,n=s.container||i.parentNode,a=void 0!==t?t:s.enabled;y(n,i,e,s.translate,a)}}updateComponentArgs(e){for(let t in e)Object.hasOwnProperty.call(e,t)&&(this.component[t]=e[t])}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(e){Object.keys(e.data).length>0&&this.component.setState(e.data);const t={syntheticEvent:e.syntheticEvent,nativeEvent:e.syntheticEvent?e.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};e.events.forEach((e=>{const s=e.type;delete e.type;const i=s&&this.component.props[s];i&&i.call(void 0,{...t,...e})}))}triggerOnPageChange(e,t,s){const i=this.component.props.virtual;if(i){const n=Math.min(Math.max(0,t),Math.max(0,i.total-s));n!==i.skip&&e.events.push({type:"onPageChange",page:{skip:n,take:s}})}}triggerPageChangeCornerItems(e,t){const s=this.component.props,{data:i=[],dataItemKey:n,virtual:a}=s,o=void 0!==s.opened?s.opened:this.component.state.opened;e&&a&&this.vs.enabled&&(a.skip>0&&w(e,i[0],n)?this.triggerOnPageChange(t,a.skip-1,a.pageSize):!o&&a.skip+a.pageSize<a.total&&w(e,i[i.length-1],n)&&this.triggerOnPageChange(t,a.skip+1,a.pageSize))}getPopupSettings(){return Object.assign({},e.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const e=this.getPopupSettings();return void 0===e.animate||e.animate}getGroupedDataModernMode(e,t){const s=[];return e.forEach(((i,n)=>{e[n-1]&&i[t]!==e[n-1][t]&&s.push({[t]:i[t]}),s.push(e[n])})),s}};A.basicPropTypes={opened:s.bool,disabled:s.bool,dir:s.string,tabIndex:s.number,accessKey:s.string,data:s.array,textField:s.string,className:s.string,label:s.string,loading:s.bool,popupSettings:s.shape({animate:s.oneOfType([s.bool,s.shape({openDuration:s.number,closeDuration:s.number})]),popupClass:s.string,className:s.string,appendTo:s.any,width:s.oneOfType([s.string,s.number]),height:s.oneOfType([s.string,s.number])}),onOpen:s.func,onClose:s.func,onFocus:s.func,onBlur:s.func,onChange:s.func,itemRender:s.func,listNoDataRender:s.func,focusedItemIndex:s.func,header:s.node,footer:s.node},A.propTypes={...A.basicPropTypes,value:s.any,defaultValue:s.any,filterable:s.bool,filter:s.string,virtual:s.shape({pageSize:s.number.isRequired,skip:s.number.isRequired,total:s.number.isRequired}),onFilterChange:s.func,onPageChange:s.func},A.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let U=A;const $={name:"@progress/kendo-react-dropdowns",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:1654528156,version:"11.1.0",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"},G=e=>{const{footer:t,windowWidth:s=0,mobileFilter:n,children:o,navigatable:l,navigatableElements:r,expand:p,animation:c,title:g,subTitle:v,onClose:m}=e,f=i.useAdaptiveModeContext(),b={navigatable:l||!1,navigatableElements:r||[],expand:p,animation:!1!==c,suffixActions:h.createElement(d.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",size:"large",themeColor:"primary",svgIcon:a.checkIcon,onClick:m}),filter:n,onClose:m,animationStyles:f&&s<=f.small?{top:0,width:"100%",height:"100%"}:void 0,title:g,subTitle:v,className:"k-adaptive-actionsheet",position:f&&s<=f.small?"fullscreen":void 0};return h.createElement(u.ActionSheet,{...b},o,t&&h.createElement(u.ActionSheetFooter,{className:"k-actions k-actions-stretched"},h.createElement(d.Button,{size:"large",tabIndex:0,"aria-label":t.cancelText,"aria-disabled":"false",type:"button",onClick:t.onCancel},t.cancelText),h.createElement(d.Button,{tabIndex:0,themeColor:"primary",size:"large","aria-label":t.applyText,"aria-disabled":"false",type:"button",onClick:t.onApply},t.applyText)))},j=h.forwardRef(((e,t)=>{let s=!1;const o=i.usePropsContext(Z,e),{delay:l=Y.delay,tabIndex:p=Y.tabIndex,ignoreCase:c=Y.ignoreCase,size:y=Y.size,rounded:x=Y.rounded,fillMode:k=Y.fillMode,groupMode:S=Y.groupMode}=o;if(o.filterable||o.virtual){const e=[];o.filterable&&e.push("filterable"),o.virtual&&e.push("virtualization"),s=!i.validatePackage($,{component:"DropDownList",features:e})}const E=i.useUnstyled(),D=i.useId(o.id),M=()=>{var e;if(i.canUseDOM)return(null==(e=ve.current)?void 0:e.ownerDocument)||window.document},N=()=>{var e,t;null!=(e=null==Ee?void 0:Ee.current)&&e.wrapper&&(null==(t=null==Ee?void 0:Ee.current)||t.wrapper.focus({preventScroll:!0}))},T=()=>{let e;return void 0!==xe.current&&null!==xe.current?e=xe.current:void 0!==o.value?e=o.value:void 0!==Me.value&&null!==Me.value?e=Me.value:void 0!==o.defaultValue&&null!==o.defaultValue&&(e=o.defaultValue),!f(e)&&void 0!==o.defaultItem&&null!==o.defaultItem&&(e=o.defaultItem),e},P=()=>void 0!==o.required?o.required:Y.required,R=()=>{const e=void 0!==o.validationMessage,t=T(),s=!P()||null!==t&&""!==t&&void 0!==t;return{customError:e,valid:void 0!==o.valid?o.valid:s,valueMissing:null===t}},O=e=>{Ce.current=!0,e.focus(),window.setTimeout((()=>Ce.current=!1),30)},B=()=>{fe.current&&O(fe.current),o.adaptive&&setTimeout((()=>{fe.current&&O(fe.current)}),300)},V=h.useCallback((e=>{for(const t of e)Te(t.target.clientWidth)}),[]),q=()=>{var e;null!=(e=me.current)&&e.setCustomValidity&&me.current.setCustomValidity(R().valid?"":o.validationMessage||"Please select a value from the list!")},W=(e,t)=>{const s=T();w(s,e,o.dataItemKey)||(void 0===o.value&&(t.data.value=e),Ee.current.updateComponentArgs({value:e}),xe.current=e,t.events.push({type:"onChange"}))},A=e=>{var t;null==(t=null==Ee?void 0:Ee.current)||t.applyState(e),xe.current=void 0},j=(e,t)=>{var s;const{virtual:i,dataItemKey:n,defaultItem:a}=o,l=F(o),r=i?i.skip:0,d=T(),u=-1===e&&void 0!==a?a:l[e-r],p=!w(u,d,n);W(u,t),p&&(null==(s=null==Ee?void 0:Ee.current)||s.triggerPageChangeCornerItems(u,t))},J=(e,t,s)=>{var i,n;const{defaultItem:a,dataItemKey:l,virtual:r={skip:0,total:0,pageSize:0}}=o,d=T(),u=F(o),p=null==(i=null==Ee?void 0:Ee.current)?void 0:i.vs,c=u.findIndex((e=>w(e,d,l))),h=null==(n=null==Ee?void 0:Ee.current)?void 0:n.navigation.navigate({current:r.skip+c,max:(null!=p&&p.enabled?r.total:u.length)-1,min:void 0!==a?-1:0,keyCode:t,skipItems:s||void 0});void 0!==h&&j(h,e),A(e)},Q=()=>{const{textField:e,dataItemKey:t,virtual:s={skip:0},focusedItemIndex:i=C,filterable:n,skipDisabledItems:a=!0}=o,l=T(),r=F(o),d=o.filter?o.filter:Me.text;return a&&e&&!d&&!l?r.findIndex((t=>!t.disabled&&t[e])):f(l)&&void 0===d||n&&""===d?r.findIndex((e=>w(e,l,t))):d?ke.current?i(r,d,e):r.findIndex((e=>w(e,l,t))):0===s.skip?0:-1},X=(e,t)=>void 0!==t&&-1!==t&&e&&e.length>0&&e[t].disabled,ee=()=>{const e=F(o),t=Ee.current.initState(),s=Q();X(e,s)&&(W(null,t),A(t))},te=e=>{if(e.isPropagationStopped())return;const t=Ee.current.initState();t.syntheticEvent=e,Me.focused||(t.data.focused=!0),ee(),Ee.current.togglePopup(t),A(t)},se=e=>{var t,s,n,a,l,r,d;e&&e.target instanceof Element&&"INPUT"===e.target.nodeName&&e.stopPropagation&&e.stopPropagation();const{filterable:u,disabled:p,defaultItem:c,leftRightKeysNavigation:h=!0,virtual:g={skip:0,total:0,pageSize:0},dataItemKey:v,groupField:m="",textField:f,skipDisabledItems:b=!0}=o,y=F(o),C=T(),x=y.findIndex((e=>w(e,C,v))),I=void 0!==o.opened?o.opened:Me.opened,k=e.keyCode,S=k===i.Keys.home||k===i.Keys.end,E=k===i.Keys.up||k===i.Keys.down,D=!I&&(e.altKey&&k===i.Keys.down||k===i.Keys.enter||k===i.Keys.space),M=I&&(e.altKey&&k===i.Keys.up||k===i.Keys.esc),K=h&&(k===i.Keys.left||k===i.Keys.right),N=E||K&&!u||S,P=Ee.current.initState();if(P.syntheticEvent=e,!p){if(S&&null!=(t=null==Ee?void 0:Ee.current)&&t.vs.enabled)k===i.Keys.home?0!==g.skip?(null==(s=null==Ee?void 0:Ee.current)||s.triggerOnPageChange(P,0,g.pageSize),Ie.current=!0):W(y[0],P):g.skip<g.total-g.pageSize?(null==(n=null==Ee?void 0:Ee.current)||n.triggerOnPageChange(P,g.total-g.pageSize,g.pageSize),Ie.current=!0):W(y[y.length-1],P);else if(I&&k===i.Keys.pageUp)e.preventDefault(),null==(a=null==Ee?void 0:Ee.current)||a.scrollPopupByPageSize(-1);else if(I&&k===i.Keys.pageDown)e.preventDefault(),null==(l=null==Ee?void 0:Ee.current)||l.scrollPopupByPageSize(1);else if(I&&k===i.Keys.enter){const t=Q();X(y,t)?(W(null,P),A(P)):j(t,P),null==(r=null==Ee?void 0:Ee.current)||r.togglePopup(P),e.preventDefault()}else if(D||M)M&&ee(),null==(d=null==Ee?void 0:Ee.current)||d.togglePopup(P),e.preventDefault();else if(N){if(ke.current=!1,""!==m&&f)if(!b&&I)J(P,k);else{let e;if(k===i.Keys.down||k===i.Keys.right){const t=y.slice(x+1).find((e=>!e.disabled&&e[f]));e=t&&y.findIndex((e=>e[f]===t[f]))}else if(k===i.Keys.up||k===i.Keys.left){let t;if(0===x&&c)e=-1;else if(-1===x)t=y,e=y.findIndex((e=>!e.disabled&&e[f]));else{t=y.slice(0,x);let s=t.pop();for(;s&&s.disabled;)s=t.pop();e=s&&y.findIndex((e=>e[f]===s[f]))}}if(void 0!==e){J(P,k,e-x)}else void 0===e&&y.findIndex((e=>e[f]===C[f]))===y.length-1&&J(P,k)}else if(!b&&I||S)J(P,k);else if(f){let e;if(k===i.Keys.down||k===i.Keys.right){const t=y.slice(x+1).find((e=>!e.disabled&&e[f]));e=t&&y.findIndex((e=>e[f]===t[f]))}else if(k===i.Keys.up||k===i.Keys.left){let t;if(0===x&&c)e=-1;else if(-1===x)t=y,e=y.find((e=>!e.disabled&&e[f]));else{t=y.slice(0,x);let s=t.pop();for(;s&&s.disabled;)s=t.pop();e=s&&y.findIndex((e=>e[f]===s[f]))}}if(void 0!==e){J(P,k,e-x)}else void 0===e&&y.findIndex((e=>e[f]===C[f]))===y.length-1&&J(P,k)}else J(P,k);e.preventDefault()}A(P)}},ie=e=>{const t=Ee.current.initState();t.syntheticEvent=e.syntheticEvent,void 0===o.filter&&(t.data.text=e.target.value),Ee.current.filterChanged(e.target.value,t),ke.current=!0,A(t),Oe({group:void 0,text:String(e.target.value)})},ne=e=>{const t=void 0!==o.filter?o.filter:Me.text;return o.filterable&&h.createElement(v,{value:t,ref:e=>{fe.current=e&&e.element},onChange:ie,onKeyDown:se,size:e?"large":y,rounded:x,fillMode:k,renderListFilterWrapper:!0,placeholder:Re.toLanguageString(_,z[_])})},ae=e=>{var t;const s=Ee.current.initState();s.syntheticEvent=e,null==(t=null==Ee?void 0:Ee.current)||t.togglePopup(s),W(o.defaultItem,s),A(s)},oe=(e,t)=>{var s;null==(s=null==Ee?void 0:Ee.current)||s.handleItemClick(e,t),xe.current=void 0},le=e=>{const{vs:t,list:s}=Ee.current;t.scrollHandler(e);const{groupField:i}=o;let n=F(o);if(i&&n.length&&i){const a=De.current=De.current||(t.enabled?t.itemHeight:s?s.children[0].offsetHeight:0),o=e.target.scrollTop-t.skip*a;n=Ee.current.getGroupedDataModernMode(n,i);let l=n[0][i];for(let e=1;e<n.length&&!(a*e>o);e++)n[e]&&n[e][i]&&(l=n[e][i]);l!==Me.group&&Oe({group:l})}},re=()=>{var e;const{textField:t,dataItemKey:s,virtual:n={skip:0,total:void 0},groupHeaderItemRender:a,listNoDataRender:l,itemRender:r}=o,d=F(o),u=E&&E.uDropDownList,p=Ee.current.vs,c=n.skip,g=void 0!==o.opened?o.opened:Me.opened,v=Ee.current.getPopupSettings(),m=`translateY(${p.translate}px)`,f=T();return h.createElement(H,{id:Le,show:g,data:d.slice(),focusedIndex:Q(),value:f,textField:t,valueField:s,optionsGuid:_e,groupField:o.groupField,groupMode:"modern",listRef:e=>{p.list=Ee.current.list=e},wrapperStyle:{maxHeight:ot?void 0:v.height},wrapperCssClass:i.classNames(i.uDropDownList.listContent({c:u})),listStyle:p.enabled?{transform:m}:void 0,key:"listkey",skip:c,onClick:oe,itemRender:r,groupHeaderItemRender:a,noDataRender:l,onScroll:le,wrapperRef:p.scrollerRef,scroller:null==(e=null==Ee?void 0:Ee.current)?void 0:e.renderScrollElement(),ariaSetSize:n.total})},de=()=>{Me.focused&&window.setTimeout((()=>{Me.focused&&Ee.current.wrapper&&O(Ee.current.wrapper)}))},ue=e=>{"onMouseDownOutside"in(o.popupSettings||{})&&o.popupSettings.onMouseDownOutside.call(void 0,e)},pe=()=>{const{header:e,footer:t,groupStickyHeaderItemRender:s,groupField:n,list:a}=o,l=F(o),r=E&&E.uDropDownList;let{group:d}=Me;return void 0===d&&void 0!==n&&(d=I(l[0],n)),h.createElement(h.Fragment,null,e&&h.createElement("div",{className:i.classNames(i.uDropDownList.listHeader({c:r}))},e),h.createElement("div",{className:i.classNames("k-list",{[`k-list-${ot?"lg":i.sizeMap[y]||y}`]:y})},!a&&d&&0!==l.length&&h.createElement(m,{group:d,groupMode:"modern",render:s}),re()),t&&h.createElement("div",{className:"k-list-footer"},t))},ce=e=>{clearTimeout(be.current),o.filterable||(be.current=window.setTimeout((()=>ye.current.word=""),l),(e=>{const{dataItemKey:t}=o,s=F(o),i=T();let n=s.map(((e,t)=>({item:e,itemIndex:t})));const a=ye.current.word,l=ye.current.last,r=((e,t)=>{for(let s=0;s<e.length;s++)if(e.charAt(s)!==t)return!1;return!0})(a,l);let d,u=n.length,p=Math.max(0,s.findIndex((e=>w(e,i,t))));o.defaultItem&&(d={item:o.defaultItem,itemIndex:-1},u+=1,p+=1),p+=r?1:0,n=((e,t,s)=>{let i=e;return s&&(i=[s].concat(i)),i.slice(t).concat(i.slice(0,t))})(n,p,d);let h,g,v,m=0;const{textField:f}=o;for(;m<u;){if(h=I(n[m].item,f),g=r&&b(h,l,c),v=b(h,a,c),g||v){m=n[m].itemIndex;break}m++}if(m!==u){const t=Ee.current.initState();t.syntheticEvent=e,j(m,t),A(t),xe.current=void 0}})(e))},he=()=>{const e=Ee.current.initState();e.data.opened=Me.opened,Ee.current.togglePopup(e),A(e)},ge=h.useRef(null),ve=h.useRef(null),me=h.useRef(null),fe=h.useRef(null);h.useImperativeHandle(ge,(()=>({get element(){return ve.current},get index(){return(()=>{const{dataItemKey:e}=o,t=F(o),s=T();return t.findIndex((t=>w(t,s,e)))})()},get name(){return o.name},get validity(){return R()},get value(){return T()},get focused(){return Me.focused},get opened(){return Me.opened},focus:N,props:o,togglePopup:he}))),h.useImperativeHandle(t,(()=>ge.current));const be=h.useRef(null),ye=h.useRef({word:"",last:""}),Ce=h.useRef(!1),xe=h.useRef(null),Ie=h.useRef(!1),ke=h.useRef(!1),we=h.useRef({}),Se=h.useRef({}),Ee=h.useRef(new U({props:o,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),De=h.useRef(0),Fe=h.useRef(null),[Me,Ke]=h.useState({}),[Ne,Te]=h.useState(),[,Pe]=h.useReducer((e=>e),!0),Re=r.useLocalization(),Oe=e=>{Ke({...Me,...e})};h.useEffect((()=>{Ee.current.updateComponentArgs({props:o,setState:Oe,state:Me,forceUpdate:Pe,element:ve.current,handleItemSelect:j,value:T()})}),[Oe,Me,Pe,j,T]),h.useEffect((()=>{var e,t,s,i,n,a,l,r,d,u,p,c,h;const{dataItemKey:g,virtual:v,groupField:m="",textField:f}=o,b=F(o),y=we.current.virtual?we.current.virtual.total:0,C=void 0!==o.opened?o.opened:Me.opened,x=void 0!==we.current.opened?we.current.opened:Se.current.opened,I=!x&&C;if(null==(e=null==Ee?void 0:Ee.current)||e.didUpdate(),null!=(t=null==Ee?void 0:Ee.current)&&t.getPopupSettings().animate||I&&B(),v&&v.total!==y)null==(s=null==Ee?void 0:Ee.current)||s.vs.calcScrollElementHeight(),null==(i=null==Ee?void 0:Ee.current)||i.vs.reset();else{const e=T(),t=void 0!==we.current.value?we.current.value:Se.current.value;let s=b.findIndex((t=>w(t,e,g)));""!==m&&e&&f&&(s=null==(a=null==(n=null==Ee?void 0:Ee.current)?void 0:n.getGroupedDataModernMode(b,m))?void 0:a.map((e=>e[f])).indexOf(e[f]));const i=!w(t,e,g);I&&v?null==(l=null==Ee?void 0:Ee.current)||l.scrollToVirtualItem(v,s):I&&!v?(B(),b&&0!==b.length&&(null==(r=null==Ee?void 0:Ee.current)||r.resetGroupStickyHeader(b[0][m],{setState:Oe,group:Me.group,state:Me})),null==(d=null==Ee?void 0:Ee.current)||d.scrollToItem(s)):C&&x&&e&&i&&!Ie.current?null==(p=null==Ee?void 0:Ee.current)||p.scrollToItem(s,null==(u=null==Ee?void 0:Ee.current)?void 0:u.vs.enabled):C&&x&&Ie.current&&(Ie.current&&v&&0===v.skip?null==(c=null==Ee?void 0:Ee.current)||c.vs.reset():Ie.current&&v&&v.skip===v.total-v.pageSize&&(null==(h=null==Ee?void 0:Ee.current)||h.vs.scrollToEnd()))}Ie.current=!1,Se.current=Me,we.current=o,q()})),h.useEffect((()=>{var e,t;return Fe.current=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(V.bind(void 0)),null==(e=null==Ee?void 0:Ee.current)||e.didMount(),q(),null!=(t=M())&&t.body&&Fe.current&&Fe.current.observe(M().body),()=>{var e;null!=(e=M())&&e.body&&Fe.current&&Fe.current.disconnect()}}),[]);const Be=D+"-accessibility-id",Le=D+"-listbox-id",_e=D+"-guid",ze=Re.toLanguageString(L,z[L]),{style:He,className:Ve,label:qe,dir:We,virtual:Ae,adaptive:Ue,dataItemKey:$e,disabled:Ge,loading:je,iconClassName:Ye,svgIcon:Ze,valueRender:Je}=o,Qe=void 0!==o.opened?o.opened:Me.opened,Xe=T(),et=I(Xe,o.textField),tt=!(void 0!==o.validityStyles?o.validityStyles:Y.validityStyles)||R().valid,st=Ee.current,it=st.vs,nt=E&&E.uDropDownList;it.enabled=void 0!==Ae;const at=i.useAdaptiveModeContext(),ot=!!(Ne&&at&&Ne<=at.medium&&o.adaptive);void 0!==Ae&&(st.vs.skip=Ae.skip,st.vs.total=Ae.total,st.vs.pageSize=Ae.pageSize);const lt=F(o),{focused:rt}=Me,dt=lt.findIndex((e=>w(e,Xe,$e))),ut=h.createElement("span",{id:Be,className:i.classNames(i.uDropDownList.inputInner({c:nt}))},et&&h.createElement("span",{className:i.classNames(i.uDropDownList.inputText({c:nt}))},et)),pt=void 0!==Je?Je.call(void 0,ut,Xe):ut,ct=h.createElement(h.Fragment,null,h.createElement("span",{ref:e=>{ve.current=e,Ee.current.wrapper=e},className:i.classNames(i.uDropDownList.wrapper({c:nt,size:y,rounded:x,fillMode:k,focused:rt,disabled:Ge,invalid:!tt,loading:je,required:P()}),Ve),style:qe?{...He,width:void 0}:He,dir:We,onMouseDown:Qe?e=>{"INPUT"!==e.target.nodeName&&(O(Ee.current.wrapper),e.preventDefault())}:void 0,onFocus:ot?e=>te(e):e=>{Ce.current||Ee.current.handleFocus(e)},onBlur:e=>{if(Ce.current||!Me.focused)return;const t=void 0!==o.opened?o.opened:Me.opened,s=Ee.current.initState();s.syntheticEvent=e,s.data.focused=!1,s.events.push({type:"onBlur"}),t&&ee(),t&&!ot&&Ee.current.togglePopup(s),A(s)},tabIndex:i.getTabIndex(p,Ge),accessKey:o.accessKey,onKeyDown:se,onKeyPress:e=>{if(o.filterable||0===e.which||e.keyCode===i.Keys.enter)return;let t=String.fromCharCode(e.charCode||e.keyCode);c&&(t=t.toLowerCase())," "===t&&e.preventDefault(),ye.current={word:ye.current.word+t,last:ye.current.last+t},ce(e)},onClick:Ge?void 0:te,role:"combobox","aria-required":P(),"aria-disabled":Ge||void 0,"aria-haspopup":"listbox","aria-expanded":Qe||!1,"aria-owns":Le,"aria-activedescendant":Qe?"option-"+_e+"-"+(dt+(Ae?Ae.skip:0)):void 0,"aria-label":o.ariaLabel||o.label,"aria-labelledby":o.ariaLabelledBy,"aria-describedby":o.ariaDescribedBy||Be,"aria-controls":Le,id:o.id,title:o.title},pt,je&&h.createElement(i.IconWrap,{className:i.classNames(i.uDropDownList.loadingIcon({c:nt})),name:"loading"}),h.createElement(d.Button,{tabIndex:-1,type:"button","aria-label":ze,size:y,fillMode:k,className:i.classNames(i.uDropDownList.inputButton({c:nt})),rounded:null,themeColor:"base",iconClass:Ye,svgIcon:Ye?void 0:Ze||a.caretAltDownIcon,onMouseDown:e=>Me.focused&&e.preventDefault()}),(e=>h.createElement("select",{name:o.name,ref:e=>{me.current=e},tabIndex:-1,"aria-hidden":!0,title:o.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},h.createElement("option",{value:o.valueMap?o.valueMap.call(void 0,e):e})))(Xe),!ot&&(()=>{const{header:e,footer:t,dir:n,groupField:a,groupStickyHeaderItemRender:l,list:r}=o,d=F(o),u=Ee.current,p=u.getPopupSettings(),c=void 0!==o.opened?o.opened:Me.opened,v=void 0!==p.width?p.width:u.popupWidth,f=E&&E.uDropDownList,b={dir:void 0!==n?n:u.dirCalculated,width:v,popupSettings:{...p,popupClass:i.classNames(p.popupClass,i.uDropDownList.listContainer({c:f,popup:!0})),anchor:p.anchor||ve.current,show:c,onOpen:B,onClose:de,onMouseDownOutside:ue},itemsCount:[d.length]};let{group:C}=Me;return void 0===C&&void 0!==a&&(C=I(d[0],a)),h.createElement(g,{...b},ne(!1),e&&h.createElement("div",{className:i.classNames(i.uDropDownList.listHeader({c:f}))},e),h.createElement("div",{className:i.classNames(i.uDropDownList.list({c:f,size:y,virtual:Ee.current.vs.enabled}))},(()=>{const{textField:e,defaultItem:t,dataItemKey:s}=o,i=T();return void 0!==t&&h.createElement(K,{defaultItem:t,textField:e,selected:w(i,t,s),key:"defaultitemkey",onClick:ae})})(),!r&&C&&0!==d.length&&h.createElement(m,{group:C,groupMode:"modern",render:l}),re()),t&&h.createElement("div",{className:i.classNames(i.uDropDownList.listFooter({c:f}))},t),s&&h.createElement(i.WatermarkOverlay,null))})()),ot&&(()=>{const{groupField:e}=o,t=F(o),s=void 0!==o.opened?o.opened:Me.opened,n=E&&E.uDropDownList,a={title:o.adaptiveTitle||o.label,subTitle:o.adaptiveSubtitle,expand:s,onClose:e=>te(e),windowWidth:Ne,mobileFilter:ne(!0)};let{group:l}=Me;return void 0===l&&void 0!==e&&(l=I(t[0],e)),h.createElement(G,{...a},h.createElement(u.ActionSheetContent,null,h.createElement("div",{className:i.classNames(i.uDropDownList.listContainer({c:n,popup:!1}))},pe())))})());return qe?h.createElement(n.FloatingLabel,{label:qe,editorValue:et,editorValid:tt,editorDisabled:o.disabled,style:{width:He?He.width:void 0},children:ct}):ct}));j.propTypes={delay:s.number,ignoreCase:s.bool,iconClassName:s.string,svgIcon:i.svgIconPropType,defaultItem:s.any,valueRender:s.func,valueMap:s.func,validationMessage:s.string,required:s.bool,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,ariaLabel:s.string,leftRightKeysNavigation:s.bool,title:s.string,groupField:s.string,list:s.any,skipDisabledItems:s.bool};const Y={delay:500,tabIndex:0,ignoreCase:!0,...U.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};j.displayName="KendoReactDropDownList";const Z=i.createPropsContext();j.displayName="KendoReactDropDownList";let J=class extends h.Component{constructor(){super(...arguments),this._input=null}get input(){return this._input}componentDidUpdate(e){const t=e.value,s=e.suggestedText,{value:n,suggestedText:a,focused:o}=this.props,l=this.input,r=t!==n||a!==s,d=r&&t.startsWith(n)&&!(s&&a&&s.endsWith(a)),u=i.getActiveElement(document);o&&l&&u!==l&&l.focus(),a&&r&&!d&&l&&l.setSelectionRange(n.length-a.length,n.length)}render(){const{expanded:e=!1,disabled:t,role:s="listbox",render:n,tabIndex:a,accessKey:o,unstyled:l,inputAttributes:r}=this.props,d=l&&l.uDropDownsBase,u={tabIndex:a,accessKey:o},p=h.createElement("input",{autoComplete:"off",id:this.props.id,type:"text",key:"searchbar",size:this.props.size,placeholder:this.props.placeholder,className:i.classNames(i.uDropDownsBase.inputInner({c:d})),role:s,name:this.props.name,value:this.props.value,onChange:this.props.onChange,ref:e=>{this._input=e},onKeyDown:this.props.onKeyDown,onFocus:this.props.onFocus,onBlur:this.props.onBlur,onClick:this.props.onClick,"aria-disabled":t||void 0,disabled:t||void 0,readOnly:this.props.readOnly||void 0,title:this.props.title,"aria-haspopup":"listbox","aria-expanded":e,"aria-owns":this.props.owns,"aria-activedescendant":e?this.props.activedescendant:void 0,"aria-describedby":this.props.ariaDescribedBy,"aria-labelledby":this.props.ariaLabelledBy,"aria-label":this.props.ariaLabel,"aria-required":this.props.ariaRequired,"aria-controls":this.props.ariaControls,...Object.assign({},u,r)});return n?n.call(void 0,p):p}};const Q=e=>{const t=r.useLocalization(),s=i.useUnstyled(),n=s&&s.uDropDownsBase,o=t.toLanguageString(R,z[R]);return h.createElement("span",{className:i.classNames(i.uDropDownsBase.clearButton({c:n})),role:"button",onClick:e.onClick,onMouseDown:e=>e.preventDefault(),tabIndex:-1,title:o,key:"clearbutton"},h.createElement(i.IconWrap,{name:"x",icon:a.xIcon}))},X=i.useCustomComponent,ee=class e extends h.Component{constructor(e){super(e),this.state={},this.base=new U(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this._skipFocus=!1,this.itemHeight=0,this.duplicates=[],this.hasDuplicates=!1,this.showLicenseWatermark=!1,this.focus=()=>{this._input&&this._input.focus()},this.checkForDuplicatePlainTextRecords=()=>{const e=void 0!==this.props.textField,t=void 0!==this.props.dataItemKey;if(this.props.data&&this.props.data.length>0&&!e&&!t){const e=this.props.data;this.duplicates=(e=>{const t=e.filter(((t,s)=>e.some(((e,i)=>e===t&&i!==s))));return Array.from(new Set(t))})(e),this.hasDuplicates=this.duplicates.length>0}},this.handleItemSelect=(e,t)=>{const{virtual:s,dataItemKey:i}=this.props,n=F(this.props)[e-(s?s.skip:0)],a=this.hasDuplicates||!w(n,this.value,i);this.triggerOnChange(n,t),void 0!==this.state.text&&(t.data.text=void 0),a&&this.base.triggerPageChangeCornerItems(n,t)},this.onPopupOpened=()=>{setTimeout((()=>{this.mobileMode&&this._adaptiveFilterInput&&(this._skipBlur=!0,this._adaptiveFilterInput.focus(),this._skipBlur=!1)}),300)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.toggleBtnClick=e=>{this._skipFocus=!0;const{skipDisabledItems:t,textField:s}=this.props,i=F(this.props),n=this.getFocusedIndex(),a=this.getCurrentValueDisabledStatus(s,i,n),o=void 0!==this.props.opened?this.props.opened:this.state.opened,l=this.base.initState();if(l.syntheticEvent=e,!t&&s&&a&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(l),!o&&this.mobileMode){const e=void 0!==this.props.adaptiveFilter?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(e,l)}this.applyState(l),setTimeout((()=>{this._skipFocus=!1}),300)},this.closeOpenedApplyStateNonMobileMode=(e,t)=>{t&&!this.mobileMode&&this.base.togglePopup(e)},this.renderMobileListFilter=()=>{const e=void 0!==this.props.adaptiveFilter?this.props.adaptiveFilter:this.state.text,t=I(this.value,this.props.textField),s=f(e)?e:t;return h.createElement(v,{value:s,ref:e=>{this._adaptiveFilterInput=e&&e.element},onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode,placeholder:this.props.placeholder})},this.listContainerContent=()=>{const{header:e,footer:t,size:s,groupStickyHeaderItemRender:n,groupField:a,list:o,groupMode:l,unstyled:r,virtual:d}=this.props,u=F(this.props),p=r&&r.uComboBox;let{group:c}=this.state;return void 0===c&&void 0!==a&&(c=I(u[0],a)),h.createElement("div",{className:i.classNames(i.uComboBox.list({c:p,list:o,size:"large",tableSize:s,virtual:d}))},e&&h.createElement("div",{className:i.classNames(i.uComboBox.listHeader({c:p}))},e),!o&&c&&0!==u.length&&h.createElement(m,{group:c,groupMode:l,render:n}),this.renderList(),t&&h.createElement("div",{className:i.classNames(i.uComboBox.listFooter({c:p}),this.props.footerClassName)},t))},this.handleMobileFilterChange=e=>{const t=this.base.initState();t.syntheticEvent=e.syntheticEvent,t.data.text=e.target.value,this.base.filterChanged(e.target.value,t),this.applyState(t)},this.onScroll=e=>{const{vs:t,list:s}=this.base;t.scrollHandler(e);const{groupField:i}=this.props;let n=F(this.props);if(!i||!n.length)return;const a=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:s?s.children[0].offsetHeight:0),o=e.target.scrollTop-t.skip*a;"modern"===this.props.groupMode&&(n=this.base.getGroupedDataModernMode(n,i));let l=n[0][i];for(let e=1;e<n.length&&!(a*e>o);e++)n[e]&&n[e][i]&&(l=n[e][i]);l!==this.state.group&&(this.setState({group:l}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:l}))},this.handleItemClick=(e,t)=>{this.navigationIndex=e,this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.handleBlur=e=>{if(this.state.focused&&!this._skipBlur){const t=this.base.initState(),{textField:s}=this.props,i=F(this.props),n=this.getFocusedIndex(),a=!(-1===n)&&this.getCurrentValueDisabledStatus(s,i,n);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,s&&a&&this.clearValueOnBlur(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,t)}},this.onInputClick=e=>{const t=void 0!==this.props.opened?this.props.opened:this.state.opened,s=void 0!==this.props.adaptiveFilter?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const t=this.base.initState();t.syntheticEvent=e,this.base.togglePopup(t),this.base.filterChanged(s,t),this.applyState(t)}},this.onInputKeyDown=e=>{const{skipDisabledItems:t,textField:s,dataItemKey:n,groupField:a}=this.props,o=F(this.props),l=this.value,r=Math.max(0,o.findIndex((e=>w(e,l,n)))),d=e.keyCode,u=void 0!==this.props.opened?this.props.opened:this.state.opened,p=this.base.initState();if(p.syntheticEvent=e,!e.altKey&&(d===i.Keys.up||d===i.Keys.down)){if(e.preventDefault(),""!==a&&s)if(!this.props.skipDisabledItems&&u)this.onNavigate(p,d);else{let e=0;if(d===i.Keys.down||d===i.Keys.right){const t=o.slice(r+1<o.length?r+1:r).find((e=>!e.disabled&&e[s]));e=t&&o.findIndex((e=>e[s]===t[s]))}else if(d===i.Keys.up||d===i.Keys.left){let t;if(0===r)t=o,e=o.findIndex((e=>!e.disabled&&e[s]));else{t=o.slice(0,r);let i=t.pop();for(;i&&i.disabled;)i=t.pop();e=i&&o.findIndex((e=>e[s]===i[s]))}}if(void 0!==e){const t=e-r;this.onNavigate(p,d,t)}else void 0===e&&o.findIndex((e=>e[s]===l[s]))===o.length-1&&this.onNavigate(p,d)}else if(!this.props.skipDisabledItems&&u)this.onNavigate(p,d);else{let e=null;if(d===i.Keys.down||d===i.Keys.right)e=o.slice(r+1).find((e=>!e.disabled));else if(d===i.Keys.up||d===i.Keys.left){const t=o.slice(0,r);for(e=t.pop();e&&e.disabled;)e=t.pop()}if(e){const t=e.id-r-1;this.onNavigate(p,d,t)}else this.onNavigate(p,d)}this.applyState(p)}const c=()=>{e.preventDefault(),this.base.togglePopup(p),this.applyState(p)},h=this.getFocusedIndex(),g=-1===h,v=!g&&this.getCurrentValueDisabledStatus(s,o,h);u?d===i.Keys.pageUp?(e.preventDefault(),this.base.scrollPopupByPageSize(-1)):d===i.Keys.pageDown?(e.preventDefault(),this.base.scrollPopupByPageSize(1)):e.altKey&&d===i.Keys.up?c():d===i.Keys.enter?(e.preventDefault(),(s&&!g&&e.currentTarget.value?o[h][s]:void 0)?!t&&s&&v?this.clearValueOnEnterOrEsc(e):v||this.applyValueOnEnter(e.currentTarget.value,p):this.applyValueOnEnter(e.currentTarget.value,p)):d===i.Keys.esc&&(!t&&s&&v&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,p)):u||d!==i.Keys.esc?e.altKey&&d===i.Keys.down&&c():this.clearValueOnEnterOrEsc(e)},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const s=void 0!==this.props.opened?this.props.opened:this.state.opened,i=e.currentTarget,n=i.value;if(this.props.suggest){const e=i.selectionEnd===n.length;let t=void 0!==this.props.filter?this.props.filter:this.state.text;f(t)||(t=I(this.value,this.props.textField)||"");const s=t&&t===n,a=t&&t.length>n.length;s||a||!e?this._suggested="":this.suggestValue(n)}void 0===this.props.filter&&(t.data.text=n),void 0!==this.state.focusedItem&&(t.data.focusedItem=void 0),s||this.base.togglePopup(t),this.base.filterChanged(n,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{this.base.initState().syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnEnterOrEsc=e=>{this.base.initState().syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnBlur=e=>{this.base.initState().syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnToggleBtnClick=e=>{this.base.initState().syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||"Please enter a valid value!")},this.handleFocus=e=>{if(this._skipFocus)return;const t=this.base.initState();t.syntheticEvent=e,this.mobileMode&&!this._skipFocus&&(this._skipFocus=!0,this.base.togglePopup(t),this.applyState(t),setTimeout((()=>{this._skipFocus=!1}),300)),this.base.handleFocus(e)},this.showLicenseWatermark=!i.validatePackage($,{component:"ComboBox"})}get _inputId(){return this.props.id}get document(){if(i.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=(null==(e=this.props._adaptiveMode)?void 0:e.medium)&&this.props.adaptive)}get value(){return void 0!==this._valueDuringOnChange?this._valueDuringOnChange:void 0!==this.props.value?this.props.value:void 0!==this.state.value?this.state.value:void 0!==this.props.defaultValue?this.props.defaultValue:void 0}get index(){const{dataItemKey:e}=this.props,t=F(this.props),s=this.value;return t.findIndex((t=>w(t,s,e)))}get name(){return this.props.name}get validity(){const e=void 0!==this.props.validationMessage,t=!this.required||null!==this.value&&""!==this.value&&void 0!==this.value;return{customError:e,valid:void 0!==this.props.valid?this.props.valid:t,valueMissing:null===this.value}}get validityStyles(){return void 0!==this.props.validityStyles?this.props.validityStyles:e.defaultProps.validityStyles}get required(){return void 0!==this.props.required?this.props.required:e.defaultProps.required}componentDidUpdate(e,t){var s;const{dataItemKey:i,virtual:n,groupField:a="",textField:o}=this.props,l=F(this.props),r=e.virtual?e.virtual.total:0,d=void 0!==this.props.opened?this.props.opened:this.state.opened,u=void 0!==e.opened?e.opened:t.opened;e.data!==l&&this.checkForDuplicatePlainTextRecords();const p=!u&&d,c=this.value;if(this._valueOnDidUpdate=c,this.base.didUpdate(),n&&n.total!==r)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const r=void 0!==e.value?e.value:t.value;let h=this.hasDuplicates?this.navigationIndex||0:l.findIndex((e=>w(e,c,i)));"modern"===this.props.groupMode&&o&&c&&(h=null==(s=this.base.getGroupedDataModernMode(l,a))?void 0:s.map((e=>e[o])).indexOf(c[o]));const g=!w(r,c,i);p&&n?this.base.scrollToVirtualItem(n,h):p&&!n?(this.onPopupOpened(),l&&0!==l.length&&this.base.resetGroupStickyHeader(l[0][a],this),this.base.scrollToItem(h)):(this.hasDuplicates||d&&u&&c&&g)&&this.base.scrollToItem(h)}p&&this._input&&this._input.focus(),this.setValidity()}componentDidMount(){var e;this.observerResize=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),null!=(e=this.document)&&e.body&&this.observerResize&&this.observerResize.observe(this.document.body),this.checkForDuplicatePlainTextRecords()}componentWillUnmount(){var e;null!=(e=this.document)&&e.body&&this.observerResize&&this.observerResize.disconnect()}render(){const t=r.provideLocalizationService(this).toLanguageString(O,z[O]),s=r.provideLocalizationService(this).toLanguageString(B,z[B]),{dir:o,disabled:l,clearButton:u=e.defaultProps.clearButton,label:p,textField:c,className:g,style:v,loading:m,iconClassName:b,virtual:y,size:C,rounded:x,fillMode:k,opened:w=this.state.opened,placeholder:S,svgIcon:E,unstyled:D}=this.props,F=!this.validityStyles||this.validity.valid,M=void 0!==this.props.filter?this.props.filter:this.state.text,K=I(this.value,c),N=f(M)?M:K,T=u&&(!!N||f(this.value)),P=this.base.vs,R=this.props.id||this._inputId,L=D&&D.uComboBox;P.enabled=void 0!==y,void 0!==y&&(P.skip=y.skip,P.total=y.total,P.pageSize=y.pageSize);const[_,H]=X(this.props.prefix||h.Fragment),[V,q]=X(this.props.suffix||h.Fragment),W=h.createElement(h.Fragment,null,h.createElement("span",{className:i.classNames(i.uComboBox.wrapper({c:L,size:C,rounded:x,fillMode:k,disabled:l,invalid:!F,loading:m,required:this.required}),g),ref:this.componentRef,style:p?{...v,width:void 0}:v,dir:o,onFocus:this.handleFocus},this.props.prefix&&h.createElement(_,{...H}),this.renderSearchBar(N||"",R,S),T&&!m&&h.createElement(Q,{onClick:this.clearButtonClick,