@pismo/marola 0.0.1-alpha.1 → 0.0.1-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/dist/Button-B1umG8kJ.js +131 -0
- package/dist/ClickAwayListener-HI1G6ob9.js +107 -0
- package/dist/Dialog.module-CGVM5V_D.js +15 -0
- package/dist/Popup-DFJQc_jn.js +1249 -0
- package/dist/Portal-D__zvwbZ.js +73 -0
- package/dist/SelectButton-DWtqAiwt.js +45 -0
- package/dist/Tabs.module-jkH1Qjn7.js +22 -0
- package/dist/_commonjsHelpers-CT_km90n.js +30 -0
- package/dist/assets/Advice.css +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/Checkbox.css +1 -0
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/IconButton.css +1 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/InputSearch.css +1 -0
- package/dist/assets/LoadingSpinner.css +1 -1
- package/dist/assets/PageHeader.css +1 -0
- package/dist/assets/Pagination.css +1 -0
- package/dist/assets/SelectButton.css +1 -0
- package/dist/assets/Skeleton.css +1 -0
- package/dist/assets/Snackbar.css +1 -0
- package/dist/assets/SortTooltip.css +1 -0
- package/dist/assets/Stepper.css +1 -0
- package/dist/assets/Table.css +1 -0
- package/dist/assets/Tabs.css +1 -0
- package/dist/assets/Toggle.css +1 -0
- package/dist/assets/Tooltip.css +1 -0
- package/dist/assets/Typography.css +1 -1
- package/dist/assets/global.css +1 -0
- package/dist/combineHooksSlotProps-BHqhiBfc.js +81 -0
- package/dist/components/Advice/Advice.d.ts +16 -0
- package/dist/components/Advice/Advice.js +25 -0
- package/dist/components/Button/Button.d.ts +29 -0
- package/dist/components/Button/Button.js +70 -0
- package/dist/components/Button/Button.stories.d.ts +60 -0
- package/dist/components/Button/Button.stories.js +41 -0
- package/dist/components/Checkbox/Checkbox.d.ts +19 -0
- package/dist/components/Checkbox/Checkbox.js +56 -0
- package/dist/components/Dialog/Actions.js +1 -1
- package/dist/components/Dialog/Backdrop.d.ts +1 -1
- package/dist/components/Dialog/Backdrop.js +2 -9
- package/dist/components/Dialog/CloseIconButton.js +11 -10
- package/dist/components/Dialog/Dialog.d.ts +5 -4
- package/dist/components/Dialog/Dialog.js +420 -20077
- package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
- package/dist/components/Dialog/Dialog.stories.js +60 -0
- package/dist/components/Dialog/Title.js +22 -7
- package/dist/components/Icon/Icon.d.ts +18 -0
- package/dist/components/Icon/Icon.js +95 -0
- package/dist/components/IconButton/IconButton.d.ts +22 -0
- package/dist/components/IconButton/IconButton.js +68 -0
- package/dist/components/Input/Input.d.ts +44 -0
- package/dist/components/Input/Input.js +497 -0
- package/dist/components/Input/Input.stories.d.ts +43 -0
- package/dist/components/Input/Input.stories.js +106 -0
- package/dist/components/InputSearch/InputSearch.d.ts +11 -0
- package/dist/components/InputSearch/InputSearch.js +29 -0
- package/dist/components/InputSearch/InputSearch.stories.d.ts +22 -0
- package/dist/components/InputSearch/InputSearch.stories.js +36 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.js +12 -13
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +39 -0
- package/dist/components/PageHeader/PageHeader.d.ts +36 -0
- package/dist/components/PageHeader/PageHeader.js +51 -0
- package/dist/components/PageHeader/PageHeader.stories.d.ts +43 -0
- package/dist/components/PageHeader/PageHeader.stories.js +49 -0
- package/dist/components/Pagination/Pagination.d.ts +36 -0
- package/dist/components/Pagination/Pagination.js +219 -0
- package/dist/components/Select/Select.d.ts +25 -0
- package/dist/components/Select/Select.js +860 -0
- package/dist/components/Select/Select.stories.d.ts +31 -0
- package/dist/components/Select/Select.stories.js +66 -0
- package/dist/components/Select/SelectButton.d.ts +13 -0
- package/dist/components/Select/SelectButton.js +8 -0
- package/dist/components/Skeleton/Skeleton.d.ts +18 -0
- package/dist/components/Skeleton/Skeleton.js +26 -0
- package/dist/components/Snackbar/Snackbar.d.ts +13 -0
- package/dist/components/Snackbar/Snackbar.js +623 -0
- package/dist/components/SortTooltip/SortTooltip.d.ts +26 -0
- package/dist/components/SortTooltip/SortTooltip.js +67 -0
- package/dist/components/Stepper/Stepper.d.ts +16 -0
- package/dist/components/Stepper/Stepper.js +33 -0
- package/dist/components/Table/Table.d.ts +39 -0
- package/dist/components/Table/Table.js +122 -0
- package/dist/components/Table/TableContext.d.ts +19 -0
- package/dist/components/Table/TableContext.js +21 -0
- package/dist/components/Tabs/Tab.d.ts +9 -0
- package/dist/components/Tabs/Tab.js +182 -0
- package/dist/components/Tabs/TabPanel.d.ts +8 -0
- package/dist/components/Tabs/TabPanel.js +119 -0
- package/dist/components/Tabs/Tabs.d.ts +11 -0
- package/dist/components/Tabs/Tabs.js +402 -0
- package/dist/components/Toggle/Toggle.d.ts +11 -0
- package/dist/components/Toggle/Toggle.js +252 -0
- package/dist/components/Toggle/Toggle.stories.d.ts +21 -0
- package/dist/components/Toggle/Toggle.stories.js +33 -0
- package/dist/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/components/Tooltip/Tooltip.js +127 -0
- package/dist/components/Typography/Typography.d.ts +15 -6
- package/dist/components/Typography/Typography.js +75 -67
- package/dist/components/Typography/Typography.stories.d.ts +31 -0
- package/dist/components/Typography/Typography.stories.js +31 -0
- package/dist/components/Typography/typography.test.d.ts +1 -0
- package/dist/components/Typography/typography.test.js +11358 -0
- package/dist/index-BJ8HbRCy.js +19585 -0
- package/dist/index-CqjC7P5Y.js +814 -0
- package/dist/magic-string.es-O_8lTkE3.js +738 -0
- package/dist/main.d.ts +19 -2
- package/dist/main.js +60 -15
- package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +26 -0
- package/dist/test-utils/assertStyles.d.ts +1 -0
- package/dist/test-utils/assertStyles.js +11 -0
- package/dist/types/helpers.d.ts +14 -7
- package/dist/useButton-Bc8IAgyk.js +106 -0
- package/dist/useCompoundItem-D1iRfg8D.js +84 -0
- package/dist/useControlled-CCMYYdCM.js +31 -0
- package/dist/useEnhancedEffect-CJGo-L3B.js +5 -0
- package/dist/useEventCallback-vAfOD-oT.js +45 -0
- package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
- package/dist/useList-ByMguSS_.js +437 -0
- package/dist/useTimeout-DxF9kiZL.js +36 -0
- package/dist/utils/styleStrings.d.ts +6 -0
- package/dist/utils/styleStrings.js +10 -0
- package/dist/utils/styleStrings.test.d.ts +1 -0
- package/dist/utils/styleStrings.test.js +41 -0
- package/dist/vi.Y_w82WR8-Df0JUamG.js +9860 -0
- package/package.json +53 -10
- package/dist/Button-REznN-RP.js +0 -1139
- package/dist/Dialog.module-BO0mdB7d.js +0 -15
- package/dist/assets/CallToActionButton.css +0 -1
- package/dist/assets/main.css +0 -1
- package/dist/components/CallToActionButton/CallToActionButton.d.ts +0 -23
- package/dist/components/CallToActionButton/CallToActionButton.js +0 -57
- package/src/playground/Playground.tsx +0 -58
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { forwardRef as q, useState as B } from "react";
|
|
4
|
+
import { T as G, u as J, s as Q } from "../../Tabs.module-jkH1Qjn7.js";
|
|
5
|
+
import { Tab as Ie } from "./Tab.js";
|
|
6
|
+
import { TabPanel as Fe } from "./TabPanel.js";
|
|
7
|
+
import { a as C, _ as I } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
|
|
8
|
+
import { g as _, a as F, b as $, P as t, c as N, d as M } from "../../index-CqjC7P5Y.js";
|
|
9
|
+
import { b as O, C as S } from "../../useCompoundItem-D1iRfg8D.js";
|
|
10
|
+
import { u as X } from "../../useControlled-CCMYYdCM.js";
|
|
11
|
+
import { L as Y, a as Z } from "../../combineHooksSlotProps-BHqhiBfc.js";
|
|
12
|
+
import { l as ee, m as te, u as oe } from "../../useList-ByMguSS_.js";
|
|
13
|
+
const k = "Tabs";
|
|
14
|
+
function se(s) {
|
|
15
|
+
return _(k, s);
|
|
16
|
+
}
|
|
17
|
+
F(k, ["root", "horizontal", "vertical"]);
|
|
18
|
+
function ne(s) {
|
|
19
|
+
const {
|
|
20
|
+
value: e,
|
|
21
|
+
defaultValue: o,
|
|
22
|
+
onChange: n,
|
|
23
|
+
orientation: i = "horizontal",
|
|
24
|
+
direction: c = "ltr",
|
|
25
|
+
selectionFollowsFocus: l = !1
|
|
26
|
+
} = s, [d, u] = X({
|
|
27
|
+
controlled: e,
|
|
28
|
+
default: o,
|
|
29
|
+
name: "Tabs",
|
|
30
|
+
state: "value"
|
|
31
|
+
}), a = r.useCallback((x, y) => {
|
|
32
|
+
u(y), n == null || n(x, y);
|
|
33
|
+
}, [n, u]), {
|
|
34
|
+
subitems: m,
|
|
35
|
+
contextValue: g
|
|
36
|
+
} = O(), p = r.useRef(() => {
|
|
37
|
+
}), f = r.useCallback((x) => {
|
|
38
|
+
var y;
|
|
39
|
+
return (y = m.get(x)) == null ? void 0 : y.id;
|
|
40
|
+
}, [m]), b = r.useCallback((x) => p.current(x), []), P = r.useCallback((x) => {
|
|
41
|
+
p.current = x;
|
|
42
|
+
}, []);
|
|
43
|
+
return {
|
|
44
|
+
contextValue: C({
|
|
45
|
+
direction: c,
|
|
46
|
+
getTabId: b,
|
|
47
|
+
getTabPanelId: f,
|
|
48
|
+
onSelected: a,
|
|
49
|
+
orientation: i,
|
|
50
|
+
registerTabIdLookup: P,
|
|
51
|
+
selectionFollowsFocus: l,
|
|
52
|
+
value: d
|
|
53
|
+
}, g)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function le(s) {
|
|
57
|
+
const {
|
|
58
|
+
value: e,
|
|
59
|
+
children: o
|
|
60
|
+
} = s, {
|
|
61
|
+
direction: n,
|
|
62
|
+
getItemIndex: i,
|
|
63
|
+
onSelected: c,
|
|
64
|
+
orientation: l,
|
|
65
|
+
registerItem: d,
|
|
66
|
+
registerTabIdLookup: u,
|
|
67
|
+
selectionFollowsFocus: a,
|
|
68
|
+
totalSubitemCount: m,
|
|
69
|
+
value: g,
|
|
70
|
+
getTabId: p,
|
|
71
|
+
getTabPanelId: f
|
|
72
|
+
} = e, b = r.useMemo(() => ({
|
|
73
|
+
getItemIndex: i,
|
|
74
|
+
registerItem: d,
|
|
75
|
+
totalSubitemCount: m
|
|
76
|
+
}), [d, i, m]), P = r.useMemo(() => ({
|
|
77
|
+
direction: n,
|
|
78
|
+
getTabId: p,
|
|
79
|
+
getTabPanelId: f,
|
|
80
|
+
onSelected: c,
|
|
81
|
+
orientation: l,
|
|
82
|
+
registerTabIdLookup: u,
|
|
83
|
+
selectionFollowsFocus: a,
|
|
84
|
+
value: g
|
|
85
|
+
}), [n, p, f, c, l, u, a, g]);
|
|
86
|
+
return /* @__PURE__ */ T(S.Provider, {
|
|
87
|
+
value: b,
|
|
88
|
+
children: /* @__PURE__ */ T(G.Provider, {
|
|
89
|
+
value: P,
|
|
90
|
+
children: o
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const re = ["children", "value", "defaultValue", "orientation", "direction", "onChange", "selectionFollowsFocus", "slotProps", "slots"], ae = (s) => {
|
|
95
|
+
const {
|
|
96
|
+
orientation: e
|
|
97
|
+
} = s;
|
|
98
|
+
return N({
|
|
99
|
+
root: ["root", e]
|
|
100
|
+
}, M(se));
|
|
101
|
+
}, w = /* @__PURE__ */ r.forwardRef(function(e, o) {
|
|
102
|
+
var n;
|
|
103
|
+
const {
|
|
104
|
+
children: i,
|
|
105
|
+
orientation: c = "horizontal",
|
|
106
|
+
direction: l = "ltr",
|
|
107
|
+
slotProps: d = {},
|
|
108
|
+
slots: u = {}
|
|
109
|
+
} = e, a = I(e, re), m = C({}, e, {
|
|
110
|
+
orientation: c,
|
|
111
|
+
direction: l
|
|
112
|
+
}), {
|
|
113
|
+
contextValue: g
|
|
114
|
+
} = ne(m), p = ae(m), f = (n = u.root) != null ? n : "div", b = $({
|
|
115
|
+
elementType: f,
|
|
116
|
+
externalSlotProps: d.root,
|
|
117
|
+
externalForwardedProps: a,
|
|
118
|
+
additionalProps: {
|
|
119
|
+
ref: o
|
|
120
|
+
},
|
|
121
|
+
ownerState: m,
|
|
122
|
+
className: p.root
|
|
123
|
+
});
|
|
124
|
+
return /* @__PURE__ */ T(f, C({}, b, {
|
|
125
|
+
children: /* @__PURE__ */ T(le, {
|
|
126
|
+
value: g,
|
|
127
|
+
children: i
|
|
128
|
+
})
|
|
129
|
+
}));
|
|
130
|
+
});
|
|
131
|
+
process.env.NODE_ENV !== "production" && (w.propTypes = {
|
|
132
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
133
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
134
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
135
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
136
|
+
/**
|
|
137
|
+
* The content of the component.
|
|
138
|
+
*/
|
|
139
|
+
children: t.node,
|
|
140
|
+
/**
|
|
141
|
+
* @ignore
|
|
142
|
+
*/
|
|
143
|
+
className: t.string,
|
|
144
|
+
/**
|
|
145
|
+
* The default value. Use when the component is not controlled.
|
|
146
|
+
*/
|
|
147
|
+
defaultValue: t.oneOfType([t.number, t.string]),
|
|
148
|
+
/**
|
|
149
|
+
* The direction of the text.
|
|
150
|
+
* @default 'ltr'
|
|
151
|
+
*/
|
|
152
|
+
direction: t.oneOf(["ltr", "rtl"]),
|
|
153
|
+
/**
|
|
154
|
+
* Callback invoked when new value is being set.
|
|
155
|
+
*/
|
|
156
|
+
onChange: t.func,
|
|
157
|
+
/**
|
|
158
|
+
* The component orientation (layout flow direction).
|
|
159
|
+
* @default 'horizontal'
|
|
160
|
+
*/
|
|
161
|
+
orientation: t.oneOf(["horizontal", "vertical"]),
|
|
162
|
+
/**
|
|
163
|
+
* If `true` the selected tab changes on focus. Otherwise it only
|
|
164
|
+
* changes on activation.
|
|
165
|
+
*/
|
|
166
|
+
selectionFollowsFocus: t.bool,
|
|
167
|
+
/**
|
|
168
|
+
* The props used for each slot inside the Tabs.
|
|
169
|
+
* @default {}
|
|
170
|
+
*/
|
|
171
|
+
slotProps: t.shape({
|
|
172
|
+
root: t.oneOfType([t.func, t.object])
|
|
173
|
+
}),
|
|
174
|
+
/**
|
|
175
|
+
* The components used for each slot inside the Tabs.
|
|
176
|
+
* Either a string to use a HTML element or a component.
|
|
177
|
+
* @default {}
|
|
178
|
+
*/
|
|
179
|
+
slots: t.shape({
|
|
180
|
+
root: t.elementType
|
|
181
|
+
}),
|
|
182
|
+
/**
|
|
183
|
+
* The value of the currently selected `Tab`.
|
|
184
|
+
* If you don't want any selected `Tab`, you can set this prop to `null`.
|
|
185
|
+
*/
|
|
186
|
+
value: t.oneOfType([t.number, t.string])
|
|
187
|
+
});
|
|
188
|
+
const E = "TabsList";
|
|
189
|
+
function ie(s) {
|
|
190
|
+
return _(E, s);
|
|
191
|
+
}
|
|
192
|
+
F(E, ["root", "horizontal", "vertical"]);
|
|
193
|
+
const z = {
|
|
194
|
+
valueChange: "valueChange"
|
|
195
|
+
};
|
|
196
|
+
function ue(s, e) {
|
|
197
|
+
if (e.type === z.valueChange)
|
|
198
|
+
return C({}, s, {
|
|
199
|
+
highlightedValue: e.value
|
|
200
|
+
});
|
|
201
|
+
const o = ee(s, e), {
|
|
202
|
+
context: {
|
|
203
|
+
selectionFollowsFocus: n
|
|
204
|
+
}
|
|
205
|
+
} = e;
|
|
206
|
+
if (e.type === Y.itemsChange) {
|
|
207
|
+
if (o.selectedValues.length > 0)
|
|
208
|
+
return C({}, o, {
|
|
209
|
+
highlightedValue: o.selectedValues[0]
|
|
210
|
+
});
|
|
211
|
+
te(null, "reset", e.context);
|
|
212
|
+
}
|
|
213
|
+
return n && o.highlightedValue != null ? C({}, o, {
|
|
214
|
+
selectedValues: [o.highlightedValue]
|
|
215
|
+
}) : o;
|
|
216
|
+
}
|
|
217
|
+
function ce(s) {
|
|
218
|
+
var e;
|
|
219
|
+
const {
|
|
220
|
+
rootRef: o
|
|
221
|
+
} = s, {
|
|
222
|
+
direction: n = "ltr",
|
|
223
|
+
onSelected: i,
|
|
224
|
+
orientation: c = "horizontal",
|
|
225
|
+
value: l,
|
|
226
|
+
registerTabIdLookup: d,
|
|
227
|
+
selectionFollowsFocus: u
|
|
228
|
+
} = J(), {
|
|
229
|
+
subitems: a,
|
|
230
|
+
contextValue: m
|
|
231
|
+
} = O(), g = r.useCallback((h) => {
|
|
232
|
+
var v;
|
|
233
|
+
return (v = a.get(h)) == null ? void 0 : v.id;
|
|
234
|
+
}, [a]);
|
|
235
|
+
d(g);
|
|
236
|
+
const p = r.useMemo(() => Array.from(a.keys()), [a]), f = r.useCallback((h) => {
|
|
237
|
+
var v, V;
|
|
238
|
+
return h == null ? null : (v = (V = a.get(h)) == null ? void 0 : V.ref.current) != null ? v : null;
|
|
239
|
+
}, [a]), b = n === "rtl";
|
|
240
|
+
let P;
|
|
241
|
+
c === "vertical" ? P = "vertical" : P = b ? "horizontal-rtl" : "horizontal-ltr";
|
|
242
|
+
const x = r.useCallback((h, v) => {
|
|
243
|
+
var V;
|
|
244
|
+
i(h, (V = v[0]) != null ? V : null);
|
|
245
|
+
}, [i]), y = r.useMemo(() => l === void 0 ? {} : l != null ? {
|
|
246
|
+
selectedValues: [l]
|
|
247
|
+
} : {
|
|
248
|
+
selectedValues: []
|
|
249
|
+
}, [l]), U = r.useCallback((h) => {
|
|
250
|
+
var v, V;
|
|
251
|
+
return (v = (V = a.get(h)) == null ? void 0 : V.disabled) != null ? v : !1;
|
|
252
|
+
}, [a]), {
|
|
253
|
+
contextValue: L,
|
|
254
|
+
dispatch: R,
|
|
255
|
+
getRootProps: D,
|
|
256
|
+
state: {
|
|
257
|
+
highlightedValue: j,
|
|
258
|
+
selectedValues: H
|
|
259
|
+
},
|
|
260
|
+
rootRef: K
|
|
261
|
+
} = oe({
|
|
262
|
+
controlledProps: y,
|
|
263
|
+
disabledItemsFocusable: !u,
|
|
264
|
+
focusManagement: "DOM",
|
|
265
|
+
getItemDomElement: f,
|
|
266
|
+
isItemDisabled: U,
|
|
267
|
+
items: p,
|
|
268
|
+
rootRef: o,
|
|
269
|
+
onChange: x,
|
|
270
|
+
orientation: P,
|
|
271
|
+
reducerActionContext: r.useMemo(() => ({
|
|
272
|
+
selectionFollowsFocus: u || !1
|
|
273
|
+
}), [u]),
|
|
274
|
+
selectionMode: "single",
|
|
275
|
+
stateReducer: ue
|
|
276
|
+
});
|
|
277
|
+
r.useEffect(() => {
|
|
278
|
+
l !== void 0 && l != null && R({
|
|
279
|
+
type: z.valueChange,
|
|
280
|
+
value: l
|
|
281
|
+
});
|
|
282
|
+
}, [R, l]);
|
|
283
|
+
const W = (h = {}) => C({}, h, D(h), {
|
|
284
|
+
"aria-orientation": c === "vertical" ? "vertical" : void 0,
|
|
285
|
+
role: "tablist"
|
|
286
|
+
});
|
|
287
|
+
return {
|
|
288
|
+
contextValue: r.useMemo(() => C({}, m, L), [m, L]),
|
|
289
|
+
dispatch: R,
|
|
290
|
+
getRootProps: W,
|
|
291
|
+
highlightedValue: j,
|
|
292
|
+
isRtl: b,
|
|
293
|
+
orientation: c,
|
|
294
|
+
rootRef: K,
|
|
295
|
+
selectedValue: (e = H[0]) != null ? e : null
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function de(s) {
|
|
299
|
+
const {
|
|
300
|
+
value: e,
|
|
301
|
+
children: o
|
|
302
|
+
} = s, {
|
|
303
|
+
dispatch: n,
|
|
304
|
+
getItemIndex: i,
|
|
305
|
+
getItemState: c,
|
|
306
|
+
registerItem: l,
|
|
307
|
+
totalSubitemCount: d
|
|
308
|
+
} = e, u = r.useMemo(() => ({
|
|
309
|
+
dispatch: n,
|
|
310
|
+
getItemState: c,
|
|
311
|
+
getItemIndex: i
|
|
312
|
+
}), [n, i, c]), a = r.useMemo(() => ({
|
|
313
|
+
getItemIndex: i,
|
|
314
|
+
registerItem: l,
|
|
315
|
+
totalSubitemCount: d
|
|
316
|
+
}), [l, i, d]);
|
|
317
|
+
return /* @__PURE__ */ T(S.Provider, {
|
|
318
|
+
value: a,
|
|
319
|
+
children: /* @__PURE__ */ T(Z.Provider, {
|
|
320
|
+
value: u,
|
|
321
|
+
children: o
|
|
322
|
+
})
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
const me = ["children", "slotProps", "slots"], pe = (s) => {
|
|
326
|
+
const {
|
|
327
|
+
orientation: e
|
|
328
|
+
} = s;
|
|
329
|
+
return N({
|
|
330
|
+
root: ["root", e]
|
|
331
|
+
}, M(ie));
|
|
332
|
+
}, A = /* @__PURE__ */ r.forwardRef(function(e, o) {
|
|
333
|
+
var n;
|
|
334
|
+
const {
|
|
335
|
+
children: i,
|
|
336
|
+
slotProps: c = {},
|
|
337
|
+
slots: l = {}
|
|
338
|
+
} = e, d = I(e, me), {
|
|
339
|
+
isRtl: u,
|
|
340
|
+
orientation: a,
|
|
341
|
+
getRootProps: m,
|
|
342
|
+
contextValue: g
|
|
343
|
+
} = ce({
|
|
344
|
+
rootRef: o
|
|
345
|
+
}), p = C({}, e, {
|
|
346
|
+
isRtl: u,
|
|
347
|
+
orientation: a
|
|
348
|
+
}), f = pe(p), b = (n = l.root) != null ? n : "div", P = $({
|
|
349
|
+
elementType: b,
|
|
350
|
+
getSlotProps: m,
|
|
351
|
+
externalSlotProps: c.root,
|
|
352
|
+
externalForwardedProps: d,
|
|
353
|
+
ownerState: p,
|
|
354
|
+
className: f.root
|
|
355
|
+
});
|
|
356
|
+
return /* @__PURE__ */ T(de, {
|
|
357
|
+
value: g,
|
|
358
|
+
children: /* @__PURE__ */ T(b, C({}, P, {
|
|
359
|
+
children: i
|
|
360
|
+
}))
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
process.env.NODE_ENV !== "production" && (A.propTypes = {
|
|
364
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
365
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
366
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
367
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
368
|
+
/**
|
|
369
|
+
* The content of the component.
|
|
370
|
+
*/
|
|
371
|
+
children: t.node,
|
|
372
|
+
/**
|
|
373
|
+
* @ignore
|
|
374
|
+
*/
|
|
375
|
+
className: t.string,
|
|
376
|
+
/**
|
|
377
|
+
* The props used for each slot inside the TabsList.
|
|
378
|
+
* @default {}
|
|
379
|
+
*/
|
|
380
|
+
slotProps: t.shape({
|
|
381
|
+
root: t.oneOfType([t.func, t.object])
|
|
382
|
+
}),
|
|
383
|
+
/**
|
|
384
|
+
* The components used for each slot inside the TabsList.
|
|
385
|
+
* Either a string to use a HTML element or a component.
|
|
386
|
+
* @default {}
|
|
387
|
+
*/
|
|
388
|
+
slots: t.shape({
|
|
389
|
+
root: t.elementType
|
|
390
|
+
})
|
|
391
|
+
});
|
|
392
|
+
const ye = q(({ children: s, onChange: e, dataTestId: o }, n) => {
|
|
393
|
+
const [i, c] = B("1");
|
|
394
|
+
return /* @__PURE__ */ T(w, { "data-testid": o, value: i, onChange: (d, u) => {
|
|
395
|
+
c(u), e && e(u, d);
|
|
396
|
+
}, ref: n, children: /* @__PURE__ */ T(A, { className: Q.tabs, children: s }) });
|
|
397
|
+
});
|
|
398
|
+
export {
|
|
399
|
+
Ie as Tab,
|
|
400
|
+
Fe as TabPanel,
|
|
401
|
+
ye as Tabs
|
|
402
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
|
|
3
|
+
type ToggleProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
4
|
+
label?: string;
|
|
5
|
+
classNameWrapper?: string;
|
|
6
|
+
classNameInput?: string;
|
|
7
|
+
classNameLabel?: string;
|
|
8
|
+
'data-testid'?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const Toggle: ({ label, checked, disabled, classNameWrapper, classNameInput, "data-testid": dataTestId, onChange, classNameLabel, }: ToggleProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import '../../assets/Toggle.css';
|
|
2
|
+
import { jsxs as I, jsx as P } from "react/jsx-runtime";
|
|
3
|
+
import { c as C } from "../../clsx-DB4S2d7J.js";
|
|
4
|
+
import { a as x, _ as v } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
|
|
5
|
+
import * as N from "react";
|
|
6
|
+
import { u as U, g as q, a as H, b as F, P as e, c as M, d as A } from "../../index-CqjC7P5Y.js";
|
|
7
|
+
import { u as D } from "../../useControlled-CCMYYdCM.js";
|
|
8
|
+
import { u as L } from "../../useIsFocusVisible-BH4IAdcw.js";
|
|
9
|
+
function W(l) {
|
|
10
|
+
const {
|
|
11
|
+
checked: s,
|
|
12
|
+
defaultChecked: p,
|
|
13
|
+
disabled: c,
|
|
14
|
+
onBlur: a,
|
|
15
|
+
onChange: g,
|
|
16
|
+
onFocus: r,
|
|
17
|
+
onFocusVisible: u,
|
|
18
|
+
readOnly: n,
|
|
19
|
+
required: i
|
|
20
|
+
} = l, [V, S] = D({
|
|
21
|
+
controlled: s,
|
|
22
|
+
default: !!p,
|
|
23
|
+
name: "Switch",
|
|
24
|
+
state: "checked"
|
|
25
|
+
}), B = (t) => (o) => {
|
|
26
|
+
var b;
|
|
27
|
+
o.nativeEvent.defaultPrevented || (S(o.target.checked), g == null || g(o), (b = t.onChange) == null || b.call(t, o));
|
|
28
|
+
}, {
|
|
29
|
+
isFocusVisibleRef: _,
|
|
30
|
+
onBlur: w,
|
|
31
|
+
onFocus: f,
|
|
32
|
+
ref: m
|
|
33
|
+
} = L(), [h, y] = N.useState(!1);
|
|
34
|
+
c && h && y(!1), N.useEffect(() => {
|
|
35
|
+
_.current = h;
|
|
36
|
+
}, [h, _]);
|
|
37
|
+
const k = N.useRef(null), R = (t) => (o) => {
|
|
38
|
+
var b;
|
|
39
|
+
k.current || (k.current = o.currentTarget), f(o), _.current === !0 && (y(!0), u == null || u(o)), r == null || r(o), (b = t.onFocus) == null || b.call(t, o);
|
|
40
|
+
}, T = (t) => (o) => {
|
|
41
|
+
var b;
|
|
42
|
+
w(o), _.current === !1 && y(!1), a == null || a(o), (b = t.onBlur) == null || b.call(t, o);
|
|
43
|
+
}, O = U(m, k);
|
|
44
|
+
return {
|
|
45
|
+
checked: V,
|
|
46
|
+
disabled: !!c,
|
|
47
|
+
focusVisible: h,
|
|
48
|
+
getInputProps: (t = {}) => x({
|
|
49
|
+
checked: s,
|
|
50
|
+
defaultChecked: p,
|
|
51
|
+
disabled: c,
|
|
52
|
+
readOnly: n,
|
|
53
|
+
ref: O,
|
|
54
|
+
required: i,
|
|
55
|
+
type: "checkbox",
|
|
56
|
+
role: "switch",
|
|
57
|
+
"aria-checked": s
|
|
58
|
+
}, t, {
|
|
59
|
+
onChange: B(t),
|
|
60
|
+
onFocus: R(t),
|
|
61
|
+
onBlur: T(t)
|
|
62
|
+
}),
|
|
63
|
+
inputRef: O,
|
|
64
|
+
readOnly: !!n
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const $ = "Switch";
|
|
68
|
+
function z(l) {
|
|
69
|
+
return q($, l);
|
|
70
|
+
}
|
|
71
|
+
H($, ["root", "input", "track", "thumb", "checked", "disabled", "focusVisible", "readOnly"]);
|
|
72
|
+
const G = ["checked", "defaultChecked", "disabled", "onBlur", "onChange", "onFocus", "onFocusVisible", "readOnly", "required", "slotProps", "slots"], J = (l) => {
|
|
73
|
+
const {
|
|
74
|
+
checked: s,
|
|
75
|
+
disabled: p,
|
|
76
|
+
focusVisible: c,
|
|
77
|
+
readOnly: a
|
|
78
|
+
} = l;
|
|
79
|
+
return M({
|
|
80
|
+
root: ["root", s && "checked", p && "disabled", c && "focusVisible", a && "readOnly"],
|
|
81
|
+
thumb: ["thumb"],
|
|
82
|
+
input: ["input"],
|
|
83
|
+
track: ["track"]
|
|
84
|
+
}, A(z));
|
|
85
|
+
}, E = /* @__PURE__ */ N.forwardRef(function(s, p) {
|
|
86
|
+
var c, a, g, r;
|
|
87
|
+
const {
|
|
88
|
+
slotProps: u = {},
|
|
89
|
+
slots: n = {}
|
|
90
|
+
} = s, i = v(s, G), {
|
|
91
|
+
getInputProps: V,
|
|
92
|
+
checked: S,
|
|
93
|
+
disabled: B,
|
|
94
|
+
focusVisible: _,
|
|
95
|
+
readOnly: w
|
|
96
|
+
} = W(s), f = x({}, s, {
|
|
97
|
+
checked: S,
|
|
98
|
+
disabled: B,
|
|
99
|
+
focusVisible: _,
|
|
100
|
+
readOnly: w
|
|
101
|
+
}), m = J(f), h = (c = n.root) != null ? c : "span", y = F({
|
|
102
|
+
elementType: h,
|
|
103
|
+
externalSlotProps: u.root,
|
|
104
|
+
externalForwardedProps: i,
|
|
105
|
+
additionalProps: {
|
|
106
|
+
ref: p
|
|
107
|
+
},
|
|
108
|
+
ownerState: f,
|
|
109
|
+
className: m.root
|
|
110
|
+
}), k = (a = n.thumb) != null ? a : "span", R = F({
|
|
111
|
+
elementType: k,
|
|
112
|
+
externalSlotProps: u.thumb,
|
|
113
|
+
ownerState: f,
|
|
114
|
+
className: m.thumb
|
|
115
|
+
}), T = (g = n.input) != null ? g : "input", O = F({
|
|
116
|
+
elementType: T,
|
|
117
|
+
getSlotProps: V,
|
|
118
|
+
externalSlotProps: u.input,
|
|
119
|
+
ownerState: f,
|
|
120
|
+
className: m.input
|
|
121
|
+
}), j = n.track === null ? () => null : (r = n.track) != null ? r : "span", t = F({
|
|
122
|
+
elementType: j,
|
|
123
|
+
externalSlotProps: u.track,
|
|
124
|
+
ownerState: f,
|
|
125
|
+
className: m.track
|
|
126
|
+
});
|
|
127
|
+
return /* @__PURE__ */ I(h, x({}, y, {
|
|
128
|
+
children: [/* @__PURE__ */ P(j, x({}, t)), /* @__PURE__ */ P(k, x({}, R)), /* @__PURE__ */ P(T, x({}, O))]
|
|
129
|
+
}));
|
|
130
|
+
});
|
|
131
|
+
process.env.NODE_ENV !== "production" && (E.propTypes = {
|
|
132
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
133
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
134
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
135
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
136
|
+
/**
|
|
137
|
+
* If `true`, the component is checked.
|
|
138
|
+
*/
|
|
139
|
+
checked: e.bool,
|
|
140
|
+
/**
|
|
141
|
+
* Class name applied to the root element.
|
|
142
|
+
*/
|
|
143
|
+
className: e.string,
|
|
144
|
+
/**
|
|
145
|
+
* The default checked state. Use when the component is not controlled.
|
|
146
|
+
*/
|
|
147
|
+
defaultChecked: e.bool,
|
|
148
|
+
/**
|
|
149
|
+
* If `true`, the component is disabled.
|
|
150
|
+
*/
|
|
151
|
+
disabled: e.bool,
|
|
152
|
+
/**
|
|
153
|
+
* @ignore
|
|
154
|
+
*/
|
|
155
|
+
onBlur: e.func,
|
|
156
|
+
/**
|
|
157
|
+
* Callback fired when the state is changed.
|
|
158
|
+
*
|
|
159
|
+
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
160
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
161
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
162
|
+
*/
|
|
163
|
+
onChange: e.func,
|
|
164
|
+
/**
|
|
165
|
+
* @ignore
|
|
166
|
+
*/
|
|
167
|
+
onFocus: e.func,
|
|
168
|
+
/**
|
|
169
|
+
* @ignore
|
|
170
|
+
*/
|
|
171
|
+
onFocusVisible: e.func,
|
|
172
|
+
/**
|
|
173
|
+
* If `true`, the component is read only.
|
|
174
|
+
*/
|
|
175
|
+
readOnly: e.bool,
|
|
176
|
+
/**
|
|
177
|
+
* If `true`, the `input` element is required.
|
|
178
|
+
*/
|
|
179
|
+
required: e.bool,
|
|
180
|
+
/**
|
|
181
|
+
* The props used for each slot inside the Switch.
|
|
182
|
+
* @default {}
|
|
183
|
+
*/
|
|
184
|
+
slotProps: e.shape({
|
|
185
|
+
input: e.oneOfType([e.func, e.object]),
|
|
186
|
+
root: e.oneOfType([e.func, e.object]),
|
|
187
|
+
thumb: e.oneOfType([e.func, e.object]),
|
|
188
|
+
track: e.oneOfType([e.func, e.object])
|
|
189
|
+
}),
|
|
190
|
+
/**
|
|
191
|
+
* The components used for each slot inside the Switch.
|
|
192
|
+
* Either a string to use a HTML element or a component.
|
|
193
|
+
* @default {}
|
|
194
|
+
*/
|
|
195
|
+
slots: e.shape({
|
|
196
|
+
input: e.elementType,
|
|
197
|
+
root: e.elementType,
|
|
198
|
+
thumb: e.elementType,
|
|
199
|
+
track: e.oneOfType([e.elementType, e.oneOf([null])])
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
const K = "_toggle_1icxx_1", Q = "_input_1icxx_12", X = "_thumb_1icxx_23", Y = "_track_1icxx_37", Z = "_toggle__label_1icxx_61", d = {
|
|
203
|
+
toggle: K,
|
|
204
|
+
"toggle__toggle-el-wrapper": "_toggle__toggle-el-wrapper_1icxx_8",
|
|
205
|
+
input: Q,
|
|
206
|
+
thumb: X,
|
|
207
|
+
track: Y,
|
|
208
|
+
"toggle--focus-visible": "_toggle--focus-visible_1icxx_47",
|
|
209
|
+
"toggle--checked": "_toggle--checked_1icxx_51",
|
|
210
|
+
toggle__label: Z,
|
|
211
|
+
"toggle--disabled": "_toggle--disabled_1icxx_66"
|
|
212
|
+
}, ne = ({
|
|
213
|
+
label: l,
|
|
214
|
+
checked: s,
|
|
215
|
+
disabled: p,
|
|
216
|
+
classNameWrapper: c,
|
|
217
|
+
classNameInput: a,
|
|
218
|
+
"data-testid": g,
|
|
219
|
+
onChange: r,
|
|
220
|
+
classNameLabel: u
|
|
221
|
+
}) => {
|
|
222
|
+
const n = (i) => {
|
|
223
|
+
r == null || r(i);
|
|
224
|
+
};
|
|
225
|
+
return /* @__PURE__ */ I("div", { className: C(d.toggle, c), "data-testid": g, children: [
|
|
226
|
+
/* @__PURE__ */ P(
|
|
227
|
+
E,
|
|
228
|
+
{
|
|
229
|
+
checked: s === !0,
|
|
230
|
+
disabled: p,
|
|
231
|
+
onChange: n,
|
|
232
|
+
"aria-label": l,
|
|
233
|
+
slotProps: {
|
|
234
|
+
root: (i) => ({
|
|
235
|
+
className: C(d["toggle__toggle-el-wrapper"], {
|
|
236
|
+
[d["toggle--disabled"]]: i.disabled,
|
|
237
|
+
[d["toggle--focus-visible"]]: i.focusVisible,
|
|
238
|
+
[d["toggle--checked"]]: i.checked
|
|
239
|
+
})
|
|
240
|
+
}),
|
|
241
|
+
input: { className: C(d.input, a) },
|
|
242
|
+
thumb: { className: d.thumb },
|
|
243
|
+
track: { className: d.track }
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
l && /* @__PURE__ */ P("label", { className: C(d.toggle__label, u), children: l })
|
|
248
|
+
] });
|
|
249
|
+
};
|
|
250
|
+
export {
|
|
251
|
+
ne as Toggle
|
|
252
|
+
};
|
|
@@ -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;
|