@pismo/marola 2.1.63 → 2.1.65
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/dist/Button-CJaBSdv1.js +135 -0
- package/dist/ClassNameConfigurator-CVRWfyIa.js +847 -0
- package/dist/{ClickAwayListener-Z08peX_P.js → ClickAwayListener-BnYMO5Ki.js} +26 -33
- package/dist/Popup-D267EI4e.js +1338 -0
- package/dist/{Portal-DJapUCn6.js → Portal-BrGvxB96.js} +32 -36
- package/dist/RadioOption-DyRY8xlF.js +1094 -0
- package/dist/{Toggle-DcZTfLrC.js → Toggle-nnDfpqI1.js} +31 -31
- package/dist/assets/Checkbox.css +1 -1
- package/dist/assets/DropdownMenu.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/ToastCard.css +1 -1
- package/dist/assets/Toggle2.css +1 -1
- package/dist/combineHooksSlotProps-j-8UVeYo.js +86 -0
- package/dist/components/Alert/Alert.stories.d.ts +6 -6
- package/dist/components/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +311 -320
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +1 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +4 -4
- package/dist/components/BankingCard/BankingCard.d.ts +0 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +56 -56
- package/dist/components/Checkbox/Checkbox.stories.d.ts +8 -8
- package/dist/components/Chip/Chip.js +3 -3
- package/dist/components/DatePicker/DatePicker.js +742 -639
- package/dist/components/DatePicker/DatePicker.stories.d.ts +8 -8
- package/dist/components/DatePicker/dateUtils.d.ts +2 -2
- package/dist/components/DatePicker/dateUtils.js +1 -1
- package/dist/components/DatePicker/keyboardNavigation.d.ts +1 -1
- package/dist/components/DatePicker/renderCalendarDays.js +1 -1
- package/dist/components/DatePicker/renderPeriodSelection.js +1 -1
- package/dist/components/Dialog/CloseIconButton.js +1 -1
- package/dist/components/Dialog/Dialog.js +372 -352
- package/dist/components/Dialog/Dialog.stories.d.ts +96 -135
- package/dist/components/DoubleAutocomplete/DoubleAutocomplete.d.ts +1 -1
- package/dist/components/DoubleAutocomplete/DoubleAutocomplete.js +2 -2
- package/dist/components/DoubleAutocomplete/DoubleAutocomplete.stories.d.ts +1 -1
- package/dist/components/DoubleInput/DoubleInput.stories.d.ts +1 -1
- package/dist/components/Draggable/Draggable.d.ts +0 -1
- package/dist/components/Draggable/Draggable.js +1 -1
- package/dist/components/Draggable/Draggable.stories.d.ts +2 -3
- package/dist/components/Draggable/useDraggable.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +3 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +39 -34
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +6 -4
- package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +4 -4
- package/dist/components/IconButton/IconButton.js +1 -1
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.js +361 -340
- package/dist/components/Input/Input.stories.d.ts +2 -0
- package/dist/components/InputSearch/InputSearch.d.ts +31 -30
- package/dist/components/InputSearch/InputSearch.stories.d.ts +31 -30
- package/dist/components/Popover/Popover.d.ts +3 -3
- package/dist/components/Popover/Popover.js +2 -2
- package/dist/components/Popover/Popover.stories.d.ts +3 -3
- package/dist/components/Popover/PopoverBody.d.ts +0 -1
- package/dist/components/Popover/PopoverFooter.d.ts +0 -1
- package/dist/components/Popover/PopoverHeader.d.ts +0 -1
- package/dist/components/RadioButton/RadioButton.d.ts +0 -1
- package/dist/components/RadioButton/RadioButton.js +684 -769
- package/dist/components/RadioButton/RadioOption.d.ts +0 -1
- package/dist/components/RadioButton/RadioOption.js +3 -3
- package/dist/components/ResultContainer/ResultContainer.d.ts +0 -1
- package/dist/components/ResultContainer/ResultContainer.stories.d.ts +9 -9
- package/dist/components/ResultWithChips/ResultWithChips.js +1 -1
- package/dist/components/ResultWithChips/ResultWithChips.stories.d.ts +9 -9
- package/dist/components/RowItem/RowItem.js +2 -2
- package/dist/components/Select/Select.js +625 -591
- package/dist/components/Skeleton/Skeleton.d.ts +0 -1
- package/dist/components/Snackbar/Snackbar.js +295 -239
- package/dist/components/Snackbar/Snackbar.stories.d.ts +113 -113
- package/dist/components/StepperNavigator/StepperNavigator.d.ts +0 -1
- package/dist/components/Table/Table.stories.d.ts +5 -5
- package/dist/components/Tabs/Tab.js +107 -98
- package/dist/components/Tabs/TabPanel.js +58 -55
- package/dist/components/Tabs/Tabs.js +246 -231
- package/dist/components/ToastCard/ToastCard.js +31 -31
- package/dist/components/Toggle/Toggle.js +147 -137
- package/dist/components/Toggle/Toggle.stories.d.ts +5 -5
- package/dist/components/ToggleGroup/Toggle.d.ts +0 -1
- package/dist/components/ToggleGroup/Toggle.js +2 -2
- package/dist/components/ToggleGroup/ToggleGroup.js +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +266 -325
- package/dist/components/Tooltip/Tooltip.stories.d.ts +4 -4
- package/dist/components/TransactionRow/TransactionRow.stories.d.ts +21 -21
- package/dist/contexts/DraggableProvider/DraggableProvider.d.ts +0 -1
- package/dist/contexts/DraggableProvider/DraggableProvider.js +1 -1
- package/dist/contexts/SnackbarProvider/SnackbarProvider.js +1 -1
- package/dist/{dayjs.min-ClQKmc--.js → dayjs.min-BtgZiFZY.js} +14 -14
- package/dist/getReactElementRef-iorwYm2A.js +19 -0
- package/dist/{index-1UpBa69h.js → index-ew-96uBP.js} +2129 -2128
- package/dist/isFocusVisible-CPZqtjv2.js +12 -0
- package/dist/main.js +2 -2
- package/dist/{ownerDocument-By592Iy6.js → ownerDocument-CU-LCrtd.js} +1 -1
- package/dist/react-BTbo_5A3.js +526 -0
- package/dist/setRef-Bo0HEdBB.js +6 -0
- package/dist/useButton-C2E_LFJp.js +90 -0
- package/dist/useControlled-BYdyS7Pn.js +31 -0
- package/dist/useId-CK6Kn3Tn.js +21 -0
- package/dist/useList-BLW78Lq7.js +446 -0
- package/dist/utils/draggable.d.ts +2 -2
- package/package.json +5 -4
- package/dist/Button-BrEDdtHO.js +0 -130
- package/dist/Popup-Dffqo7wT.js +0 -1246
- package/dist/RadioOption-DYovqiwF.js +0 -720
- package/dist/combineHooksSlotProps-BhQ14uyD.js +0 -79
- package/dist/exactProp-SYjL19cU.js +0 -13
- package/dist/react-BvI-Sw9b.js +0 -509
- package/dist/useButton-CezPDte8.js +0 -105
- package/dist/useControlled-CCMYYdCM.js +0 -31
- package/dist/useId-BW-oWmul.js +0 -19
- package/dist/useIsFocusVisible-BH4IAdcw.js +0 -69
- package/dist/useList-nqLfZem8.js +0 -435
- package/dist/useSlotProps-CYHDC4TN.js +0 -834
- package/dist/useTimeout-DxF9kiZL.js +0 -36
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
let n = 0;
|
|
3
|
+
function o(t) {
|
|
4
|
+
const [e, a] = u.useState(t), c = t || e;
|
|
5
|
+
return u.useEffect(() => {
|
|
6
|
+
e == null && (n += 1, a(`mui-${n}`));
|
|
7
|
+
}, [e]), c;
|
|
8
|
+
}
|
|
9
|
+
const f = {
|
|
10
|
+
...u
|
|
11
|
+
}, s = f.useId;
|
|
12
|
+
function l(t) {
|
|
13
|
+
if (s !== void 0) {
|
|
14
|
+
const e = s();
|
|
15
|
+
return t ?? e;
|
|
16
|
+
}
|
|
17
|
+
return o(t);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
l as u
|
|
21
|
+
};
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { L as S } from "./combineHooksSlotProps-j-8UVeYo.js";
|
|
3
|
+
import { u as re, e as ie } from "./ClassNameConfigurator-CVRWfyIa.js";
|
|
4
|
+
function K(t, e, i = (n, r) => n === r) {
|
|
5
|
+
return t.length === e.length && t.every((n, r) => i(n, e[r]));
|
|
6
|
+
}
|
|
7
|
+
function le(t, e) {
|
|
8
|
+
return t === e;
|
|
9
|
+
}
|
|
10
|
+
const A = {}, U = () => {
|
|
11
|
+
};
|
|
12
|
+
function y(t, e) {
|
|
13
|
+
const i = {
|
|
14
|
+
...t
|
|
15
|
+
};
|
|
16
|
+
return Object.keys(e).forEach((n) => {
|
|
17
|
+
e[n] !== void 0 && (i[n] = e[n]);
|
|
18
|
+
}), i;
|
|
19
|
+
}
|
|
20
|
+
function se(t) {
|
|
21
|
+
const {
|
|
22
|
+
nextState: e,
|
|
23
|
+
initialState: i,
|
|
24
|
+
stateComparers: n,
|
|
25
|
+
onStateChange: r,
|
|
26
|
+
controlledProps: c,
|
|
27
|
+
lastActionRef: l
|
|
28
|
+
} = t, f = d.useRef(i);
|
|
29
|
+
d.useEffect(() => {
|
|
30
|
+
if (l.current === null)
|
|
31
|
+
return;
|
|
32
|
+
const u = y(f.current, c);
|
|
33
|
+
Object.keys(e).forEach((g) => {
|
|
34
|
+
const b = n[g] ?? le, m = e[g], o = u[g];
|
|
35
|
+
(o == null && m != null || o != null && m == null || o != null && m != null && !b(m, o)) && (r == null || r(l.current.event ?? null, g, m, l.current.type ?? "", e));
|
|
36
|
+
}), f.current = e, l.current = null;
|
|
37
|
+
}, [f, e, l, r, n, c]);
|
|
38
|
+
}
|
|
39
|
+
function ue(t) {
|
|
40
|
+
const e = d.useRef(null), {
|
|
41
|
+
reducer: i,
|
|
42
|
+
initialState: n,
|
|
43
|
+
controlledProps: r = A,
|
|
44
|
+
stateComparers: c = A,
|
|
45
|
+
onStateChange: l = U,
|
|
46
|
+
actionContext: f,
|
|
47
|
+
componentName: u = ""
|
|
48
|
+
} = t, g = d.useRef(r);
|
|
49
|
+
process.env.NODE_ENV !== "production" && d.useEffect(() => {
|
|
50
|
+
Object.keys(r).forEach((h) => {
|
|
51
|
+
g.current[h] !== void 0 && r[h] === void 0 && console.error(`useControllableReducer: ${u ? `The ${u} component` : "A component"} is changing a controlled prop to be uncontrolled: ${h}`), g.current[h] === void 0 && r[h] !== void 0 && console.error(`useControllableReducer: ${u ? `The ${u} component` : "A component"} is changing an uncontrolled prop to be controlled: ${h}`);
|
|
52
|
+
});
|
|
53
|
+
}, [r, u]);
|
|
54
|
+
const b = d.useCallback((h, D) => {
|
|
55
|
+
e.current = D;
|
|
56
|
+
const w = y(h, r);
|
|
57
|
+
return i(w, D);
|
|
58
|
+
}, [r, i]), [m, o] = d.useReducer(b, n), C = d.useCallback((h) => {
|
|
59
|
+
o({
|
|
60
|
+
...h,
|
|
61
|
+
context: f
|
|
62
|
+
});
|
|
63
|
+
}, [f]);
|
|
64
|
+
return se({
|
|
65
|
+
nextState: m,
|
|
66
|
+
initialState: n,
|
|
67
|
+
stateComparers: c ?? A,
|
|
68
|
+
onStateChange: l ?? U,
|
|
69
|
+
controlledProps: r,
|
|
70
|
+
lastActionRef: e
|
|
71
|
+
}), [y(m, r), C];
|
|
72
|
+
}
|
|
73
|
+
function oe(t, e, i, n, r, c) {
|
|
74
|
+
if (i.length === 0 || !n && i.every((f, u) => r(f, u)))
|
|
75
|
+
return -1;
|
|
76
|
+
let l = t;
|
|
77
|
+
for (; ; ) {
|
|
78
|
+
if (!c && e === "next" && l === i.length || !c && e === "previous" && l === -1)
|
|
79
|
+
return -1;
|
|
80
|
+
if (n ? !1 : r(i[l], l))
|
|
81
|
+
l += e === "next" ? 1 : -1, c && (l = (l + i.length) % i.length);
|
|
82
|
+
else
|
|
83
|
+
return l;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function I(t, e, i) {
|
|
87
|
+
const {
|
|
88
|
+
items: n,
|
|
89
|
+
isItemDisabled: r,
|
|
90
|
+
disableListWrap: c,
|
|
91
|
+
disabledItemsFocusable: l,
|
|
92
|
+
itemComparer: f,
|
|
93
|
+
focusManagement: u
|
|
94
|
+
} = i, g = u === "DOM" ? 0 : -1, b = n.length - 1, m = t == null ? -1 : n.findIndex((w) => f(w, t));
|
|
95
|
+
let o, C, h = !c;
|
|
96
|
+
switch (e) {
|
|
97
|
+
case "reset":
|
|
98
|
+
if (g === -1)
|
|
99
|
+
return null;
|
|
100
|
+
o = 0, C = "next", h = !1;
|
|
101
|
+
break;
|
|
102
|
+
case "start":
|
|
103
|
+
o = 0, C = "next", h = !1;
|
|
104
|
+
break;
|
|
105
|
+
case "end":
|
|
106
|
+
o = b, C = "previous", h = !1;
|
|
107
|
+
break;
|
|
108
|
+
default: {
|
|
109
|
+
const w = m + e;
|
|
110
|
+
w < 0 ? !h && m !== -1 || Math.abs(e) > 1 ? (o = 0, C = "next") : (o = b, C = "previous") : w > b ? !h || Math.abs(e) > 1 ? (o = b, C = "previous") : (o = 0, C = "next") : (o = w, C = e >= 0 ? "next" : "previous");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const D = oe(o, C, n, l, r, h);
|
|
114
|
+
return D === -1 && t !== null && !r(t, m) ? t : n[D] ?? null;
|
|
115
|
+
}
|
|
116
|
+
function ce(t, e, i, n) {
|
|
117
|
+
return i === "none" ? [] : i === "single" ? n(e[0], t) ? e : [t] : e.some((r) => n(r, t)) ? e.filter((r) => !n(r, t)) : [...e, t];
|
|
118
|
+
}
|
|
119
|
+
function z(t, e, i) {
|
|
120
|
+
const {
|
|
121
|
+
itemComparer: n,
|
|
122
|
+
isItemDisabled: r,
|
|
123
|
+
selectionMode: c,
|
|
124
|
+
items: l
|
|
125
|
+
} = i, {
|
|
126
|
+
selectedValues: f
|
|
127
|
+
} = e, u = l.findIndex((b) => n(t, b));
|
|
128
|
+
if (r(t, u))
|
|
129
|
+
return e;
|
|
130
|
+
const g = ce(t, f, c, n);
|
|
131
|
+
return {
|
|
132
|
+
...e,
|
|
133
|
+
selectedValues: g,
|
|
134
|
+
highlightedValue: t
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function ae(t, e, i) {
|
|
138
|
+
const n = e.highlightedValue, {
|
|
139
|
+
orientation: r,
|
|
140
|
+
pageSize: c
|
|
141
|
+
} = i;
|
|
142
|
+
switch (t) {
|
|
143
|
+
case "Home":
|
|
144
|
+
return {
|
|
145
|
+
...e,
|
|
146
|
+
highlightedValue: I(n, "start", i)
|
|
147
|
+
};
|
|
148
|
+
case "End":
|
|
149
|
+
return {
|
|
150
|
+
...e,
|
|
151
|
+
highlightedValue: I(n, "end", i)
|
|
152
|
+
};
|
|
153
|
+
case "PageUp":
|
|
154
|
+
return {
|
|
155
|
+
...e,
|
|
156
|
+
highlightedValue: I(n, -c, i)
|
|
157
|
+
};
|
|
158
|
+
case "PageDown":
|
|
159
|
+
return {
|
|
160
|
+
...e,
|
|
161
|
+
highlightedValue: I(n, c, i)
|
|
162
|
+
};
|
|
163
|
+
case "ArrowUp":
|
|
164
|
+
if (r !== "vertical")
|
|
165
|
+
break;
|
|
166
|
+
return {
|
|
167
|
+
...e,
|
|
168
|
+
highlightedValue: I(n, -1, i)
|
|
169
|
+
};
|
|
170
|
+
case "ArrowDown":
|
|
171
|
+
if (r !== "vertical")
|
|
172
|
+
break;
|
|
173
|
+
return {
|
|
174
|
+
...e,
|
|
175
|
+
highlightedValue: I(n, 1, i)
|
|
176
|
+
};
|
|
177
|
+
case "ArrowLeft": {
|
|
178
|
+
if (r === "vertical")
|
|
179
|
+
break;
|
|
180
|
+
return {
|
|
181
|
+
...e,
|
|
182
|
+
highlightedValue: I(n, r === "horizontal-ltr" ? -1 : 1, i)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
case "ArrowRight": {
|
|
186
|
+
if (r === "vertical")
|
|
187
|
+
break;
|
|
188
|
+
return {
|
|
189
|
+
...e,
|
|
190
|
+
highlightedValue: I(n, r === "horizontal-ltr" ? 1 : -1, i)
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
case "Enter":
|
|
194
|
+
case " ":
|
|
195
|
+
return e.highlightedValue === null ? e : z(e.highlightedValue, e, i);
|
|
196
|
+
}
|
|
197
|
+
return e;
|
|
198
|
+
}
|
|
199
|
+
function he(t, e) {
|
|
200
|
+
return e.focusManagement === "DOM" ? t : {
|
|
201
|
+
...t,
|
|
202
|
+
highlightedValue: null
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function de(t, e, i) {
|
|
206
|
+
var r;
|
|
207
|
+
const n = (r = i(t)) == null ? void 0 : r.trim().toLowerCase();
|
|
208
|
+
return !n || n.length === 0 ? !1 : n.startsWith(e);
|
|
209
|
+
}
|
|
210
|
+
function fe(t, e, i) {
|
|
211
|
+
const {
|
|
212
|
+
items: n,
|
|
213
|
+
isItemDisabled: r,
|
|
214
|
+
disabledItemsFocusable: c,
|
|
215
|
+
getItemAsString: l
|
|
216
|
+
} = i, f = e.length > 1;
|
|
217
|
+
let u = f ? t.highlightedValue : I(t.highlightedValue, 1, i);
|
|
218
|
+
for (let g = 0; g < n.length; g += 1) {
|
|
219
|
+
if (!u || !f && t.highlightedValue === u)
|
|
220
|
+
return t;
|
|
221
|
+
if (de(u, e, l) && (!r(u, n.indexOf(u)) || c))
|
|
222
|
+
return {
|
|
223
|
+
...t,
|
|
224
|
+
highlightedValue: u
|
|
225
|
+
};
|
|
226
|
+
u = I(u, 1, i);
|
|
227
|
+
}
|
|
228
|
+
return t;
|
|
229
|
+
}
|
|
230
|
+
function ge(t, e, i, n) {
|
|
231
|
+
const {
|
|
232
|
+
itemComparer: r,
|
|
233
|
+
focusManagement: c
|
|
234
|
+
} = n;
|
|
235
|
+
let l = null;
|
|
236
|
+
i.highlightedValue != null ? l = t.find((g) => r(g, i.highlightedValue)) ?? null : c === "DOM" && e.length === 0 && (l = I(null, "reset", n));
|
|
237
|
+
const u = (i.selectedValues ?? []).filter((g) => t.some((b) => r(b, g)));
|
|
238
|
+
return {
|
|
239
|
+
...i,
|
|
240
|
+
highlightedValue: l,
|
|
241
|
+
selectedValues: u
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function me(t, e) {
|
|
245
|
+
return {
|
|
246
|
+
...t,
|
|
247
|
+
highlightedValue: I(null, "reset", e)
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function pe(t, e) {
|
|
251
|
+
return {
|
|
252
|
+
...t,
|
|
253
|
+
highlightedValue: I(null, "end", e)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function be(t, e) {
|
|
257
|
+
return {
|
|
258
|
+
...t,
|
|
259
|
+
selectedValues: [],
|
|
260
|
+
highlightedValue: I(null, "reset", e)
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function Se(t, e) {
|
|
264
|
+
const {
|
|
265
|
+
type: i,
|
|
266
|
+
context: n
|
|
267
|
+
} = e;
|
|
268
|
+
switch (i) {
|
|
269
|
+
case S.keyDown:
|
|
270
|
+
return ae(e.key, t, n);
|
|
271
|
+
case S.itemClick:
|
|
272
|
+
return z(e.item, t, n);
|
|
273
|
+
case S.blur:
|
|
274
|
+
return he(t, n);
|
|
275
|
+
case S.textNavigation:
|
|
276
|
+
return fe(t, e.searchString, n);
|
|
277
|
+
case S.itemsChange:
|
|
278
|
+
return ge(e.items, e.previousItems, t, n);
|
|
279
|
+
case S.resetHighlight:
|
|
280
|
+
return me(t, n);
|
|
281
|
+
case S.highlightLast:
|
|
282
|
+
return pe(t, n);
|
|
283
|
+
case S.clearSelection:
|
|
284
|
+
return be(t, n);
|
|
285
|
+
default:
|
|
286
|
+
return t;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const Ce = 500;
|
|
290
|
+
function Ie(t) {
|
|
291
|
+
const e = d.useRef({
|
|
292
|
+
searchString: "",
|
|
293
|
+
lastTime: null
|
|
294
|
+
});
|
|
295
|
+
return d.useCallback((i) => {
|
|
296
|
+
if (i.key.length === 1 && i.key !== " ") {
|
|
297
|
+
const n = e.current, r = i.key.toLowerCase(), c = performance.now();
|
|
298
|
+
n.searchString.length > 0 && n.lastTime && c - n.lastTime > Ce ? n.searchString = r : (n.searchString.length !== 1 || r !== n.searchString) && (n.searchString += r), n.lastTime = c, t(n.searchString, i);
|
|
299
|
+
}
|
|
300
|
+
}, [t]);
|
|
301
|
+
}
|
|
302
|
+
const q = {}, Ve = () => {
|
|
303
|
+
}, we = (t, e) => t === e, De = () => !1, xe = (t) => typeof t == "string" ? t : String(t), Re = () => ({
|
|
304
|
+
highlightedValue: null,
|
|
305
|
+
selectedValues: []
|
|
306
|
+
});
|
|
307
|
+
function Me(t) {
|
|
308
|
+
const {
|
|
309
|
+
controlledProps: e = q,
|
|
310
|
+
disabledItemsFocusable: i = !1,
|
|
311
|
+
disableListWrap: n = !1,
|
|
312
|
+
focusManagement: r = "activeDescendant",
|
|
313
|
+
getInitialState: c = Re,
|
|
314
|
+
getItemDomElement: l,
|
|
315
|
+
getItemId: f,
|
|
316
|
+
isItemDisabled: u = De,
|
|
317
|
+
rootRef: g,
|
|
318
|
+
onStateChange: b = Ve,
|
|
319
|
+
items: m,
|
|
320
|
+
itemComparer: o = we,
|
|
321
|
+
getItemAsString: C = xe,
|
|
322
|
+
onChange: h,
|
|
323
|
+
onHighlightChange: D,
|
|
324
|
+
onItemsChange: w,
|
|
325
|
+
orientation: E = "vertical",
|
|
326
|
+
pageSize: N = 5,
|
|
327
|
+
reducerActionContext: L = q,
|
|
328
|
+
selectionMode: P = "single",
|
|
329
|
+
stateReducer: j,
|
|
330
|
+
componentName: H = "useList"
|
|
331
|
+
} = t;
|
|
332
|
+
if (process.env.NODE_ENV !== "production") {
|
|
333
|
+
if (r === "DOM" && l == null)
|
|
334
|
+
throw new Error("useList: The `getItemDomElement` prop is required when using the `DOM` focus management.");
|
|
335
|
+
if (r === "activeDescendant" && f == null)
|
|
336
|
+
throw new Error("useList: The `getItemId` prop is required when using the `activeDescendant` focus management.");
|
|
337
|
+
}
|
|
338
|
+
const $ = d.useRef(null), F = re(g, $), T = d.useCallback((a, s, p) => {
|
|
339
|
+
var V;
|
|
340
|
+
D == null || D(a, s, p), r === "DOM" && s != null && (p === S.itemClick || p === S.keyDown || p === S.textNavigation) && ((V = l == null ? void 0 : l(s)) == null || V.focus());
|
|
341
|
+
}, [l, D, r]), O = d.useMemo(() => ({
|
|
342
|
+
highlightedValue: o,
|
|
343
|
+
selectedValues: (a, s) => K(a, s, o)
|
|
344
|
+
}), [o]), G = d.useCallback((a, s, p, V, M) => {
|
|
345
|
+
switch (b == null || b(a, s, p, V, M), s) {
|
|
346
|
+
case "highlightedValue":
|
|
347
|
+
T(a, p, V);
|
|
348
|
+
break;
|
|
349
|
+
case "selectedValues":
|
|
350
|
+
h == null || h(a, p, V);
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
}, [T, h, b]), _ = d.useMemo(() => ({
|
|
354
|
+
disabledItemsFocusable: i,
|
|
355
|
+
disableListWrap: n,
|
|
356
|
+
focusManagement: r,
|
|
357
|
+
isItemDisabled: u,
|
|
358
|
+
itemComparer: o,
|
|
359
|
+
items: m,
|
|
360
|
+
getItemAsString: C,
|
|
361
|
+
onHighlightChange: T,
|
|
362
|
+
orientation: E,
|
|
363
|
+
pageSize: N,
|
|
364
|
+
selectionMode: P,
|
|
365
|
+
stateComparers: O
|
|
366
|
+
}), [i, n, r, u, o, m, C, T, E, N, P, O]), J = c(), Y = j ?? Se, X = d.useMemo(() => ({
|
|
367
|
+
...L,
|
|
368
|
+
..._
|
|
369
|
+
}), [L, _]), [v, x] = ue({
|
|
370
|
+
reducer: Y,
|
|
371
|
+
actionContext: X,
|
|
372
|
+
initialState: J,
|
|
373
|
+
controlledProps: e,
|
|
374
|
+
stateComparers: O,
|
|
375
|
+
onStateChange: G,
|
|
376
|
+
componentName: H
|
|
377
|
+
}), {
|
|
378
|
+
highlightedValue: R,
|
|
379
|
+
selectedValues: B
|
|
380
|
+
} = v, Q = Ie((a, s) => x({
|
|
381
|
+
type: S.textNavigation,
|
|
382
|
+
event: s,
|
|
383
|
+
searchString: a
|
|
384
|
+
})), k = d.useRef([]);
|
|
385
|
+
d.useEffect(() => {
|
|
386
|
+
K(k.current, m, o) || (x({
|
|
387
|
+
type: S.itemsChange,
|
|
388
|
+
event: null,
|
|
389
|
+
items: m,
|
|
390
|
+
previousItems: k.current
|
|
391
|
+
}), k.current = m, w == null || w(m));
|
|
392
|
+
}, [m, o, x, w]);
|
|
393
|
+
const Z = (a) => (s) => {
|
|
394
|
+
var V;
|
|
395
|
+
if ((V = a.onKeyDown) == null || V.call(a, s), s.defaultMuiPrevented)
|
|
396
|
+
return;
|
|
397
|
+
const p = ["Home", "End", "PageUp", "PageDown"];
|
|
398
|
+
E === "vertical" ? p.push("ArrowUp", "ArrowDown") : p.push("ArrowLeft", "ArrowRight"), r === "activeDescendant" && p.push(" ", "Enter"), p.includes(s.key) && s.preventDefault(), x({
|
|
399
|
+
type: S.keyDown,
|
|
400
|
+
key: s.key,
|
|
401
|
+
event: s
|
|
402
|
+
}), Q(s);
|
|
403
|
+
}, ee = (a) => (s) => {
|
|
404
|
+
var p, V;
|
|
405
|
+
(p = a.onBlur) == null || p.call(a, s), !s.defaultMuiPrevented && ((V = $.current) != null && V.contains(s.relatedTarget) || x({
|
|
406
|
+
type: S.blur,
|
|
407
|
+
event: s
|
|
408
|
+
}));
|
|
409
|
+
}, te = (a = {}) => {
|
|
410
|
+
const s = ie(a);
|
|
411
|
+
return {
|
|
412
|
+
...a,
|
|
413
|
+
"aria-activedescendant": r === "activeDescendant" && R != null ? f(R) : void 0,
|
|
414
|
+
tabIndex: r === "DOM" ? -1 : 0,
|
|
415
|
+
ref: F,
|
|
416
|
+
...s,
|
|
417
|
+
onBlur: ee(s),
|
|
418
|
+
onKeyDown: Z(s)
|
|
419
|
+
};
|
|
420
|
+
}, W = d.useCallback((a) => {
|
|
421
|
+
const s = (B ?? []).some((M) => M != null && o(a, M)), p = R != null && o(a, R);
|
|
422
|
+
return {
|
|
423
|
+
focusable: r === "DOM",
|
|
424
|
+
highlighted: p,
|
|
425
|
+
selected: s
|
|
426
|
+
};
|
|
427
|
+
}, [o, B, R, r]), ne = d.useMemo(() => ({
|
|
428
|
+
dispatch: x,
|
|
429
|
+
getItemState: W
|
|
430
|
+
}), [x, W]);
|
|
431
|
+
return d.useDebugValue({
|
|
432
|
+
state: v
|
|
433
|
+
}), {
|
|
434
|
+
contextValue: ne,
|
|
435
|
+
dispatch: x,
|
|
436
|
+
getRootProps: te,
|
|
437
|
+
rootRef: F,
|
|
438
|
+
state: v
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
export {
|
|
442
|
+
z as h,
|
|
443
|
+
Se as l,
|
|
444
|
+
I as m,
|
|
445
|
+
Me as u
|
|
446
|
+
};
|
|
@@ -2,7 +2,7 @@ type DeepKeys<T> = {
|
|
|
2
2
|
[K in keyof T]: T[K] extends object ? `${K & string}` | `${K & string}.${DeepKeys<T[K]>}` : `${K & string}`;
|
|
3
3
|
}[keyof T];
|
|
4
4
|
export declare const replaceItemsByIndex: <T>(items: T[], from: number, to: number) => T[];
|
|
5
|
-
export declare const sortItemsByIndex: <T>(items: T[], from: number, to: number, direction:
|
|
6
|
-
export declare const sortItemsByKey: <T>(items: T[], key: DeepKeys<T>, from: number, to: number, direction:
|
|
5
|
+
export declare const sortItemsByIndex: <T>(items: T[], from: number, to: number, direction: "up" | "down") => T[];
|
|
6
|
+
export declare const sortItemsByKey: <T>(items: T[], key: DeepKeys<T>, from: number, to: number, direction: "up" | "down") => T[];
|
|
7
7
|
export declare const replaceItemsByKey: <T>(items: T[], key: DeepKeys<T>, from: number, to: number) => T[];
|
|
8
8
|
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": "2.1.
|
|
4
|
+
"version": "2.1.65",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
75
75
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
76
76
|
"eslint-plugin-storybook": "^0.9.0",
|
|
77
|
-
"glob": "^
|
|
77
|
+
"glob": "^11.1.0",
|
|
78
78
|
"husky": "^9.0.11",
|
|
79
79
|
"jsdom": "^26.0.0",
|
|
80
80
|
"lint-staged": "^15.2.7",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"esbuild": "^0.25.3",
|
|
112
112
|
"express": "^5.1.0",
|
|
113
113
|
"form-data": "^4.0.2",
|
|
114
|
-
"glob": "^
|
|
114
|
+
"glob": "^11.1.0",
|
|
115
115
|
"micromatch": "^4.0.8",
|
|
116
116
|
"nanoid": "^3.3.11",
|
|
117
117
|
"path-to-regexp": "^0.1.12",
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"ws": "^8.18.1",
|
|
123
123
|
"tmp": "^0.2.5",
|
|
124
124
|
"brace-expansion": "^2.0.2",
|
|
125
|
-
"debug": "^4.4.3"
|
|
125
|
+
"debug": "^4.4.3",
|
|
126
|
+
"js-yaml": "^4.1.1"
|
|
126
127
|
}
|
|
127
128
|
}
|
package/dist/Button-BrEDdtHO.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { g as T, a as _, b as x, _ as i, c as B, d as O, e as D, P as e } from "./useSlotProps-CYHDC4TN.js";
|
|
2
|
-
import * as c from "react";
|
|
3
|
-
import { jsx as F } from "react/jsx-runtime";
|
|
4
|
-
import { u as S } from "./useButton-CezPDte8.js";
|
|
5
|
-
const m = "Button";
|
|
6
|
-
function U(s) {
|
|
7
|
-
return T(m, s);
|
|
8
|
-
}
|
|
9
|
-
_(m, ["root", "active", "disabled", "focusVisible"]);
|
|
10
|
-
const W = ["action", "children", "disabled", "focusableWhenDisabled", "onFocusVisible", "slotProps", "slots", "rootElementName"], j = (s) => {
|
|
11
|
-
const {
|
|
12
|
-
active: o,
|
|
13
|
-
disabled: n,
|
|
14
|
-
focusVisible: r
|
|
15
|
-
} = s;
|
|
16
|
-
return O({
|
|
17
|
-
root: ["root", n && "disabled", r && "focusVisible", o && "active"]
|
|
18
|
-
}, D(U));
|
|
19
|
-
}, w = /* @__PURE__ */ c.forwardRef(function(o, n) {
|
|
20
|
-
var r;
|
|
21
|
-
const {
|
|
22
|
-
action: u,
|
|
23
|
-
children: h,
|
|
24
|
-
focusableWhenDisabled: f = !1,
|
|
25
|
-
slotProps: P = {},
|
|
26
|
-
slots: l = {},
|
|
27
|
-
rootElementName: N = "button"
|
|
28
|
-
} = o, t = x(o, W), g = c.useRef();
|
|
29
|
-
let a = N;
|
|
30
|
-
typeof l.root == "string" ? a = l.root : (t.href || t.to) && (a = "a");
|
|
31
|
-
const {
|
|
32
|
-
active: y,
|
|
33
|
-
focusVisible: E,
|
|
34
|
-
setFocusVisible: d,
|
|
35
|
-
getRootProps: V
|
|
36
|
-
} = S(i({}, o, {
|
|
37
|
-
focusableWhenDisabled: f,
|
|
38
|
-
rootElementName: a
|
|
39
|
-
}));
|
|
40
|
-
c.useImperativeHandle(u, () => ({
|
|
41
|
-
focusVisible: () => {
|
|
42
|
-
d(!0), g.current.focus();
|
|
43
|
-
}
|
|
44
|
-
}), [d]);
|
|
45
|
-
const p = i({}, o, {
|
|
46
|
-
active: y,
|
|
47
|
-
focusableWhenDisabled: f,
|
|
48
|
-
focusVisible: E
|
|
49
|
-
}), v = j(p), C = t.href || t.to ? "a" : "button", b = (r = l.root) != null ? r : C, R = B({
|
|
50
|
-
elementType: b,
|
|
51
|
-
getSlotProps: V,
|
|
52
|
-
externalForwardedProps: t,
|
|
53
|
-
externalSlotProps: P.root,
|
|
54
|
-
additionalProps: {
|
|
55
|
-
ref: n
|
|
56
|
-
},
|
|
57
|
-
ownerState: p,
|
|
58
|
-
className: v.root
|
|
59
|
-
});
|
|
60
|
-
return /* @__PURE__ */ F(b, i({}, R, {
|
|
61
|
-
children: h
|
|
62
|
-
}));
|
|
63
|
-
});
|
|
64
|
-
process.env.NODE_ENV !== "production" && (w.propTypes = {
|
|
65
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
66
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
67
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
68
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
69
|
-
/**
|
|
70
|
-
* A ref for imperative actions. It currently only supports `focusVisible()` action.
|
|
71
|
-
*/
|
|
72
|
-
action: e.oneOfType([e.func, e.shape({
|
|
73
|
-
current: e.shape({
|
|
74
|
-
focusVisible: e.func.isRequired
|
|
75
|
-
})
|
|
76
|
-
})]),
|
|
77
|
-
/**
|
|
78
|
-
* @ignore
|
|
79
|
-
*/
|
|
80
|
-
children: e.node,
|
|
81
|
-
/**
|
|
82
|
-
* @ignore
|
|
83
|
-
*/
|
|
84
|
-
className: e.string,
|
|
85
|
-
/**
|
|
86
|
-
* If `true`, the component is disabled.
|
|
87
|
-
* @default false
|
|
88
|
-
*/
|
|
89
|
-
disabled: e.bool,
|
|
90
|
-
/**
|
|
91
|
-
* If `true`, allows a disabled button to receive focus.
|
|
92
|
-
* @default false
|
|
93
|
-
*/
|
|
94
|
-
focusableWhenDisabled: e.bool,
|
|
95
|
-
/**
|
|
96
|
-
* @ignore
|
|
97
|
-
*/
|
|
98
|
-
href: e.string,
|
|
99
|
-
/**
|
|
100
|
-
* @ignore
|
|
101
|
-
*/
|
|
102
|
-
onFocusVisible: e.func,
|
|
103
|
-
/**
|
|
104
|
-
* The HTML element that is ultimately rendered, for example 'button' or 'a'
|
|
105
|
-
* @default 'button'
|
|
106
|
-
*/
|
|
107
|
-
rootElementName: e.string,
|
|
108
|
-
/**
|
|
109
|
-
* The props used for each slot inside the Button.
|
|
110
|
-
* @default {}
|
|
111
|
-
*/
|
|
112
|
-
slotProps: e.shape({
|
|
113
|
-
root: e.oneOfType([e.func, e.object])
|
|
114
|
-
}),
|
|
115
|
-
/**
|
|
116
|
-
* The components used for each slot inside the Button.
|
|
117
|
-
* Either a string to use a HTML element or a component.
|
|
118
|
-
* @default {}
|
|
119
|
-
*/
|
|
120
|
-
slots: e.shape({
|
|
121
|
-
root: e.elementType
|
|
122
|
-
}),
|
|
123
|
-
/**
|
|
124
|
-
* @ignore
|
|
125
|
-
*/
|
|
126
|
-
to: e.string
|
|
127
|
-
});
|
|
128
|
-
export {
|
|
129
|
-
w as B
|
|
130
|
-
};
|