@codefast/ui 0.3.11 → 0.3.12-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 +15 -0
- package/README.md +4 -0
- package/dist/components/accordion.d.ts +11 -29
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +10 -37
- package/dist/components/alert-dialog.d.ts +25 -60
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +16 -69
- package/dist/components/alert.d.ts +16 -27
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +22 -30
- package/dist/components/aspect-ratio.d.ts +5 -8
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +5 -7
- package/dist/components/avatar.d.ts +7 -17
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +7 -18
- package/dist/components/badge.d.ts +15 -21
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +23 -20
- package/dist/components/breadcrumb.d.ts +13 -35
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +13 -49
- package/dist/components/button-group.d.ts +15 -29
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button-group.js +22 -27
- package/dist/components/button.d.ts +26 -35
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +43 -51
- package/dist/components/calendar.d.ts +10 -24
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +75 -92
- package/dist/components/card.d.ts +11 -34
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +11 -39
- package/dist/components/carousel.d.ts +25 -55
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +82 -114
- package/dist/components/chart.d.ts +37 -72
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +161 -150
- package/dist/components/checkbox-cards.d.ts +9 -15
- package/dist/components/checkbox-cards.d.ts.map +1 -0
- package/dist/components/checkbox-cards.js +8 -22
- package/dist/components/checkbox-group.d.ts +9 -16
- package/dist/components/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox-group.js +7 -19
- package/dist/components/checkbox.d.ts +5 -9
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +6 -14
- package/dist/components/collapsible.d.ts +7 -14
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +7 -15
- package/dist/components/command.d.ts +24 -55
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +18 -69
- package/dist/components/context-menu.d.ts +23 -72
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +21 -89
- package/dist/components/dialog.d.ts +23 -53
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +20 -72
- package/dist/components/drawer.d.ts +29 -60
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +16 -58
- package/dist/components/dropdown-menu.d.ts +23 -73
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +21 -96
- package/dist/components/empty.d.ts +16 -37
- package/dist/components/empty.d.ts.map +1 -0
- package/dist/components/empty.js +24 -44
- package/dist/components/field.d.ts +26 -63
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +46 -89
- package/dist/components/form.d.ts +16 -37
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +50 -66
- package/dist/components/hover-card.d.ts +8 -21
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +8 -23
- package/dist/components/input-group.d.ts +29 -53
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +59 -66
- package/dist/components/input-number.d.ts +8 -28
- package/dist/components/input-number.d.ts.map +1 -0
- package/dist/components/input-number.js +14 -55
- package/dist/components/input-otp.d.ts +11 -24
- package/dist/components/input-otp.d.ts.map +1 -0
- package/dist/components/input-otp.js +13 -34
- package/dist/components/input-password.d.ts +6 -12
- package/dist/components/input-password.d.ts.map +1 -0
- package/dist/components/input-password.js +10 -31
- package/dist/components/input-search.d.ts +9 -18
- package/dist/components/input-search.d.ts.map +1 -0
- package/dist/components/input-search.js +16 -44
- package/dist/components/input.d.ts +5 -10
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +5 -9
- package/dist/components/item.d.ts +33 -69
- package/dist/components/item.d.ts.map +1 -0
- package/dist/components/item.js +47 -90
- package/dist/components/kbd.d.ts +6 -13
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +6 -13
- package/dist/components/label.d.ts +5 -9
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +5 -8
- package/dist/components/menubar.d.ts +24 -80
- package/dist/components/menubar.d.ts.map +1 -0
- package/dist/components/menubar.js +23 -99
- package/dist/components/native-select.d.ts +7 -16
- package/dist/components/native-select.d.ts.map +1 -0
- package/dist/components/native-select.js +7 -25
- package/dist/components/navigation-menu.d.ts +13 -36
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu.js +25 -61
- package/dist/components/pagination.d.ts +15 -35
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +13 -55
- package/dist/components/popover.d.ts +9 -24
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +9 -27
- package/dist/components/progress-circle.d.ts +89 -106
- package/dist/components/progress-circle.d.ts.map +1 -0
- package/dist/components/progress-circle.js +70 -103
- package/dist/components/progress.d.ts +5 -10
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +7 -13
- package/dist/components/radio-cards.d.ts +5 -10
- package/dist/components/radio-cards.d.ts.map +1 -0
- package/dist/components/radio-cards.js +7 -21
- package/dist/components/radio-group.d.ts +6 -13
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +6 -17
- package/dist/components/radio.d.ts +6 -12
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/radio.js +5 -10
- package/dist/components/resizable.d.ts +8 -18
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +7 -21
- package/dist/components/scroll-area.d.ts +21 -33
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +64 -84
- package/dist/components/select.d.ts +17 -50
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +26 -78
- package/dist/components/separator.d.ts +20 -29
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +27 -36
- package/dist/components/sheet.d.ts +30 -62
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +36 -80
- package/dist/components/sidebar.d.ts +67 -160
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +166 -301
- package/dist/components/skeleton.d.ts +5 -9
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +5 -8
- package/dist/components/slider.d.ts +5 -13
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +12 -34
- package/dist/components/sonner.d.ts +8 -10
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +13 -16
- package/dist/components/spinner.d.ts +6 -12
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +20 -33
- package/dist/components/switch.d.ts +5 -9
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +5 -12
- package/dist/components/table.d.ts +12 -37
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +12 -47
- package/dist/components/tabs.d.ts +8 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +8 -23
- package/dist/components/textarea.d.ts +5 -9
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +5 -8
- package/dist/components/toggle-group.d.ts +10 -24
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +20 -38
- package/dist/components/toggle.d.ts +18 -25
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +24 -29
- package/dist/components/tooltip.d.ts +9 -24
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +9 -28
- package/dist/hooks/use-animated-value.d.ts +2 -4
- package/dist/hooks/use-animated-value.d.ts.map +1 -0
- package/dist/hooks/use-animated-value.js +67 -58
- package/dist/hooks/use-copy-to-clipboard.d.ts +6 -11
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +42 -39
- package/dist/hooks/use-is-mobile.d.ts +2 -4
- package/dist/hooks/use-is-mobile.d.ts.map +1 -0
- package/dist/hooks/use-is-mobile.js +20 -23
- package/dist/hooks/use-media-query.d.ts +2 -4
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +49 -46
- package/dist/hooks/use-mutation-observer.d.ts +3 -6
- package/dist/hooks/use-mutation-observer.d.ts.map +1 -0
- package/dist/hooks/use-mutation-observer.js +33 -34
- package/dist/hooks/use-pagination.d.ts +15 -22
- package/dist/hooks/use-pagination.d.ts.map +1 -0
- package/dist/hooks/use-pagination.js +99 -99
- package/dist/index.d.ts +131 -69
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -69
- package/dist/primitives/checkbox-group.d.ts +84 -105
- package/dist/primitives/checkbox-group.d.ts.map +1 -0
- package/dist/primitives/checkbox-group.js +91 -105
- package/dist/primitives/input-number.d.ts +41 -51
- package/dist/primitives/input-number.d.ts.map +1 -0
- package/dist/primitives/input-number.js +417 -473
- package/dist/primitives/input.d.ts +43 -48
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +67 -66
- package/dist/primitives/progress-circle.d.ts +49 -79
- package/dist/primitives/progress-circle.d.ts.map +1 -0
- package/dist/primitives/progress-circle.js +134 -149
- package/package.json +17 -10
- package/{dist → src}/css/preset.css +1 -1
- /package/{dist → src}/css/amber.css +0 -0
- /package/{dist → src}/css/blue.css +0 -0
- /package/{dist → src}/css/cyan.css +0 -0
- /package/{dist → src}/css/emerald.css +0 -0
- /package/{dist → src}/css/fuchsia.css +0 -0
- /package/{dist → src}/css/gray.css +0 -0
- /package/{dist → src}/css/green.css +0 -0
- /package/{dist → src}/css/indigo.css +0 -0
- /package/{dist → src}/css/lime.css +0 -0
- /package/{dist → src}/css/neutral.css +0 -0
- /package/{dist → src}/css/orange.css +0 -0
- /package/{dist → src}/css/pink.css +0 -0
- /package/{dist → src}/css/purple.css +0 -0
- /package/{dist → src}/css/red.css +0 -0
- /package/{dist → src}/css/rose.css +0 -0
- /package/{dist → src}/css/sky.css +0 -0
- /package/{dist → src}/css/slate.css +0 -0
- /package/{dist → src}/css/stone.css +0 -0
- /package/{dist → src}/css/style.css +0 -0
- /package/{dist → src}/css/teal.css +0 -0
- /package/{dist → src}/css/violet.css +0 -0
- /package/{dist → src}/css/yellow.css +0 -0
- /package/{dist → src}/css/zinc.css +0 -0
package/dist/components/chart.js
CHANGED
|
@@ -1,187 +1,198 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { cn } from "@codefast/tailwind-variants";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useId, useMemo } from "react";
|
|
5
4
|
import { createContextScope } from "@radix-ui/react-context";
|
|
5
|
+
import { useId, useMemo } from "react";
|
|
6
6
|
import * as RechartsPrimitive from "recharts";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Chart Configuration and Theme Constants
|
|
9
|
+
* --------------------------------------------------------------------------- */
|
|
10
|
+
const THEMES = { dark: ".dark", light: "" };
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Context: ChartProvider
|
|
13
|
+
* --------------------------------------------------------------------------- */
|
|
12
14
|
const CHART_PROVIDER_NAME = "ChartProvider";
|
|
13
15
|
const [createChartContext, createChartScope] = createContextScope(CHART_PROVIDER_NAME);
|
|
14
16
|
const [ChartContextProvider, useChartContext] = createChartContext(CHART_PROVIDER_NAME);
|
|
15
17
|
function ChartContainer({ __scopeChart, children, className, config, id, ...props }) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
config,
|
|
20
|
-
scope: __scopeChart,
|
|
21
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
22
|
-
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),
|
|
23
|
-
"data-chart": chartId,
|
|
24
|
-
"data-slot": "chart",
|
|
25
|
-
...props,
|
|
26
|
-
children: [/* @__PURE__ */ jsx(ChartStyle, {
|
|
27
|
-
config,
|
|
28
|
-
id: chartId
|
|
29
|
-
}), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, { children })]
|
|
30
|
-
})
|
|
31
|
-
});
|
|
18
|
+
const uniqueId = useId();
|
|
19
|
+
const chartId = `chart-${id ?? uniqueId}`;
|
|
20
|
+
return (_jsx(ChartContextProvider, { config: config, scope: __scopeChart, children: _jsxs("div", { 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), "data-chart": chartId, "data-slot": "chart", ...props, children: [_jsx(ChartStyle, { config: config, id: chartId }), _jsx(RechartsPrimitive.ResponsiveContainer, { children: children })] }) }));
|
|
32
21
|
}
|
|
33
22
|
function ChartStyle({ config, id }) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
const colorConfig = Object.entries(config).filter(([, itemConfig]) => itemConfig.theme ?? itemConfig.color);
|
|
24
|
+
if (colorConfig.length === 0) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return (_jsx("style", { dangerouslySetInnerHTML: {
|
|
28
|
+
__html: generateChartStyles(id, colorConfig),
|
|
29
|
+
} }));
|
|
37
30
|
}
|
|
38
31
|
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
32
|
+
/* -----------------------------------------------------------------------------
|
|
33
|
+
* Component: ChartTooltipContent
|
|
34
|
+
* -------------------------------------------------------------------------- */
|
|
39
35
|
const CHART_TOOLTIP_CONTENT_NAME = "ChartTooltipContent";
|
|
40
|
-
function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [] }) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
89
|
-
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
90
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
91
|
-
className: "grid gap-1.5",
|
|
92
|
-
children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsx("span", {
|
|
93
|
-
className: "text-muted-foreground",
|
|
94
|
-
children: itemConfig?.label ?? item.name
|
|
95
|
-
})]
|
|
96
|
-
}), item.value != null && /* @__PURE__ */ jsx("span", {
|
|
97
|
-
className: "font-mono font-medium text-foreground tabular-nums",
|
|
98
|
-
children: typeof item.value === "number" ? item.value.toLocaleString() : safeToString(item.value)
|
|
99
|
-
})]
|
|
100
|
-
})] })
|
|
101
|
-
}, key);
|
|
102
|
-
})
|
|
103
|
-
})]
|
|
104
|
-
});
|
|
36
|
+
function ChartTooltipContent({ __scopeChart, active, className, color, formatter, hideIndicator = false, hideLabel = false, indicator = "dot", label, labelClassName, labelFormatter, labelKey, nameKey, payload = [], }) {
|
|
37
|
+
const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);
|
|
38
|
+
const tooltipLabel = useMemo(() => {
|
|
39
|
+
if (hideLabel || payload.length === 0) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const [item] = payload;
|
|
43
|
+
const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
|
|
44
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
45
|
+
const value = !labelKey && typeof label === "string"
|
|
46
|
+
? label in config
|
|
47
|
+
? (config[label].label ?? label)
|
|
48
|
+
: label
|
|
49
|
+
: itemConfig?.label;
|
|
50
|
+
if (labelFormatter) {
|
|
51
|
+
return (_jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) }));
|
|
52
|
+
}
|
|
53
|
+
if (!value) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return _jsx("div", { className: cn("font-medium", labelClassName), children: value });
|
|
57
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
58
|
+
if (!active || payload.length === 0) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
62
|
+
return (_jsxs("div", { 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), children: [nestLabel ? null : tooltipLabel, _jsx("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
|
|
63
|
+
const key = safeToString(nameKey ?? item.name ?? item.dataKey ?? "value");
|
|
64
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
65
|
+
const indicatorColor = color ??
|
|
66
|
+
(isRecord(item.payload) &&
|
|
67
|
+
"fill" in item.payload &&
|
|
68
|
+
typeof item.payload.fill === "string"
|
|
69
|
+
? item.payload.fill
|
|
70
|
+
: undefined) ??
|
|
71
|
+
item.color;
|
|
72
|
+
return (_jsx("div", { className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"), children: formatter && item.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, [item])) : (_jsxs(_Fragment, { children: [itemConfig?.icon ? (_jsx(itemConfig.icon, {})) : (!hideIndicator && (_jsx("div", { className: cn("shrink-0 rounded-xs border-(--color-border) bg-(--color-bg)", {
|
|
73
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
74
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
75
|
+
"border-1.5 w-0 border-dashed bg-transparent": indicator === "dashed",
|
|
76
|
+
"w-1": indicator === "line",
|
|
77
|
+
}), style: {
|
|
78
|
+
"--color-bg": indicatorColor,
|
|
79
|
+
"--color-border": indicatorColor,
|
|
80
|
+
} }))), _jsxs("div", { className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"), children: [_jsxs("div", { className: "grid gap-1.5", children: [nestLabel ? tooltipLabel : null, _jsx("span", { className: "text-muted-foreground", children: itemConfig?.label ?? item.name })] }), item.value != null && (_jsx("span", { className: "font-mono font-medium text-foreground tabular-nums", children: typeof item.value === "number"
|
|
81
|
+
? item.value.toLocaleString()
|
|
82
|
+
: safeToString(item.value) }))] })] })) }, key));
|
|
83
|
+
}) })] }));
|
|
105
84
|
}
|
|
106
85
|
const ChartLegend = RechartsPrimitive.Legend;
|
|
86
|
+
/* -----------------------------------------------------------------------------
|
|
87
|
+
* Component: ChartLegendContent
|
|
88
|
+
* -------------------------------------------------------------------------- */
|
|
107
89
|
const CHART_LEGEND_CONTENT_NAME = "ChartLegendContent";
|
|
108
|
-
function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom" }) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
});
|
|
90
|
+
function ChartLegendContent({ __scopeChart, className, hideIcon = false, nameKey, payload, verticalAlign = "bottom", }) {
|
|
91
|
+
const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);
|
|
92
|
+
if (!payload?.length) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return (_jsx("div", { className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className), children: payload.map((item) => {
|
|
96
|
+
let key = "value";
|
|
97
|
+
if (nameKey) {
|
|
98
|
+
key = nameKey;
|
|
99
|
+
}
|
|
100
|
+
else if (item.dataKey != null) {
|
|
101
|
+
key = safeToString(item.dataKey);
|
|
102
|
+
}
|
|
103
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
104
|
+
return (_jsxs("div", { className: cn("flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:text-muted-foreground"), children: [itemConfig?.icon && !hideIcon ? (_jsx(itemConfig.icon, {})) : (_jsx("div", { className: "size-2 shrink-0 rounded-md", style: {
|
|
105
|
+
backgroundColor: item.color,
|
|
106
|
+
} })), itemConfig?.label] }, nameKey ? safeToString(itemConfig?.color ?? "") : safeToString(item.value ?? "")));
|
|
107
|
+
}) }));
|
|
127
108
|
}
|
|
109
|
+
/* -----------------------------------------------------------------------------
|
|
110
|
+
* Helpers
|
|
111
|
+
* -------------------------------------------------------------------------- */
|
|
128
112
|
/**
|
|
129
|
-
* Type guard to check if an unknown value is a record with string keys
|
|
130
|
-
*/
|
|
113
|
+
* Type guard to check if an unknown value is a record with string keys
|
|
114
|
+
*/
|
|
131
115
|
function isRecord(value) {
|
|
132
|
-
|
|
116
|
+
return typeof value === "object" && value !== null;
|
|
133
117
|
}
|
|
134
118
|
/**
|
|
135
|
-
* Safely gets a string value from a record by key
|
|
136
|
-
*/
|
|
119
|
+
* Safely gets a string value from a record by key
|
|
120
|
+
*/
|
|
137
121
|
function getStringValue(record, key) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
122
|
+
if (key in record) {
|
|
123
|
+
const value = record[key];
|
|
124
|
+
return typeof value === "string" ? value : undefined;
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
142
127
|
}
|
|
143
128
|
/**
|
|
144
|
-
* Safely converts a value to string without type coercion
|
|
145
|
-
*/
|
|
129
|
+
* Safely converts a value to string without type coercion
|
|
130
|
+
*/
|
|
146
131
|
function safeToString(value) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
132
|
+
if (typeof value === "string") {
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
if (typeof value === "number") {
|
|
136
|
+
return value.toString();
|
|
137
|
+
}
|
|
138
|
+
if (value === null || value === undefined) {
|
|
139
|
+
return "";
|
|
140
|
+
}
|
|
141
|
+
if (typeof value === "boolean") {
|
|
142
|
+
return value.toString();
|
|
143
|
+
}
|
|
144
|
+
if (typeof value === "bigint") {
|
|
145
|
+
return value.toString();
|
|
146
|
+
}
|
|
147
|
+
if (typeof value === "symbol") {
|
|
148
|
+
return value.toString();
|
|
149
|
+
}
|
|
150
|
+
// For objects, arrays, functions, and other complex types, return empty string to avoid [object Object]
|
|
151
|
+
return "";
|
|
154
152
|
}
|
|
155
153
|
function getPayloadConfigFromPayload(config, payload, key) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
154
|
+
if (!isRecord(payload)) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
const payloadPayload = isRecord(payload.payload) ? payload.payload : undefined;
|
|
158
|
+
let configLabelKey = key;
|
|
159
|
+
// Try to get the config key from the payload first
|
|
160
|
+
const payloadValue = getStringValue(payload, key);
|
|
161
|
+
if (payloadValue) {
|
|
162
|
+
configLabelKey = payloadValue;
|
|
163
|
+
}
|
|
164
|
+
else if (payloadPayload) {
|
|
165
|
+
// If not found in the payload, try the nested payload
|
|
166
|
+
const nestedValue = getStringValue(payloadPayload, key);
|
|
167
|
+
if (nestedValue) {
|
|
168
|
+
configLabelKey = nestedValue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
166
172
|
}
|
|
167
173
|
/**
|
|
168
|
-
* Generates CSS custom property for a specific theme and config item
|
|
169
|
-
*/
|
|
174
|
+
* Generates CSS custom property for a specific theme and config item
|
|
175
|
+
*/
|
|
170
176
|
function generateCssVariable(key, itemConfig, theme) {
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
178
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
173
179
|
}
|
|
174
180
|
/**
|
|
175
|
-
* Generates CSS rules for a specific theme
|
|
176
|
-
*/
|
|
181
|
+
* Generates CSS rules for a specific theme
|
|
182
|
+
*/
|
|
177
183
|
function generateThemeStyles(theme, prefix, id, colorConfig) {
|
|
178
|
-
|
|
184
|
+
const cssVariables = colorConfig
|
|
185
|
+
.map(([key, itemConfig]) => generateCssVariable(key, itemConfig, theme))
|
|
186
|
+
.filter(Boolean)
|
|
187
|
+
.join("\n");
|
|
188
|
+
return `${prefix} [data-chart=${id}] {\n${cssVariables}\n}`;
|
|
179
189
|
}
|
|
180
190
|
/**
|
|
181
|
-
* Generates complete CSS styles for all themes
|
|
182
|
-
*/
|
|
191
|
+
* Generates complete CSS styles for all themes
|
|
192
|
+
*/
|
|
183
193
|
function generateChartStyles(id, colorConfig) {
|
|
184
|
-
|
|
194
|
+
return Object.entries(THEMES)
|
|
195
|
+
.map(([theme, prefix]) => generateThemeStyles(theme, prefix, id, colorConfig))
|
|
196
|
+
.join("\n\n");
|
|
185
197
|
}
|
|
186
|
-
|
|
187
|
-
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope };
|
|
198
|
+
export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, createChartScope, };
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
//#region src/components/checkbox-cards.d.ts
|
|
5
|
-
type CheckboxCardsProps = ComponentProps<typeof CheckboxGroup>;
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
|
+
import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
|
|
3
|
+
type CheckboxCardsProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
|
|
6
4
|
declare function CheckboxCards(props: CheckboxCardsProps): JSX.Element;
|
|
7
|
-
interface CheckboxCardsItemProps extends ComponentProps<typeof
|
|
8
|
-
|
|
5
|
+
interface CheckboxCardsItemProps extends ComponentProps<typeof CheckboxGroupPrimitive.Item> {
|
|
6
|
+
checkboxClassName?: string;
|
|
9
7
|
}
|
|
10
|
-
declare function CheckboxCardsItem({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
...props
|
|
15
|
-
}: CheckboxCardsItemProps): JSX.Element;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { CheckboxCards, CheckboxCardsItem, type CheckboxCardsItemProps, type CheckboxCardsProps };
|
|
8
|
+
declare function CheckboxCardsItem({ checkboxClassName, children, className, ...props }: CheckboxCardsItemProps): JSX.Element;
|
|
9
|
+
export { CheckboxCards, CheckboxCardsItem };
|
|
10
|
+
export type { CheckboxCardsItemProps, CheckboxCardsProps };
|
|
11
|
+
//# sourceMappingURL=checkbox-cards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-cards.d.ts","sourceRoot":"","sources":["../../src/components/checkbox-cards.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjD,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AAMrE,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAE7E,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAE7D;AAMD,UAAU,sBAAuB,SAAQ,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,iBAAS,iBAAiB,CAAC,EACzB,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CAwBtC;AAMD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC5C,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { CheckboxGroup, CheckboxGroupIndicator, CheckboxGroupItem } from "../primitives/checkbox-group.js";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { cn } from "@codefast/tailwind-variants";
|
|
5
4
|
import { CheckIcon } from "lucide-react";
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { Label } from "#components/label";
|
|
6
|
+
import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
|
|
8
7
|
function CheckboxCards(props) {
|
|
9
|
-
|
|
10
|
-
"data-slot": "checkbox-cards",
|
|
11
|
-
...props
|
|
12
|
-
});
|
|
8
|
+
return _jsx(CheckboxGroupPrimitive.Root, { "data-slot": "checkbox-cards", ...props });
|
|
13
9
|
}
|
|
14
10
|
function CheckboxCardsItem({ checkboxClassName, children, className, ...props }) {
|
|
15
|
-
|
|
16
|
-
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),
|
|
17
|
-
"data-slot": "checkbox-card",
|
|
18
|
-
children: [/* @__PURE__ */ jsx(CheckboxGroupItem, {
|
|
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, { className: "size-3.5" })
|
|
25
|
-
})
|
|
26
|
-
}), children]
|
|
27
|
-
});
|
|
11
|
+
return (_jsxs(Label, { 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), "data-slot": "checkbox-card", children: [_jsx(CheckboxGroupPrimitive.Item, { 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), "data-slot": "checkbox-card-item", ...props, children: _jsx(CheckboxGroupPrimitive.CheckboxGroupIndicator, { "data-slot": "checkbox-card-indicator", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }), children] }));
|
|
28
12
|
}
|
|
29
|
-
|
|
13
|
+
/* -----------------------------------------------------------------------------
|
|
14
|
+
* Exports
|
|
15
|
+
* -------------------------------------------------------------------------- */
|
|
30
16
|
export { CheckboxCards, CheckboxCardsItem };
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
declare function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupItem$1>;
|
|
11
|
-
declare function CheckboxGroupItem({
|
|
12
|
-
className,
|
|
13
|
-
...props
|
|
14
|
-
}: CheckboxGroupItemProps): JSX.Element;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { CheckboxGroup, CheckboxGroupItem, type CheckboxGroupItemProps, type CheckboxGroupProps };
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
|
+
import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
|
|
3
|
+
type CheckboxGroupProps = ComponentProps<typeof CheckboxGroupPrimitive.Root>;
|
|
4
|
+
declare function CheckboxGroup({ className, ...props }: CheckboxGroupProps): JSX.Element;
|
|
5
|
+
type CheckboxGroupItemProps = ComponentProps<typeof CheckboxGroupPrimitive.Item>;
|
|
6
|
+
declare function CheckboxGroupItem({ className, ...props }: CheckboxGroupItemProps): JSX.Element;
|
|
7
|
+
export { CheckboxGroup, CheckboxGroupItem };
|
|
8
|
+
export type { CheckboxGroupItemProps, CheckboxGroupProps };
|
|
9
|
+
//# sourceMappingURL=checkbox-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../src/components/checkbox-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,sBAAsB,MAAM,4BAA4B,CAAC;AAMrE,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAE7E,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAQ/E;AAMD,KAAK,sBAAsB,GAAG,cAAc,CAAC,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AAEjF,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CAkBvF;AAMD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;AAC5C,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
4
|
import { CheckIcon } from "lucide-react";
|
|
5
|
-
import
|
|
6
|
-
//#region src/components/checkbox-group.tsx
|
|
5
|
+
import * as CheckboxGroupPrimitive from "#primitives/checkbox-group";
|
|
7
6
|
function CheckboxGroup({ className, ...props }) {
|
|
8
|
-
|
|
9
|
-
className: cn("grid gap-2", className),
|
|
10
|
-
"data-slot": "checkbox-group",
|
|
11
|
-
...props
|
|
12
|
-
});
|
|
7
|
+
return (_jsx(CheckboxGroupPrimitive.Root, { className: cn("grid gap-2", className), "data-slot": "checkbox-group", ...props }));
|
|
13
8
|
}
|
|
14
9
|
function CheckboxGroupItem({ className, ...props }) {
|
|
15
|
-
|
|
16
|
-
className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
|
|
17
|
-
"data-slot": "checkbox-group-item",
|
|
18
|
-
...props,
|
|
19
|
-
children: /* @__PURE__ */ jsx(CheckboxGroupIndicator, {
|
|
20
|
-
className: "flex items-center justify-center text-current transition-none",
|
|
21
|
-
"data-slot": "checkbox-group-indicator",
|
|
22
|
-
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
23
|
-
})
|
|
24
|
-
});
|
|
10
|
+
return (_jsx(CheckboxGroupPrimitive.Item, { className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary focus-visible:aria-checked:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:focus-visible:aria-checked:ring-primary/40 dark:aria-invalid:ring-destructive/40", className), "data-slot": "checkbox-group-item", ...props, children: _jsx(CheckboxGroupPrimitive.CheckboxGroupIndicator, { className: "flex items-center justify-center text-current transition-none", "data-slot": "checkbox-group-indicator", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }));
|
|
25
11
|
}
|
|
26
|
-
|
|
12
|
+
/* -----------------------------------------------------------------------------
|
|
13
|
+
* Exports
|
|
14
|
+
* -------------------------------------------------------------------------- */
|
|
27
15
|
export { CheckboxGroup, CheckboxGroupItem };
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { ComponentProps, JSX } from "react";
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
3
|
-
|
|
4
|
-
//#region src/components/checkbox.d.ts
|
|
5
3
|
type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root>;
|
|
6
|
-
declare function Checkbox({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { Checkbox, type CheckboxProps };
|
|
4
|
+
declare function Checkbox({ className, ...props }: CheckboxProps): JSX.Element;
|
|
5
|
+
export { Checkbox };
|
|
6
|
+
export type { CheckboxProps };
|
|
7
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D,KAAK,aAAa,GAAG,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAEnE,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAkBrE;AAMD,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { cn } from "@codefast/tailwind-variants";
|
|
3
|
-
import { CheckIcon } from "lucide-react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
6
|
-
|
|
5
|
+
import { CheckIcon } from "lucide-react";
|
|
7
6
|
function Checkbox({ className, ...props }) {
|
|
8
|
-
|
|
9
|
-
className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary aria-checked:focus-visible:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:aria-checked:focus-visible:ring-primary/40 dark:aria-invalid:ring-destructive/40", className),
|
|
10
|
-
"data-slot": "checkbox",
|
|
11
|
-
...props,
|
|
12
|
-
children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
|
|
13
|
-
className: "flex items-center justify-center text-current transition-none",
|
|
14
|
-
"data-slot": "checkbox-indicator",
|
|
15
|
-
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
16
|
-
})
|
|
17
|
-
});
|
|
7
|
+
return (_jsx(CheckboxPrimitive.Root, { className: cn("peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input text-primary-foreground shadow-xs outline-hidden transition hover:not-disabled:not-aria-checked:border-ring/60 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 aria-checked:border-primary aria-checked:bg-primary aria-checked:focus-visible:ring-primary/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 hover:not-disabled:not-aria-checked:aria-invalid:border-destructive/60 aria-checked:aria-invalid:bg-destructive dark:bg-input/30 dark:aria-checked:focus-visible:ring-primary/40 dark:aria-invalid:ring-destructive/40", className), "data-slot": "checkbox", ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current transition-none", "data-slot": "checkbox-indicator", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }));
|
|
18
8
|
}
|
|
19
|
-
|
|
9
|
+
/* -----------------------------------------------------------------------------
|
|
10
|
+
* Exports
|
|
11
|
+
* -------------------------------------------------------------------------- */
|
|
20
12
|
export { Checkbox };
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import { ComponentProps, JSX } from "react";
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
2
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
3
|
-
|
|
4
|
-
//#region src/components/collapsible.d.ts
|
|
5
3
|
type CollapsibleProps = ComponentProps<typeof CollapsiblePrimitive.Root>;
|
|
6
|
-
declare function Collapsible({
|
|
7
|
-
...props
|
|
8
|
-
}: CollapsibleProps): JSX.Element;
|
|
4
|
+
declare function Collapsible({ ...props }: CollapsibleProps): JSX.Element;
|
|
9
5
|
type CollapsibleTriggerProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>;
|
|
10
|
-
declare function CollapsibleTrigger({
|
|
11
|
-
...props
|
|
12
|
-
}: CollapsibleTriggerProps): JSX.Element;
|
|
6
|
+
declare function CollapsibleTrigger({ ...props }: CollapsibleTriggerProps): JSX.Element;
|
|
13
7
|
type CollapsibleContentProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>;
|
|
14
|
-
declare function CollapsibleContent({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//#
|
|
18
|
-
export { Collapsible, CollapsibleContent, type CollapsibleContentProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps };
|
|
8
|
+
declare function CollapsibleContent({ ...props }: CollapsibleContentProps): JSX.Element;
|
|
9
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
10
|
+
export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps };
|
|
11
|
+
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../src/components/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAMpE,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAEzE,iBAAS,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAEhE;AAMD,KAAK,uBAAuB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;AAE9F,iBAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAE9E;AAMD,KAAK,uBAAuB,GAAG,cAAc,CAAC,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;AAE9F,iBAAS,kBAAkB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAE9E;AAMD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAC/D,YAAY,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
-
//#region src/components/collapsible.tsx
|
|
5
4
|
function Collapsible({ ...props }) {
|
|
6
|
-
|
|
7
|
-
"data-slot": "collapsible",
|
|
8
|
-
...props
|
|
9
|
-
});
|
|
5
|
+
return _jsx(CollapsiblePrimitive.Root, { "data-slot": "collapsible", ...props });
|
|
10
6
|
}
|
|
11
7
|
function CollapsibleTrigger({ ...props }) {
|
|
12
|
-
|
|
13
|
-
"data-slot": "collapsible-trigger",
|
|
14
|
-
...props
|
|
15
|
-
});
|
|
8
|
+
return _jsx(CollapsiblePrimitive.CollapsibleTrigger, { "data-slot": "collapsible-trigger", ...props });
|
|
16
9
|
}
|
|
17
10
|
function CollapsibleContent({ ...props }) {
|
|
18
|
-
|
|
19
|
-
"data-slot": "collapsible-content",
|
|
20
|
-
...props
|
|
21
|
-
});
|
|
11
|
+
return _jsx(CollapsiblePrimitive.CollapsibleContent, { "data-slot": "collapsible-content", ...props });
|
|
22
12
|
}
|
|
23
|
-
|
|
13
|
+
/* -----------------------------------------------------------------------------
|
|
14
|
+
* Exports
|
|
15
|
+
* -------------------------------------------------------------------------- */
|
|
24
16
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|