@dinachi/cli 0.4.0 → 0.5.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/README.md +27 -5
- package/dist/index.js +1037 -567
- package/package.json +6 -5
- package/templates/autocomplete/autocomplete.tsx +197 -0
- package/templates/autocomplete/index.ts +17 -0
- package/templates/combobox/combobox.tsx +202 -0
- package/templates/combobox/index.ts +17 -0
- package/templates/context-menu/context-menu.tsx +104 -39
- package/templates/drawer/drawer.tsx +109 -0
- package/templates/drawer/index.ts +12 -0
- package/templates/fieldset/fieldset.tsx +32 -0
- package/templates/fieldset/index.ts +1 -0
- package/templates/menu/index.ts +17 -0
- package/templates/menu/menu.tsx +282 -0
- package/templates/menubar/menubar.tsx +7 -7
- package/templates/meter/index.ts +1 -0
- package/templates/meter/meter.tsx +64 -0
- package/templates/number-field/index.ts +9 -0
- package/templates/number-field/number-field.tsx +114 -0
- package/templates/popover/index.ts +12 -0
- package/templates/popover/popover.tsx +137 -0
- package/templates/preview-card/preview-card.tsx +4 -5
- package/templates/progress/index.ts +7 -0
- package/templates/progress/progress.tsx +64 -0
- package/templates/radio/index.ts +1 -0
- package/templates/radio/radio.tsx +39 -0
- package/templates/scroll-area/index.ts +8 -0
- package/templates/scroll-area/scroll-area.tsx +94 -0
- package/templates/separator/index.ts +1 -0
- package/templates/separator/separator.tsx +25 -0
- package/templates/switch/index.ts +1 -0
- package/templates/switch/switch.tsx +42 -0
- package/templates/toggle-group/index.ts +1 -0
- package/templates/toggle-group/toggle-group.tsx +67 -0
- package/templates/tooltip/tooltip.tsx +2 -2
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
"use client"
|
|
3
|
+
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import { DrawerPreview as DrawerPrimitive } from "@base-ui/react/drawer"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const Drawer = DrawerPrimitive.Root
|
|
9
|
+
const DrawerTrigger = DrawerPrimitive.Trigger
|
|
10
|
+
const DrawerPortal = DrawerPrimitive.Portal
|
|
11
|
+
const DrawerClose = DrawerPrimitive.Close
|
|
12
|
+
|
|
13
|
+
const DrawerBackdrop = React.forwardRef<
|
|
14
|
+
React.ComponentRef<typeof DrawerPrimitive.Backdrop>,
|
|
15
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Backdrop>
|
|
16
|
+
>(({ className, ...props }, ref) => (
|
|
17
|
+
<DrawerPrimitive.Backdrop
|
|
18
|
+
ref={ref}
|
|
19
|
+
className={cn(
|
|
20
|
+
"fixed inset-0 z-50 bg-black/50",
|
|
21
|
+
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
22
|
+
"transition-opacity duration-200",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
))
|
|
28
|
+
DrawerBackdrop.displayName = "DrawerBackdrop"
|
|
29
|
+
|
|
30
|
+
type DrawerSide = "top" | "right" | "bottom" | "left"
|
|
31
|
+
|
|
32
|
+
const DrawerContent = React.forwardRef<
|
|
33
|
+
React.ComponentRef<typeof DrawerPrimitive.Popup>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Popup> & {
|
|
35
|
+
side?: DrawerSide
|
|
36
|
+
}
|
|
37
|
+
>(({ className, side = "right", children, ...props }, ref) => (
|
|
38
|
+
<DrawerPortal>
|
|
39
|
+
<DrawerBackdrop />
|
|
40
|
+
<DrawerPrimitive.Popup
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cn(
|
|
43
|
+
"fixed z-50 flex flex-col gap-4 border bg-background p-6 shadow-lg transition duration-200",
|
|
44
|
+
side === "top" &&
|
|
45
|
+
"inset-x-0 top-0 border-b data-[starting-style]:-translate-y-full data-[ending-style]:-translate-y-full",
|
|
46
|
+
side === "bottom" &&
|
|
47
|
+
"inset-x-0 bottom-0 border-t data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full",
|
|
48
|
+
side === "left" &&
|
|
49
|
+
"inset-y-0 left-0 h-full w-3/4 max-w-sm border-r data-[starting-style]:-translate-x-full data-[ending-style]:-translate-x-full",
|
|
50
|
+
side === "right" &&
|
|
51
|
+
"inset-y-0 right-0 h-full w-3/4 max-w-sm border-l data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full",
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
<DrawerPrimitive.Content className="size-full overflow-y-auto">
|
|
57
|
+
{children}
|
|
58
|
+
</DrawerPrimitive.Content>
|
|
59
|
+
</DrawerPrimitive.Popup>
|
|
60
|
+
</DrawerPortal>
|
|
61
|
+
))
|
|
62
|
+
DrawerContent.displayName = "DrawerContent"
|
|
63
|
+
|
|
64
|
+
function DrawerTitle({
|
|
65
|
+
className,
|
|
66
|
+
...props
|
|
67
|
+
}: React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>) {
|
|
68
|
+
return (
|
|
69
|
+
<DrawerPrimitive.Title
|
|
70
|
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function DrawerDescription({
|
|
77
|
+
className,
|
|
78
|
+
...props
|
|
79
|
+
}: React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>) {
|
|
80
|
+
return (
|
|
81
|
+
<DrawerPrimitive.Description
|
|
82
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
89
|
+
<div className={cn("flex flex-col gap-1.5 text-center sm:text-left", className)} {...props} />
|
|
90
|
+
)
|
|
91
|
+
DrawerHeader.displayName = "DrawerHeader"
|
|
92
|
+
|
|
93
|
+
const DrawerFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
94
|
+
<div className={cn("mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end", className)} {...props} />
|
|
95
|
+
)
|
|
96
|
+
DrawerFooter.displayName = "DrawerFooter"
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
Drawer,
|
|
100
|
+
DrawerTrigger,
|
|
101
|
+
DrawerPortal,
|
|
102
|
+
DrawerBackdrop,
|
|
103
|
+
DrawerContent,
|
|
104
|
+
DrawerTitle,
|
|
105
|
+
DrawerDescription,
|
|
106
|
+
DrawerClose,
|
|
107
|
+
DrawerHeader,
|
|
108
|
+
DrawerFooter,
|
|
109
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
"use client"
|
|
3
|
+
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import { Fieldset as FieldsetPrimitive } from "@base-ui/react/fieldset"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const Fieldset = React.forwardRef<
|
|
9
|
+
React.ComponentRef<typeof FieldsetPrimitive.Root>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof FieldsetPrimitive.Root>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<FieldsetPrimitive.Root
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn("space-y-3 rounded-lg border p-4", className)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
))
|
|
18
|
+
Fieldset.displayName = "Fieldset"
|
|
19
|
+
|
|
20
|
+
const FieldsetLegend = React.forwardRef<
|
|
21
|
+
React.ComponentRef<typeof FieldsetPrimitive.Legend>,
|
|
22
|
+
React.ComponentPropsWithoutRef<typeof FieldsetPrimitive.Legend>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<FieldsetPrimitive.Legend
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn("px-1 text-sm font-medium", className)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
))
|
|
30
|
+
FieldsetLegend.displayName = "FieldsetLegend"
|
|
31
|
+
|
|
32
|
+
export { Fieldset, FieldsetLegend }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Fieldset, FieldsetLegend } from "./fieldset"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Menu,
|
|
3
|
+
MenuTrigger,
|
|
4
|
+
MenuPortal,
|
|
5
|
+
MenuPositioner,
|
|
6
|
+
MenuContent,
|
|
7
|
+
MenuItem,
|
|
8
|
+
MenuCheckboxItem,
|
|
9
|
+
MenuRadioGroup,
|
|
10
|
+
MenuRadioItem,
|
|
11
|
+
MenuLabel,
|
|
12
|
+
MenuSeparator,
|
|
13
|
+
MenuShortcut,
|
|
14
|
+
MenuSub,
|
|
15
|
+
MenuSubTrigger,
|
|
16
|
+
MenuSubContent,
|
|
17
|
+
} from "./menu"
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
"use client"
|
|
3
|
+
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render"
|
|
7
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
8
|
+
import { cn } from "@/lib/utils"
|
|
9
|
+
|
|
10
|
+
const Menu = React.forwardRef<
|
|
11
|
+
React.ComponentRef<typeof MenuPrimitive.Root>,
|
|
12
|
+
React.ComponentProps<typeof MenuPrimitive.Root>
|
|
13
|
+
>(({ children, ...props }, ref) => {
|
|
14
|
+
const element = useRender({
|
|
15
|
+
render: <MenuPrimitive.Root>{children}</MenuPrimitive.Root>,
|
|
16
|
+
props,
|
|
17
|
+
ref,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
return element
|
|
21
|
+
})
|
|
22
|
+
Menu.displayName = "Menu"
|
|
23
|
+
|
|
24
|
+
const MenuTrigger = React.forwardRef<
|
|
25
|
+
HTMLButtonElement,
|
|
26
|
+
React.ComponentProps<typeof MenuPrimitive.Trigger>
|
|
27
|
+
>(({ className, ...props }, ref) => (
|
|
28
|
+
<MenuPrimitive.Trigger
|
|
29
|
+
ref={ref}
|
|
30
|
+
className={cn(
|
|
31
|
+
"inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium",
|
|
32
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
33
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
34
|
+
"data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
|
|
35
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
36
|
+
className
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
))
|
|
41
|
+
MenuTrigger.displayName = "MenuTrigger"
|
|
42
|
+
|
|
43
|
+
const MenuPortal = React.forwardRef<
|
|
44
|
+
React.ComponentRef<typeof MenuPrimitive.Portal>,
|
|
45
|
+
React.ComponentProps<typeof MenuPrimitive.Portal>
|
|
46
|
+
>(({ ...props }, ref) => {
|
|
47
|
+
const element = useRender({
|
|
48
|
+
render: <MenuPrimitive.Portal />,
|
|
49
|
+
props,
|
|
50
|
+
ref,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return element
|
|
54
|
+
})
|
|
55
|
+
MenuPortal.displayName = "MenuPortal"
|
|
56
|
+
|
|
57
|
+
const MenuPositioner = React.forwardRef<
|
|
58
|
+
React.ComponentRef<typeof MenuPrimitive.Positioner>,
|
|
59
|
+
React.ComponentProps<typeof MenuPrimitive.Positioner>
|
|
60
|
+
>(({ className, ...props }, ref) => (
|
|
61
|
+
<MenuPrimitive.Positioner
|
|
62
|
+
ref={ref}
|
|
63
|
+
className={cn("outline-none", className)}
|
|
64
|
+
sideOffset={6}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
))
|
|
68
|
+
MenuPositioner.displayName = "MenuPositioner"
|
|
69
|
+
|
|
70
|
+
const MenuContent = React.forwardRef<
|
|
71
|
+
React.ComponentRef<typeof MenuPrimitive.Popup>,
|
|
72
|
+
React.ComponentProps<typeof MenuPrimitive.Popup>
|
|
73
|
+
>(({ className, ...props }, ref) => (
|
|
74
|
+
<MenuPortal>
|
|
75
|
+
<MenuPositioner>
|
|
76
|
+
<MenuPrimitive.Popup
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={cn(
|
|
79
|
+
"z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
80
|
+
"origin-[var(--transform-origin)] outline-none",
|
|
81
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
82
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
83
|
+
className
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
</MenuPositioner>
|
|
88
|
+
</MenuPortal>
|
|
89
|
+
))
|
|
90
|
+
MenuContent.displayName = "MenuContent"
|
|
91
|
+
|
|
92
|
+
const MenuItem = React.forwardRef<
|
|
93
|
+
React.ComponentRef<typeof MenuPrimitive.Item>,
|
|
94
|
+
React.ComponentProps<typeof MenuPrimitive.Item> & {
|
|
95
|
+
inset?: boolean
|
|
96
|
+
}
|
|
97
|
+
>(({ className, inset, ...props }, ref) => (
|
|
98
|
+
<MenuPrimitive.Item
|
|
99
|
+
ref={ref}
|
|
100
|
+
className={cn(
|
|
101
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
102
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
103
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
104
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
105
|
+
inset && "pl-8",
|
|
106
|
+
className
|
|
107
|
+
)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
))
|
|
111
|
+
MenuItem.displayName = "MenuItem"
|
|
112
|
+
|
|
113
|
+
const MenuCheckboxItem = React.forwardRef<
|
|
114
|
+
React.ComponentRef<typeof MenuPrimitive.CheckboxItem>,
|
|
115
|
+
React.ComponentProps<typeof MenuPrimitive.CheckboxItem>
|
|
116
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
117
|
+
<MenuPrimitive.CheckboxItem
|
|
118
|
+
ref={ref}
|
|
119
|
+
className={cn(
|
|
120
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
121
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
122
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
123
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
checked={checked}
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
129
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
130
|
+
{checked && <Check className="h-4 w-4" />}
|
|
131
|
+
</span>
|
|
132
|
+
{children}
|
|
133
|
+
</MenuPrimitive.CheckboxItem>
|
|
134
|
+
))
|
|
135
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem"
|
|
136
|
+
|
|
137
|
+
const MenuRadioGroup = React.forwardRef<
|
|
138
|
+
React.ComponentRef<typeof MenuPrimitive.RadioGroup>,
|
|
139
|
+
React.ComponentProps<typeof MenuPrimitive.RadioGroup>
|
|
140
|
+
>(({ className, ...props }, ref) => (
|
|
141
|
+
<MenuPrimitive.RadioGroup ref={ref} className={cn(className)} {...props} />
|
|
142
|
+
))
|
|
143
|
+
MenuRadioGroup.displayName = "MenuRadioGroup"
|
|
144
|
+
|
|
145
|
+
const MenuRadioItem = React.forwardRef<
|
|
146
|
+
React.ComponentRef<typeof MenuPrimitive.RadioItem>,
|
|
147
|
+
React.ComponentProps<typeof MenuPrimitive.RadioItem>
|
|
148
|
+
>(({ className, children, ...props }, ref) => (
|
|
149
|
+
<MenuPrimitive.RadioItem
|
|
150
|
+
ref={ref}
|
|
151
|
+
className={cn(
|
|
152
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
|
|
153
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
154
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
155
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
156
|
+
className
|
|
157
|
+
)}
|
|
158
|
+
{...props}
|
|
159
|
+
>
|
|
160
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
161
|
+
<Circle className="h-2 w-2 fill-current data-[checked]:block data-[unchecked]:hidden" />
|
|
162
|
+
</span>
|
|
163
|
+
{children}
|
|
164
|
+
</MenuPrimitive.RadioItem>
|
|
165
|
+
))
|
|
166
|
+
MenuRadioItem.displayName = "MenuRadioItem"
|
|
167
|
+
|
|
168
|
+
const MenuLabel = React.forwardRef<
|
|
169
|
+
React.ComponentRef<typeof MenuPrimitive.GroupLabel>,
|
|
170
|
+
React.ComponentProps<typeof MenuPrimitive.GroupLabel> & {
|
|
171
|
+
inset?: boolean
|
|
172
|
+
}
|
|
173
|
+
>(({ className, inset, ...props }, ref) => (
|
|
174
|
+
<MenuPrimitive.GroupLabel
|
|
175
|
+
ref={ref}
|
|
176
|
+
className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
|
|
177
|
+
{...props}
|
|
178
|
+
/>
|
|
179
|
+
))
|
|
180
|
+
MenuLabel.displayName = "MenuLabel"
|
|
181
|
+
|
|
182
|
+
const MenuSeparator = React.forwardRef<
|
|
183
|
+
React.ComponentRef<typeof MenuPrimitive.Separator>,
|
|
184
|
+
React.ComponentProps<typeof MenuPrimitive.Separator>
|
|
185
|
+
>(({ className, ...props }, ref) => (
|
|
186
|
+
<MenuPrimitive.Separator
|
|
187
|
+
ref={ref}
|
|
188
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
189
|
+
{...props}
|
|
190
|
+
/>
|
|
191
|
+
))
|
|
192
|
+
MenuSeparator.displayName = "MenuSeparator"
|
|
193
|
+
|
|
194
|
+
const MenuShortcut = ({
|
|
195
|
+
className,
|
|
196
|
+
...props
|
|
197
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => (
|
|
198
|
+
<span
|
|
199
|
+
className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
|
|
200
|
+
{...props}
|
|
201
|
+
/>
|
|
202
|
+
)
|
|
203
|
+
MenuShortcut.displayName = "MenuShortcut"
|
|
204
|
+
|
|
205
|
+
const MenuSub = React.forwardRef<
|
|
206
|
+
React.ComponentRef<typeof MenuPrimitive.Root>,
|
|
207
|
+
React.ComponentProps<typeof MenuPrimitive.Root>
|
|
208
|
+
>(({ children, ...props }, ref) => {
|
|
209
|
+
const element = useRender({
|
|
210
|
+
render: <MenuPrimitive.Root>{children}</MenuPrimitive.Root>,
|
|
211
|
+
props,
|
|
212
|
+
ref,
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
return element
|
|
216
|
+
})
|
|
217
|
+
MenuSub.displayName = "MenuSub"
|
|
218
|
+
|
|
219
|
+
const MenuSubTrigger = React.forwardRef<
|
|
220
|
+
React.ComponentRef<typeof MenuPrimitive.SubmenuTrigger>,
|
|
221
|
+
React.ComponentProps<typeof MenuPrimitive.SubmenuTrigger> & {
|
|
222
|
+
inset?: boolean
|
|
223
|
+
}
|
|
224
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
225
|
+
<MenuPrimitive.SubmenuTrigger
|
|
226
|
+
ref={ref}
|
|
227
|
+
className={cn(
|
|
228
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
229
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
230
|
+
"data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
|
|
231
|
+
"data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
|
|
232
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
233
|
+
inset && "pl-8",
|
|
234
|
+
className
|
|
235
|
+
)}
|
|
236
|
+
{...props}
|
|
237
|
+
>
|
|
238
|
+
{children}
|
|
239
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
240
|
+
</MenuPrimitive.SubmenuTrigger>
|
|
241
|
+
))
|
|
242
|
+
MenuSubTrigger.displayName = "MenuSubTrigger"
|
|
243
|
+
|
|
244
|
+
const MenuSubContent = React.forwardRef<
|
|
245
|
+
React.ComponentRef<typeof MenuPrimitive.Popup>,
|
|
246
|
+
React.ComponentProps<typeof MenuPrimitive.Popup>
|
|
247
|
+
>(({ className, ...props }, ref) => (
|
|
248
|
+
<MenuPrimitive.Portal>
|
|
249
|
+
<MenuPrimitive.Positioner className="outline-none" alignOffset={-4} sideOffset={8}>
|
|
250
|
+
<MenuPrimitive.Popup
|
|
251
|
+
ref={ref}
|
|
252
|
+
className={cn(
|
|
253
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
254
|
+
"origin-[var(--transform-origin)] outline-none",
|
|
255
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
256
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
257
|
+
className
|
|
258
|
+
)}
|
|
259
|
+
{...props}
|
|
260
|
+
/>
|
|
261
|
+
</MenuPrimitive.Positioner>
|
|
262
|
+
</MenuPrimitive.Portal>
|
|
263
|
+
))
|
|
264
|
+
MenuSubContent.displayName = "MenuSubContent"
|
|
265
|
+
|
|
266
|
+
export {
|
|
267
|
+
Menu,
|
|
268
|
+
MenuTrigger,
|
|
269
|
+
MenuPortal,
|
|
270
|
+
MenuPositioner,
|
|
271
|
+
MenuContent,
|
|
272
|
+
MenuItem,
|
|
273
|
+
MenuCheckboxItem,
|
|
274
|
+
MenuRadioGroup,
|
|
275
|
+
MenuRadioItem,
|
|
276
|
+
MenuLabel,
|
|
277
|
+
MenuSeparator,
|
|
278
|
+
MenuShortcut,
|
|
279
|
+
MenuSub,
|
|
280
|
+
MenuSubTrigger,
|
|
281
|
+
MenuSubContent,
|
|
282
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
"use client"
|
|
3
|
+
|
|
3
4
|
import * as React from "react"
|
|
4
5
|
import { Menubar as BaseMenubar } from "@base-ui/react/menubar"
|
|
5
6
|
import { Menu } from "@base-ui/react/menu"
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render"
|
|
6
8
|
import { cn } from "@/lib/utils"
|
|
7
9
|
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
8
|
-
import { useRender } from "@base-ui/react/use-render"
|
|
9
|
-
|
|
10
10
|
|
|
11
11
|
const Menubar = React.forwardRef<
|
|
12
12
|
React.ComponentRef<typeof BaseMenubar>,
|
|
@@ -37,7 +37,7 @@ const MenubarMenu = React.forwardRef<
|
|
|
37
37
|
MenubarMenu.displayName = "MenubarMenu"
|
|
38
38
|
|
|
39
39
|
const MenubarTrigger = React.forwardRef<
|
|
40
|
-
|
|
40
|
+
HTMLButtonElement,
|
|
41
41
|
React.ComponentProps<typeof Menu.Trigger>
|
|
42
42
|
>(({ className, ...props }, ref) => (
|
|
43
43
|
<Menu.Trigger
|
|
@@ -223,11 +223,11 @@ const MenubarShortcut = ({
|
|
|
223
223
|
MenubarShortcut.displayName = "MenubarShortcut"
|
|
224
224
|
|
|
225
225
|
const MenubarSub = React.forwardRef<
|
|
226
|
-
React.ComponentRef<typeof Menu.
|
|
227
|
-
React.ComponentProps<typeof Menu.
|
|
226
|
+
React.ComponentRef<typeof Menu.SubmenuRoot>,
|
|
227
|
+
React.ComponentProps<typeof Menu.SubmenuRoot>
|
|
228
228
|
>(({ children, ...props }, ref) => {
|
|
229
229
|
const element = useRender({
|
|
230
|
-
render: <Menu.
|
|
230
|
+
render: <Menu.SubmenuRoot>{children}</Menu.SubmenuRoot>,
|
|
231
231
|
props,
|
|
232
232
|
ref,
|
|
233
233
|
});
|
|
@@ -300,4 +300,4 @@ export {
|
|
|
300
300
|
MenubarSub,
|
|
301
301
|
MenubarSubTrigger,
|
|
302
302
|
MenubarSubContent,
|
|
303
|
-
}
|
|
303
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Meter, MeterTrack, MeterIndicator, MeterLabel, MeterValue } from "./meter"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
"use client"
|
|
3
|
+
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import { Meter as MeterPrimitive } from "@base-ui/react/meter"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
const Meter = React.forwardRef<
|
|
9
|
+
React.ComponentRef<typeof MeterPrimitive.Root>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof MeterPrimitive.Root>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<MeterPrimitive.Root ref={ref} className={cn("grid gap-2", className)} {...props} />
|
|
13
|
+
))
|
|
14
|
+
Meter.displayName = "Meter"
|
|
15
|
+
|
|
16
|
+
const MeterTrack = React.forwardRef<
|
|
17
|
+
React.ComponentRef<typeof MeterPrimitive.Track>,
|
|
18
|
+
React.ComponentPropsWithoutRef<typeof MeterPrimitive.Track>
|
|
19
|
+
>(({ className, ...props }, ref) => (
|
|
20
|
+
<MeterPrimitive.Track
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn("relative h-2 w-full overflow-hidden rounded-full bg-secondary", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
))
|
|
26
|
+
MeterTrack.displayName = "MeterTrack"
|
|
27
|
+
|
|
28
|
+
const MeterIndicator = React.forwardRef<
|
|
29
|
+
React.ComponentRef<typeof MeterPrimitive.Indicator>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof MeterPrimitive.Indicator>
|
|
31
|
+
>(({ className, ...props }, ref) => (
|
|
32
|
+
<MeterPrimitive.Indicator
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn("h-full rounded-full bg-primary transition-[width] duration-200", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
))
|
|
38
|
+
MeterIndicator.displayName = "MeterIndicator"
|
|
39
|
+
|
|
40
|
+
const MeterLabel = React.forwardRef<
|
|
41
|
+
React.ComponentRef<typeof MeterPrimitive.Label>,
|
|
42
|
+
React.ComponentPropsWithoutRef<typeof MeterPrimitive.Label>
|
|
43
|
+
>(({ className, ...props }, ref) => (
|
|
44
|
+
<MeterPrimitive.Label
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn("text-sm font-medium leading-none", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
))
|
|
50
|
+
MeterLabel.displayName = "MeterLabel"
|
|
51
|
+
|
|
52
|
+
const MeterValue = React.forwardRef<
|
|
53
|
+
React.ComponentRef<typeof MeterPrimitive.Value>,
|
|
54
|
+
React.ComponentPropsWithoutRef<typeof MeterPrimitive.Value>
|
|
55
|
+
>(({ className, ...props }, ref) => (
|
|
56
|
+
<MeterPrimitive.Value
|
|
57
|
+
ref={ref}
|
|
58
|
+
className={cn("text-xs text-muted-foreground", className)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
))
|
|
62
|
+
MeterValue.displayName = "MeterValue"
|
|
63
|
+
|
|
64
|
+
export { Meter, MeterTrack, MeterIndicator, MeterLabel, MeterValue }
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
"use client"
|
|
3
|
+
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
import { NumberField as NumberFieldPrimitive } from "@base-ui/react/number-field"
|
|
6
|
+
import { Minus, Plus } from "lucide-react"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
const NumberField = NumberFieldPrimitive.Root
|
|
10
|
+
|
|
11
|
+
const NumberFieldGroup = React.forwardRef<
|
|
12
|
+
React.ComponentRef<typeof NumberFieldPrimitive.Group>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Group>
|
|
14
|
+
>(({ className, ...props }, ref) => (
|
|
15
|
+
<NumberFieldPrimitive.Group
|
|
16
|
+
ref={ref}
|
|
17
|
+
className={cn(
|
|
18
|
+
"inline-flex h-10 w-full items-stretch overflow-hidden rounded-md border border-input bg-background",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
))
|
|
24
|
+
NumberFieldGroup.displayName = "NumberFieldGroup"
|
|
25
|
+
|
|
26
|
+
const NumberFieldInput = React.forwardRef<
|
|
27
|
+
React.ComponentRef<typeof NumberFieldPrimitive.Input>,
|
|
28
|
+
React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Input>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<NumberFieldPrimitive.Input
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn(
|
|
33
|
+
"w-full bg-transparent px-3 text-sm outline-none placeholder:text-muted-foreground",
|
|
34
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
35
|
+
className
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
))
|
|
40
|
+
NumberFieldInput.displayName = "NumberFieldInput"
|
|
41
|
+
|
|
42
|
+
const NumberFieldIncrement = React.forwardRef<
|
|
43
|
+
React.ComponentRef<typeof NumberFieldPrimitive.Increment>,
|
|
44
|
+
React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Increment>
|
|
45
|
+
>(({ className, children, ...props }, ref) => (
|
|
46
|
+
<NumberFieldPrimitive.Increment
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={cn(
|
|
49
|
+
"inline-flex h-full items-center justify-center border-l border-input px-3 text-muted-foreground transition-colors",
|
|
50
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
51
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
52
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{children ?? <Plus className="h-4 w-4" />}
|
|
58
|
+
</NumberFieldPrimitive.Increment>
|
|
59
|
+
))
|
|
60
|
+
NumberFieldIncrement.displayName = "NumberFieldIncrement"
|
|
61
|
+
|
|
62
|
+
const NumberFieldDecrement = React.forwardRef<
|
|
63
|
+
React.ComponentRef<typeof NumberFieldPrimitive.Decrement>,
|
|
64
|
+
React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.Decrement>
|
|
65
|
+
>(({ className, children, ...props }, ref) => (
|
|
66
|
+
<NumberFieldPrimitive.Decrement
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn(
|
|
69
|
+
"inline-flex h-full items-center justify-center border-r border-input px-3 text-muted-foreground transition-colors",
|
|
70
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
71
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
72
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
{children ?? <Minus className="h-4 w-4" />}
|
|
78
|
+
</NumberFieldPrimitive.Decrement>
|
|
79
|
+
))
|
|
80
|
+
NumberFieldDecrement.displayName = "NumberFieldDecrement"
|
|
81
|
+
|
|
82
|
+
const NumberFieldScrubArea = React.forwardRef<
|
|
83
|
+
React.ComponentRef<typeof NumberFieldPrimitive.ScrubArea>,
|
|
84
|
+
React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.ScrubArea>
|
|
85
|
+
>(({ className, ...props }, ref) => (
|
|
86
|
+
<NumberFieldPrimitive.ScrubArea
|
|
87
|
+
ref={ref}
|
|
88
|
+
className={cn("cursor-ew-resize", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
))
|
|
92
|
+
NumberFieldScrubArea.displayName = "NumberFieldScrubArea"
|
|
93
|
+
|
|
94
|
+
const NumberFieldScrubAreaCursor = React.forwardRef<
|
|
95
|
+
React.ComponentRef<typeof NumberFieldPrimitive.ScrubAreaCursor>,
|
|
96
|
+
React.ComponentPropsWithoutRef<typeof NumberFieldPrimitive.ScrubAreaCursor>
|
|
97
|
+
>(({ className, ...props }, ref) => (
|
|
98
|
+
<NumberFieldPrimitive.ScrubAreaCursor
|
|
99
|
+
ref={ref}
|
|
100
|
+
className={cn("text-muted-foreground", className)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
))
|
|
104
|
+
NumberFieldScrubAreaCursor.displayName = "NumberFieldScrubAreaCursor"
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
NumberField,
|
|
108
|
+
NumberFieldGroup,
|
|
109
|
+
NumberFieldInput,
|
|
110
|
+
NumberFieldIncrement,
|
|
111
|
+
NumberFieldDecrement,
|
|
112
|
+
NumberFieldScrubArea,
|
|
113
|
+
NumberFieldScrubAreaCursor,
|
|
114
|
+
}
|