@alpic-ai/ui 1.144.0 → 1.145.1
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 +1 -1
- package/dist/components/accordion.d.mts +1 -1
- package/dist/components/alert.d.mts +1 -1
- package/dist/components/area-chart.mjs +5 -7
- package/dist/components/attachment-tile.mjs +1 -1
- package/dist/components/avatar.d.mts +1 -1
- package/dist/components/bar-chart.mjs +6 -12
- package/dist/components/bar-list.mjs +1 -1
- package/dist/components/button.d.mts +1 -1
- package/dist/components/chart-container.mjs +2 -2
- package/dist/components/chart-tooltip.mjs +52 -27
- package/dist/components/combobox.d.mts +1 -1
- package/dist/components/combobox.mjs +1 -1
- package/dist/components/copyable.mjs +1 -1
- package/dist/components/dialog.d.mts +1 -1
- package/dist/components/donut-chart.mjs +1 -1
- package/dist/components/dropdown-menu.d.mts +1 -1
- package/dist/components/form.mjs +1 -1
- package/dist/components/heatmap-chart.d.mts +6 -0
- package/dist/components/heatmap-chart.mjs +147 -117
- package/dist/components/input-group.d.mts +1 -1
- package/dist/components/input.mjs +1 -1
- package/dist/components/line-chart.mjs +5 -7
- package/dist/components/select.d.mts +1 -1
- package/dist/components/sidebar.d.mts +1 -1
- package/dist/components/sidebar.mjs +3 -3
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/stat.mjs +5 -5
- package/dist/components/tabs.d.mts +1 -1
- package/dist/components/tabs.mjs +1 -1
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +1 -1
- package/dist/components/toggle-group.mjs +1 -1
- package/dist/components/tooltip-icon-button.mjs +1 -1
- package/dist/lib/chart-palette.mjs +4 -1
- package/package.json +2 -2
- package/src/components/area-chart.tsx +11 -6
- package/src/components/bar-chart.tsx +12 -7
- package/src/components/chart-tooltip.tsx +17 -1
- package/src/components/heatmap-chart.tsx +49 -5
- package/src/components/line-chart.tsx +11 -6
- package/src/components/skeleton.tsx +1 -1
- package/src/components/stat.tsx +4 -4
- package/src/lib/chart-palette.ts +4 -1
|
@@ -4,8 +4,9 @@ import { makeXAxisTick, orderByLuminance, resolveSeries } from "../lib/chart.mjs
|
|
|
4
4
|
import { useChartContext } from "./chart-container.mjs";
|
|
5
5
|
import { ChartLegend } from "./chart-legend.mjs";
|
|
6
6
|
import { ChartTooltipContent } from "./chart-tooltip.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { Skeleton } from "./skeleton.mjs";
|
|
8
8
|
import * as React$1 from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { Area, AreaChart as AreaChart$1, CartesianGrid, LabelList, ReferenceArea, ReferenceDot, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
|
10
11
|
//#region src/components/area-chart.tsx
|
|
11
12
|
const CURVE_TYPE = {
|
|
@@ -113,14 +114,11 @@ function AreaChart({ data, index, series, variant = "stacked", curve = "monotone
|
|
|
113
114
|
const isEmpty = data.length === 0 || rendered.length === 0;
|
|
114
115
|
return /* @__PURE__ */ jsxs("div", {
|
|
115
116
|
"data-slot": "area-chart",
|
|
116
|
-
className: cn("flex w-full flex-col gap-3", className),
|
|
117
|
+
className: cn("flex w-full flex-col gap-3", "[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none", className),
|
|
117
118
|
children: [/* @__PURE__ */ jsx("div", {
|
|
118
119
|
className: "w-full",
|
|
119
120
|
style: { height },
|
|
120
|
-
children: loading ? /* @__PURE__ */
|
|
121
|
-
className: "flex h-full items-center justify-center gap-2.5 font-mono text-quaternary-foreground text-text-xs",
|
|
122
|
-
children: [/* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-border border-t-foreground" }), "loading…"]
|
|
123
|
-
}) : isEmpty ? /* @__PURE__ */ jsx("div", {
|
|
121
|
+
children: loading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-full w-full rounded-lg" }) : isEmpty ? /* @__PURE__ */ jsx("div", {
|
|
124
122
|
className: "flex h-full items-center justify-center rounded-lg border border-border border-dashed font-mono text-quaternary-foreground text-text-xs",
|
|
125
123
|
children: "no data in range"
|
|
126
124
|
}) : /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
@@ -181,7 +179,7 @@ function AreaChart({ data, index, series, variant = "stacked", curve = "monotone
|
|
|
181
179
|
...axis,
|
|
182
180
|
tick: makeXAxisTick(theme),
|
|
183
181
|
interval: "preserveStartEnd",
|
|
184
|
-
minTickGap:
|
|
182
|
+
minTickGap: 56
|
|
185
183
|
}),
|
|
186
184
|
/* @__PURE__ */ jsx(YAxis, {
|
|
187
185
|
...axis,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.mjs";
|
|
3
3
|
import { TooltipIconButton } from "./tooltip-icon-button.mjs";
|
|
4
|
+
import { useState } from "react";
|
|
4
5
|
import { FileText, XIcon } from "lucide-react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { useState } from "react";
|
|
7
7
|
//#region src/components/attachment-tile.tsx
|
|
8
8
|
function AttachmentTile({ src, isImage, label, onRemove, onClick, className }) {
|
|
9
9
|
const [hasError, setHasError] = useState(false);
|
|
@@ -4,8 +4,9 @@ import { makeXAxisTick, orderByLuminance, resolveSeries } from "../lib/chart.mjs
|
|
|
4
4
|
import { useChartContext } from "./chart-container.mjs";
|
|
5
5
|
import { ChartLegend } from "./chart-legend.mjs";
|
|
6
6
|
import { ChartTooltipContent } from "./chart-tooltip.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { Skeleton } from "./skeleton.mjs";
|
|
8
8
|
import * as React$1 from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { Bar, BarChart as BarChart$1, CartesianGrid, LabelList, ReferenceArea, ReferenceDot, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
|
10
11
|
//#region src/components/bar-chart.tsx
|
|
11
12
|
const BAR_RADIUS = 4;
|
|
@@ -96,14 +97,11 @@ function BarChart({ data, index, series, variant = "stacked", legend = false, le
|
|
|
96
97
|
const isEmpty = data.length === 0 || rendered.length === 0;
|
|
97
98
|
return /* @__PURE__ */ jsxs("div", {
|
|
98
99
|
"data-slot": "bar-chart",
|
|
99
|
-
className: cn("flex w-full flex-col gap-3", className),
|
|
100
|
+
className: cn("flex w-full flex-col gap-3", "[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none", className),
|
|
100
101
|
children: [/* @__PURE__ */ jsx("div", {
|
|
101
102
|
className: "w-full",
|
|
102
103
|
style: { height },
|
|
103
|
-
children: loading ? /* @__PURE__ */
|
|
104
|
-
className: "flex h-full items-center justify-center gap-2.5 font-mono text-quaternary-foreground text-text-xs",
|
|
105
|
-
children: [/* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-border border-t-foreground" }), "loading…"]
|
|
106
|
-
}) : isEmpty ? /* @__PURE__ */ jsx("div", {
|
|
104
|
+
children: loading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-full w-full rounded-lg" }) : isEmpty ? /* @__PURE__ */ jsx("div", {
|
|
107
105
|
className: "flex h-full items-center justify-center rounded-lg border border-border border-dashed font-mono text-quaternary-foreground text-text-xs",
|
|
108
106
|
children: "no data in range"
|
|
109
107
|
}) : /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
@@ -165,7 +163,7 @@ function BarChart({ data, index, series, variant = "stacked", legend = false, le
|
|
|
165
163
|
...axis,
|
|
166
164
|
tick: makeXAxisTick(theme),
|
|
167
165
|
interval: "preserveStartEnd",
|
|
168
|
-
minTickGap:
|
|
166
|
+
minTickGap: 56
|
|
169
167
|
}),
|
|
170
168
|
/* @__PURE__ */ jsx(YAxis, {
|
|
171
169
|
...axis,
|
|
@@ -218,11 +216,7 @@ function BarChart({ data, index, series, variant = "stacked", legend = false, le
|
|
|
218
216
|
strokeWidth: 0,
|
|
219
217
|
radius: radiusFor(slot),
|
|
220
218
|
maxBarSize: MAX_BAR_SIZE,
|
|
221
|
-
activeBar:
|
|
222
|
-
fillOpacity: 1,
|
|
223
|
-
stroke: theme.card,
|
|
224
|
-
strokeWidth: 1
|
|
225
|
-
},
|
|
219
|
+
activeBar: false,
|
|
226
220
|
isAnimationActive: false,
|
|
227
221
|
animationDuration: 650,
|
|
228
222
|
animationEasing: "ease-out",
|
|
@@ -3,8 +3,8 @@ import { cn } from "../lib/cn.mjs";
|
|
|
3
3
|
import { rampColor } from "../lib/chart-palette.mjs";
|
|
4
4
|
import { formatShare } from "../lib/chart.mjs";
|
|
5
5
|
import { useChartContext } from "./chart-container.mjs";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/bar-list.tsx
|
|
9
9
|
const SEMANTIC_KEY = {
|
|
10
10
|
error: "destructive",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useChartTheme } from "../hooks/use-chart-theme.mjs";
|
|
2
3
|
import { cn } from "../lib/cn.mjs";
|
|
3
4
|
import { CHART_PALETTES } from "../lib/chart-palette.mjs";
|
|
4
|
-
import { useChartTheme } from "../hooks/use-chart-theme.mjs";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
5
|
import * as React$1 from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/chart-container.tsx
|
|
8
8
|
const ChartContext = React$1.createContext(null);
|
|
9
9
|
function ChartContainer({ palette = "magenta", className, ...props }) {
|
|
@@ -3,12 +3,16 @@ import { cn } from "../lib/cn.mjs";
|
|
|
3
3
|
import { useChartContext } from "./chart-container.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/chart-tooltip.tsx
|
|
6
|
+
const MAX_TOOLTIP_ROWS = 8;
|
|
6
7
|
function ChartTooltipContent({ active, payload, label, valueFormatter = (value) => value.toLocaleString("en-US"), labelFormatter, hideLabel, showTotal, totalLabel = "Total", className }) {
|
|
7
8
|
const { theme } = useChartContext();
|
|
8
9
|
if (!active || !payload?.length) return null;
|
|
9
10
|
const toNumber = (value) => typeof value === "number" ? value : Number(value ?? 0);
|
|
10
11
|
const total = payload.reduce((sum, item) => sum + toNumber(item.value), 0);
|
|
11
|
-
const
|
|
12
|
+
const sorted = [...payload].sort((lower, upper) => toNumber(upper.value) - toNumber(lower.value));
|
|
13
|
+
const rows = sorted.slice(0, MAX_TOOLTIP_ROWS);
|
|
14
|
+
const overflow = sorted.slice(MAX_TOOLTIP_ROWS);
|
|
15
|
+
const overflowTotal = overflow.reduce((sum, item) => sum + toNumber(item.value), 0);
|
|
12
16
|
return /* @__PURE__ */ jsxs("div", {
|
|
13
17
|
className: cn("min-w-[130px] rounded-lg border px-3 py-2.5 shadow-lg", "border-border bg-popover text-popover-foreground", className),
|
|
14
18
|
children: [!hideLabel && label !== void 0 && /* @__PURE__ */ jsx("p", {
|
|
@@ -16,37 +20,58 @@ function ChartTooltipContent({ active, payload, label, valueFormatter = (value)
|
|
|
16
20
|
children: labelFormatter ? labelFormatter(label) : label
|
|
17
21
|
}), /* @__PURE__ */ jsxs("div", {
|
|
18
22
|
className: "flex flex-col gap-1",
|
|
19
|
-
children: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
children: [
|
|
24
|
+
rows.map((item, index) => {
|
|
25
|
+
const swatch = [
|
|
26
|
+
item.color,
|
|
27
|
+
item.stroke,
|
|
28
|
+
item.fill
|
|
29
|
+
].find((candidate) => typeof candidate === "string" && candidate.length > 0 && !candidate.startsWith("url(")) ?? theme.mutedForeground;
|
|
30
|
+
const numeric = toNumber(item.value);
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: "flex items-center justify-between gap-4 text-text-xs",
|
|
33
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
34
|
+
className: "inline-flex items-center gap-2 text-muted-foreground",
|
|
35
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
36
|
+
"aria-hidden": true,
|
|
37
|
+
className: "size-2 shrink-0 rounded-[2px]",
|
|
38
|
+
style: { background: swatch }
|
|
39
|
+
}), item.name]
|
|
40
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: "font-mono font-semibold tabular-nums text-foreground",
|
|
42
|
+
children: valueFormatter(numeric)
|
|
43
|
+
})]
|
|
44
|
+
}, `${item.dataKey ?? index}`);
|
|
45
|
+
}),
|
|
46
|
+
overflow.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
27
47
|
className: "flex items-center justify-between gap-4 text-text-xs",
|
|
28
48
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
29
|
-
className: "inline-flex items-center gap-2 text-
|
|
30
|
-
children: [
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
className: "inline-flex items-center gap-2 text-quaternary-foreground",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx("span", {
|
|
52
|
+
"aria-hidden": true,
|
|
53
|
+
className: "size-2 shrink-0"
|
|
54
|
+
}),
|
|
55
|
+
"+",
|
|
56
|
+
overflow.length,
|
|
57
|
+
" more"
|
|
58
|
+
]
|
|
59
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: "font-mono font-semibold tabular-nums text-quaternary-foreground",
|
|
61
|
+
children: valueFormatter(overflowTotal)
|
|
62
|
+
})]
|
|
63
|
+
}),
|
|
64
|
+
showTotal && /* @__PURE__ */ jsxs("div", {
|
|
65
|
+
className: "mt-1 flex items-center justify-between gap-4 border-border border-t pt-1.5 text-text-xs",
|
|
66
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "font-mono text-quaternary-foreground uppercase tracking-wider text-[10px]",
|
|
68
|
+
children: totalLabel
|
|
35
69
|
}), /* @__PURE__ */ jsx("span", {
|
|
36
70
|
className: "font-mono font-semibold tabular-nums text-foreground",
|
|
37
|
-
children: valueFormatter(
|
|
71
|
+
children: valueFormatter(total)
|
|
38
72
|
})]
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
className: "mt-1 flex items-center justify-between gap-4 border-border border-t pt-1.5 text-text-xs",
|
|
42
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
43
|
-
className: "font-mono text-quaternary-foreground uppercase tracking-wider text-[10px]",
|
|
44
|
-
children: totalLabel
|
|
45
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
46
|
-
className: "font-mono font-semibold tabular-nums text-foreground",
|
|
47
|
-
children: valueFormatter(total)
|
|
48
|
-
})]
|
|
49
|
-
})]
|
|
73
|
+
})
|
|
74
|
+
]
|
|
50
75
|
})]
|
|
51
76
|
});
|
|
52
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PopoverContent } from "./popover.mjs";
|
|
2
2
|
import { selectTriggerVariants } from "./select-trigger-variants.mjs";
|
|
3
|
-
import { VariantProps } from "class-variance-authority";
|
|
4
3
|
import { ReactNode } from "react";
|
|
4
|
+
import { VariantProps } from "class-variance-authority";
|
|
5
5
|
import { Command } from "cmdk";
|
|
6
6
|
|
|
7
7
|
//#region src/components/combobox.d.ts
|
|
@@ -3,9 +3,9 @@ import { cn } from "../lib/cn.mjs";
|
|
|
3
3
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover.mjs";
|
|
4
4
|
import { selectTriggerVariants } from "./select-trigger-variants.mjs";
|
|
5
5
|
import { TagDismissible } from "./tag.mjs";
|
|
6
|
+
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
6
7
|
import { CheckIcon, ChevronDownIcon, SearchIcon } from "lucide-react";
|
|
7
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
9
9
|
import { Command } from "cmdk";
|
|
10
10
|
//#region src/components/combobox.tsx
|
|
11
11
|
const ComboboxContext = createContext(null);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.mjs";
|
|
2
3
|
import { cn } from "../lib/cn.mjs";
|
|
3
4
|
import { Button } from "./button.mjs";
|
|
4
|
-
import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.mjs";
|
|
5
5
|
import { Check, Copy } from "lucide-react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/copyable.tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonProps } from "./button.mjs";
|
|
2
|
-
import { VariantProps } from "class-variance-authority";
|
|
3
2
|
import * as React$1 from "react";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
5
|
|
|
6
6
|
//#region src/components/dialog.d.ts
|
|
@@ -3,8 +3,8 @@ import { cn } from "../lib/cn.mjs";
|
|
|
3
3
|
import { paletteColor } from "../lib/chart-palette.mjs";
|
|
4
4
|
import { formatShare } from "../lib/chart.mjs";
|
|
5
5
|
import { useChartContext } from "./chart-container.mjs";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Cell, Pie, PieChart, ResponsiveContainer } from "recharts";
|
|
9
9
|
//#region src/components/donut-chart.tsx
|
|
10
10
|
const GEOMETRY = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VariantProps } from "class-variance-authority";
|
|
2
1
|
import * as React$1 from "react";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
4
|
|
|
5
5
|
//#region src/components/dropdown-menu.d.ts
|
package/dist/components/form.mjs
CHANGED
|
@@ -7,9 +7,9 @@ import { Input } from "./input.mjs";
|
|
|
7
7
|
import { RadioGroup, RadioGroupItem } from "./radio-group.mjs";
|
|
8
8
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.mjs";
|
|
9
9
|
import { Textarea } from "./textarea.mjs";
|
|
10
|
+
import * as React$1 from "react";
|
|
10
11
|
import { Info } from "lucide-react";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
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
|
|
@@ -22,6 +22,9 @@ interface HeatmapChartProps {
|
|
|
22
22
|
label: string;
|
|
23
23
|
format?: (value: number) => string;
|
|
24
24
|
}>;
|
|
25
|
+
tooltipTitleKey?: string;
|
|
26
|
+
colorScale?: "linear" | "rank";
|
|
27
|
+
showLegend?: boolean;
|
|
25
28
|
ariaLabel?: string;
|
|
26
29
|
className?: string;
|
|
27
30
|
}
|
|
@@ -41,6 +44,9 @@ declare function HeatmapChart({
|
|
|
41
44
|
xTickFormatter,
|
|
42
45
|
yTickFormatter,
|
|
43
46
|
tooltipMetrics,
|
|
47
|
+
tooltipTitleKey,
|
|
48
|
+
colorScale,
|
|
49
|
+
showLegend,
|
|
44
50
|
ariaLabel,
|
|
45
51
|
className
|
|
46
52
|
}: HeatmapChartProps): React$1.JSX.Element;
|