@pismo/marola 1.1.12 → 1.1.14

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