@dinachi/cli 1.0.0 → 1.1.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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/templates/accordion/accordion.tsx +5 -1
- package/templates/alert-dialog/alert-dialog.tsx +14 -3
- package/templates/animated-icon/animated-icon.tsx +1 -0
- package/templates/animated-list/animated-list.tsx +2 -1
- package/templates/animated-tabs/animated-tabs.tsx +4 -0
- package/templates/autocomplete/autocomplete.tsx +14 -3
- package/templates/avatar/avatar.tsx +3 -0
- package/templates/badge/badge.tsx +1 -0
- package/templates/button/button.tsx +1 -0
- package/templates/card/card.tsx +6 -1
- package/templates/carousel/carousel.tsx +7 -0
- package/templates/checkbox/checkbox.tsx +1 -0
- package/templates/checkbox-group/checkbox-group.tsx +1 -0
- package/templates/collapsible/collapsible.tsx +3 -1
- package/templates/combobox/combobox.tsx +15 -3
- package/templates/compare-slider/compare-slider.tsx +1 -0
- package/templates/context-menu/context-menu.tsx +61 -14
- package/templates/dialog/dialog.tsx +13 -3
- package/templates/drawer/drawer.tsx +19 -6
- package/templates/expandable-card/expandable-card.tsx +5 -1
- package/templates/field/field.tsx +5 -1
- package/templates/fieldset/fieldset.tsx +2 -0
- package/templates/form/form.tsx +1 -0
- package/templates/hold-to-confirm/hold-to-confirm.tsx +1 -0
- package/templates/input/input.tsx +1 -0
- package/templates/label/label.tsx +1 -0
- package/templates/link/link.tsx +1 -0
- package/templates/load-transition/load-transition.tsx +1 -0
- package/templates/marquee/marquee.tsx +1 -0
- package/templates/menu/menu.tsx +19 -3
- package/templates/menubar/menubar.tsx +15 -3
- package/templates/meter/meter.tsx +5 -1
- package/templates/navigation-menu/navigation-menu.tsx +13 -2
- package/templates/number-field/number-field.tsx +7 -1
- package/templates/number-ticker/number-ticker.tsx +3 -0
- package/templates/otp-field/otp-field.tsx +4 -0
- package/templates/popover/popover.tsx +19 -5
- package/templates/preview-card/preview-card.tsx +11 -3
- package/templates/progress/progress.tsx +5 -1
- package/templates/progress-ring/progress-ring.tsx +1 -0
- package/templates/radio/radio.tsx +3 -0
- package/templates/scroll-area/scroll-area.tsx +14 -4
- package/templates/scroll-progress/scroll-progress.tsx +1 -0
- package/templates/scroll-reveal/scroll-reveal.tsx +1 -0
- package/templates/select/select.tsx +18 -2
- package/templates/separator/separator.tsx +1 -0
- package/templates/skeleton/skeleton.tsx +1 -0
- package/templates/slider/slider.tsx +7 -0
- package/templates/sortable/sortable.tsx +3 -0
- package/templates/stagger-list/stagger-list.tsx +2 -0
- package/templates/streaming-text/streaming-text.tsx +1 -0
- package/templates/swipeable-row/swipeable-row.tsx +1 -0
- package/templates/switch/switch.tsx +2 -0
- package/templates/tabs/tabs.tsx +5 -0
- package/templates/text/text.tsx +1 -0
- package/templates/text-morph/text-morph.tsx +2 -0
- package/templates/text-shimmer/text-shimmer.tsx +1 -0
- package/templates/textarea/textarea.tsx +1 -0
- package/templates/toast/toast.tsx +10 -1
- package/templates/toggle/toggle.tsx +1 -0
- package/templates/toggle-group/toggle-group.tsx +2 -0
- package/templates/toolbar/toolbar.tsx +6 -0
- package/templates/tooltip/tooltip.tsx +9 -3
|
@@ -8,6 +8,16 @@ import { type AgentOpenParts, useAgentOpen, useHasAgent, useMergedRef } from "@/
|
|
|
8
8
|
|
|
9
9
|
const ContextMenuAgentContext = React.createContext<(AgentOpenParts & { disabled?: boolean }) | null>(null)
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Base UI places the popup at the point a right-click or long press set. Opened any other
|
|
13
|
+
* way, by an agent or a controlled `open`, there is no such point and it lands in the top
|
|
14
|
+
* left corner, so the positioner anchors on the middle of the trigger area instead.
|
|
15
|
+
*/
|
|
16
|
+
const ContextMenuAnchorContext = React.createContext<{
|
|
17
|
+
pointed: React.RefObject<boolean>
|
|
18
|
+
trigger: React.RefObject<HTMLElement | null>
|
|
19
|
+
} | null>(null)
|
|
20
|
+
|
|
11
21
|
/**
|
|
12
22
|
* Base UI's root, holding its own open state so an agent can open and close it. Closed,
|
|
13
23
|
* the agent sees the trigger area, named by its `aria-label` or text; open, the popup.
|
|
@@ -20,10 +30,20 @@ const ContextMenu: React.FC<React.ComponentProps<typeof BaseContextMenu.Root>> =
|
|
|
20
30
|
...props
|
|
21
31
|
}) => {
|
|
22
32
|
const [state, change, parts] = useAgentOpen("menu", open, defaultOpen, onOpenChange)
|
|
33
|
+
const pointed = React.useRef(false)
|
|
34
|
+
const trigger = React.useRef<HTMLElement | null>(null)
|
|
35
|
+
const anchor = React.useMemo(() => ({ pointed, trigger }), [])
|
|
36
|
+
if (!state) pointed.current = false
|
|
37
|
+
const onChange: typeof change = (next, details) => {
|
|
38
|
+
if (next) pointed.current = details.reason === "trigger-press"
|
|
39
|
+
change(next, details)
|
|
40
|
+
}
|
|
23
41
|
return (
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
42
|
+
<ContextMenuAnchorContext.Provider value={anchor}>
|
|
43
|
+
<ContextMenuAgentContext.Provider value={useHasAgent() ? { ...parts, disabled: props.disabled } : null}>
|
|
44
|
+
<BaseContextMenu.Root {...props} open={state} onOpenChange={onChange} />
|
|
45
|
+
</ContextMenuAgentContext.Provider>
|
|
46
|
+
</ContextMenuAnchorContext.Provider>
|
|
27
47
|
)
|
|
28
48
|
}
|
|
29
49
|
ContextMenu.displayName = "ContextMenu"
|
|
@@ -33,11 +53,13 @@ const ContextMenuTrigger = React.forwardRef<
|
|
|
33
53
|
React.ComponentProps<typeof BaseContextMenu.Trigger>
|
|
34
54
|
>(({ className, ...props }, ref) => {
|
|
35
55
|
const agent = React.useContext(ContextMenuAgentContext)
|
|
56
|
+
const anchor = React.useContext(ContextMenuAnchorContext)
|
|
36
57
|
return (
|
|
37
58
|
<BaseContextMenu.Trigger
|
|
38
|
-
ref={useMergedRef(ref, agent?.trigger)}
|
|
59
|
+
ref={useMergedRef(ref, agent?.trigger, anchor?.trigger)}
|
|
39
60
|
data-disabled={agent?.disabled ? "" : undefined}
|
|
40
61
|
className={cn("select-none", className)}
|
|
62
|
+
data-slot="context-menu-trigger"
|
|
41
63
|
{...props}
|
|
42
64
|
/>
|
|
43
65
|
)
|
|
@@ -46,19 +68,34 @@ ContextMenuTrigger.displayName = "ContextMenuTrigger"
|
|
|
46
68
|
|
|
47
69
|
const ContextMenuPortal: React.FC<
|
|
48
70
|
React.ComponentProps<typeof BaseContextMenu.Portal>
|
|
49
|
-
> = (props) => <BaseContextMenu.Portal {...props} />
|
|
71
|
+
> = (props) => <BaseContextMenu.Portal data-slot="context-menu-portal" {...props} />
|
|
50
72
|
ContextMenuPortal.displayName = "ContextMenuPortal"
|
|
51
73
|
|
|
52
74
|
const ContextMenuPositioner = React.forwardRef<
|
|
53
75
|
React.ComponentRef<typeof BaseContextMenu.Positioner>,
|
|
54
76
|
React.ComponentProps<typeof BaseContextMenu.Positioner>
|
|
55
|
-
>(({ className, ...props }, ref) =>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
77
|
+
>(({ className, anchor, ...props }, ref) => {
|
|
78
|
+
const ctx = React.useContext(ContextMenuAnchorContext)
|
|
79
|
+
const middle = React.useMemo(
|
|
80
|
+
() =>
|
|
81
|
+
ctx && {
|
|
82
|
+
getBoundingClientRect() {
|
|
83
|
+
const r = ctx.trigger.current?.getBoundingClientRect()
|
|
84
|
+
return r ? DOMRect.fromRect({ x: r.x + r.width / 2, y: r.y + r.height / 2, width: 0, height: 0 }) : new DOMRect()
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
[ctx]
|
|
88
|
+
)
|
|
89
|
+
return (
|
|
90
|
+
<BaseContextMenu.Positioner
|
|
91
|
+
ref={ref}
|
|
92
|
+
anchor={anchor ?? (ctx && !ctx.pointed.current ? middle : undefined)}
|
|
93
|
+
className={cn("z-50 outline-none", className)}
|
|
94
|
+
data-slot="context-menu-positioner"
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
)
|
|
98
|
+
})
|
|
62
99
|
ContextMenuPositioner.displayName = "ContextMenuPositioner"
|
|
63
100
|
|
|
64
101
|
const ContextMenuContent = React.forwardRef<
|
|
@@ -79,6 +116,7 @@ const ContextMenuContent = React.forwardRef<
|
|
|
79
116
|
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
80
117
|
className
|
|
81
118
|
)}
|
|
119
|
+
data-slot="context-menu-content"
|
|
82
120
|
{...props}
|
|
83
121
|
/>
|
|
84
122
|
</ContextMenuPositioner>
|
|
@@ -102,6 +140,7 @@ const ContextMenuItem = React.forwardRef<
|
|
|
102
140
|
inset && "pl-8",
|
|
103
141
|
className
|
|
104
142
|
)}
|
|
143
|
+
data-slot="context-menu-item"
|
|
105
144
|
{...props}
|
|
106
145
|
/>
|
|
107
146
|
))
|
|
@@ -119,6 +158,7 @@ const ContextMenuLinkItem = React.forwardRef<
|
|
|
119
158
|
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
120
159
|
className
|
|
121
160
|
)}
|
|
161
|
+
data-slot="context-menu-link-item"
|
|
122
162
|
{...props}
|
|
123
163
|
/>
|
|
124
164
|
))
|
|
@@ -137,6 +177,7 @@ const ContextMenuCheckboxItem = React.forwardRef<
|
|
|
137
177
|
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
138
178
|
className
|
|
139
179
|
)}
|
|
180
|
+
data-slot="context-menu-checkbox-item"
|
|
140
181
|
{...props}
|
|
141
182
|
>
|
|
142
183
|
<BaseContextMenu.CheckboxItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
@@ -151,7 +192,7 @@ const ContextMenuRadioGroup = React.forwardRef<
|
|
|
151
192
|
React.ComponentRef<typeof BaseContextMenu.RadioGroup>,
|
|
152
193
|
React.ComponentProps<typeof BaseContextMenu.RadioGroup>
|
|
153
194
|
>(({ className, ...props }, ref) => (
|
|
154
|
-
<BaseContextMenu.RadioGroup ref={ref} className={className} {...props} />
|
|
195
|
+
<BaseContextMenu.RadioGroup ref={ref} className={className} data-slot="context-menu-radio-group" {...props} />
|
|
155
196
|
))
|
|
156
197
|
ContextMenuRadioGroup.displayName = "ContextMenuRadioGroup"
|
|
157
198
|
|
|
@@ -168,6 +209,7 @@ const ContextMenuRadioItem = React.forwardRef<
|
|
|
168
209
|
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
169
210
|
className
|
|
170
211
|
)}
|
|
212
|
+
data-slot="context-menu-radio-item"
|
|
171
213
|
{...props}
|
|
172
214
|
>
|
|
173
215
|
<BaseContextMenu.RadioItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
@@ -182,7 +224,7 @@ const ContextMenuGroup = React.forwardRef<
|
|
|
182
224
|
React.ComponentRef<typeof BaseContextMenu.Group>,
|
|
183
225
|
React.ComponentProps<typeof BaseContextMenu.Group>
|
|
184
226
|
>(({ className, ...props }, ref) => (
|
|
185
|
-
<BaseContextMenu.Group ref={ref} className={className} {...props} />
|
|
227
|
+
<BaseContextMenu.Group ref={ref} className={className} data-slot="context-menu-group" {...props} />
|
|
186
228
|
))
|
|
187
229
|
ContextMenuGroup.displayName = "ContextMenuGroup"
|
|
188
230
|
|
|
@@ -199,6 +241,7 @@ const ContextMenuLabel = React.forwardRef<
|
|
|
199
241
|
inset && "pl-8",
|
|
200
242
|
className
|
|
201
243
|
)}
|
|
244
|
+
data-slot="context-menu-label"
|
|
202
245
|
{...props}
|
|
203
246
|
/>
|
|
204
247
|
))
|
|
@@ -211,6 +254,7 @@ const ContextMenuSeparator = React.forwardRef<
|
|
|
211
254
|
<BaseContextMenu.Separator
|
|
212
255
|
ref={ref}
|
|
213
256
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
257
|
+
data-slot="context-menu-separator"
|
|
214
258
|
{...props}
|
|
215
259
|
/>
|
|
216
260
|
))
|
|
@@ -225,6 +269,7 @@ const ContextMenuShortcut = ({
|
|
|
225
269
|
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
226
270
|
className
|
|
227
271
|
)}
|
|
272
|
+
data-slot="context-menu-shortcut"
|
|
228
273
|
{...props}
|
|
229
274
|
/>
|
|
230
275
|
)
|
|
@@ -252,6 +297,7 @@ const ContextMenuSubTrigger = React.forwardRef<
|
|
|
252
297
|
inset && "pl-8",
|
|
253
298
|
className
|
|
254
299
|
)}
|
|
300
|
+
data-slot="context-menu-sub-trigger"
|
|
255
301
|
{...props}
|
|
256
302
|
>
|
|
257
303
|
{children}
|
|
@@ -278,6 +324,7 @@ const ContextMenuSubContent = React.forwardRef<
|
|
|
278
324
|
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
279
325
|
className
|
|
280
326
|
)}
|
|
327
|
+
data-slot="context-menu-sub-content"
|
|
281
328
|
{...props}
|
|
282
329
|
/>
|
|
283
330
|
</BaseContextMenu.Positioner>
|
|
@@ -23,10 +23,12 @@ function Dialog<Payload>({ open, defaultOpen, onOpenChange, ...props }: BaseDial
|
|
|
23
23
|
|
|
24
24
|
function DialogTrigger<Payload>({ ref, ...props }: BaseDialog.Trigger.Props<Payload> & React.RefAttributes<HTMLElement>) {
|
|
25
25
|
const dialog = React.useContext(DialogAgentContext)
|
|
26
|
-
return <BaseDialog.Trigger<Payload> ref={useMergedRef(ref, dialog?.trigger)} {...props} />
|
|
26
|
+
return <BaseDialog.Trigger<Payload> ref={useMergedRef(ref, dialog?.trigger)} data-slot="dialog-trigger" {...props} />
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
function DialogPortal(props: React.ComponentProps<typeof BaseDialog.Portal>) {
|
|
30
|
+
return <BaseDialog.Portal data-slot="dialog-portal" {...props} />
|
|
31
|
+
}
|
|
30
32
|
|
|
31
33
|
const DialogBackdrop = React.forwardRef<
|
|
32
34
|
HTMLDivElement,
|
|
@@ -41,6 +43,7 @@ const DialogBackdrop = React.forwardRef<
|
|
|
41
43
|
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
42
44
|
className
|
|
43
45
|
)}
|
|
46
|
+
data-slot="dialog-backdrop"
|
|
44
47
|
{...props}
|
|
45
48
|
/>
|
|
46
49
|
))
|
|
@@ -56,6 +59,7 @@ const DialogViewport = React.forwardRef<
|
|
|
56
59
|
"fixed inset-0 z-50 flex items-center justify-center overflow-auto",
|
|
57
60
|
className
|
|
58
61
|
)}
|
|
62
|
+
data-slot="dialog-viewport"
|
|
59
63
|
{...props}
|
|
60
64
|
/>
|
|
61
65
|
))
|
|
@@ -83,6 +87,7 @@ const DialogPopup = React.forwardRef<
|
|
|
83
87
|
"data-[ending-style]:duration-[var(--motion-duration-fast,150ms)]",
|
|
84
88
|
className
|
|
85
89
|
)}
|
|
90
|
+
data-slot="dialog-popup"
|
|
86
91
|
{...props}
|
|
87
92
|
/>
|
|
88
93
|
)
|
|
@@ -96,6 +101,7 @@ const DialogTitle = React.forwardRef<
|
|
|
96
101
|
<BaseDialog.Title
|
|
97
102
|
ref={ref}
|
|
98
103
|
className={cn("text-lg font-medium leading-none tracking-tight", className)}
|
|
104
|
+
data-slot="dialog-title"
|
|
99
105
|
{...props}
|
|
100
106
|
/>
|
|
101
107
|
))
|
|
@@ -108,6 +114,7 @@ const DialogDescription = React.forwardRef<
|
|
|
108
114
|
<BaseDialog.Description
|
|
109
115
|
ref={ref}
|
|
110
116
|
className={cn("text-sm text-muted-foreground", className)}
|
|
117
|
+
data-slot="dialog-description"
|
|
111
118
|
{...props}
|
|
112
119
|
/>
|
|
113
120
|
))
|
|
@@ -130,6 +137,7 @@ const DialogClose = React.forwardRef<
|
|
|
130
137
|
className,
|
|
131
138
|
)
|
|
132
139
|
}
|
|
140
|
+
data-slot="dialog-close"
|
|
133
141
|
{...props}
|
|
134
142
|
/>
|
|
135
143
|
))
|
|
@@ -144,6 +152,7 @@ const DialogHeader = ({
|
|
|
144
152
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
145
153
|
className
|
|
146
154
|
)}
|
|
155
|
+
data-slot="dialog-header"
|
|
147
156
|
{...props}
|
|
148
157
|
/>
|
|
149
158
|
)
|
|
@@ -158,6 +167,7 @@ const DialogFooter = ({
|
|
|
158
167
|
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-1.5",
|
|
159
168
|
className
|
|
160
169
|
)}
|
|
170
|
+
data-slot="dialog-footer"
|
|
161
171
|
{...props}
|
|
162
172
|
/>
|
|
163
173
|
)
|
|
@@ -170,7 +180,7 @@ const DialogContent = React.forwardRef<
|
|
|
170
180
|
<DialogPortal>
|
|
171
181
|
<DialogBackdrop />
|
|
172
182
|
<DialogViewport>
|
|
173
|
-
<DialogPopup ref={ref} className={className} {...props}>
|
|
183
|
+
<DialogPopup ref={ref} className={className} data-slot="dialog-content" {...props}>
|
|
174
184
|
{children}
|
|
175
185
|
</DialogPopup>
|
|
176
186
|
</DialogViewport>
|
|
@@ -19,11 +19,20 @@ function Drawer<Payload>({ open, defaultOpen, onOpenChange, ...props }: DrawerPr
|
|
|
19
19
|
|
|
20
20
|
function DrawerTrigger<Payload>({ ref, ...props }: DrawerPrimitive.Trigger.Props<Payload> & React.RefAttributes<HTMLElement>) {
|
|
21
21
|
const parts = React.useContext(DrawerAgentContext)
|
|
22
|
-
return <DrawerPrimitive.Trigger<Payload> ref={useMergedRef(ref, parts?.trigger)} {...props} />
|
|
22
|
+
return <DrawerPrimitive.Trigger<Payload> ref={useMergedRef(ref, parts?.trigger)} data-slot="drawer-trigger" {...props} />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function DrawerPortal(props: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
26
|
+
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function DrawerClose(props: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
30
|
+
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function DrawerSwipeArea(props: React.ComponentProps<typeof DrawerPrimitive.SwipeArea>) {
|
|
34
|
+
return <DrawerPrimitive.SwipeArea data-slot="drawer-swipe-area" {...props} />
|
|
23
35
|
}
|
|
24
|
-
const DrawerPortal = DrawerPrimitive.Portal
|
|
25
|
-
const DrawerClose = DrawerPrimitive.Close
|
|
26
|
-
const DrawerSwipeArea = DrawerPrimitive.SwipeArea
|
|
27
36
|
|
|
28
37
|
const DrawerBackdrop = React.forwardRef<
|
|
29
38
|
React.ComponentRef<typeof DrawerPrimitive.Backdrop>,
|
|
@@ -44,6 +53,7 @@ const DrawerBackdrop = React.forwardRef<
|
|
|
44
53
|
"data-[swiping]:transition-none",
|
|
45
54
|
className
|
|
46
55
|
)}
|
|
56
|
+
data-slot="drawer-backdrop"
|
|
47
57
|
{...props}
|
|
48
58
|
/>
|
|
49
59
|
))
|
|
@@ -89,6 +99,7 @@ const DrawerContent = React.forwardRef<
|
|
|
89
99
|
"motion-reduce:data-[ending-style]:translate-x-0 motion-reduce:data-[ending-style]:translate-y-0 motion-reduce:data-[ending-style]:opacity-0",
|
|
90
100
|
className
|
|
91
101
|
)}
|
|
102
|
+
data-slot="drawer-content"
|
|
92
103
|
{...props}
|
|
93
104
|
>
|
|
94
105
|
<DrawerPrimitive.Content className="size-full overflow-y-auto">
|
|
@@ -107,6 +118,7 @@ function DrawerTitle({
|
|
|
107
118
|
return (
|
|
108
119
|
<DrawerPrimitive.Title
|
|
109
120
|
className={cn("text-lg font-medium leading-none tracking-tight", className)}
|
|
121
|
+
data-slot="drawer-title"
|
|
110
122
|
{...props}
|
|
111
123
|
/>
|
|
112
124
|
)
|
|
@@ -119,18 +131,19 @@ function DrawerDescription({
|
|
|
119
131
|
return (
|
|
120
132
|
<DrawerPrimitive.Description
|
|
121
133
|
className={cn("text-sm text-muted-foreground", className)}
|
|
134
|
+
data-slot="drawer-description"
|
|
122
135
|
{...props}
|
|
123
136
|
/>
|
|
124
137
|
)
|
|
125
138
|
}
|
|
126
139
|
|
|
127
140
|
const DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
128
|
-
<div className={cn("flex flex-col gap-1.5 text-center sm:text-left", className)} {...props} />
|
|
141
|
+
<div className={cn("flex flex-col gap-1.5 text-center sm:text-left", className)} data-slot="drawer-header" {...props} />
|
|
129
142
|
)
|
|
130
143
|
DrawerHeader.displayName = "DrawerHeader"
|
|
131
144
|
|
|
132
145
|
const DrawerFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
133
|
-
<div className={cn("mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end", className)} {...props} />
|
|
146
|
+
<div className={cn("mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end", className)} data-slot="drawer-footer" {...props} />
|
|
134
147
|
)
|
|
135
148
|
DrawerFooter.displayName = "DrawerFooter"
|
|
136
149
|
|
|
@@ -134,7 +134,7 @@ const ExpandableCard = React.forwardRef<HTMLDivElement, ExpandableCardProps>(
|
|
|
134
134
|
|
|
135
135
|
return (
|
|
136
136
|
<ExpandableCardContext.Provider value={context}>
|
|
137
|
-
<div ref={ref} className={cn("relative", className)} {...props} />
|
|
137
|
+
<div ref={ref} className={cn("relative", className)} data-slot="expandable-card" {...props} />
|
|
138
138
|
</ExpandableCardContext.Provider>
|
|
139
139
|
)
|
|
140
140
|
}
|
|
@@ -171,6 +171,7 @@ const ExpandableCardTrigger = React.forwardRef<
|
|
|
171
171
|
"block w-full overflow-hidden rounded-2xl border border-border bg-background text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
172
172
|
className
|
|
173
173
|
)}
|
|
174
|
+
data-slot="expandable-card-trigger"
|
|
174
175
|
{...props}
|
|
175
176
|
/>
|
|
176
177
|
)
|
|
@@ -326,6 +327,7 @@ const ExpandableCardPanel = React.forwardRef<HTMLDivElement, ExpandableCardPanel
|
|
|
326
327
|
panelSurface(fullscreen),
|
|
327
328
|
className
|
|
328
329
|
)}
|
|
330
|
+
data-slot="expandable-card-panel"
|
|
329
331
|
{...props}
|
|
330
332
|
>
|
|
331
333
|
<ExitMark panel={panel} />
|
|
@@ -391,6 +393,7 @@ const ExpandableCardShared = React.forwardRef<HTMLDivElement, ExpandableCardShar
|
|
|
391
393
|
ref={ref}
|
|
392
394
|
layoutId={layoutId(part)}
|
|
393
395
|
transition={transition}
|
|
396
|
+
data-slot="expandable-card-shared"
|
|
394
397
|
{...props}
|
|
395
398
|
/>
|
|
396
399
|
)
|
|
@@ -418,6 +421,7 @@ const ExpandableCardBody = React.forwardRef<HTMLDivElement, ExpandableCardBodyPr
|
|
|
418
421
|
animate={{ opacity: 1, y: 0 }}
|
|
419
422
|
transition={{ delay: reducedMotion ? 0 : 0.16, duration: 0.24 }}
|
|
420
423
|
className={cn("text-sm leading-relaxed text-muted-foreground", className)}
|
|
424
|
+
data-slot="expandable-card-body"
|
|
421
425
|
{...props}
|
|
422
426
|
/>
|
|
423
427
|
)
|
|
@@ -6,7 +6,7 @@ const Field = React.forwardRef<
|
|
|
6
6
|
HTMLDivElement,
|
|
7
7
|
React.ComponentProps<typeof BaseField.Root>
|
|
8
8
|
>(({ className, ...props }, ref) => (
|
|
9
|
-
<BaseField.Root ref={ref} className={cn("space-y-2", className)} {...props} />
|
|
9
|
+
<BaseField.Root ref={ref} data-slot="field" className={cn("space-y-2", className)} {...props} />
|
|
10
10
|
));
|
|
11
11
|
Field.displayName = "Field";
|
|
12
12
|
|
|
@@ -16,6 +16,7 @@ const FieldLabel = React.forwardRef<
|
|
|
16
16
|
>(({ className, ...props }, ref) => (
|
|
17
17
|
<BaseField.Label
|
|
18
18
|
ref={ref}
|
|
19
|
+
data-slot="field-label"
|
|
19
20
|
className={cn(
|
|
20
21
|
"text-sm font-medium leading-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-70",
|
|
21
22
|
"data-[invalid]:text-destructive",
|
|
@@ -32,6 +33,7 @@ const FieldControl = React.forwardRef<
|
|
|
32
33
|
>(({ className, ...props }, ref) => (
|
|
33
34
|
<BaseField.Control
|
|
34
35
|
ref={ref}
|
|
36
|
+
data-slot="field-control"
|
|
35
37
|
className={cn(
|
|
36
38
|
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
|
|
37
39
|
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
|
|
@@ -52,6 +54,7 @@ const FieldDescription = React.forwardRef<
|
|
|
52
54
|
>(({ className, ...props }, ref) => (
|
|
53
55
|
<BaseField.Description
|
|
54
56
|
ref={ref}
|
|
57
|
+
data-slot="field-description"
|
|
55
58
|
className={cn(
|
|
56
59
|
"text-sm text-muted-foreground",
|
|
57
60
|
"data-[disabled]:opacity-50",
|
|
@@ -69,6 +72,7 @@ const FieldError = React.forwardRef<
|
|
|
69
72
|
// Tells the agent bridge this describes what is wrong, not what the field is for.
|
|
70
73
|
<BaseField.Error
|
|
71
74
|
ref={ref}
|
|
75
|
+
data-slot="field-error"
|
|
72
76
|
data-agent-error=""
|
|
73
77
|
className={cn(
|
|
74
78
|
"text-sm font-medium text-destructive",
|
|
@@ -10,6 +10,7 @@ const Fieldset = React.forwardRef<
|
|
|
10
10
|
>(({ className, ...props }, ref) => (
|
|
11
11
|
<FieldsetPrimitive.Root
|
|
12
12
|
ref={ref}
|
|
13
|
+
data-slot="fieldset"
|
|
13
14
|
className={cn("space-y-3 rounded-lg border p-4", className)}
|
|
14
15
|
{...props}
|
|
15
16
|
/>
|
|
@@ -22,6 +23,7 @@ const FieldsetLegend = React.forwardRef<
|
|
|
22
23
|
>(({ className, ...props }, ref) => (
|
|
23
24
|
<FieldsetPrimitive.Legend
|
|
24
25
|
ref={ref}
|
|
26
|
+
data-slot="fieldset-legend"
|
|
25
27
|
className={cn("px-1 text-sm font-medium", className)}
|
|
26
28
|
{...props}
|
|
27
29
|
/>
|
package/templates/form/form.tsx
CHANGED
|
@@ -618,6 +618,7 @@ const HoldToConfirm = React.forwardRef<HTMLButtonElement, HoldToConfirmProps>(
|
|
|
618
618
|
"data-holding": isHolding || undefined,
|
|
619
619
|
"data-confirmed": confirmed || undefined,
|
|
620
620
|
className: shellClass(variant, reducedMotion, className),
|
|
621
|
+
"data-slot": "hold-to-confirm",
|
|
621
622
|
...props,
|
|
622
623
|
...holdHandlers(props, start, cancel),
|
|
623
624
|
children: (
|
|
@@ -65,6 +65,7 @@ const Input = React.forwardRef<
|
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
67
|
<BaseInput
|
|
68
|
+
data-slot="input"
|
|
68
69
|
className={cn(
|
|
69
70
|
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
70
71
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
package/templates/link/link.tsx
CHANGED
|
@@ -85,6 +85,7 @@ const LoadTransition = React.forwardRef<HTMLDivElement, LoadTransitionProps>(
|
|
|
85
85
|
"relative overflow-hidden border border-border bg-background p-4",
|
|
86
86
|
className
|
|
87
87
|
)}
|
|
88
|
+
data-slot="load-transition"
|
|
88
89
|
{...props}
|
|
89
90
|
>
|
|
90
91
|
<AnimatePresence mode="popLayout" initial={false}>
|
package/templates/menu/menu.tsx
CHANGED
|
@@ -41,6 +41,7 @@ const MenuTrigger = React.forwardRef<
|
|
|
41
41
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
42
42
|
className
|
|
43
43
|
)}
|
|
44
|
+
data-slot="menu-trigger"
|
|
44
45
|
{...props}
|
|
45
46
|
/>
|
|
46
47
|
))
|
|
@@ -48,7 +49,7 @@ MenuTrigger.displayName = "MenuTrigger"
|
|
|
48
49
|
|
|
49
50
|
const MenuPortal: React.FC<
|
|
50
51
|
React.ComponentProps<typeof MenuPrimitive.Portal>
|
|
51
|
-
> = (props) => <MenuPrimitive.Portal {...props} />
|
|
52
|
+
> = (props) => <MenuPrimitive.Portal data-slot="menu-portal" {...props} />
|
|
52
53
|
MenuPortal.displayName = "MenuPortal"
|
|
53
54
|
|
|
54
55
|
const MenuPositioner = React.forwardRef<
|
|
@@ -59,6 +60,7 @@ const MenuPositioner = React.forwardRef<
|
|
|
59
60
|
ref={ref}
|
|
60
61
|
className={cn("z-50 outline-none", className)}
|
|
61
62
|
sideOffset={6}
|
|
63
|
+
data-slot="menu-positioner"
|
|
62
64
|
{...props}
|
|
63
65
|
/>
|
|
64
66
|
))
|
|
@@ -81,6 +83,7 @@ const MenuContent = React.forwardRef<
|
|
|
81
83
|
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
82
84
|
className
|
|
83
85
|
)}
|
|
86
|
+
data-slot="menu-content"
|
|
84
87
|
{...props}
|
|
85
88
|
/>
|
|
86
89
|
</MenuPositioner>
|
|
@@ -104,6 +107,7 @@ const MenuItem = React.forwardRef<
|
|
|
104
107
|
inset && "pl-8",
|
|
105
108
|
className
|
|
106
109
|
)}
|
|
110
|
+
data-slot="menu-item"
|
|
107
111
|
{...props}
|
|
108
112
|
/>
|
|
109
113
|
))
|
|
@@ -121,6 +125,7 @@ const MenuLinkItem = React.forwardRef<
|
|
|
121
125
|
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
122
126
|
className
|
|
123
127
|
)}
|
|
128
|
+
data-slot="menu-link-item"
|
|
124
129
|
{...props}
|
|
125
130
|
/>
|
|
126
131
|
))
|
|
@@ -139,6 +144,7 @@ const MenuCheckboxItem = React.forwardRef<
|
|
|
139
144
|
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
140
145
|
className
|
|
141
146
|
)}
|
|
147
|
+
data-slot="menu-checkbox-item"
|
|
142
148
|
{...props}
|
|
143
149
|
>
|
|
144
150
|
<MenuPrimitive.CheckboxItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
@@ -153,7 +159,7 @@ const MenuRadioGroup = React.forwardRef<
|
|
|
153
159
|
React.ComponentRef<typeof MenuPrimitive.RadioGroup>,
|
|
154
160
|
React.ComponentProps<typeof MenuPrimitive.RadioGroup>
|
|
155
161
|
>(({ className, ...props }, ref) => (
|
|
156
|
-
<MenuPrimitive.RadioGroup ref={ref} className={className} {...props} />
|
|
162
|
+
<MenuPrimitive.RadioGroup ref={ref} className={className} data-slot="menu-radio-group" {...props} />
|
|
157
163
|
))
|
|
158
164
|
MenuRadioGroup.displayName = "MenuRadioGroup"
|
|
159
165
|
|
|
@@ -170,6 +176,7 @@ const MenuRadioItem = React.forwardRef<
|
|
|
170
176
|
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
171
177
|
className
|
|
172
178
|
)}
|
|
179
|
+
data-slot="menu-radio-item"
|
|
173
180
|
{...props}
|
|
174
181
|
>
|
|
175
182
|
<MenuPrimitive.RadioItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
@@ -184,7 +191,7 @@ const MenuGroup = React.forwardRef<
|
|
|
184
191
|
React.ComponentRef<typeof MenuPrimitive.Group>,
|
|
185
192
|
React.ComponentProps<typeof MenuPrimitive.Group>
|
|
186
193
|
>(({ className, ...props }, ref) => (
|
|
187
|
-
<MenuPrimitive.Group ref={ref} className={className} {...props} />
|
|
194
|
+
<MenuPrimitive.Group ref={ref} className={className} data-slot="menu-group" {...props} />
|
|
188
195
|
))
|
|
189
196
|
MenuGroup.displayName = "MenuGroup"
|
|
190
197
|
|
|
@@ -197,6 +204,7 @@ const MenuLabel = React.forwardRef<
|
|
|
197
204
|
<MenuPrimitive.GroupLabel
|
|
198
205
|
ref={ref}
|
|
199
206
|
className={cn("px-2 py-1.5 text-sm font-medium", inset && "pl-8", className)}
|
|
207
|
+
data-slot="menu-label"
|
|
200
208
|
{...props}
|
|
201
209
|
/>
|
|
202
210
|
))
|
|
@@ -209,6 +217,7 @@ const MenuSeparator = React.forwardRef<
|
|
|
209
217
|
<MenuPrimitive.Separator
|
|
210
218
|
ref={ref}
|
|
211
219
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
220
|
+
data-slot="menu-separator"
|
|
212
221
|
{...props}
|
|
213
222
|
/>
|
|
214
223
|
))
|
|
@@ -220,6 +229,7 @@ const MenuShortcut = ({
|
|
|
220
229
|
}: React.HTMLAttributes<HTMLSpanElement>) => (
|
|
221
230
|
<span
|
|
222
231
|
className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
|
|
232
|
+
data-slot="menu-shortcut"
|
|
223
233
|
{...props}
|
|
224
234
|
/>
|
|
225
235
|
)
|
|
@@ -247,6 +257,7 @@ const MenuSubTrigger = React.forwardRef<
|
|
|
247
257
|
inset && "pl-8",
|
|
248
258
|
className
|
|
249
259
|
)}
|
|
260
|
+
data-slot="menu-sub-trigger"
|
|
250
261
|
{...props}
|
|
251
262
|
>
|
|
252
263
|
{children}
|
|
@@ -272,6 +283,7 @@ const MenuSubContent = React.forwardRef<
|
|
|
272
283
|
"motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
|
|
273
284
|
className
|
|
274
285
|
)}
|
|
286
|
+
data-slot="menu-sub-content"
|
|
275
287
|
{...props}
|
|
276
288
|
/>
|
|
277
289
|
</MenuPrimitive.Positioner>
|
|
@@ -298,6 +310,7 @@ const MenuInput = React.forwardRef<
|
|
|
298
310
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
299
311
|
className
|
|
300
312
|
)}
|
|
313
|
+
data-slot="menu-input"
|
|
301
314
|
{...props}
|
|
302
315
|
/>
|
|
303
316
|
{children}
|
|
@@ -317,6 +330,7 @@ const MenuClear = React.forwardRef<
|
|
|
317
330
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
318
331
|
className
|
|
319
332
|
)}
|
|
333
|
+
data-slot="menu-clear"
|
|
320
334
|
{...props}
|
|
321
335
|
>
|
|
322
336
|
{children ?? <X className="h-4 w-4" />}
|
|
@@ -331,6 +345,7 @@ const MenuEmpty = React.forwardRef<
|
|
|
331
345
|
<MenuPrimitive.Empty
|
|
332
346
|
ref={ref}
|
|
333
347
|
className={cn("py-6 text-center text-sm text-muted-foreground", className)}
|
|
348
|
+
data-slot="menu-empty"
|
|
334
349
|
{...props}
|
|
335
350
|
/>
|
|
336
351
|
))
|
|
@@ -347,6 +362,7 @@ const MenuList = React.forwardRef<
|
|
|
347
362
|
"[&>[data-filter-section]:not([hidden])~[data-filter-section]:not([hidden])>[data-filter-separator]]:block",
|
|
348
363
|
className
|
|
349
364
|
)}
|
|
365
|
+
data-slot="menu-list"
|
|
350
366
|
{...props}
|
|
351
367
|
/>
|
|
352
368
|
))
|