@overdoser/react-toolkit 0.19.0 → 0.21.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 -2
- package/CHANGELOG.md +47 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.js +20 -0
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.js +25 -0
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +92 -95
- package/components/Alert/Alert.module.js +18 -0
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.js +23 -0
- package/components/Badge/Badge.js +16 -38
- package/components/Badge/Badge.module.js +17 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.js +10 -0
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.js +25 -0
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.js +35 -0
- 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.js +32 -0
- 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 +46 -41
- 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.js +32 -0
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.js +23 -0
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.js +28 -0
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.js +12 -0
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.js +17 -0
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.js +10 -0
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.js +66 -0
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.js +29 -0
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +12 -10
- 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.js +12 -0
- package/components/EmptyState/EmptyState.js +58 -55
- package/components/EmptyState/EmptyState.module.js +14 -0
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +32 -35
- package/components/Form/Form.module.js +16 -0
- 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.js +26 -0
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +25 -22
- package/components/Kbd/Kbd.module.js +10 -0
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.js +23 -0
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.js +10 -0
- package/components/List/List.js +22 -46
- package/components/List/List.module.js +12 -0
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.js +40 -0
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.js +18 -0
- package/components/PageHeader/PageHeader.js +78 -72
- package/components/PageHeader/PageHeader.module.js +23 -0
- package/components/Pagination/Pagination.js +63 -84
- package/components/Pagination/Pagination.module.js +13 -0
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.js +12 -0
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +57 -90
- package/components/ProgressBar/ProgressBar.module.js +29 -0
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.js +3 -0
- package/components/SegmentedControl/SegmentedControl.js +94 -130
- package/components/SegmentedControl/SegmentedControl.module.js +21 -0
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.js +15 -0
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.js +12 -0
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.js +31 -0
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.js +14 -0
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.js +42 -0
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.js +18 -0
- package/components/Table/Table.d.ts +41 -16
- package/components/Table/Table.js +383 -442
- package/components/Table/Table.module.js +42 -0
- package/components/Table/index.d.ts +1 -1
- package/components/Table/useTableSort.d.ts +1 -1
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.js +28 -0
- package/components/ThemeToggle/ThemeToggle.d.ts +2 -0
- package/components/ThemeToggle/ThemeToggle.js +122 -97
- package/components/ThemeToggle/ThemeToggle.module.js +13 -0
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.js +29 -0
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.js +31 -0
- package/components/Timeline/Timeline.module.js +76 -0
- 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 +245 -178
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.js +98 -0
- 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.js +29 -0
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.js +37 -0
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +35 -57
- package/components/ToggleIconButton/ToggleIconButton.module.js +15 -0
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.js +17 -0
- package/components/Typography/Typography.js +11 -36
- package/components/Typography/Typography.module.js +30 -0
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.js +10 -0
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.js +17 -0
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.js +23 -0
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.js +14 -0
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.js +20 -0
- 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.js +15 -0
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.js +14 -0
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.js +9 -0
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.js +8 -0
- package/components/inputs/Select/Select.js +555 -682
- package/components/inputs/Select/Select.module.js +38 -0
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.js +9 -0
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.js +14 -0
- 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 -91
- package/hooks/usePortalPosition.js +25 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.d.ts +2 -2
- package/hooks/useTheme.js +28 -25
- package/index.css +2 -1
- package/index.d.ts +1 -1
- package/index.js +97 -215
- package/index.layered.css +2 -3
- package/llms.txt +9 -6
- package/manifest.json +66 -10
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.d.ts +2 -0
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
- package/components/Accordion/Accordion.module.scss.js +0 -36
- package/components/ActionButton/ActionButton.module.scss.js +0 -47
- package/components/Alert/Alert.module.scss.js +0 -33
- package/components/Avatar/Avatar.module.scss.js +0 -43
- package/components/Badge/Badge.module.scss.js +0 -31
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +0 -17
- package/components/Button/Button.module.scss.js +0 -47
- package/components/Card/Card.module.scss.js +0 -60
- package/components/Chart/Chart.module.scss.js +0 -61
- package/components/Chip/Chip.module.scss.js +0 -59
- package/components/CodeBlock/CodeBlock.module.scss.js +0 -43
- package/components/CommandPalette/CommandPalette.module.scss.js +0 -49
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +0 -21
- package/components/Divider/Divider.module.scss.js +0 -31
- package/components/Draggable/Draggable.module.scss.js +0 -17
- package/components/Drawer/Drawer.module.scss.js +0 -119
- package/components/Dropdown/Dropdown.module.scss.js +0 -53
- package/components/Dropzone/Dropzone.module.scss.js +0 -21
- package/components/EmptyState/EmptyState.module.scss.js +0 -25
- package/components/Form/Form.module.scss.js +0 -29
- package/components/ImageViewer/ImageViewer.module.scss.js +0 -47
- package/components/Kbd/Kbd.module.scss.js +0 -17
- package/components/KeyValueList/KeyValueList.module.scss.js +0 -43
- package/components/Link/Link.module.scss.js +0 -16
- package/components/List/List.module.scss.js +0 -21
- package/components/Loader/Loader.module.scss.js +0 -70
- package/components/Modal/Modal.module.scss.js +0 -33
- package/components/PageHeader/PageHeader.module.scss.js +0 -43
- package/components/Pagination/Pagination.module.scss.js +0 -23
- package/components/Popover/Popover.module.scss.js +0 -21
- package/components/ProgressBar/ProgressBar.module.scss.js +0 -51
- package/components/RelativeTime/RelativeTime.module.scss.js +0 -7
- package/components/SegmentedControl/SegmentedControl.module.scss.js +0 -39
- package/components/Skeleton/Skeleton.module.scss.js +0 -25
- package/components/Spinner/Spinner.module.scss.js +0 -20
- package/components/SplitButton/SplitButton.module.scss.js +0 -57
- package/components/SplitPane/SplitPane.module.scss.js +0 -25
- package/components/StatCard/StatCard.module.scss.js +0 -72
- package/components/StatusDot/StatusDot.module.scss.js +0 -32
- package/components/Table/Table.module.scss.js +0 -81
- package/components/Tabs/Tabs.module.scss.js +0 -53
- package/components/ThemeToggle/ThemeToggle.module.scss.js +0 -23
- package/components/Timeline/GanttTimeline.module.scss.js +0 -55
- package/components/Timeline/HistoryTimeline.module.scss.js +0 -59
- package/components/Timeline/Timeline.module.scss.js +0 -141
- package/components/Timeline/TraceTimeline.module.scss.js +0 -189
- package/components/Timer/Timer.module.scss.js +0 -55
- package/components/Toast/Toast.module.scss.js +0 -62
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +0 -27
- package/components/Tooltip/Tooltip.module.scss.js +0 -30
- package/components/Typography/Typography.module.scss.js +0 -53
- package/components/inputs/Checkbox/Checkbox.module.scss.js +0 -17
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +0 -31
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +0 -41
- package/components/inputs/DatePicker/DatePicker.module.scss.js +0 -25
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +0 -37
- package/components/inputs/Input/Input.module.scss.js +0 -27
- package/components/inputs/NumberInput/NumberInput.module.scss.js +0 -25
- package/components/inputs/Radio/Radio.module.scss.js +0 -15
- package/components/inputs/SearchInput/SearchInput.module.scss.js +0 -13
- package/components/inputs/Select/Select.module.scss.js +0 -73
- package/components/inputs/Slider/Slider.module.scss.js +0 -15
- package/components/inputs/Textarea/Textarea.module.scss.js +0 -25
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/components/Popover/Popover.module.scss
|
|
2
|
+
var e = "crk-root-8H-L9", t = "crk-trigger-Zn1nQ", n = "crk-popover-rvS3X", r = "crk-popoverFade-hj41M", i = "crk-bottom-lawQw", a = "crk-top-rqvC6", o = "crk-left-J6exv", s = "crk-right-3y20l", c = {
|
|
3
|
+
root: e,
|
|
4
|
+
trigger: t,
|
|
5
|
+
popover: n,
|
|
6
|
+
popoverFade: r,
|
|
7
|
+
bottom: i,
|
|
8
|
+
top: a,
|
|
9
|
+
left: o,
|
|
10
|
+
right: s
|
|
11
|
+
};
|
|
12
|
+
export { i as bottom, c as default, o as left, n as popover, r as popoverFade, s as right, e as root, a as top, t as trigger };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
1
|
+
import { ComponentPropsWithRef, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
export type ProgressBarVariant = 'primary' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
3
3
|
export interface ProgressBarThreshold {
|
|
4
4
|
/** Lower bound (inclusive) from which `variant` applies. */
|
|
@@ -58,6 +58,19 @@ export interface ProgressBarProps extends Omit<ComponentPropsWithRef<'div'>, 'ch
|
|
|
58
58
|
* at the top of a survey/wizard page. @default 'rounded'
|
|
59
59
|
*/
|
|
60
60
|
shape?: 'rounded' | 'square';
|
|
61
|
+
/**
|
|
62
|
+
* Segmented mode only. Makes every segment a clickable, keyboard-focusable
|
|
63
|
+
* button and calls back with its zero-based index — jump-to-step in a
|
|
64
|
+
* wizard/survey. The track switches from `role="progressbar"` to a
|
|
65
|
+
* `role="group"` of buttons (progressbar children are presentational, so
|
|
66
|
+
* screen readers would otherwise skip them).
|
|
67
|
+
*/
|
|
68
|
+
onSegmentClick?: (index: number, event: MouseEvent<HTMLButtonElement>) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Accessible name for each clickable segment (`onSegmentClick` only).
|
|
71
|
+
* @default (index, segments) => `Step ${index + 1} of ${segments}`
|
|
72
|
+
*/
|
|
73
|
+
segmentLabel?: (index: number, segments: number) => string;
|
|
61
74
|
/** Override class names on internal elements. */
|
|
62
75
|
classes?: Partial<ProgressBarClasses>;
|
|
63
76
|
}
|
|
@@ -70,5 +83,6 @@ export interface ProgressBarProps extends Omit<ComponentPropsWithRef<'div'>, 'ch
|
|
|
70
83
|
* <ProgressBar value={level} thresholds={[{ value: 0, variant: 'danger' }, { value: 20, variant: 'warning' }, { value: 50, variant: 'success' }]} />
|
|
71
84
|
* <ProgressBar value={2} max={5} segments={5} size="lg" />
|
|
72
85
|
* <ProgressBar value={2} max={4} segments={4} showCurrent shape="square" aria-label="Step 3 of 4" />
|
|
86
|
+
* <ProgressBar value={done} max={4} segments={4} showCurrent onSegmentClick={(i) => goToStep(i)} />
|
|
73
87
|
*/
|
|
74
88
|
export declare const ProgressBar: import('react').ForwardRefExoticComponent<Omit<ProgressBarProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,90 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
r?.track
|
|
59
|
-
),
|
|
60
|
-
children: u ? Array.from({ length: i }, (x, t) => /* @__PURE__ */ m(
|
|
61
|
-
"span",
|
|
62
|
-
{
|
|
63
|
-
className: n(
|
|
64
|
-
e.segment,
|
|
65
|
-
t < f && e.segmentFilled,
|
|
66
|
-
t === y && e.segmentCurrent,
|
|
67
|
-
r?.segment,
|
|
68
|
-
t < f && r?.segmentFilled,
|
|
69
|
-
t === y && r?.segmentCurrent
|
|
70
|
-
)
|
|
71
|
-
},
|
|
72
|
-
t
|
|
73
|
-
)) : /* @__PURE__ */ m(
|
|
74
|
-
"span",
|
|
75
|
-
{
|
|
76
|
-
className: n(e.fill, r?.fill),
|
|
77
|
-
style: a ? void 0 : { width: `${N * 100}%` }
|
|
78
|
-
}
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
z.displayName = "ProgressBar";
|
|
88
|
-
export {
|
|
89
|
-
z as ProgressBar
|
|
90
|
-
};
|
|
1
|
+
import e from "./ProgressBar.module.js";
|
|
2
|
+
import { forwardRef as t, useMemo as n } from "react";
|
|
3
|
+
import r from "clsx";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
// src/components/ProgressBar/ProgressBar.tsx
|
|
6
|
+
var o = (e, t) => `${Math.round(e / t * 100)}%`, s = (e, t) => `Step ${e + 1} of ${t}`, c = t(({ value: t, max: c = 100, label: l, showValue: u = !1, formatValue: d = o, size: f = "md", variant: p = "primary", thresholds: m, segments: h, showCurrent: g = !1, shape: _ = "rounded", onSegmentClick: v, segmentLabel: y = s, classes: b, className: x, style: S, "aria-label": C, "aria-labelledby": w, ...T }, E) => {
|
|
7
|
+
let D = c > 0 ? c : 100, O = t === void 0 || Number.isNaN(t), k = O ? 0 : Math.min(D, Math.max(0, t)), A = k / D, j = n(() => {
|
|
8
|
+
if (O || !m?.length) return p;
|
|
9
|
+
let e = [...m].sort((e, t) => e.value - t.value), t = p;
|
|
10
|
+
for (let n of e) n.value <= k && (t = n.variant);
|
|
11
|
+
return t;
|
|
12
|
+
}, [
|
|
13
|
+
O,
|
|
14
|
+
m,
|
|
15
|
+
p,
|
|
16
|
+
k
|
|
17
|
+
]), M = !O && typeof h == "number" && h > 1, N = M ? Math.round(A * h) : 0, P = M && g && N < h ? N : -1, F = M && typeof v == "function", I = l != null && l !== !1, L = I || u && !O;
|
|
18
|
+
return /* @__PURE__ */ a("div", {
|
|
19
|
+
ref: E,
|
|
20
|
+
className: r(e.root, e[f], e[j], _ === "square" && e.square, b?.root, x),
|
|
21
|
+
style: S,
|
|
22
|
+
...T,
|
|
23
|
+
children: [L && /* @__PURE__ */ a("div", {
|
|
24
|
+
className: r(e.header, b?.header),
|
|
25
|
+
children: [I && /* @__PURE__ */ i("span", {
|
|
26
|
+
className: r(e.label, b?.label),
|
|
27
|
+
children: l
|
|
28
|
+
}), u && !O && /* @__PURE__ */ i("span", {
|
|
29
|
+
className: r(e.value, b?.value),
|
|
30
|
+
children: d(k, D)
|
|
31
|
+
})]
|
|
32
|
+
}), /* @__PURE__ */ i("div", {
|
|
33
|
+
role: F ? "group" : "progressbar",
|
|
34
|
+
"aria-valuemin": F ? void 0 : 0,
|
|
35
|
+
"aria-valuemax": F ? void 0 : D,
|
|
36
|
+
"aria-valuenow": F || O ? void 0 : k,
|
|
37
|
+
"aria-label": C ?? (typeof l == "string" ? l : void 0),
|
|
38
|
+
"aria-labelledby": w,
|
|
39
|
+
className: r(e.track, O && e.indeterminate, M && e.segmented, F && e.clickable, b?.track),
|
|
40
|
+
children: M ? Array.from({ length: h }, (t, n) => {
|
|
41
|
+
let a = r(e.segment, n < N && e.segmentFilled, n === P && e.segmentCurrent, b?.segment, n < N && b?.segmentFilled, n === P && b?.segmentCurrent);
|
|
42
|
+
return F ? /* @__PURE__ */ i("button", {
|
|
43
|
+
type: "button",
|
|
44
|
+
className: a,
|
|
45
|
+
"aria-label": y(n, h),
|
|
46
|
+
"aria-current": n === P ? "step" : void 0,
|
|
47
|
+
onClick: (e) => v?.(n, e)
|
|
48
|
+
}, n) : /* @__PURE__ */ i("span", { className: a }, n);
|
|
49
|
+
}) : /* @__PURE__ */ i("span", {
|
|
50
|
+
className: r(e.fill, b?.fill),
|
|
51
|
+
style: O ? void 0 : { width: `${A * 100}%` }
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
c.displayName = "ProgressBar";
|
|
57
|
+
export { c as ProgressBar };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/components/ProgressBar/ProgressBar.module.scss
|
|
2
|
+
var e = "crk-root-OIfFA", t = "crk-sm-lcp3n", n = "crk-md-6WStK", r = "crk-lg-i8EIC", i = "crk-primary-d7Piz", a = "crk-success-cvbui", o = "crk-warning-T5lWo", s = "crk-danger-43KPI", c = "crk-neutral-8XqGp", l = "crk-header-z7QvW", u = "crk-label-hsH4C", d = "crk-value-lGO18", f = "crk-track-vjybM", p = "crk-fill-MAyGB", m = "crk-indeterminate-D4x08", h = "crk-crk-progress-slide-lJXeI", g = "crk-segmented-4U5CV", _ = "crk-segment-kL8tr", v = "crk-segmentFilled-iSzPI", y = "crk-segmentCurrent-H443l", b = "crk-clickable-xDN2c", x = "crk-square-6Soi4", S = "crk-crk-progress-fade-748w-", C = {
|
|
3
|
+
root: e,
|
|
4
|
+
sm: t,
|
|
5
|
+
md: n,
|
|
6
|
+
lg: r,
|
|
7
|
+
primary: i,
|
|
8
|
+
success: a,
|
|
9
|
+
warning: o,
|
|
10
|
+
danger: s,
|
|
11
|
+
neutral: c,
|
|
12
|
+
header: l,
|
|
13
|
+
label: u,
|
|
14
|
+
value: d,
|
|
15
|
+
track: f,
|
|
16
|
+
fill: p,
|
|
17
|
+
indeterminate: m,
|
|
18
|
+
"crk-progress-slide": "crk-crk-progress-slide-lJXeI",
|
|
19
|
+
crkProgressSlide: h,
|
|
20
|
+
segmented: g,
|
|
21
|
+
segment: _,
|
|
22
|
+
segmentFilled: v,
|
|
23
|
+
segmentCurrent: y,
|
|
24
|
+
clickable: b,
|
|
25
|
+
square: x,
|
|
26
|
+
"crk-progress-fade": "crk-crk-progress-fade-748w-",
|
|
27
|
+
crkProgressFade: S
|
|
28
|
+
};
|
|
29
|
+
export { b as clickable, S as crkProgressFade, h as crkProgressSlide, s as danger, C as default, p as fill, l as header, m as indeterminate, u as label, r as lg, n as md, c as neutral, i as primary, e as root, _ as segment, y as segmentCurrent, v as segmentFilled, g as segmented, t as sm, x as square, a as success, f as track, d as value, o as warning };
|
|
@@ -1,43 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
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
|
-
U.displayName = "RelativeTime";
|
|
41
|
-
export {
|
|
42
|
-
U as RelativeTime
|
|
43
|
-
};
|
|
1
|
+
import e from "./RelativeTime.module.js";
|
|
2
|
+
import { useNow as t } from "../../hooks/useNow.js";
|
|
3
|
+
import { refreshIntervalFor as n, timeAgo as r, toTimestamp as i } from "../../utils/timeAgo.js";
|
|
4
|
+
import { forwardRef as a, useMemo as o } from "react";
|
|
5
|
+
import s from "clsx";
|
|
6
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
7
|
+
// src/components/RelativeTime/RelativeTime.tsx
|
|
8
|
+
var l = {
|
|
9
|
+
dateStyle: "medium",
|
|
10
|
+
timeStyle: "short"
|
|
11
|
+
}, u = a(({ value: a, format: u = "long", numeric: d = "auto", locale: f, live: p = !0, now: m, maxAge: h, absoluteFormat: g = l, title: _ = !0, fallback: v = "—", classes: y, className: b, ...x }, S) => {
|
|
12
|
+
let C = o(() => i(a), [a]), w = Number.isFinite(C), T = C - (m ?? Date.now()), E = n(T), D = t(E, p && m === void 0 && w), O = m ?? D;
|
|
13
|
+
if (!w) return /* @__PURE__ */ c("time", {
|
|
14
|
+
ref: S,
|
|
15
|
+
className: s(e.root, y?.root, b),
|
|
16
|
+
...x,
|
|
17
|
+
children: v
|
|
18
|
+
});
|
|
19
|
+
let k = new Date(C).toISOString(), A = new Intl.DateTimeFormat(f, g).format(C), j = r(C, {
|
|
20
|
+
now: O,
|
|
21
|
+
locale: f,
|
|
22
|
+
format: u,
|
|
23
|
+
numeric: d,
|
|
24
|
+
maxAge: h
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ c("time", {
|
|
27
|
+
ref: S,
|
|
28
|
+
dateTime: k,
|
|
29
|
+
title: _ === !1 ? void 0 : _ === !0 ? A : _,
|
|
30
|
+
className: s(e.root, y?.root, b),
|
|
31
|
+
...x,
|
|
32
|
+
children: j ?? A
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
u.displayName = "RelativeTime";
|
|
36
|
+
export { u as RelativeTime };
|
|
@@ -1,131 +1,95 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
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
|
-
|
|
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
|
-
"aria-label": x,
|
|
93
|
-
tabIndex: n ? -1 : e.value === N ? 0 : -1,
|
|
94
|
-
className: S,
|
|
95
|
-
onClick: (r) => {
|
|
96
|
-
if (n) {
|
|
97
|
-
r.preventDefault();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
g(e.value);
|
|
101
|
-
},
|
|
102
|
-
onKeyDown: (r) => k(r, e),
|
|
103
|
-
children: C
|
|
104
|
-
},
|
|
105
|
-
e.value
|
|
106
|
-
) : f = /* @__PURE__ */ t(
|
|
107
|
-
"button",
|
|
108
|
-
{
|
|
109
|
-
ref: I,
|
|
110
|
-
type: "button",
|
|
111
|
-
role: "radio",
|
|
112
|
-
"aria-checked": o,
|
|
113
|
-
"aria-label": x,
|
|
114
|
-
disabled: n,
|
|
115
|
-
tabIndex: e.value === N ? 0 : -1,
|
|
116
|
-
className: S,
|
|
117
|
-
onClick: () => g(e.value),
|
|
118
|
-
onKeyDown: (r) => k(r, e),
|
|
119
|
-
children: C
|
|
120
|
-
},
|
|
121
|
-
e.value
|
|
122
|
-
), e.tooltip !== void 0 && e.tooltip !== null && e.tooltip !== "" ? /* @__PURE__ */ t(V, { content: e.tooltip, children: f }, e.value) : f;
|
|
123
|
-
})
|
|
124
|
-
}
|
|
125
|
-
);
|
|
1
|
+
import e from "./SegmentedControl.module.js";
|
|
2
|
+
import { Tooltip as t } from "../Tooltip/Tooltip.js";
|
|
3
|
+
import { forwardRef as n, useCallback as r, useRef as i, useState as a } from "react";
|
|
4
|
+
import o from "clsx";
|
|
5
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
7
|
+
function u({ options: n, value: u, defaultValue: d, onChange: f, size: p = "md", shape: m = "rounded", variant: h = "filled", fullWidth: g = !1, disabled: _ = !1, classes: v, className: y, style: b, id: x, "aria-label": S, "aria-labelledby": C }, w) {
|
|
8
|
+
let T = u !== void 0, [E, D] = a(d), O = T ? u : E, k = i(/* @__PURE__ */ new Map()), A = n.some((e) => e.href !== void 0), j = r((e) => {
|
|
9
|
+
T || D(e), e !== O && f?.(e);
|
|
10
|
+
}, [
|
|
11
|
+
T,
|
|
12
|
+
O,
|
|
13
|
+
f
|
|
14
|
+
]), M = n.filter((e) => !(_ || e.disabled)), N = (e) => {
|
|
15
|
+
e && (j(e.value), k.current.get(e.value)?.focus());
|
|
16
|
+
}, P = (e, t) => {
|
|
17
|
+
if (M.length === 0) return;
|
|
18
|
+
let n = M.findIndex((e) => e.value === t.value);
|
|
19
|
+
switch (e.key) {
|
|
20
|
+
case "ArrowRight":
|
|
21
|
+
case "ArrowDown":
|
|
22
|
+
e.preventDefault(), N(M[(n + 1 + M.length) % M.length]);
|
|
23
|
+
break;
|
|
24
|
+
case "ArrowLeft":
|
|
25
|
+
case "ArrowUp":
|
|
26
|
+
e.preventDefault(), N(M[(n - 1 + M.length) % M.length]);
|
|
27
|
+
break;
|
|
28
|
+
case "Home":
|
|
29
|
+
e.preventDefault(), N(M[0]);
|
|
30
|
+
break;
|
|
31
|
+
case "End": e.preventDefault(), N(M[M.length - 1]);
|
|
32
|
+
}
|
|
33
|
+
}, F = M.find((e) => e.value === O)?.value ?? M[0]?.value;
|
|
34
|
+
return /* @__PURE__ */ c("div", {
|
|
35
|
+
ref: w,
|
|
36
|
+
id: x,
|
|
37
|
+
role: A ? "group" : "radiogroup",
|
|
38
|
+
"aria-label": S,
|
|
39
|
+
"aria-labelledby": C,
|
|
40
|
+
"aria-disabled": _ || void 0,
|
|
41
|
+
className: o(e.root, e[p], e[m], e[h], g && e.fullWidth, _ && e.disabled, v?.root, y),
|
|
42
|
+
style: b,
|
|
43
|
+
children: n.map((n) => {
|
|
44
|
+
let r = n.value === O, i = _ || !!n.disabled, a = n.icon !== void 0 && n.label === void 0, u = typeof n.tooltip == "string" ? n.tooltip : void 0, d = n["aria-label"] ?? (a ? u : void 0), f = /* @__PURE__ */ l(s, { children: [
|
|
45
|
+
n.icon !== void 0 && /* @__PURE__ */ c("span", {
|
|
46
|
+
className: o(e.icon, v?.icon),
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
children: n.icon
|
|
49
|
+
}),
|
|
50
|
+
n.label !== void 0 && /* @__PURE__ */ c("span", {
|
|
51
|
+
className: o(e.label, v?.label),
|
|
52
|
+
children: n.label
|
|
53
|
+
}),
|
|
54
|
+
n.count !== void 0 && /* @__PURE__ */ c("span", {
|
|
55
|
+
className: o(e.count, v?.count),
|
|
56
|
+
children: n.count
|
|
57
|
+
})
|
|
58
|
+
] }), p = o(e.item, r && e.itemSelected, a && e.iconOnly, v?.item, r && v?.itemSelected), m = (e) => {
|
|
59
|
+
e ? k.current.set(n.value, e) : k.current.delete(n.value);
|
|
60
|
+
}, h;
|
|
61
|
+
return h = A ? /* @__PURE__ */ c("a", {
|
|
62
|
+
ref: m,
|
|
63
|
+
href: i ? void 0 : n.href,
|
|
64
|
+
"aria-current": r ? "page" : void 0,
|
|
65
|
+
"aria-disabled": i || void 0,
|
|
66
|
+
"aria-label": d,
|
|
67
|
+
tabIndex: i ? -1 : n.value === F ? 0 : -1,
|
|
68
|
+
className: p,
|
|
69
|
+
onClick: (e) => {
|
|
70
|
+
i ? e.preventDefault() : j(n.value);
|
|
71
|
+
},
|
|
72
|
+
onKeyDown: (e) => P(e, n),
|
|
73
|
+
children: f
|
|
74
|
+
}, n.value) : /* @__PURE__ */ c("button", {
|
|
75
|
+
ref: m,
|
|
76
|
+
type: "button",
|
|
77
|
+
role: "radio",
|
|
78
|
+
"aria-checked": r,
|
|
79
|
+
"aria-label": d,
|
|
80
|
+
disabled: i,
|
|
81
|
+
tabIndex: n.value === F ? 0 : -1,
|
|
82
|
+
className: p,
|
|
83
|
+
onClick: () => j(n.value),
|
|
84
|
+
onKeyDown: (e) => P(e, n),
|
|
85
|
+
children: f
|
|
86
|
+
}, n.value), n.tooltip !== void 0 && n.tooltip !== null && n.tooltip !== "" ? /* @__PURE__ */ c(t, {
|
|
87
|
+
content: n.tooltip,
|
|
88
|
+
children: h
|
|
89
|
+
}, n.value) : h;
|
|
90
|
+
})
|
|
91
|
+
});
|
|
126
92
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
Y as SegmentedControl
|
|
131
|
-
};
|
|
93
|
+
var d = n(u);
|
|
94
|
+
d.displayName = "SegmentedControl";
|
|
95
|
+
export { d as SegmentedControl };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/components/SegmentedControl/SegmentedControl.module.scss
|
|
2
|
+
var e = "crk-root-ito0X", t = "crk-sm-P03Ce", n = "crk-md-my5y5", r = "crk-lg-C6A9b", i = "crk-pill-yWMHd", a = "crk-rounded-KQgE9", o = "crk-square-gChT2", s = "crk-fullWidth-ahjYN", c = "crk-item-n8hr3", l = "crk-iconOnly-wyO0n", u = "crk-icon-RUgES", d = "crk-label-urUg5", f = "crk-count-qh4-d", p = "crk-filled-THBvo", m = "crk-itemSelected-c3IgH", h = "crk-outlined-xC8GL", g = "crk-disabled-BzP8D", _ = {
|
|
3
|
+
root: e,
|
|
4
|
+
sm: t,
|
|
5
|
+
md: n,
|
|
6
|
+
lg: r,
|
|
7
|
+
pill: i,
|
|
8
|
+
rounded: a,
|
|
9
|
+
square: o,
|
|
10
|
+
fullWidth: s,
|
|
11
|
+
item: c,
|
|
12
|
+
iconOnly: l,
|
|
13
|
+
icon: u,
|
|
14
|
+
label: d,
|
|
15
|
+
count: f,
|
|
16
|
+
filled: p,
|
|
17
|
+
itemSelected: m,
|
|
18
|
+
outlined: h,
|
|
19
|
+
disabled: g
|
|
20
|
+
};
|
|
21
|
+
export { f as count, _ as default, g as disabled, p as filled, s as fullWidth, u as icon, l as iconOnly, c as item, m as itemSelected, d as label, r as lg, n as md, h as outlined, i as pill, e as root, a as rounded, t as sm, o as square };
|