@pismo/marola 1.0.0-beta.43 → 1.0.0-beta.44

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