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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +17 -5
  2. package/dist/Button-B1umG8kJ.js +131 -0
  3. package/dist/ClickAwayListener-HI1G6ob9.js +107 -0
  4. package/dist/Dialog.module-CGVM5V_D.js +15 -0
  5. package/dist/Popup-DFJQc_jn.js +1249 -0
  6. package/dist/Portal-D__zvwbZ.js +73 -0
  7. package/dist/SelectButton-DWtqAiwt.js +45 -0
  8. package/dist/Tabs.module-jkH1Qjn7.js +22 -0
  9. package/dist/_commonjsHelpers-CT_km90n.js +30 -0
  10. package/dist/assets/Advice.css +1 -0
  11. package/dist/assets/Button.css +1 -0
  12. package/dist/assets/Checkbox.css +1 -0
  13. package/dist/assets/Dialog.css +1 -1
  14. package/dist/assets/IconButton.css +1 -0
  15. package/dist/assets/Input.css +1 -0
  16. package/dist/assets/InputSearch.css +1 -0
  17. package/dist/assets/LoadingSpinner.css +1 -1
  18. package/dist/assets/PageHeader.css +1 -0
  19. package/dist/assets/Pagination.css +1 -0
  20. package/dist/assets/SelectButton.css +1 -0
  21. package/dist/assets/Skeleton.css +1 -0
  22. package/dist/assets/Snackbar.css +1 -0
  23. package/dist/assets/SortTooltip.css +1 -0
  24. package/dist/assets/Stepper.css +1 -0
  25. package/dist/assets/Table.css +1 -0
  26. package/dist/assets/Tabs.css +1 -0
  27. package/dist/assets/Toggle.css +1 -0
  28. package/dist/assets/Tooltip.css +1 -0
  29. package/dist/assets/Typography.css +1 -1
  30. package/dist/assets/global.css +1 -0
  31. package/dist/combineHooksSlotProps-BHqhiBfc.js +81 -0
  32. package/dist/components/Advice/Advice.d.ts +16 -0
  33. package/dist/components/Advice/Advice.js +25 -0
  34. package/dist/components/Button/Button.d.ts +29 -0
  35. package/dist/components/Button/Button.js +70 -0
  36. package/dist/components/Button/Button.stories.d.ts +60 -0
  37. package/dist/components/Button/Button.stories.js +41 -0
  38. package/dist/components/Checkbox/Checkbox.d.ts +19 -0
  39. package/dist/components/Checkbox/Checkbox.js +56 -0
  40. package/dist/components/Dialog/Actions.js +1 -1
  41. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  42. package/dist/components/Dialog/Backdrop.js +2 -9
  43. package/dist/components/Dialog/CloseIconButton.js +11 -10
  44. package/dist/components/Dialog/Dialog.d.ts +5 -4
  45. package/dist/components/Dialog/Dialog.js +420 -20077
  46. package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
  47. package/dist/components/Dialog/Dialog.stories.js +60 -0
  48. package/dist/components/Dialog/Title.js +22 -7
  49. package/dist/components/Icon/Icon.d.ts +18 -0
  50. package/dist/components/Icon/Icon.js +95 -0
  51. package/dist/components/IconButton/IconButton.d.ts +22 -0
  52. package/dist/components/IconButton/IconButton.js +68 -0
  53. package/dist/components/Input/Input.d.ts +44 -0
  54. package/dist/components/Input/Input.js +497 -0
  55. package/dist/components/Input/Input.stories.d.ts +43 -0
  56. package/dist/components/Input/Input.stories.js +106 -0
  57. package/dist/components/InputSearch/InputSearch.d.ts +11 -0
  58. package/dist/components/InputSearch/InputSearch.js +29 -0
  59. package/dist/components/InputSearch/InputSearch.stories.d.ts +22 -0
  60. package/dist/components/InputSearch/InputSearch.stories.js +36 -0
  61. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
  62. package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
  63. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
  64. package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +39 -0
  65. package/dist/components/PageHeader/PageHeader.d.ts +36 -0
  66. package/dist/components/PageHeader/PageHeader.js +51 -0
  67. package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
  68. package/dist/components/PageHeader/PageHeader.stories.js +49 -0
  69. package/dist/components/Pagination/Pagination.d.ts +36 -0
  70. package/dist/components/Pagination/Pagination.js +219 -0
  71. package/dist/components/Select/Select.d.ts +25 -0
  72. package/dist/components/Select/Select.js +860 -0
  73. package/dist/components/Select/Select.stories.d.ts +31 -0
  74. package/dist/components/Select/Select.stories.js +66 -0
  75. package/dist/components/Select/SelectButton.d.ts +13 -0
  76. package/dist/components/Select/SelectButton.js +8 -0
  77. package/dist/components/Skeleton/Skeleton.d.ts +18 -0
  78. package/dist/components/Skeleton/Skeleton.js +26 -0
  79. package/dist/components/Snackbar/Snackbar.d.ts +13 -0
  80. package/dist/components/Snackbar/Snackbar.js +623 -0
  81. package/dist/components/SortTooltip/SortTooltip.d.ts +26 -0
  82. package/dist/components/SortTooltip/SortTooltip.js +67 -0
  83. package/dist/components/Stepper/Stepper.d.ts +16 -0
  84. package/dist/components/Stepper/Stepper.js +33 -0
  85. package/dist/components/Table/Table.d.ts +39 -0
  86. package/dist/components/Table/Table.js +122 -0
  87. package/dist/components/Table/TableContext.d.ts +19 -0
  88. package/dist/components/Table/TableContext.js +21 -0
  89. package/dist/components/Tabs/Tab.d.ts +9 -0
  90. package/dist/components/Tabs/Tab.js +182 -0
  91. package/dist/components/Tabs/TabPanel.d.ts +8 -0
  92. package/dist/components/Tabs/TabPanel.js +119 -0
  93. package/dist/components/Tabs/Tabs.d.ts +11 -0
  94. package/dist/components/Tabs/Tabs.js +402 -0
  95. package/dist/components/Toggle/Toggle.d.ts +11 -0
  96. package/dist/components/Toggle/Toggle.js +252 -0
  97. package/dist/components/Toggle/Toggle.stories.d.ts +21 -0
  98. package/dist/components/Toggle/Toggle.stories.js +33 -0
  99. package/dist/components/Tooltip/Tooltip.d.ts +17 -0
  100. package/dist/components/Tooltip/Tooltip.js +127 -0
  101. package/dist/components/Typography/Typography.d.ts +15 -6
  102. package/dist/components/Typography/Typography.js +75 -67
  103. package/dist/components/Typography/Typography.stories.d.ts +31 -0
  104. package/dist/components/Typography/Typography.stories.js +31 -0
  105. package/dist/components/Typography/typography.test.d.ts +1 -0
  106. package/dist/components/Typography/typography.test.js +11358 -0
  107. package/dist/index-BJ8HbRCy.js +19585 -0
  108. package/dist/index-CqjC7P5Y.js +814 -0
  109. package/dist/magic-string.es-O_8lTkE3.js +738 -0
  110. package/dist/main.d.ts +19 -2
  111. package/dist/main.js +60 -15
  112. package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +26 -0
  113. package/dist/test-utils/assertStyles.d.ts +1 -0
  114. package/dist/test-utils/assertStyles.js +11 -0
  115. package/dist/types/helpers.d.ts +14 -7
  116. package/dist/useButton-Bc8IAgyk.js +106 -0
  117. package/dist/useCompoundItem-D1iRfg8D.js +84 -0
  118. package/dist/useControlled-CCMYYdCM.js +31 -0
  119. package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
  120. package/dist/useEventCallback-vAfOD-oT.js +45 -0
  121. package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
  122. package/dist/useList-ByMguSS_.js +437 -0
  123. package/dist/useTimeout-DxF9kiZL.js +36 -0
  124. package/dist/utils/styleStrings.d.ts +6 -0
  125. package/dist/utils/styleStrings.js +10 -0
  126. package/dist/utils/styleStrings.test.d.ts +1 -0
  127. package/dist/utils/styleStrings.test.js +41 -0
  128. package/dist/vi.Y_w82WR8-Df0JUamG.js +9860 -0
  129. package/package.json +53 -10
  130. package/dist/Button-REznN-RP.js +0 -1139
  131. package/dist/Dialog.module-BO0mdB7d.js +0 -15
  132. package/dist/assets/CallToActionButton.css +0 -1
  133. package/dist/assets/main.css +0 -1
  134. package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -23
  135. package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
  136. package/src/playground/Playground.tsx +0 -58
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,107 @@
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 } from "./useEventCallback-vAfOD-oT.js";
5
+ import { e as g } from "./index-BJ8HbRCy.js";
6
+ function T(c) {
7
+ return c.substring(2).toLowerCase();
8
+ }
9
+ function D(c, s) {
10
+ return s.documentElement.clientWidth < c.clientX || s.documentElement.clientHeight < c.clientY;
11
+ }
12
+ function v(c) {
13
+ const {
14
+ children: s,
15
+ disableReactTree: y = !1,
16
+ mouseEvent: i = "onClick",
17
+ onClickAway: P,
18
+ touchEvent: u = "onTouchEnd"
19
+ } = c, l = t.useRef(!1), o = t.useRef(null), d = t.useRef(!1), p = t.useRef(!1);
20
+ t.useEffect(() => (setTimeout(() => {
21
+ d.current = !0;
22
+ }, 0), () => {
23
+ d.current = !1;
24
+ }), []);
25
+ const k = C(
26
+ // @ts-expect-error TODO upstream fix
27
+ s.ref,
28
+ o
29
+ ), a = L((e) => {
30
+ const n = p.current;
31
+ p.current = !1;
32
+ const r = h(o.current);
33
+ if (!d.current || !o.current || "clientX" in e && D(e, r))
34
+ return;
35
+ if (l.current) {
36
+ l.current = !1;
37
+ return;
38
+ }
39
+ let E;
40
+ e.composedPath ? E = e.composedPath().indexOf(o.current) > -1 : E = !r.documentElement.contains(
41
+ // @ts-expect-error returns `false` as intended when not dispatched from a Node
42
+ e.target
43
+ ) || o.current.contains(
44
+ // @ts-expect-error returns `false` as intended when not dispatched from a Node
45
+ e.target
46
+ ), !E && (y || !n) && P(e);
47
+ }), R = (e) => (n) => {
48
+ p.current = !0;
49
+ const r = s.props[e];
50
+ r && r(n);
51
+ }, m = {
52
+ ref: k
53
+ };
54
+ return u !== !1 && (m[u] = R(u)), t.useEffect(() => {
55
+ if (u !== !1) {
56
+ const e = T(u), n = h(o.current), r = () => {
57
+ l.current = !0;
58
+ };
59
+ return n.addEventListener(e, a), n.addEventListener("touchmove", r), () => {
60
+ n.removeEventListener(e, a), n.removeEventListener("touchmove", r);
61
+ };
62
+ }
63
+ }, [a, u]), i !== !1 && (m[i] = R(i)), t.useEffect(() => {
64
+ if (i !== !1) {
65
+ const e = T(i), n = h(o.current);
66
+ return n.addEventListener(e, a), () => {
67
+ n.removeEventListener(e, a);
68
+ };
69
+ }
70
+ }, [a, i]), /* @__PURE__ */ w(t.Fragment, {
71
+ children: /* @__PURE__ */ t.cloneElement(s, m)
72
+ });
73
+ }
74
+ process.env.NODE_ENV !== "production" && (v.propTypes = {
75
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
76
+ // │ These PropTypes are generated from the TypeScript type definitions. │
77
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
78
+ // └─────────────────────────────────────────────────────────────────────┘
79
+ /**
80
+ * The wrapped element.
81
+ */
82
+ children: b.isRequired,
83
+ /**
84
+ * If `true`, the React tree is ignored and only the DOM tree is considered.
85
+ * This prop changes how portaled elements are handled.
86
+ * @default false
87
+ */
88
+ disableReactTree: f.bool,
89
+ /**
90
+ * The mouse event to listen to. You can disable the listener by providing `false`.
91
+ * @default 'onClick'
92
+ */
93
+ mouseEvent: f.oneOf(["onClick", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", !1]),
94
+ /**
95
+ * Callback fired when a "click away" event is detected.
96
+ */
97
+ onClickAway: f.func.isRequired,
98
+ /**
99
+ * The touch event to listen to. You can disable the listener by providing `false`.
100
+ * @default 'onTouchEnd'
101
+ */
102
+ touchEvent: f.oneOf(["onTouchEnd", "onTouchStart", !1])
103
+ });
104
+ process.env.NODE_ENV !== "production" && (v.propTypes = g(v.propTypes));
105
+ export {
106
+ v as C
107
+ };
@@ -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
+ };