@progress/kendo-react-dropdowns 11.4.0-develop.6 → 11.4.0-develop.7

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.
@@ -7,51 +7,51 @@
7
7
  */
8
8
  import * as s from "react";
9
9
  import C from "prop-types";
10
- import { usePropsContext as Yt, validatePackage as jt, useUnstyled as Jt, useId as Qt, canUseDOM as tt, useAdaptiveModeContext as Xt, classNames as L, uDropDownList as P, getTabIndex as Zt, IconWrap as Rt, svgIconPropType as en, createPropsContext as tn, Keys as I, WatermarkOverlay as nn, sizeMap as rn } from "@progress/kendo-react-common";
11
- import { FloatingLabel as on } from "@progress/kendo-react-labels";
12
- import { caretAltDownIcon as sn } from "@progress/kendo-svg-icons";
13
- import an from "../common/ListContainer.mjs";
14
- import ln from "../common/ListFilter.mjs";
10
+ import { getLicenseMessage as Jt, usePropsContext as Qt, validatePackage as Xt, useUnstyled as Zt, useId as Rt, canUseDOM as tt, useAdaptiveModeContext as en, classNames as L, uDropDownList as P, getTabIndex as tn, IconWrap as nn, svgIconPropType as rn, createPropsContext as on, Keys as I, WatermarkOverlay as sn, sizeMap as an } from "@progress/kendo-react-common";
11
+ import { FloatingLabel as ln } from "@progress/kendo-react-labels";
12
+ import { caretAltDownIcon as dn } from "@progress/kendo-svg-icons";
13
+ import cn from "../common/ListContainer.mjs";
14
+ import un from "../common/ListFilter.mjs";
15
15
  import nt from "../common/GroupStickyHeader.mjs";
16
- import dn from "../common/ListDefaultItem.mjs";
17
- import cn from "../common/List.mjs";
18
- import lt from "../common/DropDownBase.mjs";
19
- import { getFilteredData as E, areSame as M, getItemValue as te, isPresent as rt, itemIndexStartsWith as un, sameCharsOnly as pn, shuffleData as mn, matchText as ot } from "../common/utils.mjs";
20
- import { packageMetadata as fn } from "../package-metadata.mjs";
21
- import { Button as gn } from "@progress/kendo-react-buttons";
22
- import { useLocalization as vn } from "@progress/kendo-react-intl";
23
- import { dropDownListArrowBtnAriaLabel as it, messages as st, dropDownListAdaptiveFilterPlaceholder as at } from "../messages/index.mjs";
24
- import { ActionSheetContent as In } from "@progress/kendo-react-layout";
25
- import { AdaptiveMode as hn } from "../common/AdaptiveMode.mjs";
26
- const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) => {
16
+ import pn from "../common/ListDefaultItem.mjs";
17
+ import mn from "../common/List.mjs";
18
+ import dt from "../common/DropDownBase.mjs";
19
+ import { getFilteredData as E, areSame as M, getItemValue as te, isPresent as rt, itemIndexStartsWith as fn, sameCharsOnly as gn, shuffleData as vn, matchText as ot } from "../common/utils.mjs";
20
+ import { packageMetadata as it } from "../package-metadata.mjs";
21
+ import { Button as In } from "@progress/kendo-react-buttons";
22
+ import { useLocalization as hn } from "@progress/kendo-react-intl";
23
+ import { dropDownListArrowBtnAriaLabel as st, messages as at, dropDownListAdaptiveFilterPlaceholder as lt } from "../messages/index.mjs";
24
+ import { ActionSheetContent as yn } from "@progress/kendo-react-layout";
25
+ import { AdaptiveMode as wn } from "../common/AdaptiveMode.mjs";
26
+ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) => {
27
27
  let Ke = !1;
28
- const n = Yt(wn, dt), {
29
- delay: ut = T.delay,
30
- tabIndex: pt = T.tabIndex,
28
+ const pt = Jt(it), n = Qt(xn, ct), {
29
+ delay: mt = T.delay,
30
+ tabIndex: ft = T.tabIndex,
31
31
  ignoreCase: pe = T.ignoreCase,
32
32
  size: O = T.size,
33
33
  rounded: Ne = T.rounded,
34
34
  fillMode: me = T.fillMode,
35
- groupMode: Dn = T.groupMode
35
+ groupMode: Sn = T.groupMode
36
36
  } = n;
37
37
  if (n.filterable || n.virtual) {
38
38
  const e = [];
39
- n.filterable && e.push("filterable"), n.virtual && e.push("virtualization"), Ke = !jt(fn, {
39
+ n.filterable && e.push("filterable"), n.virtual && e.push("virtualization"), Ke = !Xt(it, {
40
40
  component: "DropDownList",
41
41
  features: e
42
42
  });
43
43
  }
44
- const F = Jt(), fe = Qt(n.id), ge = () => {
44
+ const F = Zt(), fe = Rt(n.id), ge = () => {
45
45
  var e;
46
46
  if (tt)
47
47
  return ((e = J.current) == null ? void 0 : e.ownerDocument) || window.document;
48
- }, mt = () => {
48
+ }, gt = () => {
49
49
  var e, r;
50
50
  (e = t == null ? void 0 : t.current) != null && e.wrapper && ((r = t == null ? void 0 : t.current) == null || r.wrapper.focus({ preventScroll: !0 }));
51
51
  }, k = () => {
52
52
  let e;
53
53
  return H.current !== void 0 && H.current !== null ? e = H.current : n.value !== void 0 ? e = n.value : p.value !== void 0 && p.value !== null ? e = p.value : n.defaultValue !== void 0 && n.defaultValue !== null && (e = n.defaultValue), !rt(e) && n.defaultItem !== void 0 && n.defaultItem !== null && (e = n.defaultItem), e;
54
- }, ft = () => {
54
+ }, vt = () => {
55
55
  const { dataItemKey: e } = n, r = E(n), o = k();
56
56
  return r.findIndex((l) => M(l, o, e));
57
57
  }, ve = () => n.required !== void 0 ? n.required : T.required, Ie = () => {
@@ -61,19 +61,19 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
61
61
  valid: l,
62
62
  valueMissing: r === null
63
63
  };
64
- }, gt = () => n.validityStyles !== void 0 ? n.validityStyles : T.validityStyles, ne = (e) => {
64
+ }, It = () => n.validityStyles !== void 0 ? n.validityStyles : T.validityStyles, ne = (e) => {
65
65
  re.current = !0, e.focus(), window.setTimeout(() => re.current = !1, 30);
66
66
  }, he = () => {
67
67
  Q.current && ne(Q.current), n.adaptive && setTimeout(() => {
68
68
  Q.current && ne(Q.current);
69
69
  }, 300);
70
- }, vt = s.useCallback((e) => {
70
+ }, ht = s.useCallback((e) => {
71
71
  for (const r of e)
72
- Ot(r.target.clientWidth);
72
+ Ht(r.target.clientWidth);
73
73
  }, []), Te = () => {
74
74
  var e;
75
75
  (e = xe.current) != null && e.setCustomValidity && xe.current.setCustomValidity(
76
- Ie().valid ? "" : n.validationMessage || yn
76
+ Ie().valid ? "" : n.validationMessage || Dn
77
77
  );
78
78
  }, U = (e, r) => {
79
79
  const o = k();
@@ -95,9 +95,9 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
95
95
  skipItems: o || void 0
96
96
  });
97
97
  c !== void 0 && j(c, e), K(e);
98
- }, It = (e) => {
98
+ }, yt = (e) => {
99
99
  J.current = e, t.current.wrapper = e;
100
- }, ht = (e) => /* @__PURE__ */ s.createElement(
100
+ }, wt = (e) => /* @__PURE__ */ s.createElement(
101
101
  "select",
102
102
  {
103
103
  name: n.name,
@@ -115,7 +115,7 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
115
115
  textField: e,
116
116
  dataItemKey: r,
117
117
  virtual: o = { skip: 0 },
118
- focusedItemIndex: l = un,
118
+ focusedItemIndex: l = fn,
119
119
  filterable: d,
120
120
  skipDisabledItems: u = !0
121
121
  } = n, g = k(), m = E(n), i = n.filter ? n.filter : p.text;
@@ -217,50 +217,50 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
217
217
  }
218
218
  K(D);
219
219
  }
220
- }, yt = (e) => {
220
+ }, Dt = (e) => {
221
221
  const r = t.current.initState();
222
222
  r.syntheticEvent = e.syntheticEvent, n.filter === void 0 && (r.data.text = e.target.value), t.current.filterChanged(e.target.value, r), Se.current = !0, K(r), Z({ group: void 0, text: String(e.target.value) });
223
223
  }, Ve = (e) => {
224
224
  const r = n.filter !== void 0 ? n.filter : p.text;
225
225
  return n.filterable && /* @__PURE__ */ s.createElement(
226
- ln,
226
+ un,
227
227
  {
228
228
  value: r,
229
229
  ref: (o) => {
230
230
  Q.current = o && o.element;
231
231
  },
232
- onChange: yt,
232
+ onChange: Dt,
233
233
  onKeyDown: Oe,
234
234
  size: e ? "large" : O,
235
235
  rounded: Ne,
236
236
  fillMode: me,
237
237
  renderListFilterWrapper: !0,
238
238
  placeholder: Ue.toLanguageString(
239
- at,
240
- st[at]
239
+ lt,
240
+ at[lt]
241
241
  )
242
242
  }
243
243
  );
244
- }, wt = (e) => {
244
+ }, xt = (e) => {
245
245
  var o;
246
246
  const r = t.current.initState();
247
247
  r.syntheticEvent = e, (o = t == null ? void 0 : t.current) == null || o.togglePopup(r), U(n.defaultItem, r), K(r);
248
- }, Dt = () => {
248
+ }, St = () => {
249
249
  const { textField: e, defaultItem: r, dataItemKey: o } = n, l = k();
250
250
  return r !== void 0 && /* @__PURE__ */ s.createElement(
251
- dn,
251
+ pn,
252
252
  {
253
253
  defaultItem: r,
254
254
  textField: e,
255
255
  selected: M(l, r, o),
256
256
  key: "defaultitemkey",
257
- onClick: wt
257
+ onClick: xt
258
258
  }
259
259
  );
260
- }, xt = (e, r) => {
260
+ }, Ct = (e, r) => {
261
261
  var o;
262
262
  (o = t == null ? void 0 : t.current) == null || o.handleItemClick(e, r), H.current = void 0;
263
- }, St = (e) => {
263
+ }, kt = (e) => {
264
264
  const { vs: r, list: o } = t.current;
265
265
  r.scrollHandler(e);
266
266
  const { groupField: l } = n;
@@ -284,7 +284,7 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
284
284
  itemRender: u
285
285
  } = n, g = E(n), m = F && F.uDropDownList, i = t.current.vs, f = o.skip, c = n.opened !== void 0 ? n.opened : p.opened, x = t.current.getPopupSettings(), h = `translateY(${i.translate}px)`, w = k();
286
286
  return /* @__PURE__ */ s.createElement(
287
- cn,
287
+ mn,
288
288
  {
289
289
  id: Ee,
290
290
  show: c,
@@ -304,17 +304,17 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
304
304
  listStyle: i.enabled ? { transform: h } : void 0,
305
305
  key: "listkey",
306
306
  skip: f,
307
- onClick: xt,
307
+ onClick: Ct,
308
308
  itemRender: u,
309
309
  groupHeaderItemRender: l,
310
310
  noDataRender: d,
311
- onScroll: St,
311
+ onScroll: kt,
312
312
  wrapperRef: i.scrollerRef,
313
313
  scroller: (a = t == null ? void 0 : t.current) == null ? void 0 : a.renderScrollElement(),
314
314
  ariaSetSize: o.total
315
315
  }
316
316
  );
317
- }, Ct = () => {
317
+ }, Et = () => {
318
318
  const { groupField: e } = n, r = E(n), o = n.opened !== void 0 ? n.opened : p.opened, l = F && F.uDropDownList, d = {
319
319
  title: n.adaptiveTitle || n.label,
320
320
  subTitle: n.adaptiveSubtitle,
@@ -324,14 +324,14 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
324
324
  mobileFilter: Ve(!0)
325
325
  };
326
326
  let { group: u } = p;
327
- return u === void 0 && e !== void 0 && (u = te(r[0], e)), /* @__PURE__ */ s.createElement(hn, { ...d }, /* @__PURE__ */ s.createElement(In, null, /* @__PURE__ */ s.createElement("div", { className: L(P.listContainer({ c: l, popup: !1 })) }, bt())));
328
- }, kt = () => {
327
+ return u === void 0 && e !== void 0 && (u = te(r[0], e)), /* @__PURE__ */ s.createElement(wn, { ...d }, /* @__PURE__ */ s.createElement(yn, null, /* @__PURE__ */ s.createElement("div", { className: L(P.listContainer({ c: l, popup: !1 })) }, Mt())));
328
+ }, Lt = () => {
329
329
  p.focused && window.setTimeout(() => {
330
330
  p.focused && t.current.wrapper && ne(t.current.wrapper);
331
331
  });
332
- }, Et = (e) => {
332
+ }, bt = (e) => {
333
333
  "onMouseDownOutside" in (n.popupSettings || {}) && n.popupSettings.onMouseDownOutside.call(void 0, e);
334
- }, Lt = () => {
334
+ }, Pt = () => {
335
335
  const { header: e, footer: r, dir: o, groupField: l, groupStickyHeaderItemRender: d, list: u } = n, g = E(n), m = t.current, i = m.getPopupSettings(), f = n.opened !== void 0 ? n.opened : p.opened, c = i.width !== void 0 ? i.width : m.popupWidth, x = F && F.uDropDownList, h = {
336
336
  dir: o !== void 0 ? o : m.dirCalculated,
337
337
  width: c,
@@ -347,13 +347,13 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
347
347
  anchor: i.anchor || J.current,
348
348
  show: f,
349
349
  onOpen: he,
350
- onClose: kt,
351
- onMouseDownOutside: Et
350
+ onClose: Lt,
351
+ onMouseDownOutside: bt
352
352
  },
353
353
  itemsCount: [g.length]
354
354
  };
355
355
  let { group: w } = p;
356
- return w === void 0 && l !== void 0 && (w = te(g[0], l)), /* @__PURE__ */ s.createElement(an, { ...h }, Ve(!1), e && /* @__PURE__ */ s.createElement("div", { className: L(P.listHeader({ c: x })) }, e), /* @__PURE__ */ s.createElement(
356
+ return w === void 0 && l !== void 0 && (w = te(g[0], l)), /* @__PURE__ */ s.createElement(cn, { ...h }, Ve(!1), e && /* @__PURE__ */ s.createElement("div", { className: L(P.listHeader({ c: x })) }, e), /* @__PURE__ */ s.createElement(
357
357
  "div",
358
358
  {
359
359
  className: L(
@@ -364,32 +364,32 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
364
364
  })
365
365
  )
366
366
  },
367
- Dt(),
367
+ St(),
368
368
  !u && w && g.length !== 0 && /* @__PURE__ */ s.createElement(nt, { group: w, groupMode: "modern", render: d }),
369
369
  He()
370
- ), r && /* @__PURE__ */ s.createElement("div", { className: L(P.listFooter({ c: x })) }, r), Ke && /* @__PURE__ */ s.createElement(nn, null));
371
- }, bt = () => {
370
+ ), r && /* @__PURE__ */ s.createElement("div", { className: L(P.listFooter({ c: x })) }, r), Ke && /* @__PURE__ */ s.createElement(sn, { message: pt }));
371
+ }, Mt = () => {
372
372
  const { header: e, footer: r, groupStickyHeaderItemRender: o, groupField: l, list: d } = n, u = E(n), g = F && F.uDropDownList;
373
373
  let { group: m } = p;
374
374
  return m === void 0 && l !== void 0 && (m = te(u[0], l)), /* @__PURE__ */ s.createElement(s.Fragment, null, e && /* @__PURE__ */ s.createElement("div", { className: L(P.listHeader({ c: g })) }, e), /* @__PURE__ */ s.createElement(
375
375
  "div",
376
376
  {
377
377
  className: L("k-list", {
378
- [`k-list-${G ? "lg" : rn[O] || O}`]: O
378
+ [`k-list-${G ? "lg" : an[O] || O}`]: O
379
379
  })
380
380
  },
381
381
  !d && m && u.length !== 0 && /* @__PURE__ */ s.createElement(nt, { group: m, groupMode: "modern", render: o }),
382
382
  He()
383
383
  ), r && /* @__PURE__ */ s.createElement("div", { className: "k-list-footer" }, r));
384
- }, Pt = (e) => {
384
+ }, Ft = (e) => {
385
385
  const { dataItemKey: r } = n, o = E(n), l = k();
386
386
  let d = o.map((b, $) => ({ item: b, itemIndex: $ }));
387
- const u = _.current.word, g = _.current.last, m = pn(u, g);
387
+ const u = _.current.word, g = _.current.last, m = gn(u, g);
388
388
  let i = d.length, f = Math.max(
389
389
  0,
390
390
  o.findIndex((b) => M(b, l, r))
391
391
  ), c;
392
- n.defaultItem && (c = { item: n.defaultItem, itemIndex: -1 }, i += 1, f += 1), f += m ? 1 : 0, d = mn(d, f, c);
392
+ n.defaultItem && (c = { item: n.defaultItem, itemIndex: -1 }, i += 1, f += 1), f += m ? 1 : 0, d = vn(d, f, c);
393
393
  let x, h, w, a = 0;
394
394
  const { textField: N } = n;
395
395
  for (; a < i; ) {
@@ -403,24 +403,24 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
403
403
  const b = t.current.initState();
404
404
  b.syntheticEvent = e, j(a, b), K(b), H.current = void 0;
405
405
  }
406
- }, Mt = (e) => {
407
- clearTimeout(Be.current), n.filterable || (Be.current = window.setTimeout(() => _.current.word = "", ut), Pt(e));
408
- }, Ft = (e) => {
409
- re.current || t.current.handleFocus(e);
410
406
  }, Kt = (e) => {
407
+ clearTimeout(Be.current), n.filterable || (Be.current = window.setTimeout(() => _.current.word = "", mt), Ft(e));
408
+ }, Nt = (e) => {
409
+ re.current || t.current.handleFocus(e);
410
+ }, Tt = (e) => {
411
411
  if (re.current || !p.focused)
412
412
  return;
413
413
  const r = n.opened !== void 0 ? n.opened : p.opened, o = t.current.initState();
414
414
  o.syntheticEvent = e, o.data.focused = !1, o.events.push({ type: "onBlur" }), r && we(), r && !G && t.current.togglePopup(o), K(o);
415
- }, Nt = (e) => {
415
+ }, zt = (e) => {
416
416
  if (n.filterable || e.which === 0 || e.keyCode === I.enter)
417
417
  return;
418
418
  let r = String.fromCharCode(e.charCode || e.keyCode);
419
419
  pe && (r = r.toLowerCase()), r === " " && e.preventDefault(), _.current = {
420
420
  word: _.current.word + r,
421
421
  last: _.current.last + r
422
- }, Mt(e);
423
- }, Tt = () => {
422
+ }, Kt(e);
423
+ }, Ot = () => {
424
424
  const e = t.current.initState();
425
425
  e.data.opened = p.opened, t.current.togglePopup(e), K(e);
426
426
  }, Ae = s.useRef(null), J = s.useRef(null), xe = s.useRef(null), Q = s.useRef(null);
@@ -431,7 +431,7 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
431
431
  return J.current;
432
432
  },
433
433
  get index() {
434
- return ft();
434
+ return vt();
435
435
  },
436
436
  get name() {
437
437
  return n.name;
@@ -448,16 +448,16 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
448
448
  get opened() {
449
449
  return p.opened;
450
450
  },
451
- focus: mt,
451
+ focus: gt,
452
452
  props: n,
453
- togglePopup: Tt
453
+ togglePopup: Ot
454
454
  })
455
455
  ), s.useImperativeHandle(
456
- ct,
456
+ ut,
457
457
  () => Ae.current
458
458
  );
459
459
  const Be = s.useRef(null), _ = s.useRef({ word: "", last: "" }), re = s.useRef(!1), H = s.useRef(null), A = s.useRef(!1), Se = s.useRef(!1), B = s.useRef({}), Ce = s.useRef({}), t = s.useRef(
460
- new lt({
460
+ new dt({
461
461
  props: n,
462
462
  setState: () => {
463
463
  },
@@ -469,8 +469,8 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
469
469
  handleItemSelect: () => {
470
470
  }
471
471
  })
472
- ), We = s.useRef(0), X = s.useRef(null), [p, zt] = s.useState({}), [ke, Ot] = s.useState(), [, qe] = s.useReducer((e) => e, !0), Ue = vn(), Z = (e) => {
473
- zt({ ...p, ...e });
472
+ ), We = s.useRef(0), X = s.useRef(null), [p, Vt] = s.useState({}), [ke, Ht] = s.useState(), [, qe] = s.useReducer((e) => e, !0), Ue = hn(), Z = (e) => {
473
+ Vt({ ...p, ...e });
474
474
  };
475
475
  s.useEffect(() => {
476
476
  t.current.updateComponentArgs({
@@ -501,60 +501,60 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
501
501
  A.current = !1, Ce.current = p, B.current = n, Te();
502
502
  }), s.useEffect(() => {
503
503
  var e, r;
504
- return X.current = tt && window.ResizeObserver && new window.ResizeObserver(vt.bind(void 0)), (e = t == null ? void 0 : t.current) == null || e.didMount(), Te(), (r = ge()) != null && r.body && X.current && X.current.observe(ge().body), () => {
504
+ return X.current = tt && window.ResizeObserver && new window.ResizeObserver(ht.bind(void 0)), (e = t == null ? void 0 : t.current) == null || e.didMount(), Te(), (r = ge()) != null && r.body && X.current && X.current.observe(ge().body), () => {
505
505
  var o;
506
506
  (o = ge()) != null && o.body && X.current && X.current.disconnect();
507
507
  };
508
508
  }, []);
509
- const _e = fe + "-accessibility-id", Ee = fe + "-listbox-id", Ge = fe + "-guid", Vt = Ue.toLanguageString(
510
- it,
511
- st[it]
509
+ const _e = fe + "-accessibility-id", Ee = fe + "-listbox-id", Ge = fe + "-guid", At = Ue.toLanguageString(
510
+ st,
511
+ at[st]
512
512
  ), {
513
513
  style: oe,
514
- className: Ht,
514
+ className: Bt,
515
515
  label: Le,
516
- dir: At,
516
+ dir: Wt,
517
517
  virtual: W,
518
- adaptive: xn,
519
- dataItemKey: Bt,
518
+ adaptive: Cn,
519
+ dataItemKey: qt,
520
520
  disabled: ie,
521
521
  loading: $e,
522
522
  iconClassName: Ye,
523
- svgIcon: Wt,
523
+ svgIcon: Ut,
524
524
  valueRender: je
525
- } = n, be = n.opened !== void 0 ? n.opened : p.opened, se = k(), Pe = te(se, n.textField), Je = !gt() || Ie().valid, ae = t.current, qt = ae.vs, R = F && F.uDropDownList;
526
- qt.enabled = W !== void 0;
527
- const Qe = Xt(), G = !!(ke && Qe && ke <= Qe.medium && n.adaptive);
525
+ } = n, be = n.opened !== void 0 ? n.opened : p.opened, se = k(), Pe = te(se, n.textField), Je = !It() || Ie().valid, ae = t.current, _t = ae.vs, R = F && F.uDropDownList;
526
+ _t.enabled = W !== void 0;
527
+ const Qe = en(), G = !!(ke && Qe && ke <= Qe.medium && n.adaptive);
528
528
  W !== void 0 && (ae.vs.skip = W.skip, ae.vs.total = W.total, ae.vs.pageSize = W.pageSize);
529
- const Ut = E(n), { focused: _t } = p, Gt = Ut.findIndex((e) => M(e, se, Bt)), Xe = /* @__PURE__ */ s.createElement("span", { id: _e, className: L(P.inputInner({ c: R })) }, Pe && /* @__PURE__ */ s.createElement("span", { className: L(P.inputText({ c: R })) }, Pe)), $t = je !== void 0 ? je.call(void 0, Xe, se) : Xe, Ze = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
529
+ const Gt = E(n), { focused: $t } = p, Yt = Gt.findIndex((e) => M(e, se, qt)), Xe = /* @__PURE__ */ s.createElement("span", { id: _e, className: L(P.inputInner({ c: R })) }, Pe && /* @__PURE__ */ s.createElement("span", { className: L(P.inputText({ c: R })) }, Pe)), jt = je !== void 0 ? je.call(void 0, Xe, se) : Xe, Ze = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
530
530
  "span",
531
531
  {
532
- ref: It,
532
+ ref: yt,
533
533
  className: L(
534
534
  P.wrapper({
535
535
  c: R,
536
536
  size: O,
537
537
  rounded: Ne,
538
538
  fillMode: me,
539
- focused: _t,
539
+ focused: $t,
540
540
  disabled: ie,
541
541
  invalid: !Je,
542
542
  loading: $e,
543
543
  required: ve()
544
544
  }),
545
- Ht
545
+ Bt
546
546
  ),
547
547
  style: Le ? { ...oe, width: void 0 } : oe,
548
- dir: At,
548
+ dir: Wt,
549
549
  onMouseDown: be ? (e) => {
550
550
  e.target.nodeName !== "INPUT" && (ne(t.current.wrapper), e.preventDefault());
551
551
  } : void 0,
552
- onFocus: G ? (e) => De(e) : Ft,
553
- onBlur: Kt,
554
- tabIndex: Zt(pt, ie),
552
+ onFocus: G ? (e) => De(e) : Nt,
553
+ onBlur: Tt,
554
+ tabIndex: tn(ft, ie),
555
555
  accessKey: n.accessKey,
556
556
  onKeyDown: Oe,
557
- onKeyPress: Nt,
557
+ onKeyPress: zt,
558
558
  onClick: ie ? void 0 : De,
559
559
  role: "combobox",
560
560
  "aria-required": ve(),
@@ -562,7 +562,7 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
562
562
  "aria-haspopup": "listbox",
563
563
  "aria-expanded": be || !1,
564
564
  "aria-owns": Ee,
565
- "aria-activedescendant": be ? "option-" + Ge + "-" + (Gt + (W ? W.skip : 0)) : void 0,
565
+ "aria-activedescendant": be ? "option-" + Ge + "-" + (Yt + (W ? W.skip : 0)) : void 0,
566
566
  "aria-label": n.ariaLabel || n.label,
567
567
  "aria-labelledby": n.ariaLabelledBy,
568
568
  "aria-describedby": n.ariaDescribedBy || _e,
@@ -570,29 +570,29 @@ const yn = "Please select a value from the list!", Fe = s.forwardRef((dt, ct) =>
570
570
  id: n.id,
571
571
  title: n.title
572
572
  },
573
- $t,
574
- $e && /* @__PURE__ */ s.createElement(Rt, { className: L(P.loadingIcon({ c: R })), name: "loading" }),
573
+ jt,
574
+ $e && /* @__PURE__ */ s.createElement(nn, { className: L(P.loadingIcon({ c: R })), name: "loading" }),
575
575
  /* @__PURE__ */ s.createElement(
576
- gn,
576
+ In,
577
577
  {
578
578
  tabIndex: -1,
579
579
  type: "button",
580
- "aria-label": Vt,
580
+ "aria-label": At,
581
581
  size: O,
582
582
  fillMode: me,
583
583
  className: L(P.inputButton({ c: R })),
584
584
  rounded: null,
585
585
  themeColor: "base",
586
586
  iconClass: Ye,
587
- svgIcon: Ye ? void 0 : Wt || sn,
587
+ svgIcon: Ye ? void 0 : Ut || dn,
588
588
  onMouseDown: (e) => p.focused && e.preventDefault()
589
589
  }
590
590
  ),
591
- ht(se),
592
- !G && Lt()
593
- ), G && Ct());
591
+ wt(se),
592
+ !G && Pt()
593
+ ), G && Et());
594
594
  return Le ? /* @__PURE__ */ s.createElement(
595
- on,
595
+ ln,
596
596
  {
597
597
  label: Le,
598
598
  editorValue: Pe,
@@ -607,7 +607,7 @@ Fe.propTypes = {
607
607
  delay: C.number,
608
608
  ignoreCase: C.bool,
609
609
  iconClassName: C.string,
610
- svgIcon: en,
610
+ svgIcon: rn,
611
611
  defaultItem: C.any,
612
612
  valueRender: C.func,
613
613
  valueMap: C.func,
@@ -627,7 +627,7 @@ const T = {
627
627
  delay: 500,
628
628
  tabIndex: 0,
629
629
  ignoreCase: !0,
630
- ...lt.defaultProps,
630
+ ...dt.defaultProps,
631
631
  required: !1,
632
632
  size: "medium",
633
633
  rounded: "medium",
@@ -635,10 +635,10 @@ const T = {
635
635
  groupMode: "modern"
636
636
  };
637
637
  Fe.displayName = "KendoReactDropDownList";
638
- const wn = tn();
638
+ const xn = on();
639
639
  Fe.displayName = "KendoReactDropDownList";
640
640
  export {
641
641
  Fe as DropDownList,
642
- wn as DropDownListPropsContext,
642
+ xn as DropDownListPropsContext,
643
643
  T as dropDownListDefaultProps
644
644
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qe=require("react"),n=require("prop-types"),r=require("@progress/kendo-react-common"),Ye=require("@progress/kendo-react-popup"),et=require("@progress/kendo-react-intl"),Fe=require("@progress/kendo-react-treeview"),tt=require("../package-metadata.js"),X=require("../common/utils.js"),nt=require("./useDropdownWidth.js"),at=require("./ListNoData.js"),h=require("../messages/index.js"),ot=require("@progress/kendo-react-labels"),Ie=require("../common/ListFilter.js"),rt=require("@progress/kendo-react-buttons"),Se=require("@progress/kendo-svg-icons"),st=require("../common/AdaptiveMode.js"),it=require("@progress/kendo-react-layout");function lt(u){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const E in u)if(E!=="default"){const s=Object.getOwnPropertyDescriptor(u,E);Object.defineProperty(m,E,s.get?s:{enumerable:!0,get:()=>u[E]})}}return m.default=u,Object.freeze(m)}const t=lt(Qe),{sizeMap:ct,roundedMap:ut}=r.kendoThemeMaps,dt=12e3,pt=2e3,ft="Please select a value from the list!",mt=u=>t.createElement("span",{className:"k-input-value-text"},u.children),Re=u=>u.split("_").map(m=>parseInt(m,10)),vt=(u,m)=>{const{validationMessage:E,valid:s,required:o}=u;return{customError:E!==void 0,valid:!!(s!==void 0?s:!o||m),valueMissing:!m}},oe={selectField:"selected",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},data:[],required:!1,style:{},validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"},Te=r.createPropsContext(),re=t.forwardRef((u,m)=>{const E=!r.validatePackage(tt.packageMetadata,{component:"DropDownTree"}),s=r.usePropsContext(Te,u),o={...oe,...s},Pe=r.useId(),se=o.id||Pe,{data:N,dataItemKey:O,popupSettings:C={},style:V,opened:d,disabled:S,onOpen:L=r.noop,onClose:v=r.noop,placeholder:H,label:R,name:qe,selectField:j,subItemsField:W,validationMessage:Z,valid:Ke,required:G,validityStyles:Me}=o,J=r.getTabIndex(o.tabIndex,S),i=t.useRef(null),g=t.useRef(null),T=t.useRef(null),Q=t.useRef(null),$=t.useRef(null),x=t.useRef(null),U=t.useRef(!1),[ie,Ne]=t.useState(void 0),D=o.value!==void 0,b=D?o.value:ie!==void 0?ie:o.defaultValue,z=X.isPresent(b),Y=z?X.getItemValue(b,o.textField):"",ee=vt({validationMessage:Z,valid:Ke,required:G},z),le=t.useContext(r.ZIndexContext),Oe=le?le+pt:dt,Ve=t.useCallback(()=>g.current&&g.current.focus(),[]);t.useImperativeHandle(i,()=>({props:o,element:g.current,focus:Ve})),t.useImperativeHandle(m,()=>i.current);const w=r.useRtl(g,o.dir),Le={width:nt.useDropdownWidth(g,oe,{...oe.popupSettings,...C},V),...w!==void 0?{direction:w}:{}},[We,ce]=t.useState(!1),l=d!==void 0?d:We,[f,te]=t.useState(!1),[ne,ze]=t.useState(),[ue,Ae]=t.useState(""),de=r.useAdaptiveModeContext(),k=!!(ne&&de&&ne<=de.medium&&o.adaptive),Be=t.useCallback(()=>{$.current&&$.current.setCustomValidity&&$.current.setCustomValidity(ee.valid?"":Z===void 0?ft:Z)},[Z,ee]);t.useEffect(Be),t.useEffect(()=>{const e=r.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Ge.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const pe=t.useCallback(e=>{if(!l){if(L){const a={...e};L.call(void 0,a)}d===void 0&&ce(!0)}},[l,d,L]),F=t.useCallback(e=>{if(l){if(v){const a={...e};v.call(void 0,a)}d===void 0&&(ce(!1),k&&setTimeout(()=>{var a;y((a=Q.current)==null?void 0:a.element)},300))}},[l,d,v,k]),fe=t.useCallback(e=>{if(!e.isDefaultPrevented()&&i.current){te(!0);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};(l?F:pe)(a)}},[l,d,L,v]),P=t.useCallback(e=>{U.current=!0,e(),window.setTimeout(()=>U.current=!1,0)},[]),_e=t.useCallback(e=>{var I,De;const{keyCode:a,altKey:c}=e,p=x.current&&x.current.element;if(!i.current||e.isDefaultPrevented()&&((I=T.current)==null?void 0:I.element)===e.target)return;const K={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(l)if(a===r.Keys.esc||c&&a===r.Keys.up)e.preventDefault(),F(K);else if(p&&p.querySelector(".k-focus")&&(a===r.Keys.up||a===r.Keys.down||a===r.Keys.left||a===r.Keys.right||a===r.Keys.home||a===r.Keys.end)){if(a===r.Keys.up&&((De=T.current)!=null&&De.element)){const _=Array.from(p.querySelectorAll(".k-treeview-item")),we=[..._].reverse().find(M=>M==null?void 0:M.querySelector(".k-focus"));if(we&&_.indexOf(we)===0)return P(()=>{var M;y((M=T.current)==null?void 0:M.element)})}P(r.noop)}else a===r.Keys.down&&P(()=>{var _;y(((_=T.current)==null?void 0:_.element)||p)});else c&&a===r.Keys.down?(e.preventDefault(),pe(K)):l||a===r.Keys.esc&&be(e)},[l,d,L,v]),me=t.useCallback(e=>{const{keyCode:a,altKey:c}=e;c||a!==r.Keys.up&&a!==r.Keys.down||(e.preventDefault(),P(a===r.Keys.up?()=>{y(g.current)}:()=>{var p;y((p=x.current)==null?void 0:p.element)}))},[]),y=t.useCallback(e=>{e&&P(()=>e.focus())},[]),He=t.useCallback(()=>{var e;!f&&l&&!d?F({target:i.current}):s.filterable?y((e=T.current)==null?void 0:e.element):y(x.current&&x.current.element)},[v,s.filterable,f,d,l]),je=t.useCallback(()=>{f&&y(g.current)},[f]),Ze=t.useCallback(e=>{if(!f&&!U.current&&(te(!0),s.onFocus&&i.current)){const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};s.onFocus.call(void 0,a)}},[f,s.onFocus]),$e=t.useCallback(e=>{if(f&&!U.current&&i.current){te(!1);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(s.onBlur){const c={...a};s.onBlur.call(void 0,c)}k||F(a)}},[f,s.onBlur,l,d,v]),Ue=t.useCallback(()=>{f&&P(r.noop),k&&setTimeout(()=>{var e;y((e=Q.current)==null?void 0:e.element)},300)},[f,k]),ve=t.useCallback((e,a,c)=>{if(s.onChange){const p={value:a,level:c?Re(c):[],...e};s.onChange.call(void 0,p)}D||Ne(a)},[s.onChange,D]),ge=t.useCallback(e=>{if(X.areSame(e.item,b,O)||!i.current)return;const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,I={syntheticEvent:K,nativeEvent:p,target:i.current};ve(I,a,c),F(I)},[D,b,s.onChange,O,l,d,v]),be=t.useCallback(e=>{if(!i.current)return;const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};ve(a,null),F(a),e.preventDefault()},[D,s.onChange,l,d,v]),ye=t.useCallback(e=>{if(e.syntheticEvent.stopPropagation(),s.onExpandChange&&i.current){const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,I={level:Re(c),item:a,nativeEvent:p,syntheticEvent:K,target:i.current};s.onExpandChange.call(void 0,I)}},[s.onExpandChange]),he=t.useCallback(e=>{if(s.onFilterChange&&i.current){const c={filter:{field:s.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:i.current};s.onFilterChange.call(void 0,c),s.filter===void 0&&Ae(e.target.value)}},[s.onFilterChange,s.filter,s.textField]),Xe=()=>{const e=o.filterable?t.createElement(Ie,{value:o.filter===void 0?ue:o.filter,ref:Q,onChange:he,onKeyDown:me,size:"large",rounded:A,fillMode:B,placeholder:H}):null,a={title:o.adaptiveTitle||R,subTitle:o.adaptiveSubtitle,expand:l,onClose:c=>F(c),windowWidth:ne,mobileFilter:e};return t.createElement(st.AdaptiveMode,{...a},t.createElement(it.ActionSheetContent,null,N.length>0?t.createElement(Fe.TreeView,{ref:x,tabIndex:J,data:Ee,focusIdField:O,textField:o.textField,selectField:j,expandField:o.expandField,childrenField:W,expandIcons:!0,onItemClick:ge,onExpandChange:ye,size:"large",item:o.item,dir:w,animate:C.animate}):t.createElement(Ce,null,ae.toLanguageString(h.nodata,h.messages[h.nodata]))))},Ge=t.useCallback(e=>{for(const a of e)ze(a.target.clientWidth)},[]),Ee=t.useMemo(()=>D||!z?N:r.mapTree(N,W,e=>r.extendDataItem(e,W,{[j]:X.areSame(e,b,O)})),[N,b,D,z,j,W]),Ce=o.listNoData||at.ListNoData,Je=o.valueHolder||mt,ae=et.useLocalization(),ke=!Me||ee.valid,{size:q,rounded:A,fillMode:B}=o,xe=t.createElement(t.Fragment,null,t.createElement("span",{className:r.classNames("k-dropdowntree k-picker",o.className,{[`k-picker-${ct[q]||q}`]:q,[`k-rounded-${ut[A]||A}`]:A,[`k-picker-${B}`]:B,"k-focus":f,"k-invalid":!ke,"k-loading":o.loading,"k-required":G,"k-disabled":o.disabled}),tabIndex:J,accessKey:o.accessKey,id:se,style:R?{...V,width:void 0}:V,dir:w,ref:g,onKeyDown:S?void 0:_e,onMouseDown:Ue,onClick:S?void 0:fe,onFocus:k?e=>fe(e):Ze,onBlur:$e,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":S,"aria-label":R,"aria-labelledby":o.ariaLabelledBy,"aria-describedby":o.ariaDescribedBy,"aria-required":G},t.createElement("span",{className:"k-input-inner"},(Y||H)&&t.createElement(Je,{item:b},Y||H)),o.loading&&t.createElement(r.IconWrap,{className:"k-input-loading-icon",name:"loading"}),z&&!S&&t.createElement("span",{onClick:be,className:"k-clear-value",title:ae.toLanguageString(h.clear,h.messages[h.clear]),role:"button",tabIndex:-1,onMouseDown:e=>e.preventDefault()},t.createElement(r.IconWrap,{name:"x",icon:Se.xIcon})),t.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":"select",className:"k-input-button",size:q,fillMode:B,themeColor:"base",rounded:null,icon:"caret-alt-down",svgIcon:Se.caretAltDownIcon}),t.createElement("select",{name:qe,ref:$,tabIndex:-1,"aria-hidden":!0,title:R,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:o.valueMap?o.valueMap.call(void 0,b):b})),!k&&t.createElement(r.ZIndexContext.Provider,{value:Oe},t.createElement(Ye.Popup,{...C,className:r.classNames(C.className,{"k-rtl":w==="rtl"}),popupClass:r.classNames(C.popupClass,"k-dropdowntree-popup k-list-container"),style:Le,anchor:C.anchor||g.current,show:l,onOpen:He,onClose:je},o.filterable&&t.createElement(Ie,{value:o.filter===void 0?ue:o.filter,ref:T,onChange:he,onKeyDown:me,size:q,rounded:A,fillMode:B,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),N.length>0?t.createElement(Fe.TreeView,{style:{height:C.height},ref:x,tabIndex:J,data:Ee,focusIdField:O,textField:o.textField,selectField:j,expandField:o.expandField,childrenField:W,expandIcons:!0,onItemClick:ge,onExpandChange:ye,size:q,item:o.item,dir:w,animate:C.animate}):t.createElement(Ce,null,ae.toLanguageString(h.nodata,h.messages[h.nodata])),E&&t.createElement(r.WatermarkOverlay,null)))),k&&Xe());return R?t.createElement(ot.FloatingLabel,{label:R,editorValue:Y,editorPlaceholder:H,editorValid:ke,editorDisabled:S,editorId:se,style:{width:V?V.width:void 0},children:xe,dir:w}):xe}),gt={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,value:n.any,valueMap:n.func,placeholder:n.string,dataItemKey:n.string.isRequired,textField:n.string.isRequired,selectField:n.string,expandField:n.string,subItemsField:n.string,className:n.string,style:n.object,label:n.string,validationMessage:n.string,validityStyles:n.bool,valid:n.bool,required:n.bool,name:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,filterable:n.bool,filter:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,onFilterChange:n.func,onExpandChange:n.func,item:n.func,valueHolder:n.func,listNoData:n.func,adaptiveTitle:n.string,adaptiveSubtitle:n.string,adaptive:n.bool};re.displayName="KendoReactDropDownTree";re.propTypes=gt;exports.DropDownTree=re;exports.DropDownTreePropsContext=Te;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const et=require("react"),n=require("prop-types"),o=require("@progress/kendo-react-common"),tt=require("@progress/kendo-react-popup"),nt=require("@progress/kendo-react-intl"),Ie=require("@progress/kendo-react-treeview"),Se=require("../package-metadata.js"),G=require("../common/utils.js"),at=require("./useDropdownWidth.js"),ot=require("./ListNoData.js"),h=require("../messages/index.js"),rt=require("@progress/kendo-react-labels"),Re=require("../common/ListFilter.js"),st=require("@progress/kendo-react-buttons"),Te=require("@progress/kendo-svg-icons"),it=require("../common/AdaptiveMode.js"),lt=require("@progress/kendo-react-layout");function ct(u){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const E in u)if(E!=="default"){const x=Object.getOwnPropertyDescriptor(u,E);Object.defineProperty(m,E,x.get?x:{enumerable:!0,get:()=>u[E]})}}return m.default=u,Object.freeze(m)}const t=ct(et),{sizeMap:ut,roundedMap:dt}=o.kendoThemeMaps,pt=12e3,ft=2e3,mt="Please select a value from the list!",vt=u=>t.createElement("span",{className:"k-input-value-text"},u.children),Me=u=>u.split("_").map(m=>parseInt(m,10)),gt=(u,m)=>{const{validationMessage:E,valid:x,required:s}=u;return{customError:E!==void 0,valid:!!(x!==void 0?x:!s||m),valueMissing:!m}},re={selectField:"selected",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},data:[],required:!1,style:{},validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"},Pe=o.createPropsContext(),se=t.forwardRef((u,m)=>{const E=!o.validatePackage(Se.packageMetadata,{component:"DropDownTree"}),x=o.getLicenseMessage(Se.packageMetadata),s=o.usePropsContext(Pe,u),r={...re,...s},qe=o.useId(),ie=r.id||qe,{data:O,dataItemKey:L,popupSettings:C={},style:V,opened:d,disabled:R,onOpen:W=o.noop,onClose:v=o.noop,placeholder:j,label:T,name:Ke,selectField:Z,subItemsField:z,validationMessage:$,valid:Ne,required:J,validityStyles:Oe}=r,Q=o.getTabIndex(r.tabIndex,R),i=t.useRef(null),g=t.useRef(null),M=t.useRef(null),Y=t.useRef(null),U=t.useRef(null),D=t.useRef(null),X=t.useRef(!1),[le,Le]=t.useState(void 0),w=r.value!==void 0,b=w?r.value:le!==void 0?le:r.defaultValue,A=G.isPresent(b),ee=A?G.getItemValue(b,r.textField):"",te=gt({validationMessage:$,valid:Ne,required:J},A),ce=t.useContext(o.ZIndexContext),Ve=ce?ce+ft:pt,We=t.useCallback(()=>g.current&&g.current.focus(),[]);t.useImperativeHandle(i,()=>({props:r,element:g.current,focus:We})),t.useImperativeHandle(m,()=>i.current);const F=o.useRtl(g,r.dir),ze={width:at.useDropdownWidth(g,re,{...re.popupSettings,...C},V),...F!==void 0?{direction:F}:{}},[Ae,ue]=t.useState(!1),l=d!==void 0?d:Ae,[f,ne]=t.useState(!1),[ae,Be]=t.useState(),[de,_e]=t.useState(""),pe=o.useAdaptiveModeContext(),k=!!(ae&&pe&&ae<=pe.medium&&r.adaptive),He=t.useCallback(()=>{U.current&&U.current.setCustomValidity&&U.current.setCustomValidity(te.valid?"":$===void 0?mt:$)},[$,te]);t.useEffect(He),t.useEffect(()=>{const e=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Qe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const fe=t.useCallback(e=>{if(!l){if(W){const a={...e};W.call(void 0,a)}d===void 0&&ue(!0)}},[l,d,W]),I=t.useCallback(e=>{if(l){if(v){const a={...e};v.call(void 0,a)}d===void 0&&(ue(!1),k&&setTimeout(()=>{var a;y((a=Y.current)==null?void 0:a.element)},300))}},[l,d,v,k]),me=t.useCallback(e=>{if(!e.isDefaultPrevented()&&i.current){ne(!0);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};(l?I:fe)(a)}},[l,d,W,v]),P=t.useCallback(e=>{X.current=!0,e(),window.setTimeout(()=>X.current=!1,0)},[]),je=t.useCallback(e=>{var S,we;const{keyCode:a,altKey:c}=e,p=D.current&&D.current.element;if(!i.current||e.isDefaultPrevented()&&((S=M.current)==null?void 0:S.element)===e.target)return;const K={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(l)if(a===o.Keys.esc||c&&a===o.Keys.up)e.preventDefault(),I(K);else if(p&&p.querySelector(".k-focus")&&(a===o.Keys.up||a===o.Keys.down||a===o.Keys.left||a===o.Keys.right||a===o.Keys.home||a===o.Keys.end)){if(a===o.Keys.up&&((we=M.current)!=null&&we.element)){const H=Array.from(p.querySelectorAll(".k-treeview-item")),Fe=[...H].reverse().find(N=>N==null?void 0:N.querySelector(".k-focus"));if(Fe&&H.indexOf(Fe)===0)return P(()=>{var N;y((N=M.current)==null?void 0:N.element)})}P(o.noop)}else a===o.Keys.down&&P(()=>{var H;y(((H=M.current)==null?void 0:H.element)||p)});else c&&a===o.Keys.down?(e.preventDefault(),fe(K)):l||a===o.Keys.esc&&ye(e)},[l,d,W,v]),ve=t.useCallback(e=>{const{keyCode:a,altKey:c}=e;c||a!==o.Keys.up&&a!==o.Keys.down||(e.preventDefault(),P(a===o.Keys.up?()=>{y(g.current)}:()=>{var p;y((p=D.current)==null?void 0:p.element)}))},[]),y=t.useCallback(e=>{e&&P(()=>e.focus())},[]),Ze=t.useCallback(()=>{var e;!f&&l&&!d?I({target:i.current}):s.filterable?y((e=M.current)==null?void 0:e.element):y(D.current&&D.current.element)},[v,s.filterable,f,d,l]),$e=t.useCallback(()=>{f&&y(g.current)},[f]),Ue=t.useCallback(e=>{if(!f&&!X.current&&(ne(!0),s.onFocus&&i.current)){const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};s.onFocus.call(void 0,a)}},[f,s.onFocus]),Xe=t.useCallback(e=>{if(f&&!X.current&&i.current){ne(!1);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(s.onBlur){const c={...a};s.onBlur.call(void 0,c)}k||I(a)}},[f,s.onBlur,l,d,v]),Ge=t.useCallback(()=>{f&&P(o.noop),k&&setTimeout(()=>{var e;y((e=Y.current)==null?void 0:e.element)},300)},[f,k]),ge=t.useCallback((e,a,c)=>{if(s.onChange){const p={value:a,level:c?Me(c):[],...e};s.onChange.call(void 0,p)}w||Le(a)},[s.onChange,w]),be=t.useCallback(e=>{if(G.areSame(e.item,b,L)||!i.current)return;const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,S={syntheticEvent:K,nativeEvent:p,target:i.current};ge(S,a,c),I(S)},[w,b,s.onChange,L,l,d,v]),ye=t.useCallback(e=>{if(!i.current)return;const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};ge(a,null),I(a),e.preventDefault()},[w,s.onChange,l,d,v]),he=t.useCallback(e=>{if(e.syntheticEvent.stopPropagation(),s.onExpandChange&&i.current){const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,S={level:Me(c),item:a,nativeEvent:p,syntheticEvent:K,target:i.current};s.onExpandChange.call(void 0,S)}},[s.onExpandChange]),Ee=t.useCallback(e=>{if(s.onFilterChange&&i.current){const c={filter:{field:s.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:i.current};s.onFilterChange.call(void 0,c),s.filter===void 0&&_e(e.target.value)}},[s.onFilterChange,s.filter,s.textField]),Je=()=>{const e=r.filterable?t.createElement(Re,{value:r.filter===void 0?de:r.filter,ref:Y,onChange:Ee,onKeyDown:ve,size:"large",rounded:B,fillMode:_,placeholder:j}):null,a={title:r.adaptiveTitle||T,subTitle:r.adaptiveSubtitle,expand:l,onClose:c=>I(c),windowWidth:ae,mobileFilter:e};return t.createElement(it.AdaptiveMode,{...a},t.createElement(lt.ActionSheetContent,null,O.length>0?t.createElement(Ie.TreeView,{ref:D,tabIndex:Q,data:Ce,focusIdField:L,textField:r.textField,selectField:Z,expandField:r.expandField,childrenField:z,expandIcons:!0,onItemClick:be,onExpandChange:he,size:"large",item:r.item,dir:F,animate:C.animate}):t.createElement(ke,null,oe.toLanguageString(h.nodata,h.messages[h.nodata]))))},Qe=t.useCallback(e=>{for(const a of e)Be(a.target.clientWidth)},[]),Ce=t.useMemo(()=>w||!A?O:o.mapTree(O,z,e=>o.extendDataItem(e,z,{[Z]:G.areSame(e,b,L)})),[O,b,w,A,Z,z]),ke=r.listNoData||ot.ListNoData,Ye=r.valueHolder||vt,oe=nt.useLocalization(),xe=!Oe||te.valid,{size:q,rounded:B,fillMode:_}=r,De=t.createElement(t.Fragment,null,t.createElement("span",{className:o.classNames("k-dropdowntree k-picker",r.className,{[`k-picker-${ut[q]||q}`]:q,[`k-rounded-${dt[B]||B}`]:B,[`k-picker-${_}`]:_,"k-focus":f,"k-invalid":!xe,"k-loading":r.loading,"k-required":J,"k-disabled":r.disabled}),tabIndex:Q,accessKey:r.accessKey,id:ie,style:T?{...V,width:void 0}:V,dir:F,ref:g,onKeyDown:R?void 0:je,onMouseDown:Ge,onClick:R?void 0:me,onFocus:k?e=>me(e):Ue,onBlur:Xe,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":R,"aria-label":T,"aria-labelledby":r.ariaLabelledBy,"aria-describedby":r.ariaDescribedBy,"aria-required":J},t.createElement("span",{className:"k-input-inner"},(ee||j)&&t.createElement(Ye,{item:b},ee||j)),r.loading&&t.createElement(o.IconWrap,{className:"k-input-loading-icon",name:"loading"}),A&&!R&&t.createElement("span",{onClick:ye,className:"k-clear-value",title:oe.toLanguageString(h.clear,h.messages[h.clear]),role:"button",tabIndex:-1,onMouseDown:e=>e.preventDefault()},t.createElement(o.IconWrap,{name:"x",icon:Te.xIcon})),t.createElement(st.Button,{tabIndex:-1,type:"button","aria-label":"select",className:"k-input-button",size:q,fillMode:_,themeColor:"base",rounded:null,icon:"caret-alt-down",svgIcon:Te.caretAltDownIcon}),t.createElement("select",{name:Ke,ref:U,tabIndex:-1,"aria-hidden":!0,title:T,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:r.valueMap?r.valueMap.call(void 0,b):b})),!k&&t.createElement(o.ZIndexContext.Provider,{value:Ve},t.createElement(tt.Popup,{...C,className:o.classNames(C.className,{"k-rtl":F==="rtl"}),popupClass:o.classNames(C.popupClass,"k-dropdowntree-popup k-list-container"),style:ze,anchor:C.anchor||g.current,show:l,onOpen:Ze,onClose:$e},r.filterable&&t.createElement(Re,{value:r.filter===void 0?de:r.filter,ref:M,onChange:Ee,onKeyDown:ve,size:q,rounded:B,fillMode:_,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),O.length>0?t.createElement(Ie.TreeView,{style:{height:C.height},ref:D,tabIndex:Q,data:Ce,focusIdField:L,textField:r.textField,selectField:Z,expandField:r.expandField,childrenField:z,expandIcons:!0,onItemClick:be,onExpandChange:he,size:q,item:r.item,dir:F,animate:C.animate}):t.createElement(ke,null,oe.toLanguageString(h.nodata,h.messages[h.nodata])),E&&t.createElement(o.WatermarkOverlay,{message:x})))),k&&Je());return T?t.createElement(rt.FloatingLabel,{label:T,editorValue:ee,editorPlaceholder:j,editorValid:xe,editorDisabled:R,editorId:ie,style:{width:V?V.width:void 0},children:De,dir:F}):De}),bt={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,value:n.any,valueMap:n.func,placeholder:n.string,dataItemKey:n.string.isRequired,textField:n.string.isRequired,selectField:n.string,expandField:n.string,subItemsField:n.string,className:n.string,style:n.object,label:n.string,validationMessage:n.string,validityStyles:n.bool,valid:n.bool,required:n.bool,name:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,filterable:n.bool,filter:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,onFilterChange:n.func,onExpandChange:n.func,item:n.func,valueHolder:n.func,listNoData:n.func,adaptiveTitle:n.string,adaptiveSubtitle:n.string,adaptive:n.bool};se.displayName="KendoReactDropDownTree";se.propTypes=bt;exports.DropDownTree=se;exports.DropDownTreePropsContext=Pe;