@alpic-ai/ui 0.0.0-dev.g0999450 → 0.0.0-dev.g0a2a154
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/components/accordion-card.d.mts +5 -5
- package/dist/components/accordion.d.mts +5 -5
- package/dist/components/alert.d.mts +8 -8
- package/dist/components/area-chart.d.mts +62 -0
- package/dist/components/area-chart.mjs +269 -0
- package/dist/components/attachment-tile.d.mts +1 -1
- package/dist/components/avatar.d.mts +7 -7
- package/dist/components/badge.d.mts +1 -1
- package/dist/components/bar-chart.d.mts +48 -0
- package/dist/components/bar-chart.mjs +256 -0
- package/dist/components/bar-list.d.mts +28 -0
- package/dist/components/bar-list.mjs +98 -0
- package/dist/components/breadcrumb.d.mts +10 -10
- package/dist/components/button.d.mts +5 -5
- package/dist/components/card.d.mts +9 -9
- package/dist/components/chart-card.d.mts +25 -0
- package/dist/components/chart-card.mjs +48 -0
- package/dist/components/chart-container.d.mts +20 -0
- package/dist/components/chart-container.mjs +37 -0
- package/dist/components/chart-legend.d.mts +16 -0
- package/dist/components/chart-legend.mjs +26 -0
- package/dist/components/chart-tooltip.d.mts +33 -0
- package/dist/components/chart-tooltip.mjs +52 -0
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/combobox.d.mts +10 -10
- package/dist/components/command.d.mts +9 -9
- package/dist/components/copyable.d.mts +2 -2
- package/dist/components/description-list.d.mts +5 -5
- package/dist/components/dialog.d.mts +13 -13
- package/dist/components/donut-chart.d.mts +46 -0
- package/dist/components/donut-chart.mjs +185 -0
- package/dist/components/dropdown-menu.d.mts +17 -17
- package/dist/components/form.d.mts +18 -18
- package/dist/components/form.mjs +6 -6
- package/dist/components/github-button.d.mts +1 -1
- package/dist/components/heatmap-chart.d.mts +40 -0
- package/dist/components/heatmap-chart.mjs +198 -0
- package/dist/components/input-group.d.mts +4 -4
- package/dist/components/input.d.mts +4 -4
- package/dist/components/input.mjs +2 -2
- package/dist/components/label.d.mts +2 -2
- package/dist/components/line-chart.d.mts +55 -0
- package/dist/components/line-chart.mjs +211 -0
- package/dist/components/page-loader.d.mts +1 -1
- package/dist/components/pagination.d.mts +3 -3
- package/dist/components/popover.d.mts +5 -5
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/scroll-area.d.mts +3 -3
- package/dist/components/select.d.mts +9 -9
- package/dist/components/separator.d.mts +2 -2
- package/dist/components/sheet.d.mts +11 -11
- package/dist/components/shimmer-text.d.mts +3 -1
- package/dist/components/sidebar.d.mts +33 -33
- package/dist/components/sidebar.mjs +10 -10
- package/dist/components/skeleton.d.mts +1 -1
- package/dist/components/sonner.d.mts +5 -5
- package/dist/components/spinner.d.mts +2 -2
- package/dist/components/stat.d.mts +30 -0
- package/dist/components/stat.mjs +107 -0
- package/dist/components/status-dot.d.mts +1 -1
- package/dist/components/switch.d.mts +2 -2
- package/dist/components/table.d.mts +10 -10
- package/dist/components/tabs.d.mts +10 -10
- package/dist/components/tag.d.mts +3 -3
- package/dist/components/task-progress.d.mts +1 -1
- package/dist/components/textarea.d.mts +3 -3
- package/dist/components/textarea.mjs +2 -2
- package/dist/components/toggle-group.d.mts +3 -3
- package/dist/components/toggle-group.mjs +3 -3
- package/dist/components/tooltip.d.mts +5 -5
- package/dist/components/typography.d.mts +4 -4
- package/dist/components/wizard.d.mts +4 -22
- package/dist/components/wizard.mjs +1 -19
- package/dist/hooks/use-chart-theme.d.mts +18 -0
- package/dist/hooks/use-chart-theme.mjs +57 -0
- package/dist/hooks/use-mobile.mjs +3 -3
- package/dist/hooks/use-reduced-motion.d.mts +4 -0
- package/dist/hooks/use-reduced-motion.mjs +16 -0
- package/dist/lib/chart-palette.d.mts +4 -0
- package/dist/lib/chart-palette.mjs +95 -0
- package/dist/lib/chart.d.mts +14 -0
- package/dist/lib/chart.mjs +27 -0
- package/package.json +30 -29
- package/src/components/area-chart.tsx +339 -0
- package/src/components/bar-chart.tsx +309 -0
- package/src/components/bar-list.tsx +150 -0
- package/src/components/chart-card.tsx +63 -0
- package/src/components/chart-container.tsx +49 -0
- package/src/components/chart-legend.tsx +41 -0
- package/src/components/chart-tooltip.tsx +93 -0
- package/src/components/donut-chart.tsx +217 -0
- package/src/components/heatmap-chart.tsx +287 -0
- package/src/components/line-chart.tsx +264 -0
- package/src/components/stat.tsx +109 -0
- package/src/components/wizard.tsx +1 -35
- package/src/hooks/use-chart-theme.ts +75 -0
- package/src/hooks/use-reduced-motion.ts +17 -0
- package/src/lib/chart-palette.ts +110 -0
- package/src/lib/chart.ts +56 -0
- package/src/stories/area-chart.stories.tsx +198 -0
- package/src/stories/bar-chart.stories.tsx +167 -0
- package/src/stories/bar-list.stories.tsx +83 -0
- package/src/stories/donut-chart.stories.tsx +110 -0
- package/src/stories/heatmap-chart.stories.tsx +105 -0
- package/src/stories/line-chart.stories.tsx +144 -0
- package/src/stories/stat.stories.tsx +64 -0
- package/src/stories/wizard.stories.tsx +22 -4
- package/src/styles/tokens.css +63 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
|
-
import * as React from "react";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
3
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
4
|
|
|
5
5
|
//#region src/components/dropdown-menu.d.ts
|
|
6
6
|
declare function DropdownMenu({
|
|
7
7
|
...props
|
|
8
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>):
|
|
8
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Root>): React$1.JSX.Element;
|
|
9
9
|
declare function DropdownMenuPortal({
|
|
10
10
|
...props
|
|
11
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>):
|
|
11
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Portal>): React$1.JSX.Element;
|
|
12
12
|
declare function DropdownMenuTrigger({
|
|
13
13
|
...props
|
|
14
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>):
|
|
14
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): React$1.JSX.Element;
|
|
15
15
|
declare function DropdownMenuContent({
|
|
16
16
|
className,
|
|
17
17
|
sideOffset,
|
|
18
18
|
...props
|
|
19
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>):
|
|
19
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Content>): React$1.JSX.Element;
|
|
20
20
|
declare function DropdownMenuGroup({
|
|
21
21
|
...props
|
|
22
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>):
|
|
22
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Group>): React$1.JSX.Element;
|
|
23
23
|
declare const dropdownMenuItemVariants: (props?: ({
|
|
24
24
|
variant?: "default" | "destructive" | null | undefined;
|
|
25
25
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -28,43 +28,43 @@ declare function DropdownMenuItem({
|
|
|
28
28
|
inset,
|
|
29
29
|
variant,
|
|
30
30
|
...props
|
|
31
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & VariantProps<typeof dropdownMenuItemVariants> & {
|
|
31
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Item> & VariantProps<typeof dropdownMenuItemVariants> & {
|
|
32
32
|
inset?: boolean;
|
|
33
|
-
}):
|
|
33
|
+
}): React$1.JSX.Element;
|
|
34
34
|
declare function DropdownMenuLabel({
|
|
35
35
|
className,
|
|
36
36
|
inset,
|
|
37
37
|
...props
|
|
38
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
38
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
39
39
|
inset?: boolean;
|
|
40
|
-
}):
|
|
40
|
+
}): React$1.JSX.Element;
|
|
41
41
|
declare function DropdownMenuHeader({
|
|
42
42
|
className,
|
|
43
43
|
children,
|
|
44
44
|
...props
|
|
45
|
-
}: React.HTMLAttributes<HTMLDivElement>):
|
|
45
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
|
|
46
46
|
declare function DropdownMenuSeparator({
|
|
47
47
|
className,
|
|
48
48
|
...props
|
|
49
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>):
|
|
49
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React$1.JSX.Element;
|
|
50
50
|
declare function DropdownMenuShortcut({
|
|
51
51
|
className,
|
|
52
52
|
...props
|
|
53
|
-
}: React.ComponentProps<"span">):
|
|
53
|
+
}: React$1.ComponentProps<"span">): React$1.JSX.Element;
|
|
54
54
|
declare function DropdownMenuSub({
|
|
55
55
|
...props
|
|
56
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>):
|
|
56
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React$1.JSX.Element;
|
|
57
57
|
declare function DropdownMenuSubTrigger({
|
|
58
58
|
className,
|
|
59
59
|
inset,
|
|
60
60
|
children,
|
|
61
61
|
...props
|
|
62
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
62
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
63
63
|
inset?: boolean;
|
|
64
|
-
}):
|
|
64
|
+
}): React$1.JSX.Element;
|
|
65
65
|
declare function DropdownMenuSubContent({
|
|
66
66
|
className,
|
|
67
67
|
...props
|
|
68
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>):
|
|
68
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): React$1.JSX.Element;
|
|
69
69
|
//#endregion
|
|
70
70
|
export { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuHeader, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuItemVariants };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputProps } from "./input.mjs";
|
|
2
2
|
import { Label } from "./label.mjs";
|
|
3
3
|
import { TextareaProps } from "./textarea.mjs";
|
|
4
|
-
import * as React from "react";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
6
6
|
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
7
7
|
|
|
@@ -25,10 +25,10 @@ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransfor
|
|
|
25
25
|
register,
|
|
26
26
|
setFocus,
|
|
27
27
|
subscribe
|
|
28
|
-
}: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
28
|
+
}: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React$1.JSX.Element;
|
|
29
29
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
30
30
|
...props
|
|
31
|
-
}: ControllerProps<TFieldValues, TName>) =>
|
|
31
|
+
}: ControllerProps<TFieldValues, TName>) => React$1.JSX.Element;
|
|
32
32
|
declare const useFormField: () => {
|
|
33
33
|
invalid: boolean;
|
|
34
34
|
isDirty: boolean;
|
|
@@ -44,8 +44,8 @@ declare const useFormField: () => {
|
|
|
44
44
|
declare function FormItem({
|
|
45
45
|
className,
|
|
46
46
|
...props
|
|
47
|
-
}: React.ComponentProps<"div">):
|
|
48
|
-
interface FormLabelProps extends React.ComponentProps<typeof Label> {
|
|
47
|
+
}: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
48
|
+
interface FormLabelProps extends React$1.ComponentProps<typeof Label> {
|
|
49
49
|
required?: boolean;
|
|
50
50
|
tooltip?: string;
|
|
51
51
|
}
|
|
@@ -55,19 +55,19 @@ declare function FormLabel({
|
|
|
55
55
|
tooltip,
|
|
56
56
|
children,
|
|
57
57
|
...props
|
|
58
|
-
}: FormLabelProps):
|
|
58
|
+
}: FormLabelProps): React$1.JSX.Element;
|
|
59
59
|
declare function FormControl({
|
|
60
60
|
...props
|
|
61
|
-
}: React.ComponentProps<typeof Slot>):
|
|
61
|
+
}: React$1.ComponentProps<typeof Slot>): React$1.JSX.Element;
|
|
62
62
|
declare function FormDescription({
|
|
63
63
|
className,
|
|
64
64
|
...props
|
|
65
|
-
}: React.ComponentProps<"p">):
|
|
65
|
+
}: React$1.ComponentProps<"p">): React$1.JSX.Element;
|
|
66
66
|
declare function FormMessage({
|
|
67
67
|
className,
|
|
68
68
|
...props
|
|
69
|
-
}: React.ComponentProps<"p">):
|
|
70
|
-
interface FormHeaderProps extends React.ComponentProps<"div"> {
|
|
69
|
+
}: React$1.ComponentProps<"p">): React$1.JSX.Element | null;
|
|
70
|
+
interface FormHeaderProps extends React$1.ComponentProps<"div"> {
|
|
71
71
|
title: string;
|
|
72
72
|
description?: string;
|
|
73
73
|
}
|
|
@@ -76,11 +76,11 @@ declare function FormHeader({
|
|
|
76
76
|
description,
|
|
77
77
|
className,
|
|
78
78
|
...props
|
|
79
|
-
}: FormHeaderProps):
|
|
79
|
+
}: FormHeaderProps): React$1.JSX.Element;
|
|
80
80
|
declare function FormFields({
|
|
81
81
|
className,
|
|
82
82
|
...props
|
|
83
|
-
}: React.ComponentProps<"div">):
|
|
83
|
+
}: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
84
84
|
interface FormFieldBaseProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> {
|
|
85
85
|
control: ControllerProps<TFieldValues, TName>["control"];
|
|
86
86
|
name: TName;
|
|
@@ -100,7 +100,7 @@ declare function InputField<TFieldValues extends FieldValues, TName extends Fiel
|
|
|
100
100
|
description,
|
|
101
101
|
tooltip,
|
|
102
102
|
...inputProps
|
|
103
|
-
}: InputFieldProps<TFieldValues, TName>):
|
|
103
|
+
}: InputFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
104
104
|
interface TextareaFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName>, Omit<TextareaProps, "name" | "label"> {}
|
|
105
105
|
declare function TextareaField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
|
|
106
106
|
control,
|
|
@@ -111,7 +111,7 @@ declare function TextareaField<TFieldValues extends FieldValues, TName extends F
|
|
|
111
111
|
description,
|
|
112
112
|
tooltip,
|
|
113
113
|
...textareaProps
|
|
114
|
-
}: TextareaFieldProps<TFieldValues, TName>):
|
|
114
|
+
}: TextareaFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
115
115
|
interface SelectFieldOption {
|
|
116
116
|
value: string;
|
|
117
117
|
label: string;
|
|
@@ -131,7 +131,7 @@ declare function SelectField<TFieldValues extends FieldValues, TName extends Fie
|
|
|
131
131
|
tooltip,
|
|
132
132
|
options,
|
|
133
133
|
placeholder
|
|
134
|
-
}: SelectFieldProps<TFieldValues, TName>):
|
|
134
|
+
}: SelectFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
135
135
|
interface RadioFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName> {
|
|
136
136
|
options: SelectFieldOption[];
|
|
137
137
|
}
|
|
@@ -144,7 +144,7 @@ declare function RadioField<TFieldValues extends FieldValues, TName extends Fiel
|
|
|
144
144
|
description,
|
|
145
145
|
tooltip,
|
|
146
146
|
options
|
|
147
|
-
}: RadioFieldProps<TFieldValues, TName>):
|
|
147
|
+
}: RadioFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
148
148
|
interface ChecklistFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName> {
|
|
149
149
|
options: SelectFieldOption[];
|
|
150
150
|
}
|
|
@@ -157,7 +157,7 @@ declare function ChecklistField<TFieldValues extends FieldValues, TName extends
|
|
|
157
157
|
description,
|
|
158
158
|
tooltip,
|
|
159
159
|
options
|
|
160
|
-
}: ChecklistFieldProps<TFieldValues, TName>):
|
|
160
|
+
}: ChecklistFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
161
161
|
interface CheckboxFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends Omit<FormFieldBaseProps<TFieldValues, TName>, "required"> {}
|
|
162
162
|
declare function CheckboxField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
|
|
163
163
|
control,
|
|
@@ -166,6 +166,6 @@ declare function CheckboxField<TFieldValues extends FieldValues, TName extends F
|
|
|
166
166
|
label,
|
|
167
167
|
description,
|
|
168
168
|
tooltip
|
|
169
|
-
}: CheckboxFieldProps<TFieldValues, TName>):
|
|
169
|
+
}: CheckboxFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
170
170
|
//#endregion
|
|
171
171
|
export { CheckboxField, ChecklistField, Form, FormControl, FormDescription, FormField, FormFields, FormHeader, FormItem, FormLabel, FormMessage, InputField, RadioField, SelectField, type SelectFieldOption, TextareaField, useFormField };
|
package/dist/components/form.mjs
CHANGED
|
@@ -9,12 +9,12 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ".
|
|
|
9
9
|
import { Textarea } from "./textarea.mjs";
|
|
10
10
|
import { Info } from "lucide-react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import * as React from "react";
|
|
12
|
+
import * as React$1 from "react";
|
|
13
13
|
import { Slot } from "@radix-ui/react-slot";
|
|
14
14
|
import { Controller, FormProvider, useFormContext, useFormState } from "react-hook-form";
|
|
15
15
|
//#region src/components/form.tsx
|
|
16
16
|
const Form = FormProvider;
|
|
17
|
-
const FormFieldContext = React.createContext({});
|
|
17
|
+
const FormFieldContext = React$1.createContext({});
|
|
18
18
|
const FormField = ({ ...props }) => {
|
|
19
19
|
return /* @__PURE__ */ jsx(FormFieldContext.Provider, {
|
|
20
20
|
value: { name: props.name },
|
|
@@ -22,8 +22,8 @@ const FormField = ({ ...props }) => {
|
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
const useFormField = () => {
|
|
25
|
-
const fieldContext = React.useContext(FormFieldContext);
|
|
26
|
-
const itemContext = React.useContext(FormItemContext);
|
|
25
|
+
const fieldContext = React$1.useContext(FormFieldContext);
|
|
26
|
+
const itemContext = React$1.useContext(FormItemContext);
|
|
27
27
|
if (!fieldContext.name) throw new Error("useFormField should be used within <FormField>");
|
|
28
28
|
const { getFieldState } = useFormContext();
|
|
29
29
|
const formState = useFormState({ name: fieldContext.name });
|
|
@@ -38,9 +38,9 @@ const useFormField = () => {
|
|
|
38
38
|
...fieldState
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
const FormItemContext = React.createContext({});
|
|
41
|
+
const FormItemContext = React$1.createContext({});
|
|
42
42
|
function FormItem({ className, ...props }) {
|
|
43
|
-
const id = React.useId();
|
|
43
|
+
const id = React$1.useId();
|
|
44
44
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, {
|
|
45
45
|
value: { id },
|
|
46
46
|
children: /* @__PURE__ */ jsx("div", {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChartPaletteName } from "../lib/chart-palette.mjs";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/heatmap-chart.d.ts
|
|
5
|
+
interface HeatmapChartProps {
|
|
6
|
+
data: ReadonlyArray<Record<string, string | number | null | undefined>>;
|
|
7
|
+
xKey: string;
|
|
8
|
+
yKey: string;
|
|
9
|
+
dataKey?: string;
|
|
10
|
+
variant?: "square" | "dot";
|
|
11
|
+
palette?: ChartPaletteName;
|
|
12
|
+
xLabels?: readonly string[];
|
|
13
|
+
yLabels?: readonly string[];
|
|
14
|
+
highlightPeak?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
valueFormatter?: (value: number) => string;
|
|
17
|
+
xTickFormatter?: (label: string) => string;
|
|
18
|
+
yTickFormatter?: (label: string) => string;
|
|
19
|
+
ariaLabel?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
declare function HeatmapChart({
|
|
23
|
+
data,
|
|
24
|
+
xKey,
|
|
25
|
+
yKey,
|
|
26
|
+
dataKey,
|
|
27
|
+
variant,
|
|
28
|
+
palette,
|
|
29
|
+
xLabels,
|
|
30
|
+
yLabels,
|
|
31
|
+
highlightPeak,
|
|
32
|
+
loading,
|
|
33
|
+
valueFormatter,
|
|
34
|
+
xTickFormatter,
|
|
35
|
+
yTickFormatter,
|
|
36
|
+
ariaLabel,
|
|
37
|
+
className
|
|
38
|
+
}: HeatmapChartProps): React$1.JSX.Element;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { HeatmapChart, HeatmapChartProps };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { HEAT_EMPTY, heatColor, heatRamp } from "../lib/chart-palette.mjs";
|
|
4
|
+
import { useChartContext } from "./chart-container.mjs";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
8
|
+
//#region src/components/heatmap-chart.tsx
|
|
9
|
+
const PLACEHOLDER_HEIGHT = 168;
|
|
10
|
+
const CELL = 22;
|
|
11
|
+
const GAP = 3;
|
|
12
|
+
const PAD = {
|
|
13
|
+
left: 36,
|
|
14
|
+
top: 18,
|
|
15
|
+
right: 6,
|
|
16
|
+
bottom: 6
|
|
17
|
+
};
|
|
18
|
+
const MAX_X_TICKS = 13;
|
|
19
|
+
const DOT_MIN = .42;
|
|
20
|
+
const DOT_RANGE = .52;
|
|
21
|
+
const TOOLTIP_OFFSET = 14;
|
|
22
|
+
const TOOLTIP_WIDTH = 150;
|
|
23
|
+
const TOOLTIP_HEIGHT = 64;
|
|
24
|
+
const pairKey = (rowLabel, colLabel) => JSON.stringify([rowLabel, colLabel]);
|
|
25
|
+
const uniqueInOrder = (values) => {
|
|
26
|
+
const seen = /* @__PURE__ */ new Set();
|
|
27
|
+
const ordered = [];
|
|
28
|
+
for (const value of values) if (!seen.has(value)) {
|
|
29
|
+
seen.add(value);
|
|
30
|
+
ordered.push(value);
|
|
31
|
+
}
|
|
32
|
+
return ordered;
|
|
33
|
+
};
|
|
34
|
+
function HeatmapChart({ data, xKey, yKey, dataKey = "value", variant = "square", palette, xLabels, yLabels, highlightPeak = true, loading = false, valueFormatter = (value) => value.toLocaleString("en-US"), xTickFormatter, yTickFormatter, ariaLabel = "Activity heatmap", className }) {
|
|
35
|
+
const { paletteName, theme } = useChartContext(palette);
|
|
36
|
+
const [hovered, setHovered] = React$1.useState(null);
|
|
37
|
+
const [mounted, setMounted] = React$1.useState(false);
|
|
38
|
+
React$1.useEffect(() => {
|
|
39
|
+
setMounted(true);
|
|
40
|
+
}, []);
|
|
41
|
+
const { columns, rows, cells, maxValue, peakKey } = React$1.useMemo(() => {
|
|
42
|
+
const columns = xLabels ? [...xLabels] : uniqueInOrder(data.map((row) => String(row[xKey] ?? "")));
|
|
43
|
+
const rows = yLabels ? [...yLabels] : uniqueInOrder(data.map((row) => String(row[yKey] ?? "")));
|
|
44
|
+
const valueAt = /* @__PURE__ */ new Map();
|
|
45
|
+
for (const row of data) valueAt.set(pairKey(String(row[yKey] ?? ""), String(row[xKey] ?? "")), Number(row[dataKey]) || 0);
|
|
46
|
+
let maxValue = 0;
|
|
47
|
+
let peakKey = "";
|
|
48
|
+
return {
|
|
49
|
+
columns,
|
|
50
|
+
rows,
|
|
51
|
+
cells: rows.flatMap((rowLabel, rowIndex) => columns.map((colLabel, colIndex) => {
|
|
52
|
+
const value = valueAt.get(pairKey(rowLabel, colLabel)) ?? 0;
|
|
53
|
+
if (value > maxValue) {
|
|
54
|
+
maxValue = value;
|
|
55
|
+
peakKey = pairKey(rowLabel, colLabel);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
rowLabel,
|
|
59
|
+
colLabel,
|
|
60
|
+
rowIndex,
|
|
61
|
+
colIndex,
|
|
62
|
+
value
|
|
63
|
+
};
|
|
64
|
+
})),
|
|
65
|
+
maxValue,
|
|
66
|
+
peakKey
|
|
67
|
+
};
|
|
68
|
+
}, [
|
|
69
|
+
data,
|
|
70
|
+
xKey,
|
|
71
|
+
yKey,
|
|
72
|
+
dataKey,
|
|
73
|
+
xLabels,
|
|
74
|
+
yLabels
|
|
75
|
+
]);
|
|
76
|
+
const isEmpty = columns.length === 0 || rows.length === 0 || maxValue <= 0;
|
|
77
|
+
if (loading) return /* @__PURE__ */ jsxs("div", {
|
|
78
|
+
className: cn("flex items-center justify-center gap-2.5 font-mono text-quaternary-foreground text-text-xs", className),
|
|
79
|
+
style: { minHeight: PLACEHOLDER_HEIGHT },
|
|
80
|
+
children: [/* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-border border-t-foreground" }), "loading…"]
|
|
81
|
+
});
|
|
82
|
+
if (isEmpty) return /* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: cn("flex items-center justify-center rounded-lg border border-border border-dashed font-mono text-quaternary-foreground text-text-xs", className),
|
|
84
|
+
style: { minHeight: PLACEHOLDER_HEIGHT },
|
|
85
|
+
children: "no data in range"
|
|
86
|
+
});
|
|
87
|
+
const ramp = heatRamp(paletteName, theme.isDark ? HEAT_EMPTY.dark : HEAT_EMPTY.light);
|
|
88
|
+
const totalWidth = PAD.left + columns.length * CELL + (columns.length - 1) * GAP + PAD.right;
|
|
89
|
+
const totalHeight = PAD.top + rows.length * CELL + (rows.length - 1) * GAP + PAD.bottom;
|
|
90
|
+
const xStride = Math.ceil(columns.length / MAX_X_TICKS);
|
|
91
|
+
const cellX = (col) => PAD.left + col * 25;
|
|
92
|
+
const cellY = (row) => PAD.top + row * 25;
|
|
93
|
+
const formatX = (label) => xTickFormatter ? xTickFormatter(label) : label;
|
|
94
|
+
const formatY = (label) => yTickFormatter ? yTickFormatter(label) : label;
|
|
95
|
+
const tooltipLeft = hovered && hovered.x + TOOLTIP_OFFSET + TOOLTIP_WIDTH > window.innerWidth ? hovered.x - TOOLTIP_OFFSET - TOOLTIP_WIDTH : (hovered?.x ?? 0) + TOOLTIP_OFFSET;
|
|
96
|
+
const tooltipTop = hovered && hovered.y + TOOLTIP_OFFSET + TOOLTIP_HEIGHT > window.innerHeight ? hovered.y - TOOLTIP_OFFSET - TOOLTIP_HEIGHT : (hovered?.y ?? 0) + TOOLTIP_OFFSET;
|
|
97
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
98
|
+
"data-slot": "heatmap-chart",
|
|
99
|
+
className: cn("w-full", className),
|
|
100
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
101
|
+
className: "overflow-x-auto",
|
|
102
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
103
|
+
viewBox: `0 0 ${totalWidth} ${totalHeight}`,
|
|
104
|
+
className: "block min-w-[480px]",
|
|
105
|
+
style: {
|
|
106
|
+
width: "100%",
|
|
107
|
+
height: "auto"
|
|
108
|
+
},
|
|
109
|
+
role: "img",
|
|
110
|
+
"aria-label": ariaLabel,
|
|
111
|
+
onMouseLeave: () => setHovered(null),
|
|
112
|
+
children: [
|
|
113
|
+
columns.map((label, col) => col % xStride === 0 ? /* @__PURE__ */ jsx("text", {
|
|
114
|
+
x: cellX(col) + CELL / 2,
|
|
115
|
+
y: PAD.top - 7,
|
|
116
|
+
textAnchor: "middle",
|
|
117
|
+
className: "fill-quaternary-foreground font-mono text-[8.5px]",
|
|
118
|
+
children: formatX(label)
|
|
119
|
+
}, `x-${label}`) : null),
|
|
120
|
+
rows.map((label, row) => /* @__PURE__ */ jsx("text", {
|
|
121
|
+
x: PAD.left - 8,
|
|
122
|
+
y: cellY(row) + CELL / 2 + 3,
|
|
123
|
+
textAnchor: "end",
|
|
124
|
+
className: "fill-quaternary-foreground font-mono text-[8.5px]",
|
|
125
|
+
children: formatY(label)
|
|
126
|
+
}, `y-${label}`)),
|
|
127
|
+
cells.map((cell) => {
|
|
128
|
+
const fraction = cell.value / maxValue;
|
|
129
|
+
const fill = heatColor(ramp, fraction);
|
|
130
|
+
const key = pairKey(cell.rowLabel, cell.colLabel);
|
|
131
|
+
const isPeak = highlightPeak && key === peakKey;
|
|
132
|
+
if (variant === "dot") return /* @__PURE__ */ jsx("circle", {
|
|
133
|
+
cx: cellX(cell.colIndex) + CELL / 2,
|
|
134
|
+
cy: cellY(cell.rowIndex) + CELL / 2,
|
|
135
|
+
r: CELL / 2 * (DOT_MIN + DOT_RANGE * fraction),
|
|
136
|
+
fill,
|
|
137
|
+
stroke: isPeak ? theme.foreground : void 0,
|
|
138
|
+
strokeWidth: isPeak ? 1.4 : void 0
|
|
139
|
+
}, key);
|
|
140
|
+
return /* @__PURE__ */ jsx("rect", {
|
|
141
|
+
x: cellX(cell.colIndex),
|
|
142
|
+
y: cellY(cell.rowIndex),
|
|
143
|
+
width: CELL,
|
|
144
|
+
height: CELL,
|
|
145
|
+
rx: 2.5,
|
|
146
|
+
fill,
|
|
147
|
+
stroke: isPeak ? theme.foreground : void 0,
|
|
148
|
+
strokeWidth: isPeak ? 1.4 : void 0
|
|
149
|
+
}, key);
|
|
150
|
+
}),
|
|
151
|
+
cells.map((cell) => /* @__PURE__ */ jsx("rect", {
|
|
152
|
+
x: cellX(cell.colIndex),
|
|
153
|
+
y: cellY(cell.rowIndex),
|
|
154
|
+
width: 25,
|
|
155
|
+
height: 25,
|
|
156
|
+
fill: "transparent",
|
|
157
|
+
onMouseMove: (event) => setHovered({
|
|
158
|
+
x: event.clientX,
|
|
159
|
+
y: event.clientY,
|
|
160
|
+
rowLabel: cell.rowLabel,
|
|
161
|
+
colLabel: cell.colLabel,
|
|
162
|
+
value: cell.value
|
|
163
|
+
})
|
|
164
|
+
}, `hit-${pairKey(cell.rowLabel, cell.colLabel)}`))
|
|
165
|
+
]
|
|
166
|
+
})
|
|
167
|
+
}), mounted && hovered && createPortal(/* @__PURE__ */ jsxs("div", {
|
|
168
|
+
className: "pointer-events-none fixed z-50 min-w-[130px] rounded-lg border border-border bg-popover px-3 py-2.5 text-popover-foreground shadow-lg",
|
|
169
|
+
style: {
|
|
170
|
+
left: tooltipLeft,
|
|
171
|
+
top: tooltipTop
|
|
172
|
+
},
|
|
173
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
174
|
+
className: "mb-1.5 font-mono text-[10px] text-quaternary-foreground uppercase tracking-wider",
|
|
175
|
+
children: [
|
|
176
|
+
formatY(hovered.rowLabel),
|
|
177
|
+
" · ",
|
|
178
|
+
formatX(hovered.colLabel)
|
|
179
|
+
]
|
|
180
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
181
|
+
className: "flex items-center justify-between gap-4 text-text-xs",
|
|
182
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
183
|
+
className: "inline-flex items-center gap-2 text-muted-foreground",
|
|
184
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
185
|
+
"aria-hidden": true,
|
|
186
|
+
className: "size-2 shrink-0 rounded-[2px]",
|
|
187
|
+
style: { background: heatColor(ramp, hovered.value / maxValue) }
|
|
188
|
+
}), "activity"]
|
|
189
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
190
|
+
className: "font-mono font-semibold tabular-nums text-foreground",
|
|
191
|
+
children: valueFormatter(hovered.value)
|
|
192
|
+
})]
|
|
193
|
+
})]
|
|
194
|
+
}), document.body)]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
export { HeatmapChart };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { VariantProps } from "class-variance-authority";
|
|
2
|
-
import * as React from "react";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/input-group.d.ts
|
|
5
5
|
declare function InputGroup({
|
|
6
6
|
className,
|
|
7
7
|
children,
|
|
8
8
|
...props
|
|
9
|
-
}: React.ComponentProps<"fieldset">):
|
|
9
|
+
}: React$1.ComponentProps<"fieldset">): React$1.JSX.Element;
|
|
10
10
|
declare const inputGroupAddonVariants: (props?: ({
|
|
11
11
|
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -14,10 +14,10 @@ declare function InputGroupAddon({
|
|
|
14
14
|
className,
|
|
15
15
|
align,
|
|
16
16
|
...props
|
|
17
|
-
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>):
|
|
17
|
+
}: React$1.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React$1.JSX.Element;
|
|
18
18
|
declare function InputGroupTextarea({
|
|
19
19
|
className,
|
|
20
20
|
...props
|
|
21
|
-
}: React.ComponentProps<"textarea">):
|
|
21
|
+
}: React$1.ComponentProps<"textarea">): React$1.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { InputGroup, InputGroupAddon, InputGroupTextarea };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as React from "react";
|
|
1
|
+
import * as React$1 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/input.d.ts
|
|
4
|
-
interface InputProps extends Omit<React.ComponentProps<"input">, "size"> {
|
|
4
|
+
interface InputProps extends Omit<React$1.ComponentProps<"input">, "size"> {
|
|
5
5
|
label?: string;
|
|
6
6
|
required?: boolean;
|
|
7
7
|
hint?: string;
|
|
8
8
|
error?: string;
|
|
9
9
|
tooltip?: string;
|
|
10
10
|
leadingText?: string;
|
|
11
|
-
leadingIcon?: React.ReactNode;
|
|
11
|
+
leadingIcon?: React$1.ReactNode;
|
|
12
12
|
size?: "sm" | "md";
|
|
13
13
|
}
|
|
14
14
|
declare function Input({
|
|
@@ -23,6 +23,6 @@ declare function Input({
|
|
|
23
23
|
leadingIcon,
|
|
24
24
|
size,
|
|
25
25
|
...props
|
|
26
|
-
}: InputProps):
|
|
26
|
+
}: InputProps): React$1.JSX.Element;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { Input, type InputProps };
|
|
@@ -4,7 +4,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.mjs";
|
|
|
4
4
|
import { Label } from "./label.mjs";
|
|
5
5
|
import { Info } from "lucide-react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import * as React from "react";
|
|
7
|
+
import * as React$1 from "react";
|
|
8
8
|
//#region src/components/input.tsx
|
|
9
9
|
const inputSizeStyles = {
|
|
10
10
|
sm: {
|
|
@@ -25,7 +25,7 @@ const inputSizeStyles = {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size = "md", ...props }) {
|
|
28
|
-
const generatedId = React.useId();
|
|
28
|
+
const generatedId = React$1.useId();
|
|
29
29
|
const fieldId = id ?? generatedId;
|
|
30
30
|
const hasAddons = leadingText || leadingIcon;
|
|
31
31
|
const sizes = inputSizeStyles[size];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from "react";
|
|
1
|
+
import * as React$1 from "react";
|
|
2
2
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
3
|
|
|
4
4
|
//#region src/components/label.d.ts
|
|
5
5
|
declare function Label({
|
|
6
6
|
className,
|
|
7
7
|
...props
|
|
8
|
-
}: React.ComponentProps<typeof LabelPrimitive.Root>):
|
|
8
|
+
}: React$1.ComponentProps<typeof LabelPrimitive.Root>): React$1.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { Label };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChartSeries } from "../lib/chart.mjs";
|
|
2
|
+
import { ChartPaletteName } from "../lib/chart-palette.mjs";
|
|
3
|
+
import { ChartMarker } from "./area-chart.mjs";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/line-chart.d.ts
|
|
7
|
+
declare const CURVE_TYPE: {
|
|
8
|
+
readonly monotone: "monotone";
|
|
9
|
+
readonly linear: "linear";
|
|
10
|
+
readonly step: "stepAfter";
|
|
11
|
+
};
|
|
12
|
+
interface LineChartProps {
|
|
13
|
+
data: ReadonlyArray<Record<string, string | number | null | undefined>>;
|
|
14
|
+
index: string;
|
|
15
|
+
series: ChartSeries[];
|
|
16
|
+
curve?: keyof typeof CURVE_TYPE;
|
|
17
|
+
legend?: boolean;
|
|
18
|
+
valueFlags?: boolean;
|
|
19
|
+
dots?: boolean;
|
|
20
|
+
height?: number;
|
|
21
|
+
yAxisWidth?: number;
|
|
22
|
+
palette?: ChartPaletteName;
|
|
23
|
+
referenceLine?: {
|
|
24
|
+
y: number;
|
|
25
|
+
label?: string;
|
|
26
|
+
band?: boolean;
|
|
27
|
+
};
|
|
28
|
+
markers?: ChartMarker[];
|
|
29
|
+
lastValueLabel?: boolean;
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
valueFormatter?: (value: number) => string;
|
|
32
|
+
labelFormatter?: (label: string | number) => string;
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
declare function LineChart({
|
|
36
|
+
data,
|
|
37
|
+
index,
|
|
38
|
+
series,
|
|
39
|
+
curve,
|
|
40
|
+
legend,
|
|
41
|
+
valueFlags,
|
|
42
|
+
dots,
|
|
43
|
+
height,
|
|
44
|
+
yAxisWidth,
|
|
45
|
+
palette,
|
|
46
|
+
referenceLine,
|
|
47
|
+
markers,
|
|
48
|
+
lastValueLabel,
|
|
49
|
+
loading,
|
|
50
|
+
valueFormatter,
|
|
51
|
+
labelFormatter,
|
|
52
|
+
className
|
|
53
|
+
}: LineChartProps): React$1.JSX.Element;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { LineChart, LineChartProps };
|