@music-vine/cadence 0.1.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 +146 -0
- package/dist/components/accordion.d.ts +35 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +95 -0
- package/dist/components/accordion.js.map +7 -0
- package/dist/components/badge.d.ts +14 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +78 -0
- package/dist/components/badge.js.map +7 -0
- package/dist/components/breadcrumb.d.ts +20 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +98 -0
- package/dist/components/breadcrumb.js.map +7 -0
- package/dist/components/button.d.ts +47 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +295 -0
- package/dist/components/button.js.map +7 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +65 -0
- package/dist/components/card.js.map +7 -0
- package/dist/components/carousel-dots.d.ts +9 -0
- package/dist/components/carousel-dots.d.ts.map +1 -0
- package/dist/components/carousel-dots.js +55 -0
- package/dist/components/carousel-dots.js.map +7 -0
- package/dist/components/carousel.d.ts +33 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +217 -0
- package/dist/components/carousel.js.map +7 -0
- package/dist/components/checkbox.d.ts +13 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +57 -0
- package/dist/components/checkbox.js.map +7 -0
- package/dist/components/context-menu.d.ts +28 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +154 -0
- package/dist/components/context-menu.js.map +7 -0
- package/dist/components/dialog.d.ts +20 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +98 -0
- package/dist/components/dialog.js.map +7 -0
- package/dist/components/drawer.d.ts +26 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +133 -0
- package/dist/components/drawer.js.map +7 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +277 -0
- package/dist/components/index.js.map +7 -0
- package/dist/components/input.d.ts +20 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +174 -0
- package/dist/components/input.js.map +7 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +21 -0
- package/dist/components/label.js.map +7 -0
- package/dist/components/popover.d.ts +8 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +38 -0
- package/dist/components/popover.js.map +7 -0
- package/dist/components/price-tag.d.ts +11 -0
- package/dist/components/price-tag.d.ts.map +1 -0
- package/dist/components/price-tag.js +31 -0
- package/dist/components/price-tag.js.map +7 -0
- package/dist/components/radio-group.d.ts +6 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +84 -0
- package/dist/components/radio-group.js.map +7 -0
- package/dist/components/scroll-area.d.ts +15 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +132 -0
- package/dist/components/scroll-area.js.map +7 -0
- package/dist/components/select.d.ts +59 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +210 -0
- package/dist/components/select.js.map +7 -0
- package/dist/components/separator.d.ts +5 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +25 -0
- package/dist/components/separator.js.map +7 -0
- package/dist/components/skeleton.d.ts +10 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +29 -0
- package/dist/components/skeleton.js.map +7 -0
- package/dist/components/slider.d.ts +15 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +95 -0
- package/dist/components/slider.js.map +7 -0
- package/dist/components/stacking-card.d.ts +54 -0
- package/dist/components/stacking-card.d.ts.map +1 -0
- package/dist/components/stacking-card.js +636 -0
- package/dist/components/stacking-card.js.map +7 -0
- package/dist/components/tabs.d.ts +8 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +48 -0
- package/dist/components/tabs.js.map +7 -0
- package/dist/components/textarea.d.ts +11 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +43 -0
- package/dist/components/textarea.js.map +7 -0
- package/dist/components/toast.d.ts +7 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +53 -0
- package/dist/components/toast.js.map +7 -0
- package/dist/components/toggle-button.d.ts +20 -0
- package/dist/components/toggle-button.d.ts.map +1 -0
- package/dist/components/toggle-button.js +56 -0
- package/dist/components/toggle-button.js.map +7 -0
- package/dist/components/typography/heading.d.ts +18 -0
- package/dist/components/typography/heading.d.ts.map +1 -0
- package/dist/components/typography/heading.js +105 -0
- package/dist/components/typography/heading.js.map +7 -0
- package/dist/components/typography/index.d.ts +5 -0
- package/dist/components/typography/index.d.ts.map +1 -0
- package/dist/components/typography/index.js +36 -0
- package/dist/components/typography/index.js.map +7 -0
- package/dist/components/typography/list.d.ts +17 -0
- package/dist/components/typography/list.d.ts.map +1 -0
- package/dist/components/typography/list.js +73 -0
- package/dist/components/typography/list.js.map +7 -0
- package/dist/components/typography/prose.d.ts +5 -0
- package/dist/components/typography/prose.d.ts.map +1 -0
- package/dist/components/typography/prose.js +50 -0
- package/dist/components/typography/prose.js.map +7 -0
- package/dist/components/typography/text.d.ts +11 -0
- package/dist/components/typography/text.d.ts.map +1 -0
- package/dist/components/typography/text.js +38 -0
- package/dist/components/typography/text.js.map +7 -0
- package/dist/icons/custom/boards-indicator.d.ts +7 -0
- package/dist/icons/custom/boards-indicator.d.ts.map +1 -0
- package/dist/icons/custom/boards-indicator.js +70 -0
- package/dist/icons/custom/boards-indicator.js.map +7 -0
- package/dist/icons/custom/download-history.d.ts +6 -0
- package/dist/icons/custom/download-history.d.ts.map +1 -0
- package/dist/icons/custom/download-history.js +19 -0
- package/dist/icons/custom/download-history.js.map +7 -0
- package/dist/icons/custom/exclamation-mark-in-octagon.d.ts +6 -0
- package/dist/icons/custom/exclamation-mark-in-octagon.d.ts.map +1 -0
- package/dist/icons/custom/exclamation-mark-in-octagon.js +57 -0
- package/dist/icons/custom/exclamation-mark-in-octagon.js.map +7 -0
- package/dist/icons/custom/pin.d.ts +6 -0
- package/dist/icons/custom/pin.d.ts.map +1 -0
- package/dist/icons/custom/pin.js +28 -0
- package/dist/icons/custom/pin.js.map +7 -0
- package/dist/icons/custom/premium-star.d.ts +10 -0
- package/dist/icons/custom/premium-star.d.ts.map +1 -0
- package/dist/icons/custom/premium-star.js +191 -0
- package/dist/icons/custom/premium-star.js.map +7 -0
- package/dist/icons/custom/social/discord.d.ts +6 -0
- package/dist/icons/custom/social/discord.d.ts.map +1 -0
- package/dist/icons/custom/social/discord.js +27 -0
- package/dist/icons/custom/social/discord.js.map +7 -0
- package/dist/icons/custom/social/index.d.ts +4 -0
- package/dist/icons/custom/social/index.d.ts.map +1 -0
- package/dist/icons/custom/social/index.js +4 -0
- package/dist/icons/custom/social/index.js.map +7 -0
- package/dist/icons/custom/social/tiktok.d.ts +6 -0
- package/dist/icons/custom/social/tiktok.d.ts.map +1 -0
- package/dist/icons/custom/social/tiktok.js +27 -0
- package/dist/icons/custom/social/tiktok.js.map +7 -0
- package/dist/icons/custom/social/twitter-x.d.ts +6 -0
- package/dist/icons/custom/social/twitter-x.d.ts.map +1 -0
- package/dist/icons/custom/social/twitter-x.js +29 -0
- package/dist/icons/custom/social/twitter-x.js.map +7 -0
- package/dist/icons/custom/tick-in-circle.d.ts +7 -0
- package/dist/icons/custom/tick-in-circle.d.ts.map +1 -0
- package/dist/icons/custom/tick-in-circle.js +32 -0
- package/dist/icons/custom/tick-in-circle.js.map +7 -0
- package/dist/icons/custom/tick-small.d.ts +6 -0
- package/dist/icons/custom/tick-small.d.ts.map +1 -0
- package/dist/icons/custom/tick-small.js +16 -0
- package/dist/icons/custom/tick-small.js.map +7 -0
- package/dist/icons/custom/tick.d.ts +3 -0
- package/dist/icons/custom/tick.d.ts.map +1 -0
- package/dist/icons/custom/tick.js +31 -0
- package/dist/icons/custom/tick.js.map +7 -0
- package/dist/icons/custom/uppbeat-credit.d.ts +4 -0
- package/dist/icons/custom/uppbeat-credit.d.ts.map +1 -0
- package/dist/icons/custom/uppbeat-credit.js +55 -0
- package/dist/icons/custom/uppbeat-credit.js.map +7 -0
- package/dist/icons/index.d.ts +20 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +15 -0
- package/dist/icons/index.js.map +7 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +7 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +7 -0
- package/dist/styles/index.css +3 -0
- package/dist/styles/storybook.css +14 -0
- package/package.json +107 -0
- package/tailwind.config.ts +299 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { Loader } from "lucide-react";
|
|
4
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
const sizeClasses = {
|
|
8
|
+
default: "h-8 px-4 py-2 leading-8",
|
|
9
|
+
xs: "h-5 gap-1.5 px-2 leading-5",
|
|
10
|
+
sm: "h-7 px-3 py-2 leading-6",
|
|
11
|
+
lg: "h-10 px-4 py-2 leading-8",
|
|
12
|
+
xl: "h-12 px-8 py-3 leading-10",
|
|
13
|
+
icon: "h-8 w-8 leading-8"
|
|
14
|
+
};
|
|
15
|
+
const fontSizeClasses = {
|
|
16
|
+
xxs: "text-xxs",
|
|
17
|
+
xs: "text-xs",
|
|
18
|
+
sm: "text-sm",
|
|
19
|
+
base: "text-base",
|
|
20
|
+
lg: "text-lg",
|
|
21
|
+
xl: "text-xl"
|
|
22
|
+
};
|
|
23
|
+
const defaultFontSizeForSize = {
|
|
24
|
+
xs: "xs",
|
|
25
|
+
sm: "xs",
|
|
26
|
+
default: "base",
|
|
27
|
+
lg: "base",
|
|
28
|
+
icon: "base",
|
|
29
|
+
xl: "lg"
|
|
30
|
+
};
|
|
31
|
+
const buttonVariants = cva(
|
|
32
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap font-normal font-sans text-base transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-pink-500 focus-visible:ring-offset-2 enabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-gray-950",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
36
|
+
// NEW BRANDING VARIANTS
|
|
37
|
+
subtle: "border-1 border-gray-150 border-solid bg-white text-gray-950 hover:bg-gray-50 active:border-pink-600 active:bg-pink-50 active:text-pink-600 disabled:bg-gray-50 active:disabled:border-gray-150 active:disabled:bg-gray-50 active:disabled:text-gray-950 dark:border-gray-800 dark:bg-gray-950 dark:text-white dark:disabled:border-gray-900 dark:disabled:bg-gray-950 dark:disabled:text-white dark:active:border-white dark:active:text-white dark:disabled:active:border-gray-900 dark:disabled:active:bg-gray-950 dark:disabled:active:text-white dark:hover:bg-gray-900",
|
|
38
|
+
pink: "border-1 border-pink-500 border-solid bg-pink-500 font-semibold text-white hover:border-pink-600 hover:bg-pink-600 disabled:hover:bg-pink-600 dark:hover:border-pink-600 dark:hover:bg-pink-600",
|
|
39
|
+
pinkSecondary: "border-1 border-pink-50 border-solid bg-pink-50 font-semibold text-pink-600 hover:border-pink-100 hover:bg-pink-100 disabled:hover:bg-pink-100 dark:border-gray-900 dark:bg-gray-900 dark:text-white hover:dark:border-gray-800 hover:dark:bg-gray-800 dark:disabled:hover:border-gray-900 dark:disabled:hover:bg-gray-900",
|
|
40
|
+
bold: "border-gray-950 bg-gray-950 font-semibold text-white dark:border-white dark:bg-white dark:text-gray-950",
|
|
41
|
+
light: "border-gray-150 bg-gray-100 font-semibold text-gray-950 hover:border-gray-200 hover:bg-gray-200 disabled:hover:border-gray-150 disabled:hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-800 dark:text-white dark:hover:border-gray-700 dark:hover:bg-gray-700 dark:hover:disabled:border-gray-800 dark:hover:disabled:bg-gray-800",
|
|
42
|
+
transparent: "!border-transparent bg-transparent font-semibold text-gray-950 hover:border-gray-50 hover:bg-gray-50 disabled:hover:border-transparent disabled:hover:bg-transparent dark:text-white dark:hover:border-gray-900 dark:hover:bg-gray-900",
|
|
43
|
+
contrast: "h border-white bg-white font-semibold text-gray-950 hover:bg-gray-50 hover:disabled:border-white hover:disabled:bg-white",
|
|
44
|
+
success: "border-green-500 bg-green-500 font-semibold text-white hover:border-green-600 hover:bg-green-600 disabled:hover:border-green-500 disabled:hover:bg-green-500 dark:border-green-400 dark:bg-green-400 dark:hover:border-green-300 dark:hover:bg-green-300 dark:disabled:hover:border-green-400 dark:disabled:hover:bg-green-400",
|
|
45
|
+
error: "border-red-600 bg-red-600 font-semibold text-white hover:bg-red-700 disabled:hover:border-red-700 disabled:hover:bg-red-700 dark:border-red-500 dark:bg-red-500 dark:hover:border-red-600 dark:hover:bg-red-600 dark:disabled:hover:border-red-600 dark:disabled:hover:bg-red-600"
|
|
46
|
+
},
|
|
47
|
+
size: sizeClasses,
|
|
48
|
+
fontSize: {
|
|
49
|
+
...fontSizeClasses,
|
|
50
|
+
null: ""
|
|
51
|
+
// No font size class, relies on compound variants
|
|
52
|
+
},
|
|
53
|
+
borderRadius: {
|
|
54
|
+
default: "rounded-lg",
|
|
55
|
+
sm: "rounded",
|
|
56
|
+
full: "rounded-full",
|
|
57
|
+
rounded: "rounded-[100px]"
|
|
58
|
+
},
|
|
59
|
+
border: {
|
|
60
|
+
true: "border border-solid",
|
|
61
|
+
false: "border-none"
|
|
62
|
+
},
|
|
63
|
+
noFeedback: {
|
|
64
|
+
true: "",
|
|
65
|
+
false: "transition-scale active:scale-[0.97] disabled:scale-100"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
compoundVariants: [
|
|
69
|
+
// Size + BorderRadius compounds
|
|
70
|
+
{
|
|
71
|
+
size: "sm",
|
|
72
|
+
borderRadius: "default",
|
|
73
|
+
className: "rounded-lg"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
size: "xs",
|
|
77
|
+
borderRadius: "default",
|
|
78
|
+
className: "rounded-md"
|
|
79
|
+
},
|
|
80
|
+
// Variant + Border compounds
|
|
81
|
+
{
|
|
82
|
+
variant: "transparent",
|
|
83
|
+
border: true,
|
|
84
|
+
className: "border-gray-200 dark:border-gray-800"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
variant: "success",
|
|
88
|
+
border: true,
|
|
89
|
+
className: "border-green-dark"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
variant: "contrast",
|
|
93
|
+
border: true,
|
|
94
|
+
className: "border-white"
|
|
95
|
+
},
|
|
96
|
+
// Size + fontSize compounds (default font size for each size when no explicit fontSize)
|
|
97
|
+
{ size: "xs", fontSize: null, className: "text-xs" },
|
|
98
|
+
{ size: "sm", fontSize: null, className: "text-xs" },
|
|
99
|
+
{ size: "default", fontSize: null, className: "text-base" },
|
|
100
|
+
{ size: "lg", fontSize: null, className: "text-base" },
|
|
101
|
+
{ size: "icon", fontSize: null, className: "text-base" },
|
|
102
|
+
{ size: "xl", fontSize: null, className: "text-lg" }
|
|
103
|
+
],
|
|
104
|
+
defaultVariants: {
|
|
105
|
+
variant: "bold",
|
|
106
|
+
size: "default",
|
|
107
|
+
fontSize: null,
|
|
108
|
+
borderRadius: "default",
|
|
109
|
+
border: false,
|
|
110
|
+
noFeedback: false
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
const getSizeClasses = (sizeKey) => sizeClasses[sizeKey] || "";
|
|
115
|
+
const getFontSizeClasses = (fontSizeKey) => fontSizeClasses[fontSizeKey] || "";
|
|
116
|
+
function generateResponsiveSizeClasses(size) {
|
|
117
|
+
if (!size || typeof size === "string") {
|
|
118
|
+
return "";
|
|
119
|
+
}
|
|
120
|
+
const classes = [];
|
|
121
|
+
const breakpoints = [
|
|
122
|
+
{ prefix: "xxs", value: size.xxs },
|
|
123
|
+
{ prefix: "xs", value: size.xs },
|
|
124
|
+
{ prefix: "sm", value: size.sm },
|
|
125
|
+
{ prefix: "md", value: size.md },
|
|
126
|
+
{ prefix: "lg", value: size.lg },
|
|
127
|
+
{ prefix: "xl", value: size.xl },
|
|
128
|
+
{ prefix: "2xl", value: size["2xl"] }
|
|
129
|
+
];
|
|
130
|
+
for (const breakpoint of breakpoints) {
|
|
131
|
+
if (breakpoint.value) {
|
|
132
|
+
const breakpointSizeClasses = getSizeClasses(breakpoint.value);
|
|
133
|
+
const responsiveClasses = breakpointSizeClasses.split(" ").filter((cls) => cls.trim() !== "").map((cls) => `${breakpoint.prefix}:${cls}`).join(" ");
|
|
134
|
+
if (responsiveClasses) {
|
|
135
|
+
classes.push(responsiveClasses);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return classes.join(" ");
|
|
140
|
+
}
|
|
141
|
+
function generateResponsiveFontSizeClasses(fontSize) {
|
|
142
|
+
if (!fontSize || typeof fontSize === "string") {
|
|
143
|
+
return "";
|
|
144
|
+
}
|
|
145
|
+
const classes = [];
|
|
146
|
+
const breakpoints = [
|
|
147
|
+
{ prefix: "xxs", value: fontSize.xxs },
|
|
148
|
+
{ prefix: "xs", value: fontSize.xs },
|
|
149
|
+
{ prefix: "sm", value: fontSize.sm },
|
|
150
|
+
{ prefix: "md", value: fontSize.md },
|
|
151
|
+
{ prefix: "lg", value: fontSize.lg },
|
|
152
|
+
{ prefix: "xl", value: fontSize.xl },
|
|
153
|
+
{ prefix: "2xl", value: fontSize["2xl"] }
|
|
154
|
+
];
|
|
155
|
+
for (const breakpoint of breakpoints) {
|
|
156
|
+
if (breakpoint.value) {
|
|
157
|
+
const breakpointFontSizeClasses = getFontSizeClasses(breakpoint.value);
|
|
158
|
+
const responsiveClasses = breakpointFontSizeClasses.split(" ").filter((cls) => cls.trim() !== "").map((cls) => `${breakpoint.prefix}:${cls}`).join(" ");
|
|
159
|
+
if (responsiveClasses) {
|
|
160
|
+
classes.push(responsiveClasses);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return classes.join(" ");
|
|
165
|
+
}
|
|
166
|
+
const Button = forwardRef(
|
|
167
|
+
({
|
|
168
|
+
className,
|
|
169
|
+
variant,
|
|
170
|
+
size,
|
|
171
|
+
borderRadius,
|
|
172
|
+
border,
|
|
173
|
+
noFeedback,
|
|
174
|
+
asChild = false,
|
|
175
|
+
type,
|
|
176
|
+
children,
|
|
177
|
+
fontSize,
|
|
178
|
+
icon = false,
|
|
179
|
+
...props
|
|
180
|
+
}, ref) => {
|
|
181
|
+
const Comp = asChild ? SlotPrimitive.Slot : "button";
|
|
182
|
+
const buttonType = asChild ? void 0 : type ?? "button";
|
|
183
|
+
const responsiveClasses = typeof size === "object" ? generateResponsiveSizeClasses(size) : void 0;
|
|
184
|
+
let responsiveFontSizeClasses;
|
|
185
|
+
if (typeof fontSize === "object") {
|
|
186
|
+
responsiveFontSizeClasses = generateResponsiveFontSizeClasses(fontSize);
|
|
187
|
+
} else if (typeof size === "object" && fontSize === void 0) {
|
|
188
|
+
const autoFontSize = {
|
|
189
|
+
default: defaultFontSizeForSize[size.default] || "base"
|
|
190
|
+
};
|
|
191
|
+
const breakpointMappings = [
|
|
192
|
+
{ sizeKey: "xxs", fontKey: "xxs" },
|
|
193
|
+
{ sizeKey: "xs", fontKey: "xs" },
|
|
194
|
+
{ sizeKey: "sm", fontKey: "sm" },
|
|
195
|
+
{ sizeKey: "md", fontKey: "md" },
|
|
196
|
+
{ sizeKey: "lg", fontKey: "lg" },
|
|
197
|
+
{ sizeKey: "xl", fontKey: "xl" },
|
|
198
|
+
{ sizeKey: "2xl", fontKey: "2xl" }
|
|
199
|
+
];
|
|
200
|
+
for (const { sizeKey, fontKey } of breakpointMappings) {
|
|
201
|
+
const sizeValue = size[sizeKey];
|
|
202
|
+
if (sizeValue && sizeValue in defaultFontSizeForSize) {
|
|
203
|
+
autoFontSize[fontKey] = defaultFontSizeForSize[sizeValue];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
responsiveFontSizeClasses = generateResponsiveFontSizeClasses(autoFontSize);
|
|
207
|
+
}
|
|
208
|
+
const cvaSize = typeof size === "object" ? size.default : size;
|
|
209
|
+
let cvaFontSize = null;
|
|
210
|
+
if (fontSize) {
|
|
211
|
+
if (typeof fontSize === "object") {
|
|
212
|
+
cvaFontSize = fontSize.default || null;
|
|
213
|
+
} else {
|
|
214
|
+
cvaFontSize = fontSize;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
let iconClasses = "";
|
|
218
|
+
if (icon) {
|
|
219
|
+
iconClasses = "aspect-square p-0";
|
|
220
|
+
if (typeof size === "object") {
|
|
221
|
+
const iconResponsiveClasses = [];
|
|
222
|
+
const breakpointMappings = [
|
|
223
|
+
{ sizeKey: "xxs", prefix: "xxs" },
|
|
224
|
+
{ sizeKey: "xs", prefix: "xs" },
|
|
225
|
+
{ sizeKey: "sm", prefix: "sm" },
|
|
226
|
+
{ sizeKey: "md", prefix: "md" },
|
|
227
|
+
{ sizeKey: "lg", prefix: "lg" },
|
|
228
|
+
{ sizeKey: "xl", prefix: "xl" },
|
|
229
|
+
{ sizeKey: "2xl", prefix: "2xl" }
|
|
230
|
+
];
|
|
231
|
+
for (const { sizeKey, prefix } of breakpointMappings) {
|
|
232
|
+
const sizeValue = size[sizeKey];
|
|
233
|
+
if (sizeValue) {
|
|
234
|
+
iconResponsiveClasses.push(`${prefix}:p-0`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (iconResponsiveClasses.length > 0) {
|
|
238
|
+
iconClasses += ` ${iconResponsiveClasses.join(" ")}`;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return /* @__PURE__ */ jsx(
|
|
243
|
+
Comp,
|
|
244
|
+
{
|
|
245
|
+
className: cn(
|
|
246
|
+
buttonVariants({
|
|
247
|
+
variant,
|
|
248
|
+
size: cvaSize,
|
|
249
|
+
fontSize: cvaFontSize,
|
|
250
|
+
borderRadius,
|
|
251
|
+
border,
|
|
252
|
+
noFeedback
|
|
253
|
+
}),
|
|
254
|
+
responsiveClasses,
|
|
255
|
+
responsiveFontSizeClasses,
|
|
256
|
+
iconClasses,
|
|
257
|
+
className
|
|
258
|
+
),
|
|
259
|
+
ref,
|
|
260
|
+
type: buttonType,
|
|
261
|
+
...props,
|
|
262
|
+
children
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
Button.displayName = "Button";
|
|
268
|
+
const loadingVariants = cva("hidden w-4 text-inherit", {
|
|
269
|
+
variants: {
|
|
270
|
+
size: {
|
|
271
|
+
default: "w-4",
|
|
272
|
+
lg: "w-5",
|
|
273
|
+
sm: "w-3",
|
|
274
|
+
xs: "w-3",
|
|
275
|
+
icon: "w-4",
|
|
276
|
+
xl: "w-5"
|
|
277
|
+
},
|
|
278
|
+
visible: {
|
|
279
|
+
true: "block",
|
|
280
|
+
false: "hidden"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
defaultVariants: {
|
|
284
|
+
size: "default",
|
|
285
|
+
visible: false
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
const Loading = ({ size, visible }) => /* @__PURE__ */ jsx(Loader, { className: cn(loadingVariants({ size, visible })) });
|
|
289
|
+
export {
|
|
290
|
+
Button,
|
|
291
|
+
Loading,
|
|
292
|
+
buttonVariants,
|
|
293
|
+
loadingVariants
|
|
294
|
+
};
|
|
295
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/button.tsx"],
|
|
4
|
+
"sourcesContent": ["import { cva, type VariantProps } from \"class-variance-authority\";\nimport { Loader } from \"lucide-react\";\nimport { Slot as SlotPrimitive } from \"radix-ui\";\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\n// Define size classes once as a single source of truth (including leading but not font sizes)\nconst sizeClasses = {\n default: \"h-8 px-4 py-2 leading-8\",\n xs: \"h-5 gap-1.5 px-2 leading-5\",\n sm: \"h-7 px-3 py-2 leading-6\",\n lg: \"h-10 px-4 py-2 leading-8\",\n xl: \"h-12 px-8 py-3 leading-10\",\n icon: \"h-8 w-8 leading-8\",\n} as const;\n\nconst fontSizeClasses = {\n xxs: \"text-xxs\",\n xs: \"text-xs\",\n sm: \"text-sm\",\n base: \"text-base\",\n lg: \"text-lg\",\n xl: \"text-xl\",\n} as const;\n\n// Type definitions for responsive sizes\ntype ButtonSize = \"default\" | \"xs\" | \"sm\" | \"lg\" | \"icon\" | \"xl\";\n\ntype ButtonFontSize = \"xxs\" | \"xs\" | \"sm\" | \"base\" | \"lg\" | \"xl\" | null;\n\n// Default font size mapping based on button size (excludes null)\nconst defaultFontSizeForSize: Record<\n ButtonSize,\n Exclude<ButtonFontSize, null>\n> = {\n xs: \"xs\",\n sm: \"xs\",\n default: \"base\",\n lg: \"base\",\n icon: \"base\",\n xl: \"lg\",\n};\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap font-normal font-sans text-base transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-pink-500 focus-visible:ring-offset-2 enabled:cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 dark:focus-visible:ring-offset-gray-950\",\n {\n variants: {\n variant: {\n // NEW BRANDING VARIANTS\n subtle:\n \"border-1 border-gray-150 border-solid bg-white text-gray-950 hover:bg-gray-50 active:border-pink-600 active:bg-pink-50 active:text-pink-600 disabled:bg-gray-50 active:disabled:border-gray-150 active:disabled:bg-gray-50 active:disabled:text-gray-950 dark:border-gray-800 dark:bg-gray-950 dark:text-white dark:disabled:border-gray-900 dark:disabled:bg-gray-950 dark:disabled:text-white dark:active:border-white dark:active:text-white dark:disabled:active:border-gray-900 dark:disabled:active:bg-gray-950 dark:disabled:active:text-white dark:hover:bg-gray-900\",\n pink: \"border-1 border-pink-500 border-solid bg-pink-500 font-semibold text-white hover:border-pink-600 hover:bg-pink-600 disabled:hover:bg-pink-600 dark:hover:border-pink-600 dark:hover:bg-pink-600\",\n pinkSecondary:\n \"border-1 border-pink-50 border-solid bg-pink-50 font-semibold text-pink-600 hover:border-pink-100 hover:bg-pink-100 disabled:hover:bg-pink-100 dark:border-gray-900 dark:bg-gray-900 dark:text-white hover:dark:border-gray-800 hover:dark:bg-gray-800 dark:disabled:hover:border-gray-900 dark:disabled:hover:bg-gray-900\",\n bold: \"border-gray-950 bg-gray-950 font-semibold text-white dark:border-white dark:bg-white dark:text-gray-950\",\n light:\n \"border-gray-150 bg-gray-100 font-semibold text-gray-950 hover:border-gray-200 hover:bg-gray-200 disabled:hover:border-gray-150 disabled:hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-800 dark:text-white dark:hover:border-gray-700 dark:hover:bg-gray-700 dark:hover:disabled:border-gray-800 dark:hover:disabled:bg-gray-800\",\n transparent:\n \"!border-transparent bg-transparent font-semibold text-gray-950 hover:border-gray-50 hover:bg-gray-50 disabled:hover:border-transparent disabled:hover:bg-transparent dark:text-white dark:hover:border-gray-900 dark:hover:bg-gray-900\",\n contrast:\n \"h border-white bg-white font-semibold text-gray-950 hover:bg-gray-50 hover:disabled:border-white hover:disabled:bg-white\",\n success:\n \"border-green-500 bg-green-500 font-semibold text-white hover:border-green-600 hover:bg-green-600 disabled:hover:border-green-500 disabled:hover:bg-green-500 dark:border-green-400 dark:bg-green-400 dark:hover:border-green-300 dark:hover:bg-green-300 dark:disabled:hover:border-green-400 dark:disabled:hover:bg-green-400\",\n error:\n \"border-red-600 bg-red-600 font-semibold text-white hover:bg-red-700 disabled:hover:border-red-700 disabled:hover:bg-red-700 dark:border-red-500 dark:bg-red-500 dark:hover:border-red-600 dark:hover:bg-red-600 dark:disabled:hover:border-red-600 dark:disabled:hover:bg-red-600\",\n },\n\n size: sizeClasses,\n fontSize: {\n ...fontSizeClasses,\n null: \"\", // No font size class, relies on compound variants\n },\n borderRadius: {\n default: \"rounded-lg\",\n sm: \"rounded\",\n full: \"rounded-full\",\n rounded: \"rounded-[100px]\",\n },\n border: {\n true: \"border border-solid\",\n false: \"border-none\",\n },\n noFeedback: {\n true: \"\",\n false: \"transition-scale active:scale-[0.97] disabled:scale-100\",\n },\n },\n compoundVariants: [\n // Size + BorderRadius compounds\n {\n size: \"sm\",\n borderRadius: \"default\",\n className: \"rounded-lg\",\n },\n {\n size: \"xs\",\n borderRadius: \"default\",\n className: \"rounded-md\",\n },\n\n // Variant + Border compounds\n {\n variant: \"transparent\",\n border: true,\n className: \"border-gray-200 dark:border-gray-800\",\n },\n {\n variant: \"success\",\n border: true,\n className: \"border-green-dark\",\n },\n {\n variant: \"contrast\",\n border: true,\n className: \"border-white\",\n },\n // Size + fontSize compounds (default font size for each size when no explicit fontSize)\n { size: \"xs\", fontSize: null, className: \"text-xs\" },\n { size: \"sm\", fontSize: null, className: \"text-xs\" },\n { size: \"default\", fontSize: null, className: \"text-base\" },\n { size: \"lg\", fontSize: null, className: \"text-base\" },\n { size: \"icon\", fontSize: null, className: \"text-base\" },\n { size: \"xl\", fontSize: null, className: \"text-lg\" },\n ],\n defaultVariants: {\n variant: \"bold\",\n size: \"default\",\n fontSize: null,\n borderRadius: \"default\",\n border: false,\n noFeedback: false,\n },\n }\n);\n\ntype ResponsiveButtonSize =\n | ButtonSize\n | {\n default: ButtonSize;\n xxs?: ButtonSize;\n xs?: ButtonSize;\n sm?: ButtonSize;\n md?: ButtonSize;\n lg?: ButtonSize;\n xl?: ButtonSize;\n \"2xl\"?: ButtonSize;\n };\n\ntype ResponsiveButtonFontSize =\n | Exclude<ButtonFontSize, null>\n | {\n default?: Exclude<ButtonFontSize, null>;\n xxs?: Exclude<ButtonFontSize, null>;\n xs?: Exclude<ButtonFontSize, null>;\n sm?: Exclude<ButtonFontSize, null>;\n md?: Exclude<ButtonFontSize, null>;\n lg?: Exclude<ButtonFontSize, null>;\n xl?: Exclude<ButtonFontSize, null>;\n \"2xl\"?: Exclude<ButtonFontSize, null>;\n };\n\nconst getSizeClasses = (sizeKey: ButtonSize): string =>\n sizeClasses[sizeKey] || \"\";\n\nconst getFontSizeClasses = (\n fontSizeKey: Exclude<ButtonFontSize, null>\n): string => fontSizeClasses[fontSizeKey] || \"\";\n\n// Function to generate responsive Tailwind classes\nfunction generateResponsiveSizeClasses(size?: ResponsiveButtonSize): string {\n if (!size || typeof size === \"string\") {\n return \"\";\n }\n\n const classes: string[] = [];\n\n // Add responsive classes for each breakpoint\n const breakpoints = [\n { prefix: \"xxs\", value: size.xxs },\n { prefix: \"xs\", value: size.xs },\n { prefix: \"sm\", value: size.sm },\n { prefix: \"md\", value: size.md },\n { prefix: \"lg\", value: size.lg },\n { prefix: \"xl\", value: size.xl },\n { prefix: \"2xl\", value: size[\"2xl\"] },\n ];\n\n for (const breakpoint of breakpoints) {\n if (breakpoint.value) {\n const breakpointSizeClasses = getSizeClasses(breakpoint.value);\n const responsiveClasses = breakpointSizeClasses\n .split(\" \")\n .filter((cls) => cls.trim() !== \"\")\n .map((cls) => `${breakpoint.prefix}:${cls}`)\n .join(\" \");\n if (responsiveClasses) {\n classes.push(responsiveClasses);\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nfunction generateResponsiveFontSizeClasses(\n fontSize?: ResponsiveButtonFontSize\n): string {\n if (!fontSize || typeof fontSize === \"string\") {\n return \"\";\n }\n\n const classes: string[] = [];\n\n // Add responsive classes for each breakpoint\n const breakpoints = [\n { prefix: \"xxs\", value: fontSize.xxs },\n { prefix: \"xs\", value: fontSize.xs },\n { prefix: \"sm\", value: fontSize.sm },\n { prefix: \"md\", value: fontSize.md },\n { prefix: \"lg\", value: fontSize.lg },\n { prefix: \"xl\", value: fontSize.xl },\n { prefix: \"2xl\", value: fontSize[\"2xl\"] },\n ];\n\n for (const breakpoint of breakpoints) {\n if (breakpoint.value) {\n const breakpointFontSizeClasses = getFontSizeClasses(breakpoint.value);\n const responsiveClasses = breakpointFontSizeClasses\n .split(\" \")\n .filter((cls) => cls.trim() !== \"\")\n .map((cls) => `${breakpoint.prefix}:${cls}`)\n .join(\" \");\n if (responsiveClasses) {\n classes.push(responsiveClasses);\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n Omit<VariantProps<typeof buttonVariants>, \"size\" | \"fontSize\"> {\n asChild?: boolean;\n size?: ResponsiveButtonSize;\n fontSize?: ResponsiveButtonFontSize;\n icon?: boolean;\n}\n\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n size,\n borderRadius,\n border,\n noFeedback,\n asChild = false,\n type,\n children,\n fontSize,\n icon = false,\n ...props\n },\n ref\n ) => {\n const Comp = asChild ? SlotPrimitive.Slot : \"button\";\n const buttonType = asChild ? undefined : (type ?? \"button\");\n\n // Generate responsive classes or use the cva size variant\n const responsiveClasses =\n typeof size === \"object\"\n ? generateResponsiveSizeClasses(size)\n : undefined;\n\n // Generate responsive font size classes\n let responsiveFontSizeClasses: string | undefined;\n if (typeof fontSize === \"object\") {\n // User provided explicit responsive font sizes\n responsiveFontSizeClasses = generateResponsiveFontSizeClasses(fontSize);\n } else if (typeof size === \"object\" && fontSize === undefined) {\n // Auto-generate responsive font sizes based on responsive sizes\n const autoFontSize: ResponsiveButtonFontSize = {\n default: defaultFontSizeForSize[size.default] || \"base\",\n };\n\n // Map over the size object to create the auto font size object\n const breakpointMappings = [\n { sizeKey: \"xxs\" as const, fontKey: \"xxs\" as const },\n { sizeKey: \"xs\" as const, fontKey: \"xs\" as const },\n { sizeKey: \"sm\" as const, fontKey: \"sm\" as const },\n { sizeKey: \"md\" as const, fontKey: \"md\" as const },\n { sizeKey: \"lg\" as const, fontKey: \"lg\" as const },\n { sizeKey: \"xl\" as const, fontKey: \"xl\" as const },\n { sizeKey: \"2xl\" as const, fontKey: \"2xl\" as const },\n ];\n\n for (const { sizeKey, fontKey } of breakpointMappings) {\n const sizeValue = (size as Record<string, ButtonSize>)[sizeKey];\n if (sizeValue && sizeValue in defaultFontSizeForSize) {\n (autoFontSize as Record<string, Exclude<ButtonFontSize, null>>)[\n fontKey\n ] = defaultFontSizeForSize[sizeValue as ButtonSize];\n }\n }\n\n responsiveFontSizeClasses =\n generateResponsiveFontSizeClasses(autoFontSize);\n }\n\n // For object sizes, use the default size in the cva\n const cvaSize = typeof size === \"object\" ? size.default : size;\n\n // Determine font size for cva\n let cvaFontSize: ButtonFontSize = null;\n if (fontSize) {\n if (typeof fontSize === \"object\") {\n // If fontSize object has no default, let compound variants handle it (null)\n cvaFontSize = fontSize.default || null;\n } else {\n cvaFontSize = fontSize;\n }\n } // null triggers compound variants for default font sizes\n\n // Generate icon classes if icon prop is true\n let iconClasses = \"\";\n if (icon) {\n iconClasses = \"aspect-square p-0\";\n\n // If using responsive sizes, we need to override padding at each breakpoint\n if (typeof size === \"object\") {\n const iconResponsiveClasses: string[] = [];\n\n const breakpointMappings = [\n { sizeKey: \"xxs\" as const, prefix: \"xxs\" },\n { sizeKey: \"xs\" as const, prefix: \"xs\" },\n { sizeKey: \"sm\" as const, prefix: \"sm\" },\n { sizeKey: \"md\" as const, prefix: \"md\" },\n { sizeKey: \"lg\" as const, prefix: \"lg\" },\n { sizeKey: \"xl\" as const, prefix: \"xl\" },\n { sizeKey: \"2xl\" as const, prefix: \"2xl\" },\n ];\n\n for (const { sizeKey, prefix } of breakpointMappings) {\n const sizeValue = (size as Record<string, ButtonSize>)[sizeKey];\n if (sizeValue) {\n iconResponsiveClasses.push(`${prefix}:p-0`);\n }\n }\n\n if (iconResponsiveClasses.length > 0) {\n iconClasses += ` ${iconResponsiveClasses.join(\" \")}`;\n }\n }\n }\n\n return (\n <Comp\n className={cn(\n buttonVariants({\n variant,\n size: cvaSize,\n fontSize: cvaFontSize,\n borderRadius,\n border,\n noFeedback,\n }),\n responsiveClasses,\n responsiveFontSizeClasses,\n iconClasses,\n className\n )}\n ref={ref}\n type={buttonType}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n);\n\nButton.displayName = \"Button\";\n\nconst loadingVariants = cva(\"hidden w-4 text-inherit\", {\n variants: {\n size: {\n default: \"w-4\",\n lg: \"w-5\",\n sm: \"w-3\",\n xs: \"w-3\",\n icon: \"w-4\",\n xl: \"w-5\",\n },\n visible: {\n true: \"block\",\n false: \"hidden\",\n },\n },\n defaultVariants: {\n size: \"default\",\n visible: false,\n },\n});\n\nconst Loading = ({ size, visible }: VariantProps<typeof loadingVariants>) => (\n <Loader className={cn(loadingVariants({ size, visible }))} />\n);\n\nexport { Button, buttonVariants, Loading, loadingVariants };\nexport type {\n ResponsiveButtonSize,\n ButtonSize,\n ResponsiveButtonFontSize,\n ButtonFontSize,\n};\n"],
|
|
5
|
+
"mappings": "AAwWM;AAxWN,SAAS,WAA8B;AACvC,SAAS,cAAc;AACvB,SAAS,QAAQ,qBAAqB;AACtC,SAAoC,kBAAkB;AAEtD,SAAS,UAAU;AAGnB,MAAM,cAAc;AAAA,EAClB,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,kBAAkB;AAAA,EACtB,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AACN;AAQA,MAAM,yBAGF;AAAA,EACF,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,SAAS;AAAA,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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
|
|
9
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,IAAI,6GAYR,CAAC;AAIH,QAAA,MAAM,UAAU,6GASd,CAAC;AAIH,QAAA,MAAM,SAAS,6GAYb,CAAC;AAIH,QAAA,MAAM,eAAe,6GASnB,CAAC;AAIH,QAAA,MAAM,WAAW,6GAKf,CAAC;AAIH,QAAA,MAAM,UAAU,6GASd,CAAC;AAIH,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,WAAW,GACZ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: cn(
|
|
8
|
+
"rounded-lg border border-gray-150 border-solid bg-white text-gray-950 shadow-card dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50",
|
|
9
|
+
className
|
|
10
|
+
),
|
|
11
|
+
ref,
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
));
|
|
15
|
+
Card.displayName = "Card";
|
|
16
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
20
|
+
ref,
|
|
21
|
+
...props
|
|
22
|
+
}
|
|
23
|
+
));
|
|
24
|
+
CardHeader.displayName = "CardHeader";
|
|
25
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: cn(
|
|
29
|
+
"font-semibold text-2xl leading-none tracking-tight",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
ref,
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
));
|
|
36
|
+
CardTitle.displayName = "CardTitle";
|
|
37
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: cn("text-gray-600 text-sm dark:text-gray-400", className),
|
|
41
|
+
ref,
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
));
|
|
45
|
+
CardDescription.displayName = "CardDescription";
|
|
46
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: cn("p-6 pt-0", className), ref, ...props }));
|
|
47
|
+
CardContent.displayName = "CardContent";
|
|
48
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
52
|
+
ref,
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
));
|
|
56
|
+
CardFooter.displayName = "CardFooter";
|
|
57
|
+
export {
|
|
58
|
+
Card,
|
|
59
|
+
CardContent,
|
|
60
|
+
CardDescription,
|
|
61
|
+
CardFooter,
|
|
62
|
+
CardHeader,
|
|
63
|
+
CardTitle
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/card.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\nconst Card = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n \"rounded-lg border border-gray-150 border-solid bg-white text-gray-950 shadow-card dark:border-gray-800 dark:bg-gray-950 dark:text-gray-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n));\n\nCard.displayName = \"Card\";\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\n ref={ref}\n {...props}\n />\n));\n\nCardHeader.displayName = \"CardHeader\";\n\nconst CardTitle = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n \"font-semibold text-2xl leading-none tracking-tight\",\n className\n )}\n ref={ref}\n {...props}\n />\n));\n\nCardTitle.displayName = \"CardTitle\";\n\nconst CardDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\"text-gray-600 text-sm dark:text-gray-400\", className)}\n ref={ref}\n {...props}\n />\n));\n\nCardDescription.displayName = \"CardDescription\";\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div className={cn(\"p-6 pt-0\", className)} ref={ref} {...props} />\n));\n\nCardContent.displayName = \"CardContent\";\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\"flex items-center p-6 pt-0\", className)}\n ref={ref}\n {...props}\n />\n));\n\nCardFooter.displayName = \"CardFooter\";\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n};\n"],
|
|
5
|
+
"mappings": "AAQE;AARF,YAAY,WAAW;AAEvB,SAAS,UAAU;AAEnB,MAAM,OAAO,MAAM,WAGjB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACC,GAAG;AAAA;AACN,CACD;AAED,KAAK,cAAc;AAEnB,MAAM,aAAa,MAAM,WAGvB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC,WAAW,GAAG,iCAAiC,SAAS;AAAA,IACxD;AAAA,IACC,GAAG;AAAA;AACN,CACD;AAED,WAAW,cAAc;AAEzB,MAAM,YAAY,MAAM,WAGtB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACC,GAAG;AAAA;AACN,CACD;AAED,UAAU,cAAc;AAExB,MAAM,kBAAkB,MAAM,WAG5B,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC,WAAW,GAAG,4CAA4C,SAAS;AAAA,IACnE;AAAA,IACC,GAAG;AAAA;AACN,CACD;AAED,gBAAgB,cAAc;AAE9B,MAAM,cAAc,MAAM,WAGxB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B,oBAAC,SAAI,WAAW,GAAG,YAAY,SAAS,GAAG,KAAW,GAAG,OAAO,CACjE;AAED,YAAY,cAAc;AAE1B,MAAM,aAAa,MAAM,WAGvB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC,WAAW,GAAG,8BAA8B,SAAS;AAAA,IACrD;AAAA,IACC,GAAG;AAAA;AACN,CACD;AAED,WAAW,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CarouselApi } from "./carousel";
|
|
2
|
+
interface CarouselDotsProps {
|
|
3
|
+
api: CarouselApi | null;
|
|
4
|
+
count: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CarouselDots: ({ api, count, className }: CarouselDotsProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=carousel-dots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-dots.d.ts","sourceRoot":"","sources":["../../src/components/carousel-dots.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,UAAU,iBAAiB;IACzB,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,YAAY,GAAI,2BAA2B,iBAAiB,4CA8DxE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
const CarouselDots = ({ api, count, className }) => {
|
|
6
|
+
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
7
|
+
const currentIndexRef = React.useRef(selectedIndex);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
if (!api) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const updateIndex = () => {
|
|
13
|
+
const newIndex = api.selectedScrollSnap();
|
|
14
|
+
if (currentIndexRef.current !== newIndex) {
|
|
15
|
+
currentIndexRef.current = newIndex;
|
|
16
|
+
queueMicrotask(() => {
|
|
17
|
+
setSelectedIndex(newIndex);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
api.on("select", updateIndex);
|
|
22
|
+
updateIndex();
|
|
23
|
+
return () => {
|
|
24
|
+
api.off("select", updateIndex);
|
|
25
|
+
};
|
|
26
|
+
}, [api]);
|
|
27
|
+
const onClick = React.useCallback(
|
|
28
|
+
(index) => {
|
|
29
|
+
api?.scrollTo(index);
|
|
30
|
+
},
|
|
31
|
+
[api]
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center gap-2", className), children: Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsx(
|
|
34
|
+
Button,
|
|
35
|
+
{
|
|
36
|
+
"aria-current": selectedIndex === index ? "true" : void 0,
|
|
37
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
38
|
+
border: true,
|
|
39
|
+
borderRadius: "full",
|
|
40
|
+
className: cn(
|
|
41
|
+
"size-2 transition-all duration-300 2xl:size-3",
|
|
42
|
+
selectedIndex === index ? "hover:!bg-pink-500 border-pink-500 bg-pink-500 hover:border-pink-500 dark:border-pink-500 dark:bg-pink-500 dark:hover:border-pink-500 dark:hover:bg-pink-500" : "hover:!bg-gray-300 dark:hover:!bg-gray-600 border-gray-300 bg-gray-300 dark:border-gray-600 dark:bg-gray-600 dark:hover:border-gray-600"
|
|
43
|
+
),
|
|
44
|
+
icon: true,
|
|
45
|
+
onClick: () => onClick(index),
|
|
46
|
+
size: "sm",
|
|
47
|
+
variant: "bold"
|
|
48
|
+
},
|
|
49
|
+
index
|
|
50
|
+
)) });
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
CarouselDots
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=carousel-dots.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/carousel-dots.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from \"react\";\n\nimport { cn } from \"../lib/utils\";\nimport { Button } from \"./button\";\n\nimport type { CarouselApi } from \"./carousel\";\n\ninterface CarouselDotsProps {\n api: CarouselApi | null;\n count: number;\n className?: string;\n}\n\nexport const CarouselDots = ({ api, count, className }: CarouselDotsProps) => {\n const [selectedIndex, setSelectedIndex] = React.useState(0);\n const currentIndexRef = React.useRef(selectedIndex);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n const updateIndex = () => {\n const newIndex = api.selectedScrollSnap();\n\n if (currentIndexRef.current !== newIndex) {\n currentIndexRef.current = newIndex;\n // Schedule state update outside of useEffect\n queueMicrotask(() => {\n setSelectedIndex(newIndex);\n });\n }\n };\n\n // Subscribe to select events\n api.on(\"select\", updateIndex);\n // Initial update\n updateIndex();\n\n // Cleanup\n return () => {\n api.off(\"select\", updateIndex);\n };\n }, [api]);\n\n const onClick = React.useCallback(\n (index: number) => {\n api?.scrollTo(index);\n },\n [api]\n );\n\n return (\n <div className={cn(\"flex items-center justify-center gap-2\", className)}>\n {Array.from({ length: count }).map((_, index) => (\n <Button\n aria-current={selectedIndex === index ? \"true\" : undefined}\n aria-label={`Go to slide ${index + 1}`}\n border\n borderRadius=\"full\"\n className={cn(\n \"size-2 transition-all duration-300 2xl:size-3\",\n selectedIndex === index\n ? \"hover:!bg-pink-500 border-pink-500 bg-pink-500 hover:border-pink-500 dark:border-pink-500 dark:bg-pink-500 dark:hover:border-pink-500 dark:hover:bg-pink-500\"\n : \"hover:!bg-gray-300 dark:hover:!bg-gray-600 border-gray-300 bg-gray-300 dark:border-gray-600 dark:bg-gray-600 dark:hover:border-gray-600\"\n )}\n icon\n key={index}\n onClick={() => onClick(index)}\n size=\"sm\"\n variant=\"bold\"\n />\n ))}\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAuDQ;AAvDR,YAAY,WAAW;AAEvB,SAAS,UAAU;AACnB,SAAS,cAAc;AAUhB,MAAM,eAAe,CAAC,EAAE,KAAK,OAAO,UAAU,MAAyB;AAC5E,QAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAAS,CAAC;AAC1D,QAAM,kBAAkB,MAAM,OAAO,aAAa;AAElD,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,KAAK;AACR;AAAA,IACF;AAEA,UAAM,cAAc,MAAM;AACxB,YAAM,WAAW,IAAI,mBAAmB;AAExC,UAAI,gBAAgB,YAAY,UAAU;AACxC,wBAAgB,UAAU;AAE1B,uBAAe,MAAM;AACnB,2BAAiB,QAAQ;AAAA,QAC3B,CAAC;AAAA,MACH;AAAA,IACF;AAGA,QAAI,GAAG,UAAU,WAAW;AAE5B,gBAAY;AAGZ,WAAO,MAAM;AACX,UAAI,IAAI,UAAU,WAAW;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,QAAM,UAAU,MAAM;AAAA,IACpB,CAAC,UAAkB;AACjB,WAAK,SAAS,KAAK;AAAA,IACrB;AAAA,IACA,CAAC,GAAG;AAAA,EACN;AAEA,SACE,oBAAC,SAAI,WAAW,GAAG,0CAA0C,SAAS,GACnE,gBAAM,KAAK,EAAE,QAAQ,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,UACrC;AAAA,IAAC;AAAA;AAAA,MACC,gBAAc,kBAAkB,QAAQ,SAAS;AAAA,MACjD,cAAY,eAAe,QAAQ,CAAC;AAAA,MACpC,QAAM;AAAA,MACN,cAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA,kBAAkB,QACd,iKACA;AAAA,MACN;AAAA,MACA,MAAI;AAAA,MAEJ,SAAS,MAAM,QAAQ,KAAK;AAAA,MAC5B,MAAK;AAAA,MACL,SAAQ;AAAA;AAAA,IAHH;AAAA,EAIP,CACD,GACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
4
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
5
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
6
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
7
|
+
interface CarouselProps {
|
|
8
|
+
opts?: CarouselOptions;
|
|
9
|
+
plugins?: CarouselPlugin;
|
|
10
|
+
orientation?: "horizontal" | "vertical";
|
|
11
|
+
setApi?: (api: CarouselApi) => void;
|
|
12
|
+
}
|
|
13
|
+
type CarouselContextProps = {
|
|
14
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
15
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
16
|
+
scrollPrev: () => void;
|
|
17
|
+
scrollNext: () => void;
|
|
18
|
+
canScrollPrev: boolean;
|
|
19
|
+
canScrollNext: boolean;
|
|
20
|
+
} & CarouselProps;
|
|
21
|
+
export declare function useCarousel(): CarouselContextProps;
|
|
22
|
+
declare const Carousel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
declare const CarouselContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
24
|
+
containerClassName?: string;
|
|
25
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
interface CarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
27
|
+
useCustomStyles?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const CarouselItem: React.ForwardRefExoticComponent<CarouselItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
declare const CarouselPrevious: React.ForwardRefExoticComponent<Omit<import("./button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
declare const CarouselNext: React.ForwardRefExoticComponent<Omit<import("./button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi, type CarouselProps, };
|
|
33
|
+
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../src/components/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACjE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAChD,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE/C,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,MAAM,CAAC,E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