@codefast/ui 0.3.11-canary.1 → 0.3.11
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 +36 -0
- package/README.md +34 -14
- package/dist/components/accordion.d.ts +29 -10
- package/dist/components/accordion.js +38 -37
- package/dist/components/alert-dialog.d.ts +60 -24
- package/dist/components/alert-dialog.js +69 -72
- package/dist/components/alert.d.ts +27 -15
- package/dist/components/alert.js +29 -31
- package/dist/components/aspect-ratio.d.ts +8 -4
- package/dist/components/aspect-ratio.js +7 -5
- package/dist/components/avatar.d.ts +17 -6
- package/dist/components/avatar.js +19 -17
- package/dist/components/badge.d.ts +21 -14
- package/dist/components/badge.js +19 -22
- package/dist/components/breadcrumb.d.ts +35 -12
- package/dist/components/breadcrumb.js +48 -54
- package/dist/components/button-group.d.ts +29 -14
- package/dist/components/button-group.js +27 -32
- package/dist/components/button.d.ts +35 -25
- package/dist/components/button.js +50 -48
- package/dist/components/calendar.d.ts +24 -9
- package/dist/components/calendar.js +92 -98
- package/dist/components/card.d.ts +34 -10
- package/dist/components/card.js +39 -37
- package/dist/components/carousel.d.ts +55 -24
- package/dist/components/carousel.js +113 -130
- package/dist/components/chart.d.ts +72 -36
- package/dist/components/chart.js +154 -166
- package/dist/components/checkbox-cards.d.ts +15 -8
- package/dist/components/checkbox-cards.js +22 -25
- package/dist/components/checkbox-group.d.ts +16 -8
- package/dist/components/checkbox-group.js +19 -19
- package/dist/components/checkbox.d.ts +9 -4
- package/dist/components/checkbox.js +14 -14
- package/dist/components/collapsible.d.ts +14 -6
- package/dist/components/collapsible.js +18 -16
- package/dist/components/command.d.ts +55 -23
- package/dist/components/command.js +70 -85
- package/dist/components/context-menu.d.ts +72 -22
- package/dist/components/context-menu.js +88 -109
- package/dist/components/dialog.d.ts +53 -22
- package/dist/components/dialog.js +71 -85
- package/dist/components/drawer.d.ts +60 -28
- package/dist/components/drawer.js +59 -67
- package/dist/components/dropdown-menu.d.ts +73 -22
- package/dist/components/dropdown-menu.js +95 -112
- package/dist/components/empty.d.ts +37 -15
- package/dist/components/empty.js +43 -45
- package/dist/components/field.d.ts +63 -25
- package/dist/components/field.js +88 -104
- package/dist/components/form.d.ts +37 -15
- package/dist/components/form.js +65 -70
- package/dist/components/hover-card.d.ts +21 -7
- package/dist/components/hover-card.js +24 -24
- package/dist/components/input-group.d.ts +53 -28
- package/dist/components/input-group.js +63 -77
- package/dist/components/input-number.d.ts +28 -7
- package/dist/components/input-number.js +55 -59
- package/dist/components/input-otp.d.ts +24 -10
- package/dist/components/input-otp.js +33 -37
- package/dist/components/input-password.d.ts +12 -5
- package/dist/components/input-password.js +31 -32
- package/dist/components/input-search.d.ts +18 -8
- package/dist/components/input-search.js +43 -41
- package/dist/components/input.d.ts +10 -4
- package/dist/components/input.js +9 -7
- package/dist/components/item.d.ts +69 -32
- package/dist/components/item.js +89 -92
- package/dist/components/kbd.d.ts +13 -5
- package/dist/components/kbd.js +13 -11
- package/dist/components/label.d.ts +9 -4
- package/dist/components/label.js +9 -7
- package/dist/components/menubar.d.ts +80 -23
- package/dist/components/menubar.js +97 -118
- package/dist/components/native-select.d.ts +16 -6
- package/dist/components/native-select.js +25 -26
- package/dist/components/navigation-menu.d.ts +36 -12
- package/dist/components/navigation-menu.js +60 -75
- package/dist/components/pagination.d.ts +35 -14
- package/dist/components/pagination.js +54 -69
- package/dist/components/popover.d.ts +24 -8
- package/dist/components/popover.js +28 -28
- package/dist/components/progress-circle.d.ts +106 -88
- package/dist/components/progress-circle.js +106 -138
- package/dist/components/progress.d.ts +10 -4
- package/dist/components/progress.js +14 -14
- package/dist/components/radio-cards.d.ts +10 -4
- package/dist/components/radio-cards.js +22 -23
- package/dist/components/radio-group.d.ts +13 -5
- package/dist/components/radio-group.js +18 -16
- package/dist/components/radio.d.ts +12 -5
- package/dist/components/radio.js +10 -8
- package/dist/components/resizable.d.ts +18 -7
- package/dist/components/resizable.js +22 -22
- package/dist/components/scroll-area.d.ts +33 -20
- package/dist/components/scroll-area.js +84 -88
- package/dist/components/select.d.ts +50 -16
- package/dist/components/select.js +77 -96
- package/dist/components/separator.d.ts +29 -19
- package/dist/components/separator.js +36 -34
- package/dist/components/sheet.d.ts +62 -29
- package/dist/components/sheet.js +79 -100
- package/dist/components/sidebar.d.ts +160 -66
- package/dist/components/sidebar.js +294 -336
- package/dist/components/skeleton.d.ts +9 -4
- package/dist/components/skeleton.js +8 -6
- package/dist/components/slider.d.ts +13 -4
- package/dist/components/slider.js +34 -40
- package/dist/components/sonner.d.ts +10 -7
- package/dist/components/sonner.js +16 -14
- package/dist/components/spinner.d.ts +12 -5
- package/dist/components/spinner.js +33 -35
- package/dist/components/switch.d.ts +9 -4
- package/dist/components/switch.js +13 -11
- package/dist/components/table.d.ts +37 -11
- package/dist/components/table.js +47 -45
- package/dist/components/tabs.d.ts +21 -7
- package/dist/components/tabs.js +24 -22
- package/dist/components/textarea.d.ts +9 -4
- package/dist/components/textarea.js +8 -6
- package/dist/components/toggle-group.d.ts +24 -9
- package/dist/components/toggle-group.js +41 -42
- package/dist/components/toggle.d.ts +25 -17
- package/dist/components/toggle.js +30 -28
- package/dist/components/tooltip.d.ts +24 -8
- package/dist/components/tooltip.js +29 -32
- package/dist/hooks/use-animated-value.d.ts +4 -1
- package/dist/hooks/use-animated-value.js +57 -36
- package/dist/hooks/use-copy-to-clipboard.d.ts +11 -5
- package/dist/hooks/use-copy-to-clipboard.js +39 -20
- package/dist/hooks/use-is-mobile.d.ts +4 -1
- package/dist/hooks/use-is-mobile.js +21 -1
- package/dist/hooks/use-media-query.d.ts +4 -1
- package/dist/hooks/use-media-query.js +45 -18
- package/dist/hooks/use-mutation-observer.d.ts +6 -2
- package/dist/hooks/use-mutation-observer.js +34 -16
- package/dist/hooks/use-pagination.d.ts +22 -14
- package/dist/hooks/use-pagination.js +100 -49
- package/dist/index.d.ts +69 -130
- package/dist/index.js +11 -11
- package/dist/primitives/checkbox-group.d.ts +105 -83
- package/dist/primitives/checkbox-group.js +111 -84
- package/dist/primitives/input-number.d.ts +51 -40
- package/dist/primitives/input-number.js +483 -350
- package/dist/primitives/input.d.ts +48 -42
- package/dist/primitives/input.js +65 -43
- package/dist/primitives/progress-circle.d.ts +79 -48
- package/dist/primitives/progress-circle.js +154 -105
- package/package.json +6 -7
|
@@ -1,148 +1,116 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useAnimatedValue } from "../hooks/use-animated-value.js";
|
|
3
|
+
import { Indicator as ProgressCircleIndicator, ProgressCircle as ProgressCircle$1, ProgressCircleProvider, ProgressCircleSVG, ProgressCircleTrack, ProgressCircleValue } from "../primitives/progress-circle.js";
|
|
3
4
|
import { tv } from "@codefast/tailwind-variants";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { useCallback, useMemo } from "react";
|
|
5
|
-
|
|
6
|
-
import { Indicator, Provider, Root, SVG, Track, Value } from "../primitives/progress-circle.js";
|
|
7
|
+
//#region src/components/progress-circle.tsx
|
|
7
8
|
const progressCircleVariants = tv({
|
|
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
|
-
default: {
|
|
45
|
-
indicator: "text-primary",
|
|
46
|
-
track: "text-primary/20"
|
|
47
|
-
},
|
|
48
|
-
destructive: {
|
|
49
|
-
indicator: "text-destructive",
|
|
50
|
-
track: "text-destructive/20"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
9
|
+
defaultVariants: {
|
|
10
|
+
size: "md",
|
|
11
|
+
thickness: "regular",
|
|
12
|
+
variant: "default"
|
|
13
|
+
},
|
|
14
|
+
slots: {
|
|
15
|
+
indicator: "origin-center",
|
|
16
|
+
label: "absolute inset-0 flex items-center justify-center text-xs font-medium",
|
|
17
|
+
root: "relative inline-flex items-center justify-center",
|
|
18
|
+
svg: "size-full",
|
|
19
|
+
track: "origin-center"
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
size: {
|
|
23
|
+
sm: { label: "text-[0.625rem]" },
|
|
24
|
+
md: { label: "text-xs" },
|
|
25
|
+
lg: { label: "text-sm" },
|
|
26
|
+
xl: { label: "text-base" },
|
|
27
|
+
"2xl": { label: "text-lg" }
|
|
28
|
+
},
|
|
29
|
+
thickness: {
|
|
30
|
+
regular: {},
|
|
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
|
+
}
|
|
54
45
|
});
|
|
55
|
-
function ProgressCircle({ animate = true, animationDuration =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
className: slots.svg({
|
|
100
|
-
className: classNames?.svg
|
|
101
|
-
}),
|
|
102
|
-
children: [
|
|
103
|
-
/*#__PURE__*/ jsx(Track, {
|
|
104
|
-
className: slots.track({
|
|
105
|
-
className: classNames?.track
|
|
106
|
-
})
|
|
107
|
-
}),
|
|
108
|
-
/*#__PURE__*/ jsx(Indicator, {
|
|
109
|
-
className: slots.indicator({
|
|
110
|
-
className: classNames?.indicator
|
|
111
|
-
}),
|
|
112
|
-
style: {
|
|
113
|
-
transitionDuration: `${animationDuration.toString()}ms`,
|
|
114
|
-
transitionProperty: "stroke-dashoffset"
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
]
|
|
118
|
-
}),
|
|
119
|
-
shouldShowLabel ? /*#__PURE__*/ jsx(Value, {
|
|
120
|
-
className: slots.label({
|
|
121
|
-
className: classNames?.label
|
|
122
|
-
}),
|
|
123
|
-
children: renderLabel()
|
|
124
|
-
}) : null
|
|
125
|
-
]
|
|
126
|
-
})
|
|
127
|
-
});
|
|
46
|
+
function ProgressCircle({ animate = true, animationDuration = 1e3, className, classNames, customLabel, showValue = false, size, sizeInPixels, strokeWidth, thickness = "regular", value = 0, variant = "default", ...props }) {
|
|
47
|
+
const displayValue = useAnimatedValue(value, animationDuration, animate);
|
|
48
|
+
const actualSize = useMemo(() => sizeInPixels ?? getActualSize(size), [sizeInPixels, size]);
|
|
49
|
+
const actualThickness = useMemo(() => strokeWidth ?? getStrokeWidth(thickness, actualSize), [
|
|
50
|
+
strokeWidth,
|
|
51
|
+
thickness,
|
|
52
|
+
actualSize
|
|
53
|
+
]);
|
|
54
|
+
const slots = useMemo(() => progressCircleVariants({
|
|
55
|
+
size,
|
|
56
|
+
thickness,
|
|
57
|
+
variant
|
|
58
|
+
}), [
|
|
59
|
+
variant,
|
|
60
|
+
size,
|
|
61
|
+
thickness
|
|
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
|
+
});
|
|
128
90
|
}
|
|
129
91
|
ProgressCircle.displayName = "ProgressCircle";
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Maps size variants to actual pixel sizes
|
|
94
|
+
*/
|
|
95
|
+
const getActualSize = (size) => {
|
|
96
|
+
return size ? {
|
|
97
|
+
"2xl": 128,
|
|
98
|
+
lg: 64,
|
|
99
|
+
md: 48,
|
|
100
|
+
sm: 32,
|
|
101
|
+
xl: 96
|
|
102
|
+
}[size] : 48;
|
|
139
103
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Calculates stroke width based on thickness variant and circle size
|
|
106
|
+
*/
|
|
107
|
+
const getStrokeWidth = (thickness, size) => {
|
|
108
|
+
const thicknessMap = {
|
|
109
|
+
regular: Math.max(3, size * .05),
|
|
110
|
+
thick: Math.max(4, size * .075),
|
|
111
|
+
thin: Math.max(2, size * .025)
|
|
112
|
+
};
|
|
113
|
+
return thickness ? thicknessMap[thickness] : Math.max(3, size * .05);
|
|
147
114
|
};
|
|
115
|
+
//#endregion
|
|
148
116
|
export { ProgressCircle, progressCircleVariants };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
|
+
|
|
4
|
+
//#region src/components/progress.d.ts
|
|
3
5
|
type ProgressProps = ComponentProps<typeof ProgressPrimitive.Root>;
|
|
4
|
-
declare function Progress({
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
declare function Progress({
|
|
7
|
+
className,
|
|
8
|
+
value,
|
|
9
|
+
...props
|
|
10
|
+
}: ProgressProps): JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Progress, type ProgressProps };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import {
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
5
|
+
//#region src/components/progress.tsx
|
|
5
6
|
function Progress({ className, value, ...props }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
});
|
|
7
|
+
return /* @__PURE__ */ jsx(ProgressPrimitive.Root, {
|
|
8
|
+
className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
|
|
9
|
+
"data-slot": "progress",
|
|
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
|
+
});
|
|
18
17
|
}
|
|
18
|
+
//#endregion
|
|
19
19
|
export { Progress };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
|
+
|
|
4
|
+
//#region src/components/radio-cards.d.ts
|
|
3
5
|
type RadioCardsProps = ComponentProps<typeof RadioGroupPrimitive.Root>;
|
|
4
6
|
declare function RadioCards(props: RadioCardsProps): JSX.Element;
|
|
5
7
|
type RadioCardsItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
|
|
6
|
-
declare function RadioCardsItem({
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
declare function RadioCardsItem({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: RadioCardsItemProps): JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { RadioCards, RadioCardsItem, type RadioCardsItemProps, type RadioCardsProps };
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import { Indicator, Item, Root } from "@radix-ui/react-radio-group";
|
|
5
2
|
import { Label } from "./label.js";
|
|
3
|
+
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
6
|
+
//#region src/components/radio-cards.tsx
|
|
6
7
|
function RadioCards(props) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, {
|
|
9
|
+
"data-slot": "radio-cards",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
11
12
|
}
|
|
12
13
|
function RadioCardsItem({ children, className, ...props }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
children
|
|
27
|
-
]
|
|
28
|
-
});
|
|
14
|
+
return /* @__PURE__ */ jsxs(Label, {
|
|
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
|
+
});
|
|
29
27
|
}
|
|
28
|
+
//#endregion
|
|
30
29
|
export { RadioCards, RadioCardsItem };
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
3
|
+
|
|
4
|
+
//#region src/components/radio-group.d.ts
|
|
3
5
|
type RadioGroupProps = ComponentProps<typeof RadioGroupPrimitive.Root>;
|
|
4
|
-
declare function RadioGroup({
|
|
6
|
+
declare function RadioGroup({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: RadioGroupProps): JSX.Element;
|
|
5
10
|
type RadioGroupItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
|
|
6
|
-
declare function RadioGroupItem({
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
declare function RadioGroupItem({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: RadioGroupItemProps): JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps };
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
-
import {
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
5
|
+
//#region src/components/radio-group.tsx
|
|
5
6
|
function RadioGroup({ className, ...props }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
return /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, {
|
|
8
|
+
className: cn("grid gap-2", className),
|
|
9
|
+
"data-slot": "radio-group",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
11
12
|
}
|
|
12
13
|
function RadioGroupItem({ className, ...props }) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
return /* @__PURE__ */ jsx(RadioGroupPrimitive.Item, {
|
|
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
|
+
});
|
|
22
23
|
}
|
|
24
|
+
//#endregion
|
|
23
25
|
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/radio.d.ts
|
|
2
4
|
interface RadioProps extends Omit<ComponentProps<"input">, "type"> {
|
|
3
|
-
|
|
5
|
+
onValueChange?: (value: string) => void;
|
|
4
6
|
}
|
|
5
|
-
declare function Radio({
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
declare function Radio({
|
|
8
|
+
className,
|
|
9
|
+
onChange,
|
|
10
|
+
onValueChange,
|
|
11
|
+
...props
|
|
12
|
+
}: RadioProps): JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Radio, type RadioProps };
|
package/dist/components/radio.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
5
|
+
//#region src/components/radio.tsx
|
|
5
6
|
function Radio({ className, onChange, onValueChange, ...props }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
return /* @__PURE__ */ jsx("input", {
|
|
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
|
+
});
|
|
13
14
|
}
|
|
15
|
+
//#endregion
|
|
14
16
|
export { Radio };
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as ResizablePrimitive from "react-resizable-panels";
|
|
3
|
+
|
|
4
|
+
//#region src/components/resizable.d.ts
|
|
3
5
|
type ResizableGroupProps = ComponentProps<typeof ResizablePrimitive.Group>;
|
|
4
|
-
declare function ResizableGroup({
|
|
6
|
+
declare function ResizableGroup({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: ResizableGroupProps): JSX.Element;
|
|
5
10
|
type ResizablePanelProps = ComponentProps<typeof ResizablePrimitive.Panel>;
|
|
6
|
-
declare function ResizablePanel({
|
|
11
|
+
declare function ResizablePanel({
|
|
12
|
+
...props
|
|
13
|
+
}: ResizablePanelProps): JSX.Element;
|
|
7
14
|
interface ResizableSeparatorProps extends ComponentProps<typeof ResizablePrimitive.Separator> {
|
|
8
|
-
|
|
15
|
+
withHandle?: boolean;
|
|
9
16
|
}
|
|
10
|
-
declare function ResizableSeparator({
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
declare function ResizableSeparator({
|
|
18
|
+
className,
|
|
19
|
+
withHandle,
|
|
20
|
+
...props
|
|
21
|
+
}: ResizableSeparatorProps): JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ResizableGroup, type ResizableGroupProps, ResizablePanel, type ResizablePanelProps, ResizableSeparator, type ResizableSeparatorProps };
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
3
|
import { GripVerticalIcon } from "lucide-react";
|
|
5
|
-
import {
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import * as ResizablePrimitive from "react-resizable-panels";
|
|
6
|
+
//#region src/components/resizable.tsx
|
|
6
7
|
function ResizableGroup({ className, ...props }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Group, {
|
|
9
|
+
className: cn("flex size-full", className),
|
|
10
|
+
"data-slot": "resizable-group",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
12
13
|
}
|
|
13
14
|
function ResizablePanel({ ...props }) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Panel, {
|
|
16
|
+
"data-slot": "resizable-panel",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
18
19
|
}
|
|
19
20
|
function ResizableSeparator({ className, withHandle, ...props }) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}) : null
|
|
30
|
-
});
|
|
21
|
+
return /* @__PURE__ */ jsx(ResizablePrimitive.Separator, {
|
|
22
|
+
className: cn("flex items-center justify-center bg-border outline-hidden focus-visible:bg-ring focus-visible:ring-3 focus-visible:ring-ring/50", "aria-[orientation=vertical]:w-px", "aria-[orientation=horizontal]:h-px", className),
|
|
23
|
+
"data-slot": "resizable-separator",
|
|
24
|
+
...props,
|
|
25
|
+
children: withHandle ? /* @__PURE__ */ jsx("div", {
|
|
26
|
+
className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",
|
|
27
|
+
children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-2.5" })
|
|
28
|
+
}) : null
|
|
29
|
+
});
|
|
31
30
|
}
|
|
31
|
+
//#endregion
|
|
32
32
|
export { ResizableGroup, ResizablePanel, ResizableSeparator };
|