@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,436 @@
1
+ import { b as p, u as re, f as ie } from "./index-CH45lKw7.js";
2
+ import * as f from "react";
3
+ import { L as x } from "./combineHooksSlotProps-DVjg9PRh.js";
4
+ function W(t, e, r = (n, l) => n === l) {
5
+ return t.length === e.length && t.every((n, l) => r(n, e[l]));
6
+ }
7
+ function ue(t, e) {
8
+ return t === e;
9
+ }
10
+ const N = {}, q = () => {
11
+ };
12
+ function L(t, e) {
13
+ const r = p({}, t);
14
+ return Object.keys(e).forEach((n) => {
15
+ e[n] !== void 0 && (r[n] = e[n]);
16
+ }), r;
17
+ }
18
+ function se(t) {
19
+ const {
20
+ nextState: e,
21
+ initialState: r,
22
+ stateComparers: n,
23
+ onStateChange: l,
24
+ controlledProps: a,
25
+ lastActionRef: i
26
+ } = t, h = f.useRef(r);
27
+ f.useEffect(() => {
28
+ if (i.current === null)
29
+ return;
30
+ const s = L(h.current, a);
31
+ Object.keys(e).forEach((C) => {
32
+ var V;
33
+ const g = (V = n[C]) != null ? V : ue, c = e[C], m = s[C];
34
+ if (m == null && c != null || m != null && c == null || m != null && c != null && !g(c, m)) {
35
+ var o, S;
36
+ l == null || l((o = i.current.event) != null ? o : null, C, c, (S = i.current.type) != null ? S : "", e);
37
+ }
38
+ }), h.current = e, i.current = null;
39
+ }, [h, e, i, l, n, a]);
40
+ }
41
+ function ae(t) {
42
+ const e = f.useRef(null), {
43
+ reducer: r,
44
+ initialState: n,
45
+ controlledProps: l = N,
46
+ stateComparers: a = N,
47
+ onStateChange: i = q,
48
+ actionContext: h,
49
+ componentName: s = ""
50
+ } = t, C = f.useRef(l);
51
+ process.env.NODE_ENV !== "production" && f.useEffect(() => {
52
+ Object.keys(l).forEach((o) => {
53
+ C.current[o] !== void 0 && l[o] === void 0 && console.error(`useControllableReducer: ${s ? `The ${s} component` : "A component"} is changing a controlled prop to be uncontrolled: ${o}`), C.current[o] === void 0 && l[o] !== void 0 && console.error(`useControllableReducer: ${s ? `The ${s} component` : "A component"} is changing an uncontrolled prop to be controlled: ${o}`);
54
+ });
55
+ }, [l, s]);
56
+ const V = f.useCallback((o, S) => {
57
+ e.current = S;
58
+ const R = L(o, l);
59
+ return r(R, S);
60
+ }, [l, r]), [g, c] = f.useReducer(V, n), m = f.useCallback((o) => {
61
+ c(p({}, o, {
62
+ context: h
63
+ }));
64
+ }, [h]);
65
+ return se({
66
+ nextState: g,
67
+ initialState: n,
68
+ stateComparers: a ?? N,
69
+ onStateChange: i ?? q,
70
+ controlledProps: l,
71
+ lastActionRef: e
72
+ }), [L(g, l), m];
73
+ }
74
+ function oe(t, e, r, n, l, a) {
75
+ if (r.length === 0 || !n && r.every((h, s) => l(h, s)))
76
+ return -1;
77
+ let i = t;
78
+ for (; ; ) {
79
+ if (!a && e === "next" && i === r.length || !a && e === "previous" && i === -1)
80
+ return -1;
81
+ if (n ? !1 : l(r[i], i))
82
+ i += e === "next" ? 1 : -1, a && (i = (i + r.length) % r.length);
83
+ else
84
+ return i;
85
+ }
86
+ }
87
+ function w(t, e, r) {
88
+ var n;
89
+ const {
90
+ items: l,
91
+ isItemDisabled: a,
92
+ disableListWrap: i,
93
+ disabledItemsFocusable: h,
94
+ itemComparer: s,
95
+ focusManagement: C
96
+ } = r, V = C === "DOM" ? 0 : -1, g = l.length - 1, c = t == null ? -1 : l.findIndex((D) => s(D, t));
97
+ let m, o, S = !i;
98
+ switch (e) {
99
+ case "reset":
100
+ if (V === -1)
101
+ return null;
102
+ m = 0, o = "next", S = !1;
103
+ break;
104
+ case "start":
105
+ m = 0, o = "next", S = !1;
106
+ break;
107
+ case "end":
108
+ m = g, o = "previous", S = !1;
109
+ break;
110
+ default: {
111
+ const D = c + e;
112
+ D < 0 ? !S && c !== -1 || Math.abs(e) > 1 ? (m = 0, o = "next") : (m = g, o = "previous") : D > g ? !S || Math.abs(e) > 1 ? (m = g, o = "previous") : (m = 0, o = "next") : (m = D, o = e >= 0 ? "next" : "previous");
113
+ }
114
+ }
115
+ const R = oe(m, o, l, h, a, S);
116
+ return R === -1 && t !== null && !a(t, c) ? t : (n = l[R]) != null ? n : null;
117
+ }
118
+ function ce(t, e, r, n) {
119
+ return r === "none" ? [] : r === "single" ? n(e[0], t) ? e : [t] : e.some((l) => n(l, t)) ? e.filter((l) => !n(l, t)) : [...e, t];
120
+ }
121
+ function j(t, e, r) {
122
+ const {
123
+ itemComparer: n,
124
+ isItemDisabled: l,
125
+ selectionMode: a,
126
+ items: i
127
+ } = r, {
128
+ selectedValues: h
129
+ } = e, s = i.findIndex((V) => n(t, V));
130
+ if (l(t, s))
131
+ return e;
132
+ const C = ce(t, h, a, n);
133
+ return p({}, e, {
134
+ selectedValues: C,
135
+ highlightedValue: t
136
+ });
137
+ }
138
+ function he(t, e, r) {
139
+ const n = e.highlightedValue, {
140
+ orientation: l,
141
+ pageSize: a
142
+ } = r;
143
+ switch (t) {
144
+ case "Home":
145
+ return p({}, e, {
146
+ highlightedValue: w(n, "start", r)
147
+ });
148
+ case "End":
149
+ return p({}, e, {
150
+ highlightedValue: w(n, "end", r)
151
+ });
152
+ case "PageUp":
153
+ return p({}, e, {
154
+ highlightedValue: w(n, -a, r)
155
+ });
156
+ case "PageDown":
157
+ return p({}, e, {
158
+ highlightedValue: w(n, a, r)
159
+ });
160
+ case "ArrowUp":
161
+ if (l !== "vertical")
162
+ break;
163
+ return p({}, e, {
164
+ highlightedValue: w(n, -1, r)
165
+ });
166
+ case "ArrowDown":
167
+ if (l !== "vertical")
168
+ break;
169
+ return p({}, e, {
170
+ highlightedValue: w(n, 1, r)
171
+ });
172
+ case "ArrowLeft": {
173
+ if (l === "vertical")
174
+ break;
175
+ return p({}, e, {
176
+ highlightedValue: w(n, l === "horizontal-ltr" ? -1 : 1, r)
177
+ });
178
+ }
179
+ case "ArrowRight": {
180
+ if (l === "vertical")
181
+ break;
182
+ return p({}, e, {
183
+ highlightedValue: w(n, l === "horizontal-ltr" ? 1 : -1, r)
184
+ });
185
+ }
186
+ case "Enter":
187
+ case " ":
188
+ return e.highlightedValue === null ? e : j(e.highlightedValue, e, r);
189
+ }
190
+ return e;
191
+ }
192
+ function ge(t, e) {
193
+ return e.focusManagement === "DOM" ? t : p({}, t, {
194
+ highlightedValue: null
195
+ });
196
+ }
197
+ function de(t, e, r) {
198
+ var n;
199
+ const l = (n = r(t)) == null ? void 0 : n.trim().toLowerCase();
200
+ return !l || l.length === 0 ? !1 : l.indexOf(e) === 0;
201
+ }
202
+ function fe(t, e, r) {
203
+ const {
204
+ items: n,
205
+ isItemDisabled: l,
206
+ disabledItemsFocusable: a,
207
+ getItemAsString: i
208
+ } = r, h = e.length > 1;
209
+ let s = h ? t.highlightedValue : w(t.highlightedValue, 1, r);
210
+ for (let C = 0; C < n.length; C += 1) {
211
+ if (!s || !h && t.highlightedValue === s)
212
+ return t;
213
+ if (de(s, e, i) && (!l(s, n.indexOf(s)) || a))
214
+ return p({}, t, {
215
+ highlightedValue: s
216
+ });
217
+ s = w(s, 1, r);
218
+ }
219
+ return t;
220
+ }
221
+ function me(t, e, r, n) {
222
+ var l;
223
+ const {
224
+ itemComparer: a,
225
+ focusManagement: i
226
+ } = n;
227
+ let h = null;
228
+ if (r.highlightedValue != null) {
229
+ var s;
230
+ h = (s = t.find((g) => a(g, r.highlightedValue))) != null ? s : null;
231
+ } else
232
+ i === "DOM" && e.length === 0 && (h = w(null, "reset", n));
233
+ const V = ((l = r.selectedValues) != null ? l : []).filter((g) => t.some((c) => a(c, g)));
234
+ return p({}, r, {
235
+ highlightedValue: h,
236
+ selectedValues: V
237
+ });
238
+ }
239
+ function pe(t, e) {
240
+ return p({}, t, {
241
+ highlightedValue: w(null, "reset", e)
242
+ });
243
+ }
244
+ function Ce(t, e) {
245
+ return p({}, t, {
246
+ highlightedValue: w(null, "end", e)
247
+ });
248
+ }
249
+ function Se(t, e) {
250
+ return p({}, t, {
251
+ selectedValues: [],
252
+ highlightedValue: w(null, "reset", e)
253
+ });
254
+ }
255
+ function Ie(t, e) {
256
+ const {
257
+ type: r,
258
+ context: n
259
+ } = e;
260
+ switch (r) {
261
+ case x.keyDown:
262
+ return he(e.key, t, n);
263
+ case x.itemClick:
264
+ return j(e.item, t, n);
265
+ case x.blur:
266
+ return ge(t, n);
267
+ case x.textNavigation:
268
+ return fe(t, e.searchString, n);
269
+ case x.itemsChange:
270
+ return me(e.items, e.previousItems, t, n);
271
+ case x.resetHighlight:
272
+ return pe(t, n);
273
+ case x.highlightLast:
274
+ return Ce(t, n);
275
+ case x.clearSelection:
276
+ return Se(t, n);
277
+ default:
278
+ return t;
279
+ }
280
+ }
281
+ const be = 500;
282
+ function xe(t) {
283
+ const e = f.useRef({
284
+ searchString: "",
285
+ lastTime: null
286
+ });
287
+ return f.useCallback((r) => {
288
+ if (r.key.length === 1 && r.key !== " ") {
289
+ const n = e.current, l = r.key.toLowerCase(), a = performance.now();
290
+ n.searchString.length > 0 && n.lastTime && a - n.lastTime > be ? n.searchString = l : (n.searchString.length !== 1 || l !== n.searchString) && (n.searchString += l), n.lastTime = a, t(n.searchString, r);
291
+ }
292
+ }, [t]);
293
+ }
294
+ const z = {}, Ve = () => {
295
+ }, we = (t, e) => t === e, De = () => !1, Re = (t) => typeof t == "string" ? t : String(t), ve = () => ({
296
+ highlightedValue: null,
297
+ selectedValues: []
298
+ });
299
+ function Me(t) {
300
+ const {
301
+ controlledProps: e = z,
302
+ disabledItemsFocusable: r = !1,
303
+ disableListWrap: n = !1,
304
+ focusManagement: l = "activeDescendant",
305
+ getInitialState: a = ve,
306
+ getItemDomElement: i,
307
+ getItemId: h,
308
+ isItemDisabled: s = De,
309
+ rootRef: C,
310
+ onStateChange: V = Ve,
311
+ items: g,
312
+ itemComparer: c = we,
313
+ getItemAsString: m = Re,
314
+ onChange: o,
315
+ onHighlightChange: S,
316
+ onItemsChange: R,
317
+ orientation: D = "vertical",
318
+ pageSize: P = 5,
319
+ reducerActionContext: H = z,
320
+ selectionMode: $ = "single",
321
+ stateReducer: _,
322
+ componentName: G = "useList"
323
+ } = t;
324
+ if (process.env.NODE_ENV !== "production") {
325
+ if (l === "DOM" && i == null)
326
+ throw new Error("useList: The `getItemDomElement` prop is required when using the `DOM` focus management.");
327
+ if (l === "activeDescendant" && h == null)
328
+ throw new Error("useList: The `getItemId` prop is required when using the `activeDescendant` focus management.");
329
+ }
330
+ const B = f.useRef(null), F = re(C, B), T = f.useCallback((d, u, I) => {
331
+ if (S == null || S(d, u, I), l === "DOM" && u != null && (I === x.itemClick || I === x.keyDown || I === x.textNavigation)) {
332
+ var b;
333
+ i == null || (b = i(u)) == null || b.focus();
334
+ }
335
+ }, [i, S, l]), O = f.useMemo(() => ({
336
+ highlightedValue: c,
337
+ selectedValues: (d, u) => W(d, u, c)
338
+ }), [c]), J = f.useCallback((d, u, I, b, M) => {
339
+ switch (V == null || V(d, u, I, b, M), u) {
340
+ case "highlightedValue":
341
+ T(d, I, b);
342
+ break;
343
+ case "selectedValues":
344
+ o == null || o(d, I, b);
345
+ break;
346
+ }
347
+ }, [T, o, V]), K = f.useMemo(() => ({
348
+ disabledItemsFocusable: r,
349
+ disableListWrap: n,
350
+ focusManagement: l,
351
+ isItemDisabled: s,
352
+ itemComparer: c,
353
+ items: g,
354
+ getItemAsString: m,
355
+ onHighlightChange: T,
356
+ orientation: D,
357
+ pageSize: P,
358
+ selectionMode: $,
359
+ stateComparers: O
360
+ }), [r, n, l, s, c, g, m, T, D, P, $, O]), Y = a(), X = _ ?? Ie, Q = f.useMemo(() => p({}, H, K), [H, K]), [k, v] = ae({
361
+ reducer: X,
362
+ actionContext: Q,
363
+ initialState: Y,
364
+ controlledProps: e,
365
+ stateComparers: O,
366
+ onStateChange: J,
367
+ componentName: G
368
+ }), {
369
+ highlightedValue: E,
370
+ selectedValues: A
371
+ } = k, Z = xe((d, u) => v({
372
+ type: x.textNavigation,
373
+ event: u,
374
+ searchString: d
375
+ })), y = f.useRef([]);
376
+ f.useEffect(() => {
377
+ W(y.current, g, c) || (v({
378
+ type: x.itemsChange,
379
+ event: null,
380
+ items: g,
381
+ previousItems: y.current
382
+ }), y.current = g, R == null || R(g));
383
+ }, [g, c, v, R]);
384
+ const ee = (d) => (u) => {
385
+ var I;
386
+ if ((I = d.onKeyDown) == null || I.call(d, u), u.defaultMuiPrevented)
387
+ return;
388
+ const b = ["Home", "End", "PageUp", "PageDown"];
389
+ D === "vertical" ? b.push("ArrowUp", "ArrowDown") : b.push("ArrowLeft", "ArrowRight"), l === "activeDescendant" && b.push(" ", "Enter"), b.includes(u.key) && u.preventDefault(), v({
390
+ type: x.keyDown,
391
+ key: u.key,
392
+ event: u
393
+ }), Z(u);
394
+ }, te = (d) => (u) => {
395
+ var I, b;
396
+ (I = d.onBlur) == null || I.call(d, u), !u.defaultMuiPrevented && ((b = B.current) != null && b.contains(u.relatedTarget) || v({
397
+ type: x.blur,
398
+ event: u
399
+ }));
400
+ }, ne = (d = {}) => {
401
+ const u = ie(d);
402
+ return p({}, d, {
403
+ "aria-activedescendant": l === "activeDescendant" && E != null ? h(E) : void 0,
404
+ tabIndex: l === "DOM" ? -1 : 0,
405
+ ref: F
406
+ }, u, {
407
+ onBlur: te(u),
408
+ onKeyDown: ee(u)
409
+ });
410
+ }, U = f.useCallback((d) => {
411
+ const u = (A ?? []).some((M) => M != null && c(d, M)), I = E != null && c(d, E);
412
+ return {
413
+ focusable: l === "DOM",
414
+ highlighted: I,
415
+ selected: u
416
+ };
417
+ }, [c, A, E, l]), le = f.useMemo(() => ({
418
+ dispatch: v,
419
+ getItemState: U
420
+ }), [v, U]);
421
+ return f.useDebugValue({
422
+ state: k
423
+ }), {
424
+ contextValue: le,
425
+ dispatch: v,
426
+ getRootProps: ne,
427
+ rootRef: F,
428
+ state: k
429
+ };
430
+ }
431
+ export {
432
+ j as h,
433
+ Ie as l,
434
+ w as m,
435
+ Me as u
436
+ };
@@ -0,0 +1,36 @@
1
+ import * as n from "react";
2
+ const u = {};
3
+ function c(t, r) {
4
+ const e = n.useRef(u);
5
+ return e.current === u && (e.current = t(r)), e;
6
+ }
7
+ const i = [];
8
+ function o(t) {
9
+ n.useEffect(t, i);
10
+ }
11
+ class s {
12
+ constructor() {
13
+ this.currentId = null, this.clear = () => {
14
+ this.currentId !== null && (clearTimeout(this.currentId), this.currentId = null);
15
+ }, this.disposeEffect = () => this.clear;
16
+ }
17
+ static create() {
18
+ return new s();
19
+ }
20
+ /**
21
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
22
+ */
23
+ start(r, e) {
24
+ this.clear(), this.currentId = setTimeout(() => {
25
+ this.currentId = null, e();
26
+ }, r);
27
+ }
28
+ }
29
+ function f() {
30
+ const t = c(s.create).current;
31
+ return o(t.disposeEffect), t;
32
+ }
33
+ export {
34
+ s as T,
35
+ f as u
36
+ };
@@ -0,0 +1,6 @@
1
+ import { Split } from '../types/helpers';
2
+
3
+ export type BlockType<T extends string> = Split<T, '-'>[0];
4
+ export declare const bemify: <T extends string>(variant: T, blocksWithElements?: BlockType<T>[]) => string;
5
+ export declare const getBEMBase: (variant: string) => string;
6
+ export declare const getBEMBlock: (variant: string) => string;
@@ -0,0 +1,10 @@
1
+ const n = (r, e) => {
2
+ const g = new RegExp(`^([${e == null ? void 0 : e.join("|")}]*)-`);
3
+ let t = r.replace(g, "$1__");
4
+ return t = t.replace(new RegExp("(?<!-)-(?!-)", "g"), "--"), t;
5
+ }, p = (r) => r.split("--")[0], B = (r) => r.split(/--|__/)[0];
6
+ export {
7
+ n as bemify,
8
+ p as getBEMBase,
9
+ B as getBEMBlock
10
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pismo/marola",
3
3
  "description": "CDX tribe component library",
4
- "version": "0.0.1-alpha.2",
4
+ "version": "0.0.1-alpha.20",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -17,36 +17,78 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "dev": "vite",
20
- "build": "tsc --p ./tsconfig-build.json && vite build",
21
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
20
+ "lint": "eslint . --report-unused-disable-directives --max-warnings 0",
21
+ "lint:fix": "yarn lint --fix",
22
+ "lint:scss": "stylelint \"**/*.scss\" --fix",
23
+ "prettier": "prettier . --write",
22
24
  "preview": "vite preview",
23
- "prepublishOnly": "npm run build"
25
+ "prepublishOnly": "npm run build",
26
+ "test": "yarn test:unit",
27
+ "test:unit": "vitest run",
28
+ "test:unit:visual": "vitest-preview",
29
+ "test:unit:watch": "vitest",
30
+ "test:e2e": "echo \"no test implemented\"",
31
+ "coverage": "vitest run --coverage",
32
+ "export-files": "node scripts/export-files.cjs",
33
+ "prebuild": "yarn export-files",
34
+ "build": "tsc --p ./tsconfig-build.json && vite build && mv ./dist/assets/marola.css ./dist",
35
+ "postbuild": "storybook build --disable-telemetry --output-dir build",
36
+ "storybook": "storybook dev -p 6006"
24
37
  },
25
38
  "peerDependencies": {
26
39
  "react": "^18.2.0",
27
40
  "react-dom": "^18.2.0"
28
41
  },
29
42
  "devDependencies": {
43
+ "@ianvs/prettier-plugin-sort-imports": "^4.2.1",
44
+ "@storybook/addon-a11y": "^8.0.8",
45
+ "@storybook/addon-essentials": "^8.0.8",
46
+ "@storybook/addon-interactions": "^8.0.8",
47
+ "@storybook/addon-links": "^8.0.8",
48
+ "@storybook/addon-onboarding": "^8.0.8",
49
+ "@storybook/blocks": "^8.0.8",
50
+ "@storybook/react": "^8.0.8",
51
+ "@storybook/react-vite": "^8.0.8",
52
+ "@storybook/test": "^8.0.8",
53
+ "@testing-library/react": "^15.0.5",
30
54
  "@types/node": "^20.12.2",
31
55
  "@types/react": "^18.2.66",
32
56
  "@types/react-dom": "^18.2.22",
33
- "@typescript-eslint/eslint-plugin": "^7.2.0",
34
- "@typescript-eslint/parser": "^7.2.0",
57
+ "@typescript-eslint/eslint-plugin": "^7.6.0",
58
+ "@typescript-eslint/parser": "^7.6.0",
35
59
  "@vitejs/plugin-react": "^4.2.1",
36
60
  "clsx": "^2.1.0",
61
+ "commitlint": "^19.2.1",
62
+ "cypress": "^13.8.1",
37
63
  "eslint": "^8.57.0",
64
+ "eslint-config-prettier": "^9.1.0",
65
+ "eslint-plugin-prettier": "^5.1.3",
38
66
  "eslint-plugin-react-hooks": "^4.6.0",
39
67
  "eslint-plugin-react-refresh": "^0.4.6",
40
- "glob": "^10.3.12",
68
+ "eslint-plugin-simple-import-sort": "^12.0.0",
69
+ "eslint-plugin-storybook": "^0.8.0",
70
+ "glob": "^10.3.14",
71
+ "husky": "^9.0.11",
72
+ "jsdom": "^24.0.0",
73
+ "prettier": "^3.2.5",
41
74
  "react": "^18.2.0",
42
75
  "react-dom": "^18.2.0",
43
76
  "sass": "^1.72.0",
77
+ "storybook": "^8.0.8",
78
+ "stylelint": "^16.3.1",
79
+ "stylelint-config-recess-order": "^5.0.0",
80
+ "stylelint-config-standard-scss": "^13.1.0",
81
+ "stylelint-prettier": "^5.0.0",
44
82
  "typescript": "^5.2.2",
45
83
  "vite": "^5.2.0",
46
84
  "vite-plugin-dts": "^3.8.1",
47
- "vite-plugin-lib-inject-css": "^2.0.1"
85
+ "vite-plugin-lib-inject-css": "^2.0.1",
86
+ "vite-plugin-svgr": "^4.2.0",
87
+ "vitest": "^1.4.0",
88
+ "vitest-preview": "^0.0.1"
48
89
  },
49
90
  "dependencies": {
50
- "@mui/base": "^5.0.0-beta.40"
91
+ "@mui/base": "^5.0.0-beta.40",
92
+ "@mui/material": "^5.15.15"
51
93
  }
52
94
  }