@codefast/ui 0.3.11 → 0.3.12-canary.1
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/CHANGELOG.md +66 -0
- package/README.md +4 -0
- package/dist/components/accordion.d.ts +11 -29
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +11 -38
- package/dist/components/alert-dialog.d.ts +25 -60
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +17 -70
- package/dist/components/alert.d.ts +16 -27
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +33 -31
- package/dist/components/aspect-ratio.d.ts +5 -8
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +5 -7
- package/dist/components/avatar.d.ts +7 -17
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +8 -19
- package/dist/components/badge.d.ts +15 -21
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +53 -21
- package/dist/components/breadcrumb.d.ts +13 -35
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +14 -50
- package/dist/components/button-group.d.ts +15 -29
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button-group.js +37 -28
- package/dist/components/button.d.ts +26 -35
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +87 -52
- package/dist/components/calendar.d.ts +10 -24
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +88 -93
- package/dist/components/card.d.ts +11 -34
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +12 -40
- package/dist/components/carousel.d.ts +25 -55
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +83 -115
- package/dist/components/chart.d.ts +37 -72
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +162 -151
- package/dist/components/checkbox-cards.d.ts +9 -15
- package/dist/components/checkbox-cards.d.ts.map +1 -0
- package/dist/components/checkbox-cards.js +9 -23
- package/dist/components/checkbox-group.d.ts +9 -16
- package/dist/components/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox-group.js +8 -20
- package/dist/components/checkbox.d.ts +5 -9
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +7 -15
- package/dist/components/collapsible.d.ts +7 -14
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +7 -15
- package/dist/components/command.d.ts +24 -55
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +19 -70
- package/dist/components/context-menu.d.ts +23 -72
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +22 -90
- package/dist/components/dialog.d.ts +23 -53
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +21 -73
- package/dist/components/drawer.d.ts +29 -60
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +17 -59
- package/dist/components/dropdown-menu.d.ts +23 -73
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +22 -97
- package/dist/components/empty.d.ts +16 -37
- package/dist/components/empty.d.ts.map +1 -0
- package/dist/components/empty.js +33 -45
- package/dist/components/field.d.ts +26 -63
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +61 -90
- package/dist/components/form.d.ts +16 -37
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +51 -67
- package/dist/components/hover-card.d.ts +8 -21
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +9 -24
- package/dist/components/input-group.d.ts +29 -53
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +110 -67
- package/dist/components/input-number.d.ts +8 -28
- package/dist/components/input-number.d.ts.map +1 -0
- package/dist/components/input-number.js +15 -56
- package/dist/components/input-otp.d.ts +11 -24
- package/dist/components/input-otp.d.ts.map +1 -0
- package/dist/components/input-otp.js +14 -35
- package/dist/components/input-password.d.ts +6 -12
- package/dist/components/input-password.d.ts.map +1 -0
- package/dist/components/input-password.js +11 -31
- package/dist/components/input-search.d.ts +9 -18
- package/dist/components/input-search.d.ts.map +1 -0
- package/dist/components/input-search.js +17 -44
- package/dist/components/input.d.ts +5 -10
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +6 -10
- package/dist/components/item.d.ts +33 -69
- package/dist/components/item.d.ts.map +1 -0
- package/dist/components/item.js +69 -91
- package/dist/components/kbd.d.ts +6 -13
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +7 -14
- package/dist/components/label.d.ts +5 -9
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +6 -9
- package/dist/components/menubar.d.ts +24 -80
- package/dist/components/menubar.d.ts.map +1 -0
- package/dist/components/menubar.js +24 -100
- package/dist/components/native-select.d.ts +7 -16
- package/dist/components/native-select.d.ts.map +1 -0
- package/dist/components/native-select.js +8 -26
- package/dist/components/navigation-menu.d.ts +13 -36
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu.js +26 -62
- package/dist/components/pagination.d.ts +15 -35
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +14 -56
- package/dist/components/popover.d.ts +9 -24
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +10 -28
- package/dist/components/progress-circle.d.ts +89 -106
- package/dist/components/progress-circle.d.ts.map +1 -0
- package/dist/components/progress-circle.js +71 -104
- package/dist/components/progress.d.ts +5 -10
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +8 -14
- package/dist/components/radio-cards.d.ts +5 -10
- package/dist/components/radio-cards.d.ts.map +1 -0
- package/dist/components/radio-cards.js +8 -22
- package/dist/components/radio-group.d.ts +6 -13
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +7 -18
- package/dist/components/radio.d.ts +6 -12
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/radio.js +6 -11
- package/dist/components/resizable.d.ts +8 -18
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +8 -22
- package/dist/components/scroll-area.d.ts +21 -33
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +65 -85
- package/dist/components/select.d.ts +17 -50
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +27 -79
- package/dist/components/separator.d.ts +20 -29
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +28 -37
- package/dist/components/sheet.d.ts +30 -62
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +68 -81
- package/dist/components/sidebar.d.ts +67 -160
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +184 -302
- package/dist/components/skeleton.d.ts +5 -9
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +6 -9
- package/dist/components/slider.d.ts +5 -13
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +13 -35
- package/dist/components/sonner.d.ts +8 -10
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +14 -16
- package/dist/components/spinner.d.ts +6 -12
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +21 -34
- package/dist/components/switch.d.ts +5 -9
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +6 -13
- package/dist/components/table.d.ts +12 -37
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +13 -48
- package/dist/components/tabs.d.ts +8 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +9 -24
- package/dist/components/textarea.d.ts +5 -9
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +6 -9
- package/dist/components/toggle-group.d.ts +10 -24
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +21 -39
- package/dist/components/toggle.d.ts +18 -25
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +42 -30
- package/dist/components/tooltip.d.ts +9 -24
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +10 -29
- package/dist/hooks/use-animated-value.d.ts +2 -4
- package/dist/hooks/use-animated-value.d.ts.map +1 -0
- package/dist/hooks/use-animated-value.js +67 -58
- package/dist/hooks/use-copy-to-clipboard.d.ts +6 -11
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +42 -39
- package/dist/hooks/use-is-mobile.d.ts +2 -4
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +20 -23
- package/dist/hooks/use-media-query.d.ts +2 -4
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +49 -46
- package/dist/hooks/use-mutation-observer.d.ts +3 -6
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
- package/dist/hooks/use-mutation-observer.js +33 -34
- package/dist/hooks/use-pagination.d.ts +15 -22
- package/dist/hooks/use-pagination.d.ts.map +1 -0
- package/dist/hooks/use-pagination.js +99 -99
- package/dist/index.d.ts +131 -69
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -69
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +10 -0
- package/dist/primitives/checkbox-group.d.ts +84 -105
- package/dist/primitives/checkbox-group.d.ts.map +1 -0
- package/dist/primitives/checkbox-group.js +91 -105
- package/dist/primitives/input-number.d.ts +41 -51
- package/dist/primitives/input-number.d.ts.map +1 -0
- package/dist/primitives/input-number.js +417 -473
- package/dist/primitives/input.d.ts +43 -48
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +67 -66
- package/dist/primitives/progress-circle.d.ts +49 -79
- package/dist/primitives/progress-circle.d.ts.map +1 -0
- package/dist/primitives/progress-circle.js +134 -149
- package/package.json +33 -16
- package/{dist → src}/css/preset.css +86 -9
- /package/{dist → src}/css/amber.css +0 -0
- /package/{dist → src}/css/blue.css +0 -0
- /package/{dist → src}/css/cyan.css +0 -0
- /package/{dist → src}/css/emerald.css +0 -0
- /package/{dist → src}/css/fuchsia.css +0 -0
- /package/{dist → src}/css/gray.css +0 -0
- /package/{dist → src}/css/green.css +0 -0
- /package/{dist → src}/css/indigo.css +0 -0
- /package/{dist → src}/css/lime.css +0 -0
- /package/{dist → src}/css/neutral.css +0 -0
- /package/{dist → src}/css/orange.css +0 -0
- /package/{dist → src}/css/pink.css +0 -0
- /package/{dist → src}/css/purple.css +0 -0
- /package/{dist → src}/css/red.css +0 -0
- /package/{dist → src}/css/rose.css +0 -0
- /package/{dist → src}/css/sky.css +0 -0
- /package/{dist → src}/css/slate.css +0 -0
- /package/{dist → src}/css/stone.css +0 -0
- /package/{dist → src}/css/style.css +0 -0
- /package/{dist → src}/css/teal.css +0 -0
- /package/{dist → src}/css/violet.css +0 -0
- /package/{dist → src}/css/yellow.css +0 -0
- /package/{dist → src}/css/zinc.css +0 -0
|
@@ -1,178 +1,163 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useId, useMemo } from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
3
|
import { createContextScope } from "@radix-ui/react-context";
|
|
5
|
-
|
|
4
|
+
import { useId, useMemo } from "react";
|
|
5
|
+
/* -----------------------------------------------------------------------------
|
|
6
|
+
* Context: ProgressCircleProvider
|
|
7
|
+
* --------------------------------------------------------------------------- */
|
|
6
8
|
const PROGRESS_CIRCLE_PROVIDER_NAME = "ProgressCircleProvider";
|
|
7
9
|
const [createProgressCircleContext, createProgressCircleScope] = createContextScope(PROGRESS_CIRCLE_PROVIDER_NAME);
|
|
8
10
|
const [ProgressCircleContextProvider, useProgressCircleContext] = createProgressCircleContext(PROGRESS_CIRCLE_PROVIDER_NAME);
|
|
9
11
|
/**
|
|
10
|
-
* Provides context for the ProgressCircle component
|
|
11
|
-
*
|
|
12
|
-
* Manages calculations for rendering the circular progress indicator,
|
|
13
|
-
* including value clamping, sizing, thresholds, and indeterminate state.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <ProgressCircleProvider
|
|
18
|
-
* value={75}
|
|
19
|
-
* min={0}
|
|
20
|
-
* max={100}
|
|
21
|
-
* size={64}
|
|
22
|
-
* thresholds={[
|
|
23
|
-
* { value: 30, color: 'red', background: 'pink' },
|
|
24
|
-
* { value: 70, color: 'yellow', background: 'lightyellow' },
|
|
25
|
-
* { value: 100, color: 'green', background: 'lightgreen' }
|
|
26
|
-
* ]}
|
|
27
|
-
* >
|
|
28
|
-
* <ProgressCircleSVG>
|
|
29
|
-
* <ProgressCircleIndicator />
|
|
30
|
-
* <ProgressCircleTrack />
|
|
31
|
-
* </ProgressCircleSVG>
|
|
32
|
-
* <ProgressCircleValue />
|
|
33
|
-
* </ProgressCircleProvider>
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max = 100, min = 0, size = 48, startAngle = -90, strokeWidth = 4, thresholds, value }) {
|
|
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
|
-
|
|
12
|
+
* Provides context for the ProgressCircle component
|
|
13
|
+
*
|
|
14
|
+
* Manages calculations for rendering the circular progress indicator,
|
|
15
|
+
* including value clamping, sizing, thresholds, and indeterminate state.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ProgressCircleProvider
|
|
20
|
+
* value={75}
|
|
21
|
+
* min={0}
|
|
22
|
+
* max={100}
|
|
23
|
+
* size={64}
|
|
24
|
+
* thresholds={[
|
|
25
|
+
* { value: 30, color: 'red', background: 'pink' },
|
|
26
|
+
* { value: 70, color: 'yellow', background: 'lightyellow' },
|
|
27
|
+
* { value: 100, color: 'green', background: 'lightgreen' }
|
|
28
|
+
* ]}
|
|
29
|
+
* >
|
|
30
|
+
* <ProgressCircleSVG>
|
|
31
|
+
* <ProgressCircleIndicator />
|
|
32
|
+
* <ProgressCircleTrack />
|
|
33
|
+
* </ProgressCircleSVG>
|
|
34
|
+
* <ProgressCircleValue />
|
|
35
|
+
* </ProgressCircleProvider>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function ProgressCircleProvider({ __scopeProgressCircle, children, formatValue, id: propertyId, max = 100, min = 0, size = 48, startAngle = -90, strokeWidth = 4, thresholds, value, }) {
|
|
39
|
+
const uniqueId = useId();
|
|
40
|
+
const id = propertyId ?? uniqueId;
|
|
41
|
+
// Ensure size and stroke width are non-negative
|
|
42
|
+
const validSize = Math.max(0, size);
|
|
43
|
+
const validStrokeWidth = Math.max(0, strokeWidth);
|
|
44
|
+
const validStartAngle = startAngle % 360;
|
|
45
|
+
// Validate min and max, swap if min > max
|
|
46
|
+
let validMin = min;
|
|
47
|
+
let validMax = max;
|
|
48
|
+
if (validMin > validMax) {
|
|
49
|
+
[validMin, validMax] = [validMax, validMin];
|
|
50
|
+
}
|
|
51
|
+
// Handle indeterminate state
|
|
52
|
+
const isIndeterminate = value === null || value === undefined;
|
|
53
|
+
const clampedValue = isIndeterminate ? undefined : clamp(validMin, validMax, value);
|
|
54
|
+
const range = validMax - validMin;
|
|
55
|
+
const percentage = clampedValue !== undefined && range > 0 ? ((clampedValue - validMin) / range) * 100 : 0;
|
|
56
|
+
const valueText = clampedValue !== undefined && formatValue
|
|
57
|
+
? formatValue(clampedValue)
|
|
58
|
+
: `${Math.round(percentage).toString()}%`;
|
|
59
|
+
// Sort thresholds by value
|
|
60
|
+
const sortedThresholds = useMemo(() => thresholds && thresholds.length > 0
|
|
61
|
+
? [...thresholds].toSorted((a, b) => a.value - b.value)
|
|
62
|
+
: [], [thresholds]);
|
|
63
|
+
// Determine an active threshold based on a clamped value
|
|
64
|
+
const threshold = useMemo(() => {
|
|
65
|
+
if (clampedValue === undefined) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
for (const sortedThreshold of sortedThresholds) {
|
|
69
|
+
if (clampedValue <= sortedThreshold.value) {
|
|
70
|
+
return sortedThreshold;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return sortedThresholds.at(-1);
|
|
74
|
+
}, [sortedThresholds, clampedValue]);
|
|
75
|
+
// Calculate circle properties
|
|
76
|
+
const center = validSize / 2;
|
|
77
|
+
const radius = Math.max(0, center - validStrokeWidth / 2);
|
|
78
|
+
const circumference = 2 * Math.PI * radius;
|
|
79
|
+
const strokeDashoffset = circumference - (percentage / 100) * circumference;
|
|
80
|
+
const rotationTransform = `rotate(${validStartAngle.toString()}, 0, 0)`;
|
|
81
|
+
return (_jsx(ProgressCircleContextProvider, { center: center, circumference: circumference, clampedValue: clampedValue, id: id, max: validMax, min: validMin, radius: radius, rotationTransform: rotationTransform, scope: __scopeProgressCircle, size: validSize, strokeDashoffset: strokeDashoffset, strokeWidth: validStrokeWidth, threshold: threshold, value: value ?? 0, valueText: valueText, children: children }));
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
|
-
* Root component for the progress circle
|
|
81
|
-
*
|
|
82
|
-
* Serves as a wrapper for other progress circle components.
|
|
83
|
-
*/
|
|
84
|
+
* Root component for the progress circle
|
|
85
|
+
*
|
|
86
|
+
* Serves as a wrapper for other progress circle components.
|
|
87
|
+
*/
|
|
84
88
|
function ProgressCircle({ __scopeProgressCircle, ...props }) {
|
|
85
|
-
|
|
89
|
+
return _jsx("div", { ...props });
|
|
86
90
|
}
|
|
91
|
+
/* -----------------------------------------------------------------------------
|
|
92
|
+
* Component: ProgressCircleSVG
|
|
93
|
+
* --------------------------------------------------------------------------- */
|
|
87
94
|
const PROGRESS_CIRCLE_SVG_NAME = "ProgressCircleSVG";
|
|
88
95
|
/**
|
|
89
|
-
* SVG container for the progress circle
|
|
90
|
-
*
|
|
91
|
-
* Renders the SVG with accessibility attributes and supports indeterminate state.
|
|
92
|
-
*/
|
|
96
|
+
* SVG container for the progress circle
|
|
97
|
+
*
|
|
98
|
+
* Renders the SVG with accessibility attributes and supports indeterminate state.
|
|
99
|
+
*/
|
|
93
100
|
function ProgressCircleSVG({ __scopeProgressCircle, ...props }) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"aria-label": "Progress",
|
|
97
|
-
"aria-valuemax": max,
|
|
98
|
-
"aria-valuemin": min,
|
|
99
|
-
"aria-valuenow": clampedValue,
|
|
100
|
-
"aria-valuetext": clampedValue === void 0 ? void 0 : valueText,
|
|
101
|
-
height: size,
|
|
102
|
-
id,
|
|
103
|
-
role: "progressbar",
|
|
104
|
-
viewBox: `0 0 ${size.toString()} ${size.toString()}`,
|
|
105
|
-
width: size,
|
|
106
|
-
...props
|
|
107
|
-
});
|
|
101
|
+
const { clampedValue, id, max, min, size, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_SVG_NAME, __scopeProgressCircle);
|
|
102
|
+
return (_jsx("svg", { "aria-label": "Progress", "aria-valuemax": max, "aria-valuemin": min, "aria-valuenow": clampedValue, "aria-valuetext": clampedValue === undefined ? undefined : valueText, height: size, id: id, role: "progressbar", viewBox: `0 0 ${size.toString()} ${size.toString()}`, width: size, ...props }));
|
|
108
103
|
}
|
|
104
|
+
/* -----------------------------------------------------------------------------
|
|
105
|
+
* Component: ProgressCircleTrack
|
|
106
|
+
* --------------------------------------------------------------------------- */
|
|
109
107
|
const PROGRESS_CIRCLE_TRACK_NAME = "ProgressCircleTrack";
|
|
110
108
|
/**
|
|
111
|
-
* Background circle for the progress indicator
|
|
112
|
-
*
|
|
113
|
-
* Renders the static track of the progress circle.
|
|
114
|
-
*/
|
|
109
|
+
* Background circle for the progress indicator
|
|
110
|
+
*
|
|
111
|
+
* Renders the static track of the progress circle.
|
|
112
|
+
*/
|
|
115
113
|
function ProgressCircleTrack({ __scopeProgressCircle, ...props }) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
cx: center,
|
|
119
|
-
cy: center,
|
|
120
|
-
fill: "transparent",
|
|
121
|
-
r: radius,
|
|
122
|
-
stroke: threshold?.background ?? "currentColor",
|
|
123
|
-
strokeWidth,
|
|
124
|
-
...props
|
|
125
|
-
});
|
|
114
|
+
const { center, radius, strokeWidth, threshold } = useProgressCircleContext(PROGRESS_CIRCLE_TRACK_NAME, __scopeProgressCircle);
|
|
115
|
+
return (_jsx("circle", { cx: center, cy: center, fill: "transparent", r: radius, stroke: threshold?.background ?? "currentColor", strokeWidth: strokeWidth, ...props }));
|
|
126
116
|
}
|
|
117
|
+
/* -----------------------------------------------------------------------------
|
|
118
|
+
* Component: ProgressCircleIndicator
|
|
119
|
+
* --------------------------------------------------------------------------- */
|
|
127
120
|
const PROGRESS_CIRCLE_INDICATOR_NAME = "ProgressCircleIndicator";
|
|
128
121
|
/**
|
|
129
|
-
* Foreground circle showing progress
|
|
130
|
-
*
|
|
131
|
-
* Renders the dynamic progress indicator with stroke dash properties.
|
|
132
|
-
*/
|
|
122
|
+
* Foreground circle showing progress
|
|
123
|
+
*
|
|
124
|
+
* Renders the dynamic progress indicator with stroke dash properties.
|
|
125
|
+
*/
|
|
133
126
|
function ProgressCircleIndicator({ __scopeProgressCircle, ...props }) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
cx: center,
|
|
137
|
-
cy: center,
|
|
138
|
-
fill: "transparent",
|
|
139
|
-
r: radius,
|
|
140
|
-
stroke: threshold?.color ?? "currentColor",
|
|
141
|
-
strokeDasharray: circumference,
|
|
142
|
-
strokeDashoffset,
|
|
143
|
-
strokeLinecap: "round",
|
|
144
|
-
strokeWidth,
|
|
145
|
-
transform: rotationTransform,
|
|
146
|
-
...props
|
|
147
|
-
});
|
|
127
|
+
const { center, circumference, radius, rotationTransform, strokeDashoffset, strokeWidth, threshold, } = useProgressCircleContext(PROGRESS_CIRCLE_INDICATOR_NAME, __scopeProgressCircle);
|
|
128
|
+
return (_jsx("circle", { cx: center, cy: center, fill: "transparent", r: radius, stroke: threshold?.color ?? "currentColor", strokeDasharray: circumference, strokeDashoffset: strokeDashoffset, strokeLinecap: "round", strokeWidth: strokeWidth, transform: rotationTransform, ...props }));
|
|
148
129
|
}
|
|
130
|
+
/* -----------------------------------------------------------------------------
|
|
131
|
+
* Component: ProgressCircleValue
|
|
132
|
+
* --------------------------------------------------------------------------- */
|
|
149
133
|
const PROGRESS_CIRCLE_VALUE_NAME = "ProgressCircleValue";
|
|
150
134
|
/**
|
|
151
|
-
* Displays the current progress value
|
|
152
|
-
*
|
|
153
|
-
* Supports custom content or default value text rendering.
|
|
154
|
-
*/
|
|
135
|
+
* Displays the current progress value
|
|
136
|
+
*
|
|
137
|
+
* Supports custom content or default value text rendering.
|
|
138
|
+
*/
|
|
155
139
|
function ProgressCircleValue({ __scopeProgressCircle, children, ...props }) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return /* @__PURE__ */ jsx("div", {
|
|
162
|
-
...props,
|
|
163
|
-
children: children ?? valueText
|
|
164
|
-
});
|
|
140
|
+
const { clampedValue, valueText } = useProgressCircleContext(PROGRESS_CIRCLE_VALUE_NAME, __scopeProgressCircle);
|
|
141
|
+
if (typeof children === "function") {
|
|
142
|
+
return children({ value: clampedValue, valueText });
|
|
143
|
+
}
|
|
144
|
+
return _jsx("div", { ...props, children: children ?? valueText });
|
|
165
145
|
}
|
|
146
|
+
/* -----------------------------------------------------------------------------
|
|
147
|
+
* Helpers
|
|
148
|
+
* -------------------------------------------------------------------------- */
|
|
166
149
|
/**
|
|
167
|
-
* Clamps a value within a specified min/max range
|
|
168
|
-
*
|
|
169
|
-
* @param min - Minimum value
|
|
170
|
-
* @param max - Maximum value
|
|
171
|
-
* @param value - Value to clamp
|
|
172
|
-
* @returns Clamped value
|
|
173
|
-
*/
|
|
150
|
+
* Clamps a value within a specified min/max range
|
|
151
|
+
*
|
|
152
|
+
* @param min - Minimum value
|
|
153
|
+
* @param max - Maximum value
|
|
154
|
+
* @param value - Value to clamp
|
|
155
|
+
* @returns Clamped value
|
|
156
|
+
*/
|
|
174
157
|
function clamp(min, max, value) {
|
|
175
|
-
|
|
158
|
+
return Math.min(max, Math.max(min, value));
|
|
176
159
|
}
|
|
177
|
-
|
|
178
|
-
|
|
160
|
+
/* -----------------------------------------------------------------------------
|
|
161
|
+
* Exports
|
|
162
|
+
* -------------------------------------------------------------------------- */
|
|
163
|
+
export { createProgressCircleScope, ProgressCircleIndicator as Indicator, ProgressCircle, ProgressCircleIndicator, ProgressCircleProvider, ProgressCircleSVG, ProgressCircleTrack, ProgressCircleValue, ProgressCircleProvider as Provider, ProgressCircle as Root, ProgressCircleSVG as SVG, ProgressCircleTrack as Track, ProgressCircleValue as Value, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12-canary.1",
|
|
4
4
|
"description": "Core UI components library built with React and Tailwind CSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -26,16 +26,29 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
|
+
"src/css",
|
|
29
30
|
"CHANGELOG.md",
|
|
30
31
|
"README.md",
|
|
31
32
|
"LICENSE"
|
|
32
33
|
],
|
|
33
34
|
"type": "module",
|
|
34
35
|
"sideEffects": [
|
|
35
|
-
"./
|
|
36
|
+
"./src/css/**/*.css"
|
|
36
37
|
],
|
|
37
38
|
"main": "./dist/index.js",
|
|
38
39
|
"types": "./dist/index.d.ts",
|
|
40
|
+
"imports": {
|
|
41
|
+
"#*": [
|
|
42
|
+
"./dist/*",
|
|
43
|
+
"./dist/*.js",
|
|
44
|
+
"./dist/*/index.js",
|
|
45
|
+
"./src/*",
|
|
46
|
+
"./src/*.ts",
|
|
47
|
+
"./src/*.tsx",
|
|
48
|
+
"./src/*/index.ts",
|
|
49
|
+
"./src/*/index.tsx"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
39
52
|
"exports": {
|
|
40
53
|
".": {
|
|
41
54
|
"types": "./dist/index.d.ts",
|
|
@@ -329,7 +342,11 @@
|
|
|
329
342
|
"types": "./dist/primitives/progress-circle.d.ts",
|
|
330
343
|
"import": "./dist/primitives/progress-circle.js"
|
|
331
344
|
},
|
|
332
|
-
"./
|
|
345
|
+
"./lib/utils": {
|
|
346
|
+
"types": "./dist/lib/utils.d.ts",
|
|
347
|
+
"import": "./dist/lib/utils.js"
|
|
348
|
+
},
|
|
349
|
+
"./css/*": "./src/css/*",
|
|
333
350
|
"./package.json": "./package.json"
|
|
334
351
|
},
|
|
335
352
|
"publishConfig": {
|
|
@@ -373,19 +390,19 @@
|
|
|
373
390
|
"date-fns": "^4.1.0",
|
|
374
391
|
"embla-carousel-react": "^8.6.0",
|
|
375
392
|
"input-otp": "^1.4.2",
|
|
376
|
-
"lucide-react": "^1.
|
|
393
|
+
"lucide-react": "^1.8.0",
|
|
377
394
|
"next-themes": "^0.4.6",
|
|
378
395
|
"react-day-picker": "^9.14.0",
|
|
379
|
-
"react-hook-form": "^7.72.
|
|
380
|
-
"react-resizable-panels": "^4.
|
|
396
|
+
"react-hook-form": "^7.72.1",
|
|
397
|
+
"react-resizable-panels": "^4.10.0",
|
|
381
398
|
"recharts": "^3.8.1",
|
|
382
399
|
"sonner": "^2.0.7",
|
|
383
400
|
"tw-animate-css": "^1.4.0",
|
|
384
401
|
"vaul": "^1.1.2",
|
|
385
|
-
"@codefast/tailwind-variants": "0.3.
|
|
402
|
+
"@codefast/tailwind-variants": "0.3.12-canary.1"
|
|
386
403
|
},
|
|
387
404
|
"devDependencies": {
|
|
388
|
-
"@swc/core": "^1.15.
|
|
405
|
+
"@swc/core": "^1.15.24",
|
|
389
406
|
"@swc/jest": "^0.2.39",
|
|
390
407
|
"@tailwindcss/postcss": "^4.2.2",
|
|
391
408
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -394,16 +411,16 @@
|
|
|
394
411
|
"@testing-library/user-event": "^14.6.1",
|
|
395
412
|
"@types/jest": "^30.0.0",
|
|
396
413
|
"@types/jest-axe": "^3.5.9",
|
|
397
|
-
"@types/node": "^25.
|
|
414
|
+
"@types/node": "^25.6.0",
|
|
415
|
+
"@typescript/native-preview": "7.0.0-dev.20260411.1",
|
|
398
416
|
"jest": "^30.3.0",
|
|
399
417
|
"jest-axe": "^10.0.0",
|
|
400
418
|
"jest-environment-jsdom": "^30.3.0",
|
|
401
|
-
"postcss": "^8.5.
|
|
419
|
+
"postcss": "^8.5.9",
|
|
402
420
|
"tailwindcss": "^4.2.2",
|
|
403
421
|
"ts-node": "^10.9.2",
|
|
404
|
-
"tsdown": "^0.21.7",
|
|
405
422
|
"typescript": "^6.0.2",
|
|
406
|
-
"@codefast/typescript-config": "0.3.
|
|
423
|
+
"@codefast/typescript-config": "0.3.12-canary.1"
|
|
407
424
|
},
|
|
408
425
|
"peerDependencies": {
|
|
409
426
|
"@types/react": "^19.0",
|
|
@@ -420,13 +437,13 @@
|
|
|
420
437
|
}
|
|
421
438
|
},
|
|
422
439
|
"scripts": {
|
|
423
|
-
"build": "
|
|
440
|
+
"build": "rm -rf dist && tsgo -p tsconfig.build.json",
|
|
441
|
+
"check-types": "tsgo --noEmit",
|
|
424
442
|
"clean": "rm -rf dist",
|
|
425
|
-
"dev": "
|
|
443
|
+
"dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
426
444
|
"test": "jest",
|
|
427
445
|
"test:coverage": "jest --coverage",
|
|
428
446
|
"test:coverage:ci": "jest --coverage --ci",
|
|
429
|
-
"test:watch": "jest --watch"
|
|
430
|
-
"typecheck": "tsc --noEmit"
|
|
447
|
+
"test:watch": "jest --watch"
|
|
431
448
|
}
|
|
432
449
|
}
|
|
@@ -1,9 +1,86 @@
|
|
|
1
1
|
@import "tw-animate-css";
|
|
2
2
|
|
|
3
|
-
@source "
|
|
3
|
+
@source "../../dist/**/*.js";
|
|
4
4
|
|
|
5
5
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
6
6
|
|
|
7
|
+
@custom-variant data-horizontal (&:where([data-orientation="horizontal"]));
|
|
8
|
+
|
|
9
|
+
@custom-variant data-vertical (&:where([data-orientation="vertical"]));
|
|
10
|
+
|
|
11
|
+
@custom-variant data-side-top (&:where([data-side="top"]));
|
|
12
|
+
|
|
13
|
+
@custom-variant data-side-right (&:where([data-side="right"]));
|
|
14
|
+
|
|
15
|
+
@custom-variant data-side-bottom (&:where([data-side="bottom"]));
|
|
16
|
+
|
|
17
|
+
@custom-variant data-side-left (&:where([data-side="left"]));
|
|
18
|
+
|
|
19
|
+
@custom-variant data-open {
|
|
20
|
+
&:where([data-state="open"]),
|
|
21
|
+
&:where([data-open]:not([data-open="false"])) {
|
|
22
|
+
@slot;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@custom-variant data-closed {
|
|
27
|
+
&:where([data-state="closed"]),
|
|
28
|
+
&:where([data-closed]:not([data-closed="false"])) {
|
|
29
|
+
@slot;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@custom-variant data-checked {
|
|
34
|
+
&:where([data-state="checked"]),
|
|
35
|
+
&:where([data-checked]:not([data-checked="false"])) {
|
|
36
|
+
@slot;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@custom-variant data-unchecked {
|
|
41
|
+
&:where([data-state="unchecked"]),
|
|
42
|
+
&:where([data-unchecked]:not([data-unchecked="false"])) {
|
|
43
|
+
@slot;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@custom-variant data-selected {
|
|
48
|
+
&:where([data-state="selected"]),
|
|
49
|
+
&:where([data-selected="true"]) {
|
|
50
|
+
@slot;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@custom-variant data-active {
|
|
55
|
+
&:where([data-state="active"]),
|
|
56
|
+
&:where([data-active]:not([data-active="false"])) {
|
|
57
|
+
@slot;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@custom-variant data-disabled {
|
|
62
|
+
&:where([data-disabled="true"]),
|
|
63
|
+
&:where([data-disabled]:not([data-disabled="false"])) {
|
|
64
|
+
@slot;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@custom-variant data-focused {
|
|
69
|
+
&:where([data-focused="true"]),
|
|
70
|
+
&:where([data-focused]:not([data-focused="false"])) {
|
|
71
|
+
@slot;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@utility no-scrollbar {
|
|
76
|
+
-ms-overflow-style: none;
|
|
77
|
+
scrollbar-width: none;
|
|
78
|
+
|
|
79
|
+
&::-webkit-scrollbar {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
7
84
|
:root {
|
|
8
85
|
--radius: 0.375rem;
|
|
9
86
|
}
|
|
@@ -52,14 +129,14 @@
|
|
|
52
129
|
--color-chart-4: var(--chart-4);
|
|
53
130
|
--color-chart-5: var(--chart-5);
|
|
54
131
|
|
|
55
|
-
--radius-xs:
|
|
56
|
-
--radius-sm:
|
|
132
|
+
--radius-xs: calc(var(--radius) * 2 / 6);
|
|
133
|
+
--radius-sm: calc(var(--radius) * 4 / 6);
|
|
57
134
|
--radius-md: var(--radius);
|
|
58
|
-
--radius-lg: calc(var(--radius)
|
|
59
|
-
--radius-xl: calc(var(--radius)
|
|
60
|
-
--radius-2xl: calc(var(--radius)
|
|
61
|
-
--radius-3xl: calc(var(--radius)
|
|
62
|
-
--radius-4xl: calc(var(--radius)
|
|
135
|
+
--radius-lg: calc(var(--radius) * 8 / 6);
|
|
136
|
+
--radius-xl: calc(var(--radius) * 12 / 6);
|
|
137
|
+
--radius-2xl: calc(var(--radius) * 16 / 6);
|
|
138
|
+
--radius-3xl: calc(var(--radius) * 24 / 6);
|
|
139
|
+
--radius-4xl: calc(var(--radius) * 32 / 6);
|
|
63
140
|
}
|
|
64
141
|
|
|
65
142
|
@theme {
|
|
@@ -73,7 +150,7 @@
|
|
|
73
150
|
::backdrop,
|
|
74
151
|
::file-selector-button {
|
|
75
152
|
border-color: var(--color-border);
|
|
76
|
-
outline-color:
|
|
153
|
+
outline-color: --alpha(var(--color-ring) / 20%);
|
|
77
154
|
}
|
|
78
155
|
|
|
79
156
|
::-webkit-scrollbar {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|