@egose/shadcn-theme 0.0.1
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 +30 -0
- package/chunk-2NMEKWO5.js +38 -0
- package/chunk-2NMEKWO5.js.map +1 -0
- package/chunk-3ONILUYO.mjs +11 -0
- package/chunk-3ONILUYO.mjs.map +1 -0
- package/chunk-4CBX7RQR.mjs +37 -0
- package/chunk-4CBX7RQR.mjs.map +1 -0
- package/chunk-5HXFUN6E.mjs +132 -0
- package/chunk-5HXFUN6E.mjs.map +1 -0
- package/chunk-A6SPGGUA.mjs +31 -0
- package/chunk-A6SPGGUA.mjs.map +1 -0
- package/chunk-B2G2EZ4P.js +11 -0
- package/chunk-B2G2EZ4P.js.map +1 -0
- package/chunk-B5KVOXLO.js +119 -0
- package/chunk-B5KVOXLO.js.map +1 -0
- package/chunk-BBMYITL4.mjs +35 -0
- package/chunk-BBMYITL4.mjs.map +1 -0
- package/chunk-BIIFJJWL.mjs +119 -0
- package/chunk-BIIFJJWL.mjs.map +1 -0
- package/chunk-DDR4LO2B.mjs +27 -0
- package/chunk-DDR4LO2B.mjs.map +1 -0
- package/chunk-DG6G5KP2.js +35 -0
- package/chunk-DG6G5KP2.js.map +1 -0
- package/chunk-HPKA6MRM.js +132 -0
- package/chunk-HPKA6MRM.js.map +1 -0
- package/chunk-JB72ECC3.js +57 -0
- package/chunk-JB72ECC3.js.map +1 -0
- package/chunk-K5LCVJVQ.js +31 -0
- package/chunk-K5LCVJVQ.js.map +1 -0
- package/chunk-PEJ7BU4C.js +27 -0
- package/chunk-PEJ7BU4C.js.map +1 -0
- package/chunk-PICOAWKQ.js +49 -0
- package/chunk-PICOAWKQ.js.map +1 -0
- package/chunk-PZ6OC36F.js +32 -0
- package/chunk-PZ6OC36F.js.map +1 -0
- package/chunk-SIGC6GCN.mjs +32 -0
- package/chunk-SIGC6GCN.mjs.map +1 -0
- package/chunk-TVGM4RRO.mjs +21 -0
- package/chunk-TVGM4RRO.mjs.map +1 -0
- package/chunk-WTKKFZZ4.mjs +57 -0
- package/chunk-WTKKFZZ4.mjs.map +1 -0
- package/chunk-WTTHT7F4.js +21 -0
- package/chunk-WTTHT7F4.js.map +1 -0
- package/chunk-XHNXPJDJ.mjs +49 -0
- package/chunk-XHNXPJDJ.mjs.map +1 -0
- package/chunk-YOSPWY5K.mjs +38 -0
- package/chunk-YOSPWY5K.mjs.map +1 -0
- package/chunk-ZR3EVQAK.js +37 -0
- package/chunk-ZR3EVQAK.js.map +1 -0
- package/components/ui/accordion.d.mts +9 -0
- package/components/ui/accordion.d.ts +9 -0
- package/components/ui/accordion.js +59 -0
- package/components/ui/accordion.js.map +1 -0
- package/components/ui/accordion.mjs +59 -0
- package/components/ui/accordion.mjs.map +1 -0
- package/components/ui/alert-dialog.d.mts +22 -0
- package/components/ui/alert-dialog.d.ts +22 -0
- package/components/ui/alert-dialog.js +143 -0
- package/components/ui/alert-dialog.js.map +1 -0
- package/components/ui/alert-dialog.mjs +143 -0
- package/components/ui/alert-dialog.mjs.map +1 -0
- package/components/ui/alert.d.mts +11 -0
- package/components/ui/alert.d.ts +11 -0
- package/components/ui/alert.js +65 -0
- package/components/ui/alert.js.map +1 -0
- package/components/ui/alert.mjs +65 -0
- package/components/ui/alert.mjs.map +1 -0
- package/components/ui/aspect-ratio.d.mts +6 -0
- package/components/ui/aspect-ratio.d.ts +6 -0
- package/components/ui/aspect-ratio.js +9 -0
- package/components/ui/aspect-ratio.js.map +1 -0
- package/components/ui/aspect-ratio.mjs +9 -0
- package/components/ui/aspect-ratio.mjs.map +1 -0
- package/components/ui/avatar.d.mts +8 -0
- package/components/ui/avatar.d.ts +8 -0
- package/components/ui/avatar.js +57 -0
- package/components/ui/avatar.js.map +1 -0
- package/components/ui/avatar.mjs +57 -0
- package/components/ui/avatar.mjs.map +1 -0
- package/components/ui/badge.d.mts +12 -0
- package/components/ui/badge.d.ts +12 -0
- package/components/ui/badge.js +36 -0
- package/components/ui/badge.js.map +1 -0
- package/components/ui/badge.mjs +36 -0
- package/components/ui/badge.mjs.map +1 -0
- package/components/ui/breadcrumb.d.mts +21 -0
- package/components/ui/breadcrumb.d.ts +21 -0
- package/components/ui/breadcrumb.js +115 -0
- package/components/ui/breadcrumb.js.map +1 -0
- package/components/ui/breadcrumb.mjs +115 -0
- package/components/ui/breadcrumb.mjs.map +1 -0
- package/components/ui/button.d.mts +14 -0
- package/components/ui/button.d.ts +14 -0
- package/components/ui/button.js +11 -0
- package/components/ui/button.js.map +1 -0
- package/components/ui/button.mjs +11 -0
- package/components/ui/button.mjs.map +1 -0
- package/components/ui/calendar.d.mts +10 -0
- package/components/ui/calendar.d.ts +10 -0
- package/components/ui/calendar.js +81 -0
- package/components/ui/calendar.js.map +1 -0
- package/components/ui/calendar.mjs +81 -0
- package/components/ui/calendar.mjs.map +1 -0
- package/components/ui/card.d.mts +10 -0
- package/components/ui/card.d.ts +10 -0
- package/components/ui/card.js +82 -0
- package/components/ui/card.js.map +1 -0
- package/components/ui/card.mjs +82 -0
- package/components/ui/card.mjs.map +1 -0
- package/components/ui/carousel.d.mts +23 -0
- package/components/ui/carousel.d.ts +23 -0
- package/components/ui/carousel.js +206 -0
- package/components/ui/carousel.js.map +1 -0
- package/components/ui/carousel.mjs +206 -0
- package/components/ui/carousel.mjs.map +1 -0
- package/components/ui/chart.d.mts +68 -0
- package/components/ui/chart.d.ts +68 -0
- package/components/ui/chart.js +236 -0
- package/components/ui/chart.js.map +1 -0
- package/components/ui/chart.mjs +236 -0
- package/components/ui/chart.mjs.map +1 -0
- package/components/ui/checkbox.d.mts +6 -0
- package/components/ui/checkbox.d.ts +6 -0
- package/components/ui/checkbox.js +37 -0
- package/components/ui/checkbox.js.map +1 -0
- package/components/ui/checkbox.mjs +37 -0
- package/components/ui/checkbox.mjs.map +1 -0
- package/components/ui/collapsible.d.mts +8 -0
- package/components/ui/collapsible.d.ts +8 -0
- package/components/ui/collapsible.js +14 -0
- package/components/ui/collapsible.js.map +1 -0
- package/components/ui/collapsible.mjs +14 -0
- package/components/ui/collapsible.mjs.map +1 -0
- package/components/ui/command.d.mts +82 -0
- package/components/ui/command.d.ts +82 -0
- package/components/ui/command.js +135 -0
- package/components/ui/command.js.map +1 -0
- package/components/ui/command.mjs +135 -0
- package/components/ui/command.mjs.map +1 -0
- package/components/ui/context-menu.d.mts +29 -0
- package/components/ui/context-menu.d.ts +29 -0
- package/components/ui/context-menu.js +172 -0
- package/components/ui/context-menu.js.map +1 -0
- package/components/ui/context-menu.mjs +172 -0
- package/components/ui/context-menu.mjs.map +1 -0
- package/components/ui/dialog.d.mts +21 -0
- package/components/ui/dialog.d.ts +21 -0
- package/components/ui/dialog.js +28 -0
- package/components/ui/dialog.js.map +1 -0
- package/components/ui/dialog.mjs +28 -0
- package/components/ui/dialog.mjs.map +1 -0
- package/components/ui/drawer.d.mts +26 -0
- package/components/ui/drawer.d.ts +26 -0
- package/components/ui/drawer.js +122 -0
- package/components/ui/drawer.js.map +1 -0
- package/components/ui/drawer.mjs +122 -0
- package/components/ui/drawer.mjs.map +1 -0
- package/components/ui/dropdown-menu.d.mts +29 -0
- package/components/ui/dropdown-menu.d.ts +29 -0
- package/components/ui/dropdown-menu.js +171 -0
- package/components/ui/dropdown-menu.js.map +1 -0
- package/components/ui/dropdown-menu.mjs +171 -0
- package/components/ui/dropdown-menu.mjs.map +1 -0
- package/components/ui/form.d.mts +27 -0
- package/components/ui/form.d.ts +27 -0
- package/components/ui/form.js +123 -0
- package/components/ui/form.js.map +1 -0
- package/components/ui/form.mjs +123 -0
- package/components/ui/form.mjs.map +1 -0
- package/components/ui/hover-card.d.mts +8 -0
- package/components/ui/hover-card.d.ts +8 -0
- package/components/ui/hover-card.js +36 -0
- package/components/ui/hover-card.js.map +1 -0
- package/components/ui/hover-card.mjs +36 -0
- package/components/ui/hover-card.mjs.map +1 -0
- package/components/ui/input-otp.d.mts +37 -0
- package/components/ui/input-otp.d.ts +37 -0
- package/components/ui/input-otp.js +63 -0
- package/components/ui/input-otp.js.map +1 -0
- package/components/ui/input-otp.mjs +63 -0
- package/components/ui/input-otp.mjs.map +1 -0
- package/components/ui/input.d.mts +5 -0
- package/components/ui/input.d.ts +5 -0
- package/components/ui/input.js +9 -0
- package/components/ui/input.js.map +1 -0
- package/components/ui/input.mjs +9 -0
- package/components/ui/input.mjs.map +1 -0
- package/components/ui/label.d.mts +8 -0
- package/components/ui/label.d.ts +8 -0
- package/components/ui/label.js +9 -0
- package/components/ui/label.js.map +1 -0
- package/components/ui/label.mjs +9 -0
- package/components/ui/label.mjs.map +1 -0
- package/components/ui/menubar.d.mts +30 -0
- package/components/ui/menubar.d.ts +30 -0
- package/components/ui/menubar.js +221 -0
- package/components/ui/menubar.js.map +1 -0
- package/components/ui/menubar.mjs +221 -0
- package/components/ui/menubar.mjs.map +1 -0
- package/components/ui/navigation-menu.d.mts +15 -0
- package/components/ui/navigation-menu.d.ts +15 -0
- package/components/ui/navigation-menu.js +123 -0
- package/components/ui/navigation-menu.js.map +1 -0
- package/components/ui/navigation-menu.mjs +123 -0
- package/components/ui/navigation-menu.mjs.map +1 -0
- package/components/ui/pagination.d.mts +32 -0
- package/components/ui/pagination.d.ts +32 -0
- package/components/ui/pagination.js +130 -0
- package/components/ui/pagination.js.map +1 -0
- package/components/ui/pagination.mjs +130 -0
- package/components/ui/pagination.mjs.map +1 -0
- package/components/ui/popover.d.mts +9 -0
- package/components/ui/popover.d.ts +9 -0
- package/components/ui/popover.js +37 -0
- package/components/ui/popover.js.map +1 -0
- package/components/ui/popover.mjs +37 -0
- package/components/ui/popover.mjs.map +1 -0
- package/components/ui/progress.d.mts +6 -0
- package/components/ui/progress.d.ts +6 -0
- package/components/ui/progress.js +37 -0
- package/components/ui/progress.js.map +1 -0
- package/components/ui/progress.mjs +37 -0
- package/components/ui/progress.mjs.map +1 -0
- package/components/ui/radio-group.d.mts +7 -0
- package/components/ui/radio-group.d.ts +7 -0
- package/components/ui/radio-group.js +45 -0
- package/components/ui/radio-group.js.map +1 -0
- package/components/ui/radio-group.mjs +45 -0
- package/components/ui/radio-group.mjs.map +1 -0
- package/components/ui/resizable.d.mts +26 -0
- package/components/ui/resizable.d.ts +26 -0
- package/components/ui/resizable.js +54 -0
- package/components/ui/resizable.js.map +1 -0
- package/components/ui/resizable.mjs +54 -0
- package/components/ui/resizable.mjs.map +1 -0
- package/components/ui/scroll-area.d.mts +7 -0
- package/components/ui/scroll-area.d.ts +7 -0
- package/components/ui/scroll-area.js +48 -0
- package/components/ui/scroll-area.js.map +1 -0
- package/components/ui/scroll-area.mjs +48 -0
- package/components/ui/scroll-area.mjs.map +1 -0
- package/components/ui/select.d.mts +15 -0
- package/components/ui/select.d.ts +15 -0
- package/components/ui/select.js +141 -0
- package/components/ui/select.js.map +1 -0
- package/components/ui/select.mjs +141 -0
- package/components/ui/select.mjs.map +1 -0
- package/components/ui/separator.d.mts +6 -0
- package/components/ui/separator.d.ts +6 -0
- package/components/ui/separator.js +9 -0
- package/components/ui/separator.js.map +1 -0
- package/components/ui/separator.mjs +9 -0
- package/components/ui/separator.mjs.map +1 -0
- package/components/ui/sheet.d.mts +28 -0
- package/components/ui/sheet.d.ts +28 -0
- package/components/ui/sheet.js +28 -0
- package/components/ui/sheet.js.map +1 -0
- package/components/ui/sheet.mjs +28 -0
- package/components/ui/sheet.mjs.map +1 -0
- package/components/ui/sidebar.d.mts +72 -0
- package/components/ui/sidebar.d.ts +72 -0
- package/components/ui/sidebar.js +642 -0
- package/components/ui/sidebar.js.map +1 -0
- package/components/ui/sidebar.mjs +642 -0
- package/components/ui/sidebar.mjs.map +1 -0
- package/components/ui/skeleton.d.mts +5 -0
- package/components/ui/skeleton.d.ts +5 -0
- package/components/ui/skeleton.js +9 -0
- package/components/ui/skeleton.js.map +1 -0
- package/components/ui/skeleton.mjs +9 -0
- package/components/ui/skeleton.mjs.map +1 -0
- package/components/ui/slider.d.mts +6 -0
- package/components/ui/slider.d.ts +6 -0
- package/components/ui/slider.js +31 -0
- package/components/ui/slider.js.map +1 -0
- package/components/ui/slider.mjs +31 -0
- package/components/ui/slider.mjs.map +1 -0
- package/components/ui/sonner.d.mts +7 -0
- package/components/ui/sonner.d.ts +7 -0
- package/components/ui/sonner.js +32 -0
- package/components/ui/sonner.js.map +1 -0
- package/components/ui/sonner.mjs +32 -0
- package/components/ui/sonner.mjs.map +1 -0
- package/components/ui/switch.d.mts +6 -0
- package/components/ui/switch.d.ts +6 -0
- package/components/ui/switch.js +39 -0
- package/components/ui/switch.js.map +1 -0
- package/components/ui/switch.mjs +39 -0
- package/components/ui/switch.mjs.map +1 -0
- package/components/ui/table.d.mts +12 -0
- package/components/ui/table.d.ts +12 -0
- package/components/ui/table.js +115 -0
- package/components/ui/table.js.map +1 -0
- package/components/ui/table.mjs +115 -0
- package/components/ui/table.mjs.map +1 -0
- package/components/ui/tabs.d.mts +9 -0
- package/components/ui/tabs.d.ts +9 -0
- package/components/ui/tabs.js +61 -0
- package/components/ui/tabs.js.map +1 -0
- package/components/ui/tabs.mjs +61 -0
- package/components/ui/tabs.mjs.map +1 -0
- package/components/ui/textarea.d.mts +5 -0
- package/components/ui/textarea.d.ts +5 -0
- package/components/ui/textarea.js +28 -0
- package/components/ui/textarea.js.map +1 -0
- package/components/ui/textarea.mjs +28 -0
- package/components/ui/textarea.mjs.map +1 -0
- package/components/ui/toggle-group.d.mts +15 -0
- package/components/ui/toggle-group.d.ts +15 -0
- package/components/ui/toggle-group.js +55 -0
- package/components/ui/toggle-group.js.map +1 -0
- package/components/ui/toggle-group.mjs +55 -0
- package/components/ui/toggle-group.mjs.map +1 -0
- package/components/ui/toggle.d.mts +15 -0
- package/components/ui/toggle.d.ts +15 -0
- package/components/ui/toggle.js +11 -0
- package/components/ui/toggle.js.map +1 -0
- package/components/ui/toggle.mjs +11 -0
- package/components/ui/toggle.mjs.map +1 -0
- package/components/ui/tooltip.d.mts +9 -0
- package/components/ui/tooltip.d.ts +9 -0
- package/components/ui/tooltip.js +16 -0
- package/components/ui/tooltip.js.map +1 -0
- package/components/ui/tooltip.mjs +16 -0
- package/components/ui/tooltip.mjs.map +1 -0
- package/hooks/use-mobile.d.mts +3 -0
- package/hooks/use-mobile.d.ts +3 -0
- package/hooks/use-mobile.js +8 -0
- package/hooks/use-mobile.js.map +1 -0
- package/hooks/use-mobile.mjs +8 -0
- package/hooks/use-mobile.mjs.map +1 -0
- package/lib/utils.d.mts +5 -0
- package/lib/utils.d.ts +5 -0
- package/lib/utils.js +8 -0
- package/lib/utils.js.map +1 -0
- package/lib/utils.mjs +8 -0
- package/lib/utils.mjs.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button
|
|
3
|
+
} from "../../chunk-WTKKFZZ4.mjs";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "../../chunk-3ONILUYO.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__objRest,
|
|
9
|
+
__spreadProps,
|
|
10
|
+
__spreadValues
|
|
11
|
+
} from "../../chunk-YOSPWY5K.mjs";
|
|
12
|
+
|
|
13
|
+
// components/ui/carousel.tsx
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
16
|
+
import { ArrowLeft, ArrowRight } from "lucide-react";
|
|
17
|
+
var CarouselContext = React.createContext(null);
|
|
18
|
+
function useCarousel() {
|
|
19
|
+
const context = React.useContext(CarouselContext);
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error("useCarousel must be used within a <Carousel />");
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
var Carousel = React.forwardRef(
|
|
26
|
+
(_a, ref) => {
|
|
27
|
+
var _b = _a, {
|
|
28
|
+
orientation = "horizontal",
|
|
29
|
+
opts,
|
|
30
|
+
setApi,
|
|
31
|
+
plugins,
|
|
32
|
+
className,
|
|
33
|
+
children
|
|
34
|
+
} = _b, props = __objRest(_b, [
|
|
35
|
+
"orientation",
|
|
36
|
+
"opts",
|
|
37
|
+
"setApi",
|
|
38
|
+
"plugins",
|
|
39
|
+
"className",
|
|
40
|
+
"children"
|
|
41
|
+
]);
|
|
42
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
43
|
+
__spreadProps(__spreadValues({}, opts), {
|
|
44
|
+
axis: orientation === "horizontal" ? "x" : "y"
|
|
45
|
+
}),
|
|
46
|
+
plugins
|
|
47
|
+
);
|
|
48
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
49
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
50
|
+
const onSelect = React.useCallback((api2) => {
|
|
51
|
+
if (!api2) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setCanScrollPrev(api2.canScrollPrev());
|
|
55
|
+
setCanScrollNext(api2.canScrollNext());
|
|
56
|
+
}, []);
|
|
57
|
+
const scrollPrev = React.useCallback(() => {
|
|
58
|
+
api == null ? void 0 : api.scrollPrev();
|
|
59
|
+
}, [api]);
|
|
60
|
+
const scrollNext = React.useCallback(() => {
|
|
61
|
+
api == null ? void 0 : api.scrollNext();
|
|
62
|
+
}, [api]);
|
|
63
|
+
const handleKeyDown = React.useCallback(
|
|
64
|
+
(event) => {
|
|
65
|
+
if (event.key === "ArrowLeft") {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
scrollPrev();
|
|
68
|
+
} else if (event.key === "ArrowRight") {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
scrollNext();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[scrollPrev, scrollNext]
|
|
74
|
+
);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (!api || !setApi) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
setApi(api);
|
|
80
|
+
}, [api, setApi]);
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
if (!api) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
onSelect(api);
|
|
86
|
+
api.on("reInit", onSelect);
|
|
87
|
+
api.on("select", onSelect);
|
|
88
|
+
return () => {
|
|
89
|
+
api == null ? void 0 : api.off("select", onSelect);
|
|
90
|
+
};
|
|
91
|
+
}, [api, onSelect]);
|
|
92
|
+
return /* @__PURE__ */ React.createElement(
|
|
93
|
+
CarouselContext.Provider,
|
|
94
|
+
{
|
|
95
|
+
value: {
|
|
96
|
+
carouselRef,
|
|
97
|
+
api,
|
|
98
|
+
opts,
|
|
99
|
+
orientation: orientation || ((opts == null ? void 0 : opts.axis) === "y" ? "vertical" : "horizontal"),
|
|
100
|
+
scrollPrev,
|
|
101
|
+
scrollNext,
|
|
102
|
+
canScrollPrev,
|
|
103
|
+
canScrollNext
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
/* @__PURE__ */ React.createElement(
|
|
107
|
+
"div",
|
|
108
|
+
__spreadValues({
|
|
109
|
+
ref,
|
|
110
|
+
onKeyDownCapture: handleKeyDown,
|
|
111
|
+
className: cn("relative", className),
|
|
112
|
+
role: "region",
|
|
113
|
+
"aria-roledescription": "carousel"
|
|
114
|
+
}, props),
|
|
115
|
+
children
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
Carousel.displayName = "Carousel";
|
|
121
|
+
var CarouselContent = React.forwardRef((_a, ref) => {
|
|
122
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
123
|
+
const { carouselRef, orientation } = useCarousel();
|
|
124
|
+
return /* @__PURE__ */ React.createElement("div", { ref: carouselRef, className: "overflow-hidden" }, /* @__PURE__ */ React.createElement(
|
|
125
|
+
"div",
|
|
126
|
+
__spreadValues({
|
|
127
|
+
ref,
|
|
128
|
+
className: cn(
|
|
129
|
+
"flex",
|
|
130
|
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
131
|
+
className
|
|
132
|
+
)
|
|
133
|
+
}, props)
|
|
134
|
+
));
|
|
135
|
+
});
|
|
136
|
+
CarouselContent.displayName = "CarouselContent";
|
|
137
|
+
var CarouselItem = React.forwardRef((_a, ref) => {
|
|
138
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
139
|
+
const { orientation } = useCarousel();
|
|
140
|
+
return /* @__PURE__ */ React.createElement(
|
|
141
|
+
"div",
|
|
142
|
+
__spreadValues({
|
|
143
|
+
ref,
|
|
144
|
+
role: "group",
|
|
145
|
+
"aria-roledescription": "slide",
|
|
146
|
+
className: cn(
|
|
147
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
148
|
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
149
|
+
className
|
|
150
|
+
)
|
|
151
|
+
}, props)
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
CarouselItem.displayName = "CarouselItem";
|
|
155
|
+
var CarouselPrevious = React.forwardRef((_a, ref) => {
|
|
156
|
+
var _b = _a, { className, variant = "outline", size = "icon" } = _b, props = __objRest(_b, ["className", "variant", "size"]);
|
|
157
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
158
|
+
return /* @__PURE__ */ React.createElement(
|
|
159
|
+
Button,
|
|
160
|
+
__spreadValues({
|
|
161
|
+
ref,
|
|
162
|
+
variant,
|
|
163
|
+
size,
|
|
164
|
+
className: cn(
|
|
165
|
+
"absolute h-8 w-8 rounded-full",
|
|
166
|
+
orientation === "horizontal" ? "-left-12 top-1/2 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
167
|
+
className
|
|
168
|
+
),
|
|
169
|
+
disabled: !canScrollPrev,
|
|
170
|
+
onClick: scrollPrev
|
|
171
|
+
}, props),
|
|
172
|
+
/* @__PURE__ */ React.createElement(ArrowLeft, { className: "h-4 w-4" }),
|
|
173
|
+
/* @__PURE__ */ React.createElement("span", { className: "sr-only" }, "Previous slide")
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
177
|
+
var CarouselNext = React.forwardRef((_a, ref) => {
|
|
178
|
+
var _b = _a, { className, variant = "outline", size = "icon" } = _b, props = __objRest(_b, ["className", "variant", "size"]);
|
|
179
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
180
|
+
return /* @__PURE__ */ React.createElement(
|
|
181
|
+
Button,
|
|
182
|
+
__spreadValues({
|
|
183
|
+
ref,
|
|
184
|
+
variant,
|
|
185
|
+
size,
|
|
186
|
+
className: cn(
|
|
187
|
+
"absolute h-8 w-8 rounded-full",
|
|
188
|
+
orientation === "horizontal" ? "-right-12 top-1/2 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
189
|
+
className
|
|
190
|
+
),
|
|
191
|
+
disabled: !canScrollNext,
|
|
192
|
+
onClick: scrollNext
|
|
193
|
+
}, props),
|
|
194
|
+
/* @__PURE__ */ React.createElement(ArrowRight, { className: "h-4 w-4" }),
|
|
195
|
+
/* @__PURE__ */ React.createElement("span", { className: "sr-only" }, "Next slide")
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
CarouselNext.displayName = "CarouselNext";
|
|
199
|
+
export {
|
|
200
|
+
Carousel,
|
|
201
|
+
CarouselContent,
|
|
202
|
+
CarouselItem,
|
|
203
|
+
CarouselNext,
|
|
204
|
+
CarouselPrevious
|
|
205
|
+
};
|
|
206
|
+
//# sourceMappingURL=carousel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../components/ui/carousel.tsx"],"sourcesContent":["import * as React from \"react\"\nimport useEmblaCarousel, {\n type UseEmblaCarouselType,\n} from \"embla-carousel-react\"\nimport { ArrowLeft, ArrowRight } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\n\ntype CarouselApi = UseEmblaCarouselType[1]\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>\ntype CarouselOptions = UseCarouselParameters[0]\ntype CarouselPlugin = UseCarouselParameters[1]\n\ntype CarouselProps = {\n opts?: CarouselOptions\n plugins?: CarouselPlugin\n orientation?: \"horizontal\" | \"vertical\"\n setApi?: (api: CarouselApi) => void\n}\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0]\n api: ReturnType<typeof useEmblaCarousel>[1]\n scrollPrev: () => void\n scrollNext: () => void\n canScrollPrev: boolean\n canScrollNext: boolean\n} & CarouselProps\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null)\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext)\n\n if (!context) {\n throw new Error(\"useCarousel must be used within a <Carousel />\")\n }\n\n return context\n}\n\nconst Carousel = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselProps\n>(\n (\n {\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n },\n ref\n ) => {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n },\n plugins\n )\n const [canScrollPrev, setCanScrollPrev] = React.useState(false)\n const [canScrollNext, setCanScrollNext] = React.useState(false)\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) {\n return\n }\n\n setCanScrollPrev(api.canScrollPrev())\n setCanScrollNext(api.canScrollNext())\n }, [])\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev()\n }, [api])\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext()\n }, [api])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault()\n scrollPrev()\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault()\n scrollNext()\n }\n },\n [scrollPrev, scrollNext]\n )\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return\n }\n\n setApi(api)\n }, [api, setApi])\n\n React.useEffect(() => {\n if (!api) {\n return\n }\n\n onSelect(api)\n api.on(\"reInit\", onSelect)\n api.on(\"select\", onSelect)\n\n return () => {\n api?.off(\"select\", onSelect)\n }\n }, [api, onSelect])\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation:\n orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn(\"relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n )\n }\n)\nCarousel.displayName = \"Carousel\"\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel()\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\">\n <div\n ref={ref}\n className={cn(\n \"flex\",\n orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\",\n className\n )}\n {...props}\n />\n </div>\n )\n})\nCarouselContent.displayName = \"CarouselContent\"\n\nconst CarouselItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { orientation } = useCarousel()\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn(\n \"min-w-0 shrink-0 grow-0 basis-full\",\n orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\",\n className\n )}\n {...props}\n />\n )\n})\nCarouselItem.displayName = \"CarouselItem\"\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button>\n>(({ className, variant = \"outline\", size = \"icon\", ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel()\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n \"absolute h-8 w-8 rounded-full\",\n orientation === \"horizontal\"\n ? \"-left-12 top-1/2 -translate-y-1/2\"\n : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\",\n className\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n )\n})\nCarouselPrevious.displayName = \"CarouselPrevious\"\n\nconst CarouselNext = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button>\n>(({ className, variant = \"outline\", size = \"icon\", ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel()\n\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={cn(\n \"absolute h-8 w-8 rounded-full\",\n orientation === \"horizontal\"\n ? \"-right-12 top-1/2 -translate-y-1/2\"\n : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\",\n className\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight className=\"h-4 w-4\" />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n )\n})\nCarouselNext.displayName = \"CarouselNext\"\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,YAAY,WAAW;AACvB,OAAO,sBAEA;AACP,SAAS,WAAW,kBAAkB;AA0BtC,IAAM,kBAAwB,oBAA2C,IAAI;AAE7E,SAAS,cAAc;AACrB,QAAM,UAAgB,iBAAW,eAAe;AAEhD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,gDAAgD;AAAA,EAClE;AAEA,SAAO;AACT;AAEA,IAAM,WAAiB;AAAA,EAIrB,CACE,IASA,QACG;AAVH,iBACE;AAAA,oBAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IArDN,IA+CI,IAOK,kBAPL,IAOK;AAAA,MANH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA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D,IAAoD,CAAlD,aAAW,WAAqB;AACnC,QAAM,EAAE,aAAa,YAAY,cAAc,IAAI,YAAY;AAE/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,gBAAgB,eACZ,sCACA;AAAA,QACJ;AAAA,MACF;AAAA,MACA,UAAU,CAAC;AAAA,MACX,SAAS;AAAA,OACL;AAAA,IAEJ,oCAAC,aAAU,WAAU,WAAU;AAAA,IAC/B,oCAAC,UAAK,WAAU,aAAU,gBAAc;AAAA,EAC1C;AAEJ,CAAC;AACD,iBAAiB,cAAc;AAE/B,IAAM,eAAqB,iBAGzB,CAAC,IAA6D,QAAQ;AAArE,eAAE,aAAW,UAAU,WAAW,OAAO,OAlO5C,IAkOG,IAAoD,kBAApD,IAAoD,CAAlD,aAAW,WAAqB;AACnC,QAAM,EAAE,aAAa,YAAY,cAAc,IAAI,YAAY;AAE/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,gBAAgB,eACZ,uCACA;AAAA,QACJ;AAAA,MACF;AAAA,MACA,UAAU,CAAC;AAAA,MACX,SAAS;AAAA,OACL;AAAA,IAEJ,oCAAC,cAAW,WAAU,WAAU;AAAA,IAChC,oCAAC,UAAK,WAAU,aAAU,YAAU;AAAA,EACtC;AAEJ,CAAC;AACD,aAAa,cAAc;","names":["api"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as recharts_types_util_payload_getUniqPayload from 'recharts/types/util/payload/getUniqPayload';
|
|
2
|
+
import * as recharts_types_component_Tooltip from 'recharts/types/component/Tooltip';
|
|
3
|
+
import * as recharts_types_util_types from 'recharts/types/util/types';
|
|
4
|
+
import * as recharts_types_component_DefaultTooltipContent from 'recharts/types/component/DefaultTooltipContent';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as RechartsPrimitive from 'recharts';
|
|
7
|
+
|
|
8
|
+
declare const THEMES: {
|
|
9
|
+
readonly light: "";
|
|
10
|
+
readonly dark: ".dark";
|
|
11
|
+
};
|
|
12
|
+
type ChartConfig = {
|
|
13
|
+
[k in string]: {
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
icon?: React.ComponentType;
|
|
16
|
+
} & ({
|
|
17
|
+
color?: string;
|
|
18
|
+
theme?: never;
|
|
19
|
+
} | {
|
|
20
|
+
color?: never;
|
|
21
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
declare const ChartContainer: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
25
|
+
config: ChartConfig;
|
|
26
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
27
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
declare const ChartStyle: ({ id, config }: {
|
|
29
|
+
id: string;
|
|
30
|
+
config: ChartConfig;
|
|
31
|
+
}) => React.JSX.Element | null;
|
|
32
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
33
|
+
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<RechartsPrimitive.DefaultTooltipContentProps<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> & {
|
|
34
|
+
accessibilityLayer?: boolean;
|
|
35
|
+
active?: boolean | undefined;
|
|
36
|
+
includeHidden?: boolean | undefined;
|
|
37
|
+
allowEscapeViewBox?: recharts_types_util_types.AllowInDimension;
|
|
38
|
+
animationDuration?: recharts_types_util_types.AnimationDuration;
|
|
39
|
+
animationEasing?: recharts_types_util_types.AnimationTiming;
|
|
40
|
+
content?: recharts_types_component_Tooltip.ContentType<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> | undefined;
|
|
41
|
+
coordinate?: Partial<recharts_types_util_types.Coordinate>;
|
|
42
|
+
cursor?: boolean | React.ReactElement | React.SVGProps<SVGElement>;
|
|
43
|
+
filterNull?: boolean;
|
|
44
|
+
defaultIndex?: number;
|
|
45
|
+
isAnimationActive?: boolean;
|
|
46
|
+
offset?: number;
|
|
47
|
+
payloadUniqBy?: recharts_types_util_payload_getUniqPayload.UniqueOption<recharts_types_component_DefaultTooltipContent.Payload<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType>> | undefined;
|
|
48
|
+
position?: Partial<recharts_types_util_types.Coordinate>;
|
|
49
|
+
reverseDirection?: recharts_types_util_types.AllowInDimension;
|
|
50
|
+
shared?: boolean;
|
|
51
|
+
trigger?: "hover" | "click";
|
|
52
|
+
useTranslate3d?: boolean;
|
|
53
|
+
viewBox?: recharts_types_util_types.CartesianViewBox;
|
|
54
|
+
wrapperStyle?: React.CSSProperties;
|
|
55
|
+
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
56
|
+
hideLabel?: boolean;
|
|
57
|
+
hideIndicator?: boolean;
|
|
58
|
+
indicator?: "line" | "dot" | "dashed";
|
|
59
|
+
nameKey?: string;
|
|
60
|
+
labelKey?: string;
|
|
61
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
62
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
63
|
+
declare const ChartLegendContent: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
64
|
+
hideIcon?: boolean;
|
|
65
|
+
nameKey?: string;
|
|
66
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
|
|
68
|
+
export { type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as recharts_types_util_payload_getUniqPayload from 'recharts/types/util/payload/getUniqPayload';
|
|
2
|
+
import * as recharts_types_component_Tooltip from 'recharts/types/component/Tooltip';
|
|
3
|
+
import * as recharts_types_util_types from 'recharts/types/util/types';
|
|
4
|
+
import * as recharts_types_component_DefaultTooltipContent from 'recharts/types/component/DefaultTooltipContent';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as RechartsPrimitive from 'recharts';
|
|
7
|
+
|
|
8
|
+
declare const THEMES: {
|
|
9
|
+
readonly light: "";
|
|
10
|
+
readonly dark: ".dark";
|
|
11
|
+
};
|
|
12
|
+
type ChartConfig = {
|
|
13
|
+
[k in string]: {
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
icon?: React.ComponentType;
|
|
16
|
+
} & ({
|
|
17
|
+
color?: string;
|
|
18
|
+
theme?: never;
|
|
19
|
+
} | {
|
|
20
|
+
color?: never;
|
|
21
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
declare const ChartContainer: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
25
|
+
config: ChartConfig;
|
|
26
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
27
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
declare const ChartStyle: ({ id, config }: {
|
|
29
|
+
id: string;
|
|
30
|
+
config: ChartConfig;
|
|
31
|
+
}) => React.JSX.Element | null;
|
|
32
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
33
|
+
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<RechartsPrimitive.DefaultTooltipContentProps<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> & {
|
|
34
|
+
accessibilityLayer?: boolean;
|
|
35
|
+
active?: boolean | undefined;
|
|
36
|
+
includeHidden?: boolean | undefined;
|
|
37
|
+
allowEscapeViewBox?: recharts_types_util_types.AllowInDimension;
|
|
38
|
+
animationDuration?: recharts_types_util_types.AnimationDuration;
|
|
39
|
+
animationEasing?: recharts_types_util_types.AnimationTiming;
|
|
40
|
+
content?: recharts_types_component_Tooltip.ContentType<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType> | undefined;
|
|
41
|
+
coordinate?: Partial<recharts_types_util_types.Coordinate>;
|
|
42
|
+
cursor?: boolean | React.ReactElement | React.SVGProps<SVGElement>;
|
|
43
|
+
filterNull?: boolean;
|
|
44
|
+
defaultIndex?: number;
|
|
45
|
+
isAnimationActive?: boolean;
|
|
46
|
+
offset?: number;
|
|
47
|
+
payloadUniqBy?: recharts_types_util_payload_getUniqPayload.UniqueOption<recharts_types_component_DefaultTooltipContent.Payload<recharts_types_component_DefaultTooltipContent.ValueType, recharts_types_component_DefaultTooltipContent.NameType>> | undefined;
|
|
48
|
+
position?: Partial<recharts_types_util_types.Coordinate>;
|
|
49
|
+
reverseDirection?: recharts_types_util_types.AllowInDimension;
|
|
50
|
+
shared?: boolean;
|
|
51
|
+
trigger?: "hover" | "click";
|
|
52
|
+
useTranslate3d?: boolean;
|
|
53
|
+
viewBox?: recharts_types_util_types.CartesianViewBox;
|
|
54
|
+
wrapperStyle?: React.CSSProperties;
|
|
55
|
+
} & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
|
|
56
|
+
hideLabel?: boolean;
|
|
57
|
+
hideIndicator?: boolean;
|
|
58
|
+
indicator?: "line" | "dot" | "dashed";
|
|
59
|
+
nameKey?: string;
|
|
60
|
+
labelKey?: string;
|
|
61
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
62
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
63
|
+
declare const ChartLegendContent: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
64
|
+
hideIcon?: boolean;
|
|
65
|
+
nameKey?: string;
|
|
66
|
+
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
|
|
68
|
+
export { type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkB2G2EZ4Pjs = require('../../chunk-B2G2EZ4P.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk2NMEKWO5js = require('../../chunk-2NMEKWO5.js');
|
|
9
|
+
|
|
10
|
+
// components/ui/chart.tsx
|
|
11
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
12
|
+
var _recharts = require('recharts'); var RechartsPrimitive = _interopRequireWildcard(_recharts);
|
|
13
|
+
var THEMES = { light: "", dark: ".dark" };
|
|
14
|
+
var ChartContext = React.createContext(null);
|
|
15
|
+
function useChart() {
|
|
16
|
+
const context = React.useContext(ChartContext);
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
19
|
+
}
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
var ChartContainer = React.forwardRef((_a, ref) => {
|
|
23
|
+
var _b = _a, { id, className, children, config } = _b, props = _chunk2NMEKWO5js.__objRest.call(void 0, _b, ["id", "className", "children", "config"]);
|
|
24
|
+
const uniqueId = React.useId();
|
|
25
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
26
|
+
return /* @__PURE__ */ React.createElement(ChartContext.Provider, { value: { config } }, /* @__PURE__ */ React.createElement(
|
|
27
|
+
"div",
|
|
28
|
+
_chunk2NMEKWO5js.__spreadValues.call(void 0, {
|
|
29
|
+
"data-chart": chartId,
|
|
30
|
+
ref,
|
|
31
|
+
className: _chunkB2G2EZ4Pjs.cn.call(void 0,
|
|
32
|
+
"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-none [&_.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[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
|
33
|
+
className
|
|
34
|
+
)
|
|
35
|
+
}, props),
|
|
36
|
+
/* @__PURE__ */ React.createElement(ChartStyle, { id: chartId, config }),
|
|
37
|
+
/* @__PURE__ */ React.createElement(RechartsPrimitive.ResponsiveContainer, null, children)
|
|
38
|
+
));
|
|
39
|
+
});
|
|
40
|
+
ChartContainer.displayName = "Chart";
|
|
41
|
+
var ChartStyle = ({ id, config }) => {
|
|
42
|
+
const colorConfig = Object.entries(config).filter(
|
|
43
|
+
([, config2]) => config2.theme || config2.color
|
|
44
|
+
);
|
|
45
|
+
if (!colorConfig.length) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ React.createElement(
|
|
49
|
+
"style",
|
|
50
|
+
{
|
|
51
|
+
dangerouslySetInnerHTML: {
|
|
52
|
+
__html: Object.entries(THEMES).map(
|
|
53
|
+
([theme, prefix]) => `
|
|
54
|
+
${prefix} [data-chart=${id}] {
|
|
55
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
56
|
+
var _a;
|
|
57
|
+
const color = ((_a = itemConfig.theme) == null ? void 0 : _a[theme]) || itemConfig.color;
|
|
58
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
59
|
+
}).join("\n")}
|
|
60
|
+
}
|
|
61
|
+
`
|
|
62
|
+
).join("\n")
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
68
|
+
var ChartTooltipContent = React.forwardRef(
|
|
69
|
+
({
|
|
70
|
+
active,
|
|
71
|
+
payload,
|
|
72
|
+
className,
|
|
73
|
+
indicator = "dot",
|
|
74
|
+
hideLabel = false,
|
|
75
|
+
hideIndicator = false,
|
|
76
|
+
label,
|
|
77
|
+
labelFormatter,
|
|
78
|
+
labelClassName,
|
|
79
|
+
formatter,
|
|
80
|
+
color,
|
|
81
|
+
nameKey,
|
|
82
|
+
labelKey
|
|
83
|
+
}, ref) => {
|
|
84
|
+
const { config } = useChart();
|
|
85
|
+
const tooltipLabel = React.useMemo(() => {
|
|
86
|
+
var _a;
|
|
87
|
+
if (hideLabel || !(payload == null ? void 0 : payload.length)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const [item] = payload;
|
|
91
|
+
const key = `${labelKey || item.dataKey || item.name || "value"}`;
|
|
92
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
93
|
+
const value = !labelKey && typeof label === "string" ? ((_a = config[label]) == null ? void 0 : _a.label) || label : itemConfig == null ? void 0 : itemConfig.label;
|
|
94
|
+
if (labelFormatter) {
|
|
95
|
+
return /* @__PURE__ */ React.createElement("div", { className: _chunkB2G2EZ4Pjs.cn.call(void 0, "font-medium", labelClassName) }, labelFormatter(value, payload));
|
|
96
|
+
}
|
|
97
|
+
if (!value) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return /* @__PURE__ */ React.createElement("div", { className: _chunkB2G2EZ4Pjs.cn.call(void 0, "font-medium", labelClassName) }, value);
|
|
101
|
+
}, [
|
|
102
|
+
label,
|
|
103
|
+
labelFormatter,
|
|
104
|
+
payload,
|
|
105
|
+
hideLabel,
|
|
106
|
+
labelClassName,
|
|
107
|
+
config,
|
|
108
|
+
labelKey
|
|
109
|
+
]);
|
|
110
|
+
if (!active || !(payload == null ? void 0 : payload.length)) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
114
|
+
return /* @__PURE__ */ React.createElement(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
ref,
|
|
118
|
+
className: _chunkB2G2EZ4Pjs.cn.call(void 0,
|
|
119
|
+
"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",
|
|
120
|
+
className
|
|
121
|
+
)
|
|
122
|
+
},
|
|
123
|
+
!nestLabel ? tooltipLabel : null,
|
|
124
|
+
/* @__PURE__ */ React.createElement("div", { className: "grid gap-1.5" }, payload.map((item, index) => {
|
|
125
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
126
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
127
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
128
|
+
return /* @__PURE__ */ React.createElement(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
key: item.dataKey,
|
|
132
|
+
className: _chunkB2G2EZ4Pjs.cn.call(void 0,
|
|
133
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
134
|
+
indicator === "dot" && "items-center"
|
|
135
|
+
)
|
|
136
|
+
},
|
|
137
|
+
formatter && (item == null ? void 0 : item.value) !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ React.createElement(React.Fragment, null, (itemConfig == null ? void 0 : itemConfig.icon) ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : !hideIndicator && /* @__PURE__ */ React.createElement(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: _chunkB2G2EZ4Pjs.cn.call(void 0,
|
|
141
|
+
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
|
142
|
+
{
|
|
143
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
144
|
+
"w-1": indicator === "line",
|
|
145
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
146
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
style: {
|
|
150
|
+
"--color-bg": indicatorColor,
|
|
151
|
+
"--color-border": indicatorColor
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
), /* @__PURE__ */ React.createElement(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: _chunkB2G2EZ4Pjs.cn.call(void 0,
|
|
158
|
+
"flex flex-1 justify-between leading-none",
|
|
159
|
+
nestLabel ? "items-end" : "items-center"
|
|
160
|
+
)
|
|
161
|
+
},
|
|
162
|
+
/* @__PURE__ */ React.createElement("div", { className: "grid gap-1.5" }, nestLabel ? tooltipLabel : null, /* @__PURE__ */ React.createElement("span", { className: "text-muted-foreground" }, (itemConfig == null ? void 0 : itemConfig.label) || item.name)),
|
|
163
|
+
item.value && /* @__PURE__ */ React.createElement("span", { className: "font-mono font-medium tabular-nums text-foreground" }, item.value.toLocaleString())
|
|
164
|
+
))
|
|
165
|
+
);
|
|
166
|
+
}))
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
ChartTooltipContent.displayName = "ChartTooltip";
|
|
171
|
+
var ChartLegend = RechartsPrimitive.Legend;
|
|
172
|
+
var ChartLegendContent = React.forwardRef(
|
|
173
|
+
({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
|
174
|
+
const { config } = useChart();
|
|
175
|
+
if (!(payload == null ? void 0 : payload.length)) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
return /* @__PURE__ */ React.createElement(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
ref,
|
|
182
|
+
className: _chunkB2G2EZ4Pjs.cn.call(void 0,
|
|
183
|
+
"flex items-center justify-center gap-4",
|
|
184
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
185
|
+
className
|
|
186
|
+
)
|
|
187
|
+
},
|
|
188
|
+
payload.map((item) => {
|
|
189
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
190
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
191
|
+
return /* @__PURE__ */ React.createElement(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
key: item.value,
|
|
195
|
+
className: _chunkB2G2EZ4Pjs.cn.call(void 0,
|
|
196
|
+
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
|
197
|
+
)
|
|
198
|
+
},
|
|
199
|
+
(itemConfig == null ? void 0 : itemConfig.icon) && !hideIcon ? /* @__PURE__ */ React.createElement(itemConfig.icon, null) : /* @__PURE__ */ React.createElement(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
203
|
+
style: {
|
|
204
|
+
backgroundColor: item.color
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
itemConfig == null ? void 0 : itemConfig.label
|
|
209
|
+
);
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
ChartLegendContent.displayName = "ChartLegend";
|
|
215
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
216
|
+
if (typeof payload !== "object" || payload === null) {
|
|
217
|
+
return void 0;
|
|
218
|
+
}
|
|
219
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
220
|
+
let configLabelKey = key;
|
|
221
|
+
if (key in payload && typeof payload[key] === "string") {
|
|
222
|
+
configLabelKey = payload[key];
|
|
223
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
224
|
+
configLabelKey = payloadPayload[key];
|
|
225
|
+
}
|
|
226
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
exports.ChartContainer = ChartContainer; exports.ChartLegend = ChartLegend; exports.ChartLegendContent = ChartLegendContent; exports.ChartStyle = ChartStyle; exports.ChartTooltip = ChartTooltip; exports.ChartTooltipContent = ChartTooltipContent;
|
|
236
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/ahnjun/projects/egose-shadcn/package/dist/components/ui/chart.js","../../../components/ui/chart.tsx"],"names":[],"mappings":"AAAA,uWAAY;AACZ;AACE;AACF,0DAAgC;AAChC;AACE;AACA;AACF,0DAAgC;AAChC;AACA;ACPA,2EAAuB;AACvB,gGAAmC;AAKnC,IAAM,OAAA,EAAS,EAAE,KAAA,EAAO,EAAA,EAAI,IAAA,EAAM,QAAQ,CAAA;AAgB1C,IAAM,aAAA,EAAqB,KAAA,CAAA,aAAA,CAAwC,IAAI,CAAA;AAEvE,SAAS,QAAA,CAAA,EAAW;AAClB,EAAA,MAAM,QAAA,EAAgB,KAAA,CAAA,UAAA,CAAW,YAAY,CAAA;AAE7C,EAAA,GAAA,CAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,KAAA,CAAM,mDAAmD,CAAA;AAAA,EACrE;AAEA,EAAA,OAAO,OAAA;AACT;AAEA,IAAM,eAAA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AGV,YAAA;AAAA,YAAA;AACW,cAAA;AACH,cAAA;AACiB,gBAAA;AACxB,cAAA;AAAA,YAAA;AACF,UAAA;AAEW,UAAA;AACf,QAAA;AAEH,MAAA;AACH,IAAA;AAEJ,EAAA;AACF;AACiC;AAO/B;AACqD,EAAA;AAC5C,IAAA;AACT,EAAA;AAIS,EAAA;AAKoB,EAAA;AAK3B,EAAA;AACoD,IAAA;AAIpD,EAAA;AAIA,IAAA;AACF,EAAA;AAGyB,EAAA;AAE3B;ADhI4D;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/ahnjun/projects/egose-shadcn/package/dist/components/ui/chart.js","sourcesContent":[null,"\"use client\"\n\nimport * as React from \"react\"\nimport * as RechartsPrimitive from \"recharts\"\n\nimport { cn } from \"@/lib/utils\"\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const\n\nexport type ChartConfig = {\n [k in string]: {\n label?: React.ReactNode\n icon?: React.ComponentType\n } & (\n | { color?: string; theme?: never }\n | { color?: never; theme: Record<keyof typeof THEMES, string> }\n )\n}\n\ntype ChartContextProps = {\n config: ChartConfig\n}\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null)\n\nfunction useChart() {\n const context = React.useContext(ChartContext)\n\n if (!context) {\n throw new Error(\"useChart must be used within a <ChartContainer />\")\n }\n\n return context\n}\n\nconst ChartContainer = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> & {\n config: ChartConfig\n children: React.ComponentProps<\n typeof RechartsPrimitive.ResponsiveContainer\n >[\"children\"]\n }\n>(({ id, className, children, config, ...props }, ref) => {\n const uniqueId = React.useId()\n const chartId = `chart-${id || uniqueId.replace(/:/g, \"\")}`\n\n return (\n <ChartContext.Provider value={{ config }}>\n <div\n data-chart={chartId}\n ref={ref}\n className={cn(\n \"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-none [&_.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[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none\",\n className\n )}\n {...props}\n >\n <ChartStyle id={chartId} config={config} />\n <RechartsPrimitive.ResponsiveContainer>\n {children}\n </RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n )\n})\nChartContainer.displayName = \"Chart\"\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n const colorConfig = Object.entries(config).filter(\n ([, config]) => config.theme || config.color\n )\n\n if (!colorConfig.length) {\n return null\n }\n\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: Object.entries(THEMES)\n .map(\n ([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n .map(([key, itemConfig]) => {\n const color =\n itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||\n itemConfig.color\n return color ? ` --color-${key}: ${color};` : null\n })\n .join(\"\\n\")}\n}\n`\n )\n .join(\"\\n\"),\n }}\n />\n )\n}\n\nconst ChartTooltip = RechartsPrimitive.Tooltip\n\nconst ChartTooltipContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n React.ComponentProps<\"div\"> & {\n hideLabel?: boolean\n hideIndicator?: boolean\n indicator?: \"line\" | \"dot\" | \"dashed\"\n nameKey?: string\n labelKey?: string\n }\n>(\n (\n {\n active,\n payload,\n className,\n indicator = \"dot\",\n hideLabel = false,\n hideIndicator = false,\n label,\n labelFormatter,\n labelClassName,\n formatter,\n color,\n nameKey,\n labelKey,\n },\n ref\n ) => {\n const { config } = useChart()\n\n const tooltipLabel = React.useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null\n }\n\n const [item] = payload\n const key = `${labelKey || item.dataKey || item.name || \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const value =\n !labelKey && typeof label === \"string\"\n ? config[label as keyof typeof config]?.label || label\n : itemConfig?.label\n\n if (labelFormatter) {\n return (\n <div className={cn(\"font-medium\", labelClassName)}>\n {labelFormatter(value, payload)}\n </div>\n )\n }\n\n if (!value) {\n return null\n }\n\n return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>\n }, [\n label,\n labelFormatter,\n payload,\n hideLabel,\n labelClassName,\n config,\n labelKey,\n ])\n\n if (!active || !payload?.length) {\n return null\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\"\n\n return (\n <div\n ref={ref}\n className={cn(\n \"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\",\n className\n )}\n >\n {!nestLabel ? tooltipLabel : null}\n <div className=\"grid gap-1.5\">\n {payload.map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n const indicatorColor = color || item.payload.fill || item.color\n\n return (\n <div\n key={item.dataKey}\n className={cn(\n \"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground\",\n indicator === \"dot\" && \"items-center\"\n )}\n >\n {formatter && item?.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload)\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\n \"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]\",\n {\n \"h-2.5 w-2.5\": indicator === \"dot\",\n \"w-1\": indicator === \"line\",\n \"w-0 border-[1.5px] border-dashed bg-transparent\":\n indicator === \"dashed\",\n \"my-0.5\": nestLabel && indicator === \"dashed\",\n }\n )}\n style={\n {\n \"--color-bg\": indicatorColor,\n \"--color-border\": indicatorColor,\n } as React.CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\n \"flex flex-1 justify-between leading-none\",\n nestLabel ? \"items-end\" : \"items-center\"\n )}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">\n {itemConfig?.label || item.name}\n </span>\n </div>\n {item.value && (\n <span className=\"font-mono font-medium tabular-nums text-foreground\">\n {item.value.toLocaleString()}\n </span>\n )}\n </div>\n </>\n )}\n </div>\n )\n })}\n </div>\n </div>\n )\n }\n)\nChartTooltipContent.displayName = \"ChartTooltip\"\n\nconst ChartLegend = RechartsPrimitive.Legend\n\nconst ChartLegendContent = React.forwardRef<\n HTMLDivElement,\n React.ComponentProps<\"div\"> &\n Pick<RechartsPrimitive.LegendProps, \"payload\" | \"verticalAlign\"> & {\n hideIcon?: boolean\n nameKey?: string\n }\n>(\n (\n { className, hideIcon = false, payload, verticalAlign = \"bottom\", nameKey },\n ref\n ) => {\n const { config } = useChart()\n\n if (!payload?.length) {\n return null\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-center justify-center gap-4\",\n verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n className\n )}\n >\n {payload.map((item) => {\n const key = `${nameKey || item.dataKey || \"value\"}`\n const itemConfig = getPayloadConfigFromPayload(config, item, key)\n\n return (\n <div\n key={item.value}\n className={cn(\n \"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground\"\n )}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"h-2 w-2 shrink-0 rounded-[2px]\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n )\n })}\n </div>\n )\n }\n)\nChartLegendContent.displayName = \"ChartLegend\"\n\n// Helper to extract item config from a payload.\nfunction getPayloadConfigFromPayload(\n config: ChartConfig,\n payload: unknown,\n key: string\n) {\n if (typeof payload !== \"object\" || payload === null) {\n return undefined\n }\n\n const payloadPayload =\n \"payload\" in payload &&\n typeof payload.payload === \"object\" &&\n payload.payload !== null\n ? payload.payload\n : undefined\n\n let configLabelKey: string = key\n\n if (\n key in payload &&\n typeof payload[key as keyof typeof payload] === \"string\"\n ) {\n configLabelKey = payload[key as keyof typeof payload] as string\n } else if (\n payloadPayload &&\n key in payloadPayload &&\n typeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n ) {\n configLabelKey = payloadPayload[\n key as keyof typeof payloadPayload\n ] as string\n }\n\n return configLabelKey in config\n ? config[configLabelKey]\n : config[key as keyof typeof config]\n}\n\nexport {\n ChartContainer,\n ChartTooltip,\n ChartTooltipContent,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n}\n"]}
|