@alpic-ai/ui 0.0.0-dev.g2df19cc → 0.0.0-dev.g2eefcc2
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 -6
- package/dist/components/accordion.d.mts +5 -6
- package/dist/components/alert.d.mts +9 -11
- 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 -3
- package/dist/components/avatar.d.mts +8 -10
- package/dist/components/badge.d.mts +2 -4
- 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 -11
- package/dist/components/button.d.mts +6 -8
- package/dist/components/card.d.mts +9 -10
- 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 -3
- package/dist/components/collapsible.d.mts +4 -5
- package/dist/components/combobox.d.mts +12 -11
- package/dist/components/combobox.mjs +7 -4
- package/dist/components/command.d.mts +9 -10
- package/dist/components/copyable.d.mts +2 -3
- package/dist/components/description-list.d.mts +5 -6
- package/dist/components/dialog.d.mts +15 -17
- package/dist/components/donut-chart.d.mts +46 -0
- package/dist/components/donut-chart.mjs +185 -0
- package/dist/components/dropdown-menu.d.mts +18 -20
- package/dist/components/form.d.mts +38 -21
- package/dist/components/form.mjs +6 -6
- package/dist/components/github-button.d.mts +1 -2
- package/dist/components/heatmap-chart.d.mts +40 -0
- package/dist/components/heatmap-chart.mjs +198 -0
- package/dist/components/input-group.d.mts +5 -7
- package/dist/components/input.d.mts +4 -5
- package/dist/components/input.mjs +2 -2
- package/dist/components/label.d.mts +2 -3
- 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 -3
- package/dist/components/pagination.d.mts +3 -4
- package/dist/components/popover.d.mts +5 -6
- package/dist/components/radio-group.d.mts +3 -4
- package/dist/components/scroll-area.d.mts +3 -4
- package/dist/components/select-trigger-variants.d.mts +1 -3
- package/dist/components/select.d.mts +9 -10
- package/dist/components/separator.d.mts +2 -3
- package/dist/components/sheet.d.mts +11 -12
- package/dist/components/shimmer-text.d.mts +2 -2
- package/dist/components/sidebar.d.mts +34 -36
- package/dist/components/sidebar.mjs +10 -10
- package/dist/components/skeleton.d.mts +2 -4
- package/dist/components/sonner.d.mts +5 -6
- package/dist/components/spinner.d.mts +3 -5
- package/dist/components/stat.d.mts +30 -0
- package/dist/components/stat.mjs +107 -0
- package/dist/components/status-dot.d.mts +2 -4
- package/dist/components/switch.d.mts +2 -3
- package/dist/components/table.d.mts +10 -11
- package/dist/components/tabs.d.mts +12 -14
- package/dist/components/tag.d.mts +3 -5
- package/dist/components/task-progress.d.mts +1 -3
- package/dist/components/textarea.d.mts +3 -4
- package/dist/components/textarea.mjs +2 -2
- package/dist/components/toggle-group.d.mts +4 -6
- package/dist/components/toggle-group.mjs +3 -3
- package/dist/components/tooltip-icon-button.d.mts +1 -2
- package/dist/components/tooltip.d.mts +5 -6
- package/dist/components/typography.d.mts +4 -5
- package/dist/components/wizard.d.mts +4 -23
- 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/combobox.tsx +9 -2
- 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
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { useReducedMotion } from "../hooks/use-reduced-motion.mjs";
|
|
4
|
+
import { paletteColor } from "../lib/chart-palette.mjs";
|
|
5
|
+
import { formatShare } from "../lib/chart.mjs";
|
|
6
|
+
import { useChartContext } from "./chart-container.mjs";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts";
|
|
10
|
+
//#region src/components/donut-chart.tsx
|
|
11
|
+
const GEOMETRY = {
|
|
12
|
+
donut: {
|
|
13
|
+
inner: "64%",
|
|
14
|
+
outer: "92%"
|
|
15
|
+
},
|
|
16
|
+
ring: {
|
|
17
|
+
inner: "78%",
|
|
18
|
+
outer: "92%"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function DonutChart({ data, index, dataKey = "value", variant = "donut", legend = false, paddingAngle = 1, height = 220, palette, centerLabel = "total", loading = false, valueFormatter = (value) => value.toLocaleString("en-US"), labelFormatter, className }) {
|
|
22
|
+
const { palette: paletteColors, theme } = useChartContext(palette);
|
|
23
|
+
const reactId = React$1.useId().replace(/:/g, "");
|
|
24
|
+
const animated = !useReducedMotion();
|
|
25
|
+
const [active, setActive] = React$1.useState(null);
|
|
26
|
+
const rowRefs = React$1.useRef([]);
|
|
27
|
+
const slices = React$1.useMemo(() => {
|
|
28
|
+
const mapped = data.map((row) => ({
|
|
29
|
+
name: String(row[index] ?? ""),
|
|
30
|
+
value: Number(row[dataKey]) || 0
|
|
31
|
+
}));
|
|
32
|
+
mapped.sort((lower, upper) => upper.value - lower.value);
|
|
33
|
+
return mapped.map((slice, rank) => ({
|
|
34
|
+
...slice,
|
|
35
|
+
color: paletteColor(paletteColors, rank)
|
|
36
|
+
}));
|
|
37
|
+
}, [
|
|
38
|
+
data,
|
|
39
|
+
index,
|
|
40
|
+
dataKey,
|
|
41
|
+
paletteColors
|
|
42
|
+
]);
|
|
43
|
+
const total = slices.reduce((sum, slice) => sum + slice.value, 0);
|
|
44
|
+
const maxValue = slices.reduce((max, slice) => slice.value > max ? slice.value : max, 0);
|
|
45
|
+
const geometry = GEOMETRY[variant] ?? GEOMETRY.donut;
|
|
46
|
+
const formatName = (name) => labelFormatter ? labelFormatter(name) : name;
|
|
47
|
+
const isEmpty = slices.length === 0 || total <= 0;
|
|
48
|
+
const activeSlice = active !== null ? slices[active] : void 0;
|
|
49
|
+
const centerTitle = activeSlice ? formatName(activeSlice.name) : centerLabel;
|
|
50
|
+
const centerValue = valueFormatter(activeSlice ? activeSlice.value : total);
|
|
51
|
+
React$1.useEffect(() => {
|
|
52
|
+
if (active !== null) rowRefs.current[active]?.scrollIntoView({ block: "nearest" });
|
|
53
|
+
}, [active]);
|
|
54
|
+
return /* @__PURE__ */ jsx("div", {
|
|
55
|
+
"data-slot": "donut-chart",
|
|
56
|
+
className: cn("@container flex w-full flex-col gap-3", className),
|
|
57
|
+
children: loading ? /* @__PURE__ */ jsxs("div", {
|
|
58
|
+
className: "flex items-center justify-center gap-2.5 font-mono text-quaternary-foreground text-text-xs",
|
|
59
|
+
style: { height },
|
|
60
|
+
children: [/* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-border border-t-foreground" }), "loading…"]
|
|
61
|
+
}) : isEmpty ? /* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: "flex items-center justify-center rounded-lg border border-border border-dashed font-mono text-quaternary-foreground text-text-xs",
|
|
63
|
+
style: { height },
|
|
64
|
+
children: "no data in range"
|
|
65
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: "flex flex-col items-center gap-5 @md:flex-row",
|
|
67
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
68
|
+
className: "relative shrink-0",
|
|
69
|
+
style: {
|
|
70
|
+
width: height,
|
|
71
|
+
height
|
|
72
|
+
},
|
|
73
|
+
children: [/* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
74
|
+
width: "100%",
|
|
75
|
+
height: "100%",
|
|
76
|
+
children: /* @__PURE__ */ jsxs(PieChart, { children: [/* @__PURE__ */ jsx("defs", { children: slices.map((slice, slot) => /* @__PURE__ */ jsxs("linearGradient", {
|
|
77
|
+
id: `donut-${reactId}-${slot}`,
|
|
78
|
+
x1: "0",
|
|
79
|
+
y1: "0",
|
|
80
|
+
x2: "0",
|
|
81
|
+
y2: "1",
|
|
82
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
83
|
+
offset: "0%",
|
|
84
|
+
stopColor: slice.color,
|
|
85
|
+
stopOpacity: 1
|
|
86
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
87
|
+
offset: "100%",
|
|
88
|
+
stopColor: slice.color,
|
|
89
|
+
stopOpacity: .7
|
|
90
|
+
})]
|
|
91
|
+
}, slice.name)) }), /* @__PURE__ */ jsx(Pie, {
|
|
92
|
+
data: slices,
|
|
93
|
+
dataKey: "value",
|
|
94
|
+
nameKey: "name",
|
|
95
|
+
innerRadius: geometry.inner,
|
|
96
|
+
outerRadius: geometry.outer,
|
|
97
|
+
paddingAngle,
|
|
98
|
+
startAngle: 90,
|
|
99
|
+
endAngle: -270,
|
|
100
|
+
cornerRadius: 2,
|
|
101
|
+
stroke: theme.card,
|
|
102
|
+
strokeWidth: 1.5,
|
|
103
|
+
isAnimationActive: animated,
|
|
104
|
+
animationDuration: 650,
|
|
105
|
+
animationEasing: "ease-out",
|
|
106
|
+
onMouseEnter: (_entry, sliceIndex) => setActive(sliceIndex),
|
|
107
|
+
onMouseLeave: () => setActive(null),
|
|
108
|
+
children: slices.map((slice, slot) => /* @__PURE__ */ jsx(Cell, {
|
|
109
|
+
className: "motion-safe:[transition:fill-opacity_180ms_ease-out]",
|
|
110
|
+
fill: `url(#donut-${reactId}-${slot})`,
|
|
111
|
+
fillOpacity: active === null || active === slot ? 1 : .55,
|
|
112
|
+
stroke: theme.card,
|
|
113
|
+
strokeWidth: 1.5
|
|
114
|
+
}, slice.name))
|
|
115
|
+
})] })
|
|
116
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
117
|
+
className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-1 text-center",
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx("span", {
|
|
120
|
+
className: "max-w-[72%] truncate font-mono text-[10px] text-quaternary-foreground uppercase tracking-[0.18em]",
|
|
121
|
+
children: centerTitle
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx("span", {
|
|
124
|
+
className: "font-mono font-semibold text-[28px] text-foreground leading-none tabular-nums",
|
|
125
|
+
children: centerValue
|
|
126
|
+
}),
|
|
127
|
+
activeSlice && /* @__PURE__ */ jsx("span", {
|
|
128
|
+
className: "font-mono font-medium text-[11px] tabular-nums",
|
|
129
|
+
style: { color: activeSlice.color },
|
|
130
|
+
children: formatShare(activeSlice.value / total)
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})]
|
|
134
|
+
}), legend && /* @__PURE__ */ jsx("div", {
|
|
135
|
+
"data-slot": "donut-readout",
|
|
136
|
+
className: "flex min-w-0 flex-1 flex-col overflow-y-auto pr-1",
|
|
137
|
+
style: { maxHeight: height },
|
|
138
|
+
children: slices.map((slice, slot) => /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
ref: (node) => {
|
|
140
|
+
rowRefs.current[slot] = node;
|
|
141
|
+
},
|
|
142
|
+
onMouseEnter: () => setActive(slot),
|
|
143
|
+
onMouseLeave: () => setActive(null),
|
|
144
|
+
className: cn("flex flex-col gap-1.5 border-border/40 border-b px-2 py-2 text-text-xs last:border-b-0 motion-safe:transition-colors", active === slot ? "bg-muted/50" : "bg-transparent"),
|
|
145
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
146
|
+
className: "flex items-center justify-between gap-3",
|
|
147
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
148
|
+
className: "inline-flex min-w-0 items-center gap-2 text-muted-foreground",
|
|
149
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
150
|
+
"aria-hidden": true,
|
|
151
|
+
className: "h-2 w-2.5 shrink-0 rounded-[3px]",
|
|
152
|
+
style: { background: slice.color }
|
|
153
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "truncate",
|
|
155
|
+
children: formatName(slice.name)
|
|
156
|
+
})]
|
|
157
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
158
|
+
className: "flex shrink-0 items-center gap-3 font-mono tabular-nums",
|
|
159
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
160
|
+
className: "min-w-[3.5rem] text-right font-semibold text-foreground",
|
|
161
|
+
children: valueFormatter(slice.value)
|
|
162
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
163
|
+
className: "w-10 text-right text-quaternary-foreground",
|
|
164
|
+
children: formatShare(slice.value / total)
|
|
165
|
+
})]
|
|
166
|
+
})]
|
|
167
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
168
|
+
"aria-hidden": true,
|
|
169
|
+
className: "relative block h-[2px] w-full overflow-hidden rounded-full bg-border/40",
|
|
170
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
171
|
+
className: "absolute inset-y-0 left-0 rounded-full motion-safe:transition-[width] motion-safe:duration-500",
|
|
172
|
+
style: {
|
|
173
|
+
width: `${maxValue > 0 ? slice.value / maxValue * 100 : 0}%`,
|
|
174
|
+
background: slice.color,
|
|
175
|
+
opacity: active === null || active === slot ? 1 : .45
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
})]
|
|
179
|
+
}, slice.name))
|
|
180
|
+
})]
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
export { DonutChart };
|
|
@@ -1,72 +1,70 @@
|
|
|
1
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
1
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
import * as React from "react";
|
|
2
|
+
import * as React$1 from "react";
|
|
4
3
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
-
import * as _$class_variance_authority_types0 from "class-variance-authority/types";
|
|
6
4
|
|
|
7
5
|
//#region src/components/dropdown-menu.d.ts
|
|
8
6
|
declare function DropdownMenu({
|
|
9
7
|
...props
|
|
10
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>):
|
|
8
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Root>): React$1.JSX.Element;
|
|
11
9
|
declare function DropdownMenuPortal({
|
|
12
10
|
...props
|
|
13
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>):
|
|
11
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Portal>): React$1.JSX.Element;
|
|
14
12
|
declare function DropdownMenuTrigger({
|
|
15
13
|
...props
|
|
16
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>):
|
|
14
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): React$1.JSX.Element;
|
|
17
15
|
declare function DropdownMenuContent({
|
|
18
16
|
className,
|
|
19
17
|
sideOffset,
|
|
20
18
|
...props
|
|
21
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>):
|
|
19
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Content>): React$1.JSX.Element;
|
|
22
20
|
declare function DropdownMenuGroup({
|
|
23
21
|
...props
|
|
24
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>):
|
|
22
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Group>): React$1.JSX.Element;
|
|
25
23
|
declare const dropdownMenuItemVariants: (props?: ({
|
|
26
24
|
variant?: "default" | "destructive" | null | undefined;
|
|
27
|
-
} &
|
|
25
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
28
26
|
declare function DropdownMenuItem({
|
|
29
27
|
className,
|
|
30
28
|
inset,
|
|
31
29
|
variant,
|
|
32
30
|
...props
|
|
33
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & VariantProps<typeof dropdownMenuItemVariants> & {
|
|
31
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Item> & VariantProps<typeof dropdownMenuItemVariants> & {
|
|
34
32
|
inset?: boolean;
|
|
35
|
-
}):
|
|
33
|
+
}): React$1.JSX.Element;
|
|
36
34
|
declare function DropdownMenuLabel({
|
|
37
35
|
className,
|
|
38
36
|
inset,
|
|
39
37
|
...props
|
|
40
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
38
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
41
39
|
inset?: boolean;
|
|
42
|
-
}):
|
|
40
|
+
}): React$1.JSX.Element;
|
|
43
41
|
declare function DropdownMenuHeader({
|
|
44
42
|
className,
|
|
45
43
|
children,
|
|
46
44
|
...props
|
|
47
|
-
}: React.HTMLAttributes<HTMLDivElement>):
|
|
45
|
+
}: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
|
|
48
46
|
declare function DropdownMenuSeparator({
|
|
49
47
|
className,
|
|
50
48
|
...props
|
|
51
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>):
|
|
49
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Separator>): React$1.JSX.Element;
|
|
52
50
|
declare function DropdownMenuShortcut({
|
|
53
51
|
className,
|
|
54
52
|
...props
|
|
55
|
-
}: React.ComponentProps<"span">):
|
|
53
|
+
}: React$1.ComponentProps<"span">): React$1.JSX.Element;
|
|
56
54
|
declare function DropdownMenuSub({
|
|
57
55
|
...props
|
|
58
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>):
|
|
56
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.Sub>): React$1.JSX.Element;
|
|
59
57
|
declare function DropdownMenuSubTrigger({
|
|
60
58
|
className,
|
|
61
59
|
inset,
|
|
62
60
|
children,
|
|
63
61
|
...props
|
|
64
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
62
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
65
63
|
inset?: boolean;
|
|
66
|
-
}):
|
|
64
|
+
}): React$1.JSX.Element;
|
|
67
65
|
declare function DropdownMenuSubContent({
|
|
68
66
|
className,
|
|
69
67
|
...props
|
|
70
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>):
|
|
68
|
+
}: React$1.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): React$1.JSX.Element;
|
|
71
69
|
//#endregion
|
|
72
70
|
export { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuHeader, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuItemVariants };
|
|
@@ -1,23 +1,40 @@
|
|
|
1
1
|
import { InputProps } from "./input.mjs";
|
|
2
2
|
import { Label } from "./label.mjs";
|
|
3
3
|
import { TextareaProps } from "./textarea.mjs";
|
|
4
|
-
import * as
|
|
5
|
-
import * as React from "react";
|
|
4
|
+
import * as React$1 from "react";
|
|
6
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
-
import * as _$react_hook_form0 from "react-hook-form";
|
|
8
6
|
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
9
7
|
|
|
10
8
|
//#region src/components/form.d.ts
|
|
11
|
-
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(
|
|
9
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({
|
|
10
|
+
children,
|
|
11
|
+
watch,
|
|
12
|
+
getValues,
|
|
13
|
+
getFieldState,
|
|
14
|
+
setError,
|
|
15
|
+
clearErrors,
|
|
16
|
+
setValue,
|
|
17
|
+
setValues,
|
|
18
|
+
trigger,
|
|
19
|
+
formState,
|
|
20
|
+
resetField,
|
|
21
|
+
reset,
|
|
22
|
+
handleSubmit,
|
|
23
|
+
unregister,
|
|
24
|
+
control,
|
|
25
|
+
register,
|
|
26
|
+
setFocus,
|
|
27
|
+
subscribe
|
|
28
|
+
}: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React$1.JSX.Element;
|
|
12
29
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
13
30
|
...props
|
|
14
|
-
}: ControllerProps<TFieldValues, TName>) =>
|
|
31
|
+
}: ControllerProps<TFieldValues, TName>) => React$1.JSX.Element;
|
|
15
32
|
declare const useFormField: () => {
|
|
16
33
|
invalid: boolean;
|
|
17
34
|
isDirty: boolean;
|
|
18
35
|
isTouched: boolean;
|
|
19
36
|
isValidating: boolean;
|
|
20
|
-
error?:
|
|
37
|
+
error?: import("react-hook-form").FieldError;
|
|
21
38
|
id: string;
|
|
22
39
|
name: string;
|
|
23
40
|
formItemId: string;
|
|
@@ -27,8 +44,8 @@ declare const useFormField: () => {
|
|
|
27
44
|
declare function FormItem({
|
|
28
45
|
className,
|
|
29
46
|
...props
|
|
30
|
-
}: React.ComponentProps<"div">):
|
|
31
|
-
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> {
|
|
32
49
|
required?: boolean;
|
|
33
50
|
tooltip?: string;
|
|
34
51
|
}
|
|
@@ -38,19 +55,19 @@ declare function FormLabel({
|
|
|
38
55
|
tooltip,
|
|
39
56
|
children,
|
|
40
57
|
...props
|
|
41
|
-
}: FormLabelProps):
|
|
58
|
+
}: FormLabelProps): React$1.JSX.Element;
|
|
42
59
|
declare function FormControl({
|
|
43
60
|
...props
|
|
44
|
-
}: React.ComponentProps<typeof Slot>):
|
|
61
|
+
}: React$1.ComponentProps<typeof Slot>): React$1.JSX.Element;
|
|
45
62
|
declare function FormDescription({
|
|
46
63
|
className,
|
|
47
64
|
...props
|
|
48
|
-
}: React.ComponentProps<"p">):
|
|
65
|
+
}: React$1.ComponentProps<"p">): React$1.JSX.Element;
|
|
49
66
|
declare function FormMessage({
|
|
50
67
|
className,
|
|
51
68
|
...props
|
|
52
|
-
}: React.ComponentProps<"p">):
|
|
53
|
-
interface FormHeaderProps extends React.ComponentProps<"div"> {
|
|
69
|
+
}: React$1.ComponentProps<"p">): React$1.JSX.Element | null;
|
|
70
|
+
interface FormHeaderProps extends React$1.ComponentProps<"div"> {
|
|
54
71
|
title: string;
|
|
55
72
|
description?: string;
|
|
56
73
|
}
|
|
@@ -59,11 +76,11 @@ declare function FormHeader({
|
|
|
59
76
|
description,
|
|
60
77
|
className,
|
|
61
78
|
...props
|
|
62
|
-
}: FormHeaderProps):
|
|
79
|
+
}: FormHeaderProps): React$1.JSX.Element;
|
|
63
80
|
declare function FormFields({
|
|
64
81
|
className,
|
|
65
82
|
...props
|
|
66
|
-
}: React.ComponentProps<"div">):
|
|
83
|
+
}: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
67
84
|
interface FormFieldBaseProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> {
|
|
68
85
|
control: ControllerProps<TFieldValues, TName>["control"];
|
|
69
86
|
name: TName;
|
|
@@ -83,7 +100,7 @@ declare function InputField<TFieldValues extends FieldValues, TName extends Fiel
|
|
|
83
100
|
description,
|
|
84
101
|
tooltip,
|
|
85
102
|
...inputProps
|
|
86
|
-
}: InputFieldProps<TFieldValues, TName>):
|
|
103
|
+
}: InputFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
87
104
|
interface TextareaFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName>, Omit<TextareaProps, "name" | "label"> {}
|
|
88
105
|
declare function TextareaField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
|
|
89
106
|
control,
|
|
@@ -94,7 +111,7 @@ declare function TextareaField<TFieldValues extends FieldValues, TName extends F
|
|
|
94
111
|
description,
|
|
95
112
|
tooltip,
|
|
96
113
|
...textareaProps
|
|
97
|
-
}: TextareaFieldProps<TFieldValues, TName>):
|
|
114
|
+
}: TextareaFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
98
115
|
interface SelectFieldOption {
|
|
99
116
|
value: string;
|
|
100
117
|
label: string;
|
|
@@ -114,7 +131,7 @@ declare function SelectField<TFieldValues extends FieldValues, TName extends Fie
|
|
|
114
131
|
tooltip,
|
|
115
132
|
options,
|
|
116
133
|
placeholder
|
|
117
|
-
}: SelectFieldProps<TFieldValues, TName>):
|
|
134
|
+
}: SelectFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
118
135
|
interface RadioFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName> {
|
|
119
136
|
options: SelectFieldOption[];
|
|
120
137
|
}
|
|
@@ -127,7 +144,7 @@ declare function RadioField<TFieldValues extends FieldValues, TName extends Fiel
|
|
|
127
144
|
description,
|
|
128
145
|
tooltip,
|
|
129
146
|
options
|
|
130
|
-
}: RadioFieldProps<TFieldValues, TName>):
|
|
147
|
+
}: RadioFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
131
148
|
interface ChecklistFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName> {
|
|
132
149
|
options: SelectFieldOption[];
|
|
133
150
|
}
|
|
@@ -140,7 +157,7 @@ declare function ChecklistField<TFieldValues extends FieldValues, TName extends
|
|
|
140
157
|
description,
|
|
141
158
|
tooltip,
|
|
142
159
|
options
|
|
143
|
-
}: ChecklistFieldProps<TFieldValues, TName>):
|
|
160
|
+
}: ChecklistFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
144
161
|
interface CheckboxFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends Omit<FormFieldBaseProps<TFieldValues, TName>, "required"> {}
|
|
145
162
|
declare function CheckboxField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
|
|
146
163
|
control,
|
|
@@ -149,6 +166,6 @@ declare function CheckboxField<TFieldValues extends FieldValues, TName extends F
|
|
|
149
166
|
label,
|
|
150
167
|
description,
|
|
151
168
|
tooltip
|
|
152
|
-
}: CheckboxFieldProps<TFieldValues, TName>):
|
|
169
|
+
}: CheckboxFieldProps<TFieldValues, TName>): React$1.JSX.Element;
|
|
153
170
|
//#endregion
|
|
154
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", {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Button } from "./button.mjs";
|
|
2
|
-
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
2
|
import { ComponentProps } from "react";
|
|
4
3
|
|
|
5
4
|
//#region src/components/github-button.d.ts
|
|
@@ -8,6 +7,6 @@ declare function GitHubButton({
|
|
|
8
7
|
className,
|
|
9
8
|
children,
|
|
10
9
|
...props
|
|
11
|
-
}: GitHubButtonProps):
|
|
10
|
+
}: GitHubButtonProps): import("react").JSX.Element;
|
|
12
11
|
//#endregion
|
|
13
12
|
export { GitHubButton, type GitHubButtonProps };
|
|
@@ -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 };
|