@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
package/README.md CHANGED
@@ -1,23 +1,35 @@
1
1
  # Marola - component library
2
- ![Marola logo](./src/assets/marolaLogo.png)
2
+
3
+ ![Marola logo](./public/marolaLogo.png)
3
4
 
4
5
  ### Commands
5
6
 
6
- `yarn dev` - run the playground, launches a server where a developer can test and develop components, watches for file
7
+ `yarn dev` - run the playground, launches a server where a developer can test and develop components, watches for file
7
8
  changes
8
9
 
9
10
  `yarn build` - builds the components ready for publish
10
11
 
11
- `yarn test` - not yet implemented
12
+ `yarn test` - calls off to yarn test:unit
13
+
14
+ `yarn test:unit` - runs vitest for unit tests
15
+
16
+ `yarn test:unit:visual` - runs vitest for unit tests in a browser, then when tests are run it will show the output in
17
+ browser
18
+
19
+ `yarn test:unit:watch` - runs vitest and watches for any change and reruns
12
20
 
13
21
  `yarn lint` - performs an eslint across the project code and reports any problems in the terminal
14
22
 
15
- `yarn preview` - runs `build` and serves the files in the `dist` serves what would be in a `publish`
23
+ `yarn preview` - runs `build` and serves the files in the `dist` serves what would be in a `publish`
16
24
 
17
25
  `yarn publish` - runs a prePublish build (the `build` command) then publishes the contents of the `dist` directory
18
26
 
27
+ `yarn storybook` - start storybook
28
+
29
+ `yarn build-storybook` - build storybook static files
30
+
19
31
  ### Tips
20
32
 
21
33
  #### Node version
22
34
 
23
- This project uses a .nvmrc file, to auto switch node version follow [these steps](https://github.com/nvm-sh/nvm?tab=readme-ov-file#zsh) from the nvm project .
35
+ This project uses a .nvmrc file, to auto switch node version follow [these steps](https://github.com/nvm-sh/nvm?tab=readme-ov-file#zsh) from the nvm project .
@@ -0,0 +1,131 @@
1
+ import { _ as T, a as i } from "./objectWithoutPropertiesLoose-D7Cp0Pg_.js";
2
+ import * as c from "react";
3
+ import { g as _, a as x, b as B, P as o, c as O, d as D } from "./index-CqjC7P5Y.js";
4
+ import { jsx as F } from "react/jsx-runtime";
5
+ import { u as S } from "./useButton-Bc8IAgyk.js";
6
+ const m = "Button";
7
+ function U(s) {
8
+ return _(m, s);
9
+ }
10
+ x(m, ["root", "active", "disabled", "focusVisible"]);
11
+ const W = ["action", "children", "disabled", "focusableWhenDisabled", "onFocusVisible", "slotProps", "slots", "rootElementName"], j = (s) => {
12
+ const {
13
+ active: e,
14
+ disabled: n,
15
+ focusVisible: r
16
+ } = s;
17
+ return O({
18
+ root: ["root", n && "disabled", r && "focusVisible", e && "active"]
19
+ }, D(U));
20
+ }, w = /* @__PURE__ */ c.forwardRef(function(e, n) {
21
+ var r;
22
+ const {
23
+ action: u,
24
+ children: h,
25
+ focusableWhenDisabled: f = !1,
26
+ slotProps: P = {},
27
+ slots: l = {},
28
+ rootElementName: N = "button"
29
+ } = e, t = T(e, W), g = c.useRef();
30
+ let a = N;
31
+ typeof l.root == "string" ? a = l.root : (t.href || t.to) && (a = "a");
32
+ const {
33
+ active: y,
34
+ focusVisible: E,
35
+ setFocusVisible: d,
36
+ getRootProps: V
37
+ } = S(i({}, e, {
38
+ focusableWhenDisabled: f,
39
+ rootElementName: a
40
+ }));
41
+ c.useImperativeHandle(u, () => ({
42
+ focusVisible: () => {
43
+ d(!0), g.current.focus();
44
+ }
45
+ }), [d]);
46
+ const p = i({}, e, {
47
+ active: y,
48
+ focusableWhenDisabled: f,
49
+ focusVisible: E
50
+ }), v = j(p), C = t.href || t.to ? "a" : "button", b = (r = l.root) != null ? r : C, R = B({
51
+ elementType: b,
52
+ getSlotProps: V,
53
+ externalForwardedProps: t,
54
+ externalSlotProps: P.root,
55
+ additionalProps: {
56
+ ref: n
57
+ },
58
+ ownerState: p,
59
+ className: v.root
60
+ });
61
+ return /* @__PURE__ */ F(b, i({}, R, {
62
+ children: h
63
+ }));
64
+ });
65
+ process.env.NODE_ENV !== "production" && (w.propTypes = {
66
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
67
+ // │ These PropTypes are generated from the TypeScript type definitions. │
68
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
69
+ // └─────────────────────────────────────────────────────────────────────┘
70
+ /**
71
+ * A ref for imperative actions. It currently only supports `focusVisible()` action.
72
+ */
73
+ action: o.oneOfType([o.func, o.shape({
74
+ current: o.shape({
75
+ focusVisible: o.func.isRequired
76
+ })
77
+ })]),
78
+ /**
79
+ * @ignore
80
+ */
81
+ children: o.node,
82
+ /**
83
+ * @ignore
84
+ */
85
+ className: o.string,
86
+ /**
87
+ * If `true`, the component is disabled.
88
+ * @default false
89
+ */
90
+ disabled: o.bool,
91
+ /**
92
+ * If `true`, allows a disabled button to receive focus.
93
+ * @default false
94
+ */
95
+ focusableWhenDisabled: o.bool,
96
+ /**
97
+ * @ignore
98
+ */
99
+ href: o.string,
100
+ /**
101
+ * @ignore
102
+ */
103
+ onFocusVisible: o.func,
104
+ /**
105
+ * The HTML element that is ultimately rendered, for example 'button' or 'a'
106
+ * @default 'button'
107
+ */
108
+ rootElementName: o.string,
109
+ /**
110
+ * The props used for each slot inside the Button.
111
+ * @default {}
112
+ */
113
+ slotProps: o.shape({
114
+ root: o.oneOfType([o.func, o.object])
115
+ }),
116
+ /**
117
+ * The components used for each slot inside the Button.
118
+ * Either a string to use a HTML element or a component.
119
+ * @default {}
120
+ */
121
+ slots: o.shape({
122
+ root: o.elementType
123
+ }),
124
+ /**
125
+ * @ignore
126
+ */
127
+ to: o.string
128
+ });
129
+ export {
130
+ w as B
131
+ };
@@ -0,0 +1,106 @@
1
+ import * as t from "react";
2
+ import { u as C, P as f } from "./index-CqjC7P5Y.js";
3
+ import { jsx as w } from "react/jsx-runtime";
4
+ import { u as L, o as h, e as b, a as g } from "./index-BNWbc5Kh.js";
5
+ function T(c) {
6
+ return c.substring(2).toLowerCase();
7
+ }
8
+ function D(c, s) {
9
+ return s.documentElement.clientWidth < c.clientX || s.documentElement.clientHeight < c.clientY;
10
+ }
11
+ function v(c) {
12
+ const {
13
+ children: s,
14
+ disableReactTree: y = !1,
15
+ mouseEvent: i = "onClick",
16
+ onClickAway: P,
17
+ touchEvent: u = "onTouchEnd"
18
+ } = c, l = t.useRef(!1), o = t.useRef(null), d = t.useRef(!1), p = t.useRef(!1);
19
+ t.useEffect(() => (setTimeout(() => {
20
+ d.current = !0;
21
+ }, 0), () => {
22
+ d.current = !1;
23
+ }), []);
24
+ const k = C(
25
+ // @ts-expect-error TODO upstream fix
26
+ s.ref,
27
+ o
28
+ ), a = L((e) => {
29
+ const n = p.current;
30
+ p.current = !1;
31
+ const r = h(o.current);
32
+ if (!d.current || !o.current || "clientX" in e && D(e, r))
33
+ return;
34
+ if (l.current) {
35
+ l.current = !1;
36
+ return;
37
+ }
38
+ let E;
39
+ e.composedPath ? E = e.composedPath().indexOf(o.current) > -1 : E = !r.documentElement.contains(
40
+ // @ts-expect-error returns `false` as intended when not dispatched from a Node
41
+ e.target
42
+ ) || o.current.contains(
43
+ // @ts-expect-error returns `false` as intended when not dispatched from a Node
44
+ e.target
45
+ ), !E && (y || !n) && P(e);
46
+ }), R = (e) => (n) => {
47
+ p.current = !0;
48
+ const r = s.props[e];
49
+ r && r(n);
50
+ }, m = {
51
+ ref: k
52
+ };
53
+ return u !== !1 && (m[u] = R(u)), t.useEffect(() => {
54
+ if (u !== !1) {
55
+ const e = T(u), n = h(o.current), r = () => {
56
+ l.current = !0;
57
+ };
58
+ return n.addEventListener(e, a), n.addEventListener("touchmove", r), () => {
59
+ n.removeEventListener(e, a), n.removeEventListener("touchmove", r);
60
+ };
61
+ }
62
+ }, [a, u]), i !== !1 && (m[i] = R(i)), t.useEffect(() => {
63
+ if (i !== !1) {
64
+ const e = T(i), n = h(o.current);
65
+ return n.addEventListener(e, a), () => {
66
+ n.removeEventListener(e, a);
67
+ };
68
+ }
69
+ }, [a, i]), /* @__PURE__ */ w(t.Fragment, {
70
+ children: /* @__PURE__ */ t.cloneElement(s, m)
71
+ });
72
+ }
73
+ process.env.NODE_ENV !== "production" && (v.propTypes = {
74
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
75
+ // │ These PropTypes are generated from the TypeScript type definitions. │
76
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
77
+ // └─────────────────────────────────────────────────────────────────────┘
78
+ /**
79
+ * The wrapped element.
80
+ */
81
+ children: b.isRequired,
82
+ /**
83
+ * If `true`, the React tree is ignored and only the DOM tree is considered.
84
+ * This prop changes how portaled elements are handled.
85
+ * @default false
86
+ */
87
+ disableReactTree: f.bool,
88
+ /**
89
+ * The mouse event to listen to. You can disable the listener by providing `false`.
90
+ * @default 'onClick'
91
+ */
92
+ mouseEvent: f.oneOf(["onClick", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", !1]),
93
+ /**
94
+ * Callback fired when a "click away" event is detected.
95
+ */
96
+ onClickAway: f.func.isRequired,
97
+ /**
98
+ * The touch event to listen to. You can disable the listener by providing `false`.
99
+ * @default 'onTouchEnd'
100
+ */
101
+ touchEvent: f.oneOf(["onTouchEnd", "onTouchStart", !1])
102
+ });
103
+ process.env.NODE_ENV !== "production" && (v.propTypes = g(v.propTypes));
104
+ export {
105
+ v as C
106
+ };
@@ -0,0 +1,15 @@
1
+ import './assets/Dialog.css';
2
+ const _ = "_dialog_1o2te_1", o = "_dialog__backdrop_1o2te_11", i = "_dialog__panel_1o2te_19", l = "_dialog__title_1o2te_35", t = "_dialog__subtitle_1o2te_42", a = "_dialog__divider_1o2te_51", d = "_dialog__actions_1o2te_64", e = {
3
+ dialog: _,
4
+ dialog__backdrop: o,
5
+ dialog__panel: i,
6
+ dialog__title: l,
7
+ "dialog__title--small": "_dialog__title--small_1o2te_39",
8
+ dialog__subtitle: t,
9
+ dialog__divider: a,
10
+ "dialog__close-icon": "_dialog__close-icon_1o2te_55",
11
+ dialog__actions: d
12
+ };
13
+ export {
14
+ e as s
15
+ };
@@ -0,0 +1,73 @@
1
+ import * as o from "react";
2
+ import { r as P, a as y } from "./index-BNWbc5Kh.js";
3
+ import { u as T, s as a, P as i } from "./index-CqjC7P5Y.js";
4
+ import { jsx as c } from "react/jsx-runtime";
5
+ import { u as f } from "./useEnhancedEffect-CJGo-L3B.js";
6
+ function N(t, l, s, n, u) {
7
+ if (process.env.NODE_ENV === "production")
8
+ return null;
9
+ const e = t[l], r = u || l;
10
+ return e == null ? null : e && e.nodeType !== 1 ? new Error(`Invalid ${n} \`${r}\` supplied to \`${s}\`. Expected an HTMLElement.`) : null;
11
+ }
12
+ function h(t) {
13
+ return typeof t == "function" ? t() : t;
14
+ }
15
+ const p = /* @__PURE__ */ o.forwardRef(function(l, s) {
16
+ const {
17
+ children: n,
18
+ container: u,
19
+ disablePortal: e = !1
20
+ } = l, [r, d] = o.useState(null), m = T(/* @__PURE__ */ o.isValidElement(n) ? n.ref : null, s);
21
+ if (f(() => {
22
+ e || d(h(u) || document.body);
23
+ }, [u, e]), f(() => {
24
+ if (r && !e)
25
+ return a(s, r), () => {
26
+ a(s, null);
27
+ };
28
+ }, [s, r, e]), e) {
29
+ if (/* @__PURE__ */ o.isValidElement(n)) {
30
+ const E = {
31
+ ref: m
32
+ };
33
+ return /* @__PURE__ */ o.cloneElement(n, E);
34
+ }
35
+ return /* @__PURE__ */ c(o.Fragment, {
36
+ children: n
37
+ });
38
+ }
39
+ return /* @__PURE__ */ c(o.Fragment, {
40
+ children: r && /* @__PURE__ */ P.createPortal(n, r)
41
+ });
42
+ });
43
+ process.env.NODE_ENV !== "production" && (p.propTypes = {
44
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
45
+ // │ These PropTypes are generated from the TypeScript type definitions. │
46
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
47
+ // └─────────────────────────────────────────────────────────────────────┘
48
+ /**
49
+ * The children to render into the `container`.
50
+ */
51
+ children: i.node,
52
+ /**
53
+ * An HTML element or function that returns one.
54
+ * The `container` will have the portal children appended to it.
55
+ *
56
+ * You can also provide a callback, which is called in a React layout effect.
57
+ * This lets you set the container from a ref, and also makes server-side rendering possible.
58
+ *
59
+ * By default, it uses the body of the top-level document object,
60
+ * so it's simply `document.body` most of the time.
61
+ */
62
+ container: i.oneOfType([N, i.func]),
63
+ /**
64
+ * The `children` will be under the DOM hierarchy of the parent component.
65
+ * @default false
66
+ */
67
+ disablePortal: i.bool
68
+ });
69
+ process.env.NODE_ENV !== "production" && (p.propTypes = y(p.propTypes));
70
+ export {
71
+ N as H,
72
+ p as P
73
+ };
@@ -0,0 +1,254 @@
1
+ import { jsx as N } from "react/jsx-runtime";
2
+ import * as f from "react";
3
+ import { forwardRef as F, useContext as U, useMemo as j } from "react";
4
+ import { c as $ } from "./clsx-DB4S2d7J.js";
5
+ import { a as A, u as B, b as W, T as q, s as y } from "./Tabs.module-yYcTJnj6.js";
6
+ import { a as p, _ as z } from "./objectWithoutPropertiesLoose-D7Cp0Pg_.js";
7
+ import { e as O, g as G, a as J, u as k, b as K, P as o, c as Q, d as X } from "./index-CqjC7P5Y.js";
8
+ import { u as Y } from "./useButton-Bc8IAgyk.js";
9
+ const E = {
10
+ blur: "list:blur",
11
+ focus: "list:focus",
12
+ itemClick: "list:itemClick",
13
+ itemHover: "list:itemHover",
14
+ itemsChange: "list:itemsChange",
15
+ keyDown: "list:keyDown",
16
+ resetHighlight: "list:resetHighlight",
17
+ highlightLast: "list:highlightLast",
18
+ textNavigation: "list:textNavigation",
19
+ clearSelection: "list:clearSelection"
20
+ }, w = /* @__PURE__ */ f.createContext(null);
21
+ process.env.NODE_ENV !== "production" && (w.displayName = "ListContext");
22
+ function Z(n) {
23
+ const {
24
+ handlePointerOverEvents: t = !1,
25
+ item: e
26
+ } = n, s = f.useContext(w);
27
+ if (!s)
28
+ throw new Error("useListItem must be used within a ListProvider");
29
+ const {
30
+ dispatch: i,
31
+ getItemState: a
32
+ } = s, {
33
+ highlighted: c,
34
+ selected: b,
35
+ focusable: m
36
+ } = a(e), h = f.useCallback((l) => (r) => {
37
+ var d;
38
+ if ((d = l.onClick) == null || d.call(l, r), !r.defaultPrevented) {
39
+ if (process.env.NODE_ENV !== "production" && e === void 0)
40
+ throw new Error(["MUI: The `item` provided to useListItem() is undefined.", "This should happen only during server-side rendering under React 17."].join(`
41
+ `));
42
+ i({
43
+ type: E.itemClick,
44
+ item: e,
45
+ event: r
46
+ });
47
+ }
48
+ }, [i, e]), g = f.useCallback((l) => (r) => {
49
+ var d;
50
+ if ((d = l.onMouseOver) == null || d.call(l, r), !r.defaultPrevented) {
51
+ if (process.env.NODE_ENV !== "production" && e === void 0)
52
+ throw new Error(["MUI: The `item` provided to useListItem() is undefined.", "This should happen only during server-side rendering under React 17."].join(`
53
+ `));
54
+ i({
55
+ type: E.itemHover,
56
+ item: e,
57
+ event: r
58
+ });
59
+ }
60
+ }, [i, e]);
61
+ let u;
62
+ return m && (u = c ? 0 : -1), {
63
+ getRootProps: (l = {}) => {
64
+ const r = O(l);
65
+ return p({}, l, {
66
+ onClick: h(r),
67
+ onPointerOver: t ? g(r) : void 0,
68
+ tabIndex: u
69
+ });
70
+ },
71
+ highlighted: c,
72
+ selected: b
73
+ };
74
+ }
75
+ function ee(n, t) {
76
+ return function(s = {}) {
77
+ const i = p({}, s, n(s));
78
+ return p({}, i, t(i));
79
+ };
80
+ }
81
+ const I = "Tab";
82
+ function te(n) {
83
+ return G(I, n);
84
+ }
85
+ J(I, ["root", "selected", "disabled"]);
86
+ function oe(n) {
87
+ return n.size;
88
+ }
89
+ function se(n) {
90
+ const {
91
+ value: t,
92
+ rootRef: e,
93
+ disabled: s = !1,
94
+ id: i
95
+ } = n, a = f.useRef(null), c = A(i), {
96
+ value: b,
97
+ selectionFollowsFocus: m,
98
+ getTabPanelId: h
99
+ } = B(), g = f.useMemo(() => ({
100
+ disabled: s,
101
+ ref: a,
102
+ id: c
103
+ }), [s, a, c]), {
104
+ id: u,
105
+ index: v,
106
+ totalItemCount: l
107
+ } = W(t ?? oe, g), {
108
+ getRootProps: r,
109
+ highlighted: d,
110
+ selected: C
111
+ } = Z({
112
+ item: u
113
+ }), {
114
+ getRootProps: R,
115
+ rootRef: P,
116
+ active: T,
117
+ focusVisible: L,
118
+ setFocusVisible: M
119
+ } = Y({
120
+ disabled: s,
121
+ focusableWhenDisabled: !m,
122
+ type: "button"
123
+ }), x = k(a, e, P), V = u !== void 0 ? h(u) : void 0;
124
+ return {
125
+ getRootProps: (_ = {}) => {
126
+ const S = O(_), D = ee(r, R);
127
+ return p({}, _, D(S), {
128
+ role: "tab",
129
+ "aria-controls": V,
130
+ "aria-selected": C,
131
+ id: c,
132
+ ref: x
133
+ });
134
+ },
135
+ active: T,
136
+ focusVisible: L,
137
+ highlighted: d,
138
+ index: v,
139
+ rootRef: x,
140
+ // the `selected` state isn't set on the server (it relies on effects to be calculated),
141
+ // so we fall back to checking the `value` prop with the selectedValue from the TabsContext
142
+ selected: C || u === b,
143
+ setFocusVisible: M,
144
+ totalTabsCount: l
145
+ };
146
+ }
147
+ const ne = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], re = (n) => {
148
+ const {
149
+ selected: t,
150
+ disabled: e
151
+ } = n;
152
+ return Q({
153
+ root: ["root", t && "selected", e && "disabled"]
154
+ }, X(te));
155
+ }, H = /* @__PURE__ */ f.forwardRef(function(t, e) {
156
+ var s;
157
+ const {
158
+ children: i,
159
+ disabled: a = !1,
160
+ slotProps: c = {},
161
+ slots: b = {},
162
+ value: m
163
+ } = t, h = z(t, ne), g = f.useRef(), u = k(g, e), {
164
+ active: v,
165
+ highlighted: l,
166
+ selected: r,
167
+ getRootProps: d
168
+ } = se(p({}, t, {
169
+ rootRef: u,
170
+ value: m
171
+ })), C = p({}, t, {
172
+ active: v,
173
+ disabled: a,
174
+ highlighted: l,
175
+ selected: r
176
+ }), R = re(C), P = (s = b.root) != null ? s : "button", T = K({
177
+ elementType: P,
178
+ getSlotProps: d,
179
+ externalSlotProps: c.root,
180
+ externalForwardedProps: h,
181
+ additionalProps: {
182
+ ref: e
183
+ },
184
+ ownerState: C,
185
+ className: R.root
186
+ });
187
+ return /* @__PURE__ */ N(P, p({}, T, {
188
+ children: i
189
+ }));
190
+ });
191
+ process.env.NODE_ENV !== "production" && (H.propTypes = {
192
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
193
+ // │ These PropTypes are generated from the TypeScript type definitions. │
194
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
195
+ // └─────────────────────────────────────────────────────────────────────┘
196
+ /**
197
+ * A ref for imperative actions. It currently only supports `focusVisible()` action.
198
+ */
199
+ action: o.oneOfType([o.func, o.shape({
200
+ current: o.shape({
201
+ focusVisible: o.func.isRequired
202
+ })
203
+ })]),
204
+ /**
205
+ * @ignore
206
+ */
207
+ children: o.node,
208
+ /**
209
+ * If `true`, the component is disabled.
210
+ * @default false
211
+ */
212
+ disabled: o.bool,
213
+ /**
214
+ * Callback invoked when new value is being set.
215
+ */
216
+ onChange: o.func,
217
+ /**
218
+ * The props used for each slot inside the Tab.
219
+ * @default {}
220
+ */
221
+ slotProps: o.shape({
222
+ root: o.oneOfType([o.func, o.object])
223
+ }),
224
+ /**
225
+ * The components used for each slot inside the Tab.
226
+ * Either a string to use a HTML element or a component.
227
+ * @default {}
228
+ */
229
+ slots: o.shape({
230
+ root: o.elementType
231
+ }),
232
+ /**
233
+ * You can provide your own value. Otherwise, it falls back to the child position index.
234
+ */
235
+ value: o.oneOfType([o.number, o.string])
236
+ });
237
+ const be = F(
238
+ ({ children: n, value: t, disabled: e, dataTestId: s }, i) => {
239
+ const a = U(q), c = j(
240
+ () => $(
241
+ y.tabs__tab,
242
+ t === (a == null ? void 0 : a.value) && y["tabs__tab--selected"],
243
+ e && y["tabs__tab--disabled"]
244
+ ),
245
+ [t, a, e]
246
+ );
247
+ return /* @__PURE__ */ N(H, { className: c, disabled: e, value: t, "data-testid": s, ref: i, children: n });
248
+ }
249
+ );
250
+ export {
251
+ E as L,
252
+ be as T,
253
+ w as a
254
+ };