@dinachi/cli 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.js +122 -33
- package/package.json +3 -4
- package/templates/alert-dialog/alert-dialog.tsx +60 -45
- package/templates/autocomplete/autocomplete.tsx +23 -17
- package/templates/badge/badge.tsx +58 -119
- package/templates/card/card.tsx +1 -1
- package/templates/checkbox/checkbox.tsx +16 -14
- package/templates/combobox/combobox.tsx +22 -16
- package/templates/context-menu/context-menu.tsx +124 -186
- package/templates/context-menu/index.ts +3 -1
- package/templates/dialog/dialog.tsx +26 -27
- package/templates/drawer/drawer.tsx +23 -21
- package/templates/field/field.tsx +5 -15
- package/templates/form/form.tsx +9 -66
- package/templates/label/index.ts +1 -0
- package/templates/label/label.tsx +21 -0
- package/templates/menu/index.ts +2 -0
- package/templates/menu/menu.tsx +59 -61
- package/templates/menubar/index.ts +1 -0
- package/templates/menubar/menubar.tsx +52 -71
- package/templates/navigation-menu/navigation-menu.tsx +61 -18
- package/templates/popover/index.ts +4 -1
- package/templates/popover/popover.tsx +89 -34
- package/templates/preview-card/preview-card.tsx +19 -5
- package/templates/radio/index.ts +1 -1
- package/templates/radio/radio.tsx +30 -14
- package/templates/select/select.tsx +83 -76
- package/templates/skeleton/index.ts +1 -0
- package/templates/skeleton/skeleton.tsx +12 -0
- package/templates/slider/slider.tsx +9 -15
- package/templates/switch/switch.tsx +15 -11
- package/templates/tabs/tabs.tsx +2 -2
- package/templates/toast/toast.tsx +76 -48
- package/templates/toggle/toggle.tsx +0 -17
- package/templates/toggle-group/toggle-group.tsx +8 -3
- package/templates/toolbar/toolbar.tsx +5 -4
- package/templates/tooltip/tooltip.tsx +9 -54
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { NavigationMenu as BaseNavigationMenu } from "@base-ui/react/navigation-menu"
|
|
5
|
-
import { useRender } from "@base-ui/react/use-render"
|
|
6
5
|
import { cn } from "@/lib/utils"
|
|
7
6
|
import { ChevronDown } from "lucide-react"
|
|
8
7
|
|
|
@@ -44,7 +43,7 @@ const NavigationMenuItem = React.forwardRef<
|
|
|
44
43
|
>(({ className, ...props }, ref) => (
|
|
45
44
|
<BaseNavigationMenu.Item
|
|
46
45
|
ref={ref}
|
|
47
|
-
className={
|
|
46
|
+
className={className}
|
|
48
47
|
{...props}
|
|
49
48
|
/>
|
|
50
49
|
))
|
|
@@ -60,7 +59,7 @@ const NavigationMenuTrigger = React.forwardRef<
|
|
|
60
59
|
"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors",
|
|
61
60
|
"hover:bg-accent hover:text-accent-foreground",
|
|
62
61
|
"focus:bg-accent focus:text-accent-foreground focus:outline-none",
|
|
63
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
62
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
64
63
|
"data-[popup-open]:bg-accent/50",
|
|
65
64
|
className
|
|
66
65
|
)}
|
|
@@ -110,17 +109,9 @@ const NavigationMenuLink = React.forwardRef<
|
|
|
110
109
|
))
|
|
111
110
|
NavigationMenuLink.displayName = "NavigationMenuLink"
|
|
112
111
|
|
|
113
|
-
const NavigationMenuPortal
|
|
114
|
-
React.ComponentRef<typeof BaseNavigationMenu.Portal>,
|
|
112
|
+
const NavigationMenuPortal: React.FC<
|
|
115
113
|
React.ComponentProps<typeof BaseNavigationMenu.Portal>
|
|
116
|
-
>(
|
|
117
|
-
const element = useRender({
|
|
118
|
-
render: <BaseNavigationMenu.Portal />,
|
|
119
|
-
props,
|
|
120
|
-
ref,
|
|
121
|
-
});
|
|
122
|
-
return element;
|
|
123
|
-
});
|
|
114
|
+
> = (props) => <BaseNavigationMenu.Portal {...props} />
|
|
124
115
|
NavigationMenuPortal.displayName = "NavigationMenuPortal"
|
|
125
116
|
|
|
126
117
|
const NavigationMenuPositioner = React.forwardRef<
|
|
@@ -129,7 +120,7 @@ const NavigationMenuPositioner = React.forwardRef<
|
|
|
129
120
|
>(({ className, ...props }, ref) => (
|
|
130
121
|
<BaseNavigationMenu.Positioner
|
|
131
122
|
ref={ref}
|
|
132
|
-
className={cn("absolute left-0 top-full flex justify-center", className)}
|
|
123
|
+
className={cn("absolute left-0 top-full z-50 flex justify-center", className)}
|
|
133
124
|
{...props}
|
|
134
125
|
/>
|
|
135
126
|
))
|
|
@@ -159,8 +150,6 @@ const NavigationMenuViewport = React.forwardRef<
|
|
|
159
150
|
ref={ref}
|
|
160
151
|
className={cn(
|
|
161
152
|
"origin-top-center relative mt-1.5 h-auto w-auto overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg",
|
|
162
|
-
"data-[state=open]:animate-in data-[state=open]:zoom-in-90 data-[state=open]:fade-in",
|
|
163
|
-
"data-[state=closed]:animate-out data-[state=closed]:zoom-out-90 data-[state=closed]:fade-out",
|
|
164
153
|
className
|
|
165
154
|
)}
|
|
166
155
|
style={{
|
|
@@ -171,6 +160,58 @@ const NavigationMenuViewport = React.forwardRef<
|
|
|
171
160
|
))
|
|
172
161
|
NavigationMenuViewport.displayName = "NavigationMenuViewport"
|
|
173
162
|
|
|
163
|
+
const NavigationMenuArrow = React.forwardRef<
|
|
164
|
+
React.ComponentRef<typeof BaseNavigationMenu.Arrow>,
|
|
165
|
+
React.ComponentProps<typeof BaseNavigationMenu.Arrow>
|
|
166
|
+
>(({ className, children, ...props }, ref) => (
|
|
167
|
+
<BaseNavigationMenu.Arrow
|
|
168
|
+
ref={ref}
|
|
169
|
+
className={cn(
|
|
170
|
+
"data-[side=bottom]:top-[-8px]",
|
|
171
|
+
"data-[side=left]:right-[-13px] data-[side=left]:rotate-90",
|
|
172
|
+
"data-[side=right]:left-[-13px] data-[side=right]:-rotate-90",
|
|
173
|
+
"data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",
|
|
174
|
+
className
|
|
175
|
+
)}
|
|
176
|
+
{...props}
|
|
177
|
+
>
|
|
178
|
+
{children || (
|
|
179
|
+
<svg width="20" height="10" viewBox="0 0 20 10" fill="none">
|
|
180
|
+
<path
|
|
181
|
+
d="M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z"
|
|
182
|
+
className="fill-popover"
|
|
183
|
+
/>
|
|
184
|
+
<path
|
|
185
|
+
d="M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z"
|
|
186
|
+
className="fill-border"
|
|
187
|
+
/>
|
|
188
|
+
<path
|
|
189
|
+
d="M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z"
|
|
190
|
+
className="fill-border"
|
|
191
|
+
/>
|
|
192
|
+
</svg>
|
|
193
|
+
)}
|
|
194
|
+
</BaseNavigationMenu.Arrow>
|
|
195
|
+
))
|
|
196
|
+
NavigationMenuArrow.displayName = "NavigationMenuArrow"
|
|
197
|
+
|
|
198
|
+
const NavigationMenuBackdrop = React.forwardRef<
|
|
199
|
+
React.ComponentRef<typeof BaseNavigationMenu.Backdrop>,
|
|
200
|
+
React.ComponentProps<typeof BaseNavigationMenu.Backdrop>
|
|
201
|
+
>(({ className, ...props }, ref) => (
|
|
202
|
+
<BaseNavigationMenu.Backdrop
|
|
203
|
+
ref={ref}
|
|
204
|
+
className={cn(
|
|
205
|
+
"fixed inset-0 z-40 bg-black/40 pointer-events-none",
|
|
206
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
207
|
+
"transition-opacity duration-150",
|
|
208
|
+
className
|
|
209
|
+
)}
|
|
210
|
+
{...props}
|
|
211
|
+
/>
|
|
212
|
+
))
|
|
213
|
+
NavigationMenuBackdrop.displayName = "NavigationMenuBackdrop"
|
|
214
|
+
|
|
174
215
|
const NavigationMenuIndicator = React.forwardRef<
|
|
175
216
|
React.ComponentRef<"div">,
|
|
176
217
|
React.HTMLAttributes<HTMLDivElement>
|
|
@@ -178,7 +219,7 @@ const NavigationMenuIndicator = React.forwardRef<
|
|
|
178
219
|
<div
|
|
179
220
|
ref={ref}
|
|
180
221
|
className={cn(
|
|
181
|
-
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden
|
|
222
|
+
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
|
|
182
223
|
className
|
|
183
224
|
)}
|
|
184
225
|
{...props}
|
|
@@ -200,4 +241,6 @@ export {
|
|
|
200
241
|
NavigationMenuPositioner,
|
|
201
242
|
NavigationMenuPopup,
|
|
202
243
|
NavigationMenuViewport,
|
|
203
|
-
|
|
244
|
+
NavigationMenuArrow,
|
|
245
|
+
NavigationMenuBackdrop,
|
|
246
|
+
}
|
|
@@ -2,11 +2,14 @@ export {
|
|
|
2
2
|
Popover,
|
|
3
3
|
PopoverTrigger,
|
|
4
4
|
PopoverContent,
|
|
5
|
+
PopoverPositioner,
|
|
6
|
+
PopoverPopup,
|
|
5
7
|
PopoverArrow,
|
|
8
|
+
PopoverViewport,
|
|
6
9
|
PopoverTitle,
|
|
7
10
|
PopoverDescription,
|
|
8
11
|
PopoverClose,
|
|
9
12
|
PopoverPortal,
|
|
10
13
|
PopoverBackdrop,
|
|
14
|
+
createPopoverHandle,
|
|
11
15
|
} from "./popover"
|
|
12
|
-
|
|
@@ -4,48 +4,91 @@ import * as React from "react"
|
|
|
4
4
|
import { Popover as PopoverPrimitive } from "@base-ui/react/popover"
|
|
5
5
|
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
|
-
// Re-export root components for better tree-shaking
|
|
8
7
|
const Popover = PopoverPrimitive.Root
|
|
9
8
|
const PopoverTrigger = PopoverPrimitive.Trigger
|
|
10
9
|
const PopoverPortal = PopoverPrimitive.Portal
|
|
11
10
|
const PopoverClose = PopoverPrimitive.Close
|
|
11
|
+
const createPopoverHandle = PopoverPrimitive.createHandle
|
|
12
|
+
|
|
13
|
+
const PopoverPositioner = React.forwardRef<
|
|
14
|
+
React.ComponentRef<typeof PopoverPrimitive.Positioner>,
|
|
15
|
+
React.ComponentProps<typeof PopoverPrimitive.Positioner>
|
|
16
|
+
>(({ className, sideOffset = 8, ...props }, ref) => (
|
|
17
|
+
<PopoverPrimitive.Positioner
|
|
18
|
+
ref={ref}
|
|
19
|
+
sideOffset={sideOffset}
|
|
20
|
+
className={cn("z-50", className)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
))
|
|
24
|
+
PopoverPositioner.displayName = "PopoverPositioner"
|
|
25
|
+
|
|
26
|
+
const PopoverPopup = React.forwardRef<
|
|
27
|
+
React.ComponentRef<typeof PopoverPrimitive.Popup>,
|
|
28
|
+
React.ComponentProps<typeof PopoverPrimitive.Popup>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<PopoverPrimitive.Popup
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn(
|
|
33
|
+
"rounded-lg border bg-popover px-6 py-4 text-popover-foreground shadow-lg outline-none",
|
|
34
|
+
"origin-(--transform-origin)",
|
|
35
|
+
"data-starting-style:scale-90 data-starting-style:opacity-0",
|
|
36
|
+
"data-ending-style:scale-90 data-ending-style:opacity-0",
|
|
37
|
+
"transition-[transform,opacity] duration-150",
|
|
38
|
+
className
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
))
|
|
43
|
+
PopoverPopup.displayName = "PopoverPopup"
|
|
12
44
|
|
|
13
|
-
// Optimized PopoverContent with better positioning and animations
|
|
14
45
|
const PopoverContent = React.forwardRef<
|
|
15
46
|
React.ComponentRef<typeof PopoverPrimitive.Popup>,
|
|
16
|
-
React.
|
|
47
|
+
React.ComponentProps<typeof PopoverPrimitive.Popup> & {
|
|
48
|
+
readonly side?: React.ComponentProps<typeof PopoverPrimitive.Positioner>["side"]
|
|
49
|
+
readonly align?: React.ComponentProps<typeof PopoverPrimitive.Positioner>["align"]
|
|
17
50
|
readonly sideOffset?: number
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
51
|
+
readonly alignOffset?: number
|
|
52
|
+
readonly collisionBoundary?: React.ComponentProps<typeof PopoverPrimitive.Positioner>["collisionBoundary"]
|
|
53
|
+
readonly collisionPadding?: React.ComponentProps<typeof PopoverPrimitive.Positioner>["collisionPadding"]
|
|
54
|
+
readonly sticky?: boolean
|
|
55
|
+
readonly portal?: boolean
|
|
20
56
|
}
|
|
21
|
-
>(({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
57
|
+
>(({
|
|
58
|
+
className,
|
|
59
|
+
side = "bottom",
|
|
60
|
+
align = "center",
|
|
61
|
+
sideOffset = 8,
|
|
62
|
+
alignOffset,
|
|
63
|
+
collisionBoundary,
|
|
64
|
+
collisionPadding,
|
|
65
|
+
sticky,
|
|
66
|
+
portal = true,
|
|
67
|
+
...props
|
|
68
|
+
}, ref) => {
|
|
69
|
+
const content = (
|
|
70
|
+
<PopoverPositioner
|
|
25
71
|
side={side}
|
|
72
|
+
align={align}
|
|
26
73
|
sideOffset={sideOffset}
|
|
74
|
+
alignOffset={alignOffset}
|
|
75
|
+
collisionBoundary={collisionBoundary}
|
|
76
|
+
collisionPadding={collisionPadding}
|
|
77
|
+
sticky={sticky}
|
|
27
78
|
>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
className
|
|
37
|
-
)}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
</PopoverPrimitive.Positioner>
|
|
41
|
-
</PopoverPrimitive.Portal>
|
|
42
|
-
))
|
|
79
|
+
<PopoverPopup ref={ref} className={className} {...props} />
|
|
80
|
+
</PopoverPositioner>
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if (!portal) return content
|
|
84
|
+
|
|
85
|
+
return <PopoverPrimitive.Portal>{content}</PopoverPrimitive.Portal>
|
|
86
|
+
})
|
|
43
87
|
PopoverContent.displayName = "PopoverContent"
|
|
44
88
|
|
|
45
|
-
// Optimized PopoverArrow
|
|
46
89
|
const PopoverArrow = React.forwardRef<
|
|
47
90
|
React.ComponentRef<typeof PopoverPrimitive.Arrow>,
|
|
48
|
-
React.
|
|
91
|
+
React.ComponentProps<typeof PopoverPrimitive.Arrow>
|
|
49
92
|
>(({ className, children, ...props }, ref) => (
|
|
50
93
|
<PopoverPrimitive.Arrow
|
|
51
94
|
ref={ref}
|
|
@@ -78,10 +121,21 @@ const PopoverArrow = React.forwardRef<
|
|
|
78
121
|
))
|
|
79
122
|
PopoverArrow.displayName = "PopoverArrow"
|
|
80
123
|
|
|
81
|
-
|
|
124
|
+
const PopoverViewport = React.forwardRef<
|
|
125
|
+
React.ComponentRef<typeof PopoverPrimitive.Viewport>,
|
|
126
|
+
React.ComponentProps<typeof PopoverPrimitive.Viewport>
|
|
127
|
+
>(({ className, ...props }, ref) => (
|
|
128
|
+
<PopoverPrimitive.Viewport
|
|
129
|
+
ref={ref}
|
|
130
|
+
className={cn("flex flex-col gap-2", className)}
|
|
131
|
+
{...props}
|
|
132
|
+
/>
|
|
133
|
+
))
|
|
134
|
+
PopoverViewport.displayName = "PopoverViewport"
|
|
135
|
+
|
|
82
136
|
const PopoverTitle = React.forwardRef<
|
|
83
137
|
React.ComponentRef<typeof PopoverPrimitive.Title>,
|
|
84
|
-
React.
|
|
138
|
+
React.ComponentProps<typeof PopoverPrimitive.Title>
|
|
85
139
|
>(({ className, ...props }, ref) => (
|
|
86
140
|
<PopoverPrimitive.Title
|
|
87
141
|
ref={ref}
|
|
@@ -91,10 +145,9 @@ const PopoverTitle = React.forwardRef<
|
|
|
91
145
|
))
|
|
92
146
|
PopoverTitle.displayName = "PopoverTitle"
|
|
93
147
|
|
|
94
|
-
// Optimized PopoverDescription
|
|
95
148
|
const PopoverDescription = React.forwardRef<
|
|
96
149
|
React.ComponentRef<typeof PopoverPrimitive.Description>,
|
|
97
|
-
React.
|
|
150
|
+
React.ComponentProps<typeof PopoverPrimitive.Description>
|
|
98
151
|
>(({ className, ...props }, ref) => (
|
|
99
152
|
<PopoverPrimitive.Description
|
|
100
153
|
ref={ref}
|
|
@@ -104,16 +157,15 @@ const PopoverDescription = React.forwardRef<
|
|
|
104
157
|
))
|
|
105
158
|
PopoverDescription.displayName = "PopoverDescription"
|
|
106
159
|
|
|
107
|
-
// Optimized PopoverBackdrop
|
|
108
160
|
const PopoverBackdrop = React.forwardRef<
|
|
109
161
|
React.ComponentRef<typeof PopoverPrimitive.Backdrop>,
|
|
110
|
-
React.
|
|
162
|
+
React.ComponentProps<typeof PopoverPrimitive.Backdrop>
|
|
111
163
|
>(({ className, ...props }, ref) => (
|
|
112
164
|
<PopoverPrimitive.Backdrop
|
|
113
165
|
ref={ref}
|
|
114
166
|
className={cn(
|
|
115
167
|
"fixed inset-0 z-40 bg-black/50",
|
|
116
|
-
"data-
|
|
168
|
+
"data-starting-style:opacity-0 data-ending-style:opacity-0",
|
|
117
169
|
"transition-opacity duration-150",
|
|
118
170
|
className
|
|
119
171
|
)}
|
|
@@ -126,11 +178,14 @@ export {
|
|
|
126
178
|
Popover,
|
|
127
179
|
PopoverTrigger,
|
|
128
180
|
PopoverContent,
|
|
181
|
+
PopoverPositioner,
|
|
182
|
+
PopoverPopup,
|
|
129
183
|
PopoverArrow,
|
|
184
|
+
PopoverViewport,
|
|
130
185
|
PopoverTitle,
|
|
131
186
|
PopoverDescription,
|
|
132
187
|
PopoverClose,
|
|
133
188
|
PopoverPortal,
|
|
134
189
|
PopoverBackdrop,
|
|
190
|
+
createPopoverHandle,
|
|
135
191
|
}
|
|
136
|
-
|
|
@@ -64,10 +64,10 @@ const PreviewCardPopup = React.forwardRef<
|
|
|
64
64
|
className={cn(
|
|
65
65
|
"flex w-[280px] origin-[var(--transform-origin)] flex-col gap-3 rounded-lg bg-secondary/80 p-4 shadow-lg shadow-secondary/20",
|
|
66
66
|
"outline outline-1 outline-border",
|
|
67
|
-
"transition-[
|
|
67
|
+
"transition-[scale,opacity] duration-200",
|
|
68
68
|
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
69
69
|
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
70
|
-
"
|
|
70
|
+
"backdrop-blur-sm dark:shadow-none dark:-outline-offset-1",
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
73
73
|
{...props}
|
|
@@ -77,9 +77,7 @@ PreviewCardPopup.displayName = "PreviewCardPopup"
|
|
|
77
77
|
|
|
78
78
|
const PreviewCardArrow = React.forwardRef<
|
|
79
79
|
React.ComponentRef<typeof BasePreviewCard.Arrow>,
|
|
80
|
-
React.ComponentProps<typeof BasePreviewCard.Arrow>
|
|
81
|
-
children?: React.ReactNode
|
|
82
|
-
}
|
|
80
|
+
React.ComponentProps<typeof BasePreviewCard.Arrow>
|
|
83
81
|
>(({ className, children, ...props }, ref) => (
|
|
84
82
|
<BasePreviewCard.Arrow
|
|
85
83
|
ref={ref}
|
|
@@ -111,6 +109,20 @@ const PreviewCardContent = React.forwardRef<
|
|
|
111
109
|
))
|
|
112
110
|
PreviewCardContent.displayName = "PreviewCardContent"
|
|
113
111
|
|
|
112
|
+
const PreviewCardViewport = React.forwardRef<
|
|
113
|
+
React.ComponentRef<typeof BasePreviewCard.Viewport>,
|
|
114
|
+
React.ComponentProps<typeof BasePreviewCard.Viewport>
|
|
115
|
+
>(({ className, ...props }, ref) => (
|
|
116
|
+
<BasePreviewCard.Viewport
|
|
117
|
+
ref={ref}
|
|
118
|
+
className={cn("flex flex-col gap-3", className)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
))
|
|
122
|
+
PreviewCardViewport.displayName = "PreviewCardViewport"
|
|
123
|
+
|
|
124
|
+
const createPreviewCardHandle = BasePreviewCard.createHandle
|
|
125
|
+
|
|
114
126
|
function PreviewCardArrowSvg(props: React.ComponentProps<'svg'>) {
|
|
115
127
|
return (
|
|
116
128
|
<svg width="20" height="10" viewBox="0 0 20 10" fill="none" {...props}>
|
|
@@ -136,5 +148,7 @@ export {
|
|
|
136
148
|
PreviewCardPopup,
|
|
137
149
|
PreviewCardArrow,
|
|
138
150
|
PreviewCardContent,
|
|
151
|
+
PreviewCardViewport,
|
|
139
152
|
PreviewCardArrowSvg,
|
|
153
|
+
createPreviewCardHandle,
|
|
140
154
|
}
|
package/templates/radio/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Radio, RadioGroup } from "./radio"
|
|
1
|
+
export { Radio, RadioGroup, RadioIndicator } from "./radio"
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Radio as RadioPrimitive } from "@base-ui/react/radio"
|
|
5
5
|
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group"
|
|
6
|
-
import { Circle } from "lucide-react"
|
|
7
6
|
import { cn } from "@/lib/utils"
|
|
8
7
|
|
|
9
8
|
const RadioGroup = React.forwardRef<
|
|
@@ -14,25 +13,42 @@ const RadioGroup = React.forwardRef<
|
|
|
14
13
|
))
|
|
15
14
|
RadioGroup.displayName = "RadioGroup"
|
|
16
15
|
|
|
17
|
-
const
|
|
18
|
-
React.ComponentRef<typeof RadioPrimitive.
|
|
19
|
-
React.
|
|
16
|
+
const RadioIndicator = React.forwardRef<
|
|
17
|
+
React.ComponentRef<typeof RadioPrimitive.Indicator>,
|
|
18
|
+
React.ComponentProps<typeof RadioPrimitive.Indicator>
|
|
20
19
|
>(({ className, ...props }, ref) => (
|
|
21
|
-
<RadioPrimitive.
|
|
20
|
+
<RadioPrimitive.Indicator
|
|
22
21
|
ref={ref}
|
|
23
22
|
className={cn(
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
23
|
+
"flex items-center justify-center",
|
|
24
|
+
"after:h-2.5 after:w-2.5 after:rounded-full after:bg-current",
|
|
27
25
|
className
|
|
28
26
|
)}
|
|
29
27
|
{...props}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
/>
|
|
29
|
+
))
|
|
30
|
+
RadioIndicator.displayName = "RadioIndicator"
|
|
31
|
+
|
|
32
|
+
const Radio = React.forwardRef<
|
|
33
|
+
React.ComponentRef<typeof RadioPrimitive.Root>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof RadioPrimitive.Root>
|
|
35
|
+
>(({ className, ...props }, ref) => (
|
|
36
|
+
<span className="relative inline-flex [&>input]:!absolute">
|
|
37
|
+
<RadioPrimitive.Root
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"flex items-center justify-center aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background",
|
|
41
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
42
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
43
|
+
"data-[checked]:border-primary data-[unchecked]:border-muted-foreground",
|
|
44
|
+
className
|
|
45
|
+
)}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
<RadioIndicator />
|
|
49
|
+
</RadioPrimitive.Root>
|
|
50
|
+
</span>
|
|
35
51
|
))
|
|
36
52
|
Radio.displayName = "Radio"
|
|
37
53
|
|
|
38
|
-
export { Radio, RadioGroup }
|
|
54
|
+
export { Radio, RadioGroup, RadioIndicator }
|