@hanzo/ui 5.3.32 → 5.3.33
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/dist/calendar-ext/index.js +203 -0
- package/dist/calendar-ext/index.mjs +165 -0
- package/dist/charts/index.js +278 -0
- package/dist/charts/index.mjs +250 -0
- package/dist/kanban/index.js +594 -0
- package/dist/kanban/index.mjs +572 -0
- package/dist/mermaid/index.js +275 -0
- package/dist/mermaid/index.mjs +249 -0
- package/package.json +58 -14
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React2 = require('react');
|
|
5
|
+
var reactIcons = require('@radix-ui/react-icons');
|
|
6
|
+
var reactDayPicker = require('react-day-picker');
|
|
7
|
+
var clsx = require('clsx');
|
|
8
|
+
var tailwindMerge = require('tailwind-merge');
|
|
9
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
10
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
11
|
+
var lucideReact = require('lucide-react');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
+
var dateFns = require('date-fns');
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
34
|
+
|
|
35
|
+
var __defProp = Object.defineProperty;
|
|
36
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
37
|
+
function cn(...inputs) {
|
|
38
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
39
|
+
}
|
|
40
|
+
__name(cn, "cn");
|
|
41
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
42
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
43
|
+
{
|
|
44
|
+
variants: {
|
|
45
|
+
variant: {
|
|
46
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
47
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
48
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
49
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
50
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
51
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
52
|
+
// Keep the additional Hanzo variants for backward compatibility
|
|
53
|
+
primary: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
54
|
+
linkFG: "text-primary underline-offset-4 hover:underline",
|
|
55
|
+
linkMuted: "text-muted-foreground underline-offset-4 hover:underline hover:text-foreground"
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
default: "h-9 px-4 py-2",
|
|
59
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
60
|
+
lg: "h-10 rounded-md px-8",
|
|
61
|
+
icon: "h-9 w-9"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
variant: "default",
|
|
66
|
+
size: "default"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
var Button = React2__namespace.forwardRef(
|
|
71
|
+
({ className, variant, size, asChild = false, isLoading = false, children, ...props }, ref) => {
|
|
72
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
74
|
+
Comp,
|
|
75
|
+
{
|
|
76
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
77
|
+
ref,
|
|
78
|
+
...props,
|
|
79
|
+
children: [
|
|
80
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
81
|
+
lucideReact.Loader2,
|
|
82
|
+
{
|
|
83
|
+
className: cn("h-4 w-4 animate-spin", size !== "icon" && "mr-2")
|
|
84
|
+
}
|
|
85
|
+
) : null,
|
|
86
|
+
isLoading && size === "icon" ? null : children
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
Button.displayName = "Button";
|
|
93
|
+
function Calendar({
|
|
94
|
+
className,
|
|
95
|
+
classNames,
|
|
96
|
+
showOutsideDays = true,
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
100
|
+
reactDayPicker.DayPicker,
|
|
101
|
+
{
|
|
102
|
+
showOutsideDays,
|
|
103
|
+
className: cn("p-3", className),
|
|
104
|
+
classNames: {
|
|
105
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
106
|
+
month: "space-y-4",
|
|
107
|
+
caption: "flex justify-center pt-1 relative items-center",
|
|
108
|
+
caption_label: "text-sm font-medium",
|
|
109
|
+
nav: "space-x-1 flex items-center",
|
|
110
|
+
nav_button: cn(
|
|
111
|
+
buttonVariants({ variant: "outline" }),
|
|
112
|
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
113
|
+
),
|
|
114
|
+
nav_button_previous: "absolute left-1",
|
|
115
|
+
nav_button_next: "absolute right-1",
|
|
116
|
+
table: "w-full border-collapse space-y-1",
|
|
117
|
+
head_row: "flex",
|
|
118
|
+
head_cell: "text-muted-1 rounded-md w-8 font-normal text-[0.8rem]",
|
|
119
|
+
row: "flex w-full mt-2",
|
|
120
|
+
cell: cn(
|
|
121
|
+
"relative p-0 text-center text-sm focus-within:relative focus-within:z-above-content [&:has([aria-selected])]:bg-level-1 [&:has([aria-selected].day-outside)]:bg-level-1/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
|
|
122
|
+
props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md"
|
|
123
|
+
),
|
|
124
|
+
day: cn(
|
|
125
|
+
buttonVariants({ variant: "ghost" }),
|
|
126
|
+
"h-8 w-8 p-0 font-normal aria-selected:opacity-100"
|
|
127
|
+
),
|
|
128
|
+
day_range_start: "day-range-start",
|
|
129
|
+
day_range_end: "day-range-end",
|
|
130
|
+
day_selected: "bg-primary text-primary-fg hover:bg-primary hover:text-primary-fg focus:bg-primary focus:text-primary-fg",
|
|
131
|
+
day_today: "bg-accent text-primary-fg",
|
|
132
|
+
day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-1 aria-selected:opacity-30",
|
|
133
|
+
day_disabled: "text-muted-foreground opacity-50",
|
|
134
|
+
day_range_middle: "aria-selected:bg-accent aria-selected:text-primary-fg",
|
|
135
|
+
day_hidden: "invisible",
|
|
136
|
+
...classNames
|
|
137
|
+
},
|
|
138
|
+
components: {
|
|
139
|
+
Chevron: /* @__PURE__ */ __name(({ orientation, ...props2 }) => {
|
|
140
|
+
if (orientation === "left") {
|
|
141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronLeftIcon, { className: "h-4 w-4" });
|
|
142
|
+
}
|
|
143
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronRightIcon, { className: "h-4 w-4" });
|
|
144
|
+
}, "Chevron")
|
|
145
|
+
},
|
|
146
|
+
...props
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
__name(Calendar, "Calendar");
|
|
151
|
+
Calendar.displayName = "Calendar";
|
|
152
|
+
function CalendarDayButton({
|
|
153
|
+
className,
|
|
154
|
+
day,
|
|
155
|
+
modifiers,
|
|
156
|
+
...props
|
|
157
|
+
}) {
|
|
158
|
+
const defaultClassNames = reactDayPicker.getDefaultClassNames();
|
|
159
|
+
const ref = React2__namespace.default.useRef(null);
|
|
160
|
+
React2__namespace.default.useEffect(() => {
|
|
161
|
+
if (modifiers.focused) ref.current?.focus();
|
|
162
|
+
}, [modifiers.focused]);
|
|
163
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
+
Button,
|
|
165
|
+
{
|
|
166
|
+
ref,
|
|
167
|
+
variant: "ghost",
|
|
168
|
+
size: "icon",
|
|
169
|
+
"data-day": day.date.toLocaleDateString(),
|
|
170
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
171
|
+
"data-range-start": modifiers.range_start,
|
|
172
|
+
"data-range-end": modifiers.range_end,
|
|
173
|
+
"data-range-middle": modifiers.range_middle,
|
|
174
|
+
className: cn(
|
|
175
|
+
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",
|
|
176
|
+
defaultClassNames.day,
|
|
177
|
+
className
|
|
178
|
+
),
|
|
179
|
+
...props
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
__name(CalendarDayButton, "CalendarDayButton");
|
|
184
|
+
var calendar_default = Calendar;
|
|
185
|
+
|
|
186
|
+
Object.defineProperty(exports, "format", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () { return dateFns.format; }
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(exports, "formatDistance", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: function () { return dateFns.formatDistance; }
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(exports, "formatRelative", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () { return dateFns.formatRelative; }
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "parseISO", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () { return dateFns.parseISO; }
|
|
201
|
+
});
|
|
202
|
+
exports.Calendar = calendar_default;
|
|
203
|
+
exports.CalendarDayButton = CalendarDayButton;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React2 from 'react';
|
|
3
|
+
import React2__default from 'react';
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '@radix-ui/react-icons';
|
|
5
|
+
import { DayPicker, getDefaultClassNames } from 'react-day-picker';
|
|
6
|
+
import { clsx } from 'clsx';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
9
|
+
import { cva } from 'class-variance-authority';
|
|
10
|
+
import { Loader2 } from 'lucide-react';
|
|
11
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
|
+
export { format, formatDistance, formatRelative, parseISO } from 'date-fns';
|
|
13
|
+
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
16
|
+
function cn(...inputs) {
|
|
17
|
+
return twMerge(clsx(inputs));
|
|
18
|
+
}
|
|
19
|
+
__name(cn, "cn");
|
|
20
|
+
var buttonVariants = cva(
|
|
21
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
variant: {
|
|
25
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
26
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
27
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
28
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
29
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
30
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
31
|
+
// Keep the additional Hanzo variants for backward compatibility
|
|
32
|
+
primary: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
33
|
+
linkFG: "text-primary underline-offset-4 hover:underline",
|
|
34
|
+
linkMuted: "text-muted-foreground underline-offset-4 hover:underline hover:text-foreground"
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
default: "h-9 px-4 py-2",
|
|
38
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
39
|
+
lg: "h-10 rounded-md px-8",
|
|
40
|
+
icon: "h-9 w-9"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: {
|
|
44
|
+
variant: "default",
|
|
45
|
+
size: "default"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
var Button = React2.forwardRef(
|
|
50
|
+
({ className, variant, size, asChild = false, isLoading = false, children, ...props }, ref) => {
|
|
51
|
+
const Comp = asChild ? Slot : "button";
|
|
52
|
+
return /* @__PURE__ */ jsxs(
|
|
53
|
+
Comp,
|
|
54
|
+
{
|
|
55
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
56
|
+
ref,
|
|
57
|
+
...props,
|
|
58
|
+
children: [
|
|
59
|
+
isLoading ? /* @__PURE__ */ jsx(
|
|
60
|
+
Loader2,
|
|
61
|
+
{
|
|
62
|
+
className: cn("h-4 w-4 animate-spin", size !== "icon" && "mr-2")
|
|
63
|
+
}
|
|
64
|
+
) : null,
|
|
65
|
+
isLoading && size === "icon" ? null : children
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
Button.displayName = "Button";
|
|
72
|
+
function Calendar({
|
|
73
|
+
className,
|
|
74
|
+
classNames,
|
|
75
|
+
showOutsideDays = true,
|
|
76
|
+
...props
|
|
77
|
+
}) {
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
DayPicker,
|
|
80
|
+
{
|
|
81
|
+
showOutsideDays,
|
|
82
|
+
className: cn("p-3", className),
|
|
83
|
+
classNames: {
|
|
84
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
85
|
+
month: "space-y-4",
|
|
86
|
+
caption: "flex justify-center pt-1 relative items-center",
|
|
87
|
+
caption_label: "text-sm font-medium",
|
|
88
|
+
nav: "space-x-1 flex items-center",
|
|
89
|
+
nav_button: cn(
|
|
90
|
+
buttonVariants({ variant: "outline" }),
|
|
91
|
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
92
|
+
),
|
|
93
|
+
nav_button_previous: "absolute left-1",
|
|
94
|
+
nav_button_next: "absolute right-1",
|
|
95
|
+
table: "w-full border-collapse space-y-1",
|
|
96
|
+
head_row: "flex",
|
|
97
|
+
head_cell: "text-muted-1 rounded-md w-8 font-normal text-[0.8rem]",
|
|
98
|
+
row: "flex w-full mt-2",
|
|
99
|
+
cell: cn(
|
|
100
|
+
"relative p-0 text-center text-sm focus-within:relative focus-within:z-above-content [&:has([aria-selected])]:bg-level-1 [&:has([aria-selected].day-outside)]:bg-level-1/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
|
|
101
|
+
props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md"
|
|
102
|
+
),
|
|
103
|
+
day: cn(
|
|
104
|
+
buttonVariants({ variant: "ghost" }),
|
|
105
|
+
"h-8 w-8 p-0 font-normal aria-selected:opacity-100"
|
|
106
|
+
),
|
|
107
|
+
day_range_start: "day-range-start",
|
|
108
|
+
day_range_end: "day-range-end",
|
|
109
|
+
day_selected: "bg-primary text-primary-fg hover:bg-primary hover:text-primary-fg focus:bg-primary focus:text-primary-fg",
|
|
110
|
+
day_today: "bg-accent text-primary-fg",
|
|
111
|
+
day_outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-1 aria-selected:opacity-30",
|
|
112
|
+
day_disabled: "text-muted-foreground opacity-50",
|
|
113
|
+
day_range_middle: "aria-selected:bg-accent aria-selected:text-primary-fg",
|
|
114
|
+
day_hidden: "invisible",
|
|
115
|
+
...classNames
|
|
116
|
+
},
|
|
117
|
+
components: {
|
|
118
|
+
Chevron: /* @__PURE__ */ __name(({ orientation, ...props2 }) => {
|
|
119
|
+
if (orientation === "left") {
|
|
120
|
+
return /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "h-4 w-4" });
|
|
121
|
+
}
|
|
122
|
+
return /* @__PURE__ */ jsx(ChevronRightIcon, { className: "h-4 w-4" });
|
|
123
|
+
}, "Chevron")
|
|
124
|
+
},
|
|
125
|
+
...props
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
__name(Calendar, "Calendar");
|
|
130
|
+
Calendar.displayName = "Calendar";
|
|
131
|
+
function CalendarDayButton({
|
|
132
|
+
className,
|
|
133
|
+
day,
|
|
134
|
+
modifiers,
|
|
135
|
+
...props
|
|
136
|
+
}) {
|
|
137
|
+
const defaultClassNames = getDefaultClassNames();
|
|
138
|
+
const ref = React2__default.useRef(null);
|
|
139
|
+
React2__default.useEffect(() => {
|
|
140
|
+
if (modifiers.focused) ref.current?.focus();
|
|
141
|
+
}, [modifiers.focused]);
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
Button,
|
|
144
|
+
{
|
|
145
|
+
ref,
|
|
146
|
+
variant: "ghost",
|
|
147
|
+
size: "icon",
|
|
148
|
+
"data-day": day.date.toLocaleDateString(),
|
|
149
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
150
|
+
"data-range-start": modifiers.range_start,
|
|
151
|
+
"data-range-end": modifiers.range_end,
|
|
152
|
+
"data-range-middle": modifiers.range_middle,
|
|
153
|
+
className: cn(
|
|
154
|
+
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",
|
|
155
|
+
defaultClassNames.day,
|
|
156
|
+
className
|
|
157
|
+
),
|
|
158
|
+
...props
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
__name(CalendarDayButton, "CalendarDayButton");
|
|
163
|
+
var calendar_default = Calendar;
|
|
164
|
+
|
|
165
|
+
export { calendar_default as Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var RechartsPrimitive = require('recharts');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
|
+
var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimitive);
|
|
30
|
+
|
|
31
|
+
var __defProp = Object.defineProperty;
|
|
32
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
33
|
+
function cn(...inputs) {
|
|
34
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
35
|
+
}
|
|
36
|
+
__name(cn, "cn");
|
|
37
|
+
var THEMES = { light: "", dark: ".dark" };
|
|
38
|
+
var ChartContext = React__namespace.createContext(null);
|
|
39
|
+
function useChart() {
|
|
40
|
+
const context = React__namespace.useContext(ChartContext);
|
|
41
|
+
if (!context) {
|
|
42
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
43
|
+
}
|
|
44
|
+
return context;
|
|
45
|
+
}
|
|
46
|
+
__name(useChart, "useChart");
|
|
47
|
+
function ChartContainer({
|
|
48
|
+
id,
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
config,
|
|
52
|
+
...props
|
|
53
|
+
}) {
|
|
54
|
+
const uniqueId = React__namespace.useId();
|
|
55
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
56
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
"data-slot": "chart",
|
|
60
|
+
"data-chart": chartId,
|
|
61
|
+
className: cn(
|
|
62
|
+
"[&_.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-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
...props,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChartStyle, { id: chartId, config }),
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive__namespace.ResponsiveContainer, { children })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
) });
|
|
72
|
+
}
|
|
73
|
+
__name(ChartContainer, "ChartContainer");
|
|
74
|
+
var ChartStyle = /* @__PURE__ */ __name(({ id, config }) => {
|
|
75
|
+
const colorConfig = Object.entries(config).filter(
|
|
76
|
+
([, config2]) => config2.theme || config2.color
|
|
77
|
+
);
|
|
78
|
+
if (!colorConfig.length) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
+
"style",
|
|
83
|
+
{
|
|
84
|
+
dangerouslySetInnerHTML: {
|
|
85
|
+
__html: Object.entries(THEMES).map(
|
|
86
|
+
([theme, prefix]) => `
|
|
87
|
+
${prefix} [data-chart=${id}] {
|
|
88
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
89
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
90
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
91
|
+
}).join("\n")}
|
|
92
|
+
}
|
|
93
|
+
`
|
|
94
|
+
).join("\n")
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}, "ChartStyle");
|
|
99
|
+
var ChartTooltip = RechartsPrimitive__namespace.Tooltip;
|
|
100
|
+
function ChartTooltipContent({
|
|
101
|
+
active,
|
|
102
|
+
payload,
|
|
103
|
+
className,
|
|
104
|
+
indicator = "dot",
|
|
105
|
+
hideLabel = false,
|
|
106
|
+
hideIndicator = false,
|
|
107
|
+
label,
|
|
108
|
+
labelFormatter,
|
|
109
|
+
labelClassName,
|
|
110
|
+
formatter,
|
|
111
|
+
color,
|
|
112
|
+
nameKey,
|
|
113
|
+
labelKey
|
|
114
|
+
}) {
|
|
115
|
+
const { config } = useChart();
|
|
116
|
+
const tooltipLabel = React__namespace.useMemo(() => {
|
|
117
|
+
if (hideLabel || !payload?.length) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const [item] = payload;
|
|
121
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
122
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
123
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
124
|
+
if (labelFormatter) {
|
|
125
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
|
|
126
|
+
}
|
|
127
|
+
if (!value) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("font-medium", labelClassName), children: value });
|
|
131
|
+
}, [
|
|
132
|
+
label,
|
|
133
|
+
labelFormatter,
|
|
134
|
+
payload,
|
|
135
|
+
hideLabel,
|
|
136
|
+
labelClassName,
|
|
137
|
+
config,
|
|
138
|
+
labelKey
|
|
139
|
+
]);
|
|
140
|
+
if (!active || !payload?.length) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: cn(
|
|
148
|
+
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
|
149
|
+
className
|
|
150
|
+
),
|
|
151
|
+
children: [
|
|
152
|
+
!nestLabel ? tooltipLabel : null,
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-1.5", children: payload.map((item, index) => {
|
|
154
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
155
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
156
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
157
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
className: cn(
|
|
161
|
+
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
162
|
+
indicator === "dot" && "items-center"
|
|
163
|
+
),
|
|
164
|
+
children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
165
|
+
itemConfig?.icon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
className: cn(
|
|
169
|
+
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
170
|
+
{
|
|
171
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
172
|
+
"w-1": indicator === "line",
|
|
173
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
174
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
style: {
|
|
178
|
+
"--color-bg": indicatorColor,
|
|
179
|
+
"--color-border": indicatorColor
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
className: cn(
|
|
187
|
+
"flex flex-1 justify-between leading-none",
|
|
188
|
+
nestLabel ? "items-end" : "items-center"
|
|
189
|
+
),
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
|
|
192
|
+
nestLabel ? tooltipLabel : null,
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: itemConfig?.label || item.name })
|
|
194
|
+
] }),
|
|
195
|
+
item.value && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-mono font-medium tabular-nums", children: item.value.toLocaleString() })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] })
|
|
200
|
+
},
|
|
201
|
+
item.dataKey
|
|
202
|
+
);
|
|
203
|
+
}) })
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
__name(ChartTooltipContent, "ChartTooltipContent");
|
|
209
|
+
var ChartLegend = RechartsPrimitive__namespace.Legend;
|
|
210
|
+
function ChartLegendContent({
|
|
211
|
+
className,
|
|
212
|
+
hideIcon = false,
|
|
213
|
+
payload,
|
|
214
|
+
verticalAlign = "bottom",
|
|
215
|
+
nameKey
|
|
216
|
+
}) {
|
|
217
|
+
const { config } = useChart();
|
|
218
|
+
if (!payload?.length) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
className: cn(
|
|
225
|
+
"flex items-center justify-center gap-4",
|
|
226
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
227
|
+
className
|
|
228
|
+
),
|
|
229
|
+
children: payload.map((item) => {
|
|
230
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
231
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
232
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
className: cn(
|
|
236
|
+
"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
|
|
237
|
+
),
|
|
238
|
+
children: [
|
|
239
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsxRuntime.jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
243
|
+
style: {
|
|
244
|
+
backgroundColor: item.color
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
itemConfig?.label
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
item.value
|
|
252
|
+
);
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
__name(ChartLegendContent, "ChartLegendContent");
|
|
258
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
259
|
+
if (typeof payload !== "object" || payload === null) {
|
|
260
|
+
return void 0;
|
|
261
|
+
}
|
|
262
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
263
|
+
let configLabelKey = key;
|
|
264
|
+
if (key in payload && typeof payload[key] === "string") {
|
|
265
|
+
configLabelKey = payload[key];
|
|
266
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
267
|
+
configLabelKey = payloadPayload[key];
|
|
268
|
+
}
|
|
269
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
270
|
+
}
|
|
271
|
+
__name(getPayloadConfigFromPayload, "getPayloadConfigFromPayload");
|
|
272
|
+
|
|
273
|
+
exports.ChartContainer = ChartContainer;
|
|
274
|
+
exports.ChartLegend = ChartLegend;
|
|
275
|
+
exports.ChartLegendContent = ChartLegendContent;
|
|
276
|
+
exports.ChartStyle = ChartStyle;
|
|
277
|
+
exports.ChartTooltip = ChartTooltip;
|
|
278
|
+
exports.ChartTooltipContent = ChartTooltipContent;
|