@overdoser/react-toolkit 0.20.0 → 0.22.0
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/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,211 +1,157 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
);
|
|
1
|
+
import { forwardRef as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import i from "clsx";
|
|
3
|
+
import a from "./ActionButton.module.scss.js";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
// src/components/ActionButton/ActionButton.tsx
|
|
6
|
+
function c() {
|
|
7
|
+
return /* @__PURE__ */ o("svg", {
|
|
8
|
+
width: "1em",
|
|
9
|
+
height: "1em",
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: "2.4",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
children: /* @__PURE__ */ o("path", { d: "M4 12l5 5L20 6" })
|
|
18
|
+
});
|
|
21
19
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
children: /* @__PURE__ */ t("path", { d: "M21 12a9 9 0 1 1-9-9" })
|
|
35
|
-
}
|
|
36
|
-
);
|
|
20
|
+
function l() {
|
|
21
|
+
return /* @__PURE__ */ o("svg", {
|
|
22
|
+
width: "1em",
|
|
23
|
+
height: "1em",
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: "2.4",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
children: /* @__PURE__ */ o("path", { d: "M21 12a9 9 0 1 1-9-9" })
|
|
31
|
+
});
|
|
37
32
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
s?.progressFill
|
|
164
|
-
),
|
|
165
|
-
style: { width: `${a ?? 0}%` },
|
|
166
|
-
"aria-hidden": "true"
|
|
167
|
-
}
|
|
168
|
-
),
|
|
169
|
-
/* @__PURE__ */ t("span", { className: o(i.iconStack, s?.iconStack), "aria-hidden": "true", children: Q.map((e) => /* @__PURE__ */ t(
|
|
170
|
-
"span",
|
|
171
|
-
{
|
|
172
|
-
className: o(
|
|
173
|
-
i.iconLayer,
|
|
174
|
-
e.visible && i.layerVisible,
|
|
175
|
-
e.visible && e.spin && i.iconSpin,
|
|
176
|
-
s?.iconLayer
|
|
177
|
-
),
|
|
178
|
-
children: e.node
|
|
179
|
-
},
|
|
180
|
-
e.key
|
|
181
|
-
)) }),
|
|
182
|
-
!L && B.length > 0 && /* @__PURE__ */ t(
|
|
183
|
-
"span",
|
|
184
|
-
{
|
|
185
|
-
className: o(i.labelStack, s?.labelStack),
|
|
186
|
-
"aria-live": c ? "off" : "polite",
|
|
187
|
-
children: B.map((e) => /* @__PURE__ */ t(
|
|
188
|
-
"span",
|
|
189
|
-
{
|
|
190
|
-
"aria-hidden": e.visible ? void 0 : !0,
|
|
191
|
-
className: o(
|
|
192
|
-
i.labelLayer,
|
|
193
|
-
e.visible && i.layerVisible,
|
|
194
|
-
e.position,
|
|
195
|
-
s?.labelLayer
|
|
196
|
-
),
|
|
197
|
-
children: e.node
|
|
198
|
-
},
|
|
199
|
-
e.key
|
|
200
|
-
))
|
|
201
|
-
}
|
|
202
|
-
)
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
ie.displayName = "ActionButton";
|
|
209
|
-
export {
|
|
210
|
-
ie as ActionButton
|
|
211
|
-
};
|
|
33
|
+
var u = e(({ icon: e, label: u, pendingIcon: d, pendingLabel: f, successIcon: p, successLabel: m, confirmLabel: h, confirmTimeout: g = 2600, onAction: _, progressLabel: v, onError: y, onPhaseChange: b, resetAfter: x = 1800, speed: S = 1, variant: C = "secondary", size: w = "md", iconOnly: T = !1, classes: E, className: D, style: O, disabled: k, onClick: A, ...j }, M) => {
|
|
34
|
+
let [N, P] = r("idle"), [F, I] = r(null), L = n("idle"), R = n(!0), z = n({});
|
|
35
|
+
t(() => {
|
|
36
|
+
R.current = !0;
|
|
37
|
+
let e = z.current;
|
|
38
|
+
return () => {
|
|
39
|
+
R.current = !1, Object.values(e).forEach(clearTimeout);
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
let B = (e) => {
|
|
43
|
+
L.current = e, P(e), b?.(e);
|
|
44
|
+
}, V = (e, t, n) => {
|
|
45
|
+
clearTimeout(z.current[e]), z.current[e] = setTimeout(t, n / S);
|
|
46
|
+
}, H = () => {
|
|
47
|
+
I(null), B("success"), x > 0 && V("reset", () => {
|
|
48
|
+
L.current === "success" && B("idle");
|
|
49
|
+
}, x);
|
|
50
|
+
}, U = { setProgress: (e) => {
|
|
51
|
+
R.current && I(e == null ? null : Math.max(0, Math.min(100, e)));
|
|
52
|
+
} }, W = () => {
|
|
53
|
+
clearTimeout(z.current.disarm);
|
|
54
|
+
let e;
|
|
55
|
+
try {
|
|
56
|
+
e = _?.(U);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
B("idle"), y?.(e);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
e && typeof e.then == "function" ? (B("pending"), e.then(() => {
|
|
62
|
+
R.current && H();
|
|
63
|
+
}, (e) => {
|
|
64
|
+
R.current && (I(null), B("idle"), y?.(e));
|
|
65
|
+
})) : H();
|
|
66
|
+
}, G = (e) => {
|
|
67
|
+
A?.(e), k || e.defaultPrevented || N !== "pending" && N !== "success" && (h != null && N === "idle" ? (B("armed"), V("disarm", () => {
|
|
68
|
+
L.current === "armed" && B("idle");
|
|
69
|
+
}, g)) : W());
|
|
70
|
+
}, K = N === "pending" && F != null, q = [
|
|
71
|
+
{
|
|
72
|
+
key: "idle",
|
|
73
|
+
node: e,
|
|
74
|
+
visible: N === "idle" || N === "armed" || K
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: "pending",
|
|
78
|
+
node: d ?? /* @__PURE__ */ o(l, {}),
|
|
79
|
+
visible: N === "pending" && !K,
|
|
80
|
+
spin: d === void 0
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "success",
|
|
84
|
+
node: p ?? /* @__PURE__ */ o(c, {}),
|
|
85
|
+
visible: N === "success"
|
|
86
|
+
}
|
|
87
|
+
], J = K ? v?.(F) ?? `${Math.round(F)}%` : f, Y = N === "idle" || N === "armed" && h == null || N === "pending" && J == null || N === "success" && m == null, X = {
|
|
88
|
+
idle: 0,
|
|
89
|
+
armed: 1,
|
|
90
|
+
pending: 2,
|
|
91
|
+
success: 3
|
|
92
|
+
}, Z = [
|
|
93
|
+
{
|
|
94
|
+
key: "idle",
|
|
95
|
+
node: u,
|
|
96
|
+
visible: Y
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "armed",
|
|
100
|
+
node: h,
|
|
101
|
+
visible: N === "armed"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: "pending",
|
|
105
|
+
node: J,
|
|
106
|
+
visible: N === "pending"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "success",
|
|
110
|
+
node: m,
|
|
111
|
+
visible: N === "success"
|
|
112
|
+
}
|
|
113
|
+
].filter((e) => e.node != null).map((e) => ({
|
|
114
|
+
...e,
|
|
115
|
+
position: e.visible ? void 0 : X[e.key] < X[N] ? a.labelAbove : a.labelBelow
|
|
116
|
+
}));
|
|
117
|
+
return /* @__PURE__ */ s("button", {
|
|
118
|
+
ref: M,
|
|
119
|
+
type: "button",
|
|
120
|
+
className: i(a.root, a[C], a[w], T && a.iconOnly, E?.root, D),
|
|
121
|
+
style: S === 1 ? O : {
|
|
122
|
+
...O,
|
|
123
|
+
"--crk-action-speed": S
|
|
124
|
+
},
|
|
125
|
+
"data-phase": N,
|
|
126
|
+
disabled: k,
|
|
127
|
+
"aria-busy": N === "pending" || void 0,
|
|
128
|
+
onClick: G,
|
|
129
|
+
...j,
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ o("span", {
|
|
132
|
+
className: i(a.progressFill, K && a.progressFillActive, E?.progressFill),
|
|
133
|
+
style: { width: `${F ?? 0}%` },
|
|
134
|
+
"aria-hidden": "true"
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ o("span", {
|
|
137
|
+
className: i(a.iconStack, E?.iconStack),
|
|
138
|
+
"aria-hidden": "true",
|
|
139
|
+
children: q.map((e) => /* @__PURE__ */ o("span", {
|
|
140
|
+
className: i(a.iconLayer, e.visible && a.layerVisible, e.visible && e.spin && a.iconSpin, E?.iconLayer),
|
|
141
|
+
children: e.node
|
|
142
|
+
}, e.key))
|
|
143
|
+
}),
|
|
144
|
+
!T && Z.length > 0 && /* @__PURE__ */ o("span", {
|
|
145
|
+
className: i(a.labelStack, E?.labelStack),
|
|
146
|
+
"aria-live": K ? "off" : "polite",
|
|
147
|
+
children: Z.map((e) => /* @__PURE__ */ o("span", {
|
|
148
|
+
"aria-hidden": !e.visible || void 0,
|
|
149
|
+
className: i(a.labelLayer, e.visible && a.layerVisible, e.position, E?.labelLayer),
|
|
150
|
+
children: e.node
|
|
151
|
+
}, e.key))
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
u.displayName = "ActionButton";
|
|
157
|
+
export { u as ActionButton };
|
|
@@ -1,47 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
F as crkActionShake,
|
|
26
|
-
p as crkActionSpin,
|
|
27
|
-
n as danger,
|
|
28
|
-
v as default,
|
|
29
|
-
l as ghost,
|
|
30
|
-
b as iconLayer,
|
|
31
|
-
a as iconOnly,
|
|
32
|
-
g as iconSpin,
|
|
33
|
-
y as iconStack,
|
|
34
|
-
d as labelAbove,
|
|
35
|
-
m as labelBelow,
|
|
36
|
-
A as labelLayer,
|
|
37
|
-
S as labelStack,
|
|
38
|
-
h as layerVisible,
|
|
39
|
-
t as lg,
|
|
40
|
-
s as md,
|
|
41
|
-
o as primary,
|
|
42
|
-
i as progressFill,
|
|
43
|
-
k as progressFillActive,
|
|
44
|
-
c as root,
|
|
45
|
-
r as secondary,
|
|
46
|
-
e as sm
|
|
1
|
+
// src/components/ActionButton/ActionButton.module.scss
|
|
2
|
+
var e = "crk-root--5DQa", t = "crk-primary-8sEXz", n = "crk-secondary-gchUR", r = "crk-danger-3Rwvr", i = "crk-ghost-NA6NO", a = "crk-sm-8Gx7n", o = "crk-md-1Aojo", s = "crk-lg-G-QeV", c = "crk-iconOnly-RXD7w", l = "crk-progressFill-fQBjO", u = "crk-progressFillActive-UUIFs", d = "crk-iconStack-cDz8K", f = "crk-iconLayer--8ZB0", p = "crk-iconSpin-P42Mx", m = "crk-crkActionSpin-hNXj5", h = "crk-labelStack-IdCBl", g = "crk-labelLayer-42FKW", _ = "crk-labelAbove-GC0xj", v = "crk-labelBelow-ozPt1", y = "crk-layerVisible-zoVoM", b = "crk-crkActionShake-IQ6fK", x = {
|
|
3
|
+
root: e,
|
|
4
|
+
primary: t,
|
|
5
|
+
secondary: n,
|
|
6
|
+
danger: r,
|
|
7
|
+
ghost: i,
|
|
8
|
+
sm: a,
|
|
9
|
+
md: o,
|
|
10
|
+
lg: s,
|
|
11
|
+
iconOnly: c,
|
|
12
|
+
progressFill: l,
|
|
13
|
+
progressFillActive: u,
|
|
14
|
+
iconStack: d,
|
|
15
|
+
iconLayer: f,
|
|
16
|
+
iconSpin: p,
|
|
17
|
+
crkActionSpin: m,
|
|
18
|
+
labelStack: h,
|
|
19
|
+
labelLayer: g,
|
|
20
|
+
labelAbove: _,
|
|
21
|
+
labelBelow: v,
|
|
22
|
+
layerVisible: y,
|
|
23
|
+
crkActionShake: b
|
|
47
24
|
};
|
|
25
|
+
export { b as crkActionShake, m as crkActionSpin, r as danger, x as default, i as ghost, f as iconLayer, c as iconOnly, p as iconSpin, d as iconStack, _ as labelAbove, v as labelBelow, g as labelLayer, h as labelStack, y as layerVisible, s as lg, o as md, t as primary, l as progressFill, u as progressFillActive, e as root, n as secondary, a as sm };
|
|
@@ -1,66 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { forwardRef as e } from "react";
|
|
2
|
+
import { ActionButton as t } from "./ActionButton.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
// src/components/ActionButton/CopyButton.tsx
|
|
5
|
+
function i() {
|
|
6
|
+
return /* @__PURE__ */ r("svg", {
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: "2",
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: [/* @__PURE__ */ n("rect", {
|
|
17
|
+
x: "9",
|
|
18
|
+
y: "9",
|
|
19
|
+
width: "12",
|
|
20
|
+
height: "12",
|
|
21
|
+
rx: "2"
|
|
22
|
+
}), /* @__PURE__ */ n("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })]
|
|
23
|
+
});
|
|
23
24
|
}
|
|
24
|
-
async function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
25
|
+
async function a(e) {
|
|
26
|
+
if (typeof navigator < "u" && navigator.clipboard?.writeText) {
|
|
27
|
+
await navigator.clipboard.writeText(e);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let t = document.createElement("textarea");
|
|
31
|
+
t.value = e, t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select();
|
|
32
|
+
try {
|
|
33
|
+
if (!document.execCommand("copy")) throw Error("Copy to clipboard failed");
|
|
34
|
+
} finally {
|
|
35
|
+
t.remove();
|
|
36
|
+
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const i = typeof o == "function" ? await o() : o;
|
|
56
|
-
await m(i), a?.(i);
|
|
57
|
-
},
|
|
58
|
-
style: { "--crk-action-icon-exit": "scale(0.4) rotate(-40deg)", ...c },
|
|
59
|
-
...d
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
u.displayName = "CopyButton";
|
|
64
|
-
export {
|
|
65
|
-
u as CopyButton
|
|
66
|
-
};
|
|
38
|
+
var o = e(({ value: e, icon: r = /* @__PURE__ */ n(i, {}), label: o = "Copy", successLabel: s = "Copied", onCopied: c, style: l, ...u }, d) => /* @__PURE__ */ n(t, {
|
|
39
|
+
ref: d,
|
|
40
|
+
icon: r,
|
|
41
|
+
label: o,
|
|
42
|
+
successLabel: s,
|
|
43
|
+
onAction: async () => {
|
|
44
|
+
let t = typeof e == "function" ? await e() : e;
|
|
45
|
+
await a(t), c?.(t);
|
|
46
|
+
},
|
|
47
|
+
style: {
|
|
48
|
+
"--crk-action-icon-exit": "scale(0.4) rotate(-40deg)",
|
|
49
|
+
...l
|
|
50
|
+
},
|
|
51
|
+
...u
|
|
52
|
+
}));
|
|
53
|
+
o.displayName = "CopyButton";
|
|
54
|
+
export { o as CopyButton };
|