@pismo/marola 1.0.0-beta.21 → 1.0.0-beta.23

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