@pismo/marola 0.0.1-alpha.2 → 0.0.1-alpha.20

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 (153) hide show
  1. package/README.md +17 -5
  2. package/dist/Button-2b1peDFT.js +130 -0
  3. package/dist/ClickAwayListener-BSW-Nd-y.js +107 -0
  4. package/dist/Dialog.module-DFEmFdYT.js +30 -0
  5. package/dist/Popup-B6ZSGIEI.js +1248 -0
  6. package/dist/Portal-DIeBsWdL.js +73 -0
  7. package/dist/SelectButton-C8JQKaf4.js +61 -0
  8. package/dist/Tabs.module-jkH1Qjn7.js +22 -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/Chip.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/TextDisplay.css +1 -0
  28. package/dist/assets/Toggle.css +1 -0
  29. package/dist/assets/Tooltip.css +1 -0
  30. package/dist/assets/Typography.css +1 -1
  31. package/dist/combineHooksSlotProps-DVjg9PRh.js +80 -0
  32. package/dist/components/Advice/Advice.d.ts +28 -0
  33. package/dist/components/Advice/Advice.js +40 -0
  34. package/dist/components/Advice/Advice.stories.d.ts +16 -0
  35. package/dist/components/Button/Button.d.ts +32 -0
  36. package/dist/components/Button/Button.js +65 -0
  37. package/dist/components/Button/Button.stories.d.ts +62 -0
  38. package/dist/components/Checkbox/Checkbox.d.ts +34 -0
  39. package/dist/components/Checkbox/Checkbox.js +71 -0
  40. package/dist/components/Checkbox/Checkbox.stories.d.ts +31 -0
  41. package/dist/components/Chip/Chip.d.ts +37 -0
  42. package/dist/components/Chip/Chip.js +113 -0
  43. package/dist/components/Chip/Chip.stories.d.ts +40 -0
  44. package/dist/components/Chip/chip.test.d.ts +1 -0
  45. package/dist/components/Dialog/Actions.js +1 -1
  46. package/dist/components/Dialog/Backdrop.d.ts +1 -1
  47. package/dist/components/Dialog/Backdrop.js +2 -9
  48. package/dist/components/Dialog/CloseIconButton.js +11 -10
  49. package/dist/components/Dialog/Dialog.d.ts +6 -5
  50. package/dist/components/Dialog/Dialog.js +419 -20077
  51. package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
  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/Icon/Icon.d.ts +27 -0
  55. package/dist/components/Icon/Icon.js +122 -0
  56. package/dist/components/Icon/Icon.stories.d.ts +16 -0
  57. package/dist/components/IconButton/Icon.stories.d.ts +15 -0
  58. package/dist/components/IconButton/IconButton.d.ts +36 -0
  59. package/dist/components/IconButton/IconButton.js +40 -0
  60. package/dist/components/Input/Input.d.ts +44 -0
  61. package/dist/components/Input/Input.js +508 -0
  62. package/dist/components/Input/Input.stories.d.ts +43 -0
  63. package/dist/components/InputSearch/InputSearch.d.ts +9 -0
  64. package/dist/components/InputSearch/InputSearch.js +34 -0
  65. package/dist/components/InputSearch/InputSearch.stories.d.ts +39 -0
  66. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
  67. package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
  68. package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
  69. package/dist/components/PageHeader/PageHeader.d.ts +36 -0
  70. package/dist/components/PageHeader/PageHeader.js +66 -0
  71. package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
  72. package/dist/components/Pagination/Pagination.d.ts +55 -0
  73. package/dist/components/Pagination/Pagination.js +236 -0
  74. package/dist/components/Pagination/Pagination.stories.d.ts +17 -0
  75. package/dist/components/Select/Select.d.ts +26 -0
  76. package/dist/components/Select/Select.js +857 -0
  77. package/dist/components/Select/Select.stories.d.ts +22 -0
  78. package/dist/components/Select/SelectButton.d.ts +12 -0
  79. package/dist/components/Select/SelectButton.js +8 -0
  80. package/dist/components/Skeleton/Skeleton.d.ts +25 -0
  81. package/dist/components/Skeleton/Skeleton.js +23 -0
  82. package/dist/components/Skeleton/Skeleton.stories.d.ts +14 -0
  83. package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +14 -0
  84. package/dist/components/Skeleton/SkeletonTable.stories.d.ts +16 -0
  85. package/dist/components/Snackbar/Snackbar.d.ts +25 -0
  86. package/dist/components/Snackbar/Snackbar.js +637 -0
  87. package/dist/components/Snackbar/Snackbar.stories.d.ts +318 -0
  88. package/dist/components/SortTooltip/SortTooltip.d.ts +28 -0
  89. package/dist/components/SortTooltip/SortTooltip.js +93 -0
  90. package/dist/components/Stepper/Stepper.d.ts +26 -0
  91. package/dist/components/Stepper/Stepper.js +48 -0
  92. package/dist/components/Stepper/Stepper.stories.d.ts +16 -0
  93. package/dist/components/Table/Table.d.ts +56 -0
  94. package/dist/components/Table/Table.js +137 -0
  95. package/dist/components/Table/Table.stories.d.ts +29 -0
  96. package/dist/components/Table/TableContext.d.ts +19 -0
  97. package/dist/components/Table/TableContext.js +21 -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 +14 -0
  104. package/dist/components/Tabs/Tab.js +181 -0
  105. package/dist/components/Tabs/Tab.stories.d.ts +15 -0
  106. package/dist/components/Tabs/TabPanel.d.ts +12 -0
  107. package/dist/components/Tabs/TabPanel.js +118 -0
  108. package/dist/components/Tabs/TabPanel.stories.d.ts +14 -0
  109. package/dist/components/Tabs/Tabs.d.ts +15 -0
  110. package/dist/components/Tabs/Tabs.js +401 -0
  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.d.ts +11 -0
  117. package/dist/components/Toggle/Toggle.js +266 -0
  118. package/dist/components/Toggle/Toggle.stories.d.ts +21 -0
  119. package/dist/components/Tooltip/Tooltip.d.ts +29 -0
  120. package/dist/components/Tooltip/Tooltip.js +139 -0
  121. package/dist/components/Tooltip/Tooltip.stories.d.ts +33 -0
  122. package/dist/components/Typography/Typography.d.ts +17 -6
  123. package/dist/components/Typography/Typography.js +56 -65
  124. package/dist/components/Typography/Typography.stories.d.ts +32 -0
  125. package/dist/components/Typography/typography.test.d.ts +1 -0
  126. package/dist/index-CH45lKw7.js +840 -0
  127. package/dist/index-CjW42-M-.js +19584 -0
  128. package/dist/main.d.ts +25 -3
  129. package/dist/main.js +67 -15
  130. package/dist/marola.css +1 -0
  131. package/dist/test-utils/assertStyles.d.ts +1 -0
  132. package/dist/test-utils/assertStyles.js +11 -0
  133. package/dist/types/helpers.d.ts +14 -7
  134. package/dist/useButton-DNk3wrQp.js +105 -0
  135. package/dist/useCompoundItem-D1iRfg8D.js +84 -0
  136. package/dist/useControlled-CCMYYdCM.js +31 -0
  137. package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
  138. package/dist/useEventCallback-xTG9piMa.js +45 -0
  139. package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
  140. package/dist/useList-B0hog_3-.js +436 -0
  141. package/dist/useTimeout-DxF9kiZL.js +36 -0
  142. package/dist/utils/styleStrings.d.ts +6 -0
  143. package/dist/utils/styleStrings.js +10 -0
  144. package/dist/utils/styleStrings.test.d.ts +1 -0
  145. package/package.json +51 -9
  146. package/dist/Button-REznN-RP.js +0 -1139
  147. package/dist/Dialog.module-BO0mdB7d.js +0 -15
  148. package/dist/assets/CallToActionButton.css +0 -1
  149. package/dist/assets/main.css +0 -1
  150. package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -23
  151. package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
  152. package/dist/components/Dialog/Title.js +0 -14
  153. package/src/playground/Playground.tsx +0 -58
@@ -0,0 +1,266 @@
1
+ import '../../assets/Toggle.css';
2
+ import { jsxs as j, jsx as P } from "react/jsx-runtime";
3
+ import { c as O } from "../../clsx-DB4S2d7J.js";
4
+ import { u as E, b as k, g as v, a as U, _ as q, c as C, P as e, d as H, e as M } from "../../index-CH45lKw7.js";
5
+ import * as F from "react";
6
+ import { u as A } from "../../useControlled-CCMYYdCM.js";
7
+ import { u as D } from "../../useIsFocusVisible-BH4IAdcw.js";
8
+ function L(l) {
9
+ const {
10
+ checked: s,
11
+ defaultChecked: i,
12
+ disabled: r,
13
+ onBlur: c,
14
+ onChange: h,
15
+ onFocus: n,
16
+ onFocusVisible: u,
17
+ readOnly: a,
18
+ required: p
19
+ } = l, [N, V] = A({
20
+ controlled: s,
21
+ default: !!i,
22
+ name: "Switch",
23
+ state: "checked"
24
+ }), S = (t) => (o) => {
25
+ var d;
26
+ o.nativeEvent.defaultPrevented || (V(o.target.checked), h == null || h(o), (d = t.onChange) == null || d.call(t, o));
27
+ }, {
28
+ isFocusVisibleRef: b,
29
+ onBlur: B,
30
+ onFocus: _,
31
+ ref: f
32
+ } = D(), [y, z] = F.useState(!1);
33
+ r && y && z(!1), F.useEffect(() => {
34
+ b.current = y;
35
+ }, [y, b]);
36
+ const m = F.useRef(null), w = (t) => (o) => {
37
+ var d;
38
+ m.current || (m.current = o.currentTarget), _(o), b.current === !0 && (z(!0), u == null || u(o)), n == null || n(o), (d = t.onFocus) == null || d.call(t, o);
39
+ }, T = (t) => (o) => {
40
+ var d;
41
+ B(o), b.current === !1 && z(!1), c == null || c(o), (d = t.onBlur) == null || d.call(t, o);
42
+ }, x = E(f, m);
43
+ return {
44
+ checked: N,
45
+ disabled: !!r,
46
+ focusVisible: y,
47
+ getInputProps: (t = {}) => k({
48
+ checked: s,
49
+ defaultChecked: i,
50
+ disabled: r,
51
+ readOnly: a,
52
+ ref: x,
53
+ required: p,
54
+ type: "checkbox",
55
+ role: "switch",
56
+ "aria-checked": s
57
+ }, t, {
58
+ onChange: S(t),
59
+ onFocus: w(t),
60
+ onBlur: T(t)
61
+ }),
62
+ inputRef: x,
63
+ readOnly: !!a
64
+ };
65
+ }
66
+ const I = "Switch";
67
+ function W(l) {
68
+ return v(I, l);
69
+ }
70
+ U(I, ["root", "input", "track", "thumb", "checked", "disabled", "focusVisible", "readOnly"]);
71
+ const G = ["checked", "defaultChecked", "disabled", "onBlur", "onChange", "onFocus", "onFocusVisible", "readOnly", "required", "slotProps", "slots"], J = (l) => {
72
+ const {
73
+ checked: s,
74
+ disabled: i,
75
+ focusVisible: r,
76
+ readOnly: c
77
+ } = l;
78
+ return H({
79
+ root: ["root", s && "checked", i && "disabled", r && "focusVisible", c && "readOnly"],
80
+ thumb: ["thumb"],
81
+ input: ["input"],
82
+ track: ["track"]
83
+ }, M(W));
84
+ }, $ = /* @__PURE__ */ F.forwardRef(function(s, i) {
85
+ var r, c, h, n;
86
+ const {
87
+ slotProps: u = {},
88
+ slots: a = {}
89
+ } = s, p = q(s, G), {
90
+ getInputProps: N,
91
+ checked: V,
92
+ disabled: S,
93
+ focusVisible: b,
94
+ readOnly: B
95
+ } = L(s), _ = k({}, s, {
96
+ checked: V,
97
+ disabled: S,
98
+ focusVisible: b,
99
+ readOnly: B
100
+ }), f = J(_), y = (r = a.root) != null ? r : "span", z = C({
101
+ elementType: y,
102
+ externalSlotProps: u.root,
103
+ externalForwardedProps: p,
104
+ additionalProps: {
105
+ ref: i
106
+ },
107
+ ownerState: _,
108
+ className: f.root
109
+ }), m = (c = a.thumb) != null ? c : "span", w = C({
110
+ elementType: m,
111
+ externalSlotProps: u.thumb,
112
+ ownerState: _,
113
+ className: f.thumb
114
+ }), T = (h = a.input) != null ? h : "input", x = C({
115
+ elementType: T,
116
+ getSlotProps: N,
117
+ externalSlotProps: u.input,
118
+ ownerState: _,
119
+ className: f.input
120
+ }), R = a.track === null ? () => null : (n = a.track) != null ? n : "span", t = C({
121
+ elementType: R,
122
+ externalSlotProps: u.track,
123
+ ownerState: _,
124
+ className: f.track
125
+ });
126
+ return /* @__PURE__ */ j(y, k({}, z, {
127
+ children: [/* @__PURE__ */ P(R, k({}, t)), /* @__PURE__ */ P(m, k({}, w)), /* @__PURE__ */ P(T, k({}, x))]
128
+ }));
129
+ });
130
+ process.env.NODE_ENV !== "production" && ($.propTypes = {
131
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
132
+ // │ These PropTypes are generated from the TypeScript type definitions. │
133
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
134
+ // └─────────────────────────────────────────────────────────────────────┘
135
+ /**
136
+ * If `true`, the component is checked.
137
+ */
138
+ checked: e.bool,
139
+ /**
140
+ * Class name applied to the root element.
141
+ */
142
+ className: e.string,
143
+ /**
144
+ * The default checked state. Use when the component is not controlled.
145
+ */
146
+ defaultChecked: e.bool,
147
+ /**
148
+ * If `true`, the component is disabled.
149
+ */
150
+ disabled: e.bool,
151
+ /**
152
+ * @ignore
153
+ */
154
+ onBlur: e.func,
155
+ /**
156
+ * Callback fired when the state is changed.
157
+ *
158
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
159
+ * You can pull out the new value by accessing `event.target.value` (string).
160
+ * You can pull out the new checked state by accessing `event.target.checked` (boolean).
161
+ */
162
+ onChange: e.func,
163
+ /**
164
+ * @ignore
165
+ */
166
+ onFocus: e.func,
167
+ /**
168
+ * @ignore
169
+ */
170
+ onFocusVisible: e.func,
171
+ /**
172
+ * If `true`, the component is read only.
173
+ */
174
+ readOnly: e.bool,
175
+ /**
176
+ * If `true`, the `input` element is required.
177
+ */
178
+ required: e.bool,
179
+ /**
180
+ * The props used for each slot inside the Switch.
181
+ * @default {}
182
+ */
183
+ slotProps: e.shape({
184
+ input: e.oneOfType([e.func, e.object]),
185
+ root: e.oneOfType([e.func, e.object]),
186
+ thumb: e.oneOfType([e.func, e.object]),
187
+ track: e.oneOfType([e.func, e.object])
188
+ }),
189
+ /**
190
+ * The components used for each slot inside the Switch.
191
+ * Either a string to use a HTML element or a component.
192
+ * @default {}
193
+ */
194
+ slots: e.shape({
195
+ input: e.elementType,
196
+ root: e.elementType,
197
+ thumb: e.elementType,
198
+ track: e.oneOfType([e.elementType, e.oneOf([null])])
199
+ })
200
+ });
201
+ const K = "_toggle__label_1rzg2_43", Q = "_toggle_1rzg2_43", X = "_input_1rzg2_88", Y = "_thumb_1rzg2_99", Z = "_track_1rzg2_113", g = {
202
+ "u-typography-h1": "_u-typography-h1_1rzg2_1",
203
+ "u-typography-h2": "_u-typography-h2_1rzg2_8",
204
+ "u-typography-h3": "_u-typography-h3_1rzg2_15",
205
+ "u-typography-h4": "_u-typography-h4_1rzg2_22",
206
+ "u-typography-h5": "_u-typography-h5_1rzg2_29",
207
+ "u-typography-h6": "_u-typography-h6_1rzg2_36",
208
+ "u-typography-base": "_u-typography-base_1rzg2_43",
209
+ toggle__label: K,
210
+ "u-typography-base--xxl": "_u-typography-base--xxl_1rzg2_48",
211
+ "u-typography-base--xl": "_u-typography-base--xl_1rzg2_52",
212
+ "u-typography-base--lg": "_u-typography-base--lg_1rzg2_56",
213
+ "u-typography-base--sm": "_u-typography-base--sm_1rzg2_60",
214
+ "u-typography-base--bold": "_u-typography-base--bold_1rzg2_64",
215
+ "u-typography-base--strikethrough": "_u-typography-base--strikethrough_1rzg2_67",
216
+ "u-typography-base--underlined": "_u-typography-base--underlined_1rzg2_70",
217
+ "u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_1rzg2_73",
218
+ toggle: Q,
219
+ "toggle__toggle-el-wrapper": "_toggle__toggle-el-wrapper_1rzg2_84",
220
+ input: X,
221
+ thumb: Y,
222
+ track: Z,
223
+ "toggle--focus-visible": "_toggle--focus-visible_1rzg2_123",
224
+ "toggle--checked": "_toggle--checked_1rzg2_127",
225
+ "toggle--disabled": "_toggle--disabled_1rzg2_140"
226
+ }, re = ({
227
+ label: l,
228
+ checked: s,
229
+ disabled: i,
230
+ classNameWrapper: r,
231
+ classNameInput: c,
232
+ "data-testid": h,
233
+ onChange: n,
234
+ classNameLabel: u
235
+ }) => {
236
+ const a = (p) => {
237
+ n == null || n(p);
238
+ };
239
+ return /* @__PURE__ */ j("div", { className: O(g.toggle, r), "data-testid": h, children: [
240
+ /* @__PURE__ */ P(
241
+ $,
242
+ {
243
+ checked: s === !0,
244
+ disabled: i,
245
+ onChange: a,
246
+ "aria-label": l,
247
+ slotProps: {
248
+ root: (p) => ({
249
+ className: O(g["toggle__toggle-el-wrapper"], {
250
+ [g["toggle--disabled"]]: p.disabled,
251
+ [g["toggle--focus-visible"]]: p.focusVisible,
252
+ [g["toggle--checked"]]: p.checked
253
+ })
254
+ }),
255
+ input: { className: O(g.input, c) },
256
+ thumb: { className: g.thumb },
257
+ track: { className: g.track }
258
+ }
259
+ }
260
+ ),
261
+ l && /* @__PURE__ */ P("label", { className: O(g.toggle__label, u), children: l })
262
+ ] });
263
+ };
264
+ export {
265
+ re as Toggle
266
+ };
@@ -0,0 +1,21 @@
1
+ import { StoryObj } from '@storybook/react';
2
+
3
+ declare const meta: {
4
+ title: string;
5
+ component: ({ label, checked, disabled, classNameWrapper, classNameInput, "data-testid": dataTestId, onChange, classNameLabel, }: import('react').InputHTMLAttributes<HTMLInputElement> & {
6
+ label?: string | undefined;
7
+ classNameWrapper?: string | undefined;
8
+ classNameInput?: string | undefined;
9
+ classNameLabel?: string | undefined;
10
+ 'data-testid'?: string | undefined;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ tags: string[];
13
+ parameters: {
14
+ layout: string;
15
+ };
16
+ };
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+ export declare const Simple: Story;
20
+ export declare const WithLabel: Story;
21
+ export declare const Disabled: Story;
@@ -0,0 +1,29 @@
1
+ import { PopupPlacement } from '@mui/base';
2
+ import { AriaRole, ReactNode } from 'react';
3
+
4
+ export type TooltipProps = {
5
+ /** Tooltip reference element. */
6
+ children: ReactNode;
7
+ /** Tooltip title. Zero-length titles string, undefined, null and false are never displayed. */
8
+ title: ReactNode;
9
+ /** Should the tooltip be initially open */
10
+ open?: boolean;
11
+ /** Disable the hover listener */
12
+ disableHoverListener?: boolean;
13
+ /** Function to run when the tooltip is closed */
14
+ onClose?: () => void;
15
+ /** The color of the tooltip */
16
+ theme?: 'white' | 'black';
17
+ /** Dhe padding applied to the tooltip */
18
+ padding?: 'small' | 'normal';
19
+ /** The Position where the tooltip will be display relative to the anchor element */
20
+ position?: PopupPlacement;
21
+ /** Accessibility role label */
22
+ arialRole?: AriaRole;
23
+ /** Additional classnames to be applied to the tooltip */
24
+ className?: string;
25
+ /** Test id */
26
+ 'data-testid'?: string;
27
+ };
28
+ declare const Tooltip: ({ arialRole, children: childrenProp, className, disableHoverListener, onClose, padding, position, open: openProp, theme, title, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
29
+ export { Tooltip };
@@ -0,0 +1,139 @@
1
+ import '../../assets/Tooltip.css';
2
+ import { jsx as i, jsxs as w, Fragment as S } from "react/jsx-runtime";
3
+ import * as u from "react";
4
+ import { useRef as v, useState as P, useEffect as E, isValidElement as R, cloneElement as q } from "react";
5
+ import { T as M, P as O } from "../../Popup-B6ZSGIEI.js";
6
+ import { _ as V, b as $, P as l } from "../../index-CH45lKw7.js";
7
+ import { c as z } from "../../clsx-DB4S2d7J.js";
8
+ import { C as D } from "../../ClickAwayListener-BSW-Nd-y.js";
9
+ function F() {
10
+ const n = u.useContext(M);
11
+ if (!n)
12
+ throw new Error("Missing transition context");
13
+ const {
14
+ registerTransition: e,
15
+ requestedEnter: r,
16
+ onExited: o
17
+ } = n;
18
+ return u.useEffect(() => e(), [e]), {
19
+ onExited: o,
20
+ requestedEnter: r
21
+ };
22
+ }
23
+ const I = ["children", "className", "enterAnimationName", "enterClassName", "exitAnimationName", "exitClassName"];
24
+ function g(n) {
25
+ const {
26
+ children: e,
27
+ className: r,
28
+ enterAnimationName: o,
29
+ enterClassName: c,
30
+ exitAnimationName: _,
31
+ exitClassName: f
32
+ } = n, p = V(n, I), {
33
+ requestedEnter: d,
34
+ onExited: a
35
+ } = F(), s = u.useRef(!0);
36
+ u.useEffect(() => {
37
+ d && s.current && (s.current = !1);
38
+ }, [d]);
39
+ const t = u.useCallback((h) => {
40
+ h.animationName === _ ? (a(), s.current = !0) : h.animationName === o && (s.current = !1);
41
+ }, [a, _, o]);
42
+ return /* @__PURE__ */ i("div", $({
43
+ onAnimationEnd: t,
44
+ className: z(r, d ? c : f)
45
+ }, p, {
46
+ children: e
47
+ }));
48
+ }
49
+ process.env.NODE_ENV !== "production" && (g.propTypes = {
50
+ children: l.node,
51
+ className: l.string,
52
+ enterAnimationName: l.string,
53
+ enterClassName: l.string,
54
+ exitAnimationName: l.string,
55
+ exitClassName: l.string
56
+ });
57
+ const W = "_tooltip_1dujm_1", m = {
58
+ tooltip: W,
59
+ "tooltip--small-padding": "_tooltip--small-padding_1dujm_5",
60
+ "tooltip--normal-padding": "_tooltip--normal-padding_1dujm_8",
61
+ "tooltip--white-theme": "_tooltip--white-theme_1dujm_11",
62
+ "tooltip--black-theme": "_tooltip--black-theme_1dujm_15",
63
+ "tooltip--animation": "_tooltip--animation_1dujm_20",
64
+ "tooltip--anim-open": "_tooltip--anim-open_1dujm_20",
65
+ "tooltip--open-animation": "_tooltip--open-animation_1dujm_1",
66
+ "tooltip--anim-close": "_tooltip--anim-close_1dujm_23",
67
+ "tooltip--close-animation": "_tooltip--close-animation_1dujm_1"
68
+ }, U = ({
69
+ arialRole: n,
70
+ children: e,
71
+ className: r,
72
+ disableHoverListener: o,
73
+ onClose: c,
74
+ padding: _ = "small",
75
+ position: f = "bottom",
76
+ open: p,
77
+ theme: d = "black",
78
+ title: a,
79
+ ...s
80
+ }) => {
81
+ const t = v(null), [h, N] = P(p || !1);
82
+ let j = h;
83
+ E(() => {
84
+ N(p || !1);
85
+ }, [p]);
86
+ const C = R(e) ? e : /* @__PURE__ */ i("span", { children: e });
87
+ !a && a !== 0 && (j = !1);
88
+ const b = () => {
89
+ c == null || c(), !o && N(!1);
90
+ };
91
+ E(() => {
92
+ var A;
93
+ if (t != null && t.current) {
94
+ const x = (A = t == null ? void 0 : t.current) == null ? void 0 : A.parentElement;
95
+ x && (o || (x.onpointerenter = () => N(!0), x.onpointerleave = () => N(!1)));
96
+ }
97
+ }, [t, o]);
98
+ const y = {
99
+ padding: f.match(/(bottom|top)/) ? ".25rem 0" : "0 .25rem",
100
+ zIndex: 1
101
+ }, T = [
102
+ m.tooltip,
103
+ m[`tooltip--${d}-theme`],
104
+ m[`tooltip--${_}-padding`],
105
+ r || ""
106
+ ].join(" ").trim(), k = {
107
+ ...C.props,
108
+ ref: t
109
+ };
110
+ return /* @__PURE__ */ w(S, { children: [
111
+ q(C, k),
112
+ /* @__PURE__ */ i(
113
+ O,
114
+ {
115
+ ...s,
116
+ open: j,
117
+ anchor: t == null ? void 0 : t.current,
118
+ disablePortal: !0,
119
+ style: y,
120
+ role: n,
121
+ placement: f,
122
+ children: /* @__PURE__ */ i(
123
+ g,
124
+ {
125
+ className: m["tooltip--animation"],
126
+ enterClassName: m["tooltip--anim-open"],
127
+ exitClassName: m["tooltip--anim-close"],
128
+ enterAnimationName: "tooltip--open-animation",
129
+ exitAnimationName: "tooltip--close-animation",
130
+ children: /* @__PURE__ */ i("div", { className: T, children: /* @__PURE__ */ i(D, { onClickAway: b, children: /* @__PURE__ */ i("div", { children: a }) }) })
131
+ }
132
+ )
133
+ }
134
+ )
135
+ ] });
136
+ };
137
+ export {
138
+ U as Tooltip
139
+ };
@@ -0,0 +1,33 @@
1
+ import { TooltipProps } from './Tooltip.tsx';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: ({ arialRole, children: childrenProp, className, disableHoverListener, onClose, padding, position, open: openProp, theme, title, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
7
+ tags: string[];
8
+ parameters: {
9
+ layout: string;
10
+ };
11
+ decorators: ((Story: import('@storybook/types').PartialStoryFn<import('@storybook/react').ReactRenderer, {
12
+ children: import('react').ReactNode;
13
+ title: import('react').ReactNode;
14
+ open?: boolean | undefined;
15
+ disableHoverListener?: boolean | undefined;
16
+ onClose?: (() => void) | undefined;
17
+ theme?: "black" | "white" | undefined;
18
+ padding?: "small" | "normal" | undefined;
19
+ position?: import('@floating-ui/utils').Placement | undefined;
20
+ arialRole?: import('react').AriaRole | undefined;
21
+ className?: string | undefined;
22
+ 'data-testid'?: string | undefined;
23
+ }>) => import("react/jsx-runtime").JSX.Element)[];
24
+ };
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+ export declare const Simple: Story;
28
+ export declare const Onclose: Story;
29
+ export declare const InitialOpen: Story;
30
+ export declare const WhiteTheme: Story;
31
+ export declare const DisabledHover: Story;
32
+ export declare const NormalPadding: Story;
33
+ export declare const Positioning: Story;
@@ -1,22 +1,33 @@
1
- import { ComponentType, ElementType, HTMLAttributes, ReactNode } from 'react';
1
+ import { ComponentType, ElementType, HTMLAttributes, LabelHTMLAttributes, ReactNode } from 'react';
2
2
 
3
- export type VariantType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body-large" | "body-medium" | "body" | "body-small" | "body-tiny" | "quote-large" | "quote" | "form-input" | "form-label" | "form-hint" | "form-dropdown" | "table-header" | "table-body" | "table-body-secondary" | "button" | "link";
3
+ export type VariantType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'base-lg' | 'base-xl' | 'base-xxl' | 'base' | 'base-sm';
4
4
  export type CommonTypographyHTMLAttributes = HTMLAttributes<HTMLParagraphElement> & HTMLAttributes<HTMLHeadingElement> & HTMLAttributes<HTMLSpanElement> & HTMLAttributes<HTMLTableCellElement>;
5
5
  export type TypographyProps = {
6
+ /** Text or children to display */
6
7
  children: ReactNode;
7
- elementProps?: HTMLAttributes<CommonTypographyHTMLAttributes>;
8
- dataTestId?: string;
8
+ /** The HTML element to render as on the DOM */
9
9
  element?: ElementType;
10
- className?: string;
10
+ /** Style to be visually displayed as */
11
11
  variant?: VariantType;
12
+ /** Space separated list of CSS classes to apply */
13
+ className?: string;
14
+ /** Color to apply */
15
+ color?: string;
16
+ /** Whether to apply underline text decoration */
12
17
  underline?: boolean;
18
+ /** Whether to apply strikethrough text decoration */
13
19
  strikethrough?: boolean;
20
+ /** Whether to set a higher 'bold' font weight */
14
21
  bold?: boolean;
22
+ /** Additional props to pass down to native HTML element e.g. dataset attributes */
23
+ elementProps?: HTMLAttributes<CommonTypographyHTMLAttributes> & LabelHTMLAttributes<HTMLLabelElement>;
24
+ /** ID that tests can use to get this component from the DOM */
25
+ ['data-testid']?: string;
15
26
  };
16
27
  /**
17
28
  * Typography component provide HTML 'element' field (default span) and override
18
29
  * element specific styling with 'variant'. 'className' to provide additional
19
30
  * styling. elementProps to provide additional HTML element attributes
20
31
  */
21
- export declare const Typography: import('react').ForwardRefExoticComponent<TypographyProps & import("react").RefAttributes<ElementType | ComponentType>>;
32
+ export declare const Typography: import('react').ForwardRefExoticComponent<TypographyProps & import('react').RefAttributes<ElementType | ComponentType>>;
22
33
  export default Typography;
@@ -1,73 +1,64 @@
1
1
  import '../../assets/Typography.css';
2
- import { jsx as y } from "react/jsx-runtime";
3
- import { forwardRef as u, useMemo as c } from "react";
4
- import { c as f } from "../../clsx-DB4S2d7J.js";
5
- const p = "_h1_111i6_1", g = "_h2_111i6_11", k = "_h3_111i6_21", q = "_h4_111i6_31", T = "_body_111i6_41", w = "_quote_111i6_75", $ = "_form__input_111i6_86", x = "_form__hint_111i6_91", N = "_form__label_111i6_96", S = "_form__dropdown_111i6_101", v = "_table__header_111i6_107", E = "_table__body_111i6_112", V = "_button_111i6_123", r = {
6
- h1: p,
7
- "h1--bold": "_h1--bold_111i6_7",
8
- h2: g,
9
- "h2--bold": "_h2--bold_111i6_17",
10
- h3: k,
11
- "h3--bold": "_h3--bold_111i6_27",
12
- h4: q,
13
- "h4--bold": "_h4--bold_111i6_37",
14
- body: T,
15
- "body--large": "_body--large_111i6_46",
16
- "body--medium": "_body--medium_111i6_50",
17
- "body--small": "_body--small_111i6_54",
18
- "body--tiny": "_body--tiny_111i6_58",
19
- "body--bold": "_body--bold_111i6_62",
20
- "body--strikethrough": "_body--strikethrough_111i6_65",
21
- "body--underlined": "_body--underlined_111i6_68",
22
- "body--strikethrough-underlined": "_body--strikethrough-underlined_111i6_71",
23
- quote: w,
24
- "quote--large": "_quote--large_111i6_80",
25
- form__input: $,
26
- form__hint: x,
27
- form__label: N,
28
- form__dropdown: S,
29
- table__header: v,
30
- table__body: E,
31
- "table__body--secondary": "_table__body--secondary_111i6_117",
32
- button: V
33
- }, j = (t) => {
34
- const _ = t.toString();
35
- let o = "body";
36
- return _.match(/^h[1-4]/) ? o = _ : _.match(/^h[5-6]/) && (o = "h4"), _ === "th" && (o = "table-header"), _ === "td" && (o = "table-body"), o;
37
- }, I = (t) => {
38
- let _ = t.replace(/form-/g, "form__");
39
- return _ = _.replace(/table-/g, "table__"), _ = _.replace(new RegExp("(?<!-)-(?!-)", "g"), "--"), _;
40
- }, U = u((t, _) => {
2
+ import { jsx as b } from "react/jsx-runtime";
3
+ import { forwardRef as m, useMemo as c } from "react";
4
+ import { bemify as f, getBEMBase as k, getBEMBlock as x } from "../../utils/styleStrings.js";
5
+ import { c as B } from "../../clsx-DB4S2d7J.js";
6
+ const t = {
7
+ "u-typography-h1": "_u-typography-h1_zizdh_1",
8
+ "u-typography-h2": "_u-typography-h2_zizdh_8",
9
+ "u-typography-h3": "_u-typography-h3_zizdh_15",
10
+ "u-typography-h4": "_u-typography-h4_zizdh_22",
11
+ "u-typography-h5": "_u-typography-h5_zizdh_29",
12
+ "u-typography-h6": "_u-typography-h6_zizdh_36",
13
+ "u-typography-base": "_u-typography-base_zizdh_43",
14
+ "u-typography-base--xxl": "_u-typography-base--xxl_zizdh_48",
15
+ "u-typography-base--xl": "_u-typography-base--xl_zizdh_52",
16
+ "u-typography-base--lg": "_u-typography-base--lg_zizdh_56",
17
+ "u-typography-base--sm": "_u-typography-base--sm_zizdh_60",
18
+ "u-typography-base--bold": "_u-typography-base--bold_zizdh_64",
19
+ "u-typography-base--strikethrough": "_u-typography-base--strikethrough_zizdh_67",
20
+ "u-typography-base--underlined": "_u-typography-base--underlined_zizdh_70",
21
+ "u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_zizdh_73"
22
+ }, E = (a) => {
23
+ const r = a.toString();
24
+ let h = "base";
25
+ return r.match(/^h[1-6]/) && (h = r), h;
26
+ }, T = m((a, r) => {
41
27
  const {
42
- dataTestId: o,
43
- children: s,
44
- className: n,
45
- underline: l = !1,
46
- element: i = "span",
47
- bold: a = !1,
48
- variant: e = j(i),
49
- strikethrough: d = !1,
50
- elementProps: b
51
- } = t, h = i, m = c(() => f(
52
- r[I(e)],
53
- n,
54
- { [r[`${e}--bold`]]: a },
55
- { [r[`${e}--underlined`]]: l },
56
- { [r[`${e}--strikethrough`]]: d },
57
- { [r[`${e}--strikethrough-underlined`]]: d && d && l }
58
- ), [a, n, d, l, e]);
59
- return /* @__PURE__ */ y(
60
- h,
28
+ children: h,
29
+ className: s,
30
+ underline: y = !1,
31
+ element: u = "span",
32
+ bold: i = !1,
33
+ color: d,
34
+ variant: g = E(u),
35
+ strikethrough: o = !1,
36
+ elementProps: n
37
+ } = a, l = u, z = c(() => {
38
+ const e = `u-typography-${f(g)}`, _ = k(e), p = x(e);
39
+ return console.log("variantBEMified: ", e), B(
40
+ t[_],
41
+ { [t[`${e}`]]: e !== _ },
42
+ s,
43
+ { [t[`${p}--bold`]]: i },
44
+ { [t[`${p}--underlined`]]: y },
45
+ { [t[`${p}--strikethrough`]]: o },
46
+ { [t[`${p}--strikethrough-underlined`]]: o && o && y }
47
+ );
48
+ }, [i, s, o, y, g]);
49
+ return /* @__PURE__ */ b(
50
+ l,
61
51
  {
62
- ref: _,
63
- "data-testid": o,
64
- ...b != null && b,
65
- className: m,
66
- children: s
52
+ style: { color: d },
53
+ ref: r,
54
+ "data-testid": a["data-testid"],
55
+ ...n ?? {},
56
+ className: z,
57
+ children: h
67
58
  }
68
59
  );
69
60
  });
70
61
  export {
71
- U as Typography,
72
- U as default
62
+ T as Typography,
63
+ T as default
73
64
  };