@dinachi/cli 0.6.2 → 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 (38) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +122 -33
  3. package/package.json +3 -4
  4. package/templates/alert-dialog/alert-dialog.tsx +60 -45
  5. package/templates/autocomplete/autocomplete.tsx +23 -17
  6. package/templates/badge/badge.tsx +58 -119
  7. package/templates/card/card.tsx +1 -1
  8. package/templates/checkbox/checkbox.tsx +16 -14
  9. package/templates/combobox/combobox.tsx +22 -16
  10. package/templates/context-menu/context-menu.tsx +124 -186
  11. package/templates/context-menu/index.ts +3 -1
  12. package/templates/dialog/dialog.tsx +26 -27
  13. package/templates/drawer/drawer.tsx +23 -21
  14. package/templates/field/field.tsx +5 -15
  15. package/templates/form/form.tsx +9 -66
  16. package/templates/label/index.ts +1 -0
  17. package/templates/label/label.tsx +21 -0
  18. package/templates/menu/index.ts +2 -0
  19. package/templates/menu/menu.tsx +59 -61
  20. package/templates/menubar/index.ts +1 -0
  21. package/templates/menubar/menubar.tsx +52 -71
  22. package/templates/navigation-menu/navigation-menu.tsx +61 -18
  23. package/templates/popover/index.ts +4 -1
  24. package/templates/popover/popover.tsx +89 -34
  25. package/templates/preview-card/preview-card.tsx +19 -5
  26. package/templates/radio/index.ts +1 -1
  27. package/templates/radio/radio.tsx +30 -14
  28. package/templates/select/select.tsx +83 -76
  29. package/templates/skeleton/index.ts +1 -0
  30. package/templates/skeleton/skeleton.tsx +12 -0
  31. package/templates/slider/slider.tsx +9 -15
  32. package/templates/switch/switch.tsx +15 -11
  33. package/templates/tabs/tabs.tsx +2 -2
  34. package/templates/toast/toast.tsx +76 -48
  35. package/templates/toggle/toggle.tsx +0 -17
  36. package/templates/toggle-group/toggle-group.tsx +8 -3
  37. package/templates/toolbar/toolbar.tsx +5 -4
  38. package/templates/tooltip/tooltip.tsx +9 -54
@@ -5,12 +5,11 @@ import { Select as SelectPrimitive } from "@base-ui/react/select"
5
5
  import { cn } from "@/lib/utils"
6
6
  import { Check, ChevronDown } from "lucide-react"
7
7
 
8
- // Re-export root components for better tree-shaking
8
+ // Direct re-exports
9
9
  const Select = SelectPrimitive.Root
10
10
  const SelectGroup = SelectPrimitive.Group
11
11
  const SelectValue = SelectPrimitive.Value
12
12
 
13
- // Optimized SelectTrigger with better type safety and performance
14
13
  const SelectTrigger = React.forwardRef<
15
14
  React.ComponentRef<typeof SelectPrimitive.Trigger>,
16
15
  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & {
@@ -33,43 +32,58 @@ const SelectTrigger = React.forwardRef<
33
32
  ))
34
33
  SelectTrigger.displayName = "SelectTrigger"
35
34
 
36
- // Optimized SelectContent with better positioning and performance
37
35
  const SelectContent = React.forwardRef<
38
36
  React.ComponentRef<typeof SelectPrimitive.Popup>,
39
37
  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Popup> & {
40
- readonly position?: "item-aligned" | "popper"
38
+ readonly alignItemWithTrigger?: boolean
41
39
  readonly sideOffset?: number
40
+ readonly portal?: boolean
42
41
  }
43
- >(({ className, children, position = "popper", sideOffset = 4, ...props }, ref) => (
44
- <SelectPrimitive.Portal>
42
+ >(({ className, children, alignItemWithTrigger = false, sideOffset = 4, portal = true, ...props }, ref) => {
43
+ const content = (
45
44
  <SelectPrimitive.Positioner
46
45
  sideOffset={sideOffset}
47
- alignItemWithTrigger={position === "item-aligned"}
46
+ alignItemWithTrigger={alignItemWithTrigger}
48
47
  >
49
48
  <SelectPrimitive.Popup
50
49
  ref={ref}
51
50
  className={cn(
52
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
53
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
51
+ "relative z-50 max-h-96 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
52
+ "data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95",
54
53
  "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
55
- position === "popper" &&
54
+ !alignItemWithTrigger &&
56
55
  "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
57
56
  className
58
57
  )}
59
58
  {...props}
60
59
  >
61
60
  <SelectScrollUpArrow />
62
- <div className="overflow-y-auto p-1">
61
+ <SelectPrimitive.List className="overflow-y-auto p-1">
63
62
  {children}
64
- </div>
63
+ </SelectPrimitive.List>
65
64
  <SelectScrollDownArrow />
66
65
  </SelectPrimitive.Popup>
67
66
  </SelectPrimitive.Positioner>
68
- </SelectPrimitive.Portal>
69
- ))
67
+ )
68
+
69
+ if (!portal) return content
70
+
71
+ return <SelectPrimitive.Portal>{content}</SelectPrimitive.Portal>
72
+ })
70
73
  SelectContent.displayName = "SelectContent"
71
74
 
72
- // Add scroll arrows for better UX with large lists
75
+ const SelectBackdrop = React.forwardRef<
76
+ React.ComponentRef<typeof SelectPrimitive.Backdrop>,
77
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Backdrop>
78
+ >(({ className, ...props }, ref) => (
79
+ <SelectPrimitive.Backdrop
80
+ ref={ref}
81
+ className={cn("fixed inset-0 z-40", className)}
82
+ {...props}
83
+ />
84
+ ))
85
+ SelectBackdrop.displayName = "SelectBackdrop"
86
+
73
87
  const SelectScrollUpArrow = React.forwardRef<
74
88
  React.ComponentRef<typeof SelectPrimitive.ScrollUpArrow>,
75
89
  React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpArrow>
@@ -104,84 +118,72 @@ const SelectScrollDownArrow = React.forwardRef<
104
118
  ))
105
119
  SelectScrollDownArrow.displayName = "SelectScrollDownArrow"
106
120
 
107
- // Optimized SelectLabel with better accessibility
108
121
  const SelectLabel = React.forwardRef<
109
122
  React.ComponentRef<typeof SelectPrimitive.GroupLabel>,
110
123
  React.ComponentPropsWithoutRef<typeof SelectPrimitive.GroupLabel>
111
124
  >(({ className, ...props }, ref) => (
112
125
  <SelectPrimitive.GroupLabel
113
126
  ref={ref}
114
- className={cn("py-1.5 pl-2 pr-2 text-sm font-semibold", className)}
127
+ className={cn("py-1.5 pl-2 pr-2 text-sm font-medium", className)}
115
128
  {...props}
116
129
  />
117
130
  ))
118
131
  SelectLabel.displayName = "SelectLabel"
119
132
 
120
- // Optimized SelectItem with conditional indicator and better type safety
121
133
  const SelectItem = React.forwardRef<
122
134
  React.ComponentRef<typeof SelectPrimitive.Item>,
123
135
  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & {
124
- readonly inset?: boolean
125
136
  readonly showIndicator?: boolean
126
- readonly indicatorIcon?: React.ReactNode
127
- readonly indicatorPosition?: "left" | "right"
128
137
  }
129
- >(({
130
- className,
131
- children,
132
- inset,
133
- showIndicator = false,
134
- indicatorIcon = <Check className="h-4 w-4" />,
135
- indicatorPosition = "left",
136
- ...props
137
- }, ref) => {
138
- const isLeftIndicator = indicatorPosition === "left"
139
- const isRightIndicator = indicatorPosition === "right"
140
-
141
- return (
142
- <SelectPrimitive.Item
143
- ref={ref}
144
- className={cn(
145
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-2 text-sm outline-none",
146
- "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
147
- // Dynamic padding based on indicator presence and position
148
- showIndicator && isLeftIndicator && "pl-8",
149
- showIndicator && isRightIndicator && "pr-8",
150
- !showIndicator && "px-2",
151
- inset && !showIndicator && "pl-8",
152
- inset && showIndicator && isLeftIndicator && "pl-8",
153
- !inset && !showIndicator && "pl-2",
154
- className
155
- )}
156
- {...props}
157
- >
158
- {/* Left indicator */}
159
- {showIndicator && isLeftIndicator && (
160
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
161
- <SelectPrimitive.ItemIndicator>
162
- {indicatorIcon}
163
- </SelectPrimitive.ItemIndicator>
164
- </span>
165
- )}
166
-
167
- <SelectPrimitive.ItemText className="flex-1">
168
- {children}
169
- </SelectPrimitive.ItemText>
170
-
171
- {/* Right indicator */}
172
- {showIndicator && isRightIndicator && (
173
- <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
174
- <SelectPrimitive.ItemIndicator>
175
- {indicatorIcon}
176
- </SelectPrimitive.ItemIndicator>
177
- </span>
178
- )}
179
- </SelectPrimitive.Item>
180
- )
181
- })
138
+ >(({ className, children, showIndicator = false, ...props }, ref) => (
139
+ <SelectPrimitive.Item
140
+ ref={ref}
141
+ className={cn(
142
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 text-sm outline-none",
143
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
144
+ showIndicator ? "pl-8 pr-2" : "px-2",
145
+ className
146
+ )}
147
+ {...props}
148
+ >
149
+ {showIndicator && (
150
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
151
+ <SelectPrimitive.ItemIndicator>
152
+ <Check className="h-4 w-4" />
153
+ </SelectPrimitive.ItemIndicator>
154
+ </span>
155
+ )}
156
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
157
+ </SelectPrimitive.Item>
158
+ ))
182
159
  SelectItem.displayName = "SelectItem"
183
160
 
184
- // Optimized SelectSeparator
161
+ const SelectItemIndicator = React.forwardRef<
162
+ React.ComponentRef<typeof SelectPrimitive.ItemIndicator>,
163
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ItemIndicator>
164
+ >(({ className, children, ...props }, ref) => (
165
+ <SelectPrimitive.ItemIndicator
166
+ ref={ref}
167
+ className={cn("flex h-3.5 w-3.5 items-center justify-center", className)}
168
+ {...props}
169
+ >
170
+ {children ?? <Check className="h-4 w-4" />}
171
+ </SelectPrimitive.ItemIndicator>
172
+ ))
173
+ SelectItemIndicator.displayName = "SelectItemIndicator"
174
+
175
+ const SelectArrow = React.forwardRef<
176
+ React.ComponentRef<typeof SelectPrimitive.Arrow>,
177
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Arrow>
178
+ >(({ className, ...props }, ref) => (
179
+ <SelectPrimitive.Arrow
180
+ ref={ref}
181
+ className={cn("fill-popover stroke-border", className)}
182
+ {...props}
183
+ />
184
+ ))
185
+ SelectArrow.displayName = "SelectArrow"
186
+
185
187
  const SelectSeparator = React.forwardRef<
186
188
  React.ComponentRef<typeof SelectPrimitive.Separator>,
187
189
  React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
@@ -200,7 +202,12 @@ export {
200
202
  SelectValue,
201
203
  SelectTrigger,
202
204
  SelectContent,
205
+ SelectBackdrop,
203
206
  SelectLabel,
204
207
  SelectItem,
208
+ SelectItemIndicator,
209
+ SelectArrow,
210
+ SelectScrollUpArrow,
211
+ SelectScrollDownArrow,
205
212
  SelectSeparator,
206
- }
213
+ }
@@ -0,0 +1 @@
1
+ export { Skeleton } from "./skeleton"
@@ -0,0 +1,12 @@
1
+ import { cn } from "@/lib/utils"
2
+
3
+ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4
+ return (
5
+ <div
6
+ className={cn("animate-pulse rounded-md bg-muted", className)}
7
+ {...props}
8
+ />
9
+ )
10
+ }
11
+
12
+ export { Skeleton }
@@ -6,19 +6,13 @@ import { cn } from "@/lib/utils";
6
6
  const Slider = React.forwardRef<
7
7
  React.ComponentRef<typeof BaseSlider.Root>,
8
8
  React.ComponentProps<typeof BaseSlider.Root>
9
- >(({ className, ...props }, ref) => {
10
- const internalRef = React.useRef<HTMLDivElement>(null);
11
-
12
- React.useImperativeHandle(ref, () => internalRef.current!, []);
13
-
14
- return (
15
- <BaseSlider.Root
16
- ref={internalRef as React.RefObject<HTMLDivElement>}
17
- className={cn("relative flex w-full touch-none select-none items-center", className)}
18
- {...props}
19
- />
20
- );
21
- });
9
+ >(({ className, ...props }, ref) => (
10
+ <BaseSlider.Root
11
+ ref={ref}
12
+ className={cn("relative flex w-full items-center", className)}
13
+ {...props}
14
+ />
15
+ ));
22
16
  Slider.displayName = "Slider";
23
17
 
24
18
  const SliderValue = React.forwardRef<
@@ -66,7 +60,7 @@ const SliderRange = React.forwardRef<
66
60
  >(({ className, ...props }, ref) => (
67
61
  <BaseSlider.Indicator
68
62
  ref={ref}
69
- className={cn("absolute h-full bg-primary rounded", className)}
63
+ className={cn("absolute h-full bg-primary rounded-full", className)}
70
64
  {...props}
71
65
  />
72
66
  ));
@@ -81,7 +75,7 @@ const SliderThumb = React.forwardRef<
81
75
  className={cn(
82
76
  "block h-5 w-5 z-10 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors",
83
77
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
84
- "disabled:pointer-events-none disabled:opacity-50",
78
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
85
79
  "data-[dragging]:scale-110",
86
80
  className
87
81
  )}
@@ -8,17 +8,20 @@ const Switch = React.forwardRef<
8
8
  React.ComponentRef<typeof SwitchPrimitive.Root>,
9
9
  React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>
10
10
  >(({ className, ...props }, ref) => (
11
- <SwitchPrimitive.Root
12
- ref={ref}
13
- className={cn(
14
- "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
15
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
16
- "disabled:cursor-not-allowed disabled:opacity-50",
17
- "data-[checked]:bg-primary data-[unchecked]:bg-input",
18
- className
19
- )}
20
- {...props}
21
- />
11
+ <span className="relative inline-flex [&>input]:!absolute">
12
+ <SwitchPrimitive.Root
13
+ ref={ref}
14
+ className={cn(
15
+ "inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
16
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
17
+ "disabled:cursor-not-allowed disabled:opacity-50",
18
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
19
+ "data-[checked]:bg-primary data-[unchecked]:bg-input",
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ </span>
22
25
  ))
23
26
  Switch.displayName = "Switch"
24
27
 
@@ -31,6 +34,7 @@ const SwitchThumb = React.forwardRef<
31
34
  className={cn(
32
35
  "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
33
36
  "data-[checked]:translate-x-5 data-[unchecked]:translate-x-0",
37
+ "data-[disabled]:opacity-80",
34
38
  className
35
39
  )}
36
40
  {...props}
@@ -38,8 +38,8 @@ const TabsTrigger = React.forwardRef<
38
38
  className={cn(
39
39
  "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all",
40
40
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
41
- "disabled:pointer-events-none disabled:opacity-50",
42
- "data-[selected]:bg-muted data-[selected]:text-foreground data-[selected]:shadow-sm",
41
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
42
+ "data-[active]:bg-muted data-[active]:text-foreground data-[active]:shadow-sm",
43
43
  "hover:text-foreground",
44
44
  className
45
45
  )}
@@ -16,7 +16,7 @@ const ToastViewport = React.forwardRef<
16
16
  <BaseToast.Viewport
17
17
  ref={ref}
18
18
  className={cn(
19
- "fixed top-auto right-[1rem] bottom-[1rem] mx-auto flex w-[250px] sm:right-[2rem] sm:bottom-[2rem] sm:w-[300px]",
19
+ "fixed z-10 top-auto right-4 bottom-4 mx-auto flex w-[250px] sm:right-8 sm:bottom-8 sm:w-[300px]",
20
20
  className
21
21
  )}
22
22
  {...props}
@@ -30,14 +30,36 @@ const ToastPortal: typeof BaseToast.Portal = BaseToast.Portal;
30
30
  // Toast variants for different types
31
31
  const toastVariants = cva(
32
32
  [
33
+ // CSS variables for stacking
34
+ "[--gap:1rem] [--peek:0.75rem]",
35
+ "[--scale:calc(max(0,1-(var(--toast-index)*0.1)))]",
36
+ "[--shrink:calc(1-var(--scale))]",
37
+ "[--height:var(--toast-frontmost-height,var(--toast-height))]",
38
+ "[--offset-y:calc(var(--toast-offset-y)*-1+(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))]",
39
+ // Positioning
33
40
  "absolute right-0 bottom-0 left-auto z-[calc(1000-var(--toast-index))] mr-0 w-full",
34
- "[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-15px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))]",
35
- "rounded-lg border bg-background p-4 shadow-lg transition-all [transition-property:opacity,transform] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)] select-none",
36
- "after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
41
+ // Transform (collapsed stacking with peek/shrink)
42
+ "[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))]",
43
+ // Height management (collapse to frontmost height)
44
+ "h-[var(--height)]",
45
+ // Appearance
46
+ "origin-bottom cursor-default rounded-lg border bg-clip-padding bg-background p-4 shadow-lg select-none",
47
+ // Transition (includes height for expand/collapse animation)
48
+ "[transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,height_0.15s]",
49
+ // Gap pseudo-element for hover detection between stacked toasts
50
+ "after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
51
+ // Ending style (fade out)
37
52
  "data-[ending-style]:opacity-0",
38
- "data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))]",
53
+ // Expanded state (full height, offset positioning)
54
+ "data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
55
+ "data-[expanded]:h-[var(--toast-height)]",
56
+ // Limited (exceeded limit)
39
57
  "data-[limited]:opacity-0",
58
+ // Starting style (enter from below)
40
59
  "data-[starting-style]:[transform:translateY(150%)]",
60
+ // Default ending style (slide out, but not when limited or swiped)
61
+ "[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
62
+ // Swipe direction ending styles
41
63
  "data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
42
64
  "data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
43
65
  "data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
@@ -46,18 +68,17 @@ const toastVariants = cva(
46
68
  "data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
47
69
  "data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
48
70
  "data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
49
- "data-[ending-style]:[&:not([data-limited])]:[transform:translateY(150%)]",
50
71
  ],
51
72
  {
52
73
  variants: {
53
74
  variant: {
54
75
  default: "border-border bg-background text-foreground",
55
76
  destructive:
56
- "border-destructive/50 bg-destructive text-destructive-foreground",
57
- success: "border-success bg-success text-success-foreground",
58
- warning: "border-warning bg-warning text-warning-foreground",
77
+ "border-destructive border-l-4 bg-background text-foreground",
78
+ success: "border-success border-l-4 bg-background text-foreground",
79
+ warning: "border-warning border-l-4 bg-background text-foreground",
59
80
  loading:
60
- "border-primary/50 border-dashed bg-secondary text-secondary-foreground",
81
+ "border-primary/50 border-l-4 bg-background text-foreground",
61
82
  },
62
83
  },
63
84
  defaultVariants: {
@@ -76,11 +97,6 @@ const ToastRoot = React.forwardRef<HTMLDivElement, ToastProps>(
76
97
  <BaseToast.Root
77
98
  ref={ref}
78
99
  className={cn(toastVariants({ variant }), className)}
79
- style={{
80
- ["--gap" as string]: "1rem",
81
- ["--offset-y" as string]:
82
- "calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))",
83
- }}
84
100
  {...props}
85
101
  />
86
102
  )
@@ -113,6 +129,24 @@ const ToastDescription = React.forwardRef<
113
129
  ));
114
130
  ToastDescription.displayName = "ToastDescription";
115
131
 
132
+ // Toast Content (clips overflow for stacking, handles behind/expanded states)
133
+ const ToastContent = React.forwardRef<
134
+ HTMLDivElement,
135
+ React.ComponentProps<typeof BaseToast.Content>
136
+ >(({ className, ...props }, ref) => (
137
+ <BaseToast.Content
138
+ ref={ref}
139
+ className={cn(
140
+ "overflow-hidden transition-opacity [transition-duration:250ms]",
141
+ "data-[behind]:pointer-events-none data-[behind]:opacity-0",
142
+ "data-[expanded]:pointer-events-auto data-[expanded]:opacity-100",
143
+ className
144
+ )}
145
+ {...props}
146
+ />
147
+ ));
148
+ ToastContent.displayName = "ToastContent";
149
+
116
150
  // Toast Action
117
151
  const ToastAction = React.forwardRef<
118
152
  HTMLButtonElement,
@@ -175,40 +209,33 @@ function getVariantFromType(
175
209
  }
176
210
 
177
211
  // Default ToastList component for easy usage
178
- interface ToastListProps {
179
- className?: string;
180
- }
181
-
182
- const ToastList = React.forwardRef<HTMLDivElement, ToastListProps>(
183
- ({ className }, ref) => {
184
- const { toasts } = useToastManager();
212
+ // Returns toast roots directly without a wrapper — Base UI requires
213
+ // Toast.Root elements as direct children of Toast.Viewport.
214
+ function ToastList() {
215
+ const { toasts } = useToastManager();
185
216
 
186
- return (
187
- <div ref={ref} className={className}>
188
- {toasts.map((toast) => (
189
- <ToastRoot
190
- key={toast.id}
191
- toast={toast}
192
- variant={getVariantFromType(toast.type)}
193
- swipeDirection={["down", "right"]}
194
- >
195
- <div className="grid gap-1">
196
- {toast.title && <ToastTitle>{toast.title}</ToastTitle>}
197
- {toast.description && (
198
- <ToastDescription>{toast.description}</ToastDescription>
199
- )}
200
- </div>
201
- {toast.actionProps && <ToastAction {...toast.actionProps} />}
202
- <ToastClose aria-label="Close">
203
- <X className="h-4 w-4" />
204
- </ToastClose>
205
- </ToastRoot>
206
- ))}
207
- </div>
208
- );
209
- }
210
- );
211
- ToastList.displayName = "ToastList";
217
+ return toasts.map((toast) => (
218
+ <ToastRoot
219
+ key={toast.id}
220
+ toast={toast}
221
+ variant={getVariantFromType(toast.type)}
222
+ swipeDirection={["down", "right"]}
223
+ >
224
+ <ToastContent>
225
+ <div className="grid gap-1">
226
+ {toast.title && <ToastTitle>{toast.title}</ToastTitle>}
227
+ {toast.description && (
228
+ <ToastDescription>{toast.description}</ToastDescription>
229
+ )}
230
+ </div>
231
+ {toast.actionProps && <ToastAction {...toast.actionProps} />}
232
+ <ToastClose aria-label="Close">
233
+ <X className="h-4 w-4" />
234
+ </ToastClose>
235
+ </ToastContent>
236
+ </ToastRoot>
237
+ ));
238
+ }
212
239
 
213
240
  // X Icon component
214
241
  const X = React.forwardRef<SVGSVGElement, React.ComponentProps<"svg">>(
@@ -265,6 +292,7 @@ export {
265
292
  ToastViewport,
266
293
  ToastPortal,
267
294
  ToastRoot,
295
+ ToastContent,
268
296
  ToastTitle,
269
297
  ToastDescription,
270
298
  ToastAction,
@@ -6,17 +6,12 @@ import { type VariantProps, cva } from "class-variance-authority"
6
6
  import { cn } from "@/lib/utils"
7
7
 
8
8
  const toggleVariants = cva(
9
- // Base styles with improved state handling
10
9
  [
11
10
  "inline-flex items-center justify-center rounded-md text-sm font-medium",
12
11
  "ring-offset-background transition-all duration-200 ease-in-out",
13
- // Focus styles
14
12
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
15
- // Disabled styles
16
13
  "disabled:pointer-events-none disabled:opacity-50",
17
14
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
18
- // Pressed/Active state styles using Base UI data attributes
19
- "data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
20
15
  "data-[pressed]:bg-accent data-[pressed]:text-accent-foreground",
21
16
  ],
22
17
  {
@@ -24,28 +19,16 @@ const toggleVariants = cva(
24
19
  variant: {
25
20
  default: [
26
21
  "bg-transparent",
27
- // Hover states
28
22
  "hover:bg-muted hover:text-muted-foreground",
29
- // Pressed hover states
30
- "data-[state=on]:hover:bg-accent/90",
31
23
  "data-[pressed]:hover:bg-accent/90",
32
- // Disabled pressed state
33
- "data-[state=on]:data-[disabled]:bg-accent/50",
34
24
  "data-[pressed]:data-[disabled]:bg-accent/50",
35
25
  ],
36
26
  outline: [
37
27
  "border border-input bg-transparent",
38
- // Hover states
39
28
  "hover:bg-accent hover:text-accent-foreground hover:border-accent",
40
- // Pressed states for outline variant
41
- "data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:border-accent",
42
29
  "data-[pressed]:bg-accent data-[pressed]:text-accent-foreground data-[pressed]:border-accent",
43
- // Pressed hover states
44
- "data-[state=on]:hover:bg-accent/90",
45
30
  "data-[pressed]:hover:bg-accent/90",
46
- // Disabled states
47
31
  "data-[disabled]:border-input/50",
48
- "data-[state=on]:data-[disabled]:bg-accent/50 data-[state=on]:data-[disabled]:border-accent/50",
49
32
  "data-[pressed]:data-[disabled]:bg-accent/50 data-[pressed]:data-[disabled]:border-accent/50",
50
33
  ],
51
34
  },
@@ -17,14 +17,15 @@ const toggleGroupItemVariants = cva(
17
17
  "ring-offset-background transition-colors",
18
18
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
19
19
  "disabled:pointer-events-none disabled:opacity-50",
20
- "data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
20
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
21
+ "data-[pressed]:bg-accent data-[pressed]:text-accent-foreground",
21
22
  ],
22
23
  {
23
24
  variants: {
24
25
  variant: {
25
26
  default: "bg-transparent hover:bg-muted hover:text-muted-foreground",
26
27
  outline:
27
- "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground data-[state=on]:border-accent",
28
+ "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground data-[pressed]:border-accent",
28
29
  },
29
30
  size: {
30
31
  default: "h-10 px-3",
@@ -45,7 +46,11 @@ const ToggleGroup = React.forwardRef<
45
46
  >(({ className, ...props }, ref) => (
46
47
  <ToggleGroupPrimitive
47
48
  ref={ref}
48
- className={cn("inline-flex items-center justify-center gap-1", className)}
49
+ className={cn(
50
+ "inline-flex items-center justify-center gap-1",
51
+ "data-[orientation=vertical]:flex-col",
52
+ className
53
+ )}
49
54
  {...props}
50
55
  />
51
56
  ))
@@ -9,7 +9,8 @@ const ToolbarRoot = React.forwardRef<
9
9
  <BaseToolbar.Root
10
10
  ref={ref}
11
11
  className={cn(
12
- "flex items-center gap-1 rounded-md border bg-background p-1",
12
+ "flex flex-wrap items-center gap-1 rounded-md border bg-background p-1",
13
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
13
14
  className
14
15
  )}
15
16
  {...props}
@@ -24,7 +25,7 @@ const ToolbarButton = React.forwardRef<
24
25
  <BaseToolbar.Button
25
26
  ref={ref}
26
27
  className={cn(
27
- "inline-flex items-center justify-center rounded-sm px-3 py-2 text-sm font-medium transition-colors",
28
+ "inline-flex shrink-0 items-center justify-center rounded-sm px-3 py-2 text-sm font-medium transition-colors",
28
29
  "hover:bg-accent hover:text-accent-foreground",
29
30
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
30
31
  "disabled:pointer-events-none disabled:opacity-50",
@@ -43,7 +44,7 @@ const ToolbarLink = React.forwardRef<
43
44
  <BaseToolbar.Link
44
45
  ref={ref}
45
46
  className={cn(
46
- "inline-flex items-center justify-center rounded-sm px-3 py-2 text-sm font-medium transition-colors",
47
+ "inline-flex shrink-0 items-center justify-center rounded-sm px-3 py-2 text-sm font-medium transition-colors",
47
48
  "text-primary hover:text-primary/80 hover:underline",
48
49
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
49
50
  "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
@@ -77,7 +78,7 @@ const ToolbarGroup = React.forwardRef<
77
78
  >(({ className, ...props }, ref) => (
78
79
  <BaseToolbar.Group
79
80
  ref={ref}
80
- className={cn("flex items-center gap-1", className)}
81
+ className={cn("flex shrink-0 items-center gap-1", className)}
81
82
  {...props}
82
83
  />
83
84
  ));