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

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 (124) hide show
  1. package/README.md +17 -5
  2. package/dist/Button-B1umG8kJ.js +131 -0
  3. package/dist/ClickAwayListener-BKznXF1d.js +106 -0
  4. package/dist/Dialog.module-CGVM5V_D.js +15 -0
  5. package/dist/Portal-BcdMtRGF.js +73 -0
  6. package/dist/Tab-CRwnhsj5.js +254 -0
  7. package/dist/Tabs.module-yYcTJnj6.js +103 -0
  8. package/dist/_commonjsHelpers-CT_km90n.js +30 -0
  9. package/dist/assets/Advice.css +1 -0
  10. package/dist/assets/Button.css +1 -0
  11. package/dist/assets/Checkbox.css +1 -0
  12. package/dist/assets/Dialog.css +1 -1
  13. package/dist/assets/IconButton.css +1 -0
  14. package/dist/assets/Input.css +1 -0
  15. package/dist/assets/InputSearch.css +1 -0
  16. package/dist/assets/LoadingSpinner.css +1 -1
  17. package/dist/assets/PageHeader.css +1 -0
  18. package/dist/assets/Pagination.css +1 -0
  19. package/dist/assets/Skeleton.css +1 -0
  20. package/dist/assets/Snackbar.css +1 -0
  21. package/dist/assets/SortTooltip.css +1 -0
  22. package/dist/assets/Stepper.css +1 -0
  23. package/dist/assets/Table.css +1 -0
  24. package/dist/assets/Tabs.css +1 -0
  25. package/dist/assets/Toggle.css +1 -0
  26. package/dist/assets/Tooltip.css +1 -0
  27. package/dist/assets/Typography.css +1 -1
  28. package/dist/assets/global.css +1 -0
  29. package/dist/components/Advice/Advice.d.ts +16 -0
  30. package/dist/components/Advice/Advice.js +25 -0
  31. package/dist/components/Button/Button.d.ts +29 -0
  32. package/dist/components/Button/Button.js +70 -0
  33. package/dist/components/Button/Button.stories.d.ts +60 -0
  34. package/dist/components/Button/Button.stories.js +40 -0
  35. package/dist/components/Checkbox/Checkbox.d.ts +19 -0
  36. package/dist/components/Checkbox/Checkbox.js +56 -0
  37. package/dist/components/Dialog/Actions.js +1 -1
  38. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  39. package/dist/components/Dialog/Backdrop.js +2 -9
  40. package/dist/components/Dialog/CloseIconButton.js +11 -10
  41. package/dist/components/Dialog/Dialog.d.ts +5 -4
  42. package/dist/components/Dialog/Dialog.js +419 -20077
  43. package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
  44. package/dist/components/Dialog/Dialog.stories.js +59 -0
  45. package/dist/components/Dialog/Title.js +22 -7
  46. package/dist/components/Icon/Icon.d.ts +18 -0
  47. package/dist/components/Icon/Icon.js +95 -0
  48. package/dist/components/IconButton/IconButton.d.ts +22 -0
  49. package/dist/components/IconButton/IconButton.js +68 -0
  50. package/dist/components/Input/Input.d.ts +44 -0
  51. package/dist/components/Input/Input.js +497 -0
  52. package/dist/components/Input/Input.stories.d.ts +43 -0
  53. package/dist/components/Input/Input.stories.js +106 -0
  54. package/dist/components/InputSearch/InputSearch.d.ts +11 -0
  55. package/dist/components/InputSearch/InputSearch.js +29 -0
  56. package/dist/components/InputSearch/InputSearch.stories.d.ts +22 -0
  57. package/dist/components/InputSearch/InputSearch.stories.js +36 -0
  58. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
  59. package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
  60. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
  61. package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +38 -0
  62. package/dist/components/PageHeader/PageHeader.d.ts +36 -0
  63. package/dist/components/PageHeader/PageHeader.js +51 -0
  64. package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
  65. package/dist/components/PageHeader/PageHeader.stories.js +49 -0
  66. package/dist/components/Pagination/Pagination.d.ts +36 -0
  67. package/dist/components/Pagination/Pagination.js +219 -0
  68. package/dist/components/Skeleton/Skeleton.d.ts +18 -0
  69. package/dist/components/Skeleton/Skeleton.js +26 -0
  70. package/dist/components/Snackbar/Snackbar.d.ts +13 -0
  71. package/dist/components/Snackbar/Snackbar.js +622 -0
  72. package/dist/components/SortTooltip/SortTooltip.d.ts +26 -0
  73. package/dist/components/SortTooltip/SortTooltip.js +67 -0
  74. package/dist/components/Stepper/Stepper.d.ts +16 -0
  75. package/dist/components/Stepper/Stepper.js +33 -0
  76. package/dist/components/Table/Table.d.ts +39 -0
  77. package/dist/components/Table/Table.js +122 -0
  78. package/dist/components/Table/TableContext.d.ts +19 -0
  79. package/dist/components/Table/TableContext.js +21 -0
  80. package/dist/components/Tabs/Tab.d.ts +9 -0
  81. package/dist/components/Tabs/Tab.js +8 -0
  82. package/dist/components/Tabs/TabPanel.d.ts +8 -0
  83. package/dist/components/Tabs/TabPanel.js +118 -0
  84. package/dist/components/Tabs/Tabs.d.ts +11 -0
  85. package/dist/components/Tabs/Tabs.js +827 -0
  86. package/dist/components/Toggle/Toggle.d.ts +11 -0
  87. package/dist/components/Toggle/Toggle.js +252 -0
  88. package/dist/components/Toggle/Toggle.stories.d.ts +21 -0
  89. package/dist/components/Toggle/Toggle.stories.js +33 -0
  90. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  91. package/dist/components/Tooltip/Tooltip.js +1366 -0
  92. package/dist/components/Typography/Typography.d.ts +15 -6
  93. package/dist/components/Typography/Typography.js +75 -67
  94. package/dist/components/Typography/Typography.stories.d.ts +31 -0
  95. package/dist/components/Typography/Typography.stories.js +30 -0
  96. package/dist/components/Typography/typography.test.d.ts +1 -0
  97. package/dist/components/Typography/typography.test.js +11357 -0
  98. package/dist/index-BNWbc5Kh.js +19628 -0
  99. package/dist/index-CqjC7P5Y.js +814 -0
  100. package/dist/magic-string.es-O_8lTkE3.js +738 -0
  101. package/dist/main.d.ts +18 -2
  102. package/dist/main.js +57 -15
  103. package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +26 -0
  104. package/dist/test-utils/assertStyles.d.ts +1 -0
  105. package/dist/test-utils/assertStyles.js +11 -0
  106. package/dist/types/helpers.d.ts +14 -7
  107. package/dist/useButton-Bc8IAgyk.js +106 -0
  108. package/dist/useControlled-CCMYYdCM.js +31 -0
  109. package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
  110. package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
  111. package/dist/useTimeout-DxF9kiZL.js +36 -0
  112. package/dist/utils/styleStrings.d.ts +6 -0
  113. package/dist/utils/styleStrings.js +10 -0
  114. package/dist/utils/styleStrings.test.d.ts +1 -0
  115. package/dist/utils/styleStrings.test.js +41 -0
  116. package/dist/vi.Y_w82WR8-Df0JUamG.js +9860 -0
  117. package/package.json +53 -10
  118. package/dist/Button-REznN-RP.js +0 -1139
  119. package/dist/Dialog.module-BO0mdB7d.js +0 -15
  120. package/dist/assets/CallToActionButton.css +0 -1
  121. package/dist/assets/main.css +0 -1
  122. package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -23
  123. package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
  124. package/src/playground/Playground.tsx +0 -58
@@ -0,0 +1,827 @@
1
+ import { jsx as E } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { forwardRef as xe, useState as Ve } from "react";
4
+ import { c as Q, C as Z, T as Te, u as Ie, s as Se } from "../../Tabs.module-yYcTJnj6.js";
5
+ import { L as S, a as Re } from "../../Tab-CRwnhsj5.js";
6
+ import { T as bt } from "../../Tab-CRwnhsj5.js";
7
+ import { TabPanel as vt } from "./TabPanel.js";
8
+ import { a as b, _ as ee } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
9
+ import { u as we, e as Pe, g as te, a as ne, b as oe, P as v, c as le, d as se } from "../../index-CqjC7P5Y.js";
10
+ import { u as ye } from "../../useControlled-CCMYYdCM.js";
11
+ function J(t, e, l = (n, o) => n === o) {
12
+ return t.length === e.length && t.every((n, o) => l(n, e[o]));
13
+ }
14
+ function De(t, e) {
15
+ return t === e;
16
+ }
17
+ const W = {}, Y = () => {
18
+ };
19
+ function q(t, e) {
20
+ const l = b({}, t);
21
+ return Object.keys(e).forEach((n) => {
22
+ e[n] !== void 0 && (l[n] = e[n]);
23
+ }), l;
24
+ }
25
+ function Ee(t) {
26
+ const {
27
+ nextState: e,
28
+ initialState: l,
29
+ stateComparers: n,
30
+ onStateChange: o,
31
+ controlledProps: a,
32
+ lastActionRef: s
33
+ } = t, u = i.useRef(l);
34
+ i.useEffect(() => {
35
+ if (s.current === null)
36
+ return;
37
+ const r = q(u.current, a);
38
+ Object.keys(e).forEach((d) => {
39
+ var m;
40
+ const g = (m = n[d]) != null ? m : De, h = e[d], f = r[d];
41
+ if (f == null && h != null || f != null && h == null || f != null && h != null && !g(h, f)) {
42
+ var c, C;
43
+ o == null || o((c = s.current.event) != null ? c : null, d, h, (C = s.current.type) != null ? C : "", e);
44
+ }
45
+ }), u.current = e, s.current = null;
46
+ }, [u, e, s, o, n, a]);
47
+ }
48
+ function Me(t) {
49
+ const e = i.useRef(null), {
50
+ reducer: l,
51
+ initialState: n,
52
+ controlledProps: o = W,
53
+ stateComparers: a = W,
54
+ onStateChange: s = Y,
55
+ actionContext: u,
56
+ componentName: r = ""
57
+ } = t, d = i.useRef(o);
58
+ process.env.NODE_ENV !== "production" && i.useEffect(() => {
59
+ Object.keys(o).forEach((c) => {
60
+ d.current[c] !== void 0 && o[c] === void 0 && console.error(`useControllableReducer: ${r ? `The ${r} component` : "A component"} is changing a controlled prop to be uncontrolled: ${c}`), d.current[c] === void 0 && o[c] !== void 0 && console.error(`useControllableReducer: ${r ? `The ${r} component` : "A component"} is changing an uncontrolled prop to be controlled: ${c}`);
61
+ });
62
+ }, [o, r]);
63
+ const m = i.useCallback((c, C) => {
64
+ e.current = C;
65
+ const V = q(c, o);
66
+ return l(V, C);
67
+ }, [o, l]), [g, h] = i.useReducer(m, n), f = i.useCallback((c) => {
68
+ h(b({}, c, {
69
+ context: u
70
+ }));
71
+ }, [u]);
72
+ return Ee({
73
+ nextState: g,
74
+ initialState: n,
75
+ stateComparers: a ?? W,
76
+ onStateChange: s ?? Y,
77
+ controlledProps: o,
78
+ lastActionRef: e
79
+ }), [q(g, o), f];
80
+ }
81
+ function Oe(t, e, l, n, o, a) {
82
+ if (l.length === 0 || !n && l.every((u, r) => o(u, r)))
83
+ return -1;
84
+ let s = t;
85
+ for (; ; ) {
86
+ if (!a && e === "next" && s === l.length || !a && e === "previous" && s === -1)
87
+ return -1;
88
+ if (n ? !1 : o(l[s], s))
89
+ s += e === "next" ? 1 : -1, a && (s = (s + l.length) % l.length);
90
+ else
91
+ return s;
92
+ }
93
+ }
94
+ function w(t, e, l) {
95
+ var n;
96
+ const {
97
+ items: o,
98
+ isItemDisabled: a,
99
+ disableListWrap: s,
100
+ disabledItemsFocusable: u,
101
+ itemComparer: r,
102
+ focusManagement: d
103
+ } = l, m = d === "DOM" ? 0 : -1, g = o.length - 1, h = t == null ? -1 : o.findIndex((T) => r(T, t));
104
+ let f, c, C = !s;
105
+ switch (e) {
106
+ case "reset":
107
+ if (m === -1)
108
+ return null;
109
+ f = 0, c = "next", C = !1;
110
+ break;
111
+ case "start":
112
+ f = 0, c = "next", C = !1;
113
+ break;
114
+ case "end":
115
+ f = g, c = "previous", C = !1;
116
+ break;
117
+ default: {
118
+ const T = h + e;
119
+ T < 0 ? !C && h !== -1 || Math.abs(e) > 1 ? (f = 0, c = "next") : (f = g, c = "previous") : T > g ? !C || Math.abs(e) > 1 ? (f = g, c = "previous") : (f = 0, c = "next") : (f = T, c = e >= 0 ? "next" : "previous");
120
+ }
121
+ }
122
+ const V = Oe(f, c, o, u, a, C);
123
+ return V === -1 && t !== null && !a(t, h) ? t : (n = o[V]) != null ? n : null;
124
+ }
125
+ function ke(t, e, l, n) {
126
+ return l === "none" ? [] : l === "single" ? n(e[0], t) ? e : [t] : e.some((o) => n(o, t)) ? e.filter((o) => !n(o, t)) : [...e, t];
127
+ }
128
+ function re(t, e, l) {
129
+ const {
130
+ itemComparer: n,
131
+ isItemDisabled: o,
132
+ selectionMode: a,
133
+ items: s
134
+ } = l, {
135
+ selectedValues: u
136
+ } = e, r = s.findIndex((m) => n(t, m));
137
+ if (o(t, r))
138
+ return e;
139
+ const d = ke(t, u, a, n);
140
+ return b({}, e, {
141
+ selectedValues: d,
142
+ highlightedValue: t
143
+ });
144
+ }
145
+ function Le(t, e, l) {
146
+ const n = e.highlightedValue, {
147
+ orientation: o,
148
+ pageSize: a
149
+ } = l;
150
+ switch (t) {
151
+ case "Home":
152
+ return b({}, e, {
153
+ highlightedValue: w(n, "start", l)
154
+ });
155
+ case "End":
156
+ return b({}, e, {
157
+ highlightedValue: w(n, "end", l)
158
+ });
159
+ case "PageUp":
160
+ return b({}, e, {
161
+ highlightedValue: w(n, -a, l)
162
+ });
163
+ case "PageDown":
164
+ return b({}, e, {
165
+ highlightedValue: w(n, a, l)
166
+ });
167
+ case "ArrowUp":
168
+ if (o !== "vertical")
169
+ break;
170
+ return b({}, e, {
171
+ highlightedValue: w(n, -1, l)
172
+ });
173
+ case "ArrowDown":
174
+ if (o !== "vertical")
175
+ break;
176
+ return b({}, e, {
177
+ highlightedValue: w(n, 1, l)
178
+ });
179
+ case "ArrowLeft": {
180
+ if (o === "vertical")
181
+ break;
182
+ return b({}, e, {
183
+ highlightedValue: w(n, o === "horizontal-ltr" ? -1 : 1, l)
184
+ });
185
+ }
186
+ case "ArrowRight": {
187
+ if (o === "vertical")
188
+ break;
189
+ return b({}, e, {
190
+ highlightedValue: w(n, o === "horizontal-ltr" ? 1 : -1, l)
191
+ });
192
+ }
193
+ case "Enter":
194
+ case " ":
195
+ return e.highlightedValue === null ? e : re(e.highlightedValue, e, l);
196
+ }
197
+ return e;
198
+ }
199
+ function Ne(t, e) {
200
+ return e.focusManagement === "DOM" ? t : b({}, t, {
201
+ highlightedValue: null
202
+ });
203
+ }
204
+ function $e(t, e, l) {
205
+ var n;
206
+ const o = (n = l(t)) == null ? void 0 : n.trim().toLowerCase();
207
+ return !o || o.length === 0 ? !1 : o.indexOf(e) === 0;
208
+ }
209
+ function _e(t, e, l) {
210
+ const {
211
+ items: n,
212
+ isItemDisabled: o,
213
+ disabledItemsFocusable: a,
214
+ getItemAsString: s
215
+ } = l, u = e.length > 1;
216
+ let r = u ? t.highlightedValue : w(t.highlightedValue, 1, l);
217
+ for (let d = 0; d < n.length; d += 1) {
218
+ if (!r || !u && t.highlightedValue === r)
219
+ return t;
220
+ if ($e(r, e, s) && (!o(r, n.indexOf(r)) || a))
221
+ return b({}, t, {
222
+ highlightedValue: r
223
+ });
224
+ r = w(r, 1, l);
225
+ }
226
+ return t;
227
+ }
228
+ function Ae(t, e, l, n) {
229
+ var o;
230
+ const {
231
+ itemComparer: a,
232
+ focusManagement: s
233
+ } = n;
234
+ let u = null;
235
+ if (l.highlightedValue != null) {
236
+ var r;
237
+ u = (r = t.find((g) => a(g, l.highlightedValue))) != null ? r : null;
238
+ } else
239
+ s === "DOM" && e.length === 0 && (u = w(null, "reset", n));
240
+ const m = ((o = l.selectedValues) != null ? o : []).filter((g) => t.some((h) => a(h, g)));
241
+ return b({}, l, {
242
+ highlightedValue: u,
243
+ selectedValues: m
244
+ });
245
+ }
246
+ function Fe(t, e) {
247
+ return b({}, t, {
248
+ highlightedValue: w(null, "reset", e)
249
+ });
250
+ }
251
+ function He(t, e) {
252
+ return b({}, t, {
253
+ highlightedValue: w(null, "end", e)
254
+ });
255
+ }
256
+ function ze(t, e) {
257
+ return b({}, t, {
258
+ selectedValues: [],
259
+ highlightedValue: w(null, "reset", e)
260
+ });
261
+ }
262
+ function ae(t, e) {
263
+ const {
264
+ type: l,
265
+ context: n
266
+ } = e;
267
+ switch (l) {
268
+ case S.keyDown:
269
+ return Le(e.key, t, n);
270
+ case S.itemClick:
271
+ return re(e.item, t, n);
272
+ case S.blur:
273
+ return Ne(t, n);
274
+ case S.textNavigation:
275
+ return _e(t, e.searchString, n);
276
+ case S.itemsChange:
277
+ return Ae(e.items, e.previousItems, t, n);
278
+ case S.resetHighlight:
279
+ return Fe(t, n);
280
+ case S.highlightLast:
281
+ return He(t, n);
282
+ case S.clearSelection:
283
+ return ze(t, n);
284
+ default:
285
+ return t;
286
+ }
287
+ }
288
+ const Ue = 500;
289
+ function je(t) {
290
+ const e = i.useRef({
291
+ searchString: "",
292
+ lastTime: null
293
+ });
294
+ return i.useCallback((l) => {
295
+ if (l.key.length === 1 && l.key !== " ") {
296
+ const n = e.current, o = l.key.toLowerCase(), a = performance.now();
297
+ n.searchString.length > 0 && n.lastTime && a - n.lastTime > Ue ? n.searchString = o : (n.searchString.length !== 1 || o !== n.searchString) && (n.searchString += o), n.lastTime = a, t(n.searchString, l);
298
+ }
299
+ }, [t]);
300
+ }
301
+ const X = {}, Be = () => {
302
+ }, Ke = (t, e) => t === e, We = () => !1, qe = (t) => typeof t == "string" ? t : String(t), Ge = () => ({
303
+ highlightedValue: null,
304
+ selectedValues: []
305
+ });
306
+ function Je(t) {
307
+ const {
308
+ controlledProps: e = X,
309
+ disabledItemsFocusable: l = !1,
310
+ disableListWrap: n = !1,
311
+ focusManagement: o = "activeDescendant",
312
+ getInitialState: a = Ge,
313
+ getItemDomElement: s,
314
+ getItemId: u,
315
+ isItemDisabled: r = We,
316
+ rootRef: d,
317
+ onStateChange: m = Be,
318
+ items: g,
319
+ itemComparer: h = Ke,
320
+ getItemAsString: f = qe,
321
+ onChange: c,
322
+ onHighlightChange: C,
323
+ onItemsChange: V,
324
+ orientation: T = "vertical",
325
+ pageSize: $ = 5,
326
+ reducerActionContext: L = X,
327
+ selectionMode: O = "single",
328
+ stateReducer: _,
329
+ componentName: U = "useList"
330
+ } = t;
331
+ if (process.env.NODE_ENV !== "production") {
332
+ if (o === "DOM" && s == null)
333
+ throw new Error("useList: The `getItemDomElement` prop is required when using the `DOM` focus management.");
334
+ if (o === "activeDescendant" && u == null)
335
+ throw new Error("useList: The `getItemId` prop is required when using the `activeDescendant` focus management.");
336
+ }
337
+ const A = i.useRef(null), F = we(d, A), k = i.useCallback((x, p, I) => {
338
+ if (C == null || C(x, p, I), o === "DOM" && p != null && (I === S.itemClick || I === S.keyDown || I === S.textNavigation)) {
339
+ var R;
340
+ s == null || (R = s(p)) == null || R.focus();
341
+ }
342
+ }, [s, C, o]), H = i.useMemo(() => ({
343
+ highlightedValue: h,
344
+ selectedValues: (x, p) => J(x, p, h)
345
+ }), [h]), P = i.useCallback((x, p, I, R, z) => {
346
+ switch (m == null || m(x, p, I, R, z), p) {
347
+ case "highlightedValue":
348
+ k(x, I, R);
349
+ break;
350
+ case "selectedValues":
351
+ c == null || c(x, I, R);
352
+ break;
353
+ }
354
+ }, [k, c, m]), y = i.useMemo(() => ({
355
+ disabledItemsFocusable: l,
356
+ disableListWrap: n,
357
+ focusManagement: o,
358
+ isItemDisabled: r,
359
+ itemComparer: h,
360
+ items: g,
361
+ getItemAsString: f,
362
+ onHighlightChange: k,
363
+ orientation: T,
364
+ pageSize: $,
365
+ selectionMode: O,
366
+ stateComparers: H
367
+ }), [l, n, o, r, h, g, f, k, T, $, O, H]), D = a(), ge = _ ?? ae, fe = i.useMemo(() => b({}, L, y), [L, y]), [j, M] = Me({
368
+ reducer: ge,
369
+ actionContext: fe,
370
+ initialState: D,
371
+ controlledProps: e,
372
+ stateComparers: H,
373
+ onStateChange: P,
374
+ componentName: U
375
+ }), {
376
+ highlightedValue: N,
377
+ selectedValues: B
378
+ } = j, me = je((x, p) => M({
379
+ type: S.textNavigation,
380
+ event: p,
381
+ searchString: x
382
+ })), K = i.useRef([]);
383
+ i.useEffect(() => {
384
+ J(K.current, g, h) || (M({
385
+ type: S.itemsChange,
386
+ event: null,
387
+ items: g,
388
+ previousItems: K.current
389
+ }), K.current = g, V == null || V(g));
390
+ }, [g, h, M, V]);
391
+ const pe = (x) => (p) => {
392
+ var I;
393
+ if ((I = x.onKeyDown) == null || I.call(x, p), p.defaultMuiPrevented)
394
+ return;
395
+ const R = ["Home", "End", "PageUp", "PageDown"];
396
+ T === "vertical" ? R.push("ArrowUp", "ArrowDown") : R.push("ArrowLeft", "ArrowRight"), o === "activeDescendant" && R.push(" ", "Enter"), R.includes(p.key) && p.preventDefault(), M({
397
+ type: S.keyDown,
398
+ key: p.key,
399
+ event: p
400
+ }), me(p);
401
+ }, be = (x) => (p) => {
402
+ var I, R;
403
+ (I = x.onBlur) == null || I.call(x, p), !p.defaultMuiPrevented && ((R = A.current) != null && R.contains(p.relatedTarget) || M({
404
+ type: S.blur,
405
+ event: p
406
+ }));
407
+ }, Ce = (x = {}) => {
408
+ const p = Pe(x);
409
+ return b({}, x, {
410
+ "aria-activedescendant": o === "activeDescendant" && N != null ? u(N) : void 0,
411
+ tabIndex: o === "DOM" ? -1 : 0,
412
+ ref: F
413
+ }, p, {
414
+ onBlur: be(p),
415
+ onKeyDown: pe(p)
416
+ });
417
+ }, G = i.useCallback((x) => {
418
+ const p = (B ?? []).some((z) => z != null && h(x, z)), I = N != null && h(x, N);
419
+ return {
420
+ focusable: o === "DOM",
421
+ highlighted: I,
422
+ selected: p
423
+ };
424
+ }, [h, B, N, o]), ve = i.useMemo(() => ({
425
+ dispatch: M,
426
+ getItemState: G
427
+ }), [M, G]);
428
+ return i.useDebugValue({
429
+ state: j
430
+ }), {
431
+ contextValue: ve,
432
+ dispatch: M,
433
+ getRootProps: Ce,
434
+ rootRef: F,
435
+ state: j
436
+ };
437
+ }
438
+ const ie = "Tabs";
439
+ function Ye(t) {
440
+ return te(ie, t);
441
+ }
442
+ ne(ie, ["root", "horizontal", "vertical"]);
443
+ function Xe(t) {
444
+ const {
445
+ value: e,
446
+ defaultValue: l,
447
+ onChange: n,
448
+ orientation: o = "horizontal",
449
+ direction: a = "ltr",
450
+ selectionFollowsFocus: s = !1
451
+ } = t, [u, r] = ye({
452
+ controlled: e,
453
+ default: l,
454
+ name: "Tabs",
455
+ state: "value"
456
+ }), d = i.useCallback((V, T) => {
457
+ r(T), n == null || n(V, T);
458
+ }, [n, r]), {
459
+ subitems: m,
460
+ contextValue: g
461
+ } = Q(), h = i.useRef(() => {
462
+ }), f = i.useCallback((V) => {
463
+ var T;
464
+ return (T = m.get(V)) == null ? void 0 : T.id;
465
+ }, [m]), c = i.useCallback((V) => h.current(V), []), C = i.useCallback((V) => {
466
+ h.current = V;
467
+ }, []);
468
+ return {
469
+ contextValue: b({
470
+ direction: a,
471
+ getTabId: c,
472
+ getTabPanelId: f,
473
+ onSelected: d,
474
+ orientation: o,
475
+ registerTabIdLookup: C,
476
+ selectionFollowsFocus: s,
477
+ value: u
478
+ }, g)
479
+ };
480
+ }
481
+ function Qe(t) {
482
+ const {
483
+ value: e,
484
+ children: l
485
+ } = t, {
486
+ direction: n,
487
+ getItemIndex: o,
488
+ onSelected: a,
489
+ orientation: s,
490
+ registerItem: u,
491
+ registerTabIdLookup: r,
492
+ selectionFollowsFocus: d,
493
+ totalSubitemCount: m,
494
+ value: g,
495
+ getTabId: h,
496
+ getTabPanelId: f
497
+ } = e, c = i.useMemo(() => ({
498
+ getItemIndex: o,
499
+ registerItem: u,
500
+ totalSubitemCount: m
501
+ }), [u, o, m]), C = i.useMemo(() => ({
502
+ direction: n,
503
+ getTabId: h,
504
+ getTabPanelId: f,
505
+ onSelected: a,
506
+ orientation: s,
507
+ registerTabIdLookup: r,
508
+ selectionFollowsFocus: d,
509
+ value: g
510
+ }), [n, h, f, a, s, r, d, g]);
511
+ return /* @__PURE__ */ E(Z.Provider, {
512
+ value: c,
513
+ children: /* @__PURE__ */ E(Te.Provider, {
514
+ value: C,
515
+ children: l
516
+ })
517
+ });
518
+ }
519
+ const Ze = ["children", "value", "defaultValue", "orientation", "direction", "onChange", "selectionFollowsFocus", "slotProps", "slots"], et = (t) => {
520
+ const {
521
+ orientation: e
522
+ } = t;
523
+ return le({
524
+ root: ["root", e]
525
+ }, se(Ye));
526
+ }, ue = /* @__PURE__ */ i.forwardRef(function(e, l) {
527
+ var n;
528
+ const {
529
+ children: o,
530
+ orientation: a = "horizontal",
531
+ direction: s = "ltr",
532
+ slotProps: u = {},
533
+ slots: r = {}
534
+ } = e, d = ee(e, Ze), m = b({}, e, {
535
+ orientation: a,
536
+ direction: s
537
+ }), {
538
+ contextValue: g
539
+ } = Xe(m), h = et(m), f = (n = r.root) != null ? n : "div", c = oe({
540
+ elementType: f,
541
+ externalSlotProps: u.root,
542
+ externalForwardedProps: d,
543
+ additionalProps: {
544
+ ref: l
545
+ },
546
+ ownerState: m,
547
+ className: h.root
548
+ });
549
+ return /* @__PURE__ */ E(f, b({}, c, {
550
+ children: /* @__PURE__ */ E(Qe, {
551
+ value: g,
552
+ children: o
553
+ })
554
+ }));
555
+ });
556
+ process.env.NODE_ENV !== "production" && (ue.propTypes = {
557
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
558
+ // │ These PropTypes are generated from the TypeScript type definitions. │
559
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
560
+ // └─────────────────────────────────────────────────────────────────────┘
561
+ /**
562
+ * The content of the component.
563
+ */
564
+ children: v.node,
565
+ /**
566
+ * @ignore
567
+ */
568
+ className: v.string,
569
+ /**
570
+ * The default value. Use when the component is not controlled.
571
+ */
572
+ defaultValue: v.oneOfType([v.number, v.string]),
573
+ /**
574
+ * The direction of the text.
575
+ * @default 'ltr'
576
+ */
577
+ direction: v.oneOf(["ltr", "rtl"]),
578
+ /**
579
+ * Callback invoked when new value is being set.
580
+ */
581
+ onChange: v.func,
582
+ /**
583
+ * The component orientation (layout flow direction).
584
+ * @default 'horizontal'
585
+ */
586
+ orientation: v.oneOf(["horizontal", "vertical"]),
587
+ /**
588
+ * If `true` the selected tab changes on focus. Otherwise it only
589
+ * changes on activation.
590
+ */
591
+ selectionFollowsFocus: v.bool,
592
+ /**
593
+ * The props used for each slot inside the Tabs.
594
+ * @default {}
595
+ */
596
+ slotProps: v.shape({
597
+ root: v.oneOfType([v.func, v.object])
598
+ }),
599
+ /**
600
+ * The components used for each slot inside the Tabs.
601
+ * Either a string to use a HTML element or a component.
602
+ * @default {}
603
+ */
604
+ slots: v.shape({
605
+ root: v.elementType
606
+ }),
607
+ /**
608
+ * The value of the currently selected `Tab`.
609
+ * If you don't want any selected `Tab`, you can set this prop to `null`.
610
+ */
611
+ value: v.oneOfType([v.number, v.string])
612
+ });
613
+ const ce = "TabsList";
614
+ function tt(t) {
615
+ return te(ce, t);
616
+ }
617
+ ne(ce, ["root", "horizontal", "vertical"]);
618
+ const de = {
619
+ valueChange: "valueChange"
620
+ };
621
+ function nt(t, e) {
622
+ if (e.type === de.valueChange)
623
+ return b({}, t, {
624
+ highlightedValue: e.value
625
+ });
626
+ const l = ae(t, e), {
627
+ context: {
628
+ selectionFollowsFocus: n
629
+ }
630
+ } = e;
631
+ if (e.type === S.itemsChange) {
632
+ if (l.selectedValues.length > 0)
633
+ return b({}, l, {
634
+ highlightedValue: l.selectedValues[0]
635
+ });
636
+ w(null, "reset", e.context);
637
+ }
638
+ return n && l.highlightedValue != null ? b({}, l, {
639
+ selectedValues: [l.highlightedValue]
640
+ }) : l;
641
+ }
642
+ function ot(t) {
643
+ var e;
644
+ const {
645
+ rootRef: l
646
+ } = t, {
647
+ direction: n = "ltr",
648
+ onSelected: o,
649
+ orientation: a = "horizontal",
650
+ value: s,
651
+ registerTabIdLookup: u,
652
+ selectionFollowsFocus: r
653
+ } = Ie(), {
654
+ subitems: d,
655
+ contextValue: m
656
+ } = Q(), g = i.useCallback((P) => {
657
+ var y;
658
+ return (y = d.get(P)) == null ? void 0 : y.id;
659
+ }, [d]);
660
+ u(g);
661
+ const h = i.useMemo(() => Array.from(d.keys()), [d]), f = i.useCallback((P) => {
662
+ var y, D;
663
+ return P == null ? null : (y = (D = d.get(P)) == null ? void 0 : D.ref.current) != null ? y : null;
664
+ }, [d]), c = n === "rtl";
665
+ let C;
666
+ a === "vertical" ? C = "vertical" : C = c ? "horizontal-rtl" : "horizontal-ltr";
667
+ const V = i.useCallback((P, y) => {
668
+ var D;
669
+ o(P, (D = y[0]) != null ? D : null);
670
+ }, [o]), T = i.useMemo(() => s === void 0 ? {} : s != null ? {
671
+ selectedValues: [s]
672
+ } : {
673
+ selectedValues: []
674
+ }, [s]), $ = i.useCallback((P) => {
675
+ var y, D;
676
+ return (y = (D = d.get(P)) == null ? void 0 : D.disabled) != null ? y : !1;
677
+ }, [d]), {
678
+ contextValue: L,
679
+ dispatch: O,
680
+ getRootProps: _,
681
+ state: {
682
+ highlightedValue: U,
683
+ selectedValues: A
684
+ },
685
+ rootRef: F
686
+ } = Je({
687
+ controlledProps: T,
688
+ disabledItemsFocusable: !r,
689
+ focusManagement: "DOM",
690
+ getItemDomElement: f,
691
+ isItemDisabled: $,
692
+ items: h,
693
+ rootRef: l,
694
+ onChange: V,
695
+ orientation: C,
696
+ reducerActionContext: i.useMemo(() => ({
697
+ selectionFollowsFocus: r || !1
698
+ }), [r]),
699
+ selectionMode: "single",
700
+ stateReducer: nt
701
+ });
702
+ i.useEffect(() => {
703
+ s !== void 0 && s != null && O({
704
+ type: de.valueChange,
705
+ value: s
706
+ });
707
+ }, [O, s]);
708
+ const k = (P = {}) => b({}, P, _(P), {
709
+ "aria-orientation": a === "vertical" ? "vertical" : void 0,
710
+ role: "tablist"
711
+ });
712
+ return {
713
+ contextValue: i.useMemo(() => b({}, m, L), [m, L]),
714
+ dispatch: O,
715
+ getRootProps: k,
716
+ highlightedValue: U,
717
+ isRtl: c,
718
+ orientation: a,
719
+ rootRef: F,
720
+ selectedValue: (e = A[0]) != null ? e : null
721
+ };
722
+ }
723
+ function lt(t) {
724
+ const {
725
+ value: e,
726
+ children: l
727
+ } = t, {
728
+ dispatch: n,
729
+ getItemIndex: o,
730
+ getItemState: a,
731
+ registerItem: s,
732
+ totalSubitemCount: u
733
+ } = e, r = i.useMemo(() => ({
734
+ dispatch: n,
735
+ getItemState: a,
736
+ getItemIndex: o
737
+ }), [n, o, a]), d = i.useMemo(() => ({
738
+ getItemIndex: o,
739
+ registerItem: s,
740
+ totalSubitemCount: u
741
+ }), [s, o, u]);
742
+ return /* @__PURE__ */ E(Z.Provider, {
743
+ value: d,
744
+ children: /* @__PURE__ */ E(Re.Provider, {
745
+ value: r,
746
+ children: l
747
+ })
748
+ });
749
+ }
750
+ const st = ["children", "slotProps", "slots"], rt = (t) => {
751
+ const {
752
+ orientation: e
753
+ } = t;
754
+ return le({
755
+ root: ["root", e]
756
+ }, se(tt));
757
+ }, he = /* @__PURE__ */ i.forwardRef(function(e, l) {
758
+ var n;
759
+ const {
760
+ children: o,
761
+ slotProps: a = {},
762
+ slots: s = {}
763
+ } = e, u = ee(e, st), {
764
+ isRtl: r,
765
+ orientation: d,
766
+ getRootProps: m,
767
+ contextValue: g
768
+ } = ot({
769
+ rootRef: l
770
+ }), h = b({}, e, {
771
+ isRtl: r,
772
+ orientation: d
773
+ }), f = rt(h), c = (n = s.root) != null ? n : "div", C = oe({
774
+ elementType: c,
775
+ getSlotProps: m,
776
+ externalSlotProps: a.root,
777
+ externalForwardedProps: u,
778
+ ownerState: h,
779
+ className: f.root
780
+ });
781
+ return /* @__PURE__ */ E(lt, {
782
+ value: g,
783
+ children: /* @__PURE__ */ E(c, b({}, C, {
784
+ children: o
785
+ }))
786
+ });
787
+ });
788
+ process.env.NODE_ENV !== "production" && (he.propTypes = {
789
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
790
+ // │ These PropTypes are generated from the TypeScript type definitions. │
791
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
792
+ // └─────────────────────────────────────────────────────────────────────┘
793
+ /**
794
+ * The content of the component.
795
+ */
796
+ children: v.node,
797
+ /**
798
+ * @ignore
799
+ */
800
+ className: v.string,
801
+ /**
802
+ * The props used for each slot inside the TabsList.
803
+ * @default {}
804
+ */
805
+ slotProps: v.shape({
806
+ root: v.oneOfType([v.func, v.object])
807
+ }),
808
+ /**
809
+ * The components used for each slot inside the TabsList.
810
+ * Either a string to use a HTML element or a component.
811
+ * @default {}
812
+ */
813
+ slots: v.shape({
814
+ root: v.elementType
815
+ })
816
+ });
817
+ const ft = xe(({ children: t, onChange: e, dataTestId: l }, n) => {
818
+ const [o, a] = Ve("1");
819
+ return /* @__PURE__ */ E(ue, { "data-testid": l, value: o, onChange: (u, r) => {
820
+ a(r), e && e(r, u);
821
+ }, ref: n, children: /* @__PURE__ */ E(he, { className: Se.tabs, children: t }) });
822
+ });
823
+ export {
824
+ bt as Tab,
825
+ vt as TabPanel,
826
+ ft as Tabs
827
+ };