@dinachi/cli 0.3.2 → 0.5.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/README.md +14 -0
- package/dist/index.js +392 -344
- package/package.json +5 -5
- package/templates/accordion/accordion.tsx +1 -1
- package/templates/alert-dialog/alert-dialog.tsx +1 -1
- package/templates/autocomplete/autocomplete.tsx +197 -0
- package/templates/autocomplete/index.ts +17 -0
- package/templates/avatar/avatar.tsx +4 -4
- package/templates/checkbox/checkbox.tsx +2 -2
- package/templates/checkbox-group/checkbox-group.tsx +2 -2
- package/templates/collapsible/collapsible.tsx +4 -4
- package/templates/combobox/combobox.tsx +202 -0
- package/templates/combobox/index.ts +17 -0
- package/templates/context-menu/context-menu.tsx +119 -54
- package/templates/dialog/dialog.tsx +1 -1
- package/templates/drawer/drawer.tsx +109 -0
- package/templates/drawer/index.ts +12 -0
- package/templates/field/field.tsx +1 -1
- package/templates/fieldset/fieldset.tsx +32 -0
- package/templates/fieldset/index.ts +1 -0
- package/templates/form/form.tsx +3 -3
- package/templates/input/input.tsx +23 -15
- package/templates/menu/index.ts +17 -0
- package/templates/menu/menu.tsx +282 -0
- package/templates/menubar/menubar.tsx +22 -22
- package/templates/meter/index.ts +1 -0
- package/templates/meter/meter.tsx +64 -0
- package/templates/navigation-menu/navigation-menu.tsx +13 -13
- 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 +10 -11
- 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/select/select.tsx +8 -8
- package/templates/separator/index.ts +1 -0
- package/templates/separator/separator.tsx +25 -0
- package/templates/slider/slider.tsx +10 -10
- package/templates/switch/index.ts +1 -0
- package/templates/switch/switch.tsx +42 -0
- package/templates/tabs/tabs.tsx +6 -6
- package/templates/toast/toast.tsx +1 -1
- package/templates/toggle/toggle.tsx +2 -2
- package/templates/toggle-group/index.ts +1 -0
- package/templates/toggle-group/toggle-group.tsx +67 -0
- package/templates/toolbar/toolbar.tsx +7 -7
- package/templates/tooltip/tooltip.tsx +38 -23
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { ContextMenu as BaseContextMenu } from "@base-ui
|
|
4
|
-
import { Menu } from "@base-ui
|
|
5
|
-
import {
|
|
3
|
+
import { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu";
|
|
4
|
+
import { Menu } from "@base-ui/react/menu";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
6
7
|
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
7
|
-
import { useRender } from "@base-ui-components/react/use-render";
|
|
8
8
|
|
|
9
9
|
const ContextMenu = React.forwardRef<
|
|
10
|
-
React.
|
|
10
|
+
React.ComponentRef<typeof BaseContextMenu.Root>,
|
|
11
11
|
React.ComponentProps<typeof BaseContextMenu.Root>
|
|
12
12
|
>(({ children, ...props }, ref) => {
|
|
13
13
|
const element = useRender({
|
|
@@ -20,7 +20,7 @@ const ContextMenu = React.forwardRef<
|
|
|
20
20
|
ContextMenu.displayName = "ContextMenu";
|
|
21
21
|
|
|
22
22
|
const ContextMenuTrigger = React.forwardRef<
|
|
23
|
-
React.
|
|
23
|
+
React.ComponentRef<typeof BaseContextMenu.Trigger>,
|
|
24
24
|
React.ComponentProps<typeof BaseContextMenu.Trigger>
|
|
25
25
|
>(({ className, ...props }, ref) => (
|
|
26
26
|
<BaseContextMenu.Trigger
|
|
@@ -32,7 +32,7 @@ const ContextMenuTrigger = React.forwardRef<
|
|
|
32
32
|
ContextMenuTrigger.displayName = "ContextMenuTrigger";
|
|
33
33
|
|
|
34
34
|
const ContextMenuPortal = React.forwardRef<
|
|
35
|
-
React.
|
|
35
|
+
React.ComponentRef<typeof BaseContextMenu.Portal>,
|
|
36
36
|
React.ComponentProps<typeof BaseContextMenu.Portal>
|
|
37
37
|
>(({ ...props }, ref) => {
|
|
38
38
|
const element = useRender({
|
|
@@ -45,7 +45,7 @@ const ContextMenuPortal = React.forwardRef<
|
|
|
45
45
|
ContextMenuPortal.displayName = "ContextMenuPortal";
|
|
46
46
|
|
|
47
47
|
const ContextMenuPositioner = React.forwardRef<
|
|
48
|
-
React.
|
|
48
|
+
React.ComponentRef<typeof BaseContextMenu.Positioner>,
|
|
49
49
|
React.ComponentProps<typeof BaseContextMenu.Positioner>
|
|
50
50
|
>(({ className, ...props }, ref) => (
|
|
51
51
|
<BaseContextMenu.Positioner
|
|
@@ -57,26 +57,62 @@ const ContextMenuPositioner = React.forwardRef<
|
|
|
57
57
|
ContextMenuPositioner.displayName = "ContextMenuPositioner";
|
|
58
58
|
|
|
59
59
|
const ContextMenuContent = React.forwardRef<
|
|
60
|
-
React.
|
|
61
|
-
React.ComponentProps<typeof BaseContextMenu.Popup>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
React.ComponentRef<typeof BaseContextMenu.Popup>,
|
|
61
|
+
React.ComponentProps<typeof BaseContextMenu.Popup> & {
|
|
62
|
+
container?: HTMLElement | React.RefObject<HTMLElement | null> | null;
|
|
63
|
+
}
|
|
64
|
+
>(({ className, container, ...props }, ref) => {
|
|
65
|
+
const [portalContainer, setPortalContainer] =
|
|
66
|
+
React.useState<HTMLElement | null>(null);
|
|
67
|
+
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
// If container is provided, use it
|
|
70
|
+
if (container) {
|
|
71
|
+
if (container instanceof HTMLElement) {
|
|
72
|
+
setPortalContainer(container);
|
|
73
|
+
} else if (container.current) {
|
|
74
|
+
setPortalContainer(container.current);
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Otherwise create/use the high-level portal root
|
|
80
|
+
let portalRoot = document.getElementById(
|
|
81
|
+
"context-menu-portal-root"
|
|
82
|
+
) as HTMLElement;
|
|
83
|
+
if (!portalRoot) {
|
|
84
|
+
portalRoot = document.createElement("div");
|
|
85
|
+
portalRoot.id = "context-menu-portal-root";
|
|
86
|
+
portalRoot.style.cssText =
|
|
87
|
+
"position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; isolation: isolate;";
|
|
88
|
+
document.body.appendChild(portalRoot);
|
|
89
|
+
}
|
|
90
|
+
setPortalContainer(portalRoot);
|
|
91
|
+
}, [container]);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<ContextMenuPortal container={portalContainer}>
|
|
95
|
+
<ContextMenuPositioner>
|
|
96
|
+
<BaseContextMenu.Popup
|
|
97
|
+
ref={ref}
|
|
98
|
+
className={cn(
|
|
99
|
+
"z-[9999] min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg pointer-events-auto",
|
|
100
|
+
"origin-[var(--transform-origin)]",
|
|
101
|
+
"outline-none focus:outline-none focus-visible:outline-none",
|
|
102
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
103
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
104
|
+
className
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
</ContextMenuPositioner>
|
|
109
|
+
</ContextMenuPortal>
|
|
110
|
+
);
|
|
111
|
+
});
|
|
76
112
|
ContextMenuContent.displayName = "ContextMenuContent";
|
|
77
113
|
|
|
78
114
|
const ContextMenuItem = React.forwardRef<
|
|
79
|
-
React.
|
|
115
|
+
React.ComponentRef<typeof BaseContextMenu.Item>,
|
|
80
116
|
React.ComponentProps<typeof BaseContextMenu.Item> & {
|
|
81
117
|
inset?: boolean;
|
|
82
118
|
}
|
|
@@ -97,7 +133,7 @@ const ContextMenuItem = React.forwardRef<
|
|
|
97
133
|
ContextMenuItem.displayName = "ContextMenuItem";
|
|
98
134
|
|
|
99
135
|
const ContextMenuCheckboxItem = React.forwardRef<
|
|
100
|
-
React.
|
|
136
|
+
React.ComponentRef<typeof BaseContextMenu.CheckboxItem>,
|
|
101
137
|
React.ComponentProps<typeof BaseContextMenu.CheckboxItem>
|
|
102
138
|
>(({ className, children, checked, ...props }, ref) => (
|
|
103
139
|
<BaseContextMenu.CheckboxItem
|
|
@@ -121,7 +157,7 @@ const ContextMenuCheckboxItem = React.forwardRef<
|
|
|
121
157
|
ContextMenuCheckboxItem.displayName = "ContextMenuCheckboxItem";
|
|
122
158
|
|
|
123
159
|
const ContextMenuRadioGroup = React.forwardRef<
|
|
124
|
-
React.
|
|
160
|
+
React.ComponentRef<typeof BaseContextMenu.RadioGroup>,
|
|
125
161
|
React.ComponentProps<typeof BaseContextMenu.RadioGroup>
|
|
126
162
|
>(({ className, ...props }, ref) => (
|
|
127
163
|
<BaseContextMenu.RadioGroup ref={ref} className={cn(className)} {...props} />
|
|
@@ -129,7 +165,7 @@ const ContextMenuRadioGroup = React.forwardRef<
|
|
|
129
165
|
ContextMenuRadioGroup.displayName = "ContextMenuRadioGroup";
|
|
130
166
|
|
|
131
167
|
const ContextMenuRadioItem = React.forwardRef<
|
|
132
|
-
React.
|
|
168
|
+
React.ComponentRef<typeof BaseContextMenu.RadioItem>,
|
|
133
169
|
React.ComponentProps<typeof BaseContextMenu.RadioItem>
|
|
134
170
|
>(({ className, children, ...props }, ref) => (
|
|
135
171
|
<BaseContextMenu.RadioItem
|
|
@@ -151,8 +187,16 @@ const ContextMenuRadioItem = React.forwardRef<
|
|
|
151
187
|
));
|
|
152
188
|
ContextMenuRadioItem.displayName = "ContextMenuRadioItem";
|
|
153
189
|
|
|
190
|
+
const ContextMenuGroup = React.forwardRef<
|
|
191
|
+
React.ComponentRef<typeof BaseContextMenu.Group>,
|
|
192
|
+
React.ComponentProps<typeof BaseContextMenu.Group>
|
|
193
|
+
>(({ className, ...props }, ref) => (
|
|
194
|
+
<BaseContextMenu.Group ref={ref} className={cn(className)} {...props} />
|
|
195
|
+
));
|
|
196
|
+
ContextMenuGroup.displayName = "ContextMenuGroup";
|
|
197
|
+
|
|
154
198
|
const ContextMenuLabel = React.forwardRef<
|
|
155
|
-
React.
|
|
199
|
+
React.ComponentRef<typeof BaseContextMenu.GroupLabel>,
|
|
156
200
|
React.ComponentProps<typeof BaseContextMenu.GroupLabel> & {
|
|
157
201
|
inset?: boolean;
|
|
158
202
|
}
|
|
@@ -170,7 +214,7 @@ const ContextMenuLabel = React.forwardRef<
|
|
|
170
214
|
ContextMenuLabel.displayName = "ContextMenuLabel";
|
|
171
215
|
|
|
172
216
|
const ContextMenuSeparator = React.forwardRef<
|
|
173
|
-
React.
|
|
217
|
+
React.ComponentRef<typeof BaseContextMenu.Separator>,
|
|
174
218
|
React.ComponentProps<typeof BaseContextMenu.Separator>
|
|
175
219
|
>(({ className, ...props }, ref) => (
|
|
176
220
|
<BaseContextMenu.Separator
|
|
@@ -199,11 +243,11 @@ ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
|
199
243
|
|
|
200
244
|
// Submenu components using Menu from @base-ui-components
|
|
201
245
|
const ContextMenuSub = React.forwardRef<
|
|
202
|
-
|
|
203
|
-
React.ComponentProps<typeof Menu.
|
|
246
|
+
HTMLDivElement,
|
|
247
|
+
React.ComponentProps<typeof Menu.SubmenuRoot>
|
|
204
248
|
>(({ children, ...props }, ref) => {
|
|
205
249
|
const element = useRender({
|
|
206
|
-
render: <Menu.
|
|
250
|
+
render: <Menu.SubmenuRoot>{children}</Menu.SubmenuRoot>,
|
|
207
251
|
props,
|
|
208
252
|
ref,
|
|
209
253
|
});
|
|
@@ -212,7 +256,7 @@ const ContextMenuSub = React.forwardRef<
|
|
|
212
256
|
ContextMenuSub.displayName = "ContextMenuSub";
|
|
213
257
|
|
|
214
258
|
const ContextMenuSubTrigger = React.forwardRef<
|
|
215
|
-
React.
|
|
259
|
+
React.ComponentRef<typeof Menu.SubmenuTrigger>,
|
|
216
260
|
React.ComponentProps<typeof Menu.SubmenuTrigger> & {
|
|
217
261
|
inset?: boolean;
|
|
218
262
|
}
|
|
@@ -237,26 +281,46 @@ const ContextMenuSubTrigger = React.forwardRef<
|
|
|
237
281
|
ContextMenuSubTrigger.displayName = "ContextMenuSubTrigger";
|
|
238
282
|
|
|
239
283
|
const ContextMenuSubContent = React.forwardRef<
|
|
240
|
-
React.
|
|
284
|
+
React.ComponentRef<typeof Menu.Popup>,
|
|
241
285
|
React.ComponentProps<typeof Menu.Popup>
|
|
242
|
-
>(({ className, ...props }, ref) =>
|
|
243
|
-
|
|
244
|
-
<
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
)
|
|
286
|
+
>(({ className, ...props }, ref) => {
|
|
287
|
+
const [portalContainer, setPortalContainer] =
|
|
288
|
+
React.useState<HTMLElement | null>(null);
|
|
289
|
+
|
|
290
|
+
React.useEffect(() => {
|
|
291
|
+
// Use the same high-level portal root for submenus
|
|
292
|
+
let portalRoot = document.getElementById(
|
|
293
|
+
"context-menu-portal-root"
|
|
294
|
+
) as HTMLElement;
|
|
295
|
+
if (!portalRoot) {
|
|
296
|
+
portalRoot = document.createElement("div");
|
|
297
|
+
portalRoot.id = "context-menu-portal-root";
|
|
298
|
+
portalRoot.style.cssText =
|
|
299
|
+
"position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; isolation: isolate;";
|
|
300
|
+
document.body.appendChild(portalRoot);
|
|
301
|
+
}
|
|
302
|
+
setPortalContainer(portalRoot);
|
|
303
|
+
}, []);
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<Menu.Portal container={portalContainer}>
|
|
307
|
+
<Menu.Positioner className="outline-none" alignOffset={-4} sideOffset={8}>
|
|
308
|
+
<Menu.Popup
|
|
309
|
+
ref={ref}
|
|
310
|
+
className={cn(
|
|
311
|
+
"z-[9999] min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg pointer-events-auto",
|
|
312
|
+
"origin-[var(--transform-origin)]",
|
|
313
|
+
"outline-none focus:outline-none focus-visible:outline-none",
|
|
314
|
+
"data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
|
|
315
|
+
"data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
|
|
316
|
+
className
|
|
317
|
+
)}
|
|
318
|
+
{...props}
|
|
319
|
+
/>
|
|
320
|
+
</Menu.Positioner>
|
|
321
|
+
</Menu.Portal>
|
|
322
|
+
);
|
|
323
|
+
});
|
|
260
324
|
ContextMenuSubContent.displayName = "ContextMenuSubContent";
|
|
261
325
|
|
|
262
326
|
export {
|
|
@@ -269,10 +333,11 @@ export {
|
|
|
269
333
|
ContextMenuCheckboxItem,
|
|
270
334
|
ContextMenuRadioGroup,
|
|
271
335
|
ContextMenuRadioItem,
|
|
336
|
+
ContextMenuGroup,
|
|
272
337
|
ContextMenuLabel,
|
|
273
338
|
ContextMenuSeparator,
|
|
274
339
|
ContextMenuShortcut,
|
|
275
340
|
ContextMenuSub,
|
|
276
341
|
ContextMenuSubTrigger,
|
|
277
342
|
ContextMenuSubContent,
|
|
278
|
-
};
|
|
343
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
"use client"
|
|
3
3
|
import * as React from "react"
|
|
4
|
-
import { Dialog as BaseDialog } from "@base-ui
|
|
4
|
+
import { Dialog as BaseDialog } from "@base-ui/react/dialog"
|
|
5
5
|
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
7
|
const Dialog = BaseDialog.Root
|
|
@@ -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"
|
package/templates/form/form.tsx
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use client"
|
|
3
3
|
|
|
4
4
|
import * as React from "react"
|
|
5
|
-
import { Form as BaseForm } from "@base-ui
|
|
6
|
-
import { useRender } from "@base-ui
|
|
7
|
-
import { mergeProps } from "@base-ui
|
|
5
|
+
import { Form as BaseForm } from "@base-ui/react/form"
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render"
|
|
7
|
+
import { mergeProps } from "@base-ui/react/merge-props"
|
|
8
8
|
import { cn } from "@/lib/utils"
|
|
9
9
|
|
|
10
10
|
// Type definitions for form errors
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Input as BaseInput } from "@base-ui/react/input";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
3
5
|
|
|
4
|
-
const Input = React.forwardRef<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
const Input = React.forwardRef<
|
|
7
|
+
HTMLInputElement,
|
|
8
|
+
React.ComponentProps<typeof BaseInput>
|
|
9
|
+
>(({ className, ...props }, ref) => {
|
|
10
|
+
return (
|
|
11
|
+
<BaseInput
|
|
12
|
+
className={cn(
|
|
13
|
+
"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",
|
|
14
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
15
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
ref={ref}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
Input.displayName = "Input";
|
|
16
24
|
|
|
17
|
-
export { Input }
|
|
25
|
+
export { Input };
|
|
@@ -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"
|