@progress/kendo-react-dropdowns 7.2.4-develop.3 → 7.3.0-develop.1

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.
Files changed (107) hide show
  1. package/AutoComplete/AutoComplete.js +8 -0
  2. package/AutoComplete/AutoComplete.mjs +458 -0
  3. package/ComboBox/ComboBox.js +8 -0
  4. package/ComboBox/ComboBox.mjs +618 -0
  5. package/DropDownList/DropDownList.js +8 -0
  6. package/DropDownList/DropDownList.mjs +630 -0
  7. package/DropDownTree/DropDownTree.js +8 -0
  8. package/DropDownTree/DropDownTree.mjs +550 -0
  9. package/DropDownTree/ListNoData.js +8 -0
  10. package/DropDownTree/ListNoData.mjs +13 -0
  11. package/DropDownTree/useDropdownWidth.js +8 -0
  12. package/DropDownTree/useDropdownWidth.mjs +25 -0
  13. package/MultiColumnComboBox/MultiColumnComboBox.js +8 -0
  14. package/MultiColumnComboBox/MultiColumnComboBox.mjs +186 -0
  15. package/MultiSelect/MultiSelect.js +8 -0
  16. package/MultiSelect/MultiSelect.mjs +694 -0
  17. package/MultiSelect/TagList.js +8 -0
  18. package/MultiSelect/TagList.mjs +48 -0
  19. package/MultiSelectTree/MultiSelectTree.js +8 -0
  20. package/MultiSelectTree/MultiSelectTree.mjs +590 -0
  21. package/MultiSelectTree/utils.js +8 -0
  22. package/MultiSelectTree/utils.mjs +74 -0
  23. package/common/AdaptiveMode.js +8 -0
  24. package/common/AdaptiveMode.mjs +73 -0
  25. package/common/ClearButton.js +8 -0
  26. package/common/ClearButton.mjs +38 -0
  27. package/common/DropDownBase.js +8 -0
  28. package/common/DropDownBase.mjs +194 -0
  29. package/common/GroupStickyHeader.js +8 -0
  30. package/common/GroupStickyHeader.mjs +22 -0
  31. package/common/List.js +8 -0
  32. package/common/List.mjs +117 -0
  33. package/common/ListContainer.js +8 -0
  34. package/common/ListContainer.mjs +33 -0
  35. package/common/ListDefaultItem.js +8 -0
  36. package/common/ListDefaultItem.mjs +36 -0
  37. package/common/ListFilter.js +8 -0
  38. package/common/ListFilter.mjs +49 -0
  39. package/common/ListGroupItem.js +8 -0
  40. package/common/ListGroupItem.mjs +32 -0
  41. package/common/ListItem.js +8 -0
  42. package/common/ListItem.mjs +49 -0
  43. package/common/MultiColumnList.js +8 -0
  44. package/common/MultiColumnList.mjs +28 -0
  45. package/common/Navigation.js +8 -0
  46. package/common/Navigation.mjs +29 -0
  47. package/common/SearchBar.js +8 -0
  48. package/common/SearchBar.mjs +65 -0
  49. package/common/VirtualScroll.js +8 -0
  50. package/common/VirtualScroll.mjs +75 -0
  51. package/common/constants.js +8 -0
  52. package/common/constants.mjs +13 -0
  53. package/common/settings.js +8 -0
  54. package/common/settings.mjs +12 -0
  55. package/common/utils.js +8 -0
  56. package/common/utils.mjs +109 -0
  57. package/common/withCustomComponent.js +8 -0
  58. package/common/withCustomComponent.mjs +13 -0
  59. package/dist/cdn/js/kendo-react-dropdowns.js +8 -5
  60. package/index.d.mts +4098 -5
  61. package/index.d.ts +4098 -31
  62. package/index.js +8 -5
  63. package/index.mjs +55 -4429
  64. package/messages/index.js +8 -0
  65. package/messages/index.mjs +27 -0
  66. package/package-metadata.js +8 -0
  67. package/package-metadata.mjs +19 -0
  68. package/package.json +9 -9
  69. package/AutoComplete/AutoComplete.d.ts +0 -236
  70. package/AutoComplete/AutoCompleteProps.d.ts +0 -254
  71. package/ComboBox/ComboBox.d.ts +0 -254
  72. package/ComboBox/ComboBoxProps.d.ts +0 -324
  73. package/DropDownList/DropDownList.d.ts +0 -264
  74. package/DropDownList/DropDownListProps.d.ts +0 -329
  75. package/DropDownTree/DropDownTree.d.ts +0 -74
  76. package/DropDownTree/DropDownTreeProps.d.ts +0 -297
  77. package/DropDownTree/ListNoData.d.ts +0 -10
  78. package/DropDownTree/useDropdownWidth.d.ts +0 -10
  79. package/MultiColumnComboBox/MultiColumnComboBox.d.ts +0 -300
  80. package/MultiSelect/MultiSelect.d.ts +0 -262
  81. package/MultiSelect/MultiSelectProps.d.ts +0 -325
  82. package/MultiSelect/TagList.d.ts +0 -42
  83. package/MultiSelectTree/MultiSelectTree.d.ts +0 -85
  84. package/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -324
  85. package/MultiSelectTree/utils.d.ts +0 -21
  86. package/common/AdaptiveMode.d.ts +0 -25
  87. package/common/ClearButton.d.ts +0 -18
  88. package/common/DropDownBase.d.ts +0 -180
  89. package/common/GroupStickyHeader.d.ts +0 -28
  90. package/common/List.d.ts +0 -50
  91. package/common/ListContainer.d.ts +0 -22
  92. package/common/ListDefaultItem.d.ts +0 -20
  93. package/common/ListFilter.d.ts +0 -23
  94. package/common/ListGroupItem.d.ts +0 -37
  95. package/common/ListItem.d.ts +0 -65
  96. package/common/MultiColumnList.d.ts +0 -9
  97. package/common/Navigation.d.ts +0 -17
  98. package/common/SearchBar.d.ts +0 -47
  99. package/common/VirtualScroll.d.ts +0 -45
  100. package/common/constants.d.ts +0 -8
  101. package/common/events.d.ts +0 -76
  102. package/common/filterDescriptor.d.ts +0 -45
  103. package/common/settings.d.ts +0 -109
  104. package/common/utils.d.ts +0 -70
  105. package/common/withCustomComponent.d.ts +0 -11
  106. package/messages/index.d.ts +0 -44
  107. package/package-metadata.d.ts +0 -9
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),g=require("prop-types"),B=require("../common/SearchBar.js"),q=require("../common/ListContainer.js"),E=require("../common/List.js"),k=require("../common/DropDownBase.js"),T=require("../common/GroupStickyHeader.js"),I=require("../common/utils.js"),l=require("@progress/kendo-react-common"),N=require("@progress/kendo-react-labels"),L=require("../package-metadata.js"),R=require("../common/ClearButton.js"),_=require("../common/withCustomComponent.js");function H(x){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const t in x)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(x,t);Object.defineProperty(a,t,e.get?e:{enumerable:!0,get:()=>x[t]})}}return a.default=x,Object.freeze(a)}const y=H(M),z="Please enter a valid value!",{sizeMap:O,roundedMap:A}=l.kendoThemeMaps,b=class b extends y.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=(t,e)=>{const{data:s=[]}=this.props,n=I.getItemValue(s[t],this.props.textField);this.triggerOnChange(n,e)},this.itemFocus=(t,e)=>{const{data:s=[],textField:n}=this.props,i=s[t];I.areSame(this.state.focusedItem,i,n)||(e.data.focusedItem=i)},this.togglePopup=t=>{this.base.togglePopup(t)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||z)},this.onScroll=t=>{this._isScrolling=!0;const{list:e}=this.base,{groupField:s}=this.props;let{data:n=[]}=this.props;if(!s||!n.length)return;const i=this.itemHeight||(e?e.children[0].offsetHeight:0),p=t.target.scrollTop;s&&(n=this.base.getGroupedDataModernMode(n,s));let o=n[0][s];for(let d=1;d<n.length&&!(i*d>p);d++)n[d]&&n[d][s]&&(o=n[d][s]);o!==this.state.group&&this.setState({group:o})},this.handleItemClick=(t,e)=>{this.base.handleItemClick(t,e),this._valueDuringOnChange=void 0},this.onChangeHandler=t=>{const s=this.base.initState(),n=t.currentTarget,i=n.value,r=n.selectionEnd===i.length;s.syntheticEvent=t;const p=this._suggested,o=this.value,d=o&&o.substring(0,o.length-p.length),f=d&&d===i,h=d&&d.length>i.length,{suggest:m}=this.props,u=this.props.opened!==void 0?this.props.opened:this.state.opened;if(m!==void 0&&m!==!1){f||h||!r?this._suggested="":this.suggestValue(i);const c=i+this._suggested,v={userInput:i,value:this._suggested};this.triggerOnChange(c,s,{suggestion:v})}else this._suggested="",this.triggerOnChange(i,s);(!u&&i||u&&!i)&&this.togglePopup(s),s.data.focusedItem=void 0,this.applyState(s),this.setState({group:void 0})},this.clearButtonClick=t=>{const s=this.base.initState(),n=this.props.opened!==void 0?this.props.opened:this.state.opened;s.syntheticEvent=t;const i="";this._suggested="",this.triggerOnChange(i,s),this.state.focusedItem!==void 0&&(s.data.focusedItem=void 0),n&&this.togglePopup(s),this.applyState(s)},this.onInputKeyDown=t=>{const{data:e=[],skipDisabledItems:s,groupField:n,textField:i}=this.props;this._isScrolling&&(this._isScrolling=!1);const r=this.focusedIndex(),p=e[r],o=t.keyCode,d=t.altKey,f=this.props.opened!==void 0?this.props.opened:this.state.opened,h=this.base.initState();h.syntheticEvent=t;const m=()=>{f&&t.preventDefault()};if(d&&o===l.Keys.down)this.setState({opened:!0});else if(d&&o===l.Keys.up)this.setState({opened:!1});else if(f&&o===l.Keys.pageUp)this.base.scrollPopupByPageSize(-1);else if(f&&o===l.Keys.pageDown)this.base.scrollPopupByPageSize(1);else if(f&&(o===l.Keys.enter||o===l.Keys.esc))m(),s===!1&&p&&p.disabled?(f&&this.togglePopup(h),this.applyState(h)):this.applyInputValue(t.currentTarget.value,h,t.keyCode);else if(!f&&o===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(o===l.Keys.up||o===l.Keys.down){if(n!==""&&i)if(!this.props.skipDisabledItems&&f)this.onNavigate(h,o);else{let u=0;if(o===l.Keys.down||o===l.Keys.right){const c=e.slice(r+1).find(v=>!v.disabled&&v[i]);u=c&&e.findIndex(v=>v[i]===c[i])}else if(o===l.Keys.up||o===l.Keys.left){let c;if(r===-1)c=e,u=e.findIndex(v=>!v.disabled&&v[i]);else{c=e.slice(0,r);let v=c.pop();for(;v&&v.disabled;)v=c.pop();u=v&&e.findIndex(C=>C[i]===v[i])}}if(u!==void 0){const c=u-r;this.onNavigate(h,o,c)}else u===void 0&&e.findIndex(c=>c[i])===e.length-1&&this.onNavigate(h,o)}else if(!this.props.skipDisabledItems&&f)this.onNavigate(h,o);else{let u=null;if(o===l.Keys.down||o===l.Keys.right)u=e.slice(r+1).find(c=>!c.disabled);else if(o===l.Keys.up||o===l.Keys.left){const c=e.slice(0,r);for(u=c.pop();u&&u.disabled;)u=c.pop()}if(u){const c=u.id-r-1;this.onNavigate(h,o,c)}else this.onNavigate(h,o)}this.applyState(h),m()}},this.handleBlur=t=>{if(this.state.focused){const e=this.base.initState();e.data.focused=!1,e.events.push({type:"onBlur"}),e.syntheticEvent=t,this.applyInputValue(t.currentTarget.value,e)}},l.validatePackage(L.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,t=!this.required||this.value!=="",e=this.props.valid!==void 0?this.props.valid:t;return{customError:a,valid:e,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,t){var m;const{groupField:e="",data:s=[]}=this.props,{data:n=[]}=a,i=this.focusedIndex(),r=s[i],p=n!==s,o=r!==void 0&&t.focusedItem!==r,d=this.props.opened!==void 0?this.props.opened:this.state.opened,f=a.opened!==void 0?a.opened:t.opened,h=!f&&d;if(e==="")(d&&(o||p)||h)&&this.base.scrollToItem(i);else if(!this._isScrolling){let u=(m=this.base.getGroupedDataModernMode(s,e))==null?void 0:m.indexOf(r);h&&(s&&s.length!==0&&this.base.resetGroupStickyHeader(s[0][e],this),this.base.scrollToItem(u)),d&&f&&o&&this.base.scrollToItem(u)}this.setValidity()}componentDidMount(){this.base.didMount(),this.setValidity()}render(){const{dir:a,disabled:t,label:e,className:s,style:n,loading:i,suggest:r,size:p,rounded:o,fillMode:d}=this.props,f=!this.validityStyles||this.validity.valid,h=this.base,m=this.value,u=this.props.clearButton!==!1&&!i&&!!m,c=this.props.id||this._inputId;typeof r=="string"&&(this._suggested=r);const[v,C]=_(this.props.prefix||y.Fragment),[K,V]=_(this.props.suffix||y.Fragment),w=y.createElement("span",{className:l.classNames("k-autocomplete k-input",s,{[`k-input-${O[p]||p}`]:p,[`k-rounded-${A[o]||o}`]:o,[`k-input-${d}`]:d,"k-invalid":!f,"k-loading":i,"k-required":this.required,"k-disabled":t}),ref:D=>{this._element=D,h.wrapper=D},style:e?{...n,width:void 0}:n,dir:a},this.props.prefix&&y.createElement(v,{...C}),this.renderSearchBar(m||"",c),i&&y.createElement(l.IconWrap,{className:"k-input-loading-icon",name:"loading"}),u&&!i&&y.createElement(R,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&y.createElement(K,{...V}),this.renderListContainer());return e?y.createElement(N.FloatingLabel,{label:e,editorId:c,editorValue:m,editorValid:f,editorDisabled:t,style:{width:n?n.width:void 0},children:w}):w}onNavigate(a,t,e){const s=this.value,{data:n=[],textField:i,focusedItemIndex:r}=this.props,p=this.state.focusedItem!==void 0?n.findIndex(d=>I.areSame(d,this.state.focusedItem,i)):r?r(n,s,i):n.indexOf(I.getFocusedItem(n,s,i)),o=this.base.navigation.navigate({keyCode:t,current:p,max:n.length-1,min:0,skipItems:e||void 0});o!==void 0&&this.itemFocus(o,a),this.applyState(a)}applyInputValue(a,t,e){const s=this.props.opened!==void 0?this.props.opened:this.state.opened,{data:n=[],textField:i}=this.props,r=this.focusedIndex(),p=n[r];if(this._suggested="",s&&e===l.Keys.enter&&p&&!p.disabled){const o=I.getItemValue(n[this.focusedIndex(a)],i);this.triggerOnChange(o,t)}s&&this.togglePopup(t),this.applyState(t)}renderSearchBar(a,t){const e=this.base,{placeholder:s,tabIndex:n,disabled:i,readonly:r}=this.props,{focused:p}=this.state,o=this.props.opened!==void 0?this.props.opened:this.state.opened;return y.createElement(B,{id:t,placeholder:s,tabIndex:n,accessKey:this.props.accessKey,value:a,suggestedText:this._suggested,focused:p,name:this.props.name,ref:d=>this._input=d&&d.input,onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:e.handleFocus,onBlur:this.handleBlur,disabled:i,readOnly:r,expanded:o,owns:e.listBoxId,activedescendant:"option-"+e.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:t,header:e,footer:s,data:n=[],size:i,groupField:r,list:p,groupStickyHeaderItemRender:o}=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;let{group:m}=this.state;return m===void 0&&r!==void 0&&(m=I.getItemValue(n[0],r)),y.createElement(q,{width:h,popupSettings:{...d,anchor:d.anchor||this.element,show:f,popupClass:l.classNames(d.popupClass,"k-list-container","k-autocomplete-popup")},dir:t!==void 0?t:this.base.dirCalculated,itemsCount:[n.length]},e&&y.createElement("div",{className:"k-list-header"},e),y.createElement("div",{className:l.classNames("k-list",{[`k-list-${O[i]||i}`]:i})},!p&&m&&n.length!==0&&y.createElement(T,{group:m,groupMode:"modern",render:o}),this.renderList()),s&&y.createElement("div",{className:"k-list-footer"},s))}renderList(){const a=this.base,t=a.getPopupSettings(),{textField:e,data:s=[],listNoDataRender:n,itemRender:i,groupHeaderItemRender:r}=this.props,p=this.value,o=this.props.opened!==void 0?this.props.opened:this.state.opened;return y.createElement(E,{id:a.listBoxId,show:o,data:s.slice(),focusedIndex:this.focusedIndex(),value:p,textField:e,valueField:e,highlightSelected:!1,optionsGuid:a.guid,groupField:this.props.groupField,groupMode:"modern",listRef:d=>a.list=d,wrapperStyle:{maxHeight:t.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:i,groupHeaderItemRender:r,noDataRender:n,onMouseDown:d=>d.preventDefault(),onScroll:this.onScroll})}triggerOnChange(a,t,e){this.value===a&&!e||(t.data.value=a,this._valueDuringOnChange=a,t.events.push({type:"onChange",...e||{}}))}applyState(a){this.base.applyState(a),this._valueDuringOnChange=void 0}suggestValue(a){if(this._suggested="",a){const{data:t=[],textField:e}=this.props,s=t[I.itemIndexStartsWith(t,a,e)];if(s){const n=I.getItemValue(s,e);a.toLowerCase()!==n.toLowerCase()&&(this._suggested=n.substring(a.length))}}}focusedIndex(a){const{data:t=[],textField:e,focusedItemIndex:s,skipDisabledItems:n}=this.props,i=a!==void 0?a:this.value;if(this.state.focusedItem!==void 0)return t.findIndex(r=>I.areSame(r,this.state.focusedItem,e));if(s)return s(t,i,e);{const r=t.indexOf(I.getFocusedItem(t,i,e));return n&&e&&r===-1?t.findIndex(p=>!p.disabled&&p[e]):Math.max(0,r)}}};b.displayName="AutoComplete",b.propTypes={...k.basicPropTypes,size:g.oneOf([null,"small","medium","large"]),rounded:g.oneOf([null,"small","medium","large","full"]),fillMode:g.oneOf([null,"solid","flat","outline"]),groupField:g.string,suggest:g.oneOfType([g.bool,g.string]),placeholder:g.string,value:g.string,defaultValue:g.string,validationMessage:g.string,required:g.bool,readonly:g.bool,clearButton:g.bool,valueRender:g.func,id:g.string,ariaLabelledBy:g.string,ariaDescribedBy:g.string,list:g.any,skipDisabledItems:g.bool},b.defaultProps={...k.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let S=b;const P=l.createPropsContext(),F=l.withIdHOC(l.withPropsContext(P,S));F.displayName="KendoReactAutoComplete";exports.AutoComplete=F;exports.AutoCompletePropsContext=P;exports.AutoCompleteWithoutContext=S;
@@ -0,0 +1,458 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as I from "react";
10
+ import c from "prop-types";
11
+ import E from "../common/SearchBar.mjs";
12
+ import M from "../common/ListContainer.mjs";
13
+ import T from "../common/List.mjs";
14
+ import S from "../common/DropDownBase.mjs";
15
+ import N from "../common/GroupStickyHeader.mjs";
16
+ import { getItemValue as b, areSame as C, getFocusedItem as F, itemIndexStartsWith as L } from "../common/utils.mjs";
17
+ import { Keys as f, validatePackage as H, classNames as k, IconWrap as R, createPropsContext as q, withIdHOC as K, withPropsContext as z, kendoThemeMaps as G } from "@progress/kendo-react-common";
18
+ import { FloatingLabel as $ } from "@progress/kendo-react-labels";
19
+ import { packageMetadata as A } from "../package-metadata.mjs";
20
+ import U from "../common/ClearButton.mjs";
21
+ import O from "../common/withCustomComponent.mjs";
22
+ const j = "Please enter a valid value!", { sizeMap: P, roundedMap: J } = G, y = class y extends I.Component {
23
+ constructor(a) {
24
+ super(a), this.state = {}, this.base = new S(this), this._element = null, this._suggested = "", this._input = null, this._isScrolling = !1, this.itemHeight = 0, this.focus = () => {
25
+ this._input && this._input.focus();
26
+ }, this.handleItemSelect = (t, e) => {
27
+ const { data: s = [] } = this.props, n = b(s[t], this.props.textField);
28
+ this.triggerOnChange(n, e);
29
+ }, this.itemFocus = (t, e) => {
30
+ const { data: s = [], textField: n } = this.props, i = s[t];
31
+ C(this.state.focusedItem, i, n) || (e.data.focusedItem = i);
32
+ }, this.togglePopup = (t) => {
33
+ this.base.togglePopup(t);
34
+ }, this.setValidity = () => {
35
+ this._input && this._input.setCustomValidity && this._input.setCustomValidity(
36
+ this.validity.valid ? "" : this.props.validationMessage || j
37
+ );
38
+ }, this.onScroll = (t) => {
39
+ this._isScrolling = !0;
40
+ const { list: e } = this.base, { groupField: s } = this.props;
41
+ let { data: n = [] } = this.props;
42
+ if (!s || !n.length)
43
+ return;
44
+ const i = this.itemHeight || (e ? e.children[0].offsetHeight : 0), l = t.target.scrollTop;
45
+ s && (n = this.base.getGroupedDataModernMode(n, s));
46
+ let o = n[0][s];
47
+ for (let d = 1; d < n.length && !(i * d > l); d++)
48
+ n[d] && n[d][s] && (o = n[d][s]);
49
+ o !== this.state.group && this.setState({
50
+ group: o
51
+ });
52
+ }, this.handleItemClick = (t, e) => {
53
+ this.base.handleItemClick(t, e), this._valueDuringOnChange = void 0;
54
+ }, this.onChangeHandler = (t) => {
55
+ const s = this.base.initState(), n = t.currentTarget, i = n.value, r = n.selectionEnd === i.length;
56
+ s.syntheticEvent = t;
57
+ const l = this._suggested, o = this.value, d = o && o.substring(0, o.length - l.length), g = d && d === i, h = d && d.length > i.length, { suggest: m } = this.props, p = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
58
+ if (m !== void 0 && m !== !1) {
59
+ g || h || !r ? this._suggested = "" : this.suggestValue(i);
60
+ const u = i + this._suggested, v = { userInput: i, value: this._suggested };
61
+ this.triggerOnChange(u, s, { suggestion: v });
62
+ } else
63
+ this._suggested = "", this.triggerOnChange(i, s);
64
+ (!p && i || p && !i) && this.togglePopup(s), s.data.focusedItem = void 0, this.applyState(s), this.setState({ group: void 0 });
65
+ }, this.clearButtonClick = (t) => {
66
+ const s = this.base.initState(), n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
67
+ s.syntheticEvent = t;
68
+ const i = "";
69
+ this._suggested = "", this.triggerOnChange(i, s), this.state.focusedItem !== void 0 && (s.data.focusedItem = void 0), n && this.togglePopup(s), this.applyState(s);
70
+ }, this.onInputKeyDown = (t) => {
71
+ const { data: e = [], skipDisabledItems: s, groupField: n, textField: i } = this.props;
72
+ this._isScrolling && (this._isScrolling = !1);
73
+ const r = this.focusedIndex(), l = e[r], o = t.keyCode, d = t.altKey, g = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
74
+ h.syntheticEvent = t;
75
+ const m = () => {
76
+ g && t.preventDefault();
77
+ };
78
+ if (d && o === f.down)
79
+ this.setState({
80
+ opened: !0
81
+ });
82
+ else if (d && o === f.up)
83
+ this.setState({
84
+ opened: !1
85
+ });
86
+ else if (g && o === f.pageUp)
87
+ this.base.scrollPopupByPageSize(-1);
88
+ else if (g && o === f.pageDown)
89
+ this.base.scrollPopupByPageSize(1);
90
+ else if (g && (o === f.enter || o === f.esc))
91
+ m(), s === !1 && l && l.disabled ? (g && this.togglePopup(h), this.applyState(h)) : this.applyInputValue(t.currentTarget.value, h, t.keyCode);
92
+ else if (!g && o === f.esc) {
93
+ const p = "";
94
+ this._suggested = "", this.triggerOnChange(p, h), this.state.focusedItem !== void 0 && (h.data.focusedItem = void 0), this.applyState(h);
95
+ } else if (o === f.up || o === f.down) {
96
+ if (n !== "" && i)
97
+ if (!this.props.skipDisabledItems && g)
98
+ this.onNavigate(h, o);
99
+ else {
100
+ let p = 0;
101
+ if (o === f.down || o === f.right) {
102
+ const u = e.slice(r + 1).find((v) => !v.disabled && v[i]);
103
+ p = u && e.findIndex((v) => v[i] === u[i]);
104
+ } else if (o === f.up || o === f.left) {
105
+ let u;
106
+ if (r === -1)
107
+ u = e, p = e.findIndex((v) => !v.disabled && v[i]);
108
+ else {
109
+ u = e.slice(0, r);
110
+ let v = u.pop();
111
+ for (; v && v.disabled; )
112
+ v = u.pop();
113
+ p = v && e.findIndex((x) => x[i] === v[i]);
114
+ }
115
+ }
116
+ if (p !== void 0) {
117
+ const u = p - r;
118
+ this.onNavigate(h, o, u);
119
+ } else
120
+ p === void 0 && e.findIndex((u) => u[i]) === e.length - 1 && this.onNavigate(h, o);
121
+ }
122
+ else if (!this.props.skipDisabledItems && g)
123
+ this.onNavigate(h, o);
124
+ else {
125
+ let p = null;
126
+ if (o === f.down || o === f.right)
127
+ p = e.slice(r + 1).find((u) => !u.disabled);
128
+ else if (o === f.up || o === f.left) {
129
+ const u = e.slice(0, r);
130
+ for (p = u.pop(); p && p.disabled; )
131
+ p = u.pop();
132
+ }
133
+ if (p) {
134
+ const u = p.id - r - 1;
135
+ this.onNavigate(h, o, u);
136
+ } else
137
+ this.onNavigate(h, o);
138
+ }
139
+ this.applyState(h), m();
140
+ }
141
+ }, this.handleBlur = (t) => {
142
+ if (this.state.focused) {
143
+ const e = this.base.initState();
144
+ e.data.focused = !1, e.events.push({ type: "onBlur" }), e.syntheticEvent = t, this.applyInputValue(t.currentTarget.value, e);
145
+ }
146
+ }, H(A);
147
+ }
148
+ get _inputId() {
149
+ return this.props.id + "-accessibility-id";
150
+ }
151
+ /**
152
+ * @hidden
153
+ */
154
+ get element() {
155
+ return this._element;
156
+ }
157
+ /**
158
+ * The value of the AutoComplete.
159
+ */
160
+ get value() {
161
+ 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 : "";
162
+ }
163
+ /**
164
+ * Gets the `name` property of the AutoComplete.
165
+ */
166
+ get name() {
167
+ return this.props.name;
168
+ }
169
+ /**
170
+ * Represents the validity state into which the AutoComplete is set.
171
+ */
172
+ get validity() {
173
+ const a = this.props.validationMessage !== void 0, t = !this.required || this.value !== "", e = this.props.valid !== void 0 ? this.props.valid : t;
174
+ return {
175
+ customError: a,
176
+ valid: e,
177
+ valueMissing: this.value === null
178
+ };
179
+ }
180
+ /**
181
+ * @hidden
182
+ */
183
+ get validityStyles() {
184
+ return this.props.validityStyles !== void 0 ? this.props.validityStyles : y.defaultProps.validityStyles;
185
+ }
186
+ /**
187
+ * @hidden
188
+ */
189
+ get required() {
190
+ return this.props.required !== void 0 ? this.props.required : y.defaultProps.required;
191
+ }
192
+ /**
193
+ * @hidden
194
+ */
195
+ componentDidUpdate(a, t) {
196
+ var m;
197
+ const { groupField: e = "", data: s = [] } = this.props, { data: n = [] } = a, i = this.focusedIndex(), r = s[i], l = n !== s, o = r !== void 0 && t.focusedItem !== r, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, g = a.opened !== void 0 ? a.opened : t.opened, h = !g && d;
198
+ if (e === "")
199
+ (d && (o || l) || h) && this.base.scrollToItem(i);
200
+ else if (!this._isScrolling) {
201
+ let p = (m = this.base.getGroupedDataModernMode(s, e)) == null ? void 0 : m.indexOf(r);
202
+ h && (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][e], this), this.base.scrollToItem(p)), d && g && o && this.base.scrollToItem(p);
203
+ }
204
+ this.setValidity();
205
+ }
206
+ /**
207
+ * @hidden
208
+ */
209
+ componentDidMount() {
210
+ this.base.didMount(), this.setValidity();
211
+ }
212
+ /**
213
+ * @hidden
214
+ */
215
+ render() {
216
+ const { dir: a, disabled: t, label: e, className: s, style: n, loading: i, suggest: r, size: l, rounded: o, fillMode: d } = this.props, g = !this.validityStyles || this.validity.valid, h = this.base, m = this.value, p = this.props.clearButton !== !1 && !i && !!m, u = this.props.id || this._inputId;
217
+ typeof r == "string" && (this._suggested = r);
218
+ const [v, x] = O(this.props.prefix || I.Fragment), [B, V] = O(this.props.suffix || I.Fragment), D = /* @__PURE__ */ I.createElement(
219
+ "span",
220
+ {
221
+ className: k(
222
+ "k-autocomplete k-input",
223
+ s,
224
+ {
225
+ [`k-input-${P[l] || l}`]: l,
226
+ [`k-rounded-${J[o] || o}`]: o,
227
+ [`k-input-${d}`]: d,
228
+ "k-invalid": !g,
229
+ "k-loading": i,
230
+ "k-required": this.required,
231
+ "k-disabled": t
232
+ }
233
+ ),
234
+ ref: (_) => {
235
+ this._element = _, h.wrapper = _;
236
+ },
237
+ style: e ? { ...n, width: void 0 } : n,
238
+ dir: a
239
+ },
240
+ this.props.prefix && /* @__PURE__ */ I.createElement(v, { ...x }),
241
+ this.renderSearchBar(m || "", u),
242
+ i && /* @__PURE__ */ I.createElement(R, { className: "k-input-loading-icon", name: "loading" }),
243
+ p && !i && /* @__PURE__ */ I.createElement(U, { onClick: this.clearButtonClick, key: "clearbutton" }),
244
+ this.props.suffix && /* @__PURE__ */ I.createElement(B, { ...V }),
245
+ this.renderListContainer()
246
+ );
247
+ return e ? /* @__PURE__ */ I.createElement(
248
+ $,
249
+ {
250
+ label: e,
251
+ editorId: u,
252
+ editorValue: m,
253
+ editorValid: g,
254
+ editorDisabled: t,
255
+ style: { width: n ? n.width : void 0 },
256
+ children: D
257
+ }
258
+ ) : D;
259
+ }
260
+ /**
261
+ * @hidden
262
+ */
263
+ onNavigate(a, t, e) {
264
+ const s = this.value, { data: n = [], textField: i, focusedItemIndex: r } = this.props, l = this.state.focusedItem !== void 0 ? n.findIndex((d) => C(d, this.state.focusedItem, i)) : r ? r(n, s, i) : n.indexOf(F(n, s, i)), o = this.base.navigation.navigate({
265
+ keyCode: t,
266
+ current: l,
267
+ max: n.length - 1,
268
+ min: 0,
269
+ skipItems: e || void 0
270
+ });
271
+ o !== void 0 && this.itemFocus(o, a), this.applyState(a);
272
+ }
273
+ /**
274
+ * @hidden
275
+ */
276
+ applyInputValue(a, t, e) {
277
+ const s = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { data: n = [], textField: i } = this.props, r = this.focusedIndex(), l = n[r];
278
+ if (this._suggested = "", s && e === f.enter && l && !l.disabled) {
279
+ const o = b(n[this.focusedIndex(a)], i);
280
+ this.triggerOnChange(o, t);
281
+ }
282
+ s && this.togglePopup(t), this.applyState(t);
283
+ }
284
+ renderSearchBar(a, t) {
285
+ const e = this.base, { placeholder: s, tabIndex: n, disabled: i, readonly: r } = this.props, { focused: l } = this.state, o = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
286
+ return /* @__PURE__ */ I.createElement(
287
+ E,
288
+ {
289
+ id: t,
290
+ placeholder: s,
291
+ tabIndex: n,
292
+ accessKey: this.props.accessKey,
293
+ value: a,
294
+ suggestedText: this._suggested,
295
+ focused: l,
296
+ name: this.props.name,
297
+ ref: (d) => this._input = d && d.input,
298
+ onKeyDown: this.onInputKeyDown,
299
+ onChange: this.onChangeHandler,
300
+ onFocus: e.handleFocus,
301
+ onBlur: this.handleBlur,
302
+ disabled: i,
303
+ readOnly: r,
304
+ expanded: o,
305
+ owns: e.listBoxId,
306
+ activedescendant: "option-" + e.guid + "-" + this.focusedIndex(),
307
+ role: "combobox",
308
+ ariaLabelledBy: this.props.ariaLabelledBy,
309
+ ariaDescribedBy: this.props.ariaDescribedBy,
310
+ ariaRequired: this.required,
311
+ render: this.props.valueRender
312
+ }
313
+ );
314
+ }
315
+ renderListContainer() {
316
+ const a = this.base, {
317
+ dir: t,
318
+ header: e,
319
+ footer: s,
320
+ data: n = [],
321
+ size: i,
322
+ groupField: r,
323
+ list: l,
324
+ groupStickyHeaderItemRender: o
325
+ } = this.props, d = a.getPopupSettings(), g = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = d.width !== void 0 ? d.width : a.popupWidth;
326
+ let { group: m } = this.state;
327
+ return m === void 0 && r !== void 0 && (m = b(n[0], r)), /* @__PURE__ */ I.createElement(
328
+ M,
329
+ {
330
+ width: h,
331
+ popupSettings: {
332
+ ...d,
333
+ anchor: d.anchor || this.element,
334
+ show: g,
335
+ popupClass: k(
336
+ d.popupClass,
337
+ "k-list-container",
338
+ "k-autocomplete-popup"
339
+ )
340
+ },
341
+ dir: t !== void 0 ? t : this.base.dirCalculated,
342
+ itemsCount: [n.length]
343
+ },
344
+ e && /* @__PURE__ */ I.createElement("div", { className: "k-list-header" }, e),
345
+ /* @__PURE__ */ I.createElement(
346
+ "div",
347
+ {
348
+ className: k(
349
+ "k-list",
350
+ {
351
+ [`k-list-${P[i] || i}`]: i
352
+ }
353
+ )
354
+ },
355
+ !l && m && n.length !== 0 && /* @__PURE__ */ I.createElement(N, { group: m, groupMode: "modern", render: o }),
356
+ this.renderList()
357
+ ),
358
+ s && /* @__PURE__ */ I.createElement("div", { className: "k-list-footer" }, s)
359
+ );
360
+ }
361
+ renderList() {
362
+ const a = this.base, t = a.getPopupSettings(), {
363
+ textField: e,
364
+ data: s = [],
365
+ listNoDataRender: n,
366
+ itemRender: i,
367
+ groupHeaderItemRender: r
368
+ } = this.props, l = this.value, o = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
369
+ return /* @__PURE__ */ I.createElement(
370
+ T,
371
+ {
372
+ id: a.listBoxId,
373
+ show: o,
374
+ data: s.slice(),
375
+ focusedIndex: this.focusedIndex(),
376
+ value: l,
377
+ textField: e,
378
+ valueField: e,
379
+ highlightSelected: !1,
380
+ optionsGuid: a.guid,
381
+ groupField: this.props.groupField,
382
+ groupMode: "modern",
383
+ listRef: (d) => a.list = d,
384
+ wrapperStyle: { maxHeight: t.height },
385
+ wrapperCssClass: "k-list-content",
386
+ onClick: this.handleItemClick,
387
+ itemRender: i,
388
+ groupHeaderItemRender: r,
389
+ noDataRender: n,
390
+ onMouseDown: (d) => d.preventDefault(),
391
+ onScroll: this.onScroll
392
+ }
393
+ );
394
+ }
395
+ triggerOnChange(a, t, e) {
396
+ this.value === a && !e || (t.data.value = a, this._valueDuringOnChange = a, t.events.push({ type: "onChange", ...e || {} }));
397
+ }
398
+ applyState(a) {
399
+ this.base.applyState(a), this._valueDuringOnChange = void 0;
400
+ }
401
+ suggestValue(a) {
402
+ if (this._suggested = "", a) {
403
+ const { data: t = [], textField: e } = this.props, s = t[L(t, a, e)];
404
+ if (s) {
405
+ const n = b(s, e);
406
+ a.toLowerCase() !== n.toLowerCase() && (this._suggested = n.substring(a.length));
407
+ }
408
+ }
409
+ }
410
+ focusedIndex(a) {
411
+ const { data: t = [], textField: e, focusedItemIndex: s, skipDisabledItems: n } = this.props, i = a !== void 0 ? a : this.value;
412
+ if (this.state.focusedItem !== void 0)
413
+ return t.findIndex((r) => C(r, this.state.focusedItem, e));
414
+ if (s)
415
+ return s(t, i, e);
416
+ {
417
+ const r = t.indexOf(F(t, i, e));
418
+ return n && e && r === -1 ? t.findIndex((l) => !l.disabled && l[e]) : Math.max(0, r);
419
+ }
420
+ }
421
+ };
422
+ y.displayName = "AutoComplete", y.propTypes = {
423
+ ...S.basicPropTypes,
424
+ size: c.oneOf([null, "small", "medium", "large"]),
425
+ rounded: c.oneOf([null, "small", "medium", "large", "full"]),
426
+ fillMode: c.oneOf([null, "solid", "flat", "outline"]),
427
+ groupField: c.string,
428
+ suggest: c.oneOfType([c.bool, c.string]),
429
+ placeholder: c.string,
430
+ value: c.string,
431
+ defaultValue: c.string,
432
+ validationMessage: c.string,
433
+ required: c.bool,
434
+ readonly: c.bool,
435
+ clearButton: c.bool,
436
+ valueRender: c.func,
437
+ id: c.string,
438
+ ariaLabelledBy: c.string,
439
+ ariaDescribedBy: c.string,
440
+ list: c.any,
441
+ skipDisabledItems: c.bool
442
+ }, y.defaultProps = {
443
+ ...S.defaultProps,
444
+ size: "medium",
445
+ rounded: "medium",
446
+ fillMode: "solid",
447
+ skipDisabledItems: !0,
448
+ prefix: void 0,
449
+ suffix: void 0
450
+ };
451
+ let w = y;
452
+ const Q = q(), W = K(z(Q, w));
453
+ W.displayName = "KendoReactAutoComplete";
454
+ export {
455
+ W as AutoComplete,
456
+ Q as AutoCompletePropsContext,
457
+ w as AutoCompleteWithoutContext
458
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("react"),I=require("prop-types"),F=require("../common/DropDownBase.js"),g=require("@progress/kendo-react-common"),ee=require("@progress/kendo-react-labels"),u=require("../common/utils.js"),te=require("../common/SearchBar.js"),se=require("../common/ListContainer.js"),ie=require("../common/List.js"),oe=require("../common/ListFilter.js"),R=require("../common/GroupStickyHeader.js"),ae=require("../package-metadata.js"),ne=require("../common/ClearButton.js"),q=require("@progress/kendo-react-buttons"),A=require("@progress/kendo-svg-icons"),C=require("../messages/index.js"),z=require("@progress/kendo-react-intl"),_=require("@progress/kendo-react-layout"),E=require("../common/constants.js"),H=require("../common/withCustomComponent.js");function le(w){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(w){for(const e in w)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(w,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>w[e]})}}return s.default=w,Object.freeze(s)}const c=le(Z),re="Please enter a valid value!",{sizeMap:D,roundedMap:de}=g.kendoThemeMaps,k=class k extends c.Component{constructor(s){super(s),this.state={},this.base=new F(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this.itemHeight=0,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,t)=>{const{data:n=[],virtual:i,dataItemKey:l}=this.props,d=i?i.skip:0,a=n[e-d],r=!u.areSame(a,this.value,l);this.triggerOnChange(a,t),this.state.text!==void 0&&(t.data.text=void 0),r&&this.base.triggerPageChangeCornerItems(a,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{data:t=[],skipDisabledItems:n,textField:i}=this.props,l=this.getFocusedIndex(),d=this.getCurrentValueDisabledStatus(i,t,l),a=this.props.opened!==void 0?this.props.opened:this.state.opened,r=this.base.initState();if(r.syntheticEvent=e,!n&&i&&d&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(r),!a&&this.mobileMode){const o=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(o,r)}this.applyState(r)},this.renderMobileListFilter=()=>{const e=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text,t=u.getItemValue(this.value,this.props.textField),n=u.isPresent(e)?e:t;return c.createElement(oe,{value:n,ref:i=>this._adaptiveFilterInput=i&&i.element,onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:this.props.size,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:n}=this.base;t.scrollHandler(e);const{groupField:i}=this.props;let{data:l=[]}=this.props;if(!i||!l.length)return;const d=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:n?n.children[0].offsetHeight:0),r=e.target.scrollTop-t.skip*d;this.props.groupMode==="modern"&&(l=this.base.getGroupedDataModernMode(l,i));let o=l[0][i];for(let h=1;h<l.length&&!(d*h>r);h++)l[h]&&l[h][i]&&(o=l[h][i]);o!==this.state.group&&(this.setState({group:o}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:o}))},this.handleItemClick=(e,t)=>{this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.handleBlur=e=>{if(this.state.focused&&!this._skipBlur){const t=this.base.initState(),{textField:n,data:i=[]}=this.props,l=this.getFocusedIndex(),a=!(l===-1)&&this.getCurrentValueDisabledStatus(n,i,l);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,n&&a&&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,n=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const i=this.base.initState();i.syntheticEvent=e,this.base.togglePopup(i),this.base.filterChanged(n,i),this.applyState(i)}},this.onInputKeyDown=e=>{const{data:t=[],skipDisabledItems:n,textField:i,dataItemKey:l,groupField:d}=this.props,a=this.value,r=Math.max(0,t.findIndex(m=>u.areSame(m,a,l))),o=e.keyCode,h=this.props.opened!==void 0?this.props.opened:this.state.opened,p=this.base.initState();if(p.syntheticEvent=e,!e.altKey&&(o===g.Keys.up||o===g.Keys.down)){if(e.preventDefault(),d!==""&&i)if(!this.props.skipDisabledItems&&h)this.onNavigate(p,o);else{let m=0;if(o===g.Keys.down||o===g.Keys.right){const f=t.slice(r+1<t.length?r+1:r).find(y=>!y.disabled&&y[i]);m=f&&t.findIndex(y=>y[i]===f[i])}else if(o===g.Keys.up||o===g.Keys.left){let f;if(r===0)f=t,m=t.findIndex(y=>!y.disabled&&y[i]);else{f=t.slice(0,r);let y=f.pop();for(;y&&y.disabled;)y=f.pop();m=y&&t.findIndex(O=>O[i]===y[i])}}if(m!==void 0){const f=m-r;this.onNavigate(p,o,f)}else m===void 0&&t.findIndex(f=>f[i]===a[i])===t.length-1&&this.onNavigate(p,o)}else if(!this.props.skipDisabledItems&&h)this.onNavigate(p,o);else{let m=null;if(o===g.Keys.down||o===g.Keys.right)m=t.slice(r+1).find(f=>!f.disabled);else if(o===g.Keys.up||o===g.Keys.left){const f=t.slice(0,r);for(m=f.pop();m&&m.disabled;)m=f.pop()}if(m){const f=m.id-r-1;this.onNavigate(p,o,f)}else this.onNavigate(p,o)}this.applyState(p)}const v=()=>{e.preventDefault(),this.base.togglePopup(p),this.applyState(p)},x=this.getFocusedIndex(),b=x===-1,S=!b&&this.getCurrentValueDisabledStatus(i,t,x);h?o===g.Keys.pageUp?this.base.scrollPopupByPageSize(-1):o===g.Keys.pageDown?this.base.scrollPopupByPageSize(1):e.altKey&&o===g.Keys.up?v():o===g.Keys.enter?(e.preventDefault(),(i&&!b&&e.currentTarget.value?t[x][i]:void 0)?!n&&i&&S?this.clearValueOnEnterOrEsc(e):S||this.applyValueOnEnter(e.currentTarget.value,p):this.applyValueOnEnter(e.currentTarget.value,p)):o===g.Keys.esc&&(!n&&i&&S&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,p)):!h&&o===g.Keys.esc?this.clearValueOnEnterOrEsc(e):e.altKey&&o===g.Keys.down&&v()},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const n=this.props.opened!==void 0?this.props.opened:this.state.opened,i=e.currentTarget,l=i.value;if(this.props.suggest){const d=i.selectionEnd===l.length;let a=this.props.filter!==void 0?this.props.filter:this.state.text;u.isPresent(a)||(a=u.getItemValue(this.value,this.props.textField)||"");const r=a&&a===l,o=a&&a.length>l.length;r||o||!d?this._suggested="":this.suggestValue(l)}this.props.filter===void 0&&(t.data.text=l),this.state.focusedItem!==void 0&&(t.data.focusedItem=void 0),n||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||re)},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<=E.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{data:s=[],dataItemKey:e}=this.props,t=this.value;return s.findIndex(n=>u.areSame(n,t,e))}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:k.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:k.defaultProps.required}componentDidUpdate(s,e){var v;const{dataItemKey:t,virtual:n,groupField:i="",data:l=[],textField:d}=this.props,a=s.virtual?s.virtual.total:0,r=this.props.opened!==void 0?this.props.opened:this.state.opened,o=s.opened!==void 0?s.opened:e.opened,h=!o&&r,p=this.value;if(this._valueOnDidUpdate=p,n&&n.total!==a)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const x=s.value!==void 0?s.value:e.value;let b=l.findIndex(m=>u.areSame(m,p,t));this.props.groupMode==="modern"&&d&&p&&(b=(v=this.base.getGroupedDataModernMode(l,i))==null?void 0:v.map(m=>m[d]).indexOf(p[d]));const S=!u.areSame(x,p,t);h&&n?this.base.scrollToVirtualItem(n,b):h&&!n?(this.onPopupOpened(),l&&l.length!==0&&this.base.resetGroupStickyHeader(l[0][i],this),this.base.scrollToItem(b)):r&&o&&p&&S&&this.base.scrollToItem(b)}h&&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)}componentWillUnmount(){var s;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const s=z.provideLocalizationService(this).toLanguageString(C.comboArrowBtnAriaLabelExpand,C.messages[C.comboArrowBtnAriaLabelExpand]),e=z.provideLocalizationService(this).toLanguageString(C.comboArrowBtnAriaLabelCollapse,C.messages[C.comboArrowBtnAriaLabelCollapse]),{dir:t,disabled:n,clearButton:i=k.defaultProps.clearButton,label:l,textField:d,adaptive:a,className:r,style:o,loading:h,iconClassName:p,virtual:v,size:x,rounded:b,fillMode:S,opened:m=this.state.opened,placeholder:f,svgIcon:y}=this.props,{windowWidth:O=0}=this.state,P=!this.validityStyles||this.validity.valid,T=this.props.filter!==void 0?this.props.filter:this.state.text,$=u.getItemValue(this.value,d),B=u.isPresent(T)?T:$,j=i&&(!!B||u.isPresent(this.value)),M=this.base.vs,L=this.props.id||this._inputId,N=O<=E.MOBILE_MEDIUM_DEVISE&&a;M.enabled=v!==void 0,v!==void 0&&(M.skip=v.skip,M.total=v.total,M.pageSize=v.pageSize);const[G,Y]=H(this.props.prefix||c.Fragment),[J,Q]=H(this.props.suffix||c.Fragment),K=c.createElement(c.Fragment,null,c.createElement("span",{className:g.classNames("k-combobox k-input",{[`k-input-${D[x]||x}`]:x,[`k-rounded-${de[b]||b}`]:b,[`k-input-${S}`]:S,"k-invalid":!P,"k-loading":h,"k-required":this.required,"k-disabled":n},r),ref:this.componentRef,style:l?{...o,width:void 0}:o,dir:t},this.props.prefix&&c.createElement(G,{...Y}),this.renderSearchBar(B||"",L,f),j&&!h&&c.createElement(ne,{onClick:this.clearButtonClick,key:"clearbutton"}),h&&c.createElement(g.IconWrap,{className:"k-input-loading-icon",name:"loading",key:"loading"}),this.props.suffix&&c.createElement(J,{...Q}),c.createElement(q.Button,{tabIndex:-1,type:"button","aria-label":m?e:s,icon:p?void 0:"caret-alt-down",svgIcon:y||A.caretAltDownIcon,iconClass:p,size:x,fillMode:S,rounded:null,themeColor:"base",className:"k-input-button",onClick:this.toggleBtnClick,onMouseDown:X=>X.preventDefault()}),!N&&this.renderListContainer()),N&&this.renderAdaptiveListContainer());return l?c.createElement(ee.FloatingLabel,{label:l,editorId:L,editorValue:B,editorValid:P,editorDisabled:n,style:{width:o?o.width:void 0},children:K}):K}onNavigate(s,e,t){const{data:n=[],virtual:i={skip:0}}=this.props,l=this.props.filter?this.props.filter:this.state.text,d=this.getFocusedIndex(),a=this.base.vs,r=this.value;if(this._suggested="",d!==-1&&!u.isPresent(r))this.handleItemSelect(d,s);else if(l==="")this.handleItemSelect(0,s);else{const o=i.skip+d,h=this.base.navigation.navigate({keyCode:e,current:o,max:(a.enabled?a.total:n.length)-1,min:0,skipItems:t||void 0});h!==void 0&&this.handleItemSelect(h,s)}}getCurrentValueDisabledStatus(s,e,t){return s&&e&&e[t]&&e[t].disabled}applyValueOnEnter(s,e){const{data:t=[],textField:n,allowCustom:i}=this.props,l=this.props.opened!==void 0?this.props.opened:this.state.opened,a=u.getItemValue(this.value,n)===s?this.index:u.getItemIndexByText(t,s,n),r=a!==-1;let o;if(this._suggested="",r)o=t[a];else if(i)o=n!==void 0?{[n]:s}:s;else return this.selectFocusedItem(s,e);this.triggerOnChange(o,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{data:t=[],textField:n,allowCustom:i}=this.props,l=this.props.opened!==void 0?this.props.opened:this.state.opened,d=u.getItemValue(this.value,n),a=this.state.windowWidth&&this.state.windowWidth<=E.MOBILE_MEDIUM_DEVISE;if(this._suggested="",s===d||s===""&&!u.isPresent(d))return l&&!a&&this.base.togglePopup(e),this.applyState(e);const r=u.getItemIndexByText(t,s,n,!0),o=r!==-1;let h=null;o?h=t[r]:i&&(h=s?n?{[n]:s}:s:null),this.triggerOnChange(h,e),this.state.text!==void 0&&(e.data.text=void 0,this.base.filterChanged("",e)),l&&!a&&this.base.togglePopup(e),this.applyState(e)}selectFocusedItem(s,e){const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{data:n=[],textField:i,virtual:l={skip:0},focusedItemIndex:d=u.itemIndexStartsWith}=this.props,a=l.skip,r=s===""&&a===0?0:d(n,s,i);return r!==-1?this.handleItemSelect(r+a,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:n,data:i=[],groupField:l,groupMode:d,list:a,virtual:r,adaptiveTitle:o,groupStickyHeaderItemRender:h}=this.props,p=this.props.opened!==void 0?this.props.opened:this.state.opened;let{group:v}=this.state;v===void 0&&l!==void 0&&(v=u.getItemValue(i[0],l));const x={navigatable:!1,navigatableElements:[],expand:p,animation:!0,onClose:b=>this.toggleBtnClick(b),animationStyles:s<=E.MOBILE_SMALL_DEVISE?{top:0,width:"100%",height:"100%"}:void 0,className:s<=E.MOBILE_SMALL_DEVISE?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"};return c.createElement(_.ActionSheet,{...x},c.createElement(_.ActionSheetHeader,{className:"k-text-center"},c.createElement("div",{className:"k-actionsheet-titlebar-group k-hbox"},c.createElement("div",{className:"k-actionsheet-title"},c.createElement("div",null,o)),c.createElement("div",{className:"k-actionsheet-actions"},c.createElement(q.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.toggleBtnClick,icon:"x",svgIcon:A.xIcon}))),c.createElement("div",{className:"k-actionsheet-titlebar-group k-actionsheet-filter"},this.renderMobileListFilter())),c.createElement(_.ActionSheetContent,{className:"!k-overflow-hidden"},c.createElement("div",{className:"k-list-container"},c.createElement("div",{className:g.classNames({"k-list":!a,"k-list-lg":!0,"k-virtual-list":r,"k-data-table":a,[`k-table-${D[n]||n}`]:a&&n})},e&&c.createElement("div",{className:"k-table-header"},e),!a&&v&&i.length!==0&&c.createElement(R,{group:v,groupMode:d,render:h}),this.renderList(),t&&c.createElement("div",{className:"k-list-footer"},t)))))}renderListContainer(){const s=this.base,{dir:e,header:t,footer:n,data:i=[],groupField:l,groupMode:d,size:a,list:r,virtual:o,groupStickyHeaderItemRender:h}=this.props,p=this.props.opened!==void 0?this.props.opened:this.state.opened,v=s.getPopupSettings(),x=v.width!==void 0?v.width:s.popupWidth;let{group:b}=this.state;return b===void 0&&l!==void 0&&(b=u.getItemValue(i[0],l)),c.createElement(se,{width:x,popupSettings:{...v,anchor:v.anchor||this.element,show:p,popupClass:g.classNames(v.popupClass,"k-list-container","k-combobox-popup")},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[i.length]},c.createElement("div",{className:g.classNames({"k-list":!r,[`k-list-${D[a]||a}`]:!r&&a,"k-virtual-list":o,"k-data-table":r,[`k-table-${D[a]||a}`]:r&&a})},t&&c.createElement("div",{className:"k-table-header"},t),!r&&b&&i.length!==0&&c.createElement(R,{group:b,groupMode:d,render:h}),this.renderList(),n&&c.createElement("div",{className:g.classNames({"k-list-footer":!this.props.footerClassName},this.props.footerClassName)},n)))}renderList(){const s=this.base,{textField:e,dataItemKey:t,listNoDataRender:n,itemRender:i,groupHeaderItemRender:l,data:d=[],virtual:a={skip:0,total:void 0}}=this.props,r=s.getPopupSettings(),o=s.vs,h=a.skip,p=this.props.opened!==void 0?this.props.opened:this.state.opened,v=`translateY(${o.translate}px)`,x=p?this.getFocusedIndex():void 0,b=this.props.filter!==void 0?this.props.filter:this.state.text,S=u.getItemValue(this.value,e),m=u.isPresent(b)&&b!==S?null:this.value,f=this.props.list||ie;return c.createElement(f,{id:s.listBoxId,virtual:!!a,show:p,data:d,focusedIndex:x,value:m,textField:e,valueField:t,groupField:this.props.groupField,groupMode:this.props.groupMode,isMultiColumn:this.props.isMultiColumn,optionsGuid:s.guid,listRef:y=>{o.list=this.base.list=y,this.itemHeight=0},wrapperStyle:this.state.windowWidth&&this.state.windowWidth>E.MOBILE_MEDIUM_DEVISE?{maxHeight:r.height}:{},wrapperCssClass:g.classNames("k-list-content",{"k-list-scroller":!a}),listStyle:o.enabled?{transform:v}:void 0,key:"listkey",skip:h,onClick:this.handleItemClick,itemRender:i,groupHeaderItemRender:l,noDataRender:n,onMouseDown:y=>y.preventDefault(),onScroll:this.onScroll,wrapperRef:o.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:a.total})}renderSearchBar(s,e,t){const{tabIndex:n,disabled:i,data:l=[],dataItemKey:d,virtual:a={skip:0}}=this.props,r=this.props.opened!==void 0?this.props.opened:this.state.opened,o=this.value,h=Math.max(0,l.findIndex(p=>u.areSame(p,o,d)));return this._suggested&&!u.areSame(this._valueOnDidUpdate,o,d)&&(this._suggested=""),c.createElement(te,{id:e,readOnly:r&&this.mobileMode,placeholder:t,tabIndex:n,title:this.props.title,accessKey:this.props.accessKey,value:s+this._suggested,suggestedText:this._suggested,ref:p=>this._input=p&&p.input,onClick:this.onInputClick,onKeyDown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:i,expanded:r,owns:this.base.listBoxId,activedescendant:`option-${this.base.guid}-${h+a.skip}`,role:"combobox",ariaLabelledBy:this.props.ariaLabelledBy,ariaDescribedBy:this.props.ariaDescribedBy,ariaRequired:this.required,render:this.props.valueRender})}clearValue(){const s=this.base.initState();this._suggested="",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;!u.isPresent(t)&&!u.isPresent(s)||u.areSame(t,s,this.props.dataItemKey)||(this.props.value===void 0&&(e.data.value=s),this._valueDuringOnChange=s,e.events.push({type:"onChange"}))}getFocusedIndex(){const s=this.value,{data:e=[],textField:t,dataItemKey:n,virtual:i={skip:0},focusedItemIndex:l=u.itemIndexStartsWith,skipDisabledItems:d}=this.props,a=this.props.filter?this.props.filter:this.state.text;return u.isPresent(s)&&a===void 0?e.findIndex(r=>u.areSame(r,s,n)):a?l(e,a,t):d&&t&&!a&&i.skip===0?e.findIndex(r=>!r.disabled&&r[t]):i.skip===0?0:-1}suggestValue(s){const{data:e,textField:t}=this.props;this._suggested=u.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})}};k.displayName="ComboBox",k.propTypes={...F.propTypes,size:I.oneOf([null,"small","medium","large"]),rounded:I.oneOf([null,"small","medium","large","full"]),fillMode:I.oneOf([null,"solid","flat","outline"]),dataItemKey:I.string,groupField:I.string,groupMode:I.oneOf([void 0,"classic","modern"]),isMultiColumn:I.bool,suggest:I.bool,placeholder:I.string,title:I.string,allowCustom:I.bool,clearButton:I.bool,iconClassName:I.string,svgIcon:g.svgIconPropType,validationMessage:I.string,required:I.bool,id:I.string,ariaLabelledBy:I.string,ariaDescribedBy:I.string,list:I.any,valueRender:I.func,skipDisabledItems:I.bool},k.defaultProps={...F.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 V=k;const W=g.createPropsContext(),U=g.withIdHOC(g.withPropsContext(W,V));U.displayName="KendoReactComboBox";exports.ComboBox=U;exports.ComboBoxPropsContext=W;exports.ComboBoxWithoutContext=V;