@pismo/marola 1.0.15 → 1.0.17

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,19 +1,20 @@
1
- import { jsx as h, jsxs as re } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { useId as ze } from "react";
4
- import { c as U } from "../../clsx-DB4S2d7J.js";
5
- import { Icon as We } from "../Icon/Icon.js";
1
+ import { jsx as m, jsxs as re } from "react/jsx-runtime";
2
+ import * as r from "react";
3
+ import { createContext as We, useContext as Je, useId as Ge } from "react";
4
+ import { c as K } from "../../clsx-DB4S2d7J.js";
5
+ import { Checkbox as Qe } from "../Checkbox/Checkbox.js";
6
+ import { Icon as Xe } from "../Icon/Icon.js";
6
7
  import { Typography as _e } from "../Typography/Typography.js";
7
- import { s as y, S as Je } from "../../SelectButton-B38avP9u.js";
8
- import { g as we, a as Ie, u as Y, f as le, b as m, P as l, _ as Ne, c as se, d as Me, e as ke } from "../../useSlotProps-C_I1kEHr.js";
9
- import { u as Ge, c as ae, a as Se, L as X } from "../../combineHooksSlotProps-C-zYvfnF.js";
8
+ import { s as y, S as Ye } from "../../SelectButton-B38avP9u.js";
9
+ import { g as we, a as Ie, u as Z, f as le, b as g, P as l, _ as Ne, c as se, d as ke, e as Me } from "../../useSlotProps-C_I1kEHr.js";
10
+ import { u as Ze, c as ae, a as Se, L as Y } from "../../combineHooksSlotProps-C-zYvfnF.js";
10
11
  import { u as Te } from "../../useButton-DcihopJG.js";
11
12
  import { u as Le } from "../../useId-BW-oWmul.js";
12
- import { u as Qe, a as Xe, C as Ye } from "../../useCompoundItem-B7Eo_qZk.js";
13
- import { P as Ze } from "../../Popup-Ck3XlWMq.js";
14
- import { m as Re, h as et, l as tt, u as ot } from "../../useList-B9C55YB7.js";
15
- import { u as nt } from "../../useEnhancedEffect-CJGo-L3B.js";
16
- const lt = {
13
+ import { u as et, a as tt, C as ot } from "../../useCompoundItem-B7Eo_qZk.js";
14
+ import { P as nt } from "../../Popup-Ck3XlWMq.js";
15
+ import { m as Re, h as lt, l as st, u as rt } from "../../useList-B9C55YB7.js";
16
+ import { u as at } from "../../useEnhancedEffect-CJGo-L3B.js";
17
+ const it = {
17
18
  border: 0,
18
19
  clip: "rect(0 0 0 0)",
19
20
  height: "1px",
@@ -24,141 +25,141 @@ const lt = {
24
25
  whiteSpace: "nowrap",
25
26
  width: "1px"
26
27
  }, Ae = "Option";
27
- function st(n) {
28
+ function ut(n) {
28
29
  return we(Ae, n);
29
30
  }
30
31
  Ie(Ae, ["root", "disabled", "selected", "highlighted"]);
31
- function rt(n) {
32
+ function ct(n) {
32
33
  const {
33
34
  value: o,
34
35
  label: i,
35
36
  disabled: c,
36
- rootRef: r,
37
+ rootRef: s,
37
38
  id: u
38
39
  } = n, {
39
- getRootProps: f,
40
- highlighted: b,
41
- selected: d
42
- } = Ge({
40
+ getRootProps: d,
41
+ highlighted: p,
42
+ selected: f
43
+ } = Ze({
43
44
  item: o
44
45
  }), {
45
- getRootProps: R,
46
- rootRef: V
46
+ getRootProps: S,
47
+ rootRef: I
47
48
  } = Te({
48
49
  disabled: c,
49
50
  focusableWhenDisabled: !0
50
- }), x = Le(u), _ = s.useRef(null), g = s.useMemo(() => ({
51
+ }), C = Le(u), R = r.useRef(null), _ = r.useMemo(() => ({
51
52
  disabled: c,
52
53
  label: i,
53
54
  value: o,
54
- ref: _,
55
- id: x
56
- }), [c, i, o, x]), {
57
- index: I
58
- } = Qe(o, g), O = Y(r, _, V), N = (p) => (C) => {
59
- var P;
60
- (P = p.onKeyDown) == null || P.call(p, C), !C.defaultMuiPrevented && [" ", "Enter"].includes(C.key) && (C.defaultMuiPrevented = !0);
61
- }, L = (p = {}) => ({
62
- onKeyDown: N(p)
55
+ ref: R,
56
+ id: C
57
+ }), [c, i, o, C]), {
58
+ index: N
59
+ } = et(o, _), h = Z(s, R, I), k = (b) => (P) => {
60
+ var x;
61
+ (x = b.onKeyDown) == null || x.call(b, P), !P.defaultMuiPrevented && [" ", "Enter"].includes(P.key) && (P.defaultMuiPrevented = !0);
62
+ }, A = (b = {}) => ({
63
+ onKeyDown: k(b)
63
64
  });
64
65
  return {
65
- getRootProps: (p = {}) => {
66
- const C = le(p), P = ae(f, ae(R, L));
67
- return m({}, p, C, P(C), {
68
- id: x,
69
- ref: O,
66
+ getRootProps: (b = {}) => {
67
+ const P = le(b), x = ae(d, ae(S, A));
68
+ return g({}, b, P, x(P), {
69
+ id: C,
70
+ ref: h,
70
71
  role: "option",
71
- "aria-selected": d
72
+ "aria-selected": f
72
73
  });
73
74
  },
74
- highlighted: b,
75
- index: I,
76
- selected: d,
77
- rootRef: O
75
+ highlighted: p,
76
+ index: N,
77
+ selected: f,
78
+ rootRef: h
78
79
  };
79
80
  }
80
- function at(n) {
81
- const o = s.useContext(Se);
81
+ function dt(n) {
82
+ const o = r.useContext(Se);
82
83
  if (!o)
83
84
  throw new Error("Option: ListContext was not found.");
84
85
  const {
85
86
  getItemState: i,
86
87
  dispatch: c
87
88
  } = o, {
88
- highlighted: r,
89
+ highlighted: s,
89
90
  selected: u,
90
- focusable: f
91
- } = i(n), b = s.useCallback((R) => {
92
- if (R !== n)
91
+ focusable: d
92
+ } = i(n), p = r.useCallback((S) => {
93
+ if (S !== n)
93
94
  throw new Error(["Base UI Option: Tried to access the state of another Option.", "This is unsupported when the Option uses the OptionContextStabilizer as a performance optimization."].join("/n"));
94
95
  return {
95
- highlighted: r,
96
+ highlighted: s,
96
97
  selected: u,
97
- focusable: f
98
+ focusable: d
98
99
  };
99
- }, [r, u, f, n]);
100
+ }, [s, u, d, n]);
100
101
  return {
101
- contextValue: s.useMemo(() => ({
102
+ contextValue: r.useMemo(() => ({
102
103
  dispatch: c,
103
- getItemState: b
104
- }), [c, b])
104
+ getItemState: p
105
+ }), [c, p])
105
106
  };
106
107
  }
107
- const it = ["children", "disabled", "label", "slotProps", "slots", "value"];
108
- function ut(n) {
108
+ const pt = ["children", "disabled", "label", "slotProps", "slots", "value"];
109
+ function ft(n) {
109
110
  const {
110
111
  disabled: o,
111
112
  highlighted: i,
112
113
  selected: c
113
114
  } = n;
114
- return Me({
115
+ return ke({
115
116
  root: ["root", o && "disabled", i && "highlighted", c && "selected"]
116
- }, ke(st));
117
+ }, Me(ut));
117
118
  }
118
- const ct = /* @__PURE__ */ s.memo(/* @__PURE__ */ s.forwardRef(function(o, i) {
119
- var c, r;
119
+ const bt = /* @__PURE__ */ r.memo(/* @__PURE__ */ r.forwardRef(function(o, i) {
120
+ var c, s;
120
121
  const {
121
122
  children: u,
122
- disabled: f = !1,
123
- label: b,
124
- slotProps: d = {},
125
- slots: R = {},
126
- value: V
127
- } = o, x = Ne(o, it), _ = (c = R.root) != null ? c : "li", g = s.useRef(null), I = Y(g, i), O = b ?? (typeof u == "string" ? u : (r = g.current) == null || (r = r.textContent) == null ? void 0 : r.trim()), {
128
- getRootProps: N,
129
- selected: L,
130
- highlighted: p,
131
- index: C
132
- } = rt({
133
- disabled: f,
134
- label: O,
135
- rootRef: I,
136
- value: V
137
- }), P = m({}, o, {
138
- disabled: f,
139
- highlighted: p,
140
- index: C,
141
- selected: L
142
- }), M = ut(P), S = se({
143
- getSlotProps: N,
144
- elementType: _,
145
- externalSlotProps: d.root,
146
- externalForwardedProps: x,
147
- className: M.root,
148
- ownerState: P
123
+ disabled: d = !1,
124
+ label: p,
125
+ slotProps: f = {},
126
+ slots: S = {},
127
+ value: I
128
+ } = o, C = Ne(o, pt), R = (c = S.root) != null ? c : "li", _ = r.useRef(null), N = Z(_, i), h = p ?? (typeof u == "string" ? u : (s = _.current) == null || (s = s.textContent) == null ? void 0 : s.trim()), {
129
+ getRootProps: k,
130
+ selected: A,
131
+ highlighted: b,
132
+ index: P
133
+ } = ct({
134
+ disabled: d,
135
+ label: h,
136
+ rootRef: N,
137
+ value: I
138
+ }), x = g({}, o, {
139
+ disabled: d,
140
+ highlighted: b,
141
+ index: P,
142
+ selected: A
143
+ }), $ = ft(x), O = se({
144
+ getSlotProps: k,
145
+ elementType: R,
146
+ externalSlotProps: f.root,
147
+ externalForwardedProps: C,
148
+ className: $.root,
149
+ ownerState: x
149
150
  });
150
- return /* @__PURE__ */ h(_, m({}, S, {
151
+ return /* @__PURE__ */ m(R, g({}, O, {
151
152
  children: u
152
153
  }));
153
- })), Ee = /* @__PURE__ */ s.forwardRef(function(o, i) {
154
+ })), Ee = /* @__PURE__ */ r.forwardRef(function(o, i) {
154
155
  const {
155
156
  value: c
156
157
  } = o, {
157
- contextValue: r
158
- } = at(c);
159
- return /* @__PURE__ */ h(Se.Provider, {
160
- value: r,
161
- children: /* @__PURE__ */ h(ct, m({}, o, {
158
+ contextValue: s
159
+ } = dt(c);
160
+ return /* @__PURE__ */ m(Se.Provider, {
161
+ value: s,
162
+ children: /* @__PURE__ */ m(bt, g({}, o, {
162
163
  ref: i
163
164
  }))
164
165
  });
@@ -216,7 +217,7 @@ const ie = {
216
217
  } = n;
217
218
  return typeof o == "string" ? o : typeof i == "string" ? i : String(n);
218
219
  };
219
- function dt(n, o) {
220
+ function mt(n, o) {
220
221
  const {
221
222
  open: i
222
223
  } = n, {
@@ -225,48 +226,48 @@ function dt(n, o) {
225
226
  }
226
227
  } = o;
227
228
  if (o.type === ie.buttonClick) {
228
- var r;
229
- const d = (r = n.selectedValues[0]) != null ? r : Re(null, "start", o.context);
230
- return m({}, n, {
229
+ var s;
230
+ const f = (s = n.selectedValues[0]) != null ? s : Re(null, "start", o.context);
231
+ return g({}, n, {
231
232
  open: !i,
232
- highlightedValue: i ? null : d
233
+ highlightedValue: i ? null : f
233
234
  });
234
235
  }
235
236
  if (o.type === ie.browserAutoFill)
236
- return et(o.item, n, o.context);
237
- const u = tt(n, o);
237
+ return lt(o.item, n, o.context);
238
+ const u = st(n, o);
238
239
  switch (o.type) {
239
- case X.keyDown:
240
+ case Y.keyDown:
240
241
  if (n.open) {
241
242
  if (o.event.key === "Escape")
242
- return m({}, u, {
243
+ return g({}, u, {
243
244
  open: !1
244
245
  });
245
246
  } else {
246
247
  if (o.event.key === "ArrowDown") {
247
- var f;
248
- return m({}, n, {
248
+ var d;
249
+ return g({}, n, {
249
250
  open: !0,
250
- highlightedValue: (f = n.selectedValues[0]) != null ? f : Re(null, "start", o.context)
251
+ highlightedValue: (d = n.selectedValues[0]) != null ? d : Re(null, "start", o.context)
251
252
  });
252
253
  }
253
254
  if (o.event.key === "ArrowUp") {
254
- var b;
255
- return m({}, n, {
255
+ var p;
256
+ return g({}, n, {
256
257
  open: !0,
257
- highlightedValue: (b = n.selectedValues[0]) != null ? b : Re(null, "end", o.context)
258
+ highlightedValue: (p = n.selectedValues[0]) != null ? p : Re(null, "end", o.context)
258
259
  });
259
260
  }
260
261
  }
261
262
  break;
262
- case X.itemClick:
263
+ case Y.itemClick:
263
264
  if (c === "single")
264
- return m({}, u, {
265
+ return g({}, u, {
265
266
  open: !1
266
267
  });
267
268
  break;
268
- case X.blur:
269
- return m({}, u, {
269
+ case Y.blur:
270
+ return g({}, u, {
270
271
  open: !1
271
272
  });
272
273
  default:
@@ -274,87 +275,87 @@ function dt(n, o) {
274
275
  }
275
276
  return u;
276
277
  }
277
- function pt(n) {
278
+ function gt(n) {
278
279
  return Array.isArray(n) ? n.length === 0 ? "" : JSON.stringify(n.map((o) => o.value)) : (n == null ? void 0 : n.value) == null ? "" : typeof n.value == "string" || typeof n.value == "number" ? n.value : JSON.stringify(n.value);
279
280
  }
280
- function ft(n) {
281
+ function ht(n) {
281
282
  const {
282
283
  areOptionsEqual: o,
283
284
  buttonRef: i,
284
285
  defaultOpen: c = !1,
285
- defaultValue: r,
286
+ defaultValue: s,
286
287
  disabled: u = !1,
287
- listboxId: f,
288
- listboxRef: b,
289
- multiple: d = !1,
290
- name: R,
291
- required: V,
292
- onChange: x,
293
- onHighlightChange: _,
294
- onOpenChange: g,
295
- open: I,
296
- options: O,
297
- getOptionAsString: N = Be,
298
- getSerializedValue: L = pt,
299
- value: p,
300
- componentName: C = "useSelect"
301
- } = n, P = s.useRef(null), M = Y(i, P), S = s.useRef(null), E = Le(f);
302
- let $;
303
- p === void 0 && r === void 0 ? $ = [] : r !== void 0 && (d ? $ = r : $ = r == null ? [] : [r]);
304
- const Z = s.useMemo(() => {
305
- if (p !== void 0)
306
- return d ? p : p == null ? [] : [p];
307
- }, [p, d]), {
288
+ listboxId: d,
289
+ listboxRef: p,
290
+ multiple: f = !1,
291
+ name: S,
292
+ required: I,
293
+ onChange: C,
294
+ onHighlightChange: R,
295
+ onOpenChange: _,
296
+ open: N,
297
+ options: h,
298
+ getOptionAsString: k = Be,
299
+ getSerializedValue: A = gt,
300
+ value: b,
301
+ componentName: P = "useSelect"
302
+ } = n, x = r.useRef(null), $ = Z(i, x), O = r.useRef(null), V = Le(d);
303
+ let M;
304
+ b === void 0 && s === void 0 ? M = [] : s !== void 0 && (f ? M = s : M = s == null ? [] : [s]);
305
+ const q = r.useMemo(() => {
306
+ if (b !== void 0)
307
+ return f ? b : b == null ? [] : [b];
308
+ }, [b, f]), {
308
309
  subitems: B,
309
- contextValue: q
310
- } = Xe(), k = s.useMemo(() => O != null ? new Map(O.map((e, t) => [e.value, {
310
+ contextValue: j
311
+ } = tt(), T = r.useMemo(() => h != null ? new Map(h.map((e, t) => [e.value, {
311
312
  value: e.value,
312
313
  label: e.label,
313
314
  disabled: e.disabled,
314
- ref: /* @__PURE__ */ s.createRef(),
315
- id: `${E}_${t}`
316
- }])) : B, [O, B, E]), ue = Y(b, S), {
315
+ ref: /* @__PURE__ */ r.createRef(),
316
+ id: `${V}_${t}`
317
+ }])) : B, [h, B, V]), ue = Z(p, O), {
317
318
  getRootProps: ee,
318
319
  active: ce,
319
320
  focusVisible: de,
320
- rootRef: K
321
+ rootRef: z
321
322
  } = Te({
322
323
  disabled: u,
323
- rootRef: M
324
- }), j = s.useMemo(() => Array.from(k.keys()), [k]), w = s.useCallback((e) => {
324
+ rootRef: $
325
+ }), U = r.useMemo(() => Array.from(T.keys()), [T]), w = r.useCallback((e) => {
325
326
  if (o !== void 0) {
326
- const t = j.find((a) => o(a, e));
327
- return k.get(t);
327
+ const t = U.find((a) => o(a, e));
328
+ return T.get(t);
328
329
  }
329
- return k.get(e);
330
- }, [k, o, j]), te = s.useCallback((e) => {
330
+ return T.get(e);
331
+ }, [T, o, U]), te = r.useCallback((e) => {
331
332
  var t;
332
333
  const a = w(e);
333
334
  return (t = a == null ? void 0 : a.disabled) != null ? t : !1;
334
- }, [w]), oe = s.useCallback((e) => {
335
+ }, [w]), oe = r.useCallback((e) => {
335
336
  const t = w(e);
336
- return t ? N(t) : "";
337
- }, [w, N]), pe = s.useMemo(() => ({
338
- selectedValues: Z,
339
- open: I
340
- }), [Z, I]), fe = s.useCallback((e) => {
337
+ return t ? k(t) : "";
338
+ }, [w, k]), pe = r.useMemo(() => ({
339
+ selectedValues: q,
340
+ open: N
341
+ }), [q, N]), fe = r.useCallback((e) => {
341
342
  var t;
342
- return (t = k.get(e)) == null ? void 0 : t.id;
343
- }, [k]), be = s.useCallback((e, t) => {
344
- if (d)
345
- x == null || x(e, t);
343
+ return (t = T.get(e)) == null ? void 0 : t.id;
344
+ }, [T]), be = r.useCallback((e, t) => {
345
+ if (f)
346
+ C == null || C(e, t);
346
347
  else {
347
348
  var a;
348
- x == null || x(e, (a = t[0]) != null ? a : null);
349
+ C == null || C(e, (a = t[0]) != null ? a : null);
349
350
  }
350
- }, [d, x]), me = s.useCallback((e, t) => {
351
- _ == null || _(e, t ?? null);
352
- }, [_]), ge = s.useCallback((e, t, a) => {
353
- if (t === "open" && (g == null || g(a), a === !1 && (e == null ? void 0 : e.type) !== "blur")) {
351
+ }, [f, C]), me = r.useCallback((e, t) => {
352
+ R == null || R(e, t ?? null);
353
+ }, [R]), ge = r.useCallback((e, t, a) => {
354
+ if (t === "open" && (_ == null || _(a), a === !1 && (e == null ? void 0 : e.type) !== "blur")) {
354
355
  var v;
355
- (v = P.current) == null || v.focus();
356
+ (v = x.current) == null || v.focus();
356
357
  }
357
- }, [g]), he = s.useCallback((e) => {
358
+ }, [_]), he = r.useCallback((e) => {
358
359
  var t, a;
359
360
  return e == null ? null : (t = (a = B.get(e)) == null ? void 0 : a.ref.current) != null ? t : null;
360
361
  }, [B]), xe = {
@@ -362,7 +363,7 @@ function ft(n) {
362
363
  var e;
363
364
  return {
364
365
  highlightedValue: null,
365
- selectedValues: (e = $) != null ? e : [],
366
+ selectedValues: (e = M) != null ? e : [],
366
367
  open: c
367
368
  };
368
369
  },
@@ -376,39 +377,39 @@ function ft(n) {
376
377
  onChange: be,
377
378
  onHighlightChange: me,
378
379
  onStateChange: ge,
379
- reducerActionContext: s.useMemo(() => ({
380
- multiple: d
381
- }), [d]),
382
- items: j,
380
+ reducerActionContext: r.useMemo(() => ({
381
+ multiple: f
382
+ }), [f]),
383
+ items: U,
383
384
  getItemAsString: oe,
384
- selectionMode: d ? "multiple" : "single",
385
- stateReducer: dt,
386
- componentName: C
385
+ selectionMode: f ? "multiple" : "single",
386
+ stateReducer: mt,
387
+ componentName: P
387
388
  }, {
388
389
  dispatch: H,
389
390
  getRootProps: Ce,
390
- contextValue: z,
391
+ contextValue: W,
391
392
  state: {
392
- open: T,
393
+ open: L,
393
394
  highlightedValue: D,
394
- selectedValues: A
395
+ selectedValues: E
395
396
  },
396
- rootRef: W
397
- } = ot(xe), Pe = s.useRef(T);
398
- nt(() => {
399
- if (T && D !== null) {
397
+ rootRef: J
398
+ } = rt(xe), Pe = r.useRef(L);
399
+ at(() => {
400
+ if (L && D !== null) {
400
401
  var e;
401
402
  const t = (e = w(D)) == null ? void 0 : e.ref;
402
- if (!S.current || !(t != null && t.current))
403
+ if (!O.current || !(t != null && t.current))
403
404
  return;
404
405
  Pe.current || t.current.focus({
405
406
  preventScroll: !0
406
407
  });
407
- const a = S.current.getBoundingClientRect(), v = t.current.getBoundingClientRect();
408
- v.top < a.top ? S.current.scrollTop -= a.top - v.top : v.bottom > a.bottom && (S.current.scrollTop += v.bottom - a.bottom);
408
+ const a = O.current.getBoundingClientRect(), v = t.current.getBoundingClientRect();
409
+ v.top < a.top ? O.current.scrollTop -= a.top - v.top : v.bottom > a.bottom && (O.current.scrollTop += v.bottom - a.bottom);
409
410
  }
410
- }, [T, D, w]);
411
- const J = s.useCallback((e) => w(e), [w]), ve = (e) => (t) => {
411
+ }, [L, D, w]);
412
+ const G = r.useCallback((e) => w(e), [w]), ve = (e) => (t) => {
412
413
  var a;
413
414
  if (e == null || (a = e.onClick) == null || a.call(e, t), !t.defaultMuiPrevented) {
414
415
  const v = {
@@ -417,58 +418,58 @@ function ft(n) {
417
418
  };
418
419
  H(v);
419
420
  }
420
- }, G = (e) => (t) => {
421
+ }, Q = (e) => (t) => {
421
422
  var a;
422
423
  (a = e.onKeyDown) == null || a.call(e, t), !t.defaultMuiPrevented && (t.key === "ArrowDown" || t.key === "ArrowUp") && (t.preventDefault(), H({
423
- type: X.keyDown,
424
+ type: Y.keyDown,
424
425
  key: t.key,
425
426
  event: t
426
427
  }));
427
428
  }, ne = (e = {}) => ({
428
429
  onClick: ve(e),
429
- onKeyDown: G(e)
430
- }), F = (e = {}) => m({}, e, ne(e), {
430
+ onKeyDown: Q(e)
431
+ }), F = (e = {}) => g({}, e, ne(e), {
431
432
  role: "combobox",
432
- "aria-expanded": T,
433
- "aria-controls": E
434
- }), He = (e = {}) => {
433
+ "aria-expanded": L,
434
+ "aria-controls": V
435
+ }), Fe = (e = {}) => {
435
436
  const t = le(e), a = ae(F, ee);
436
- return m({}, e, a(t));
437
- }, Fe = (e) => (t) => {
437
+ return g({}, e, a(t));
438
+ }, qe = (e) => (t) => {
438
439
  var a, v;
439
- (a = e.onBlur) == null || a.call(e, t), !t.defaultMuiPrevented && ((v = S.current) != null && v.contains(t.relatedTarget) || t.relatedTarget === P.current) && (t.defaultMuiPrevented = !0);
440
- }, qe = (e = {}) => ({
441
- onBlur: Fe(e)
442
- }), je = (e = {}) => {
443
- const t = le(e), a = ae(qe, Ce);
444
- return m({
445
- id: E,
440
+ (a = e.onBlur) == null || a.call(e, t), !t.defaultMuiPrevented && ((v = O.current) != null && v.contains(t.relatedTarget) || t.relatedTarget === x.current) && (t.defaultMuiPrevented = !0);
441
+ }, je = (e = {}) => ({
442
+ onBlur: qe(e)
443
+ }), Ue = (e = {}) => {
444
+ const t = le(e), a = ae(je, Ce);
445
+ return g({
446
+ id: V,
446
447
  role: "listbox",
447
- "aria-multiselectable": d ? "true" : void 0
448
+ "aria-multiselectable": f ? "true" : void 0
448
449
  }, e, a(t));
449
450
  };
450
- s.useDebugValue({
451
- selectedOptions: A,
451
+ r.useDebugValue({
452
+ selectedOptions: E,
452
453
  highlightedOption: D,
453
- open: T
454
+ open: L
454
455
  });
455
- const Ue = s.useMemo(() => m({}, z, q), [z, q]);
456
- let Q;
457
- n.multiple ? Q = A : Q = A.length > 0 ? A[0] : null;
456
+ const Ke = r.useMemo(() => g({}, W, j), [W, j]);
457
+ let X;
458
+ n.multiple ? X = E : X = E.length > 0 ? E[0] : null;
458
459
  let ye;
459
- if (d)
460
- ye = Q.map((e) => J(e)).filter((e) => e !== void 0);
460
+ if (f)
461
+ ye = X.map((e) => G(e)).filter((e) => e !== void 0);
461
462
  else {
462
463
  var Oe;
463
- ye = (Oe = J(Q)) != null ? Oe : null;
464
+ ye = (Oe = G(X)) != null ? Oe : null;
464
465
  }
465
- const Ke = (e) => (t) => {
466
+ const ze = (e) => (t) => {
466
467
  var a;
467
468
  if (e == null || (a = e.onChange) == null || a.call(e, t), t.defaultMuiPrevented)
468
469
  return;
469
- const v = k.get(t.target.value);
470
+ const v = T.get(t.target.value);
470
471
  t.target.value === "" ? H({
471
- type: X.clearSelection
472
+ type: Y.clearSelection
472
473
  }) : v !== void 0 && H({
473
474
  type: ie.browserAutoFill,
474
475
  item: v.value,
@@ -478,116 +479,116 @@ function ft(n) {
478
479
  return {
479
480
  buttonActive: ce,
480
481
  buttonFocusVisible: de,
481
- buttonRef: K,
482
- contextValue: Ue,
482
+ buttonRef: z,
483
+ contextValue: Ke,
483
484
  disabled: u,
484
485
  dispatch: H,
485
- getButtonProps: He,
486
+ getButtonProps: Fe,
486
487
  getHiddenInputProps: (e = {}) => {
487
488
  const t = le(e);
488
- return m({
489
- name: R,
489
+ return g({
490
+ name: S,
490
491
  tabIndex: -1,
491
492
  "aria-hidden": !0,
492
- required: V ? !0 : void 0,
493
- value: L(ye),
494
- style: lt
493
+ required: I ? !0 : void 0,
494
+ value: A(ye),
495
+ style: it
495
496
  }, e, {
496
- onChange: Ke(t)
497
+ onChange: ze(t)
497
498
  });
498
499
  },
499
- getListboxProps: je,
500
- getOptionMetadata: J,
501
- listboxRef: W,
502
- open: T,
503
- options: j,
504
- value: Q,
500
+ getListboxProps: Ue,
501
+ getOptionMetadata: G,
502
+ listboxRef: J,
503
+ open: L,
504
+ options: U,
505
+ value: X,
505
506
  highlightedOption: D
506
507
  };
507
508
  }
508
- function bt(n) {
509
+ function xt(n) {
509
510
  const {
510
511
  value: o,
511
512
  children: i
512
513
  } = n, {
513
514
  dispatch: c,
514
- getItemIndex: r,
515
+ getItemIndex: s,
515
516
  getItemState: u,
516
- registerItem: f,
517
- totalSubitemCount: b
518
- } = o, d = s.useMemo(() => ({
517
+ registerItem: d,
518
+ totalSubitemCount: p
519
+ } = o, f = r.useMemo(() => ({
519
520
  dispatch: c,
520
521
  getItemState: u,
521
- getItemIndex: r
522
- }), [c, r, u]), R = s.useMemo(() => ({
523
- getItemIndex: r,
524
- registerItem: f,
525
- totalSubitemCount: b
526
- }), [f, r, b]);
527
- return /* @__PURE__ */ h(Ye.Provider, {
528
- value: R,
529
- children: /* @__PURE__ */ h(Se.Provider, {
530
- value: d,
522
+ getItemIndex: s
523
+ }), [c, s, u]), S = r.useMemo(() => ({
524
+ getItemIndex: s,
525
+ registerItem: d,
526
+ totalSubitemCount: p
527
+ }), [d, s, p]);
528
+ return /* @__PURE__ */ m(ot.Provider, {
529
+ value: S,
530
+ children: /* @__PURE__ */ m(Se.Provider, {
531
+ value: f,
531
532
  children: i
532
533
  })
533
534
  });
534
535
  }
535
536
  const De = "Select";
536
- function mt(n) {
537
+ function Ct(n) {
537
538
  return we(De, n);
538
539
  }
539
540
  Ie(De, ["root", "button", "listbox", "popup", "active", "expanded", "disabled", "focusVisible"]);
540
541
  var Ve;
541
- const gt = ["areOptionsEqual", "autoComplete", "autoFocus", "children", "defaultValue", "defaultListboxOpen", "disabled", "getSerializedValue", "listboxId", "listboxOpen", "multiple", "name", "required", "onChange", "onListboxOpenChange", "getOptionAsString", "renderValue", "placeholder", "slotProps", "slots", "value"];
542
- function ht(n) {
542
+ const Pt = ["areOptionsEqual", "autoComplete", "autoFocus", "children", "defaultValue", "defaultListboxOpen", "disabled", "getSerializedValue", "listboxId", "listboxOpen", "multiple", "name", "required", "onChange", "onListboxOpenChange", "getOptionAsString", "renderValue", "placeholder", "slotProps", "slots", "value"];
543
+ function vt(n) {
543
544
  var o;
544
- return Array.isArray(n) ? /* @__PURE__ */ h(s.Fragment, {
545
+ return Array.isArray(n) ? /* @__PURE__ */ m(r.Fragment, {
545
546
  children: n.map((i) => i.label).join(", ")
546
547
  }) : (o = n == null ? void 0 : n.label) != null ? o : null;
547
548
  }
548
- function xt(n) {
549
+ function yt(n) {
549
550
  const {
550
551
  active: o,
551
552
  disabled: i,
552
553
  open: c,
553
- focusVisible: r
554
+ focusVisible: s
554
555
  } = n;
555
- return Me({
556
- root: ["root", i && "disabled", r && "focusVisible", o && "active", c && "expanded"],
556
+ return ke({
557
+ root: ["root", i && "disabled", s && "focusVisible", o && "active", c && "expanded"],
557
558
  listbox: ["listbox", i && "disabled"],
558
559
  popup: ["popup"]
559
- }, ke(mt));
560
+ }, Me(Ct));
560
561
  }
561
- const $e = /* @__PURE__ */ s.forwardRef(function(o, i) {
562
- var c, r, u, f, b;
562
+ const $e = /* @__PURE__ */ r.forwardRef(function(o, i) {
563
+ var c, s, u, d, p;
563
564
  const {
564
- areOptionsEqual: d,
565
- autoComplete: R,
566
- autoFocus: V,
567
- children: x,
568
- defaultValue: _,
569
- defaultListboxOpen: g = !1,
570
- disabled: I,
571
- getSerializedValue: O,
572
- listboxId: N,
573
- listboxOpen: L,
574
- multiple: p = !1,
575
- name: C,
576
- required: P = !1,
577
- onChange: M,
578
- onListboxOpenChange: S,
579
- getOptionAsString: E = Be,
580
- renderValue: $,
581
- placeholder: Z,
565
+ areOptionsEqual: f,
566
+ autoComplete: S,
567
+ autoFocus: I,
568
+ children: C,
569
+ defaultValue: R,
570
+ defaultListboxOpen: _ = !1,
571
+ disabled: N,
572
+ getSerializedValue: h,
573
+ listboxId: k,
574
+ listboxOpen: A,
575
+ multiple: b = !1,
576
+ name: P,
577
+ required: x = !1,
578
+ onChange: $,
579
+ onListboxOpenChange: O,
580
+ getOptionAsString: V = Be,
581
+ renderValue: M,
582
+ placeholder: q,
582
583
  slotProps: B = {},
583
- slots: q = {},
584
- value: k
585
- } = o, ue = Ne(o, gt), ee = $ ?? ht, [ce, de] = s.useState(!1), K = s.useRef(null), j = s.useRef(null), w = (c = q.root) != null ? c : "button", te = (r = q.listbox) != null ? r : "ul", oe = (u = q.popup) != null ? u : "div", pe = s.useCallback((F) => {
584
+ slots: j = {},
585
+ value: T
586
+ } = o, ue = Ne(o, Pt), ee = M ?? vt, [ce, de] = r.useState(!1), z = r.useRef(null), U = r.useRef(null), w = (c = j.root) != null ? c : "button", te = (s = j.listbox) != null ? s : "ul", oe = (u = j.popup) != null ? u : "div", pe = r.useCallback((F) => {
586
587
  de(F != null);
587
- }, []), fe = Y(i, K, pe);
588
- s.useEffect(() => {
589
- V && K.current.focus();
590
- }, [V]);
588
+ }, []), fe = Z(i, z, pe);
589
+ r.useEffect(() => {
590
+ I && z.current.focus();
591
+ }, [I]);
591
592
  const {
592
593
  buttonActive: be,
593
594
  buttonFocusVisible: me,
@@ -596,94 +597,94 @@ const $e = /* @__PURE__ */ s.forwardRef(function(o, i) {
596
597
  getButtonProps: xe,
597
598
  getListboxProps: H,
598
599
  getHiddenInputProps: Ce,
599
- getOptionMetadata: z,
600
- value: T,
600
+ getOptionMetadata: W,
601
+ value: L,
601
602
  open: D
602
- } = ft({
603
- name: C,
604
- required: P,
605
- getSerializedValue: O,
606
- areOptionsEqual: d,
603
+ } = ht({
604
+ name: P,
605
+ required: x,
606
+ getSerializedValue: h,
607
+ areOptionsEqual: f,
607
608
  buttonRef: fe,
608
- defaultOpen: g,
609
- defaultValue: _,
610
- disabled: I,
611
- listboxId: N,
612
- multiple: p,
613
- open: L,
614
- onChange: M,
615
- onOpenChange: S,
616
- getOptionAsString: E,
617
- value: k,
609
+ defaultOpen: _,
610
+ defaultValue: R,
611
+ disabled: N,
612
+ listboxId: k,
613
+ multiple: b,
614
+ open: A,
615
+ onChange: $,
616
+ onOpenChange: O,
617
+ getOptionAsString: V,
618
+ value: T,
618
619
  componentName: "Select"
619
- }), A = m({}, o, {
620
+ }), E = g({}, o, {
620
621
  active: be,
621
- defaultListboxOpen: g,
622
+ defaultListboxOpen: _,
622
623
  disabled: he,
623
624
  focusVisible: me,
624
625
  open: D,
625
- multiple: p,
626
+ multiple: b,
626
627
  renderValue: ee,
627
- value: T
628
- }), W = xt(A), Pe = se({
628
+ value: L
629
+ }), J = yt(E), Pe = se({
629
630
  elementType: w,
630
631
  getSlotProps: xe,
631
632
  externalSlotProps: B.root,
632
633
  externalForwardedProps: ue,
633
- ownerState: A,
634
- className: W.root
635
- }), J = se({
634
+ ownerState: E,
635
+ className: J.root
636
+ }), G = se({
636
637
  elementType: te,
637
638
  getSlotProps: H,
638
639
  externalSlotProps: B.listbox,
639
640
  additionalProps: {
640
- ref: j
641
+ ref: U
641
642
  },
642
- ownerState: A,
643
- className: W.listbox
643
+ ownerState: E,
644
+ className: J.listbox
644
645
  }), ve = se({
645
646
  elementType: oe,
646
647
  externalSlotProps: B.popup,
647
648
  additionalProps: {
648
- anchor: K.current,
649
+ anchor: z.current,
649
650
  keepMounted: !0,
650
651
  open: D,
651
652
  placement: "bottom-start",
652
653
  role: void 0
653
654
  },
654
- ownerState: A,
655
- className: W.popup
655
+ ownerState: E,
656
+ className: J.popup
656
657
  });
657
- let G;
658
- if (p)
659
- G = T.map((F) => z(F)).filter((F) => F !== void 0);
658
+ let Q;
659
+ if (b)
660
+ Q = L.map((F) => W(F)).filter((F) => F !== void 0);
660
661
  else {
661
662
  var ne;
662
- G = (ne = z(T)) != null ? ne : null;
663
+ Q = (ne = W(L)) != null ? ne : null;
663
664
  }
664
- return /* @__PURE__ */ re(s.Fragment, {
665
- children: [/* @__PURE__ */ h(w, m({}, Pe, {
666
- children: (f = (b = ee(G)) != null ? b : Z) != null ? f : (
665
+ return /* @__PURE__ */ re(r.Fragment, {
666
+ children: [/* @__PURE__ */ m(w, g({}, Pe, {
667
+ children: (d = (p = ee(Q)) != null ? p : q) != null ? d : (
667
668
  // fall back to a zero-width space to prevent layout shift
668
669
  // from https://github.com/mui/material-ui/pull/24563
669
- Ve || (Ve = /* @__PURE__ */ h("span", {
670
+ Ve || (Ve = /* @__PURE__ */ m("span", {
670
671
  className: "notranslate",
671
672
  children: "​"
672
673
  }))
673
674
  )
674
- })), ce && /* @__PURE__ */ h(Ze, m({
675
+ })), ce && /* @__PURE__ */ m(nt, g({
675
676
  slots: {
676
677
  root: oe
677
678
  }
678
679
  }, ve, {
679
- children: /* @__PURE__ */ h(te, m({}, J, {
680
- children: /* @__PURE__ */ h(bt, {
680
+ children: /* @__PURE__ */ m(te, g({}, G, {
681
+ children: /* @__PURE__ */ m(xt, {
681
682
  value: ge,
682
- children: x
683
+ children: C
683
684
  })
684
685
  }))
685
- })), /* @__PURE__ */ h("input", m({}, Ce(), {
686
- autoComplete: R
686
+ })), /* @__PURE__ */ m("input", g({}, Ce(), {
687
+ autoComplete: S
687
688
  }))]
688
689
  });
689
690
  });
@@ -814,80 +815,86 @@ process.env.NODE_ENV !== "production" && ($e.propTypes = {
814
815
  */
815
816
  value: l.any
816
817
  });
817
- const Ct = (n) => {
818
- const { children: o, icon: i, className: c, ...r } = n;
818
+ const He = We({}), Rt = () => Je(He), _t = (n) => {
819
+ const { children: o, icon: i, className: c, ...s } = n, { multiple: u, selectedValue: d = [] } = Rt();
819
820
  return /* @__PURE__ */ re(
820
821
  Ee,
821
822
  {
822
- ...r,
823
+ ...s,
823
824
  slotProps: {
824
- root: (u) => ({
825
- className: U(y.select__listbox__option, c, {
826
- [y["select__listbox__option--disabled"]]: u.disabled,
827
- [y["select__listbox__option--selected"]]: u.selected
825
+ root: (p) => ({
826
+ className: K(y.select__listbox__option, c, {
827
+ [y["select__listbox__option--disabled"]]: p.disabled,
828
+ [y["select__listbox__option--selected"]]: p.selected && !u
828
829
  })
829
830
  })
830
831
  },
831
832
  children: [
832
- i ? /* @__PURE__ */ h("span", { className: y.select__listbox__option__icon, children: i }) : "",
833
- /* @__PURE__ */ h(_e, { className: y.select__listbox__option__text, children: o })
833
+ u && /* @__PURE__ */ m(Qe, { checked: d == null ? void 0 : d.includes(s.value), onChange: () => {
834
+ } }),
835
+ i ? /* @__PURE__ */ m("span", { className: y.select__listbox__option__icon, children: i }) : "",
836
+ /* @__PURE__ */ m(_e, { className: y.select__listbox__option__text, children: o })
834
837
  ]
835
838
  }
836
839
  );
837
- }, Pt = (n) => {
840
+ }, St = (n) => {
838
841
  const {
839
842
  children: o,
840
843
  className: i,
841
844
  id: c,
842
- onChange: r,
845
+ onChange: s,
843
846
  label: u,
847
+ multiple: d,
848
+ value: p,
844
849
  classNameWrapper: f,
845
- classNameLabel: b,
846
- testIdLabel: d,
847
- testIdWrapper: R,
848
- fullWidth: V = !0,
849
- infoMessage: x,
850
- error: _,
851
- errorMessage: g,
852
- classNameInfoMessage: I,
853
- classNameErrorMessage: O,
854
- "data-testid-infoMessage": N,
855
- "data-testid-errorMessage": L,
856
- ...p
857
- } = n, C = (S, E) => {
858
- S && (r == null || r(E, S));
859
- }, P = ze(), M = c || `select_${P}`;
850
+ classNameLabel: S,
851
+ testIdLabel: I,
852
+ testIdWrapper: C,
853
+ fullWidth: R = !0,
854
+ infoMessage: _,
855
+ error: N,
856
+ errorMessage: h,
857
+ classNameInfoMessage: k,
858
+ classNameErrorMessage: A,
859
+ "data-testid-infoMessage": b,
860
+ "data-testid-errorMessage": P,
861
+ ...x
862
+ } = n, $ = (M, q) => {
863
+ M && (s == null || s(q, M));
864
+ }, O = Ge(), V = c || `select_${O}`;
860
865
  return /* @__PURE__ */ re(
861
866
  "div",
862
867
  {
863
- className: U(
868
+ className: K(
864
869
  y.select__wrapper,
865
- !V && y["select__wrapper--fit-content-width"],
870
+ !R && y["select__wrapper--fit-content-width"],
866
871
  f
867
872
  ),
868
- "data-testid": R,
869
- id: `${M}_wrapper`,
873
+ "data-testid": C,
874
+ id: `${V}_wrapper`,
870
875
  children: [
871
- u && /* @__PURE__ */ h(
876
+ u && /* @__PURE__ */ m(
872
877
  _e,
873
878
  {
874
879
  element: "label",
875
- elementProps: { htmlFor: M, id: `${M}_label` },
876
- className: U(y.select__label, b),
877
- "data-testid": d,
880
+ elementProps: { htmlFor: V, id: `${V}_label` },
881
+ className: K(y.select__label, S),
882
+ "data-testid": I,
878
883
  children: u
879
884
  }
880
885
  ),
881
- /* @__PURE__ */ h(
886
+ /* @__PURE__ */ m(He.Provider, { value: { multiple: d, selectedValue: p, onChange: s }, children: /* @__PURE__ */ m(
882
887
  $e,
883
888
  {
884
- ...p,
885
- id: M,
886
- onChange: C,
887
- className: U(y.select, i, (_ || g) && y["select-button--error"]),
888
- slots: { root: Je },
889
+ ...x,
890
+ value: p,
891
+ id: V,
892
+ onChange: $,
893
+ className: K(y.select, i, (N || h) && y["select-button--error"]),
894
+ slots: { root: Ye },
895
+ multiple: d,
889
896
  slotProps: {
890
- root: { fullWidth: V, placeholder: p.placeholder },
897
+ root: { fullWidth: R, placeholder: x.placeholder },
891
898
  listbox: { className: y.select__listbox },
892
899
  popup: {
893
900
  className: y.select__popup,
@@ -897,15 +904,15 @@ const Ct = (n) => {
897
904
  },
898
905
  children: o
899
906
  }
900
- ),
901
- /* @__PURE__ */ h("div", { className: y["messages-wrapper"], children: (g || x) && /* @__PURE__ */ re(
907
+ ) }),
908
+ /* @__PURE__ */ m("div", { className: y["messages-wrapper"], children: (h || _) && /* @__PURE__ */ re(
902
909
  _e,
903
910
  {
904
- className: g ? U(y["error-message"], O) : U(y["info-message"], I),
905
- "data-testid": g ? L : N,
911
+ className: h ? K(y["error-message"], A) : K(y["info-message"], k),
912
+ "data-testid": h ? P : b,
906
913
  children: [
907
- /* @__PURE__ */ h(We, { icon: g ? "circle-exclamation" : "circle-info" }),
908
- g || x
914
+ /* @__PURE__ */ m(Xe, { icon: h ? "circle-exclamation" : "circle-info" }),
915
+ h || _
909
916
  ]
910
917
  }
911
918
  ) })
@@ -913,8 +920,10 @@ const Ct = (n) => {
913
920
  }
914
921
  );
915
922
  };
916
- Pt.Option = Ct;
923
+ St.Option = _t;
917
924
  export {
918
- Pt as Select,
919
- Ct as SelectOption
925
+ St as Select,
926
+ He as SelectContext,
927
+ _t as SelectOption,
928
+ Rt as useSelectContext
920
929
  };