@tensor_1/react 2.55.2 → 2.56.0
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/README.md +42 -0
- package/component-inventory.json +44 -0
- package/dist/{ChartCore-BKK2HEfi.d.cts → ChartCore-CY5a4teJ.d.cts} +18 -2
- package/dist/GlanceCharts-Cb39RqDC.d.cts +88 -0
- package/dist/chart-analytic-guide.d.ts +1 -0
- package/dist/chart-analytic-guide.js +6 -1
- package/dist/chart-analytic.cjs +11 -1
- package/dist/chart-analytic.d.cts +2 -2
- package/dist/chart-glance.d.ts +65 -0
- package/dist/chart-glance.js +162 -0
- package/dist/chart-preset.cjs +337 -5
- package/dist/chart-preset.d.cts +9 -3
- package/dist/chart-preset.d.ts +8 -1
- package/dist/chart-preset.js +16 -1
- package/dist/chart-theme.d.ts +18 -2
- package/dist/chart-theme.js +6 -1
- package/dist/chart.cjs +337 -5
- package/dist/chart.d.cts +9 -3
- package/dist/chart.d.ts +3 -1
- package/dist/chart.js +9 -2
- package/dist/components/Arrive.d.ts +49 -0
- package/dist/components/Arrive.js +93 -0
- package/dist/components/Chart.d.ts +8 -1
- package/dist/components/Chart.js +16 -1
- package/dist/components/ChartCard.d.ts +34 -0
- package/dist/components/ChartCard.js +36 -0
- package/dist/components/ChartPanels.js +5 -0
- package/dist/components/Count.d.ts +10 -4
- package/dist/components/Count.js +35 -3
- package/dist/components/GlanceCharts.d.ts +37 -0
- package/dist/components/GlanceCharts.js +128 -0
- package/dist/components/GlanceMarks.d.ts +63 -0
- package/dist/components/GlanceMarks.js +59 -0
- package/dist/components/Meter.d.ts +12 -2
- package/dist/components/Meter.js +23 -13
- package/dist/components/StatusDot.d.ts +27 -0
- package/dist/components/StatusDot.js +16 -0
- package/dist/icons/Icon.d.ts +5 -5
- package/dist/index.cjs +2165 -1925
- package/dist/index.d.cts +173 -7
- package/dist/index.d.ts +4 -0
- package/dist/index.js +12 -0
- package/package.json +1 -1
package/dist/chart-preset.cjs
CHANGED
|
@@ -36,11 +36,18 @@ __export(chart_preset_exports, {
|
|
|
36
36
|
ChartLegendItem: () => ChartLegendItem,
|
|
37
37
|
ChartMetric: () => ChartMetric,
|
|
38
38
|
DEFAULT_CHART_LABELS: () => DEFAULT_CHART_LABELS,
|
|
39
|
+
GLANCE_AT_REST: () => GLANCE_AT_REST,
|
|
40
|
+
GlanceLineChart: () => GlanceLineChart,
|
|
41
|
+
PAIRED_BARS_MAX_BUCKETS: () => PAIRED_BARS_MAX_BUCKETS,
|
|
42
|
+
PairedBarChart: () => PairedBarChart,
|
|
43
|
+
glanceLineOption: () => glanceLineOption,
|
|
39
44
|
mergeChartTheme: () => mergeChartTheme,
|
|
45
|
+
pairedBarsOption: () => pairedBarsOption,
|
|
40
46
|
uixChartAreaGradient: () => uixChartAreaGradient,
|
|
41
47
|
uixChartPalette: () => uixChartPalette,
|
|
42
48
|
uixChartTheme: () => uixChartTheme,
|
|
43
|
-
uixChartTokens: () => uixChartTokens
|
|
49
|
+
uixChartTokens: () => uixChartTokens,
|
|
50
|
+
uixGlanceBase: () => uixGlanceBase
|
|
44
51
|
});
|
|
45
52
|
module.exports = __toCommonJS(chart_preset_exports);
|
|
46
53
|
var echarts = __toESM(require("echarts/core"), 1);
|
|
@@ -69,6 +76,9 @@ function uixChartTokens(source) {
|
|
|
69
76
|
const unquote = (font) => font.replace(/"/g, "");
|
|
70
77
|
return {
|
|
71
78
|
palette: [1, 2, 3, 4, 5, 6, 7, 8].map((i) => t(`chart-${i}`)),
|
|
79
|
+
series: t("chart-series"),
|
|
80
|
+
seriesSoft: t("chart-series-soft"),
|
|
81
|
+
categories: [1, 2, 3].map((i) => t(`chart-${i}`)),
|
|
72
82
|
neutral: t("chart-neutral"),
|
|
73
83
|
grid: t("chart-grid"),
|
|
74
84
|
axis: t("chart-axis"),
|
|
@@ -86,7 +96,9 @@ function uixChartTokens(source) {
|
|
|
86
96
|
textMuted: t("text-muted"),
|
|
87
97
|
border: t("border-strong"),
|
|
88
98
|
fontSans: unquote(t("font-sans")),
|
|
89
|
-
fontMono: unquote(t("font-mono"))
|
|
99
|
+
fontMono: unquote(t("font-mono")),
|
|
100
|
+
radius: t("radius-md"),
|
|
101
|
+
shadow: t("shadow-popover")
|
|
90
102
|
};
|
|
91
103
|
}
|
|
92
104
|
function uixChartTheme(source) {
|
|
@@ -356,8 +368,315 @@ function ChartLegendItem({ label, color, swatch = "block", className, style, ...
|
|
|
356
368
|
] });
|
|
357
369
|
}
|
|
358
370
|
|
|
359
|
-
// src/
|
|
371
|
+
// src/components/GlanceCharts.tsx
|
|
372
|
+
var import_react4 = require("react");
|
|
373
|
+
|
|
374
|
+
// src/components/Arrive.tsx
|
|
375
|
+
var import_react3 = require("react");
|
|
376
|
+
|
|
377
|
+
// src/motion.ts
|
|
378
|
+
function tokenMs(name, fallback, el) {
|
|
379
|
+
if (typeof getComputedStyle === "undefined" || typeof document === "undefined") return fallback;
|
|
380
|
+
const raw = getComputedStyle(el ?? document.documentElement).getPropertyValue(name).trim();
|
|
381
|
+
const m = /^(-?\d*\.?\d+)(ms|s)$/.exec(raw);
|
|
382
|
+
if (!m) return fallback;
|
|
383
|
+
return m[2] === "s" ? Number(m[1]) * 1e3 : Number(m[1]);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// src/components/Arrive.tsx
|
|
360
387
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
388
|
+
var REGISTRY = /* @__PURE__ */ Symbol.for("@tensor_1/react/arrive-contexts");
|
|
389
|
+
var registry = globalThis;
|
|
390
|
+
var contexts = registry[REGISTRY] ?? (registry[REGISTRY] = {
|
|
391
|
+
stage: (0, import_react3.createContext)({ playing: false }),
|
|
392
|
+
index: (0, import_react3.createContext)(0)
|
|
393
|
+
});
|
|
394
|
+
var ArriveContext = contexts.stage;
|
|
395
|
+
function useArrive() {
|
|
396
|
+
return (0, import_react3.useContext)(ArriveContext);
|
|
397
|
+
}
|
|
398
|
+
var ArriveIndexContext = contexts.index;
|
|
399
|
+
function useArriveIndex() {
|
|
400
|
+
return (0, import_react3.useContext)(ArriveIndexContext);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// src/chart-glance.ts
|
|
404
|
+
var GLANCE_AT_REST = { play: false, delay: 0, trace: 0, grow: 0, stagger: 0 };
|
|
405
|
+
var escapeHtml = (value) => String(value).replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
406
|
+
var plain = (value) => value.toLocaleString();
|
|
407
|
+
function tooltipHtml(title, rows) {
|
|
408
|
+
return `<div class="uix-glance-tooltip"><div class="uix-glance-tooltip__title">${escapeHtml(title)}</div>${rows.map((row) => `<div class="uix-glance-tooltip__row"><span class="uix-glance-tooltip__swatch" style="--swatch:${escapeHtml(row.color)}"></span>${escapeHtml(row.name)}<span class="uix-glance-tooltip__value">${escapeHtml(row.value)}</span></div>`).join("")}</div>`;
|
|
409
|
+
}
|
|
410
|
+
var seriesColor = (k) => k.series ?? k.palette[0] ?? "";
|
|
411
|
+
function uixGlanceBase(k, motion = GLANCE_AT_REST) {
|
|
412
|
+
return {
|
|
413
|
+
backgroundColor: "transparent",
|
|
414
|
+
animation: motion.play,
|
|
415
|
+
animationDurationUpdate: 0,
|
|
416
|
+
textStyle: { color: k.textMuted, fontFamily: k.fontSans, fontSize: 11 },
|
|
417
|
+
grid: { top: 10, right: 12, bottom: 4, left: 4, containLabel: true },
|
|
418
|
+
tooltip: {
|
|
419
|
+
trigger: "axis",
|
|
420
|
+
confine: true,
|
|
421
|
+
backgroundColor: k.text,
|
|
422
|
+
borderWidth: 0,
|
|
423
|
+
padding: [6, 10],
|
|
424
|
+
textStyle: { color: k.surface, fontFamily: k.fontSans, fontSize: 12 },
|
|
425
|
+
extraCssText: [k.radius ? `border-radius:${k.radius}` : "", k.shadow ? `box-shadow:${k.shadow}` : ""].filter(Boolean).join(";"),
|
|
426
|
+
transitionDuration: 0
|
|
427
|
+
},
|
|
428
|
+
xAxis: {
|
|
429
|
+
type: "category",
|
|
430
|
+
axisLine: { lineStyle: { color: k.axis } },
|
|
431
|
+
axisTick: { show: false },
|
|
432
|
+
axisLabel: { color: k.textMuted, fontFamily: k.fontSans, fontSize: 11, hideOverlap: true },
|
|
433
|
+
splitLine: { show: false }
|
|
434
|
+
},
|
|
435
|
+
yAxis: {
|
|
436
|
+
type: "value",
|
|
437
|
+
splitNumber: 3,
|
|
438
|
+
minInterval: 1,
|
|
439
|
+
axisLine: { show: false },
|
|
440
|
+
axisTick: { show: false },
|
|
441
|
+
axisLabel: { color: k.textMuted, fontFamily: k.fontSans, fontSize: 11 },
|
|
442
|
+
splitLine: { lineStyle: { color: k.axis, type: [3, 4], width: 1 } }
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
function glanceLineOption(k, input, motion = GLANCE_AT_REST) {
|
|
447
|
+
const format = input.format ?? plain;
|
|
448
|
+
const last = input.values.length - 1;
|
|
449
|
+
const forecast = input.forecast;
|
|
450
|
+
const categories = [...input.categories, ...forecast?.categories ?? []];
|
|
451
|
+
const labelled = (value, text, color2, dot) => ({
|
|
452
|
+
value,
|
|
453
|
+
symbolSize: dot ? 8 : 0,
|
|
454
|
+
label: { show: true, position: "right", distance: 6, color: color2, fontFamily: k.fontSans, fontSize: 11, fontWeight: 600, formatter: () => text }
|
|
455
|
+
});
|
|
456
|
+
const showEnd = input.endLabel !== false && !forecast && last >= 0;
|
|
457
|
+
const measured = forecast ? [
|
|
458
|
+
...input.values.map((v, i) => i === last ? { value: v, symbolSize: 8 } : v),
|
|
459
|
+
...forecast.values.map(() => null)
|
|
460
|
+
] : [
|
|
461
|
+
...input.values.map((v, i) => showEnd && i === last ? labelled(v, format(v), k.text, true) : v)
|
|
462
|
+
];
|
|
463
|
+
const projected = forecast ? [...input.values.map((v, i) => i === last ? v : null), ...forecast.values.map((v, i) => i === forecast.values.length - 1 ? labelled(v, forecast.label ?? format(v), k.textMuted, false) : v)] : [];
|
|
464
|
+
const color = seriesColor(k);
|
|
465
|
+
const base = uixGlanceBase(k, motion);
|
|
466
|
+
const title = input.tooltipTitle ?? ((c) => c);
|
|
467
|
+
const endText = forecast ? forecast.label ?? format(forecast.values[forecast.values.length - 1] ?? 0) : showEnd ? format(input.values[last]) : "";
|
|
468
|
+
const series = [{
|
|
469
|
+
name: input.name,
|
|
470
|
+
type: "line",
|
|
471
|
+
data: measured,
|
|
472
|
+
color,
|
|
473
|
+
// symbols at size 0 so the last point can carry its dot and its label
|
|
474
|
+
showSymbol: true,
|
|
475
|
+
symbol: "circle",
|
|
476
|
+
symbolSize: 0,
|
|
477
|
+
lineStyle: { width: 2.2, cap: "round", join: "round" },
|
|
478
|
+
itemStyle: { color, borderColor: k.surface, borderWidth: 2 },
|
|
479
|
+
areaStyle: input.area === false ? void 0 : k.seriesSoft ? { color: k.seriesSoft, opacity: 1 } : { color, opacity: 0.14 },
|
|
480
|
+
emphasis: { disabled: true },
|
|
481
|
+
animationDuration: motion.trace,
|
|
482
|
+
animationDelay: motion.delay,
|
|
483
|
+
animationEasing: "cubicOut"
|
|
484
|
+
}];
|
|
485
|
+
if (forecast) {
|
|
486
|
+
series.push({
|
|
487
|
+
name: forecast.name,
|
|
488
|
+
type: "line",
|
|
489
|
+
data: projected,
|
|
490
|
+
color,
|
|
491
|
+
showSymbol: true,
|
|
492
|
+
symbolSize: 0,
|
|
493
|
+
connectNulls: false,
|
|
494
|
+
lineStyle: { width: 2, type: [4, 5], opacity: 0.75, cap: "round" },
|
|
495
|
+
itemStyle: { color },
|
|
496
|
+
emphasis: { disabled: true },
|
|
497
|
+
// the projection continues the measured line, at half its pace
|
|
498
|
+
animationDuration: Math.round(motion.trace / 2),
|
|
499
|
+
animationDelay: motion.delay + motion.trace,
|
|
500
|
+
animationEasing: "cubicOut"
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
return {
|
|
504
|
+
...base,
|
|
505
|
+
// the gutter fits the end label ("Prognose 140"): about 6.5 px a character at 11 px
|
|
506
|
+
grid: { ...base.grid, right: endText ? Math.max(24, Math.ceil(endText.length * 6.5) + 14) : 12 },
|
|
507
|
+
tooltip: {
|
|
508
|
+
...base.tooltip,
|
|
509
|
+
axisPointer: { type: "line", lineStyle: { color: k.textMuted, type: [2, 3], width: 1 } },
|
|
510
|
+
formatter: (params) => {
|
|
511
|
+
const list = (Array.isArray(params) ? params : [params]).filter((p) => p.value != null);
|
|
512
|
+
if (!list.length) return "";
|
|
513
|
+
const point = list.find((p) => p.seriesIndex === 0) ?? list[0];
|
|
514
|
+
const value = typeof point.value === "object" && point.value !== null ? point.value.value : point.value;
|
|
515
|
+
return tooltipHtml(title(point.name), [{ color, name: point.seriesName, value: format(value) }]);
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
xAxis: { ...base.xAxis, data: categories, boundaryGap: false },
|
|
519
|
+
series
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
var PAIRED_BARS_MAX_BUCKETS = 12;
|
|
523
|
+
function pairedBarsOption(k, input, motion = GLANCE_AT_REST) {
|
|
524
|
+
const format = input.format ?? plain;
|
|
525
|
+
const base = uixGlanceBase(k, motion);
|
|
526
|
+
const title = input.tooltipTitle ?? ((c) => c);
|
|
527
|
+
const bar = (name, values, color, offset) => ({
|
|
528
|
+
name,
|
|
529
|
+
type: "bar",
|
|
530
|
+
data: values,
|
|
531
|
+
color,
|
|
532
|
+
barMaxWidth: 16,
|
|
533
|
+
barGap: "18%",
|
|
534
|
+
barCategoryGap: "38%",
|
|
535
|
+
itemStyle: { color, borderRadius: [3, 3, 0, 0] },
|
|
536
|
+
emphasis: { disabled: true },
|
|
537
|
+
animationDuration: motion.grow,
|
|
538
|
+
animationDelay: (index) => motion.delay + index * motion.stagger + offset,
|
|
539
|
+
animationEasing: "cubicOut"
|
|
540
|
+
});
|
|
541
|
+
return {
|
|
542
|
+
...base,
|
|
543
|
+
tooltip: {
|
|
544
|
+
...base.tooltip,
|
|
545
|
+
axisPointer: { type: "shadow", shadowStyle: { color: k.forecastBand } },
|
|
546
|
+
formatter: (params) => {
|
|
547
|
+
const list = Array.isArray(params) ? params : [params];
|
|
548
|
+
if (!list.length) return "";
|
|
549
|
+
return tooltipHtml(title(list[0].name), list.map((p) => ({ color: p.color, name: p.seriesName, value: format(p.value) })));
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
xAxis: { ...base.xAxis, data: input.categories },
|
|
553
|
+
series: [
|
|
554
|
+
bar(input.series.name, input.series.values, seriesColor(k), 0),
|
|
555
|
+
bar(input.comparison.name, input.comparison.values, k.comparison, motion.stagger)
|
|
556
|
+
]
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// src/components/GlanceCharts.tsx
|
|
561
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
562
|
+
function useGlanceMotion() {
|
|
563
|
+
const { playing } = useArrive();
|
|
564
|
+
const index = useArriveIndex();
|
|
565
|
+
const played = (0, import_react4.useRef)(null);
|
|
566
|
+
const [settled, setSettled] = (0, import_react4.useState)(false);
|
|
567
|
+
if (playing && !played.current) {
|
|
568
|
+
played.current = {
|
|
569
|
+
play: true,
|
|
570
|
+
delay: index * tokenMs("--uix-stagger-arrive", 45) + tokenMs("--uix-delay-arrive-trace", 150),
|
|
571
|
+
trace: tokenMs("--uix-dur-arrive-trace", 700),
|
|
572
|
+
grow: tokenMs("--uix-dur-arrive-grow", 500),
|
|
573
|
+
stagger: tokenMs("--uix-stagger-arrive-grow", 25)
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
const motion = played.current;
|
|
577
|
+
(0, import_react4.useEffect)(() => {
|
|
578
|
+
if (!motion || settled) return void 0;
|
|
579
|
+
const drawIn = motion.delay + Math.max(motion.trace, motion.grow + motion.stagger * (PAIRED_BARS_MAX_BUCKETS - 1));
|
|
580
|
+
const timer = setTimeout(() => setSettled(true), drawIn + 50);
|
|
581
|
+
return () => clearTimeout(timer);
|
|
582
|
+
}, [motion, settled]);
|
|
583
|
+
return motion && !settled ? motion : GLANCE_AT_REST;
|
|
584
|
+
}
|
|
585
|
+
function useDrawInWhenPlayed(motion, build) {
|
|
586
|
+
const chart = (0, import_react4.useRef)(null);
|
|
587
|
+
const atRestWhenDrawn = (0, import_react4.useRef)(false);
|
|
588
|
+
const motionNow = (0, import_react4.useRef)(motion);
|
|
589
|
+
motionNow.current = motion;
|
|
590
|
+
const buildNow = (0, import_react4.useRef)(build);
|
|
591
|
+
buildNow.current = build;
|
|
592
|
+
const onReady = (0, import_react4.useCallback)((instance) => {
|
|
593
|
+
chart.current = instance;
|
|
594
|
+
atRestWhenDrawn.current = !motionNow.current.play;
|
|
595
|
+
}, []);
|
|
596
|
+
(0, import_react4.useEffect)(() => {
|
|
597
|
+
const instance = chart.current;
|
|
598
|
+
if (!motion.play || !instance || instance.isDisposed() || !atRestWhenDrawn.current) return;
|
|
599
|
+
atRestWhenDrawn.current = false;
|
|
600
|
+
if (prefersReducedMotion()) return;
|
|
601
|
+
const element = instance.getDom();
|
|
602
|
+
instance.clear();
|
|
603
|
+
instance.setOption(mergeChartTheme(uixChartTheme(element), buildNow.current(uixChartTokens(element), motion)));
|
|
604
|
+
}, [motion]);
|
|
605
|
+
return onReady;
|
|
606
|
+
}
|
|
607
|
+
function GlanceLineChartCore({ engine, ariaLabel, categoryLabel = "Period", height = 150, className, style, loading, empty, labels, group, onEvents, ...input }) {
|
|
608
|
+
const motion = useGlanceMotion();
|
|
609
|
+
const { categories, values, name, forecast, endLabel, area, format, tooltipTitle } = input;
|
|
610
|
+
const build = (k, m) => glanceLineOption(k, { categories, values, name, forecast, endLabel, area, format, tooltipTitle }, m);
|
|
611
|
+
const onReady = useDrawInWhenPlayed(motion, build);
|
|
612
|
+
const option = (0, import_react4.useMemo)(
|
|
613
|
+
() => (k) => build(k, motion),
|
|
614
|
+
// a new array with the same numbers is the same chart
|
|
615
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
616
|
+
[JSON.stringify(categories), JSON.stringify(values), name, JSON.stringify(forecast), endLabel, area, format, tooltipTitle, motion]
|
|
617
|
+
);
|
|
618
|
+
const headers = [categoryLabel, name, ...forecast ? [forecast.name] : []];
|
|
619
|
+
const rows = [
|
|
620
|
+
...categories.map((c, i) => ({ [categoryLabel]: c, [name]: values[i] ?? "" })),
|
|
621
|
+
...forecast ? forecast.categories.map((c, i) => ({ [categoryLabel]: c, [name]: "", [forecast.name]: forecast.values[i] ?? "" })) : []
|
|
622
|
+
];
|
|
623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
624
|
+
ChartCore,
|
|
625
|
+
{
|
|
626
|
+
engine,
|
|
627
|
+
option,
|
|
628
|
+
ariaLabel,
|
|
629
|
+
tableHeaders: headers,
|
|
630
|
+
tableData: rows,
|
|
631
|
+
height,
|
|
632
|
+
className,
|
|
633
|
+
style,
|
|
634
|
+
loading,
|
|
635
|
+
empty,
|
|
636
|
+
labels,
|
|
637
|
+
group,
|
|
638
|
+
onEvents,
|
|
639
|
+
onReady
|
|
640
|
+
}
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
function PairedBarChartCore({ engine, ariaLabel, categoryLabel = "Period", height = 140, className, style, loading, empty, labels, group, onEvents, ...input }) {
|
|
644
|
+
const motion = useGlanceMotion();
|
|
645
|
+
const { categories, series, comparison, format, tooltipTitle } = input;
|
|
646
|
+
if (categories.length > PAIRED_BARS_MAX_BUCKETS && typeof console !== "undefined") {
|
|
647
|
+
console.warn(`[uix] PairedBarChart reads at a glance up to ${PAIRED_BARS_MAX_BUCKETS} buckets; it has ${categories.length}. Use a line, or move it to a report.`);
|
|
648
|
+
}
|
|
649
|
+
const build = (k, m) => pairedBarsOption(k, { categories, series, comparison, format, tooltipTitle }, m);
|
|
650
|
+
const onReady = useDrawInWhenPlayed(motion, build);
|
|
651
|
+
const option = (0, import_react4.useMemo)(
|
|
652
|
+
() => (k) => build(k, motion),
|
|
653
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
654
|
+
[JSON.stringify(categories), JSON.stringify(series), JSON.stringify(comparison), format, tooltipTitle, motion]
|
|
655
|
+
);
|
|
656
|
+
const rows = categories.map((c, i) => ({ [categoryLabel]: c, [series.name]: series.values[i] ?? "", [comparison.name]: comparison.values[i] ?? "" }));
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
658
|
+
ChartCore,
|
|
659
|
+
{
|
|
660
|
+
engine,
|
|
661
|
+
option,
|
|
662
|
+
ariaLabel,
|
|
663
|
+
tableHeaders: [categoryLabel, series.name, comparison.name],
|
|
664
|
+
tableData: rows,
|
|
665
|
+
height,
|
|
666
|
+
className,
|
|
667
|
+
style,
|
|
668
|
+
loading,
|
|
669
|
+
empty,
|
|
670
|
+
labels,
|
|
671
|
+
group,
|
|
672
|
+
onEvents,
|
|
673
|
+
onReady
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// src/chart-preset.tsx
|
|
679
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
361
680
|
echarts.use([
|
|
362
681
|
import_charts.BarChart,
|
|
363
682
|
import_charts.LineChart,
|
|
@@ -372,7 +691,13 @@ echarts.use([
|
|
|
372
691
|
]);
|
|
373
692
|
var presetEngine = echarts;
|
|
374
693
|
function Chart(props) {
|
|
375
|
-
return /* @__PURE__ */ (0,
|
|
694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartCore, { ...props, engine: presetEngine });
|
|
695
|
+
}
|
|
696
|
+
function GlanceLineChart(props) {
|
|
697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GlanceLineChartCore, { ...props, engine: presetEngine });
|
|
698
|
+
}
|
|
699
|
+
function PairedBarChart(props) {
|
|
700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PairedBarChartCore, { ...props, engine: presetEngine });
|
|
376
701
|
}
|
|
377
702
|
// Annotate the CommonJS export names for ESM import in node:
|
|
378
703
|
0 && (module.exports = {
|
|
@@ -381,9 +706,16 @@ function Chart(props) {
|
|
|
381
706
|
ChartLegendItem,
|
|
382
707
|
ChartMetric,
|
|
383
708
|
DEFAULT_CHART_LABELS,
|
|
709
|
+
GLANCE_AT_REST,
|
|
710
|
+
GlanceLineChart,
|
|
711
|
+
PAIRED_BARS_MAX_BUCKETS,
|
|
712
|
+
PairedBarChart,
|
|
713
|
+
glanceLineOption,
|
|
384
714
|
mergeChartTheme,
|
|
715
|
+
pairedBarsOption,
|
|
385
716
|
uixChartAreaGradient,
|
|
386
717
|
uixChartPalette,
|
|
387
718
|
uixChartTheme,
|
|
388
|
-
uixChartTokens
|
|
719
|
+
uixChartTokens,
|
|
720
|
+
uixGlanceBase
|
|
389
721
|
});
|
package/dist/chart-preset.d.cts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { a as ChartProps } from './ChartCore-
|
|
3
|
-
export { c as ChartEventHandler, C as ChartLabels, d as ChartLegend, e as ChartLegendItem, f as ChartLegendItemProps, g as ChartLegendProps, h as ChartMetric, i as ChartMetricProps, j as ChartOption, k as ChartTable, l as ChartTableRow, m as ChartTokenSource, D as DEFAULT_CHART_LABELS, U as UixChartTokens, n as mergeChartTheme, u as uixChartAreaGradient, o as uixChartPalette, p as uixChartTheme, q as uixChartTokens } from './ChartCore-
|
|
2
|
+
import { a as ChartProps } from './ChartCore-CY5a4teJ.cjs';
|
|
3
|
+
export { c as ChartEventHandler, C as ChartLabels, d as ChartLegend, e as ChartLegendItem, f as ChartLegendItemProps, g as ChartLegendProps, h as ChartMetric, i as ChartMetricProps, j as ChartOption, k as ChartTable, l as ChartTableRow, m as ChartTokenSource, D as DEFAULT_CHART_LABELS, U as UixChartTokens, n as mergeChartTheme, u as uixChartAreaGradient, o as uixChartPalette, p as uixChartTheme, q as uixChartTokens } from './ChartCore-CY5a4teJ.cjs';
|
|
4
|
+
import { G as GlanceLineChartProps, P as PairedBarChartProps } from './GlanceCharts-Cb39RqDC.cjs';
|
|
5
|
+
export { a as GLANCE_AT_REST, b as GlanceChartBaseProps, c as GlanceFormat, d as GlanceLineInput, e as GlanceMotion, f as PAIRED_BARS_MAX_BUCKETS, g as PairedBarsInput, h as glanceLineOption, p as pairedBarsOption, u as uixGlanceBase } from './GlanceCharts-Cb39RqDC.cjs';
|
|
4
6
|
import 'echarts';
|
|
5
7
|
|
|
6
8
|
/** Lean SVG adapter: line, bar, pie, dataset, grid, legend, title, and tooltip. */
|
|
7
9
|
declare function Chart(props: ChartProps): react.JSX.Element;
|
|
10
|
+
/** A glance line (calm kit 2.56) on the lean preset. Put it in a `ChartCard`. */
|
|
11
|
+
declare function GlanceLineChart(props: GlanceLineChartProps): react.JSX.Element;
|
|
12
|
+
/** Paired bars (calm kit 2.56) on the lean preset, up to 12 buckets. Put it in a `ChartCard`. */
|
|
13
|
+
declare function PairedBarChart(props: PairedBarChartProps): react.JSX.Element;
|
|
8
14
|
|
|
9
|
-
export { Chart, ChartProps };
|
|
15
|
+
export { Chart, ChartProps, GlanceLineChart, GlanceLineChartProps, PairedBarChart, PairedBarChartProps };
|
package/dist/chart-preset.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ChartProps } from './components/ChartCore.js';
|
|
3
3
|
export { ChartEventHandler, ChartLabels, ChartLegend, ChartLegendItem, ChartLegendItemProps, ChartLegendProps, ChartMetric, ChartMetricProps, ChartOption, ChartTable, ChartTableRow, DEFAULT_CHART_LABELS, uixChartPalette } from './components/ChartCore.js';
|
|
4
|
+
import { GlanceLineChartProps, PairedBarChartProps } from './components/GlanceCharts.js';
|
|
5
|
+
export { GlanceChartBaseProps } from './components/GlanceCharts.js';
|
|
4
6
|
export { ChartTokenSource, UixChartTokens, mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from './chart-theme.js';
|
|
7
|
+
export { GLANCE_AT_REST, GlanceFormat, GlanceLineInput, GlanceMotion, PAIRED_BARS_MAX_BUCKETS, PairedBarsInput, glanceLineOption, pairedBarsOption, uixGlanceBase } from './chart-glance.js';
|
|
5
8
|
import 'echarts';
|
|
6
9
|
|
|
7
10
|
/** Lean SVG adapter: line, bar, pie, dataset, grid, legend, title, and tooltip. */
|
|
8
11
|
declare function Chart(props: ChartProps): react.JSX.Element;
|
|
12
|
+
/** A glance line (calm kit 2.56) on the lean preset. Put it in a `ChartCard`. */
|
|
13
|
+
declare function GlanceLineChart(props: GlanceLineChartProps): react.JSX.Element;
|
|
14
|
+
/** Paired bars (calm kit 2.56) on the lean preset, up to 12 buckets. Put it in a `ChartCard`. */
|
|
15
|
+
declare function PairedBarChart(props: PairedBarChartProps): react.JSX.Element;
|
|
9
16
|
|
|
10
|
-
export { Chart, ChartProps };
|
|
17
|
+
export { Chart, ChartProps, GlanceLineChart, GlanceLineChartProps, PairedBarChart, PairedBarChartProps };
|
package/dist/chart-preset.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "echarts/components";
|
|
13
13
|
import { SVGRenderer } from "echarts/renderers";
|
|
14
14
|
import { ChartCore } from "./components/ChartCore.js";
|
|
15
|
+
import { GlanceLineChartCore, PairedBarChartCore } from "./components/GlanceCharts.js";
|
|
15
16
|
echarts.use([
|
|
16
17
|
BarChart,
|
|
17
18
|
LineChart,
|
|
@@ -28,17 +29,31 @@ const presetEngine = echarts;
|
|
|
28
29
|
function Chart(props) {
|
|
29
30
|
return /* @__PURE__ */ jsx(ChartCore, { ...props, engine: presetEngine });
|
|
30
31
|
}
|
|
32
|
+
function GlanceLineChart(props) {
|
|
33
|
+
return /* @__PURE__ */ jsx(GlanceLineChartCore, { ...props, engine: presetEngine });
|
|
34
|
+
}
|
|
35
|
+
function PairedBarChart(props) {
|
|
36
|
+
return /* @__PURE__ */ jsx(PairedBarChartCore, { ...props, engine: presetEngine });
|
|
37
|
+
}
|
|
31
38
|
import { ChartLegend, ChartLegendItem, ChartMetric, DEFAULT_CHART_LABELS, uixChartPalette } from "./components/ChartCore.js";
|
|
32
39
|
import { mergeChartTheme, uixChartAreaGradient, uixChartTheme, uixChartTokens } from "./chart-theme.js";
|
|
40
|
+
import { GLANCE_AT_REST, PAIRED_BARS_MAX_BUCKETS, glanceLineOption, pairedBarsOption, uixGlanceBase } from "./chart-glance.js";
|
|
33
41
|
export {
|
|
34
42
|
Chart,
|
|
35
43
|
ChartLegend,
|
|
36
44
|
ChartLegendItem,
|
|
37
45
|
ChartMetric,
|
|
38
46
|
DEFAULT_CHART_LABELS,
|
|
47
|
+
GLANCE_AT_REST,
|
|
48
|
+
GlanceLineChart,
|
|
49
|
+
PAIRED_BARS_MAX_BUCKETS,
|
|
50
|
+
PairedBarChart,
|
|
51
|
+
glanceLineOption,
|
|
39
52
|
mergeChartTheme,
|
|
53
|
+
pairedBarsOption,
|
|
40
54
|
uixChartAreaGradient,
|
|
41
55
|
uixChartPalette,
|
|
42
56
|
uixChartTheme,
|
|
43
|
-
uixChartTokens
|
|
57
|
+
uixChartTokens,
|
|
58
|
+
uixGlanceBase
|
|
44
59
|
};
|
package/dist/chart-theme.d.ts
CHANGED
|
@@ -2,9 +2,21 @@ import { EChartsOption } from 'echarts';
|
|
|
2
2
|
|
|
3
3
|
/** Where tokens are read from: an element (its computed style), or a reader for tests and non-DOM use. */
|
|
4
4
|
type ChartTokenSource = Element | ((token: string) => string);
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* The analytic chart roles: reference lines, threshold zones, forecast bands, events, partial periods.
|
|
7
|
+
* The calm-kit fields (series, seriesSoft, categories, radius, shadow) are optional, so an object
|
|
8
|
+
* built for 2.55 still type-checks; `uixChartTokens()` always fills them, and the glance charts fall
|
|
9
|
+
* back to `palette[0]` when an object of your own leaves them out.
|
|
10
|
+
*/
|
|
6
11
|
interface UixChartTokens {
|
|
12
|
+
/** The categorical palette, --uix-chart-1..8 (v2, calm kit 2.56): no red slot and no amber slot. */
|
|
7
13
|
palette: string[];
|
|
14
|
+
/** THE series colour of a glance chart (--uix-chart-series, = chart-1). */
|
|
15
|
+
series?: string;
|
|
16
|
+
/** The series colour as a faint wash (an area under a glance line). */
|
|
17
|
+
seriesSoft?: string;
|
|
18
|
+
/** The three quiet category hues (blue, teal, violet) for a chart that truly needs more than one. */
|
|
19
|
+
categories?: string[];
|
|
8
20
|
neutral: string;
|
|
9
21
|
grid: string;
|
|
10
22
|
axis: string;
|
|
@@ -24,9 +36,13 @@ interface UixChartTokens {
|
|
|
24
36
|
border: string;
|
|
25
37
|
fontSans: string;
|
|
26
38
|
fontMono: string;
|
|
39
|
+
/** --uix-radius-md, for a glance tooltip. */
|
|
40
|
+
radius?: string;
|
|
41
|
+
/** --uix-shadow-popover, for a glance tooltip. */
|
|
42
|
+
shadow?: string;
|
|
27
43
|
}
|
|
28
44
|
/** Resolve the chart tokens once (current theme). */
|
|
29
|
-
declare function uixChartTokens(source?: ChartTokenSource): UixChartTokens
|
|
45
|
+
declare function uixChartTokens(source?: ChartTokenSource): UixChartTokens & Required<Pick<UixChartTokens, 'series' | 'seriesSoft' | 'categories' | 'radius' | 'shadow'>>;
|
|
30
46
|
/**
|
|
31
47
|
* The base option every UIx chart merges under the consumer's option (the consumer wins).
|
|
32
48
|
* Axis defaults apply to every x/y axis, whether the consumer passes one axis or an array.
|
package/dist/chart-theme.js
CHANGED
|
@@ -10,6 +10,9 @@ function uixChartTokens(source) {
|
|
|
10
10
|
const unquote = (font) => font.replace(/"/g, "");
|
|
11
11
|
return {
|
|
12
12
|
palette: [1, 2, 3, 4, 5, 6, 7, 8].map((i) => t(`chart-${i}`)),
|
|
13
|
+
series: t("chart-series"),
|
|
14
|
+
seriesSoft: t("chart-series-soft"),
|
|
15
|
+
categories: [1, 2, 3].map((i) => t(`chart-${i}`)),
|
|
13
16
|
neutral: t("chart-neutral"),
|
|
14
17
|
grid: t("chart-grid"),
|
|
15
18
|
axis: t("chart-axis"),
|
|
@@ -27,7 +30,9 @@ function uixChartTokens(source) {
|
|
|
27
30
|
textMuted: t("text-muted"),
|
|
28
31
|
border: t("border-strong"),
|
|
29
32
|
fontSans: unquote(t("font-sans")),
|
|
30
|
-
fontMono: unquote(t("font-mono"))
|
|
33
|
+
fontMono: unquote(t("font-mono")),
|
|
34
|
+
radius: t("radius-md"),
|
|
35
|
+
shadow: t("shadow-popover")
|
|
31
36
|
};
|
|
32
37
|
}
|
|
33
38
|
function uixChartTheme(source) {
|