@dinachi/cli 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +14 -0
  2. package/dist/index.js +392 -344
  3. package/package.json +1 -1
  4. package/templates/autocomplete/autocomplete.tsx +197 -0
  5. package/templates/autocomplete/index.ts +17 -0
  6. package/templates/combobox/combobox.tsx +202 -0
  7. package/templates/combobox/index.ts +17 -0
  8. package/templates/context-menu/context-menu.tsx +104 -39
  9. package/templates/drawer/drawer.tsx +109 -0
  10. package/templates/drawer/index.ts +12 -0
  11. package/templates/fieldset/fieldset.tsx +32 -0
  12. package/templates/fieldset/index.ts +1 -0
  13. package/templates/menu/index.ts +17 -0
  14. package/templates/menu/menu.tsx +282 -0
  15. package/templates/menubar/menubar.tsx +7 -7
  16. package/templates/meter/index.ts +1 -0
  17. package/templates/meter/meter.tsx +64 -0
  18. package/templates/number-field/index.ts +9 -0
  19. package/templates/number-field/number-field.tsx +114 -0
  20. package/templates/popover/index.ts +12 -0
  21. package/templates/popover/popover.tsx +137 -0
  22. package/templates/preview-card/preview-card.tsx +4 -5
  23. package/templates/progress/index.ts +7 -0
  24. package/templates/progress/progress.tsx +64 -0
  25. package/templates/radio/index.ts +1 -0
  26. package/templates/radio/radio.tsx +39 -0
  27. package/templates/scroll-area/index.ts +8 -0
  28. package/templates/scroll-area/scroll-area.tsx +94 -0
  29. package/templates/separator/index.ts +1 -0
  30. package/templates/separator/separator.tsx +25 -0
  31. package/templates/switch/index.ts +1 -0
  32. package/templates/switch/switch.tsx +42 -0
  33. package/templates/toggle-group/index.ts +1 -0
  34. package/templates/toggle-group/toggle-group.tsx +67 -0
  35. package/templates/tooltip/tooltip.tsx +2 -2
@@ -0,0 +1,12 @@
1
+ export {
2
+ Popover,
3
+ PopoverTrigger,
4
+ PopoverContent,
5
+ PopoverArrow,
6
+ PopoverTitle,
7
+ PopoverDescription,
8
+ PopoverClose,
9
+ PopoverPortal,
10
+ PopoverBackdrop,
11
+ } from "./popover"
12
+
@@ -0,0 +1,137 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { Popover as PopoverPrimitive } from "@base-ui/react/popover"
6
+ import { cn } from "@/lib/utils"
7
+
8
+ // Re-export root components for better tree-shaking
9
+ const Popover = PopoverPrimitive.Root
10
+ const PopoverTrigger = PopoverPrimitive.Trigger
11
+ const PopoverPortal = PopoverPrimitive.Portal
12
+ const PopoverClose = PopoverPrimitive.Close
13
+
14
+ // Optimized PopoverContent with better positioning and animations
15
+ const PopoverContent = React.forwardRef<
16
+ React.ComponentRef<typeof PopoverPrimitive.Popup>,
17
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Popup> & {
18
+ readonly sideOffset?: number
19
+ readonly align?: "start" | "center" | "end"
20
+ readonly side?: "top" | "bottom" | "left" | "right"
21
+ }
22
+ >(({ className, align = "center", side = "bottom", sideOffset = 8, ...props }, ref) => (
23
+ <PopoverPrimitive.Portal>
24
+ <PopoverPrimitive.Positioner
25
+ align={align}
26
+ side={side}
27
+ sideOffset={sideOffset}
28
+ >
29
+ <PopoverPrimitive.Popup
30
+ ref={ref}
31
+ className={cn(
32
+ "z-50 rounded-lg border bg-popover px-6 py-4 text-popover-foreground shadow-lg outline-none",
33
+ "origin-[var(--transform-origin)]",
34
+ "data-[starting-style]:scale-90 data-[starting-style]:opacity-0",
35
+ "data-[ending-style]:scale-90 data-[ending-style]:opacity-0",
36
+ "transition-[transform,opacity] duration-150",
37
+ className
38
+ )}
39
+ {...props}
40
+ />
41
+ </PopoverPrimitive.Positioner>
42
+ </PopoverPrimitive.Portal>
43
+ ))
44
+ PopoverContent.displayName = "PopoverContent"
45
+
46
+ // Optimized PopoverArrow
47
+ const PopoverArrow = React.forwardRef<
48
+ React.ComponentRef<typeof PopoverPrimitive.Arrow>,
49
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>
50
+ >(({ className, children, ...props }, ref) => (
51
+ <PopoverPrimitive.Arrow
52
+ ref={ref}
53
+ className={cn(
54
+ "data-[side=bottom]:top-[-8px]",
55
+ "data-[side=left]:right-[-13px] data-[side=left]:rotate-90",
56
+ "data-[side=right]:left-[-13px] data-[side=right]:-rotate-90",
57
+ "data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",
58
+ className
59
+ )}
60
+ {...props}
61
+ >
62
+ {children || (
63
+ <svg width="20" height="10" viewBox="0 0 20 10" fill="none">
64
+ <path
65
+ d="M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z"
66
+ className="fill-popover"
67
+ />
68
+ <path
69
+ d="M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z"
70
+ className="fill-border"
71
+ />
72
+ <path
73
+ d="M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z"
74
+ className="fill-border"
75
+ />
76
+ </svg>
77
+ )}
78
+ </PopoverPrimitive.Arrow>
79
+ ))
80
+ PopoverArrow.displayName = "PopoverArrow"
81
+
82
+ // Optimized PopoverTitle
83
+ const PopoverTitle = React.forwardRef<
84
+ React.ComponentRef<typeof PopoverPrimitive.Title>,
85
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Title>
86
+ >(({ className, ...props }, ref) => (
87
+ <PopoverPrimitive.Title
88
+ ref={ref}
89
+ className={cn("mb-2 text-base font-medium leading-none", className)}
90
+ {...props}
91
+ />
92
+ ))
93
+ PopoverTitle.displayName = "PopoverTitle"
94
+
95
+ // Optimized PopoverDescription
96
+ const PopoverDescription = React.forwardRef<
97
+ React.ComponentRef<typeof PopoverPrimitive.Description>,
98
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Description>
99
+ >(({ className, ...props }, ref) => (
100
+ <PopoverPrimitive.Description
101
+ ref={ref}
102
+ className={cn("text-base text-muted-foreground", className)}
103
+ {...props}
104
+ />
105
+ ))
106
+ PopoverDescription.displayName = "PopoverDescription"
107
+
108
+ // Optimized PopoverBackdrop
109
+ const PopoverBackdrop = React.forwardRef<
110
+ React.ComponentRef<typeof PopoverPrimitive.Backdrop>,
111
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Backdrop>
112
+ >(({ className, ...props }, ref) => (
113
+ <PopoverPrimitive.Backdrop
114
+ ref={ref}
115
+ className={cn(
116
+ "fixed inset-0 z-40 bg-black/50",
117
+ "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
118
+ "transition-opacity duration-150",
119
+ className
120
+ )}
121
+ {...props}
122
+ />
123
+ ))
124
+ PopoverBackdrop.displayName = "PopoverBackdrop"
125
+
126
+ export {
127
+ Popover,
128
+ PopoverTrigger,
129
+ PopoverContent,
130
+ PopoverArrow,
131
+ PopoverTitle,
132
+ PopoverDescription,
133
+ PopoverClose,
134
+ PopoverPortal,
135
+ PopoverBackdrop,
136
+ }
137
+
@@ -1,5 +1,4 @@
1
1
  // @ts-nocheck
2
-
3
2
  "use client"
4
3
 
5
4
  import * as React from "react"
@@ -9,7 +8,7 @@ import { cn } from "@/lib/utils"
9
8
  const PreviewCard = BasePreviewCard.Root
10
9
 
11
10
  const PreviewCardTrigger = React.forwardRef<
12
- React.ComponentRef<typeof BasePreviewCard.Trigger>,
11
+ HTMLAnchorElement,
13
12
  React.ComponentProps<typeof BasePreviewCard.Trigger>
14
13
  >(({ className, ...props }, ref) => (
15
14
  <BasePreviewCard.Trigger
@@ -64,12 +63,12 @@ const PreviewCardPopup = React.forwardRef<
64
63
  <BasePreviewCard.Popup
65
64
  ref={ref}
66
65
  className={cn(
67
- "flex w-[280px] origin-[var(--transform-origin)] flex-col gap-3 rounded-lg bg-secondary/70 p-4 shadow-lg shadow-secondary/20",
66
+ "flex w-[280px] origin-[var(--transform-origin)] flex-col gap-3 rounded-lg bg-secondary/80 p-4 shadow-lg shadow-secondary/20",
68
67
  "outline outline-1 outline-border",
69
68
  "transition-[transform,scale,opacity] duration-200",
70
69
  "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
71
70
  "data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
72
- "bg-secondary/70 backdrop-blur-sm dark:shadow-none dark:-outline-offset-1",
71
+ "bg-secondary/80 backdrop-blur-sm dark:shadow-none dark:-outline-offset-1",
73
72
  className
74
73
  )}
75
74
  {...props}
@@ -139,4 +138,4 @@ export {
139
138
  PreviewCardArrow,
140
139
  PreviewCardContent,
141
140
  PreviewCardArrowSvg,
142
- }
141
+ }
@@ -0,0 +1,7 @@
1
+ export {
2
+ Progress,
3
+ ProgressTrack,
4
+ ProgressIndicator,
5
+ ProgressLabel,
6
+ ProgressValue,
7
+ } from "./progress"
@@ -0,0 +1,64 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Progress = React.forwardRef<
9
+ React.ComponentRef<typeof ProgressPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
11
+ >(({ className, ...props }, ref) => (
12
+ <ProgressPrimitive.Root ref={ref} className={cn("grid gap-2", className)} {...props} />
13
+ ))
14
+ Progress.displayName = "Progress"
15
+
16
+ const ProgressTrack = React.forwardRef<
17
+ React.ComponentRef<typeof ProgressPrimitive.Track>,
18
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Track>
19
+ >(({ className, ...props }, ref) => (
20
+ <ProgressPrimitive.Track
21
+ ref={ref}
22
+ className={cn("relative h-2 w-full overflow-hidden rounded-full bg-secondary", className)}
23
+ {...props}
24
+ />
25
+ ))
26
+ ProgressTrack.displayName = "ProgressTrack"
27
+
28
+ const ProgressIndicator = React.forwardRef<
29
+ React.ComponentRef<typeof ProgressPrimitive.Indicator>,
30
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Indicator>
31
+ >(({ className, ...props }, ref) => (
32
+ <ProgressPrimitive.Indicator
33
+ ref={ref}
34
+ className={cn("h-full rounded-full bg-primary transition-[width] duration-200", className)}
35
+ {...props}
36
+ />
37
+ ))
38
+ ProgressIndicator.displayName = "ProgressIndicator"
39
+
40
+ const ProgressLabel = React.forwardRef<
41
+ React.ComponentRef<typeof ProgressPrimitive.Label>,
42
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Label>
43
+ >(({ className, ...props }, ref) => (
44
+ <ProgressPrimitive.Label
45
+ ref={ref}
46
+ className={cn("text-sm font-medium leading-none", className)}
47
+ {...props}
48
+ />
49
+ ))
50
+ ProgressLabel.displayName = "ProgressLabel"
51
+
52
+ const ProgressValue = React.forwardRef<
53
+ React.ComponentRef<typeof ProgressPrimitive.Value>,
54
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Value>
55
+ >(({ className, ...props }, ref) => (
56
+ <ProgressPrimitive.Value
57
+ ref={ref}
58
+ className={cn("text-xs text-muted-foreground", className)}
59
+ {...props}
60
+ />
61
+ ))
62
+ ProgressValue.displayName = "ProgressValue"
63
+
64
+ export { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValue }
@@ -0,0 +1 @@
1
+ export { Radio, RadioGroup } from "./radio"
@@ -0,0 +1,39 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { Radio as RadioPrimitive } from "@base-ui/react/radio"
6
+ import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group"
7
+ import { Circle } from "lucide-react"
8
+ import { cn } from "@/lib/utils"
9
+
10
+ const RadioGroup = React.forwardRef<
11
+ React.ComponentRef<typeof RadioGroupPrimitive>,
12
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive>
13
+ >(({ className, ...props }, ref) => (
14
+ <RadioGroupPrimitive ref={ref} className={cn("grid gap-2", className)} {...props} />
15
+ ))
16
+ RadioGroup.displayName = "RadioGroup"
17
+
18
+ const Radio = React.forwardRef<
19
+ React.ComponentRef<typeof RadioPrimitive.Root>,
20
+ React.ComponentPropsWithoutRef<typeof RadioPrimitive.Root>
21
+ >(({ className, ...props }, ref) => (
22
+ <RadioPrimitive.Root
23
+ ref={ref}
24
+ className={cn(
25
+ "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background",
26
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
27
+ "disabled:cursor-not-allowed disabled:opacity-50",
28
+ className
29
+ )}
30
+ {...props}
31
+ >
32
+ <RadioPrimitive.Indicator className="flex items-center justify-center">
33
+ <Circle className="h-2.5 w-2.5 fill-current text-current" />
34
+ </RadioPrimitive.Indicator>
35
+ </RadioPrimitive.Root>
36
+ ))
37
+ Radio.displayName = "Radio"
38
+
39
+ export { Radio, RadioGroup }
@@ -0,0 +1,8 @@
1
+ export {
2
+ ScrollArea,
3
+ ScrollAreaViewport,
4
+ ScrollAreaContent,
5
+ ScrollAreaScrollbar,
6
+ ScrollAreaThumb,
7
+ ScrollAreaCorner,
8
+ } from "./scroll-area"
@@ -0,0 +1,94 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const ScrollArea = React.forwardRef<
9
+ React.ComponentRef<typeof ScrollAreaPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
11
+ >(({ className, ...props }, ref) => (
12
+ <ScrollAreaPrimitive.Root
13
+ ref={ref}
14
+ className={cn("relative overflow-hidden", className)}
15
+ {...props}
16
+ />
17
+ ))
18
+ ScrollArea.displayName = "ScrollArea"
19
+
20
+ const ScrollAreaViewport = React.forwardRef<
21
+ React.ComponentRef<typeof ScrollAreaPrimitive.Viewport>,
22
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Viewport>
23
+ >(({ className, ...props }, ref) => (
24
+ <ScrollAreaPrimitive.Viewport
25
+ ref={ref}
26
+ className={cn("size-full rounded-[inherit]", className)}
27
+ {...props}
28
+ />
29
+ ))
30
+ ScrollAreaViewport.displayName = "ScrollAreaViewport"
31
+
32
+ const ScrollAreaContent = React.forwardRef<
33
+ React.ComponentRef<typeof ScrollAreaPrimitive.Content>,
34
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Content>
35
+ >(({ className, ...props }, ref) => (
36
+ <ScrollAreaPrimitive.Content
37
+ ref={ref}
38
+ className={cn("min-w-full", className)}
39
+ {...props}
40
+ />
41
+ ))
42
+ ScrollAreaContent.displayName = "ScrollAreaContent"
43
+
44
+ const ScrollAreaScrollbar = React.forwardRef<
45
+ React.ComponentRef<typeof ScrollAreaPrimitive.Scrollbar>,
46
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Scrollbar>
47
+ >(({ className, orientation = "vertical", ...props }, ref) => (
48
+ <ScrollAreaPrimitive.Scrollbar
49
+ ref={ref}
50
+ orientation={orientation}
51
+ className={cn(
52
+ "flex touch-none select-none p-0.5 transition-colors",
53
+ orientation === "vertical"
54
+ ? "h-full w-2.5 border-l border-l-transparent"
55
+ : "h-2.5 w-full flex-col border-t border-t-transparent",
56
+ className
57
+ )}
58
+ {...props}
59
+ />
60
+ ))
61
+ ScrollAreaScrollbar.displayName = "ScrollAreaScrollbar"
62
+
63
+ const ScrollAreaThumb = React.forwardRef<
64
+ React.ComponentRef<typeof ScrollAreaPrimitive.Thumb>,
65
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Thumb>
66
+ >(({ className, ...props }, ref) => (
67
+ <ScrollAreaPrimitive.Thumb
68
+ ref={ref}
69
+ className={cn("relative flex-1 rounded-full bg-border", className)}
70
+ {...props}
71
+ />
72
+ ))
73
+ ScrollAreaThumb.displayName = "ScrollAreaThumb"
74
+
75
+ const ScrollAreaCorner = React.forwardRef<
76
+ React.ComponentRef<typeof ScrollAreaPrimitive.Corner>,
77
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Corner>
78
+ >(({ className, ...props }, ref) => (
79
+ <ScrollAreaPrimitive.Corner
80
+ ref={ref}
81
+ className={cn("bg-background", className)}
82
+ {...props}
83
+ />
84
+ ))
85
+ ScrollAreaCorner.displayName = "ScrollAreaCorner"
86
+
87
+ export {
88
+ ScrollArea,
89
+ ScrollAreaViewport,
90
+ ScrollAreaContent,
91
+ ScrollAreaScrollbar,
92
+ ScrollAreaThumb,
93
+ ScrollAreaCorner,
94
+ }
@@ -0,0 +1 @@
1
+ export { Separator } from "./separator"
@@ -0,0 +1,25 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Separator = React.forwardRef<
9
+ React.ComponentRef<typeof SeparatorPrimitive>,
10
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive>
11
+ >(({ className, orientation = "horizontal", ...props }, ref) => (
12
+ <SeparatorPrimitive
13
+ ref={ref}
14
+ orientation={orientation}
15
+ className={cn(
16
+ "shrink-0 bg-border",
17
+ orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
18
+ className
19
+ )}
20
+ {...props}
21
+ />
22
+ ))
23
+ Separator.displayName = "Separator"
24
+
25
+ export { Separator }
@@ -0,0 +1 @@
1
+ export { Switch, SwitchThumb } from "./switch"
@@ -0,0 +1,42 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Switch = React.forwardRef<
9
+ React.ComponentRef<typeof SwitchPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>
11
+ >(({ className, ...props }, ref) => (
12
+ <SwitchPrimitive.Root
13
+ ref={ref}
14
+ className={cn(
15
+ "peer 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-[checked]:bg-primary data-[unchecked]:bg-input",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ ))
24
+ Switch.displayName = "Switch"
25
+
26
+ const SwitchThumb = React.forwardRef<
27
+ React.ComponentRef<typeof SwitchPrimitive.Thumb>,
28
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Thumb>
29
+ >(({ className, ...props }, ref) => (
30
+ <SwitchPrimitive.Thumb
31
+ ref={ref}
32
+ className={cn(
33
+ "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
34
+ "data-[checked]:translate-x-5 data-[unchecked]:translate-x-0",
35
+ className
36
+ )}
37
+ {...props}
38
+ />
39
+ ))
40
+ SwitchThumb.displayName = "SwitchThumb"
41
+
42
+ export { Switch, SwitchThumb }
@@ -0,0 +1 @@
1
+ export { ToggleGroup, ToggleGroupItem } from "./toggle-group"
@@ -0,0 +1,67 @@
1
+ // @ts-nocheck
2
+ "use client"
3
+
4
+ import * as React from "react"
5
+ import { ToggleGroup as ToggleGroupPrimitive } from "@base-ui/react/toggle-group"
6
+ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle"
7
+ import { cva } from "class-variance-authority"
8
+ import { cn } from "@/lib/utils"
9
+
10
+ type ToggleGroupItemProps = React.ComponentPropsWithoutRef<typeof TogglePrimitive> & {
11
+ variant?: "default" | "outline"
12
+ size?: "default" | "sm" | "lg"
13
+ }
14
+
15
+ const toggleGroupItemVariants = cva(
16
+ [
17
+ "inline-flex items-center justify-center rounded-md text-sm font-medium",
18
+ "ring-offset-background transition-colors",
19
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
20
+ "disabled:pointer-events-none disabled:opacity-50",
21
+ "data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
22
+ ],
23
+ {
24
+ variants: {
25
+ variant: {
26
+ default: "bg-transparent hover:bg-muted hover:text-muted-foreground",
27
+ outline:
28
+ "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground data-[state=on]:border-accent",
29
+ },
30
+ size: {
31
+ default: "h-10 px-3",
32
+ sm: "h-9 px-2.5 text-xs",
33
+ lg: "h-11 px-5",
34
+ },
35
+ },
36
+ defaultVariants: {
37
+ variant: "outline",
38
+ size: "sm",
39
+ },
40
+ }
41
+ )
42
+
43
+ const ToggleGroup = React.forwardRef<
44
+ React.ComponentRef<typeof ToggleGroupPrimitive>,
45
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive>
46
+ >(({ className, ...props }, ref) => (
47
+ <ToggleGroupPrimitive
48
+ ref={ref}
49
+ className={cn("inline-flex items-center justify-center gap-1", className)}
50
+ {...props}
51
+ />
52
+ ))
53
+ ToggleGroup.displayName = "ToggleGroup"
54
+
55
+ const ToggleGroupItem = React.forwardRef<
56
+ React.ComponentRef<typeof TogglePrimitive>,
57
+ ToggleGroupItemProps
58
+ >(({ className, variant = "outline", size = "sm", ...props }, ref) => (
59
+ <TogglePrimitive
60
+ ref={ref}
61
+ className={cn(toggleGroupItemVariants({ variant, size }), className)}
62
+ {...props}
63
+ />
64
+ ))
65
+ ToggleGroupItem.displayName = "ToggleGroupItem"
66
+
67
+ export { ToggleGroup, ToggleGroupItem }
@@ -19,9 +19,9 @@ interface TooltipTriggerProps
19
19
  }
20
20
 
21
21
  const TooltipTrigger: React.ForwardRefExoticComponent<
22
- TooltipTriggerProps & React.RefAttributes<React.ComponentRef<typeof BaseTooltip.Trigger>>
22
+ TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>
23
23
  > = React.forwardRef<
24
- React.ComponentRef<typeof BaseTooltip.Trigger>,
24
+ HTMLButtonElement,
25
25
  TooltipTriggerProps
26
26
  >(
27
27
  (