sonance-brand-mcp 1.3.108 → 1.3.110
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/assets/components/alert.tsx +35 -9
- package/dist/assets/components/badge.tsx +49 -20
- package/dist/assets/components/button.tsx +29 -20
- package/dist/assets/components/card.tsx +87 -33
- package/dist/assets/components/checkbox.tsx +36 -12
- package/dist/assets/components/dialog.tsx +73 -30
- package/dist/assets/components/dropdown-menu.tsx +57 -20
- package/dist/assets/components/input.tsx +35 -14
- package/dist/assets/components/pagination.tsx +86 -35
- package/dist/assets/components/popover.tsx +80 -36
- package/dist/assets/components/radio-group.tsx +40 -12
- package/dist/assets/components/select.tsx +62 -26
- package/dist/assets/components/switch.tsx +41 -13
- package/dist/assets/components/tabs.tsx +32 -12
- package/dist/assets/components/tooltip.tsx +34 -5
- package/dist/index.js +470 -115
- package/package.json +1 -1
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { createContext, useContext, useState } from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
5
|
import { cn } from "@/lib/utils";
|
|
5
6
|
|
|
6
7
|
export type TabsTriggerState = "default" | "hover" | "focus" | "active" | "disabled";
|
|
7
8
|
|
|
9
|
+
const tabsTriggerVariants = cva(
|
|
10
|
+
"relative font-medium transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/20",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
size: {
|
|
14
|
+
xs: "px-2.5 py-1 text-[10px] rounded-md",
|
|
15
|
+
sm: "px-3 py-1.5 text-xs rounded-lg",
|
|
16
|
+
md: "px-3.5 py-2 text-sm rounded-lg",
|
|
17
|
+
lg: "px-4 py-2.5 text-sm rounded-xl",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: "sm",
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
8
26
|
// State styles for Storybook/Figma visualization
|
|
9
27
|
const getStateStyles = (state?: TabsTriggerState, isActive?: boolean) => {
|
|
10
28
|
if (!state || state === "default") return "";
|
|
11
29
|
|
|
12
30
|
const stateMap: Record<string, string> = {
|
|
13
31
|
hover: "text-foreground",
|
|
14
|
-
focus: "ring-2 ring-
|
|
15
|
-
active: "text-foreground",
|
|
32
|
+
focus: "ring-2 ring-primary/20",
|
|
33
|
+
active: "text-foreground bg-background shadow-sm",
|
|
16
34
|
disabled: "opacity-50 cursor-not-allowed",
|
|
17
35
|
};
|
|
18
36
|
|
|
@@ -22,6 +40,7 @@ const getStateStyles = (state?: TabsTriggerState, isActive?: boolean) => {
|
|
|
22
40
|
interface TabsContextValue {
|
|
23
41
|
value: string;
|
|
24
42
|
onChange: (value: string) => void;
|
|
43
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
25
44
|
}
|
|
26
45
|
|
|
27
46
|
const TabsContext = createContext<TabsContextValue | null>(null);
|
|
@@ -32,6 +51,8 @@ interface TabsProps {
|
|
|
32
51
|
onValueChange?: (value: string) => void;
|
|
33
52
|
className?: string;
|
|
34
53
|
children: React.ReactNode;
|
|
54
|
+
/** Size variant for tabs */
|
|
55
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
35
56
|
}
|
|
36
57
|
|
|
37
58
|
export function Tabs({
|
|
@@ -40,6 +61,7 @@ export function Tabs({
|
|
|
40
61
|
onValueChange,
|
|
41
62
|
className,
|
|
42
63
|
children,
|
|
64
|
+
size = "sm",
|
|
43
65
|
}: TabsProps) {
|
|
44
66
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
45
67
|
const value = controlledValue ?? internalValue;
|
|
@@ -50,7 +72,7 @@ export function Tabs({
|
|
|
50
72
|
};
|
|
51
73
|
|
|
52
74
|
return (
|
|
53
|
-
<TabsContext.Provider value={{ value, onChange }}>
|
|
75
|
+
<TabsContext.Provider value={{ value, onChange, size }}>
|
|
54
76
|
<div className={cn("w-full", className)}>{children}</div>
|
|
55
77
|
</TabsContext.Provider>
|
|
56
78
|
);
|
|
@@ -66,7 +88,7 @@ export function TabsList({ className, children }: TabsListProps) {
|
|
|
66
88
|
<div data-sonance-name="tabs"
|
|
67
89
|
role="tablist"
|
|
68
90
|
className={cn(
|
|
69
|
-
"inline-flex items-center gap-1
|
|
91
|
+
"inline-flex items-center gap-1 rounded-lg bg-muted/50 p-1",
|
|
70
92
|
className
|
|
71
93
|
)}
|
|
72
94
|
>
|
|
@@ -105,20 +127,16 @@ export function TabsTrigger({
|
|
|
105
127
|
disabled={isDisabled}
|
|
106
128
|
onClick={() => !isDisabled && context.onChange(value)}
|
|
107
129
|
className={cn(
|
|
108
|
-
|
|
109
|
-
"focus:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
|
|
130
|
+
tabsTriggerVariants({ size: context.size }),
|
|
110
131
|
isActive
|
|
111
|
-
? "text-foreground"
|
|
112
|
-
: "text-foreground-muted hover:text-foreground",
|
|
132
|
+
? "text-foreground bg-background shadow-sm"
|
|
133
|
+
: "text-foreground-muted hover:text-foreground hover:bg-background/50",
|
|
113
134
|
isDisabled && "cursor-not-allowed opacity-50",
|
|
114
135
|
getStateStyles(state, isActive),
|
|
115
136
|
className
|
|
116
137
|
)}
|
|
117
138
|
>
|
|
118
139
|
{children}
|
|
119
|
-
{isActive && (
|
|
120
|
-
<span id="tabs-trigger-span" className="absolute bottom-0 left-0 right-0 h-0.5 bg-primary" />
|
|
121
|
-
)}
|
|
122
140
|
</button>
|
|
123
141
|
);
|
|
124
142
|
}
|
|
@@ -138,7 +156,7 @@ export function TabsContent({ value, className, children }: TabsContentProps) {
|
|
|
138
156
|
return (
|
|
139
157
|
<div
|
|
140
158
|
role="tabpanel"
|
|
141
|
-
className={cn("mt-
|
|
159
|
+
className={cn("mt-3 focus:outline-none animate-in fade-in-0 duration-200", className)}
|
|
142
160
|
tabIndex={0}
|
|
143
161
|
>
|
|
144
162
|
{children}
|
|
@@ -146,3 +164,5 @@ export function TabsContent({ value, className, children }: TabsContentProps) {
|
|
|
146
164
|
);
|
|
147
165
|
}
|
|
148
166
|
|
|
167
|
+
export { tabsTriggerVariants };
|
|
168
|
+
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react"
|
|
4
4
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
5
6
|
|
|
6
7
|
import { cn } from "@/lib/utils"
|
|
7
8
|
|
|
@@ -11,15 +12,43 @@ const Tooltip = TooltipPrimitive.Root
|
|
|
11
12
|
|
|
12
13
|
const TooltipTrigger = TooltipPrimitive.Trigger
|
|
13
14
|
|
|
15
|
+
const tooltipContentVariants = cva(
|
|
16
|
+
"z-50 overflow-hidden border shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
17
|
+
{
|
|
18
|
+
variants: {
|
|
19
|
+
size: {
|
|
20
|
+
xs: "px-2 py-1 text-[10px] rounded-md",
|
|
21
|
+
sm: "px-2.5 py-1 text-xs rounded-lg",
|
|
22
|
+
md: "px-3 py-1.5 text-sm rounded-lg",
|
|
23
|
+
lg: "px-3.5 py-2 text-sm rounded-xl",
|
|
24
|
+
},
|
|
25
|
+
tooltipVariant: {
|
|
26
|
+
default: "bg-popover text-popover-foreground border-border",
|
|
27
|
+
glass: "bg-popover/95 text-popover-foreground border-border/50 backdrop-blur-md",
|
|
28
|
+
dark: "bg-foreground text-background border-foreground",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
size: "sm",
|
|
33
|
+
tooltipVariant: "glass",
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
interface TooltipContentProps
|
|
39
|
+
extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>,
|
|
40
|
+
VariantProps<typeof tooltipContentVariants> {}
|
|
41
|
+
|
|
14
42
|
const TooltipContent = React.forwardRef<
|
|
15
43
|
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
16
|
-
|
|
17
|
-
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
18
|
-
<TooltipPrimitive.Content
|
|
44
|
+
TooltipContentProps
|
|
45
|
+
>(({ className, sideOffset = 4, size, tooltipVariant, ...props }, ref) => (
|
|
46
|
+
<TooltipPrimitive.Content
|
|
47
|
+
data-sonance-name="tooltip"
|
|
19
48
|
ref={ref}
|
|
20
49
|
sideOffset={sideOffset}
|
|
21
50
|
className={cn(
|
|
22
|
-
|
|
51
|
+
tooltipContentVariants({ size, tooltipVariant }),
|
|
23
52
|
className
|
|
24
53
|
)}
|
|
25
54
|
{...props}
|
|
@@ -27,4 +56,4 @@ const TooltipContent = React.forwardRef<
|
|
|
27
56
|
))
|
|
28
57
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
|
29
58
|
|
|
30
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
|
59
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, tooltipContentVariants }
|