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

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