@squadbase/vantage 0.6.2-dev1.5aae04e → 0.6.2-dev1.81c1bbe
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/chunk-2IAPIOPS.js +152 -0
- package/dist/chunk-2IAPIOPS.js.map +1 -0
- package/dist/chunk-57GHR5LN.js +163 -0
- package/dist/chunk-57GHR5LN.js.map +1 -0
- package/dist/{chunk-XPQSTZUU.js → chunk-7S52M2SL.js} +4 -3
- package/dist/chunk-7S52M2SL.js.map +1 -0
- package/dist/chunk-JXFCSF3K.js +673 -0
- package/dist/chunk-JXFCSF3K.js.map +1 -0
- package/dist/{chunk-HKSVYMYJ.js → chunk-RU6WKEOG.js} +56 -927
- package/dist/chunk-RU6WKEOG.js.map +1 -0
- package/dist/components/index.d.ts +3 -243
- package/dist/components/index.js +5 -2
- package/dist/doc/index.d.ts +194 -2
- package/dist/doc/index.js +334 -3
- package/dist/doc/index.js.map +1 -1
- package/dist/format-U0cQl069.d.ts +243 -0
- package/dist/slide/index.d.ts +177 -1
- package/dist/slide/index.js +864 -1
- package/dist/slide/index.js.map +1 -1
- package/dist/table/index.js +5 -2
- package/dist/table/index.js.map +1 -1
- package/dist/ui/index.d.ts +4 -1
- package/dist/ui/index.js +3 -3
- package/dist/ui/index.js.map +1 -1
- package/docs/en/components.md +11 -2
- package/docs/en/doc/doc-action-items.md +49 -0
- package/docs/en/doc/doc-callout.md +38 -0
- package/docs/en/doc/doc-data-table.md +60 -0
- package/docs/en/doc/doc-executive-summary.md +64 -0
- package/docs/en/doc/doc-figure.md +56 -0
- package/docs/en/doc/doc-key-findings.md +61 -0
- package/docs/en/doc/doc-kpi-scorecard.md +80 -0
- package/docs/en/doc/doc-report-header.md +46 -0
- package/docs/en/parts/area-chart.md +99 -0
- package/docs/en/parts/bar-chart.md +91 -0
- package/docs/en/parts/bar-list.md +50 -0
- package/docs/en/parts/category-bar.md +37 -0
- package/docs/en/parts/chart-frame.md +39 -0
- package/docs/en/parts/donut-chart.md +72 -0
- package/docs/en/parts/funnel-steps.md +2 -1
- package/docs/en/parts/heatmap.md +53 -0
- package/docs/en/parts/legend.md +35 -0
- package/docs/en/parts/line-chart.md +94 -0
- package/docs/en/parts/progress-circle.md +33 -0
- package/docs/en/parts/sample-data.md +39 -0
- package/docs/en/parts/scatter-chart.md +56 -0
- package/docs/en/parts/tracker.md +36 -0
- package/docs/en/parts/updated-at.md +30 -0
- package/docs/en/parts/waterfall-chart.md +56 -0
- package/docs/en/slide/slide-chart-insight.md +52 -0
- package/docs/en/slide/slide-cover.md +39 -0
- package/docs/en/slide/slide-exec-summary.md +47 -0
- package/docs/en/slide/slide-kpi-grid.md +55 -0
- package/docs/en/slide/slide-kpi-hero.md +58 -0
- package/docs/en/slide/slide-next-actions.md +49 -0
- package/docs/en/slide/slide-scorecard-table.md +54 -0
- package/docs/en/ui/alert-dialog.md +42 -0
- package/docs/en/ui/avatar.md +31 -0
- package/docs/en/ui/combobox.md +74 -0
- package/docs/en/ui/drawer.md +41 -0
- package/docs/en/ui/empty.md +1 -1
- package/docs/en/ui/error-state.md +4 -3
- package/docs/en/ui/field.md +42 -0
- package/docs/en/ui/hover-card.md +21 -0
- package/docs/en/ui/kbd.md +17 -0
- package/docs/en/ui/loading.md +1 -1
- package/docs/en/ui/pagination.md +36 -0
- package/docs/en/ui/radio-group.md +21 -0
- package/docs/en/ui/toast.md +44 -0
- package/docs/en/ui/toggle-group.md +4 -3
- package/docs/index.json +697 -77
- package/docs/ja/components.md +10 -1
- package/docs/ja/doc/doc-action-items.md +49 -0
- package/docs/ja/doc/doc-callout.md +38 -0
- package/docs/ja/doc/doc-data-table.md +60 -0
- package/docs/ja/doc/doc-executive-summary.md +64 -0
- package/docs/ja/doc/doc-figure.md +56 -0
- package/docs/ja/doc/doc-key-findings.md +61 -0
- package/docs/ja/doc/doc-kpi-scorecard.md +80 -0
- package/docs/ja/doc/doc-report-header.md +46 -0
- package/docs/ja/parts/area-chart.md +49 -25
- package/docs/ja/parts/bar-chart.md +50 -24
- package/docs/ja/parts/bar-list.md +31 -8
- package/docs/ja/parts/chart-frame.md +36 -0
- package/docs/ja/parts/donut-chart.md +45 -26
- package/docs/ja/parts/funnel-steps.md +27 -8
- package/docs/ja/parts/heatmap.md +45 -0
- package/docs/ja/parts/legend.md +36 -0
- package/docs/ja/parts/line-chart.md +48 -22
- package/docs/ja/parts/sample-data.md +61 -0
- package/docs/ja/parts/scatter-chart.md +69 -0
- package/docs/ja/parts/updated-at.md +27 -0
- package/docs/ja/parts/waterfall-chart.md +61 -0
- package/docs/ja/slide/slide-chart-insight.md +52 -0
- package/docs/ja/slide/slide-cover.md +39 -0
- package/docs/ja/slide/slide-exec-summary.md +47 -0
- package/docs/ja/slide/slide-kpi-grid.md +55 -0
- package/docs/ja/slide/slide-kpi-hero.md +58 -0
- package/docs/ja/slide/slide-next-actions.md +49 -0
- package/docs/ja/slide/slide-scorecard-table.md +54 -0
- package/docs/ja/ui/empty.md +1 -1
- package/docs/ja/ui/error-state.md +4 -3
- package/docs/ja/ui/loading.md +1 -1
- package/docs/ja/ui/toggle-group.md +4 -3
- package/package.json +2 -2
- package/registry/ui/area-chart.tsx +45 -19
- package/registry/ui/bar-chart.tsx +45 -19
- package/registry/ui/bar-list.tsx +44 -17
- package/registry/ui/box-plot-chart.tsx +45 -19
- package/registry/ui/category-bar.tsx +44 -17
- package/registry/ui/chart-frame.tsx +44 -17
- package/registry/ui/delta.tsx +4 -4
- package/registry/ui/donut-chart.tsx +46 -19
- package/registry/ui/echart.tsx +171 -54
- package/registry/ui/heatmap.tsx +45 -19
- package/registry/ui/histogram-chart.tsx +45 -19
- package/registry/ui/legend.tsx +44 -17
- package/registry/ui/line-chart.tsx +45 -19
- package/registry/ui/page-shell.tsx +7 -7
- package/registry/ui/paired-chart.tsx +45 -19
- package/registry/ui/sample-data.tsx +1 -1
- package/registry/ui/scatter-chart.tsx +45 -19
- package/registry/ui/slider.tsx +1 -1
- package/registry/ui/status-badge.tsx +8 -8
- package/registry/ui/tooltip.tsx +6 -2
- package/registry/ui/tracker.tsx +9 -3
- package/registry/ui/trend-indicator.tsx +2 -2
- package/registry/ui/waterfall-chart.tsx +45 -19
- package/skills/vantage-design/SKILL.md +27 -25
- package/skills/vantage-design/references/extract.md +16 -14
- package/skills/vantage-design/references/format.md +6 -5
- package/skills/vantage-design/references/presets.md +60 -110
- package/skills/vantage-slide/SKILL.md +54 -36
- package/templates/AGENTS.md +2 -2
- package/templates/agents/doc.md +45 -0
- package/templates/agents/page.md +22 -1
- package/templates/agents/slide.md +55 -2
- package/theme.css +16 -15
- package/dist/chunk-HKSVYMYJ.js.map +0 -1
- package/dist/chunk-XPQSTZUU.js.map +0 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChartFrameContext, useChartSurface, resolveChartColors, CHART_OTHER_COLOR, EChart, resolveFillColors } from './chunk-JXFCSF3K.js';
|
|
2
|
+
import { Sparkline } from './chunk-2IAPIOPS.js';
|
|
3
|
+
import { formatDateRange, EMPTY_VALUE, DEFAULT_LOCALE, formatDate, toValueFormatter, formatValue, formatPoints, formatKind, formatDelta, MINUS_SIGN, formatDatesInText } from './chunk-57GHR5LN.js';
|
|
4
|
+
import { Tooltip, TooltipTrigger, TooltipContent, Badge, SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarFooter, SidebarRail, SidebarInset, SidebarTrigger, Separator, Input, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Skeleton, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuCheckboxItem, useIsMobile, Popover, PopoverTrigger, PopoverContent, Calendar, ToggleGroup, ToggleGroupItem, SelectGroup, SelectLabel, Collapsible, CollapsibleTrigger, SidebarMenuButton, SidebarMenuBadge, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, SidebarMenuItem, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, Checkbox, Card, CardHeader, CardDescription, CardTitle, CardAction, CardFooter } from './chunk-7S52M2SL.js';
|
|
2
5
|
import { Button } from './chunk-PDOBHMUQ.js';
|
|
3
6
|
import { cn } from './chunk-U736PVHY.js';
|
|
4
|
-
import { forwardRef, useState, useEffect, createContext, useId,
|
|
7
|
+
import { forwardRef, useState, useEffect, createContext, useId, useMemo, useRef, useCallback, Fragment as Fragment$1, useContext } from 'react';
|
|
5
8
|
import { cva } from 'class-variance-authority';
|
|
6
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
import {
|
|
8
|
-
import { use
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { CanvasRenderer } from 'echarts/renderers';
|
|
10
|
+
import { Search, Columns3, CalendarIcon, ChevronDownIcon, ArrowUp, ArrowDown, ArrowRight, Minus, ChevronRight, ArrowUpDown, XIcon, LoaderIcon, CheckIcon, Download, ChevronDown, X, CircleX, TriangleAlert, CircleCheck } from 'lucide-react';
|
|
11
|
+
import { use } from 'echarts/core';
|
|
12
|
+
import { GraphicComponent, VisualMapComponent } from 'echarts/components';
|
|
13
|
+
import { ScatterChart as ScatterChart$1, HeatmapChart } from 'echarts/charts';
|
|
12
14
|
import 'echarts';
|
|
13
15
|
import { flexRender, useReactTable, getPaginationRowModel, getFilteredRowModel, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
|
|
14
16
|
import { subMonths, subDays, endOfDay, startOfDay, startOfWeek, subWeeks, endOfWeek, startOfMonth, endOfMonth, isSameDay, format, addMonths } from 'date-fns';
|
|
@@ -16,164 +18,6 @@ import { ja } from 'date-fns/locale';
|
|
|
16
18
|
|
|
17
19
|
// @squadbase/vantage — generated build. Do not edit.
|
|
18
20
|
|
|
19
|
-
// ../squadkit/registry/lib/format.ts
|
|
20
|
-
var DEFAULT_LOCALE = "ja-JP";
|
|
21
|
-
var EMPTY_VALUE = "\u2014";
|
|
22
|
-
var MINUS_SIGN = "\u2212";
|
|
23
|
-
var PERCENT_DIGITS = 1;
|
|
24
|
-
var DEFAULT_CURRENCY = "JPY";
|
|
25
|
-
var MULTIPLE_SUFFIX = "\xD7";
|
|
26
|
-
var POINTS_SUFFIX = "pt";
|
|
27
|
-
function normalize(format2) {
|
|
28
|
-
if (format2 === void 0) return { type: "compact" };
|
|
29
|
-
return typeof format2 === "string" ? { type: format2 } : format2;
|
|
30
|
-
}
|
|
31
|
-
function formatKind(format2) {
|
|
32
|
-
return normalize(format2).type;
|
|
33
|
-
}
|
|
34
|
-
function digitOptions(digits, defaultMax, significantDigits) {
|
|
35
|
-
if (significantDigits !== void 0) return { maximumSignificantDigits: significantDigits };
|
|
36
|
-
if (digits !== void 0) return { minimumFractionDigits: digits, maximumFractionDigits: digits };
|
|
37
|
-
return defaultMax === void 0 ? {} : { maximumFractionDigits: defaultMax };
|
|
38
|
-
}
|
|
39
|
-
function formatParts(locale, options, value) {
|
|
40
|
-
if (options.notation === "compact") {
|
|
41
|
-
const compact = new Intl.NumberFormat(locale, {
|
|
42
|
-
...options,
|
|
43
|
-
useGrouping: "always"
|
|
44
|
-
}).formatToParts(value);
|
|
45
|
-
if (!compact.some((p) => p.type === "compact")) return formatParts(locale, { ...options, notation: "standard" }, value);
|
|
46
|
-
return joinParts(compact);
|
|
47
|
-
}
|
|
48
|
-
return joinParts(new Intl.NumberFormat(locale, options).formatToParts(value));
|
|
49
|
-
}
|
|
50
|
-
var joinParts = (parts) => parts.map((p) => p.type === "currency" ? p.value.normalize("NFKC") : p.type === "minusSign" ? MINUS_SIGN : p.value).join("");
|
|
51
|
-
function formatValue(value, format2, locale = DEFAULT_LOCALE, options) {
|
|
52
|
-
if (value === null || value === void 0 || Number.isNaN(value)) return EMPTY_VALUE;
|
|
53
|
-
const { type, digits, currency, notation, unit, divisor, durationUnit } = normalize(format2);
|
|
54
|
-
if (divisor !== void 0 && Number.isFinite(divisor) && divisor !== 0) value = value / divisor;
|
|
55
|
-
const signDisplay = options?.signDisplay ?? "auto";
|
|
56
|
-
const sig = options?.significantDigits;
|
|
57
|
-
const withUnit = (s) => unit ? `${s}${unit}` : s;
|
|
58
|
-
switch (type) {
|
|
59
|
-
case "number":
|
|
60
|
-
return withUnit(formatParts(locale, { ...digitOptions(digits, 2, sig), signDisplay }, value));
|
|
61
|
-
case "percent":
|
|
62
|
-
return formatParts(locale, { style: "percent", ...digitOptions(digits ?? PERCENT_DIGITS, void 0, sig), signDisplay }, value);
|
|
63
|
-
case "currency":
|
|
64
|
-
return withUnit(
|
|
65
|
-
formatParts(
|
|
66
|
-
locale,
|
|
67
|
-
{
|
|
68
|
-
style: "currency",
|
|
69
|
-
currency: currency ?? DEFAULT_CURRENCY,
|
|
70
|
-
notation: notation ?? "compact",
|
|
71
|
-
...digitOptions(digits, notation === "standard" ? void 0 : 1, sig),
|
|
72
|
-
signDisplay
|
|
73
|
-
},
|
|
74
|
-
value
|
|
75
|
-
)
|
|
76
|
-
);
|
|
77
|
-
case "multiple":
|
|
78
|
-
return `${formatParts(locale, { ...digitOptions(digits, 2, sig), signDisplay }, value)}${unit || MULTIPLE_SUFFIX}`;
|
|
79
|
-
case "compact":
|
|
80
|
-
return withUnit(formatParts(locale, { ...digitOptions(digits, 1, sig), signDisplay, notation: "compact" }, value));
|
|
81
|
-
case "duration":
|
|
82
|
-
return formatDuration(value, durationUnit ?? "second", locale, digits, signDisplay);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
var SECONDS_PER = { second: 1, minute: 60, hour: 3600, day: 86400 };
|
|
86
|
-
function durationWords(locale) {
|
|
87
|
-
return locale.toLowerCase().startsWith("ja") ? { day: "\u65E5", hour: "\u6642\u9593", minute: "\u5206", second: "\u79D2", sep: "" } : { day: "d", hour: "h", minute: "min", second: "s", sep: " " };
|
|
88
|
-
}
|
|
89
|
-
function formatDuration(value, unit, locale, digits, signDisplay) {
|
|
90
|
-
const w = durationWords(locale);
|
|
91
|
-
const abs = Math.round(Math.abs(value) * SECONDS_PER[unit]);
|
|
92
|
-
const join = (...parts) => parts.filter(([n]) => n !== 0).map(([n, u]) => `${n}${w.sep}${u}`).join(w.sep) || `0${w.sep}${parts.at(-1)?.[1] ?? w.second}`;
|
|
93
|
-
let body;
|
|
94
|
-
let zero = false;
|
|
95
|
-
if (abs >= 86400) {
|
|
96
|
-
const days = new Intl.NumberFormat(locale, { maximumFractionDigits: digits ?? 1, minimumFractionDigits: digits ?? 0 });
|
|
97
|
-
body = `${days.format(abs / 86400)}${w.sep}${w.day}`;
|
|
98
|
-
} else if (abs >= 3600) {
|
|
99
|
-
const minutes = Math.round(abs / 60);
|
|
100
|
-
body = join([Math.floor(minutes / 60), w.hour], [minutes % 60, w.minute]);
|
|
101
|
-
} else if (abs >= 60) {
|
|
102
|
-
body = join([Math.floor(abs / 60), w.minute], [abs % 60, w.second]);
|
|
103
|
-
} else {
|
|
104
|
-
zero = abs === 0;
|
|
105
|
-
body = `${abs}${w.sep}${w.second}`;
|
|
106
|
-
}
|
|
107
|
-
const sign = zero ? "" : value < 0 ? MINUS_SIGN : signDisplay === "exceptZero" ? "+" : "";
|
|
108
|
-
return `${sign}${body}`;
|
|
109
|
-
}
|
|
110
|
-
function formatDelta(value, format2, locale = DEFAULT_LOCALE) {
|
|
111
|
-
return formatValue(value, format2, locale, { signDisplay: "exceptZero" });
|
|
112
|
-
}
|
|
113
|
-
function formatPoints(difference, locale = DEFAULT_LOCALE, options) {
|
|
114
|
-
if (difference === null || difference === void 0 || Number.isNaN(difference)) return EMPTY_VALUE;
|
|
115
|
-
const digits = options?.digits ?? PERCENT_DIGITS;
|
|
116
|
-
const number = formatParts(
|
|
117
|
-
locale,
|
|
118
|
-
{ minimumFractionDigits: digits, maximumFractionDigits: digits, signDisplay: options?.signDisplay ?? "exceptZero" },
|
|
119
|
-
difference * 100
|
|
120
|
-
);
|
|
121
|
-
return `${number}${POINTS_SUFFIX}`;
|
|
122
|
-
}
|
|
123
|
-
function toValueFormatter(format2, locale = DEFAULT_LOCALE) {
|
|
124
|
-
return (value) => formatValue(value, format2, locale);
|
|
125
|
-
}
|
|
126
|
-
var DATE_STYLE_OPTIONS = {
|
|
127
|
-
date: { year: "numeric", month: "2-digit", day: "2-digit" },
|
|
128
|
-
datetime: { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hourCycle: "h23" },
|
|
129
|
-
month: { month: "short" },
|
|
130
|
-
"year-month": { year: "numeric", month: "long" },
|
|
131
|
-
year: { year: "numeric" }
|
|
132
|
-
};
|
|
133
|
-
var CALENDAR_DATE = /^\d{4}-\d{2}(-\d{2})?$/;
|
|
134
|
-
function formatDate(value, style = "date", locale = DEFAULT_LOCALE, options) {
|
|
135
|
-
if (value === null || value === void 0 || value === "") return EMPTY_VALUE;
|
|
136
|
-
const calendar = typeof value === "string" && CALENDAR_DATE.test(value);
|
|
137
|
-
const date = value instanceof Date ? value : new Date(value);
|
|
138
|
-
if (!Number.isFinite(date.getTime())) return EMPTY_VALUE;
|
|
139
|
-
return new Intl.DateTimeFormat(locale, {
|
|
140
|
-
...DATE_STYLE_OPTIONS[style],
|
|
141
|
-
timeZone: calendar ? "UTC" : options?.timeZone
|
|
142
|
-
}).format(date);
|
|
143
|
-
}
|
|
144
|
-
function formatDateRange(start, end, options) {
|
|
145
|
-
const locale = options?.locale ?? DEFAULT_LOCALE;
|
|
146
|
-
const parse = (value) => {
|
|
147
|
-
if (value === null || value === void 0 || value === "") return null;
|
|
148
|
-
const calendar = typeof value === "string" && CALENDAR_DATE.test(value);
|
|
149
|
-
const date = value instanceof Date ? value : new Date(value);
|
|
150
|
-
if (!Number.isFinite(date.getTime())) return null;
|
|
151
|
-
return { date, timeZone: calendar ? "UTC" : options?.timeZone };
|
|
152
|
-
};
|
|
153
|
-
const a = parse(start);
|
|
154
|
-
const b = parse(end);
|
|
155
|
-
if (!a || !b) return EMPTY_VALUE;
|
|
156
|
-
const full = (x, withYear) => new Intl.DateTimeFormat(locale, {
|
|
157
|
-
...withYear ? { year: "numeric" } : {},
|
|
158
|
-
month: "numeric",
|
|
159
|
-
day: "numeric",
|
|
160
|
-
timeZone: x.timeZone
|
|
161
|
-
}).format(x.date);
|
|
162
|
-
const year = (x) => new Intl.DateTimeFormat("en-US", { year: "numeric", timeZone: x.timeZone }).format(x.date);
|
|
163
|
-
const startText = full(a, true);
|
|
164
|
-
const sameYear = year(a) === year(b);
|
|
165
|
-
const endFull = full(b, true);
|
|
166
|
-
if (startText === endFull) return startText;
|
|
167
|
-
const separator = locale.toLowerCase().startsWith("ja") ? "\u301C" : " \u2013 ";
|
|
168
|
-
return `${startText}${separator}${sameYear ? full(b, false) : endFull}`;
|
|
169
|
-
}
|
|
170
|
-
function formatDatesInText(text, locale = DEFAULT_LOCALE) {
|
|
171
|
-
return text.replace(
|
|
172
|
-
/(?<![\d-])(\d{4})-(0[1-9]|1[0-2])(-(0[1-9]|[12]\d|3[01]))?(?![\d-])/g,
|
|
173
|
-
(match, _y, _m, day) => formatDate(match, day ? "date" : "year-month", locale)
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
21
|
// ../squadkit/registry/lib/relative-time.ts
|
|
178
22
|
var SECOND = 1e3;
|
|
179
23
|
var MINUTE = 60 * SECOND;
|
|
@@ -288,11 +132,11 @@ var PageShellHeader = forwardRef(
|
|
|
288
132
|
children,
|
|
289
133
|
updatedAt !== void 0 && updatedAt !== null ? /* @__PURE__ */ jsx("div", { "data-slot": "page-shell-updated-at", className: "ml-auto max-w-full shrink-0 text-right", children: /* @__PURE__ */ jsx(UpdatedAt, { at: updatedAt, variant: updatedAtVariant, timeZone }) }) : null,
|
|
290
134
|
hasChips ? /* @__PURE__ */ jsxs("div", { "data-slot": "page-shell-chips", className: "order-1 flex basis-full flex-wrap gap-1.5", children: [
|
|
291
|
-
source ? /* @__PURE__ */ jsxs(Badge, { variant: "outline", className: "h-auto max-w-full whitespace-normal", children: [
|
|
135
|
+
source ? /* @__PURE__ */ jsxs(Badge, { variant: "outline", className: "h-auto max-w-full whitespace-normal text-muted-foreground", children: [
|
|
292
136
|
"\u51FA\u5178\uFF1A",
|
|
293
137
|
source
|
|
294
138
|
] }) : null,
|
|
295
|
-
periodText && periodText !== EMPTY_VALUE ? /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "tabular-nums", children: periodText }) : null
|
|
139
|
+
periodText && periodText !== EMPTY_VALUE ? /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "tabular-nums text-muted-foreground", children: periodText }) : null
|
|
296
140
|
] }) : null,
|
|
297
141
|
hasStatus ? /* @__PURE__ */ jsx("div", { "data-slot": "page-shell-status", className: "order-2 min-w-0 basis-full", children: status }) : null
|
|
298
142
|
]
|
|
@@ -389,11 +233,11 @@ var PageShellSummary = forwardRef(
|
|
|
389
233
|
);
|
|
390
234
|
PageShellSummary.displayName = "PageShellSummary";
|
|
391
235
|
var summaryCardTones = {
|
|
392
|
-
positive: "border-positive/
|
|
393
|
-
negative: "border-negative/
|
|
394
|
-
warning: "border-warning/
|
|
395
|
-
info: "border-info/
|
|
396
|
-
neutral: "border-neutral/
|
|
236
|
+
positive: "border-positive/20 dark:border-positive/25 bg-positive-subtle [&>svg]:text-positive",
|
|
237
|
+
negative: "border-negative/20 dark:border-negative/25 bg-negative-subtle [&>svg]:text-negative",
|
|
238
|
+
warning: "border-warning/20 dark:border-warning/25 bg-warning-subtle [&>svg]:text-warning",
|
|
239
|
+
info: "border-info/20 dark:border-info/25 bg-info-subtle [&>svg]:text-info",
|
|
240
|
+
neutral: "border-neutral/20 dark:border-neutral/25 bg-neutral-subtle [&>svg]:text-neutral",
|
|
397
241
|
violet: "border-chart-4/30 bg-chart-4/5 [&>svg]:text-chart-4",
|
|
398
242
|
pink: "border-chart-5/30 bg-chart-5/5 [&>svg]:text-chart-5"
|
|
399
243
|
};
|
|
@@ -667,7 +511,7 @@ function SampleBadge({ label: label2 = DEFAULT_SAMPLE_LABEL, className, ...props
|
|
|
667
511
|
{
|
|
668
512
|
"data-slot": "sample-badge",
|
|
669
513
|
title: SAMPLE_TITLE,
|
|
670
|
-
className: cn("border-warning/
|
|
514
|
+
className: cn("border-warning/20 dark:border-warning/25 bg-warning-subtle text-warning align-middle", className),
|
|
671
515
|
...props,
|
|
672
516
|
children: label2
|
|
673
517
|
}
|
|
@@ -807,228 +651,6 @@ function DashboardCardPreset({
|
|
|
807
651
|
footer && /* @__PURE__ */ jsx(DashboardCardFooter, { className: cn(subgrid === 3 && "row-start-3", footerClassName), children: footer })
|
|
808
652
|
] }) });
|
|
809
653
|
}
|
|
810
|
-
var CHART_OTHER_COLOR = "color-mix(in oklab, var(--neutral) 50%, var(--background))";
|
|
811
|
-
var ChartFrameContext = createContext(false);
|
|
812
|
-
var SERIES_TOKENS = ["--chart-1", "--chart-2", "--chart-3", "--chart-4", "--chart-5"];
|
|
813
|
-
var normalizeContext;
|
|
814
|
-
var ZRENDER_COLOR_RE = /^(?:#[0-9a-f]{6}|rgba?\()/i;
|
|
815
|
-
function toCanvasColor(value) {
|
|
816
|
-
const raw = value.trim();
|
|
817
|
-
if (!raw) return null;
|
|
818
|
-
if (normalizeContext === void 0) {
|
|
819
|
-
const canvas = document.createElement("canvas");
|
|
820
|
-
canvas.width = 1;
|
|
821
|
-
canvas.height = 1;
|
|
822
|
-
normalizeContext = canvas.getContext("2d", { willReadFrequently: true });
|
|
823
|
-
}
|
|
824
|
-
const ctx = normalizeContext;
|
|
825
|
-
if (!ctx) return raw;
|
|
826
|
-
ctx.fillStyle = "#000000";
|
|
827
|
-
ctx.fillStyle = raw;
|
|
828
|
-
const onBlack = ctx.fillStyle;
|
|
829
|
-
ctx.fillStyle = "#ffffff";
|
|
830
|
-
ctx.fillStyle = raw;
|
|
831
|
-
if (onBlack !== ctx.fillStyle || typeof onBlack !== "string") return null;
|
|
832
|
-
if (ZRENDER_COLOR_RE.test(onBlack)) return onBlack;
|
|
833
|
-
ctx.clearRect(0, 0, 1, 1);
|
|
834
|
-
ctx.fillRect(0, 0, 1, 1);
|
|
835
|
-
const [r = 0, g = 0, b = 0, a = 0] = ctx.getImageData(0, 0, 1, 1).data;
|
|
836
|
-
return a === 255 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${Math.round(a / 255 * 1e3) / 1e3})`;
|
|
837
|
-
}
|
|
838
|
-
function readChartTokens(el) {
|
|
839
|
-
if (typeof document === "undefined") return null;
|
|
840
|
-
const target = document.documentElement;
|
|
841
|
-
if (!target) return null;
|
|
842
|
-
const styles = getComputedStyle(target);
|
|
843
|
-
const read = (name) => toCanvasColor(styles.getPropertyValue(name));
|
|
844
|
-
const series = [];
|
|
845
|
-
for (const token of SERIES_TOKENS) {
|
|
846
|
-
const color = read(token);
|
|
847
|
-
if (color) series.push(color);
|
|
848
|
-
}
|
|
849
|
-
return {
|
|
850
|
-
series,
|
|
851
|
-
...styles.fontFamily ? { fontFamily: styles.fontFamily } : {},
|
|
852
|
-
foreground: read("--foreground"),
|
|
853
|
-
mutedForeground: read("--muted-foreground"),
|
|
854
|
-
border: read("--border"),
|
|
855
|
-
popover: read("--popover"),
|
|
856
|
-
popoverForeground: read("--popover-foreground")
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
function sameChartTokens(a, b) {
|
|
860
|
-
if (a === b) return true;
|
|
861
|
-
if (!a || !b) return false;
|
|
862
|
-
return a.series.length === b.series.length && a.series.every((color, i) => color === b.series[i]) && a.fontFamily === b.fontFamily && a.foreground === b.foreground && a.mutedForeground === b.mutedForeground && a.border === b.border && a.popover === b.popover && a.popoverForeground === b.popoverForeground;
|
|
863
|
-
}
|
|
864
|
-
function watchChartTokens(onChange) {
|
|
865
|
-
if (typeof document === "undefined") return () => {
|
|
866
|
-
};
|
|
867
|
-
let frame = 0;
|
|
868
|
-
const schedule = () => {
|
|
869
|
-
if (frame) return;
|
|
870
|
-
frame = requestAnimationFrame(() => {
|
|
871
|
-
frame = 0;
|
|
872
|
-
onChange();
|
|
873
|
-
});
|
|
874
|
-
};
|
|
875
|
-
const themeObserver = new MutationObserver(schedule);
|
|
876
|
-
const attributeFilter = ["class", "style", "data-theme"];
|
|
877
|
-
themeObserver.observe(document.documentElement, { attributes: true, attributeFilter });
|
|
878
|
-
if (document.body) themeObserver.observe(document.body, { attributes: true, attributeFilter });
|
|
879
|
-
const styleObserver = new MutationObserver(schedule);
|
|
880
|
-
if (document.head) {
|
|
881
|
-
styleObserver.observe(document.head, {
|
|
882
|
-
childList: true,
|
|
883
|
-
subtree: true,
|
|
884
|
-
characterData: true,
|
|
885
|
-
attributes: true,
|
|
886
|
-
attributeFilter: ["href", "media", "disabled"]
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
const onLoad = (event) => {
|
|
890
|
-
if (event.target instanceof HTMLLinkElement) schedule();
|
|
891
|
-
};
|
|
892
|
-
document.addEventListener("load", onLoad, true);
|
|
893
|
-
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
894
|
-
media.addEventListener("change", schedule);
|
|
895
|
-
return () => {
|
|
896
|
-
if (frame) cancelAnimationFrame(frame);
|
|
897
|
-
themeObserver.disconnect();
|
|
898
|
-
styleObserver.disconnect();
|
|
899
|
-
document.removeEventListener("load", onLoad, true);
|
|
900
|
-
media.removeEventListener("change", schedule);
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
function axisTheme(tokens, splitLine) {
|
|
904
|
-
const line = tokens.border ?? void 0;
|
|
905
|
-
return {
|
|
906
|
-
axisLine: { show: false },
|
|
907
|
-
axisTick: { show: false },
|
|
908
|
-
axisLabel: { show: true, color: tokens.mutedForeground ?? void 0, fontSize: 12 },
|
|
909
|
-
// Faint horizontal rules only: the border colour at low opacity.
|
|
910
|
-
splitLine: { show: splitLine, lineStyle: { color: line ? [line] : void 0, opacity: 0.5, width: 1 } },
|
|
911
|
-
splitArea: { show: false }
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
function buildChartTheme(tokens) {
|
|
915
|
-
const text = tokens.foreground ?? void 0;
|
|
916
|
-
const muted = tokens.mutedForeground ?? void 0;
|
|
917
|
-
const line = tokens.border ?? void 0;
|
|
918
|
-
return {
|
|
919
|
-
// Let the page background show through: charts sit on cards, not on a canvas.
|
|
920
|
-
backgroundColor: "transparent",
|
|
921
|
-
...tokens.series.length > 0 ? { color: tokens.series } : {},
|
|
922
|
-
textStyle: { color: text, ...tokens.fontFamily ? { fontFamily: tokens.fontFamily } : {} },
|
|
923
|
-
title: { textStyle: { color: text }, subtextStyle: { color: muted } },
|
|
924
|
-
legend: { textStyle: { color: muted } },
|
|
925
|
-
categoryAxis: axisTheme(tokens, false),
|
|
926
|
-
valueAxis: axisTheme(tokens, true),
|
|
927
|
-
logAxis: axisTheme(tokens, true),
|
|
928
|
-
timeAxis: axisTheme(tokens, true),
|
|
929
|
-
tooltip: {
|
|
930
|
-
// ECharts' default 0.4s transform lags the tooltip ~300ms behind the cursor.
|
|
931
|
-
transitionDuration: 0,
|
|
932
|
-
backgroundColor: tokens.popover ?? void 0,
|
|
933
|
-
borderColor: line,
|
|
934
|
-
borderWidth: 1,
|
|
935
|
-
padding: [8, 12],
|
|
936
|
-
// Rounded card with a soft shadow; in dark mode the shadow barely shows, so the border carries the edge.
|
|
937
|
-
extraCssText: "border-radius:8px;box-shadow:var(--shadow-card, 0 4px 12px rgb(0 0 0 / 0.08));",
|
|
938
|
-
textStyle: {
|
|
939
|
-
color: tokens.popoverForeground ?? void 0,
|
|
940
|
-
fontSize: 12,
|
|
941
|
-
...tokens.fontFamily ? { fontFamily: tokens.fontFamily } : {}
|
|
942
|
-
},
|
|
943
|
-
axisPointer: { lineStyle: { color: line }, crossStyle: { color: line } }
|
|
944
|
-
}
|
|
945
|
-
};
|
|
946
|
-
}
|
|
947
|
-
function useChartTokens() {
|
|
948
|
-
const [tokens, setTokens] = useState(() => readChartTokens());
|
|
949
|
-
const tokensRef = useRef(tokens);
|
|
950
|
-
useEffect(() => {
|
|
951
|
-
const sync = () => {
|
|
952
|
-
const next = readChartTokens();
|
|
953
|
-
if (sameChartTokens(tokensRef.current, next)) return;
|
|
954
|
-
tokensRef.current = next;
|
|
955
|
-
setTokens(next);
|
|
956
|
-
};
|
|
957
|
-
sync();
|
|
958
|
-
return watchChartTokens(sync);
|
|
959
|
-
}, []);
|
|
960
|
-
return tokens;
|
|
961
|
-
}
|
|
962
|
-
var SERIES_TOKEN_NAME_RE = /^chart-([1-5])$/;
|
|
963
|
-
var TONE_NAME_RE = /^(?:positive|warning|negative|neutral|info)(?:-fill)?$/;
|
|
964
|
-
var CSS_VAR_RE = /^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/;
|
|
965
|
-
var EMBEDDED_VAR_RE = /var\(\s*(--[\w-]+)\s*\)/g;
|
|
966
|
-
function resolveChartColors(colors, tokens) {
|
|
967
|
-
return colors.map((color) => {
|
|
968
|
-
const token = SERIES_TOKEN_NAME_RE.exec(color.trim());
|
|
969
|
-
if (token) return tokens?.series[Number(token[1]) - 1] ?? "";
|
|
970
|
-
if (TONE_NAME_RE.test(color.trim())) {
|
|
971
|
-
if (typeof document === "undefined") return "";
|
|
972
|
-
return toCanvasColor(getComputedStyle(document.documentElement).getPropertyValue(`--${color.trim()}`)) ?? "";
|
|
973
|
-
}
|
|
974
|
-
if (typeof document === "undefined") return color;
|
|
975
|
-
let value = color.trim();
|
|
976
|
-
const cssVar = CSS_VAR_RE.exec(value);
|
|
977
|
-
const styles = getComputedStyle(document.documentElement);
|
|
978
|
-
if (cssVar) {
|
|
979
|
-
value = styles.getPropertyValue(cssVar[1]).trim() || (cssVar[2] ?? "").trim();
|
|
980
|
-
} else if (value.includes("var(")) {
|
|
981
|
-
value = value.replace(EMBEDDED_VAR_RE, (_, name) => styles.getPropertyValue(name).trim());
|
|
982
|
-
}
|
|
983
|
-
return toCanvasColor(value) ?? "";
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
function resolveFillColors(tokens) {
|
|
987
|
-
const [positive = "", warning = "", negative = "", neutral = ""] = resolveChartColors(
|
|
988
|
-
["positive-fill", "warning-fill", "negative-fill", "neutral-fill"],
|
|
989
|
-
tokens
|
|
990
|
-
);
|
|
991
|
-
return { positive, warning, negative, neutral };
|
|
992
|
-
}
|
|
993
|
-
var TRANSPARENT_RE = /^(?:transparent|rgba\([^)]*,\s*0(?:\.0+)?\))$/i;
|
|
994
|
-
function readChartSurface(el) {
|
|
995
|
-
if (typeof document === "undefined") return null;
|
|
996
|
-
for (let node = el; node; node = node.parentElement) {
|
|
997
|
-
const bg = getComputedStyle(node).backgroundColor.trim();
|
|
998
|
-
if (bg && !TRANSPARENT_RE.test(bg)) {
|
|
999
|
-
const color = toCanvasColor(bg);
|
|
1000
|
-
if (color) return color;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
return toCanvasColor(getComputedStyle(document.documentElement).getPropertyValue("--background"));
|
|
1004
|
-
}
|
|
1005
|
-
var WIDTH_BUCKET = 40;
|
|
1006
|
-
function useChartSurface(forwarded, tokens) {
|
|
1007
|
-
const [node, setNode] = useState(null);
|
|
1008
|
-
const [surface, setSurface] = useState(void 0);
|
|
1009
|
-
const [width, setWidth] = useState(void 0);
|
|
1010
|
-
const ref = useCallback(
|
|
1011
|
-
(el) => {
|
|
1012
|
-
setNode(el);
|
|
1013
|
-
if (typeof forwarded === "function") forwarded(el);
|
|
1014
|
-
else if (forwarded) forwarded.current = el;
|
|
1015
|
-
},
|
|
1016
|
-
[forwarded]
|
|
1017
|
-
);
|
|
1018
|
-
useEffect(() => {
|
|
1019
|
-
if (!node) return;
|
|
1020
|
-
setSurface(readChartSurface(node) ?? void 0);
|
|
1021
|
-
}, [node, tokens]);
|
|
1022
|
-
useEffect(() => {
|
|
1023
|
-
if (!node || typeof ResizeObserver === "undefined") return;
|
|
1024
|
-
const update = (w) => setWidth(Math.floor(w / WIDTH_BUCKET) * WIDTH_BUCKET);
|
|
1025
|
-
update(node.getBoundingClientRect().width);
|
|
1026
|
-
const observer = new ResizeObserver((entries) => update(entries[0]?.contentRect.width ?? 0));
|
|
1027
|
-
observer.observe(node);
|
|
1028
|
-
return () => observer.disconnect();
|
|
1029
|
-
}, [node]);
|
|
1030
|
-
return { ref, surface, width };
|
|
1031
|
-
}
|
|
1032
654
|
var DEFAULT_CHART_HEIGHT = 288;
|
|
1033
655
|
var DEFAULT_EMPTY_TITLE = "\u8868\u793A\u3067\u304D\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093";
|
|
1034
656
|
var ChartFrame = forwardRef(function ChartFrame2({
|
|
@@ -1112,356 +734,6 @@ function ChartEmpty({ title, description, action }) {
|
|
|
1112
734
|
}
|
|
1113
735
|
);
|
|
1114
736
|
}
|
|
1115
|
-
use([
|
|
1116
|
-
BarChart,
|
|
1117
|
-
CustomChart,
|
|
1118
|
-
LineChart,
|
|
1119
|
-
PieChart,
|
|
1120
|
-
GridComponent,
|
|
1121
|
-
LegendComponent,
|
|
1122
|
-
MarkAreaComponent,
|
|
1123
|
-
MarkLineComponent,
|
|
1124
|
-
MarkPointComponent,
|
|
1125
|
-
TooltipComponent,
|
|
1126
|
-
CanvasRenderer
|
|
1127
|
-
]);
|
|
1128
|
-
var HEADER_PAD_X = 16;
|
|
1129
|
-
var HEADER_PAD_TOP = 16;
|
|
1130
|
-
var HEADER_PAD_BOTTOM = 12;
|
|
1131
|
-
var HEADER_LINE_HEIGHT = 20;
|
|
1132
|
-
var HEADER_GAP = 4;
|
|
1133
|
-
var HEADER_FONT_SIZE = 14;
|
|
1134
|
-
function wrapChartText(text, maxWidth, measure) {
|
|
1135
|
-
const lines = [];
|
|
1136
|
-
let line = "";
|
|
1137
|
-
for (const ch of text) {
|
|
1138
|
-
if (ch === "\n") {
|
|
1139
|
-
lines.push(line);
|
|
1140
|
-
line = "";
|
|
1141
|
-
continue;
|
|
1142
|
-
}
|
|
1143
|
-
if (line !== "" && measure(line + ch) > maxWidth) {
|
|
1144
|
-
lines.push(line);
|
|
1145
|
-
line = ch.trim() === "" ? "" : ch;
|
|
1146
|
-
} else {
|
|
1147
|
-
line += ch;
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
if (line !== "" || lines.length === 0) lines.push(line);
|
|
1151
|
-
return lines.filter((l, i) => l !== "" || i < lines.length - 1);
|
|
1152
|
-
}
|
|
1153
|
-
function chartExportHeaderLayout(header, width, measure) {
|
|
1154
|
-
const title = header?.title?.trim();
|
|
1155
|
-
const summary = header?.summary?.trim();
|
|
1156
|
-
if (!title && !summary) return { lines: [], height: 0 };
|
|
1157
|
-
const room = Math.max(40, width - HEADER_PAD_X * 2);
|
|
1158
|
-
const lines = [
|
|
1159
|
-
...title ? wrapChartText(title, room, (t) => measure(t, "title")).map((text) => ({ text, kind: "title" })) : [],
|
|
1160
|
-
...summary ? wrapChartText(summary, room, (t) => measure(t, "summary")).map((text) => ({ text, kind: "summary" })) : []
|
|
1161
|
-
];
|
|
1162
|
-
const gap = title && summary ? HEADER_GAP : 0;
|
|
1163
|
-
return { lines, height: HEADER_PAD_TOP + lines.length * HEADER_LINE_HEIGHT + gap + HEADER_PAD_BOTTOM };
|
|
1164
|
-
}
|
|
1165
|
-
function loadImage(src) {
|
|
1166
|
-
return new Promise((resolve, reject) => {
|
|
1167
|
-
const image = new Image();
|
|
1168
|
-
image.onload = () => resolve(image);
|
|
1169
|
-
image.onerror = () => reject(new Error("PNG \u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F"));
|
|
1170
|
-
image.src = src;
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
async function pngWithHeader(dataUrl, header, look, pixelRatio) {
|
|
1174
|
-
const image = await loadImage(dataUrl);
|
|
1175
|
-
const width = image.width / pixelRatio;
|
|
1176
|
-
const plotHeight = image.height / pixelRatio;
|
|
1177
|
-
const canvas = document.createElement("canvas");
|
|
1178
|
-
const ctx = canvas.getContext("2d");
|
|
1179
|
-
if (!ctx) return dataUrl;
|
|
1180
|
-
const font = (kind) => `${kind === "title" ? 500 : 400} ${HEADER_FONT_SIZE}px ${look.fontFamily}`;
|
|
1181
|
-
ctx.font = font("title");
|
|
1182
|
-
const layout = chartExportHeaderLayout(header, width, (text, kind) => {
|
|
1183
|
-
ctx.font = font(kind);
|
|
1184
|
-
return ctx.measureText(text).width;
|
|
1185
|
-
});
|
|
1186
|
-
if (layout.height === 0) return dataUrl;
|
|
1187
|
-
canvas.width = Math.round(image.width);
|
|
1188
|
-
canvas.height = Math.round((layout.height + plotHeight) * pixelRatio);
|
|
1189
|
-
ctx.scale(pixelRatio, pixelRatio);
|
|
1190
|
-
ctx.fillStyle = look.background;
|
|
1191
|
-
ctx.fillRect(0, 0, width, layout.height + plotHeight);
|
|
1192
|
-
ctx.textBaseline = "middle";
|
|
1193
|
-
let y = HEADER_PAD_TOP;
|
|
1194
|
-
let previous = null;
|
|
1195
|
-
for (const line of layout.lines) {
|
|
1196
|
-
if (previous === "title" && line.kind === "summary") y += HEADER_GAP;
|
|
1197
|
-
ctx.font = font(line.kind);
|
|
1198
|
-
ctx.fillStyle = line.kind === "title" ? look.color : look.mutedColor;
|
|
1199
|
-
ctx.fillText(line.text, HEADER_PAD_X, y + HEADER_LINE_HEIGHT / 2);
|
|
1200
|
-
y += HEADER_LINE_HEIGHT;
|
|
1201
|
-
previous = line.kind;
|
|
1202
|
-
}
|
|
1203
|
-
ctx.drawImage(image, 0, layout.height, width, plotHeight);
|
|
1204
|
-
return canvas.toDataURL("image/png");
|
|
1205
|
-
}
|
|
1206
|
-
function useResolvedChartColors(colors) {
|
|
1207
|
-
const tokens = useChartTokens();
|
|
1208
|
-
const key = colors.join("\0");
|
|
1209
|
-
return useMemo(() => resolveChartColors(colors, tokens), [key, tokens]);
|
|
1210
|
-
}
|
|
1211
|
-
var COMPONENT_MAIN_TYPES = /* @__PURE__ */ new Set([
|
|
1212
|
-
"title",
|
|
1213
|
-
"legend",
|
|
1214
|
-
"grid",
|
|
1215
|
-
"xAxis",
|
|
1216
|
-
"yAxis",
|
|
1217
|
-
"polar",
|
|
1218
|
-
"radiusAxis",
|
|
1219
|
-
"angleAxis",
|
|
1220
|
-
"radar",
|
|
1221
|
-
"dataZoom",
|
|
1222
|
-
"visualMap",
|
|
1223
|
-
"tooltip",
|
|
1224
|
-
"axisPointer",
|
|
1225
|
-
"toolbox",
|
|
1226
|
-
"brush",
|
|
1227
|
-
"geo",
|
|
1228
|
-
"parallel",
|
|
1229
|
-
"parallelAxis",
|
|
1230
|
-
"singleAxis",
|
|
1231
|
-
"graphic",
|
|
1232
|
-
"calendar",
|
|
1233
|
-
"dataset",
|
|
1234
|
-
"series",
|
|
1235
|
-
"matrix",
|
|
1236
|
-
"thumbnail"
|
|
1237
|
-
]);
|
|
1238
|
-
function echartSetOptionOpts(prev, next) {
|
|
1239
|
-
const special = (o) => "timeline" in o || "baseOption" in o || "options" in o || "media" in o;
|
|
1240
|
-
if (!prev || special(prev) || special(next)) return { notMerge: true, lazyUpdate: true };
|
|
1241
|
-
const types = /* @__PURE__ */ new Set();
|
|
1242
|
-
for (const key of [...Object.keys(prev), ...Object.keys(next)]) if (COMPONENT_MAIN_TYPES.has(key)) types.add(key);
|
|
1243
|
-
return { notMerge: false, replaceMerge: [...types], lazyUpdate: true };
|
|
1244
|
-
}
|
|
1245
|
-
function withGraphicFont(option, fontFamily) {
|
|
1246
|
-
const graphic = option.graphic;
|
|
1247
|
-
if (!fontFamily || !Array.isArray(graphic)) return option;
|
|
1248
|
-
return {
|
|
1249
|
-
...option,
|
|
1250
|
-
graphic: graphic.map(
|
|
1251
|
-
(g) => g && g.type === "text" && g.style && !g.style.fontFamily ? { ...g, style: { ...g.style, fontFamily } } : g
|
|
1252
|
-
)
|
|
1253
|
-
};
|
|
1254
|
-
}
|
|
1255
|
-
function withMotionPreference(option, reducedMotion) {
|
|
1256
|
-
return { ...option, animation: reducedMotion ? false : option.animation ?? true };
|
|
1257
|
-
}
|
|
1258
|
-
var REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
1259
|
-
function usePrefersReducedMotion() {
|
|
1260
|
-
const [reduced, setReduced] = useState(
|
|
1261
|
-
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(REDUCED_MOTION_QUERY).matches
|
|
1262
|
-
);
|
|
1263
|
-
useEffect(() => {
|
|
1264
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1265
|
-
const media = window.matchMedia(REDUCED_MOTION_QUERY);
|
|
1266
|
-
const sync = () => setReduced(media.matches);
|
|
1267
|
-
sync();
|
|
1268
|
-
media.addEventListener("change", sync);
|
|
1269
|
-
return () => media.removeEventListener("change", sync);
|
|
1270
|
-
}, []);
|
|
1271
|
-
return reduced;
|
|
1272
|
-
}
|
|
1273
|
-
var EChart = forwardRef(function EChart2({
|
|
1274
|
-
option,
|
|
1275
|
-
height,
|
|
1276
|
-
loading = false,
|
|
1277
|
-
theme,
|
|
1278
|
-
onEvents,
|
|
1279
|
-
ariaLabel,
|
|
1280
|
-
className,
|
|
1281
|
-
actions = false,
|
|
1282
|
-
fileName = "chart.png",
|
|
1283
|
-
exportHeader
|
|
1284
|
-
}, ref) {
|
|
1285
|
-
const containerRef = useRef(null);
|
|
1286
|
-
const [instance, setInstance] = useState(null);
|
|
1287
|
-
const [copied, setCopied] = useState(false);
|
|
1288
|
-
const [tokens, setTokens] = useState(() => readChartTokens());
|
|
1289
|
-
const reducedMotion = usePrefersReducedMotion();
|
|
1290
|
-
const appliedRef = useRef(null);
|
|
1291
|
-
const tokensRef = useRef(tokens);
|
|
1292
|
-
useEffect(() => {
|
|
1293
|
-
if (theme !== void 0) return;
|
|
1294
|
-
const sync = () => {
|
|
1295
|
-
const base = readChartTokens();
|
|
1296
|
-
const font = containerRef.current ? getComputedStyle(containerRef.current).fontFamily : "";
|
|
1297
|
-
const next = base && font ? { ...base, fontFamily: font } : base;
|
|
1298
|
-
if (sameChartTokens(tokensRef.current, next)) return;
|
|
1299
|
-
tokensRef.current = next;
|
|
1300
|
-
setTokens(next);
|
|
1301
|
-
};
|
|
1302
|
-
sync();
|
|
1303
|
-
const stop = watchChartTokens(sync);
|
|
1304
|
-
const ancestors = new MutationObserver(sync);
|
|
1305
|
-
for (let node = containerRef.current?.parentElement; node; node = node.parentElement) {
|
|
1306
|
-
ancestors.observe(node, { attributes: true, attributeFilter: ["class", "style"] });
|
|
1307
|
-
}
|
|
1308
|
-
return () => {
|
|
1309
|
-
stop();
|
|
1310
|
-
ancestors.disconnect();
|
|
1311
|
-
};
|
|
1312
|
-
}, [theme]);
|
|
1313
|
-
const autoTheme = useMemo(() => tokens ? buildChartTheme(tokens) : void 0, [tokens]);
|
|
1314
|
-
const resolvedTheme = theme ?? autoTheme;
|
|
1315
|
-
useEffect(() => {
|
|
1316
|
-
const container = containerRef.current;
|
|
1317
|
-
if (!container) return;
|
|
1318
|
-
const inst = init(container, resolvedTheme, { renderer: "canvas" });
|
|
1319
|
-
appliedRef.current = null;
|
|
1320
|
-
container.dataset.rendering = "";
|
|
1321
|
-
inst.on("finished", () => {
|
|
1322
|
-
delete container.dataset.rendering;
|
|
1323
|
-
});
|
|
1324
|
-
setInstance(inst);
|
|
1325
|
-
let frame = 0;
|
|
1326
|
-
const observer = new ResizeObserver(() => {
|
|
1327
|
-
cancelAnimationFrame(frame);
|
|
1328
|
-
frame = requestAnimationFrame(() => {
|
|
1329
|
-
if (!inst.isDisposed()) inst.resize();
|
|
1330
|
-
});
|
|
1331
|
-
});
|
|
1332
|
-
observer.observe(container);
|
|
1333
|
-
return () => {
|
|
1334
|
-
observer.disconnect();
|
|
1335
|
-
cancelAnimationFrame(frame);
|
|
1336
|
-
inst.dispose();
|
|
1337
|
-
};
|
|
1338
|
-
}, [resolvedTheme]);
|
|
1339
|
-
useEffect(() => {
|
|
1340
|
-
if (!instance) return;
|
|
1341
|
-
if (containerRef.current) containerRef.current.dataset.rendering = "";
|
|
1342
|
-
const next = withGraphicFont(withMotionPreference(option, reducedMotion), theme === void 0 ? tokens?.fontFamily : void 0);
|
|
1343
|
-
instance.setOption(next, echartSetOptionOpts(appliedRef.current, next));
|
|
1344
|
-
appliedRef.current = next;
|
|
1345
|
-
}, [instance, option, reducedMotion, theme, tokens?.fontFamily]);
|
|
1346
|
-
useEffect(() => {
|
|
1347
|
-
if (!instance) return;
|
|
1348
|
-
if (loading) instance.showLoading();
|
|
1349
|
-
else instance.hideLoading();
|
|
1350
|
-
}, [instance, loading]);
|
|
1351
|
-
useEffect(() => {
|
|
1352
|
-
if (!instance || !onEvents) return;
|
|
1353
|
-
const entries = Object.entries(onEvents);
|
|
1354
|
-
for (const [event, handler] of entries) {
|
|
1355
|
-
instance.on(event, handler);
|
|
1356
|
-
}
|
|
1357
|
-
return () => {
|
|
1358
|
-
if (instance.isDisposed()) return;
|
|
1359
|
-
for (const [event, handler] of entries) {
|
|
1360
|
-
instance.off(event, handler);
|
|
1361
|
-
}
|
|
1362
|
-
};
|
|
1363
|
-
}, [instance, onEvents]);
|
|
1364
|
-
const includeTitle = typeof actions === "object" ? actions.includeTitle ?? true : true;
|
|
1365
|
-
const getPngDataUrl = useCallback(async () => {
|
|
1366
|
-
if (!instance) return null;
|
|
1367
|
-
let backgroundColor = "#ffffff";
|
|
1368
|
-
for (let el = containerRef.current; el; el = el.parentElement) {
|
|
1369
|
-
const bg = getComputedStyle(el).backgroundColor;
|
|
1370
|
-
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
|
1371
|
-
backgroundColor = bg;
|
|
1372
|
-
break;
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
const pixelRatio = 2;
|
|
1376
|
-
const dataUrl = instance.getDataURL({ type: "png", pixelRatio, backgroundColor });
|
|
1377
|
-
if (!includeTitle || !exportHeader || !(exportHeader.title || exportHeader.summary) || !containerRef.current) return dataUrl;
|
|
1378
|
-
try {
|
|
1379
|
-
const style = getComputedStyle(containerRef.current);
|
|
1380
|
-
return await pngWithHeader(
|
|
1381
|
-
dataUrl,
|
|
1382
|
-
exportHeader,
|
|
1383
|
-
{ background: backgroundColor, color: style.color, mutedColor: tokens?.mutedForeground ?? style.color, fontFamily: style.fontFamily },
|
|
1384
|
-
pixelRatio
|
|
1385
|
-
);
|
|
1386
|
-
} catch {
|
|
1387
|
-
return dataUrl;
|
|
1388
|
-
}
|
|
1389
|
-
}, [instance, includeTitle, exportHeader, tokens]);
|
|
1390
|
-
const handleCopy = useCallback(async () => {
|
|
1391
|
-
const dataUrl = await getPngDataUrl();
|
|
1392
|
-
if (!dataUrl) return;
|
|
1393
|
-
try {
|
|
1394
|
-
const blob = await (await fetch(dataUrl)).blob();
|
|
1395
|
-
await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);
|
|
1396
|
-
setCopied(true);
|
|
1397
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
1398
|
-
} catch {
|
|
1399
|
-
}
|
|
1400
|
-
}, [getPngDataUrl]);
|
|
1401
|
-
const handleDownload = useCallback(async () => {
|
|
1402
|
-
const dataUrl = await getPngDataUrl();
|
|
1403
|
-
if (!dataUrl) return;
|
|
1404
|
-
const link = document.createElement("a");
|
|
1405
|
-
link.href = dataUrl;
|
|
1406
|
-
link.download = fileName;
|
|
1407
|
-
link.click();
|
|
1408
|
-
}, [getPngDataUrl, fileName]);
|
|
1409
|
-
const inFrame = useContext(ChartFrameContext);
|
|
1410
|
-
const styleHeight = height == null ? void 0 : typeof height === "number" ? `${height}px` : height;
|
|
1411
|
-
return /* @__PURE__ */ jsxs(
|
|
1412
|
-
"div",
|
|
1413
|
-
{
|
|
1414
|
-
ref,
|
|
1415
|
-
"data-slot": "echart",
|
|
1416
|
-
className: cn("group relative w-full", height == null && "h-[400px]", className),
|
|
1417
|
-
style: styleHeight != null ? { height: styleHeight } : void 0,
|
|
1418
|
-
children: [
|
|
1419
|
-
/* @__PURE__ */ jsx(
|
|
1420
|
-
"div",
|
|
1421
|
-
{
|
|
1422
|
-
ref: containerRef,
|
|
1423
|
-
"data-slot": "echart-canvas",
|
|
1424
|
-
className: "h-full w-full",
|
|
1425
|
-
role: inFrame ? void 0 : "img",
|
|
1426
|
-
"aria-label": inFrame ? void 0 : ariaLabel ?? "\u30C1\u30E3\u30FC\u30C8"
|
|
1427
|
-
}
|
|
1428
|
-
),
|
|
1429
|
-
actions && /* @__PURE__ */ jsxs(
|
|
1430
|
-
"div",
|
|
1431
|
-
{
|
|
1432
|
-
"data-slot": "echart-actions",
|
|
1433
|
-
className: "absolute top-2 right-2 z-10 flex gap-1 pointer-events-none opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100",
|
|
1434
|
-
children: [
|
|
1435
|
-
/* @__PURE__ */ jsx(
|
|
1436
|
-
Button,
|
|
1437
|
-
{
|
|
1438
|
-
type: "button",
|
|
1439
|
-
variant: "ghost",
|
|
1440
|
-
size: "icon-sm",
|
|
1441
|
-
onClick: handleCopy,
|
|
1442
|
-
"aria-label": copied ? "\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F" : "PNG \u3092\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u306B\u30B3\u30D4\u30FC",
|
|
1443
|
-
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-4" }) : /* @__PURE__ */ jsx(Copy, { className: "size-4" })
|
|
1444
|
-
}
|
|
1445
|
-
),
|
|
1446
|
-
/* @__PURE__ */ jsx(
|
|
1447
|
-
Button,
|
|
1448
|
-
{
|
|
1449
|
-
type: "button",
|
|
1450
|
-
variant: "ghost",
|
|
1451
|
-
size: "icon-sm",
|
|
1452
|
-
onClick: handleDownload,
|
|
1453
|
-
"aria-label": "PNG \u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",
|
|
1454
|
-
children: /* @__PURE__ */ jsx(Download, { className: "size-4" })
|
|
1455
|
-
}
|
|
1456
|
-
)
|
|
1457
|
-
]
|
|
1458
|
-
}
|
|
1459
|
-
)
|
|
1460
|
-
]
|
|
1461
|
-
}
|
|
1462
|
-
);
|
|
1463
|
-
});
|
|
1464
|
-
EChart.displayName = "EChart";
|
|
1465
737
|
|
|
1466
738
|
// ../squadkit/registry/lib/chart-utils.ts
|
|
1467
739
|
var ROOT_PROP_KEYS = /* @__PURE__ */ new Set(["id", "style", "role", "tabIndex", "lang", "hidden"]);
|
|
@@ -3252,8 +2524,7 @@ function AreaChartImpl({
|
|
|
3252
2524
|
className,
|
|
3253
2525
|
...rest
|
|
3254
2526
|
}, ref) {
|
|
3255
|
-
const tokens =
|
|
3256
|
-
const { ref: frameRef, surface, width: plotWidth } = useChartSurface(ref, tokens);
|
|
2527
|
+
const { ref: frameRef, surface, width: plotWidth, tokens } = useChartSurface(ref);
|
|
3257
2528
|
const tooltipFormatter = useMemo(() => resolveValueFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
3258
2529
|
const axisFormatter = useMemo(() => resolveAxisFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
3259
2530
|
const axisTicks = useMemo(() => resolveAxisTickFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
@@ -3435,8 +2706,7 @@ function BarChartImpl({
|
|
|
3435
2706
|
className,
|
|
3436
2707
|
...rest
|
|
3437
2708
|
}, ref) {
|
|
3438
|
-
const tokens =
|
|
3439
|
-
const { ref: frameRef, surface, width: plotWidth } = useChartSurface(ref, tokens);
|
|
2709
|
+
const { ref: frameRef, surface, width: plotWidth, tokens } = useChartSurface(ref);
|
|
3440
2710
|
const tooltipFormatter = useMemo(() => resolveValueFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
3441
2711
|
const axisFormatter = useMemo(() => resolveAxisFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
3442
2712
|
const axisTicks = useMemo(() => resolveAxisTickFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
@@ -3571,8 +2841,8 @@ function BarChartImpl({
|
|
|
3571
2841
|
}
|
|
3572
2842
|
);
|
|
3573
2843
|
}
|
|
3574
|
-
var
|
|
3575
|
-
|
|
2844
|
+
var BarChart = forwardRef(BarChartImpl);
|
|
2845
|
+
BarChart.displayName = "BarChart";
|
|
3576
2846
|
var NO_ROWS3 = [];
|
|
3577
2847
|
function LineChartImpl({
|
|
3578
2848
|
data = NO_ROWS3,
|
|
@@ -3620,8 +2890,7 @@ function LineChartImpl({
|
|
|
3620
2890
|
className,
|
|
3621
2891
|
...rest
|
|
3622
2892
|
}, ref) {
|
|
3623
|
-
const tokens =
|
|
3624
|
-
const { ref: frameRef, surface, width: plotWidth } = useChartSurface(ref, tokens);
|
|
2893
|
+
const { ref: frameRef, surface, width: plotWidth, tokens } = useChartSurface(ref);
|
|
3625
2894
|
const tooltipFormatter = useMemo(() => resolveValueFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
3626
2895
|
const axisFormatter = useMemo(() => resolveAxisFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
3627
2896
|
const axisTicks = useMemo(() => resolveAxisTickFormatter(valueFormatter, format2), [valueFormatter, format2]);
|
|
@@ -3758,8 +3027,8 @@ function LineChartImpl({
|
|
|
3758
3027
|
}
|
|
3759
3028
|
);
|
|
3760
3029
|
}
|
|
3761
|
-
var
|
|
3762
|
-
|
|
3030
|
+
var LineChart = forwardRef(LineChartImpl);
|
|
3031
|
+
LineChart.displayName = "LineChart";
|
|
3763
3032
|
function useElementWidth() {
|
|
3764
3033
|
const [node, setNode] = useState(null);
|
|
3765
3034
|
const [width, setWidth] = useState(null);
|
|
@@ -3809,7 +3078,7 @@ function DonutChartImpl({
|
|
|
3809
3078
|
const maxSlices = donutOptions?.maxSlices;
|
|
3810
3079
|
const showLegend = donutOptions?.showLegend ?? true;
|
|
3811
3080
|
const valueFormatter = useMemo(() => resolveValueFormatter(valueFormatterProp, format2), [valueFormatterProp, format2]);
|
|
3812
|
-
const tokens =
|
|
3081
|
+
const { ref: frameRef, tokens } = useChartSurface(ref);
|
|
3813
3082
|
const slices = useMemo(
|
|
3814
3083
|
() => donutSlices(data, { index: labelKey, value: valueKey, colors, maxSlices, otherColor: CHART_OTHER_COLOR }),
|
|
3815
3084
|
[data, labelKey, valueKey, colors, maxSlices]
|
|
@@ -3875,7 +3144,7 @@ function DonutChartImpl({
|
|
|
3875
3144
|
ChartFrame,
|
|
3876
3145
|
{
|
|
3877
3146
|
...chartRootProps(rest),
|
|
3878
|
-
ref,
|
|
3147
|
+
ref: frameRef,
|
|
3879
3148
|
title,
|
|
3880
3149
|
summary: resolvedSummary,
|
|
3881
3150
|
isLoading: isLoading ?? loading ?? false,
|
|
@@ -4191,8 +3460,14 @@ function blockColorToCss(color) {
|
|
|
4191
3460
|
}
|
|
4192
3461
|
var NO_ROWS7 = [];
|
|
4193
3462
|
var Tracker = forwardRef(function Tracker2({ data = NO_ROWS7, defaultColor, hoverEffect = true, className, ...props }, ref) {
|
|
3463
|
+
const containerRef = useRef(null);
|
|
3464
|
+
const setRef = useCallback((node) => {
|
|
3465
|
+
containerRef.current = node;
|
|
3466
|
+
if (typeof ref === "function") return ref(node);
|
|
3467
|
+
if (ref) ref.current = node;
|
|
3468
|
+
}, [ref]);
|
|
4194
3469
|
const fallback = defaultColor ? blockColorToCss(defaultColor) : DEFAULT_BLOCK_COLOR;
|
|
4195
|
-
return /* @__PURE__ */ jsx("div", { ref, "data-slot": "tracker", className: cn("flex h-6 w-full gap-0.5", className), ...props, children: data.map((block, i) => {
|
|
3470
|
+
return /* @__PURE__ */ jsx("div", { ref: setRef, "data-slot": "tracker", className: cn("flex h-6 w-full gap-0.5", className), ...props, children: data.map((block, i) => {
|
|
4196
3471
|
const blockClass = cn(
|
|
4197
3472
|
"h-full min-w-0 flex-1 rounded-[2px]",
|
|
4198
3473
|
hoverEffect && "transition-opacity hover:opacity-60 motion-reduce:transition-none"
|
|
@@ -4206,7 +3481,7 @@ var Tracker = forwardRef(function Tracker2({ data = NO_ROWS7, defaultColor, hove
|
|
|
4206
3481
|
render: /* @__PURE__ */ jsx("div", { "data-slot": "tracker-block", role: "img", tabIndex: 0, "aria-label": block.tooltip, className: blockClass, style })
|
|
4207
3482
|
}
|
|
4208
3483
|
),
|
|
4209
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: block.tooltip })
|
|
3484
|
+
/* @__PURE__ */ jsx(TooltipContent, { container: containerRef, children: block.tooltip })
|
|
4210
3485
|
] }, block.key ?? i) : /* @__PURE__ */ jsx("div", { "data-slot": "tracker-block", className: blockClass, style }, block.key ?? i);
|
|
4211
3486
|
}) });
|
|
4212
3487
|
});
|
|
@@ -4583,8 +3858,7 @@ function WaterfallChartImpl({
|
|
|
4583
3858
|
...rest
|
|
4584
3859
|
}, ref) {
|
|
4585
3860
|
const valueKey = categories[0] ?? "";
|
|
4586
|
-
const tokens =
|
|
4587
|
-
const { ref: frameRef, width: plotWidth } = useChartSurface(ref, tokens);
|
|
3861
|
+
const { ref: frameRef, width: plotWidth, tokens } = useChartSurface(ref);
|
|
4588
3862
|
const valueFormatter = useMemo(() => resolveValueFormatter(valueFormatterProp, format2), [valueFormatterProp, format2]);
|
|
4589
3863
|
const axisFormatter = useMemo(() => resolveAxisFormatter(valueFormatterProp, format2), [valueFormatterProp, format2]);
|
|
4590
3864
|
const steps = useMemo(() => waterfallSteps(data, { index, value: valueKey, totals, mode }), [data, index, valueKey, totals, mode]);
|
|
@@ -4983,8 +4257,7 @@ function ScatterChartImpl({
|
|
|
4983
4257
|
className,
|
|
4984
4258
|
...rest
|
|
4985
4259
|
}, ref) {
|
|
4986
|
-
const tokens =
|
|
4987
|
-
const { ref: frameRef, width: plotWidth } = useChartSurface(ref, tokens);
|
|
4260
|
+
const { ref: frameRef, width: plotWidth, tokens } = useChartSurface(ref);
|
|
4988
4261
|
const formatters = useMemo(
|
|
4989
4262
|
() => ({
|
|
4990
4263
|
x: resolveValueFormatter(valueFormatter, xFormat ?? format2),
|
|
@@ -5688,8 +4961,7 @@ function HeatmapImpl({
|
|
|
5688
4961
|
ariaLabel,
|
|
5689
4962
|
...rest
|
|
5690
4963
|
}, ref) {
|
|
5691
|
-
const tokens =
|
|
5692
|
-
const { ref: frameRef, surface, width: plotWidth } = useChartSurface(ref, tokens);
|
|
4964
|
+
const { ref: frameRef, surface, width: plotWidth, tokens } = useChartSurface(ref);
|
|
5693
4965
|
const formatter = useMemo(() => resolveValueFormatter(valueFormatter, format2 ?? "number"), [valueFormatter, format2]);
|
|
5694
4966
|
const model = useMemo(
|
|
5695
4967
|
() => buildHeatmapModel({ data, x, y, value, xLabels, yLabels, flag, scale, minValue, maxValue }),
|
|
@@ -5758,149 +5030,6 @@ function HeatmapLegend({
|
|
|
5758
5030
|
}
|
|
5759
5031
|
var Heatmap = forwardRef(HeatmapImpl);
|
|
5760
5032
|
Heatmap.displayName = "Heatmap";
|
|
5761
|
-
var VB_WIDTH = 100;
|
|
5762
|
-
function normalizeData(values, height, vPad = 2) {
|
|
5763
|
-
const min = Math.min(...values);
|
|
5764
|
-
const max = Math.max(...values);
|
|
5765
|
-
const range = max - min;
|
|
5766
|
-
const drawHeight = height - vPad * 2;
|
|
5767
|
-
if (range === 0) return values.map(() => vPad + drawHeight / 2);
|
|
5768
|
-
return values.map((v) => height - vPad - (v - min) / range * drawHeight);
|
|
5769
|
-
}
|
|
5770
|
-
function buildLinePath(ys) {
|
|
5771
|
-
if (ys.length === 0) return "";
|
|
5772
|
-
const step = ys.length > 1 ? VB_WIDTH / (ys.length - 1) : 0;
|
|
5773
|
-
return ys.map((y, i) => `${i === 0 ? "M" : "L"}${(i * step).toFixed(2)},${y.toFixed(2)}`).join(" ");
|
|
5774
|
-
}
|
|
5775
|
-
function buildAreaPath(ys, height) {
|
|
5776
|
-
if (ys.length === 0) return "";
|
|
5777
|
-
const step = ys.length > 1 ? VB_WIDTH / (ys.length - 1) : 0;
|
|
5778
|
-
const lastX = ((ys.length - 1) * step).toFixed(2);
|
|
5779
|
-
return `${buildLinePath(ys)} L${lastX},${height} L0,${height} Z`;
|
|
5780
|
-
}
|
|
5781
|
-
function sparklineHighlightPoints(values) {
|
|
5782
|
-
if (values.length === 0) return [];
|
|
5783
|
-
const last = values.length - 1;
|
|
5784
|
-
const points = [{ kind: "latest", index: last }];
|
|
5785
|
-
let maxI = 0;
|
|
5786
|
-
let minI = 0;
|
|
5787
|
-
let max = values[0];
|
|
5788
|
-
let min = max;
|
|
5789
|
-
values.forEach((v, i) => {
|
|
5790
|
-
if (v >= max) [max, maxI] = [v, i];
|
|
5791
|
-
if (v <= min) [min, minI] = [v, i];
|
|
5792
|
-
});
|
|
5793
|
-
const latest = values[last];
|
|
5794
|
-
if (max === min) return points;
|
|
5795
|
-
if (max !== latest) points.push({ kind: "max", index: maxI });
|
|
5796
|
-
if (min !== latest) points.push({ kind: "min", index: minI });
|
|
5797
|
-
return points;
|
|
5798
|
-
}
|
|
5799
|
-
function buildBarRects(ys, height, gap = 1) {
|
|
5800
|
-
const barW = Math.max(1, VB_WIDTH / ys.length - gap);
|
|
5801
|
-
return ys.map((y, i) => ({ x: i * (barW + gap), y, w: barW, h: height - y }));
|
|
5802
|
-
}
|
|
5803
|
-
var NO_ROWS12 = [];
|
|
5804
|
-
var Sparkline = forwardRef(function Sparkline2({
|
|
5805
|
-
data = NO_ROWS12,
|
|
5806
|
-
variant = "line",
|
|
5807
|
-
height = 40,
|
|
5808
|
-
color = "text-chart-1",
|
|
5809
|
-
area = false,
|
|
5810
|
-
animate = false,
|
|
5811
|
-
highlight = "auto",
|
|
5812
|
-
"aria-label": ariaLabel,
|
|
5813
|
-
className,
|
|
5814
|
-
...props
|
|
5815
|
-
}, ref) {
|
|
5816
|
-
const [mounted, setMounted] = useState(false);
|
|
5817
|
-
useEffect(() => {
|
|
5818
|
-
if (animate) setMounted(true);
|
|
5819
|
-
}, [animate]);
|
|
5820
|
-
if (data.length === 0) return null;
|
|
5821
|
-
const values = data.map((d) => d.value);
|
|
5822
|
-
const ys = normalizeData(values, height);
|
|
5823
|
-
const step = ys.length > 1 ? VB_WIDTH / (ys.length - 1) : 0;
|
|
5824
|
-
const points = variant !== "line" ? [] : highlight === "auto" ? sparklineHighlightPoints(values) : highlight === "latest" ? [{ kind: "latest", index: values.length - 1 }] : [];
|
|
5825
|
-
return /* @__PURE__ */ jsxs(
|
|
5826
|
-
"svg",
|
|
5827
|
-
{
|
|
5828
|
-
ref,
|
|
5829
|
-
"data-slot": "sparkline",
|
|
5830
|
-
viewBox: `0 0 ${VB_WIDTH} ${height}`,
|
|
5831
|
-
preserveAspectRatio: "none",
|
|
5832
|
-
width: "100%",
|
|
5833
|
-
height,
|
|
5834
|
-
role: ariaLabel ? "img" : void 0,
|
|
5835
|
-
"aria-label": ariaLabel,
|
|
5836
|
-
"aria-hidden": ariaLabel ? void 0 : true,
|
|
5837
|
-
className: cn("overflow-visible", className),
|
|
5838
|
-
...props,
|
|
5839
|
-
children: [
|
|
5840
|
-
variant === "line" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5841
|
-
area && /* @__PURE__ */ jsx(
|
|
5842
|
-
"path",
|
|
5843
|
-
{
|
|
5844
|
-
d: buildAreaPath(ys, height),
|
|
5845
|
-
strokeWidth: 0,
|
|
5846
|
-
className: cn("fill-current opacity-15", color)
|
|
5847
|
-
}
|
|
5848
|
-
),
|
|
5849
|
-
/* @__PURE__ */ jsx(
|
|
5850
|
-
"path",
|
|
5851
|
-
{
|
|
5852
|
-
d: buildLinePath(ys),
|
|
5853
|
-
fill: "none",
|
|
5854
|
-
strokeWidth: 1.5,
|
|
5855
|
-
strokeLinecap: "round",
|
|
5856
|
-
strokeLinejoin: "round",
|
|
5857
|
-
vectorEffect: "non-scaling-stroke",
|
|
5858
|
-
pathLength: animate ? 1 : void 0,
|
|
5859
|
-
strokeDasharray: animate ? 1 : void 0,
|
|
5860
|
-
strokeDashoffset: animate ? mounted ? 0 : 1 : void 0,
|
|
5861
|
-
className: cn("stroke-current", animate && "motion-reduce:transition-none!", color),
|
|
5862
|
-
style: animate ? { transition: "stroke-dashoffset 0.6s ease-in-out" } : void 0
|
|
5863
|
-
}
|
|
5864
|
-
),
|
|
5865
|
-
points.map((p) => {
|
|
5866
|
-
const x = (p.index * step).toFixed(2);
|
|
5867
|
-
const y = (ys[p.index] ?? 0).toFixed(2);
|
|
5868
|
-
return /* @__PURE__ */ jsx(
|
|
5869
|
-
"path",
|
|
5870
|
-
{
|
|
5871
|
-
"data-slot": "sparkline-point",
|
|
5872
|
-
"data-point": p.kind,
|
|
5873
|
-
d: `M${x},${y} L${x},${y}`,
|
|
5874
|
-
fill: "none",
|
|
5875
|
-
strokeWidth: p.kind === "latest" ? 5 : 4,
|
|
5876
|
-
strokeLinecap: "round",
|
|
5877
|
-
vectorEffect: "non-scaling-stroke",
|
|
5878
|
-
className: cn("stroke-current", p.kind === "latest" ? color : "text-muted-foreground")
|
|
5879
|
-
},
|
|
5880
|
-
p.kind
|
|
5881
|
-
);
|
|
5882
|
-
})
|
|
5883
|
-
] }),
|
|
5884
|
-
variant === "bar" && buildBarRects(ys, height).map((rect, i) => /* @__PURE__ */ jsx(
|
|
5885
|
-
"rect",
|
|
5886
|
-
{
|
|
5887
|
-
x: rect.x,
|
|
5888
|
-
y: animate ? mounted ? rect.y : height : rect.y,
|
|
5889
|
-
width: rect.w,
|
|
5890
|
-
height: animate ? mounted ? rect.h : 0 : rect.h,
|
|
5891
|
-
rx: 0.5,
|
|
5892
|
-
className: cn("fill-current", animate && "motion-reduce:transition-none!", color),
|
|
5893
|
-
style: animate ? {
|
|
5894
|
-
transition: `height 0.4s ease-out ${i * 0.02}s, y 0.4s ease-out ${i * 0.02}s`
|
|
5895
|
-
} : void 0
|
|
5896
|
-
},
|
|
5897
|
-
i
|
|
5898
|
-
))
|
|
5899
|
-
]
|
|
5900
|
-
}
|
|
5901
|
-
);
|
|
5902
|
-
});
|
|
5903
|
-
Sparkline.displayName = "Sparkline";
|
|
5904
5033
|
function resolveFormat(format2, row) {
|
|
5905
5034
|
return typeof format2 === "function" ? format2(row) : format2;
|
|
5906
5035
|
}
|
|
@@ -5965,10 +5094,10 @@ function useDataTable() {
|
|
|
5965
5094
|
if (!ctx) throw new Error("useDataTable must be used inside <DataTable>");
|
|
5966
5095
|
return ctx;
|
|
5967
5096
|
}
|
|
5968
|
-
var
|
|
5097
|
+
var NO_ROWS12 = [];
|
|
5969
5098
|
function DataTable({
|
|
5970
|
-
columns =
|
|
5971
|
-
data =
|
|
5099
|
+
columns = NO_ROWS12,
|
|
5100
|
+
data = NO_ROWS12,
|
|
5972
5101
|
enableSorting = true,
|
|
5973
5102
|
sorting: sortingProp,
|
|
5974
5103
|
onSortingChange,
|
|
@@ -7404,7 +6533,7 @@ var deltaVariants = cva(
|
|
|
7404
6533
|
{
|
|
7405
6534
|
variants: {
|
|
7406
6535
|
variant: {
|
|
7407
|
-
badge: "h-5 rounded-
|
|
6536
|
+
badge: "h-5 rounded-md border px-2 py-0.5 text-xs font-medium [&>svg]:size-3",
|
|
7408
6537
|
inline: "text-sm [&>svg]:size-3.5"
|
|
7409
6538
|
},
|
|
7410
6539
|
sentiment: {
|
|
@@ -7414,9 +6543,9 @@ var deltaVariants = cva(
|
|
|
7414
6543
|
}
|
|
7415
6544
|
},
|
|
7416
6545
|
compoundVariants: [
|
|
7417
|
-
{ variant: "badge", sentiment: "positive", className: "bg-positive-subtle" },
|
|
7418
|
-
{ variant: "badge", sentiment: "negative", className: "bg-negative-subtle" },
|
|
7419
|
-
{ variant: "badge", sentiment: "neutral", className: "bg-neutral-subtle" }
|
|
6546
|
+
{ variant: "badge", sentiment: "positive", className: "border-positive/20 bg-positive-subtle dark:border-positive/25" },
|
|
6547
|
+
{ variant: "badge", sentiment: "negative", className: "border-negative/20 bg-negative-subtle dark:border-negative/25" },
|
|
6548
|
+
{ variant: "badge", sentiment: "neutral", className: "border-neutral/20 bg-neutral-subtle dark:border-neutral/25" }
|
|
7420
6549
|
],
|
|
7421
6550
|
defaultVariants: {
|
|
7422
6551
|
variant: "badge",
|
|
@@ -7809,8 +6938,8 @@ function updatedAtText(updatedAt, display, locale, now, timeZone) {
|
|
|
7809
6938
|
var trendIndicatorVariants = cva("inline-flex items-center gap-0.5 text-sm font-medium", {
|
|
7810
6939
|
variants: {
|
|
7811
6940
|
sentiment: {
|
|
7812
|
-
positive: "text-
|
|
7813
|
-
negative: "text-
|
|
6941
|
+
positive: "text-positive",
|
|
6942
|
+
negative: "text-negative",
|
|
7814
6943
|
neutral: "text-muted-foreground"
|
|
7815
6944
|
}
|
|
7816
6945
|
},
|
|
@@ -7870,11 +6999,11 @@ var legacyColorTones = {
|
|
|
7870
6999
|
blue: "info"
|
|
7871
7000
|
};
|
|
7872
7001
|
var toneStyles = {
|
|
7873
|
-
positive: { dot: "bg-positive", bg: "bg-positive-subtle", text: "text-positive" },
|
|
7874
|
-
negative: { dot: "bg-negative", bg: "bg-negative-subtle", text: "text-negative" },
|
|
7875
|
-
warning: { dot: "bg-warning", bg: "bg-warning-subtle", text: "text-warning" },
|
|
7876
|
-
info: { dot: "bg-info", bg: "bg-info-subtle", text: "text-info" },
|
|
7877
|
-
neutral: { dot: "bg-neutral", bg: "bg-neutral-subtle", text: "text-neutral" }
|
|
7002
|
+
positive: { dot: "bg-positive", bg: "bg-positive-subtle", text: "text-positive", border: "border-positive/20 dark:border-positive/25" },
|
|
7003
|
+
negative: { dot: "bg-negative", bg: "bg-negative-subtle", text: "text-negative", border: "border-negative/20 dark:border-negative/25" },
|
|
7004
|
+
warning: { dot: "bg-warning", bg: "bg-warning-subtle", text: "text-warning", border: "border-warning/20 dark:border-warning/25" },
|
|
7005
|
+
info: { dot: "bg-info", bg: "bg-info-subtle", text: "text-info", border: "border-info/20 dark:border-info/25" },
|
|
7006
|
+
neutral: { dot: "bg-neutral", bg: "bg-neutral-subtle", text: "text-neutral", border: "border-neutral/20 dark:border-neutral/25" }
|
|
7878
7007
|
};
|
|
7879
7008
|
var resolveTone = (color) => {
|
|
7880
7009
|
if (color === void 0) return "neutral";
|
|
@@ -7891,10 +7020,10 @@ var StatusBadge = forwardRef(function StatusBadge2({ status, label: label2, colo
|
|
|
7891
7020
|
ref,
|
|
7892
7021
|
"data-slot": "status-badge",
|
|
7893
7022
|
variant: "outline",
|
|
7894
|
-
className: cn("gap-1.5
|
|
7023
|
+
className: cn("gap-1.5 rounded-md", style.border, style.bg, style.text, className),
|
|
7895
7024
|
"aria-label": displayLabel,
|
|
7896
7025
|
children: [
|
|
7897
|
-
/* @__PURE__ */ jsx("span", { className: cn("inline-block size-
|
|
7026
|
+
/* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", style.dot), "aria-hidden": "true" }),
|
|
7898
7027
|
displayLabel
|
|
7899
7028
|
]
|
|
7900
7029
|
}
|
|
@@ -7914,6 +7043,6 @@ var Placeholder = forwardRef(function Placeholder2({ className, ...props }, ref)
|
|
|
7914
7043
|
});
|
|
7915
7044
|
Placeholder.displayName = "Placeholder";
|
|
7916
7045
|
|
|
7917
|
-
export { AppShell, AreaChart,
|
|
7918
|
-
//# sourceMappingURL=chunk-
|
|
7919
|
-
//# sourceMappingURL=chunk-
|
|
7046
|
+
export { AppShell, AreaChart, BarChart, BarList, COMPARISON_LABELS, CategoryBar, ChartFrame, DEFAULT_SAMPLE_LABEL, DELTA_NOT_COMPARABLE, DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardDescription, DashboardCardFooter, DashboardCardHeader, DashboardCardPreset, DashboardCardSkeleton, DashboardCardTitle, DataTable, DataTableColumnVisibility, DataTableContent, DataTableExport, DataTablePagination, DataTablePreset, DataTableToolbar, DateRangePicker, Delta, DonutChart, FilterBar, FilterBarActiveChips, FilterBarClearButton, FilterBarMultiSelect, FilterBarPreset, FilterBarSelect, FunnelSteps, Heatmap, KpiCard, Legend, LineChart, MetricUnit, MetricValue, MultiSelect, PageShell, PageShellActions, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellMeta, PageShellSummary, PageShellSummaryCard, PageShellTitle, Placeholder, ProgressCircle, RECORD_MIN_POINTS, SampleBadge, SampleClaim, SampleData, ScatterChart, SearchableSelect, SectionHeader, SegmentedControl, StatusBadge, Tracker, TrendIndicator, UpdatedAt, WaterfallChart, comparisonBaseline, comparisonLabel, computeComparison, computeTargetProgress, defaultChangeDisplay, defaultPresets, deltaVariants, detectRecord, fillKpiTemplate, flattenOptions, formatChange, formatChangeAmount, formatRelativeTime, funnelStepsVariants, inferPeriodGrain, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, tableToCsv, toCsv, toneForValue, useDataTable, useSampleMark };
|
|
7047
|
+
//# sourceMappingURL=chunk-RU6WKEOG.js.map
|
|
7048
|
+
//# sourceMappingURL=chunk-RU6WKEOG.js.map
|