@dinachi/cli 0.6.3 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/index.js +133 -34
  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 +137 -74
  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
@@ -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
  )}
@@ -4,6 +4,7 @@ import * as React from "react";
4
4
  import { Toast as BaseToast } from "@base-ui/react/toast";
5
5
  import { cn } from "@/lib/utils";
6
6
  import { type VariantProps, cva } from "class-variance-authority";
7
+ import { XIcon } from "lucide-react";
7
8
 
8
9
  // Toast Provider
9
10
  const ToastProvider = BaseToast.Provider;
@@ -16,7 +17,7 @@ const ToastViewport = React.forwardRef<
16
17
  <BaseToast.Viewport
17
18
  ref={ref}
18
19
  className={cn(
19
- "fixed top-auto right-[1rem] bottom-[1rem] mx-auto flex w-[250px] sm:right-[2rem] sm:bottom-[2rem] sm:w-[300px]",
20
+ "fixed z-10 top-auto right-4 bottom-4 mx-auto flex w-[250px] sm:right-8 sm:bottom-8 sm:w-[300px]",
20
21
  className
21
22
  )}
22
23
  {...props}
@@ -30,14 +31,36 @@ const ToastPortal: typeof BaseToast.Portal = BaseToast.Portal;
30
31
  // Toast variants for different types
31
32
  const toastVariants = cva(
32
33
  [
34
+ // CSS variables for stacking
35
+ "[--gap:1rem] [--peek:0.75rem]",
36
+ "[--scale:calc(max(0,1-(var(--toast-index)*0.1)))]",
37
+ "[--shrink:calc(1-var(--scale))]",
38
+ "[--height:var(--toast-frontmost-height,var(--toast-height))]",
39
+ "[--offset-y:calc(var(--toast-offset-y)*-1+(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))]",
40
+ // Positioning
33
41
  "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-['']",
42
+ // Transform (collapsed stacking with peek/shrink)
43
+ "[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))]",
44
+ // Height management (collapse to frontmost height)
45
+ "h-[var(--height)]",
46
+ // Appearance
47
+ "origin-bottom cursor-default rounded-lg border bg-clip-padding bg-background p-4 shadow-lg select-none",
48
+ // Transition (includes height for expand/collapse animation)
49
+ "[transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,height_0.15s]",
50
+ // Gap pseudo-element for hover detection between stacked toasts
51
+ "after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
52
+ // Ending style (fade out)
37
53
  "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)))]",
54
+ // Expanded state (full height, offset positioning)
55
+ "data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
56
+ "data-[expanded]:h-[var(--toast-height)]",
57
+ // Limited (exceeded limit)
39
58
  "data-[limited]:opacity-0",
59
+ // Starting style (enter from below)
40
60
  "data-[starting-style]:[transform:translateY(150%)]",
61
+ // Default ending style (slide out, but not when limited or swiped)
62
+ "[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
63
+ // Swipe direction ending styles
41
64
  "data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
42
65
  "data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
43
66
  "data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
@@ -46,18 +69,17 @@ const toastVariants = cva(
46
69
  "data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
47
70
  "data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
48
71
  "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
72
  ],
51
73
  {
52
74
  variants: {
53
75
  variant: {
54
76
  default: "border-border bg-background text-foreground",
55
77
  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",
78
+ "border-destructive border-l-4 bg-background text-foreground",
79
+ success: "border-success border-l-4 bg-background text-foreground",
80
+ warning: "border-warning border-l-4 bg-background text-foreground",
59
81
  loading:
60
- "border-primary/50 border-dashed bg-secondary text-secondary-foreground",
82
+ "border-primary/50 border-l-4 bg-background text-foreground",
61
83
  },
62
84
  },
63
85
  defaultVariants: {
@@ -76,11 +98,6 @@ const ToastRoot = React.forwardRef<HTMLDivElement, ToastProps>(
76
98
  <BaseToast.Root
77
99
  ref={ref}
78
100
  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
101
  {...props}
85
102
  />
86
103
  )
@@ -113,6 +130,24 @@ const ToastDescription = React.forwardRef<
113
130
  ));
114
131
  ToastDescription.displayName = "ToastDescription";
115
132
 
133
+ // Toast Content (clips overflow for stacking, handles behind/expanded states)
134
+ const ToastContent = React.forwardRef<
135
+ HTMLDivElement,
136
+ React.ComponentProps<typeof BaseToast.Content>
137
+ >(({ className, ...props }, ref) => (
138
+ <BaseToast.Content
139
+ ref={ref}
140
+ className={cn(
141
+ "overflow-hidden transition-opacity [transition-duration:250ms]",
142
+ "data-[behind]:pointer-events-none data-[behind]:opacity-0",
143
+ "data-[expanded]:pointer-events-auto data-[expanded]:opacity-100",
144
+ className
145
+ )}
146
+ {...props}
147
+ />
148
+ ));
149
+ ToastContent.displayName = "ToastContent";
150
+
116
151
  // Toast Action
117
152
  const ToastAction = React.forwardRef<
118
153
  HTMLButtonElement,
@@ -132,13 +167,14 @@ const ToastAction = React.forwardRef<
132
167
  ));
133
168
  ToastAction.displayName = "ToastAction";
134
169
 
135
- // Toast Close
170
+ // Toast Close — renders XIcon by default, overridable via children
136
171
  const ToastClose = React.forwardRef<
137
172
  HTMLButtonElement,
138
173
  React.ComponentProps<typeof BaseToast.Close>
139
- >(({ className, ...props }, ref) => (
174
+ >(({ className, children, ...props }, ref) => (
140
175
  <BaseToast.Close
141
176
  ref={ref}
177
+ aria-label="Close"
142
178
  className={cn(
143
179
  "absolute top-2 right-2 flex h-5 w-5 items-center justify-center rounded border-none bg-transparent opacity-60 transition-opacity",
144
180
  "hover:opacity-100 focus:outline-none focus:ring-1 focus:ring-ring",
@@ -146,10 +182,45 @@ const ToastClose = React.forwardRef<
146
182
  className
147
183
  )}
148
184
  {...props}
149
- />
185
+ >
186
+ {children ?? <XIcon className="h-4 w-4" />}
187
+ </BaseToast.Close>
150
188
  ));
151
189
  ToastClose.displayName = "ToastClose";
152
190
 
191
+ // Toast Positioner — positions a toast relative to an anchor element
192
+ const ToastPositioner = React.forwardRef<
193
+ HTMLDivElement,
194
+ React.ComponentProps<typeof BaseToast.Positioner>
195
+ >(({ className, ...props }, ref) => (
196
+ <BaseToast.Positioner
197
+ ref={ref}
198
+ className={cn("z-50", className)}
199
+ {...props}
200
+ />
201
+ ));
202
+ ToastPositioner.displayName = "ToastPositioner";
203
+
204
+ // Toast Arrow — decorative arrow for anchored toasts
205
+ const ToastArrow = React.forwardRef<
206
+ HTMLDivElement,
207
+ React.ComponentProps<typeof BaseToast.Arrow>
208
+ >(({ className, ...props }, ref) => (
209
+ <BaseToast.Arrow
210
+ ref={ref}
211
+ className={cn(
212
+ "fill-background [stroke-width:1px] stroke-border",
213
+ "data-[side=bottom]:top-[-8px]",
214
+ "data-[side=left]:right-[-8px]",
215
+ "data-[side=right]:left-[-8px]",
216
+ "data-[side=top]:bottom-[-8px]",
217
+ className
218
+ )}
219
+ {...props}
220
+ />
221
+ ));
222
+ ToastArrow.displayName = "ToastArrow";
223
+
153
224
  // Hook for using toast manager
154
225
  const useToastManager = BaseToast.useToastManager;
155
226
 
@@ -174,64 +245,42 @@ function getVariantFromType(
174
245
  }
175
246
  }
176
247
 
177
- // Default ToastList component for easy usage
178
- interface ToastListProps {
179
- className?: string;
180
- }
248
+ // Toast object type from Base UI
249
+ type ToastObject = React.ComponentProps<typeof BaseToast.Root>["toast"];
181
250
 
182
- const ToastList = React.forwardRef<HTMLDivElement, ToastListProps>(
183
- ({ className }, ref) => {
184
- const { toasts } = useToastManager();
251
+ // renderToast callback type
252
+ type RenderToastFn = (toast: ToastObject) => React.ReactNode;
185
253
 
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";
254
+ // Default ToastList component for easy usage
255
+ // Returns toast roots directly without a wrapper — Base UI requires
256
+ // Toast.Root elements as direct children of Toast.Viewport.
257
+ function ToastList({ renderToast }: { renderToast?: RenderToastFn }) {
258
+ const { toasts } = useToastManager();
212
259
 
213
- // X Icon component
214
- const X = React.forwardRef<SVGSVGElement, React.ComponentProps<"svg">>(
215
- (props, ref) => (
216
- <svg
217
- ref={ref}
218
- xmlns="http://www.w3.org/2000/svg"
219
- width="24"
220
- height="24"
221
- viewBox="0 0 24 24"
222
- fill="none"
223
- stroke="currentColor"
224
- strokeWidth="2"
225
- strokeLinecap="round"
226
- strokeLinejoin="round"
227
- {...props}
260
+ return toasts.map((toast) => (
261
+ <ToastRoot
262
+ key={toast.id}
263
+ toast={toast}
264
+ variant={getVariantFromType(toast.type)}
265
+ swipeDirection={["down", "right"]}
228
266
  >
229
- <path d="M18 6 6 18" />
230
- <path d="m6 6 12 12" />
231
- </svg>
232
- )
233
- );
234
- X.displayName = "X";
267
+ {renderToast ? (
268
+ renderToast(toast)
269
+ ) : (
270
+ <ToastContent>
271
+ <div className="grid gap-1">
272
+ {toast.title && <ToastTitle>{toast.title}</ToastTitle>}
273
+ {toast.description && (
274
+ <ToastDescription>{toast.description}</ToastDescription>
275
+ )}
276
+ </div>
277
+ {toast.actionProps && <ToastAction {...toast.actionProps} />}
278
+ <ToastClose />
279
+ </ToastContent>
280
+ )}
281
+ </ToastRoot>
282
+ ));
283
+ }
235
284
 
236
285
  // Complete Toast component for easy setup
237
286
  interface ToastComponentProps {
@@ -240,18 +289,27 @@ interface ToastComponentProps {
240
289
  limit?: number;
241
290
  timeout?: number;
242
291
  toastManager?: ReturnType<typeof createToastManager>;
292
+ renderToast?: RenderToastFn;
243
293
  }
244
294
 
245
295
  const Toast = React.forwardRef<HTMLDivElement, ToastComponentProps>(
246
296
  (
247
- { children, className, limit = 3, timeout = 5000, toastManager, ...props },
297
+ {
298
+ children,
299
+ className,
300
+ limit = 3,
301
+ timeout = 5000,
302
+ toastManager,
303
+ renderToast,
304
+ ...props
305
+ },
248
306
  ref
249
307
  ) => (
250
308
  <ToastProvider limit={limit} timeout={timeout} toastManager={toastManager}>
251
309
  {children}
252
310
  <ToastPortal>
253
311
  <ToastViewport ref={ref} className={className} {...props}>
254
- <ToastList />
312
+ <ToastList renderToast={renderToast} />
255
313
  </ToastViewport>
256
314
  </ToastPortal>
257
315
  </ToastProvider>
@@ -265,13 +323,18 @@ export {
265
323
  ToastViewport,
266
324
  ToastPortal,
267
325
  ToastRoot,
326
+ ToastContent,
268
327
  ToastTitle,
269
328
  ToastDescription,
270
329
  ToastAction,
271
330
  ToastClose,
331
+ ToastPositioner,
332
+ ToastArrow,
272
333
  ToastList,
273
334
  useToastManager,
274
335
  createToastManager,
275
336
  toastVariants,
276
337
  getVariantFromType,
277
338
  };
339
+
340
+ export type { ToastComponentProps, RenderToastFn, ToastObject };
@@ -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
  ));
@@ -10,58 +10,13 @@ const TooltipProvider: typeof BaseTooltip.Provider = BaseTooltip.Provider;
10
10
  // Root Component
11
11
  const Tooltip: typeof BaseTooltip.Root = BaseTooltip.Root;
12
12
 
13
- // Trigger Component with Base UI's native render prop support
14
- interface TooltipTriggerProps
15
- extends React.ComponentProps<typeof BaseTooltip.Trigger> {
16
- variant?: "default" | "ghost" | "outline" | "icon";
17
- size?: "default" | "sm" | "lg" | "icon";
18
- }
19
-
20
- const TooltipTrigger: React.ForwardRefExoticComponent<
21
- TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>
22
- > = React.forwardRef<
13
+ // Trigger Component — a simple pass-through. Style via `render` prop.
14
+ const TooltipTrigger = React.forwardRef<
23
15
  HTMLButtonElement,
24
- TooltipTriggerProps
25
- >(
26
- (
27
- { className, variant = "ghost", size = "default", render, ...props },
28
- ref
29
- ) => {
30
- const variantStyles = {
31
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
32
- ghost: "hover:bg-accent hover:text-accent-foreground",
33
- outline:
34
- "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
35
- icon: "bg-transparent hover:bg-transparent rounded-full w-fit h-fit",
36
- };
37
-
38
- const sizeStyles = {
39
- default: "h-10 px-4 py-2",
40
- sm: "h-9 rounded-md px-3",
41
- lg: "h-11 rounded-md px-8",
42
- icon: "size-auto",
43
- };
44
-
45
- const triggerClassName = cn(
46
- "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors",
47
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
48
- "disabled:pointer-events-none disabled:opacity-50",
49
- "data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground",
50
- variantStyles[variant],
51
- sizeStyles[size],
52
- className
53
- );
54
-
55
- return (
56
- <BaseTooltip.Trigger
57
- ref={ref}
58
- className={triggerClassName}
59
- render={render}
60
- {...props}
61
- />
62
- );
63
- }
64
- );
16
+ React.ComponentProps<typeof BaseTooltip.Trigger>
17
+ >(({ className, ...props }, ref) => (
18
+ <BaseTooltip.Trigger ref={ref} className={className} {...props} />
19
+ ));
65
20
  TooltipTrigger.displayName = "TooltipTrigger";
66
21
 
67
22
  // Portal Component
@@ -105,10 +60,10 @@ const TooltipPopup: React.ForwardRefExoticComponent<
105
60
  <BaseTooltip.Popup
106
61
  ref={ref}
107
62
  className={cn(
108
- "origin-[var(--transform-origin)] rounded-md px-3 py-1.5 text-sm shadow-md",
63
+ "origin-(--transform-origin) rounded-md px-3 py-1.5 text-sm shadow-md",
109
64
  "transition-[transform,scale,opacity] duration-200",
110
- "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
111
- "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
65
+ "data-ending-style:scale-95 data-ending-style:opacity-0",
66
+ "data-starting-style:scale-95 data-starting-style:opacity-0",
112
67
  variantStyles[variant],
113
68
  className
114
69
  )}