@progress/kendo-react-dropdowns 8.3.0-develop.9 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),f=require("prop-types"),q=require("../common/SearchBar.js"),E=require("../common/ListContainer.js"),T=require("../common/List.js"),k=require("../common/DropDownBase.js"),N=require("../common/GroupStickyHeader.js"),g=require("../common/utils.js"),l=require("@progress/kendo-react-common"),L=require("@progress/kendo-react-labels"),R=require("../package-metadata.js"),H=require("../common/ClearButton.js"),F=require("../common/withCustomComponent.js");function z(x){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const e in x)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(x,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>x[e]})}}return a.default=x,Object.freeze(a)}const I=z(B),A="Please enter a valid value!",{sizeMap:_,roundedMap:G}=l.kendoThemeMaps,b=class b extends I.Component{constructor(a){super(a),this.state={},this.base=new k(this),this._element=null,this._suggested="",this._input=null,this._isScrolling=!1,this.itemHeight=0,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,s)=>{const i=g.getFilteredData(this.props),t=g.getItemValue(i[e],this.props.textField);this.triggerOnChange(t,s)},this.itemFocus=(e,s)=>{const{textField:i}=this.props,o=g.getFilteredData(this.props)[e];g.areSame(this.state.focusedItem,o,i)||(s.data.focusedItem=o)},this.togglePopup=e=>{this.base.togglePopup(e)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||A)},this.onScroll=e=>{this._isScrolling=!0;const{list:s}=this.base,{groupField:i}=this.props;let t=g.getFilteredData(this.props);if(!i||!t.length)return;const o=this.itemHeight||(s?s.children[0].offsetHeight:0),p=e.target.scrollTop;i&&(t=this.base.getGroupedDataModernMode(t,i));let n=t[0][i];for(let r=1;r<t.length&&!(o*r>p);r++)t[r]&&t[r][i]&&(n=t[r][i]);n!==this.state.group&&this.setState({group:n})},this.handleItemClick=(e,s)=>{this.base.handleItemClick(e,s),this._valueDuringOnChange=void 0},this.onChangeHandler=e=>{const i=this.base.initState(),t=e.currentTarget,o=t.value,d=t.selectionEnd===o.length;i.syntheticEvent=e;const p=this._suggested,n=this.value,r=n&&n.substring(0,n.length-p.length),v=r&&r===o,h=r&&r.length>o.length,{suggest:m}=this.props,u=this.props.opened!==void 0?this.props.opened:this.state.opened;if(m!==void 0&&m!==!1){v||h||!d?this._suggested="":this.suggestValue(o);const c=o+this._suggested,y={userInput:o,value:this._suggested};this.triggerOnChange(c,i,{suggestion:y})}else this._suggested="",this.triggerOnChange(o,i);(!u&&o||u&&!o)&&this.togglePopup(i),i.data.focusedItem=void 0,this.applyState(i),this.setState({group:void 0})},this.clearButtonClick=e=>{const i=this.base.initState(),t=this.props.opened!==void 0?this.props.opened:this.state.opened;i.syntheticEvent=e;const o="";this._suggested="",this.triggerOnChange(o,i),this.state.focusedItem!==void 0&&(i.data.focusedItem=void 0),t&&this.togglePopup(i),this.applyState(i)},this.onInputKeyDown=e=>{const{skipDisabledItems:s,groupField:i,textField:t}=this.props,o=g.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const d=this.focusedIndex(),p=o[d],n=e.keyCode,r=e.altKey,v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=this.base.initState();h.syntheticEvent=e;const m=()=>{v&&e.preventDefault()};if(r&&n===l.Keys.down)this.setState({opened:!0});else if(r&&n===l.Keys.up)this.setState({opened:!1});else if(v&&n===l.Keys.pageUp)m(),this.base.scrollPopupByPageSize(-1);else if(v&&n===l.Keys.pageDown)m(),this.base.scrollPopupByPageSize(1);else if(v&&(n===l.Keys.enter||n===l.Keys.esc))m(),s===!1&&p&&p.disabled?(v&&this.togglePopup(h),this.applyState(h)):this.applyInputValue(e.currentTarget.value,h,e.keyCode);else if(!v&&n===l.Keys.esc){const u="";this._suggested="",this.triggerOnChange(u,h),this.state.focusedItem!==void 0&&(h.data.focusedItem=void 0),this.applyState(h)}else if(n===l.Keys.up||n===l.Keys.down){if(i!==""&&t)if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=0;if(n===l.Keys.down||n===l.Keys.right){const c=o.slice(d+1).find(y=>!y.disabled&&y[t]);u=c&&o.findIndex(y=>y[t]===c[t])}else if(n===l.Keys.up||n===l.Keys.left){let c;if(d===-1)c=o,u=o.findIndex(y=>!y.disabled&&y[t]);else{c=o.slice(0,d);let y=c.pop();for(;y&&y.disabled;)y=c.pop();u=y&&o.findIndex(C=>C[t]===y[t])}}if(u!==void 0){const c=u-d;this.onNavigate(h,n,c)}else u===void 0&&o.findIndex(c=>c[t])===o.length-1&&this.onNavigate(h,n)}else if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=null;if(n===l.Keys.down||n===l.Keys.right)u=o.slice(d+1).find(c=>!c.disabled);else if(n===l.Keys.up||n===l.Keys.left){const c=o.slice(0,d);for(u=c.pop();u&&u.disabled;)u=c.pop()}if(u){const c=u.id-d-1;this.onNavigate(h,n,c)}else this.onNavigate(h,n)}this.applyState(h),m()}},this.handleBlur=e=>{if(this.state.focused){const s=this.base.initState();s.data.focused=!1,s.events.push({type:"onBlur"}),s.syntheticEvent=e,this.applyInputValue(e.currentTarget.value,s)}},l.validatePackage(R.packageMetadata)}get _inputId(){return this.props.id+"-accessibility-id"}get element(){return this._element}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get name(){return this.props.name}get validity(){const a=this.props.validationMessage!==void 0,e=!this.required||this.value!=="",s=this.props.valid!==void 0?this.props.valid:e;return{customError:a,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:b.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:b.defaultProps.required}componentDidUpdate(a,e){var m;const{groupField:s=""}=this.props,i=g.getFilteredData(this.props),{data:t=[]}=a,o=this.focusedIndex(),d=i[o],p=t!==i,n=d!==void 0&&e.focusedItem!==d,r=this.props.opened!==void 0?this.props.opened:this.state.opened,v=a.opened!==void 0?a.opened:e.opened,h=!v&&r;if(s==="")(r&&(n||p)||h)&&this.base.scrollToItem(o);else if(!this._isScrolling){const u=(m=this.base.getGroupedDataModernMode(i,s))==null?void 0:m.indexOf(d);h&&(i&&i.length!==0&&this.base.resetGroupStickyHeader(i[0][s],this),this.base.scrollToItem(u)),r&&v&&n&&this.base.scrollToItem(u)}this.setValidity()}componentDidMount(){this.base.didMount(),this.setValidity()}render(){const{dir:a,disabled:e,label:s,className:i,style:t,loading:o,suggest:d,size:p,rounded:n,fillMode:r}=this.props,v=!this.validityStyles||this.validity.valid,h=this.base,m=this.value,u=this.props.clearButton!==!1&&!o&&!!m,c=this.props.id||this._inputId,y=this.state.focused;typeof d=="string"&&(this._suggested=d);const[C,K]=F(this.props.prefix||I.Fragment),[V,M]=F(this.props.suffix||I.Fragment),D=I.createElement("span",{className:l.classNames("k-autocomplete k-input",i,{[`k-input-${_[p]||p}`]:p,[`k-rounded-${G[n]||n}`]:n,[`k-input-${r}`]:r,"k-invalid":!v,"k-focus":y&&!e,"k-loading":o,"k-required":this.required,"k-disabled":e}),ref:w=>{this._element=w,h.wrapper=w},style:s?{...t,width:void 0}:t,dir:a},this.props.prefix&&I.createElement(C,{...K}),this.renderSearchBar(m||"",c),o&&I.createElement(l.IconWrap,{className:"k-input-loading-icon",name:"loading"}),u&&!o&&I.createElement(H,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&I.createElement(V,{...M}),this.renderListContainer());return s?I.createElement(L.FloatingLabel,{label:s,editorId:c,editorValue:m,editorValid:v,editorDisabled:e,style:{width:t?t.width:void 0},children:D}):D}onNavigate(a,e,s){const i=this.value,{textField:t,focusedItemIndex:o}=this.props,d=g.getFilteredData(this.props),p=this.state.focusedItem!==void 0?d.findIndex(r=>g.areSame(r,this.state.focusedItem,t)):o?o(d,i,t):d.indexOf(g.getFocusedItem(d,i,t)),n=this.base.navigation.navigate({keyCode:e,current:p,max:d.length-1,min:0,skipItems:s||void 0});n!==void 0&&this.itemFocus(n,a),this.applyState(a)}applyInputValue(a,e,s){const i=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:t}=this.props,o=g.getFilteredData(this.props),d=this.focusedIndex(),p=o[d];if(this._suggested="",i&&s===l.Keys.enter&&p&&!p.disabled){const n=g.getItemValue(o[this.focusedIndex(a)],t);this.triggerOnChange(n,e)}i&&this.togglePopup(e),this.applyState(e)}renderSearchBar(a,e){const s=this.base,{placeholder:i,tabIndex:t,disabled:o,readonly:d}=this.props,{focused:p}=this.state,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(q,{id:e,placeholder:i,tabIndex:t,accessKey:this.props.accessKey,value:a,suggestedText:this._suggested,focused:p,name:this.props.name,ref:r=>this._input=r&&r.input,onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:o,readOnly:d,expanded:n,owns:s.listBoxId,activedescendant:"option-"+s.guid+"-"+this.focusedIndex(),role:"combobox",ariaLabelledBy:this.props.ariaLabelledBy,ariaDescribedBy:this.props.ariaDescribedBy,ariaRequired:this.required,render:this.props.valueRender})}renderListContainer(){const a=this.base,{dir:e,header:s,footer:i,size:t,groupField:o,list:d,groupStickyHeaderItemRender:p}=this.props,n=g.getFilteredData(this.props),r=a.getPopupSettings(),v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=r.width!==void 0?r.width:a.popupWidth;let{group:m}=this.state;return m===void 0&&o!==void 0&&(m=g.getItemValue(n[0],o)),I.createElement(E,{width:h,popupSettings:{...r,anchor:r.anchor||this.element,show:v,popupClass:l.classNames(r.popupClass,"k-list-container","k-autocomplete-popup")},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[n.length]},s&&I.createElement("div",{className:"k-list-header"},s),I.createElement("div",{className:l.classNames("k-list",{[`k-list-${_[t]||t}`]:t})},!d&&m&&n.length!==0&&I.createElement(N,{group:m,groupMode:"modern",render:p}),this.renderList()),i&&I.createElement("div",{className:"k-list-footer"},i))}renderList(){const a=this.base,e=a.getPopupSettings(),{textField:s,listNoDataRender:i,itemRender:t,groupHeaderItemRender:o}=this.props,d=g.getFilteredData(this.props),p=this.value,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(T,{id:a.listBoxId,show:n,data:d.slice(),focusedIndex:this.focusedIndex(),value:p,textField:s,valueField:s,highlightSelected:!1,optionsGuid:a.guid,groupField:this.props.groupField,groupMode:"modern",listRef:r=>a.list=r,wrapperStyle:{maxHeight:e.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:t,groupHeaderItemRender:o,noDataRender:i,onMouseDown:r=>r.preventDefault(),onScroll:this.onScroll})}triggerOnChange(a,e,s){this.value===a&&!s||(e.data.value=a,this._valueDuringOnChange=a,e.events.push({type:"onChange",...s||{}}))}applyState(a){this.base.applyState(a),this._valueDuringOnChange=void 0}suggestValue(a){if(this._suggested="",a){const{textField:e}=this.props,s=g.getFilteredData(this.props),i=s[g.itemIndexStartsWith(s,a,e)];if(i){const t=g.getItemValue(i,e);a.toLowerCase()!==t.toLowerCase()&&(this._suggested=t.substring(a.length))}}}focusedIndex(a){const{textField:e,focusedItemIndex:s,skipDisabledItems:i}=this.props,t=g.getFilteredData(this.props),o=a!==void 0?a:this.value;if(this.state.focusedItem!==void 0)return t.findIndex(d=>g.areSame(d,this.state.focusedItem,e));if(s)return s(t,o,e);{const d=t.indexOf(g.getFocusedItem(t,o,e));return i&&e&&d===-1?t.findIndex(p=>!p.disabled&&p[e]):Math.max(0,d)}}};b.displayName="AutoComplete",b.propTypes={...k.basicPropTypes,size:f.oneOf([null,"small","medium","large"]),rounded:f.oneOf([null,"small","medium","large","full"]),fillMode:f.oneOf([null,"solid","flat","outline"]),groupField:f.string,suggest:f.oneOfType([f.bool,f.string]),placeholder:f.string,value:f.string,defaultValue:f.string,validationMessage:f.string,required:f.bool,readonly:f.bool,clearButton:f.bool,valueRender:f.func,id:f.string,ariaLabelledBy:f.string,ariaDescribedBy:f.string,list:f.any,skipDisabledItems:f.bool},b.defaultProps={...k.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let S=b;const O=l.createPropsContext(),P=l.withIdHOC(l.withPropsContext(O,S));P.displayName="KendoReactAutoComplete";exports.AutoComplete=P;exports.AutoCompletePropsContext=O;exports.AutoCompleteWithoutContext=S;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),f=require("prop-types"),q=require("../common/SearchBar.js"),E=require("../common/ListContainer.js"),T=require("../common/List.js"),k=require("../common/DropDownBase.js"),N=require("../common/GroupStickyHeader.js"),g=require("../common/utils.js"),p=require("@progress/kendo-react-common"),L=require("@progress/kendo-react-labels"),R=require("../package-metadata.js"),H=require("../common/ClearButton.js"),F=require("../common/withCustomComponent.js");function z(x){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const e in x)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(x,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>x[e]})}}return a.default=x,Object.freeze(a)}const I=z(B),A="Please enter a valid value!",{sizeMap:_,roundedMap:G}=p.kendoThemeMaps,b=class b extends I.Component{constructor(a){super(a),this.state={},this.base=new k(this),this._element=null,this._suggested="",this._input=null,this._isScrolling=!1,this.itemHeight=0,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,s)=>{const i=g.getFilteredData(this.props),t=g.getItemValue(i[e],this.props.textField);this.triggerOnChange(t,s)},this.itemFocus=(e,s)=>{const{textField:i}=this.props,o=g.getFilteredData(this.props)[e];g.areSame(this.state.focusedItem,o,i)||(s.data.focusedItem=o)},this.togglePopup=e=>{this.base.togglePopup(e)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||A)},this.onScroll=e=>{this._isScrolling=!0;const{list:s}=this.base,{groupField:i}=this.props;let t=g.getFilteredData(this.props);if(!i||!t.length)return;const o=this.itemHeight||(s?s.children[0].offsetHeight:0),l=e.target.scrollTop;i&&(t=this.base.getGroupedDataModernMode(t,i));let n=t[0][i];for(let d=1;d<t.length&&!(o*d>l);d++)t[d]&&t[d][i]&&(n=t[d][i]);n!==this.state.group&&this.setState({group:n})},this.handleItemClick=(e,s)=>{this.base.handleItemClick(e,s),this._valueDuringOnChange=void 0},this.onChangeHandler=e=>{const i=this.base.initState(),t=e.currentTarget,o=t.value,r=t.selectionEnd===o.length;i.syntheticEvent=e;const l=this._suggested,n=this.value,d=n&&n.substring(0,n.length-l.length),v=d&&d===o,h=d&&d.length>o.length,{suggest:m}=this.props,u=this.props.opened!==void 0?this.props.opened:this.state.opened;if(m!==void 0&&m!==!1){v||h||!r?this._suggested="":this.suggestValue(o);const c=o+this._suggested,y={userInput:o,value:this._suggested};this.triggerOnChange(c,i,{suggestion:y})}else this._suggested="",this.triggerOnChange(o,i);(!u&&o||u&&!o)&&this.togglePopup(i),i.data.focusedItem=void 0,this.applyState(i),this.setState({group:void 0})},this.clearButtonClick=e=>{const i=this.base.initState(),t=this.props.opened!==void 0?this.props.opened:this.state.opened;i.syntheticEvent=e;const o="";this._suggested="",this.triggerOnChange(o,i),this.state.focusedItem!==void 0&&(i.data.focusedItem=void 0),t&&this.togglePopup(i),this.applyState(i)},this.onInputKeyDown=e=>{const{skipDisabledItems:s,groupField:i,textField:t}=this.props,o=g.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const r=this.focusedIndex(),l=o[r],n=e.keyCode,d=e.altKey,v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=this.base.initState();h.syntheticEvent=e;const m=()=>{v&&e.preventDefault()};if(d&&n===p.Keys.down)this.setState({opened:!0});else if(d&&n===p.Keys.up)this.setState({opened:!1});else if(v&&n===p.Keys.pageUp)m(),this.base.scrollPopupByPageSize(-1);else if(v&&n===p.Keys.pageDown)m(),this.base.scrollPopupByPageSize(1);else if(v&&(n===p.Keys.enter||n===p.Keys.esc))m(),s===!1&&l&&l.disabled?(v&&this.togglePopup(h),this.applyState(h)):this.applyInputValue(e.currentTarget.value,h,e.keyCode);else if(!v&&n===p.Keys.esc){const u="";this._suggested="",this.triggerOnChange(u,h),this.state.focusedItem!==void 0&&(h.data.focusedItem=void 0),this.applyState(h)}else if(n===p.Keys.up||n===p.Keys.down){if(i!==""&&t)if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=0;if(n===p.Keys.down||n===p.Keys.right){const c=o.slice(r+1).find(y=>!y.disabled&&y[t]);u=c&&o.findIndex(y=>y[t]===c[t])}else if(n===p.Keys.up||n===p.Keys.left){let c;if(r===-1)c=o,u=o.findIndex(y=>!y.disabled&&y[t]);else{c=o.slice(0,r);let y=c.pop();for(;y&&y.disabled;)y=c.pop();u=y&&o.findIndex(C=>C[t]===y[t])}}if(u!==void 0){const c=u-r;this.onNavigate(h,n,c)}else u===void 0&&o.findIndex(c=>c[t])===o.length-1&&this.onNavigate(h,n)}else if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=null;if(n===p.Keys.down||n===p.Keys.right)u=o.slice(r+1).find(c=>!c.disabled);else if(n===p.Keys.up||n===p.Keys.left){const c=o.slice(0,r);for(u=c.pop();u&&u.disabled;)u=c.pop()}if(u){const c=u.id-r-1;this.onNavigate(h,n,c)}else this.onNavigate(h,n)}this.applyState(h),m()}},this.handleBlur=e=>{if(this.state.focused){const s=this.base.initState();s.data.focused=!1,s.events.push({type:"onBlur"}),s.syntheticEvent=e,this.applyInputValue(e.currentTarget.value,s)}},p.validatePackage(R.packageMetadata)}get _inputId(){return this.props.id+"-accessibility-id"}get element(){return this._element}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get name(){return this.props.name}get validity(){const a=this.props.validationMessage!==void 0,e=!this.required||this.value!=="",s=this.props.valid!==void 0?this.props.valid:e;return{customError:a,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:b.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:b.defaultProps.required}componentDidUpdate(a,e){var m;const{groupField:s=""}=this.props,i=g.getFilteredData(this.props),{data:t=[]}=a,o=this.focusedIndex(),r=i[o],l=t!==i,n=r!==void 0&&e.focusedItem!==r,d=this.props.opened!==void 0?this.props.opened:this.state.opened,v=a.opened!==void 0?a.opened:e.opened,h=!v&&d;if(s==="")(d&&(n||l)||h)&&this.base.scrollToItem(o);else if(!this._isScrolling){const u=(m=this.base.getGroupedDataModernMode(i,s))==null?void 0:m.indexOf(r);h&&(i&&i.length!==0&&this.base.resetGroupStickyHeader(i[0][s],this),this.base.scrollToItem(u)),d&&v&&n&&this.base.scrollToItem(u)}this.setValidity()}componentDidMount(){this.base.didMount(),this.setValidity()}render(){const{dir:a,disabled:e,label:s,className:i,style:t,loading:o,suggest:r,size:l,rounded:n,fillMode:d}=this.props,v=!this.validityStyles||this.validity.valid,h=this.base,m=this.value,u=this.props.clearButton!==!1&&!o&&!!m,c=this.props.id||this._inputId,y=this.state.focused;typeof r=="string"&&(this._suggested=r);const[C,K]=F(this.props.prefix||I.Fragment),[V,M]=F(this.props.suffix||I.Fragment),D=I.createElement("span",{className:p.classNames("k-autocomplete k-input",i,{[`k-input-${_[l]||l}`]:l,[`k-rounded-${G[n]||n}`]:n,[`k-input-${d}`]:d,"k-invalid":!v,"k-focus":y&&!e,"k-loading":o,"k-required":this.required,"k-disabled":e}),ref:w=>{this._element=w,h.wrapper=w},style:s?{...t,width:void 0}:t,dir:a},this.props.prefix&&I.createElement(C,{...K}),this.renderSearchBar(m||"",c),o&&I.createElement(p.IconWrap,{className:"k-input-loading-icon",name:"loading"}),u&&!o&&I.createElement(H,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&I.createElement(V,{...M}),this.renderListContainer());return s?I.createElement(L.FloatingLabel,{label:s,editorId:c,editorValue:m,editorValid:v,editorDisabled:e,style:{width:t?t.width:void 0},children:D}):D}onNavigate(a,e,s){const i=this.value,{textField:t,focusedItemIndex:o}=this.props,r=g.getFilteredData(this.props),l=this.state.focusedItem!==void 0?r.findIndex(d=>g.areSame(d,this.state.focusedItem,t)):o?o(r,i,t):r.indexOf(g.getFocusedItem(r,i,t)),n=this.base.navigation.navigate({keyCode:e,current:l,max:r.length-1,min:0,skipItems:s||void 0});n!==void 0&&this.itemFocus(n,a),this.applyState(a)}applyInputValue(a,e,s){const i=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:t}=this.props,o=g.getFilteredData(this.props),r=this.focusedIndex(),l=o[r];if(this._suggested="",i&&s===p.Keys.enter&&l&&!l.disabled){const n=g.getItemValue(o[this.focusedIndex(a)],t);this.triggerOnChange(n,e)}i&&this.togglePopup(e),this.applyState(e)}renderSearchBar(a,e){const s=this.base,{placeholder:i,tabIndex:t,disabled:o,readonly:r}=this.props,{focused:l}=this.state,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(q,{id:e,placeholder:i,tabIndex:t,accessKey:this.props.accessKey,value:a,suggestedText:this._suggested,focused:l,name:this.props.name,ref:d=>this._input=d&&d.input,onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:o,readOnly:r,expanded:n,owns:s.listBoxId,activedescendant:"option-"+s.guid+"-"+this.focusedIndex(),role:"combobox",ariaLabelledBy:this.props.ariaLabelledBy,ariaDescribedBy:this.props.ariaDescribedBy,ariaRequired:this.required,render:this.props.valueRender})}renderListContainer(){const a=this.base,{dir:e,header:s,footer:i,size:t,groupField:o,list:r,groupStickyHeaderItemRender:l}=this.props,n=g.getFilteredData(this.props),d=a.getPopupSettings(),v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=d.width!==void 0?d.width:a.popupWidth;let{group:m}=this.state;return m===void 0&&o!==void 0&&(m=g.getItemValue(n[0],o)),I.createElement(E,{width:h,popupSettings:{...d,anchor:d.anchor||this.element,show:v,popupClass:p.classNames(d.popupClass,"k-list-container","k-autocomplete-popup")},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[n.length]},s&&I.createElement("div",{className:"k-list-header"},s),I.createElement("div",{className:p.classNames("k-list",{[`k-list-${_[t]||t}`]:t})},!r&&m&&n.length!==0&&I.createElement(N,{group:m,groupMode:"modern",render:l}),this.renderList()),i&&I.createElement("div",{className:"k-list-footer"},i))}renderList(){const a=this.base,e=a.getPopupSettings(),{textField:s,listNoDataRender:i,itemRender:t,groupHeaderItemRender:o}=this.props,r=g.getFilteredData(this.props),l=this.value,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(T,{id:a.listBoxId,show:n,data:r.slice(),focusedIndex:this.focusedIndex(),value:l,textField:s,valueField:s,highlightSelected:!1,optionsGuid:a.guid,groupField:this.props.groupField,groupMode:"modern",listRef:d=>a.list=d,wrapperStyle:{maxHeight:e.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:t,groupHeaderItemRender:o,noDataRender:i,onMouseDown:d=>d.preventDefault(),onScroll:this.onScroll})}triggerOnChange(a,e,s){this.value===a&&!s||(e.data.value=a,this._valueDuringOnChange=a,e.events.push({type:"onChange",...s||{}}))}applyState(a){this.base.applyState(a),this._valueDuringOnChange=void 0}suggestValue(a){if(this._suggested="",a){const{textField:e}=this.props,s=g.getFilteredData(this.props),i=s[g.itemIndexStartsWith(s,a,e)];if(i){const t=g.getItemValue(i,e);a.toLowerCase()!==t.toLowerCase()&&(this._suggested=t.substring(a.length))}}}focusedIndex(a){const{textField:e,focusedItemIndex:s,skipDisabledItems:i}=this.props,t=g.getFilteredData(this.props),o=a!==void 0?a:this.value;if(this.state.focusedItem!==void 0)return t.findIndex(l=>g.areSame(l,this.state.focusedItem,e));if(s)return s(t,o,e);const r=t.indexOf(g.getFocusedItem(t,o,e));return i&&e&&r===-1?t.findIndex(l=>!l.disabled&&l[e]):Math.max(0,r)}};b.displayName="AutoComplete",b.propTypes={...k.basicPropTypes,size:f.oneOf([null,"small","medium","large"]),rounded:f.oneOf([null,"small","medium","large","full"]),fillMode:f.oneOf([null,"solid","flat","outline"]),groupField:f.string,suggest:f.oneOfType([f.bool,f.string]),placeholder:f.string,value:f.string,defaultValue:f.string,validationMessage:f.string,required:f.bool,readonly:f.bool,clearButton:f.bool,valueRender:f.func,id:f.string,ariaLabelledBy:f.string,ariaDescribedBy:f.string,list:f.any,skipDisabledItems:f.bool},b.defaultProps={...k.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let S=b;const O=p.createPropsContext(),P=p.withIdHOC(p.withPropsContext(O,S));P.displayName="KendoReactAutoComplete";exports.AutoComplete=P;exports.AutoCompletePropsContext=O;exports.AutoCompleteWithoutContext=S;
@@ -44,19 +44,19 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
44
44
  const i = this.itemHeight || (o ? o.children[0].offsetHeight : 0), p = e.target.scrollTop;
45
45
  s && (t = this.base.getGroupedDataModernMode(t, s));
46
46
  let n = t[0][s];
47
- for (let r = 1; r < t.length && !(i * r > p); r++)
48
- t[r] && t[r][s] && (n = t[r][s]);
47
+ for (let d = 1; d < t.length && !(i * d > p); d++)
48
+ t[d] && t[d][s] && (n = t[d][s]);
49
49
  n !== this.state.group && this.setState({
50
50
  group: n
51
51
  });
52
52
  }, this.handleItemClick = (e, o) => {
53
53
  this.base.handleItemClick(e, o), this._valueDuringOnChange = void 0;
54
54
  }, this.onChangeHandler = (e) => {
55
- const s = this.base.initState(), t = e.currentTarget, i = t.value, d = t.selectionEnd === i.length;
55
+ const s = this.base.initState(), t = e.currentTarget, i = t.value, r = t.selectionEnd === i.length;
56
56
  s.syntheticEvent = e;
57
- const p = this._suggested, n = this.value, r = n && n.substring(0, n.length - p.length), f = r && r === i, h = r && r.length > i.length, { suggest: g } = this.props, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
57
+ const p = this._suggested, n = this.value, d = n && n.substring(0, n.length - p.length), f = d && d === i, h = d && d.length > i.length, { suggest: g } = this.props, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
58
58
  if (g !== void 0 && g !== !1) {
59
- f || h || !d ? this._suggested = "" : this.suggestValue(i);
59
+ f || h || !r ? this._suggested = "" : this.suggestValue(i);
60
60
  const u = i + this._suggested, v = { userInput: i, value: this._suggested };
61
61
  this.triggerOnChange(u, s, { suggestion: v });
62
62
  } else
@@ -70,16 +70,16 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
70
70
  }, this.onInputKeyDown = (e) => {
71
71
  const { skipDisabledItems: o, groupField: s, textField: t } = this.props, i = y(this.props);
72
72
  this._isScrolling && (this._isScrolling = !1);
73
- const d = this.focusedIndex(), p = i[d], n = e.keyCode, r = e.altKey, f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
73
+ const r = this.focusedIndex(), p = i[r], n = e.keyCode, d = e.altKey, f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
74
74
  h.syntheticEvent = e;
75
75
  const g = () => {
76
76
  f && e.preventDefault();
77
77
  };
78
- if (r && n === m.down)
78
+ if (d && n === m.down)
79
79
  this.setState({
80
80
  opened: !0
81
81
  });
82
- else if (r && n === m.up)
82
+ else if (d && n === m.up)
83
83
  this.setState({
84
84
  opened: !1
85
85
  });
@@ -99,14 +99,14 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
99
99
  else {
100
100
  let l = 0;
101
101
  if (n === m.down || n === m.right) {
102
- const u = i.slice(d + 1).find((v) => !v.disabled && v[t]);
102
+ const u = i.slice(r + 1).find((v) => !v.disabled && v[t]);
103
103
  l = u && i.findIndex((v) => v[t] === u[t]);
104
104
  } else if (n === m.up || n === m.left) {
105
105
  let u;
106
- if (d === -1)
106
+ if (r === -1)
107
107
  u = i, l = i.findIndex((v) => !v.disabled && v[t]);
108
108
  else {
109
- u = i.slice(0, d);
109
+ u = i.slice(0, r);
110
110
  let v = u.pop();
111
111
  for (; v && v.disabled; )
112
112
  v = u.pop();
@@ -114,7 +114,7 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
114
114
  }
115
115
  }
116
116
  if (l !== void 0) {
117
- const u = l - d;
117
+ const u = l - r;
118
118
  this.onNavigate(h, n, u);
119
119
  } else
120
120
  l === void 0 && i.findIndex((u) => u[t]) === i.length - 1 && this.onNavigate(h, n);
@@ -124,14 +124,14 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
124
124
  else {
125
125
  let l = null;
126
126
  if (n === m.down || n === m.right)
127
- l = i.slice(d + 1).find((u) => !u.disabled);
127
+ l = i.slice(r + 1).find((u) => !u.disabled);
128
128
  else if (n === m.up || n === m.left) {
129
- const u = i.slice(0, d);
129
+ const u = i.slice(0, r);
130
130
  for (l = u.pop(); l && l.disabled; )
131
131
  l = u.pop();
132
132
  }
133
133
  if (l) {
134
- const u = l.id - d - 1;
134
+ const u = l.id - r - 1;
135
135
  this.onNavigate(h, n, u);
136
136
  } else
137
137
  this.onNavigate(h, n);
@@ -194,12 +194,12 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
194
194
  */
195
195
  componentDidUpdate(a, e) {
196
196
  var g;
197
- const { groupField: o = "" } = this.props, s = y(this.props), { data: t = [] } = a, i = this.focusedIndex(), d = s[i], p = t !== s, n = d !== void 0 && e.focusedItem !== d, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = a.opened !== void 0 ? a.opened : e.opened, h = !f && r;
197
+ const { groupField: o = "" } = this.props, s = y(this.props), { data: t = [] } = a, i = this.focusedIndex(), r = s[i], p = t !== s, n = r !== void 0 && e.focusedItem !== r, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = a.opened !== void 0 ? a.opened : e.opened, h = !f && d;
198
198
  if (o === "")
199
- (r && (n || p) || h) && this.base.scrollToItem(i);
199
+ (d && (n || p) || h) && this.base.scrollToItem(i);
200
200
  else if (!this._isScrolling) {
201
- const l = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(d);
202
- h && (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(l)), r && f && n && this.base.scrollToItem(l);
201
+ const l = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(r);
202
+ h && (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(l)), d && f && n && this.base.scrollToItem(l);
203
203
  }
204
204
  this.setValidity();
205
205
  }
@@ -213,25 +213,21 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
213
213
  * @hidden
214
214
  */
215
215
  render() {
216
- const { dir: a, disabled: e, label: o, className: s, style: t, loading: i, suggest: d, size: p, rounded: n, fillMode: r } = this.props, f = !this.validityStyles || this.validity.valid, h = this.base, g = this.value, l = this.props.clearButton !== !1 && !i && !!g, u = this.props.id || this._inputId, v = this.state.focused;
217
- typeof d == "string" && (this._suggested = d);
216
+ const { dir: a, disabled: e, label: o, className: s, style: t, loading: i, suggest: r, size: p, rounded: n, fillMode: d } = this.props, f = !this.validityStyles || this.validity.valid, h = this.base, g = this.value, l = this.props.clearButton !== !1 && !i && !!g, u = this.props.id || this._inputId, v = this.state.focused;
217
+ typeof r == "string" && (this._suggested = r);
218
218
  const [S, V] = P(this.props.prefix || I.Fragment), [E, M] = P(this.props.suffix || I.Fragment), _ = /* @__PURE__ */ I.createElement(
219
219
  "span",
220
220
  {
221
- className: w(
222
- "k-autocomplete k-input",
223
- s,
224
- {
225
- [`k-input-${B[p] || p}`]: p,
226
- [`k-rounded-${W[n] || n}`]: n,
227
- [`k-input-${r}`]: r,
228
- "k-invalid": !f,
229
- "k-focus": v && !e,
230
- "k-loading": i,
231
- "k-required": this.required,
232
- "k-disabled": e
233
- }
234
- ),
221
+ className: w("k-autocomplete k-input", s, {
222
+ [`k-input-${B[p] || p}`]: p,
223
+ [`k-rounded-${W[n] || n}`]: n,
224
+ [`k-input-${d}`]: d,
225
+ "k-invalid": !f,
226
+ "k-focus": v && !e,
227
+ "k-loading": i,
228
+ "k-required": this.required,
229
+ "k-disabled": e
230
+ }),
235
231
  ref: (F) => {
236
232
  this._element = F, h.wrapper = F;
237
233
  },
@@ -262,10 +258,10 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
262
258
  * @hidden
263
259
  */
264
260
  onNavigate(a, e, o) {
265
- const s = this.value, { textField: t, focusedItemIndex: i } = this.props, d = y(this.props), p = this.state.focusedItem !== void 0 ? d.findIndex((r) => k(r, this.state.focusedItem, t)) : i ? i(d, s, t) : d.indexOf(O(d, s, t)), n = this.base.navigation.navigate({
261
+ const s = this.value, { textField: t, focusedItemIndex: i } = this.props, r = y(this.props), p = this.state.focusedItem !== void 0 ? r.findIndex((d) => k(d, this.state.focusedItem, t)) : i ? i(r, s, t) : r.indexOf(O(r, s, t)), n = this.base.navigation.navigate({
266
262
  keyCode: e,
267
263
  current: p,
268
- max: d.length - 1,
264
+ max: r.length - 1,
269
265
  min: 0,
270
266
  skipItems: o || void 0
271
267
  });
@@ -275,7 +271,7 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
275
271
  * @hidden
276
272
  */
277
273
  applyInputValue(a, e, o) {
278
- const s = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: t } = this.props, i = y(this.props), d = this.focusedIndex(), p = i[d];
274
+ const s = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: t } = this.props, i = y(this.props), r = this.focusedIndex(), p = i[r];
279
275
  if (this._suggested = "", s && o === m.enter && p && !p.disabled) {
280
276
  const n = x(i[this.focusedIndex(a)], t);
281
277
  this.triggerOnChange(n, e);
@@ -283,7 +279,7 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
283
279
  s && this.togglePopup(e), this.applyState(e);
284
280
  }
285
281
  renderSearchBar(a, e) {
286
- const o = this.base, { placeholder: s, tabIndex: t, disabled: i, readonly: d } = this.props, { focused: p } = this.state, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
282
+ const o = this.base, { placeholder: s, tabIndex: t, disabled: i, readonly: r } = this.props, { focused: p } = this.state, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
287
283
  return /* @__PURE__ */ I.createElement(
288
284
  T,
289
285
  {
@@ -295,13 +291,13 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
295
291
  suggestedText: this._suggested,
296
292
  focused: p,
297
293
  name: this.props.name,
298
- ref: (r) => this._input = r && r.input,
294
+ ref: (d) => this._input = d && d.input,
299
295
  onKeyDown: this.onInputKeyDown,
300
296
  onChange: this.onChangeHandler,
301
297
  onFocus: o.handleFocus,
302
298
  onBlur: this.handleBlur,
303
299
  disabled: i,
304
- readOnly: d,
300
+ readOnly: r,
305
301
  expanded: n,
306
302
  owns: o.listBoxId,
307
303
  activedescendant: "option-" + o.guid + "-" + this.focusedIndex(),
@@ -314,29 +310,17 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
314
310
  );
315
311
  }
316
312
  renderListContainer() {
317
- const a = this.base, {
318
- dir: e,
319
- header: o,
320
- footer: s,
321
- size: t,
322
- groupField: i,
323
- list: d,
324
- groupStickyHeaderItemRender: p
325
- } = this.props, n = y(this.props), r = a.getPopupSettings(), f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = r.width !== void 0 ? r.width : a.popupWidth;
313
+ const a = this.base, { dir: e, header: o, footer: s, size: t, groupField: i, list: r, groupStickyHeaderItemRender: p } = this.props, n = y(this.props), d = a.getPopupSettings(), f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = d.width !== void 0 ? d.width : a.popupWidth;
326
314
  let { group: g } = this.state;
327
315
  return g === void 0 && i !== void 0 && (g = x(n[0], i)), /* @__PURE__ */ I.createElement(
328
316
  N,
329
317
  {
330
318
  width: h,
331
319
  popupSettings: {
332
- ...r,
333
- anchor: r.anchor || this.element,
320
+ ...d,
321
+ anchor: d.anchor || this.element,
334
322
  show: f,
335
- popupClass: w(
336
- r.popupClass,
337
- "k-list-container",
338
- "k-autocomplete-popup"
339
- )
323
+ popupClass: w(d.popupClass, "k-list-container", "k-autocomplete-popup")
340
324
  },
341
325
  dir: e !== void 0 ? e : this.base.dirCalculated,
342
326
  itemsCount: [n.length]
@@ -345,32 +329,24 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
345
329
  /* @__PURE__ */ I.createElement(
346
330
  "div",
347
331
  {
348
- className: w(
349
- "k-list",
350
- {
351
- [`k-list-${B[t] || t}`]: t
352
- }
353
- )
332
+ className: w("k-list", {
333
+ [`k-list-${B[t] || t}`]: t
334
+ })
354
335
  },
355
- !d && g && n.length !== 0 && /* @__PURE__ */ I.createElement(H, { group: g, groupMode: "modern", render: p }),
336
+ !r && g && n.length !== 0 && /* @__PURE__ */ I.createElement(H, { group: g, groupMode: "modern", render: p }),
356
337
  this.renderList()
357
338
  ),
358
339
  s && /* @__PURE__ */ I.createElement("div", { className: "k-list-footer" }, s)
359
340
  );
360
341
  }
361
342
  renderList() {
362
- const a = this.base, e = a.getPopupSettings(), {
363
- textField: o,
364
- listNoDataRender: s,
365
- itemRender: t,
366
- groupHeaderItemRender: i
367
- } = this.props, d = y(this.props), p = this.value, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
343
+ const a = this.base, e = a.getPopupSettings(), { textField: o, listNoDataRender: s, itemRender: t, groupHeaderItemRender: i } = this.props, r = y(this.props), p = this.value, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
368
344
  return /* @__PURE__ */ I.createElement(
369
345
  L,
370
346
  {
371
347
  id: a.listBoxId,
372
348
  show: n,
373
- data: d.slice(),
349
+ data: r.slice(),
374
350
  focusedIndex: this.focusedIndex(),
375
351
  value: p,
376
352
  textField: o,
@@ -379,14 +355,14 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
379
355
  optionsGuid: a.guid,
380
356
  groupField: this.props.groupField,
381
357
  groupMode: "modern",
382
- listRef: (r) => a.list = r,
358
+ listRef: (d) => a.list = d,
383
359
  wrapperStyle: { maxHeight: e.height },
384
360
  wrapperCssClass: "k-list-content",
385
361
  onClick: this.handleItemClick,
386
362
  itemRender: t,
387
363
  groupHeaderItemRender: i,
388
364
  noDataRender: s,
389
- onMouseDown: (r) => r.preventDefault(),
365
+ onMouseDown: (d) => d.preventDefault(),
390
366
  onScroll: this.onScroll
391
367
  }
392
368
  );
@@ -409,13 +385,11 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
409
385
  focusedIndex(a) {
410
386
  const { textField: e, focusedItemIndex: o, skipDisabledItems: s } = this.props, t = y(this.props), i = a !== void 0 ? a : this.value;
411
387
  if (this.state.focusedItem !== void 0)
412
- return t.findIndex((d) => k(d, this.state.focusedItem, e));
388
+ return t.findIndex((p) => k(p, this.state.focusedItem, e));
413
389
  if (o)
414
390
  return o(t, i, e);
415
- {
416
- const d = t.indexOf(O(t, i, e));
417
- return s && e && d === -1 ? t.findIndex((p) => !p.disabled && p[e]) : Math.max(0, d);
418
- }
391
+ const r = t.indexOf(O(t, i, e));
392
+ return s && e && r === -1 ? t.findIndex((p) => !p.disabled && p[e]) : Math.max(0, r);
419
393
  }
420
394
  };
421
395
  b.displayName = "AutoComplete", b.propTypes = {
@@ -448,7 +422,12 @@ b.displayName = "AutoComplete", b.propTypes = {
448
422
  suffix: void 0
449
423
  };
450
424
  let D = b;
451
- const X = z(), Y = G($(X, D));
425
+ const X = z(), Y = G(
426
+ $(
427
+ X,
428
+ D
429
+ )
430
+ );
452
431
  Y.displayName = "KendoReactAutoComplete";
453
432
  export {
454
433
  Y as AutoComplete,
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),x=require("prop-types"),B=require("../common/DropDownBase.js"),g=require("@progress/kendo-react-common"),Z=require("@progress/kendo-react-labels"),p=require("../common/utils.js"),ee=require("../common/SearchBar.js"),te=require("../common/ListContainer.js"),se=require("../common/List.js"),ie=require("../common/ListFilter.js"),K=require("../common/GroupStickyHeader.js"),ae=require("../package-metadata.js"),oe=require("../common/ClearButton.js"),R=require("@progress/kendo-react-buttons"),A=require("@progress/kendo-svg-icons"),C=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),P=require("@progress/kendo-react-layout"),M=require("../common/constants.js"),z=require("../common/withCustomComponent.js");function ne(D){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const e in D)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(D,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>D[e]})}}return s.default=D,Object.freeze(s)}const h=ne(X),le="Please enter a valid value!",{sizeMap:w,roundedMap:re}=g.kendoThemeMaps,S=class S extends h.Component{constructor(s){super(s),this.state={},this.base=new B(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this.itemHeight=0,this.duplicates=[],this.hasDuplicates=!1,this.focus=()=>{this._input&&this._input.focus()},this.checkForDuplicatePlainTextRecords=()=>{const e=this.props.textField!==void 0,t=this.props.dataItemKey!==void 0;if(this.props.data&&this.props.data.length>0&&!e&&!t){const a=this.props.data;this.duplicates=p.getPlainDataDuplicates(a),this.hasDuplicates=this.duplicates.length>0}},this.handleItemSelect=(e,t)=>{const{virtual:a,dataItemKey:n}=this.props,l=p.getFilteredData(this.props),o=a?a.skip:0,r=l[e-o],d=this.hasDuplicates||!p.areSame(r,this.value,n);this.triggerOnChange(r,t),this.state.text!==void 0&&(t.data.text=void 0),d&&this.base.triggerPageChangeCornerItems(r,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=>{const{skipDisabledItems:t,textField:a}=this.props,n=p.getFilteredData(this.props),l=this.getFocusedIndex(),o=this.getCurrentValueDisabledStatus(a,n,l),r=this.props.opened!==void 0?this.props.opened:this.state.opened,d=this.base.initState();if(d.syntheticEvent=e,!t&&a&&o&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(d),!r&&this.mobileMode){const i=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(i,d)}this.applyState(d)},this.closeOpenedApplyStateNonMobileMode=(e,t)=>{t&&!this.mobileMode&&this.base.togglePopup(e)},this.renderMobileListFilter=()=>{const e=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text,t=p.getItemValue(this.value,this.props.textField),a=p.isPresent(e)?e:t;return h.createElement(ie,{value:a,ref:n=>this._adaptiveFilterInput=n&&n.element,onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode})},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:a}=this.base;t.scrollHandler(e);const{groupField:n}=this.props;let l=p.getFilteredData(this.props);if(!n||!l.length)return;const o=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:a?a.children[0].offsetHeight:0),d=e.target.scrollTop-t.skip*o;this.props.groupMode==="modern"&&(l=this.base.getGroupedDataModernMode(l,n));let i=l[0][n];for(let u=1;u<l.length&&!(o*u>d);u++)l[u]&&l[u][n]&&(i=l[u][n]);i!==this.state.group&&(this.setState({group:i}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:i}))},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:a}=this.props,n=p.getFilteredData(this.props),l=this.getFocusedIndex(),r=!(l===-1)&&this.getCurrentValueDisabledStatus(a,n,l);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,a&&r&&this.clearValueOnBlur(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,t)}},this.onInputClick=e=>{const t=this.props.opened!==void 0?this.props.opened:this.state.opened,a=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const n=this.base.initState();n.syntheticEvent=e,this.base.togglePopup(n),this.base.filterChanged(a,n),this.applyState(n)}},this.onInputKeyDown=e=>{const{skipDisabledItems:t,textField:a,dataItemKey:n,groupField:l}=this.props,o=p.getFilteredData(this.props),r=this.value,d=Math.max(0,o.findIndex(m=>p.areSame(m,r,n))),i=e.keyCode,u=this.props.opened!==void 0?this.props.opened:this.state.opened,c=this.base.initState();if(c.syntheticEvent=e,!e.altKey&&(i===g.Keys.up||i===g.Keys.down)){if(e.preventDefault(),l!==""&&a)if(!this.props.skipDisabledItems&&u)this.onNavigate(c,i);else{let m=0;if(i===g.Keys.down||i===g.Keys.right){const I=o.slice(d+1<o.length?d+1:d).find(y=>!y.disabled&&y[a]);m=I&&o.findIndex(y=>y[a]===I[a])}else if(i===g.Keys.up||i===g.Keys.left){let I;if(d===0)I=o,m=o.findIndex(y=>!y.disabled&&y[a]);else{I=o.slice(0,d);let y=I.pop();for(;y&&y.disabled;)y=I.pop();m=y&&o.findIndex(E=>E[a]===y[a])}}if(m!==void 0){const I=m-d;this.onNavigate(c,i,I)}else m===void 0&&o.findIndex(I=>I[a]===r[a])===o.length-1&&this.onNavigate(c,i)}else if(!this.props.skipDisabledItems&&u)this.onNavigate(c,i);else{let m=null;if(i===g.Keys.down||i===g.Keys.right)m=o.slice(d+1).find(I=>!I.disabled);else if(i===g.Keys.up||i===g.Keys.left){const I=o.slice(0,d);for(m=I.pop();m&&m.disabled;)m=I.pop()}if(m){const I=m.id-d-1;this.onNavigate(c,i,I)}else this.onNavigate(c,i)}this.applyState(c)}const v=()=>{e.preventDefault(),this.base.togglePopup(c),this.applyState(c)},b=this.getFocusedIndex(),f=b===-1,k=!f&&this.getCurrentValueDisabledStatus(a,o,b);u?i===g.Keys.pageUp?(e.preventDefault(),this.base.scrollPopupByPageSize(-1)):i===g.Keys.pageDown?(e.preventDefault(),this.base.scrollPopupByPageSize(1)):e.altKey&&i===g.Keys.up?v():i===g.Keys.enter?(e.preventDefault(),(a&&!f&&e.currentTarget.value?o[b][a]:void 0)?!t&&a&&k?this.clearValueOnEnterOrEsc(e):k||this.applyValueOnEnter(e.currentTarget.value,c):this.applyValueOnEnter(e.currentTarget.value,c)):i===g.Keys.esc&&(!t&&a&&k&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,c)):!u&&i===g.Keys.esc?this.clearValueOnEnterOrEsc(e):e.altKey&&i===g.Keys.down&&v()},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const a=this.props.opened!==void 0?this.props.opened:this.state.opened,n=e.currentTarget,l=n.value;if(this.props.suggest){const o=n.selectionEnd===l.length;let r=this.props.filter!==void 0?this.props.filter:this.state.text;p.isPresent(r)||(r=p.getItemValue(this.value,this.props.textField)||"");const d=r&&r===l,i=r&&r.length>l.length;d||i||!o?this._suggested="":this.suggestValue(l)}this.props.filter===void 0&&(t.data.text=l),this.state.focusedItem!==void 0&&(t.data.focusedItem=void 0),a||this.base.togglePopup(t),this.base.filterChanged(l,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnEnterOrEsc=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnBlur=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnToggleBtnClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||le)},g.validatePackage(ae.packageMetadata)}get _inputId(){return this.props.id}get document(){if(g.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=M.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get value(){if(this._valueDuringOnChange!==void 0)return this._valueDuringOnChange;if(this.props.value!==void 0)return this.props.value;if(this.state.value!==void 0)return this.state.value;if(this.props.defaultValue!==void 0)return this.props.defaultValue}get index(){const{dataItemKey:s}=this.props,e=p.getFilteredData(this.props),t=this.value;return e.findIndex(a=>p.areSame(a,t,s))}get name(){return this.props.name}get validity(){const s=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value!==""&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:s,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:S.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:S.defaultProps.required}componentDidUpdate(s,e){var v;const{dataItemKey:t,virtual:a,groupField:n="",textField:l}=this.props,o=p.getFilteredData(this.props),r=s.virtual?s.virtual.total:0,d=this.props.opened!==void 0?this.props.opened:this.state.opened,i=s.opened!==void 0?s.opened:e.opened;s.data!==o&&this.checkForDuplicatePlainTextRecords();const u=!i&&d,c=this.value;if(this._valueOnDidUpdate=c,this.base.didUpdate(),a&&a.total!==r)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const b=s.value!==void 0?s.value:e.value;let f=this.hasDuplicates?this.navigationIndex||0:o.findIndex(m=>p.areSame(m,c,t));this.props.groupMode==="modern"&&l&&c&&(f=(v=this.base.getGroupedDataModernMode(o,n))==null?void 0:v.map(m=>m[l]).indexOf(c[l]));const k=!p.areSame(b,c,t);u&&a?this.base.scrollToVirtualItem(a,f):u&&!a?(this.onPopupOpened(),o&&o.length!==0&&this.base.resetGroupStickyHeader(o[0][n],this),this.base.scrollToItem(f)):(this.hasDuplicates||d&&i&&c&&k)&&this.base.scrollToItem(f)}u&&this._input&&this._input.focus(),this.setValidity()}componentDidMount(){var s;this.observerResize=g.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.observe(this.document.body),this.checkForDuplicatePlainTextRecords()}componentWillUnmount(){var s;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const s=q.provideLocalizationService(this).toLanguageString(C.comboArrowBtnAriaLabelExpand,C.messages[C.comboArrowBtnAriaLabelExpand]),e=q.provideLocalizationService(this).toLanguageString(C.comboArrowBtnAriaLabelCollapse,C.messages[C.comboArrowBtnAriaLabelCollapse]),{dir:t,disabled:a,clearButton:n=S.defaultProps.clearButton,label:l,textField:o,adaptive:r,className:d,style:i,loading:u,iconClassName:c,virtual:v,size:b,rounded:f,fillMode:k,opened:m=this.state.opened,placeholder:I,svgIcon:y}=this.props,E=!this.validityStyles||this.validity.valid,T=this.props.filter!==void 0?this.props.filter:this.state.text,W=p.getItemValue(this.value,o),V=p.isPresent(T)?T:W,$=n&&(!!V||p.isPresent(this.value)),F=this.base.vs,_=this.props.id||this._inputId,N=this.mobileMode;F.enabled=v!==void 0,v!==void 0&&(F.skip=v.skip,F.total=v.total,F.pageSize=v.pageSize);const[j,G]=z(this.props.prefix||h.Fragment),[Y,J]=z(this.props.suffix||h.Fragment),L=h.createElement(h.Fragment,null,h.createElement("span",{className:g.classNames("k-combobox k-input",{[`k-input-${w[b]||b}`]:b,[`k-rounded-${re[f]||f}`]:f,[`k-input-${k}`]:k,"k-invalid":!E,"k-loading":u,"k-required":this.required,"k-disabled":a},d),ref:this.componentRef,style:l?{...i,width:void 0}:i,dir:t},this.props.prefix&&h.createElement(j,{...G}),this.renderSearchBar(V||"",_,I),$&&!u&&h.createElement(oe,{onClick:this.clearButtonClick,key:"clearbutton"}),u&&h.createElement(g.IconWrap,{className:"k-input-loading-icon",name:"loading",key:"loading"}),this.props.suffix&&h.createElement(Y,{...J}),h.createElement(R.Button,{tabIndex:-1,type:"button","aria-label":m?e:s,icon:c?void 0:"caret-alt-down",svgIcon:y||A.caretAltDownIcon,iconClass:c,size:b,fillMode:k,rounded:null,themeColor:"base",className:"k-input-button",onClick:this.toggleBtnClick,onMouseDown:Q=>Q.preventDefault()}),!N&&this.renderListContainer()),N&&this.renderAdaptiveListContainer());return l?h.createElement(Z.FloatingLabel,{label:l,editorId:_,editorValue:V,editorValid:E,editorDisabled:a,style:{width:i?i.width:void 0},children:L}):L}onNavigate(s,e,t){const{virtual:a={skip:0}}=this.props,n=p.getFilteredData(this.props),l=this.props.filter?this.props.filter:this.state.text;let o=-1,r;const d=this.base.vs,i=this.value;this._suggested="";const u=this.hasDuplicates&&this.duplicates.indexOf(i)!==-1;if(o=this.getFocusedIndex(u),o!==-1&&!p.isPresent(i))this.handleItemSelect(o,s);else if(l==="")this.handleItemSelect(0,s);else{const c=a.skip+o;r=this.base.navigation.navigate({keyCode:e,current:c,max:(d.enabled?d.total:n.length)-1,min:0,skipItems:t||void 0}),r!==void 0&&this.handleItemSelect(r,s)}this.navigationIndex=r}getCurrentValueDisabledStatus(s,e,t){return s&&e&&e[t]&&e[t].disabled}applyValueOnEnter(s,e){const{textField:t,allowCustom:a}=this.props,n=p.getFilteredData(this.props),l=this.props.opened!==void 0?this.props.opened:this.state.opened,r=p.getItemValue(this.value,t)===s?this.index:p.getItemIndexByText(n,s,t),d=r!==-1;let i;if(this._suggested="",d)i=n[r];else if(a)i=t!==void 0?{[t]:s}:s;else return this.selectFocusedItem(s,e);this.triggerOnChange(i,e),l&&this.base.togglePopup(e),this.props.filter===void 0&&this.state.text!==void 0&&(e.data.text=void 0),this.applyState(e)}applyValueOnRejectSuggestions(s,e){const{textField:t,allowCustom:a}=this.props,n=p.getFilteredData(this.props),l=this.props.opened!==void 0?this.props.opened:this.state.opened,o=p.getItemValue(this.value,t);if(this._suggested="",s===o||s===""&&!p.isPresent(o))return this.closeOpenedApplyStateNonMobileMode(e,l),this.applyState(e);const r=p.getItemIndexByText(n,s,t,!0),d=r!==-1;let i=null;d?i=n[r]:a&&(i=s?t?{[t]:s}:s:null),this.triggerOnChange(i,e),this.state.text!==void 0&&(e.data.text=void 0,this.base.filterChanged("",e)),this.closeOpenedApplyStateNonMobileMode(e,l),this.applyState(e)}selectFocusedItem(s,e){const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:a,virtual:n={skip:0},focusedItemIndex:l=p.itemIndexStartsWith}=this.props,o=p.getFilteredData(this.props),r=n.skip,d=s===""&&r===0?0:l(o,s,a);return d!==-1?this.handleItemSelect(d+r,e):(this.triggerOnChange(null,e),this.state.text!==void 0&&(e.data.text=void 0)),t&&this.base.togglePopup(e),this.applyState(e)}renderAdaptiveListContainer(){const{windowWidth:s=0}=this.state,{header:e,footer:t,size:a,groupField:n,groupMode:l,list:o,virtual:r,adaptiveTitle:d,groupStickyHeaderItemRender:i}=this.props,u=p.getFilteredData(this.props),c=this.props.opened!==void 0?this.props.opened:this.state.opened,v=this.base.getAdaptiveAnimation();let{group:b}=this.state;b===void 0&&n!==void 0&&(b=p.getItemValue(u[0],n));const f={navigatable:!1,navigatableElements:[],expand:c,animation:v,onClose:k=>this.toggleBtnClick(k),animationStyles:s<=M.MOBILE_SMALL_DEVISE?{top:0,width:"100%",height:"100%"}:void 0,className:s<=M.MOBILE_SMALL_DEVISE?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom k-actionsheet"};return h.createElement(P.ActionSheet,{...f},h.createElement(P.ActionSheetHeader,null,h.createElement("div",{className:"k-actionsheet-titlebar-group k-hbox"},h.createElement("div",{className:"k-actionsheet-title"},h.createElement("div",{className:"k-text-center"},d),h.createElement("div",{className:"k-actionsheet-subtitle k-text-center"})),h.createElement("div",{className:"k-actionsheet-actions"},h.createElement(R.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",themeColor:"base",size:"large",onClick:this.toggleBtnClick,icon:"x",svgIcon:A.xIcon}))),h.createElement("div",{className:"k-actionsheet-titlebar-group k-actionsheet-filter"},this.renderMobileListFilter())),h.createElement(P.ActionSheetContent,{overflowHidden:!0},h.createElement("div",{className:"k-list-container"},h.createElement("div",{className:g.classNames({"k-list":!o,"k-list-lg":!0,"k-virtual-list":r,"k-data-table":o,[`k-table-${w[a]||a}`]:o&&a})},e&&h.createElement("div",{className:"k-table-header"},e),!o&&b&&u.length!==0&&h.createElement(K,{group:b,groupMode:l,render:i}),this.renderList(),t&&h.createElement("div",{className:"k-list-footer"},t)))))}renderListContainer(){const s=this.base,{dir:e,header:t,footer:a,groupField:n,groupMode:l,size:o,list:r,virtual:d,groupStickyHeaderItemRender:i}=this.props,u=p.getFilteredData(this.props),c=this.props.opened!==void 0?this.props.opened:this.state.opened,v=s.getPopupSettings(),b=v.width!==void 0?v.width:s.popupWidth;let{group:f}=this.state;return f===void 0&&n!==void 0&&(f=p.getItemValue(u[0],n)),h.createElement(te,{width:b,popupSettings:{...v,anchor:v.anchor||this.element,show:c,popupClass:g.classNames(v.popupClass,"k-list-container","k-combobox-popup")},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[u.length]},h.createElement("div",{className:g.classNames({"k-list":!r,[`k-list-${w[o]||o}`]:!r&&o,"k-virtual-list":d,"k-data-table":r,[`k-table-${w[o]||o}`]:r&&o})},t&&h.createElement("div",{className:"k-table-header"},t),!r&&f&&u.length!==0&&h.createElement(K,{group:f,groupMode:l,render:i}),this.renderList(),a&&h.createElement("div",{className:g.classNames({"k-list-footer":!this.props.footerClassName},this.props.footerClassName)},a)))}renderList(){const s=this.base,{textField:e,dataItemKey:t,listNoDataRender:a,itemRender:n,groupHeaderItemRender:l,virtual:o={skip:0,total:void 0}}=this.props,r=p.getFilteredData(this.props),d=s.getPopupSettings(),i=s.vs,u=o.skip,c=this.props.opened!==void 0?this.props.opened:this.state.opened,v=`translateY(${i.translate}px)`,b=c?this.getFocusedIndex(this.hasDuplicates):void 0,f=this.props.filter!==void 0?this.props.filter:this.state.text,k=p.getItemValue(this.value,e),m=p.isPresent(f)&&f!==k?null:this.value,I=this.props.list||se;return h.createElement(I,{id:s.listBoxId,virtual:!!o,show:c,data:r,focusedIndex:b,value:m,textField:e,valueField:t,groupField:this.props.groupField,groupMode:this.props.groupMode,isMultiColumn:this.props.isMultiColumn,optionsGuid:s.guid,hasDuplicates:this.hasDuplicates,listRef:y=>{i.list=this.base.list=y,this.itemHeight=0},wrapperStyle:this.state.windowWidth&&this.state.windowWidth>M.MOBILE_MEDIUM_DEVISE?{maxHeight:d.height}:{},wrapperCssClass:g.classNames("k-list-content",{"k-list-scroller":!o}),listStyle:i.enabled?{transform:v}:void 0,key:"listkey",skip:u,onClick:this.handleItemClick,itemRender:n,groupHeaderItemRender:l,noDataRender:a,onMouseDown:y=>y.preventDefault(),onScroll:this.onScroll,wrapperRef:i.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:o.total})}renderSearchBar(s,e,t){const{tabIndex:a,disabled:n,title:l,ariaLabelledBy:o,ariaDescribedBy:r,dataItemKey:d,virtual:i={skip:0},accessKey:u}=this.props,c=p.getFilteredData(this.props),v=this.props.opened!==void 0?this.props.opened:this.state.opened,b=this.value,f=Math.max(0,c.findIndex(m=>p.areSame(m,b,d)));this._suggested&&!p.areSame(this._valueOnDidUpdate,b,d)&&(this._suggested="");const k={accessKey:u};return h.createElement(ee,{id:e,readOnly:v&&this.mobileMode,placeholder:t,tabIndex:a,title:l,value:s+this._suggested,suggestedText:this._suggested,ref:m=>this._input=m&&m.input,onClick:this.onInputClick,onKeyDown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:n,expanded:v,owns:this.base.listBoxId,activedescendant:`option-${this.base.guid}-${f+i.skip}`,role:"combobox",ariaLabelledBy:o,ariaLabel:this.props.ariaLabel,ariaDescribedBy:r,ariaRequired:this.required,render:this.props.valueRender,ariaControls:this.base.listBoxId,...k})}clearValue(){const s=this.base.initState();this._suggested="",this.navigationIndex=void 0,this.base.filterChanged("",s),this.props.filter===void 0&&this.state.text!==void 0&&(s.data.text=void 0),this.triggerOnChange(null,s);const e=this.props.opened!==void 0?this.props.opened:this.state.opened,t=this.mobileMode;e&&!t&&this.base.togglePopup(s),this.applyState(s)}triggerOnChange(s,e){const t=this.value;!this.hasDuplicates&&(!p.isPresent(t)&&!p.isPresent(s)||p.areSame(t,s,this.props.dataItemKey))||(this.props.value===void 0&&(e.data.value=s),this._valueDuringOnChange=s,e.events.push({type:"onChange"}))}getFocusedIndex(s){const e=this.value,{textField:t,dataItemKey:a,virtual:n={skip:0},focusedItemIndex:l=p.itemIndexStartsWith,skipDisabledItems:o}=this.props,r=p.getFilteredData(this.props),d=this.props.filter?this.props.filter:this.state.text;return s&&this.navigationIndex!==void 0?this.navigationIndex:p.isPresent(e)&&d===void 0?r.findIndex(i=>p.areSame(i,e,a)):d?l(r,d,t):o&&t&&!d&&n.skip===0?r.findIndex(i=>!i.disabled&&i[t]):n.skip===0?0:-1}suggestValue(s){const{data:e,textField:t}=this.props;this._suggested=p.suggestValue(s,e,t)}applyState(s){this.base.applyState(s),this._valueDuringOnChange=void 0}calculateMedia(s){for(const e of s)this.setState({windowWidth:e.target.clientWidth})}};S.displayName="ComboBox",S.propTypes={...B.propTypes,size:x.oneOf([null,"small","medium","large"]),rounded:x.oneOf([null,"small","medium","large","full"]),fillMode:x.oneOf([null,"solid","flat","outline"]),dataItemKey:x.string,groupField:x.string,groupMode:x.oneOf([void 0,"classic","modern"]),isMultiColumn:x.bool,suggest:x.bool,placeholder:x.string,title:x.string,allowCustom:x.bool,clearButton:x.bool,iconClassName:x.string,svgIcon:g.svgIconPropType,validationMessage:x.string,required:x.bool,id:x.string,ariaLabelledBy:x.string,ariaLabel:x.string,ariaDescribedBy:x.string,list:x.any,valueRender:x.func,skipDisabledItems:x.bool},S.defaultProps={...B.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",allowCustom:!1,clearButton:!0,required:!1,groupMode:"modern",isMultiColumn:!1,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let O=S;const H=g.createPropsContext(),U=g.withIdHOC(g.withPropsContext(H,O));U.displayName="KendoReactComboBox";exports.ComboBox=U;exports.ComboBoxPropsContext=H;exports.ComboBoxWithoutContext=O;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("react"),b=require("prop-types"),N=require("../common/DropDownBase.js"),a=require("@progress/kendo-react-common"),ee=require("@progress/kendo-react-labels"),h=require("../common/utils.js"),te=require("../common/SearchBar.js"),se=require("../common/ListContainer.js"),ie=require("../common/List.js"),oe=require("../common/ListFilter.js"),K=require("../common/GroupStickyHeader.js"),ae=require("../package-metadata.js"),ne=require("../common/ClearButton.js"),R=require("@progress/kendo-react-buttons"),q=require("@progress/kendo-svg-icons"),E=require("../messages/index.js"),z=require("@progress/kendo-react-intl"),P=require("@progress/kendo-react-layout"),k=require("../common/constants.js"),H=require("../common/withCustomComponent.js");function le(B){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(B){for(const e in B)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(B,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>B[e]})}}return s.default=B,Object.freeze(s)}const m=le(Z),re="Please enter a valid value!",S=class S extends m.Component{constructor(s){super(s),this.state={},this.base=new N(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this.itemHeight=0,this.duplicates=[],this.hasDuplicates=!1,this.focus=()=>{this._input&&this._input.focus()},this.checkForDuplicatePlainTextRecords=()=>{const e=this.props.textField!==void 0,t=this.props.dataItemKey!==void 0;if(this.props.data&&this.props.data.length>0&&!e&&!t){const i=this.props.data;this.duplicates=h.getPlainDataDuplicates(i),this.hasDuplicates=this.duplicates.length>0}},this.handleItemSelect=(e,t)=>{const{virtual:i,dataItemKey:l}=this.props,r=h.getFilteredData(this.props),n=i?i.skip:0,d=r[e-n],p=this.hasDuplicates||!h.areSame(d,this.value,l);this.triggerOnChange(d,t),this.state.text!==void 0&&(t.data.text=void 0),p&&this.base.triggerPageChangeCornerItems(d,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=>{const{skipDisabledItems:t,textField:i}=this.props,l=h.getFilteredData(this.props),r=this.getFocusedIndex(),n=this.getCurrentValueDisabledStatus(i,l,r),d=this.props.opened!==void 0?this.props.opened:this.state.opened,p=this.base.initState();if(p.syntheticEvent=e,!t&&i&&n&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(p),!d&&this.mobileMode){const o=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(o,p)}this.applyState(p)},this.closeOpenedApplyStateNonMobileMode=(e,t)=>{t&&!this.mobileMode&&this.base.togglePopup(e)},this.renderMobileListFilter=()=>{const e=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text,t=h.getItemValue(this.value,this.props.textField),i=h.isPresent(e)?e:t;return m.createElement(oe,{value:i,ref:l=>this._adaptiveFilterInput=l&&l.element,onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode})},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:i}=this.base;t.scrollHandler(e);const{groupField:l}=this.props;let r=h.getFilteredData(this.props);if(!l||!r.length)return;const n=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:i?i.children[0].offsetHeight:0),p=e.target.scrollTop-t.skip*n;this.props.groupMode==="modern"&&(r=this.base.getGroupedDataModernMode(r,l));let o=r[0][l];for(let u=1;u<r.length&&!(n*u>p);u++)r[u]&&r[u][l]&&(o=r[u][l]);o!==this.state.group&&(this.setState({group:o}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:o}))},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:i}=this.props,l=h.getFilteredData(this.props),r=this.getFocusedIndex(),d=!(r===-1)&&this.getCurrentValueDisabledStatus(i,l,r);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,i&&d&&this.clearValueOnBlur(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,t)}},this.onInputClick=e=>{const t=this.props.opened!==void 0?this.props.opened:this.state.opened,i=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const l=this.base.initState();l.syntheticEvent=e,this.base.togglePopup(l),this.base.filterChanged(i,l),this.applyState(l)}},this.onInputKeyDown=e=>{const{skipDisabledItems:t,textField:i,dataItemKey:l,groupField:r}=this.props,n=h.getFilteredData(this.props),d=this.value,p=Math.max(0,n.findIndex(c=>h.areSame(c,d,l))),o=e.keyCode,u=this.props.opened!==void 0?this.props.opened:this.state.opened,g=this.base.initState();if(g.syntheticEvent=e,!e.altKey&&(o===a.Keys.up||o===a.Keys.down)){if(e.preventDefault(),r!==""&&i)if(!this.props.skipDisabledItems&&u)this.onNavigate(g,o);else{let c=0;if(o===a.Keys.down||o===a.Keys.right){const f=n.slice(p+1<n.length?p+1:p).find(C=>!C.disabled&&C[i]);c=f&&n.findIndex(C=>C[i]===f[i])}else if(o===a.Keys.up||o===a.Keys.left){let f;if(p===0)f=n,c=n.findIndex(C=>!C.disabled&&C[i]);else{f=n.slice(0,p);let C=f.pop();for(;C&&C.disabled;)C=f.pop();c=C&&n.findIndex(D=>D[i]===C[i])}}if(c!==void 0){const f=c-p;this.onNavigate(g,o,f)}else c===void 0&&n.findIndex(f=>f[i]===d[i])===n.length-1&&this.onNavigate(g,o)}else if(!this.props.skipDisabledItems&&u)this.onNavigate(g,o);else{let c=null;if(o===a.Keys.down||o===a.Keys.right)c=n.slice(p+1).find(f=>!f.disabled);else if(o===a.Keys.up||o===a.Keys.left){const f=n.slice(0,p);for(c=f.pop();c&&c.disabled;)c=f.pop()}if(c){const f=c.id-p-1;this.onNavigate(g,o,f)}else this.onNavigate(g,o)}this.applyState(g)}const x=()=>{e.preventDefault(),this.base.togglePopup(g),this.applyState(g)},I=this.getFocusedIndex(),y=I===-1,v=!y&&this.getCurrentValueDisabledStatus(i,n,I);u?o===a.Keys.pageUp?(e.preventDefault(),this.base.scrollPopupByPageSize(-1)):o===a.Keys.pageDown?(e.preventDefault(),this.base.scrollPopupByPageSize(1)):e.altKey&&o===a.Keys.up?x():o===a.Keys.enter?(e.preventDefault(),(i&&!y&&e.currentTarget.value?n[I][i]:void 0)?!t&&i&&v?this.clearValueOnEnterOrEsc(e):v||this.applyValueOnEnter(e.currentTarget.value,g):this.applyValueOnEnter(e.currentTarget.value,g)):o===a.Keys.esc&&(!t&&i&&v&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,g)):!u&&o===a.Keys.esc?this.clearValueOnEnterOrEsc(e):e.altKey&&o===a.Keys.down&&x()},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const i=this.props.opened!==void 0?this.props.opened:this.state.opened,l=e.currentTarget,r=l.value;if(this.props.suggest){const n=l.selectionEnd===r.length;let d=this.props.filter!==void 0?this.props.filter:this.state.text;h.isPresent(d)||(d=h.getItemValue(this.value,this.props.textField)||"");const p=d&&d===r,o=d&&d.length>r.length;p||o||!n?this._suggested="":this.suggestValue(r)}this.props.filter===void 0&&(t.data.text=r),this.state.focusedItem!==void 0&&(t.data.focusedItem=void 0),i||this.base.togglePopup(t),this.base.filterChanged(r,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnEnterOrEsc=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnBlur=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnToggleBtnClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||re)},a.validatePackage(ae.packageMetadata)}get _inputId(){return this.props.id}get document(){if(a.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=k.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get value(){if(this._valueDuringOnChange!==void 0)return this._valueDuringOnChange;if(this.props.value!==void 0)return this.props.value;if(this.state.value!==void 0)return this.state.value;if(this.props.defaultValue!==void 0)return this.props.defaultValue}get index(){const{dataItemKey:s}=this.props,e=h.getFilteredData(this.props),t=this.value;return e.findIndex(i=>h.areSame(i,t,s))}get name(){return this.props.name}get validity(){const s=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value!==""&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:s,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:S.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:S.defaultProps.required}componentDidUpdate(s,e){var x;const{dataItemKey:t,virtual:i,groupField:l="",textField:r}=this.props,n=h.getFilteredData(this.props),d=s.virtual?s.virtual.total:0,p=this.props.opened!==void 0?this.props.opened:this.state.opened,o=s.opened!==void 0?s.opened:e.opened;s.data!==n&&this.checkForDuplicatePlainTextRecords();const u=!o&&p,g=this.value;if(this._valueOnDidUpdate=g,this.base.didUpdate(),i&&i.total!==d)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const I=s.value!==void 0?s.value:e.value;let y=this.hasDuplicates?this.navigationIndex||0:n.findIndex(c=>h.areSame(c,g,t));this.props.groupMode==="modern"&&r&&g&&(y=(x=this.base.getGroupedDataModernMode(n,l))==null?void 0:x.map(c=>c[r]).indexOf(g[r]));const v=!h.areSame(I,g,t);u&&i?this.base.scrollToVirtualItem(i,y):u&&!i?(this.onPopupOpened(),n&&n.length!==0&&this.base.resetGroupStickyHeader(n[0][l],this),this.base.scrollToItem(y)):(this.hasDuplicates||p&&o&&g&&v)&&this.base.scrollToItem(y)}u&&this._input&&this._input.focus(),this.setValidity()}componentDidMount(){var s;this.observerResize=a.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.observe(this.document.body),this.checkForDuplicatePlainTextRecords()}componentWillUnmount(){var s;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const s=z.provideLocalizationService(this).toLanguageString(E.comboArrowBtnAriaLabelExpand,E.messages[E.comboArrowBtnAriaLabelExpand]),e=z.provideLocalizationService(this).toLanguageString(E.comboArrowBtnAriaLabelCollapse,E.messages[E.comboArrowBtnAriaLabelCollapse]),{dir:t,disabled:i,clearButton:l=S.defaultProps.clearButton,label:r,textField:n,adaptive:d,className:p,style:o,loading:u,iconClassName:g,virtual:x,size:I,rounded:y,fillMode:v,opened:c=this.state.opened,placeholder:f,svgIcon:C,unstyled:D}=this.props,w=!this.validityStyles||this.validity.valid,T=this.props.filter!==void 0?this.props.filter:this.state.text,G=h.getItemValue(this.value,n),O=h.isPresent(T)?T:G,j=l&&(!!O||h.isPresent(this.value)),F=this.base.vs,_=this.props.id||this._inputId,A=this.mobileMode,V=D&&D.uComboBox;F.enabled=x!==void 0,x!==void 0&&(F.skip=x.skip,F.total=x.total,F.pageSize=x.pageSize);const[$,Y]=H(this.props.prefix||m.Fragment),[J,Q]=H(this.props.suffix||m.Fragment),L=m.createElement(m.Fragment,null,m.createElement("span",{className:a.classNames(a.uComboBox.wrapper({c:V,size:I,rounded:y,fillMode:v,disabled:i,invalid:!w,loading:u,required:this.required}),p),ref:this.componentRef,style:r?{...o,width:void 0}:o,dir:t},this.props.prefix&&m.createElement($,{...Y}),this.renderSearchBar(O||"",_,f),j&&!u&&m.createElement(ne,{onClick:this.clearButtonClick,key:"clearbutton"}),u&&m.createElement(a.IconWrap,{className:a.classNames(a.uComboBox.loadingIcon({c:V})),name:"loading",key:"loading"}),this.props.suffix&&m.createElement(J,{...Q}),m.createElement(R.Button,{tabIndex:-1,type:"button","aria-label":c?e:s,icon:g?void 0:"caret-alt-down",svgIcon:C||q.caretAltDownIcon,iconClass:g,size:I,fillMode:v,rounded:null,themeColor:"base",className:a.classNames(a.uComboBox.inputButton({c:V})),onClick:this.toggleBtnClick,onMouseDown:X=>X.preventDefault()}),!A&&this.renderListContainer()),A&&this.renderAdaptiveListContainer());return r?m.createElement(ee.FloatingLabel,{label:r,editorId:_,editorValue:O,editorValid:w,editorDisabled:i,style:{width:o?o.width:void 0},children:L,unstyled:D}):L}onNavigate(s,e,t){const{virtual:i={skip:0}}=this.props,l=h.getFilteredData(this.props),r=this.props.filter?this.props.filter:this.state.text;let n=-1,d;const p=this.base.vs,o=this.value;this._suggested="";const u=this.hasDuplicates&&this.duplicates.indexOf(o)!==-1;if(n=this.getFocusedIndex(u),n!==-1&&!h.isPresent(o))this.handleItemSelect(n,s);else if(r==="")this.handleItemSelect(0,s);else{const g=i.skip+n;d=this.base.navigation.navigate({keyCode:e,current:g,max:(p.enabled?p.total:l.length)-1,min:0,skipItems:t||void 0}),d!==void 0&&this.handleItemSelect(d,s)}this.navigationIndex=d}getCurrentValueDisabledStatus(s,e,t){return s&&e&&e[t]&&e[t].disabled}applyValueOnEnter(s,e){const{textField:t,allowCustom:i}=this.props,l=h.getFilteredData(this.props),r=this.props.opened!==void 0?this.props.opened:this.state.opened,d=h.getItemValue(this.value,t)===s?this.index:h.getItemIndexByText(l,s,t),p=d!==-1;let o;if(this._suggested="",p)o=l[d];else if(i)o=t!==void 0?{[t]:s}:s;else return this.selectFocusedItem(s,e);this.triggerOnChange(o,e),r&&this.base.togglePopup(e),this.props.filter===void 0&&this.state.text!==void 0&&(e.data.text=void 0),this.applyState(e)}applyValueOnRejectSuggestions(s,e){const{textField:t,allowCustom:i}=this.props,l=h.getFilteredData(this.props),r=this.props.opened!==void 0?this.props.opened:this.state.opened,n=h.getItemValue(this.value,t);if(this._suggested="",s===n||s===""&&!h.isPresent(n))return this.closeOpenedApplyStateNonMobileMode(e,r),this.applyState(e);const d=h.getItemIndexByText(l,s,t,!0),p=d!==-1;let o=null;p?o=l[d]:i&&(o=s?t?{[t]:s}:s:null),this.triggerOnChange(o,e),this.state.text!==void 0&&(e.data.text=void 0,this.base.filterChanged("",e)),this.closeOpenedApplyStateNonMobileMode(e,r),this.applyState(e)}selectFocusedItem(s,e){const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:i,virtual:l={skip:0},focusedItemIndex:r=h.itemIndexStartsWith}=this.props,n=h.getFilteredData(this.props),d=l.skip,p=s===""&&d===0?0:r(n,s,i);return p!==-1?this.handleItemSelect(p+d,e):(this.triggerOnChange(null,e),this.state.text!==void 0&&(e.data.text=void 0)),t&&this.base.togglePopup(e),this.applyState(e)}renderAdaptiveListContainer(){const{windowWidth:s=0}=this.state,{header:e,footer:t,size:i,groupField:l,groupMode:r,list:n,virtual:d,adaptiveTitle:p,groupStickyHeaderItemRender:o,unstyled:u}=this.props,g=h.getFilteredData(this.props),x=this.props.opened!==void 0?this.props.opened:this.state.opened,I=this.base.getAdaptiveAnimation(),y=u&&u.uComboBox,v=u&&u.uDropDownsActionSheet;let{group:c}=this.state;c===void 0&&l!==void 0&&(c=h.getItemValue(g[0],l));const f={navigatable:!1,navigatableElements:[],expand:x,animation:I,onClose:C=>this.toggleBtnClick(C),animationStyles:s<=k.MOBILE_SMALL_DEVISE?{top:0,width:"100%",height:"100%"}:void 0,className:a.classNames(a.uDropDownsActionSheet.wrapper({c:v,isFullScreen:s<=k.MOBILE_SMALL_DEVISE}))};return m.createElement(P.ActionSheet,{...f},m.createElement(P.ActionSheetHeader,null,m.createElement("div",{className:a.classNames(a.uDropDownsActionSheet.titleBar({c:v}))},m.createElement("div",{className:a.classNames(a.uDropDownsActionSheet.title({c:v}))},m.createElement("div",{className:a.classNames(a.uDropDownsActionSheet.header({c:v}))},p),m.createElement("div",{className:a.classNames(a.uDropDownsActionSheet.subtitle({c:v}))})),m.createElement("div",{className:a.classNames(a.uDropDownsActionSheet.actions({c:v}))},m.createElement(R.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",themeColor:"base",size:"large",onClick:this.toggleBtnClick,icon:"x",svgIcon:q.xIcon}))),m.createElement("div",{className:a.classNames(a.uDropDownsActionSheet.titleBarGroup({c:v}))},this.renderMobileListFilter())),m.createElement(P.ActionSheetContent,{overflowHidden:!0},m.createElement("div",{className:a.classNames(a.uComboBox.listContainer({c:y}))},m.createElement("div",{className:a.classNames(a.uComboBox.list({c:y,list:n,size:"large",tableSize:i,virtual:d}))},e&&m.createElement("div",{className:a.classNames(a.uComboBox.listHeader({c:y}))},e),!n&&c&&g.length!==0&&m.createElement(K,{group:c,groupMode:r,render:o}),this.renderList(),t&&m.createElement("div",{className:a.classNames(a.uComboBox.listFooter({c:y}),this.props.footerClassName)},t)))))}renderListContainer(){const s=this.base,{dir:e,header:t,footer:i,groupField:l,groupMode:r,size:n,list:d,virtual:p,groupStickyHeaderItemRender:o,unstyled:u}=this.props,g=h.getFilteredData(this.props),x=this.props.opened!==void 0?this.props.opened:this.state.opened,I=s.getPopupSettings(),y=I.width!==void 0?I.width:s.popupWidth,v=u&&u.uComboBox;let{group:c}=this.state;return c===void 0&&l!==void 0&&(c=h.getItemValue(g[0],l)),m.createElement(se,{width:y,popupSettings:{...I,anchor:I.anchor||this.element,show:x,popupClass:a.classNames(I.popupClass,a.uComboBox.listContainer({c:v,popup:!0}))},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[g.length]},m.createElement("div",{className:a.classNames(a.uComboBox.list({c:v,list:d,size:n,tableSize:n,virtual:p}))},t&&m.createElement("div",{className:a.classNames(a.uComboBox.listHeader({c:v}))},t),!d&&c&&g.length!==0&&m.createElement(K,{group:c,groupMode:r,render:o}),this.renderList(),i&&m.createElement("div",{className:a.classNames(a.uComboBox.listFooter({c:v}),this.props.footerClassName)},i)))}renderList(){const s=this.base,{textField:e,dataItemKey:t,listNoDataRender:i,itemRender:l,groupHeaderItemRender:r,virtual:n={skip:0,total:void 0},unstyled:d}=this.props,p=h.getFilteredData(this.props),o=s.getPopupSettings(),u=s.vs,g=n.skip,x=this.props.opened!==void 0?this.props.opened:this.state.opened,I=`translateY(${u.translate}px)`,y=x?this.getFocusedIndex(this.hasDuplicates):void 0,v=this.props.filter!==void 0?this.props.filter:this.state.text,c=h.getItemValue(this.value,e),f=h.isPresent(v)&&v!==c?null:this.value,C=this.props.list||ie,D=d&&d.uComboBox;return m.createElement(C,{id:s.listBoxId,virtual:!!n,show:x,data:p,focusedIndex:y,value:f,textField:e,valueField:t,groupField:this.props.groupField,groupMode:this.props.groupMode,isMultiColumn:this.props.isMultiColumn,optionsGuid:s.guid,hasDuplicates:this.hasDuplicates,listRef:w=>{u.list=this.base.list=w,this.itemHeight=0},wrapperStyle:this.state.windowWidth&&this.state.windowWidth>k.MOBILE_MEDIUM_DEVISE?{maxHeight:o.height}:{},wrapperCssClass:a.classNames(a.uComboBox.listContent({c:D,virtual:n})),listStyle:u.enabled?{transform:I}:void 0,key:"listkey",skip:g,onClick:this.handleItemClick,itemRender:l,groupHeaderItemRender:r,noDataRender:i,onMouseDown:w=>w.preventDefault(),onScroll:this.onScroll,wrapperRef:u.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:n.total})}renderSearchBar(s,e,t){const{tabIndex:i,disabled:l,title:r,ariaLabelledBy:n,ariaDescribedBy:d,dataItemKey:p,virtual:o={skip:0},accessKey:u}=this.props,g=h.getFilteredData(this.props),x=this.props.opened!==void 0?this.props.opened:this.state.opened,I=this.value,y=Math.max(0,g.findIndex(c=>h.areSame(c,I,p)));this._suggested&&!h.areSame(this._valueOnDidUpdate,I,p)&&(this._suggested="");const v={accessKey:u};return m.createElement(te,{id:e,readOnly:x&&this.mobileMode,placeholder:t,tabIndex:i,title:r,value:s+this._suggested,suggestedText:this._suggested,ref:c=>this._input=c&&c.input,onClick:this.onInputClick,onKeyDown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:l,expanded:x,owns:this.base.listBoxId,activedescendant:`option-${this.base.guid}-${y+o.skip}`,role:"combobox",ariaLabelledBy:n,ariaLabel:this.props.ariaLabel,ariaDescribedBy:d,ariaRequired:this.required,render:this.props.valueRender,ariaControls:this.base.listBoxId,...v})}clearValue(){const s=this.base.initState();this._suggested="",this.navigationIndex=void 0,this.base.filterChanged("",s),this.props.filter===void 0&&this.state.text!==void 0&&(s.data.text=void 0),this.triggerOnChange(null,s);const e=this.props.opened!==void 0?this.props.opened:this.state.opened,t=this.mobileMode;e&&!t&&this.base.togglePopup(s),this.applyState(s)}triggerOnChange(s,e){const t=this.value;!this.hasDuplicates&&(!h.isPresent(t)&&!h.isPresent(s)||h.areSame(t,s,this.props.dataItemKey))||(this.props.value===void 0&&(e.data.value=s),this._valueDuringOnChange=s,e.events.push({type:"onChange"}))}getFocusedIndex(s){const e=this.value,{textField:t,dataItemKey:i,virtual:l={skip:0},focusedItemIndex:r=h.itemIndexStartsWith,skipDisabledItems:n}=this.props,d=h.getFilteredData(this.props),p=this.props.filter?this.props.filter:this.state.text;return s&&this.navigationIndex!==void 0?this.navigationIndex:h.isPresent(e)&&p===void 0?d.findIndex(o=>h.areSame(o,e,i)):p?r(d,p,t):n&&t&&!p&&l.skip===0?d.findIndex(o=>!o.disabled&&o[t]):l.skip===0?0:-1}suggestValue(s){const{data:e,textField:t}=this.props;this._suggested=h.suggestValue(s,e,t)}applyState(s){this.base.applyState(s),this._valueDuringOnChange=void 0}calculateMedia(s){for(const e of s)this.setState({windowWidth:e.target.clientWidth})}};S.displayName="ComboBox",S.propTypes={...N.propTypes,size:b.oneOf([null,"small","medium","large"]),rounded:b.oneOf([null,"small","medium","large","full"]),fillMode:b.oneOf([null,"solid","flat","outline"]),dataItemKey:b.string,groupField:b.string,groupMode:b.oneOf([void 0,"classic","modern"]),isMultiColumn:b.bool,suggest:b.bool,placeholder:b.string,title:b.string,allowCustom:b.bool,clearButton:b.bool,iconClassName:b.string,svgIcon:a.svgIconPropType,validationMessage:b.string,required:b.bool,id:b.string,ariaLabelledBy:b.string,ariaLabel:b.string,ariaDescribedBy:b.string,list:b.any,valueRender:b.func,skipDisabledItems:b.bool},S.defaultProps={...N.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",allowCustom:!1,clearButton:!0,required:!1,groupMode:"modern",isMultiColumn:!1,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let M=S;const U=a.createPropsContext(),W=a.withIdHOC(a.withPropsContext(U,a.withUnstyledHOC(M)));W.displayName="KendoReactComboBox";exports.ComboBox=W;exports.ComboBoxPropsContext=U;exports.ComboBoxWithoutContext=M;