@arolariu/components 0.2.0 → 0.3.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 +11 -0
- package/dist/components/ui/accordion.d.ts +4 -4
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +19 -27
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +17 -11
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +38 -61
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts +4 -5
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +17 -20
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +1 -2
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.js +1 -8
- package/dist/components/ui/aspect-ratio.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +3 -3
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar.js +16 -19
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +7 -10
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +16 -8
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +28 -35
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/button-group.d.ts +13 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +47 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +3 -2
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +15 -14
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +20 -20
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.d.ts +7 -8
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +31 -44
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.d.ts +5 -6
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +30 -21
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/chart.d.ts +35 -27
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/chart.js +28 -26
- package/dist/components/ui/chart.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts +1 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +10 -12
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible.d.ts +3 -4
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +3 -20
- package/dist/components/ui/collapsible.js.map +1 -1
- package/dist/components/ui/command.d.ts +78 -16
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +47 -72
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +21 -19
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +57 -101
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +16 -12
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +36 -64
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.d.ts +19 -10
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +32 -57
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +21 -19
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +64 -108
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdrawer.d.ts +1 -1
- package/dist/components/ui/dropdrawer.d.ts.map +1 -1
- package/dist/components/ui/dropdrawer.js +2 -5
- package/dist/components/ui/dropdrawer.js.map +1 -1
- package/dist/components/ui/empty.d.ts +13 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +65 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/field.d.ts +25 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +135 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/form.d.ts +5 -6
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/form.js +28 -27
- package/dist/components/ui/form.js.map +1 -1
- package/dist/components/ui/hover-card.d.ts +3 -3
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/hover-card.js +11 -25
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +91 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +30 -7
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp.js +23 -26
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +6 -7
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/item.d.ts +24 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +122 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +5 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +21 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/label.d.ts +2 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +8 -7
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/menubar.d.ts +18 -16
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar.js +73 -93
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +8 -10
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +37 -55
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +24 -9
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +33 -45
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.d.ts +4 -4
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +9 -25
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +1 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +5 -7
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/radio-group.d.ts +2 -2
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group.js +16 -19
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/resizable.d.ts +20 -5
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +9 -21
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +2 -2
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +12 -16
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/select.d.ts +10 -12
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +54 -77
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts +1 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +6 -7
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/sheet.d.ts +23 -11
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +54 -66
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +34 -38
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +113 -122
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/skeleton.js +1 -2
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/slider.d.ts +1 -1
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +11 -30
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/sonner.d.ts +4 -2
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/sonner.js +7 -4
- package/dist/components/ui/sonner.js.map +1 -1
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +16 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +2 -2
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +7 -9
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts +8 -8
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +36 -45
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -4
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +17 -26
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +6 -7
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +8 -3
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.js +11 -15
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +4 -1
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +7 -8
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +4 -4
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -38
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/typewriter.d.ts.map +1 -1
- package/dist/components/ui/typewriter.js +2 -6
- package/dist/components/ui/typewriter.js.map +1 -1
- package/dist/index.css +839 -1126
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/package.json +37 -2
- package/src/components/ui/accordion.tsx +43 -44
- package/src/components/ui/alert-dialog.tsx +88 -99
- package/src/components/ui/alert.tsx +23 -25
- package/src/components/ui/aspect-ratio.tsx +1 -9
- package/src/components/ui/avatar.tsx +29 -24
- package/src/components/ui/badge.tsx +8 -16
- package/src/components/ui/breadcrumb.tsx +70 -73
- package/src/components/ui/button-group.tsx +69 -0
- package/src/components/ui/button.tsx +18 -24
- package/src/components/ui/calendar.tsx +20 -22
- package/src/components/ui/card.tsx +52 -71
- package/src/components/ui/carousel.tsx +145 -133
- package/src/components/ui/chart.tsx +173 -183
- package/src/components/ui/checkbox.tsx +18 -18
- package/src/components/ui/collapsible.tsx +3 -25
- package/src/components/ui/command.tsx +100 -99
- package/src/components/ui/context-menu.tsx +150 -193
- package/src/components/ui/dialog.tsx +75 -110
- package/src/components/ui/drawer.tsx +74 -102
- package/src/components/ui/dropdown-menu.tsx +153 -200
- package/src/components/ui/dropdrawer.tsx +0 -5
- package/src/components/ui/empty.tsx +86 -0
- package/src/components/ui/field.tsx +198 -0
- package/src/components/ui/form.tsx +47 -48
- package/src/components/ui/hover-card.tsx +18 -37
- package/src/components/ui/input-group.tsx +145 -0
- package/src/components/ui/input-otp.tsx +49 -59
- package/src/components/ui/input.tsx +5 -6
- package/src/components/ui/item.tsx +163 -0
- package/src/components/ui/kbd.tsx +31 -0
- package/src/components/ui/label.tsx +14 -12
- package/src/components/ui/menubar.tsx +178 -201
- package/src/components/ui/navigation-menu.tsx +85 -100
- package/src/components/ui/pagination.tsx +74 -85
- package/src/components/ui/popover.tsx +19 -38
- package/src/components/ui/progress.tsx +15 -14
- package/src/components/ui/radio-group.tsx +19 -13
- package/src/components/ui/resizable.tsx +23 -37
- package/src/components/ui/scroll-area.tsx +32 -35
- package/src/components/ui/select.tsx +112 -127
- package/src/components/ui/separator.tsx +17 -19
- package/src/components/ui/sheet.tsx +87 -108
- package/src/components/ui/sidebar.tsx +262 -271
- package/src/components/ui/skeleton.tsx +2 -3
- package/src/components/ui/slider.tsx +10 -36
- package/src/components/ui/sonner.tsx +15 -9
- package/src/components/ui/spinner.tsx +18 -0
- package/src/components/ui/switch.tsx +18 -17
- package/src/components/ui/table.tsx +66 -71
- package/src/components/ui/tabs.tsx +36 -36
- package/src/components/ui/textarea.tsx +5 -4
- package/src/components/ui/toggle-group.tsx +21 -34
- package/src/components/ui/toggle.tsx +14 -16
- package/src/components/ui/tooltip.tsx +19 -43
- package/src/components/ui/typewriter.tsx +3 -4
- package/src/index.css +6 -6
- package/src/index.ts +43 -4
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
3
|
import * as React from "react";
|
|
6
4
|
import * as RechartsPrimitive from "recharts";
|
|
7
5
|
|
|
8
|
-
import type {LegendPayload} from "recharts/types/component/DefaultLegendContent";
|
|
9
|
-
import {NameType, Payload, ValueType} from "recharts/types/component/DefaultTooltipContent";
|
|
10
|
-
import type {Props as LegendProps} from "recharts/types/component/Legend";
|
|
11
|
-
import {TooltipContentProps} from "recharts/types/component/Tooltip";
|
|
12
|
-
|
|
13
6
|
import {cn} from "@/lib/utilities";
|
|
14
7
|
|
|
15
8
|
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
@@ -26,36 +19,6 @@ type ChartContextProps = {
|
|
|
26
19
|
config: ChartConfig;
|
|
27
20
|
};
|
|
28
21
|
|
|
29
|
-
export type CustomTooltipProps = TooltipContentProps<ValueType, NameType> & {
|
|
30
|
-
className?: string;
|
|
31
|
-
hideLabel?: boolean;
|
|
32
|
-
hideIndicator?: boolean;
|
|
33
|
-
indicator?: "line" | "dot" | "dashed";
|
|
34
|
-
nameKey?: string;
|
|
35
|
-
labelKey?: string;
|
|
36
|
-
labelFormatter?: (
|
|
37
|
-
label: TooltipContentProps<number, string>["label"],
|
|
38
|
-
payload: TooltipContentProps<number, string>["payload"],
|
|
39
|
-
) => React.ReactNode;
|
|
40
|
-
formatter?: (
|
|
41
|
-
value: number | string,
|
|
42
|
-
name: string,
|
|
43
|
-
item: Payload<number | string, string>,
|
|
44
|
-
index: number,
|
|
45
|
-
payload: ReadonlyArray<Payload<number | string, string>>,
|
|
46
|
-
) => React.ReactNode;
|
|
47
|
-
labelClassName?: string;
|
|
48
|
-
color?: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type ChartLegendContentProps = {
|
|
52
|
-
className?: string;
|
|
53
|
-
hideIcon?: boolean;
|
|
54
|
-
verticalAlign?: LegendProps["verticalAlign"];
|
|
55
|
-
payload?: LegendPayload[];
|
|
56
|
-
nameKey?: string;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
22
|
const ChartContext = React.createContext<ChartContextProps | null>(null);
|
|
60
23
|
|
|
61
24
|
function useChart() {
|
|
@@ -68,26 +31,23 @@ function useChart() {
|
|
|
68
31
|
return context;
|
|
69
32
|
}
|
|
70
33
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
config: ChartConfig;
|
|
79
|
-
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
80
|
-
}) {
|
|
34
|
+
const ChartContainer = React.forwardRef<
|
|
35
|
+
HTMLDivElement,
|
|
36
|
+
React.ComponentProps<"div"> & {
|
|
37
|
+
config: ChartConfig;
|
|
38
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
39
|
+
}
|
|
40
|
+
>(({id, className, children, config, ...props}, ref) => {
|
|
81
41
|
const uniqueId = React.useId();
|
|
82
42
|
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
83
43
|
|
|
84
44
|
return (
|
|
85
45
|
<ChartContext.Provider value={{config}}>
|
|
86
46
|
<div
|
|
87
|
-
data-slot='chart'
|
|
88
47
|
data-chart={chartId}
|
|
48
|
+
ref={ref}
|
|
89
49
|
className={cn(
|
|
90
|
-
"[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-
|
|
50
|
+
"[&_.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-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 flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none",
|
|
91
51
|
className,
|
|
92
52
|
)}
|
|
93
53
|
{...props}>
|
|
@@ -99,7 +59,8 @@ function ChartContainer({
|
|
|
99
59
|
</div>
|
|
100
60
|
</ChartContext.Provider>
|
|
101
61
|
);
|
|
102
|
-
}
|
|
62
|
+
});
|
|
63
|
+
ChartContainer.displayName = "Chart";
|
|
103
64
|
|
|
104
65
|
const ChartStyle = ({id, config}: {id: string; config: ChartConfig}) => {
|
|
105
66
|
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
|
@@ -114,17 +75,17 @@ const ChartStyle = ({id, config}: {id: string; config: ChartConfig}) => {
|
|
|
114
75
|
__html: Object.entries(THEMES)
|
|
115
76
|
.map(
|
|
116
77
|
([theme, prefix]) => `
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
78
|
+
${prefix} [data-chart=${id}] {
|
|
79
|
+
${colorConfig
|
|
80
|
+
.map(([key, itemConfig]) => {
|
|
81
|
+
const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
|
|
82
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
83
|
+
})
|
|
84
|
+
.join("")}
|
|
85
|
+
}
|
|
86
|
+
`,
|
|
126
87
|
)
|
|
127
|
-
.join("
|
|
88
|
+
.join(""),
|
|
128
89
|
}}
|
|
129
90
|
/>
|
|
130
91
|
);
|
|
@@ -132,153 +93,182 @@ const ChartStyle = ({id, config}: {id: string; config: ChartConfig}) => {
|
|
|
132
93
|
|
|
133
94
|
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
134
95
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
96
|
+
const ChartTooltipContent = React.forwardRef<
|
|
97
|
+
HTMLDivElement,
|
|
98
|
+
React.ComponentProps<typeof RechartsPrimitive.Tooltip>
|
|
99
|
+
& React.ComponentProps<"div"> & {
|
|
100
|
+
hideLabel?: boolean;
|
|
101
|
+
hideIndicator?: boolean;
|
|
102
|
+
indicator?: "line" | "dot" | "dashed";
|
|
103
|
+
nameKey?: string;
|
|
104
|
+
labelKey?: string;
|
|
105
|
+
}
|
|
106
|
+
>(
|
|
107
|
+
(
|
|
108
|
+
{
|
|
109
|
+
active,
|
|
110
|
+
payload,
|
|
111
|
+
className,
|
|
112
|
+
indicator = "dot",
|
|
113
|
+
hideLabel = false,
|
|
114
|
+
hideIndicator = false,
|
|
115
|
+
label,
|
|
116
|
+
labelFormatter,
|
|
117
|
+
labelClassName,
|
|
118
|
+
formatter,
|
|
119
|
+
color,
|
|
120
|
+
nameKey,
|
|
121
|
+
labelKey,
|
|
122
|
+
},
|
|
123
|
+
ref,
|
|
124
|
+
) => {
|
|
125
|
+
const {config} = useChart();
|
|
126
|
+
|
|
127
|
+
const tooltipLabel = React.useMemo(() => {
|
|
128
|
+
if (hideLabel || !payload?.length) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const [item] = payload;
|
|
133
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
134
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
135
|
+
const value = !labelKey && typeof label === "string" ? config[label as keyof typeof config]?.label || label : itemConfig?.label;
|
|
136
|
+
|
|
137
|
+
if (labelFormatter) {
|
|
138
|
+
return <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (!value) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>;
|
|
146
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
147
|
+
|
|
148
|
+
if (!active || !payload?.length) {
|
|
154
149
|
return null;
|
|
155
150
|
}
|
|
156
151
|
|
|
157
|
-
const
|
|
158
|
-
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
159
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
160
|
-
const value = (() => {
|
|
161
|
-
const v = !labelKey && typeof label === "string" ? (config[label as keyof typeof config]?.label ?? label) : itemConfig?.label;
|
|
152
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
162
153
|
|
|
163
|
-
|
|
164
|
-
|
|
154
|
+
return (
|
|
155
|
+
<div
|
|
156
|
+
ref={ref}
|
|
157
|
+
className={cn(
|
|
158
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-neutral-200 border-neutral-200/50 bg-white px-2.5 py-1.5 text-xs shadow-xl dark:border-neutral-800 dark:border-neutral-800/50 dark:bg-neutral-950",
|
|
159
|
+
className,
|
|
160
|
+
)}>
|
|
161
|
+
{!nestLabel ? tooltipLabel : null}
|
|
162
|
+
<div className='grid gap-1.5'>
|
|
163
|
+
{payload
|
|
164
|
+
.filter((item) => item.type !== "none")
|
|
165
|
+
.map((item, index) => {
|
|
166
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
167
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
168
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<div
|
|
172
|
+
key={item.dataKey}
|
|
173
|
+
className={cn(
|
|
174
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-neutral-500 dark:[&>svg]:text-neutral-400",
|
|
175
|
+
indicator === "dot" && "items-center",
|
|
176
|
+
)}>
|
|
177
|
+
{formatter && item?.value !== undefined && item.name ? (
|
|
178
|
+
formatter(item.value, item.name, item, index, item.payload)
|
|
179
|
+
) : (
|
|
180
|
+
<>
|
|
181
|
+
{itemConfig?.icon ? (
|
|
182
|
+
<itemConfig.icon />
|
|
183
|
+
) : (
|
|
184
|
+
!hideIndicator && (
|
|
185
|
+
<div
|
|
186
|
+
className={cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
|
|
187
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
188
|
+
"w-1": indicator === "line",
|
|
189
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
190
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
191
|
+
})}
|
|
192
|
+
style={
|
|
193
|
+
{
|
|
194
|
+
"--color-bg": indicatorColor,
|
|
195
|
+
"--color-border": indicatorColor,
|
|
196
|
+
} as React.CSSProperties
|
|
197
|
+
}
|
|
198
|
+
/>
|
|
199
|
+
)
|
|
200
|
+
)}
|
|
201
|
+
<div className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}>
|
|
202
|
+
<div className='grid gap-1.5'>
|
|
203
|
+
{nestLabel ? tooltipLabel : null}
|
|
204
|
+
<span className='text-neutral-500 dark:text-neutral-400'>{itemConfig?.label || item.name}</span>
|
|
205
|
+
</div>
|
|
206
|
+
{item.value && (
|
|
207
|
+
<span className='font-mono font-medium text-neutral-950 tabular-nums dark:text-neutral-50'>
|
|
208
|
+
{item.value.toLocaleString()}
|
|
209
|
+
</span>
|
|
210
|
+
)}
|
|
211
|
+
</div>
|
|
212
|
+
</>
|
|
213
|
+
)}
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
})}
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
},
|
|
221
|
+
);
|
|
222
|
+
ChartTooltipContent.displayName = "ChartTooltip";
|
|
165
223
|
|
|
166
|
-
|
|
167
|
-
return <div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>;
|
|
168
|
-
}
|
|
224
|
+
const ChartLegend = RechartsPrimitive.Legend;
|
|
169
225
|
|
|
170
|
-
|
|
171
|
-
|
|
226
|
+
const ChartLegendContent = React.forwardRef<
|
|
227
|
+
HTMLDivElement,
|
|
228
|
+
React.ComponentProps<"div">
|
|
229
|
+
& Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
230
|
+
hideIcon?: boolean;
|
|
231
|
+
nameKey?: string;
|
|
172
232
|
}
|
|
233
|
+
>(({className, hideIcon = false, payload, verticalAlign = "bottom", nameKey}, ref) => {
|
|
234
|
+
const {config} = useChart();
|
|
173
235
|
|
|
174
|
-
|
|
175
|
-
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
176
|
-
|
|
177
|
-
if (!active || !payload?.length) {
|
|
236
|
+
if (!payload?.length) {
|
|
178
237
|
return null;
|
|
179
238
|
}
|
|
180
239
|
|
|
181
|
-
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
182
|
-
|
|
183
240
|
return (
|
|
184
241
|
<div
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
{payload.map((item, index) => {
|
|
192
|
-
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
242
|
+
ref={ref}
|
|
243
|
+
className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
|
|
244
|
+
{payload
|
|
245
|
+
.filter((item) => item.type !== "none")
|
|
246
|
+
.map((item) => {
|
|
247
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
193
248
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
194
|
-
const indicatorColor = color || item.payload.fill || item.color;
|
|
195
249
|
|
|
196
250
|
return (
|
|
197
251
|
<div
|
|
198
|
-
key={item.
|
|
199
|
-
className={cn(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
)}>
|
|
203
|
-
{formatter && item?.value !== undefined && item.name ? (
|
|
204
|
-
formatter(item.value, item.name, item, index, item.payload)
|
|
252
|
+
key={item.value}
|
|
253
|
+
className={cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-neutral-500 dark:[&>svg]:text-neutral-400")}>
|
|
254
|
+
{itemConfig?.icon && !hideIcon ? (
|
|
255
|
+
<itemConfig.icon />
|
|
205
256
|
) : (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
className={cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
|
|
213
|
-
"h-2.5 w-2.5": indicator === "dot",
|
|
214
|
-
"w-1": indicator === "line",
|
|
215
|
-
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
216
|
-
"my-0.5": nestLabel && indicator === "dashed",
|
|
217
|
-
})}
|
|
218
|
-
style={
|
|
219
|
-
{
|
|
220
|
-
"--color-bg": indicatorColor,
|
|
221
|
-
"--color-border": indicatorColor,
|
|
222
|
-
} as React.CSSProperties
|
|
223
|
-
}
|
|
224
|
-
/>
|
|
225
|
-
)
|
|
226
|
-
)}
|
|
227
|
-
<div className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}>
|
|
228
|
-
<div className='grid gap-1.5'>
|
|
229
|
-
{nestLabel ? tooltipLabel : null}
|
|
230
|
-
<span className='text-muted-foreground'>{itemConfig?.label || item.name}</span>
|
|
231
|
-
</div>
|
|
232
|
-
{item.value && (
|
|
233
|
-
<span className='text-foreground font-mono font-medium tabular-nums'>{item.value.toLocaleString()}</span>
|
|
234
|
-
)}
|
|
235
|
-
</div>
|
|
236
|
-
</>
|
|
257
|
+
<div
|
|
258
|
+
className='h-2 w-2 shrink-0 rounded-[2px]'
|
|
259
|
+
style={{
|
|
260
|
+
backgroundColor: item.color,
|
|
261
|
+
}}
|
|
262
|
+
/>
|
|
237
263
|
)}
|
|
264
|
+
{itemConfig?.label}
|
|
238
265
|
</div>
|
|
239
266
|
);
|
|
240
267
|
})}
|
|
241
|
-
</div>
|
|
242
268
|
</div>
|
|
243
269
|
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const ChartLegend = RechartsPrimitive.Legend;
|
|
247
|
-
|
|
248
|
-
function ChartLegendContent({className, hideIcon = false, payload, verticalAlign = "bottom", nameKey}: ChartLegendContentProps) {
|
|
249
|
-
const {config} = useChart();
|
|
250
|
-
|
|
251
|
-
if (!payload?.length) {
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return (
|
|
256
|
-
<div className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
|
|
257
|
-
{payload.map((item) => {
|
|
258
|
-
const key = `${nameKey || item.dataKey || "value"}`;
|
|
259
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
260
|
-
|
|
261
|
-
return (
|
|
262
|
-
<div
|
|
263
|
-
key={item.value}
|
|
264
|
-
className={cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3")}>
|
|
265
|
-
{itemConfig?.icon && !hideIcon ? (
|
|
266
|
-
<itemConfig.icon />
|
|
267
|
-
) : (
|
|
268
|
-
<div
|
|
269
|
-
className='h-2 w-2 shrink-0 rounded-[2px]'
|
|
270
|
-
style={{
|
|
271
|
-
backgroundColor: item.color,
|
|
272
|
-
}}
|
|
273
|
-
/>
|
|
274
|
-
)}
|
|
275
|
-
{itemConfig?.label}
|
|
276
|
-
</div>
|
|
277
|
-
);
|
|
278
|
-
})}
|
|
279
|
-
</div>
|
|
280
|
-
);
|
|
281
|
-
}
|
|
270
|
+
});
|
|
271
|
+
ChartLegendContent.displayName = "ChartLegend";
|
|
282
272
|
|
|
283
273
|
// Helper to extract item config from a payload.
|
|
284
274
|
function getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string) {
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
4
|
-
import {
|
|
4
|
+
import {Check} from "lucide-react";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
|
|
7
7
|
import {cn} from "@/lib/utilities";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
const Checkbox = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
12
|
+
>(({className, ...props}, ref) => (
|
|
13
|
+
<CheckboxPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn(
|
|
16
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-neutral-200 border-neutral-900 shadow focus-visible:ring-1 focus-visible:ring-neutral-950 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-neutral-900 data-[state=checked]:text-neutral-50 dark:border-neutral-50 dark:border-neutral-800 dark:focus-visible:ring-neutral-300 dark:data-[state=checked]:bg-neutral-50 dark:data-[state=checked]:text-neutral-900",
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}>
|
|
20
|
+
<CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
|
|
21
|
+
<Check className='h-4 w-4' />
|
|
22
|
+
</CheckboxPrimitive.Indicator>
|
|
23
|
+
</CheckboxPrimitive.Root>
|
|
24
|
+
));
|
|
25
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
26
26
|
|
|
27
27
|
export {Checkbox};
|
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4
|
-
import * as React from "react";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<CollapsiblePrimitive.Root
|
|
9
|
-
data-slot='collapsible'
|
|
10
|
-
{...props}
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
13
|
-
}
|
|
5
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
14
6
|
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<CollapsiblePrimitive.CollapsibleTrigger
|
|
18
|
-
data-slot='collapsible-trigger'
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
7
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
23
8
|
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<CollapsiblePrimitive.CollapsibleContent
|
|
27
|
-
data-slot='collapsible-content'
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
9
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
32
10
|
|
|
33
11
|
export {Collapsible, CollapsibleContent, CollapsibleTrigger};
|