@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,81 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
R as bulkActions,
|
|
43
|
-
I as bulkBar,
|
|
44
|
-
f as bulkClear,
|
|
45
|
-
x as bulkLabel,
|
|
46
|
-
b as cell,
|
|
47
|
-
s as cellSticky,
|
|
48
|
-
j as compact,
|
|
49
|
-
F as default,
|
|
50
|
-
c as dragging,
|
|
51
|
-
u as emptyCell,
|
|
52
|
-
w as emptyRow,
|
|
53
|
-
l as headerCell,
|
|
54
|
-
n as headerCellSortable,
|
|
55
|
-
a as headerCellSticky,
|
|
56
|
-
h as hoverable,
|
|
57
|
-
v as layoutFixed,
|
|
58
|
-
C as loaderWrap,
|
|
59
|
-
S as loadingRow,
|
|
60
|
-
H as pageButton,
|
|
61
|
-
L as pageButtonActive,
|
|
62
|
-
Q as pageEllipsis,
|
|
63
|
-
q as pageSizeSelect,
|
|
64
|
-
o as paginator,
|
|
65
|
-
D as paginatorInfo,
|
|
66
|
-
z as paginatorNav,
|
|
67
|
-
P as paginatorText,
|
|
68
|
-
t as root,
|
|
69
|
-
g as row,
|
|
70
|
-
y as rowClickable,
|
|
71
|
-
A as rowSelected,
|
|
72
|
-
r as scrollable,
|
|
73
|
-
m as selectCell,
|
|
74
|
-
B as selectHeaderCell,
|
|
75
|
-
i as sortArrow,
|
|
76
|
-
p as sortArrowActive,
|
|
77
|
-
d as sortIndex,
|
|
78
|
-
k as sortIndicator,
|
|
79
|
-
W as striped,
|
|
80
|
-
e as wrapper
|
|
1
|
+
// src/components/Table/Table.module.scss
|
|
2
|
+
var e = "crk-wrapper-zxjMt", t = "crk-scrollable-Apjbs", n = "crk-root-Gf85-", r = "crk-paginator-UlYIY", i = "crk-dragging-dAaIR", a = "crk-headerCell-ePPZW", o = "crk-headerCellSticky-Qwz3q", s = "crk-cellSticky-LwmbD", c = "crk-headerCellSortable-NMybk", l = "crk-sortIndicator-WGD2S", u = "crk-sortArrow-1-ok4", d = "crk-sortArrowActive-yhWrO", f = "crk-sortIndex-HGoca", p = "crk-row-H0wL1", m = "crk-cell-ZfnbG", h = "crk-emptyRow-AoPfj", g = "crk-emptyCell-99-7C", _ = "crk-loaderWrap-Bug3B", v = "crk-loadingRow-i25F2", y = "crk-rowClickable--9VTD", b = "crk-rowSelected-ucID4", x = "crk-hoverable-ljU9B", S = "crk-selectHeaderCell-sK1ej", C = "crk-selectCell-4A3ho", w = "crk-layoutFixed-PUK1R", T = "crk-bulkBar-OPem5", E = "crk-bulkLabel-Z5fZQ", D = "crk-bulkClear--wKbf", O = "crk-bulkActions-jm9bq", k = "crk-striped-6Qckq", A = "crk-compact-2-UWr", j = "crk-paginatorInfo-BVca4", M = "crk-paginatorText-sqWS0", N = "crk-pageSizeSelect-yhqJQ", P = "crk-paginatorNav-MDSui", F = "crk-pageButton-1PX-g", I = "crk-pageButtonActive--D7Q7", L = "crk-pageEllipsis-en59J", R = {
|
|
3
|
+
wrapper: e,
|
|
4
|
+
scrollable: t,
|
|
5
|
+
root: n,
|
|
6
|
+
paginator: r,
|
|
7
|
+
dragging: i,
|
|
8
|
+
headerCell: a,
|
|
9
|
+
headerCellSticky: o,
|
|
10
|
+
cellSticky: s,
|
|
11
|
+
headerCellSortable: c,
|
|
12
|
+
sortIndicator: l,
|
|
13
|
+
sortArrow: u,
|
|
14
|
+
sortArrowActive: d,
|
|
15
|
+
sortIndex: f,
|
|
16
|
+
row: p,
|
|
17
|
+
cell: m,
|
|
18
|
+
emptyRow: h,
|
|
19
|
+
emptyCell: g,
|
|
20
|
+
loaderWrap: _,
|
|
21
|
+
loadingRow: v,
|
|
22
|
+
rowClickable: y,
|
|
23
|
+
rowSelected: b,
|
|
24
|
+
hoverable: x,
|
|
25
|
+
selectHeaderCell: S,
|
|
26
|
+
selectCell: C,
|
|
27
|
+
layoutFixed: w,
|
|
28
|
+
bulkBar: T,
|
|
29
|
+
bulkLabel: E,
|
|
30
|
+
bulkClear: D,
|
|
31
|
+
bulkActions: O,
|
|
32
|
+
striped: k,
|
|
33
|
+
compact: A,
|
|
34
|
+
paginatorInfo: j,
|
|
35
|
+
paginatorText: M,
|
|
36
|
+
pageSizeSelect: N,
|
|
37
|
+
paginatorNav: P,
|
|
38
|
+
pageButton: F,
|
|
39
|
+
pageButtonActive: I,
|
|
40
|
+
pageEllipsis: L
|
|
81
41
|
};
|
|
42
|
+
export { O as bulkActions, T as bulkBar, D as bulkClear, E as bulkLabel, m as cell, s as cellSticky, A as compact, R as default, i as dragging, g as emptyCell, h as emptyRow, a as headerCell, c as headerCellSortable, o as headerCellSticky, x as hoverable, w as layoutFixed, _ as loaderWrap, v as loadingRow, F as pageButton, I as pageButtonActive, L as pageEllipsis, N as pageSizeSelect, r as paginator, j as paginatorInfo, P as paginatorNav, M as paginatorText, n as root, p as row, y as rowClickable, b as rowSelected, t as scrollable, C as selectCell, S as selectHeaderCell, u as sortArrow, d as sortArrowActive, f as sortIndex, l as sortIndicator, k as striped, e as wrapper };
|
|
@@ -1,44 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { useCallback as e, useMemo as t, useState as n } from "react";
|
|
2
|
+
// src/components/Table/useTableSort.ts
|
|
3
|
+
function r(e, t) {
|
|
4
|
+
return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
function i(i, a = []) {
|
|
7
|
+
let [o, s] = n(a), c = e((e, t = "asc") => {
|
|
8
|
+
let n = t === "asc" ? "desc" : "asc";
|
|
9
|
+
s((r) => {
|
|
10
|
+
let i = r.find((t) => t.key === e);
|
|
11
|
+
return i ? i.direction === t ? [{
|
|
12
|
+
key: e,
|
|
13
|
+
direction: n
|
|
14
|
+
}] : [] : [{
|
|
15
|
+
key: e,
|
|
16
|
+
direction: t
|
|
17
|
+
}];
|
|
18
|
+
});
|
|
19
|
+
}, []), l = e((e, t = "asc") => {
|
|
20
|
+
let n = t === "asc" ? "desc" : "asc";
|
|
21
|
+
s((r) => {
|
|
22
|
+
let i = r.findIndex((t) => t.key === e);
|
|
23
|
+
if (i === -1) return [...r, {
|
|
24
|
+
key: e,
|
|
25
|
+
direction: t
|
|
26
|
+
}];
|
|
27
|
+
if (r[i].direction === t) {
|
|
28
|
+
let t = [...r];
|
|
29
|
+
return t[i] = {
|
|
30
|
+
key: e,
|
|
31
|
+
direction: n
|
|
32
|
+
}, t;
|
|
33
|
+
}
|
|
34
|
+
return r.filter((e, t) => t !== i);
|
|
35
|
+
});
|
|
36
|
+
}, []), u = e(() => {
|
|
37
|
+
s([]);
|
|
38
|
+
}, []);
|
|
39
|
+
return {
|
|
40
|
+
sortedData: t(() => o.length === 0 ? i : [...i].sort((e, t) => {
|
|
41
|
+
for (let { key: n, direction: i } of o) {
|
|
42
|
+
let a = r(e[n], t[n]);
|
|
43
|
+
if (a !== 0) return i === "asc" ? a : -a;
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
}), [i, o]),
|
|
47
|
+
sortConfig: o,
|
|
48
|
+
requestSort: c,
|
|
49
|
+
requestMultiSort: l,
|
|
50
|
+
resetSort: u
|
|
51
|
+
};
|
|
41
52
|
}
|
|
42
|
-
export {
|
|
43
|
-
M as useTableSort
|
|
44
|
-
};
|
|
53
|
+
export { i as useTableSort };
|
package/components/Tabs/Tabs.js
CHANGED
|
@@ -1,163 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useId as i, useRef as a, useState as o } from "react";
|
|
2
|
+
import s from "clsx";
|
|
3
|
+
import c from "./Tabs.module.scss.js";
|
|
4
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
5
|
+
// src/components/Tabs/Tabs.tsx
|
|
6
|
+
var u = e(null);
|
|
7
|
+
function d(e) {
|
|
8
|
+
let t = r(u);
|
|
9
|
+
if (!t) throw Error(`${e} must be rendered inside a <Tabs>.`);
|
|
10
|
+
return t;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
baseId: c,
|
|
33
|
-
orientation: o,
|
|
34
|
-
variant: r,
|
|
35
|
-
size: s,
|
|
36
|
-
classes: i
|
|
37
|
-
};
|
|
38
|
-
return /* @__PURE__ */ m(N.Provider, { value: v, children: /* @__PURE__ */ m(
|
|
39
|
-
"div",
|
|
40
|
-
{
|
|
41
|
-
ref: p,
|
|
42
|
-
className: $(
|
|
43
|
-
d.root,
|
|
44
|
-
o === "vertical" && d.vertical,
|
|
45
|
-
i?.root,
|
|
46
|
-
a
|
|
47
|
-
),
|
|
48
|
-
...t,
|
|
49
|
-
children: l
|
|
50
|
-
}
|
|
51
|
-
) });
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
k.displayName = "Tabs";
|
|
55
|
-
const A = x(
|
|
56
|
-
({ className: e, children: n, onKeyDown: b, ...o }, r) => {
|
|
57
|
-
const s = I("Tabs.List"), i = V(null), a = g(
|
|
58
|
-
(t) => {
|
|
59
|
-
i.current = t, typeof r == "function" ? r(t) : r && (r.current = t);
|
|
60
|
-
},
|
|
61
|
-
[r]
|
|
62
|
-
), l = (t) => {
|
|
63
|
-
if (b?.(t), t.defaultPrevented) return;
|
|
64
|
-
const p = i.current;
|
|
65
|
-
if (!p) return;
|
|
66
|
-
const c = Array.from(
|
|
67
|
-
p.querySelectorAll('[role="tab"]:not([aria-disabled="true"])')
|
|
68
|
-
);
|
|
69
|
-
if (c.length === 0) return;
|
|
70
|
-
const f = s.orientation === "vertical" ? "ArrowDown" : "ArrowRight", h = s.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", T = c.indexOf(document.activeElement);
|
|
71
|
-
let u = null;
|
|
72
|
-
if (t.key === f ? u = (T + 1) % c.length : t.key === h ? u = (T - 1 + c.length) % c.length : t.key === "Home" ? u = 0 : t.key === "End" && (u = c.length - 1), u === null) return;
|
|
73
|
-
t.preventDefault();
|
|
74
|
-
const y = c[u];
|
|
75
|
-
y.focus();
|
|
76
|
-
const v = y.dataset.value;
|
|
77
|
-
v !== void 0 && s.setValue(v);
|
|
78
|
-
};
|
|
79
|
-
return /* @__PURE__ */ m(
|
|
80
|
-
"div",
|
|
81
|
-
{
|
|
82
|
-
ref: a,
|
|
83
|
-
role: "tablist",
|
|
84
|
-
"aria-orientation": s.orientation,
|
|
85
|
-
className: $(
|
|
86
|
-
d.list,
|
|
87
|
-
d[`list_${s.variant}`],
|
|
88
|
-
d[`list_${s.size}`],
|
|
89
|
-
s.classes?.list,
|
|
90
|
-
e
|
|
91
|
-
),
|
|
92
|
-
onKeyDown: l,
|
|
93
|
-
...o,
|
|
94
|
-
children: n
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
A.displayName = "Tabs.List";
|
|
100
|
-
const C = x(
|
|
101
|
-
({ value: e, disabled: n = !1, className: b, children: o, onClick: r, ...s }, i) => {
|
|
102
|
-
const a = I("Tabs.Tab"), l = a.value === e;
|
|
103
|
-
return /* @__PURE__ */ m(
|
|
104
|
-
"button",
|
|
105
|
-
{
|
|
106
|
-
ref: i,
|
|
107
|
-
type: "button",
|
|
108
|
-
role: "tab",
|
|
109
|
-
id: `${a.baseId}-tab-${e}`,
|
|
110
|
-
"data-value": e,
|
|
111
|
-
"aria-selected": l,
|
|
112
|
-
"aria-controls": `${a.baseId}-panel-${e}`,
|
|
113
|
-
"aria-disabled": n || void 0,
|
|
114
|
-
tabIndex: l ? 0 : -1,
|
|
115
|
-
disabled: n,
|
|
116
|
-
className: $(
|
|
117
|
-
d.tab,
|
|
118
|
-
d[`tab_${a.variant}`],
|
|
119
|
-
l && d.tabSelected,
|
|
120
|
-
a.classes?.tab,
|
|
121
|
-
b
|
|
122
|
-
),
|
|
123
|
-
onClick: (t) => {
|
|
124
|
-
r?.(t), n || a.setValue(e);
|
|
125
|
-
},
|
|
126
|
-
...s,
|
|
127
|
-
children: o
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
C.displayName = "Tabs.Tab";
|
|
133
|
-
const P = x(
|
|
134
|
-
({ value: e, keepMounted: n = !1, className: b, style: o, children: r, ...s }, i) => {
|
|
135
|
-
const a = I("Tabs.Panel"), l = a.value === e;
|
|
136
|
-
if (!l && !n) return null;
|
|
137
|
-
const t = l ? o : { display: "none", ...o };
|
|
138
|
-
return /* @__PURE__ */ m(
|
|
139
|
-
"div",
|
|
140
|
-
{
|
|
141
|
-
ref: i,
|
|
142
|
-
role: "tabpanel",
|
|
143
|
-
id: `${a.baseId}-panel-${e}`,
|
|
144
|
-
"aria-labelledby": `${a.baseId}-tab-${e}`,
|
|
145
|
-
hidden: !l,
|
|
146
|
-
tabIndex: 0,
|
|
147
|
-
className: $(d.panel, a.classes?.panel, b),
|
|
148
|
-
style: t,
|
|
149
|
-
...s,
|
|
150
|
-
children: r
|
|
151
|
-
}
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
P.displayName = "Tabs.Panel";
|
|
156
|
-
const K = Object.assign(k, {
|
|
157
|
-
List: A,
|
|
158
|
-
Tab: C,
|
|
159
|
-
Panel: P
|
|
12
|
+
var f = t(({ value: e, defaultValue: t, onValueChange: r, orientation: a = "horizontal", variant: d = "line", size: f = "md", classes: p, className: m, children: h, ...g }, _) => {
|
|
13
|
+
let v = i(), y = e !== void 0, [b, x] = o(t), S = {
|
|
14
|
+
value: y ? e : b,
|
|
15
|
+
setValue: n((e) => {
|
|
16
|
+
y || x(e), r?.(e);
|
|
17
|
+
}, [y, r]),
|
|
18
|
+
baseId: v,
|
|
19
|
+
orientation: a,
|
|
20
|
+
variant: d,
|
|
21
|
+
size: f,
|
|
22
|
+
classes: p
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ l(u.Provider, {
|
|
25
|
+
value: S,
|
|
26
|
+
children: /* @__PURE__ */ l("div", {
|
|
27
|
+
ref: _,
|
|
28
|
+
className: s(c.root, a === "vertical" && c.vertical, p?.root, m),
|
|
29
|
+
...g,
|
|
30
|
+
children: h
|
|
31
|
+
})
|
|
32
|
+
});
|
|
160
33
|
});
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
34
|
+
f.displayName = "Tabs";
|
|
35
|
+
var p = t(({ className: e, children: t, onKeyDown: r, ...i }, o) => {
|
|
36
|
+
let u = d("Tabs.List"), f = a(null), p = n((e) => {
|
|
37
|
+
f.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
|
|
38
|
+
}, [o]);
|
|
39
|
+
return /* @__PURE__ */ l("div", {
|
|
40
|
+
ref: p,
|
|
41
|
+
role: "tablist",
|
|
42
|
+
"aria-orientation": u.orientation,
|
|
43
|
+
className: s(c.list, c[`list_${u.variant}`], c[`list_${u.size}`], u.classes?.list, e),
|
|
44
|
+
onKeyDown: (e) => {
|
|
45
|
+
if (r?.(e), e.defaultPrevented) return;
|
|
46
|
+
let t = f.current;
|
|
47
|
+
if (!t) return;
|
|
48
|
+
let n = Array.from(t.querySelectorAll("[role=\"tab\"]:not([aria-disabled=\"true\"])"));
|
|
49
|
+
if (n.length === 0) return;
|
|
50
|
+
let i = u.orientation === "vertical" ? "ArrowDown" : "ArrowRight", a = u.orientation === "vertical" ? "ArrowUp" : "ArrowLeft", o = n.indexOf(document.activeElement), s = null;
|
|
51
|
+
if (e.key === i ? s = (o + 1) % n.length : e.key === a ? s = (o - 1 + n.length) % n.length : e.key === "Home" ? s = 0 : e.key === "End" && (s = n.length - 1), s === null) return;
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
let c = n[s];
|
|
54
|
+
c.focus();
|
|
55
|
+
let l = c.dataset.value;
|
|
56
|
+
l !== void 0 && u.setValue(l);
|
|
57
|
+
},
|
|
58
|
+
...i,
|
|
59
|
+
children: t
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
p.displayName = "Tabs.List";
|
|
63
|
+
var m = t(({ value: e, disabled: t = !1, className: n, children: r, onClick: i, ...a }, o) => {
|
|
64
|
+
let u = d("Tabs.Tab"), f = u.value === e;
|
|
65
|
+
return /* @__PURE__ */ l("button", {
|
|
66
|
+
ref: o,
|
|
67
|
+
type: "button",
|
|
68
|
+
role: "tab",
|
|
69
|
+
id: `${u.baseId}-tab-${e}`,
|
|
70
|
+
"data-value": e,
|
|
71
|
+
"aria-selected": f,
|
|
72
|
+
"aria-controls": `${u.baseId}-panel-${e}`,
|
|
73
|
+
"aria-disabled": t || void 0,
|
|
74
|
+
tabIndex: f ? 0 : -1,
|
|
75
|
+
disabled: t,
|
|
76
|
+
className: s(c.tab, c[`tab_${u.variant}`], f && c.tabSelected, u.classes?.tab, n),
|
|
77
|
+
onClick: (n) => {
|
|
78
|
+
i?.(n), t || u.setValue(e);
|
|
79
|
+
},
|
|
80
|
+
...a,
|
|
81
|
+
children: r
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
m.displayName = "Tabs.Tab";
|
|
85
|
+
var h = t(({ value: e, keepMounted: t = !1, className: n, style: r, children: i, ...a }, o) => {
|
|
86
|
+
let u = d("Tabs.Panel"), f = u.value === e;
|
|
87
|
+
if (!f && !t) return null;
|
|
88
|
+
let p = f ? r : {
|
|
89
|
+
display: "none",
|
|
90
|
+
...r
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ l("div", {
|
|
93
|
+
ref: o,
|
|
94
|
+
role: "tabpanel",
|
|
95
|
+
id: `${u.baseId}-panel-${e}`,
|
|
96
|
+
"aria-labelledby": `${u.baseId}-tab-${e}`,
|
|
97
|
+
hidden: !f,
|
|
98
|
+
tabIndex: 0,
|
|
99
|
+
className: s(c.panel, u.classes?.panel, n),
|
|
100
|
+
style: p,
|
|
101
|
+
...a,
|
|
102
|
+
children: i
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
h.displayName = "Tabs.Panel";
|
|
106
|
+
var g = Object.assign(f, {
|
|
107
|
+
List: p,
|
|
108
|
+
Tab: m,
|
|
109
|
+
Panel: h
|
|
110
|
+
});
|
|
111
|
+
export { g as Tabs };
|
|
@@ -1,53 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
H as default,
|
|
29
|
-
i as list,
|
|
30
|
-
m as listLg,
|
|
31
|
-
c as listLine,
|
|
32
|
-
d as listMd,
|
|
33
|
-
_ as listPill,
|
|
34
|
-
r as listSm,
|
|
35
|
-
n as listSolid,
|
|
36
|
-
p as list_lg,
|
|
37
|
-
s as list_line,
|
|
38
|
-
k as list_md,
|
|
39
|
-
a as list_pill,
|
|
40
|
-
e as list_sm,
|
|
41
|
-
o as list_solid,
|
|
42
|
-
B as panel,
|
|
43
|
-
l as root,
|
|
44
|
-
b as tab,
|
|
45
|
-
g as tabLine,
|
|
46
|
-
Z as tabPill,
|
|
47
|
-
x as tabSelected,
|
|
48
|
-
S as tabSolid,
|
|
49
|
-
L as tab_line,
|
|
50
|
-
f as tab_pill,
|
|
51
|
-
v as tab_solid,
|
|
52
|
-
t as vertical
|
|
1
|
+
// src/components/Tabs/Tabs.module.scss
|
|
2
|
+
var e = "crk-root-2x4fl", t = "crk-vertical-D93pf", n = "crk-list-6iAKX", r = "crk-list_line-ZazHL", i = "crk-list_line-ZazHL", a = "crk-list_solid-Lbmnx", o = "crk-list_solid-Lbmnx", s = "crk-list_pill-g90VV", c = "crk-list_pill-g90VV", l = "crk-list_sm-U-pax", u = "crk-list_sm-U-pax", d = "crk-tab-LYqhc", f = "crk-list_md-0H3Fg", p = "crk-list_md-0H3Fg", m = "crk-list_lg-vxB6m", h = "crk-list_lg-vxB6m", g = "crk-tab_line-8v4fZ", _ = "crk-tab_line-8v4fZ", v = "crk-tabSelected-lZne9", y = "crk-tab_solid-4RJvK", b = "crk-tab_solid-4RJvK", x = "crk-tab_pill-qGlBx", S = "crk-tab_pill-qGlBx", C = "crk-panel-0OUR6", w = {
|
|
3
|
+
root: e,
|
|
4
|
+
vertical: t,
|
|
5
|
+
list: n,
|
|
6
|
+
list_line: r,
|
|
7
|
+
listLine: i,
|
|
8
|
+
list_solid: a,
|
|
9
|
+
listSolid: o,
|
|
10
|
+
list_pill: s,
|
|
11
|
+
listPill: c,
|
|
12
|
+
list_sm: l,
|
|
13
|
+
listSm: u,
|
|
14
|
+
tab: d,
|
|
15
|
+
list_md: f,
|
|
16
|
+
listMd: p,
|
|
17
|
+
list_lg: m,
|
|
18
|
+
listLg: h,
|
|
19
|
+
tab_line: g,
|
|
20
|
+
tabLine: _,
|
|
21
|
+
tabSelected: v,
|
|
22
|
+
tab_solid: y,
|
|
23
|
+
tabSolid: b,
|
|
24
|
+
tab_pill: x,
|
|
25
|
+
tabPill: S,
|
|
26
|
+
panel: C
|
|
53
27
|
};
|
|
28
|
+
export { w as default, n as list, h as listLg, i as listLine, p as listMd, c as listPill, u as listSm, o as listSolid, m as list_lg, r as list_line, f as list_md, s as list_pill, l as list_sm, a as list_solid, C as panel, e as root, d as tab, _ as tabLine, S as tabPill, v as tabSelected, b as tabSolid, g as tab_line, x as tab_pill, y as tab_solid, t as vertical };
|