@alpic-ai/ui 0.0.0-dev.g378c8b6 → 0.0.0-dev.g380fab7
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 +245 -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/grid-fx.d.mts +13 -0
- package/dist/components/grid-fx.mjs +188 -0
- 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 -4
- 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 +300 -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/grid-fx.tsx +238 -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/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 +200 -0
- package/src/stories/bar-chart.stories.tsx +169 -0
- package/src/stories/bar-list.stories.tsx +85 -0
- package/src/stories/donut-chart.stories.tsx +112 -0
- package/src/stories/heatmap-chart.stories.tsx +107 -0
- package/src/stories/line-chart.stories.tsx +146 -0
- package/src/stories/stat.stories.tsx +64 -0
- 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,13 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/grid-fx.d.ts
|
|
4
|
+
declare function GridFx({
|
|
5
|
+
className,
|
|
6
|
+
cellSize,
|
|
7
|
+
style,
|
|
8
|
+
...props
|
|
9
|
+
}: React$1.ComponentProps<"canvas"> & {
|
|
10
|
+
cellSize?: number;
|
|
11
|
+
}): React$1.JSX.Element | null;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { GridFx };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { useReducedMotion } from "../hooks/use-reduced-motion.mjs";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
//#region src/components/grid-fx.tsx
|
|
7
|
+
const CELL_SIZE = 46;
|
|
8
|
+
const TTL_MIN = 42;
|
|
9
|
+
const TTL_MAX = 78;
|
|
10
|
+
const SPAWN_MIN = 180;
|
|
11
|
+
const SPAWN_MAX = 480;
|
|
12
|
+
const rand = (min, max) => min + Math.random() * (max - min);
|
|
13
|
+
function resolveColors(element) {
|
|
14
|
+
const styles = getComputedStyle(element);
|
|
15
|
+
return {
|
|
16
|
+
color: styles.getPropertyValue("--color-primary").trim() || "#e90060",
|
|
17
|
+
colorHi: styles.getPropertyValue("--color-primary-hover").trim() || "#f22b79"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function strokeFull(ctx, horiz, at, width, height) {
|
|
21
|
+
ctx.beginPath();
|
|
22
|
+
if (horiz) {
|
|
23
|
+
ctx.moveTo(0, at);
|
|
24
|
+
ctx.lineTo(width, at);
|
|
25
|
+
} else {
|
|
26
|
+
ctx.moveTo(at, 0);
|
|
27
|
+
ctx.lineTo(at, height);
|
|
28
|
+
}
|
|
29
|
+
ctx.stroke();
|
|
30
|
+
}
|
|
31
|
+
function drawGlitchLine(ctx, line, width, height) {
|
|
32
|
+
const { horiz, at, color, colorHi } = line;
|
|
33
|
+
const span = horiz ? width : height;
|
|
34
|
+
const progress = line.life / line.ttl;
|
|
35
|
+
const envelope = progress < .08 ? progress / .08 : 1 - (progress - .08) / .92;
|
|
36
|
+
const base = Math.max(0, envelope);
|
|
37
|
+
ctx.lineCap = "round";
|
|
38
|
+
const ghosts = [
|
|
39
|
+
{
|
|
40
|
+
offset: 0,
|
|
41
|
+
alpha: .85,
|
|
42
|
+
blur: 12
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
offset: rand(-3, 3),
|
|
46
|
+
alpha: .35,
|
|
47
|
+
blur: 0
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
offset: rand(-7, 7),
|
|
51
|
+
alpha: .2,
|
|
52
|
+
blur: 0
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
for (const ghost of ghosts) {
|
|
56
|
+
ctx.globalAlpha = base * ghost.alpha * (Math.random() < .1 ? .3 : 1);
|
|
57
|
+
ctx.strokeStyle = color;
|
|
58
|
+
ctx.lineWidth = 1.5;
|
|
59
|
+
ctx.shadowBlur = ghost.blur;
|
|
60
|
+
ctx.shadowColor = color;
|
|
61
|
+
strokeFull(ctx, horiz, at + ghost.offset, width, height);
|
|
62
|
+
}
|
|
63
|
+
if (Math.random() < .5) {
|
|
64
|
+
ctx.globalAlpha = base * .6;
|
|
65
|
+
ctx.lineWidth = 2;
|
|
66
|
+
ctx.shadowBlur = 0;
|
|
67
|
+
ctx.strokeStyle = colorHi;
|
|
68
|
+
for (let segment = 0; segment < 3; segment++) {
|
|
69
|
+
const start = rand(0, span * .85);
|
|
70
|
+
const end = start + rand(20, 80);
|
|
71
|
+
const jitter = rand(-4, 4);
|
|
72
|
+
ctx.beginPath();
|
|
73
|
+
if (horiz) {
|
|
74
|
+
ctx.moveTo(start, at + jitter);
|
|
75
|
+
ctx.lineTo(end, at + jitter);
|
|
76
|
+
} else {
|
|
77
|
+
ctx.moveTo(at + jitter, start);
|
|
78
|
+
ctx.lineTo(at + jitter, end);
|
|
79
|
+
}
|
|
80
|
+
ctx.stroke();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function GridFx({ className, cellSize = CELL_SIZE, style, ...props }) {
|
|
85
|
+
const reduced = useReducedMotion();
|
|
86
|
+
const canvasRef = React$1.useRef(null);
|
|
87
|
+
React$1.useEffect(() => {
|
|
88
|
+
if (reduced) return;
|
|
89
|
+
const canvas = canvasRef.current;
|
|
90
|
+
const parent = canvas?.parentElement;
|
|
91
|
+
const ctx = canvas?.getContext("2d");
|
|
92
|
+
if (!canvas || !parent || !ctx) return;
|
|
93
|
+
let width = 0;
|
|
94
|
+
let height = 0;
|
|
95
|
+
let dpr = 1;
|
|
96
|
+
let frame = 0;
|
|
97
|
+
let nextIn = rand(SPAWN_MIN, SPAWN_MAX);
|
|
98
|
+
let onScreen = true;
|
|
99
|
+
const lines = [];
|
|
100
|
+
const resize = () => {
|
|
101
|
+
dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
102
|
+
width = parent.clientWidth;
|
|
103
|
+
height = parent.clientHeight;
|
|
104
|
+
canvas.width = width * dpr;
|
|
105
|
+
canvas.height = height * dpr;
|
|
106
|
+
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
107
|
+
};
|
|
108
|
+
const spawn = () => {
|
|
109
|
+
const horiz = Math.random() < .5;
|
|
110
|
+
const tracks = Math.ceil((horiz ? height : width) / cellSize);
|
|
111
|
+
const { color, colorHi } = resolveColors(canvas);
|
|
112
|
+
lines.push({
|
|
113
|
+
horiz,
|
|
114
|
+
at: Math.floor(Math.random() * tracks) * cellSize + .5,
|
|
115
|
+
life: 0,
|
|
116
|
+
ttl: rand(TTL_MIN, TTL_MAX),
|
|
117
|
+
color,
|
|
118
|
+
colorHi
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const tick = () => {
|
|
122
|
+
ctx.globalAlpha = 1;
|
|
123
|
+
ctx.shadowBlur = 0;
|
|
124
|
+
ctx.clearRect(0, 0, width, height);
|
|
125
|
+
if (--nextIn <= 0) {
|
|
126
|
+
spawn();
|
|
127
|
+
nextIn = rand(SPAWN_MIN, SPAWN_MAX);
|
|
128
|
+
}
|
|
129
|
+
for (let index = lines.length - 1; index >= 0; index--) {
|
|
130
|
+
const line = lines[index];
|
|
131
|
+
if (!line) continue;
|
|
132
|
+
line.life++;
|
|
133
|
+
drawGlitchLine(ctx, line, width, height);
|
|
134
|
+
if (line.life >= line.ttl) lines.splice(index, 1);
|
|
135
|
+
}
|
|
136
|
+
ctx.globalAlpha = 1;
|
|
137
|
+
ctx.shadowBlur = 0;
|
|
138
|
+
frame = requestAnimationFrame(tick);
|
|
139
|
+
};
|
|
140
|
+
const running = () => onScreen && document.visibilityState === "visible";
|
|
141
|
+
const start = () => {
|
|
142
|
+
if (!frame && running()) frame = requestAnimationFrame(tick);
|
|
143
|
+
};
|
|
144
|
+
const stop = () => {
|
|
145
|
+
if (frame) cancelAnimationFrame(frame);
|
|
146
|
+
frame = 0;
|
|
147
|
+
ctx.clearRect(0, 0, width, height);
|
|
148
|
+
};
|
|
149
|
+
resize();
|
|
150
|
+
start();
|
|
151
|
+
const resizeObserver = new ResizeObserver(() => resize());
|
|
152
|
+
resizeObserver.observe(parent);
|
|
153
|
+
const intersectionObserver = new IntersectionObserver(([entry]) => {
|
|
154
|
+
if (!entry) return;
|
|
155
|
+
onScreen = entry.isIntersecting;
|
|
156
|
+
if (onScreen) start();
|
|
157
|
+
else stop();
|
|
158
|
+
});
|
|
159
|
+
intersectionObserver.observe(canvas);
|
|
160
|
+
const onVisibility = () => {
|
|
161
|
+
if (running()) start();
|
|
162
|
+
else stop();
|
|
163
|
+
};
|
|
164
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
165
|
+
return () => {
|
|
166
|
+
stop();
|
|
167
|
+
resizeObserver.disconnect();
|
|
168
|
+
intersectionObserver.disconnect();
|
|
169
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
170
|
+
};
|
|
171
|
+
}, [reduced, cellSize]);
|
|
172
|
+
if (reduced) return null;
|
|
173
|
+
return /* @__PURE__ */ jsx("canvas", {
|
|
174
|
+
ref: canvasRef,
|
|
175
|
+
"aria-hidden": true,
|
|
176
|
+
"data-slot": "grid-fx",
|
|
177
|
+
className: cn("pointer-events-none absolute inset-0 h-full w-full", className),
|
|
178
|
+
style: {
|
|
179
|
+
zIndex: -1,
|
|
180
|
+
WebkitMaskImage: "radial-gradient(120% 95% at 50% 0%, #000 30%, transparent 100%)",
|
|
181
|
+
maskImage: "radial-gradient(120% 95% at 50% 0%, #000 30%, transparent 100%)",
|
|
182
|
+
...style
|
|
183
|
+
},
|
|
184
|
+
...props
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { GridFx };
|
|
@@ -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 };
|