@codefast/ui 0.3.9 → 0.3.11-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +277 -167
- package/dist/components/accordion.cjs +97 -1
- package/dist/components/accordion.js +51 -1
- package/dist/components/alert-dialog.cjs +155 -1
- package/dist/components/alert-dialog.d.ts +2 -2
- package/dist/components/alert-dialog.js +94 -1
- package/dist/components/alert.cjs +84 -1
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/alert.js +41 -1
- package/dist/components/aspect-ratio.cjs +43 -1
- package/dist/components/aspect-ratio.js +9 -1
- package/dist/components/avatar.cjs +65 -1
- package/dist/components/avatar.js +25 -1
- package/dist/components/badge.cjs +66 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +29 -1
- package/dist/components/breadcrumb.cjs +124 -1
- package/dist/components/breadcrumb.js +72 -1
- package/dist/components/button-group.cjs +86 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button-group.js +43 -1
- package/dist/components/button.cjs +92 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.js +55 -1
- package/dist/components/calendar.cjs +150 -1
- package/dist/components/calendar.d.ts +11 -18
- package/dist/components/calendar.js +113 -1
- package/dist/components/card.cjs +105 -1
- package/dist/components/card.js +53 -1
- package/dist/components/carousel.cjs +210 -1
- package/dist/components/carousel.d.ts +1 -1
- package/dist/components/carousel.js +151 -1
- package/dist/components/chart.cjs +250 -3
- package/dist/components/chart.d.ts +5 -4
- package/dist/components/chart.js +198 -3
- package/dist/components/checkbox-cards.cjs +69 -1
- package/dist/components/checkbox-cards.js +32 -1
- package/dist/components/checkbox-group.cjs +63 -1
- package/dist/components/checkbox-group.js +26 -1
- package/dist/components/checkbox.cjs +53 -1
- package/dist/components/checkbox.js +19 -1
- package/dist/components/collapsible.cjs +61 -1
- package/dist/components/collapsible.js +21 -1
- package/dist/components/command.cjs +167 -1
- package/dist/components/command.js +106 -1
- package/dist/components/context-menu.cjs +218 -1
- package/dist/components/context-menu.js +142 -1
- package/dist/components/dialog.cjs +164 -1
- package/dist/components/dialog.d.ts +2 -2
- package/dist/components/dialog.js +106 -1
- package/dist/components/drawer.cjs +143 -1
- package/dist/components/drawer.d.ts +1 -1
- package/dist/components/drawer.js +85 -1
- package/dist/components/dropdown-menu.cjs +221 -1
- package/dist/components/dropdown-menu.js +145 -1
- package/dist/components/empty.cjs +113 -1
- package/dist/components/empty.d.ts +1 -1
- package/dist/components/empty.js +61 -1
- package/dist/components/field.cjs +193 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/field.js +129 -1
- package/dist/components/form.cjs +151 -1
- package/dist/components/form.d.ts +3 -3
- package/dist/components/form.js +96 -1
- package/dist/components/hover-card.cjs +77 -1
- package/dist/components/hover-card.js +34 -1
- package/dist/components/input-group.cjs +155 -1
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/input-group.js +97 -1
- package/dist/components/input-number.cjs +98 -1
- package/dist/components/input-number.js +64 -1
- package/dist/components/input-otp.cjs +101 -1
- package/dist/components/input-otp.js +49 -1
- package/dist/components/input-password.cjs +71 -1
- package/dist/components/input-password.js +37 -1
- package/dist/components/input-search.cjs +80 -1
- package/dist/components/input-search.js +46 -1
- package/dist/components/input.cjs +45 -1
- package/dist/components/input.js +11 -1
- package/dist/components/item.cjs +186 -1
- package/dist/components/item.d.ts +1 -1
- package/dist/components/item.js +119 -1
- package/dist/components/kbd.cjs +54 -1
- package/dist/components/kbd.js +17 -1
- package/dist/components/label.cjs +45 -1
- package/dist/components/label.js +11 -1
- package/dist/components/menubar.cjs +232 -1
- package/dist/components/menubar.js +153 -1
- package/dist/components/native-select.cjs +75 -1
- package/dist/components/native-select.js +35 -1
- package/dist/components/navigation-menu.cjs +146 -2
- package/dist/components/navigation-menu.js +94 -2
- package/dist/components/pagination.cjs +138 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +86 -1
- package/dist/components/popover.cjs +86 -1
- package/dist/components/popover.js +40 -1
- package/dist/components/progress-circle.cjs +184 -1
- package/dist/components/progress-circle.d.ts +1 -1
- package/dist/components/progress-circle.js +147 -1
- package/dist/components/progress.cjs +52 -1
- package/dist/components/progress.js +18 -1
- package/dist/components/radio-cards.cjs +66 -1
- package/dist/components/radio-cards.js +29 -1
- package/dist/components/radio-group.cjs +59 -1
- package/dist/components/radio-group.js +22 -1
- package/dist/components/radio.cjs +47 -1
- package/dist/components/radio.js +13 -1
- package/dist/components/resizable.cjs +71 -1
- package/dist/components/resizable.d.ts +6 -6
- package/dist/components/resizable.js +31 -1
- package/dist/components/scroll-area.cjs +140 -1
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area.js +100 -1
- package/dist/components/select.cjs +180 -1
- package/dist/components/select.d.ts +2 -2
- package/dist/components/select.js +119 -1
- package/dist/components/separator.cjs +82 -1
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +42 -1
- package/dist/components/sheet.cjs +184 -1
- package/dist/components/sheet.d.ts +2 -2
- package/dist/components/sheet.js +123 -1
- package/dist/components/sidebar.cjs +506 -1
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/sidebar.js +400 -1
- package/dist/components/skeleton.cjs +44 -1
- package/dist/components/skeleton.js +10 -1
- package/dist/components/slider.cjs +79 -1
- package/dist/components/slider.js +45 -1
- package/dist/components/sonner.cjs +57 -1
- package/dist/components/sonner.js +17 -1
- package/dist/components/spinner.cjs +75 -1
- package/dist/components/spinner.js +41 -1
- package/dist/components/switch.cjs +49 -1
- package/dist/components/switch.js +15 -1
- package/dist/components/table.cjs +118 -1
- package/dist/components/table.js +63 -1
- package/dist/components/tabs.cjs +75 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +32 -1
- package/dist/components/textarea.cjs +44 -1
- package/dist/components/textarea.js +10 -1
- package/dist/components/toggle-group.cjs +90 -1
- package/dist/components/toggle-group.d.ts +8 -10
- package/dist/components/toggle-group.js +53 -1
- package/dist/components/toggle.cjs +71 -1
- package/dist/components/toggle.d.ts +8 -10
- package/dist/components/toggle.js +34 -1
- package/dist/components/tooltip.cjs +90 -1
- package/dist/components/tooltip.js +44 -1
- package/dist/css/amber.css +95 -1
- package/dist/css/blue.css +95 -1
- package/dist/css/cyan.css +95 -1
- package/dist/css/emerald.css +95 -1
- package/dist/css/fuchsia.css +95 -1
- package/dist/css/gray.css +95 -1
- package/dist/css/green.css +95 -1
- package/dist/css/indigo.css +95 -1
- package/dist/css/lime.css +95 -1
- package/dist/css/neutral.css +95 -1
- package/dist/css/orange.css +95 -1
- package/dist/css/pink.css +95 -1
- package/dist/css/preset.css +118 -1
- package/dist/css/purple.css +95 -1
- package/dist/css/red.css +95 -1
- package/dist/css/rose.css +95 -1
- package/dist/css/sky.css +95 -1
- package/dist/css/slate.css +95 -1
- package/dist/css/stone.css +95 -1
- package/dist/css/style.css +3 -1
- package/dist/css/teal.css +95 -1
- package/dist/css/violet.css +95 -1
- package/dist/css/yellow.css +95 -1
- package/dist/css/zinc.css +95 -1
- package/dist/hooks/use-animated-value.cjs +74 -1
- package/dist/hooks/use-animated-value.d.ts +9 -10
- package/dist/hooks/use-animated-value.js +40 -1
- package/dist/hooks/use-copy-to-clipboard.cjs +57 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +17 -0
- package/dist/hooks/use-copy-to-clipboard.js +23 -1
- package/dist/hooks/use-is-mobile.cjs +39 -1
- package/dist/hooks/use-is-mobile.d.ts +15 -6
- package/dist/hooks/use-is-mobile.js +5 -1
- package/dist/hooks/use-media-query.cjs +56 -1
- package/dist/hooks/use-media-query.d.ts +11 -3
- package/dist/hooks/use-media-query.js +22 -1
- package/dist/hooks/use-mutation-observer.cjs +56 -1
- package/dist/hooks/use-mutation-observer.d.ts +7 -11
- package/dist/hooks/use-mutation-observer.js +22 -1
- package/dist/hooks/use-pagination.cjs +92 -1
- package/dist/hooks/use-pagination.d.ts +12 -10
- package/dist/hooks/use-pagination.js +55 -1
- package/dist/index.cjs +1081 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +69 -1
- package/dist/primitives/checkbox-group.cjs +151 -1
- package/dist/primitives/checkbox-group.d.ts +1 -1
- package/dist/primitives/checkbox-group.js +99 -1
- package/dist/primitives/input-number.cjs +439 -1
- package/dist/primitives/input-number.d.ts +1 -1
- package/dist/primitives/input-number.js +381 -1
- package/dist/primitives/input.cjs +99 -1
- package/dist/primitives/input.d.ts +1 -1
- package/dist/primitives/input.js +53 -1
- package/dist/primitives/progress-circle.cjs +198 -1
- package/dist/primitives/progress-circle.d.ts +1 -1
- package/dist/primitives/progress-circle.js +128 -1
- package/package.json +405 -62
|
@@ -1,4 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
ChartContainer: ()=>ChartContainer,
|
|
29
|
+
ChartLegend: ()=>ChartLegend,
|
|
30
|
+
ChartTooltipContent: ()=>ChartTooltipContent,
|
|
31
|
+
ChartLegendContent: ()=>ChartLegendContent,
|
|
32
|
+
createChartScope: ()=>createChartScope,
|
|
33
|
+
ChartTooltip: ()=>ChartTooltip,
|
|
34
|
+
ChartStyle: ()=>ChartStyle
|
|
35
|
+
});
|
|
36
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
37
|
+
const tailwind_variants_namespaceObject = require("@codefast/tailwind-variants");
|
|
38
|
+
const react_context_namespaceObject = require("@radix-ui/react-context");
|
|
39
|
+
const external_react_namespaceObject = require("react");
|
|
40
|
+
const external_recharts_namespaceObject = require("recharts");
|
|
41
|
+
const THEMES = {
|
|
42
|
+
dark: ".dark",
|
|
43
|
+
light: ""
|
|
44
|
+
};
|
|
45
|
+
const CHART_PROVIDER_NAME = "ChartProvider";
|
|
46
|
+
const [createChartContext, createChartScope] = (0, react_context_namespaceObject.createContextScope)(CHART_PROVIDER_NAME);
|
|
47
|
+
const [ChartContextProvider, useChartContext] = createChartContext(CHART_PROVIDER_NAME);
|
|
48
|
+
function ChartContainer({ __scopeChart, children, className, config, id, ...props }) {
|
|
49
|
+
const uniqueId = (0, external_react_namespaceObject.useId)();
|
|
50
|
+
const chartId = `chart-${id ?? uniqueId}`;
|
|
51
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ChartContextProvider, {
|
|
52
|
+
config: config,
|
|
53
|
+
scope: __scopeChart,
|
|
54
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
55
|
+
className: (0, tailwind_variants_namespaceObject.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
56
|
+
"data-chart": chartId,
|
|
57
|
+
"data-slot": "chart",
|
|
58
|
+
...props,
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ChartStyle, {
|
|
61
|
+
config: config,
|
|
62
|
+
id: chartId
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_recharts_namespaceObject.ResponsiveContainer, {
|
|
65
|
+
children: children
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function ChartStyle({ config, id }) {
|
|
72
|
+
const colorConfig = Object.entries(config).filter(([, itemConfig])=>itemConfig.theme ?? itemConfig.color);
|
|
73
|
+
if (0 === colorConfig.length) return null;
|
|
74
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("style", {
|
|
75
|
+
dangerouslySetInnerHTML: {
|
|
76
|
+
__html: generateChartStyles(id, colorConfig)
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const ChartTooltip = external_recharts_namespaceObject.Tooltip;
|
|
81
|
+
const CHART_TOOLTIP_CONTENT_NAME = "ChartTooltipContent";
|
|
82
|
+
function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [] }) {
|
|
83
|
+
const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
|
|
84
|
+
const tooltipLabel = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
85
|
+
if (hideLabel || 0 === payload.length) return null;
|
|
86
|
+
const [item] = payload;
|
|
87
|
+
const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
|
|
88
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
89
|
+
const value = labelKey || "string" != typeof label ? itemConfig?.label : label in config ? config[label].label ?? label : label;
|
|
90
|
+
if (labelFormatter) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
91
|
+
className: (0, tailwind_variants_namespaceObject.cn)("font-medium", labelClassName),
|
|
92
|
+
children: labelFormatter(value, payload)
|
|
93
|
+
});
|
|
94
|
+
if (!value) return null;
|
|
95
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
96
|
+
className: (0, tailwind_variants_namespaceObject.cn)("font-medium", labelClassName),
|
|
97
|
+
children: value
|
|
98
|
+
});
|
|
99
|
+
}, [
|
|
100
|
+
label,
|
|
101
|
+
labelFormatter,
|
|
102
|
+
payload,
|
|
103
|
+
hideLabel,
|
|
104
|
+
labelClassName,
|
|
105
|
+
config,
|
|
106
|
+
labelKey
|
|
107
|
+
]);
|
|
108
|
+
if (!active || 0 === payload.length) return null;
|
|
109
|
+
const nestLabel = 1 === payload.length && "dot" !== indicator;
|
|
110
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
111
|
+
className: (0, tailwind_variants_namespaceObject.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
112
|
+
children: [
|
|
113
|
+
nestLabel ? null : tooltipLabel,
|
|
114
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
115
|
+
className: "grid gap-1.5",
|
|
116
|
+
children: payload.map((item, index)=>{
|
|
117
|
+
const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
|
|
118
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
119
|
+
const indicatorColor = color ?? (isRecord(item.payload) && "fill" in item.payload && "string" == typeof item.payload.fill ? item.payload.fill : void 0) ?? item.color;
|
|
120
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
121
|
+
className: (0, tailwind_variants_namespaceObject.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground", "dot" === indicator && "items-center"),
|
|
122
|
+
children: formatter && void 0 !== item.value && item.name ? formatter(item.value, item.name, item, index, [
|
|
123
|
+
item
|
|
124
|
+
]) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
125
|
+
children: [
|
|
126
|
+
itemConfig?.icon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(itemConfig.icon, {}) : !hideIndicator && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
127
|
+
className: (0, tailwind_variants_namespaceObject.cn)("shrink-0 rounded-xs border-(--color-border) bg-(--color-bg)", {
|
|
128
|
+
"h-2.5 w-2.5": "dot" === indicator,
|
|
129
|
+
"my-0.5": nestLabel && "dashed" === indicator,
|
|
130
|
+
"border-1.5 w-0 border-dashed bg-transparent": "dashed" === indicator,
|
|
131
|
+
"w-1": "line" === indicator
|
|
132
|
+
}),
|
|
133
|
+
style: {
|
|
134
|
+
"--color-bg": indicatorColor,
|
|
135
|
+
"--color-border": indicatorColor
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
139
|
+
className: (0, tailwind_variants_namespaceObject.cn)("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
140
|
+
children: [
|
|
141
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
142
|
+
className: "grid gap-1.5",
|
|
143
|
+
children: [
|
|
144
|
+
nestLabel ? tooltipLabel : null,
|
|
145
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
146
|
+
className: "text-muted-foreground",
|
|
147
|
+
children: itemConfig?.label ?? item.name
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
}),
|
|
151
|
+
null != item.value && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
152
|
+
className: "font-mono font-medium text-foreground tabular-nums",
|
|
153
|
+
children: "number" == typeof item.value ? item.value.toLocaleString() : safeToString(item.value)
|
|
154
|
+
})
|
|
155
|
+
]
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
})
|
|
159
|
+
}, key);
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const ChartLegend = external_recharts_namespaceObject.Legend;
|
|
166
|
+
const CHART_LEGEND_CONTENT_NAME = "ChartLegendContent";
|
|
167
|
+
function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom" }) {
|
|
168
|
+
const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
|
|
169
|
+
if (!payload?.length) return null;
|
|
170
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
171
|
+
className: (0, tailwind_variants_namespaceObject.cn)("flex items-center justify-center gap-4", "top" === verticalAlign ? "pb-3" : "pt-3", className),
|
|
172
|
+
children: payload.map((item)=>{
|
|
173
|
+
let key = "value";
|
|
174
|
+
if (nameKey) key = nameKey;
|
|
175
|
+
else if (null != item.dataKey) key = safeToString(item.dataKey);
|
|
176
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
177
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
178
|
+
className: (0, tailwind_variants_namespaceObject.cn)("flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:text-muted-foreground"),
|
|
179
|
+
children: [
|
|
180
|
+
itemConfig?.icon && !hideIcon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(itemConfig.icon, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
181
|
+
className: "size-2 shrink-0 rounded-md",
|
|
182
|
+
style: {
|
|
183
|
+
backgroundColor: item.color
|
|
184
|
+
}
|
|
185
|
+
}),
|
|
186
|
+
itemConfig?.label
|
|
187
|
+
]
|
|
188
|
+
}, nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? ""));
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function isRecord(value) {
|
|
193
|
+
return "object" == typeof value && null !== value;
|
|
194
|
+
}
|
|
195
|
+
function getStringValue(record, key) {
|
|
196
|
+
if (key in record) {
|
|
197
|
+
const value = record[key];
|
|
198
|
+
return "string" == typeof value ? value : void 0;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function safeToString(value) {
|
|
202
|
+
if ("string" == typeof value) return value;
|
|
203
|
+
if ("number" == typeof value) return value.toString();
|
|
204
|
+
if (null == value) return "";
|
|
205
|
+
if ("boolean" == typeof value) return value.toString();
|
|
206
|
+
if ("bigint" == typeof value) return value.toString();
|
|
207
|
+
if ("symbol" == typeof value) return value.toString();
|
|
208
|
+
return "";
|
|
209
|
+
}
|
|
210
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
211
|
+
if (!isRecord(payload)) return;
|
|
212
|
+
const payloadPayload = isRecord(payload.payload) ? payload.payload : void 0;
|
|
213
|
+
let configLabelKey = key;
|
|
214
|
+
const payloadValue = getStringValue(payload, key);
|
|
215
|
+
if (payloadValue) configLabelKey = payloadValue;
|
|
216
|
+
else if (payloadPayload) {
|
|
217
|
+
const nestedValue = getStringValue(payloadPayload, key);
|
|
218
|
+
if (nestedValue) configLabelKey = nestedValue;
|
|
219
|
+
}
|
|
220
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
221
|
+
}
|
|
222
|
+
function generateCssVariable(key, itemConfig, theme) {
|
|
223
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
224
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
225
|
+
}
|
|
226
|
+
function generateThemeStyles(theme, prefix, id, colorConfig) {
|
|
227
|
+
const cssVariables = colorConfig.map(([key, itemConfig])=>generateCssVariable(key, itemConfig, theme)).filter(Boolean).join("\n");
|
|
228
|
+
return `${prefix} [data-chart=${id}] {\n${cssVariables}\n}`;
|
|
229
|
+
}
|
|
230
|
+
function generateChartStyles(id, colorConfig) {
|
|
231
|
+
return Object.entries(THEMES).map(([theme, prefix])=>generateThemeStyles(theme, prefix, id, colorConfig)).join("\n\n");
|
|
232
|
+
}
|
|
233
|
+
exports.ChartContainer = __webpack_exports__.ChartContainer;
|
|
234
|
+
exports.ChartLegend = __webpack_exports__.ChartLegend;
|
|
235
|
+
exports.ChartLegendContent = __webpack_exports__.ChartLegendContent;
|
|
236
|
+
exports.ChartStyle = __webpack_exports__.ChartStyle;
|
|
237
|
+
exports.ChartTooltip = __webpack_exports__.ChartTooltip;
|
|
238
|
+
exports.ChartTooltipContent = __webpack_exports__.ChartTooltipContent;
|
|
239
|
+
exports.createChartScope = __webpack_exports__.createChartScope;
|
|
240
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
241
|
+
"ChartContainer",
|
|
242
|
+
"ChartLegend",
|
|
243
|
+
"ChartLegendContent",
|
|
244
|
+
"ChartStyle",
|
|
245
|
+
"ChartTooltip",
|
|
246
|
+
"ChartTooltipContent",
|
|
247
|
+
"createChartScope"
|
|
248
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
249
|
+
Object.defineProperty(exports, '__esModule', {
|
|
250
|
+
value: true
|
|
251
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
1
2
|
import type { ComponentProps, ComponentType, JSX, ReactNode } from "react";
|
|
2
3
|
import type { NameType, Payload, ValueType } from "recharts/types/component/DefaultTooltipContent";
|
|
4
|
+
import type { TooltipContentProps, TooltipProps } from "recharts";
|
|
3
5
|
import * as RechartsPrimitive from "recharts";
|
|
4
|
-
import type { Scope } from "@radix-ui/react-context";
|
|
5
6
|
type ExtractProps<T> = T extends (props: infer P) => ReactNode ? P : never;
|
|
6
7
|
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
7
8
|
declare const THEMES: {
|
|
@@ -32,9 +33,9 @@ interface ChartStyleProps {
|
|
|
32
33
|
id: string;
|
|
33
34
|
}
|
|
34
35
|
declare function ChartStyle({ config, id }: ChartStyleProps): ReactNode;
|
|
35
|
-
type ChartTooltipProps<TValue extends ValueType, TName extends NameType> =
|
|
36
|
+
type ChartTooltipProps<TValue extends ValueType, TName extends NameType> = TooltipProps<TValue, TName>;
|
|
36
37
|
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
37
|
-
type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType> = Omit<MakeOptional<
|
|
38
|
+
type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType> = Omit<MakeOptional<TooltipContentProps<TValue, TName>, "accessibilityLayer" | "active" | "activeIndex" | "coordinate" | "payload">, "payload"> & {
|
|
38
39
|
hideIndicator?: boolean;
|
|
39
40
|
hideLabel?: boolean;
|
|
40
41
|
indicator?: "dashed" | "dot" | "line";
|
|
@@ -46,7 +47,7 @@ type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType>
|
|
|
46
47
|
};
|
|
47
48
|
declare function ChartTooltipContent<TValue extends ValueType, TName extends NameType>({ __scopeChart, active, className, color, formatter, hideIndicator, hideLabel, indicator, label, labelClassName, labelFormatter, labelKey, nameKey, payload, }: ScopedProps<ChartTooltipContentProps<TValue, TName>>): ReactNode;
|
|
48
49
|
type ChartLegendProps = ComponentProps<typeof RechartsPrimitive.Legend>;
|
|
49
|
-
declare const ChartLegend:
|
|
50
|
+
declare const ChartLegend: import("react").MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
50
51
|
type ChartLegendContentProps = ComponentProps<"div"> & ExtractProps<RechartsPrimitive.LegendProps["content"]> & {
|
|
51
52
|
hideIcon?: boolean;
|
|
52
53
|
nameKey?: string;
|
package/dist/components/chart.js
CHANGED
|
@@ -1,4 +1,199 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
5
|
+
import { useId, useMemo } from "react";
|
|
6
|
+
import { Legend, ResponsiveContainer, Tooltip } from "recharts";
|
|
7
|
+
const THEMES = {
|
|
8
|
+
dark: ".dark",
|
|
9
|
+
light: ""
|
|
10
|
+
};
|
|
11
|
+
const CHART_PROVIDER_NAME = "ChartProvider";
|
|
12
|
+
const [createChartContext, createChartScope] = createContextScope(CHART_PROVIDER_NAME);
|
|
13
|
+
const [ChartContextProvider, useChartContext] = createChartContext(CHART_PROVIDER_NAME);
|
|
14
|
+
function ChartContainer({ __scopeChart, children, className, config, id, ...props }) {
|
|
15
|
+
const uniqueId = useId();
|
|
16
|
+
const chartId = `chart-${id ?? uniqueId}`;
|
|
17
|
+
return /*#__PURE__*/ jsx(ChartContextProvider, {
|
|
18
|
+
config: config,
|
|
19
|
+
scope: __scopeChart,
|
|
20
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
21
|
+
className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className),
|
|
22
|
+
"data-chart": chartId,
|
|
23
|
+
"data-slot": "chart",
|
|
24
|
+
...props,
|
|
25
|
+
children: [
|
|
26
|
+
/*#__PURE__*/ jsx(ChartStyle, {
|
|
27
|
+
config: config,
|
|
28
|
+
id: chartId
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ jsx(ResponsiveContainer, {
|
|
31
|
+
children: children
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function ChartStyle({ config, id }) {
|
|
38
|
+
const colorConfig = Object.entries(config).filter(([, itemConfig])=>itemConfig.theme ?? itemConfig.color);
|
|
39
|
+
if (0 === colorConfig.length) return null;
|
|
40
|
+
return /*#__PURE__*/ jsx("style", {
|
|
41
|
+
dangerouslySetInnerHTML: {
|
|
42
|
+
__html: generateChartStyles(id, colorConfig)
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const ChartTooltip = Tooltip;
|
|
47
|
+
const CHART_TOOLTIP_CONTENT_NAME = "ChartTooltipContent";
|
|
48
|
+
function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [] }) {
|
|
49
|
+
const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
|
|
50
|
+
const tooltipLabel = useMemo(()=>{
|
|
51
|
+
if (hideLabel || 0 === payload.length) return null;
|
|
52
|
+
const [item] = payload;
|
|
53
|
+
const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
|
|
54
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
55
|
+
const value = labelKey || "string" != typeof label ? itemConfig?.label : label in config ? config[label].label ?? label : label;
|
|
56
|
+
if (labelFormatter) return /*#__PURE__*/ jsx("div", {
|
|
57
|
+
className: cn("font-medium", labelClassName),
|
|
58
|
+
children: labelFormatter(value, payload)
|
|
59
|
+
});
|
|
60
|
+
if (!value) return null;
|
|
61
|
+
return /*#__PURE__*/ jsx("div", {
|
|
62
|
+
className: cn("font-medium", labelClassName),
|
|
63
|
+
children: value
|
|
64
|
+
});
|
|
65
|
+
}, [
|
|
66
|
+
label,
|
|
67
|
+
labelFormatter,
|
|
68
|
+
payload,
|
|
69
|
+
hideLabel,
|
|
70
|
+
labelClassName,
|
|
71
|
+
config,
|
|
72
|
+
labelKey
|
|
73
|
+
]);
|
|
74
|
+
if (!active || 0 === payload.length) return null;
|
|
75
|
+
const nestLabel = 1 === payload.length && "dot" !== indicator;
|
|
76
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
77
|
+
className: cn("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
78
|
+
children: [
|
|
79
|
+
nestLabel ? null : tooltipLabel,
|
|
80
|
+
/*#__PURE__*/ jsx("div", {
|
|
81
|
+
className: "grid gap-1.5",
|
|
82
|
+
children: payload.map((item, index)=>{
|
|
83
|
+
const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
|
|
84
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
85
|
+
const indicatorColor = color ?? (isRecord(item.payload) && "fill" in item.payload && "string" == typeof item.payload.fill ? item.payload.fill : void 0) ?? item.color;
|
|
86
|
+
return /*#__PURE__*/ jsx("div", {
|
|
87
|
+
className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground", "dot" === indicator && "items-center"),
|
|
88
|
+
children: formatter && void 0 !== item.value && item.name ? formatter(item.value, item.name, item, index, [
|
|
89
|
+
item
|
|
90
|
+
]) : /*#__PURE__*/ jsxs(Fragment, {
|
|
91
|
+
children: [
|
|
92
|
+
itemConfig?.icon ? /*#__PURE__*/ jsx(itemConfig.icon, {}) : !hideIndicator && /*#__PURE__*/ jsx("div", {
|
|
93
|
+
className: cn("shrink-0 rounded-xs border-(--color-border) bg-(--color-bg)", {
|
|
94
|
+
"h-2.5 w-2.5": "dot" === indicator,
|
|
95
|
+
"my-0.5": nestLabel && "dashed" === indicator,
|
|
96
|
+
"border-1.5 w-0 border-dashed bg-transparent": "dashed" === indicator,
|
|
97
|
+
"w-1": "line" === indicator
|
|
98
|
+
}),
|
|
99
|
+
style: {
|
|
100
|
+
"--color-bg": indicatorColor,
|
|
101
|
+
"--color-border": indicatorColor
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ jsxs("div", {
|
|
105
|
+
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
106
|
+
children: [
|
|
107
|
+
/*#__PURE__*/ jsxs("div", {
|
|
108
|
+
className: "grid gap-1.5",
|
|
109
|
+
children: [
|
|
110
|
+
nestLabel ? tooltipLabel : null,
|
|
111
|
+
/*#__PURE__*/ jsx("span", {
|
|
112
|
+
className: "text-muted-foreground",
|
|
113
|
+
children: itemConfig?.label ?? item.name
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
}),
|
|
117
|
+
null != item.value && /*#__PURE__*/ jsx("span", {
|
|
118
|
+
className: "font-mono font-medium text-foreground tabular-nums",
|
|
119
|
+
children: "number" == typeof item.value ? item.value.toLocaleString() : safeToString(item.value)
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
})
|
|
125
|
+
}, key);
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const ChartLegend = Legend;
|
|
132
|
+
const CHART_LEGEND_CONTENT_NAME = "ChartLegendContent";
|
|
133
|
+
function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom" }) {
|
|
134
|
+
const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
|
|
135
|
+
if (!payload?.length) return null;
|
|
136
|
+
return /*#__PURE__*/ jsx("div", {
|
|
137
|
+
className: cn("flex items-center justify-center gap-4", "top" === verticalAlign ? "pb-3" : "pt-3", className),
|
|
138
|
+
children: payload.map((item)=>{
|
|
139
|
+
let key = "value";
|
|
140
|
+
if (nameKey) key = nameKey;
|
|
141
|
+
else if (null != item.dataKey) key = safeToString(item.dataKey);
|
|
142
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
143
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
144
|
+
className: cn("flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:text-muted-foreground"),
|
|
145
|
+
children: [
|
|
146
|
+
itemConfig?.icon && !hideIcon ? /*#__PURE__*/ jsx(itemConfig.icon, {}) : /*#__PURE__*/ jsx("div", {
|
|
147
|
+
className: "size-2 shrink-0 rounded-md",
|
|
148
|
+
style: {
|
|
149
|
+
backgroundColor: item.color
|
|
150
|
+
}
|
|
151
|
+
}),
|
|
152
|
+
itemConfig?.label
|
|
153
|
+
]
|
|
154
|
+
}, nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? ""));
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function isRecord(value) {
|
|
159
|
+
return "object" == typeof value && null !== value;
|
|
160
|
+
}
|
|
161
|
+
function getStringValue(record, key) {
|
|
162
|
+
if (key in record) {
|
|
163
|
+
const value = record[key];
|
|
164
|
+
return "string" == typeof value ? value : void 0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function safeToString(value) {
|
|
168
|
+
if ("string" == typeof value) return value;
|
|
169
|
+
if ("number" == typeof value) return value.toString();
|
|
170
|
+
if (null == value) return "";
|
|
171
|
+
if ("boolean" == typeof value) return value.toString();
|
|
172
|
+
if ("bigint" == typeof value) return value.toString();
|
|
173
|
+
if ("symbol" == typeof value) return value.toString();
|
|
174
|
+
return "";
|
|
175
|
+
}
|
|
176
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
177
|
+
if (!isRecord(payload)) return;
|
|
178
|
+
const payloadPayload = isRecord(payload.payload) ? payload.payload : void 0;
|
|
179
|
+
let configLabelKey = key;
|
|
180
|
+
const payloadValue = getStringValue(payload, key);
|
|
181
|
+
if (payloadValue) configLabelKey = payloadValue;
|
|
182
|
+
else if (payloadPayload) {
|
|
183
|
+
const nestedValue = getStringValue(payloadPayload, key);
|
|
184
|
+
if (nestedValue) configLabelKey = nestedValue;
|
|
185
|
+
}
|
|
186
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
187
|
+
}
|
|
188
|
+
function generateCssVariable(key, itemConfig, theme) {
|
|
189
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
190
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
191
|
+
}
|
|
192
|
+
function generateThemeStyles(theme, prefix, id, colorConfig) {
|
|
193
|
+
const cssVariables = colorConfig.map(([key, itemConfig])=>generateCssVariable(key, itemConfig, theme)).filter(Boolean).join("\n");
|
|
194
|
+
return `${prefix} [data-chart=${id}] {\n${cssVariables}\n}`;
|
|
195
|
+
}
|
|
196
|
+
function generateChartStyles(id, colorConfig) {
|
|
197
|
+
return Object.entries(THEMES).map(([theme, prefix])=>generateThemeStyles(theme, prefix, id, colorConfig)).join("\n\n");
|
|
198
|
+
}
|
|
199
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope };
|
|
@@ -1,2 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
"use client";
|
|
2
|
-
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
CheckboxCards: ()=>CheckboxCards,
|
|
29
|
+
CheckboxCardsItem: ()=>CheckboxCardsItem
|
|
30
|
+
});
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const tailwind_variants_namespaceObject = require("@codefast/tailwind-variants");
|
|
33
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
34
|
+
const external_label_cjs_namespaceObject = require("./label.cjs");
|
|
35
|
+
const checkbox_group_cjs_namespaceObject = require("../primitives/checkbox-group.cjs");
|
|
36
|
+
function CheckboxCards(props) {
|
|
37
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_group_cjs_namespaceObject.Root, {
|
|
38
|
+
"data-slot": "checkbox-cards",
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function CheckboxCardsItem({ checkboxClassName, children, className, ...props }) {
|
|
43
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_label_cjs_namespaceObject.Label, {
|
|
44
|
+
className: (0, tailwind_variants_namespaceObject.cn)("flex items-start gap-3 rounded-lg border border-input p-3 transition hover:not-has-disabled:not-has-aria-checked:bg-secondary has-focus-visible:border-ring has-disabled:opacity-50 has-aria-checked:border-primary has-aria-checked:bg-primary/10", className),
|
|
45
|
+
"data-slot": "checkbox-card",
|
|
46
|
+
children: [
|
|
47
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_group_cjs_namespaceObject.Item, {
|
|
48
|
+
className: (0, tailwind_variants_namespaceObject.cn)("peer flex size-4 shrink-0 rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40", checkboxClassName),
|
|
49
|
+
"data-slot": "checkbox-card-item",
|
|
50
|
+
...props,
|
|
51
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(checkbox_group_cjs_namespaceObject.CheckboxGroupIndicator, {
|
|
52
|
+
"data-slot": "checkbox-card-indicator",
|
|
53
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.CheckIcon, {
|
|
54
|
+
className: "size-3.5"
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
children
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.CheckboxCards = __webpack_exports__.CheckboxCards;
|
|
63
|
+
exports.CheckboxCardsItem = __webpack_exports__.CheckboxCardsItem;
|
|
64
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
65
|
+
"CheckboxCards",
|
|
66
|
+
"CheckboxCardsItem"
|
|
67
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
68
|
+
Object.defineProperty(exports, '__esModule', {
|
|
69
|
+
value: true
|
|
70
|
+
});
|
|
@@ -1,2 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@codefast/tailwind-variants";
|
|
4
|
+
import { CheckIcon } from "lucide-react";
|
|
5
|
+
import { Label } from "./label.js";
|
|
6
|
+
import { CheckboxGroupIndicator, Item, Root } from "../primitives/checkbox-group.js";
|
|
7
|
+
function CheckboxCards(props) {
|
|
8
|
+
return /*#__PURE__*/ jsx(Root, {
|
|
9
|
+
"data-slot": "checkbox-cards",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function CheckboxCardsItem({ checkboxClassName, children, className, ...props }) {
|
|
14
|
+
return /*#__PURE__*/ jsxs(Label, {
|
|
15
|
+
className: cn("flex items-start gap-3 rounded-lg border border-input p-3 transition hover:not-has-disabled:not-has-aria-checked:bg-secondary has-focus-visible:border-ring has-disabled:opacity-50 has-aria-checked:border-primary has-aria-checked:bg-primary/10", className),
|
|
16
|
+
"data-slot": "checkbox-card",
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx(Item, {
|
|
19
|
+
className: cn("peer flex size-4 shrink-0 rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40", checkboxClassName),
|
|
20
|
+
"data-slot": "checkbox-card-item",
|
|
21
|
+
...props,
|
|
22
|
+
children: /*#__PURE__*/ jsx(CheckboxGroupIndicator, {
|
|
23
|
+
"data-slot": "checkbox-card-indicator",
|
|
24
|
+
children: /*#__PURE__*/ jsx(CheckIcon, {
|
|
25
|
+
className: "size-3.5"
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
}),
|
|
29
|
+
children
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export { CheckboxCards, CheckboxCardsItem };
|