@pismo/marola 2.1.63 → 2.1.65

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 (115) hide show
  1. package/dist/Button-CJaBSdv1.js +135 -0
  2. package/dist/ClassNameConfigurator-CVRWfyIa.js +847 -0
  3. package/dist/{ClickAwayListener-Z08peX_P.js → ClickAwayListener-BnYMO5Ki.js} +26 -33
  4. package/dist/Popup-D267EI4e.js +1338 -0
  5. package/dist/{Portal-DJapUCn6.js → Portal-BrGvxB96.js} +32 -36
  6. package/dist/RadioOption-DyRY8xlF.js +1094 -0
  7. package/dist/{Toggle-DcZTfLrC.js → Toggle-nnDfpqI1.js} +31 -31
  8. package/dist/assets/Checkbox.css +1 -1
  9. package/dist/assets/DropdownMenu.css +1 -1
  10. package/dist/assets/Input.css +1 -1
  11. package/dist/assets/ToastCard.css +1 -1
  12. package/dist/assets/Toggle2.css +1 -1
  13. package/dist/combineHooksSlotProps-j-8UVeYo.js +86 -0
  14. package/dist/components/Alert/Alert.stories.d.ts +6 -6
  15. package/dist/components/Autocomplete/Autocomplete.d.ts +1 -1
  16. package/dist/components/Autocomplete/Autocomplete.js +311 -320
  17. package/dist/components/Autocomplete/Autocomplete.stories.d.ts +1 -1
  18. package/dist/components/Avatar/Avatar.stories.d.ts +4 -4
  19. package/dist/components/BankingCard/BankingCard.d.ts +0 -1
  20. package/dist/components/Button/Button.js +1 -1
  21. package/dist/components/Checkbox/Checkbox.js +56 -56
  22. package/dist/components/Checkbox/Checkbox.stories.d.ts +8 -8
  23. package/dist/components/Chip/Chip.js +3 -3
  24. package/dist/components/DatePicker/DatePicker.js +742 -639
  25. package/dist/components/DatePicker/DatePicker.stories.d.ts +8 -8
  26. package/dist/components/DatePicker/dateUtils.d.ts +2 -2
  27. package/dist/components/DatePicker/dateUtils.js +1 -1
  28. package/dist/components/DatePicker/keyboardNavigation.d.ts +1 -1
  29. package/dist/components/DatePicker/renderCalendarDays.js +1 -1
  30. package/dist/components/DatePicker/renderPeriodSelection.js +1 -1
  31. package/dist/components/Dialog/CloseIconButton.js +1 -1
  32. package/dist/components/Dialog/Dialog.js +372 -352
  33. package/dist/components/Dialog/Dialog.stories.d.ts +96 -135
  34. package/dist/components/DoubleAutocomplete/DoubleAutocomplete.d.ts +1 -1
  35. package/dist/components/DoubleAutocomplete/DoubleAutocomplete.js +2 -2
  36. package/dist/components/DoubleAutocomplete/DoubleAutocomplete.stories.d.ts +1 -1
  37. package/dist/components/DoubleInput/DoubleInput.stories.d.ts +1 -1
  38. package/dist/components/Draggable/Draggable.d.ts +0 -1
  39. package/dist/components/Draggable/Draggable.js +1 -1
  40. package/dist/components/Draggable/Draggable.stories.d.ts +2 -3
  41. package/dist/components/Draggable/useDraggable.js +1 -1
  42. package/dist/components/DropdownMenu/DropdownMenu.d.ts +3 -1
  43. package/dist/components/DropdownMenu/DropdownMenu.js +39 -34
  44. package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +6 -4
  45. package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +4 -4
  46. package/dist/components/IconButton/IconButton.js +1 -1
  47. package/dist/components/Input/Input.d.ts +2 -0
  48. package/dist/components/Input/Input.js +361 -340
  49. package/dist/components/Input/Input.stories.d.ts +2 -0
  50. package/dist/components/InputSearch/InputSearch.d.ts +31 -30
  51. package/dist/components/InputSearch/InputSearch.stories.d.ts +31 -30
  52. package/dist/components/Popover/Popover.d.ts +3 -3
  53. package/dist/components/Popover/Popover.js +2 -2
  54. package/dist/components/Popover/Popover.stories.d.ts +3 -3
  55. package/dist/components/Popover/PopoverBody.d.ts +0 -1
  56. package/dist/components/Popover/PopoverFooter.d.ts +0 -1
  57. package/dist/components/Popover/PopoverHeader.d.ts +0 -1
  58. package/dist/components/RadioButton/RadioButton.d.ts +0 -1
  59. package/dist/components/RadioButton/RadioButton.js +684 -769
  60. package/dist/components/RadioButton/RadioOption.d.ts +0 -1
  61. package/dist/components/RadioButton/RadioOption.js +3 -3
  62. package/dist/components/ResultContainer/ResultContainer.d.ts +0 -1
  63. package/dist/components/ResultContainer/ResultContainer.stories.d.ts +9 -9
  64. package/dist/components/ResultWithChips/ResultWithChips.js +1 -1
  65. package/dist/components/ResultWithChips/ResultWithChips.stories.d.ts +9 -9
  66. package/dist/components/RowItem/RowItem.js +2 -2
  67. package/dist/components/Select/Select.js +625 -591
  68. package/dist/components/Skeleton/Skeleton.d.ts +0 -1
  69. package/dist/components/Snackbar/Snackbar.js +295 -239
  70. package/dist/components/Snackbar/Snackbar.stories.d.ts +113 -113
  71. package/dist/components/StepperNavigator/StepperNavigator.d.ts +0 -1
  72. package/dist/components/Table/Table.stories.d.ts +5 -5
  73. package/dist/components/Tabs/Tab.js +107 -98
  74. package/dist/components/Tabs/TabPanel.js +58 -55
  75. package/dist/components/Tabs/Tabs.js +246 -231
  76. package/dist/components/ToastCard/ToastCard.js +31 -31
  77. package/dist/components/Toggle/Toggle.js +147 -137
  78. package/dist/components/Toggle/Toggle.stories.d.ts +5 -5
  79. package/dist/components/ToggleGroup/Toggle.d.ts +0 -1
  80. package/dist/components/ToggleGroup/Toggle.js +2 -2
  81. package/dist/components/ToggleGroup/ToggleGroup.js +1 -1
  82. package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
  83. package/dist/components/Tooltip/Tooltip.js +266 -325
  84. package/dist/components/Tooltip/Tooltip.stories.d.ts +4 -4
  85. package/dist/components/TransactionRow/TransactionRow.stories.d.ts +21 -21
  86. package/dist/contexts/DraggableProvider/DraggableProvider.d.ts +0 -1
  87. package/dist/contexts/DraggableProvider/DraggableProvider.js +1 -1
  88. package/dist/contexts/SnackbarProvider/SnackbarProvider.js +1 -1
  89. package/dist/{dayjs.min-ClQKmc--.js → dayjs.min-BtgZiFZY.js} +14 -14
  90. package/dist/getReactElementRef-iorwYm2A.js +19 -0
  91. package/dist/{index-1UpBa69h.js → index-ew-96uBP.js} +2129 -2128
  92. package/dist/isFocusVisible-CPZqtjv2.js +12 -0
  93. package/dist/main.js +2 -2
  94. package/dist/{ownerDocument-By592Iy6.js → ownerDocument-CU-LCrtd.js} +1 -1
  95. package/dist/react-BTbo_5A3.js +526 -0
  96. package/dist/setRef-Bo0HEdBB.js +6 -0
  97. package/dist/useButton-C2E_LFJp.js +90 -0
  98. package/dist/useControlled-BYdyS7Pn.js +31 -0
  99. package/dist/useId-CK6Kn3Tn.js +21 -0
  100. package/dist/useList-BLW78Lq7.js +446 -0
  101. package/dist/utils/draggable.d.ts +2 -2
  102. package/package.json +5 -4
  103. package/dist/Button-BrEDdtHO.js +0 -130
  104. package/dist/Popup-Dffqo7wT.js +0 -1246
  105. package/dist/RadioOption-DYovqiwF.js +0 -720
  106. package/dist/combineHooksSlotProps-BhQ14uyD.js +0 -79
  107. package/dist/exactProp-SYjL19cU.js +0 -13
  108. package/dist/react-BvI-Sw9b.js +0 -509
  109. package/dist/useButton-CezPDte8.js +0 -105
  110. package/dist/useControlled-CCMYYdCM.js +0 -31
  111. package/dist/useId-BW-oWmul.js +0 -19
  112. package/dist/useIsFocusVisible-BH4IAdcw.js +0 -69
  113. package/dist/useList-nqLfZem8.js +0 -435
  114. package/dist/useSlotProps-CYHDC4TN.js +0 -834
  115. package/dist/useTimeout-DxF9kiZL.js +0 -36
@@ -1,178 +1,169 @@
1
- import { jsx as Q, jsxs as it } from "react/jsx-runtime";
1
+ import { jsx as Z, jsxs as st } from "react/jsx-runtime";
2
2
  import * as g from "react";
3
- import { useId as lt, useState as at } from "react";
4
- import { c as ut } from "../../clsx-OuTLNxxd.js";
5
- import { Icon as ct } from "../Icon/Icon.js";
6
- import { Input as ft } from "../Input/Input.js";
7
- import { s as dt, _ as Me } from "../../useSlotProps-CYHDC4TN.js";
8
- import { u as pt } from "../../useId-BW-oWmul.js";
9
- import { u as _e } from "../../useControlled-CCMYYdCM.js";
3
+ import { useId as it, useState as lt } from "react";
4
+ import { c as at } from "../../clsx-OuTLNxxd.js";
5
+ import { Icon as ut } from "../Icon/Icon.js";
6
+ import { Input as ct } from "../Input/Input.js";
7
+ import { u as ft } from "../../useId-CK6Kn3Tn.js";
8
+ import { u as ke } from "../../useControlled-BYdyS7Pn.js";
10
9
  import { u as pe } from "../../useEventCallback-BAQJJ3ye.js";
11
- import '../../assets/Autocomplete.css';const gt = (c) => {
10
+ import { s as dt } from "../../setRef-Bo0HEdBB.js";
11
+ import '../../assets/Autocomplete.css';const pt = (p) => {
12
12
  const h = g.useRef({});
13
13
  return g.useEffect(() => {
14
- h.current = c;
14
+ h.current = p;
15
15
  }), h.current;
16
16
  };
17
- function Re(c) {
18
- return typeof c.normalize < "u" ? c.normalize("NFD").replace(/[\u0300-\u036f]/g, "") : c;
17
+ function ve(p) {
18
+ return p.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
19
19
  }
20
- function ht(c = {}) {
20
+ function gt(p = {}) {
21
21
  const {
22
22
  ignoreAccents: h = !0,
23
- ignoreCase: m = !0,
24
- limit: A,
25
- matchFrom: v = "any",
26
- stringify: j,
27
- trim: V = !1
28
- } = c;
29
- return (D, {
23
+ ignoreCase: O = !0,
24
+ limit: _,
25
+ matchFrom: N = "any",
26
+ stringify: U,
27
+ trim: v = !1
28
+ } = p;
29
+ return ($, {
30
30
  inputValue: M,
31
- getOptionLabel: b
31
+ getOptionLabel: m
32
32
  }) => {
33
- let k = V ? M.trim() : M;
34
- m && (k = k.toLowerCase()), h && (k = Re(k));
35
- const B = k ? D.filter((J) => {
36
- let w = (j || b)(J);
37
- return m && (w = w.toLowerCase()), h && (w = Re(w)), v === "start" ? w.indexOf(k) === 0 : w.indexOf(k) > -1;
38
- }) : D;
39
- return typeof A == "number" ? B.slice(0, A) : B;
33
+ let k = v ? M.trim() : M;
34
+ O && (k = k.toLowerCase()), h && (k = ve(k));
35
+ const j = k ? $.filter((W) => {
36
+ let w = (U || m)(W);
37
+ return O && (w = w.toLowerCase()), h && (w = ve(w)), N === "start" ? w.startsWith(k) : w.includes(k);
38
+ }) : $;
39
+ return typeof _ == "number" ? j.slice(0, _) : j;
40
40
  };
41
41
  }
42
- function ge(c, h) {
43
- for (let m = 0; m < c.length; m += 1)
44
- if (h(c[m]))
45
- return m;
46
- return -1;
47
- }
48
- const mt = ht(), bt = 5, xt = (c) => {
42
+ const ht = gt(), Me = 5, mt = (p) => {
49
43
  var h;
50
- return c.current !== null && ((h = c.current.parentElement) == null ? void 0 : h.contains(document.activeElement));
51
- };
52
- function yt(c) {
44
+ return p.current !== null && ((h = p.current.parentElement) == null ? void 0 : h.contains(document.activeElement));
45
+ }, bt = [];
46
+ function xt(p) {
53
47
  const {
54
48
  // eslint-disable-next-line @typescript-eslint/naming-convention
55
- unstable_isActiveElementInListbox: h = xt,
49
+ unstable_isActiveElementInListbox: h = mt,
56
50
  // eslint-disable-next-line @typescript-eslint/naming-convention
57
- unstable_classNamePrefix: m = "Mui",
58
- autoComplete: A = !1,
59
- autoHighlight: v = !1,
60
- autoSelect: j = !1,
61
- blurOnSelect: V = !1,
62
- clearOnBlur: D = !c.freeSolo,
51
+ unstable_classNamePrefix: O = "Mui",
52
+ autoComplete: _ = !1,
53
+ autoHighlight: N = !1,
54
+ autoSelect: U = !1,
55
+ blurOnSelect: v = !1,
56
+ clearOnBlur: $ = !p.freeSolo,
63
57
  clearOnEscape: M = !1,
64
- componentName: b = "useAutocomplete",
65
- defaultValue: k = c.multiple ? [] : null,
66
- disableClearable: B = !1,
67
- disableCloseOnSelect: J = !1,
58
+ componentName: m = "useAutocomplete",
59
+ defaultValue: k = p.multiple ? bt : null,
60
+ disableClearable: j = !1,
61
+ disableCloseOnSelect: W = !1,
68
62
  disabled: w,
69
- disabledItemsFocusable: he = !1,
70
- disableListWrap: W = !1,
71
- filterOptions: me = mt,
72
- filterSelectedOptions: ee = !1,
73
- freeSolo: L = !1,
74
- getOptionDisabled: U,
75
- getOptionKey: te,
76
- getOptionLabel: ne = (t) => {
77
- var e;
78
- return (e = t.label) != null ? e : t;
79
- },
80
- groupBy: R,
81
- handleHomeEndKeys: re = !c.freeSolo,
82
- id: be,
63
+ disabledItemsFocusable: ge = !1,
64
+ disableListWrap: J = !1,
65
+ filterOptions: he = ht,
66
+ filterSelectedOptions: te = !1,
67
+ freeSolo: V = !1,
68
+ getOptionDisabled: B,
69
+ getOptionKey: Y,
70
+ getOptionLabel: ne = (t) => t.label ?? t,
71
+ groupBy: H,
72
+ handleHomeEndKeys: re = !p.freeSolo,
73
+ id: me,
83
74
  includeInputInList: i = !1,
84
- inputValue: y,
85
- isOptionEqualToValue: _ = (t, e) => t === e,
75
+ inputValue: x,
76
+ isOptionEqualToValue: E = (t, e) => t === e,
86
77
  multiple: l = !1,
87
- onChange: E,
78
+ onChange: T,
88
79
  onClose: oe,
89
80
  onHighlightChange: se,
90
- onInputChange: H,
81
+ onInputChange: R,
91
82
  onOpen: Ee,
92
83
  open: He,
93
- openOnFocus: Fe = !1,
94
- options: xe,
95
- readOnly: Y = !1,
96
- selectOnFocus: qe = !c.freeSolo,
97
- value: je
98
- } = c, T = pt(be);
99
- let O = ne;
100
- O = (t) => {
84
+ openOnFocus: Re = !1,
85
+ options: be,
86
+ readOnly: X = !1,
87
+ selectOnFocus: Fe = !p.freeSolo,
88
+ value: qe
89
+ } = p, A = ft(me);
90
+ let y = ne;
91
+ y = (t) => {
101
92
  const e = ne(t);
102
93
  if (typeof e != "string") {
103
94
  if (process.env.NODE_ENV !== "production") {
104
95
  const n = e === void 0 ? "undefined" : `${typeof e} (${e})`;
105
- console.error(`MUI: The \`getOptionLabel\` method of ${b} returned ${n} instead of a string for ${JSON.stringify(t)}.`);
96
+ console.error(`MUI: The \`getOptionLabel\` method of ${m} returned ${n} instead of a string for ${JSON.stringify(t)}.`);
106
97
  }
107
98
  return String(e);
108
99
  }
109
100
  return e;
110
101
  };
111
- const ye = g.useRef(!1), Oe = g.useRef(!0), d = g.useRef(null), $ = g.useRef(null), [ie, Be] = g.useState(null), [P, Ie] = g.useState(-1), Te = v ? 0 : -1, x = g.useRef(Te), [r, Ue] = _e({
112
- controlled: je,
102
+ const xe = g.useRef(!1), ye = g.useRef(!0), f = g.useRef(null), P = g.useRef(null), [ie, Ue] = g.useState(null), [D, Ie] = g.useState(-1), Te = N ? 0 : -1, b = g.useRef(Te), [r, je] = ke({
103
+ controlled: qe,
113
104
  default: k,
114
- name: b
115
- }), [u, le] = _e({
116
- controlled: y,
105
+ name: m
106
+ }), [u, le] = ke({
107
+ controlled: x,
117
108
  default: "",
118
- name: b,
109
+ name: m,
119
110
  state: "inputValue"
120
- }), [ae, $e] = g.useState(!1), ue = g.useCallback((t, e) => {
121
- if (!(l ? r.length < e.length : e !== null) && !D)
111
+ }), [ae, Ae] = g.useState(!1), ue = g.useCallback((t, e, n) => {
112
+ if (!(l ? r.length < e.length : e !== null) && !$)
122
113
  return;
123
- let o;
114
+ let s;
124
115
  if (l)
125
- o = "";
116
+ s = "";
126
117
  else if (e == null)
127
- o = "";
118
+ s = "";
128
119
  else {
129
- const s = O(e);
130
- o = typeof s == "string" ? s : "";
120
+ const a = y(e);
121
+ s = typeof a == "string" ? a : "";
131
122
  }
132
- u !== o && (le(o), H && H(t, o, "reset"));
133
- }, [O, u, l, H, le, D, r]), [K, Pe] = _e({
123
+ u !== s && (le(s), R && R(t, s, n));
124
+ }, [y, u, l, R, le, $, r]), [z, Pe] = ke({
134
125
  controlled: He,
135
126
  default: !1,
136
- name: b,
127
+ name: m,
137
128
  state: "open"
138
- }), [Ke, Ae] = g.useState(!0), De = !l && r != null && u === O(r), S = K && !Y, f = S ? me(
139
- xe.filter((t) => !(ee && (l ? r : [r]).some((e) => e !== null && _(t, e)))),
129
+ }), [Be, De] = g.useState(!0), _e = !l && r != null && u === y(r), S = z && !X, c = S ? he(
130
+ be.filter((t) => !(te && (l ? r : [r]).some((e) => e !== null && E(t, e)))),
140
131
  // we use the empty string to manipulate `filterOptions` to not filter any options
141
132
  // i.e. the filter predicate always returns true
142
133
  {
143
- inputValue: De && Ke ? "" : u,
144
- getOptionLabel: O
134
+ inputValue: _e && Be ? "" : u,
135
+ getOptionLabel: y
145
136
  }
146
- ) : [], C = gt({
147
- filteredOptions: f,
137
+ ) : [], C = pt({
138
+ filteredOptions: c,
148
139
  value: r,
149
140
  inputValue: u
150
141
  });
151
142
  g.useEffect(() => {
152
143
  const t = r !== C.value;
153
- ae && !t || L && !t || ue(null, r);
154
- }, [r, ue, ae, C.value, L]);
155
- const we = K && f.length > 0 && !Y;
156
- if (process.env.NODE_ENV !== "production" && r !== null && !L && xe.length > 0) {
157
- const t = (l ? r : [r]).filter((e) => !xe.some((n) => _(n, e)));
158
- t.length > 0 && console.warn([`MUI: The value provided to ${b} is invalid.`, `None of the options match with \`${t.length > 1 ? JSON.stringify(t) : JSON.stringify(t[0])}\`.`, "You can use the `isOptionEqualToValue` prop to customize the equality test."].join(`
144
+ ae && !t || V && !t || ue(null, r, "reset");
145
+ }, [r, ue, ae, C.value, V]);
146
+ const Oe = z && c.length > 0 && !X;
147
+ if (process.env.NODE_ENV !== "production" && r !== null && !V && be.length > 0) {
148
+ const t = (l ? r : [r]).filter((e) => !be.some((n) => E(n, e)));
149
+ t.length > 0 && console.warn([`MUI: The value provided to ${m} is invalid.`, `None of the options match with \`${t.length > 1 ? JSON.stringify(t) : JSON.stringify(t[0])}\`.`, "You can use the `isOptionEqualToValue` prop to customize the equality test."].join(`
159
150
  `));
160
151
  }
161
152
  const ce = pe((t) => {
162
- t === -1 ? d.current.focus() : ie.querySelector(`[data-tag-index="${t}"]`).focus();
153
+ t === -1 ? f.current.focus() : ie.querySelector(`[data-tag-index="${t}"]`).focus();
163
154
  });
164
155
  g.useEffect(() => {
165
- l && P > r.length - 1 && (Ie(-1), ce(-1));
166
- }, [r, l, P, ce]);
156
+ l && D > r.length - 1 && (Ie(-1), ce(-1));
157
+ }, [r, l, D, ce]);
167
158
  function ze(t, e) {
168
- if (!$.current || t < 0 || t >= f.length)
159
+ if (!P.current || t < 0 || t >= c.length)
169
160
  return -1;
170
161
  let n = t;
171
162
  for (; ; ) {
172
- const o = $.current.querySelector(`[data-option-index="${n}"]`), s = he ? !1 : !o || o.disabled || o.getAttribute("aria-disabled") === "true";
163
+ const o = P.current.querySelector(`[data-option-index="${n}"]`), s = ge ? !1 : !o || o.disabled || o.getAttribute("aria-disabled") === "true";
173
164
  if (o && o.hasAttribute("tabindex") && !s)
174
165
  return n;
175
- if (e === "next" ? n = (n + 1) % f.length : n = (n - 1 + f.length) % f.length, n === t)
166
+ if (e === "next" ? n = (n + 1) % c.length : n = (n - 1 + c.length) % c.length, n === t)
176
167
  return -1;
177
168
  }
178
169
  }
@@ -181,23 +172,23 @@ function yt(c) {
181
172
  index: e,
182
173
  reason: n = "auto"
183
174
  }) => {
184
- if (x.current = e, e === -1 ? d.current.removeAttribute("aria-activedescendant") : d.current.setAttribute("aria-activedescendant", `${T}-option-${e}`), se && se(t, e === -1 ? null : f[e], n), !$.current)
175
+ if (b.current = e, e === -1 ? f.current.removeAttribute("aria-activedescendant") : f.current.setAttribute("aria-activedescendant", `${A}-option-${e}`), se && se(t, e === -1 ? null : c[e], n), !P.current)
185
176
  return;
186
- const o = $.current.querySelector(`[role="option"].${m}-focused`);
187
- o && (o.classList.remove(`${m}-focused`), o.classList.remove(`${m}-focusVisible`));
188
- let s = $.current;
189
- if ($.current.getAttribute("role") !== "listbox" && (s = $.current.parentElement.querySelector('[role="listbox"]')), !s)
177
+ const o = P.current.querySelector(`[role="option"].${O}-focused`);
178
+ o && (o.classList.remove(`${O}-focused`), o.classList.remove(`${O}-focusVisible`));
179
+ let s = P.current;
180
+ if (P.current.getAttribute("role") !== "listbox" && (s = P.current.parentElement.querySelector('[role="listbox"]')), !s)
190
181
  return;
191
182
  if (e === -1) {
192
183
  s.scrollTop = 0;
193
184
  return;
194
185
  }
195
- const a = $.current.querySelector(`[data-option-index="${e}"]`);
196
- if (a && (a.classList.add(`${m}-focused`), n === "keyboard" && a.classList.add(`${m}-focusVisible`), s.scrollHeight > s.clientHeight && n !== "mouse" && n !== "touch")) {
197
- const p = a, I = s.clientHeight + s.scrollTop, de = p.offsetTop + p.offsetHeight;
198
- de > I ? s.scrollTop = de - s.clientHeight : p.offsetTop - p.offsetHeight * (R ? 1.3 : 0) < s.scrollTop && (s.scrollTop = p.offsetTop - p.offsetHeight * (R ? 1.3 : 0));
186
+ const a = P.current.querySelector(`[data-option-index="${e}"]`);
187
+ if (a && (a.classList.add(`${O}-focused`), n === "keyboard" && a.classList.add(`${O}-focusVisible`), s.scrollHeight > s.clientHeight && n !== "mouse" && n !== "touch")) {
188
+ const d = a, I = s.clientHeight + s.scrollTop, de = d.offsetTop + d.offsetHeight;
189
+ de > I ? s.scrollTop = de - s.clientHeight : d.offsetTop - d.offsetHeight * (H ? 1.3 : 0) < s.scrollTop && (s.scrollTop = d.offsetTop - d.offsetHeight * (H ? 1.3 : 0));
199
190
  }
200
- }), N = pe(({
191
+ }), L = pe(({
201
192
  event: t,
202
193
  diff: e,
203
194
  direction: n = "next",
@@ -206,125 +197,125 @@ function yt(c) {
206
197
  if (!S)
207
198
  return;
208
199
  const a = ze((() => {
209
- const p = f.length - 1;
200
+ const d = c.length - 1;
210
201
  if (e === "reset")
211
202
  return Te;
212
203
  if (e === "start")
213
204
  return 0;
214
205
  if (e === "end")
215
- return p;
216
- const I = x.current + e;
217
- return I < 0 ? I === -1 && i ? -1 : W && x.current !== -1 || Math.abs(e) > 1 ? 0 : p : I > p ? I === p + 1 && i ? -1 : W || Math.abs(e) > 1 ? p : 0 : I;
206
+ return d;
207
+ const I = b.current + e;
208
+ return I < 0 ? I === -1 && i ? -1 : J && b.current !== -1 || Math.abs(e) > 1 ? 0 : d : I > d ? I === d + 1 && i ? -1 : J || Math.abs(e) > 1 ? d : 0 : I;
218
209
  })(), n);
219
210
  if (F({
220
211
  index: a,
221
212
  reason: o,
222
213
  event: t
223
- }), A && e !== "reset")
214
+ }), _ && e !== "reset")
224
215
  if (a === -1)
225
- d.current.value = u;
216
+ f.current.value = u;
226
217
  else {
227
- const p = O(f[a]);
228
- d.current.value = p, p.toLowerCase().indexOf(u.toLowerCase()) === 0 && u.length > 0 && d.current.setSelectionRange(u.length, p.length);
218
+ const d = y(c[a]);
219
+ f.current.value = d, d.toLowerCase().indexOf(u.toLowerCase()) === 0 && u.length > 0 && f.current.setSelectionRange(u.length, d.length);
229
220
  }
230
- }), Je = () => {
221
+ }), Ke = () => {
231
222
  const t = (e, n) => {
232
- const o = e ? O(e) : "", s = n ? O(n) : "";
223
+ const o = e ? y(e) : "", s = n ? y(n) : "";
233
224
  return o === s;
234
225
  };
235
- if (x.current !== -1 && C.filteredOptions && C.filteredOptions.length !== f.length && C.inputValue === u && (l ? r.length === C.value.length && C.value.every((e, n) => O(r[n]) === O(e)) : t(C.value, r))) {
236
- const e = C.filteredOptions[x.current];
226
+ if (b.current !== -1 && C.filteredOptions && C.filteredOptions.length !== c.length && C.inputValue === u && (l ? r.length === C.value.length && C.value.every((e, n) => y(r[n]) === y(e)) : t(C.value, r))) {
227
+ const e = C.filteredOptions[b.current];
237
228
  if (e)
238
- return ge(f, (n) => O(n) === O(e));
229
+ return c.findIndex((n) => y(n) === y(e));
239
230
  }
240
231
  return -1;
241
- }, Se = g.useCallback(() => {
232
+ }, we = g.useCallback(() => {
242
233
  if (!S)
243
234
  return;
244
- const t = Je();
235
+ const t = Ke();
245
236
  if (t !== -1) {
246
- x.current = t;
237
+ b.current = t;
247
238
  return;
248
239
  }
249
240
  const e = l ? r[0] : r;
250
- if (f.length === 0 || e == null) {
251
- N({
241
+ if (c.length === 0 || e == null) {
242
+ L({
252
243
  diff: "reset"
253
244
  });
254
245
  return;
255
246
  }
256
- if ($.current) {
247
+ if (P.current) {
257
248
  if (e != null) {
258
- const n = f[x.current];
259
- if (l && n && ge(r, (s) => _(n, s)) !== -1)
249
+ const n = c[b.current];
250
+ if (l && n && r.findIndex((s) => E(n, s)) !== -1)
260
251
  return;
261
- const o = ge(f, (s) => _(s, e));
262
- o === -1 ? N({
252
+ const o = c.findIndex((s) => E(s, e));
253
+ o === -1 ? L({
263
254
  diff: "reset"
264
255
  }) : F({
265
256
  index: o
266
257
  });
267
258
  return;
268
259
  }
269
- if (x.current >= f.length - 1) {
260
+ if (b.current >= c.length - 1) {
270
261
  F({
271
- index: f.length - 1
262
+ index: c.length - 1
272
263
  });
273
264
  return;
274
265
  }
275
266
  F({
276
- index: x.current
267
+ index: b.current
277
268
  });
278
269
  }
279
270
  }, [
280
271
  // Only sync the highlighted index when the option switch between empty and not
281
- f.length,
272
+ c.length,
282
273
  // Don't sync the highlighted index with the value when multiple
283
274
  // eslint-disable-next-line react-hooks/exhaustive-deps
284
275
  l ? !1 : r,
285
- ee,
286
- N,
276
+ te,
277
+ L,
287
278
  F,
288
279
  S,
289
280
  u,
290
281
  l
291
282
  ]), We = pe((t) => {
292
- dt($, t), t && Se();
283
+ dt(P, t), t && we();
293
284
  });
294
285
  process.env.NODE_ENV !== "production" && g.useEffect(() => {
295
- (!d.current || d.current.nodeName !== "INPUT") && (d.current && d.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${b} where input was expected.`, "This is not a supported scenario but it may work under certain conditions.", "A textarea keyboard navigation may conflict with Autocomplete controls (for example enter and arrow keys).", "Make sure to test keyboard navigation and add custom event handlers if necessary."].join(`
296
- `)) : console.error([`MUI: Unable to find the input element. It was resolved to ${d.current} while an HTMLInputElement was expected.`, `Instead, ${b} expects an input element.`, "", b === "useAutocomplete" ? "Make sure you have bound getInputProps correctly and that the normal ref/effect resolutions order is guaranteed." : "Make sure you have customized the input component correctly."].join(`
286
+ (!f.current || f.current.nodeName !== "INPUT") && (f.current && f.current.nodeName === "TEXTAREA" ? console.warn([`A textarea element was provided to ${m} where input was expected.`, "This is not a supported scenario but it may work under certain conditions.", "A textarea keyboard navigation may conflict with Autocomplete controls (for example enter and arrow keys).", "Make sure to test keyboard navigation and add custom event handlers if necessary."].join(`
287
+ `)) : console.error([`MUI: Unable to find the input element. It was resolved to ${f.current} while an HTMLInputElement was expected.`, `Instead, ${m} expects an input element.`, "", m === "useAutocomplete" ? "Make sure you have bound getInputProps correctly and that the normal ref/effect resolutions order is guaranteed." : "Make sure you have customized the input component correctly."].join(`
297
288
  `)));
298
- }, [b]), g.useEffect(() => {
299
- Se();
300
- }, [Se]);
289
+ }, [m]), g.useEffect(() => {
290
+ we();
291
+ }, [we]);
301
292
  const q = (t) => {
302
- K || (Pe(!0), Ae(!0), Ee && Ee(t));
303
- }, X = (t, e) => {
304
- K && (Pe(!1), oe && oe(t, e));
305
- }, z = (t, e, n, o) => {
293
+ z || (Pe(!0), De(!0), Ee && Ee(t));
294
+ }, G = (t, e) => {
295
+ z && (Pe(!1), oe && oe(t, e));
296
+ }, K = (t, e, n, o) => {
306
297
  if (l) {
307
298
  if (r.length === e.length && r.every((s, a) => s === e[a]))
308
299
  return;
309
300
  } else if (r === e)
310
301
  return;
311
- E && E(t, e, n, o), Ue(e);
312
- }, fe = g.useRef(!1), G = (t, e, n = "selectOption", o = "options") => {
302
+ T && T(t, e, n, o), je(e);
303
+ }, fe = g.useRef(!1), Q = (t, e, n = "selectOption", o = "options") => {
313
304
  let s = n, a = e;
314
305
  if (l) {
315
306
  if (a = Array.isArray(r) ? r.slice() : [], process.env.NODE_ENV !== "production") {
316
- const I = a.filter((de) => _(e, de));
317
- I.length > 1 && console.error([`MUI: The \`isOptionEqualToValue\` method of ${b} does not handle the arguments correctly.`, `The component expects a single value to match a given option but found ${I.length} matches.`].join(`
307
+ const I = a.filter((de) => E(e, de));
308
+ I.length > 1 && console.error([`MUI: The \`isOptionEqualToValue\` method of ${m} does not handle the arguments correctly.`, `The component expects a single value to match a given option but found ${I.length} matches.`].join(`
318
309
  `));
319
310
  }
320
- const p = ge(a, (I) => _(e, I));
321
- p === -1 ? a.push(e) : o !== "freeSolo" && (a.splice(p, 1), s = "removeOption");
311
+ const d = a.findIndex((I) => E(e, I));
312
+ d === -1 ? a.push(e) : o !== "freeSolo" && (a.splice(d, 1), s = "removeOption");
322
313
  }
323
- ue(t, a), z(t, a, s, {
314
+ ue(t, a, s), K(t, a, s, {
324
315
  option: e
325
- }), !J && (!t || !t.ctrlKey && !t.metaKey) && X(t, s), (V === !0 || V === "touch" && fe.current || V === "mouse" && !fe.current) && d.current.blur();
316
+ }), !W && (!t || !t.ctrlKey && !t.metaKey) && G(t, s), (v === !0 || v === "touch" && fe.current || v === "mouse" && !fe.current) && f.current.blur();
326
317
  };
327
- function Ye(t, e) {
318
+ function Je(t, e) {
328
319
  if (t === -1)
329
320
  return -1;
330
321
  let n = t;
@@ -338,19 +329,19 @@ function yt(c) {
338
329
  return n;
339
330
  }
340
331
  }
341
- const Ce = (t, e) => {
332
+ const $e = (t, e) => {
342
333
  if (!l)
343
334
  return;
344
- u === "" && X(t, "toggleInput");
345
- let n = P;
346
- P === -1 ? u === "" && e === "previous" && (n = r.length - 1) : (n += e === "next" ? 1 : -1, n < 0 && (n = 0), n === r.length && (n = -1)), n = Ye(n, e), Ie(n), ce(n);
347
- }, Ne = (t) => {
348
- ye.current = !0, le(""), H && H(t, "", "clear"), z(t, l ? [] : null, "clear");
349
- }, Xe = (t) => (e) => {
350
- if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (P !== -1 && ["ArrowLeft", "ArrowRight"].indexOf(e.key) === -1 && (Ie(-1), ce(-1)), e.which !== 229))
335
+ u === "" && G(t, "toggleInput");
336
+ let n = D;
337
+ D === -1 ? u === "" && e === "previous" && (n = r.length - 1) : (n += e === "next" ? 1 : -1, n < 0 && (n = 0), n === r.length && (n = -1)), n = Je(n, e), Ie(n), ce(n);
338
+ }, Ce = (t) => {
339
+ xe.current = !0, le(""), R && R(t, "", "clear"), K(t, l ? [] : null, "clear");
340
+ }, Ye = (t) => (e) => {
341
+ if (t.onKeyDown && t.onKeyDown(e), !e.defaultMuiPrevented && (D !== -1 && !["ArrowLeft", "ArrowRight"].includes(e.key) && (Ie(-1), ce(-1)), e.which !== 229))
351
342
  switch (e.key) {
352
343
  case "Home":
353
- S && re && (e.preventDefault(), N({
344
+ S && re && (e.preventDefault(), L({
354
345
  diff: "start",
355
346
  direction: "next",
356
347
  reason: "keyboard",
@@ -358,7 +349,7 @@ function yt(c) {
358
349
  }));
359
350
  break;
360
351
  case "End":
361
- S && re && (e.preventDefault(), N({
352
+ S && re && (e.preventDefault(), L({
362
353
  diff: "end",
363
354
  direction: "previous",
364
355
  reason: "keyboard",
@@ -366,23 +357,23 @@ function yt(c) {
366
357
  }));
367
358
  break;
368
359
  case "PageUp":
369
- e.preventDefault(), N({
370
- diff: -5,
360
+ e.preventDefault(), L({
361
+ diff: -Me,
371
362
  direction: "previous",
372
363
  reason: "keyboard",
373
364
  event: e
374
365
  }), q(e);
375
366
  break;
376
367
  case "PageDown":
377
- e.preventDefault(), N({
378
- diff: bt,
368
+ e.preventDefault(), L({
369
+ diff: Me,
379
370
  direction: "next",
380
371
  reason: "keyboard",
381
372
  event: e
382
373
  }), q(e);
383
374
  break;
384
375
  case "ArrowDown":
385
- e.preventDefault(), N({
376
+ e.preventDefault(), L({
386
377
  diff: 1,
387
378
  direction: "next",
388
379
  reason: "keyboard",
@@ -390,7 +381,7 @@ function yt(c) {
390
381
  }), q(e);
391
382
  break;
392
383
  case "ArrowUp":
393
- e.preventDefault(), N({
384
+ e.preventDefault(), L({
394
385
  diff: -1,
395
386
  direction: "previous",
396
387
  reason: "keyboard",
@@ -398,89 +389,89 @@ function yt(c) {
398
389
  }), q(e);
399
390
  break;
400
391
  case "ArrowLeft":
401
- Ce(e, "previous");
392
+ $e(e, "previous");
402
393
  break;
403
394
  case "ArrowRight":
404
- Ce(e, "next");
395
+ $e(e, "next");
405
396
  break;
406
397
  case "Enter":
407
- if (x.current !== -1 && S) {
408
- const n = f[x.current], o = U ? U(n) : !1;
398
+ if (b.current !== -1 && S) {
399
+ const n = c[b.current], o = B ? B(n) : !1;
409
400
  if (e.preventDefault(), o)
410
401
  return;
411
- G(e, n, "selectOption"), A && d.current.setSelectionRange(d.current.value.length, d.current.value.length);
412
- } else L && u !== "" && De === !1 && (l && e.preventDefault(), G(e, u, "createOption", "freeSolo"));
402
+ Q(e, n, "selectOption"), _ && f.current.setSelectionRange(f.current.value.length, f.current.value.length);
403
+ } else V && u !== "" && _e === !1 && (l && e.preventDefault(), Q(e, u, "createOption", "freeSolo"));
413
404
  break;
414
405
  case "Escape":
415
- S ? (e.preventDefault(), e.stopPropagation(), X(e, "escape")) : M && (u !== "" || l && r.length > 0) && (e.preventDefault(), e.stopPropagation(), Ne(e));
406
+ S ? (e.preventDefault(), e.stopPropagation(), G(e, "escape")) : M && (u !== "" || l && r.length > 0) && (e.preventDefault(), e.stopPropagation(), Ce(e));
416
407
  break;
417
408
  case "Backspace":
418
- if (l && !Y && u === "" && r.length > 0) {
419
- const n = P === -1 ? r.length - 1 : P, o = r.slice();
420
- o.splice(n, 1), z(e, o, "removeOption", {
409
+ if (l && !X && u === "" && r.length > 0) {
410
+ const n = D === -1 ? r.length - 1 : D, o = r.slice();
411
+ o.splice(n, 1), K(e, o, "removeOption", {
421
412
  option: r[n]
422
413
  });
423
414
  }
424
415
  break;
425
416
  case "Delete":
426
- if (l && !Y && u === "" && r.length > 0 && P !== -1) {
427
- const n = P, o = r.slice();
428
- o.splice(n, 1), z(e, o, "removeOption", {
417
+ if (l && !X && u === "" && r.length > 0 && D !== -1) {
418
+ const n = D, o = r.slice();
419
+ o.splice(n, 1), K(e, o, "removeOption", {
429
420
  option: r[n]
430
421
  });
431
422
  }
432
423
  break;
433
424
  }
434
- }, Ge = (t) => {
435
- $e(!0), Fe && !ye.current && q(t);
436
- }, ve = (t) => {
437
- if (h($)) {
438
- d.current.focus();
425
+ }, Xe = (t) => {
426
+ Ae(!0), Re && !xe.current && q(t);
427
+ }, Le = (t) => {
428
+ if (h(P)) {
429
+ f.current.focus();
439
430
  return;
440
431
  }
441
- $e(!1), Oe.current = !0, ye.current = !1, j && x.current !== -1 && S ? G(t, f[x.current], "blur") : j && L && u !== "" ? G(t, u, "blur", "freeSolo") : D && ue(t, r), X(t, "blur");
442
- }, Qe = (t) => {
432
+ Ae(!1), ye.current = !0, xe.current = !1, U && b.current !== -1 && S ? Q(t, c[b.current], "blur") : U && V && u !== "" ? Q(t, u, "blur", "freeSolo") : $ && ue(t, r, "blur"), G(t, "blur");
433
+ }, Ge = (t) => {
443
434
  const e = t.target.value;
444
- u !== e && (le(e), Ae(!1), H && H(t, e, "input")), e === "" ? !B && !l && z(t, null, "clear") : q(t);
445
- }, Ze = (t) => {
435
+ u !== e && (le(e), De(!1), R && R(t, e, "input")), e === "" ? !j && !l && K(t, null, "clear") : q(t);
436
+ }, Qe = (t) => {
446
437
  const e = Number(t.currentTarget.getAttribute("data-option-index"));
447
- x.current !== e && F({
438
+ b.current !== e && F({
448
439
  event: t,
449
440
  index: e,
450
441
  reason: "mouse"
451
442
  });
452
- }, et = (t) => {
443
+ }, Ze = (t) => {
453
444
  F({
454
445
  event: t,
455
446
  index: Number(t.currentTarget.getAttribute("data-option-index")),
456
447
  reason: "touch"
457
448
  }), fe.current = !0;
458
- }, tt = (t) => {
449
+ }, et = (t) => {
459
450
  const e = Number(t.currentTarget.getAttribute("data-option-index"));
460
- G(t, f[e], "selectOption"), fe.current = !1;
461
- }, nt = (t) => (e) => {
451
+ Q(t, c[e], "selectOption"), fe.current = !1;
452
+ }, tt = (t) => (e) => {
462
453
  const n = r.slice();
463
- n.splice(t, 1), z(e, n, "removeOption", {
454
+ n.splice(t, 1), K(e, n, "removeOption", {
464
455
  option: r[t]
465
456
  });
466
- }, Le = (t) => {
467
- K ? X(t, "toggleInput") : q(t);
457
+ }, Ne = (t) => {
458
+ z ? G(t, "toggleInput") : q(t);
459
+ }, nt = (t) => {
460
+ t.currentTarget.contains(t.target) && t.target.getAttribute("id") !== A && t.preventDefault();
468
461
  }, rt = (t) => {
469
- t.currentTarget.contains(t.target) && t.target.getAttribute("id") !== T && t.preventDefault();
462
+ t.currentTarget.contains(t.target) && (f.current.focus(), Fe && ye.current && f.current.selectionEnd - f.current.selectionStart === 0 && f.current.select(), ye.current = !1);
470
463
  }, ot = (t) => {
471
- t.currentTarget.contains(t.target) && (d.current.focus(), qe && Oe.current && d.current.selectionEnd - d.current.selectionStart === 0 && d.current.select(), Oe.current = !1);
472
- }, st = (t) => {
473
- !w && (u === "" || !K) && Le(t);
464
+ !w && (u === "" || !z) && Ne(t);
474
465
  };
475
- let ke = L && u.length > 0;
476
- ke = ke || (l ? r.length > 0 : r !== null);
477
- let Ve = f;
478
- if (R) {
466
+ let Se = V && u.length > 0;
467
+ Se = Se || (l ? r.length > 0 : r !== null);
468
+ let Ve = c;
469
+ if (H) {
479
470
  const t = /* @__PURE__ */ new Map();
480
471
  let e = !1;
481
- Ve = f.reduce((n, o, s) => {
482
- const a = R(o);
483
- return n.length > 0 && n[n.length - 1].group === a ? n[n.length - 1].options.push(o) : (process.env.NODE_ENV !== "production" && (t.get(a) && !e && (console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${b} returns duplicated headers.`, "You can solve the issue by sorting the options with the output of `groupBy`."), e = !0), t.set(a, !0)), n.push({
472
+ Ve = c.reduce((n, o, s) => {
473
+ const a = H(o);
474
+ return n.length > 0 && n[n.length - 1].group === a ? n[n.length - 1].options.push(o) : (process.env.NODE_ENV !== "production" && (t.get(a) && !e && (console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${m} returns duplicated headers.`, "You can solve the issue by sorting the options with the output of `groupBy`."), e = !0), t.set(a, !0)), n.push({
484
475
  key: s,
485
476
  index: s,
486
477
  group: a,
@@ -488,35 +479,35 @@ function yt(c) {
488
479
  })), n;
489
480
  }, []);
490
481
  }
491
- return w && ae && ve(), {
492
- getRootProps: (t = {}) => Me({
493
- "aria-owns": we ? `${T}-listbox` : null
494
- }, t, {
495
- onKeyDown: Xe(t),
496
- onMouseDown: rt,
497
- onClick: ot
482
+ return w && ae && Le(), {
483
+ getRootProps: (t = {}) => ({
484
+ "aria-owns": Oe ? `${A}-listbox` : null,
485
+ ...t,
486
+ onKeyDown: Ye(t),
487
+ onMouseDown: nt,
488
+ onClick: rt
498
489
  }),
499
490
  getInputLabelProps: () => ({
500
- id: `${T}-label`,
501
- htmlFor: T
491
+ id: `${A}-label`,
492
+ htmlFor: A
502
493
  }),
503
494
  getInputProps: () => ({
504
- id: T,
495
+ id: A,
505
496
  value: u,
506
- onBlur: ve,
507
- onFocus: Ge,
508
- onChange: Qe,
509
- onMouseDown: st,
497
+ onBlur: Le,
498
+ onFocus: Xe,
499
+ onChange: Ge,
500
+ onMouseDown: ot,
510
501
  // if open then this is handled imperatively so don't let react override
511
502
  // only have an opinion about this when closed
512
503
  "aria-activedescendant": S ? "" : null,
513
- "aria-autocomplete": A ? "both" : "list",
514
- "aria-controls": we ? `${T}-listbox` : void 0,
515
- "aria-expanded": we,
504
+ "aria-autocomplete": _ ? "both" : "list",
505
+ "aria-controls": Oe ? `${A}-listbox` : void 0,
506
+ "aria-expanded": Oe,
516
507
  // Disable browser's suggestion that might overlap with the popup.
517
508
  // Handle autocomplete but not autofill.
518
509
  autoComplete: "off",
519
- ref: d,
510
+ ref: f,
520
511
  autoCapitalize: "none",
521
512
  spellCheck: "false",
522
513
  role: "combobox",
@@ -525,26 +516,27 @@ function yt(c) {
525
516
  getClearProps: () => ({
526
517
  tabIndex: -1,
527
518
  type: "button",
528
- onClick: Ne
519
+ onClick: Ce
529
520
  }),
530
521
  getPopupIndicatorProps: () => ({
531
522
  tabIndex: -1,
532
523
  type: "button",
533
- onClick: Le
524
+ onClick: Ne
534
525
  }),
535
526
  getTagProps: ({
536
527
  index: t
537
- }) => Me({
528
+ }) => ({
538
529
  key: t,
539
530
  "data-tag-index": t,
540
- tabIndex: -1
541
- }, !Y && {
542
- onDelete: nt(t)
531
+ tabIndex: -1,
532
+ ...!X && {
533
+ onDelete: tt(t)
534
+ }
543
535
  }),
544
536
  getListboxProps: () => ({
545
537
  role: "listbox",
546
- id: `${T}-listbox`,
547
- "aria-labelledby": `${T}-label`,
538
+ id: `${A}-listbox`,
539
+ "aria-labelledby": `${A}-label`,
548
540
  ref: We,
549
541
  onMouseDown: (t) => {
550
542
  t.preventDefault();
@@ -554,120 +546,119 @@ function yt(c) {
554
546
  index: t,
555
547
  option: e
556
548
  }) => {
557
- var n;
558
- const o = (l ? r : [r]).some((a) => a != null && _(e, a)), s = U ? U(e) : !1;
549
+ const n = (l ? r : [r]).some((s) => s != null && E(e, s)), o = B ? B(e) : !1;
559
550
  return {
560
- key: (n = te == null ? void 0 : te(e)) != null ? n : O(e),
551
+ key: (Y == null ? void 0 : Y(e)) ?? y(e),
561
552
  tabIndex: -1,
562
553
  role: "option",
563
- id: `${T}-option-${t}`,
564
- onMouseMove: Ze,
565
- onClick: tt,
566
- onTouchStart: et,
554
+ id: `${A}-option-${t}`,
555
+ onMouseMove: Qe,
556
+ onClick: et,
557
+ onTouchStart: Ze,
567
558
  "data-option-index": t,
568
- "aria-disabled": s,
569
- "aria-selected": o
559
+ "aria-disabled": o,
560
+ "aria-selected": n
570
561
  };
571
562
  },
572
- id: T,
563
+ id: A,
573
564
  inputValue: u,
574
565
  value: r,
575
- dirty: ke,
566
+ dirty: Se,
576
567
  expanded: S && ie,
577
568
  popupOpen: S,
578
- focused: ae || P !== -1,
569
+ focused: ae || D !== -1,
579
570
  anchorEl: ie,
580
- setAnchorEl: Be,
581
- focusedTag: P,
571
+ setAnchorEl: Ue,
572
+ focusedTag: D,
582
573
  groupedOptions: Ve
583
574
  };
584
575
  }
585
- const Ot = "_autocomplete_mj65r_65", Z = {
576
+ const yt = "_autocomplete_mj65r_65", ee = {
586
577
  "autocomplete__dropdown-item": "_autocomplete__dropdown-item_mj65r_65",
587
- autocomplete: Ot,
578
+ autocomplete: yt,
588
579
  "autocomplete__dropdown-list": "_autocomplete__dropdown-list_mj65r_82",
589
580
  "option-focused": "_option-focused_mj65r_106"
590
- }, At = ({
591
- labelKey: c,
581
+ }, Dt = ({
582
+ labelKey: p,
592
583
  valueKey: h,
593
- renderOption: m,
594
- customSelectedOptionLabel: A,
595
- options: v,
596
- type: j,
597
- value: V,
598
- onChange: D,
584
+ renderOption: O,
585
+ customSelectedOptionLabel: _,
586
+ options: N,
587
+ type: U,
588
+ value: v,
589
+ onChange: $,
599
590
  onInputChange: M,
600
- classNameWrapper: b,
591
+ classNameWrapper: m,
601
592
  "data-testid-wrapper": k,
602
- classNameInputWrapper: B,
603
- open: J = void 0,
593
+ classNameInputWrapper: j,
594
+ open: W = void 0,
604
595
  onOpen: w = void 0,
605
- onClose: he = void 0,
606
- ...W
596
+ onClose: ge = void 0,
597
+ ...J
607
598
  }) => {
608
- const me = lt(), [ee, L] = at("");
609
- v != null && v.some((i) => typeof i != "string") && (!c && !m || !h) && console.error(
599
+ const he = it(), [te, V] = lt("");
600
+ N != null && N.some((i) => typeof i != "string") && (!p && !O || !h) && console.error(
610
601
  '[autocomplete] When options is a list of objects, you must provide the "labelKey" or "renderOption" and "valueKey" parameters.'
611
602
  );
612
- const { getRootProps: U, getInputProps: te, getOptionProps: ne, groupedOptions: R, getListboxProps: re } = yt({
613
- id: `autocomplete_${me}`,
614
- options: v,
615
- open: J,
603
+ const { getRootProps: B, getInputProps: Y, getOptionProps: ne, groupedOptions: H, getListboxProps: re } = xt({
604
+ id: `autocomplete_${he.replace(/:/g, "-")}`,
605
+ options: N,
606
+ open: W,
616
607
  onOpen: w,
617
- onClose: he,
618
- getOptionLabel: (i) => typeof i == "string" ? i : A ? A(i) : String(i[c || "label"]),
619
- value: V,
620
- inputValue: ee,
621
- isOptionEqualToValue: (i, y) => typeof i == "string" ? String(i) === String(y) : String(i[h || "id"]) === String(y[h || "id"]),
608
+ onClose: ge,
609
+ getOptionLabel: (i) => typeof i == "string" ? i : _ ? _(i) : String(i[p || "label"]),
610
+ value: v,
611
+ inputValue: te,
612
+ isOptionEqualToValue: (i, x) => typeof i == "string" ? String(i) === String(x) : String(i[h || "id"]) === String(x[h || "id"]),
622
613
  getOptionKey(i) {
623
614
  return String(typeof i == "string" ? i : i[h || "id"]);
624
615
  },
625
- onChange: (i, y) => {
626
- D && D(i, y);
616
+ onChange: (i, x) => {
617
+ $ && $(i, x);
627
618
  },
628
- onInputChange: (i, y) => {
629
- M && M(i, y), L(y);
619
+ onInputChange: (i, x) => {
620
+ M && M(i, x), V(x);
630
621
  },
631
- onHighlightChange: (i, y, _) => {
622
+ onHighlightChange: (i, x, E) => {
632
623
  var l;
633
- if (_ === "keyboard") {
634
- const E = document.querySelector("#autocomplete-list"), oe = (i == null ? void 0 : i.target).getAttribute("aria-activedescendant");
635
- E == null || E.querySelectorAll("li").forEach((se) => se.classList.remove(Z["option-focused"])), (l = E == null ? void 0 : E.querySelector(`[id="${oe}"]`)) == null || l.classList.add(Z["option-focused"]);
624
+ if (E === "keyboard") {
625
+ const T = document.querySelector("#autocomplete-list"), oe = (i == null ? void 0 : i.target).getAttribute("aria-activedescendant");
626
+ T == null || T.querySelectorAll("li").forEach((se) => se.classList.remove(ee["option-focused"])), (l = T == null ? void 0 : T.querySelector(`[id="${oe}"]`)) == null || l.classList.add(ee["option-focused"]);
636
627
  }
637
628
  }
638
- }), be = {
639
- ...te(),
640
- ...W,
641
- classNameWrapper: B
629
+ }), me = {
630
+ ...Y(),
631
+ ...J,
632
+ classNameWrapper: j
642
633
  };
643
- return /* @__PURE__ */ Q("div", { className: ut(Z.autocomplete, b), "data-testid": k, children: /* @__PURE__ */ it("div", { ...U(), children: [
644
- /* @__PURE__ */ Q(
645
- ft,
634
+ return /* @__PURE__ */ Z("div", { className: at(ee.autocomplete, m), "data-testid": k, children: /* @__PURE__ */ st("div", { ...B(), children: [
635
+ /* @__PURE__ */ Z(
636
+ ct,
646
637
  {
647
- rightIcon: j === "search" && /* @__PURE__ */ Q(ct, { color: "var(--accent)", icon: "magnifying-glass" }),
648
- ...be
638
+ rightIcon: U === "search" && /* @__PURE__ */ Z(ut, { color: "var(--accent)", icon: "magnifying-glass" }),
639
+ ...me
649
640
  }
650
641
  ),
651
- R.length > 0 && !W.disabled && /* @__PURE__ */ Q(
642
+ H.length > 0 && !J.disabled && /* @__PURE__ */ Z(
652
643
  "ul",
653
644
  {
654
645
  ...re(),
655
646
  id: "autocomplete-list",
656
- className: Z["autocomplete__dropdown-list"],
657
- children: R.map((i, y) => {
658
- const { key: _, ...l } = ne({
647
+ className: ee["autocomplete__dropdown-list"],
648
+ children: H.map((i, x) => {
649
+ const { key: E, ...l } = ne({
659
650
  option: i,
660
- index: y
661
- }), E = typeof i == "string" ? i : m ? m(i) : String(i[c || "label"]);
662
- return /* @__PURE__ */ Q(
651
+ index: x
652
+ }), T = typeof i == "string" ? i : O ? O(i) : String(i[p || "label"]);
653
+ return /* @__PURE__ */ Z(
663
654
  "li",
664
655
  {
665
- tabIndex: y,
666
- className: Z["autocomplete__dropdown-item"],
656
+ tabIndex: x,
657
+ className: ee["autocomplete__dropdown-item"],
667
658
  ...l,
668
- children: E
659
+ children: T
669
660
  },
670
- _
661
+ E
671
662
  );
672
663
  })
673
664
  }
@@ -675,5 +666,5 @@ const Ot = "_autocomplete_mj65r_65", Z = {
675
666
  ] }) });
676
667
  };
677
668
  export {
678
- At as Autocomplete
669
+ Dt as Autocomplete
679
670
  };