@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,694 @@
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 f from "react";
10
+ import m from "prop-types";
11
+ import { Keys as u, classNames as I, IconWrap as N, validatePackage as Q, canUseDOM as R, createPropsContext as X, withIdHOC as Z, withPropsContext as ee, kendoThemeMaps as te } from "@progress/kendo-react-common";
12
+ import { plusIcon as se } from "@progress/kendo-svg-icons";
13
+ import { FloatingLabel as ie } from "@progress/kendo-react-labels";
14
+ import oe from "../common/ListContainer.mjs";
15
+ import ae from "../common/List.mjs";
16
+ import ne from "../common/GroupStickyHeader.mjs";
17
+ import le from "./TagList.mjs";
18
+ import de from "../common/SearchBar.mjs";
19
+ import D from "../common/DropDownBase.mjs";
20
+ import { ActiveDescendant as C } from "../common/settings.mjs";
21
+ import { areSame as F, removeDataItems as k, isPresent as E, getItemValue as M, preventDefaultNonInputs as re, matchTags as L, itemIndexStartsWith as he } from "../common/utils.mjs";
22
+ import { packageMetadata as pe } from "../package-metadata.mjs";
23
+ import ce from "../common/ClearButton.mjs";
24
+ import { AdaptiveMode as ue } from "../common/AdaptiveMode.mjs";
25
+ import { ActionSheetContent as fe } from "@progress/kendo-react-layout";
26
+ import { MOBILE_MEDIUM_DEVISE as ge } from "../common/constants.mjs";
27
+ import { provideLocalizationService as me } from "@progress/kendo-react-intl";
28
+ import { adaptiveModeFooterCancel as B, messages as z, adaptiveModeFooterApply as V } from "../messages/index.mjs";
29
+ import ve from "../common/ListFilter.mjs";
30
+ import H from "../common/withCustomComponent.mjs";
31
+ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A = (T) => T.preventDefault(), $ = (T) => T === 2, y = class y extends f.Component {
32
+ constructor(n) {
33
+ super(n), this.state = {
34
+ activedescendant: C.PopupList,
35
+ currentValue: []
36
+ }, this._element = null, this._valueItemsDuringOnChange = null, this.base = new D(this), this._tags = [], this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._lastSelectedOrDeslectedItemIndex = null, this.itemHeight = 0, this.scrollToFocused = !1, this.localization = null, this.focus = () => {
37
+ this._input && this._input.focus();
38
+ }, this.handleItemSelect = (t, e) => {
39
+ const { data: s = [], dataItemKey: o, virtual: a } = this.props, p = a ? a.skip : 0, r = s[t - p], h = this.value.findIndex((g) => F(g, r, o));
40
+ this._lastSelectedOrDeslectedItemIndex = s.findIndex((g) => F(g, r, o));
41
+ let i = [];
42
+ h !== -1 ? (i = this.value, i.splice(h, 1)) : i = [...this.value, r], (this.props.filter !== void 0 ? this.props.filter : this.state.text) && !this.mobileMode && (this.state.text && (e.data.text = ""), this.base.filterChanged("", e)), this._adaptiveInput && this._adaptiveInput.blur(), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.triggerOnChange(i, e), this.base.triggerPageChangeCornerItems(r, e);
43
+ }, this.onTagDelete = (t, e) => {
44
+ const s = this.base.initState();
45
+ s.syntheticEvent = e, this.opened && this.base.togglePopup(s), !this.state.focused && !this.mobileMode && (s.data.focused = !0, this.focus());
46
+ const o = this.value;
47
+ k(o, t, this.props.dataItemKey), this.triggerOnChange(o, s), this.applyState(s);
48
+ }, this.itemFocus = (t, e) => {
49
+ const { data: s = [], allowCustom: o, virtual: a } = this.props, p = a ? a.skip : 0, r = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedIndex: h } = this.getFocusedState(), i = o && r, l = s[t - p];
50
+ l && h !== t ? this.state.focusedIndex !== t && (e.data.focusedIndex = t, e.data.activedescendant = C.PopupList) : i && t === -1 && this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.base.triggerPageChangeCornerItems(l, e);
51
+ }, this.componentRef = (t) => {
52
+ this._element = t, this.base.wrapper = t;
53
+ }, this.searchbarRef = (t) => {
54
+ const e = this._input = t && t.input;
55
+ e && this.state.focused && window.setTimeout(() => e.focus(), 0);
56
+ }, this.onChangeHandler = (t) => {
57
+ const e = this.base.initState(), s = t.target.value;
58
+ e.syntheticEvent = t, this.props.filter === void 0 && (e.data.text = s), e.data.focusedIndex = void 0, this.opened || (this.base.togglePopup(e), this.setState({ currentValue: this.value })), this.base.filterChanged(s, e), this.applyState(e), this.setState({ group: void 0 });
59
+ }, this.clearButtonClick = (t) => {
60
+ const e = this.base.initState();
61
+ e.syntheticEvent = t, t.stopPropagation(), this.value.length > 0 && this.triggerOnChange([], e), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.opened && this.base.togglePopup(e);
62
+ const s = this.props.filter !== void 0 ? this.props.filter : this.state.text;
63
+ E(s) && s !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this._lastSelectedOrDeslectedItemIndex = null, this.applyState(e);
64
+ }, this.onInputKeyDown = (t) => {
65
+ const { data: e = [], textField: s, groupField: o } = this.props, a = t.keyCode, p = this.props.filter !== void 0 ? this.props.filter : this.state.text, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { focusedItem: h, focusedIndex: i } = this.getFocusedState(), l = this.base.initState();
66
+ if (l.syntheticEvent = t, !p && this.value.length > 0 && (a === u.left || a === u.right || a === u.home || a === u.end || a === u.delete || a === u.backspace) && !t.shiftKey)
67
+ return this.onTagsNavigate(t, l);
68
+ const g = () => {
69
+ t.preventDefault(), this.base.togglePopup(l), this.applyState(l);
70
+ };
71
+ if (this.opened)
72
+ if (a === u.pageUp)
73
+ this.base.scrollPopupByPageSize(-1);
74
+ else if (a === u.pageDown)
75
+ this.base.scrollPopupByPageSize(1);
76
+ else if ((t.ctrlKey || t.metaKey) && t.code === "KeyA") {
77
+ const c = (this.state.value && this.state.value.length) === e.length ? [] : e;
78
+ this.updateStateOnKeyboardNavigation(c, l);
79
+ } else if ((t.ctrlKey || t.metaKey) && t.shiftKey && t.keyCode === u.end) {
80
+ const d = e.slice(this.getFocusedState().focusedIndex);
81
+ this.itemFocus(e.length - 1, l), this.updateStateOnKeyboardNavigation(d, l);
82
+ } else if ((t.ctrlKey || t.metaKey) && t.shiftKey && t.keyCode === u.home) {
83
+ const d = e.slice(0, this.getFocusedState().focusedIndex + 1);
84
+ this.itemFocus(0, l), this.updateStateOnKeyboardNavigation(d, l);
85
+ } else if (t.shiftKey && t.keyCode === u.up) {
86
+ let d;
87
+ const c = this.getLastSelectedOrDeselectedIndex(1, i);
88
+ c === null ? d = i !== 0 ? e.slice(i - 1, i) : [e[i]] : c === i ? d = [e[c - 1]] : i >= 0 && (d = c > i ? e.slice(i - 1, c) : e.slice(c - 1, i)), d && d.length > 0 && (i >= 1 && this.itemFocus(i - 1, l), this.updateStateOnKeyboardNavigation(d, l));
89
+ } else if (t.shiftKey && t.keyCode === u.down) {
90
+ let d;
91
+ const c = this.getLastSelectedOrDeselectedIndex(0, i);
92
+ c === null ? d = i !== e.length - 1 ? e.slice(i, i + 1) : [e[i]] : c === i ? d = e.slice(i, i + 2) : i >= 0 && (d = c > i ? e.slice(i + 1, c + 1) : e.slice(c, i + 2)), d && d.length >= 1 && (this.itemFocus(i + 1, l), this.updateStateOnKeyboardNavigation(d, l));
93
+ } else if (t.altKey && a === u.up)
94
+ g();
95
+ else if (a === u.up || a === u.down) {
96
+ if (o !== "" && s)
97
+ if (!this.props.skipDisabledItems && r)
98
+ this.onNavigate(l, a);
99
+ else {
100
+ let d = 0;
101
+ if (a === u.down || a === u.right) {
102
+ const c = e.slice(i + 1).find((v) => !v.disabled && v[s]);
103
+ d = c && e.findIndex((v) => v[s] === c[s]);
104
+ } else if (a === u.up || a === u.left) {
105
+ let c;
106
+ if (i === -1)
107
+ c = e, d = e.findIndex((v) => !v.disabled && v[s]);
108
+ else {
109
+ c = e.slice(0, i);
110
+ let v = c.pop();
111
+ for (; v && v.disabled; )
112
+ v = c.pop();
113
+ d = v && e.findIndex((x) => x[s] === v[s]);
114
+ }
115
+ }
116
+ if (d) {
117
+ const c = d - i;
118
+ this.onNavigate(l, a, c);
119
+ } else
120
+ d !== void 0 && this.onNavigate(l, a);
121
+ }
122
+ else if (!this.props.skipDisabledItems && r)
123
+ this.onNavigate(l, a);
124
+ else {
125
+ let d = null;
126
+ if (a === u.down || a === u.right)
127
+ d = e.slice(i + 1).find((c) => !c.disabled);
128
+ else if (a === u.up || a === u.left) {
129
+ const c = e.slice(0, i);
130
+ for (d = c.pop(); d && d.disabled; )
131
+ d = c.pop();
132
+ }
133
+ if (d) {
134
+ const c = d.id - i - 1;
135
+ this.onNavigate(l, a, c);
136
+ } else
137
+ this.onNavigate(l, a);
138
+ }
139
+ this.applyState(l), t.preventDefault();
140
+ } else
141
+ a === u.enter ? (t.preventDefault(), this.props.allowCustom && p && h === null ? this.customItemSelect(t) : h && h.disabled ? g() : this.selectFocusedItem(t)) : a === u.esc && g();
142
+ else
143
+ t.altKey && a === u.down && g();
144
+ }, this.listContainerContent = () => {
145
+ const { header: t, footer: e, allowCustom: s, size: o, data: a = [], groupStickyHeaderItemRender: p, groupField: r, list: h } = this.props, i = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: l } = this.getFocusedState(), g = s && i && /* @__PURE__ */ f.createElement(
146
+ "div",
147
+ {
148
+ className: I("k-list", {
149
+ [`k-list-${w[o] || o}`]: o
150
+ }),
151
+ key: "customitem",
152
+ onClick: this.customItemSelect,
153
+ onMouseDown: A
154
+ },
155
+ /* @__PURE__ */ f.createElement(
156
+ "div",
157
+ {
158
+ className: I("k-list-item k-custom-item", { "k-focus": $(l) }),
159
+ style: { fontStyle: "italic" }
160
+ },
161
+ i,
162
+ /* @__PURE__ */ f.createElement(N, { name: "plus", icon: se, style: { position: "absolute", right: "0.5em" } })
163
+ )
164
+ );
165
+ let { group: d } = this.state;
166
+ return d === void 0 && r !== void 0 && (d = M(a[0], r)), /* @__PURE__ */ f.createElement(f.Fragment, null, t && /* @__PURE__ */ f.createElement("div", { className: "k-list-header" }, t), g, /* @__PURE__ */ f.createElement(
167
+ "div",
168
+ {
169
+ className: I(
170
+ "k-list",
171
+ {
172
+ [`k-list-${this.mobileMode ? "lg" : w[o] || o}`]: o,
173
+ "k-virtual-list": this.base.vs.enabled
174
+ }
175
+ )
176
+ },
177
+ !h && d && a.length !== 0 && /* @__PURE__ */ f.createElement(ne, { group: d, groupMode: "modern", render: p }),
178
+ this.renderList()
179
+ ), e && /* @__PURE__ */ f.createElement("div", { className: "k-list-footer" }, e));
180
+ }, this.renderListContainer = () => {
181
+ const t = this.base, { dir: e, data: s = [] } = this.props, o = this.base.getPopupSettings(), a = o.width !== void 0 ? o.width : t.popupWidth, p = {
182
+ dir: e !== void 0 ? e : t.dirCalculated,
183
+ width: a,
184
+ popupSettings: {
185
+ ...o,
186
+ popupClass: I(
187
+ o.popupClass,
188
+ "k-list-container",
189
+ "k-multiselect-popup"
190
+ ),
191
+ anchor: o.anchor || this.element,
192
+ show: this.opened,
193
+ onOpen: this.onPopupOpened,
194
+ onClose: this.onPopupClosed
195
+ },
196
+ itemsCount: [s.length, this.value.length]
197
+ };
198
+ return /* @__PURE__ */ f.createElement(oe, { ...p }, this.listContainerContent());
199
+ }, this.renderAdaptiveListContainer = () => {
200
+ const { adaptiveTitle: t, filterable: e, filter: s } = this.props, { windowWidth: o = 0 } = this.state, a = s !== void 0 ? s : this.state.text;
201
+ this.localization = me(this);
202
+ const p = e ? /* @__PURE__ */ f.createElement(
203
+ ve,
204
+ {
205
+ value: a,
206
+ ref: (h) => this._adaptiveInput = h && h.element,
207
+ onChange: this.onChangeHandler,
208
+ onKeyDown: this.onInputKeyDown,
209
+ size: this.props.size,
210
+ rounded: this.props.rounded,
211
+ fillMode: this.props.fillMode
212
+ }
213
+ ) : null, r = {
214
+ adaptiveTitle: t,
215
+ expand: this.opened,
216
+ onClose: (h) => this.onCancel(h),
217
+ windowWidth: o,
218
+ mobileFilter: p,
219
+ footer: {
220
+ cancelText: this.localization.toLanguageString(B, z[B]),
221
+ onCancel: this.onCancel,
222
+ applyText: this.localization.toLanguageString(V, z[V]),
223
+ onApply: this.closePopup
224
+ }
225
+ };
226
+ return /* @__PURE__ */ f.createElement(ue, { ...r }, /* @__PURE__ */ f.createElement(fe, { className: "!k-overflow-hidden" }, /* @__PURE__ */ f.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
227
+ }, this.closePopup = (t) => {
228
+ const e = this.base.initState();
229
+ e.syntheticEvent = t, t.stopPropagation(), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.opened && this.base.togglePopup(e), e.events.push({ type: "onClose" });
230
+ const s = this.props.filter !== void 0 ? this.props.filter : this.state.text;
231
+ E(s) && s !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this.applyState(e);
232
+ }, this.onCancel = (t) => {
233
+ const e = this.base.initState();
234
+ e.syntheticEvent = t, t.stopPropagation(), this.state.focusedIndex !== void 0 && (e.data.focusedIndex = void 0), this.opened && this.base.togglePopup(e), e.events.push({ type: "onCancel" });
235
+ const s = this.props.filter !== void 0 ? this.props.filter : this.state.text;
236
+ E(s) && s !== "" && this.base.filterChanged("", e), this.state.text && (e.data.text = ""), this.applyState(e);
237
+ }, this.renderList = () => {
238
+ const {
239
+ data: t = [],
240
+ textField: e,
241
+ listNoDataRender: s,
242
+ itemRender: o,
243
+ groupHeaderItemRender: a,
244
+ dataItemKey: p,
245
+ virtual: r = { skip: 0, total: void 0 }
246
+ } = this.props, h = this.base.vs, { focusedIndex: i } = this.getFocusedState(), l = this.base.getPopupSettings(), g = `translateY(${h.translate}px)`;
247
+ return /* @__PURE__ */ f.createElement(
248
+ ae,
249
+ {
250
+ id: this.base.listBoxId,
251
+ show: this.opened,
252
+ data: t.slice(),
253
+ focusedIndex: i - r.skip,
254
+ value: this.value,
255
+ textField: e,
256
+ valueField: p,
257
+ optionsGuid: this.base.guid,
258
+ groupField: this.props.groupField,
259
+ groupMode: "modern",
260
+ listRef: (d) => {
261
+ h.list = this.base.list = d;
262
+ },
263
+ wrapperStyle: this.mobileMode ? {} : { maxHeight: l.height },
264
+ wrapperCssClass: "k-list-content",
265
+ listStyle: h.enabled ? { transform: g } : void 0,
266
+ key: "listKey",
267
+ skip: r.skip,
268
+ onClick: this.handleItemClick,
269
+ itemRender: o,
270
+ groupHeaderItemRender: a,
271
+ noDataRender: s,
272
+ onMouseDown: A,
273
+ onBlur: this.handleBlur,
274
+ onScroll: this.onScroll,
275
+ wrapperRef: h.scrollerRef,
276
+ scroller: this.base.renderScrollElement(),
277
+ ariaSetSize: r.total
278
+ }
279
+ );
280
+ }, this.onScroll = (t) => {
281
+ const { vs: e, list: s } = this.base;
282
+ e.scrollHandler(t);
283
+ const { groupField: o } = this.props;
284
+ let { data: a = [] } = this.props;
285
+ if (!(!o || !a.length) && o) {
286
+ const p = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : s ? s.children[0].offsetHeight : 0), h = t.target.scrollTop - e.skip * p;
287
+ a = this.base.getGroupedDataModernMode(a, o);
288
+ let i = a[0][o];
289
+ for (let l = 1; l < a.length && !(p * l > h); l++)
290
+ a[l] && a[l][o] && (i = a[l][o]);
291
+ i !== this.state.group && this.setState({
292
+ group: i
293
+ });
294
+ }
295
+ }, this.customItemSelect = (t) => {
296
+ const e = this.props.filter !== void 0 ? this.props.filter : this.state.text, { textField: s } = this.props;
297
+ if (!e)
298
+ return;
299
+ const o = this.base.initState();
300
+ o.syntheticEvent = t;
301
+ const a = s ? { [s]: e } : e;
302
+ this.state.text !== void 0 && (o.data.text = ""), o.data.focusedIndex = void 0, this.base.filterChanged("", o);
303
+ const p = [...this.value, a];
304
+ this.triggerOnChange(p, o), this.base.togglePopup(o), this.applyState(o);
305
+ }, this.handleWrapperClick = (t) => {
306
+ const e = this._input;
307
+ !this.opened && e && this.focusElement(e);
308
+ const s = this.base.initState();
309
+ s.syntheticEvent = t, !this.state.focused && !this.mobileMode && (s.events.push({ type: "onFocus" }), s.data.focused = !0), this.mobileMode && (this.setState({ currentValue: this.tagsToRender }), this.mobileMode && window.setTimeout(() => this._adaptiveInput && this._adaptiveInput.focus(), 300)), this.base.togglePopup(s), this.applyState(s);
310
+ }, this.handleItemClick = (t, e) => {
311
+ const s = this.base.initState();
312
+ s.syntheticEvent = e, this.handleItemSelect(t, s), this.props.autoClose && !this.mobileMode && this.base.togglePopup(s), e.stopPropagation(), this.applyState(s);
313
+ }, this.handleBlur = (t) => {
314
+ if (!this.state.focused || this._skipFocusEvent)
315
+ return;
316
+ const e = this.base.initState(), { allowCustom: s, filterable: o } = this.props;
317
+ e.syntheticEvent = t, e.data.focused = !1, e.events.push({ type: "onBlur" }), this.opened && !this.mobileMode && (this.state.opened && (e.data.opened = !1), e.events.push({ type: "onClose" })), !s && !o && this.state.text && (e.data.text = ""), this.applyState(e);
318
+ }, this.handleFocus = (t) => {
319
+ this._skipFocusEvent || this.base.handleFocus(t);
320
+ }, this.onPopupOpened = () => {
321
+ this._input && this.state.focused && !this.mobileMode && this.focusElement(this._input);
322
+ }, this.onPopupClosed = () => {
323
+ this.state.focused && window.setTimeout(() => {
324
+ this.state.focused && this.focusElement(this._input);
325
+ }, 0);
326
+ }, this.setValidity = () => {
327
+ this._input && this._input.setCustomValidity && this._input.setCustomValidity(
328
+ this.validity.valid ? "" : this.props.validationMessage || ye
329
+ );
330
+ }, Q(pe);
331
+ }
332
+ get _inputId() {
333
+ return this.props.id;
334
+ }
335
+ get document() {
336
+ if (R)
337
+ return this.element && this.element.ownerDocument || document;
338
+ }
339
+ /** @hidden */
340
+ get element() {
341
+ return this._element;
342
+ }
343
+ /** @hidden */
344
+ get opened() {
345
+ return !!(this.props.opened !== void 0 ? this.props.opened : this.state.opened);
346
+ }
347
+ /** @hidden */
348
+ get tagsToRender() {
349
+ const { tags: n, textField: t } = this.props;
350
+ let e = [];
351
+ return n === void 0 ? this.value.forEach((s) => {
352
+ e.push({ text: M(s, t), data: [s] });
353
+ }) : e.push(...n), e;
354
+ }
355
+ /**
356
+ * The mobile mode of the ComboBox.
357
+ */
358
+ get mobileMode() {
359
+ return !!(this.state.windowWidth && this.state.windowWidth <= ge && this.props.adaptive);
360
+ }
361
+ /**
362
+ * Represents the value of the MultiSelect.
363
+ */
364
+ get value() {
365
+ const n = [];
366
+ return this._valueItemsDuringOnChange ? n.push(...this._valueItemsDuringOnChange) : this.props.value ? n.push(...this.props.value) : this.state.value ? n.push(...this.state.value) : this.props.defaultValue && n.push(...this.props.defaultValue), n;
367
+ }
368
+ /**
369
+ * Gets the `name` property of the MultiSelect.
370
+ */
371
+ get name() {
372
+ return this.props.name;
373
+ }
374
+ /**
375
+ * Represents the validity state into which the MultiSelect is set.
376
+ */
377
+ get validity() {
378
+ const n = this.props.validationMessage !== void 0, t = !this.required || this.value !== null && this.value.length > 0 && this.value !== void 0, e = this.props.valid !== void 0 ? this.props.valid : t;
379
+ return {
380
+ customError: n,
381
+ valid: e,
382
+ valueMissing: this.value === null
383
+ };
384
+ }
385
+ /** @hidden */
386
+ get required() {
387
+ return this.props.required !== void 0 ? this.props.required : y.defaultProps.required;
388
+ }
389
+ get validityStyles() {
390
+ return this.props.validityStyles !== void 0 ? this.props.validityStyles : y.defaultProps.validityStyles;
391
+ }
392
+ /** @hidden */
393
+ componentDidUpdate(n, t) {
394
+ var g;
395
+ const { virtual: e, groupField: s = "", data: o = [] } = this.props, a = e ? e.skip : 0, p = n.virtual ? n.virtual.total : 0, r = n.opened !== void 0 ? n.opened : t.opened, h = !r && this.opened, i = r && !this.opened;
396
+ if (!this.base.getPopupSettings().animate && i && this.onPopupClosed(), e && e.total !== p)
397
+ this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
398
+ else {
399
+ let { focusedItem: d, focusedIndex: c } = this.getFocusedState();
400
+ s !== "" && (c = (g = this.base.getGroupedDataModernMode(o, s)) == null ? void 0 : g.indexOf(d)), h && e ? this.base.scrollToVirtualItem(e, c - a) : h && !e ? (o && o.length !== 0 && this.base.resetGroupStickyHeader(o[0][s], this), this.base.scrollToItem(c)) : this.opened && r && d && this.scrollToFocused && this.base.scrollToItem(c - a);
401
+ }
402
+ this.scrollToFocused = !1, this.setValidity();
403
+ }
404
+ /** @hidden */
405
+ componentDidMount() {
406
+ var n;
407
+ this.observerResize = R && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (n = this.document) != null && n.body && this.observerResize && this.observerResize.observe(this.document.body);
408
+ }
409
+ /** @hidden */
410
+ componentWillUnmount() {
411
+ var n;
412
+ (n = this.document) != null && n.body && this.observerResize && this.observerResize.disconnect();
413
+ }
414
+ /** @hidden */
415
+ onNavigate(n, t, e) {
416
+ const { allowCustom: s, data: o = [] } = this.props, a = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: p, focusedIndex: r } = this.getFocusedState(), h = s && a, i = $(p), l = this.base, g = l.vs;
417
+ if (this.opened && t === u.up && i)
418
+ this.state.focusedIndex !== void 0 && (n.data.focusedIndex = void 0);
419
+ else {
420
+ const d = l.navigation.navigate({
421
+ keyCode: t,
422
+ current: r,
423
+ max: (g.enabled ? g.total : o.length) - 1,
424
+ min: h ? -1 : 0,
425
+ skipItems: e || void 0
426
+ });
427
+ d !== void 0 && (this.itemFocus(d, n), this.scrollToFocused = !0);
428
+ }
429
+ this.applyState(n);
430
+ }
431
+ /** @hidden */
432
+ render() {
433
+ const {
434
+ style: n,
435
+ className: t,
436
+ label: e,
437
+ dir: s,
438
+ disabled: o,
439
+ textField: a,
440
+ dataItemKey: p,
441
+ virtual: r,
442
+ size: h,
443
+ rounded: i,
444
+ fillMode: l,
445
+ loading: g,
446
+ filter: d
447
+ } = this.props, { text: c, focused: v, focusedTag: x, currentValue: q } = this.state, S = this.base.vs, P = this.props.id || this._inputId;
448
+ S.enabled = r !== void 0, r !== void 0 && (S.skip = r.skip, S.total = r.total, S.pageSize = r.pageSize);
449
+ const b = this.mobileMode && this.opened ? q : this.tagsToRender;
450
+ this.setItems(this.tagsToRender, this._tags);
451
+ const _ = !this.validityStyles || this.validity.valid, W = !!(d !== void 0 ? d : c) || b && b.length > 0, [G, U] = H(this.props.prefix || f.Fragment), [Y, j] = H(this.props.suffix || f.Fragment), K = /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(
452
+ "div",
453
+ {
454
+ ref: this.componentRef,
455
+ className: I("k-multiselect k-input", t, {
456
+ [`k-input-${w[h] || h}`]: h,
457
+ [`k-rounded-${Ie[i] || i}`]: i,
458
+ [`k-input-${l}`]: l,
459
+ "k-focus": v && !o,
460
+ "k-invalid": !_,
461
+ "k-disabled": o,
462
+ "k-loading": g,
463
+ "k-required": this.required
464
+ }),
465
+ style: e ? { ...n, width: void 0 } : n,
466
+ dir: s,
467
+ onFocus: this.handleFocus,
468
+ onBlur: this.handleBlur,
469
+ onClick: this.handleWrapperClick,
470
+ onMouseDown: re
471
+ },
472
+ this.props.prefix && /* @__PURE__ */ f.createElement(G, { ...U }),
473
+ /* @__PURE__ */ f.createElement("div", { className: I("k-input-values") }, /* @__PURE__ */ f.createElement(
474
+ "div",
475
+ {
476
+ className: I(
477
+ "k-chip-list",
478
+ { [`k-chip-list-${w[h] || h}`]: h }
479
+ ),
480
+ role: "listbox",
481
+ id: "tagslist-" + this.base.guid
482
+ },
483
+ b && b.length > 0 && /* @__PURE__ */ f.createElement(
484
+ le,
485
+ {
486
+ tagRender: this.props.tagRender,
487
+ onTagDelete: this.onTagDelete,
488
+ data: b,
489
+ guid: this.base.guid,
490
+ focused: x ? b.find((J) => L(J, x, p)) : void 0,
491
+ size: h
492
+ }
493
+ )
494
+ ), this.renderSearchBar(P)),
495
+ g && /* @__PURE__ */ f.createElement(N, { className: "k-input-loading-icon", name: "loading" }),
496
+ this.props.suffix && /* @__PURE__ */ f.createElement(Y, { ...j }),
497
+ W && /* @__PURE__ */ f.createElement(ce, { onClick: this.clearButtonClick }),
498
+ !this.mobileMode && this.renderListContainer()
499
+ ), this.mobileMode && this.renderAdaptiveListContainer());
500
+ return e ? /* @__PURE__ */ f.createElement(
501
+ ie,
502
+ {
503
+ label: e,
504
+ editorId: P,
505
+ editorValue: c || M(this.value[0], a),
506
+ editorValid: _,
507
+ editorDisabled: o,
508
+ style: { width: n ? n.width : void 0 },
509
+ children: K
510
+ }
511
+ ) : K;
512
+ }
513
+ renderSearchBar(n) {
514
+ const { activedescendant: t, focusedTag: e, currentValue: s } = this.state, { disabled: o, placeholder: a, ariaDescribedBy: p } = this.props, r = !this.mobileMode && (this.props.filter !== void 0 ? this.props.filter : this.state.text) || "", { focusedIndex: h } = this.getFocusedState(), i = this.value.length === 0 && !r ? a : void 0, l = s && s.length > 0 ? void 0 : a, g = t === C.TagsList && e !== void 0 ? `tag-${this.base.guid}-${e.text.replace(/\s+/g, "-")}` : `option-${this.base.guid}-${h}`;
515
+ return /* @__PURE__ */ f.createElement(
516
+ de,
517
+ {
518
+ id: n,
519
+ size: Math.max((i || "").length, r.length, 1),
520
+ tabIndex: this.props.tabIndex,
521
+ accessKey: this.props.accessKey,
522
+ placeholder: this.mobileMode && this.opened ? l : i,
523
+ value: r,
524
+ onChange: this.onChangeHandler,
525
+ onKeyDown: this.onInputKeyDown,
526
+ ref: this.searchbarRef,
527
+ disabled: o,
528
+ expanded: this.opened,
529
+ owns: this.base.listBoxId,
530
+ role: "combobox",
531
+ activedescendant: g,
532
+ ariaDescribedBy: `tagslist-${this.base.guid}${p ? " " + p : ""}`,
533
+ ariaLabelledBy: this.props.ariaLabelledBy,
534
+ ariaRequired: this.required
535
+ }
536
+ );
537
+ }
538
+ onTagsNavigate(n, t) {
539
+ const e = n.keyCode, { focusedTag: s } = this.state, o = this._tags, a = this.props.dataItemKey;
540
+ let p = s ? o.findIndex((i) => L(i, s, a)) : -1, r;
541
+ const h = p !== -1;
542
+ if (e === u.left)
543
+ h ? p = Math.max(0, p - 1) : p = o.length - 1, r = o[p];
544
+ else if (e === u.right)
545
+ p === o.length - 1 ? r = void 0 : h && (p = Math.min(o.length - 1, p + 1), r = o[p]);
546
+ else if (e === u.home && !n.shiftKey)
547
+ r = o[0];
548
+ else if (e === u.end && !n.shiftKey)
549
+ r = o[o.length - 1];
550
+ else if (e === u.delete) {
551
+ if (h) {
552
+ const i = this.value;
553
+ k(i, o[p].data, a), this.triggerOnChange(i, t);
554
+ }
555
+ } else if (e === u.backspace) {
556
+ const i = this.value;
557
+ if (h)
558
+ k(i, o[p].data, a), this.triggerOnChange(i, t);
559
+ else if (!h && o.length) {
560
+ const l = o.pop();
561
+ k(i, l.data, a), this.triggerOnChange(i, t);
562
+ }
563
+ }
564
+ r !== s && (t.data.focusedTag = r, t.data.activedescendant = C.TagsList), this.applyState(t);
565
+ }
566
+ triggerOnChange(n, t) {
567
+ this.props.value === void 0 && (t.data.value = [...n]), this._valueItemsDuringOnChange = [], this.setItems(n, this._valueItemsDuringOnChange), t.events.push({ type: "onChange" });
568
+ }
569
+ selectFocusedItem(n, t) {
570
+ const { data: e = [], virtual: s } = this.props, { focusedIndex: o } = t || this.getFocusedState(), a = s ? s.skip : 0;
571
+ e[o - a] !== void 0 && this.handleItemClick(o, n);
572
+ }
573
+ setItems(n, t) {
574
+ t.length = 0, t.push(...n);
575
+ }
576
+ getFocusedState() {
577
+ const { focusedIndex: n } = this.state, t = this.props.filter !== void 0 ? this.props.filter : this.state.text, { allowCustom: e, data: s = [], dataItemKey: o, virtual: a, textField: p, focusedItemIndex: r = he, skipDisabledItems: h } = this.props, i = a && a.skip || 0;
578
+ let l;
579
+ if (n !== void 0)
580
+ return {
581
+ focusedIndex: n,
582
+ focusedItem: s[n - i],
583
+ focusedType: 1
584
+ /* ListItem */
585
+ };
586
+ const g = this.value;
587
+ if (e && t)
588
+ return {
589
+ focusedItem: null,
590
+ focusedIndex: -1,
591
+ focusedType: 2
592
+ /* CustomItem */
593
+ };
594
+ if (t)
595
+ return l = r(s, t, p), {
596
+ focusedItem: s[l],
597
+ focusedIndex: l + i,
598
+ focusedType: 1
599
+ /* ListItem */
600
+ };
601
+ if (g.length) {
602
+ const d = g[g.length - 1];
603
+ return l = s.findIndex((c) => F(c, d, o)), s[l] !== void 0 ? {
604
+ focusedIndex: l + i,
605
+ focusedItem: s[l],
606
+ focusedType: 1
607
+ /* ListItem */
608
+ } : { focusedType: 0, focusedIndex: -1 };
609
+ } else if (h && p && !t && i === 0) {
610
+ const d = s.findIndex((c) => !c.disabled && c[p]);
611
+ return {
612
+ focusedIndex: d,
613
+ focusedItem: s[d - i],
614
+ focusedType: 1
615
+ /* ListItem */
616
+ };
617
+ }
618
+ return i === 0 ? {
619
+ focusedItem: s[0],
620
+ focusedIndex: 0,
621
+ focusedType: 1
622
+ /* ListItem */
623
+ } : { focusedType: 0, focusedIndex: -1 };
624
+ }
625
+ focusElement(n) {
626
+ this._skipFocusEvent = !0, n.focus(), window.setTimeout(() => this._skipFocusEvent = !1, 0);
627
+ }
628
+ applyState(n) {
629
+ this.base.applyState(n), this._valueItemsDuringOnChange = null;
630
+ }
631
+ calculateMedia(n) {
632
+ for (let t of n)
633
+ this.setState({ windowWidth: t.target.clientWidth });
634
+ }
635
+ /**
636
+ * Updates the state of the MultiSelect when the complex keyboard navigation that
637
+ * includes key combinations with the Ctrl/Command, Shift, Home and End keys
638
+ *
639
+ * @param {Array<string | Object>} dataToSet Defines the array of new values that will be applied to the MultiSelect
640
+ * @param {MultiSelectInternalState} state The current state of the MultiSelect
641
+ */
642
+ updateStateOnKeyboardNavigation(n, t) {
643
+ this.setState({ value: n }), this.triggerOnChange(n, t), this.applyState(t);
644
+ }
645
+ /**
646
+ * Returns the last element that was selected or deselected. Needed for the keyboard navigation specifications
647
+ *
648
+ * @param {number} correction A correction is needed depending on if UP or DOWN key is pressed
649
+ */
650
+ getLastSelectedOrDeselectedIndex(n, t) {
651
+ return this._lastSelectedOrDeslectedItemIndex === null && (this._lastSelectedOrDeslectedItemIndex = t), this._lastSelectedOrDeslectedItemIndex !== null ? this._lastSelectedOrDeslectedItemIndex + n : null;
652
+ }
653
+ };
654
+ y.displayName = "MultiSelect", y.propTypes = {
655
+ ...D.propTypes,
656
+ autoClose: m.bool,
657
+ value: m.arrayOf(m.any),
658
+ defaultValue: m.arrayOf(m.any),
659
+ dataItemKey: m.string,
660
+ placeholder: m.string,
661
+ tags: m.arrayOf(m.shape({
662
+ text: m.string,
663
+ data: m.arrayOf(m.any)
664
+ })),
665
+ tagRender: m.func,
666
+ id: m.string,
667
+ ariaLabelledBy: m.string,
668
+ ariaDescribedBy: m.string,
669
+ groupField: m.string,
670
+ list: m.any,
671
+ adaptive: m.bool,
672
+ adaptiveTitle: m.string,
673
+ onCancel: m.func,
674
+ skipDisabledItems: m.bool
675
+ }, y.defaultProps = {
676
+ ...D.defaultProps,
677
+ autoClose: !0,
678
+ required: !1,
679
+ size: "medium",
680
+ rounded: "medium",
681
+ fillMode: "solid",
682
+ groupMode: "modern",
683
+ skipDisabledItems: !0,
684
+ prefix: void 0,
685
+ suffix: void 0
686
+ };
687
+ let O = y;
688
+ const be = X(), xe = Z(ee(be, O));
689
+ xe.displayName = "KendoReactMultiSelect";
690
+ export {
691
+ xe as MultiSelect,
692
+ be as MultiSelectPropsContext,
693
+ O as MultiSelectWithoutContext
694
+ };