@ultralabs/glass 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +326 -0
- package/DESIGN.md +682 -0
- package/LICENSE +21 -0
- package/README.md +690 -2
- package/dist/esm/index.js +20991 -0
- package/dist/types/src/charts/ULCartesianChart.d.ts +177 -0
- package/dist/types/src/charts/ULDonutChart.d.ts +65 -0
- package/dist/types/src/charts/ULFunnelChart.d.ts +64 -0
- package/dist/types/src/charts/ULHeatmapChart.d.ts +40 -0
- package/dist/types/src/charts/ULRadarChart.d.ts +19 -0
- package/dist/types/src/charts/ULRadialChart.d.ts +48 -0
- package/dist/types/src/charts/ULScatterChart.d.ts +49 -0
- package/dist/types/src/charts/core.d.ts +287 -0
- package/dist/types/src/charts/decimate.d.ts +8 -0
- package/dist/types/src/charts/nav.d.ts +368 -0
- package/dist/types/src/charts/quadtree.d.ts +9 -0
- package/dist/types/src/charts/scales.d.ts +59 -0
- package/dist/types/src/charts/timeseries.d.ts +56 -0
- package/dist/types/src/components/ULAnchoredSurface/ULAnchoredSurface.d.ts +72 -0
- package/dist/types/src/components/ULBatch2/carousel.d.ts +31 -0
- package/dist/types/src/components/ULBatch2/hovercard.d.ts +40 -0
- package/dist/types/src/components/ULBatch2/layout.d.ts +16 -0
- package/dist/types/src/components/ULBatch2/menubar.d.ts +29 -0
- package/dist/types/src/components/ULBatch2/navmenu.d.ts +51 -0
- package/dist/types/src/components/ULBatch2/resizable.d.ts +48 -0
- package/dist/types/src/components/ULBatch2/typography.d.ts +55 -0
- package/dist/types/src/components/ULButton/ULButton.d.ts +87 -0
- package/dist/types/src/components/ULContainers/ULCard.d.ts +54 -0
- package/dist/types/src/components/ULContainers/ULDialog.d.ts +57 -0
- package/dist/types/src/components/ULContainers/ULLayout.d.ts +81 -0
- package/dist/types/src/components/ULContainers/ULMenu.d.ts +99 -0
- package/dist/types/src/components/ULContainers/ULOverlays.d.ts +113 -0
- package/dist/types/src/components/ULContainers/contextTarget.d.ts +91 -0
- package/dist/types/src/components/ULData/ULData.d.ts +225 -0
- package/dist/types/src/components/ULData/ULKpi.d.ts +159 -0
- package/dist/types/src/components/ULField/ULField.d.ts +93 -0
- package/dist/types/src/components/ULForms/fieldContext.d.ts +39 -0
- package/dist/types/src/components/ULForms/forms.d.ts +143 -0
- package/dist/types/src/components/ULIsland/ULIsland.d.ts +39 -0
- package/dist/types/src/components/ULIsland/headerConfig.d.ts +43 -0
- package/dist/types/src/components/ULIsland/navIndicator.d.ts +26 -0
- package/dist/types/src/components/ULListbox/ULListbox.d.ts +75 -0
- package/dist/types/src/components/ULPickers/ULPickers.d.ts +141 -0
- package/dist/types/src/components/ULSegmented/ULSegmented.d.ts +50 -0
- package/dist/types/src/components/ULSelection/ULSelection.d.ts +71 -0
- package/dist/types/src/components/ULSlider/ULSlider.d.ts +43 -0
- package/dist/types/src/components/ULSpinner/ULSpinner.d.ts +8 -0
- package/dist/types/src/components/ULStructure/kbd.d.ts +22 -0
- package/dist/types/src/components/ULStructure/structure.d.ts +154 -0
- package/dist/types/src/components/ULTabs/ULTabs.d.ts +28 -0
- package/dist/types/src/components/ULTooltip/anchoredTooltip.d.ts +22 -0
- package/dist/types/src/components/actions/actions.d.ts +175 -0
- package/dist/types/src/components/actions/core.d.ts +346 -0
- package/dist/types/src/components/dashboard/blocks.d.ts +583 -0
- package/dist/types/src/components/dashboard/blocks2.d.ts +297 -0
- package/dist/types/src/components/dashboard/columnsDrag.d.ts +27 -0
- package/dist/types/src/components/shared/ULCheckMark.d.ts +9 -0
- package/dist/types/src/components/shared/dev.d.ts +13 -0
- package/dist/types/src/components/shared/icons.d.ts +23 -0
- package/dist/types/src/glass/ULGlass.d.ts +78 -0
- package/dist/types/src/glass/ULGlassGroup.d.ts +16 -0
- package/dist/types/src/glass/accent.d.ts +31 -0
- package/dist/types/src/glass/contrast.d.ts +78 -0
- package/dist/types/src/glass/engine.d.ts +177 -0
- package/dist/types/src/glass/glassDebug.d.ts +27 -0
- package/dist/types/src/glass/material.d.ts +49 -0
- package/dist/types/src/glass/radius.d.ts +2 -0
- package/dist/types/src/hooks/useAnchoredMorph.d.ts +20 -0
- package/dist/types/src/hooks/usePointerLight.d.ts +6 -0
- package/dist/types/src/hooks/useReducedMotion.d.ts +3 -0
- package/dist/types/src/index.d.ts +150 -0
- package/dist/types/src/island/sectionAccent.d.ts +18 -0
- package/dist/types/src/live/ULLiveStatus.d.ts +18 -0
- package/dist/types/src/live/liveQueue.d.ts +13 -0
- package/dist/types/src/live/liveSource.d.ts +149 -0
- package/dist/types/src/live/liveStore.d.ts +72 -0
- package/dist/types/src/motion/anchoredMorph.d.ts +175 -0
- package/dist/types/src/motion/goo.d.ts +3 -0
- package/dist/types/src/motion/lensBubble.d.ts +143 -0
- package/dist/types/src/motion/lensSelect.d.ts +31 -0
- package/dist/types/src/motion/overlayStack.d.ts +13 -0
- package/dist/types/src/motion/placement.d.ts +18 -0
- package/dist/types/src/motion/spring.d.ts +20 -0
- package/dist/types/src/motion/topLayer.d.ts +13 -0
- package/dist/types/src/motion/viewSwap.d.ts +33 -0
- package/dist/types/src/motion/virtualAnchor.d.ts +28 -0
- package/dist/ul-glass.css +10519 -0
- package/dist/ul-glass.js +21034 -0
- package/dist/ul-glass.min.js +14 -0
- package/dist/ul-glass.min.js.map +7 -0
- package/icons/arrow-up-down.svg +5 -0
- package/icons/bell.svg +3 -0
- package/icons/bold.svg +2 -0
- package/icons/calendar.svg +5 -0
- package/icons/check.svg +2 -0
- package/icons/chevron-down.svg +2 -0
- package/icons/chevron-left.svg +2 -0
- package/icons/chevron-right.svg +2 -0
- package/icons/chevrons-right.svg +3 -0
- package/icons/circle-check.svg +3 -0
- package/icons/circle-x.svg +4 -0
- package/icons/circle.svg +2 -0
- package/icons/copy.svg +3 -0
- package/icons/ellipsis.svg +4 -0
- package/icons/eye.svg +3 -0
- package/icons/filter.svg +2 -0
- package/icons/flags/LICENSE.md +2 -0
- package/icons/flags/cs.svg +1 -0
- package/icons/flags/de.svg +1 -0
- package/icons/flags/en.svg +1 -0
- package/icons/flags/sk.svg +1 -0
- package/icons/folder-kanban.svg +5 -0
- package/icons/icons.json +1 -0
- package/icons/inbox.svg +3 -0
- package/icons/info.svg +4 -0
- package/icons/layout-dashboard.svg +5 -0
- package/icons/layout-grid.svg +5 -0
- package/icons/loader-circle.svg +2 -0
- package/icons/lock.svg +3 -0
- package/icons/mail.svg +3 -0
- package/icons/menu.svg +4 -0
- package/icons/minus.svg +2 -0
- package/icons/panel-left-close.svg +4 -0
- package/icons/plus.svg +3 -0
- package/icons/refresh-cw.svg +5 -0
- package/icons/search.svg +3 -0
- package/icons/shield-check.svg +3 -0
- package/icons/shopping-bag.svg +4 -0
- package/icons/sparkles.svg +6 -0
- package/icons/trash-2.svg +6 -0
- package/icons/triangle-alert.svg +4 -0
- package/icons/upload.svg +4 -0
- package/icons/users.svg +5 -0
- package/icons/x.svg +3 -0
- package/package.json +65 -4
- package/tokens/tokens.css +799 -0
- package/tokens/tokens.json +1017 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULCartesianChart: line, area (stacked / percent), bar (grouped / stacked / horizontal) and combo (bars + line, dual axis)
|
|
3
|
+
* on the shared chart core. Wrappers: ULLineChart, ULAreaChart, ULBarChart, ULComboChart. Legacy ULChart maps onto it.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import type { Accent } from '../glass/accent.js';
|
|
7
|
+
import type { ContextMenuProps } from '../components/ULContainers/contextTarget.js';
|
|
8
|
+
import { type PatternMode, type ChartState } from './core.js';
|
|
9
|
+
import type { TimeRangeValue } from '../components/dashboard/blocks.js';
|
|
10
|
+
export interface ChartSeriesDef<T> {
|
|
11
|
+
key: string;
|
|
12
|
+
name: string;
|
|
13
|
+
value: (d: T, i: number) => number | null | undefined;
|
|
14
|
+
/** Mark type (combo charts mix them). Default: the chart kind. */
|
|
15
|
+
type?: 'line' | 'area' | 'bar';
|
|
16
|
+
/** Value axis. 'right' turns on the second axis (combo). */
|
|
17
|
+
axis?: 'left' | 'right';
|
|
18
|
+
/** Palette slot 0–5 (colour + dash/pattern). Default: series index. */
|
|
19
|
+
slot?: number;
|
|
20
|
+
}
|
|
21
|
+
export type ChartTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger';
|
|
22
|
+
export interface ChartReference {
|
|
23
|
+
value: number;
|
|
24
|
+
label?: string;
|
|
25
|
+
axis?: 'left' | 'right';
|
|
26
|
+
tone?: ChartTone;
|
|
27
|
+
}
|
|
28
|
+
export interface ChartThreshold {
|
|
29
|
+
from: number;
|
|
30
|
+
to: number;
|
|
31
|
+
label?: string;
|
|
32
|
+
axis?: 'left' | 'right';
|
|
33
|
+
tone?: ChartTone;
|
|
34
|
+
}
|
|
35
|
+
export interface ChartAxisConfig {
|
|
36
|
+
label?: string;
|
|
37
|
+
format?: (v: number) => string;
|
|
38
|
+
min?: number;
|
|
39
|
+
max?: number;
|
|
40
|
+
}
|
|
41
|
+
/** Context-menu payload: data point, series (legend chip) or plot background. */
|
|
42
|
+
export interface ChartPointTarget {
|
|
43
|
+
index?: number;
|
|
44
|
+
label?: string;
|
|
45
|
+
series?: string;
|
|
46
|
+
values?: {
|
|
47
|
+
series: string;
|
|
48
|
+
value: number | null;
|
|
49
|
+
}[];
|
|
50
|
+
}
|
|
51
|
+
export interface ULCartesianChartProps<T = Record<string, unknown>> extends ContextMenuProps<ChartPointTarget> {
|
|
52
|
+
/** Rows. */ data: T[];
|
|
53
|
+
/** X accessor (d, i). */ x: (d: T, i: number) => string | number | Date;
|
|
54
|
+
/** Series definitions ({ key, name, value, color?, dash? }). */ series: ChartSeriesDef<T>[];
|
|
55
|
+
/** "line" | "area" | "bar". */ kind?: 'line' | 'area' | 'bar';
|
|
56
|
+
/** "none" (default) | "stacked" | "percent". */ stack?: 'none' | 'stacked' | 'percent';
|
|
57
|
+
/** "vertical" (default) | "horizontal" (bars). */ orientation?: 'vertical' | 'horizontal';
|
|
58
|
+
/** "monotone" (default) | "linear". */ curve?: 'monotone' | 'linear';
|
|
59
|
+
/** "category" (default) | "time" (enables zoom / brush with onRangeChange). */ xScale?: 'category' | 'time';
|
|
60
|
+
/** "linear" (default) | "log". */ yScale?: 'linear' | 'log';
|
|
61
|
+
/** Reference lines ({ value, label, tone? }). */ references?: ChartReference[];
|
|
62
|
+
/** Threshold lines / bands ({ value, label?, tone }). */ thresholds?: ChartThreshold[];
|
|
63
|
+
/** Axis options per axis ({ x?, y? }: label, ticks, min, max, format). */ axes?: {
|
|
64
|
+
x?: Omit<ChartAxisConfig, 'min' | 'max'>;
|
|
65
|
+
left?: ChartAxisConfig;
|
|
66
|
+
right?: ChartAxisConfig;
|
|
67
|
+
};
|
|
68
|
+
/** Chart title (panel heading, names the figure). */ title: React.ReactNode;
|
|
69
|
+
/** Short description under the title. */ description?: React.ReactNode;
|
|
70
|
+
/** Screen-reader summary. Default: generated per series (first → last, lowest, highest). */
|
|
71
|
+
summary?: string;
|
|
72
|
+
/** Plot height in px. */ height?: number;
|
|
73
|
+
/** "en" | "sk" | "de" | "cs" for numbers, dates and built-in strings. Default "en". */ locale?: string;
|
|
74
|
+
/** Intl options for values (tooltip, table). Axis ticks use compact notation automatically from 10 000. */
|
|
75
|
+
valueFormat?: Intl.NumberFormatOptions;
|
|
76
|
+
/** Formats values for ticks, tooltip and table: Intl options or (v) => string. */ format?: (v: number, seriesKey: string) => string;
|
|
77
|
+
/** Accent colour of the panel; series colours derive from it (--ul-chart-s0…s5). */ accent?: Accent;
|
|
78
|
+
/** Wrap in the one glass chart panel. Default true; false for embedding in another surface. */ panel?: boolean;
|
|
79
|
+
/** Extra class on the panel. */ className?: string;
|
|
80
|
+
/** Show the legend (toggles series). Default true for more than one series. */ legend?: boolean;
|
|
81
|
+
/** Show the toolbar (table, copy, CSV). Default true. */ toolbar?: boolean;
|
|
82
|
+
/** Base file name of the CSV export. */ filename?: string;
|
|
83
|
+
/** Static point beads: auto = only when ≤ 40 points. The hover bead always shows. */
|
|
84
|
+
beads?: 'auto' | 'always' | 'never';
|
|
85
|
+
/** "ready" | "loading" | "empty" | "error" — skeleton, empty and error states keep the panel size. */ state?: ChartState;
|
|
86
|
+
/** Error state Retry action. */ onRetry?: () => unknown;
|
|
87
|
+
/** Error state text. Default localised. */ errorMessage?: React.ReactNode;
|
|
88
|
+
/** Empty state content. Default localised "No data". */ empty?: {
|
|
89
|
+
title?: React.ReactNode;
|
|
90
|
+
description?: React.ReactNode;
|
|
91
|
+
action?: React.ReactNode;
|
|
92
|
+
};
|
|
93
|
+
/** Stale badge (true or a custom label) when the data is old. */ stale?: boolean | string;
|
|
94
|
+
/** Open with the data table shown. Default false. */ defaultTable?: boolean;
|
|
95
|
+
/** Called with { series, index, row } when a point / bar is activated (click, Enter). */ onPointClick?: (t: ChartPointTarget) => void;
|
|
96
|
+
/** Secondary cues. auto (default): dash for series 3+, fill patterns only with > 4 series or high-contrast mode. on | off. */
|
|
97
|
+
patterns?: PatternMode;
|
|
98
|
+
/** Zoom, pan and range brush (line / area / bar). true = brush + wheel (Ctrl / Cmd) + pinch + keyboard; overview adds the mini strip. */
|
|
99
|
+
zoom?: boolean | {
|
|
100
|
+
brush?: boolean;
|
|
101
|
+
overview?: boolean;
|
|
102
|
+
};
|
|
103
|
+
/** Controlled view range (time: Date / ms; category: index). null = full. */
|
|
104
|
+
range?: {
|
|
105
|
+
from: Date | number;
|
|
106
|
+
to: Date | number;
|
|
107
|
+
} | null;
|
|
108
|
+
/** Fires on brush end, zoom / pan settle and reset (null). Same shape as ULTimeRange's value (preset 'custom'). */
|
|
109
|
+
onRangeChange?: (r: TimeRangeValue | null) => void;
|
|
110
|
+
/** Highlight a data index from outside (e.g. a hovered table row): shows the tooltip unless the user pinned one. */
|
|
111
|
+
highlight?: number | null;
|
|
112
|
+
/** auto (default): canvas above --ul-chart-canvas-at points (line / area only). */
|
|
113
|
+
renderer?: 'auto' | 'svg' | 'canvas';
|
|
114
|
+
/** LTTB decimation for drawing when points exceed the plot pixels (tooltip and table keep every point). Default true. */
|
|
115
|
+
decimate?: boolean;
|
|
116
|
+
/** Time domain override (streaming window). */
|
|
117
|
+
xDomain?: [number, number];
|
|
118
|
+
/** Pulsing bead on the latest point (streaming). */
|
|
119
|
+
liveBead?: boolean;
|
|
120
|
+
/** false: data changes jump (streaming windows, zoom steps). Draw-in on mount still runs. */
|
|
121
|
+
animate?: boolean;
|
|
122
|
+
}
|
|
123
|
+
/** Internal: what the zoom / stream wrappers inject into the body. */
|
|
124
|
+
export interface ChartInteraction {
|
|
125
|
+
bind?: Record<string, (e: never) => unknown>;
|
|
126
|
+
layer?: React.ReactNode;
|
|
127
|
+
onKey?: (e: React.KeyboardEvent) => boolean;
|
|
128
|
+
onGeom?: (g: {
|
|
129
|
+
l: number;
|
|
130
|
+
r: number;
|
|
131
|
+
t: number;
|
|
132
|
+
b: number;
|
|
133
|
+
iw: number;
|
|
134
|
+
ih: number;
|
|
135
|
+
W: number;
|
|
136
|
+
H: number;
|
|
137
|
+
el: HTMLDivElement | null;
|
|
138
|
+
band: boolean;
|
|
139
|
+
step: number;
|
|
140
|
+
}) => void;
|
|
141
|
+
footer?: React.ReactNode;
|
|
142
|
+
indexOffset?: number;
|
|
143
|
+
tools?: React.ReactNode;
|
|
144
|
+
}
|
|
145
|
+
export declare function ULCartesianChart<T>(props: ULCartesianChartProps<T>): React.JSX.Element;
|
|
146
|
+
declare let ZoomHost: <T>(p: ULCartesianChartProps<T>) => React.ReactElement;
|
|
147
|
+
/** Set by timeseries.tsx (keeps this file free of the zoom code path when unused). */
|
|
148
|
+
export declare const registerZoomHost: (c: typeof ZoomHost) => void;
|
|
149
|
+
export declare function CartesianBody<T>(props: ULCartesianChartProps<T> & {
|
|
150
|
+
ix?: ChartInteraction;
|
|
151
|
+
}): React.JSX.Element;
|
|
152
|
+
type Pre<T> = Omit<ULCartesianChartProps<T>, 'kind'>;
|
|
153
|
+
export declare function ULLineChart<T>(p: Pre<T>): React.JSX.Element;
|
|
154
|
+
export declare function ULAreaChart<T>(p: Pre<T>): React.JSX.Element;
|
|
155
|
+
export declare function ULBarChart<T>(p: Pre<T>): React.JSX.Element;
|
|
156
|
+
/** Bars + line(s), dual axis: give the line series axis: 'right' and label both axes (axes.left.label / axes.right.label). */
|
|
157
|
+
export declare function ULComboChart<T>(p: Pre<T>): React.JSX.Element;
|
|
158
|
+
export interface ULChartLegacyProps extends ContextMenuProps<ChartPointTarget> {
|
|
159
|
+
/** "line" | "area" | "bar". */ kind?: 'line' | 'area' | 'bar'; /** Series ({ name, values }). */
|
|
160
|
+
series: {
|
|
161
|
+
name: string;
|
|
162
|
+
data: number[];
|
|
163
|
+
}[]; /** Category labels. */
|
|
164
|
+
labels: string[]; /** Chart title (panel heading, names the figure). */
|
|
165
|
+
title: string; /** Text summary for screen readers (read before the data table). */
|
|
166
|
+
summary?: string; /** Plot height in px. */
|
|
167
|
+
height?: number;
|
|
168
|
+
/** Formats values for ticks, tooltip and table: Intl options or (v) => string. */ format?: (v: number) => string; /** Show the data table toggle. Default true. */
|
|
169
|
+
showTable?: boolean; /** Accent colour of the panel; series colours derive from it (--ul-chart-s0…s5). */
|
|
170
|
+
accent?: Accent; /** Wrap in the one glass chart panel. Default true; false for embedding in another surface. */
|
|
171
|
+
panel?: boolean; /** Extra class on the panel. */
|
|
172
|
+
className?: string; /** "en" | "sk" | "de" | "cs" for numbers, dates and built-in strings. Default "en". */
|
|
173
|
+
locale?: string;
|
|
174
|
+
}
|
|
175
|
+
/** Drop-in for the 2d ULChart: same props; renders through ULCartesianChart. */
|
|
176
|
+
export declare function ULChart({ kind, series, labels, title, summary, height, format, showTable, accent, panel, className, locale, ...ctx }: ULChartLegacyProps): React.JSX.Element;
|
|
177
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULDonutChart (pie with innerRadius 0) and ULSparkChart (line, area, bars, win/loss) on the shared chart core.
|
|
3
|
+
*/
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import type { Accent } from '../glass/accent.js';
|
|
6
|
+
import type { ContextMenuProps } from '../components/ULContainers/contextTarget.js';
|
|
7
|
+
import { type PatternMode, type ChartState } from './core.js';
|
|
8
|
+
import type { ChartPointTarget } from './ULCartesianChart.js';
|
|
9
|
+
export interface ULDonutChartProps<T = Record<string, unknown>> extends ContextMenuProps<ChartPointTarget> {
|
|
10
|
+
/** Rows. */ data: T[];
|
|
11
|
+
/** Category label accessor (d, i) => string. */ label: (d: T, i: number) => string;
|
|
12
|
+
/** Value accessor (d, i) => number. */ value: (d: T, i: number) => number;
|
|
13
|
+
/** 'donut' (default) or 'pie'. */
|
|
14
|
+
variant?: 'donut' | 'pie';
|
|
15
|
+
/** Slices below this share (0–1) merge into one "Other" slice. Default 0 (off). */
|
|
16
|
+
mergeBelow?: number;
|
|
17
|
+
/** Centre slot (donut): any content, e.g. <ULRollingNumber>. Default: the total. */
|
|
18
|
+
center?: React.ReactNode;
|
|
19
|
+
/** Content in the centre (e.g. a ULRollingNumber total). */ centerLabel?: React.ReactNode;
|
|
20
|
+
/** Chart title (panel heading, names the figure). */ title: React.ReactNode; /** Short description under the title. */
|
|
21
|
+
description?: React.ReactNode; /** Text summary for screen readers (read before the data table). */
|
|
22
|
+
summary?: string; /** Plot height in px. */
|
|
23
|
+
height?: number; /** "en" | "sk" | "de" | "cs" for numbers, dates and built-in strings. Default "en". */
|
|
24
|
+
locale?: string;
|
|
25
|
+
/** Intl.NumberFormat options for values (tooltip, table, legend). */ valueFormat?: Intl.NumberFormatOptions; /** Formats values for ticks, tooltip and table: Intl options or (v) => string. */
|
|
26
|
+
format?: (v: number) => string;
|
|
27
|
+
/** Accent colour of the panel; series colours derive from it (--ul-chart-s0…s5). */ accent?: Accent; /** Wrap in the one glass chart panel. Default true; false for embedding in another surface. */
|
|
28
|
+
panel?: boolean; /** Extra class on the panel. */
|
|
29
|
+
className?: string; /** Show the legend (toggles series). Default true for more than one series. */
|
|
30
|
+
legend?: boolean; /** Show the toolbar (table, copy, CSV). Default true. */
|
|
31
|
+
toolbar?: boolean; /** Base file name of the CSV export. */
|
|
32
|
+
filename?: string;
|
|
33
|
+
/** "ready" | "loading" | "empty" | "error" — skeleton, empty and error states keep the panel size. */ state?: ChartState; /** Error state Retry action. */
|
|
34
|
+
onRetry?: () => unknown; /** Error state text. Default localised. */
|
|
35
|
+
errorMessage?: React.ReactNode; /** Empty state content. Default localised "No data". */
|
|
36
|
+
empty?: {
|
|
37
|
+
title?: React.ReactNode;
|
|
38
|
+
description?: React.ReactNode;
|
|
39
|
+
action?: React.ReactNode;
|
|
40
|
+
}; /** Stale badge (true or a custom label) when the data is old. */
|
|
41
|
+
stale?: boolean | string; /** Open with the data table shown. Default false. */
|
|
42
|
+
defaultTable?: boolean;
|
|
43
|
+
/** auto (default): slice patterns only with > 4 slices or high-contrast mode. on | off. */
|
|
44
|
+
patterns?: PatternMode;
|
|
45
|
+
}
|
|
46
|
+
export declare function ULDonutChart<T>(props: ULDonutChartProps<T>): React.JSX.Element;
|
|
47
|
+
export declare function ULPieChart<T>(p: Omit<ULDonutChartProps<T>, 'variant'>): React.JSX.Element;
|
|
48
|
+
export interface ULSparkChartProps {
|
|
49
|
+
/** Values (oldest first). */ data: (number | null)[];
|
|
50
|
+
/** "line" (default) | "area" | "bars" | "winloss". */ variant?: 'line' | 'area' | 'bars' | 'winloss';
|
|
51
|
+
/** Width in px or CSS length. */ width?: number | string; /** Plot height in px. */
|
|
52
|
+
height?: number;
|
|
53
|
+
/** Palette slot or tone. 'auto' (winloss/bars): positive = series, negative = danger. */
|
|
54
|
+
slot?: number;
|
|
55
|
+
/** Accessible label; without it the sparkline is decorative (aria-hidden), the host (KPI card, table cell) states the value. */
|
|
56
|
+
label?: string;
|
|
57
|
+
/** Reference line (e.g. target or 0). */
|
|
58
|
+
reference?: number;
|
|
59
|
+
/** Highlight the last point (bead) / bar. Default true. */
|
|
60
|
+
emphasizeLast?: boolean;
|
|
61
|
+
/** Draw in once and morph on real data change (reduced motion = fade). Default true. */ animate?: boolean;
|
|
62
|
+
/** Extra class on the panel. */ className?: string;
|
|
63
|
+
}
|
|
64
|
+
/** Small inline chart for ULKpiCard (trend prop) and table cells. No axes, no tooltip, no glass. Draws in once; identical data never re-animates. */
|
|
65
|
+
export declare function ULSparkChart({ data, variant, width, height, slot, label, reference, emphasizeLast, animate, className }: ULSparkChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULFunnelChart (steps, conversion of the first step, drop-off from the previous), ULHistogramChart (bin control,
|
|
3
|
+
* percentile / reference lines), ULTreemapChart (squarified, drill-in with embedded ULBreadcrumbs, labels hide when the
|
|
4
|
+
* tile is too small). Hover = ONE shared indicator element; keyboard; table view; patterns per policy.
|
|
5
|
+
*/
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { type ChartBaseProps } from './nav.js';
|
|
8
|
+
import './charts-adv.css';
|
|
9
|
+
export interface ULFunnelChartProps<T = Record<string, unknown>> extends ChartBaseProps {
|
|
10
|
+
/** Rows. */ data: T[];
|
|
11
|
+
/** Category label accessor (d, i) => string. */ label: (d: T, i: number) => string;
|
|
12
|
+
/** Value accessor (d, i) => number. */ value: (d: T, i: number) => number;
|
|
13
|
+
}
|
|
14
|
+
export declare function ULFunnelChart<T>(props: ULFunnelChartProps<T>): React.JSX.Element;
|
|
15
|
+
export interface ULHistogramChartProps extends ChartBaseProps {
|
|
16
|
+
/** Raw values; binned automatically. */ values: number[];
|
|
17
|
+
/** Bin count (approximate; edges are nice numbers). Default 'auto' (Sturges). */
|
|
18
|
+
bins?: number | 'auto';
|
|
19
|
+
/** Bin control choices. Default [10, 20, 40]; [] hides the control. */
|
|
20
|
+
binOptions?: number[];
|
|
21
|
+
/** Percentile lines, e.g. [50, 95, 99]. */
|
|
22
|
+
percentiles?: number[];
|
|
23
|
+
/** Reference lines ({ value, label }), e.g. p50 / p95 / p99. */ references?: {
|
|
24
|
+
value: number;
|
|
25
|
+
label?: string;
|
|
26
|
+
}[];
|
|
27
|
+
/** X axis label. */ xLabel?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const quantile: (sorted: number[], q: number) => number;
|
|
30
|
+
export declare function binValues(values: number[], bins: number): {
|
|
31
|
+
edges: number[];
|
|
32
|
+
counts: any[];
|
|
33
|
+
};
|
|
34
|
+
export declare function ULHistogramChart(props: ULHistogramChartProps): React.JSX.Element;
|
|
35
|
+
export interface TreeNode {
|
|
36
|
+
name: string;
|
|
37
|
+
value?: number;
|
|
38
|
+
children?: TreeNode[];
|
|
39
|
+
}
|
|
40
|
+
export interface ULTreemapChartProps extends ChartBaseProps {
|
|
41
|
+
/** Tree ({ name, value?, children? }). */ data: TreeNode;
|
|
42
|
+
/** Controlled drill path (names from the root). */
|
|
43
|
+
path?: string[]; /** Called with the drill-in path (names) when the user drills in or out. */
|
|
44
|
+
onPathChange?: (path: string[]) => void;
|
|
45
|
+
}
|
|
46
|
+
export interface Tile {
|
|
47
|
+
i: number;
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
w: number;
|
|
51
|
+
h: number;
|
|
52
|
+
node: TreeNode;
|
|
53
|
+
value: number;
|
|
54
|
+
}
|
|
55
|
+
/** Squarified treemap (Bruls et al.). Items sorted by value desc; returns rects in the given box. */
|
|
56
|
+
export declare function squarify(items: {
|
|
57
|
+
value: number;
|
|
58
|
+
}[], x: number, y: number, w: number, h: number): {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
w: number;
|
|
62
|
+
h: number;
|
|
63
|
+
}[];
|
|
64
|
+
export declare function ULTreemapChart(props: ULTreemapChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULHeatmapChart (matrix with row / column labels) and ULCalendarHeatmap (days × weekdays). Quantised colour-blind-safe
|
|
3
|
+
* scales (sequential / diverging) with a legend and numeric labels; cell labels pick dark / light ink per step.
|
|
4
|
+
* Hover = ONE shared indicator element (never per-cell glass); grid keyboard navigation; table view.
|
|
5
|
+
*/
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { type ChartBaseProps, type ColorScheme } from './nav.js';
|
|
8
|
+
import './charts-adv.css';
|
|
9
|
+
export interface ULHeatmapChartProps<T = Record<string, unknown>> extends ChartBaseProps {
|
|
10
|
+
/** Rows. */ data: T[];
|
|
11
|
+
/** Row accessor (d, i) => string. */ row: (d: T, i: number) => string;
|
|
12
|
+
/** Column accessor (d, i) => string. */ col: (d: T, i: number) => string;
|
|
13
|
+
/** Cell value accessor; null = empty cell. */ value: (d: T, i: number) => number | null | undefined;
|
|
14
|
+
/** Explicit orders (default: first appearance). */
|
|
15
|
+
rows?: string[]; /** Column order (default: first appearance). */
|
|
16
|
+
cols?: string[];
|
|
17
|
+
/** Colour scale: "sequential" (default) | "diverging" (--ul-chart-seq-* / --ul-chart-div-*). */ scheme?: ColorScheme; /** Value domain [min, max] of the colour scale. Default: data extent. */
|
|
18
|
+
domain?: [number, number]; /** Midpoint of a diverging scale. Default 0. */
|
|
19
|
+
mid?: number;
|
|
20
|
+
/** Numbers inside cells: auto = when the cell is ≥ 30 × 18 px. */
|
|
21
|
+
labels?: 'auto' | 'on' | 'off';
|
|
22
|
+
/** Cell height in px. */ cellHeight?: number;
|
|
23
|
+
/** Legend title. */
|
|
24
|
+
scaleLabel?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function ULHeatmapChart<T>(props: ULHeatmapChartProps<T>): React.JSX.Element;
|
|
27
|
+
export interface ULCalendarHeatmapProps<T = Record<string, unknown>> extends ChartBaseProps {
|
|
28
|
+
/** Rows. */ data: T[];
|
|
29
|
+
/** Date accessor (d, i) => Date | ISO string. */ date: (d: T, i: number) => Date | string | number;
|
|
30
|
+
/** Value accessor; null = no data. */ value: (d: T, i: number) => number | null | undefined;
|
|
31
|
+
/** First day shown. Default: first date in data. */ from?: Date; /** Last day shown. Default: last date in data. */
|
|
32
|
+
to?: Date;
|
|
33
|
+
/** Colour scale: "sequential" (default) | "diverging" (--ul-chart-seq-* / --ul-chart-div-*). */ scheme?: ColorScheme; /** Value domain [min, max] of the colour scale. Default: data extent. */
|
|
34
|
+
domain?: [number, number]; /** Midpoint of a diverging scale. Default 0. */
|
|
35
|
+
mid?: number;
|
|
36
|
+
/** Accessible label of the colour legend. */ scaleLabel?: string;
|
|
37
|
+
/** Max cell size in px. Default 16. */
|
|
38
|
+
cell?: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function ULCalendarHeatmap<T>(props: ULCalendarHeatmapProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULRadarChart: multi-series polygons over shared axes (one data row per axis, series like ULCartesianChart).
|
|
3
|
+
* Axis labels are HTML (wrap to two lines, then ellipsis; the full name is in the axis tooltip) so they never clip at 375px.
|
|
4
|
+
* Keyboard: ← → axes, ↑ ↓ series, Enter pin, Esc unpin. Legend toggles series; patterns / dash per policy; table view.
|
|
5
|
+
*/
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import type { ChartSeriesDef } from './ULCartesianChart.js';
|
|
8
|
+
import { type ChartBaseProps } from './nav.js';
|
|
9
|
+
import './charts-adv.css';
|
|
10
|
+
export interface ULRadarChartProps<T = Record<string, unknown>> extends ChartBaseProps {
|
|
11
|
+
/** One row per axis. */
|
|
12
|
+
data: T[];
|
|
13
|
+
/** Axis name accessor (d, i) => string (one row per axis). */ axis: (d: T, i: number) => string;
|
|
14
|
+
/** Series definitions ({ key, name, value, color?, dash? }). */ series: Pick<ChartSeriesDef<T>, 'key' | 'name' | 'value' | 'slot'>[];
|
|
15
|
+
/** Outer ring value. Default: nice max of the data. */
|
|
16
|
+
max?: number;
|
|
17
|
+
/** Number of grid rings. Default 4. */ rings?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function ULRadarChart<T>(props: ULRadarChartProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULRadialChart (progress ring group) and ULGaugeChart (semi-circle gauge) on the shared chart core.
|
|
3
|
+
* Rings: concentric tracks, rounded caps with the glossy end cap (same .ul-gloss-cap as ULProgress), centre slot,
|
|
4
|
+
* draw-in once, morph on real change. Gauge: threshold bands, fill or needle, min / max / target labels, comparison
|
|
5
|
+
* marker, role="meter" text value.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import type { ChartTone } from './ULCartesianChart.js';
|
|
9
|
+
import { type ChartBaseProps } from './nav.js';
|
|
10
|
+
import './charts-adv.css';
|
|
11
|
+
export interface ULRadialChartProps<T = Record<string, unknown>> extends ChartBaseProps {
|
|
12
|
+
/** Rows. */ data: T[];
|
|
13
|
+
/** Category label accessor (d, i) => string. */ label: (d: T, i: number) => string;
|
|
14
|
+
/** Value accessor (d, i) => number. */ value: (d: T, i: number) => number;
|
|
15
|
+
/** Full-ring value per item (number or accessor). Default 100. */
|
|
16
|
+
max?: number | ((d: T, i: number) => number);
|
|
17
|
+
/** Sweep in degrees (90–360). Default 270 (open at the bottom). */
|
|
18
|
+
sweep?: number;
|
|
19
|
+
/** Centre slot (e.g. <ULRollingNumber>). Default: the first ring's share. */
|
|
20
|
+
center?: React.ReactNode;
|
|
21
|
+
/** Content in the centre (e.g. a ULRollingNumber total). */ centerLabel?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare function ULRadialChart<T>(props: ULRadialChartProps<T>): React.JSX.Element;
|
|
24
|
+
export interface GaugeThreshold {
|
|
25
|
+
to: number;
|
|
26
|
+
tone: ChartTone;
|
|
27
|
+
label?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ULGaugeChartProps extends ChartBaseProps {
|
|
30
|
+
/** Current value; null = empty state. */ value: number | null;
|
|
31
|
+
/** Scale minimum. */ min?: number; /** Scale maximum. */
|
|
32
|
+
max?: number;
|
|
33
|
+
/** Bands ({ to, tone, label? }) from min to max. */ thresholds?: GaugeThreshold[];
|
|
34
|
+
/** Target marker value. */ target?: number; /** Label of the target marker. */
|
|
35
|
+
targetLabel?: string;
|
|
36
|
+
/** Comparison marker (e.g. last period). */
|
|
37
|
+
compare?: {
|
|
38
|
+
value: number;
|
|
39
|
+
label?: string;
|
|
40
|
+
};
|
|
41
|
+
/** 'fill' (default): the value arc fills in the band colour. 'needle': a needle over the bands. */
|
|
42
|
+
mode?: 'fill' | 'needle';
|
|
43
|
+
/** Name of the measured quantity (meter label). Default: the title. */
|
|
44
|
+
label?: string;
|
|
45
|
+
/** Centre content (e.g. <ULRollingNumber>). Default: the formatted value. */
|
|
46
|
+
center?: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
export declare function ULGaugeChart(props: ULGaugeChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ULScatterChart (scatter + bubble). Numeric x / y, optional size (sqrt area scale with a size legend), series by colour
|
|
3
|
+
* AND shape (circle, square, triangle, diamond), linear trend per series, nearest point through a quadtree (no per-point
|
|
4
|
+
* listeners), keyboard nearest-neighbour walk, rect brush that emits the selected points (Esc cancels / clears).
|
|
5
|
+
*/
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { type ChartBaseProps } from './nav.js';
|
|
8
|
+
import './charts-adv.css';
|
|
9
|
+
export { shapePath, SCATTER_SHAPES } from './scales.js';
|
|
10
|
+
export type { ScatterShape } from './scales.js';
|
|
11
|
+
export interface ULScatterChartProps<T = Record<string, unknown>> extends ChartBaseProps {
|
|
12
|
+
/** Rows. */ data: T[];
|
|
13
|
+
/** X accessor (d, i). */ x: (d: T, i: number) => number;
|
|
14
|
+
/** Y accessor (d, i) => number. */ y: (d: T, i: number) => number;
|
|
15
|
+
/** Bubble size value (area-proportional). Omit for a plain scatter. */
|
|
16
|
+
size?: (d: T, i: number) => number;
|
|
17
|
+
/** Series name per point (colour + shape). Default: one series. */
|
|
18
|
+
group?: (d: T, i: number) => string;
|
|
19
|
+
/** Point label for the tooltip / table. */
|
|
20
|
+
pointLabel?: (d: T, i: number) => string;
|
|
21
|
+
/** Axis options per axis ({ x?, y? }: label, ticks, min, max, format). */ axes?: {
|
|
22
|
+
x?: {
|
|
23
|
+
label?: string;
|
|
24
|
+
format?: (v: number) => string;
|
|
25
|
+
min?: number;
|
|
26
|
+
max?: number;
|
|
27
|
+
};
|
|
28
|
+
y?: {
|
|
29
|
+
label?: string;
|
|
30
|
+
format?: (v: number) => string;
|
|
31
|
+
min?: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
};
|
|
34
|
+
size?: {
|
|
35
|
+
label?: string;
|
|
36
|
+
format?: (v: number) => string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/** Least-squares trend line per series. */
|
|
40
|
+
trend?: boolean;
|
|
41
|
+
/** Rect brush; onSelect receives the selected rows (empty = cleared). */
|
|
42
|
+
brush?: boolean;
|
|
43
|
+
/** Called with the rows and indices inside a brush selection. */ onSelect?: (rows: T[], indices: number[]) => void;
|
|
44
|
+
/** Bubble radius range in px. Default [4, 18] (bubble) / 4.5 (scatter). */
|
|
45
|
+
radius?: [number, number];
|
|
46
|
+
/** auto (default): canvas above --ul-chart-canvas-at points (same tooltip, keyboard, brush, shapes, table and context menu). */
|
|
47
|
+
renderer?: 'auto' | 'svg' | 'canvas';
|
|
48
|
+
}
|
|
49
|
+
export declare function ULScatterChart<T>(props: ULScatterChartProps<T>): React.JSX.Element;
|