@pismo/marola 0.0.1-alpha.9 → 1.0.0-beta.1

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