@dinachi/cli 0.6.3 → 0.7.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 (36) hide show
  1. package/dist/index.js +122 -33
  2. package/package.json +2 -3
  3. package/templates/alert-dialog/alert-dialog.tsx +62 -47
  4. package/templates/autocomplete/autocomplete.tsx +7 -7
  5. package/templates/badge/badge.tsx +58 -119
  6. package/templates/card/card.tsx +1 -1
  7. package/templates/checkbox/checkbox.tsx +16 -14
  8. package/templates/combobox/combobox.tsx +5 -5
  9. package/templates/context-menu/context-menu.tsx +124 -186
  10. package/templates/context-menu/index.ts +3 -1
  11. package/templates/dialog/dialog.tsx +26 -27
  12. package/templates/drawer/drawer.tsx +23 -21
  13. package/templates/field/field.tsx +5 -15
  14. package/templates/form/form.tsx +9 -66
  15. package/templates/label/index.ts +1 -0
  16. package/templates/label/label.tsx +21 -0
  17. package/templates/menu/index.ts +2 -0
  18. package/templates/menu/menu.tsx +59 -61
  19. package/templates/menubar/menubar.tsx +44 -72
  20. package/templates/navigation-menu/navigation-menu.tsx +61 -18
  21. package/templates/popover/index.ts +4 -1
  22. package/templates/popover/popover.tsx +80 -30
  23. package/templates/preview-card/preview-card.tsx +19 -5
  24. package/templates/radio/index.ts +1 -1
  25. package/templates/radio/radio.tsx +30 -14
  26. package/templates/select/select.tsx +75 -73
  27. package/templates/skeleton/index.ts +1 -0
  28. package/templates/skeleton/skeleton.tsx +12 -0
  29. package/templates/slider/slider.tsx +9 -15
  30. package/templates/switch/switch.tsx +15 -11
  31. package/templates/tabs/tabs.tsx +2 -2
  32. package/templates/toast/toast.tsx +76 -48
  33. package/templates/toggle/toggle.tsx +0 -17
  34. package/templates/toggle-group/toggle-group.tsx +8 -3
  35. package/templates/toolbar/toolbar.tsx +5 -4
  36. package/templates/tooltip/tooltip.tsx +9 -54
@@ -1,22 +1,14 @@
1
- import * as React from "react";
2
- import { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu";
3
- import { Menu } from "@base-ui/react/menu";
4
- import { useRender } from "@base-ui/react/use-render";
5
- import { cn } from "@/lib/utils";
6
- import { Check, ChevronRight, Circle } from "lucide-react";
1
+ "use client"
7
2
 
8
- const ContextMenu = React.forwardRef<
9
- React.ComponentRef<typeof BaseContextMenu.Root>,
10
- React.ComponentProps<typeof BaseContextMenu.Root>
11
- >(({ children, ...props }, ref) => {
12
- const element = useRender({
13
- render: <BaseContextMenu.Root>{children}</BaseContextMenu.Root>,
14
- props,
15
- ref,
16
- });
17
- return element;
18
- });
19
- ContextMenu.displayName = "ContextMenu";
3
+ import * as React from "react"
4
+ import { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu"
5
+ import { cn } from "@/lib/utils"
6
+ import { Check, ChevronRight, Circle } from "lucide-react"
7
+
8
+ const ContextMenu: React.FC<React.ComponentProps<typeof BaseContextMenu.Root>> = (props) => (
9
+ <BaseContextMenu.Root {...props} />
10
+ )
11
+ ContextMenu.displayName = "ContextMenu"
20
12
 
21
13
  const ContextMenuTrigger = React.forwardRef<
22
14
  React.ComponentRef<typeof BaseContextMenu.Trigger>,
@@ -27,21 +19,13 @@ const ContextMenuTrigger = React.forwardRef<
27
19
  className={cn("select-none", className)}
28
20
  {...props}
29
21
  />
30
- ));
31
- ContextMenuTrigger.displayName = "ContextMenuTrigger";
22
+ ))
23
+ ContextMenuTrigger.displayName = "ContextMenuTrigger"
32
24
 
33
- const ContextMenuPortal = React.forwardRef<
34
- React.ComponentRef<typeof BaseContextMenu.Portal>,
25
+ const ContextMenuPortal: React.FC<
35
26
  React.ComponentProps<typeof BaseContextMenu.Portal>
36
- >(({ ...props }, ref) => {
37
- const element = useRender({
38
- render: <BaseContextMenu.Portal />,
39
- props,
40
- ref,
41
- });
42
- return element;
43
- });
44
- ContextMenuPortal.displayName = "ContextMenuPortal";
27
+ > = (props) => <BaseContextMenu.Portal {...props} />
28
+ ContextMenuPortal.displayName = "ContextMenuPortal"
45
29
 
46
30
  const ContextMenuPositioner = React.forwardRef<
47
31
  React.ComponentRef<typeof BaseContextMenu.Positioner>,
@@ -52,68 +36,36 @@ const ContextMenuPositioner = React.forwardRef<
52
36
  className={cn("outline-none", className)}
53
37
  {...props}
54
38
  />
55
- ));
56
- ContextMenuPositioner.displayName = "ContextMenuPositioner";
39
+ ))
40
+ ContextMenuPositioner.displayName = "ContextMenuPositioner"
57
41
 
58
42
  const ContextMenuContent = React.forwardRef<
59
43
  React.ComponentRef<typeof BaseContextMenu.Popup>,
60
- React.ComponentProps<typeof BaseContextMenu.Popup> & {
61
- container?: HTMLElement | React.RefObject<HTMLElement | null> | null;
62
- }
63
- >(({ className, container, ...props }, ref) => {
64
- const [portalContainer, setPortalContainer] =
65
- React.useState<HTMLElement | null>(null);
66
-
67
- React.useEffect(() => {
68
- // If container is provided, use it
69
- if (container) {
70
- if (container instanceof HTMLElement) {
71
- setPortalContainer(container);
72
- } else if (container.current) {
73
- setPortalContainer(container.current);
74
- }
75
- return;
76
- }
77
-
78
- // Otherwise create/use the high-level portal root
79
- let portalRoot = document.getElementById(
80
- "context-menu-portal-root"
81
- ) as HTMLElement;
82
- if (!portalRoot) {
83
- portalRoot = document.createElement("div");
84
- portalRoot.id = "context-menu-portal-root";
85
- portalRoot.style.cssText =
86
- "position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; isolation: isolate;";
87
- document.body.appendChild(portalRoot);
88
- }
89
- setPortalContainer(portalRoot);
90
- }, [container]);
91
-
92
- return (
93
- <ContextMenuPortal container={portalContainer}>
94
- <ContextMenuPositioner>
95
- <BaseContextMenu.Popup
96
- ref={ref}
97
- className={cn(
98
- "z-[9999] min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg pointer-events-auto",
99
- "origin-[var(--transform-origin)]",
100
- "outline-none focus:outline-none focus-visible:outline-none",
101
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
102
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
103
- className
104
- )}
105
- {...props}
106
- />
107
- </ContextMenuPositioner>
108
- </ContextMenuPortal>
109
- );
110
- });
111
- ContextMenuContent.displayName = "ContextMenuContent";
44
+ React.ComponentProps<typeof BaseContextMenu.Popup>
45
+ >(({ className, ...props }, ref) => (
46
+ <ContextMenuPortal>
47
+ <ContextMenuPositioner>
48
+ <BaseContextMenu.Popup
49
+ ref={ref}
50
+ className={cn(
51
+ "z-50 min-w-48 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
52
+ "origin-(--transform-origin)",
53
+ "outline-none focus:outline-none focus-visible:outline-none",
54
+ "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
55
+ "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
56
+ className
57
+ )}
58
+ {...props}
59
+ />
60
+ </ContextMenuPositioner>
61
+ </ContextMenuPortal>
62
+ ))
63
+ ContextMenuContent.displayName = "ContextMenuContent"
112
64
 
113
65
  const ContextMenuItem = React.forwardRef<
114
66
  React.ComponentRef<typeof BaseContextMenu.Item>,
115
67
  React.ComponentProps<typeof BaseContextMenu.Item> & {
116
- inset?: boolean;
68
+ inset?: boolean
117
69
  }
118
70
  >(({ className, inset, ...props }, ref) => (
119
71
  <BaseContextMenu.Item
@@ -128,13 +80,30 @@ const ContextMenuItem = React.forwardRef<
128
80
  )}
129
81
  {...props}
130
82
  />
131
- ));
132
- ContextMenuItem.displayName = "ContextMenuItem";
83
+ ))
84
+ ContextMenuItem.displayName = "ContextMenuItem"
85
+
86
+ const ContextMenuLinkItem = React.forwardRef<
87
+ React.ComponentRef<typeof BaseContextMenu.LinkItem>,
88
+ React.ComponentProps<typeof BaseContextMenu.LinkItem>
89
+ >(({ className, ...props }, ref) => (
90
+ <BaseContextMenu.LinkItem
91
+ ref={ref}
92
+ className={cn(
93
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
94
+ "focus:bg-accent focus:text-accent-foreground",
95
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
96
+ className
97
+ )}
98
+ {...props}
99
+ />
100
+ ))
101
+ ContextMenuLinkItem.displayName = "ContextMenuLinkItem"
133
102
 
134
103
  const ContextMenuCheckboxItem = React.forwardRef<
135
104
  React.ComponentRef<typeof BaseContextMenu.CheckboxItem>,
136
105
  React.ComponentProps<typeof BaseContextMenu.CheckboxItem>
137
- >(({ className, children, checked, ...props }, ref) => (
106
+ >(({ className, children, ...props }, ref) => (
138
107
  <BaseContextMenu.CheckboxItem
139
108
  ref={ref}
140
109
  className={cn(
@@ -144,24 +113,23 @@ const ContextMenuCheckboxItem = React.forwardRef<
144
113
  "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
145
114
  className
146
115
  )}
147
- checked={checked}
148
116
  {...props}
149
117
  >
150
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
151
- {checked && <Check className="h-4 w-4" />}
152
- </span>
118
+ <BaseContextMenu.CheckboxItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
119
+ <Check className="h-4 w-4" />
120
+ </BaseContextMenu.CheckboxItemIndicator>
153
121
  {children}
154
122
  </BaseContextMenu.CheckboxItem>
155
- ));
156
- ContextMenuCheckboxItem.displayName = "ContextMenuCheckboxItem";
123
+ ))
124
+ ContextMenuCheckboxItem.displayName = "ContextMenuCheckboxItem"
157
125
 
158
126
  const ContextMenuRadioGroup = React.forwardRef<
159
127
  React.ComponentRef<typeof BaseContextMenu.RadioGroup>,
160
128
  React.ComponentProps<typeof BaseContextMenu.RadioGroup>
161
129
  >(({ className, ...props }, ref) => (
162
- <BaseContextMenu.RadioGroup ref={ref} className={cn(className)} {...props} />
163
- ));
164
- ContextMenuRadioGroup.displayName = "ContextMenuRadioGroup";
130
+ <BaseContextMenu.RadioGroup ref={ref} className={className} {...props} />
131
+ ))
132
+ ContextMenuRadioGroup.displayName = "ContextMenuRadioGroup"
165
133
 
166
134
  const ContextMenuRadioItem = React.forwardRef<
167
135
  React.ComponentRef<typeof BaseContextMenu.RadioItem>,
@@ -178,39 +146,39 @@ const ContextMenuRadioItem = React.forwardRef<
178
146
  )}
179
147
  {...props}
180
148
  >
181
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
182
- <Circle className="h-2 w-2 fill-current data-[checked]:block data-[unchecked]:hidden" />
183
- </span>
149
+ <BaseContextMenu.RadioItemIndicator className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
150
+ <Circle className="h-2 w-2 fill-current" />
151
+ </BaseContextMenu.RadioItemIndicator>
184
152
  {children}
185
153
  </BaseContextMenu.RadioItem>
186
- ));
187
- ContextMenuRadioItem.displayName = "ContextMenuRadioItem";
154
+ ))
155
+ ContextMenuRadioItem.displayName = "ContextMenuRadioItem"
188
156
 
189
157
  const ContextMenuGroup = React.forwardRef<
190
158
  React.ComponentRef<typeof BaseContextMenu.Group>,
191
159
  React.ComponentProps<typeof BaseContextMenu.Group>
192
160
  >(({ className, ...props }, ref) => (
193
- <BaseContextMenu.Group ref={ref} className={cn(className)} {...props} />
194
- ));
195
- ContextMenuGroup.displayName = "ContextMenuGroup";
161
+ <BaseContextMenu.Group ref={ref} className={className} {...props} />
162
+ ))
163
+ ContextMenuGroup.displayName = "ContextMenuGroup"
196
164
 
197
165
  const ContextMenuLabel = React.forwardRef<
198
166
  React.ComponentRef<typeof BaseContextMenu.GroupLabel>,
199
167
  React.ComponentProps<typeof BaseContextMenu.GroupLabel> & {
200
- inset?: boolean;
168
+ inset?: boolean
201
169
  }
202
170
  >(({ className, inset, ...props }, ref) => (
203
171
  <BaseContextMenu.GroupLabel
204
172
  ref={ref}
205
173
  className={cn(
206
- "px-2 py-1.5 text-sm font-semibold text-foreground",
174
+ "px-2 py-1.5 text-sm font-medium text-foreground",
207
175
  inset && "pl-8",
208
176
  className
209
177
  )}
210
178
  {...props}
211
179
  />
212
- ));
213
- ContextMenuLabel.displayName = "ContextMenuLabel";
180
+ ))
181
+ ContextMenuLabel.displayName = "ContextMenuLabel"
214
182
 
215
183
  const ContextMenuSeparator = React.forwardRef<
216
184
  React.ComponentRef<typeof BaseContextMenu.Separator>,
@@ -221,46 +189,35 @@ const ContextMenuSeparator = React.forwardRef<
221
189
  className={cn("-mx-1 my-1 h-px bg-border", className)}
222
190
  {...props}
223
191
  />
224
- ));
225
- ContextMenuSeparator.displayName = "ContextMenuSeparator";
192
+ ))
193
+ ContextMenuSeparator.displayName = "ContextMenuSeparator"
226
194
 
227
195
  const ContextMenuShortcut = ({
228
196
  className,
229
197
  ...props
230
- }: React.HTMLAttributes<HTMLSpanElement>) => {
231
- return (
232
- <span
233
- className={cn(
234
- "ml-auto text-xs tracking-widest text-muted-foreground",
235
- className
236
- )}
237
- {...props}
238
- />
239
- );
240
- };
241
- ContextMenuShortcut.displayName = "ContextMenuShortcut";
198
+ }: React.HTMLAttributes<HTMLSpanElement>) => (
199
+ <span
200
+ className={cn(
201
+ "ml-auto text-xs tracking-widest text-muted-foreground",
202
+ className
203
+ )}
204
+ {...props}
205
+ />
206
+ )
207
+ ContextMenuShortcut.displayName = "ContextMenuShortcut"
242
208
 
243
- // Submenu components using Menu from @base-ui-components
244
- const ContextMenuSub = React.forwardRef<
245
- HTMLDivElement,
246
- React.ComponentProps<typeof Menu.SubmenuRoot>
247
- >(({ children, ...props }, ref) => {
248
- const element = useRender({
249
- render: <Menu.SubmenuRoot>{children}</Menu.SubmenuRoot>,
250
- props,
251
- ref,
252
- });
253
- return element;
254
- });
255
- ContextMenuSub.displayName = "ContextMenuSub";
209
+ const ContextMenuSub: React.FC<React.ComponentProps<typeof BaseContextMenu.SubmenuRoot>> = (props) => (
210
+ <BaseContextMenu.SubmenuRoot {...props} />
211
+ )
212
+ ContextMenuSub.displayName = "ContextMenuSub"
256
213
 
257
214
  const ContextMenuSubTrigger = React.forwardRef<
258
- React.ComponentRef<typeof Menu.SubmenuTrigger>,
259
- React.ComponentProps<typeof Menu.SubmenuTrigger> & {
260
- inset?: boolean;
215
+ React.ComponentRef<typeof BaseContextMenu.SubmenuTrigger>,
216
+ React.ComponentProps<typeof BaseContextMenu.SubmenuTrigger> & {
217
+ inset?: boolean
261
218
  }
262
219
  >(({ className, inset, children, ...props }, ref) => (
263
- <Menu.SubmenuTrigger
220
+ <BaseContextMenu.SubmenuTrigger
264
221
  ref={ref}
265
222
  className={cn(
266
223
  "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
@@ -275,52 +232,32 @@ const ContextMenuSubTrigger = React.forwardRef<
275
232
  >
276
233
  {children}
277
234
  <ChevronRight className="ml-auto h-4 w-4" />
278
- </Menu.SubmenuTrigger>
279
- ));
280
- ContextMenuSubTrigger.displayName = "ContextMenuSubTrigger";
235
+ </BaseContextMenu.SubmenuTrigger>
236
+ ))
237
+ ContextMenuSubTrigger.displayName = "ContextMenuSubTrigger"
281
238
 
282
239
  const ContextMenuSubContent = React.forwardRef<
283
- React.ComponentRef<typeof Menu.Popup>,
284
- React.ComponentProps<typeof Menu.Popup>
285
- >(({ className, ...props }, ref) => {
286
- const [portalContainer, setPortalContainer] =
287
- React.useState<HTMLElement | null>(null);
288
-
289
- React.useEffect(() => {
290
- // Use the same high-level portal root for submenus
291
- let portalRoot = document.getElementById(
292
- "context-menu-portal-root"
293
- ) as HTMLElement;
294
- if (!portalRoot) {
295
- portalRoot = document.createElement("div");
296
- portalRoot.id = "context-menu-portal-root";
297
- portalRoot.style.cssText =
298
- "position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; isolation: isolate;";
299
- document.body.appendChild(portalRoot);
300
- }
301
- setPortalContainer(portalRoot);
302
- }, []);
303
-
304
- return (
305
- <Menu.Portal container={portalContainer}>
306
- <Menu.Positioner className="outline-none" alignOffset={-4} sideOffset={8}>
307
- <Menu.Popup
308
- ref={ref}
309
- className={cn(
310
- "z-[9999] min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg pointer-events-auto",
311
- "origin-[var(--transform-origin)]",
312
- "outline-none focus:outline-none focus-visible:outline-none",
313
- "data-[starting-style]:animate-in data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95",
314
- "data-[ending-style]:animate-out data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95",
315
- className
316
- )}
317
- {...props}
318
- />
319
- </Menu.Positioner>
320
- </Menu.Portal>
321
- );
322
- });
323
- ContextMenuSubContent.displayName = "ContextMenuSubContent";
240
+ React.ComponentRef<typeof BaseContextMenu.Popup>,
241
+ React.ComponentProps<typeof BaseContextMenu.Popup>
242
+ >(({ className, ...props }, ref) => (
243
+ <BaseContextMenu.Portal>
244
+ <BaseContextMenu.Positioner className="outline-none" alignOffset={-4} sideOffset={8}>
245
+ <BaseContextMenu.Popup
246
+ ref={ref}
247
+ className={cn(
248
+ "z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
249
+ "origin-(--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
+ </BaseContextMenu.Positioner>
258
+ </BaseContextMenu.Portal>
259
+ ))
260
+ ContextMenuSubContent.displayName = "ContextMenuSubContent"
324
261
 
325
262
  export {
326
263
  ContextMenu,
@@ -329,6 +266,7 @@ export {
329
266
  ContextMenuPositioner,
330
267
  ContextMenuContent,
331
268
  ContextMenuItem,
269
+ ContextMenuLinkItem,
332
270
  ContextMenuCheckboxItem,
333
271
  ContextMenuRadioGroup,
334
272
  ContextMenuRadioItem,
@@ -339,4 +277,4 @@ export {
339
277
  ContextMenuSub,
340
278
  ContextMenuSubTrigger,
341
279
  ContextMenuSubContent,
342
- };
280
+ }
@@ -5,13 +5,15 @@ export {
5
5
  ContextMenuPositioner,
6
6
  ContextMenuContent,
7
7
  ContextMenuItem,
8
+ ContextMenuLinkItem,
8
9
  ContextMenuCheckboxItem,
9
10
  ContextMenuRadioGroup,
10
11
  ContextMenuRadioItem,
12
+ ContextMenuGroup,
11
13
  ContextMenuLabel,
12
14
  ContextMenuSeparator,
13
15
  ContextMenuShortcut,
14
16
  ContextMenuSub,
15
17
  ContextMenuSubTrigger,
16
18
  ContextMenuSubContent,
17
- } from "./context-menu";
19
+ } from "./context-menu";
@@ -5,44 +5,40 @@ import { Dialog as BaseDialog } from "@base-ui/react/dialog"
5
5
  import { cn } from "@/lib/utils"
6
6
 
7
7
  const Dialog = BaseDialog.Root
8
+ const DialogTrigger = BaseDialog.Trigger
9
+ const DialogPortal = BaseDialog.Portal
8
10
 
9
- const DialogTrigger = React.forwardRef<
10
- HTMLButtonElement,
11
- React.ComponentProps<typeof BaseDialog.Trigger>
11
+ const DialogBackdrop = React.forwardRef<
12
+ HTMLDivElement,
13
+ React.ComponentProps<typeof BaseDialog.Backdrop>
12
14
  >(({ className, ...props }, ref) => (
13
- <BaseDialog.Trigger
15
+ <BaseDialog.Backdrop
14
16
  ref={ref}
15
17
  className={cn(
16
- "inline-flex items-center cursor-pointer justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors",
17
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
18
- "disabled:pointer-events-none disabled:opacity-50",
19
- "bg-primary text-primary-foreground hover:bg-primary/90",
20
- "h-10 px-4 py-2",
18
+ "fixed inset-0 z-50 bg-black/80",
19
+ "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
20
+ "transition-all duration-150",
21
21
  className
22
22
  )}
23
23
  {...props}
24
24
  />
25
25
  ))
26
- DialogTrigger.displayName = "DialogTrigger"
27
-
28
- const DialogPortal = BaseDialog.Portal
26
+ DialogBackdrop.displayName = "DialogBackdrop"
29
27
 
30
- const DialogBackdrop = React.forwardRef<
28
+ const DialogViewport = React.forwardRef<
31
29
  HTMLDivElement,
32
- React.ComponentProps<typeof BaseDialog.Backdrop>
30
+ React.ComponentProps<typeof BaseDialog.Viewport>
33
31
  >(({ className, ...props }, ref) => (
34
- <BaseDialog.Backdrop
32
+ <BaseDialog.Viewport
35
33
  ref={ref}
36
34
  className={cn(
37
- "fixed inset-0 z-50 bg-black/80",
38
- "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
39
- "transition-all duration-150",
35
+ "fixed inset-0 z-50 flex items-center justify-center overflow-auto",
40
36
  className
41
37
  )}
42
38
  {...props}
43
39
  />
44
40
  ))
45
- DialogBackdrop.displayName = "DialogBackdrop"
41
+ DialogViewport.displayName = "DialogViewport"
46
42
 
47
43
  const DialogPopup = React.forwardRef<
48
44
  HTMLDivElement,
@@ -51,7 +47,7 @@ const DialogPopup = React.forwardRef<
51
47
  <BaseDialog.Popup
52
48
  ref={ref}
53
49
  className={cn(
54
- "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",
50
+ "w-[95%] max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg",
55
51
  "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
56
52
  "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
57
53
  "transition-all duration-150",
@@ -68,7 +64,7 @@ const DialogTitle = React.forwardRef<
68
64
  >(({ className, ...props }, ref) => (
69
65
  <BaseDialog.Title
70
66
  ref={ref}
71
- className={cn("text-lg font-semibold leading-none tracking-tight", className)}
67
+ className={cn("text-lg font-medium leading-none tracking-tight", className)}
72
68
  {...props}
73
69
  />
74
70
  ))
@@ -93,7 +89,7 @@ const DialogClose = React.forwardRef<
93
89
  <BaseDialog.Close
94
90
  ref={ref}
95
91
  className={cn(
96
- "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",
92
+ "inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors",
97
93
  "hover:bg-accent hover:text-accent-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
98
94
  "disabled:cursor-not-allowed disabled:opacity-50",
99
95
  className
@@ -123,7 +119,7 @@ const DialogFooter = ({
123
119
  }: React.HTMLAttributes<HTMLDivElement>) => (
124
120
  <div
125
121
  className={cn(
126
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
122
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-1.5",
127
123
  className
128
124
  )}
129
125
  {...props}
@@ -137,9 +133,11 @@ const DialogContent = React.forwardRef<
137
133
  >(({ className, children, ...props }, ref) => (
138
134
  <DialogPortal>
139
135
  <DialogBackdrop />
140
- <DialogPopup ref={ref} className={className} {...props}>
141
- {children}
142
- </DialogPopup>
136
+ <DialogViewport>
137
+ <DialogPopup ref={ref} className={className} {...props}>
138
+ {children}
139
+ </DialogPopup>
140
+ </DialogViewport>
143
141
  </DialogPortal>
144
142
  ))
145
143
  DialogContent.displayName = "DialogContent"
@@ -149,6 +147,7 @@ export {
149
147
  DialogTrigger,
150
148
  DialogPortal,
151
149
  DialogBackdrop,
150
+ DialogViewport,
152
151
  DialogPopup,
153
152
  DialogTitle,
154
153
  DialogDescription,
@@ -156,4 +155,4 @@ export {
156
155
  DialogHeader,
157
156
  DialogFooter,
158
157
  DialogContent,
159
- }
158
+ }
@@ -36,26 +36,28 @@ const DrawerContent = React.forwardRef<
36
36
  >(({ className, side = "right", children, ...props }, ref) => (
37
37
  <DrawerPortal>
38
38
  <DrawerBackdrop />
39
- <DrawerPrimitive.Popup
40
- ref={ref}
41
- className={cn(
42
- "fixed z-50 flex flex-col gap-4 border bg-background p-6 shadow-lg transition duration-200",
43
- side === "top" &&
44
- "inset-x-0 top-0 border-b data-[starting-style]:-translate-y-full data-[ending-style]:-translate-y-full",
45
- side === "bottom" &&
46
- "inset-x-0 bottom-0 border-t data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full",
47
- side === "left" &&
48
- "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",
49
- side === "right" &&
50
- "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",
51
- className
52
- )}
53
- {...props}
54
- >
55
- <DrawerPrimitive.Content className="size-full overflow-y-auto">
56
- {children}
57
- </DrawerPrimitive.Content>
58
- </DrawerPrimitive.Popup>
39
+ <DrawerPrimitive.Viewport>
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
+ </DrawerPrimitive.Viewport>
59
61
  </DrawerPortal>
60
62
  ))
61
63
  DrawerContent.displayName = "DrawerContent"
@@ -66,7 +68,7 @@ function DrawerTitle({
66
68
  }: React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>) {
67
69
  return (
68
70
  <DrawerPrimitive.Title
69
- className={cn("text-lg font-semibold leading-none tracking-tight", className)}
71
+ className={cn("text-lg font-medium leading-none tracking-tight", className)}
70
72
  {...props}
71
73
  />
72
74
  )
@@ -17,7 +17,7 @@ const FieldLabel = React.forwardRef<
17
17
  <BaseField.Label
18
18
  ref={ref}
19
19
  className={cn(
20
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
20
+ "text-sm font-medium leading-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-70",
21
21
  "data-[invalid]:text-destructive",
22
22
  className
23
23
  )}
@@ -37,7 +37,7 @@ const FieldControl = React.forwardRef<
37
37
  "file:border-0 file:bg-transparent file:text-sm file:font-medium",
38
38
  "placeholder:text-muted-foreground",
39
39
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
40
- "disabled:cursor-not-allowed disabled:opacity-50",
40
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
41
41
  "data-[invalid]:border-destructive data-[invalid]:ring-destructive",
42
42
  className
43
43
  )}
@@ -78,19 +78,9 @@ const FieldError = React.forwardRef<
78
78
  ));
79
79
  FieldError.displayName = "FieldError";
80
80
 
81
- const FieldValidity = React.forwardRef<
82
- HTMLDivElement,
83
- React.ComponentProps<typeof BaseField.Validity> & {
84
- className?: string;
85
- }
86
- >(({ className, children, ...props }, ref) => (
87
- <div
88
- ref={ref}
89
- className={cn("text-sm", "data-[disabled]:opacity-50", className)}
90
- >
91
- <BaseField.Validity {...props}>{children}</BaseField.Validity>
92
- </div>
93
- ));
81
+ const FieldValidity: React.FC<React.ComponentProps<typeof BaseField.Validity>> = (props) => (
82
+ <BaseField.Validity {...props} />
83
+ );
94
84
  FieldValidity.displayName = "FieldValidity";
95
85
 
96
86
  export {