@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.
- package/dist/index.js +122 -33
- package/package.json +2 -3
- package/templates/alert-dialog/alert-dialog.tsx +62 -47
- package/templates/autocomplete/autocomplete.tsx +7 -7
- package/templates/badge/badge.tsx +58 -119
- package/templates/card/card.tsx +1 -1
- package/templates/checkbox/checkbox.tsx +16 -14
- package/templates/combobox/combobox.tsx +5 -5
- package/templates/context-menu/context-menu.tsx +124 -186
- package/templates/context-menu/index.ts +3 -1
- package/templates/dialog/dialog.tsx +26 -27
- package/templates/drawer/drawer.tsx +23 -21
- package/templates/field/field.tsx +5 -15
- package/templates/form/form.tsx +9 -66
- package/templates/label/index.ts +1 -0
- package/templates/label/label.tsx +21 -0
- package/templates/menu/index.ts +2 -0
- package/templates/menu/menu.tsx +59 -61
- package/templates/menubar/menubar.tsx +44 -72
- package/templates/navigation-menu/navigation-menu.tsx +61 -18
- package/templates/popover/index.ts +4 -1
- package/templates/popover/popover.tsx +80 -30
- package/templates/preview-card/preview-card.tsx +19 -5
- package/templates/radio/index.ts +1 -1
- package/templates/radio/radio.tsx +30 -14
- package/templates/select/select.tsx +75 -73
- package/templates/skeleton/index.ts +1 -0
- package/templates/skeleton/skeleton.tsx +12 -0
- package/templates/slider/slider.tsx +9 -15
- package/templates/switch/switch.tsx +15 -11
- package/templates/tabs/tabs.tsx +2 -2
- package/templates/toast/toast.tsx +76 -48
- package/templates/toggle/toggle.tsx +0 -17
- package/templates/toggle-group/toggle-group.tsx +8 -3
- package/templates/toolbar/toolbar.tsx +5 -4
- package/templates/tooltip/tooltip.tsx +9 -54
|
@@ -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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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}
|
package/templates/tabs/tabs.tsx
CHANGED
|
@@ -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-[
|
|
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-
|
|
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
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
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
|
-
|
|
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
|
|
57
|
-
success: "border-success bg-
|
|
58
|
-
warning: "border-warning bg-
|
|
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-
|
|
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
|
-
|
|
179
|
-
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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-[
|
|
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-[
|
|
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(
|
|
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
|
|
14
|
-
|
|
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
|
-
|
|
25
|
-
>(
|
|
26
|
-
|
|
27
|
-
|
|
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-
|
|
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-
|
|
111
|
-
"data-
|
|
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
|
)}
|