@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,124 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { VariantProps } from "#lib/utils";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
import * as ProgressCirclePrimitive from "#primitives/progress-circle";
|
|
4
|
+
declare const progressCircleVariants: import("@codefast/tailwind-variants").VariantFunctionType<{
|
|
5
|
+
size: {
|
|
6
|
+
sm: {
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
md: {
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
lg: {
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
xl: {
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
"2xl": {
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
11
21
|
};
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
thickness: {
|
|
23
|
+
regular: {};
|
|
24
|
+
thick: {};
|
|
25
|
+
thin: {};
|
|
14
26
|
};
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
variant: {
|
|
28
|
+
default: {
|
|
29
|
+
indicator: string;
|
|
30
|
+
track: string;
|
|
31
|
+
};
|
|
32
|
+
destructive: {
|
|
33
|
+
indicator: string;
|
|
34
|
+
track: string;
|
|
35
|
+
};
|
|
17
36
|
};
|
|
18
|
-
xl: {
|
|
19
|
-
label: string;
|
|
20
|
-
};
|
|
21
|
-
"2xl": {
|
|
22
|
-
label: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
thickness: {
|
|
26
|
-
regular: {};
|
|
27
|
-
thick: {};
|
|
28
|
-
thin: {};
|
|
29
|
-
};
|
|
30
|
-
variant: {
|
|
31
|
-
default: {
|
|
32
|
-
indicator: string;
|
|
33
|
-
track: string;
|
|
34
|
-
};
|
|
35
|
-
destructive: {
|
|
36
|
-
indicator: string;
|
|
37
|
-
track: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
37
|
}, {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
indicator: string;
|
|
39
|
+
label: string[];
|
|
40
|
+
root: string;
|
|
41
|
+
svg: string;
|
|
42
|
+
track: string;
|
|
46
43
|
}>;
|
|
47
|
-
interface ProgressCircleProps extends Omit<ComponentProps<typeof
|
|
48
|
-
/**
|
|
49
|
-
* Enables animation effect when value changes
|
|
50
|
-
*/
|
|
51
|
-
animate?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Duration of the animation in milliseconds
|
|
54
|
-
*/
|
|
55
|
-
animationDuration?: number;
|
|
56
|
-
/**
|
|
57
|
-
* CSS class to customize the entire component
|
|
58
|
-
*/
|
|
59
|
-
className?: string;
|
|
60
|
-
/**
|
|
61
|
-
* CSS classes to customize specific parts of the component
|
|
62
|
-
*/
|
|
63
|
-
classNames?: {
|
|
44
|
+
interface ProgressCircleProps extends Omit<ComponentProps<typeof ProgressCirclePrimitive.Provider>, "children" | "size">, VariantProps<typeof progressCircleVariants> {
|
|
64
45
|
/**
|
|
65
|
-
*
|
|
46
|
+
* Enables animation effect when value changes
|
|
66
47
|
*/
|
|
67
|
-
|
|
48
|
+
animate?: boolean;
|
|
68
49
|
/**
|
|
69
|
-
*
|
|
50
|
+
* Duration of the animation in milliseconds
|
|
70
51
|
*/
|
|
71
|
-
|
|
52
|
+
animationDuration?: number;
|
|
53
|
+
/**
|
|
54
|
+
* CSS class to customize the entire component
|
|
55
|
+
*/
|
|
56
|
+
className?: string;
|
|
57
|
+
/**
|
|
58
|
+
* CSS classes to customize specific parts of the component
|
|
59
|
+
*/
|
|
60
|
+
classNames?: {
|
|
61
|
+
/**
|
|
62
|
+
* Class for the progress indicator
|
|
63
|
+
*/
|
|
64
|
+
indicator?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Class for the label in the center of the circle
|
|
67
|
+
*/
|
|
68
|
+
label?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Class for the root element of the component
|
|
71
|
+
*/
|
|
72
|
+
root?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Class for the SVG element
|
|
75
|
+
*/
|
|
76
|
+
svg?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Class for the circle track
|
|
79
|
+
*/
|
|
80
|
+
track?: string;
|
|
81
|
+
};
|
|
72
82
|
/**
|
|
73
|
-
*
|
|
83
|
+
* Custom function to render content in the center of the circle
|
|
84
|
+
* @param value - Current value of the component
|
|
85
|
+
* @returns React element to display in the center of the circle
|
|
74
86
|
*/
|
|
75
|
-
|
|
87
|
+
customLabel?: ({ value }: {
|
|
88
|
+
value: number;
|
|
89
|
+
}) => JSX.Element;
|
|
76
90
|
/**
|
|
77
|
-
*
|
|
91
|
+
* Display the numeric value in the center of the circle
|
|
78
92
|
*/
|
|
79
|
-
|
|
93
|
+
showValue?: boolean;
|
|
80
94
|
/**
|
|
81
|
-
*
|
|
95
|
+
* Custom size in pixels
|
|
96
|
+
* When provided, this value overrides the size variant option
|
|
82
97
|
*/
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Custom function to render content in the center of the circle
|
|
87
|
-
* @param value - Current value of the component
|
|
88
|
-
* @returns React element to display in the center of the circle
|
|
89
|
-
*/
|
|
90
|
-
customLabel?: ({
|
|
91
|
-
value
|
|
92
|
-
}: {
|
|
93
|
-
value: number;
|
|
94
|
-
}) => JSX.Element;
|
|
95
|
-
/**
|
|
96
|
-
* Display the numeric value in the center of the circle
|
|
97
|
-
*/
|
|
98
|
-
showValue?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Custom size in pixels
|
|
101
|
-
* When provided, this value overrides the size variant option
|
|
102
|
-
*/
|
|
103
|
-
sizeInPixels?: number;
|
|
98
|
+
sizeInPixels?: number;
|
|
104
99
|
}
|
|
105
|
-
declare function ProgressCircle({
|
|
106
|
-
animate,
|
|
107
|
-
animationDuration,
|
|
108
|
-
className,
|
|
109
|
-
classNames,
|
|
110
|
-
customLabel,
|
|
111
|
-
showValue,
|
|
112
|
-
size,
|
|
113
|
-
sizeInPixels,
|
|
114
|
-
strokeWidth,
|
|
115
|
-
thickness,
|
|
116
|
-
value,
|
|
117
|
-
variant,
|
|
118
|
-
...props
|
|
119
|
-
}: ProgressCircleProps): JSX.Element;
|
|
100
|
+
declare function ProgressCircle({ animate, animationDuration, className, classNames, customLabel, showValue, size, sizeInPixels, strokeWidth, thickness, value, variant, ...props }: ProgressCircleProps): JSX.Element;
|
|
120
101
|
declare namespace ProgressCircle {
|
|
121
|
-
|
|
102
|
+
var displayName: string;
|
|
122
103
|
}
|
|
123
|
-
|
|
124
|
-
export { ProgressCircle
|
|
104
|
+
export { progressCircleVariants };
|
|
105
|
+
export { ProgressCircle };
|
|
106
|
+
export type { ProgressCircleProps };
|
|
107
|
+
//# sourceMappingURL=progress-circle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-circle.d.ts","sourceRoot":"","sources":["../../src/components/progress-circle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAiB,GAAG,EAAE,MAAM,OAAO,CAAC;AAMhE,OAAO,KAAK,uBAAuB,MAAM,6BAA6B,CAAC;AAMvE,QAAA,MAAM,sBAAsB;;QAWtB,EAAE;YAAI,KAAK;;QAEX,EAAE;YAAI,KAAK;;QAEX,EAAE;YAAI,KAAK;;QAEX,EAAE;YAAI,KAAK;;QAEX,KAAK;YAAI,KAAK;;;;QAEH,OAAO;QAAM,KAAK;QAAM,IAAI;;;QAEvC,OAAO;YAAI,SAAS;YAAkB,KAAK;;QAC3C,WAAW;YAAI,SAAS;YAAsB,KAAK;;;;;;;;;EAGvD,CAAC;AAMH,UAAU,mBACR,SACE,IAAI,CAAC,cAAc,CAAC,OAAO,uBAAuB,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,EAClF,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;IAE5D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,iBAAS,cAAc,CAAC,EACtB,OAAc,EACd,iBAAwB,EACxB,SAAS,EACT,UAAU,EACV,WAAW,EACX,SAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,SAAqB,EACrB,KAAS,EACT,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAyDnC;;;;AA2CD,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,116 +1,83 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { tv } from "@codefast/tailwind-variants";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { tv } from "#lib/utils";
|
|
6
4
|
import { useCallback, useMemo } from "react";
|
|
7
|
-
|
|
5
|
+
import { useAnimatedValue } from "#hooks/use-animated-value";
|
|
6
|
+
import * as ProgressCirclePrimitive from "#primitives/progress-circle";
|
|
7
|
+
/* -------------------------------------------------------------------------------------------------
|
|
8
|
+
* Variant: ProgressCircle
|
|
9
|
+
* ----------------------------------------------------------------------------------------------- */
|
|
8
10
|
const progressCircleVariants = tv({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
thick: {},
|
|
32
|
-
thin: {}
|
|
33
|
-
},
|
|
34
|
-
variant: {
|
|
35
|
-
default: {
|
|
36
|
-
indicator: "text-primary",
|
|
37
|
-
track: "text-primary/20"
|
|
38
|
-
},
|
|
39
|
-
destructive: {
|
|
40
|
-
indicator: "text-destructive",
|
|
41
|
-
track: "text-destructive/20"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
11
|
+
defaultVariants: { size: "md", thickness: "regular", variant: "default" },
|
|
12
|
+
slots: {
|
|
13
|
+
indicator: "origin-center",
|
|
14
|
+
label: ["absolute flex items-center justify-center", "inset-0", "text-xs font-medium"],
|
|
15
|
+
root: "relative inline-flex items-center justify-center",
|
|
16
|
+
svg: "size-full",
|
|
17
|
+
track: "origin-center",
|
|
18
|
+
},
|
|
19
|
+
variants: {
|
|
20
|
+
size: {
|
|
21
|
+
sm: { label: "text-[0.625rem]" },
|
|
22
|
+
md: { label: "text-xs" },
|
|
23
|
+
lg: { label: "text-sm" },
|
|
24
|
+
xl: { label: "text-base" },
|
|
25
|
+
"2xl": { label: "text-lg" },
|
|
26
|
+
},
|
|
27
|
+
thickness: { regular: {}, thick: {}, thin: {} },
|
|
28
|
+
variant: {
|
|
29
|
+
default: { indicator: "text-primary", track: "text-primary/20" },
|
|
30
|
+
destructive: { indicator: "text-destructive", track: "text-destructive/20" },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
45
33
|
});
|
|
46
|
-
function ProgressCircle({ animate = true, animationDuration =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
]);
|
|
63
|
-
const shouldShowLabel = showValue || Boolean(customLabel);
|
|
64
|
-
const renderLabel = useCallback(() => {
|
|
65
|
-
if (customLabel) return customLabel({ value: displayValue });
|
|
66
|
-
return `${displayValue.toString()}%`;
|
|
67
|
-
}, [customLabel, displayValue]);
|
|
68
|
-
return /* @__PURE__ */ jsx(ProgressCircleProvider, {
|
|
69
|
-
size: actualSize,
|
|
70
|
-
strokeWidth: actualThickness,
|
|
71
|
-
value,
|
|
72
|
-
...props,
|
|
73
|
-
children: /* @__PURE__ */ jsxs(ProgressCircle$1, {
|
|
74
|
-
className: slots.root({ className: [className, classNames?.root] }),
|
|
75
|
-
children: [/* @__PURE__ */ jsxs(ProgressCircleSVG, {
|
|
76
|
-
className: slots.svg({ className: classNames?.svg }),
|
|
77
|
-
children: [/* @__PURE__ */ jsx(ProgressCircleTrack, { className: slots.track({ className: classNames?.track }) }), /* @__PURE__ */ jsx(ProgressCircleIndicator, {
|
|
78
|
-
className: slots.indicator({ className: classNames?.indicator }),
|
|
79
|
-
style: {
|
|
80
|
-
transitionDuration: `${animationDuration.toString()}ms`,
|
|
81
|
-
transitionProperty: "stroke-dashoffset"
|
|
82
|
-
}
|
|
83
|
-
})]
|
|
84
|
-
}), shouldShowLabel ? /* @__PURE__ */ jsx(ProgressCircleValue, {
|
|
85
|
-
className: slots.label({ className: classNames?.label }),
|
|
86
|
-
children: renderLabel()
|
|
87
|
-
}) : null]
|
|
88
|
-
})
|
|
89
|
-
});
|
|
34
|
+
function ProgressCircle({ animate = true, animationDuration = 1000, className, classNames, customLabel, showValue = false, size, sizeInPixels, strokeWidth, thickness = "regular", value = 0, variant = "default", ...props }) {
|
|
35
|
+
const displayValue = useAnimatedValue(value, animationDuration, animate);
|
|
36
|
+
const actualSize = useMemo(() => sizeInPixels ?? getActualSize(size), [sizeInPixels, size]);
|
|
37
|
+
const actualThickness = useMemo(() => strokeWidth ?? getStrokeWidth(thickness, actualSize), [strokeWidth, thickness, actualSize]);
|
|
38
|
+
const slots = useMemo(() => progressCircleVariants({ size, thickness, variant }), [variant, size, thickness]);
|
|
39
|
+
const shouldShowLabel = showValue || Boolean(customLabel);
|
|
40
|
+
const renderLabel = useCallback(() => {
|
|
41
|
+
if (customLabel) {
|
|
42
|
+
return customLabel({ value: displayValue });
|
|
43
|
+
}
|
|
44
|
+
return `${displayValue.toString()}%`;
|
|
45
|
+
}, [customLabel, displayValue]);
|
|
46
|
+
return (_jsx(ProgressCirclePrimitive.Provider, { size: actualSize, strokeWidth: actualThickness, value: value, ...props, children: _jsxs(ProgressCirclePrimitive.Root, { className: slots.root({ className: [className, classNames?.root] }), children: [_jsxs(ProgressCirclePrimitive.SVG, { className: slots.svg({ className: classNames?.svg }), children: [_jsx(ProgressCirclePrimitive.Track, { className: slots.track({ className: classNames?.track }) }), _jsx(ProgressCirclePrimitive.Indicator, { className: slots.indicator({ className: classNames?.indicator }), style: {
|
|
47
|
+
transitionDuration: `${animationDuration.toString()}ms`,
|
|
48
|
+
transitionProperty: "stroke-dashoffset",
|
|
49
|
+
} })] }), shouldShowLabel ? (_jsx(ProgressCirclePrimitive.Value, { className: slots.label({ className: classNames?.label }), children: renderLabel() })) : null] }) }));
|
|
90
50
|
}
|
|
91
51
|
ProgressCircle.displayName = "ProgressCircle";
|
|
52
|
+
/* -----------------------------------------------------------------------------
|
|
53
|
+
* Helpers
|
|
54
|
+
* -------------------------------------------------------------------------- */
|
|
92
55
|
/**
|
|
93
|
-
* Maps size variants to actual pixel sizes
|
|
94
|
-
*/
|
|
56
|
+
* Maps size variants to actual pixel sizes
|
|
57
|
+
*/
|
|
95
58
|
const getActualSize = (size) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
59
|
+
const sizeMap = {
|
|
60
|
+
"2xl": 128,
|
|
61
|
+
lg: 64,
|
|
62
|
+
md: 48,
|
|
63
|
+
sm: 32,
|
|
64
|
+
xl: 96,
|
|
65
|
+
};
|
|
66
|
+
return size ? sizeMap[size] : 48;
|
|
103
67
|
};
|
|
104
68
|
/**
|
|
105
|
-
* Calculates stroke width based on thickness variant and circle size
|
|
106
|
-
*/
|
|
69
|
+
* Calculates stroke width based on thickness variant and circle size
|
|
70
|
+
*/
|
|
107
71
|
const getStrokeWidth = (thickness, size) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
72
|
+
const thicknessMap = {
|
|
73
|
+
regular: Math.max(3, size * 0.05),
|
|
74
|
+
thick: Math.max(4, size * 0.075),
|
|
75
|
+
thin: Math.max(2, size * 0.025),
|
|
76
|
+
};
|
|
77
|
+
return thickness ? thicknessMap[thickness] : Math.max(3, size * 0.05);
|
|
114
78
|
};
|
|
115
|
-
|
|
116
|
-
|
|
79
|
+
/* -----------------------------------------------------------------------------
|
|
80
|
+
* Exports
|
|
81
|
+
* -------------------------------------------------------------------------- */
|
|
82
|
+
export { progressCircleVariants };
|
|
83
|
+
export { ProgressCircle };
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { ComponentProps, JSX } from "react";
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
|
-
|
|
4
|
-
//#region src/components/progress.d.ts
|
|
5
3
|
type ProgressProps = ComponentProps<typeof ProgressPrimitive.Root>;
|
|
6
|
-
declare function Progress({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}: ProgressProps): JSX.Element;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { Progress, type ProgressProps };
|
|
4
|
+
declare function Progress({ className, value, ...props }: ProgressProps): JSX.Element;
|
|
5
|
+
export { Progress };
|
|
6
|
+
export type { ProgressProps };
|
|
7
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAM9D,KAAK,aAAa,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAEnE,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAsB5E;AAMD,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "#lib/utils";
|
|
4
4
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
5
|
-
//#region src/components/progress.tsx
|
|
6
5
|
function Progress({ className, value, ...props }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
...props,
|
|
11
|
-
children: /* @__PURE__ */ jsx(ProgressPrimitive.Indicator, {
|
|
12
|
-
className: "size-full flex-1 bg-primary transition-all",
|
|
13
|
-
"data-slot": "progress-indicator",
|
|
14
|
-
style: { transform: `translateX(-${(100 - (value ?? 0)).toString()}%)` }
|
|
15
|
-
})
|
|
16
|
-
});
|
|
6
|
+
return (_jsx(ProgressPrimitive.Root, { className: cn("relative", "h-2 w-full overflow-hidden", "rounded-full", "bg-primary/20", className), "data-slot": "progress", ...props, children: _jsx(ProgressPrimitive.Indicator, { className: cn("size-full flex-1", "bg-primary", "transition-all"), "data-slot": "progress-indicator", style: {
|
|
7
|
+
transform: `translateX(-${(100 - (value ?? 0)).toString()}%)`,
|
|
8
|
+
} }) }));
|
|
17
9
|
}
|
|
18
|
-
|
|
10
|
+
/* -----------------------------------------------------------------------------
|
|
11
|
+
* Exports
|
|
12
|
+
* -------------------------------------------------------------------------- */
|
|
19
13
|
export { Progress };
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { ComponentProps, JSX } from "react";
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
|
-
|
|
4
|
-
//#region src/components/radio-cards.d.ts
|
|
5
3
|
type RadioCardsProps = ComponentProps<typeof RadioGroupPrimitive.Root>;
|
|
6
4
|
declare function RadioCards(props: RadioCardsProps): JSX.Element;
|
|
7
5
|
type RadioCardsItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
|
|
8
|
-
declare function RadioCardsItem({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}: RadioCardsItemProps): JSX.Element;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { RadioCards, RadioCardsItem, type RadioCardsItemProps, type RadioCardsProps };
|
|
6
|
+
declare function RadioCardsItem({ children, className, ...props }: RadioCardsItemProps): JSX.Element;
|
|
7
|
+
export { RadioCards, RadioCardsItem };
|
|
8
|
+
export type { RadioCardsItemProps, RadioCardsProps };
|
|
9
|
+
//# sourceMappingURL=radio-cards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../../src/components/radio-cards.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAQnE,KAAK,eAAe,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAEvE,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAEvD;AAMD,KAAK,mBAAmB,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAE3E,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAwC3F;AAMD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;AACtC,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { cn } from "
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "#lib/utils";
|
|
5
4
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
6
|
-
|
|
5
|
+
import { Label } from "#components/label";
|
|
7
6
|
function RadioCards(props) {
|
|
8
|
-
|
|
9
|
-
"data-slot": "radio-cards",
|
|
10
|
-
...props
|
|
11
|
-
});
|
|
7
|
+
return _jsx(RadioGroupPrimitive.Root, { "data-slot": "radio-cards", ...props });
|
|
12
8
|
}
|
|
13
9
|
function RadioCardsItem({ children, className, ...props }) {
|
|
14
|
-
|
|
15
|
-
className: "flex items-start gap-3 rounded-lg border border-input p-3 transition hover:not-has-disabled:not-has-aria-checked:bg-secondary has-focus-visible:border-ring has-disabled:opacity-50 has-aria-checked:border-primary has-aria-checked:bg-primary/10",
|
|
16
|
-
"data-slot": "radio-card",
|
|
17
|
-
children: [/* @__PURE__ */ jsx(RadioGroupPrimitive.Item, {
|
|
18
|
-
className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-full border border-input text-primary-foreground shadow-xs outline-hidden transition focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:not-aria-checked:border-ring aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40", className),
|
|
19
|
-
"data-slot": "radio-card-item",
|
|
20
|
-
...props,
|
|
21
|
-
children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, {
|
|
22
|
-
className: "size-1 rounded-full bg-background",
|
|
23
|
-
"data-slot": "radio-card-indicator"
|
|
24
|
-
})
|
|
25
|
-
}), children]
|
|
26
|
-
});
|
|
10
|
+
return (_jsxs(Label, { className: cn("flex items-start gap-3", "p-3", "rounded-lg border border-input", "transition", "hover:not-has-disabled:not-has-aria-checked:bg-secondary", "has-focus-visible:border-ring", "has-disabled:opacity-50", "has-aria-checked:border-primary has-aria-checked:bg-primary/10"), "data-slot": "radio-card", children: [_jsx(RadioGroupPrimitive.Item, { className: cn("peer flex size-4 shrink-0 items-center justify-center", "rounded-full border border-input shadow-xs outline-hidden", "text-primary-foreground", "transition", "focus-visible:ring-3 focus-visible:ring-ring/50", "focus-visible:not-aria-checked:border-ring", "aria-checked:border-primary aria-checked:bg-primary", "focus-visible:aria-checked:ring-primary/20", "dark:bg-input/30", "dark:focus-visible:aria-checked:ring-primary/40", className), "data-slot": "radio-card-item", ...props, children: _jsx(RadioGroupPrimitive.Indicator, { className: cn("size-1", "rounded-full", "bg-background"), "data-slot": "radio-card-indicator" }) }), children] }));
|
|
27
11
|
}
|
|
28
|
-
|
|
12
|
+
/* -----------------------------------------------------------------------------
|
|
13
|
+
* Exports
|
|
14
|
+
* -------------------------------------------------------------------------- */
|
|
29
15
|
export { RadioCards, RadioCardsItem };
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { ComponentProps, JSX } from "react";
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
|
-
|
|
4
|
-
//#region src/components/radio-group.d.ts
|
|
5
3
|
type RadioGroupProps = ComponentProps<typeof RadioGroupPrimitive.Root>;
|
|
6
|
-
declare function RadioGroup({
|
|
7
|
-
className,
|
|
8
|
-
...props
|
|
9
|
-
}: RadioGroupProps): JSX.Element;
|
|
4
|
+
declare function RadioGroup({ className, ...props }: RadioGroupProps): JSX.Element;
|
|
10
5
|
type RadioGroupItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
|
|
11
|
-
declare function RadioGroupItem({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps };
|
|
6
|
+
declare function RadioGroupItem({ className, ...props }: RadioGroupItemProps): JSX.Element;
|
|
7
|
+
export { RadioGroup, RadioGroupItem };
|
|
8
|
+
export type { RadioGroupItemProps, RadioGroupProps };
|
|
9
|
+
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/components/radio-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAMnE,KAAK,eAAe,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAEvE,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAQzE;AAMD,KAAK,mBAAmB,GAAG,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;AAE3E,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CA6BjF;AAMD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;AACtC,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "#lib/utils";
|
|
4
4
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
5
|
-
//#region src/components/radio-group.tsx
|
|
6
5
|
function RadioGroup({ className, ...props }) {
|
|
7
|
-
|
|
8
|
-
className: cn("grid gap-2", className),
|
|
9
|
-
"data-slot": "radio-group",
|
|
10
|
-
...props
|
|
11
|
-
});
|
|
6
|
+
return (_jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), "data-slot": "radio-group", ...props }));
|
|
12
7
|
}
|
|
13
8
|
function RadioGroupItem({ className, ...props }) {
|
|
14
|
-
|
|
15
|
-
className: cn("peer inline-flex size-4 shrink-0 items-center justify-center rounded-full border border-input shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
|
|
16
|
-
"data-slot": "radio-group-item",
|
|
17
|
-
...props,
|
|
18
|
-
children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, {
|
|
19
|
-
className: "size-1 rounded-full bg-background",
|
|
20
|
-
"data-slot": "radio-group-indicator"
|
|
21
|
-
})
|
|
22
|
-
});
|
|
9
|
+
return (_jsx(RadioGroupPrimitive.Item, { className: cn("peer inline-flex size-4 shrink-0 items-center justify-center", "rounded-full border border-input shadow-xs outline-hidden", "transition", "hover:not-disabled:not-aria-checked:border-ring/60", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:opacity-50", "aria-checked:border-primary aria-checked:bg-primary", "focus-visible:aria-checked:ring-primary/20", "aria-invalid:border-destructive aria-invalid:ring-destructive/20", "hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60", "aria-checked:aria-invalid:bg-destructive", "dark:bg-input/30", "dark:focus-visible:aria-checked:ring-primary/40", "dark:aria-invalid:ring-destructive/40", className), "data-slot": "radio-group-item", ...props, children: _jsx(RadioGroupPrimitive.Indicator, { className: cn("size-1", "rounded-full", "bg-background"), "data-slot": "radio-group-indicator" }) }));
|
|
23
10
|
}
|
|
24
|
-
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Exports
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
25
14
|
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { ComponentProps, JSX } from "react";
|
|
2
|
-
|
|
3
|
-
//#region src/components/radio.d.ts
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
2
|
interface RadioProps extends Omit<ComponentProps<"input">, "type"> {
|
|
5
|
-
|
|
3
|
+
onValueChange?: (value: string) => void;
|
|
6
4
|
}
|
|
7
|
-
declare function Radio({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
...props
|
|
12
|
-
}: RadioProps): JSX.Element;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { Radio, type RadioProps };
|
|
5
|
+
declare function Radio({ className, onChange, onValueChange, ...props }: RadioProps): JSX.Element;
|
|
6
|
+
export { Radio };
|
|
7
|
+
export type { RadioProps };
|
|
8
|
+
//# sourceMappingURL=radio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/components/radio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AASjD,UAAU,UAAW,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAChE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CA+BxF;AAMD,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/components/radio.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "#lib/utils";
|
|
4
4
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
5
|
-
//#region src/components/radio.tsx
|
|
6
5
|
function Radio({ className, onChange, onValueChange, ...props }) {
|
|
7
|
-
|
|
8
|
-
className: cn("peer inline-flex size-4 shrink-0 appearance-none items-center justify-center rounded-full border border-input shadow-xs outline-hidden after:size-full after:rounded-full after:bg-background after:transition-[width,height] checked:border-primary checked:bg-primary checked:after:size-1 hover:not-disabled:not-checked:border-ring/60 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:not-checked:border-ring focus-visible:checked:ring-primary/20 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 checked:aria-invalid:bg-destructive hover:not-disabled:not-checked:aria-invalid:border-destructive/60 dark:not-checked:after:bg-input/30 dark:focus-visible:checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
|
|
9
|
-
"data-slot": "radio",
|
|
10
|
-
type: "radio",
|
|
11
|
-
onChange: composeEventHandlers(onChange, (event) => onValueChange?.(event.currentTarget.value)),
|
|
12
|
-
...props
|
|
13
|
-
});
|
|
6
|
+
return (_jsx("input", { className: cn("peer inline-flex size-4 shrink-0 items-center justify-center", "rounded-full border border-input shadow-xs outline-hidden", "appearance-none", "after:size-full after:rounded-full after:bg-background after:transition-[width,height]", "checked:border-primary checked:bg-primary", "checked:after:size-1", "hover:not-disabled:not-checked:border-ring/60", "focus-visible:ring-3 focus-visible:ring-ring/50", "focus-visible:not-checked:border-ring", "focus-visible:checked:ring-primary/20", "disabled:opacity-50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20", "checked:aria-invalid:bg-destructive", "hover:not-disabled:not-checked:aria-invalid:border-destructive/60", "dark:not-checked:after:bg-input/30", "dark:focus-visible:checked:ring-primary/40", "dark:aria-invalid:ring-destructive/40", className), "data-slot": "radio", type: "radio", onChange: composeEventHandlers(onChange, (event) => onValueChange?.(event.currentTarget.value)), ...props }));
|
|
14
7
|
}
|
|
15
|
-
|
|
8
|
+
/* -----------------------------------------------------------------------------
|
|
9
|
+
* Exports
|
|
10
|
+
* -------------------------------------------------------------------------- */
|
|
16
11
|
export { Radio };
|