@dinachi/cli 0.3.2 → 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.
- package/README.md +14 -0
- package/dist/index.js +392 -344
- package/package.json +5 -5
- package/templates/accordion/accordion.tsx +1 -1
- package/templates/alert-dialog/alert-dialog.tsx +1 -1
- package/templates/autocomplete/autocomplete.tsx +197 -0
- package/templates/autocomplete/index.ts +17 -0
- package/templates/avatar/avatar.tsx +4 -4
- package/templates/checkbox/checkbox.tsx +2 -2
- package/templates/checkbox-group/checkbox-group.tsx +2 -2
- package/templates/collapsible/collapsible.tsx +4 -4
- package/templates/combobox/combobox.tsx +202 -0
- package/templates/combobox/index.ts +17 -0
- package/templates/context-menu/context-menu.tsx +119 -54
- package/templates/dialog/dialog.tsx +1 -1
- package/templates/drawer/drawer.tsx +109 -0
- package/templates/drawer/index.ts +12 -0
- package/templates/field/field.tsx +1 -1
- package/templates/fieldset/fieldset.tsx +32 -0
- package/templates/fieldset/index.ts +1 -0
- package/templates/form/form.tsx +3 -3
- package/templates/input/input.tsx +23 -15
- package/templates/menu/index.ts +17 -0
- package/templates/menu/menu.tsx +282 -0
- package/templates/menubar/menubar.tsx +22 -22
- package/templates/meter/index.ts +1 -0
- package/templates/meter/meter.tsx +64 -0
- package/templates/navigation-menu/navigation-menu.tsx +13 -13
- package/templates/number-field/index.ts +9 -0
- package/templates/number-field/number-field.tsx +114 -0
- package/templates/popover/index.ts +12 -0
- package/templates/popover/popover.tsx +137 -0
- package/templates/preview-card/preview-card.tsx +10 -11
- package/templates/progress/index.ts +7 -0
- package/templates/progress/progress.tsx +64 -0
- package/templates/radio/index.ts +1 -0
- package/templates/radio/radio.tsx +39 -0
- package/templates/scroll-area/index.ts +8 -0
- package/templates/scroll-area/scroll-area.tsx +94 -0
- package/templates/select/select.tsx +8 -8
- package/templates/separator/index.ts +1 -0
- package/templates/separator/separator.tsx +25 -0
- package/templates/slider/slider.tsx +10 -10
- package/templates/switch/index.ts +1 -0
- package/templates/switch/switch.tsx +42 -0
- package/templates/tabs/tabs.tsx +6 -6
- package/templates/toast/toast.tsx +1 -1
- package/templates/toggle/toggle.tsx +2 -2
- package/templates/toggle-group/index.ts +1 -0
- package/templates/toggle-group/toggle-group.tsx +67 -0
- package/templates/toolbar/toolbar.tsx +7 -7
- package/templates/tooltip/tooltip.tsx +38 -23
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { Slider as BaseSlider } from "@base-ui
|
|
4
|
-
import { DirectionProvider } from "@base-ui
|
|
3
|
+
import { Slider as BaseSlider } from "@base-ui/react/slider";
|
|
4
|
+
import { DirectionProvider } from "@base-ui/react/direction-provider";
|
|
5
5
|
import { cn } from "@/lib/utils"
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
const Slider = React.forwardRef<
|
|
9
|
-
React.
|
|
9
|
+
React.ComponentRef<typeof BaseSlider.Root>,
|
|
10
10
|
React.ComponentProps<typeof BaseSlider.Root>
|
|
11
11
|
>(({ className, ...props }, ref) => {
|
|
12
12
|
const internalRef = React.useRef<HTMLDivElement>(null);
|
|
@@ -15,7 +15,7 @@ const Slider = React.forwardRef<
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<BaseSlider.Root
|
|
18
|
-
ref={internalRef}
|
|
18
|
+
ref={internalRef as React.RefObject<HTMLDivElement>}
|
|
19
19
|
className={cn("relative flex w-full touch-none select-none items-center", className)}
|
|
20
20
|
{...props}
|
|
21
21
|
/>
|
|
@@ -24,7 +24,7 @@ const Slider = React.forwardRef<
|
|
|
24
24
|
Slider.displayName = "Slider";
|
|
25
25
|
|
|
26
26
|
const SliderValue = React.forwardRef<
|
|
27
|
-
React.
|
|
27
|
+
React.ComponentRef<typeof BaseSlider.Value>,
|
|
28
28
|
React.ComponentProps<typeof BaseSlider.Value>
|
|
29
29
|
>(({ className, ...props }, ref) => (
|
|
30
30
|
<BaseSlider.Value
|
|
@@ -36,7 +36,7 @@ const SliderValue = React.forwardRef<
|
|
|
36
36
|
SliderValue.displayName = "SliderValue";
|
|
37
37
|
|
|
38
38
|
const SliderControl = React.forwardRef<
|
|
39
|
-
React.
|
|
39
|
+
React.ComponentRef<typeof BaseSlider.Control>,
|
|
40
40
|
React.ComponentProps<typeof BaseSlider.Control>
|
|
41
41
|
>(({ className, ...props }, ref) => (
|
|
42
42
|
<BaseSlider.Control
|
|
@@ -48,7 +48,7 @@ const SliderControl = React.forwardRef<
|
|
|
48
48
|
SliderControl.displayName = "SliderControl";
|
|
49
49
|
|
|
50
50
|
const SliderTrack = React.forwardRef<
|
|
51
|
-
React.
|
|
51
|
+
React.ComponentRef<typeof BaseSlider.Track>,
|
|
52
52
|
React.ComponentProps<typeof BaseSlider.Track>
|
|
53
53
|
>(({ className, ...props }, ref) => (
|
|
54
54
|
<BaseSlider.Track
|
|
@@ -63,7 +63,7 @@ const SliderTrack = React.forwardRef<
|
|
|
63
63
|
SliderTrack.displayName = "SliderTrack";
|
|
64
64
|
|
|
65
65
|
const SliderRange = React.forwardRef<
|
|
66
|
-
React.
|
|
66
|
+
React.ComponentRef<typeof BaseSlider.Indicator>,
|
|
67
67
|
React.ComponentProps<typeof BaseSlider.Indicator>
|
|
68
68
|
>(({ className, ...props }, ref) => (
|
|
69
69
|
<BaseSlider.Indicator
|
|
@@ -75,7 +75,7 @@ const SliderRange = React.forwardRef<
|
|
|
75
75
|
SliderRange.displayName = "SliderRange";
|
|
76
76
|
|
|
77
77
|
const SliderThumb = React.forwardRef<
|
|
78
|
-
React.
|
|
78
|
+
React.ComponentRef<typeof BaseSlider.Thumb>,
|
|
79
79
|
React.ComponentProps<typeof BaseSlider.Thumb>
|
|
80
80
|
>(({ className, ...props }, ref) => (
|
|
81
81
|
<BaseSlider.Thumb
|
|
@@ -118,4 +118,4 @@ export {
|
|
|
118
118
|
SliderRange,
|
|
119
119
|
SliderThumb,
|
|
120
120
|
SliderDirectionProvider,
|
|
121
|
-
};
|
|
121
|
+
};
|
|
@@ -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 }
|
package/templates/tabs/tabs.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { Tabs as BaseTabs } from "@base-ui
|
|
3
|
+
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
|
|
4
4
|
import { cn } from "@/lib/utils";
|
|
5
5
|
|
|
6
6
|
const Tabs = React.forwardRef<
|
|
7
|
-
React.
|
|
7
|
+
React.ComponentRef<typeof BaseTabs.Root>,
|
|
8
8
|
React.ComponentProps<typeof BaseTabs.Root>
|
|
9
9
|
>(({ className, ...props }, ref) => (
|
|
10
10
|
<BaseTabs.Root
|
|
@@ -16,7 +16,7 @@ const Tabs = React.forwardRef<
|
|
|
16
16
|
Tabs.displayName = "Tabs";
|
|
17
17
|
|
|
18
18
|
const TabsList = React.forwardRef<
|
|
19
|
-
React.
|
|
19
|
+
React.ComponentRef<typeof BaseTabs.List>,
|
|
20
20
|
React.ComponentProps<typeof BaseTabs.List>
|
|
21
21
|
>(({ className, ...props }, ref) => (
|
|
22
22
|
<BaseTabs.List
|
|
@@ -31,7 +31,7 @@ const TabsList = React.forwardRef<
|
|
|
31
31
|
TabsList.displayName = "TabsList";
|
|
32
32
|
|
|
33
33
|
const TabsTrigger = React.forwardRef<
|
|
34
|
-
React.
|
|
34
|
+
React.ComponentRef<typeof BaseTabs.Tab>,
|
|
35
35
|
React.ComponentProps<typeof BaseTabs.Tab>
|
|
36
36
|
>(({ className, ...props }, ref) => (
|
|
37
37
|
<BaseTabs.Tab
|
|
@@ -50,7 +50,7 @@ const TabsTrigger = React.forwardRef<
|
|
|
50
50
|
TabsTrigger.displayName = "TabsTrigger";
|
|
51
51
|
|
|
52
52
|
const TabsContent = React.forwardRef<
|
|
53
|
-
React.
|
|
53
|
+
React.ComponentRef<typeof BaseTabs.Panel>,
|
|
54
54
|
React.ComponentProps<typeof BaseTabs.Panel>
|
|
55
55
|
>(({ className, ...props }, ref) => (
|
|
56
56
|
<BaseTabs.Panel
|
|
@@ -66,7 +66,7 @@ const TabsContent = React.forwardRef<
|
|
|
66
66
|
TabsContent.displayName = "TabsContent";
|
|
67
67
|
|
|
68
68
|
const TabsIndicator = React.forwardRef<
|
|
69
|
-
React.
|
|
69
|
+
React.ComponentRef<typeof BaseTabs.Indicator>,
|
|
70
70
|
React.ComponentProps<typeof BaseTabs.Indicator>
|
|
71
71
|
>(({ className, ...props }, ref) => (
|
|
72
72
|
<BaseTabs.Indicator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { Toast as BaseToast } from "@base-ui
|
|
3
|
+
import { Toast as BaseToast } from "@base-ui/react/toast";
|
|
4
4
|
import { cn } from "@/lib/utils";
|
|
5
5
|
import { type VariantProps, cva } from "class-variance-authority";
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client"
|
|
3
3
|
|
|
4
4
|
import * as React from "react"
|
|
5
|
-
import { Toggle as TogglePrimitive } from "@base-ui
|
|
5
|
+
import { Toggle as TogglePrimitive } from "@base-ui/react/toggle"
|
|
6
6
|
import { type VariantProps, cva } from "class-variance-authority"
|
|
7
7
|
import { cn } from "@/lib/utils"
|
|
8
8
|
|
|
@@ -68,7 +68,7 @@ export interface ToggleProps
|
|
|
68
68
|
VariantProps<typeof toggleVariants> {}
|
|
69
69
|
|
|
70
70
|
const Toggle = React.forwardRef<
|
|
71
|
-
React.
|
|
71
|
+
React.ComponentRef<typeof TogglePrimitive>,
|
|
72
72
|
ToggleProps
|
|
73
73
|
>(({ className, variant, size, ...props }, ref) => (
|
|
74
74
|
<TogglePrimitive
|
|
@@ -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 }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { Toolbar as BaseToolbar } from "@base-ui
|
|
3
|
+
import { Toolbar as BaseToolbar } from "@base-ui/react/toolbar";
|
|
4
4
|
import { cn } from "@/lib/utils";
|
|
5
5
|
|
|
6
6
|
const ToolbarRoot = React.forwardRef<
|
|
7
|
-
React.
|
|
7
|
+
React.ComponentRef<typeof BaseToolbar.Root>,
|
|
8
8
|
React.ComponentProps<typeof BaseToolbar.Root>
|
|
9
9
|
>(({ className, ...props }, ref) => (
|
|
10
10
|
<BaseToolbar.Root
|
|
@@ -19,7 +19,7 @@ const ToolbarRoot = React.forwardRef<
|
|
|
19
19
|
ToolbarRoot.displayName = "ToolbarRoot";
|
|
20
20
|
|
|
21
21
|
const ToolbarButton = React.forwardRef<
|
|
22
|
-
React.
|
|
22
|
+
React.ComponentRef<typeof BaseToolbar.Button>,
|
|
23
23
|
React.ComponentProps<typeof BaseToolbar.Button>
|
|
24
24
|
>(({ className, ...props }, ref) => (
|
|
25
25
|
<BaseToolbar.Button
|
|
@@ -38,7 +38,7 @@ const ToolbarButton = React.forwardRef<
|
|
|
38
38
|
ToolbarButton.displayName = "ToolbarButton";
|
|
39
39
|
|
|
40
40
|
const ToolbarLink = React.forwardRef<
|
|
41
|
-
React.
|
|
41
|
+
React.ComponentRef<typeof BaseToolbar.Link>,
|
|
42
42
|
React.ComponentProps<typeof BaseToolbar.Link>
|
|
43
43
|
>(({ className, ...props }, ref) => (
|
|
44
44
|
<BaseToolbar.Link
|
|
@@ -56,7 +56,7 @@ const ToolbarLink = React.forwardRef<
|
|
|
56
56
|
ToolbarLink.displayName = "ToolbarLink";
|
|
57
57
|
|
|
58
58
|
const ToolbarSeparator = React.forwardRef<
|
|
59
|
-
React.
|
|
59
|
+
React.ComponentRef<typeof BaseToolbar.Separator>,
|
|
60
60
|
React.ComponentProps<typeof BaseToolbar.Separator>
|
|
61
61
|
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
62
62
|
<BaseToolbar.Separator
|
|
@@ -73,7 +73,7 @@ const ToolbarSeparator = React.forwardRef<
|
|
|
73
73
|
ToolbarSeparator.displayName = "ToolbarSeparator";
|
|
74
74
|
|
|
75
75
|
const ToolbarGroup = React.forwardRef<
|
|
76
|
-
React.
|
|
76
|
+
React.ComponentRef<typeof BaseToolbar.Group>,
|
|
77
77
|
React.ComponentProps<typeof BaseToolbar.Group>
|
|
78
78
|
>(({ className, ...props }, ref) => (
|
|
79
79
|
<BaseToolbar.Group
|
|
@@ -85,7 +85,7 @@ const ToolbarGroup = React.forwardRef<
|
|
|
85
85
|
ToolbarGroup.displayName = "ToolbarGroup";
|
|
86
86
|
|
|
87
87
|
const ToolbarInput = React.forwardRef<
|
|
88
|
-
React.
|
|
88
|
+
React.ComponentRef<typeof BaseToolbar.Input>,
|
|
89
89
|
React.ComponentProps<typeof BaseToolbar.Input>
|
|
90
90
|
>(({ className, ...props }, ref) => (
|
|
91
91
|
<BaseToolbar.Input
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import { Tooltip as BaseTooltip } from "@base-ui
|
|
5
|
+
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
6
6
|
import { cn } from "@/lib/utils";
|
|
7
7
|
|
|
8
8
|
// Provider Component
|
|
9
|
-
const TooltipProvider = BaseTooltip.Provider;
|
|
9
|
+
const TooltipProvider: typeof BaseTooltip.Provider = BaseTooltip.Provider;
|
|
10
10
|
|
|
11
11
|
// Root Component
|
|
12
|
-
const Tooltip = BaseTooltip.Root;
|
|
12
|
+
const Tooltip: typeof BaseTooltip.Root = BaseTooltip.Root;
|
|
13
13
|
|
|
14
14
|
// Trigger Component with Base UI's native render prop support
|
|
15
15
|
interface TooltipTriggerProps
|
|
@@ -18,8 +18,10 @@ interface TooltipTriggerProps
|
|
|
18
18
|
size?: "default" | "sm" | "lg" | "icon";
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const TooltipTrigger
|
|
22
|
-
React.
|
|
21
|
+
const TooltipTrigger: React.ForwardRefExoticComponent<
|
|
22
|
+
TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>
|
|
23
|
+
> = React.forwardRef<
|
|
24
|
+
HTMLButtonElement,
|
|
23
25
|
TooltipTriggerProps
|
|
24
26
|
>(
|
|
25
27
|
(
|
|
@@ -64,11 +66,14 @@ const TooltipTrigger = React.forwardRef<
|
|
|
64
66
|
TooltipTrigger.displayName = "TooltipTrigger";
|
|
65
67
|
|
|
66
68
|
// Portal Component
|
|
67
|
-
const TooltipPortal = BaseTooltip.Portal;
|
|
69
|
+
const TooltipPortal: typeof BaseTooltip.Portal = BaseTooltip.Portal;
|
|
68
70
|
|
|
69
71
|
// Positioner Component
|
|
70
|
-
const TooltipPositioner
|
|
71
|
-
React.
|
|
72
|
+
const TooltipPositioner: React.ForwardRefExoticComponent<
|
|
73
|
+
React.ComponentProps<typeof BaseTooltip.Positioner> &
|
|
74
|
+
React.RefAttributes<React.ComponentRef<typeof BaseTooltip.Positioner>>
|
|
75
|
+
> = React.forwardRef<
|
|
76
|
+
React.ComponentRef<typeof BaseTooltip.Positioner>,
|
|
72
77
|
React.ComponentProps<typeof BaseTooltip.Positioner>
|
|
73
78
|
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
74
79
|
<BaseTooltip.Positioner
|
|
@@ -86,8 +91,10 @@ interface TooltipPopupProps
|
|
|
86
91
|
variant?: "default" | "inverse";
|
|
87
92
|
}
|
|
88
93
|
|
|
89
|
-
const TooltipPopup
|
|
90
|
-
React.
|
|
94
|
+
const TooltipPopup: React.ForwardRefExoticComponent<
|
|
95
|
+
TooltipPopupProps & React.RefAttributes<React.ComponentRef<typeof BaseTooltip.Popup>>
|
|
96
|
+
> = React.forwardRef<
|
|
97
|
+
React.ComponentRef<typeof BaseTooltip.Popup>,
|
|
91
98
|
TooltipPopupProps
|
|
92
99
|
>(({ className, variant = "default", ...props }, ref) => {
|
|
93
100
|
const variantStyles = {
|
|
@@ -113,12 +120,16 @@ const TooltipPopup = React.forwardRef<
|
|
|
113
120
|
TooltipPopup.displayName = "TooltipPopup";
|
|
114
121
|
|
|
115
122
|
// Arrow Component with custom SVG
|
|
116
|
-
|
|
117
|
-
React.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
type TooltipArrowProps = React.ComponentProps<typeof BaseTooltip.Arrow> & {
|
|
124
|
+
children?: React.ReactNode;
|
|
125
|
+
variant?: "default" | "inverse";
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const TooltipArrow: React.ForwardRefExoticComponent<
|
|
129
|
+
TooltipArrowProps & React.RefAttributes<React.ComponentRef<typeof BaseTooltip.Arrow>>
|
|
130
|
+
> = React.forwardRef<
|
|
131
|
+
React.ComponentRef<typeof BaseTooltip.Arrow>,
|
|
132
|
+
TooltipArrowProps
|
|
122
133
|
>(({ className, children, variant = "default", ...props }, ref) => (
|
|
123
134
|
<BaseTooltip.Arrow
|
|
124
135
|
ref={ref}
|
|
@@ -143,8 +154,10 @@ interface TooltipContentProps extends TooltipPopupProps {
|
|
|
143
154
|
showArrow?: boolean;
|
|
144
155
|
}
|
|
145
156
|
|
|
146
|
-
const TooltipContent
|
|
147
|
-
React.
|
|
157
|
+
const TooltipContent: React.ForwardRefExoticComponent<
|
|
158
|
+
TooltipContentProps & React.RefAttributes<React.ComponentRef<typeof BaseTooltip.Popup>>
|
|
159
|
+
> = React.forwardRef<
|
|
160
|
+
React.ComponentRef<typeof BaseTooltip.Popup>,
|
|
148
161
|
TooltipContentProps
|
|
149
162
|
>(
|
|
150
163
|
(
|
|
@@ -178,11 +191,13 @@ const TooltipContent = React.forwardRef<
|
|
|
178
191
|
TooltipContent.displayName = "TooltipContent";
|
|
179
192
|
|
|
180
193
|
// Optimized Arrow SVG Component
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
194
|
+
type TooltipArrowSvgProps = React.ComponentProps<"svg"> & {
|
|
195
|
+
variant?: "default" | "inverse";
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const TooltipArrowSvg: React.MemoExoticComponent<
|
|
199
|
+
React.FC<TooltipArrowSvgProps>
|
|
200
|
+
> = React.memo(({ variant = "default", ...props }: TooltipArrowSvgProps) => {
|
|
186
201
|
const fillClasses = variant === "inverse" ? "fill-primary" : "fill-popover";
|
|
187
202
|
|
|
188
203
|
const borderClasses =
|