@dinachi/cli 0.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.
Files changed (50) hide show
  1. package/README.md +131 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +643 -0
  4. package/package.json +56 -0
  5. package/templates/accordion/accordion.tsx +85 -0
  6. package/templates/accordion/index.ts +1 -0
  7. package/templates/alert-dialog/alert-dialog.tsx +162 -0
  8. package/templates/alert-dialog/index.ts +13 -0
  9. package/templates/avatar/avatar.tsx +64 -0
  10. package/templates/avatar/index.ts +1 -0
  11. package/templates/button/button.tsx +54 -0
  12. package/templates/button/index.ts +2 -0
  13. package/templates/checkbox/checkbox.tsx +29 -0
  14. package/templates/checkbox/index.ts +1 -0
  15. package/templates/checkbox-group/checkbox-group.tsx +19 -0
  16. package/templates/checkbox-group/index.ts +1 -0
  17. package/templates/collapsible/collapsible.tsx +65 -0
  18. package/templates/collapsible/index.ts +1 -0
  19. package/templates/context-menu/context-menu.tsx +278 -0
  20. package/templates/context-menu/index.ts +17 -0
  21. package/templates/dialog/dialog.tsx +158 -0
  22. package/templates/dialog/index.ts +1 -0
  23. package/templates/field/field.tsx +119 -0
  24. package/templates/field/index.ts +1 -0
  25. package/templates/form/form.tsx +71 -0
  26. package/templates/form/index.ts +1 -0
  27. package/templates/input/index.ts +2 -0
  28. package/templates/input/input.tsx +17 -0
  29. package/templates/menubar/index.ts +18 -0
  30. package/templates/menubar/menubar.tsx +303 -0
  31. package/templates/navigation-menu/index.ts +13 -0
  32. package/templates/navigation-menu/navigation-menu.tsx +205 -0
  33. package/templates/preview-card/index.ts +1 -0
  34. package/templates/preview-card/preview-card.tsx +142 -0
  35. package/templates/select/index.ts +1 -0
  36. package/templates/select/select.tsx +208 -0
  37. package/templates/slider/index.ts +9 -0
  38. package/templates/slider/slider.tsx +121 -0
  39. package/templates/tabs/index.ts +7 -0
  40. package/templates/tabs/tabs.tsx +89 -0
  41. package/templates/toast/index.ts +1 -0
  42. package/templates/toast/toast.tsx +276 -0
  43. package/templates/toggle/index.ts +1 -0
  44. package/templates/toggle/toggle.tsx +83 -0
  45. package/templates/toolbar/index.ts +1 -0
  46. package/templates/toolbar/toolbar.tsx +124 -0
  47. package/templates/tooltip/index.ts +1 -0
  48. package/templates/tooltip/tooltip.tsx +217 -0
  49. package/templates/utils/utils.ts +7 -0
  50. package/templates/utils/variants.ts +7 -0
@@ -0,0 +1,278 @@
1
+ // @ts-nocheck
2
+ import * as React from "react";
3
+ import { ContextMenu as BaseContextMenu } from "@base-ui-components/react/context-menu";
4
+ import { Menu } from "@base-ui-components/react/menu";
5
+ import { cn } from "@/lib/utils"
6
+ import { Check, ChevronRight, Circle } from "lucide-react";
7
+ import { useRender } from "@base-ui-components/react/use-render";
8
+
9
+ const ContextMenu = React.forwardRef<
10
+ React.ElementRef<typeof BaseContextMenu.Root>,
11
+ React.ComponentProps<typeof BaseContextMenu.Root>
12
+ >(({ children, ...props }, ref) => {
13
+ const element = useRender({
14
+ render: <BaseContextMenu.Root>{children}</BaseContextMenu.Root>,
15
+ props,
16
+ ref,
17
+ });
18
+ return element;
19
+ });
20
+ ContextMenu.displayName = "ContextMenu";
21
+
22
+ const ContextMenuTrigger = React.forwardRef<
23
+ React.ElementRef<typeof BaseContextMenu.Trigger>,
24
+ React.ComponentProps<typeof BaseContextMenu.Trigger>
25
+ >(({ className, ...props }, ref) => (
26
+ <BaseContextMenu.Trigger
27
+ ref={ref}
28
+ className={cn("select-none", className)}
29
+ {...props}
30
+ />
31
+ ));
32
+ ContextMenuTrigger.displayName = "ContextMenuTrigger";
33
+
34
+ const ContextMenuPortal = React.forwardRef<
35
+ React.ElementRef<typeof BaseContextMenu.Portal>,
36
+ React.ComponentProps<typeof BaseContextMenu.Portal>
37
+ >(({ ...props }, ref) => {
38
+ const element = useRender({
39
+ render: <BaseContextMenu.Portal />,
40
+ props,
41
+ ref,
42
+ });
43
+ return element;
44
+ });
45
+ ContextMenuPortal.displayName = "ContextMenuPortal";
46
+
47
+ const ContextMenuPositioner = React.forwardRef<
48
+ React.ElementRef<typeof BaseContextMenu.Positioner>,
49
+ React.ComponentProps<typeof BaseContextMenu.Positioner>
50
+ >(({ className, ...props }, ref) => (
51
+ <BaseContextMenu.Positioner
52
+ ref={ref}
53
+ className={cn("outline-none", className)}
54
+ {...props}
55
+ />
56
+ ));
57
+ ContextMenuPositioner.displayName = "ContextMenuPositioner";
58
+
59
+ const ContextMenuContent = React.forwardRef<
60
+ React.ElementRef<typeof BaseContextMenu.Popup>,
61
+ React.ComponentProps<typeof BaseContextMenu.Popup>
62
+ >(({ className, ...props }, ref) => (
63
+ <BaseContextMenu.Popup
64
+ ref={ref}
65
+ className={cn(
66
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
67
+ "origin-[var(--transform-origin)]",
68
+ "outline-none focus:outline-none focus-visible:outline-none",
69
+ "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
70
+ "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
71
+ className
72
+ )}
73
+ {...props}
74
+ />
75
+ ));
76
+ ContextMenuContent.displayName = "ContextMenuContent";
77
+
78
+ const ContextMenuItem = React.forwardRef<
79
+ React.ElementRef<typeof BaseContextMenu.Item>,
80
+ React.ComponentProps<typeof BaseContextMenu.Item> & {
81
+ inset?: boolean;
82
+ }
83
+ >(({ className, inset, ...props }, ref) => (
84
+ <BaseContextMenu.Item
85
+ ref={ref}
86
+ className={cn(
87
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
88
+ "focus:bg-accent focus:text-accent-foreground",
89
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
90
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
91
+ inset && "pl-8",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ ));
97
+ ContextMenuItem.displayName = "ContextMenuItem";
98
+
99
+ const ContextMenuCheckboxItem = React.forwardRef<
100
+ React.ElementRef<typeof BaseContextMenu.CheckboxItem>,
101
+ React.ComponentProps<typeof BaseContextMenu.CheckboxItem>
102
+ >(({ className, children, checked, ...props }, ref) => (
103
+ <BaseContextMenu.CheckboxItem
104
+ ref={ref}
105
+ className={cn(
106
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
107
+ "focus:bg-accent focus:text-accent-foreground",
108
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
109
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
110
+ className
111
+ )}
112
+ checked={checked}
113
+ {...props}
114
+ >
115
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
116
+ {checked && <Check className="h-4 w-4" />}
117
+ </span>
118
+ {children}
119
+ </BaseContextMenu.CheckboxItem>
120
+ ));
121
+ ContextMenuCheckboxItem.displayName = "ContextMenuCheckboxItem";
122
+
123
+ const ContextMenuRadioGroup = React.forwardRef<
124
+ React.ElementRef<typeof BaseContextMenu.RadioGroup>,
125
+ React.ComponentProps<typeof BaseContextMenu.RadioGroup>
126
+ >(({ className, ...props }, ref) => (
127
+ <BaseContextMenu.RadioGroup ref={ref} className={cn(className)} {...props} />
128
+ ));
129
+ ContextMenuRadioGroup.displayName = "ContextMenuRadioGroup";
130
+
131
+ const ContextMenuRadioItem = React.forwardRef<
132
+ React.ElementRef<typeof BaseContextMenu.RadioItem>,
133
+ React.ComponentProps<typeof BaseContextMenu.RadioItem>
134
+ >(({ className, children, ...props }, ref) => (
135
+ <BaseContextMenu.RadioItem
136
+ ref={ref}
137
+ className={cn(
138
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
139
+ "focus:bg-accent focus:text-accent-foreground",
140
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
141
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
142
+ className
143
+ )}
144
+ {...props}
145
+ >
146
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
147
+ <Circle className="h-2 w-2 fill-current data-[checked]:block data-[unchecked]:hidden" />
148
+ </span>
149
+ {children}
150
+ </BaseContextMenu.RadioItem>
151
+ ));
152
+ ContextMenuRadioItem.displayName = "ContextMenuRadioItem";
153
+
154
+ const ContextMenuLabel = React.forwardRef<
155
+ React.ElementRef<typeof BaseContextMenu.GroupLabel>,
156
+ React.ComponentProps<typeof BaseContextMenu.GroupLabel> & {
157
+ inset?: boolean;
158
+ }
159
+ >(({ className, inset, ...props }, ref) => (
160
+ <BaseContextMenu.GroupLabel
161
+ ref={ref}
162
+ className={cn(
163
+ "px-2 py-1.5 text-sm font-semibold text-foreground",
164
+ inset && "pl-8",
165
+ className
166
+ )}
167
+ {...props}
168
+ />
169
+ ));
170
+ ContextMenuLabel.displayName = "ContextMenuLabel";
171
+
172
+ const ContextMenuSeparator = React.forwardRef<
173
+ React.ElementRef<typeof BaseContextMenu.Separator>,
174
+ React.ComponentProps<typeof BaseContextMenu.Separator>
175
+ >(({ className, ...props }, ref) => (
176
+ <BaseContextMenu.Separator
177
+ ref={ref}
178
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
179
+ {...props}
180
+ />
181
+ ));
182
+ ContextMenuSeparator.displayName = "ContextMenuSeparator";
183
+
184
+ const ContextMenuShortcut = ({
185
+ className,
186
+ ...props
187
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
188
+ return (
189
+ <span
190
+ className={cn(
191
+ "ml-auto text-xs tracking-widest text-muted-foreground",
192
+ className
193
+ )}
194
+ {...props}
195
+ />
196
+ );
197
+ };
198
+ ContextMenuShortcut.displayName = "ContextMenuShortcut";
199
+
200
+ // Submenu components using Menu from @base-ui-components
201
+ const ContextMenuSub = React.forwardRef<
202
+ React.ElementRef<typeof Menu.Root>,
203
+ React.ComponentProps<typeof Menu.Root>
204
+ >(({ children, ...props }, ref) => {
205
+ const element = useRender({
206
+ render: <Menu.Root>{children}</Menu.Root>,
207
+ props,
208
+ ref,
209
+ });
210
+ return element;
211
+ });
212
+ ContextMenuSub.displayName = "ContextMenuSub";
213
+
214
+ const ContextMenuSubTrigger = React.forwardRef<
215
+ React.ElementRef<typeof Menu.SubmenuTrigger>,
216
+ React.ComponentProps<typeof Menu.SubmenuTrigger> & {
217
+ inset?: boolean;
218
+ }
219
+ >(({ className, inset, children, ...props }, ref) => (
220
+ <Menu.SubmenuTrigger
221
+ ref={ref}
222
+ className={cn(
223
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
224
+ "focus:bg-accent focus:text-accent-foreground",
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",
228
+ inset && "pl-8",
229
+ className
230
+ )}
231
+ {...props}
232
+ >
233
+ {children}
234
+ <ChevronRight className="ml-auto h-4 w-4" />
235
+ </Menu.SubmenuTrigger>
236
+ ));
237
+ ContextMenuSubTrigger.displayName = "ContextMenuSubTrigger";
238
+
239
+ const ContextMenuSubContent = React.forwardRef<
240
+ React.ElementRef<typeof Menu.Popup>,
241
+ React.ComponentProps<typeof Menu.Popup>
242
+ >(({ className, ...props }, ref) => (
243
+ <Menu.Portal>
244
+ <Menu.Positioner className="outline-none" alignOffset={-4} sideOffset={8}>
245
+ <Menu.Popup
246
+ ref={ref}
247
+ className={cn(
248
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
249
+ "origin-[var(--transform-origin)]",
250
+ "outline-none focus:outline-none focus-visible:outline-none",
251
+ "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
252
+ "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
253
+ className
254
+ )}
255
+ {...props}
256
+ />
257
+ </Menu.Positioner>
258
+ </Menu.Portal>
259
+ ));
260
+ ContextMenuSubContent.displayName = "ContextMenuSubContent";
261
+
262
+ export {
263
+ ContextMenu,
264
+ ContextMenuTrigger,
265
+ ContextMenuPortal,
266
+ ContextMenuPositioner,
267
+ ContextMenuContent,
268
+ ContextMenuItem,
269
+ ContextMenuCheckboxItem,
270
+ ContextMenuRadioGroup,
271
+ ContextMenuRadioItem,
272
+ ContextMenuLabel,
273
+ ContextMenuSeparator,
274
+ ContextMenuShortcut,
275
+ ContextMenuSub,
276
+ ContextMenuSubTrigger,
277
+ ContextMenuSubContent,
278
+ };
@@ -0,0 +1,17 @@
1
+ export {
2
+ ContextMenu,
3
+ ContextMenuTrigger,
4
+ ContextMenuPortal,
5
+ ContextMenuPositioner,
6
+ ContextMenuContent,
7
+ ContextMenuItem,
8
+ ContextMenuCheckboxItem,
9
+ ContextMenuRadioGroup,
10
+ ContextMenuRadioItem,
11
+ ContextMenuLabel,
12
+ ContextMenuSeparator,
13
+ ContextMenuShortcut,
14
+ ContextMenuSub,
15
+ ContextMenuSubTrigger,
16
+ ContextMenuSubContent,
17
+ } from "./context-menu";
@@ -0,0 +1,158 @@
1
+ // @ts-nocheck
2
+ import * as React from "react"
3
+ import { Dialog as BaseDialog } from "@base-ui-components/react/dialog"
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const Dialog = BaseDialog.Root
7
+
8
+ const DialogTrigger = React.forwardRef<
9
+ HTMLButtonElement,
10
+ React.ComponentProps<typeof BaseDialog.Trigger>
11
+ >(({ className, ...props }, ref) => (
12
+ <BaseDialog.Trigger
13
+ ref={ref}
14
+ className={cn(
15
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors",
16
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
17
+ "disabled:pointer-events-none disabled:opacity-50",
18
+ "bg-primary text-primary-foreground hover:bg-primary/90",
19
+ "h-10 px-4 py-2",
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ ))
25
+ DialogTrigger.displayName = "DialogTrigger"
26
+
27
+ const DialogPortal = BaseDialog.Portal
28
+
29
+ const DialogBackdrop = React.forwardRef<
30
+ HTMLDivElement,
31
+ React.ComponentProps<typeof BaseDialog.Backdrop>
32
+ >(({ className, ...props }, ref) => (
33
+ <BaseDialog.Backdrop
34
+ ref={ref}
35
+ className={cn(
36
+ "fixed inset-0 z-50 bg-black/80",
37
+ "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
38
+ "transition-all duration-150",
39
+ className
40
+ )}
41
+ {...props}
42
+ />
43
+ ))
44
+ DialogBackdrop.displayName = "DialogBackdrop"
45
+
46
+ const DialogPopup = React.forwardRef<
47
+ HTMLDivElement,
48
+ React.ComponentProps<typeof BaseDialog.Popup>
49
+ >(({ className, ...props }, ref) => (
50
+ <BaseDialog.Popup
51
+ ref={ref}
52
+ className={cn(
53
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg sm:rounded-lg",
54
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
55
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
56
+ "transition-all duration-150",
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ ))
62
+ DialogPopup.displayName = "DialogPopup"
63
+
64
+ const DialogTitle = React.forwardRef<
65
+ HTMLHeadingElement,
66
+ React.ComponentProps<typeof BaseDialog.Title>
67
+ >(({ className, ...props }, ref) => (
68
+ <BaseDialog.Title
69
+ ref={ref}
70
+ className={cn("text-lg font-semibold leading-none tracking-tight", className)}
71
+ {...props}
72
+ />
73
+ ))
74
+ DialogTitle.displayName = "DialogTitle"
75
+
76
+ const DialogDescription = React.forwardRef<
77
+ HTMLParagraphElement,
78
+ React.ComponentProps<typeof BaseDialog.Description>
79
+ >(({ className, ...props }, ref) => (
80
+ <BaseDialog.Description
81
+ ref={ref}
82
+ className={cn("text-sm text-muted-foreground", className)}
83
+ {...props}
84
+ />
85
+ ))
86
+ DialogDescription.displayName = "DialogDescription"
87
+
88
+ const DialogClose = React.forwardRef<
89
+ HTMLButtonElement,
90
+ React.ComponentProps<typeof BaseDialog.Close>
91
+ >(({ className, ...props }, ref) => (
92
+ <BaseDialog.Close
93
+ ref={ref}
94
+ className={cn(
95
+ "inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-semibold shadow-sm transition-colors",
96
+ "hover:bg-accent hover:text-accent-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
97
+ "disabled:cursor-not-allowed disabled:opacity-50",
98
+ className
99
+ )}
100
+ {...props}
101
+ />
102
+ ))
103
+ DialogClose.displayName = "DialogClose"
104
+
105
+ const DialogHeader = ({
106
+ className,
107
+ ...props
108
+ }: React.HTMLAttributes<HTMLDivElement>) => (
109
+ <div
110
+ className={cn(
111
+ "flex flex-col space-y-1.5 text-center sm:text-left",
112
+ className
113
+ )}
114
+ {...props}
115
+ />
116
+ )
117
+ DialogHeader.displayName = "DialogHeader"
118
+
119
+ const DialogFooter = ({
120
+ className,
121
+ ...props
122
+ }: React.HTMLAttributes<HTMLDivElement>) => (
123
+ <div
124
+ className={cn(
125
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
126
+ className
127
+ )}
128
+ {...props}
129
+ />
130
+ )
131
+ DialogFooter.displayName = "DialogFooter"
132
+
133
+ const DialogContent = React.forwardRef<
134
+ HTMLDivElement,
135
+ React.ComponentProps<typeof BaseDialog.Popup>
136
+ >(({ className, children, ...props }, ref) => (
137
+ <DialogPortal>
138
+ <DialogBackdrop />
139
+ <DialogPopup ref={ref} className={className} {...props}>
140
+ {children}
141
+ </DialogPopup>
142
+ </DialogPortal>
143
+ ))
144
+ DialogContent.displayName = "DialogContent"
145
+
146
+ export {
147
+ Dialog,
148
+ DialogTrigger,
149
+ DialogPortal,
150
+ DialogBackdrop,
151
+ DialogPopup,
152
+ DialogTitle,
153
+ DialogDescription,
154
+ DialogClose,
155
+ DialogHeader,
156
+ DialogFooter,
157
+ DialogContent,
158
+ }
@@ -0,0 +1 @@
1
+ export * from "./dialog"
@@ -0,0 +1,119 @@
1
+ // @ts-nocheck
2
+ import * as React from "react";
3
+ import { Field as BaseField } from "@base-ui-components/react/field";
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const Field = React.forwardRef<
7
+ HTMLDivElement,
8
+ React.ComponentProps<typeof BaseField.Root>
9
+ >(({ className, ...props }, ref) => {
10
+ return (
11
+ <BaseField.Root
12
+ ref={ref}
13
+ className={cn("space-y-2", className)}
14
+ {...props}
15
+ />
16
+ );
17
+ });
18
+
19
+ const FieldLabel = React.forwardRef<
20
+ HTMLLabelElement,
21
+ React.ComponentProps<typeof BaseField.Label>
22
+ >(({ className, ...props }, ref) => {
23
+ return (
24
+ <BaseField.Label
25
+ ref={ref}
26
+ className={cn(
27
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
28
+ "data-[invalid]:text-destructive",
29
+ className
30
+ )}
31
+ {...props}
32
+ />
33
+ );
34
+ });
35
+
36
+ const FieldControl = React.forwardRef<
37
+ HTMLInputElement,
38
+ React.ComponentProps<typeof BaseField.Control>
39
+ >(({ className, ...props }, ref) => {
40
+ return (
41
+ <BaseField.Control
42
+ ref={ref}
43
+ className={cn(
44
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",
45
+ "file:border-0 file:bg-transparent file:text-sm file:font-medium",
46
+ "placeholder:text-muted-foreground",
47
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
48
+ "disabled:cursor-not-allowed disabled:opacity-50",
49
+ "data-[invalid]:border-destructive data-[invalid]:ring-destructive",
50
+ className
51
+ )}
52
+ {...props}
53
+ />
54
+ );
55
+ });
56
+
57
+ const FieldDescription = React.forwardRef<
58
+ HTMLParagraphElement,
59
+ React.ComponentProps<typeof BaseField.Description>
60
+ >(({ className, ...props }, ref) => {
61
+ return (
62
+ <BaseField.Description
63
+ ref={ref}
64
+ className={cn(
65
+ "text-sm text-muted-foreground",
66
+ "data-[disabled]:opacity-50",
67
+ className
68
+ )}
69
+ {...props}
70
+ />
71
+ );
72
+ });
73
+
74
+ const FieldError = React.forwardRef<
75
+ HTMLParagraphElement,
76
+ React.ComponentProps<typeof BaseField.Error>
77
+ >(({ className, ...props }, ref) => {
78
+ return (
79
+ <BaseField.Error
80
+ ref={ref}
81
+ className={cn(
82
+ "text-sm font-medium text-destructive",
83
+ "data-[disabled]:opacity-50",
84
+ className
85
+ )}
86
+ {...props}
87
+ />
88
+ );
89
+ });
90
+
91
+ const FieldValidity = React.forwardRef<
92
+ HTMLDivElement,
93
+ React.ComponentProps<typeof BaseField.Validity> & { className?: string }
94
+ >(({ className, children, ...props }, ref) => {
95
+ return (
96
+ <div
97
+ ref={ref}
98
+ className={cn("text-sm", "data-[disabled]:opacity-50", className)}
99
+ >
100
+ <BaseField.Validity {...props}>{children}</BaseField.Validity>
101
+ </div>
102
+ );
103
+ });
104
+
105
+ Field.displayName = "Field";
106
+ FieldLabel.displayName = "FieldLabel";
107
+ FieldControl.displayName = "FieldControl";
108
+ FieldDescription.displayName = "FieldDescription";
109
+ FieldError.displayName = "FieldError";
110
+ FieldValidity.displayName = "FieldValidity";
111
+
112
+ export {
113
+ Field,
114
+ FieldLabel,
115
+ FieldControl,
116
+ FieldDescription,
117
+ FieldError,
118
+ FieldValidity,
119
+ };
@@ -0,0 +1 @@
1
+ export * from './field';
@@ -0,0 +1,71 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { Form as BaseForm } from "@base-ui-components/react/form"
6
+ import { useRender } from "@base-ui-components/react/use-render"
7
+ import { mergeProps } from "@base-ui-components/react/merge-props"
8
+ import { cn } from "@/lib/utils"
9
+
10
+ // Type definitions for form errors
11
+ export type Errors = Record<string, string | string[]>
12
+
13
+ // Form state interface
14
+ export interface FormState extends Record<string, unknown> {
15
+ errors: Errors
16
+ }
17
+
18
+ // Form component props interface using useRender types
19
+ export interface FormProps extends useRender.ComponentProps<'form', FormState> {
20
+ /**
21
+ * Object containing field errors where keys are field names and values are error messages
22
+ */
23
+ errors?: Errors
24
+ /**
25
+ * Callback function called when errors should be cleared
26
+ */
27
+ onClearErrors?: (errors: Errors) => void
28
+ /**
29
+ * Form submission handler
30
+ */
31
+ onSubmit?: React.FormEventHandler<HTMLFormElement>
32
+ }
33
+
34
+ const Form = React.forwardRef<
35
+ HTMLFormElement,
36
+ FormProps
37
+ >(({ className, errors = {}, onClearErrors, render = <form />, children, onSubmit, ...props }, ref) => {
38
+ // Create form state object
39
+ const formState: FormState = React.useMemo(() => ({
40
+ errors
41
+ }), [errors])
42
+
43
+ // Default form props
44
+ const defaultProps: useRender.ElementProps<'form'> = {
45
+ className: cn("space-y-4", className),
46
+ onSubmit,
47
+ children: (
48
+ <BaseForm
49
+ errors={errors}
50
+ onClearErrors={onClearErrors}
51
+ className="contents" // Use contents to avoid wrapper styling
52
+ >
53
+ {children}
54
+ </BaseForm>
55
+ )
56
+ }
57
+
58
+ // Use the useRender hook to handle render prop pattern
59
+ const element = useRender({
60
+ render,
61
+ props: mergeProps<'form'>(defaultProps, props),
62
+ state: formState,
63
+ ref
64
+ })
65
+
66
+ return element
67
+ })
68
+
69
+ Form.displayName = "Form"
70
+
71
+ export { Form }
@@ -0,0 +1 @@
1
+ export * from "./form"
@@ -0,0 +1,2 @@
1
+ export { Input, inputVariants } from "./input"
2
+ export type { InputProps } from "./input"
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { Input as BaseInput } from '@base-ui-components/react/input';
3
+
4
+ const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<typeof BaseInput>>(
5
+ ({ className, ...props }, ref) => {
6
+ return (
7
+ <BaseInput
8
+ className="h-10 w-full max-w-64 rounded-md border border-gray-200 pl-3.5 text-base text-gray-900 focus:outline focus:outline-2 focus:-outline-offset-1 focus:outline-blue-800"
9
+ ref={ref}
10
+ {...props}
11
+ />
12
+ )
13
+ }
14
+ )
15
+ Input.displayName = "Input"
16
+
17
+ export { Input }
@@ -0,0 +1,18 @@
1
+ export {
2
+ Menubar,
3
+ MenubarMenu,
4
+ MenubarTrigger,
5
+ MenubarPortal,
6
+ MenubarPositioner,
7
+ MenubarContent,
8
+ MenubarItem,
9
+ MenubarCheckboxItem,
10
+ MenubarRadioGroup,
11
+ MenubarRadioItem,
12
+ MenubarLabel,
13
+ MenubarSeparator,
14
+ MenubarShortcut,
15
+ MenubarSub,
16
+ MenubarSubTrigger,
17
+ MenubarSubContent,
18
+ } from "./menubar"