@dinachi/cli 0.6.3 → 0.7.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/dist/index.js +133 -34
- package/package.json +2 -3
- package/templates/alert-dialog/alert-dialog.tsx +62 -47
- package/templates/autocomplete/autocomplete.tsx +7 -7
- 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 +5 -5
- 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/menubar.tsx +44 -72
- package/templates/navigation-menu/navigation-menu.tsx +61 -18
- package/templates/popover/index.ts +4 -1
- package/templates/popover/popover.tsx +80 -30
- 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 +75 -73
- 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 +137 -74
- 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
package/templates/form/form.tsx
CHANGED
|
@@ -2,78 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Form as BaseForm } from "@base-ui/react/form"
|
|
5
|
-
import { useRender } from "@base-ui/react/use-render"
|
|
6
|
-
import { mergeProps } from "@base-ui/react/merge-props"
|
|
7
5
|
import { cn } from "@/lib/utils"
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
export type Errors = Record<string, string | string[]>
|
|
11
|
-
|
|
12
|
-
// Form state interface
|
|
13
|
-
export interface FormState extends Record<string, unknown> {
|
|
14
|
-
errors: Errors
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Form component props interface using useRender types
|
|
18
|
-
export interface FormProps extends useRender.ComponentProps<'form', FormState> {
|
|
19
|
-
/**
|
|
20
|
-
* Object containing field errors where keys are field names and values are error messages.
|
|
21
|
-
* Errors are automatically cleared when the value changes (Base UI 1.0.0+).
|
|
22
|
-
*/
|
|
23
|
-
errors?: Errors
|
|
24
|
-
/**
|
|
25
|
-
* Form submission handler
|
|
26
|
-
*/
|
|
27
|
-
onSubmit?: React.FormEventHandler<HTMLFormElement>
|
|
28
|
-
}
|
|
7
|
+
export type FormProps = React.ComponentProps<typeof BaseForm>
|
|
29
8
|
|
|
30
9
|
const Form = React.forwardRef<
|
|
31
10
|
HTMLFormElement,
|
|
32
11
|
FormProps
|
|
33
|
-
>(({ className,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (render && typeof render === 'function') {
|
|
41
|
-
// Function render prop
|
|
42
|
-
const defaultProps = {
|
|
43
|
-
className: cn("space-y-4", className),
|
|
44
|
-
onSubmit
|
|
45
|
-
}
|
|
46
|
-
const formProps = mergeProps<'form'>(defaultProps, props)
|
|
47
|
-
|
|
48
|
-
const element = useRender({
|
|
49
|
-
render,
|
|
50
|
-
props: formProps,
|
|
51
|
-
state: formState,
|
|
52
|
-
ref
|
|
53
|
-
})
|
|
54
|
-
return element
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (render && React.isValidElement(render) && render.type !== 'form') {
|
|
58
|
-
// Element render prop - return the element directly (but not if it's the default <form />)
|
|
59
|
-
return render
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Default rendering using BaseForm
|
|
63
|
-
return (
|
|
64
|
-
<BaseForm
|
|
65
|
-
ref={ref}
|
|
66
|
-
className={cn("space-y-4", className)}
|
|
67
|
-
errors={errors}
|
|
68
|
-
onSubmit={onSubmit}
|
|
69
|
-
role="form"
|
|
70
|
-
{...props}
|
|
71
|
-
>
|
|
72
|
-
{children}
|
|
73
|
-
</BaseForm>
|
|
74
|
-
)
|
|
75
|
-
})
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<BaseForm
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn("space-y-4", className)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
))
|
|
76
19
|
|
|
77
20
|
Form.displayName = "Form"
|
|
78
21
|
|
|
79
|
-
export { Form }
|
|
22
|
+
export { Form }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Label } from "./label"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const Label = React.forwardRef<
|
|
7
|
+
HTMLLabelElement,
|
|
8
|
+
React.ComponentProps<"label">
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<label
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
))
|
|
19
|
+
Label.displayName = "Label"
|
|
20
|
+
|
|
21
|
+
export { Label }
|
package/templates/menu/index.ts
CHANGED
package/templates/menu/menu.tsx
CHANGED
|
@@ -2,22 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
5
|
-
import { useRender } from "@base-ui/react/use-render"
|
|
6
5
|
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
7
6
|
import { cn } from "@/lib/utils"
|
|
8
7
|
|
|
9
|
-
const Menu
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>(({ children, ...props }, ref) => {
|
|
13
|
-
const element = useRender({
|
|
14
|
-
render: <MenuPrimitive.Root>{children}</MenuPrimitive.Root>,
|
|
15
|
-
props,
|
|
16
|
-
ref,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
return element
|
|
20
|
-
})
|
|
8
|
+
const Menu: React.FC<React.ComponentProps<typeof MenuPrimitive.Root>> = (props) => (
|
|
9
|
+
<MenuPrimitive.Root {...props} />
|
|
10
|
+
)
|
|
21
11
|
Menu.displayName = "Menu"
|
|
22
12
|
|
|
23
13
|
const MenuTrigger = React.forwardRef<
|
|
@@ -30,8 +20,8 @@ const MenuTrigger = React.forwardRef<
|
|
|
30
20
|
"inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium",
|
|
31
21
|
"hover:bg-accent hover:text-accent-foreground",
|
|
32
22
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
33
|
-
"data-popup-open:bg-accent data-popup-open:text-accent-foreground",
|
|
34
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
23
|
+
"data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
|
|
24
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
35
25
|
className
|
|
36
26
|
)}
|
|
37
27
|
{...props}
|
|
@@ -39,18 +29,9 @@ const MenuTrigger = React.forwardRef<
|
|
|
39
29
|
))
|
|
40
30
|
MenuTrigger.displayName = "MenuTrigger"
|
|
41
31
|
|
|
42
|
-
const MenuPortal
|
|
43
|
-
React.ComponentRef<typeof MenuPrimitive.Portal>,
|
|
32
|
+
const MenuPortal: React.FC<
|
|
44
33
|
React.ComponentProps<typeof MenuPrimitive.Portal>
|
|
45
|
-
>(
|
|
46
|
-
const element = useRender({
|
|
47
|
-
render: <MenuPrimitive.Portal />,
|
|
48
|
-
props,
|
|
49
|
-
ref,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
return element
|
|
53
|
-
})
|
|
34
|
+
> = (props) => <MenuPrimitive.Portal {...props} />
|
|
54
35
|
MenuPortal.displayName = "MenuPortal"
|
|
55
36
|
|
|
56
37
|
const MenuPositioner = React.forwardRef<
|
|
@@ -77,8 +58,8 @@ const MenuContent = React.forwardRef<
|
|
|
77
58
|
className={cn(
|
|
78
59
|
"z-50 min-w-40 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
79
60
|
"origin-(--transform-origin) outline-none",
|
|
80
|
-
"data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
|
|
81
|
-
"data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
|
|
61
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
62
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
82
63
|
className
|
|
83
64
|
)}
|
|
84
65
|
{...props}
|
|
@@ -99,8 +80,8 @@ const MenuItem = React.forwardRef<
|
|
|
99
80
|
className={cn(
|
|
100
81
|
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
101
82
|
"focus:bg-accent focus:text-accent-foreground",
|
|
102
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
103
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
83
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
84
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
104
85
|
inset && "pl-8",
|
|
105
86
|
className
|
|
106
87
|
)}
|
|
@@ -109,25 +90,41 @@ const MenuItem = React.forwardRef<
|
|
|
109
90
|
))
|
|
110
91
|
MenuItem.displayName = "MenuItem"
|
|
111
92
|
|
|
93
|
+
const MenuLinkItem = React.forwardRef<
|
|
94
|
+
React.ComponentRef<typeof MenuPrimitive.LinkItem>,
|
|
95
|
+
React.ComponentProps<typeof MenuPrimitive.LinkItem>
|
|
96
|
+
>(({ className, ...props }, ref) => (
|
|
97
|
+
<MenuPrimitive.LinkItem
|
|
98
|
+
ref={ref}
|
|
99
|
+
className={cn(
|
|
100
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
101
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
102
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
))
|
|
108
|
+
MenuLinkItem.displayName = "MenuLinkItem"
|
|
109
|
+
|
|
112
110
|
const MenuCheckboxItem = React.forwardRef<
|
|
113
111
|
React.ComponentRef<typeof MenuPrimitive.CheckboxItem>,
|
|
114
112
|
React.ComponentProps<typeof MenuPrimitive.CheckboxItem>
|
|
115
|
-
>(({ className, children,
|
|
113
|
+
>(({ className, children, ...props }, ref) => (
|
|
116
114
|
<MenuPrimitive.CheckboxItem
|
|
117
115
|
ref={ref}
|
|
118
116
|
className={cn(
|
|
119
117
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
120
118
|
"focus:bg-accent focus:text-accent-foreground",
|
|
121
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
122
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
119
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
120
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
123
121
|
className
|
|
124
122
|
)}
|
|
125
|
-
checked={checked}
|
|
126
123
|
{...props}
|
|
127
124
|
>
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
</
|
|
125
|
+
<MenuPrimitive.CheckboxItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
126
|
+
<Check className="h-4 w-4" />
|
|
127
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
131
128
|
{children}
|
|
132
129
|
</MenuPrimitive.CheckboxItem>
|
|
133
130
|
))
|
|
@@ -137,7 +134,7 @@ const MenuRadioGroup = React.forwardRef<
|
|
|
137
134
|
React.ComponentRef<typeof MenuPrimitive.RadioGroup>,
|
|
138
135
|
React.ComponentProps<typeof MenuPrimitive.RadioGroup>
|
|
139
136
|
>(({ className, ...props }, ref) => (
|
|
140
|
-
<MenuPrimitive.RadioGroup ref={ref} className={
|
|
137
|
+
<MenuPrimitive.RadioGroup ref={ref} className={className} {...props} />
|
|
141
138
|
))
|
|
142
139
|
MenuRadioGroup.displayName = "MenuRadioGroup"
|
|
143
140
|
|
|
@@ -150,20 +147,28 @@ const MenuRadioItem = React.forwardRef<
|
|
|
150
147
|
className={cn(
|
|
151
148
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
152
149
|
"focus:bg-accent focus:text-accent-foreground",
|
|
153
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
154
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
150
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
151
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
155
152
|
className
|
|
156
153
|
)}
|
|
157
154
|
{...props}
|
|
158
155
|
>
|
|
159
|
-
<
|
|
160
|
-
<Circle className="h-2 w-2 fill-current
|
|
161
|
-
</
|
|
156
|
+
<MenuPrimitive.RadioItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
157
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
158
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
162
159
|
{children}
|
|
163
160
|
</MenuPrimitive.RadioItem>
|
|
164
161
|
))
|
|
165
162
|
MenuRadioItem.displayName = "MenuRadioItem"
|
|
166
163
|
|
|
164
|
+
const MenuGroup = React.forwardRef<
|
|
165
|
+
React.ComponentRef<typeof MenuPrimitive.Group>,
|
|
166
|
+
React.ComponentProps<typeof MenuPrimitive.Group>
|
|
167
|
+
>(({ className, ...props }, ref) => (
|
|
168
|
+
<MenuPrimitive.Group ref={ref} className={className} {...props} />
|
|
169
|
+
))
|
|
170
|
+
MenuGroup.displayName = "MenuGroup"
|
|
171
|
+
|
|
167
172
|
const MenuLabel = React.forwardRef<
|
|
168
173
|
React.ComponentRef<typeof MenuPrimitive.GroupLabel>,
|
|
169
174
|
React.ComponentProps<typeof MenuPrimitive.GroupLabel> & {
|
|
@@ -172,7 +177,7 @@ const MenuLabel = React.forwardRef<
|
|
|
172
177
|
>(({ className, inset, ...props }, ref) => (
|
|
173
178
|
<MenuPrimitive.GroupLabel
|
|
174
179
|
ref={ref}
|
|
175
|
-
className={cn("px-2 py-1.5 text-sm font-
|
|
180
|
+
className={cn("px-2 py-1.5 text-sm font-medium", inset && "pl-8", className)}
|
|
176
181
|
{...props}
|
|
177
182
|
/>
|
|
178
183
|
))
|
|
@@ -201,18 +206,9 @@ const MenuShortcut = ({
|
|
|
201
206
|
)
|
|
202
207
|
MenuShortcut.displayName = "MenuShortcut"
|
|
203
208
|
|
|
204
|
-
const MenuSub
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
>(({ children, ...props }, ref) => {
|
|
208
|
-
const element = useRender({
|
|
209
|
-
render: <MenuPrimitive.Root>{children}</MenuPrimitive.Root>,
|
|
210
|
-
props,
|
|
211
|
-
ref,
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
return element
|
|
215
|
-
})
|
|
209
|
+
const MenuSub: React.FC<React.ComponentProps<typeof MenuPrimitive.SubmenuRoot>> = (props) => (
|
|
210
|
+
<MenuPrimitive.SubmenuRoot {...props} />
|
|
211
|
+
)
|
|
216
212
|
MenuSub.displayName = "MenuSub"
|
|
217
213
|
|
|
218
214
|
const MenuSubTrigger = React.forwardRef<
|
|
@@ -226,9 +222,9 @@ const MenuSubTrigger = React.forwardRef<
|
|
|
226
222
|
className={cn(
|
|
227
223
|
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
228
224
|
"focus:bg-accent focus:text-accent-foreground",
|
|
229
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
230
|
-
"data-popup-open:bg-accent data-popup-open:text-accent-foreground",
|
|
231
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
225
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
226
|
+
"data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
|
|
227
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
232
228
|
inset && "pl-8",
|
|
233
229
|
className
|
|
234
230
|
)}
|
|
@@ -251,8 +247,8 @@ const MenuSubContent = React.forwardRef<
|
|
|
251
247
|
className={cn(
|
|
252
248
|
"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
253
249
|
"origin-(--transform-origin) outline-none",
|
|
254
|
-
"data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
|
|
255
|
-
"data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
|
|
250
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
251
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
256
252
|
className
|
|
257
253
|
)}
|
|
258
254
|
{...props}
|
|
@@ -269,9 +265,11 @@ export {
|
|
|
269
265
|
MenuPositioner,
|
|
270
266
|
MenuContent,
|
|
271
267
|
MenuItem,
|
|
268
|
+
MenuLinkItem,
|
|
272
269
|
MenuCheckboxItem,
|
|
273
270
|
MenuRadioGroup,
|
|
274
271
|
MenuRadioItem,
|
|
272
|
+
MenuGroup,
|
|
275
273
|
MenuLabel,
|
|
276
274
|
MenuSeparator,
|
|
277
275
|
MenuShortcut,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import { Menubar as BaseMenubar } from "@base-ui/react/menubar"
|
|
5
5
|
import { Menu } from "@base-ui/react/menu"
|
|
6
|
-
import { useRender } from "@base-ui/react/use-render"
|
|
7
6
|
import { cn } from "@/lib/utils"
|
|
8
7
|
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
9
8
|
|
|
@@ -22,17 +21,9 @@ const Menubar = React.forwardRef<
|
|
|
22
21
|
))
|
|
23
22
|
Menubar.displayName = "Menubar"
|
|
24
23
|
|
|
25
|
-
const MenubarMenu
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
>(({ children, ...props }, ref) => {
|
|
29
|
-
const element = useRender({
|
|
30
|
-
render: <Menu.Root>{children}</Menu.Root>,
|
|
31
|
-
props,
|
|
32
|
-
ref,
|
|
33
|
-
});
|
|
34
|
-
return element;
|
|
35
|
-
});
|
|
24
|
+
const MenubarMenu: React.FC<React.ComponentProps<typeof Menu.Root>> = (props) => (
|
|
25
|
+
<Menu.Root {...props} />
|
|
26
|
+
)
|
|
36
27
|
MenubarMenu.displayName = "MenubarMenu"
|
|
37
28
|
|
|
38
29
|
const MenubarTrigger = React.forwardRef<
|
|
@@ -44,9 +35,9 @@ const MenubarTrigger = React.forwardRef<
|
|
|
44
35
|
className={cn(
|
|
45
36
|
"flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none",
|
|
46
37
|
"focus:bg-accent focus:text-accent-foreground",
|
|
47
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
48
|
-
"data-popup-open:bg-accent data-popup-open:text-accent-foreground",
|
|
49
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
38
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
39
|
+
"data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
|
|
40
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
50
41
|
className
|
|
51
42
|
)}
|
|
52
43
|
{...props}
|
|
@@ -54,17 +45,9 @@ const MenubarTrigger = React.forwardRef<
|
|
|
54
45
|
))
|
|
55
46
|
MenubarTrigger.displayName = "MenubarTrigger"
|
|
56
47
|
|
|
57
|
-
const MenubarPortal
|
|
58
|
-
React.ComponentRef<typeof Menu.Portal>,
|
|
48
|
+
const MenubarPortal: React.FC<
|
|
59
49
|
React.ComponentProps<typeof Menu.Portal>
|
|
60
|
-
>(
|
|
61
|
-
const element = useRender({
|
|
62
|
-
render: <Menu.Portal />,
|
|
63
|
-
props,
|
|
64
|
-
ref,
|
|
65
|
-
});
|
|
66
|
-
return element;
|
|
67
|
-
});
|
|
50
|
+
> = (props) => <Menu.Portal {...props} />
|
|
68
51
|
MenubarPortal.displayName = "MenubarPortal"
|
|
69
52
|
|
|
70
53
|
const MenubarPositioner = React.forwardRef<
|
|
@@ -90,8 +73,8 @@ const MenubarContent = React.forwardRef<
|
|
|
90
73
|
"z-50 min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
91
74
|
"origin-(--transform-origin)",
|
|
92
75
|
"outline-none focus:outline-none focus-visible:outline-none",
|
|
93
|
-
"data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
|
|
94
|
-
"data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
|
|
76
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
77
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
95
78
|
className
|
|
96
79
|
)}
|
|
97
80
|
{...props}
|
|
@@ -110,8 +93,8 @@ const MenubarItem = React.forwardRef<
|
|
|
110
93
|
className={cn(
|
|
111
94
|
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
112
95
|
"focus:bg-accent focus:text-accent-foreground",
|
|
113
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
114
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
96
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
97
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
115
98
|
inset && "pl-8",
|
|
116
99
|
className
|
|
117
100
|
)}
|
|
@@ -123,22 +106,21 @@ MenubarItem.displayName = "MenubarItem"
|
|
|
123
106
|
const MenubarCheckboxItem = React.forwardRef<
|
|
124
107
|
React.ComponentRef<typeof Menu.CheckboxItem>,
|
|
125
108
|
React.ComponentProps<typeof Menu.CheckboxItem>
|
|
126
|
-
>(({ className, children,
|
|
109
|
+
>(({ className, children, ...props }, ref) => (
|
|
127
110
|
<Menu.CheckboxItem
|
|
128
111
|
ref={ref}
|
|
129
112
|
className={cn(
|
|
130
113
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
131
114
|
"focus:bg-accent focus:text-accent-foreground",
|
|
132
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
133
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
115
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
116
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
134
117
|
className
|
|
135
118
|
)}
|
|
136
|
-
checked={checked}
|
|
137
119
|
{...props}
|
|
138
120
|
>
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
</
|
|
121
|
+
<Menu.CheckboxItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
122
|
+
<Check className="h-4 w-4" />
|
|
123
|
+
</Menu.CheckboxItemIndicator>
|
|
142
124
|
{children}
|
|
143
125
|
</Menu.CheckboxItem>
|
|
144
126
|
))
|
|
@@ -148,7 +130,7 @@ const MenubarRadioGroup = React.forwardRef<
|
|
|
148
130
|
React.ComponentRef<typeof Menu.RadioGroup>,
|
|
149
131
|
React.ComponentProps<typeof Menu.RadioGroup>
|
|
150
132
|
>(({ className, ...props }, ref) => (
|
|
151
|
-
<Menu.RadioGroup ref={ref} className={
|
|
133
|
+
<Menu.RadioGroup ref={ref} className={className} {...props} />
|
|
152
134
|
))
|
|
153
135
|
MenubarRadioGroup.displayName = "MenubarRadioGroup"
|
|
154
136
|
|
|
@@ -161,15 +143,15 @@ const MenubarRadioItem = React.forwardRef<
|
|
|
161
143
|
className={cn(
|
|
162
144
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
163
145
|
"focus:bg-accent focus:text-accent-foreground",
|
|
164
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
165
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
146
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
147
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
166
148
|
className
|
|
167
149
|
)}
|
|
168
150
|
{...props}
|
|
169
151
|
>
|
|
170
|
-
<
|
|
171
|
-
<Circle className="h-2 w-2 fill-current
|
|
172
|
-
</
|
|
152
|
+
<Menu.RadioItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
153
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
154
|
+
</Menu.RadioItemIndicator>
|
|
173
155
|
{children}
|
|
174
156
|
</Menu.RadioItem>
|
|
175
157
|
))
|
|
@@ -179,7 +161,7 @@ const MenubarGroup = React.forwardRef<
|
|
|
179
161
|
React.ComponentRef<typeof Menu.Group>,
|
|
180
162
|
React.ComponentProps<typeof Menu.Group>
|
|
181
163
|
>(({ className, ...props }, ref) => (
|
|
182
|
-
<Menu.Group ref={ref} className={
|
|
164
|
+
<Menu.Group ref={ref} className={className} {...props} />
|
|
183
165
|
))
|
|
184
166
|
MenubarGroup.displayName = "MenubarGroup"
|
|
185
167
|
|
|
@@ -192,7 +174,7 @@ const MenubarLabel = React.forwardRef<
|
|
|
192
174
|
<Menu.GroupLabel
|
|
193
175
|
ref={ref}
|
|
194
176
|
className={cn(
|
|
195
|
-
"px-2 py-1.5 text-sm font-
|
|
177
|
+
"px-2 py-1.5 text-sm font-medium text-foreground",
|
|
196
178
|
inset && "pl-8",
|
|
197
179
|
className
|
|
198
180
|
)}
|
|
@@ -216,30 +198,20 @@ MenubarSeparator.displayName = "MenubarSeparator"
|
|
|
216
198
|
const MenubarShortcut = ({
|
|
217
199
|
className,
|
|
218
200
|
...props
|
|
219
|
-
}: React.HTMLAttributes<HTMLSpanElement>) =>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
)
|
|
229
|
-
}
|
|
201
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => (
|
|
202
|
+
<span
|
|
203
|
+
className={cn(
|
|
204
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
205
|
+
className
|
|
206
|
+
)}
|
|
207
|
+
{...props}
|
|
208
|
+
/>
|
|
209
|
+
)
|
|
230
210
|
MenubarShortcut.displayName = "MenubarShortcut"
|
|
231
211
|
|
|
232
|
-
const MenubarSub
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
>(({ children, ...props }, ref) => {
|
|
236
|
-
const element = useRender({
|
|
237
|
-
render: <Menu.SubmenuRoot>{children}</Menu.SubmenuRoot>,
|
|
238
|
-
props,
|
|
239
|
-
ref,
|
|
240
|
-
});
|
|
241
|
-
return element;
|
|
242
|
-
});
|
|
212
|
+
const MenubarSub: React.FC<React.ComponentProps<typeof Menu.SubmenuRoot>> = (props) => (
|
|
213
|
+
<Menu.SubmenuRoot {...props} />
|
|
214
|
+
)
|
|
243
215
|
MenubarSub.displayName = "MenubarSub"
|
|
244
216
|
|
|
245
217
|
const MenubarSubTrigger = React.forwardRef<
|
|
@@ -253,9 +225,9 @@ const MenubarSubTrigger = React.forwardRef<
|
|
|
253
225
|
className={cn(
|
|
254
226
|
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
255
227
|
"focus:bg-accent focus:text-accent-foreground",
|
|
256
|
-
"data-highlighted:bg-accent data-highlighted:text-accent-foreground",
|
|
257
|
-
"data-popup-open:bg-accent data-popup-open:text-accent-foreground",
|
|
258
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
228
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
229
|
+
"data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
|
|
230
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
259
231
|
inset && "pl-8",
|
|
260
232
|
className
|
|
261
233
|
)}
|
|
@@ -279,8 +251,8 @@ const MenubarSubContent = React.forwardRef<
|
|
|
279
251
|
"z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
|
|
280
252
|
"origin-(--transform-origin)",
|
|
281
253
|
"outline-none focus:outline-none focus-visible:outline-none",
|
|
282
|
-
"data-starting-style:animate-in data-starting-style:fade-in-0 data-starting-style:zoom-in-95",
|
|
283
|
-
"data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95",
|
|
254
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
255
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
284
256
|
className
|
|
285
257
|
)}
|
|
286
258
|
{...props}
|
|
@@ -308,4 +280,4 @@ export {
|
|
|
308
280
|
MenubarSub,
|
|
309
281
|
MenubarSubTrigger,
|
|
310
282
|
MenubarSubContent,
|
|
311
|
-
}
|
|
283
|
+
}
|