@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,170 @@
|
|
|
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
|
+
const colorMap = {
|
|
7
|
+
default: {
|
|
8
|
+
solid: "bg-foreground text-background",
|
|
9
|
+
subtle: "bg-background-muted text-foreground",
|
|
10
|
+
outline: "border-border text-foreground"
|
|
11
|
+
},
|
|
12
|
+
primary: {
|
|
13
|
+
solid: "bg-primary text-primary-foreground",
|
|
14
|
+
subtle: "bg-primary-tint text-text-primary",
|
|
15
|
+
outline: "border-primary text-text-primary"
|
|
16
|
+
},
|
|
17
|
+
success: {
|
|
18
|
+
solid: "bg-success text-success-foreground",
|
|
19
|
+
subtle: "bg-success-tint text-text-success",
|
|
20
|
+
outline: "border-success text-text-success"
|
|
21
|
+
},
|
|
22
|
+
warning: {
|
|
23
|
+
solid: "bg-warning text-warning-foreground",
|
|
24
|
+
subtle: "bg-warning-tint text-text-warning",
|
|
25
|
+
outline: "border-warning text-text-warning"
|
|
26
|
+
},
|
|
27
|
+
error: {
|
|
28
|
+
solid: "bg-error text-error-foreground",
|
|
29
|
+
subtle: "bg-error-tint text-text-error",
|
|
30
|
+
outline: "border-error text-text-error"
|
|
31
|
+
},
|
|
32
|
+
info: {
|
|
33
|
+
solid: "bg-info text-info-foreground",
|
|
34
|
+
subtle: "bg-info-tint text-text-info",
|
|
35
|
+
outline: "border-info text-text-info"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const badgeVariants = cva(
|
|
39
|
+
"inline-flex items-center justify-center whitespace-nowrap font-semibold transition-colors select-none",
|
|
40
|
+
{
|
|
41
|
+
variants: {
|
|
42
|
+
size: {
|
|
43
|
+
sm: "h-5 min-w-5 px-1.5 text-2xs gap-1",
|
|
44
|
+
// 20px height, 6px paddingX, 11px font
|
|
45
|
+
default: "h-6 min-w-6 px-2 text-xs gap-1",
|
|
46
|
+
// 24px height, 8px paddingX, 12px font
|
|
47
|
+
lg: "h-7 min-w-7 px-2.5 text-sm gap-1.5"
|
|
48
|
+
// 28px height, 10px paddingX, 13px font
|
|
49
|
+
},
|
|
50
|
+
radius: {
|
|
51
|
+
sm: "rounded-sm",
|
|
52
|
+
// 2px
|
|
53
|
+
base: "rounded",
|
|
54
|
+
// 4px
|
|
55
|
+
md: "rounded-md",
|
|
56
|
+
// 6px
|
|
57
|
+
lg: "rounded-lg",
|
|
58
|
+
// 8px
|
|
59
|
+
full: "rounded-full"
|
|
60
|
+
// 9999px
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
size: "default",
|
|
65
|
+
radius: "full"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const badgeIconSizes = {
|
|
70
|
+
sm: "icon-2xs",
|
|
71
|
+
// 12px
|
|
72
|
+
default: "icon-2xs",
|
|
73
|
+
// 12px
|
|
74
|
+
lg: "icon-xs"
|
|
75
|
+
// 14px
|
|
76
|
+
};
|
|
77
|
+
const badgeDotSizes = {
|
|
78
|
+
sm: "w-1 h-1",
|
|
79
|
+
default: "w-1.5 h-1.5",
|
|
80
|
+
lg: "w-1.5 h-1.5"
|
|
81
|
+
};
|
|
82
|
+
const dotColorMap = {
|
|
83
|
+
default: "bg-foreground",
|
|
84
|
+
primary: "bg-primary",
|
|
85
|
+
success: "bg-success",
|
|
86
|
+
warning: "bg-warning",
|
|
87
|
+
error: "bg-error",
|
|
88
|
+
info: "bg-info"
|
|
89
|
+
};
|
|
90
|
+
const Badge = React.forwardRef(
|
|
91
|
+
({
|
|
92
|
+
className,
|
|
93
|
+
variant = "subtle",
|
|
94
|
+
color = "default",
|
|
95
|
+
size,
|
|
96
|
+
radius,
|
|
97
|
+
icon,
|
|
98
|
+
dot = false,
|
|
99
|
+
removable = false,
|
|
100
|
+
onRemove,
|
|
101
|
+
asChild = false,
|
|
102
|
+
children,
|
|
103
|
+
...props
|
|
104
|
+
}, ref) => {
|
|
105
|
+
const Comp = asChild ? Slot : "span";
|
|
106
|
+
const resolvedSize = size || "default";
|
|
107
|
+
const colorClasses = colorMap[color][variant];
|
|
108
|
+
const outlineClasses = variant === "outline" ? "border bg-transparent" : "";
|
|
109
|
+
const dotColor = variant === "solid" ? "bg-current" : dotColorMap[color];
|
|
110
|
+
return /* @__PURE__ */ React.createElement(
|
|
111
|
+
Comp,
|
|
112
|
+
{
|
|
113
|
+
ref,
|
|
114
|
+
className: cn(
|
|
115
|
+
badgeVariants({ size, radius }),
|
|
116
|
+
colorClasses,
|
|
117
|
+
outlineClasses,
|
|
118
|
+
className
|
|
119
|
+
),
|
|
120
|
+
...props
|
|
121
|
+
},
|
|
122
|
+
dot && /* @__PURE__ */ React.createElement(
|
|
123
|
+
"span",
|
|
124
|
+
{
|
|
125
|
+
className: cn("shrink-0 rounded-full", badgeDotSizes[resolvedSize], dotColor),
|
|
126
|
+
"aria-hidden": "true"
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
icon && /* @__PURE__ */ React.createElement(
|
|
130
|
+
"span",
|
|
131
|
+
{
|
|
132
|
+
className: cn("shrink-0 [&>svg]:w-full [&>svg]:h-full", badgeIconSizes[resolvedSize]),
|
|
133
|
+
"aria-hidden": "true"
|
|
134
|
+
},
|
|
135
|
+
icon
|
|
136
|
+
),
|
|
137
|
+
children,
|
|
138
|
+
removable && /* @__PURE__ */ React.createElement(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
className: "shrink-0 -mr-0.5 ml-0.5 rounded-full p-0.5 opacity-70 hover:opacity-100 transition-opacity focus-visible:focus-ring",
|
|
143
|
+
onClick: (e) => {
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
onRemove?.();
|
|
146
|
+
},
|
|
147
|
+
"aria-label": "Remove"
|
|
148
|
+
},
|
|
149
|
+
/* @__PURE__ */ React.createElement(
|
|
150
|
+
"svg",
|
|
151
|
+
{
|
|
152
|
+
className: "w-3 h-3",
|
|
153
|
+
fill: "none",
|
|
154
|
+
viewBox: "0 0 24 24",
|
|
155
|
+
stroke: "currentColor",
|
|
156
|
+
strokeWidth: 2,
|
|
157
|
+
"aria-hidden": "true"
|
|
158
|
+
},
|
|
159
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
160
|
+
)
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
Badge.displayName = "Badge";
|
|
166
|
+
export {
|
|
167
|
+
Badge,
|
|
168
|
+
badgeVariants
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=badge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/badge.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'\n\n// Badge color maps for variant × color combinations\n// Uses semantic tokens (*.tint, text-text-*) for v4 dark mode compatibility\nconst colorMap = {\n default: {\n solid: 'bg-foreground text-background',\n subtle: 'bg-background-muted text-foreground',\n outline: 'border-border text-foreground',\n },\n primary: {\n solid: 'bg-primary text-primary-foreground',\n subtle: 'bg-primary-tint text-text-primary',\n outline: 'border-primary text-text-primary',\n },\n success: {\n solid: 'bg-success text-success-foreground',\n subtle: 'bg-success-tint text-text-success',\n outline: 'border-success text-text-success',\n },\n warning: {\n solid: 'bg-warning text-warning-foreground',\n subtle: 'bg-warning-tint text-text-warning',\n outline: 'border-warning text-text-warning',\n },\n error: {\n solid: 'bg-error text-error-foreground',\n subtle: 'bg-error-tint text-text-error',\n outline: 'border-error text-text-error',\n },\n info: {\n solid: 'bg-info text-info-foreground',\n subtle: 'bg-info-tint text-text-info',\n outline: 'border-info text-text-info',\n },\n} as const\n\nconst badgeVariants = cva(\n 'inline-flex items-center justify-center whitespace-nowrap font-semibold transition-colors select-none',\n {\n variants: {\n size: {\n sm: 'h-5 min-w-5 px-1.5 text-2xs gap-1', // 20px height, 6px paddingX, 11px font\n default: 'h-6 min-w-6 px-2 text-xs gap-1', // 24px height, 8px paddingX, 12px font\n lg: 'h-7 min-w-7 px-2.5 text-sm gap-1.5', // 28px height, 10px paddingX, 13px font\n },\n radius: {\n sm: 'rounded-sm', // 2px\n base: 'rounded', // 4px\n md: 'rounded-md', // 6px\n lg: 'rounded-lg', // 8px\n full: 'rounded-full', // 9999px\n },\n },\n defaultVariants: {\n size: 'default',\n radius: 'full',\n },\n }\n)\n\n// Icon sizes per badge size\nconst badgeIconSizes = {\n sm: 'icon-2xs', // 12px\n default: 'icon-2xs', // 12px\n lg: 'icon-xs', // 14px\n} as const\n\n// Dot sizes per badge size\nconst badgeDotSizes = {\n sm: 'w-1 h-1',\n default: 'w-1.5 h-1.5',\n lg: 'w-1.5 h-1.5',\n} as const\n\n// Dot colors per color (matches the solid background)\nconst dotColorMap = {\n default: 'bg-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n error: 'bg-error',\n info: 'bg-info',\n} as const\n\nexport type BadgeVariant = 'solid' | 'subtle' | 'outline'\nexport type BadgeColor = 'default' | 'primary' | 'success' | 'warning' | 'error' | 'info'\nexport type BadgeSize = 'sm' | 'default' | 'lg'\nexport type BadgeRadius = 'sm' | 'base' | 'md' | 'lg' | 'full'\n\nexport interface BadgeProps\n extends React.HTMLAttributes<HTMLSpanElement>,\n VariantProps<typeof badgeVariants> {\n /** Visual style */\n variant?: BadgeVariant\n /** Semantic color */\n color?: BadgeColor\n /** Leading icon slot */\n icon?: React.ReactNode\n /** Show a status dot before text */\n dot?: boolean\n /** Show a remove button */\n removable?: boolean\n /** Callback when remove button is clicked */\n onRemove?: () => void\n /** Render as child element (Slot pattern) */\n asChild?: boolean\n}\n\nconst Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n ({\n className,\n variant = 'subtle',\n color = 'default',\n size,\n radius,\n icon,\n dot = false,\n removable = false,\n onRemove,\n asChild = false,\n children,\n ...props\n }, ref) => {\n const Comp = asChild ? Slot : 'span'\n const resolvedSize = size || 'default'\n\n // Color classes from variant × color map\n const colorClasses = colorMap[color][variant]\n // Outline variant needs border\n const outlineClasses = variant === 'outline' ? 'border bg-transparent' : ''\n\n // Dot color: in solid variant use currentColor (white/foreground), otherwise use semantic color\n const dotColor = variant === 'solid' ? 'bg-current' : dotColorMap[color]\n\n return (\n <Comp\n ref={ref}\n className={cn(\n badgeVariants({ size, radius }),\n colorClasses,\n outlineClasses,\n className\n )}\n {...props}\n >\n {dot && (\n <span\n className={cn('shrink-0 rounded-full', badgeDotSizes[resolvedSize], dotColor)}\n aria-hidden=\"true\"\n />\n )}\n {icon && (\n <span\n className={cn('shrink-0 [&>svg]:w-full [&>svg]:h-full', badgeIconSizes[resolvedSize])}\n aria-hidden=\"true\"\n >\n {icon}\n </span>\n )}\n {children}\n {removable && (\n <button\n type=\"button\"\n className=\"shrink-0 -mr-0.5 ml-0.5 rounded-full p-0.5 opacity-70 hover:opacity-100 transition-opacity focus-visible:focus-ring\"\n onClick={(e) => {\n e.stopPropagation()\n onRemove?.()\n }}\n aria-label=\"Remove\"\n >\n <svg\n className=\"w-3 h-3\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n </button>\n )}\n </Comp>\n )\n }\n)\nBadge.displayName = 'Badge'\n\nexport { Badge, badgeVariants }\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const breadcrumbSizeMap: {
|
|
4
|
+
readonly sm: {
|
|
5
|
+
readonly text: "text-xs";
|
|
6
|
+
readonly icon: "icon-xs";
|
|
7
|
+
readonly gap: "gap-1.5";
|
|
8
|
+
};
|
|
9
|
+
readonly default: {
|
|
10
|
+
readonly text: "text-sm";
|
|
11
|
+
readonly icon: "icon-xs";
|
|
12
|
+
readonly gap: "gap-2";
|
|
13
|
+
};
|
|
14
|
+
readonly lg: {
|
|
15
|
+
readonly text: "text-md";
|
|
16
|
+
readonly icon: "icon-sm";
|
|
17
|
+
readonly gap: "gap-2";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
interface BreadcrumbProps extends React.ComponentPropsWithoutRef<'nav'> {
|
|
21
|
+
/** Separator element between items */
|
|
22
|
+
separator?: React.ReactNode;
|
|
23
|
+
/** Size of the breadcrumb */
|
|
24
|
+
size?: 'sm' | 'default' | 'lg';
|
|
25
|
+
/** Max items before collapsing (undefined = no collapse) */
|
|
26
|
+
maxItems?: number;
|
|
27
|
+
/** Items visible before the ellipsis when collapsed */
|
|
28
|
+
itemsBeforeCollapse?: number;
|
|
29
|
+
/** Items visible after the ellipsis when collapsed */
|
|
30
|
+
itemsAfterCollapse?: number;
|
|
31
|
+
}
|
|
32
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
|
|
33
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
34
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
35
|
+
interface BreadcrumbLinkProps extends React.ComponentPropsWithoutRef<'a'> {
|
|
36
|
+
/** Use Radix Slot to compose with custom link components */
|
|
37
|
+
asChild?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<BreadcrumbLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
40
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
41
|
+
declare const BreadcrumbSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
42
|
+
interface BreadcrumbEllipsisProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
43
|
+
}
|
|
44
|
+
declare const BreadcrumbEllipsis: React.ForwardRefExoticComponent<BreadcrumbEllipsisProps & React.RefAttributes<HTMLSpanElement>>;
|
|
45
|
+
|
|
46
|
+
export { Breadcrumb, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps, BreadcrumbSeparator, breadcrumbSizeMap };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare const breadcrumbSizeMap: {
|
|
4
|
+
readonly sm: {
|
|
5
|
+
readonly text: "text-xs";
|
|
6
|
+
readonly icon: "icon-xs";
|
|
7
|
+
readonly gap: "gap-1.5";
|
|
8
|
+
};
|
|
9
|
+
readonly default: {
|
|
10
|
+
readonly text: "text-sm";
|
|
11
|
+
readonly icon: "icon-xs";
|
|
12
|
+
readonly gap: "gap-2";
|
|
13
|
+
};
|
|
14
|
+
readonly lg: {
|
|
15
|
+
readonly text: "text-md";
|
|
16
|
+
readonly icon: "icon-sm";
|
|
17
|
+
readonly gap: "gap-2";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
interface BreadcrumbProps extends React.ComponentPropsWithoutRef<'nav'> {
|
|
21
|
+
/** Separator element between items */
|
|
22
|
+
separator?: React.ReactNode;
|
|
23
|
+
/** Size of the breadcrumb */
|
|
24
|
+
size?: 'sm' | 'default' | 'lg';
|
|
25
|
+
/** Max items before collapsing (undefined = no collapse) */
|
|
26
|
+
maxItems?: number;
|
|
27
|
+
/** Items visible before the ellipsis when collapsed */
|
|
28
|
+
itemsBeforeCollapse?: number;
|
|
29
|
+
/** Items visible after the ellipsis when collapsed */
|
|
30
|
+
itemsAfterCollapse?: number;
|
|
31
|
+
}
|
|
32
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
|
|
33
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
34
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
35
|
+
interface BreadcrumbLinkProps extends React.ComponentPropsWithoutRef<'a'> {
|
|
36
|
+
/** Use Radix Slot to compose with custom link components */
|
|
37
|
+
asChild?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<BreadcrumbLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
40
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
41
|
+
declare const BreadcrumbSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
42
|
+
interface BreadcrumbEllipsisProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
43
|
+
}
|
|
44
|
+
declare const BreadcrumbEllipsis: React.ForwardRefExoticComponent<BreadcrumbEllipsisProps & React.RefAttributes<HTMLSpanElement>>;
|
|
45
|
+
|
|
46
|
+
export { Breadcrumb, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps, BreadcrumbSeparator, breadcrumbSizeMap };
|
|
@@ -0,0 +1,201 @@
|
|
|
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 breadcrumb_exports = {};
|
|
31
|
+
__export(breadcrumb_exports, {
|
|
32
|
+
Breadcrumb: () => Breadcrumb,
|
|
33
|
+
BreadcrumbEllipsis: () => BreadcrumbEllipsis,
|
|
34
|
+
BreadcrumbItem: () => BreadcrumbItem,
|
|
35
|
+
BreadcrumbLink: () => BreadcrumbLink,
|
|
36
|
+
BreadcrumbList: () => BreadcrumbList,
|
|
37
|
+
BreadcrumbPage: () => BreadcrumbPage,
|
|
38
|
+
BreadcrumbSeparator: () => BreadcrumbSeparator,
|
|
39
|
+
breadcrumbSizeMap: () => breadcrumbSizeMap
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(breadcrumb_exports);
|
|
42
|
+
var React = __toESM(require("react"));
|
|
43
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
44
|
+
var import_utils = require("../../lib/utils");
|
|
45
|
+
const BreadcrumbContext = React.createContext({});
|
|
46
|
+
const useBreadcrumbContext = () => React.useContext(BreadcrumbContext);
|
|
47
|
+
function ChevronRightIcon({ className }) {
|
|
48
|
+
return /* @__PURE__ */ React.createElement(
|
|
49
|
+
"svg",
|
|
50
|
+
{
|
|
51
|
+
className,
|
|
52
|
+
fill: "none",
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
stroke: "currentColor",
|
|
55
|
+
strokeWidth: 2
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" })
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function EllipsisIcon({ className }) {
|
|
61
|
+
return /* @__PURE__ */ React.createElement(
|
|
62
|
+
"svg",
|
|
63
|
+
{
|
|
64
|
+
className,
|
|
65
|
+
fill: "currentColor",
|
|
66
|
+
viewBox: "0 0 24 24"
|
|
67
|
+
},
|
|
68
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "6", cy: "12", r: "1.5" }),
|
|
69
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "12", cy: "12", r: "1.5" }),
|
|
70
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "18", cy: "12", r: "1.5" })
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const breadcrumbSizeMap = {
|
|
74
|
+
sm: { text: "text-xs", icon: "icon-xs", gap: "gap-1.5" },
|
|
75
|
+
default: { text: "text-sm", icon: "icon-xs", gap: "gap-2" },
|
|
76
|
+
lg: { text: "text-md", icon: "icon-sm", gap: "gap-2" }
|
|
77
|
+
};
|
|
78
|
+
const Breadcrumb = React.forwardRef(
|
|
79
|
+
({ className, separator, size = "default", ...props }, ref) => /* @__PURE__ */ React.createElement(BreadcrumbContext.Provider, { value: { size, separator } }, /* @__PURE__ */ React.createElement(
|
|
80
|
+
"nav",
|
|
81
|
+
{
|
|
82
|
+
ref,
|
|
83
|
+
"aria-label": "breadcrumb",
|
|
84
|
+
className: (0, import_utils.cn)("", className),
|
|
85
|
+
...props
|
|
86
|
+
}
|
|
87
|
+
))
|
|
88
|
+
);
|
|
89
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
90
|
+
const BreadcrumbList = React.forwardRef(
|
|
91
|
+
({ className, ...props }, ref) => {
|
|
92
|
+
const { size = "default" } = useBreadcrumbContext();
|
|
93
|
+
const sizeClass = breadcrumbSizeMap[size];
|
|
94
|
+
return /* @__PURE__ */ React.createElement(
|
|
95
|
+
"ol",
|
|
96
|
+
{
|
|
97
|
+
ref,
|
|
98
|
+
className: (0, import_utils.cn)(
|
|
99
|
+
"flex flex-wrap items-center",
|
|
100
|
+
sizeClass.gap,
|
|
101
|
+
sizeClass.text,
|
|
102
|
+
"text-text-muted",
|
|
103
|
+
className
|
|
104
|
+
),
|
|
105
|
+
...props
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
111
|
+
const BreadcrumbItem = React.forwardRef(
|
|
112
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
113
|
+
"li",
|
|
114
|
+
{
|
|
115
|
+
ref,
|
|
116
|
+
className: (0, import_utils.cn)("inline-flex items-center gap-1.5", className),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
122
|
+
const BreadcrumbLink = React.forwardRef(
|
|
123
|
+
({ asChild, className, ...props }, ref) => {
|
|
124
|
+
const Comp = asChild ? import_react_slot.Slot : "a";
|
|
125
|
+
return /* @__PURE__ */ React.createElement(
|
|
126
|
+
Comp,
|
|
127
|
+
{
|
|
128
|
+
ref,
|
|
129
|
+
className: (0, import_utils.cn)(
|
|
130
|
+
"transition-colors duration-fast hover:text-foreground",
|
|
131
|
+
className
|
|
132
|
+
),
|
|
133
|
+
...props
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
139
|
+
const BreadcrumbPage = React.forwardRef(
|
|
140
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
141
|
+
"span",
|
|
142
|
+
{
|
|
143
|
+
ref,
|
|
144
|
+
role: "link",
|
|
145
|
+
"aria-disabled": "true",
|
|
146
|
+
"aria-current": "page",
|
|
147
|
+
className: (0, import_utils.cn)("text-foreground", className),
|
|
148
|
+
...props
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
);
|
|
152
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
153
|
+
const BreadcrumbSeparator = React.forwardRef(
|
|
154
|
+
({ children, className, ...props }, ref) => {
|
|
155
|
+
const { separator, size = "default" } = useBreadcrumbContext();
|
|
156
|
+
const sizeClass = breadcrumbSizeMap[size];
|
|
157
|
+
return /* @__PURE__ */ React.createElement(
|
|
158
|
+
"li",
|
|
159
|
+
{
|
|
160
|
+
ref,
|
|
161
|
+
role: "presentation",
|
|
162
|
+
"aria-hidden": "true",
|
|
163
|
+
className: (0, import_utils.cn)("flex items-center text-text-subtle", className),
|
|
164
|
+
...props
|
|
165
|
+
},
|
|
166
|
+
children ?? separator ?? /* @__PURE__ */ React.createElement(ChevronRightIcon, { className: sizeClass.icon })
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
171
|
+
const BreadcrumbEllipsis = React.forwardRef(
|
|
172
|
+
({ className, ...props }, ref) => {
|
|
173
|
+
const { size = "default" } = useBreadcrumbContext();
|
|
174
|
+
const sizeClass = breadcrumbSizeMap[size];
|
|
175
|
+
return /* @__PURE__ */ React.createElement(
|
|
176
|
+
"span",
|
|
177
|
+
{
|
|
178
|
+
ref,
|
|
179
|
+
role: "presentation",
|
|
180
|
+
"aria-hidden": "true",
|
|
181
|
+
className: (0, import_utils.cn)("flex items-center justify-center", className),
|
|
182
|
+
...props
|
|
183
|
+
},
|
|
184
|
+
/* @__PURE__ */ React.createElement(EllipsisIcon, { className: sizeClass.icon }),
|
|
185
|
+
/* @__PURE__ */ React.createElement("span", { className: "sr-only" }, "More")
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
190
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
191
|
+
0 && (module.exports = {
|
|
192
|
+
Breadcrumb,
|
|
193
|
+
BreadcrumbEllipsis,
|
|
194
|
+
BreadcrumbItem,
|
|
195
|
+
BreadcrumbLink,
|
|
196
|
+
BreadcrumbList,
|
|
197
|
+
BreadcrumbPage,
|
|
198
|
+
BreadcrumbSeparator,
|
|
199
|
+
breadcrumbSizeMap
|
|
200
|
+
});
|
|
201
|
+
//# sourceMappingURL=breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/breadcrumb.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'\n\n// ─── Context ──────────────────────────────────────────────\n\ntype BreadcrumbContextValue = {\n size?: 'sm' | 'default' | 'lg'\n separator?: React.ReactNode\n}\n\nconst BreadcrumbContext = React.createContext<BreadcrumbContextValue>({})\nconst useBreadcrumbContext = () => React.useContext(BreadcrumbContext)\n\n// ─── Default Separator Icon ───────────────────────────────\n\nfunction ChevronRightIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M9 5l7 7-7 7\" />\n </svg>\n )\n}\n\n// ─── Ellipsis Icon ────────────────────────────────────────\n\nfunction EllipsisIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <circle cx=\"6\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"12\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"18\" cy=\"12\" r=\"1.5\" />\n </svg>\n )\n}\n\n// ─── Breadcrumb (Root) ────────────────────────────────────\n\nconst breadcrumbSizeMap = {\n sm: { text: 'text-xs', icon: 'icon-xs', gap: 'gap-1.5' },\n default: { text: 'text-sm', icon: 'icon-xs', gap: 'gap-2' },\n lg: { text: 'text-md', icon: 'icon-sm', gap: 'gap-2' },\n} as const\n\nexport interface BreadcrumbProps extends React.ComponentPropsWithoutRef<'nav'> {\n /** Separator element between items */\n separator?: React.ReactNode\n /** Size of the breadcrumb */\n size?: 'sm' | 'default' | 'lg'\n /** Max items before collapsing (undefined = no collapse) */\n maxItems?: number\n /** Items visible before the ellipsis when collapsed */\n itemsBeforeCollapse?: number\n /** Items visible after the ellipsis when collapsed */\n itemsAfterCollapse?: number\n}\n\nconst Breadcrumb = React.forwardRef<HTMLElement, BreadcrumbProps>(\n ({ className, separator, size = 'default', ...props }, ref) => (\n <BreadcrumbContext.Provider value={{ size, separator }}>\n <nav\n ref={ref}\n aria-label=\"breadcrumb\"\n className={cn('', className)}\n {...props}\n />\n </BreadcrumbContext.Provider>\n )\n)\nBreadcrumb.displayName = 'Breadcrumb'\n\n// ─── BreadcrumbList ───────────────────────────────────────\n\nconst BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<'ol'>>(\n ({ className, ...props }, ref) => {\n const { size = 'default' } = useBreadcrumbContext()\n const sizeClass = breadcrumbSizeMap[size]\n return (\n <ol\n ref={ref}\n className={cn(\n 'flex flex-wrap items-center',\n sizeClass.gap,\n sizeClass.text,\n 'text-text-muted',\n className\n )}\n {...props}\n />\n )\n }\n)\nBreadcrumbList.displayName = 'BreadcrumbList'\n\n// ─── BreadcrumbItem ───────────────────────────────────────\n\nconst BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'>>(\n ({ className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn('inline-flex items-center gap-1.5', className)}\n {...props}\n />\n )\n)\nBreadcrumbItem.displayName = 'BreadcrumbItem'\n\n// ─── BreadcrumbLink ───────────────────────────────────────\n\nexport interface BreadcrumbLinkProps extends React.ComponentPropsWithoutRef<'a'> {\n /** Use Radix Slot to compose with custom link components */\n asChild?: boolean\n}\n\nconst BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(\n ({ asChild, className, ...props }, ref) => {\n const Comp = asChild ? Slot : 'a'\n return (\n <Comp\n ref={ref}\n className={cn(\n 'transition-colors duration-fast hover:text-foreground',\n className\n )}\n {...props}\n />\n )\n }\n)\nBreadcrumbLink.displayName = 'BreadcrumbLink'\n\n// ─── BreadcrumbPage ───────────────────────────────────────\n\nconst BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<'span'>>(\n ({ className, ...props }, ref) => (\n <span\n ref={ref}\n role=\"link\"\n aria-disabled=\"true\"\n aria-current=\"page\"\n className={cn('text-foreground', className)}\n {...props}\n />\n )\n)\nBreadcrumbPage.displayName = 'BreadcrumbPage'\n\n// ─── BreadcrumbSeparator ──────────────────────────────────\n\nconst BreadcrumbSeparator = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<'li'>>(\n ({ children, className, ...props }, ref) => {\n const { separator, size = 'default' } = useBreadcrumbContext()\n const sizeClass = breadcrumbSizeMap[size]\n return (\n <li\n ref={ref}\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('flex items-center text-text-subtle', className)}\n {...props}\n >\n {children ?? separator ?? <ChevronRightIcon className={sizeClass.icon} />}\n </li>\n )\n }\n)\nBreadcrumbSeparator.displayName = 'BreadcrumbSeparator'\n\n// ─── BreadcrumbEllipsis ───────────────────────────────────\n\nexport interface BreadcrumbEllipsisProps extends React.ComponentPropsWithoutRef<'span'> {}\n\nconst BreadcrumbEllipsis = React.forwardRef<HTMLSpanElement, BreadcrumbEllipsisProps>(\n ({ className, ...props }, ref) => {\n const { size = 'default' } = useBreadcrumbContext()\n const sizeClass = breadcrumbSizeMap[size]\n return (\n <span\n ref={ref}\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn('flex items-center justify-center', className)}\n {...props}\n >\n <EllipsisIcon className={sizeClass.icon} />\n <span className=\"sr-only\">More</span>\n </span>\n )\n }\n)\nBreadcrumbEllipsis.displayName = 'BreadcrumbEllipsis'\n\n// ─── Exports ──────────────────────────────────────────────\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n breadcrumbSizeMap,\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
const BreadcrumbContext = React.createContext({});
|
|
6
|
+
const useBreadcrumbContext = () => React.useContext(BreadcrumbContext);
|
|
7
|
+
function ChevronRightIcon({ className }) {
|
|
8
|
+
return /* @__PURE__ */ React.createElement(
|
|
9
|
+
"svg",
|
|
10
|
+
{
|
|
11
|
+
className,
|
|
12
|
+
fill: "none",
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
strokeWidth: 2
|
|
16
|
+
},
|
|
17
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" })
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function EllipsisIcon({ className }) {
|
|
21
|
+
return /* @__PURE__ */ React.createElement(
|
|
22
|
+
"svg",
|
|
23
|
+
{
|
|
24
|
+
className,
|
|
25
|
+
fill: "currentColor",
|
|
26
|
+
viewBox: "0 0 24 24"
|
|
27
|
+
},
|
|
28
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "6", cy: "12", r: "1.5" }),
|
|
29
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "12", cy: "12", r: "1.5" }),
|
|
30
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "18", cy: "12", r: "1.5" })
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const breadcrumbSizeMap = {
|
|
34
|
+
sm: { text: "text-xs", icon: "icon-xs", gap: "gap-1.5" },
|
|
35
|
+
default: { text: "text-sm", icon: "icon-xs", gap: "gap-2" },
|
|
36
|
+
lg: { text: "text-md", icon: "icon-sm", gap: "gap-2" }
|
|
37
|
+
};
|
|
38
|
+
const Breadcrumb = React.forwardRef(
|
|
39
|
+
({ className, separator, size = "default", ...props }, ref) => /* @__PURE__ */ React.createElement(BreadcrumbContext.Provider, { value: { size, separator } }, /* @__PURE__ */ React.createElement(
|
|
40
|
+
"nav",
|
|
41
|
+
{
|
|
42
|
+
ref,
|
|
43
|
+
"aria-label": "breadcrumb",
|
|
44
|
+
className: cn("", className),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
))
|
|
48
|
+
);
|
|
49
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
50
|
+
const BreadcrumbList = React.forwardRef(
|
|
51
|
+
({ className, ...props }, ref) => {
|
|
52
|
+
const { size = "default" } = useBreadcrumbContext();
|
|
53
|
+
const sizeClass = breadcrumbSizeMap[size];
|
|
54
|
+
return /* @__PURE__ */ React.createElement(
|
|
55
|
+
"ol",
|
|
56
|
+
{
|
|
57
|
+
ref,
|
|
58
|
+
className: cn(
|
|
59
|
+
"flex flex-wrap items-center",
|
|
60
|
+
sizeClass.gap,
|
|
61
|
+
sizeClass.text,
|
|
62
|
+
"text-text-muted",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
71
|
+
const BreadcrumbItem = React.forwardRef(
|
|
72
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
73
|
+
"li",
|
|
74
|
+
{
|
|
75
|
+
ref,
|
|
76
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
82
|
+
const BreadcrumbLink = React.forwardRef(
|
|
83
|
+
({ asChild, className, ...props }, ref) => {
|
|
84
|
+
const Comp = asChild ? Slot : "a";
|
|
85
|
+
return /* @__PURE__ */ React.createElement(
|
|
86
|
+
Comp,
|
|
87
|
+
{
|
|
88
|
+
ref,
|
|
89
|
+
className: cn(
|
|
90
|
+
"transition-colors duration-fast hover:text-foreground",
|
|
91
|
+
className
|
|
92
|
+
),
|
|
93
|
+
...props
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
99
|
+
const BreadcrumbPage = React.forwardRef(
|
|
100
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
101
|
+
"span",
|
|
102
|
+
{
|
|
103
|
+
ref,
|
|
104
|
+
role: "link",
|
|
105
|
+
"aria-disabled": "true",
|
|
106
|
+
"aria-current": "page",
|
|
107
|
+
className: cn("text-foreground", className),
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
113
|
+
const BreadcrumbSeparator = React.forwardRef(
|
|
114
|
+
({ children, className, ...props }, ref) => {
|
|
115
|
+
const { separator, size = "default" } = useBreadcrumbContext();
|
|
116
|
+
const sizeClass = breadcrumbSizeMap[size];
|
|
117
|
+
return /* @__PURE__ */ React.createElement(
|
|
118
|
+
"li",
|
|
119
|
+
{
|
|
120
|
+
ref,
|
|
121
|
+
role: "presentation",
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
className: cn("flex items-center text-text-subtle", className),
|
|
124
|
+
...props
|
|
125
|
+
},
|
|
126
|
+
children ?? separator ?? /* @__PURE__ */ React.createElement(ChevronRightIcon, { className: sizeClass.icon })
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
131
|
+
const BreadcrumbEllipsis = React.forwardRef(
|
|
132
|
+
({ className, ...props }, ref) => {
|
|
133
|
+
const { size = "default" } = useBreadcrumbContext();
|
|
134
|
+
const sizeClass = breadcrumbSizeMap[size];
|
|
135
|
+
return /* @__PURE__ */ React.createElement(
|
|
136
|
+
"span",
|
|
137
|
+
{
|
|
138
|
+
ref,
|
|
139
|
+
role: "presentation",
|
|
140
|
+
"aria-hidden": "true",
|
|
141
|
+
className: cn("flex items-center justify-center", className),
|
|
142
|
+
...props
|
|
143
|
+
},
|
|
144
|
+
/* @__PURE__ */ React.createElement(EllipsisIcon, { className: sizeClass.icon }),
|
|
145
|
+
/* @__PURE__ */ React.createElement("span", { className: "sr-only" }, "More")
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
150
|
+
export {
|
|
151
|
+
Breadcrumb,
|
|
152
|
+
BreadcrumbEllipsis,
|
|
153
|
+
BreadcrumbItem,
|
|
154
|
+
BreadcrumbLink,
|
|
155
|
+
BreadcrumbList,
|
|
156
|
+
BreadcrumbPage,
|
|
157
|
+
BreadcrumbSeparator,
|
|
158
|
+
breadcrumbSizeMap
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=breadcrumb.mjs.map
|