@pismo/marola 0.0.1-alpha.9 → 1.0.0-beta.1
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.
- package/README.md +1 -1
- package/dist/{Button-B1umG8kJ.js → Button-2b1peDFT.js} +25 -26
- package/dist/{ClickAwayListener-BKznXF1d.js → ClickAwayListener-BSW-Nd-y.js} +3 -2
- package/dist/Dialog.module-DFEmFdYT.js +30 -0
- package/dist/Group-B3p31ftp.js +26 -0
- package/dist/Popup-B6ZSGIEI.js +1248 -0
- package/dist/{Portal-BcdMtRGF.js → Portal-DIeBsWdL.js} +2 -2
- package/dist/SelectButton-C8JQKaf4.js +61 -0
- package/dist/Tabs.module-jkH1Qjn7.js +22 -0
- package/dist/Toggle-BCgIItCc.js +142 -0
- package/dist/assets/Advice.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Checkbox.css +1 -1
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/EllipsisTooltip.css +1 -0
- package/dist/assets/Group.css +1 -0
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/InputSearch.css +1 -1
- package/dist/assets/PageHeader.css +1 -1
- package/dist/assets/Pagination.css +1 -1
- package/dist/assets/SelectButton.css +1 -0
- package/dist/assets/Skeleton.css +1 -1
- package/dist/assets/Snackbar.css +1 -1
- package/dist/assets/SortTooltip.css +1 -1
- package/dist/assets/Stepper.css +1 -1
- package/dist/assets/Table.css +1 -1
- package/dist/assets/TextDisplay.css +1 -0
- package/dist/assets/Toggle.css +1 -1
- package/dist/assets/Toggle2.css +1 -0
- package/dist/assets/Typography.css +1 -1
- package/dist/combineHooksSlotProps-DVjg9PRh.js +80 -0
- package/dist/components/Advice/Advice.d.ts +17 -3
- package/dist/components/Advice/Advice.js +39 -17
- package/dist/components/Advice/Advice.stories.d.ts +18 -0
- package/dist/components/Button/Button.d.ts +6 -3
- package/dist/components/Button/Button.js +60 -65
- package/dist/components/Button/Button.stories.d.ts +3 -1
- package/dist/components/Checkbox/Checkbox.d.ts +19 -2
- package/dist/components/Checkbox/Checkbox.js +63 -40
- package/dist/components/Checkbox/Checkbox.stories.d.ts +31 -0
- package/dist/components/Chip/Chip.d.ts +39 -0
- package/dist/components/Chip/Chip.js +19 -0
- package/dist/components/Chip/Chip.stories.d.ts +42 -0
- package/dist/components/Chip/chip.test.d.ts +1 -0
- package/dist/components/Dialog/Actions.js +1 -1
- package/dist/components/Dialog/Backdrop.js +1 -1
- package/dist/components/Dialog/CloseIconButton.js +2 -2
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/Dialog.js +13 -13
- package/dist/components/Dialog/Dialog.stories.d.ts +10 -10
- package/dist/components/Dialog/{Title.d.ts → DialogTitle.d.ts} +3 -3
- package/dist/components/Dialog/DialogTitle.js +29 -0
- package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +7 -0
- package/dist/components/EllipsisTooltip/EllipsisTooltip.js +23 -0
- package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +31 -0
- package/dist/components/Icon/Icon.d.ts +8 -15
- package/dist/components/Icon/Icon.js +108 -57
- package/dist/components/Icon/Icon.stories.d.ts +14 -0
- package/dist/components/Icon/types.d.ts +5 -0
- package/dist/components/Icon/types.js +1 -0
- package/dist/components/IconButton/Icon.stories.d.ts +15 -0
- package/dist/components/IconButton/IconButton.d.ts +18 -2
- package/dist/components/IconButton/IconButton.js +58 -63
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +241 -230
- package/dist/components/InputSearch/InputSearch.d.ts +7 -9
- package/dist/components/InputSearch/InputSearch.js +30 -25
- package/dist/components/InputSearch/InputSearch.stories.d.ts +21 -4
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +36 -6
- package/dist/components/PageHeader/PageHeader.js +83 -47
- package/dist/components/PageHeader/PageHeader.stories.d.ts +2 -31
- package/dist/components/Pagination/Pagination.d.ts +24 -5
- package/dist/components/Pagination/Pagination.js +127 -109
- package/dist/components/Pagination/Pagination.stories.d.ts +17 -0
- package/dist/components/Select/Select.d.ts +26 -0
- package/dist/components/Select/Select.js +857 -0
- package/dist/components/Select/Select.stories.d.ts +22 -0
- package/dist/components/Select/SelectButton.d.ts +12 -0
- package/dist/components/Select/SelectButton.js +8 -0
- package/dist/components/Skeleton/Skeleton.d.ts +10 -3
- package/dist/components/Skeleton/Skeleton.js +16 -19
- package/dist/components/Skeleton/Skeleton.stories.d.ts +14 -0
- package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +14 -0
- package/dist/components/Skeleton/SkeletonTable.stories.d.ts +16 -0
- package/dist/components/Snackbar/Snackbar.d.ts +19 -5
- package/dist/components/Snackbar/Snackbar.js +247 -230
- package/dist/components/Snackbar/Snackbar.stories.d.ts +319 -0
- package/dist/components/SortTooltip/SortTooltip.d.ts +3 -1
- package/dist/components/SortTooltip/SortTooltip.js +55 -29
- package/dist/components/Stepper/Stepper.d.ts +11 -1
- package/dist/components/Stepper/Stepper.js +37 -22
- package/dist/components/Stepper/Stepper.stories.d.ts +16 -0
- package/dist/components/Table/Table.d.ts +33 -16
- package/dist/components/Table/Table.js +106 -91
- package/dist/components/Table/Table.stories.d.ts +29 -0
- package/dist/components/Table/_Table.TBody.stories.d.ts +14 -0
- package/dist/components/Table/_Table.THead.stories.d.ts +14 -0
- package/dist/components/Table/_Table.Td.stories.d.ts +16 -0
- package/dist/components/Table/_Table.Th.stories.d.ts +15 -0
- package/dist/components/Table/_Table.Tr.stories.d.ts +15 -0
- package/dist/components/Tabs/Tab.d.ts +5 -0
- package/dist/components/Tabs/Tab.js +179 -6
- package/dist/components/Tabs/Tab.stories.d.ts +15 -0
- package/dist/components/Tabs/TabPanel.d.ts +4 -0
- package/dist/components/Tabs/TabPanel.js +12 -12
- package/dist/components/Tabs/TabPanel.stories.d.ts +14 -0
- package/dist/components/Tabs/Tabs.d.ts +5 -1
- package/dist/components/Tabs/Tabs.js +242 -668
- package/dist/components/Tabs/Tabs.stories.d.ts +14 -0
- package/dist/components/TextDisplay/TextDisplay.d.ts +23 -0
- package/dist/components/TextDisplay/TextDisplay.js +37 -0
- package/dist/components/TextDisplay/TextDisplay.stories.d.ts +13 -0
- package/dist/components/TextDisplay/textDisplay.test.d.ts +1 -0
- package/dist/components/Toggle/Toggle.js +143 -129
- package/dist/components/ToggleGroup/Group.d.ts +18 -0
- package/dist/components/ToggleGroup/Group.js +7 -0
- package/dist/components/ToggleGroup/Group.test.d.ts +1 -0
- package/dist/components/ToggleGroup/Toggle.d.ts +15 -0
- package/dist/components/ToggleGroup/Toggle.js +17 -0
- package/dist/components/ToggleGroup/Toggle.test.d.ts +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +6 -0
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +25 -0
- package/dist/components/Tooltip/Tooltip.d.ts +22 -6
- package/dist/components/Tooltip/Tooltip.js +114 -1339
- package/dist/components/Tooltip/Tooltip.stories.d.ts +35 -0
- package/dist/components/Typography/Typography.d.ts +5 -2
- package/dist/components/Typography/Typography.js +58 -74
- package/dist/components/Typography/Typography.stories.d.ts +1 -0
- package/dist/contexts/SnackbarProvider/SnackbarProvider.d.ts +11 -0
- package/dist/contexts/SnackbarProvider/SnackbarProvider.js +50 -0
- package/dist/contexts/SnackbarProvider/SnackbarProvider.stories.d.ts +21 -0
- package/dist/{index-CqjC7P5Y.js → index-CH45lKw7.js} +333 -307
- package/dist/{index-BNWbc5Kh.js → index-CjW42-M-.js} +3108 -3152
- package/dist/main.d.ts +10 -1
- package/dist/main.js +74 -55
- package/dist/marola.css +1 -0
- package/dist/{useButton-Bc8IAgyk.js → useButton-DNk3wrQp.js} +3 -4
- package/dist/useCompoundItem-D1iRfg8D.js +84 -0
- package/dist/useEventCallback-xTG9piMa.js +45 -0
- package/dist/useList-B0hog_3-.js +436 -0
- package/dist/utils/styleStrings.d.ts +1 -1
- package/dist/utils/styleStrings.js +7 -7
- package/package.json +4 -4
- package/dist/Dialog.module-CGVM5V_D.js +0 -15
- package/dist/Tab-CRwnhsj5.js +0 -254
- package/dist/Tabs.module-yYcTJnj6.js +0 -103
- package/dist/_commonjsHelpers-CT_km90n.js +0 -30
- package/dist/assets/global.css +0 -1
- package/dist/components/Button/Button.stories.js +0 -40
- package/dist/components/Dialog/Dialog.stories.js +0 -59
- package/dist/components/Dialog/Title.js +0 -29
- package/dist/components/Input/Input.stories.js +0 -106
- package/dist/components/InputSearch/InputSearch.stories.js +0 -36
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +0 -38
- package/dist/components/PageHeader/PageHeader.stories.js +0 -49
- package/dist/components/Toggle/Toggle.stories.js +0 -33
- package/dist/components/Typography/Typography.stories.js +0 -30
- package/dist/components/Typography/typography.test.js +0 -11357
- package/dist/magic-string.es-O_8lTkE3.js +0 -738
- package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +0 -26
- package/dist/utils/styleStrings.test.js +0 -41
- package/dist/vi.Y_w82WR8-Df0JUamG.js +0 -9860
|
@@ -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
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Split } from '../types/helpers';
|
|
2
2
|
|
|
3
3
|
export type BlockType<T extends string> = Split<T, '-'>[0];
|
|
4
|
-
export declare const bemify: <T extends string>(variant: T, blocksWithElements
|
|
4
|
+
export declare const bemify: <T extends string>(variant: T, blocksWithElements?: BlockType<T>[]) => string;
|
|
5
5
|
export declare const getBEMBase: (variant: string) => string;
|
|
6
6
|
export declare const getBEMBlock: (variant: string) => string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
let t =
|
|
1
|
+
const n = (r, e) => {
|
|
2
|
+
const g = new RegExp(`^([${e == null ? void 0 : e.join("|")}]*)-`);
|
|
3
|
+
let t = r.replace(g, "$1__");
|
|
4
4
|
return t = t.replace(new RegExp("(?<!-)-(?!-)", "g"), "--"), t;
|
|
5
|
-
},
|
|
5
|
+
}, p = (r) => r.split("--")[0], B = (r) => r.split(/--|__/)[0];
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
n as bemify,
|
|
8
|
+
p as getBEMBase,
|
|
9
|
+
B as getBEMBlock
|
|
10
10
|
};
|
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
|
|
4
|
+
"version": "1.0.0-beta.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
"test:e2e": "echo \"no test implemented\"",
|
|
31
31
|
"coverage": "vitest run --coverage",
|
|
32
32
|
"export-files": "node scripts/export-files.cjs",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"generate-icon-types": "node scripts/generate-icon-types.cjs",
|
|
34
|
+
"prebuild": "yarn export-files & yarn generate-icon-types",
|
|
35
|
+
"build": "tsc --p ./tsconfig-build.json && vite build && mv ./dist/assets/marola.css ./dist",
|
|
35
36
|
"postbuild": "storybook build --disable-telemetry --output-dir build",
|
|
36
37
|
"storybook": "storybook dev -p 6006"
|
|
37
38
|
},
|
|
@@ -45,7 +46,6 @@
|
|
|
45
46
|
"@storybook/addon-essentials": "^8.0.8",
|
|
46
47
|
"@storybook/addon-interactions": "^8.0.8",
|
|
47
48
|
"@storybook/addon-links": "^8.0.8",
|
|
48
|
-
"@storybook/addon-onboarding": "^8.0.8",
|
|
49
49
|
"@storybook/blocks": "^8.0.8",
|
|
50
50
|
"@storybook/react": "^8.0.8",
|
|
51
51
|
"@storybook/react-vite": "^8.0.8",
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|