@karakuri-ui/react 0.2.2 → 0.2.4
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 +9 -0
- package/dist/components/ui/accordion.d.mts +49 -0
- package/dist/components/ui/accordion.d.ts +49 -0
- package/dist/components/ui/accordion.js +220 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/accordion.mjs +181 -0
- package/dist/components/ui/accordion.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +47 -0
- package/dist/components/ui/alert.d.ts +47 -0
- package/dist/components/ui/alert.js +223 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/alert.mjs +185 -0
- package/dist/components/ui/alert.mjs.map +1 -0
- package/dist/components/ui/avatar.d.mts +232 -0
- package/dist/components/ui/avatar.d.ts +232 -0
- package/dist/components/ui/avatar.js +250 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/avatar.mjs +209 -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 +57 -0
- package/dist/components/ui/breadcrumb.d.ts +57 -0
- package/dist/components/ui/breadcrumb.js +209 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/breadcrumb.mjs +168 -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 +77 -0
- package/dist/components/ui/card.d.ts +77 -0
- package/dist/components/ui/card.js +370 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/card.mjs +328 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/{chart.js → components/ui/chart.js} +29 -39
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/{chart.mjs → components/ui/chart.mjs} +21 -31
- 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 +51 -0
- package/dist/components/ui/drawer.d.ts +51 -0
- package/dist/components/ui/drawer.js +225 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/drawer.mjs +178 -0
- package/dist/components/ui/drawer.mjs.map +1 -0
- package/dist/components/ui/dropdown.d.mts +59 -0
- package/dist/components/ui/dropdown.d.ts +59 -0
- package/dist/components/ui/dropdown.js +310 -0
- package/dist/components/ui/dropdown.js.map +1 -0
- package/dist/components/ui/dropdown.mjs +263 -0
- package/dist/components/ui/dropdown.mjs.map +1 -0
- package/dist/components/ui/field.d.mts +33 -0
- package/dist/components/ui/field.d.ts +33 -0
- package/dist/components/ui/field.js +146 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/field.mjs +108 -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 +476 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +246 -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 +53 -0
- package/dist/components/ui/metric-card.d.ts +53 -0
- package/dist/components/ui/metric-card.js +258 -0
- package/dist/components/ui/metric-card.js.map +1 -0
- package/dist/components/ui/metric-card.mjs +217 -0
- package/dist/components/ui/metric-card.mjs.map +1 -0
- package/dist/components/ui/modal.d.mts +77 -0
- package/dist/components/ui/modal.d.ts +77 -0
- package/dist/components/ui/modal.js +396 -0
- package/dist/components/ui/modal.js.map +1 -0
- package/dist/components/ui/modal.mjs +338 -0
- package/dist/components/ui/modal.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +139 -0
- package/dist/components/ui/navigation-menu.d.ts +139 -0
- package/dist/components/ui/navigation-menu.js +531 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/navigation-menu.mjs +488 -0
- package/dist/components/ui/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/pagination.d.mts +130 -0
- package/dist/components/ui/pagination.d.ts +130 -0
- package/dist/components/ui/pagination.js +495 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/pagination.mjs +449 -0
- package/dist/components/ui/pagination.mjs.map +1 -0
- package/dist/components/ui/popover.d.mts +41 -0
- package/dist/components/ui/popover.d.ts +41 -0
- package/dist/components/ui/popover.js +175 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/popover.mjs +133 -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 +40 -0
- package/dist/components/ui/radio-group.d.ts +40 -0
- package/dist/components/ui/radio-group.js +177 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/radio-group.mjs +140 -0
- package/dist/components/ui/radio-group.mjs.map +1 -0
- package/dist/components/ui/segmented.d.mts +30 -0
- package/dist/components/ui/segmented.d.ts +30 -0
- package/dist/components/ui/segmented.js +241 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/segmented.mjs +204 -0
- package/dist/components/ui/segmented.mjs.map +1 -0
- package/dist/components/ui/select.d.mts +31 -0
- package/dist/components/ui/select.d.ts +31 -0
- package/dist/components/ui/select.js +317 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/select.mjs +276 -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 +74 -0
- package/dist/components/ui/table.d.ts +74 -0
- package/dist/components/ui/table.js +240 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/table.mjs +199 -0
- package/dist/components/ui/table.mjs.map +1 -0
- package/dist/components/ui/tabs.d.mts +40 -0
- package/dist/components/ui/tabs.d.ts +40 -0
- package/dist/components/ui/tabs.js +238 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/tabs.mjs +199 -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 +47 -0
- package/dist/components/ui/toggle-group.d.ts +47 -0
- package/dist/components/ui/toggle-group.js +186 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-group.mjs +149 -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 +37 -0
- package/dist/components/ui/tooltip.d.ts +37 -0
- package/dist/components/ui/tooltip.js +137 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +96 -0
- package/dist/components/ui/tooltip.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
- /package/dist/{chart.d.mts → components/ui/chart.d.mts} +0 -0
- /package/dist/{chart.d.ts → components/ui/chart.d.ts} +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
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 badge_exports = {};
|
|
31
|
+
__export(badge_exports, {
|
|
32
|
+
Badge: () => Badge,
|
|
33
|
+
badgeVariants: () => badgeVariants
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(badge_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
38
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
39
|
+
var import_utils = require("../../lib/utils");
|
|
40
|
+
const colorMap = {
|
|
41
|
+
default: {
|
|
42
|
+
solid: "bg-foreground text-background",
|
|
43
|
+
subtle: "bg-background-muted text-foreground",
|
|
44
|
+
outline: "border-border text-foreground"
|
|
45
|
+
},
|
|
46
|
+
primary: {
|
|
47
|
+
solid: "bg-primary text-primary-foreground",
|
|
48
|
+
subtle: "bg-primary-tint text-text-primary",
|
|
49
|
+
outline: "border-primary text-text-primary"
|
|
50
|
+
},
|
|
51
|
+
success: {
|
|
52
|
+
solid: "bg-success text-success-foreground",
|
|
53
|
+
subtle: "bg-success-tint text-text-success",
|
|
54
|
+
outline: "border-success text-text-success"
|
|
55
|
+
},
|
|
56
|
+
warning: {
|
|
57
|
+
solid: "bg-warning text-warning-foreground",
|
|
58
|
+
subtle: "bg-warning-tint text-text-warning",
|
|
59
|
+
outline: "border-warning text-text-warning"
|
|
60
|
+
},
|
|
61
|
+
error: {
|
|
62
|
+
solid: "bg-error text-error-foreground",
|
|
63
|
+
subtle: "bg-error-tint text-text-error",
|
|
64
|
+
outline: "border-error text-text-error"
|
|
65
|
+
},
|
|
66
|
+
info: {
|
|
67
|
+
solid: "bg-info text-info-foreground",
|
|
68
|
+
subtle: "bg-info-tint text-text-info",
|
|
69
|
+
outline: "border-info text-text-info"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const badgeVariants = (0, import_class_variance_authority.cva)(
|
|
73
|
+
"inline-flex items-center justify-center whitespace-nowrap font-semibold transition-colors select-none",
|
|
74
|
+
{
|
|
75
|
+
variants: {
|
|
76
|
+
size: {
|
|
77
|
+
sm: "h-5 min-w-5 px-1.5 text-2xs gap-1",
|
|
78
|
+
// 20px height, 6px paddingX, 11px font
|
|
79
|
+
default: "h-6 min-w-6 px-2 text-xs gap-1",
|
|
80
|
+
// 24px height, 8px paddingX, 12px font
|
|
81
|
+
lg: "h-7 min-w-7 px-2.5 text-sm gap-1.5"
|
|
82
|
+
// 28px height, 10px paddingX, 13px font
|
|
83
|
+
},
|
|
84
|
+
radius: {
|
|
85
|
+
sm: "rounded-sm",
|
|
86
|
+
// 2px
|
|
87
|
+
base: "rounded",
|
|
88
|
+
// 4px
|
|
89
|
+
md: "rounded-md",
|
|
90
|
+
// 6px
|
|
91
|
+
lg: "rounded-lg",
|
|
92
|
+
// 8px
|
|
93
|
+
full: "rounded-full"
|
|
94
|
+
// 9999px
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
defaultVariants: {
|
|
98
|
+
size: "default",
|
|
99
|
+
radius: "full"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
const badgeIconSizes = {
|
|
104
|
+
sm: "icon-2xs",
|
|
105
|
+
// 12px
|
|
106
|
+
default: "icon-2xs",
|
|
107
|
+
// 12px
|
|
108
|
+
lg: "icon-xs"
|
|
109
|
+
// 14px
|
|
110
|
+
};
|
|
111
|
+
const badgeDotSizes = {
|
|
112
|
+
sm: "w-1 h-1",
|
|
113
|
+
default: "w-1.5 h-1.5",
|
|
114
|
+
lg: "w-1.5 h-1.5"
|
|
115
|
+
};
|
|
116
|
+
const dotColorMap = {
|
|
117
|
+
default: "bg-foreground",
|
|
118
|
+
primary: "bg-primary",
|
|
119
|
+
success: "bg-success",
|
|
120
|
+
warning: "bg-warning",
|
|
121
|
+
error: "bg-error",
|
|
122
|
+
info: "bg-info"
|
|
123
|
+
};
|
|
124
|
+
const Badge = React.forwardRef(
|
|
125
|
+
({
|
|
126
|
+
className,
|
|
127
|
+
variant = "subtle",
|
|
128
|
+
color = "default",
|
|
129
|
+
size,
|
|
130
|
+
radius,
|
|
131
|
+
icon,
|
|
132
|
+
dot = false,
|
|
133
|
+
removable = false,
|
|
134
|
+
onRemove,
|
|
135
|
+
asChild = false,
|
|
136
|
+
children,
|
|
137
|
+
...props
|
|
138
|
+
}, ref) => {
|
|
139
|
+
const Comp = asChild ? import_react_slot.Slot : "span";
|
|
140
|
+
const resolvedSize = size || "default";
|
|
141
|
+
const colorClasses = colorMap[color][variant];
|
|
142
|
+
const outlineClasses = variant === "outline" ? "border bg-transparent" : "";
|
|
143
|
+
const dotColor = variant === "solid" ? "bg-current" : dotColorMap[color];
|
|
144
|
+
return /* @__PURE__ */ React.createElement(
|
|
145
|
+
Comp,
|
|
146
|
+
{
|
|
147
|
+
ref,
|
|
148
|
+
className: (0, import_utils.cn)(
|
|
149
|
+
badgeVariants({ size, radius }),
|
|
150
|
+
colorClasses,
|
|
151
|
+
outlineClasses,
|
|
152
|
+
className
|
|
153
|
+
),
|
|
154
|
+
...props
|
|
155
|
+
},
|
|
156
|
+
dot && /* @__PURE__ */ React.createElement(
|
|
157
|
+
"span",
|
|
158
|
+
{
|
|
159
|
+
className: (0, import_utils.cn)("shrink-0 rounded-full", badgeDotSizes[resolvedSize], dotColor),
|
|
160
|
+
"aria-hidden": "true"
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
icon && /* @__PURE__ */ React.createElement(
|
|
164
|
+
"span",
|
|
165
|
+
{
|
|
166
|
+
className: (0, import_utils.cn)("shrink-0 [&>svg]:w-full [&>svg]:h-full", badgeIconSizes[resolvedSize]),
|
|
167
|
+
"aria-hidden": "true"
|
|
168
|
+
},
|
|
169
|
+
icon
|
|
170
|
+
),
|
|
171
|
+
children,
|
|
172
|
+
removable && /* @__PURE__ */ React.createElement(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "button",
|
|
176
|
+
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",
|
|
177
|
+
onClick: (e) => {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
onRemove?.();
|
|
180
|
+
},
|
|
181
|
+
"aria-label": "Remove"
|
|
182
|
+
},
|
|
183
|
+
/* @__PURE__ */ React.createElement(
|
|
184
|
+
"svg",
|
|
185
|
+
{
|
|
186
|
+
className: "w-3 h-3",
|
|
187
|
+
fill: "none",
|
|
188
|
+
viewBox: "0 0 24 24",
|
|
189
|
+
stroke: "currentColor",
|
|
190
|
+
strokeWidth: 2,
|
|
191
|
+
"aria-hidden": "true"
|
|
192
|
+
},
|
|
193
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
Badge.displayName = "Badge";
|
|
200
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
201
|
+
0 && (module.exports = {
|
|
202
|
+
Badge,
|
|
203
|
+
badgeVariants
|
|
204
|
+
});
|
|
205
|
+
//# sourceMappingURL=badge.js.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,wBAAqB;AACrB,sCAAuC;AACvC,mBAAmB;AAInB,MAAM,WAAW;AAAA,EACf,SAAS;AAAA,IACP,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,OAAO;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AACF;AAEA,MAAM,oBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,MAAM;AAAA;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,MAAM;AAAA;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAGA,MAAM,iBAAiB;AAAA,EACrB,IAAI;AAAA;AAAA,EACJ,SAAS;AAAA;AAAA,EACT,IAAI;AAAA;AACN;AAGA,MAAM,gBAAgB;AAAA,EACpB,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AACN;AAGA,MAAM,cAAc;AAAA,EAClB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR;AA0BA,MAAM,QAAQ,MAAM;AAAA,EAClB,CAAC;AAAA,IACC;AAAA,IACA,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,YAAY;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,GAAG,QAAQ;AACT,UAAM,OAAO,UAAU,yBAAO;AAC9B,UAAM,eAAe,QAAQ;AAG7B,UAAM,eAAe,SAAS,KAAK,EAAE,OAAO;AAE5C,UAAM,iBAAiB,YAAY,YAAY,0BAA0B;AAGzE,UAAM,WAAW,YAAY,UAAU,eAAe,YAAY,KAAK;AAEvE,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW;AAAA,UACT,cAAc,EAAE,MAAM,OAAO,CAAC;AAAA,UAC9B;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACC,GAAG;AAAA;AAAA,MAEH,OACC;AAAA,QAAC;AAAA;AAAA,UACC,eAAW,iBAAG,yBAAyB,cAAc,YAAY,GAAG,QAAQ;AAAA,UAC5E,eAAY;AAAA;AAAA,MACd;AAAA,MAED,QACC;AAAA,QAAC;AAAA;AAAA,UACC,eAAW,iBAAG,0CAA0C,eAAe,YAAY,CAAC;AAAA,UACpF,eAAY;AAAA;AAAA,QAEX;AAAA,MACH;AAAA,MAED;AAAA,MACA,aACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,SAAS,CAAC,MAAM;AACd,cAAE,gBAAgB;AAClB,uBAAW;AAAA,UACb;AAAA,UACA,cAAW;AAAA;AAAA,QAEX;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,QAAO;AAAA,YACP,aAAa;AAAA,YACb,eAAY;AAAA;AAAA,UAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAAA,QAC9E;AAAA,MACF;AAAA,IAEJ;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;","names":[]}
|
|
@@ -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,57 @@
|
|
|
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 BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
33
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
34
|
+
interface BreadcrumbLinkProps extends React.ComponentPropsWithoutRef<'a'> {
|
|
35
|
+
/** Use Radix Slot to compose with custom link components */
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}
|
|
38
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<BreadcrumbLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
39
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
40
|
+
declare const BreadcrumbSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
41
|
+
interface BreadcrumbEllipsisProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
42
|
+
}
|
|
43
|
+
declare const BreadcrumbEllipsis: React.ForwardRefExoticComponent<BreadcrumbEllipsisProps & React.RefAttributes<HTMLSpanElement>>;
|
|
44
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>> & {
|
|
45
|
+
List: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
46
|
+
Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
47
|
+
Link: React.ForwardRefExoticComponent<BreadcrumbLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
48
|
+
Page: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
49
|
+
Separator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
50
|
+
Ellipsis: React.ForwardRefExoticComponent<BreadcrumbEllipsisProps & React.RefAttributes<HTMLSpanElement>>;
|
|
51
|
+
};
|
|
52
|
+
declare namespace Breadcrumb {
|
|
53
|
+
type LinkProps = BreadcrumbLinkProps;
|
|
54
|
+
type EllipsisProps = BreadcrumbEllipsisProps;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Breadcrumb, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps, BreadcrumbSeparator, breadcrumbSizeMap };
|
|
@@ -0,0 +1,57 @@
|
|
|
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 BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
33
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
34
|
+
interface BreadcrumbLinkProps extends React.ComponentPropsWithoutRef<'a'> {
|
|
35
|
+
/** Use Radix Slot to compose with custom link components */
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}
|
|
38
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<BreadcrumbLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
39
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
40
|
+
declare const BreadcrumbSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
41
|
+
interface BreadcrumbEllipsisProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
42
|
+
}
|
|
43
|
+
declare const BreadcrumbEllipsis: React.ForwardRefExoticComponent<BreadcrumbEllipsisProps & React.RefAttributes<HTMLSpanElement>>;
|
|
44
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>> & {
|
|
45
|
+
List: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
46
|
+
Item: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
47
|
+
Link: React.ForwardRefExoticComponent<BreadcrumbLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
48
|
+
Page: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
49
|
+
Separator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
50
|
+
Ellipsis: React.ForwardRefExoticComponent<BreadcrumbEllipsisProps & React.RefAttributes<HTMLSpanElement>>;
|
|
51
|
+
};
|
|
52
|
+
declare namespace Breadcrumb {
|
|
53
|
+
type LinkProps = BreadcrumbLinkProps;
|
|
54
|
+
type EllipsisProps = BreadcrumbEllipsisProps;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { Breadcrumb, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps, BreadcrumbSeparator, breadcrumbSizeMap };
|