@progress/kendo-react-dropdowns 7.2.4-develop.2 → 7.2.4-develop.4

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,618 @@
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 u from "react";
10
+ import f from "prop-types";
11
+ import B from "../common/DropDownBase.mjs";
12
+ import { Keys as x, validatePackage as ie, svgIconPropType as oe, canUseDOM as z, classNames as E, IconWrap as ae, createPropsContext as ne, withIdHOC as le, withPropsContext as re, kendoThemeMaps as de } from "@progress/kendo-react-common";
13
+ import { FloatingLabel as pe } from "@progress/kendo-react-labels";
14
+ import { areSame as C, getItemValue as S, isPresent as k, getItemIndexByText as A, suggestValue as he, itemIndexStartsWith as K } from "../common/utils.mjs";
15
+ import ue from "../common/SearchBar.mjs";
16
+ import ce from "../common/ListContainer.mjs";
17
+ import ge from "../common/List.mjs";
18
+ import me from "../common/ListFilter.mjs";
19
+ import H from "../common/GroupStickyHeader.mjs";
20
+ import { packageMetadata as ve } from "../package-metadata.mjs";
21
+ import fe from "../common/ClearButton.mjs";
22
+ import { Button as q } from "@progress/kendo-react-buttons";
23
+ import { caretAltDownIcon as be, xIcon as xe } from "@progress/kendo-svg-icons";
24
+ import { comboArrowBtnAriaLabelExpand as W, messages as $, comboArrowBtnAriaLabelCollapse as G } from "../messages/index.mjs";
25
+ import { provideLocalizationService as U } from "@progress/kendo-react-intl";
26
+ import { ActionSheet as Ie, ActionSheetHeader as ye, ActionSheetContent as ke } from "@progress/kendo-react-layout";
27
+ import { MOBILE_MEDIUM_DEVISE as D, MOBILE_SMALL_DEVISE as j } from "../common/constants.mjs";
28
+ import Y from "../common/withCustomComponent.mjs";
29
+ const Ce = "Please enter a valid value!", { sizeMap: V, roundedMap: Se } = de, w = class w extends u.Component {
30
+ constructor(s) {
31
+ super(s), this.state = {}, this.base = new B(this), this._element = null, this._suggested = "", this._skipBlur = !1, this._input = null, this._adaptiveFilterInput = null, this.itemHeight = 0, this.focus = () => {
32
+ this._input && this._input.focus();
33
+ }, this.handleItemSelect = (e, t) => {
34
+ const { data: n = [], virtual: i, dataItemKey: l } = this.props, d = i ? i.skip : 0, a = n[e - d], r = !C(a, this.value, l);
35
+ this.triggerOnChange(a, t), this.state.text !== void 0 && (t.data.text = void 0), r && this.base.triggerPageChangeCornerItems(a, t);
36
+ }, this.onPopupOpened = () => {
37
+ setTimeout(() => {
38
+ this.mobileMode && this._adaptiveFilterInput && (this._skipBlur = !0, this._adaptiveFilterInput.focus(), this._skipBlur = !1);
39
+ }, 300);
40
+ }, this.componentRef = (e) => {
41
+ this._element = e, this.base.wrapper = e;
42
+ }, this.toggleBtnClick = (e) => {
43
+ 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();
44
+ if (r.syntheticEvent = e, !n && i && d && this.clearValueOnToggleBtnClick(e), this.base.togglePopup(r), !a && this.mobileMode) {
45
+ const o = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
46
+ this.base.filterChanged(o, r);
47
+ }
48
+ this.applyState(r);
49
+ }, this.renderMobileListFilter = () => {
50
+ const e = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text, t = S(this.value, this.props.textField), n = k(e) ? e : t;
51
+ return /* @__PURE__ */ u.createElement(
52
+ me,
53
+ {
54
+ value: n,
55
+ ref: (i) => this._adaptiveFilterInput = i && i.element,
56
+ onChange: this.handleMobileFilterChange,
57
+ onKeyDown: this.onInputKeyDown,
58
+ size: this.props.size,
59
+ rounded: this.props.rounded,
60
+ fillMode: this.props.fillMode
61
+ }
62
+ );
63
+ }, this.handleMobileFilterChange = (e) => {
64
+ const t = this.base.initState();
65
+ t.syntheticEvent = e.syntheticEvent, t.data.text = e.target.value, this.base.filterChanged(e.target.value, t), this.applyState(t);
66
+ }, this.onScroll = (e) => {
67
+ const { vs: t, list: n } = this.base;
68
+ t.scrollHandler(e);
69
+ const { groupField: i } = this.props;
70
+ let { data: l = [] } = this.props;
71
+ if (!i || !l.length)
72
+ return;
73
+ const d = this.itemHeight = this.itemHeight || (t.enabled ? t.itemHeight : n ? n.children[0].offsetHeight : 0), r = e.target.scrollTop - t.skip * d;
74
+ this.props.groupMode === "modern" && (l = this.base.getGroupedDataModernMode(l, i));
75
+ let o = l[0][i];
76
+ for (let h = 1; h < l.length && !(d * h > r); h++)
77
+ l[h] && l[h][i] && (o = l[h][i]);
78
+ o !== this.state.group && (this.setState({
79
+ group: o
80
+ }), this.props.onGroupScroll && this.props.onGroupScroll.call(void 0, { group: o }));
81
+ }, this.handleItemClick = (e, t) => {
82
+ this.base.handleItemClick(e, t), this._valueDuringOnChange = void 0;
83
+ }, this.handleBlur = (e) => {
84
+ if (this.state.focused && !this._skipBlur) {
85
+ const t = this.base.initState(), { textField: n, data: i = [] } = this.props, l = this.getFocusedIndex(), a = !(l === -1) && this.getCurrentValueDisabledStatus(n, i, l);
86
+ t.data.focused = !1, t.events.push({ type: "onBlur" }), t.syntheticEvent = e, n && a && this.clearValueOnBlur(e), this.applyValueOnRejectSuggestions(e.currentTarget.value, t);
87
+ }
88
+ }, this.onInputClick = (e) => {
89
+ 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;
90
+ if (!t && this.mobileMode) {
91
+ const i = this.base.initState();
92
+ i.syntheticEvent = e, this.base.togglePopup(i), this.base.filterChanged(n, i), this.applyState(i);
93
+ }
94
+ }, this.onInputKeyDown = (e) => {
95
+ const { data: t = [], skipDisabledItems: n, textField: i, dataItemKey: l, groupField: d } = this.props, a = this.value, r = Math.max(0, t.findIndex((c) => C(c, a, l))), o = e.keyCode, h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, p = this.base.initState();
96
+ if (p.syntheticEvent = e, !e.altKey && (o === x.up || o === x.down)) {
97
+ if (e.preventDefault(), d !== "" && i)
98
+ if (!this.props.skipDisabledItems && h)
99
+ this.onNavigate(p, o);
100
+ else {
101
+ let c = 0;
102
+ if (o === x.down || o === x.right) {
103
+ const m = t.slice(r + 1 < t.length ? r + 1 : r).find((b) => !b.disabled && b[i]);
104
+ c = m && t.findIndex((b) => b[i] === m[i]);
105
+ } else if (o === x.up || o === x.left) {
106
+ let m;
107
+ if (r === 0)
108
+ m = t, c = t.findIndex((b) => !b.disabled && b[i]);
109
+ else {
110
+ m = t.slice(0, r);
111
+ let b = m.pop();
112
+ for (; b && b.disabled; )
113
+ b = m.pop();
114
+ c = b && t.findIndex((F) => F[i] === b[i]);
115
+ }
116
+ }
117
+ if (c !== void 0) {
118
+ const m = c - r;
119
+ this.onNavigate(p, o, m);
120
+ } else
121
+ c === void 0 && t.findIndex((m) => m[i] === a[i]) === t.length - 1 && this.onNavigate(p, o);
122
+ }
123
+ else if (!this.props.skipDisabledItems && h)
124
+ this.onNavigate(p, o);
125
+ else {
126
+ let c = null;
127
+ if (o === x.down || o === x.right)
128
+ c = t.slice(r + 1).find((m) => !m.disabled);
129
+ else if (o === x.up || o === x.left) {
130
+ const m = t.slice(0, r);
131
+ for (c = m.pop(); c && c.disabled; )
132
+ c = m.pop();
133
+ }
134
+ if (c) {
135
+ const m = c.id - r - 1;
136
+ this.onNavigate(p, o, m);
137
+ } else
138
+ this.onNavigate(p, o);
139
+ }
140
+ this.applyState(p);
141
+ }
142
+ const g = () => {
143
+ e.preventDefault(), this.base.togglePopup(p), this.applyState(p);
144
+ }, I = this.getFocusedIndex(), v = I === -1, y = !v && this.getCurrentValueDisabledStatus(i, t, I);
145
+ h ? o === x.pageUp ? this.base.scrollPopupByPageSize(-1) : o === x.pageDown ? this.base.scrollPopupByPageSize(1) : e.altKey && o === x.up ? g() : o === x.enter ? (e.preventDefault(), (i && !v && e.currentTarget.value ? t[I][i] : void 0) ? !n && i && y ? this.clearValueOnEnterOrEsc(e) : y || this.applyValueOnEnter(e.currentTarget.value, p) : this.applyValueOnEnter(e.currentTarget.value, p)) : o === x.esc && (!n && i && y && this.clearValueOnEnterOrEsc(e), this.applyValueOnRejectSuggestions(e.currentTarget.value, p)) : !h && o === x.esc ? this.clearValueOnEnterOrEsc(e) : e.altKey && o === x.down && g();
146
+ }, this.inputOnChange = (e) => {
147
+ const t = this.base.initState();
148
+ t.syntheticEvent = e;
149
+ const n = this.props.opened !== void 0 ? this.props.opened : this.state.opened, i = e.currentTarget, l = i.value;
150
+ if (this.props.suggest) {
151
+ const d = i.selectionEnd === l.length;
152
+ let a = this.props.filter !== void 0 ? this.props.filter : this.state.text;
153
+ k(a) || (a = S(this.value, this.props.textField) || "");
154
+ const r = a && a === l, o = a && a.length > l.length;
155
+ r || o || !d ? this._suggested = "" : this.suggestValue(l);
156
+ }
157
+ 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 });
158
+ }, this.clearButtonClick = (e) => {
159
+ const t = this.base.initState();
160
+ t.syntheticEvent = e, e.stopPropagation(), this.clearValue();
161
+ }, this.clearValueOnEnterOrEsc = (e) => {
162
+ const t = this.base.initState();
163
+ t.syntheticEvent = e, e.stopPropagation(), this.clearValue();
164
+ }, this.clearValueOnBlur = (e) => {
165
+ const t = this.base.initState();
166
+ t.syntheticEvent = e, e.stopPropagation(), this.clearValue();
167
+ }, this.clearValueOnToggleBtnClick = (e) => {
168
+ const t = this.base.initState();
169
+ t.syntheticEvent = e, e.stopPropagation(), this.clearValue();
170
+ }, this.setValidity = () => {
171
+ this._input && this._input.setCustomValidity && this._input.setCustomValidity(
172
+ this.validity.valid ? "" : this.props.validationMessage || Ce
173
+ );
174
+ }, ie(ve);
175
+ }
176
+ get _inputId() {
177
+ return this.props.id;
178
+ }
179
+ get document() {
180
+ if (z)
181
+ return this.element && this.element.ownerDocument || document;
182
+ }
183
+ /** @hidden */
184
+ get element() {
185
+ return this._element;
186
+ }
187
+ /**
188
+ * The mobile mode of the ComboBox.
189
+ */
190
+ get mobileMode() {
191
+ return !!(this.state.windowWidth && this.state.windowWidth <= D && this.props.adaptive);
192
+ }
193
+ /**
194
+ * The value of the ComboBox.
195
+ */
196
+ get value() {
197
+ if (this._valueDuringOnChange !== void 0)
198
+ return this._valueDuringOnChange;
199
+ if (this.props.value !== void 0)
200
+ return this.props.value;
201
+ if (this.state.value !== void 0)
202
+ return this.state.value;
203
+ if (this.props.defaultValue !== void 0)
204
+ return this.props.defaultValue;
205
+ }
206
+ /**
207
+ * The index of the selected item.
208
+ */
209
+ get index() {
210
+ const { data: s = [], dataItemKey: e } = this.props, t = this.value;
211
+ return s.findIndex((n) => C(n, t, e));
212
+ }
213
+ /**
214
+ * Gets the `name` property of the ComboBox.
215
+ */
216
+ get name() {
217
+ return this.props.name;
218
+ }
219
+ /**
220
+ * Represents the validity state into which the component is set.
221
+ */
222
+ get validity() {
223
+ 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;
224
+ return {
225
+ customError: s,
226
+ valid: t,
227
+ valueMissing: this.value === null
228
+ };
229
+ }
230
+ get validityStyles() {
231
+ return this.props.validityStyles !== void 0 ? this.props.validityStyles : w.defaultProps.validityStyles;
232
+ }
233
+ /** @hidden */
234
+ get required() {
235
+ return this.props.required !== void 0 ? this.props.required : w.defaultProps.required;
236
+ }
237
+ /** @hidden */
238
+ componentDidUpdate(s, e) {
239
+ var g;
240
+ 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;
241
+ if (this._valueOnDidUpdate = p, n && n.total !== a)
242
+ this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
243
+ else {
244
+ const I = s.value !== void 0 ? s.value : e.value;
245
+ let v = l.findIndex((c) => C(c, p, t));
246
+ this.props.groupMode === "modern" && d && p && (v = (g = this.base.getGroupedDataModernMode(l, i)) == null ? void 0 : g.map((c) => c[d]).indexOf(p[d]));
247
+ const y = !C(I, p, t);
248
+ h && n ? this.base.scrollToVirtualItem(n, v) : h && !n ? (this.onPopupOpened(), l && l.length !== 0 && this.base.resetGroupStickyHeader(l[0][i], this), this.base.scrollToItem(v)) : r && o && p && y && this.base.scrollToItem(v);
249
+ }
250
+ h && this._input && this._input.focus(), this.setValidity();
251
+ }
252
+ /** @hidden */
253
+ componentDidMount() {
254
+ var s;
255
+ this.observerResize = z && 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);
256
+ }
257
+ /** @hidden */
258
+ componentWillUnmount() {
259
+ var s;
260
+ (s = this.document) != null && s.body && this.observerResize && this.observerResize.disconnect();
261
+ }
262
+ /** @hidden */
263
+ render() {
264
+ const s = U(this).toLanguageString(W, $[W]), e = U(this).toLanguageString(
265
+ G,
266
+ $[G]
267
+ ), {
268
+ dir: t,
269
+ disabled: n,
270
+ clearButton: i = w.defaultProps.clearButton,
271
+ label: l,
272
+ textField: d,
273
+ adaptive: a,
274
+ className: r,
275
+ style: o,
276
+ loading: h,
277
+ iconClassName: p,
278
+ virtual: g,
279
+ size: I,
280
+ rounded: v,
281
+ fillMode: y,
282
+ opened: c = this.state.opened,
283
+ placeholder: m,
284
+ svgIcon: b
285
+ } = this.props, { windowWidth: F = 0 } = this.state, _ = !this.validityStyles || this.validity.valid, P = this.props.filter !== void 0 ? this.props.filter : this.state.text, J = S(this.value, d), O = k(P) ? P : J, Q = i && (!!O || k(this.value)), M = this.base.vs, N = this.props.id || this._inputId, L = F <= D && a;
286
+ M.enabled = g !== void 0, g !== void 0 && (M.skip = g.skip, M.total = g.total, M.pageSize = g.pageSize);
287
+ const [X, Z] = Y(this.props.prefix || u.Fragment), [ee, te] = Y(this.props.suffix || u.Fragment), R = /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement(
288
+ "span",
289
+ {
290
+ className: E(
291
+ "k-combobox k-input",
292
+ {
293
+ [`k-input-${V[I] || I}`]: I,
294
+ [`k-rounded-${Se[v] || v}`]: v,
295
+ [`k-input-${y}`]: y,
296
+ "k-invalid": !_,
297
+ "k-loading": h,
298
+ "k-required": this.required,
299
+ "k-disabled": n
300
+ },
301
+ r
302
+ ),
303
+ ref: this.componentRef,
304
+ style: l ? { ...o, width: void 0 } : o,
305
+ dir: t
306
+ },
307
+ this.props.prefix && /* @__PURE__ */ u.createElement(X, { ...Z }),
308
+ this.renderSearchBar(O || "", N, m),
309
+ Q && !h && /* @__PURE__ */ u.createElement(fe, { onClick: this.clearButtonClick, key: "clearbutton" }),
310
+ h && /* @__PURE__ */ u.createElement(ae, { className: "k-input-loading-icon", name: "loading", key: "loading" }),
311
+ this.props.suffix && /* @__PURE__ */ u.createElement(ee, { ...te }),
312
+ /* @__PURE__ */ u.createElement(
313
+ q,
314
+ {
315
+ tabIndex: -1,
316
+ type: "button",
317
+ "aria-label": c ? e : s,
318
+ icon: p ? void 0 : "caret-alt-down",
319
+ svgIcon: b || be,
320
+ iconClass: p,
321
+ size: I,
322
+ fillMode: y,
323
+ rounded: null,
324
+ themeColor: "base",
325
+ className: "k-input-button",
326
+ onClick: this.toggleBtnClick,
327
+ onMouseDown: (se) => se.preventDefault()
328
+ }
329
+ ),
330
+ !L && this.renderListContainer()
331
+ ), L && this.renderAdaptiveListContainer());
332
+ return l ? /* @__PURE__ */ u.createElement(
333
+ pe,
334
+ {
335
+ label: l,
336
+ editorId: N,
337
+ editorValue: O,
338
+ editorValid: _,
339
+ editorDisabled: n,
340
+ style: { width: o ? o.width : void 0 },
341
+ children: R
342
+ }
343
+ ) : R;
344
+ }
345
+ /** @hidden */
346
+ onNavigate(s, e, t) {
347
+ 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;
348
+ if (this._suggested = "", d !== -1 && !k(r))
349
+ this.handleItemSelect(d, s);
350
+ else if (l === "")
351
+ this.handleItemSelect(0, s);
352
+ else {
353
+ const o = i.skip + d, h = this.base.navigation.navigate({
354
+ keyCode: e,
355
+ current: o,
356
+ max: (a.enabled ? a.total : n.length) - 1,
357
+ min: 0,
358
+ skipItems: t || void 0
359
+ });
360
+ h !== void 0 && this.handleItemSelect(h, s);
361
+ }
362
+ }
363
+ getCurrentValueDisabledStatus(s, e, t) {
364
+ return s && e && e[t] && e[t].disabled;
365
+ }
366
+ applyValueOnEnter(s, e) {
367
+ const { data: t = [], textField: n, allowCustom: i } = this.props, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, a = S(this.value, n) === s ? this.index : A(t, s, n), r = a !== -1;
368
+ let o;
369
+ if (this._suggested = "", r)
370
+ o = t[a];
371
+ else if (i)
372
+ o = n !== void 0 ? { [n]: s } : s;
373
+ else
374
+ return this.selectFocusedItem(s, e);
375
+ 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);
376
+ }
377
+ applyValueOnRejectSuggestions(s, e) {
378
+ const { data: t = [], textField: n, allowCustom: i } = this.props, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, d = S(this.value, n), a = this.state.windowWidth && this.state.windowWidth <= D;
379
+ if (this._suggested = "", s === d || s === "" && !k(d))
380
+ return l && !a && this.base.togglePopup(e), this.applyState(e);
381
+ const r = A(t, s, n, !0), o = r !== -1;
382
+ let h = null;
383
+ 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);
384
+ }
385
+ selectFocusedItem(s, e) {
386
+ const t = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { data: n = [], textField: i, virtual: l = { skip: 0 }, focusedItemIndex: d = K } = this.props, a = l.skip, r = s === "" && a === 0 ? 0 : d(n, s, i);
387
+ 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);
388
+ }
389
+ renderAdaptiveListContainer() {
390
+ 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;
391
+ let { group: g } = this.state;
392
+ g === void 0 && l !== void 0 && (g = S(i[0], l));
393
+ const I = {
394
+ navigatable: !1,
395
+ navigatableElements: [],
396
+ expand: p,
397
+ animation: !0,
398
+ onClose: (v) => this.toggleBtnClick(v),
399
+ animationStyles: s <= j ? { top: 0, width: "100%", height: "100%" } : void 0,
400
+ className: s <= j ? "k-adaptive-actionsheet k-actionsheet-fullscreen" : "k-adaptive-actionsheet k-actionsheet-bottom"
401
+ };
402
+ return /* @__PURE__ */ u.createElement(Ie, { ...I }, /* @__PURE__ */ u.createElement(ye, { className: "k-text-center" }, /* @__PURE__ */ u.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" }, /* @__PURE__ */ u.createElement("div", { className: "k-actionsheet-title" }, /* @__PURE__ */ u.createElement("div", null, o)), /* @__PURE__ */ u.createElement("div", { className: "k-actionsheet-actions" }, /* @__PURE__ */ u.createElement(
403
+ q,
404
+ {
405
+ tabIndex: 0,
406
+ "aria-label": "Cancel",
407
+ "aria-disabled": "false",
408
+ type: "button",
409
+ fillMode: "flat",
410
+ onClick: this.toggleBtnClick,
411
+ icon: "x",
412
+ svgIcon: xe
413
+ }
414
+ ))), /* @__PURE__ */ u.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())), /* @__PURE__ */ u.createElement(ke, { className: "!k-overflow-hidden" }, /* @__PURE__ */ u.createElement("div", { className: "k-list-container" }, /* @__PURE__ */ u.createElement("div", { className: E(
415
+ {
416
+ "k-list": !a,
417
+ "k-list-lg": !0,
418
+ "k-virtual-list": r,
419
+ "k-data-table": a,
420
+ [`k-table-${V[n] || n}`]: a && n
421
+ }
422
+ ) }, e && /* @__PURE__ */ u.createElement("div", { className: "k-table-header" }, e), !a && g && i.length !== 0 && /* @__PURE__ */ u.createElement(H, { group: g, groupMode: d, render: h }), this.renderList(), t && /* @__PURE__ */ u.createElement("div", { className: "k-list-footer" }, t)))));
423
+ }
424
+ renderListContainer() {
425
+ 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, g = s.getPopupSettings(), I = g.width !== void 0 ? g.width : s.popupWidth;
426
+ let { group: v } = this.state;
427
+ return v === void 0 && l !== void 0 && (v = S(i[0], l)), /* @__PURE__ */ u.createElement(
428
+ ce,
429
+ {
430
+ width: I,
431
+ popupSettings: {
432
+ ...g,
433
+ anchor: g.anchor || this.element,
434
+ show: p,
435
+ popupClass: E(
436
+ g.popupClass,
437
+ "k-list-container",
438
+ "k-combobox-popup"
439
+ )
440
+ },
441
+ dir: e !== void 0 ? e : this.base.dirCalculated,
442
+ itemsCount: [i.length]
443
+ },
444
+ /* @__PURE__ */ u.createElement("div", { className: E(
445
+ {
446
+ "k-list": !r,
447
+ [`k-list-${V[a] || a}`]: !r && a,
448
+ "k-virtual-list": o,
449
+ "k-data-table": r,
450
+ [`k-table-${V[a] || a}`]: r && a
451
+ }
452
+ ) }, t && /* @__PURE__ */ u.createElement("div", { className: "k-table-header" }, t), !r && v && i.length !== 0 && /* @__PURE__ */ u.createElement(H, { group: v, groupMode: d, render: h }), this.renderList(), n && /* @__PURE__ */ u.createElement("div", { className: E(
453
+ {
454
+ "k-list-footer": !this.props.footerClassName
455
+ },
456
+ this.props.footerClassName
457
+ ) }, n))
458
+ );
459
+ }
460
+ renderList() {
461
+ const s = this.base, {
462
+ textField: e,
463
+ dataItemKey: t,
464
+ listNoDataRender: n,
465
+ itemRender: i,
466
+ groupHeaderItemRender: l,
467
+ data: d = [],
468
+ virtual: a = { skip: 0, total: void 0 }
469
+ } = this.props, r = s.getPopupSettings(), o = s.vs, h = a.skip, p = this.props.opened !== void 0 ? this.props.opened : this.state.opened, g = `translateY(${o.translate}px)`, I = p ? this.getFocusedIndex() : void 0, v = this.props.filter !== void 0 ? this.props.filter : this.state.text, y = S(this.value, e), c = k(v) && v !== y ? null : this.value, m = this.props.list || ge;
470
+ return /* @__PURE__ */ u.createElement(
471
+ m,
472
+ {
473
+ id: s.listBoxId,
474
+ virtual: !!a,
475
+ show: p,
476
+ data: d,
477
+ focusedIndex: I,
478
+ value: c,
479
+ textField: e,
480
+ valueField: t,
481
+ groupField: this.props.groupField,
482
+ groupMode: this.props.groupMode,
483
+ isMultiColumn: this.props.isMultiColumn,
484
+ optionsGuid: s.guid,
485
+ listRef: (b) => {
486
+ o.list = this.base.list = b, this.itemHeight = 0;
487
+ },
488
+ wrapperStyle: this.state.windowWidth && this.state.windowWidth > D ? { maxHeight: r.height } : {},
489
+ wrapperCssClass: E(
490
+ "k-list-content",
491
+ {
492
+ "k-list-scroller": !a
493
+ }
494
+ ),
495
+ listStyle: o.enabled ? { transform: g } : void 0,
496
+ key: "listkey",
497
+ skip: h,
498
+ onClick: this.handleItemClick,
499
+ itemRender: i,
500
+ groupHeaderItemRender: l,
501
+ noDataRender: n,
502
+ onMouseDown: (b) => b.preventDefault(),
503
+ onScroll: this.onScroll,
504
+ wrapperRef: o.scrollerRef,
505
+ scroller: this.base.renderScrollElement(),
506
+ ariaSetSize: a.total
507
+ }
508
+ );
509
+ }
510
+ renderSearchBar(s, e, t) {
511
+ const {
512
+ tabIndex: n,
513
+ disabled: i,
514
+ data: l = [],
515
+ dataItemKey: d,
516
+ virtual: a = { skip: 0 }
517
+ } = this.props, r = this.props.opened !== void 0 ? this.props.opened : this.state.opened, o = this.value, h = Math.max(0, l.findIndex((p) => C(p, o, d)));
518
+ return this._suggested && !C(this._valueOnDidUpdate, o, d) && (this._suggested = ""), /* @__PURE__ */ u.createElement(
519
+ ue,
520
+ {
521
+ id: e,
522
+ readOnly: r && this.mobileMode,
523
+ placeholder: t,
524
+ tabIndex: n,
525
+ title: this.props.title,
526
+ accessKey: this.props.accessKey,
527
+ value: s + this._suggested,
528
+ suggestedText: this._suggested,
529
+ ref: (p) => this._input = p && p.input,
530
+ onClick: this.onInputClick,
531
+ onKeyDown: this.onInputKeyDown,
532
+ onChange: this.inputOnChange,
533
+ onFocus: this.base.handleFocus,
534
+ onBlur: this.handleBlur,
535
+ disabled: i,
536
+ expanded: r,
537
+ owns: this.base.listBoxId,
538
+ activedescendant: `option-${this.base.guid}-${h + a.skip}`,
539
+ role: "combobox",
540
+ ariaLabelledBy: this.props.ariaLabelledBy,
541
+ ariaDescribedBy: this.props.ariaDescribedBy,
542
+ ariaRequired: this.required,
543
+ render: this.props.valueRender
544
+ }
545
+ );
546
+ }
547
+ clearValue() {
548
+ const s = this.base.initState();
549
+ 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);
550
+ const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, t = this.mobileMode;
551
+ e && !t && this.base.togglePopup(s), this.applyState(s);
552
+ }
553
+ triggerOnChange(s, e) {
554
+ const t = this.value;
555
+ !k(t) && !k(s) || C(t, s, this.props.dataItemKey) || (this.props.value === void 0 && (e.data.value = s), this._valueDuringOnChange = s, e.events.push({ type: "onChange" }));
556
+ }
557
+ getFocusedIndex() {
558
+ const s = this.value, { data: e = [], textField: t, dataItemKey: n, virtual: i = { skip: 0 }, focusedItemIndex: l = K, skipDisabledItems: d } = this.props, a = this.props.filter ? this.props.filter : this.state.text;
559
+ return k(s) && a === void 0 ? e.findIndex((r) => C(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;
560
+ }
561
+ suggestValue(s) {
562
+ const { data: e, textField: t } = this.props;
563
+ this._suggested = he(s, e, t);
564
+ }
565
+ applyState(s) {
566
+ this.base.applyState(s), this._valueDuringOnChange = void 0;
567
+ }
568
+ calculateMedia(s) {
569
+ for (const e of s)
570
+ this.setState({ windowWidth: e.target.clientWidth });
571
+ }
572
+ };
573
+ w.displayName = "ComboBox", w.propTypes = {
574
+ ...B.propTypes,
575
+ size: f.oneOf([null, "small", "medium", "large"]),
576
+ rounded: f.oneOf([null, "small", "medium", "large", "full"]),
577
+ fillMode: f.oneOf([null, "solid", "flat", "outline"]),
578
+ dataItemKey: f.string,
579
+ groupField: f.string,
580
+ groupMode: f.oneOf([void 0, "classic", "modern"]),
581
+ isMultiColumn: f.bool,
582
+ suggest: f.bool,
583
+ placeholder: f.string,
584
+ title: f.string,
585
+ allowCustom: f.bool,
586
+ clearButton: f.bool,
587
+ iconClassName: f.string,
588
+ svgIcon: oe,
589
+ validationMessage: f.string,
590
+ required: f.bool,
591
+ id: f.string,
592
+ ariaLabelledBy: f.string,
593
+ ariaDescribedBy: f.string,
594
+ list: f.any,
595
+ valueRender: f.func,
596
+ skipDisabledItems: f.bool
597
+ }, w.defaultProps = {
598
+ ...B.defaultProps,
599
+ size: "medium",
600
+ rounded: "medium",
601
+ fillMode: "solid",
602
+ allowCustom: !1,
603
+ clearButton: !0,
604
+ required: !1,
605
+ groupMode: "modern",
606
+ isMultiColumn: !1,
607
+ skipDisabledItems: !0,
608
+ prefix: void 0,
609
+ suffix: void 0
610
+ };
611
+ let T = w;
612
+ const we = ne(), Ee = le(re(we, T));
613
+ Ee.displayName = "KendoReactComboBox";
614
+ export {
615
+ Ee as ComboBox,
616
+ we as ComboBoxPropsContext,
617
+ T as ComboBoxWithoutContext
618
+ };
@@ -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 Y=require("react"),w=require("prop-types"),d=require("@progress/kendo-react-common"),J=require("@progress/kendo-react-labels"),B=require("@progress/kendo-svg-icons"),Q=require("../common/ListContainer.js"),X=require("../common/ListFilter.js"),H=require("../common/GroupStickyHeader.js"),Z=require("../common/ListDefaultItem.js"),ee=require("../common/List.js"),R=require("../common/DropDownBase.js"),I=require("../common/utils.js"),te=require("../package-metadata.js"),W=require("@progress/kendo-react-buttons"),se=require("@progress/kendo-react-intl"),T=require("../messages/index.js"),F=require("../common/constants.js"),q=require("@progress/kendo-react-layout");function ie(_){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(_){for(const e in _)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(_,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>_[e]})}}return s.default=_,Object.freeze(s)}const c=ie(Y),ae="Please select a value from the list!",{sizeMap:z,roundedMap:ne}=d.kendoThemeMaps,E=class E extends c.Component{constructor(s){super(s),this.state={},this._element=null,this.base=new R(this),this.searchState={word:"",last:""},this._select=null,this._skipFocusEvent=!1,this._filterInput=null,this._navigated=!1,this._lastKeypressIsFilter=!1,this.itemHeight=0,this.focus=()=>{this.base.wrapper&&this.base.wrapper.focus()},this.handleItemSelect=(e,t)=>{const{data:a=[],virtual:l,dataItemKey:n,defaultItem:o}=this.props,u=l?l.skip:0,p=e===-1&&o!==void 0?o:a[e-u],h=!I.areSame(p,this.value,n);this.triggerOnChange(p,t),h&&this.base.triggerPageChangeCornerItems(p,t)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.dummySelect=e=>c.createElement("select",{name:this.props.name,ref:t=>{this._select=t},tabIndex:-1,"aria-hidden":!0,title:this.props.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},c.createElement("option",{value:this.props.valueMap?this.props.valueMap.call(void 0,e):e})),this.renderListContainer=()=>{const{header:e,footer:t,dir:a,data:l=[],size:n,groupField:o,groupStickyHeaderItemRender:u,list:p}=this.props,h=this.base,i=h.getPopupSettings(),v=this.props.opened!==void 0?this.props.opened:this.state.opened,b=i.width!==void 0?i.width:h.popupWidth,k={dir:a!==void 0?a:h.dirCalculated,width:b,popupSettings:{...i,popupClass:d.classNames(i.popupClass,"k-list-container","k-dropdownlist-popup"),anchor:i.anchor||this.element,show:v,onOpen:this.onPopupOpened,onClose:this.onPopupClosed},itemsCount:[l.length]};let{group:g}=this.state;return g===void 0&&o!==void 0&&(g=I.getItemValue(l[0],o)),c.createElement(Q,{...k},this.renderListFilter(),e&&c.createElement("div",{className:"k-list-header"},e),c.createElement("div",{className:d.classNames("k-list",{[`k-list-${z[n]||n}`]:n,"k-virtual-list":this.base.vs.enabled})},this.renderDefaultItem(),!p&&g&&l.length!==0&&c.createElement(H,{group:g,groupMode:"modern",render:u}),this.renderList()),t&&c.createElement("div",{className:"k-list-footer"},t))},this.renderList=()=>{const{data:e=[],textField:t,dataItemKey:a,virtual:l={skip:0,total:void 0},groupHeaderItemRender:n,listNoDataRender:o,itemRender:u}=this.props,p=this.base.vs,h=l.skip,i=this.props.opened!==void 0?this.props.opened:this.state.opened,v=this.base.getPopupSettings(),b=`translateY(${p.translate}px)`;return c.createElement(ee,{id:this._listboxId,show:i,data:e.slice(),focusedIndex:this.getFocusedIndex(),value:this.value,textField:t,valueField:a,optionsGuid:this._guid,groupField:this.props.groupField,groupMode:"modern",listRef:k=>p.list=this.base.list=k,wrapperStyle:{maxHeight:v.height},wrapperCssClass:"k-list-content",listStyle:p.enabled?{transform:b}:void 0,key:"listkey",skip:h,onClick:this.handleItemClick,itemRender:u,groupHeaderItemRender:n,noDataRender:o,onScroll:this.onScroll,wrapperRef:p.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:l.total})},this.onScroll=e=>{const{vs:t,list:a}=this.base;t.scrollHandler(e);const{groupField:l}=this.props;let{data:n=[]}=this.props;if(!(!l||!n.length)&&l){const o=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:a?a.children[0].offsetHeight:0),p=e.target.scrollTop-t.skip*o;n=this.base.getGroupedDataModernMode(n,l);let h=n[0][l];for(let i=1;i<n.length&&!(o*i>p);i++)n[i]&&n[i][l]&&(h=n[i][l]);h!==this.state.group&&this.setState({group:h})}},this.renderListFilter=()=>{const e=this.props.filter!==void 0?this.props.filter:this.state.text;return this.props.filterable&&c.createElement(X,{value:e,ref:t=>this._filterInput=t&&t.element,onChange:this.handleListFilterChange,onKeyDown:this.handleKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode})},this.renderDefaultItem=()=>{const{textField:e,defaultItem:t,dataItemKey:a}=this.props;return t!==void 0&&c.createElement(Z,{defaultItem:t,textField:e,selected:I.areSame(this.value,t,a),key:"defaultitemkey",onClick:this.handleDefaultItemClick})},this.search=e=>{clearTimeout(this._typingTimeout),this.props.filterable||(this._typingTimeout=window.setTimeout(()=>this.searchState.word="",this.props.delay),this.selectNext(e))},this.selectNext=e=>{const{data:t=[],dataItemKey:a}=this.props;let l=t.map((C,N)=>({item:C,itemIndex:N}));const n=this.searchState.word,o=this.searchState.last,u=I.sameCharsOnly(n,o);let p=l.length,h=Math.max(0,t.findIndex(C=>I.areSame(C,this.value,a))),i;this.props.defaultItem&&(i={item:this.props.defaultItem,itemIndex:-1},p+=1,h+=1),h+=u?1:0,l=I.shuffleData(l,h,i);let v,b,k,g=0;const{textField:r,ignoreCase:x}=this.props;for(;g<p;g++)if(v=I.getItemValue(l[g].item,r),b=u&&I.matchText(v,o,x),k=I.matchText(v,n,x),b||k){g=l[g].itemIndex;break}if(g!==p){const C=this.base.initState();C.syntheticEvent=e,this.handleItemSelect(g,C),this.applyState(C),this._valueDuringOnChange=void 0}},this.handleKeyDown=e=>{e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{data:t=[],filterable:a,disabled:l,defaultItem:n,leftRightKeysNavigation:o=!0,virtual:u={skip:0,total:0,pageSize:0},dataItemKey:p,groupField:h="",textField:i,skipDisabledItems:v=!0}=this.props,b=this.value,k=t.findIndex(y=>I.areSame(y,b,p)),g=this.props.opened!==void 0?this.props.opened:this.state.opened,r=e.keyCode,x=r===d.Keys.home||r===d.Keys.end,C=r===d.Keys.up||r===d.Keys.down,N=!g&&(e.altKey&&r===d.Keys.down||r===d.Keys.enter||r===d.Keys.space),L=g&&(e.altKey&&r===d.Keys.up||r===d.Keys.esc),D=o&&(r===d.Keys.left||r===d.Keys.right),P=C||D&&!a||x,S=this.base.initState();if(S.syntheticEvent=e,!l){if(x&&this.base.vs.enabled)r===d.Keys.home?u.skip!==0?(this.base.triggerOnPageChange(S,0,u.pageSize),this._navigated=!0):this.triggerOnChange(t[0],S):u.skip<u.total-u.pageSize?(this.base.triggerOnPageChange(S,u.total-u.pageSize,u.pageSize),this._navigated=!0):this.triggerOnChange(t[t.length-1],S);else if(g&&r===d.Keys.pageUp)this.base.scrollPopupByPageSize(-1);else if(g&&r===d.Keys.pageDown)this.base.scrollPopupByPageSize(1);else if(g&&r===d.Keys.enter){const y=this.getFocusedIndex();this.haveFocusedItemAndDataNotEmpty(t,y)?(this.triggerOnChange(null,S),this.applyState(S)):this.handleItemSelect(y,S),this.base.togglePopup(S),e.preventDefault()}else if(N||L)L&&this.resetValueIfDisabledItem(),this.base.togglePopup(S),e.preventDefault();else if(P){if(this._lastKeypressIsFilter=!1,h!==""&&i)if(!v&&g)this.onNavigate(S,r);else{let y;if(r===d.Keys.down||r===d.Keys.right){const f=t.slice(k+1).find(m=>!m.disabled&&m[i]);y=f&&t.findIndex(m=>m[i]===f[i])}else if(r===d.Keys.up||r===d.Keys.left){let f;if(k===0&&n)y=-1;else if(k===-1)f=t,y=t.findIndex(m=>!m.disabled&&m[i]);else{f=t.slice(0,k);let m=f.pop();for(;m&&m.disabled;)m=f.pop();y=m&&t.findIndex(M=>M[i]===m[i])}}if(y!==void 0){const f=y-k;this.onNavigate(S,r,f)}else y===void 0&&t.findIndex(f=>f[i]===b[i])===t.length-1&&this.onNavigate(S,r)}else if(!v&&g||x)this.onNavigate(S,r);else if(i){let y;if(r===d.Keys.down||r===d.Keys.right){const f=t.slice(k+1).find(m=>!m.disabled&&m[i]);y=f&&t.findIndex(m=>m[i]===f[i])}else if(r===d.Keys.up||r===d.Keys.left){let f;if(k===0&&n)y=-1;else if(k===-1)f=t,y=t.find(m=>!m.disabled&&m[i]);else{f=t.slice(0,k);let m=f.pop();for(;m&&m.disabled;)m=f.pop();y=m&&t.findIndex(M=>M[i]===m[i])}}if(y!==void 0){const f=y-k;this.onNavigate(S,r,f)}else y===void 0&&t.findIndex(f=>f[i]===b[i])===t.length-1&&this.onNavigate(S,r)}else this.onNavigate(S,r);e.preventDefault()}this.applyState(S)}},this.handleItemClick=(e,t)=>{this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.handleBlur=e=>{if(this._skipFocusEvent||!this.state.focused)return;const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{adaptive:a}=this.props,{windowWidth:l=0}=this.state,n=l<=F.MOBILE_MEDIUM_DEVISE&&a,o=this.base.initState();o.syntheticEvent=e,o.data.focused=!1,o.events.push({type:"onBlur"}),t&&this.resetValueIfDisabledItem(),t&&!n&&this.base.togglePopup(o),this.applyState(o)},this.handleDefaultItemClick=e=>{const t=this.base.initState();t.syntheticEvent=e,this.base.togglePopup(t),this.triggerOnChange(this.props.defaultItem,t),this.applyState(t)},this.handleWrapperClick=e=>{if(e.isPropagationStopped())return;const t=this.base.initState();t.syntheticEvent=e,this.state.focused||(t.data.focused=!0),this.resetValueIfDisabledItem(),this.base.togglePopup(t),this.applyState(t)},this.handleKeyPress=e=>{if(this.props.filterable||e.which===0||e.keyCode===d.Keys.enter)return;let t=String.fromCharCode(e.charCode||e.keyCode);this.props.ignoreCase&&(t=t.toLowerCase()),t===" "&&e.preventDefault(),this.searchState={word:this.searchState.word+t,last:this.searchState.last+t},this.search(e)},this.handleListFilterChange=e=>{const t=this.base.initState();t.syntheticEvent=e.syntheticEvent,this.props.filter===void 0&&(t.data.text=e.target.value),this.base.filterChanged(e.target.value,t),this._lastKeypressIsFilter=!0,this.applyState(t),this.setState({group:void 0})},this.onPopupOpened=()=>{this._filterInput&&this.focusElement(this._filterInput),this.props.adaptive&&setTimeout(()=>{this._filterInput&&this.focusElement(this._filterInput)},300)},this.onPopupClosed=()=>{this.state.focused&&window.setTimeout(()=>{this.state.focused&&this.base.wrapper&&this.focusElement(this.base.wrapper)})},this.setValidity=()=>{this._select&&this._select.setCustomValidity&&this._select.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ae)},d.validatePackage(te.packageMetadata)}get _inputId(){return this.props.id+"-accessibility-id"}get _listboxId(){return this.props.id+"-listbox-id"}get _guid(){return this.props.id+"-guid"}get document(){if(d.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get value(){let s;return this._valueDuringOnChange!==void 0?s=this._valueDuringOnChange:this.props.value!==void 0?s=this.props.value:this.state.value!==void 0?s=this.state.value:this.props.defaultValue!==void 0&&(s=this.props.defaultValue),!I.isPresent(s)&&this.props.defaultItem!==void 0&&(s=this.props.defaultItem),s}get index(){const{data:s=[],dataItemKey:e}=this.props,t=this.value;return s.findIndex(a=>I.areSame(a,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:E.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:E.defaultProps.required}componentDidUpdate(s,e){var v;const{dataItemKey:t,virtual:a,groupField:l="",textField:n}=this.props,{data:o=[]}=this.props,u=s.virtual?s.virtual.total:0,p=this.props.opened!==void 0?this.props.opened:this.state.opened,h=s.opened!==void 0?s.opened:e.opened,i=!h&&p;if(this.base.getPopupSettings().animate||i&&this.onPopupOpened(),a&&a.total!==u)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const b=this.value,k=s.value!==void 0?s.value:e.value;let g=o.findIndex(x=>I.areSame(x,b,t));l!==""&&b&&n&&(g=(v=this.base.getGroupedDataModernMode(o,l))==null?void 0:v.map(x=>x[n]).indexOf(b[n]));const r=!I.areSame(k,b,t);i&&a?this.base.scrollToVirtualItem(a,g):i&&!a?(this.onPopupOpened(),o&&o.length!==0&&this.base.resetGroupStickyHeader(o[0][l],this),this.base.scrollToItem(g)):p&&h&&b&&r&&!this._navigated?this.base.scrollToItem(g):p&&h&&this._navigated&&(this._navigated&&a&&a.skip===0?this.base.vs.reset():this._navigated&&a&&a.skip===a.total-a.pageSize&&this.base.vs.scrollToEnd())}this._navigated=!1,this.setValidity()}componentDidMount(){var s;this.observerResize=d.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=se.provideLocalizationService(this).toLanguageString(T.dropDownListArrowBtnAriaLabel,T.messages[T.dropDownListArrowBtnAriaLabel]),{style:e,className:t,label:a,dir:l,virtual:n,size:o,rounded:u,fillMode:p,adaptive:h}=this.props,{windowWidth:i=0}=this.state,v=this.props.opened!==void 0?this.props.opened:this.state.opened,b=this.value,k=I.getItemValue(b,this.props.textField),g=!this.validityStyles||this.validity.valid,r=this.base,x=r.vs,C=i<=F.MOBILE_MEDIUM_DEVISE&&h;x.enabled=n!==void 0,n!==void 0&&(r.vs.skip=n.skip,r.vs.total=n.total,r.vs.pageSize=n.pageSize);const{dataItemKey:N,data:L=[],disabled:D,tabIndex:P,loading:S,iconClassName:y,svgIcon:f,valueRender:m}=this.props,{focused:M}=this.state,$=L.findIndex(K=>I.areSame(K,b,N)),V=c.createElement("span",{id:this._inputId,className:"k-input-inner"},c.createElement("span",{className:"k-input-value-text"},k)),j=m!==void 0?m.call(void 0,V,b):V,A=c.createElement(c.Fragment,null,c.createElement("span",{ref:this.componentRef,className:d.classNames("k-dropdownlist k-picker",t,{[`k-picker-${z[o]||o}`]:o,[`k-rounded-${ne[u]||u}`]:u,[`k-picker-${p}`]:p,"k-focus":M,"k-disabled":D,"k-invalid":!g,"k-loading":S,"k-required":this.required}),style:a?{...e,width:void 0}:e,dir:l,onMouseDown:v?K=>{K.target.nodeName!=="INPUT"&&(this.focusElement(this.base.wrapper),K.preventDefault())}:void 0,onFocus:this.handleFocus,onBlur:this.handleBlur,tabIndex:d.getTabIndex(P,D),accessKey:this.props.accessKey,onKeyDown:this.handleKeyDown,onKeyPress:this.handleKeyPress,onClick:D?void 0:this.handleWrapperClick,role:"combobox","aria-required":this.required,"aria-disabled":D||void 0,"aria-haspopup":"listbox","aria-expanded":v||!1,"aria-owns":this._listboxId,"aria-activedescendant":v?"option-"+this._guid+"-"+($+(n?n.skip:0)):void 0,"aria-label":this.props.ariaLabel||this.props.label,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy||this._inputId,id:this.props.id,title:this.props.title},j,S&&c.createElement(d.IconWrap,{className:"k-input-loading-icon",name:"loading"}),c.createElement(W.Button,{tabIndex:-1,type:"button","aria-label":s,"aria-hidden":!0,size:o,fillMode:p,iconClass:y,className:"k-input-button",rounded:null,themeColor:"base",icon:y?void 0:"caret-alt-down",svgIcon:f||B.caretAltDownIcon,onMouseDown:K=>this.state.focused&&K.preventDefault()}),this.dummySelect(b),!C&&this.renderListContainer()),C&&this.renderAdaptiveListContainer());return a?c.createElement(J.FloatingLabel,{label:a,editorValue:k,editorValid:g,editorDisabled:this.props.disabled,style:{width:e?e.width:void 0},children:A}):A}onNavigate(s,e,t){const{data:a=[],defaultItem:l,dataItemKey:n,virtual:o={skip:0,total:0,pageSize:0}}=this.props,u=this.base.vs,p=this.value,h=a.findIndex(v=>I.areSame(v,p,n)),i=this.base.navigation.navigate({current:o.skip+h,max:(u.enabled?o.total:a.length)-1,min:l!==void 0?-1:0,keyCode:e,skipItems:t||void 0});i!==void 0&&this.handleItemSelect(i,s),this.applyState(s)}renderAdaptiveListContainer(){const{windowWidth:s=0}=this.state,{header:e,footer:t,size:a,adaptiveTitle:l,groupField:n,groupStickyHeaderItemRender:o,list:u,data:p=[]}=this.props,h=this.props.opened!==void 0?this.props.opened:this.state.opened,i={navigatable:!1,navigatableElements:[],expand:h,animation:!0,onClose:b=>this.handleWrapperClick(b),animationStyles:s<=F.MOBILE_SMALL_DEVISE?{top:0,width:"100%",height:"100%"}:void 0,className:s<=F.MOBILE_SMALL_DEVISE?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"};let{group:v}=this.state;return v===void 0&&n!==void 0&&(v=I.getItemValue(p[0],n)),c.createElement(q.ActionSheet,{...i},c.createElement(q.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,l)),c.createElement("div",{className:"k-actionsheet-actions"},c.createElement(W.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.handleWrapperClick,icon:"x",svgIcon:B.xIcon}))),c.createElement("div",{className:"k-actionsheet-titlebar-group k-actionsheet-filter"},this.renderListFilter())),c.createElement(q.ActionSheetContent,{className:"!k-overflow-hidden"},e&&c.createElement("div",{className:"k-list-header"},e),c.createElement("div",{className:d.classNames("k-list",{[`k-list-${z[a]||a}`]:a,"k-virtual-list":this.base.vs.enabled})},this.renderDefaultItem(),!u&&v&&p.length!==0&&c.createElement(H,{group:v,groupMode:"modern",render:o}),this.renderList()),t&&c.createElement("div",{className:"k-list-footer"},t)))}getFocusedIndex(){const s=this.value,{data:e=[],textField:t,dataItemKey:a,virtual:l={skip:0},focusedItemIndex:n=I.itemIndexStartsWith,filterable:o,skipDisabledItems:u=!0}=this.props,p=this.props.filter?this.props.filter:this.state.text;return u&&t&&!p&&!s?e.findIndex(h=>!h.disabled&&h[t]):I.isPresent(s)&&p===void 0||o&&p===""?e.findIndex(h=>I.areSame(h,s,a)):p?this._lastKeypressIsFilter?n(e,p,t):e.findIndex(h=>I.areSame(h,s,a)):l.skip===0?0:-1}focusElement(s){this._skipFocusEvent=!0,s.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,30)}triggerOnChange(s,e){I.areSame(this.value,s,this.props.dataItemKey)||(this.props.value===void 0&&(e.data.value=s),this._valueDuringOnChange=s,e.events.push({type:"onChange"}))}applyState(s){this.base.applyState(s),this._valueDuringOnChange=void 0}calculateMedia(s){for(const e of s)this.setState({windowWidth:e.target.clientWidth})}resetValueIfDisabledItem(){const{data:s=[]}=this.props,e=this.base.initState(),t=this.getFocusedIndex();this.haveFocusedItemAndDataNotEmpty(s,t)&&(this.triggerOnChange(null,e),this.applyState(e))}haveFocusedItemAndDataNotEmpty(s,e){return e!==void 0&&e!==-1&&s&&s.length>0&&s[e].disabled}};E.displayName="DropDownList",E.propTypes={delay:w.number,ignoreCase:w.bool,iconClassName:w.string,svgIcon:d.svgIconPropType,defaultItem:w.any,valueRender:w.func,valueMap:w.func,validationMessage:w.string,required:w.bool,id:w.string,ariaLabelledBy:w.string,ariaDescribedBy:w.string,ariaLabel:w.string,leftRightKeysNavigation:w.bool,title:w.string,groupField:w.string,list:w.any,skipDisabledItems:w.bool,...R.propTypes},E.defaultProps={delay:500,tabIndex:0,ignoreCase:!0,...R.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};let O=E;const U=d.createPropsContext(),G=d.withIdHOC(d.withPropsContext(U,O));G.displayName="KendoReactDropDownList";exports.DropDownList=G;exports.DropDownListPropsContext=U;exports.DropDownListWithoutContext=O;