@pismo/marola 0.0.1-alpha.1 → 0.0.1-alpha.12

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 (136) hide show
  1. package/README.md +17 -5
  2. package/dist/Button-B1umG8kJ.js +131 -0
  3. package/dist/ClickAwayListener-HI1G6ob9.js +107 -0
  4. package/dist/Dialog.module-CGVM5V_D.js +15 -0
  5. package/dist/Popup-DFJQc_jn.js +1249 -0
  6. package/dist/Portal-D__zvwbZ.js +73 -0
  7. package/dist/SelectButton-DWtqAiwt.js +45 -0
  8. package/dist/Tabs.module-jkH1Qjn7.js +22 -0
  9. package/dist/_commonjsHelpers-CT_km90n.js +30 -0
  10. package/dist/assets/Advice.css +1 -0
  11. package/dist/assets/Button.css +1 -0
  12. package/dist/assets/Checkbox.css +1 -0
  13. package/dist/assets/Dialog.css +1 -1
  14. package/dist/assets/IconButton.css +1 -0
  15. package/dist/assets/Input.css +1 -0
  16. package/dist/assets/InputSearch.css +1 -0
  17. package/dist/assets/LoadingSpinner.css +1 -1
  18. package/dist/assets/PageHeader.css +1 -0
  19. package/dist/assets/Pagination.css +1 -0
  20. package/dist/assets/SelectButton.css +1 -0
  21. package/dist/assets/Skeleton.css +1 -0
  22. package/dist/assets/Snackbar.css +1 -0
  23. package/dist/assets/SortTooltip.css +1 -0
  24. package/dist/assets/Stepper.css +1 -0
  25. package/dist/assets/Table.css +1 -0
  26. package/dist/assets/Tabs.css +1 -0
  27. package/dist/assets/Toggle.css +1 -0
  28. package/dist/assets/Tooltip.css +1 -0
  29. package/dist/assets/Typography.css +1 -1
  30. package/dist/assets/global.css +1 -0
  31. package/dist/combineHooksSlotProps-BHqhiBfc.js +81 -0
  32. package/dist/components/Advice/Advice.d.ts +16 -0
  33. package/dist/components/Advice/Advice.js +25 -0
  34. package/dist/components/Button/Button.d.ts +29 -0
  35. package/dist/components/Button/Button.js +70 -0
  36. package/dist/components/Button/Button.stories.d.ts +60 -0
  37. package/dist/components/Button/Button.stories.js +41 -0
  38. package/dist/components/Checkbox/Checkbox.d.ts +19 -0
  39. package/dist/components/Checkbox/Checkbox.js +56 -0
  40. package/dist/components/Dialog/Actions.js +1 -1
  41. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  42. package/dist/components/Dialog/Backdrop.js +2 -9
  43. package/dist/components/Dialog/CloseIconButton.js +11 -10
  44. package/dist/components/Dialog/Dialog.d.ts +5 -4
  45. package/dist/components/Dialog/Dialog.js +420 -20077
  46. package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
  47. package/dist/components/Dialog/Dialog.stories.js +60 -0
  48. package/dist/components/Dialog/Title.js +22 -7
  49. package/dist/components/Icon/Icon.d.ts +18 -0
  50. package/dist/components/Icon/Icon.js +95 -0
  51. package/dist/components/IconButton/IconButton.d.ts +22 -0
  52. package/dist/components/IconButton/IconButton.js +68 -0
  53. package/dist/components/Input/Input.d.ts +44 -0
  54. package/dist/components/Input/Input.js +497 -0
  55. package/dist/components/Input/Input.stories.d.ts +43 -0
  56. package/dist/components/Input/Input.stories.js +106 -0
  57. package/dist/components/InputSearch/InputSearch.d.ts +11 -0
  58. package/dist/components/InputSearch/InputSearch.js +29 -0
  59. package/dist/components/InputSearch/InputSearch.stories.d.ts +22 -0
  60. package/dist/components/InputSearch/InputSearch.stories.js +36 -0
  61. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
  62. package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
  63. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
  64. package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +39 -0
  65. package/dist/components/PageHeader/PageHeader.d.ts +36 -0
  66. package/dist/components/PageHeader/PageHeader.js +51 -0
  67. package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
  68. package/dist/components/PageHeader/PageHeader.stories.js +49 -0
  69. package/dist/components/Pagination/Pagination.d.ts +36 -0
  70. package/dist/components/Pagination/Pagination.js +219 -0
  71. package/dist/components/Select/Select.d.ts +25 -0
  72. package/dist/components/Select/Select.js +860 -0
  73. package/dist/components/Select/Select.stories.d.ts +31 -0
  74. package/dist/components/Select/Select.stories.js +66 -0
  75. package/dist/components/Select/SelectButton.d.ts +13 -0
  76. package/dist/components/Select/SelectButton.js +8 -0
  77. package/dist/components/Skeleton/Skeleton.d.ts +18 -0
  78. package/dist/components/Skeleton/Skeleton.js +26 -0
  79. package/dist/components/Snackbar/Snackbar.d.ts +13 -0
  80. package/dist/components/Snackbar/Snackbar.js +623 -0
  81. package/dist/components/SortTooltip/SortTooltip.d.ts +26 -0
  82. package/dist/components/SortTooltip/SortTooltip.js +67 -0
  83. package/dist/components/Stepper/Stepper.d.ts +16 -0
  84. package/dist/components/Stepper/Stepper.js +33 -0
  85. package/dist/components/Table/Table.d.ts +39 -0
  86. package/dist/components/Table/Table.js +122 -0
  87. package/dist/components/Table/TableContext.d.ts +19 -0
  88. package/dist/components/Table/TableContext.js +21 -0
  89. package/dist/components/Tabs/Tab.d.ts +9 -0
  90. package/dist/components/Tabs/Tab.js +182 -0
  91. package/dist/components/Tabs/TabPanel.d.ts +8 -0
  92. package/dist/components/Tabs/TabPanel.js +119 -0
  93. package/dist/components/Tabs/Tabs.d.ts +11 -0
  94. package/dist/components/Tabs/Tabs.js +402 -0
  95. package/dist/components/Toggle/Toggle.d.ts +11 -0
  96. package/dist/components/Toggle/Toggle.js +252 -0
  97. package/dist/components/Toggle/Toggle.stories.d.ts +21 -0
  98. package/dist/components/Toggle/Toggle.stories.js +33 -0
  99. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  100. package/dist/components/Tooltip/Tooltip.js +127 -0
  101. package/dist/components/Typography/Typography.d.ts +15 -6
  102. package/dist/components/Typography/Typography.js +75 -67
  103. package/dist/components/Typography/Typography.stories.d.ts +31 -0
  104. package/dist/components/Typography/Typography.stories.js +31 -0
  105. package/dist/components/Typography/typography.test.d.ts +1 -0
  106. package/dist/components/Typography/typography.test.js +11358 -0
  107. package/dist/index-BJ8HbRCy.js +19585 -0
  108. package/dist/index-CqjC7P5Y.js +814 -0
  109. package/dist/magic-string.es-O_8lTkE3.js +738 -0
  110. package/dist/main.d.ts +19 -2
  111. package/dist/main.js +60 -15
  112. package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +26 -0
  113. package/dist/test-utils/assertStyles.d.ts +1 -0
  114. package/dist/test-utils/assertStyles.js +11 -0
  115. package/dist/types/helpers.d.ts +14 -7
  116. package/dist/useButton-Bc8IAgyk.js +106 -0
  117. package/dist/useCompoundItem-D1iRfg8D.js +84 -0
  118. package/dist/useControlled-CCMYYdCM.js +31 -0
  119. package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
  120. package/dist/useEventCallback-vAfOD-oT.js +45 -0
  121. package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
  122. package/dist/useList-ByMguSS_.js +437 -0
  123. package/dist/useTimeout-DxF9kiZL.js +36 -0
  124. package/dist/utils/styleStrings.d.ts +6 -0
  125. package/dist/utils/styleStrings.js +10 -0
  126. package/dist/utils/styleStrings.test.d.ts +1 -0
  127. package/dist/utils/styleStrings.test.js +41 -0
  128. package/dist/vi.Y_w82WR8-Df0JUamG.js +9860 -0
  129. package/package.json +53 -10
  130. package/dist/Button-REznN-RP.js +0 -1139
  131. package/dist/Dialog.module-BO0mdB7d.js +0 -15
  132. package/dist/assets/CallToActionButton.css +0 -1
  133. package/dist/assets/main.css +0 -1
  134. package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -23
  135. package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
  136. package/src/playground/Playground.tsx +0 -58
@@ -0,0 +1,860 @@
1
+ import { jsx as h, jsxs as Oe } from "react/jsx-runtime";
2
+ import { c as Se } from "../../clsx-DB4S2d7J.js";
3
+ import { Typography as Ke } from "../Typography/Typography.js";
4
+ import { s as I, B as ze } from "../../SelectButton-DWtqAiwt.js";
5
+ import { a as g, _ as Ve } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
6
+ import * as s from "react";
7
+ import { g as we, a as ke, u as X, e as ne, P as l, b as le, c as Ie, d as Me } from "../../index-CqjC7P5Y.js";
8
+ import { u as Je, c as se, a as ye, L as Q } from "../../combineHooksSlotProps-BHqhiBfc.js";
9
+ import { u as Ne } from "../../useButton-Bc8IAgyk.js";
10
+ import { u as Te, a as We, b as Ge, C as Qe } from "../../useCompoundItem-D1iRfg8D.js";
11
+ import { P as Xe } from "../../Popup-DFJQc_jn.js";
12
+ import { m as ve, h as Ye, l as Ze, u as et } from "../../useList-ByMguSS_.js";
13
+ import { u as tt } from "../../useEnhancedEffect-CJGo-L3B.js";
14
+ const ot = {
15
+ border: 0,
16
+ clip: "rect(0 0 0 0)",
17
+ height: "1px",
18
+ margin: "-1px",
19
+ overflow: "hidden",
20
+ padding: 0,
21
+ position: "absolute",
22
+ whiteSpace: "nowrap",
23
+ width: "1px"
24
+ }, Ae = "Option";
25
+ function nt(n) {
26
+ return we(Ae, n);
27
+ }
28
+ ke(Ae, ["root", "disabled", "selected", "highlighted"]);
29
+ function lt(n) {
30
+ const {
31
+ value: o,
32
+ label: i,
33
+ disabled: a,
34
+ rootRef: r,
35
+ id: c
36
+ } = n, {
37
+ getRootProps: p,
38
+ highlighted: f,
39
+ selected: d
40
+ } = Je({
41
+ item: o
42
+ }), {
43
+ getRootProps: v,
44
+ rootRef: M
45
+ } = Ne({
46
+ disabled: a,
47
+ focusableWhenDisabled: !0
48
+ }), x = Te(c), y = s.useRef(null), R = s.useMemo(() => ({
49
+ disabled: a,
50
+ label: i,
51
+ value: o,
52
+ ref: y,
53
+ id: x
54
+ }), [a, i, o, x]), {
55
+ index: N
56
+ } = We(o, R), O = X(r, y, M), T = (b) => (C) => {
57
+ var P;
58
+ (P = b.onKeyDown) == null || P.call(b, C), !C.defaultMuiPrevented && [" ", "Enter"].includes(C.key) && (C.defaultMuiPrevented = !0);
59
+ }, B = (b = {}) => ({
60
+ onKeyDown: T(b)
61
+ });
62
+ return {
63
+ getRootProps: (b = {}) => {
64
+ const C = ne(b), P = se(p, se(v, B));
65
+ return g({}, b, C, P(C), {
66
+ id: x,
67
+ ref: O,
68
+ role: "option",
69
+ "aria-selected": d
70
+ });
71
+ },
72
+ highlighted: f,
73
+ index: N,
74
+ selected: d,
75
+ rootRef: O
76
+ };
77
+ }
78
+ function st(n) {
79
+ const o = s.useContext(ye);
80
+ if (!o)
81
+ throw new Error("Option: ListContext was not found.");
82
+ const {
83
+ getItemState: i,
84
+ dispatch: a
85
+ } = o, {
86
+ highlighted: r,
87
+ selected: c,
88
+ focusable: p
89
+ } = i(n), f = s.useCallback((v) => {
90
+ if (v !== n)
91
+ 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
+ return {
93
+ highlighted: r,
94
+ selected: c,
95
+ focusable: p
96
+ };
97
+ }, [r, c, p, n]);
98
+ return {
99
+ contextValue: s.useMemo(() => ({
100
+ dispatch: a,
101
+ getItemState: f
102
+ }), [a, f])
103
+ };
104
+ }
105
+ const rt = ["children", "disabled", "label", "slotProps", "slots", "value"];
106
+ function it(n) {
107
+ const {
108
+ disabled: o,
109
+ highlighted: i,
110
+ selected: a
111
+ } = n;
112
+ return Ie({
113
+ root: ["root", o && "disabled", i && "highlighted", a && "selected"]
114
+ }, Me(nt));
115
+ }
116
+ const ut = /* @__PURE__ */ s.memo(/* @__PURE__ */ s.forwardRef(function(o, i) {
117
+ var a, r;
118
+ const {
119
+ children: c,
120
+ disabled: p = !1,
121
+ label: f,
122
+ slotProps: d = {},
123
+ slots: v = {},
124
+ value: M
125
+ } = o, x = Ve(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: T,
127
+ selected: B,
128
+ highlighted: b,
129
+ index: C
130
+ } = lt({
131
+ disabled: p,
132
+ label: O,
133
+ rootRef: N,
134
+ value: M
135
+ }), P = g({}, o, {
136
+ disabled: p,
137
+ highlighted: b,
138
+ index: C,
139
+ selected: B
140
+ }), j = it(P), S = le({
141
+ getSlotProps: T,
142
+ elementType: y,
143
+ externalSlotProps: d.root,
144
+ externalForwardedProps: x,
145
+ className: j.root,
146
+ ownerState: P
147
+ });
148
+ return /* @__PURE__ */ h(y, g({}, S, {
149
+ children: c
150
+ }));
151
+ })), Le = /* @__PURE__ */ s.forwardRef(function(o, i) {
152
+ const {
153
+ value: a
154
+ } = o, {
155
+ contextValue: r
156
+ } = st(a);
157
+ return /* @__PURE__ */ h(ye.Provider, {
158
+ value: r,
159
+ children: /* @__PURE__ */ h(ut, g({}, o, {
160
+ ref: i
161
+ }))
162
+ });
163
+ });
164
+ process.env.NODE_ENV !== "production" && (Le.propTypes = {
165
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
166
+ // │ These PropTypes are generated from the TypeScript type definitions. │
167
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
168
+ // └─────────────────────────────────────────────────────────────────────┘
169
+ /**
170
+ * @ignore
171
+ */
172
+ children: l.node,
173
+ /**
174
+ * @ignore
175
+ */
176
+ className: l.string,
177
+ /**
178
+ * If `true`, the option will be disabled.
179
+ * @default false
180
+ */
181
+ disabled: l.bool,
182
+ /**
183
+ * A text representation of the option's content.
184
+ * Used for keyboard text navigation matching.
185
+ */
186
+ label: l.string,
187
+ /**
188
+ * The props used for each slot inside the Option.
189
+ * @default {}
190
+ */
191
+ slotProps: l.shape({
192
+ root: l.oneOfType([l.func, l.object])
193
+ }),
194
+ /**
195
+ * The components used for each slot inside the Option.
196
+ * Either a string to use a HTML element or a component.
197
+ * @default {}
198
+ */
199
+ slots: l.shape({
200
+ root: l.elementType
201
+ }),
202
+ /**
203
+ * The value of the option.
204
+ */
205
+ value: l.any.isRequired
206
+ });
207
+ const re = {
208
+ buttonClick: "buttonClick",
209
+ browserAutoFill: "browserAutoFill"
210
+ }, Be = (n) => {
211
+ const {
212
+ label: o,
213
+ value: i
214
+ } = n;
215
+ return typeof o == "string" ? o : typeof i == "string" ? i : String(n);
216
+ };
217
+ function at(n, o) {
218
+ const {
219
+ open: i
220
+ } = n, {
221
+ context: {
222
+ selectionMode: a
223
+ }
224
+ } = o;
225
+ if (o.type === re.buttonClick) {
226
+ 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
231
+ });
232
+ }
233
+ if (o.type === re.browserAutoFill)
234
+ return Ye(o.item, n, o.context);
235
+ const c = Ze(n, o);
236
+ switch (o.type) {
237
+ case Q.keyDown:
238
+ if (n.open) {
239
+ if (o.event.key === "Escape")
240
+ return g({}, c, {
241
+ open: !1
242
+ });
243
+ } else {
244
+ if (o.event.key === "ArrowDown") {
245
+ var p;
246
+ return g({}, n, {
247
+ open: !0,
248
+ highlightedValue: (p = n.selectedValues[0]) != null ? p : ve(null, "start", o.context)
249
+ });
250
+ }
251
+ if (o.event.key === "ArrowUp") {
252
+ var f;
253
+ return g({}, n, {
254
+ open: !0,
255
+ highlightedValue: (f = n.selectedValues[0]) != null ? f : ve(null, "end", o.context)
256
+ });
257
+ }
258
+ }
259
+ break;
260
+ case Q.itemClick:
261
+ if (a === "single")
262
+ return g({}, c, {
263
+ open: !1
264
+ });
265
+ break;
266
+ case Q.blur:
267
+ return g({}, c, {
268
+ open: !1
269
+ });
270
+ default:
271
+ return c;
272
+ }
273
+ return c;
274
+ }
275
+ function ct(n) {
276
+ 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
+ function dt(n) {
279
+ const {
280
+ areOptionsEqual: o,
281
+ buttonRef: i,
282
+ defaultOpen: a = !1,
283
+ defaultValue: r,
284
+ disabled: c = !1,
285
+ listboxId: p,
286
+ listboxRef: f,
287
+ multiple: d = !1,
288
+ name: v,
289
+ required: M,
290
+ onChange: x,
291
+ onHighlightChange: y,
292
+ onOpenChange: R,
293
+ open: N,
294
+ options: O,
295
+ getOptionAsString: T = Be,
296
+ getSerializedValue: B = ct,
297
+ value: b,
298
+ componentName: C = "useSelect"
299
+ } = n, P = s.useRef(null), j = X(i, P), S = s.useRef(null), $ = Te(p);
300
+ let E;
301
+ b === void 0 && r === void 0 ? E = [] : r !== void 0 && (d ? E = r : E = r == null ? [] : [r]);
302
+ const Y = s.useMemo(() => {
303
+ if (b !== void 0)
304
+ return d ? b : b == null ? [] : [b];
305
+ }, [b, d]), {
306
+ subitems: A,
307
+ contextValue: F
308
+ } = Ge(), V = s.useMemo(() => O != null ? new Map(O.map((e, t) => [e.value, {
309
+ value: e.value,
310
+ label: e.label,
311
+ disabled: e.disabled,
312
+ ref: /* @__PURE__ */ s.createRef(),
313
+ id: `${$}_${t}`
314
+ }])) : A, [O, A, $]), ie = X(f, S), {
315
+ getRootProps: Z,
316
+ active: ue,
317
+ focusVisible: ae,
318
+ rootRef: U
319
+ } = Ne({
320
+ disabled: c,
321
+ rootRef: j
322
+ }), q = s.useMemo(() => Array.from(V.keys()), [V]), _ = s.useCallback((e) => {
323
+ if (o !== void 0) {
324
+ const t = q.find((u) => o(u, e));
325
+ return V.get(t);
326
+ }
327
+ return V.get(e);
328
+ }, [V, o, q]), ee = s.useCallback((e) => {
329
+ var t;
330
+ const u = _(e);
331
+ return (t = u == null ? void 0 : u.disabled) != null ? t : !1;
332
+ }, [_]), te = s.useCallback((e) => {
333
+ const t = _(e);
334
+ return t ? T(t) : "";
335
+ }, [_, T]), ce = s.useMemo(() => ({
336
+ selectedValues: Y,
337
+ open: N
338
+ }), [Y, N]), de = s.useCallback((e) => {
339
+ var t;
340
+ return (t = V.get(e)) == null ? void 0 : t.id;
341
+ }, [V]), pe = s.useCallback((e, t) => {
342
+ if (d)
343
+ x == null || x(e, t);
344
+ else {
345
+ var u;
346
+ x == null || x(e, (u = t[0]) != null ? u : null);
347
+ }
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();
354
+ }
355
+ }, [R]), ge = s.useCallback((e) => {
356
+ var t, u;
357
+ return e == null ? null : (t = (u = A.get(e)) == null ? void 0 : u.ref.current) != null ? t : null;
358
+ }, [A]), me = {
359
+ getInitialState: () => {
360
+ var e;
361
+ return {
362
+ highlightedValue: null,
363
+ selectedValues: (e = E) != null ? e : [],
364
+ open: a
365
+ };
366
+ },
367
+ getItemId: de,
368
+ controlledProps: ce,
369
+ focusManagement: "DOM",
370
+ getItemDomElement: ge,
371
+ itemComparer: o,
372
+ isItemDisabled: ee,
373
+ rootRef: ie,
374
+ onChange: pe,
375
+ onHighlightChange: fe,
376
+ onStateChange: be,
377
+ reducerActionContext: s.useMemo(() => ({
378
+ multiple: d
379
+ }), [d]),
380
+ items: q,
381
+ getItemAsString: te,
382
+ selectionMode: d ? "multiple" : "single",
383
+ stateReducer: at,
384
+ componentName: C
385
+ }, {
386
+ dispatch: D,
387
+ getRootProps: he,
388
+ contextValue: K,
389
+ state: {
390
+ open: w,
391
+ highlightedValue: L,
392
+ selectedValues: k
393
+ },
394
+ rootRef: z
395
+ } = et(me), xe = s.useRef(w);
396
+ tt(() => {
397
+ if (w && L !== null) {
398
+ var e;
399
+ const t = (e = _(L)) == null ? void 0 : e.ref;
400
+ if (!S.current || !(t != null && t.current))
401
+ return;
402
+ xe.current || t.current.focus({
403
+ preventScroll: !0
404
+ });
405
+ const u = S.current.getBoundingClientRect(), m = t.current.getBoundingClientRect();
406
+ m.top < u.top ? S.current.scrollTop -= u.top - m.top : m.bottom > u.bottom && (S.current.scrollTop += m.bottom - u.bottom);
407
+ }
408
+ }, [w, L, _]);
409
+ const J = s.useCallback((e) => _(e), [_]), 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,
414
+ event: t
415
+ };
416
+ D(m);
417
+ }
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({
421
+ type: Q.keyDown,
422
+ key: t.key,
423
+ event: t
424
+ }));
425
+ }, oe = (e = {}) => ({
426
+ onClick: Ce(e),
427
+ onKeyDown: W(e)
428
+ }), H = (e = {}) => g({}, e, oe(e), {
429
+ role: "combobox",
430
+ "aria-expanded": w,
431
+ "aria-controls": $
432
+ }), 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 = S.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: $,
444
+ role: "listbox",
445
+ "aria-multiselectable": d ? "true" : void 0
446
+ }, e, u(t));
447
+ };
448
+ s.useDebugValue({
449
+ selectedOptions: k,
450
+ highlightedOption: L,
451
+ open: w
452
+ });
453
+ const je = s.useMemo(() => g({}, K, F), [K, F]);
454
+ let G;
455
+ n.multiple ? G = k : G = k.length > 0 ? k[0] : null;
456
+ let Pe;
457
+ if (d)
458
+ Pe = G.map((e) => J(e)).filter((e) => e !== void 0);
459
+ else {
460
+ var Re;
461
+ Pe = (Re = J(G)) != null ? Re : null;
462
+ }
463
+ const Ue = (e) => (t) => {
464
+ var u;
465
+ if (e == null || (u = e.onChange) == null || u.call(e, t), t.defaultMuiPrevented)
466
+ return;
467
+ const m = V.get(t.target.value);
468
+ t.target.value === "" ? D({
469
+ type: Q.clearSelection
470
+ }) : m !== void 0 && D({
471
+ type: re.browserAutoFill,
472
+ item: m.value,
473
+ event: t
474
+ });
475
+ };
476
+ return {
477
+ buttonActive: ue,
478
+ buttonFocusVisible: ae,
479
+ buttonRef: U,
480
+ contextValue: je,
481
+ disabled: c,
482
+ dispatch: D,
483
+ getButtonProps: He,
484
+ getHiddenInputProps: (e = {}) => {
485
+ const t = ne(e);
486
+ return g({
487
+ name: v,
488
+ tabIndex: -1,
489
+ "aria-hidden": !0,
490
+ required: M ? !0 : void 0,
491
+ value: B(Pe),
492
+ style: ot
493
+ }, e, {
494
+ onChange: Ue(t)
495
+ });
496
+ },
497
+ getListboxProps: qe,
498
+ getOptionMetadata: J,
499
+ listboxRef: z,
500
+ open: w,
501
+ options: q,
502
+ value: G,
503
+ highlightedOption: L
504
+ };
505
+ }
506
+ function pt(n) {
507
+ const {
508
+ value: o,
509
+ children: i
510
+ } = n, {
511
+ dispatch: a,
512
+ getItemIndex: r,
513
+ getItemState: c,
514
+ registerItem: p,
515
+ totalSubitemCount: f
516
+ } = o, d = s.useMemo(() => ({
517
+ dispatch: a,
518
+ getItemState: c,
519
+ getItemIndex: r
520
+ }), [a, r, c]), v = s.useMemo(() => ({
521
+ getItemIndex: r,
522
+ registerItem: p,
523
+ totalSubitemCount: f
524
+ }), [p, r, f]);
525
+ return /* @__PURE__ */ h(Qe.Provider, {
526
+ value: v,
527
+ children: /* @__PURE__ */ h(ye.Provider, {
528
+ value: d,
529
+ children: i
530
+ })
531
+ });
532
+ }
533
+ const Ee = "Select";
534
+ function ft(n) {
535
+ return we(Ee, n);
536
+ }
537
+ ke(Ee, ["root", "button", "listbox", "popup", "active", "expanded", "disabled", "focusVisible"]);
538
+ var _e;
539
+ const bt = ["areOptionsEqual", "autoComplete", "autoFocus", "children", "defaultValue", "defaultListboxOpen", "disabled", "getSerializedValue", "listboxId", "listboxOpen", "multiple", "name", "required", "onChange", "onListboxOpenChange", "getOptionAsString", "renderValue", "placeholder", "slotProps", "slots", "value"];
540
+ function gt(n) {
541
+ var o;
542
+ return Array.isArray(n) ? /* @__PURE__ */ h(s.Fragment, {
543
+ children: n.map((i) => i.label).join(", ")
544
+ }) : (o = n == null ? void 0 : n.label) != null ? o : null;
545
+ }
546
+ function mt(n) {
547
+ const {
548
+ active: o,
549
+ disabled: i,
550
+ open: a,
551
+ focusVisible: r
552
+ } = n;
553
+ return Ie({
554
+ root: ["root", i && "disabled", r && "focusVisible", o && "active", a && "expanded"],
555
+ listbox: ["listbox", i && "disabled"],
556
+ popup: ["popup"]
557
+ }, Me(ft));
558
+ }
559
+ const De = /* @__PURE__ */ s.forwardRef(function(o, i) {
560
+ var a, r, c, p, f;
561
+ const {
562
+ areOptionsEqual: d,
563
+ autoComplete: v,
564
+ autoFocus: M,
565
+ children: x,
566
+ defaultValue: y,
567
+ defaultListboxOpen: R = !1,
568
+ disabled: N,
569
+ getSerializedValue: O,
570
+ listboxId: T,
571
+ listboxOpen: B,
572
+ multiple: b = !1,
573
+ name: C,
574
+ required: P = !1,
575
+ onChange: j,
576
+ onListboxOpenChange: S,
577
+ getOptionAsString: $ = Be,
578
+ renderValue: E,
579
+ placeholder: Y,
580
+ slotProps: A = {},
581
+ slots: F = {},
582
+ value: V
583
+ } = o, ie = Ve(o, bt), Z = E ?? gt, [ue, ae] = s.useState(!1), U = s.useRef(null), q = s.useRef(null), _ = (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);
586
+ s.useEffect(() => {
587
+ M && U.current.focus();
588
+ }, [M]);
589
+ const {
590
+ buttonActive: pe,
591
+ buttonFocusVisible: fe,
592
+ contextValue: be,
593
+ disabled: ge,
594
+ getButtonProps: me,
595
+ getListboxProps: D,
596
+ getHiddenInputProps: he,
597
+ getOptionMetadata: K,
598
+ value: w,
599
+ open: L
600
+ } = dt({
601
+ name: C,
602
+ required: P,
603
+ getSerializedValue: O,
604
+ areOptionsEqual: d,
605
+ buttonRef: de,
606
+ defaultOpen: R,
607
+ defaultValue: y,
608
+ disabled: N,
609
+ listboxId: T,
610
+ multiple: b,
611
+ open: B,
612
+ onChange: j,
613
+ onOpenChange: S,
614
+ getOptionAsString: $,
615
+ value: V,
616
+ componentName: "Select"
617
+ }), k = g({}, o, {
618
+ active: pe,
619
+ defaultListboxOpen: R,
620
+ disabled: ge,
621
+ focusVisible: fe,
622
+ open: L,
623
+ multiple: b,
624
+ renderValue: Z,
625
+ value: w
626
+ }), z = mt(k), xe = le({
627
+ elementType: _,
628
+ getSlotProps: me,
629
+ externalSlotProps: A.root,
630
+ externalForwardedProps: ie,
631
+ ownerState: k,
632
+ className: z.root
633
+ }), J = le({
634
+ elementType: ee,
635
+ getSlotProps: D,
636
+ externalSlotProps: A.listbox,
637
+ additionalProps: {
638
+ ref: q
639
+ },
640
+ ownerState: k,
641
+ className: z.listbox
642
+ }), Ce = le({
643
+ elementType: te,
644
+ externalSlotProps: A.popup,
645
+ additionalProps: {
646
+ anchor: U.current,
647
+ keepMounted: !0,
648
+ open: L,
649
+ placement: "bottom-start",
650
+ role: void 0
651
+ },
652
+ ownerState: k,
653
+ className: z.popup
654
+ });
655
+ let W;
656
+ if (b)
657
+ W = w.map((H) => K(H)).filter((H) => H !== void 0);
658
+ else {
659
+ var oe;
660
+ W = (oe = K(w)) != null ? oe : null;
661
+ }
662
+ return /* @__PURE__ */ Oe(s.Fragment, {
663
+ children: [/* @__PURE__ */ h(_, g({}, xe, {
664
+ children: (p = (f = Z(W)) != null ? f : Y) != null ? p : (
665
+ // fall back to a zero-width space to prevent layout shift
666
+ // from https://github.com/mui/material-ui/pull/24563
667
+ _e || (_e = /* @__PURE__ */ h("span", {
668
+ className: "notranslate",
669
+ children: "​"
670
+ }))
671
+ )
672
+ })), ue && /* @__PURE__ */ h(Xe, g({
673
+ slots: {
674
+ root: te
675
+ }
676
+ }, Ce, {
677
+ children: /* @__PURE__ */ h(ee, g({}, J, {
678
+ children: /* @__PURE__ */ h(pt, {
679
+ value: be,
680
+ children: x
681
+ })
682
+ }))
683
+ })), /* @__PURE__ */ h("input", g({}, he(), {
684
+ autoComplete: v
685
+ }))]
686
+ });
687
+ });
688
+ process.env.NODE_ENV !== "production" && (De.propTypes = {
689
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
690
+ // │ These PropTypes are generated from the TypeScript type definitions. │
691
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
692
+ // └─────────────────────────────────────────────────────────────────────┘
693
+ /**
694
+ * A function used to determine if two options' values are equal.
695
+ * By default, reference equality is used.
696
+ *
697
+ * There is a performance impact when using the `areOptionsEqual` prop (proportional to the number of options).
698
+ * Therefore, it's recommented to use the default reference equality comparison whenever possible.
699
+ */
700
+ areOptionsEqual: l.func,
701
+ /**
702
+ * This prop helps users to fill forms faster, especially on mobile devices.
703
+ * The name can be confusing, as it's more like an autofill.
704
+ * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
705
+ */
706
+ autoComplete: l.string,
707
+ /**
708
+ * If `true`, the select element is focused during the first mount
709
+ * @default false
710
+ */
711
+ autoFocus: l.bool,
712
+ /**
713
+ * @ignore
714
+ */
715
+ children: l.node,
716
+ /**
717
+ * @ignore
718
+ */
719
+ className: l.string,
720
+ /**
721
+ * If `true`, the select will be initially open.
722
+ * @default false
723
+ */
724
+ defaultListboxOpen: l.bool,
725
+ /**
726
+ * The default selected value. Use when the component is not controlled.
727
+ */
728
+ defaultValue: l.any,
729
+ /**
730
+ * If `true`, the select is disabled.
731
+ * @default false
732
+ */
733
+ disabled: l.bool,
734
+ /**
735
+ * A function used to convert the option label to a string.
736
+ * It's useful when labels are elements and need to be converted to plain text
737
+ * to enable navigation using character keys on a keyboard.
738
+ *
739
+ * @default defaultOptionStringifier
740
+ */
741
+ getOptionAsString: l.func,
742
+ /**
743
+ * A function to convert the currently selected value to a string.
744
+ * Used to set a value of a hidden input associated with the select,
745
+ * so that the selected value can be posted with a form.
746
+ */
747
+ getSerializedValue: l.func,
748
+ /**
749
+ * `id` attribute of the listbox element.
750
+ */
751
+ listboxId: l.string,
752
+ /**
753
+ * Controls the open state of the select's listbox.
754
+ * @default undefined
755
+ */
756
+ listboxOpen: l.bool,
757
+ /**
758
+ * If `true`, selecting multiple values is allowed.
759
+ * This affects the type of the `value`, `defaultValue`, and `onChange` props.
760
+ *
761
+ * @default false
762
+ */
763
+ multiple: l.bool,
764
+ /**
765
+ * Name of the element. For example used by the server to identify the fields in form submits.
766
+ */
767
+ name: l.string,
768
+ /**
769
+ * Callback fired when an option is selected.
770
+ */
771
+ onChange: l.func,
772
+ /**
773
+ * Callback fired when the component requests to be opened.
774
+ * Use in controlled mode (see listboxOpen).
775
+ */
776
+ onListboxOpenChange: l.func,
777
+ /**
778
+ * Text to show when there is no selected value.
779
+ */
780
+ placeholder: l.node,
781
+ /**
782
+ * Function that customizes the rendering of the selected value.
783
+ */
784
+ renderValue: l.func,
785
+ /**
786
+ * If `true`, the Select cannot be empty when submitting form.
787
+ * @default false
788
+ */
789
+ required: l.bool,
790
+ /**
791
+ * The props used for each slot inside the Input.
792
+ * @default {}
793
+ */
794
+ slotProps: l.shape({
795
+ listbox: l.oneOfType([l.func, l.object]),
796
+ popup: l.oneOfType([l.func, l.object]),
797
+ root: l.oneOfType([l.func, l.object])
798
+ }),
799
+ /**
800
+ * The components used for each slot inside the Select.
801
+ * Either a string to use a HTML element or a component.
802
+ * @default {}
803
+ */
804
+ slots: l.shape({
805
+ listbox: l.elementType,
806
+ popup: l.elementType,
807
+ root: l.elementType
808
+ }),
809
+ /**
810
+ * The selected value.
811
+ * Set to `null` to deselect all options.
812
+ */
813
+ value: l.any
814
+ });
815
+ const ht = (n) => {
816
+ const { children: o, icon: i, ...a } = n;
817
+ return /* @__PURE__ */ Oe(
818
+ Le,
819
+ {
820
+ ...a,
821
+ slotProps: {
822
+ root: (r) => ({
823
+ className: Se(I.select__listbox__option, {
824
+ [I["select__listbox__option--disabled"]]: r.disabled,
825
+ [I["select__listbox__option--selected"]]: r.selected,
826
+ [I["select__listbox__option--highlighted"]]: r.highlighted
827
+ })
828
+ })
829
+ },
830
+ children: [
831
+ i ? /* @__PURE__ */ h("span", { className: I.select__listbox__option__icon, children: i }) : "",
832
+ /* @__PURE__ */ h(Ke, { element: "span", variant: "body-small", className: I.select__listbox__option__text, children: o })
833
+ ]
834
+ }
835
+ );
836
+ }, xt = (n) => {
837
+ const { children: o, onChange: i, ariaLabelledby: a, ...r } = n;
838
+ return /* @__PURE__ */ h(
839
+ De,
840
+ {
841
+ ...r,
842
+ onChange: (p, f) => {
843
+ i == null || i(f, p);
844
+ },
845
+ className: Se(I.select),
846
+ slots: { root: ze },
847
+ slotProps: {
848
+ listbox: { className: I.select__listbox },
849
+ popup: { className: I.select__popup }
850
+ },
851
+ "aria-labelledby": a,
852
+ children: o
853
+ }
854
+ );
855
+ };
856
+ xt.Option = ht;
857
+ export {
858
+ ht as Option,
859
+ xt as Select
860
+ };