@karakuri-ui/react 0.2.3 → 0.3.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 +0 -1
- package/dist/components/ui/accordion.d.mts +40 -0
- package/dist/components/ui/accordion.d.ts +40 -0
- package/dist/components/ui/accordion.js +215 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/accordion.mjs +176 -0
- package/dist/components/ui/accordion.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +38 -0
- package/dist/components/ui/alert.d.ts +38 -0
- package/dist/components/ui/alert.js +217 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/alert.mjs +180 -0
- package/dist/components/ui/alert.mjs.map +1 -0
- package/dist/components/ui/avatar.d.mts +223 -0
- package/dist/components/ui/avatar.d.ts +223 -0
- package/dist/components/ui/avatar.js +245 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/avatar.mjs +204 -0
- package/dist/components/ui/avatar.mjs.map +1 -0
- package/dist/components/ui/badge.d.mts +31 -0
- package/dist/components/ui/badge.d.ts +31 -0
- package/dist/components/ui/badge.js +205 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/badge.mjs +170 -0
- package/dist/components/ui/badge.mjs.map +1 -0
- package/dist/components/ui/breadcrumb.d.mts +46 -0
- package/dist/components/ui/breadcrumb.d.ts +46 -0
- package/dist/components/ui/breadcrumb.js +201 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/breadcrumb.mjs +160 -0
- package/dist/components/ui/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/button-group.d.mts +22 -0
- package/dist/components/ui/button-group.d.ts +22 -0
- package/dist/components/ui/button-group.js +107 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button-group.mjs +72 -0
- package/dist/components/ui/button-group.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +31 -0
- package/dist/components/ui/button.d.ts +31 -0
- package/dist/components/ui/button.js +176 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +141 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/card.d.mts +60 -0
- package/dist/components/ui/card.d.ts +60 -0
- package/dist/components/ui/card.js +361 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/card.mjs +319 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/{chart.d.mts → components/ui/chart.d.mts} +2 -18
- package/dist/{chart.d.ts → components/ui/chart.d.ts} +2 -18
- package/dist/{chart.js → components/ui/chart.js} +30 -55
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/{chart.mjs → components/ui/chart.mjs} +22 -46
- package/dist/components/ui/chart.mjs.map +1 -0
- package/dist/components/ui/checkbox.d.mts +24 -0
- package/dist/components/ui/checkbox.d.ts +24 -0
- package/dist/components/ui/checkbox.js +173 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/checkbox.mjs +138 -0
- package/dist/components/ui/checkbox.mjs.map +1 -0
- package/dist/components/ui/divider.d.mts +27 -0
- package/dist/components/ui/divider.d.ts +27 -0
- package/dist/components/ui/divider.js +147 -0
- package/dist/components/ui/divider.js.map +1 -0
- package/dist/components/ui/divider.mjs +112 -0
- package/dist/components/ui/divider.mjs.map +1 -0
- package/dist/components/ui/drawer.d.mts +36 -0
- package/dist/components/ui/drawer.d.ts +36 -0
- package/dist/components/ui/drawer.js +211 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/drawer.mjs +165 -0
- package/dist/components/ui/drawer.mjs.map +1 -0
- package/dist/components/ui/dropdown.d.mts +34 -0
- package/dist/components/ui/dropdown.d.ts +34 -0
- package/dist/components/ui/dropdown.js +295 -0
- package/dist/components/ui/dropdown.js.map +1 -0
- package/dist/components/ui/dropdown.mjs +248 -0
- package/dist/components/ui/dropdown.mjs.map +1 -0
- package/dist/components/ui/field.d.mts +26 -0
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.js +141 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/field.mjs +103 -0
- package/dist/components/ui/field.mjs.map +1 -0
- package/dist/components/ui/icon-button.d.mts +20 -0
- package/dist/components/ui/icon-button.d.ts +20 -0
- package/dist/components/ui/icon-button.js +147 -0
- package/dist/components/ui/icon-button.js.map +1 -0
- package/dist/components/ui/icon-button.mjs +112 -0
- package/dist/components/ui/icon-button.mjs.map +1 -0
- package/dist/components/ui/index.d.mts +55 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +468 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +242 -0
- package/dist/components/ui/index.mjs.map +1 -0
- package/dist/components/ui/input.d.mts +20 -0
- package/dist/components/ui/input.d.ts +20 -0
- package/dist/components/ui/input.js +250 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/input.mjs +215 -0
- package/dist/components/ui/input.mjs.map +1 -0
- package/dist/components/ui/metric-card.d.mts +38 -0
- package/dist/components/ui/metric-card.d.ts +38 -0
- package/dist/components/ui/metric-card.js +250 -0
- package/dist/components/ui/metric-card.js.map +1 -0
- package/dist/components/ui/metric-card.mjs +209 -0
- package/dist/components/ui/metric-card.mjs.map +1 -0
- package/dist/components/ui/modal.d.mts +47 -0
- package/dist/components/ui/modal.d.ts +47 -0
- package/dist/components/ui/modal.js +371 -0
- package/dist/components/ui/modal.js.map +1 -0
- package/dist/components/ui/modal.mjs +313 -0
- package/dist/components/ui/modal.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +120 -0
- package/dist/components/ui/navigation-menu.d.ts +120 -0
- package/dist/components/ui/navigation-menu.js +521 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/navigation-menu.mjs +478 -0
- package/dist/components/ui/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/pagination.d.mts +113 -0
- package/dist/components/ui/pagination.d.ts +113 -0
- package/dist/components/ui/pagination.js +484 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/pagination.mjs +438 -0
- package/dist/components/ui/pagination.mjs.map +1 -0
- package/dist/components/ui/popover.d.mts +29 -0
- package/dist/components/ui/popover.d.ts +29 -0
- package/dist/components/ui/popover.js +165 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/popover.mjs +124 -0
- package/dist/components/ui/popover.mjs.map +1 -0
- package/dist/components/ui/progress.d.mts +35 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.js +194 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/progress.mjs +159 -0
- package/dist/components/ui/progress.mjs.map +1 -0
- package/dist/components/ui/radio-group.d.mts +35 -0
- package/dist/components/ui/radio-group.d.ts +35 -0
- package/dist/components/ui/radio-group.js +174 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/radio-group.mjs +137 -0
- package/dist/components/ui/radio-group.mjs.map +1 -0
- package/dist/components/ui/segmented.d.mts +25 -0
- package/dist/components/ui/segmented.d.ts +25 -0
- package/dist/components/ui/segmented.js +238 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/segmented.mjs +201 -0
- package/dist/components/ui/segmented.mjs.map +1 -0
- package/dist/components/ui/select.d.mts +20 -0
- package/dist/components/ui/select.d.ts +20 -0
- package/dist/components/ui/select.js +308 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/select.mjs +267 -0
- package/dist/components/ui/select.mjs.map +1 -0
- package/dist/components/ui/skeleton.d.mts +26 -0
- package/dist/components/ui/skeleton.d.ts +26 -0
- package/dist/components/ui/skeleton.js +144 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/skeleton.mjs +109 -0
- package/dist/components/ui/skeleton.mjs.map +1 -0
- package/dist/components/ui/slider.d.mts +38 -0
- package/dist/components/ui/slider.d.ts +38 -0
- package/dist/components/ui/slider.js +180 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/slider.mjs +145 -0
- package/dist/components/ui/slider.mjs.map +1 -0
- package/dist/components/ui/spinner.d.mts +23 -0
- package/dist/components/ui/spinner.d.ts +23 -0
- package/dist/components/ui/spinner.js +471 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spinner.mjs +436 -0
- package/dist/components/ui/spinner.mjs.map +1 -0
- package/dist/components/ui/switch.d.mts +22 -0
- package/dist/components/ui/switch.d.ts +22 -0
- package/dist/components/ui/switch.js +173 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/switch.mjs +138 -0
- package/dist/components/ui/switch.mjs.map +1 -0
- package/dist/components/ui/table.d.mts +60 -0
- package/dist/components/ui/table.d.ts +60 -0
- package/dist/components/ui/table.js +231 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/table.mjs +190 -0
- package/dist/components/ui/table.mjs.map +1 -0
- package/dist/components/ui/tabs.d.mts +31 -0
- package/dist/components/ui/tabs.d.ts +31 -0
- package/dist/components/ui/tabs.js +233 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/tabs.mjs +194 -0
- package/dist/components/ui/tabs.mjs.map +1 -0
- package/dist/components/ui/textarea.d.mts +19 -0
- package/dist/components/ui/textarea.d.ts +19 -0
- package/dist/components/ui/textarea.js +181 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/textarea.mjs +146 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/components/ui/toast.d.mts +93 -0
- package/dist/components/ui/toast.d.ts +93 -0
- package/dist/components/ui/toast.js +429 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toast.mjs +393 -0
- package/dist/components/ui/toast.mjs.map +1 -0
- package/dist/components/ui/toggle-group.d.mts +42 -0
- package/dist/components/ui/toggle-group.d.ts +42 -0
- package/dist/components/ui/toggle-group.js +183 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-group.mjs +146 -0
- package/dist/components/ui/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggle.d.mts +19 -0
- package/dist/components/ui/toggle.d.ts +19 -0
- package/dist/components/ui/toggle.js +194 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/toggle.mjs +159 -0
- package/dist/components/ui/toggle.mjs.map +1 -0
- package/dist/components/ui/tooltip.d.mts +26 -0
- package/dist/components/ui/tooltip.d.ts +26 -0
- package/dist/components/ui/tooltip.js +128 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +88 -0
- package/dist/components/ui/tooltip.mjs.map +1 -0
- package/dist/lib/code-generator.d.mts +60 -0
- package/dist/lib/code-generator.d.ts +60 -0
- package/dist/lib/code-generator.js +224 -0
- package/dist/lib/code-generator.js.map +1 -0
- package/dist/lib/code-generator.mjs +159 -0
- package/dist/lib/code-generator.mjs.map +1 -0
- package/dist/lib/utils.d.mts +10 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.js +33 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/chart.js.map +0 -1
- package/dist/chart.mjs.map +0 -1
- package/dist/index.d.mts +0 -1636
- package/dist/index.d.ts +0 -1636
- package/dist/index.js +0 -7291
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -7048
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
import { useButtonGroup } from "./button-group";
|
|
7
|
+
const solidColorMap = {
|
|
8
|
+
default: "bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80",
|
|
9
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active",
|
|
10
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active",
|
|
11
|
+
destructive: "bg-error text-error-foreground hover:bg-error-hover active:bg-error-active"
|
|
12
|
+
};
|
|
13
|
+
const buttonVariants = cva(
|
|
14
|
+
"inline-flex items-center justify-center whitespace-nowrap transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50",
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
solid: "font-semibold",
|
|
19
|
+
outline: "border border-border-form bg-background text-foreground hover:bg-background-muted font-normal",
|
|
20
|
+
ghost: "text-foreground hover:bg-background-muted font-normal",
|
|
21
|
+
link: "text-text-link underline-offset-4 hover:underline font-normal"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
xs: "h-7 px-2.5 text-xs gap-1",
|
|
25
|
+
// 28px height, 10px paddingX, 12px font
|
|
26
|
+
sm: "h-8 px-3 text-sm gap-2",
|
|
27
|
+
// 32px height, 12px paddingX, 13px font
|
|
28
|
+
md: "h-9 px-3.5 text-md gap-2",
|
|
29
|
+
// 36px height, 14px paddingX, 14px font
|
|
30
|
+
default: "h-10 px-4 text-md gap-2",
|
|
31
|
+
// 40px height, 16px paddingX, 14px font
|
|
32
|
+
lg: "h-12 px-6 text-base gap-2",
|
|
33
|
+
// 48px height, 24px paddingX, 16px font
|
|
34
|
+
icon: "h-10 w-10"
|
|
35
|
+
},
|
|
36
|
+
radius: {
|
|
37
|
+
none: "rounded-none",
|
|
38
|
+
// 0px - primitive.borderRadius.none
|
|
39
|
+
sm: "rounded-sm",
|
|
40
|
+
// 2px - primitive.borderRadius.sm
|
|
41
|
+
base: "rounded",
|
|
42
|
+
// 4px - primitive.borderRadius.base
|
|
43
|
+
default: "rounded-md",
|
|
44
|
+
// 6px - primitive.borderRadius.md (Figma button default)
|
|
45
|
+
lg: "rounded-lg",
|
|
46
|
+
// 8px - primitive.borderRadius.lg
|
|
47
|
+
xl: "rounded-xl",
|
|
48
|
+
// 12px - primitive.borderRadius.xl
|
|
49
|
+
"2xl": "rounded-2xl",
|
|
50
|
+
// 16px - primitive.borderRadius.2xl
|
|
51
|
+
"3xl": "rounded-3xl",
|
|
52
|
+
// 24px - primitive.borderRadius.3xl
|
|
53
|
+
full: "rounded-full"
|
|
54
|
+
// 9999px - primitive.borderRadius.full
|
|
55
|
+
},
|
|
56
|
+
fullWidth: {
|
|
57
|
+
true: "w-full",
|
|
58
|
+
false: "w-auto"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
variant: "solid",
|
|
63
|
+
size: "default",
|
|
64
|
+
radius: "default",
|
|
65
|
+
fullWidth: false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const Button = React.forwardRef(
|
|
70
|
+
({
|
|
71
|
+
className,
|
|
72
|
+
variant: variantProp,
|
|
73
|
+
color: colorProp,
|
|
74
|
+
size: sizeProp,
|
|
75
|
+
radius: radiusProp,
|
|
76
|
+
fullWidth,
|
|
77
|
+
asChild = false,
|
|
78
|
+
loading = false,
|
|
79
|
+
disabled: disabledProp,
|
|
80
|
+
leftIcon,
|
|
81
|
+
rightIcon,
|
|
82
|
+
selected = false,
|
|
83
|
+
fontWeight: fontWeightProp,
|
|
84
|
+
pressEffect,
|
|
85
|
+
children,
|
|
86
|
+
...props
|
|
87
|
+
}, ref) => {
|
|
88
|
+
const Comp = asChild ? Slot : "button";
|
|
89
|
+
const groupContext = useButtonGroup();
|
|
90
|
+
const variant = variantProp ?? groupContext?.variant ?? "solid";
|
|
91
|
+
const color = colorProp ?? "default";
|
|
92
|
+
const size = sizeProp ?? groupContext?.size;
|
|
93
|
+
const radius = radiusProp ?? groupContext?.radius;
|
|
94
|
+
const disabled = disabledProp ?? groupContext?.disabled;
|
|
95
|
+
const fontWeight = fontWeightProp ?? groupContext?.fontWeight;
|
|
96
|
+
const fontWeightClass = fontWeight === "normal" ? "font-normal" : fontWeight === "semibold" ? "font-semibold" : "";
|
|
97
|
+
const iconSizeClass = {
|
|
98
|
+
xs: "icon-xs",
|
|
99
|
+
// 14px
|
|
100
|
+
sm: "icon-xs",
|
|
101
|
+
// 14px
|
|
102
|
+
md: "icon-sm",
|
|
103
|
+
// 16px
|
|
104
|
+
default: "icon-sm",
|
|
105
|
+
// 16px
|
|
106
|
+
lg: "icon-sm",
|
|
107
|
+
// 16px
|
|
108
|
+
icon: "icon-md"
|
|
109
|
+
// icon-only → 20px
|
|
110
|
+
}[size || "default"];
|
|
111
|
+
const selectedStyles = selected ? variant === "outline" ? "bg-background-muted" : variant === "ghost" ? "font-semibold" : "" : "";
|
|
112
|
+
return /* @__PURE__ */ React.createElement(
|
|
113
|
+
Comp,
|
|
114
|
+
{
|
|
115
|
+
className: cn(buttonVariants({ variant, size, radius, fullWidth }), variant === "solid" && solidColorMap[color], pressEffect !== false && "active:scale-pressed", fontWeightClass, selectedStyles, className),
|
|
116
|
+
ref,
|
|
117
|
+
disabled: disabled || loading,
|
|
118
|
+
"aria-busy": loading || void 0,
|
|
119
|
+
"aria-pressed": selected || void 0,
|
|
120
|
+
...props
|
|
121
|
+
},
|
|
122
|
+
loading ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
123
|
+
"svg",
|
|
124
|
+
{
|
|
125
|
+
className: cn(iconSizeClass, "animate-spin"),
|
|
126
|
+
fill: "none",
|
|
127
|
+
viewBox: "0 0 24 24",
|
|
128
|
+
"aria-hidden": "true"
|
|
129
|
+
},
|
|
130
|
+
/* @__PURE__ */ React.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
131
|
+
/* @__PURE__ */ React.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
132
|
+
), /* @__PURE__ */ React.createElement("span", null, children)) : /* @__PURE__ */ React.createElement(React.Fragment, null, leftIcon && /* @__PURE__ */ React.createElement("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, leftIcon), children, rightIcon && /* @__PURE__ */ React.createElement("span", { className: cn(iconSizeClass, "[&>svg]:w-full [&>svg]:h-full"), "aria-hidden": "true" }, rightIcon))
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
Button.displayName = "Button";
|
|
137
|
+
export {
|
|
138
|
+
Button,
|
|
139
|
+
buttonVariants
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/button.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\nimport { useButtonGroup } from './button-group'\n\n// Solid color maps (applied when variant=\"solid\")\nconst solidColorMap = {\n default: 'bg-foreground text-background hover:bg-foreground/90 active:bg-foreground/80',\n primary: 'bg-primary text-primary-foreground hover:bg-primary-hover active:bg-primary-active',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary-hover active:bg-secondary-active',\n destructive: 'bg-error text-error-foreground hover:bg-error-hover active:bg-error-active',\n} as const\n\nexport type ButtonColor = keyof typeof solidColorMap\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center whitespace-nowrap transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n solid: 'font-semibold',\n outline: 'border border-border-form bg-background text-foreground hover:bg-background-muted font-normal',\n ghost: 'text-foreground hover:bg-background-muted font-normal',\n link: 'text-text-link underline-offset-4 hover:underline font-normal',\n },\n size: {\n xs: 'h-7 px-2.5 text-xs gap-1', // 28px height, 10px paddingX, 12px font\n sm: 'h-8 px-3 text-sm gap-2', // 32px height, 12px paddingX, 13px font\n md: 'h-9 px-3.5 text-md gap-2', // 36px height, 14px paddingX, 14px font\n default: 'h-10 px-4 text-md gap-2', // 40px height, 16px paddingX, 14px font\n lg: 'h-12 px-6 text-base gap-2', // 48px height, 24px paddingX, 16px font\n icon: 'h-10 w-10',\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md (Figma button default)\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n fullWidth: {\n true: 'w-full',\n false: 'w-auto',\n },\n },\n defaultVariants: {\n variant: 'solid',\n size: 'default',\n radius: 'default',\n fullWidth: false,\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n /** Solid variant color */\n color?: ButtonColor\n asChild?: boolean\n loading?: boolean\n leftIcon?: React.ReactNode\n rightIcon?: React.ReactNode\n selected?: boolean\n fontWeight?: 'normal' | 'semibold'\n pressEffect?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({\n className,\n variant: variantProp,\n color: colorProp,\n size: sizeProp,\n radius: radiusProp,\n fullWidth,\n asChild = false,\n loading = false,\n disabled: disabledProp,\n leftIcon,\n rightIcon,\n selected = false,\n fontWeight: fontWeightProp,\n pressEffect,\n children,\n ...props\n }, ref) => {\n const Comp = asChild ? Slot : 'button'\n const groupContext = useButtonGroup()\n\n // Use context values as fallback, individual props take precedence\n const variant = variantProp ?? groupContext?.variant ?? 'solid'\n const color = colorProp ?? 'default'\n const size = sizeProp ?? groupContext?.size\n const radius = radiusProp ?? groupContext?.radius\n const disabled = disabledProp ?? groupContext?.disabled\n\n // Priority: direct prop > ButtonGroup context > variant default (no class)\n const fontWeight = fontWeightProp ?? groupContext?.fontWeight\n\n // FontWeight class (overrides variant default)\n const fontWeightClass = fontWeight === 'normal' ? 'font-normal' : fontWeight === 'semibold' ? 'font-semibold' : ''\n\n // Icon size for button with text (5-step scale)\n // xs~sm: 14px, md~default~lg: 16px\n const iconSizeClass = {\n xs: 'icon-xs', // 14px\n sm: 'icon-xs', // 14px\n md: 'icon-sm', // 16px\n default: 'icon-sm', // 16px\n lg: 'icon-sm', // 16px\n icon: 'icon-md', // icon-only → 20px\n }[size || 'default']\n\n // Selected styles by variant (used in ButtonGroup)\n const selectedStyles = selected ? (\n variant === 'outline' ? 'bg-background-muted' :\n variant === 'ghost' ? 'font-semibold' : ''\n ) : ''\n\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, radius, fullWidth }), variant === 'solid' && solidColorMap[color], pressEffect !== false && 'active:scale-pressed', fontWeightClass, selectedStyles, className)}\n ref={ref}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n aria-pressed={selected || undefined}\n {...props}\n >\n {loading ? (\n <>\n <svg\n className={cn(iconSizeClass, 'animate-spin')}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\" />\n </svg>\n <span>{children}</span>\n </>\n ) : (\n <>\n {leftIcon && <span className={cn(iconSizeClass, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">{leftIcon}</span>}\n {children}\n {rightIcon && <span className={cn(iconSizeClass, '[&>svg]:w-full [&>svg]:h-full')} aria-hidden=\"true\">{rightIcon}</span>}\n </>\n )}\n </Comp>\n )\n }\n)\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
type CardSize = 'sm' | 'default' | 'lg';
|
|
6
|
+
type CardDirection = 'vertical' | 'horizontal';
|
|
7
|
+
declare const cardVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "outline" | "ghost" | null | undefined;
|
|
9
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
10
|
+
radius?: "sm" | "lg" | "base" | "md" | "xl" | "2xl" | null | undefined;
|
|
11
|
+
direction?: "horizontal" | "vertical" | null | undefined;
|
|
12
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
+
type CardVariant = 'default' | 'outline' | 'ghost';
|
|
14
|
+
type CardRadius = 'sm' | 'base' | 'md' | 'lg' | 'xl' | '2xl';
|
|
15
|
+
interface CardProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof cardVariants> {
|
|
16
|
+
/** Visual style */
|
|
17
|
+
variant?: CardVariant;
|
|
18
|
+
/** Content padding scale */
|
|
19
|
+
size?: CardSize;
|
|
20
|
+
/** Border radius */
|
|
21
|
+
radius?: CardRadius;
|
|
22
|
+
/** Layout direction */
|
|
23
|
+
direction?: CardDirection;
|
|
24
|
+
/** Enable hover effect for interactive cards */
|
|
25
|
+
interactive?: boolean;
|
|
26
|
+
/** Render as child element (Slot pattern) */
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
interface CardImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
31
|
+
/** Gradient overlay on image */
|
|
32
|
+
overlay?: boolean;
|
|
33
|
+
/** Overlay opacity (10–90). Default: 60 */
|
|
34
|
+
overlayOpacity?: number;
|
|
35
|
+
/** Custom class for overlay gradient (overrides overlayOpacity) */
|
|
36
|
+
overlayClassName?: string;
|
|
37
|
+
}
|
|
38
|
+
declare const CardImage: React.ForwardRefExoticComponent<CardImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
39
|
+
interface CardHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
40
|
+
}
|
|
41
|
+
declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
interface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
43
|
+
/** Leading icon */
|
|
44
|
+
icon?: React.ReactNode;
|
|
45
|
+
}
|
|
46
|
+
declare const CardTitle: React.ForwardRefExoticComponent<CardTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
47
|
+
interface CardDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
48
|
+
}
|
|
49
|
+
declare const CardDescription: React.ForwardRefExoticComponent<CardDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
50
|
+
interface CardActionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
51
|
+
}
|
|
52
|
+
declare const CardAction: React.ForwardRefExoticComponent<CardActionProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
54
|
+
}
|
|
55
|
+
declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
interface CardFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
57
|
+
}
|
|
58
|
+
declare const CardFooter: React.ForwardRefExoticComponent<CardFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
|
|
60
|
+
export { Card, CardAction, type CardActionProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardImage, type CardImageProps, type CardProps, type CardRadius, CardTitle, type CardTitleProps, type CardVariant, cardVariants };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
type CardSize = 'sm' | 'default' | 'lg';
|
|
6
|
+
type CardDirection = 'vertical' | 'horizontal';
|
|
7
|
+
declare const cardVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "outline" | "ghost" | null | undefined;
|
|
9
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
10
|
+
radius?: "sm" | "lg" | "base" | "md" | "xl" | "2xl" | null | undefined;
|
|
11
|
+
direction?: "horizontal" | "vertical" | null | undefined;
|
|
12
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
13
|
+
type CardVariant = 'default' | 'outline' | 'ghost';
|
|
14
|
+
type CardRadius = 'sm' | 'base' | 'md' | 'lg' | 'xl' | '2xl';
|
|
15
|
+
interface CardProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof cardVariants> {
|
|
16
|
+
/** Visual style */
|
|
17
|
+
variant?: CardVariant;
|
|
18
|
+
/** Content padding scale */
|
|
19
|
+
size?: CardSize;
|
|
20
|
+
/** Border radius */
|
|
21
|
+
radius?: CardRadius;
|
|
22
|
+
/** Layout direction */
|
|
23
|
+
direction?: CardDirection;
|
|
24
|
+
/** Enable hover effect for interactive cards */
|
|
25
|
+
interactive?: boolean;
|
|
26
|
+
/** Render as child element (Slot pattern) */
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
interface CardImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
31
|
+
/** Gradient overlay on image */
|
|
32
|
+
overlay?: boolean;
|
|
33
|
+
/** Overlay opacity (10–90). Default: 60 */
|
|
34
|
+
overlayOpacity?: number;
|
|
35
|
+
/** Custom class for overlay gradient (overrides overlayOpacity) */
|
|
36
|
+
overlayClassName?: string;
|
|
37
|
+
}
|
|
38
|
+
declare const CardImage: React.ForwardRefExoticComponent<CardImageProps & React.RefAttributes<HTMLImageElement>>;
|
|
39
|
+
interface CardHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
40
|
+
}
|
|
41
|
+
declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
interface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
43
|
+
/** Leading icon */
|
|
44
|
+
icon?: React.ReactNode;
|
|
45
|
+
}
|
|
46
|
+
declare const CardTitle: React.ForwardRefExoticComponent<CardTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
47
|
+
interface CardDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
48
|
+
}
|
|
49
|
+
declare const CardDescription: React.ForwardRefExoticComponent<CardDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
50
|
+
interface CardActionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
51
|
+
}
|
|
52
|
+
declare const CardAction: React.ForwardRefExoticComponent<CardActionProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
54
|
+
}
|
|
55
|
+
declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
interface CardFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
57
|
+
}
|
|
58
|
+
declare const CardFooter: React.ForwardRefExoticComponent<CardFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
|
|
60
|
+
export { Card, CardAction, type CardActionProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardImage, type CardImageProps, type CardProps, type CardRadius, CardTitle, type CardTitleProps, type CardVariant, cardVariants };
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var card_exports = {};
|
|
31
|
+
__export(card_exports, {
|
|
32
|
+
Card: () => Card,
|
|
33
|
+
CardAction: () => CardAction,
|
|
34
|
+
CardContent: () => CardContent,
|
|
35
|
+
CardDescription: () => CardDescription,
|
|
36
|
+
CardFooter: () => CardFooter,
|
|
37
|
+
CardHeader: () => CardHeader,
|
|
38
|
+
CardImage: () => CardImage,
|
|
39
|
+
CardTitle: () => CardTitle,
|
|
40
|
+
cardVariants: () => cardVariants
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(card_exports);
|
|
43
|
+
var React = __toESM(require("react"));
|
|
44
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
45
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
46
|
+
var import_utils = require("../../lib/utils");
|
|
47
|
+
const CardContext = React.createContext({
|
|
48
|
+
size: "default",
|
|
49
|
+
direction: "vertical"
|
|
50
|
+
});
|
|
51
|
+
function useCard() {
|
|
52
|
+
return React.useContext(CardContext);
|
|
53
|
+
}
|
|
54
|
+
const cardVariants = (0, import_class_variance_authority.cva)(
|
|
55
|
+
"flex overflow-hidden transition-all duration-normal",
|
|
56
|
+
{
|
|
57
|
+
variants: {
|
|
58
|
+
variant: {
|
|
59
|
+
default: "bg-background-paper border border-border-subtle shadow-sm",
|
|
60
|
+
outline: "bg-background-paper border border-border",
|
|
61
|
+
ghost: "bg-transparent"
|
|
62
|
+
},
|
|
63
|
+
size: {
|
|
64
|
+
sm: "",
|
|
65
|
+
default: "",
|
|
66
|
+
lg: ""
|
|
67
|
+
},
|
|
68
|
+
radius: {
|
|
69
|
+
sm: "rounded-sm",
|
|
70
|
+
// 2px
|
|
71
|
+
base: "rounded",
|
|
72
|
+
// 4px
|
|
73
|
+
md: "rounded-md",
|
|
74
|
+
// 6px
|
|
75
|
+
lg: "rounded-lg",
|
|
76
|
+
// 8px
|
|
77
|
+
xl: "rounded-xl",
|
|
78
|
+
// 12px
|
|
79
|
+
"2xl": "rounded-2xl"
|
|
80
|
+
// 16px
|
|
81
|
+
},
|
|
82
|
+
direction: {
|
|
83
|
+
vertical: "flex-col",
|
|
84
|
+
horizontal: "flex-row"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
variant: "default",
|
|
89
|
+
size: "default",
|
|
90
|
+
radius: "xl",
|
|
91
|
+
direction: "vertical"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
const Card = React.forwardRef(
|
|
96
|
+
({
|
|
97
|
+
className,
|
|
98
|
+
variant = "default",
|
|
99
|
+
size = "default",
|
|
100
|
+
radius = "xl",
|
|
101
|
+
direction = "vertical",
|
|
102
|
+
interactive = false,
|
|
103
|
+
asChild = false,
|
|
104
|
+
children,
|
|
105
|
+
...props
|
|
106
|
+
}, ref) => {
|
|
107
|
+
const Comp = asChild ? import_react_slot.Slot : "div";
|
|
108
|
+
let content = children;
|
|
109
|
+
if (direction === "horizontal") {
|
|
110
|
+
const childArray = React.Children.toArray(children);
|
|
111
|
+
const imageChildren = [];
|
|
112
|
+
const otherChildren = [];
|
|
113
|
+
childArray.forEach((child) => {
|
|
114
|
+
if (React.isValidElement(child) && child.type === CardImage) {
|
|
115
|
+
imageChildren.push(child);
|
|
116
|
+
} else {
|
|
117
|
+
otherChildren.push(child);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
content = /* @__PURE__ */ React.createElement(React.Fragment, null, imageChildren, /* @__PURE__ */ React.createElement("div", { className: "flex-1 flex flex-col min-w-0" }, otherChildren));
|
|
121
|
+
}
|
|
122
|
+
return /* @__PURE__ */ React.createElement(CardContext.Provider, { value: { size, direction } }, /* @__PURE__ */ React.createElement(
|
|
123
|
+
Comp,
|
|
124
|
+
{
|
|
125
|
+
ref,
|
|
126
|
+
className: (0, import_utils.cn)(
|
|
127
|
+
cardVariants({ variant, size, radius, direction }),
|
|
128
|
+
interactive && "cursor-pointer hover:shadow-md hover:-translate-y-0.5",
|
|
129
|
+
className
|
|
130
|
+
),
|
|
131
|
+
...props
|
|
132
|
+
},
|
|
133
|
+
content
|
|
134
|
+
));
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
Card.displayName = "Card";
|
|
138
|
+
const sizePaddingMap = {
|
|
139
|
+
sm: "p-4",
|
|
140
|
+
// 16px
|
|
141
|
+
default: "p-4 sm:p-6",
|
|
142
|
+
// 16px → 24px
|
|
143
|
+
lg: "p-6 sm:p-8"
|
|
144
|
+
// 24px → 32px
|
|
145
|
+
};
|
|
146
|
+
const sizePaddingXMap = {
|
|
147
|
+
sm: "px-4",
|
|
148
|
+
// 16px
|
|
149
|
+
default: "px-4 sm:px-6",
|
|
150
|
+
// 16px → 24px
|
|
151
|
+
lg: "px-6 sm:px-8"
|
|
152
|
+
// 24px → 32px
|
|
153
|
+
};
|
|
154
|
+
const sizePaddingYMap = {
|
|
155
|
+
sm: "py-3",
|
|
156
|
+
// 12px
|
|
157
|
+
default: "py-3 sm:py-4",
|
|
158
|
+
// 12px → 16px
|
|
159
|
+
lg: "py-4 sm:py-5"
|
|
160
|
+
// 16px → 20px
|
|
161
|
+
};
|
|
162
|
+
const sizePaddingTMap = {
|
|
163
|
+
sm: "pt-5",
|
|
164
|
+
// 20px
|
|
165
|
+
default: "pt-5 sm:pt-6",
|
|
166
|
+
// 20px → 24px
|
|
167
|
+
lg: "pt-6 sm:pt-8"
|
|
168
|
+
// 24px → 32px
|
|
169
|
+
};
|
|
170
|
+
const sizeInnerPbMap = {
|
|
171
|
+
sm: "pb-3",
|
|
172
|
+
// 12px
|
|
173
|
+
default: "pb-3 sm:pb-4",
|
|
174
|
+
// 12px → 16px
|
|
175
|
+
lg: "pb-3 sm:pb-4"
|
|
176
|
+
// 12px → 16px (default와 동일)
|
|
177
|
+
};
|
|
178
|
+
const sizeLastPbMap = {
|
|
179
|
+
sm: "last:pb-5",
|
|
180
|
+
// 20px
|
|
181
|
+
default: "last:pb-5 sm:last:pb-6",
|
|
182
|
+
// 20px → 24px
|
|
183
|
+
lg: "last:pb-6 sm:last:pb-8"
|
|
184
|
+
// 24px → 32px
|
|
185
|
+
};
|
|
186
|
+
const overlayOpacityMap = {
|
|
187
|
+
10: "from-black/10",
|
|
188
|
+
20: "from-black/20",
|
|
189
|
+
30: "from-black/30",
|
|
190
|
+
40: "from-black/40",
|
|
191
|
+
50: "from-black/50",
|
|
192
|
+
60: "from-black/60",
|
|
193
|
+
70: "from-black/70",
|
|
194
|
+
80: "from-black/80",
|
|
195
|
+
90: "from-black/90"
|
|
196
|
+
};
|
|
197
|
+
const CardImage = React.forwardRef(
|
|
198
|
+
({ className, overlay = false, overlayOpacity = 60, overlayClassName, alt = "", ...props }, ref) => {
|
|
199
|
+
const { direction } = useCard();
|
|
200
|
+
const isHorizontal = direction === "horizontal";
|
|
201
|
+
if (isHorizontal) {
|
|
202
|
+
const opacityClass = overlay ? overlayOpacityMap[overlayOpacity] || "from-black/60" : null;
|
|
203
|
+
return /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)("relative shrink-0 w-48 overflow-hidden", className) }, /* @__PURE__ */ React.createElement(
|
|
204
|
+
"img",
|
|
205
|
+
{
|
|
206
|
+
ref,
|
|
207
|
+
alt,
|
|
208
|
+
className: "absolute inset-0 w-full h-full object-cover",
|
|
209
|
+
...props
|
|
210
|
+
}
|
|
211
|
+
), overlay && /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)("absolute inset-0 bg-gradient-to-t to-transparent", overlayClassName || opacityClass) }));
|
|
212
|
+
}
|
|
213
|
+
if (overlay) {
|
|
214
|
+
const opacityClass = overlayOpacityMap[overlayOpacity] || "from-black/60";
|
|
215
|
+
return /* @__PURE__ */ React.createElement("div", { className: "relative w-full shrink-0 overflow-hidden" }, /* @__PURE__ */ React.createElement(
|
|
216
|
+
"img",
|
|
217
|
+
{
|
|
218
|
+
ref,
|
|
219
|
+
alt,
|
|
220
|
+
className: (0, import_utils.cn)("w-full object-cover", className),
|
|
221
|
+
...props
|
|
222
|
+
}
|
|
223
|
+
), /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)("absolute inset-0 bg-gradient-to-t to-transparent", overlayClassName || opacityClass) }));
|
|
224
|
+
}
|
|
225
|
+
return /* @__PURE__ */ React.createElement(
|
|
226
|
+
"img",
|
|
227
|
+
{
|
|
228
|
+
ref,
|
|
229
|
+
alt,
|
|
230
|
+
className: (0, import_utils.cn)("w-full object-cover shrink-0", className),
|
|
231
|
+
...props
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
CardImage.displayName = "CardImage";
|
|
237
|
+
const CardHeader = React.forwardRef(
|
|
238
|
+
({ className, children, ...props }, ref) => {
|
|
239
|
+
const { size } = useCard();
|
|
240
|
+
const childArray = React.Children.toArray(children);
|
|
241
|
+
const actionChildren = [];
|
|
242
|
+
const otherChildren = [];
|
|
243
|
+
childArray.forEach((child) => {
|
|
244
|
+
if (React.isValidElement(child) && child.type === CardAction) {
|
|
245
|
+
actionChildren.push(child);
|
|
246
|
+
} else {
|
|
247
|
+
otherChildren.push(child);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
return /* @__PURE__ */ React.createElement(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
ref,
|
|
254
|
+
className: (0, import_utils.cn)(
|
|
255
|
+
"flex items-start gap-3",
|
|
256
|
+
sizePaddingXMap[size],
|
|
257
|
+
sizePaddingTMap[size],
|
|
258
|
+
sizeInnerPbMap[size],
|
|
259
|
+
sizeLastPbMap[size],
|
|
260
|
+
className
|
|
261
|
+
),
|
|
262
|
+
...props
|
|
263
|
+
},
|
|
264
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0 space-y-3" }, otherChildren),
|
|
265
|
+
actionChildren
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
CardHeader.displayName = "CardHeader";
|
|
270
|
+
const CardTitle = React.forwardRef(
|
|
271
|
+
({ className, icon, children, ...props }, ref) => {
|
|
272
|
+
return /* @__PURE__ */ React.createElement(
|
|
273
|
+
"h3",
|
|
274
|
+
{
|
|
275
|
+
ref,
|
|
276
|
+
className: (0, import_utils.cn)(
|
|
277
|
+
"font-semibold text-foreground leading-none tracking-tight",
|
|
278
|
+
icon && "flex items-center gap-2",
|
|
279
|
+
className
|
|
280
|
+
),
|
|
281
|
+
...props
|
|
282
|
+
},
|
|
283
|
+
icon && /* @__PURE__ */ React.createElement("span", { className: "shrink-0 icon-sm [&>svg]:w-full [&>svg]:h-full", "aria-hidden": "true" }, icon),
|
|
284
|
+
children
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
CardTitle.displayName = "CardTitle";
|
|
289
|
+
const CardDescription = React.forwardRef(
|
|
290
|
+
({ className, ...props }, ref) => {
|
|
291
|
+
return /* @__PURE__ */ React.createElement(
|
|
292
|
+
"p",
|
|
293
|
+
{
|
|
294
|
+
ref,
|
|
295
|
+
className: (0, import_utils.cn)("text-sm text-text-muted", className),
|
|
296
|
+
...props
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
CardDescription.displayName = "CardDescription";
|
|
302
|
+
const CardAction = React.forwardRef(
|
|
303
|
+
({ className, ...props }, ref) => {
|
|
304
|
+
return /* @__PURE__ */ React.createElement(
|
|
305
|
+
"div",
|
|
306
|
+
{
|
|
307
|
+
ref,
|
|
308
|
+
className: (0, import_utils.cn)("shrink-0 ml-auto -mr-2 -mt-2", className),
|
|
309
|
+
...props
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
CardAction.displayName = "CardAction";
|
|
315
|
+
const CardContent = React.forwardRef(
|
|
316
|
+
({ className, ...props }, ref) => {
|
|
317
|
+
const { size } = useCard();
|
|
318
|
+
return /* @__PURE__ */ React.createElement(
|
|
319
|
+
"div",
|
|
320
|
+
{
|
|
321
|
+
ref,
|
|
322
|
+
className: (0, import_utils.cn)(sizePaddingXMap[size], "pb-0", sizeLastPbMap[size], className),
|
|
323
|
+
...props
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
CardContent.displayName = "CardContent";
|
|
329
|
+
const CardFooter = React.forwardRef(
|
|
330
|
+
({ className, ...props }, ref) => {
|
|
331
|
+
const { size } = useCard();
|
|
332
|
+
return /* @__PURE__ */ React.createElement(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
ref,
|
|
336
|
+
className: (0, import_utils.cn)(
|
|
337
|
+
"flex items-center gap-2",
|
|
338
|
+
sizePaddingXMap[size],
|
|
339
|
+
sizePaddingYMap[size],
|
|
340
|
+
"mt-auto",
|
|
341
|
+
className
|
|
342
|
+
),
|
|
343
|
+
...props
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
CardFooter.displayName = "CardFooter";
|
|
349
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
350
|
+
0 && (module.exports = {
|
|
351
|
+
Card,
|
|
352
|
+
CardAction,
|
|
353
|
+
CardContent,
|
|
354
|
+
CardDescription,
|
|
355
|
+
CardFooter,
|
|
356
|
+
CardHeader,
|
|
357
|
+
CardImage,
|
|
358
|
+
CardTitle,
|
|
359
|
+
cardVariants
|
|
360
|
+
});
|
|
361
|
+
//# sourceMappingURL=card.js.map
|