@karakuri-ui/react 0.2.3 → 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 +0 -1
- 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,175 @@
|
|
|
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 popover_exports = {};
|
|
31
|
+
__export(popover_exports, {
|
|
32
|
+
Popover: () => Popover,
|
|
33
|
+
PopoverAnchor: () => PopoverAnchor,
|
|
34
|
+
PopoverArrow: () => PopoverArrow,
|
|
35
|
+
PopoverClose: () => PopoverClose,
|
|
36
|
+
PopoverContent: () => PopoverContent,
|
|
37
|
+
PopoverPortal: () => PopoverPortal,
|
|
38
|
+
PopoverRoot: () => PopoverRoot,
|
|
39
|
+
PopoverTrigger: () => PopoverTrigger,
|
|
40
|
+
popoverContentVariants: () => popoverContentVariants
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(popover_exports);
|
|
43
|
+
var React = __toESM(require("react"));
|
|
44
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
45
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
46
|
+
var import_utils = require("../../lib/utils");
|
|
47
|
+
const DefaultCloseIcon = ({ className }) => /* @__PURE__ */ React.createElement(
|
|
48
|
+
"svg",
|
|
49
|
+
{
|
|
50
|
+
className,
|
|
51
|
+
fill: "none",
|
|
52
|
+
viewBox: "0 0 24 24",
|
|
53
|
+
stroke: "currentColor",
|
|
54
|
+
strokeWidth: 2,
|
|
55
|
+
"aria-hidden": "true"
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
58
|
+
);
|
|
59
|
+
const ANIMATION_CLASSES = {
|
|
60
|
+
top: "data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit",
|
|
61
|
+
bottom: "data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit",
|
|
62
|
+
left: "data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit",
|
|
63
|
+
right: "data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit"
|
|
64
|
+
};
|
|
65
|
+
const popoverContentVariants = (0, import_class_variance_authority.cva)(
|
|
66
|
+
"relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none",
|
|
67
|
+
{
|
|
68
|
+
variants: {
|
|
69
|
+
variant: {
|
|
70
|
+
default: "bg-background-paper text-foreground border border-border shadow-lg",
|
|
71
|
+
elevated: "bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm"
|
|
72
|
+
},
|
|
73
|
+
size: {
|
|
74
|
+
sm: "text-sm p-3 rounded-lg",
|
|
75
|
+
default: "text-sm p-4 rounded-xl",
|
|
76
|
+
lg: "text-md p-5 rounded-xl"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
defaultVariants: {
|
|
80
|
+
variant: "default",
|
|
81
|
+
size: "default"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const CSS_ARROW_CLASSES = {
|
|
86
|
+
bottom: "-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border",
|
|
87
|
+
top: "-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border",
|
|
88
|
+
right: "-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border",
|
|
89
|
+
left: "-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border"
|
|
90
|
+
};
|
|
91
|
+
const ARROW_ELEVATED = "fill-background-paper drop-shadow-sm";
|
|
92
|
+
function PopoverRoot(props) {
|
|
93
|
+
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Root, { ...props });
|
|
94
|
+
}
|
|
95
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
96
|
+
const PopoverPortal = PopoverPrimitive.Portal;
|
|
97
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
98
|
+
const PopoverClose = PopoverPrimitive.Close;
|
|
99
|
+
const PopoverContent = React.forwardRef(({ className, variant = "default", size, side = "bottom", sideOffset, showArrow = true, showClose = false, closeIcon, children, ...props }, ref) => {
|
|
100
|
+
const resolvedSide = side;
|
|
101
|
+
const resolvedOffset = sideOffset ?? (variant === "default" && showArrow ? 12 : 6);
|
|
102
|
+
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
103
|
+
PopoverPrimitive.Content,
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
side,
|
|
107
|
+
sideOffset: resolvedOffset,
|
|
108
|
+
className: (0, import_utils.cn)(
|
|
109
|
+
popoverContentVariants({ variant, size }),
|
|
110
|
+
ANIMATION_CLASSES[resolvedSide],
|
|
111
|
+
className
|
|
112
|
+
),
|
|
113
|
+
...props
|
|
114
|
+
},
|
|
115
|
+
showClose && /* @__PURE__ */ React.createElement(
|
|
116
|
+
PopoverPrimitive.Close,
|
|
117
|
+
{
|
|
118
|
+
className: "absolute top-3 right-3 rounded-md p-1 text-text-muted hover:text-foreground hover:bg-background-muted transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
119
|
+
"aria-label": "Close"
|
|
120
|
+
},
|
|
121
|
+
closeIcon || /* @__PURE__ */ React.createElement(DefaultCloseIcon, { className: "icon-sm" })
|
|
122
|
+
),
|
|
123
|
+
children,
|
|
124
|
+
showArrow && variant === "default" && /* @__PURE__ */ React.createElement(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: (0, import_utils.cn)(
|
|
128
|
+
"absolute w-2.5 h-2.5 rotate-45 bg-background-paper",
|
|
129
|
+
CSS_ARROW_CLASSES[resolvedSide]
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
showArrow && variant === "elevated" && /* @__PURE__ */ React.createElement(
|
|
134
|
+
PopoverPrimitive.Arrow,
|
|
135
|
+
{
|
|
136
|
+
className: ARROW_ELEVATED,
|
|
137
|
+
width: 12,
|
|
138
|
+
height: 6
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
));
|
|
142
|
+
});
|
|
143
|
+
PopoverContent.displayName = "PopoverContent";
|
|
144
|
+
const PopoverArrow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
145
|
+
PopoverPrimitive.Arrow,
|
|
146
|
+
{
|
|
147
|
+
ref,
|
|
148
|
+
className: (0, import_utils.cn)("fill-background-paper", className),
|
|
149
|
+
width: 10,
|
|
150
|
+
height: 5,
|
|
151
|
+
...props
|
|
152
|
+
}
|
|
153
|
+
));
|
|
154
|
+
PopoverArrow.displayName = "PopoverArrow";
|
|
155
|
+
const Popover = Object.assign(PopoverRoot, {
|
|
156
|
+
Trigger: PopoverTrigger,
|
|
157
|
+
Content: PopoverContent,
|
|
158
|
+
Arrow: PopoverArrow,
|
|
159
|
+
Close: PopoverClose,
|
|
160
|
+
Anchor: PopoverAnchor,
|
|
161
|
+
Portal: PopoverPortal
|
|
162
|
+
});
|
|
163
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
+
0 && (module.exports = {
|
|
165
|
+
Popover,
|
|
166
|
+
PopoverAnchor,
|
|
167
|
+
PopoverArrow,
|
|
168
|
+
PopoverClose,
|
|
169
|
+
PopoverContent,
|
|
170
|
+
PopoverPortal,
|
|
171
|
+
PopoverRoot,
|
|
172
|
+
PopoverTrigger,
|
|
173
|
+
popoverContentVariants
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\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)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<PopoverSide, string> = {\n top: 'data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit',\n bottom: 'data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit',\n left: 'data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit',\n right: 'data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit',\n}\n\n// ─── Content variants ────────────────────────────────────────\nconst popoverContentVariants = cva(\n 'relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none',\n {\n variants: {\n variant: {\n default: 'bg-background-paper text-foreground border border-border shadow-lg',\n elevated: 'bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm',\n },\n size: {\n sm: 'text-sm p-3 rounded-lg',\n default: 'text-sm p-4 rounded-xl',\n lg: 'text-md p-5 rounded-xl',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\n// ─── Arrow styles ──────────────────────────────────────────────\n// default: CSS rotated square with 2-side border (seamless connection)\n// elevated: Radix SVG arrow with drop-shadow (glassmorphism, subtle border)\nconst CSS_ARROW_CLASSES: Record<PopoverSide, string> = {\n bottom: '-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border',\n top: '-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border',\n right: '-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border',\n left: '-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border',\n}\n\nconst ARROW_ELEVATED = 'fill-background-paper drop-shadow-sm'\n\n// ═══════════════════════════════════════════════════════════════\n// Popover\n// ═══════════════════════════════════════════════════════════════\n\n// ─── PopoverRoot — wrapper to avoid Object.assign mutating Radix primitive ──\nexport interface PopoverRootProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\n\nfunction PopoverRoot(props: PopoverRootProps) {\n return <PopoverPrimitive.Root {...props} />\n}\n\n// ─── PopoverTrigger ──────────────────────────────────────────\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\n// ─── PopoverPortal ───────────────────────────────────────────\nconst PopoverPortal = PopoverPrimitive.Portal\n\n// ─── PopoverAnchor ───────────────────────────────────────────\nconst PopoverAnchor = PopoverPrimitive.Anchor\n\n// ─── PopoverClose ────────────────────────────────────────────\nconst PopoverClose = PopoverPrimitive.Close\n\n// ─── PopoverContent ──────────────────────────────────────────\nexport interface PopoverContentProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n VariantProps<typeof popoverContentVariants> {\n /** Show arrow pointing to trigger */\n showArrow?: boolean\n /** Show built-in close button */\n showClose?: boolean\n /** Custom close icon (replaces default X icon) */\n closeIcon?: React.ReactNode\n}\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(({ className, variant = 'default', size, side = 'bottom', sideOffset, showArrow = true, showClose = false, closeIcon, children, ...props }, ref) => {\n const resolvedSide = side as PopoverSide\n // CSS arrow (default) needs more gap since it doesn't occupy layout space\n const resolvedOffset = sideOffset ?? (variant === 'default' && showArrow ? 12 : 6)\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n sideOffset={resolvedOffset}\n className={cn(\n popoverContentVariants({ variant, size }),\n ANIMATION_CLASSES[resolvedSide],\n className,\n )}\n {...props}\n >\n {showClose && (\n <PopoverPrimitive.Close\n className=\"absolute top-3 right-3 rounded-md p-1 text-text-muted hover:text-foreground hover:bg-background-muted transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring\"\n aria-label=\"Close\"\n >\n {closeIcon || <DefaultCloseIcon className=\"icon-sm\" />}\n </PopoverPrimitive.Close>\n )}\n {children}\n {showArrow && variant === 'default' && (\n <div\n className={cn(\n 'absolute w-2.5 h-2.5 rotate-45 bg-background-paper',\n CSS_ARROW_CLASSES[resolvedSide],\n )}\n />\n )}\n {showArrow && variant === 'elevated' && (\n <PopoverPrimitive.Arrow\n className={ARROW_ELEVATED}\n width={12}\n height={6}\n />\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n )\n})\nPopoverContent.displayName = 'PopoverContent'\n\n// ─── PopoverArrow (standalone, for manual placement outside Content) ──\nconst PopoverArrow = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Arrow\n ref={ref}\n className={cn('fill-background-paper', className)}\n width={10}\n height={5}\n {...props}\n />\n))\nPopoverArrow.displayName = 'PopoverArrow'\n\n// ─── Namespace: Popover ──────────────────────────────────────\nconst Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Arrow: PopoverArrow,\n Close: PopoverClose,\n Anchor: PopoverAnchor,\n Portal: PopoverPortal,\n})\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Popover {\n export type ContentProps = PopoverContentProps\n export type RootProps = PopoverRootProps\n}\n\n// ─── Exports ────────────────────────────────────────────────\nexport {\n Popover,\n PopoverRoot,\n PopoverTrigger,\n PopoverContent,\n PopoverArrow,\n PopoverClose,\n PopoverAnchor,\n PopoverPortal,\n popoverContentVariants,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,uBAAkC;AAClC,sCAAuC;AACvC,mBAAmB;AAGnB,MAAM,mBAAmB,CAAC,EAAE,UAAU,MACpC;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,QAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAY;AAAA;AAAA,EAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAC9E;AAOF,MAAM,oBAAiD;AAAA,EACrD,KAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAQ;AAAA,EACR,OAAQ;AACV;AAGA,MAAM,6BAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAKA,MAAM,oBAAiD;AAAA,EACrD,QAAQ;AAAA,EACR,KAAK;AAAA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E,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA,eAAW,iBAAG,yBAAyB,SAAS;AAAA,IAChD,OAAO;AAAA,IACP,QAAQ;AAAA,IACP,GAAG;AAAA;AACN,CACD;AACD,aAAa,cAAc;AAG3B,MAAM,UAAU,OAAO,OAAO,aAAa;AAAA,EACzC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV,CAAC;","names":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const DefaultCloseIcon = ({ className }) => /* @__PURE__ */ React.createElement(
|
|
7
|
+
"svg",
|
|
8
|
+
{
|
|
9
|
+
className,
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: 2,
|
|
14
|
+
"aria-hidden": "true"
|
|
15
|
+
},
|
|
16
|
+
/* @__PURE__ */ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
17
|
+
);
|
|
18
|
+
const ANIMATION_CLASSES = {
|
|
19
|
+
top: "data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit",
|
|
20
|
+
bottom: "data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit",
|
|
21
|
+
left: "data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit",
|
|
22
|
+
right: "data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit"
|
|
23
|
+
};
|
|
24
|
+
const popoverContentVariants = cva(
|
|
25
|
+
"relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none",
|
|
26
|
+
{
|
|
27
|
+
variants: {
|
|
28
|
+
variant: {
|
|
29
|
+
default: "bg-background-paper text-foreground border border-border shadow-lg",
|
|
30
|
+
elevated: "bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm"
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
sm: "text-sm p-3 rounded-lg",
|
|
34
|
+
default: "text-sm p-4 rounded-xl",
|
|
35
|
+
lg: "text-md p-5 rounded-xl"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
defaultVariants: {
|
|
39
|
+
variant: "default",
|
|
40
|
+
size: "default"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
const CSS_ARROW_CLASSES = {
|
|
45
|
+
bottom: "-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border",
|
|
46
|
+
top: "-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border",
|
|
47
|
+
right: "-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border",
|
|
48
|
+
left: "-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border"
|
|
49
|
+
};
|
|
50
|
+
const ARROW_ELEVATED = "fill-background-paper drop-shadow-sm";
|
|
51
|
+
function PopoverRoot(props) {
|
|
52
|
+
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Root, { ...props });
|
|
53
|
+
}
|
|
54
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
55
|
+
const PopoverPortal = PopoverPrimitive.Portal;
|
|
56
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
57
|
+
const PopoverClose = PopoverPrimitive.Close;
|
|
58
|
+
const PopoverContent = React.forwardRef(({ className, variant = "default", size, side = "bottom", sideOffset, showArrow = true, showClose = false, closeIcon, children, ...props }, ref) => {
|
|
59
|
+
const resolvedSide = side;
|
|
60
|
+
const resolvedOffset = sideOffset ?? (variant === "default" && showArrow ? 12 : 6);
|
|
61
|
+
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
62
|
+
PopoverPrimitive.Content,
|
|
63
|
+
{
|
|
64
|
+
ref,
|
|
65
|
+
side,
|
|
66
|
+
sideOffset: resolvedOffset,
|
|
67
|
+
className: cn(
|
|
68
|
+
popoverContentVariants({ variant, size }),
|
|
69
|
+
ANIMATION_CLASSES[resolvedSide],
|
|
70
|
+
className
|
|
71
|
+
),
|
|
72
|
+
...props
|
|
73
|
+
},
|
|
74
|
+
showClose && /* @__PURE__ */ React.createElement(
|
|
75
|
+
PopoverPrimitive.Close,
|
|
76
|
+
{
|
|
77
|
+
className: "absolute top-3 right-3 rounded-md p-1 text-text-muted hover:text-foreground hover:bg-background-muted transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
78
|
+
"aria-label": "Close"
|
|
79
|
+
},
|
|
80
|
+
closeIcon || /* @__PURE__ */ React.createElement(DefaultCloseIcon, { className: "icon-sm" })
|
|
81
|
+
),
|
|
82
|
+
children,
|
|
83
|
+
showArrow && variant === "default" && /* @__PURE__ */ React.createElement(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: cn(
|
|
87
|
+
"absolute w-2.5 h-2.5 rotate-45 bg-background-paper",
|
|
88
|
+
CSS_ARROW_CLASSES[resolvedSide]
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
showArrow && variant === "elevated" && /* @__PURE__ */ React.createElement(
|
|
93
|
+
PopoverPrimitive.Arrow,
|
|
94
|
+
{
|
|
95
|
+
className: ARROW_ELEVATED,
|
|
96
|
+
width: 12,
|
|
97
|
+
height: 6
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
));
|
|
101
|
+
});
|
|
102
|
+
PopoverContent.displayName = "PopoverContent";
|
|
103
|
+
const PopoverArrow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
104
|
+
PopoverPrimitive.Arrow,
|
|
105
|
+
{
|
|
106
|
+
ref,
|
|
107
|
+
className: cn("fill-background-paper", className),
|
|
108
|
+
width: 10,
|
|
109
|
+
height: 5,
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
));
|
|
113
|
+
PopoverArrow.displayName = "PopoverArrow";
|
|
114
|
+
const Popover = Object.assign(PopoverRoot, {
|
|
115
|
+
Trigger: PopoverTrigger,
|
|
116
|
+
Content: PopoverContent,
|
|
117
|
+
Arrow: PopoverArrow,
|
|
118
|
+
Close: PopoverClose,
|
|
119
|
+
Anchor: PopoverAnchor,
|
|
120
|
+
Portal: PopoverPortal
|
|
121
|
+
});
|
|
122
|
+
export {
|
|
123
|
+
Popover,
|
|
124
|
+
PopoverAnchor,
|
|
125
|
+
PopoverArrow,
|
|
126
|
+
PopoverClose,
|
|
127
|
+
PopoverContent,
|
|
128
|
+
PopoverPortal,
|
|
129
|
+
PopoverRoot,
|
|
130
|
+
PopoverTrigger,
|
|
131
|
+
popoverContentVariants
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=popover.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as PopoverPrimitive from '@radix-ui/react-popover'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ─── Default Close Icon (built-in, no external dependency) ──\nconst DefaultCloseIcon = ({ className }: { className?: string }) => (\n <svg\n className={className}\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)\n\n// ─── Types ──────────────────────────────────────────────────\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left'\n\n// ─── Animation class mapping (static strings for Tailwind scanner) ──\nconst ANIMATION_CLASSES: Record<PopoverSide, string> = {\n top: 'data-[state=open]:animate-popover-top-enter data-[state=closed]:animate-popover-top-exit',\n bottom: 'data-[state=open]:animate-popover-bottom-enter data-[state=closed]:animate-popover-bottom-exit',\n left: 'data-[state=open]:animate-popover-left-enter data-[state=closed]:animate-popover-left-exit',\n right: 'data-[state=open]:animate-popover-right-enter data-[state=closed]:animate-popover-right-exit',\n}\n\n// ─── Content variants ────────────────────────────────────────\nconst popoverContentVariants = cva(\n 'relative z-popover font-normal select-none w-auto max-w-[calc(100vw-16px)] outline-none',\n {\n variants: {\n variant: {\n default: 'bg-background-paper text-foreground border border-border shadow-lg',\n elevated: 'bg-background-paper/95 text-foreground border border-border-subtle shadow-xl backdrop-blur-sm',\n },\n size: {\n sm: 'text-sm p-3 rounded-lg',\n default: 'text-sm p-4 rounded-xl',\n lg: 'text-md p-5 rounded-xl',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\n// ─── Arrow styles ──────────────────────────────────────────────\n// default: CSS rotated square with 2-side border (seamless connection)\n// elevated: Radix SVG arrow with drop-shadow (glassmorphism, subtle border)\nconst CSS_ARROW_CLASSES: Record<PopoverSide, string> = {\n bottom: '-top-[5px] left-1/2 -translate-x-1/2 border-t border-l border-border',\n top: '-bottom-[5px] left-1/2 -translate-x-1/2 border-b border-r border-border',\n right: '-left-[5px] top-1/2 -translate-y-1/2 border-b border-l border-border',\n left: '-right-[5px] top-1/2 -translate-y-1/2 border-t border-r border-border',\n}\n\nconst ARROW_ELEVATED = 'fill-background-paper drop-shadow-sm'\n\n// ═══════════════════════════════════════════════════════════════\n// Popover\n// ═══════════════════════════════════════════════════════════════\n\n// ─── PopoverRoot — wrapper to avoid Object.assign mutating Radix primitive ──\nexport interface PopoverRootProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}\n\nfunction PopoverRoot(props: PopoverRootProps) {\n return <PopoverPrimitive.Root {...props} />\n}\n\n// ─── PopoverTrigger ──────────────────────────────────────────\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\n// ─── PopoverPortal ───────────────────────────────────────────\nconst PopoverPortal = PopoverPrimitive.Portal\n\n// ─── PopoverAnchor ───────────────────────────────────────────\nconst PopoverAnchor = PopoverPrimitive.Anchor\n\n// ─── PopoverClose ────────────────────────────────────────────\nconst PopoverClose = PopoverPrimitive.Close\n\n// ─── PopoverContent ──────────────────────────────────────────\nexport interface PopoverContentProps\n extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n VariantProps<typeof popoverContentVariants> {\n /** Show arrow pointing to trigger */\n showArrow?: boolean\n /** Show built-in close button */\n showClose?: boolean\n /** Custom close icon (replaces default X icon) */\n closeIcon?: React.ReactNode\n}\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(({ className, variant = 'default', size, side = 'bottom', sideOffset, showArrow = true, showClose = false, closeIcon, children, ...props }, ref) => {\n const resolvedSide = side as PopoverSide\n // CSS arrow (default) needs more gap since it doesn't occupy layout space\n const resolvedOffset = sideOffset ?? (variant === 'default' && showArrow ? 12 : 6)\n\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n side={side}\n sideOffset={resolvedOffset}\n className={cn(\n popoverContentVariants({ variant, size }),\n ANIMATION_CLASSES[resolvedSide],\n className,\n )}\n {...props}\n >\n {showClose && (\n <PopoverPrimitive.Close\n className=\"absolute top-3 right-3 rounded-md p-1 text-text-muted hover:text-foreground hover:bg-background-muted transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring\"\n aria-label=\"Close\"\n >\n {closeIcon || <DefaultCloseIcon className=\"icon-sm\" />}\n </PopoverPrimitive.Close>\n )}\n {children}\n {showArrow && variant === 'default' && (\n <div\n className={cn(\n 'absolute w-2.5 h-2.5 rotate-45 bg-background-paper',\n CSS_ARROW_CLASSES[resolvedSide],\n )}\n />\n )}\n {showArrow && variant === 'elevated' && (\n <PopoverPrimitive.Arrow\n className={ARROW_ELEVATED}\n width={12}\n height={6}\n />\n )}\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n )\n})\nPopoverContent.displayName = 'PopoverContent'\n\n// ─── PopoverArrow (standalone, for manual placement outside Content) ──\nconst PopoverArrow = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Arrow\n ref={ref}\n className={cn('fill-background-paper', className)}\n width={10}\n height={5}\n {...props}\n />\n))\nPopoverArrow.displayName = 'PopoverArrow'\n\n// ─── Namespace: Popover ──────────────────────────────────────\nconst Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Arrow: PopoverArrow,\n Close: PopoverClose,\n Anchor: PopoverAnchor,\n Portal: PopoverPortal,\n})\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Popover {\n export type ContentProps = PopoverContentProps\n export type RootProps = PopoverRootProps\n}\n\n// ─── Exports ────────────────────────────────────────────────\nexport {\n Popover,\n PopoverRoot,\n PopoverTrigger,\n PopoverContent,\n PopoverArrow,\n PopoverClose,\n PopoverAnchor,\n PopoverPortal,\n popoverContentVariants,\n}\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,sBAAsB;AAClC,SAAS,WAA8B;AACvC,SAAS,UAAU;AAGnB,MAAM,mBAAmB,CAAC,EAAE,UAAU,MACpC;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,QAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAY;AAAA;AAAA,EAEZ,oCAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAC9E;AAOF,MAAM,oBAAiD;AAAA,EACrD,KAAQ;AAAA,EACR,QAAQ;AAAA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BAAiB,WAAU,WAAU;AAAA,IACtD;AAAA,IAED;AAAA,IACA,aAAa,YAAY,aACxB;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,kBAAkB,YAAY;AAAA,QAChC;AAAA;AAAA,IACF;AAAA,IAED,aAAa,YAAY,cACxB;AAAA,MAAC,iBAAiB;AAAA,MAAjB;AAAA,QACC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,QAAQ;AAAA;AAAA,IACV;AAAA,EAEJ,CACF;AAEJ,CAAC;AACD,eAAe,cAAc;AAG7B,MAAM,eAAe,MAAM,WAGzB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC,iBAAiB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,yBAAyB,SAAS;AAAA,IAChD,OAAO;AAAA,IACP,QAAQ;AAAA,IACP,GAAG;AAAA;AACN,CACD;AACD,aAAa,cAAc;AAG3B,MAAM,UAAU,OAAO,OAAO,aAAa;AAAA,EACzC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV,CAAC;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const linearTrackVariants: (props?: ({
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
interface ProgressProps extends Omit<React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>, 'children'>, VariantProps<typeof linearTrackVariants> {
|
|
10
|
+
/** Progress type */
|
|
11
|
+
type?: 'linear' | 'circular';
|
|
12
|
+
/** Current value (0 to max) */
|
|
13
|
+
value?: number;
|
|
14
|
+
/** Maximum value */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** Visual variant (linear only) */
|
|
17
|
+
variant?: 'default' | 'striped';
|
|
18
|
+
/** Indicator color */
|
|
19
|
+
color?: 'default' | 'primary';
|
|
20
|
+
/** Custom indicator class (overrides color) */
|
|
21
|
+
indicatorClassName?: string;
|
|
22
|
+
/** Show percentage value */
|
|
23
|
+
showValue?: boolean;
|
|
24
|
+
/** Custom label formatter */
|
|
25
|
+
formatLabel?: (value: number, max: number) => string;
|
|
26
|
+
/** Animate striped variant */
|
|
27
|
+
animated?: boolean;
|
|
28
|
+
/** Circular stroke thickness override */
|
|
29
|
+
thickness?: number;
|
|
30
|
+
/** Accessibility label */
|
|
31
|
+
label?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
|
|
35
|
+
export { Progress, type ProgressProps, linearTrackVariants };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const linearTrackVariants: (props?: ({
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
interface ProgressProps extends Omit<React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>, 'children'>, VariantProps<typeof linearTrackVariants> {
|
|
10
|
+
/** Progress type */
|
|
11
|
+
type?: 'linear' | 'circular';
|
|
12
|
+
/** Current value (0 to max) */
|
|
13
|
+
value?: number;
|
|
14
|
+
/** Maximum value */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** Visual variant (linear only) */
|
|
17
|
+
variant?: 'default' | 'striped';
|
|
18
|
+
/** Indicator color */
|
|
19
|
+
color?: 'default' | 'primary';
|
|
20
|
+
/** Custom indicator class (overrides color) */
|
|
21
|
+
indicatorClassName?: string;
|
|
22
|
+
/** Show percentage value */
|
|
23
|
+
showValue?: boolean;
|
|
24
|
+
/** Custom label formatter */
|
|
25
|
+
formatLabel?: (value: number, max: number) => string;
|
|
26
|
+
/** Animate striped variant */
|
|
27
|
+
animated?: boolean;
|
|
28
|
+
/** Circular stroke thickness override */
|
|
29
|
+
thickness?: number;
|
|
30
|
+
/** Accessibility label */
|
|
31
|
+
label?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
|
|
35
|
+
export { Progress, type ProgressProps, linearTrackVariants };
|
|
@@ -0,0 +1,194 @@
|
|
|
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 progress_exports = {};
|
|
31
|
+
__export(progress_exports, {
|
|
32
|
+
Progress: () => Progress,
|
|
33
|
+
linearTrackVariants: () => linearTrackVariants
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(progress_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"));
|
|
38
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
39
|
+
var import_utils = require("../../lib/utils");
|
|
40
|
+
const CIRCULAR_VIEWBOX = 100;
|
|
41
|
+
const CIRCULAR_CENTER = 50;
|
|
42
|
+
const CIRCULAR_SIZES = {
|
|
43
|
+
sm: 32,
|
|
44
|
+
default: 48,
|
|
45
|
+
lg: 64
|
|
46
|
+
};
|
|
47
|
+
const CIRCULAR_THICKNESS = {
|
|
48
|
+
sm: 4,
|
|
49
|
+
default: 5,
|
|
50
|
+
lg: 6
|
|
51
|
+
};
|
|
52
|
+
const CIRCULAR_FONT_SIZES = {
|
|
53
|
+
sm: "text-2xs",
|
|
54
|
+
default: "text-xs",
|
|
55
|
+
lg: "text-sm"
|
|
56
|
+
};
|
|
57
|
+
const linearTrackVariants = (0, import_class_variance_authority.cva)(
|
|
58
|
+
"relative w-full overflow-hidden bg-border rounded-full",
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
size: {
|
|
62
|
+
sm: "h-1",
|
|
63
|
+
default: "h-2",
|
|
64
|
+
lg: "h-3"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
size: "default"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
const colorMap = {
|
|
73
|
+
default: "bg-foreground",
|
|
74
|
+
primary: "bg-primary"
|
|
75
|
+
};
|
|
76
|
+
const circularColorMap = {
|
|
77
|
+
default: "stroke-foreground",
|
|
78
|
+
primary: "stroke-primary"
|
|
79
|
+
};
|
|
80
|
+
const valueFontSizes = {
|
|
81
|
+
sm: "text-xs",
|
|
82
|
+
default: "text-sm",
|
|
83
|
+
lg: "text-base"
|
|
84
|
+
};
|
|
85
|
+
const Progress = React.forwardRef(({
|
|
86
|
+
className,
|
|
87
|
+
type = "linear",
|
|
88
|
+
value = 0,
|
|
89
|
+
max = 100,
|
|
90
|
+
size,
|
|
91
|
+
variant = "default",
|
|
92
|
+
color = "default",
|
|
93
|
+
indicatorClassName,
|
|
94
|
+
showValue = false,
|
|
95
|
+
formatLabel,
|
|
96
|
+
animated = false,
|
|
97
|
+
thickness,
|
|
98
|
+
label,
|
|
99
|
+
...props
|
|
100
|
+
}, ref) => {
|
|
101
|
+
const resolvedSize = size || "default";
|
|
102
|
+
const clampedValue = Math.min(Math.max(value, 0), max);
|
|
103
|
+
const percentage = clampedValue / max * 100;
|
|
104
|
+
const valueLabel = formatLabel ? formatLabel(clampedValue, max) : `${Math.round(percentage)}%`;
|
|
105
|
+
if (type === "circular") {
|
|
106
|
+
const diameter = CIRCULAR_SIZES[resolvedSize];
|
|
107
|
+
const strokeWidth = thickness ?? CIRCULAR_THICKNESS[resolvedSize];
|
|
108
|
+
const r = (CIRCULAR_VIEWBOX - strokeWidth) / 2;
|
|
109
|
+
const circumference = 2 * Math.PI * r;
|
|
110
|
+
const offset = circumference * (1 - percentage / 100);
|
|
111
|
+
return /* @__PURE__ */ React.createElement(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: (0, import_utils.cn)("inline-flex items-center gap-2", className),
|
|
115
|
+
role: "progressbar",
|
|
116
|
+
"aria-valuenow": clampedValue,
|
|
117
|
+
"aria-valuemin": 0,
|
|
118
|
+
"aria-valuemax": max,
|
|
119
|
+
"aria-label": label
|
|
120
|
+
},
|
|
121
|
+
/* @__PURE__ */ React.createElement("div", { className: "relative", style: { width: diameter, height: diameter } }, /* @__PURE__ */ React.createElement(
|
|
122
|
+
"svg",
|
|
123
|
+
{
|
|
124
|
+
viewBox: `0 0 ${CIRCULAR_VIEWBOX} ${CIRCULAR_VIEWBOX}`,
|
|
125
|
+
className: "transform -rotate-90",
|
|
126
|
+
width: diameter,
|
|
127
|
+
height: diameter
|
|
128
|
+
},
|
|
129
|
+
/* @__PURE__ */ React.createElement(
|
|
130
|
+
"circle",
|
|
131
|
+
{
|
|
132
|
+
cx: CIRCULAR_CENTER,
|
|
133
|
+
cy: CIRCULAR_CENTER,
|
|
134
|
+
r,
|
|
135
|
+
fill: "none",
|
|
136
|
+
className: "stroke-border",
|
|
137
|
+
strokeWidth
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ React.createElement(
|
|
141
|
+
"circle",
|
|
142
|
+
{
|
|
143
|
+
cx: CIRCULAR_CENTER,
|
|
144
|
+
cy: CIRCULAR_CENTER,
|
|
145
|
+
r,
|
|
146
|
+
fill: "none",
|
|
147
|
+
className: (0, import_utils.cn)(indicatorClassName || circularColorMap[color], "transition-[stroke-dashoffset] duration-normal ease-out"),
|
|
148
|
+
strokeWidth,
|
|
149
|
+
strokeDasharray: circumference,
|
|
150
|
+
strokeDashoffset: offset,
|
|
151
|
+
strokeLinecap: "round"
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
), showValue && resolvedSize !== "sm" && /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)(
|
|
155
|
+
"absolute inset-0 flex items-center justify-center font-semibold font-mono tabular-nums text-foreground",
|
|
156
|
+
CIRCULAR_FONT_SIZES[resolvedSize]
|
|
157
|
+
) }, valueLabel))
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
const stripedBg = variant === "striped" ? "bg-[length:1rem_1rem] bg-[linear-gradient(45deg,rgba(255,255,255,0.15)_25%,transparent_25%,transparent_50%,rgba(255,255,255,0.15)_50%,rgba(255,255,255,0.15)_75%,transparent_75%,transparent)]" : "";
|
|
161
|
+
return /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)("flex items-center gap-3", showValue && "w-full", className) }, /* @__PURE__ */ React.createElement(
|
|
162
|
+
ProgressPrimitive.Root,
|
|
163
|
+
{
|
|
164
|
+
ref,
|
|
165
|
+
className: (0, import_utils.cn)(linearTrackVariants({ size })),
|
|
166
|
+
value: clampedValue,
|
|
167
|
+
max,
|
|
168
|
+
"aria-label": label,
|
|
169
|
+
...props
|
|
170
|
+
},
|
|
171
|
+
/* @__PURE__ */ React.createElement(
|
|
172
|
+
ProgressPrimitive.Indicator,
|
|
173
|
+
{
|
|
174
|
+
className: (0, import_utils.cn)(
|
|
175
|
+
"h-full transition-[width] duration-normal ease-out rounded-full",
|
|
176
|
+
indicatorClassName || colorMap[color],
|
|
177
|
+
stripedBg,
|
|
178
|
+
animated && variant === "striped" && "animate-progress-stripe"
|
|
179
|
+
),
|
|
180
|
+
style: { width: `${percentage}%` }
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
), showValue && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)(
|
|
184
|
+
"shrink-0 font-semibold font-mono tabular-nums text-foreground",
|
|
185
|
+
valueFontSizes[resolvedSize]
|
|
186
|
+
) }, valueLabel));
|
|
187
|
+
});
|
|
188
|
+
Progress.displayName = "Progress";
|
|
189
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
190
|
+
0 && (module.exports = {
|
|
191
|
+
Progress,
|
|
192
|
+
linearTrackVariants
|
|
193
|
+
});
|
|
194
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/progress.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as ProgressPrimitive from '@radix-ui/react-progress'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Circular SVG viewBox size */\nconst CIRCULAR_VIEWBOX = 100\n/** Circular center point */\nconst CIRCULAR_CENTER = 50\n\n/** Circular sizes (diameter in px) */\nconst CIRCULAR_SIZES = {\n sm: 32,\n default: 48,\n lg: 64,\n} as const\n\n/** Circular stroke thickness per size */\nconst CIRCULAR_THICKNESS = {\n sm: 4,\n default: 5,\n lg: 6,\n} as const\n\n/** Circular value font sizes */\nconst CIRCULAR_FONT_SIZES = {\n sm: 'text-2xs',\n default: 'text-xs',\n lg: 'text-sm',\n} as const\n\n// ============================================================================\n// Linear Progress\n// ============================================================================\n\nconst linearTrackVariants = cva(\n 'relative w-full overflow-hidden bg-border rounded-full',\n {\n variants: {\n size: {\n sm: 'h-1',\n default: 'h-2',\n lg: 'h-3',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\nconst colorMap = {\n default: 'bg-foreground',\n primary: 'bg-primary',\n} as const\n\nconst circularColorMap = {\n default: 'stroke-foreground',\n primary: 'stroke-primary',\n} as const\n\nconst valueFontSizes = {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n} as const\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ProgressProps\n extends Omit<React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>, 'children'>,\n VariantProps<typeof linearTrackVariants> {\n /** Progress type */\n type?: 'linear' | 'circular'\n /** Current value (0 to max) */\n value?: number\n /** Maximum value */\n max?: number\n /** Visual variant (linear only) */\n variant?: 'default' | 'striped'\n /** Indicator color */\n color?: 'default' | 'primary'\n /** Custom indicator class (overrides color) */\n indicatorClassName?: string\n /** Show percentage value */\n showValue?: boolean\n /** Custom label formatter */\n formatLabel?: (value: number, max: number) => string\n /** Animate striped variant */\n animated?: boolean\n /** Circular stroke thickness override */\n thickness?: number\n /** Accessibility label */\n label?: string\n}\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n ProgressProps\n>(({\n className,\n type = 'linear',\n value = 0,\n max = 100,\n size,\n variant = 'default',\n color = 'default',\n indicatorClassName,\n showValue = false,\n formatLabel,\n animated = false,\n thickness,\n label,\n ...props\n}, ref) => {\n const resolvedSize = size || 'default'\n const clampedValue = Math.min(Math.max(value, 0), max)\n const percentage = (clampedValue / max) * 100\n\n const valueLabel = formatLabel\n ? formatLabel(clampedValue, max)\n : `${Math.round(percentage)}%`\n\n // ── Circular ──\n if (type === 'circular') {\n const diameter = CIRCULAR_SIZES[resolvedSize]\n const strokeWidth = thickness ?? CIRCULAR_THICKNESS[resolvedSize]\n const r = (CIRCULAR_VIEWBOX - strokeWidth) / 2\n const circumference = 2 * Math.PI * r\n const offset = circumference * (1 - percentage / 100)\n\n return (\n <div\n className={cn('inline-flex items-center gap-2', className)}\n role=\"progressbar\"\n aria-valuenow={clampedValue}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-label={label}\n >\n <div className=\"relative\" style={{ width: diameter, height: diameter }}>\n <svg\n viewBox={`0 0 ${CIRCULAR_VIEWBOX} ${CIRCULAR_VIEWBOX}`}\n className=\"transform -rotate-90\"\n width={diameter}\n height={diameter}\n >\n {/* Track */}\n <circle\n cx={CIRCULAR_CENTER}\n cy={CIRCULAR_CENTER}\n r={r}\n fill=\"none\"\n className=\"stroke-border\"\n strokeWidth={strokeWidth}\n />\n {/* Indicator */}\n <circle\n cx={CIRCULAR_CENTER}\n cy={CIRCULAR_CENTER}\n r={r}\n fill=\"none\"\n className={cn(indicatorClassName || circularColorMap[color], 'transition-[stroke-dashoffset] duration-normal ease-out')}\n strokeWidth={strokeWidth}\n strokeDasharray={circumference}\n strokeDashoffset={offset}\n strokeLinecap=\"round\"\n />\n </svg>\n {/* Center value */}\n {showValue && resolvedSize !== 'sm' && (\n <div className={cn(\n 'absolute inset-0 flex items-center justify-center font-semibold font-mono tabular-nums text-foreground',\n CIRCULAR_FONT_SIZES[resolvedSize]\n )}>\n {valueLabel}\n </div>\n )}\n </div>\n </div>\n )\n }\n\n // ── Linear ──\n const stripedBg = variant === 'striped'\n ? 'bg-[length:1rem_1rem] bg-[linear-gradient(45deg,rgba(255,255,255,0.15)_25%,transparent_25%,transparent_50%,rgba(255,255,255,0.15)_50%,rgba(255,255,255,0.15)_75%,transparent_75%,transparent)]'\n : ''\n\n return (\n <div className={cn('flex items-center gap-3', showValue && 'w-full', className)}>\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(linearTrackVariants({ size }))}\n value={clampedValue}\n max={max}\n aria-label={label}\n {...props}\n >\n <ProgressPrimitive.Indicator\n className={cn(\n 'h-full transition-[width] duration-normal ease-out rounded-full',\n indicatorClassName || colorMap[color],\n stripedBg,\n animated && variant === 'striped' && 'animate-progress-stripe',\n )}\n style={{ width: `${percentage}%` }}\n />\n </ProgressPrimitive.Root>\n {showValue && (\n <span className={cn(\n 'shrink-0 font-semibold font-mono tabular-nums text-foreground',\n valueFontSizes[resolvedSize]\n )}>\n {valueLabel}\n </span>\n )}\n </div>\n )\n})\nProgress.displayName = 'Progress'\n\nexport { Progress, linearTrackVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,wBAAmC;AACnC,sCAAuC;AACvC,mBAAmB;AAOnB,MAAM,mBAAmB;AAEzB,MAAM,kBAAkB;AAGxB,MAAM,iBAAiB;AAAA,EACrB,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AACN;AAGA,MAAM,qBAAqB;AAAA,EACzB,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AACN;AAGA,MAAM,sBAAsB;AAAA,EAC1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