@boost33/ui 0.8.0 → 0.9.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/CHANGELOG.md +214 -123
- package/dist/backdrop-icons.d.ts +53 -0
- package/dist/backdrop-icons.js +62 -0
- package/dist/backdrop-icons.js.map +1 -0
- package/dist/backdrop.css +1 -0
- package/dist/backdrop.d.ts +46 -0
- package/dist/backdrop.js +127 -0
- package/dist/backdrop.js.map +1 -0
- package/dist/components/AccountMenu/AccountMenu.d.ts +42 -32
- package/dist/components/AccountMenu/AccountMenu.js +66 -48
- package/dist/components/AccountMenu/AccountMenu.js.map +1 -1
- package/dist/components/AccountMenu/AccountMenu.module.css.js +44 -38
- package/dist/components/AccountMenu/AccountMenu.module.css.js.map +1 -1
- package/dist/components/AccountMenu/StandardAccountMenu.d.ts +87 -0
- package/dist/components/AccountMenu/StandardAccountMenu.js +86 -0
- package/dist/components/AccountMenu/StandardAccountMenu.js.map +1 -0
- package/dist/components/AccountMenu/icons.d.ts +2 -2
- package/dist/components/AccountMenu/icons.js +21 -8
- package/dist/components/AccountMenu/icons.js.map +1 -1
- package/dist/components/AccountMenu/initials.d.ts +11 -0
- package/dist/components/AccountMenu/initials.js +8 -0
- package/dist/components/AccountMenu/initials.js.map +1 -0
- package/dist/components/AccountMenu/labels.d.ts +64 -3
- package/dist/components/AccountMenu/labels.js +33 -5
- package/dist/components/AccountMenu/labels.js.map +1 -1
- package/dist/components/AccountMenu/use-menu.d.ts +34 -0
- package/dist/components/AccountMenu/use-menu.js +102 -0
- package/dist/components/AccountMenu/use-menu.js.map +1 -0
- package/dist/components/Backdrop/BackdropAppMenu.d.ts +55 -0
- package/dist/components/Backdrop/BackdropAppMenu.js +79 -0
- package/dist/components/Backdrop/BackdropAppMenu.js.map +1 -0
- package/dist/components/Backdrop/BackdropAppMenu.module.css.js +48 -0
- package/dist/components/Backdrop/BackdropAppMenu.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropBasics.d.ts +129 -0
- package/dist/components/Backdrop/BackdropBasics.js +130 -0
- package/dist/components/Backdrop/BackdropBasics.js.map +1 -0
- package/dist/components/Backdrop/BackdropBasics.module.css.js +71 -0
- package/dist/components/Backdrop/BackdropBasics.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropButton.d.ts +63 -0
- package/dist/components/Backdrop/BackdropButton.js +59 -0
- package/dist/components/Backdrop/BackdropButton.js.map +1 -0
- package/dist/components/Backdrop/BackdropButton.module.css.js +41 -0
- package/dist/components/Backdrop/BackdropButton.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropCharts.d.ts +158 -0
- package/dist/components/Backdrop/BackdropCharts.js +222 -0
- package/dist/components/Backdrop/BackdropCharts.js.map +1 -0
- package/dist/components/Backdrop/BackdropCharts.module.css.js +109 -0
- package/dist/components/Backdrop/BackdropCharts.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropChrome.d.ts +26 -0
- package/dist/components/Backdrop/BackdropChrome.js +35 -0
- package/dist/components/Backdrop/BackdropChrome.js.map +1 -0
- package/dist/components/Backdrop/BackdropConversation.d.ts +67 -0
- package/dist/components/Backdrop/BackdropConversation.js +76 -0
- package/dist/components/Backdrop/BackdropConversation.js.map +1 -0
- package/dist/components/Backdrop/BackdropConversation.module.css.js +44 -0
- package/dist/components/Backdrop/BackdropConversation.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropData.d.ts +195 -0
- package/dist/components/Backdrop/BackdropData.js +204 -0
- package/dist/components/Backdrop/BackdropData.js.map +1 -0
- package/dist/components/Backdrop/BackdropData.module.css.js +135 -0
- package/dist/components/Backdrop/BackdropData.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropDisplay.d.ts +122 -0
- package/dist/components/Backdrop/BackdropDisplay.js +80 -0
- package/dist/components/Backdrop/BackdropDisplay.js.map +1 -0
- package/dist/components/Backdrop/BackdropDisplay.module.css.js +80 -0
- package/dist/components/Backdrop/BackdropDisplay.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropFields.d.ts +122 -0
- package/dist/components/Backdrop/BackdropFields.js +196 -0
- package/dist/components/Backdrop/BackdropFields.js.map +1 -0
- package/dist/components/Backdrop/BackdropFields.module.css.js +104 -0
- package/dist/components/Backdrop/BackdropFields.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropFlows.d.ts +128 -0
- package/dist/components/Backdrop/BackdropFlows.js +156 -0
- package/dist/components/Backdrop/BackdropFlows.js.map +1 -0
- package/dist/components/Backdrop/BackdropFlows.module.css.js +80 -0
- package/dist/components/Backdrop/BackdropFlows.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropFrame.d.ts +36 -0
- package/dist/components/Backdrop/BackdropFrame.js +15 -0
- package/dist/components/Backdrop/BackdropFrame.js.map +1 -0
- package/dist/components/Backdrop/BackdropFrame.module.css.js +14 -0
- package/dist/components/Backdrop/BackdropFrame.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropGlobalPanels.d.ts +272 -0
- package/dist/components/Backdrop/BackdropGlobalPanels.js +264 -0
- package/dist/components/Backdrop/BackdropGlobalPanels.js.map +1 -0
- package/dist/components/Backdrop/BackdropGlobalPanels.module.css.js +201 -0
- package/dist/components/Backdrop/BackdropGlobalPanels.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropHub.d.ts +80 -0
- package/dist/components/Backdrop/BackdropHub.js +92 -0
- package/dist/components/Backdrop/BackdropHub.js.map +1 -0
- package/dist/components/Backdrop/BackdropHub.module.css.js +40 -0
- package/dist/components/Backdrop/BackdropHub.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropLists.d.ts +165 -0
- package/dist/components/Backdrop/BackdropLists.js +162 -0
- package/dist/components/Backdrop/BackdropLists.js.map +1 -0
- package/dist/components/Backdrop/BackdropLists.module.css.js +114 -0
- package/dist/components/Backdrop/BackdropLists.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropOverlays.d.ts +175 -0
- package/dist/components/Backdrop/BackdropOverlays.js +252 -0
- package/dist/components/Backdrop/BackdropOverlays.js.map +1 -0
- package/dist/components/Backdrop/BackdropOverlays.module.css.js +104 -0
- package/dist/components/Backdrop/BackdropOverlays.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropPage.d.ts +73 -0
- package/dist/components/Backdrop/BackdropPage.js +65 -0
- package/dist/components/Backdrop/BackdropPage.js.map +1 -0
- package/dist/components/Backdrop/BackdropPage.module.css.js +46 -0
- package/dist/components/Backdrop/BackdropPage.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropPatterns.d.ts +224 -0
- package/dist/components/Backdrop/BackdropPatterns.js +202 -0
- package/dist/components/Backdrop/BackdropPatterns.js.map +1 -0
- package/dist/components/Backdrop/BackdropPatterns.module.css.js +114 -0
- package/dist/components/Backdrop/BackdropPatterns.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropRail.d.ts +63 -0
- package/dist/components/Backdrop/BackdropRail.js +98 -0
- package/dist/components/Backdrop/BackdropRail.js.map +1 -0
- package/dist/components/Backdrop/BackdropRail.module.css.js +42 -0
- package/dist/components/Backdrop/BackdropRail.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropSheets.d.ts +68 -0
- package/dist/components/Backdrop/BackdropSheets.js +75 -0
- package/dist/components/Backdrop/BackdropSheets.js.map +1 -0
- package/dist/components/Backdrop/BackdropSheets.module.css.js +42 -0
- package/dist/components/Backdrop/BackdropSheets.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropTabs.d.ts +20 -0
- package/dist/components/Backdrop/BackdropTabs.js +31 -0
- package/dist/components/Backdrop/BackdropTabs.js.map +1 -0
- package/dist/components/Backdrop/BackdropTabs.module.css.js +16 -0
- package/dist/components/Backdrop/BackdropTabs.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropTooltip.d.ts +21 -0
- package/dist/components/Backdrop/BackdropTooltip.js +15 -0
- package/dist/components/Backdrop/BackdropTooltip.js.map +1 -0
- package/dist/components/Backdrop/BackdropTooltip.module.css.js +18 -0
- package/dist/components/Backdrop/BackdropTooltip.module.css.js.map +1 -0
- package/dist/components/Backdrop/BackdropTopStrip.d.ts +65 -0
- package/dist/components/Backdrop/BackdropTopStrip.js +46 -0
- package/dist/components/Backdrop/BackdropTopStrip.js.map +1 -0
- package/dist/components/Backdrop/BackdropTopStrip.module.css.js +40 -0
- package/dist/components/Backdrop/BackdropTopStrip.module.css.js.map +1 -0
- package/dist/components/Backdrop/cx.d.ts +2 -0
- package/dist/components/Backdrop/cx.js +7 -0
- package/dist/components/Backdrop/cx.js.map +1 -0
- package/dist/components/Backdrop/icons.d.ts +70 -0
- package/dist/components/Backdrop/icons.js +103 -0
- package/dist/components/Backdrop/icons.js.map +1 -0
- package/dist/components/TopBar/TopBar.d.ts +8 -1
- package/dist/components/TopBar/TopBar.js +19 -16
- package/dist/components/TopBar/TopBar.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +40 -36
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +23 -4
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ElementType, ReactNode } from 'react';
|
|
2
|
+
import { BackdropPageAction } from './BackdropPage';
|
|
3
|
+
/** `ink` (default) or `success`, where the figure itself is good news. Never orange. */
|
|
4
|
+
export type BackdropChartTone = 'ink' | 'success';
|
|
5
|
+
/** The caption action's button. Outline by default; `primary` only when it is the screen's one orange action. */
|
|
6
|
+
export type BackdropChartActionEmphasis = 'outline' | 'primary';
|
|
7
|
+
/** A y-axis tick: where it sits, and its words ("3,000", "€2,000"). */
|
|
8
|
+
export interface BackdropChartTick {
|
|
9
|
+
value: number;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BackdropBarChartDatum {
|
|
13
|
+
/** The x label's first line, and the table's row header: "Nov", "2 Nov". */
|
|
14
|
+
label: string;
|
|
15
|
+
/** An optional second line under the x label: "43 reached", "2 posts". */
|
|
16
|
+
detail?: string;
|
|
17
|
+
value: number;
|
|
18
|
+
/** The value as written in the table: "2,280". Defaults to the number. */
|
|
19
|
+
valueText?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface BackdropBarChartProps {
|
|
22
|
+
/** The chart's accessible name, and the hidden table's caption: "Views by week". */
|
|
23
|
+
label: string;
|
|
24
|
+
data: BackdropBarChartDatum[];
|
|
25
|
+
/** The hidden table's column headers: the category ("Week") and the figure ("Views"). */
|
|
26
|
+
categoryHeader: string;
|
|
27
|
+
valueHeader: string;
|
|
28
|
+
/**
|
|
29
|
+
* The bar drawn in the strong colour with a bold x label (usually the
|
|
30
|
+
* current period). The others are the tone's pale partner. Leave it out and
|
|
31
|
+
* every bar is the strong colour.
|
|
32
|
+
*/
|
|
33
|
+
highlightIndex?: number;
|
|
34
|
+
tone?: BackdropChartTone;
|
|
35
|
+
/** Y-axis ticks, labelled in a 48 column at the left. Leave out for no axis. */
|
|
36
|
+
yTicks?: BackdropChartTick[];
|
|
37
|
+
/** A gridline at each tick above zero. Default true; needs `yTicks`. */
|
|
38
|
+
gridlines?: boolean;
|
|
39
|
+
/** The value at the top of the plot. Defaults to the highest tick or value. */
|
|
40
|
+
max?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Words beside the plot, level with the top of the highlighted bar: a figure
|
|
43
|
+
* and a line under it ("2 meetings" / "this month"). Pass a node; use
|
|
44
|
+
* `directLabelValue` and `directLabelNote` for the drawn two-line look.
|
|
45
|
+
*/
|
|
46
|
+
directLabel?: ReactNode;
|
|
47
|
+
/** The direct label's figure, 15/20 semibold, in the tone's text colour. */
|
|
48
|
+
directLabelValue?: ReactNode;
|
|
49
|
+
/** The direct label's second line, 13/18 muted. */
|
|
50
|
+
directLabelNote?: ReactNode;
|
|
51
|
+
/** A sentence under the chart, after a hairline. */
|
|
52
|
+
caption?: ReactNode;
|
|
53
|
+
/** One action at the caption's end. */
|
|
54
|
+
action?: BackdropPageAction;
|
|
55
|
+
/** The action's button: `outline` (default) or `primary` when it is the screen's one orange action. */
|
|
56
|
+
actionEmphasis?: BackdropChartActionEmphasis;
|
|
57
|
+
linkComponent?: ElementType;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Single-series vertical bars over time. Fluid width; the plot height is fixed
|
|
62
|
+
* (`--backdrop-chart-bar-plot-height`). Bars grow up from a baseline in equal
|
|
63
|
+
* slots, at most 56 wide.
|
|
64
|
+
*/
|
|
65
|
+
export declare function BackdropBarChart({ label, data, categoryHeader, valueHeader, highlightIndex, tone, yTicks, gridlines, max, directLabel, directLabelValue, directLabelNote, caption, action, actionEmphasis, linkComponent, className, }: BackdropBarChartProps): import("react").JSX.Element;
|
|
66
|
+
export interface BackdropBarListItem {
|
|
67
|
+
key: string;
|
|
68
|
+
/** The row's name: "Outbound", "Needs found". */
|
|
69
|
+
label: ReactNode;
|
|
70
|
+
value: number;
|
|
71
|
+
/** The figure at the row's end: "1,429". Defaults to the number. */
|
|
72
|
+
valueText?: ReactNode;
|
|
73
|
+
/** A 24px mark or icon before the label. Decorative: the label names the row. */
|
|
74
|
+
leading?: ReactNode;
|
|
75
|
+
/** The fill's tone. `success` for stages that are themselves the good outcome. */
|
|
76
|
+
tone?: BackdropChartTone;
|
|
77
|
+
/**
|
|
78
|
+
* Words in place of the bar, for a row with nothing to draw ("Free"). The
|
|
79
|
+
* row's figure turns muted with it.
|
|
80
|
+
*/
|
|
81
|
+
note?: ReactNode;
|
|
82
|
+
}
|
|
83
|
+
export interface BackdropBarListProps {
|
|
84
|
+
/** The list's accessible name: "Where it goes", "From need to paid". */
|
|
85
|
+
label: string;
|
|
86
|
+
items: BackdropBarListItem[];
|
|
87
|
+
/** The value a full bar stands for. Defaults to the largest item. */
|
|
88
|
+
max?: number;
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Rows of label · bar · figure, the bar proportional to the figure. The
|
|
93
|
+
* label and figure columns size to their widest row so every bar starts and
|
|
94
|
+
* ends on one line. The bar is BackdropProgress's track and fill (the same
|
|
95
|
+
* drawing as BackdropMeter `look="bar"`), at the list's 8px height. Each row
|
|
96
|
+
* reads as its label and figure; the bar is decorative.
|
|
97
|
+
*/
|
|
98
|
+
export declare function BackdropBarList({ label, items, max, className }: BackdropBarListProps): import("react").JSX.Element;
|
|
99
|
+
/** `filled` ink dot, `hollow` ringed dot (a projected or expected end), or `none`. */
|
|
100
|
+
export type BackdropLineChartEnd = 'filled' | 'hollow' | 'none';
|
|
101
|
+
export interface BackdropLineChartPoint {
|
|
102
|
+
/** The table's row header: "25 Aug", "14 Nov". */
|
|
103
|
+
label: string;
|
|
104
|
+
/** The main series. `null` leaves a gap. */
|
|
105
|
+
value: number | null;
|
|
106
|
+
/** The value as written in the table. Defaults to the number. */
|
|
107
|
+
valueText?: string;
|
|
108
|
+
/** The muted comparison series at this point. `null` or absent leaves a gap. */
|
|
109
|
+
comparison?: number | null;
|
|
110
|
+
comparisonText?: string;
|
|
111
|
+
/** A label under the x axis at this point. Points without one show none. */
|
|
112
|
+
axisLabel?: ReactNode;
|
|
113
|
+
/** Sets this point's axis label in ink and semibold. */
|
|
114
|
+
axisLabelStrong?: boolean;
|
|
115
|
+
}
|
|
116
|
+
export interface BackdropLineChartMarker {
|
|
117
|
+
/** The point the vertical rule stands on. A filled dot marks the value there. */
|
|
118
|
+
index: number;
|
|
119
|
+
/** Words at the top of the rule, to its right: "Today · 1,240". */
|
|
120
|
+
label?: ReactNode;
|
|
121
|
+
}
|
|
122
|
+
export interface BackdropLineChartProps {
|
|
123
|
+
/** The chart's accessible name and the hidden table's caption. */
|
|
124
|
+
label: string;
|
|
125
|
+
data: BackdropLineChartPoint[];
|
|
126
|
+
/** The hidden table's headers: the category ("Week") and each series' name. */
|
|
127
|
+
categoryHeader: string;
|
|
128
|
+
seriesName: string;
|
|
129
|
+
/** Name of the comparison series. Required for it to appear in the table. */
|
|
130
|
+
comparisonName?: string;
|
|
131
|
+
/** Y-axis ticks in a 48 column at the left. Leave out for no axis. */
|
|
132
|
+
yTicks?: BackdropChartTick[];
|
|
133
|
+
/** A gridline at each tick above zero. Default true; needs `yTicks`. */
|
|
134
|
+
gridlines?: boolean;
|
|
135
|
+
max?: number;
|
|
136
|
+
/** From this index on, the main line is dashed (a projection). */
|
|
137
|
+
dashedFrom?: number;
|
|
138
|
+
/** Fill the area under the solid part of the main line. */
|
|
139
|
+
area?: boolean;
|
|
140
|
+
marker?: BackdropLineChartMarker;
|
|
141
|
+
/** The main series' last point. Default `none`. */
|
|
142
|
+
end?: BackdropLineChartEnd;
|
|
143
|
+
/** The comparison series' last point. Default `none`. */
|
|
144
|
+
comparisonEnd?: BackdropLineChartEnd;
|
|
145
|
+
caption?: ReactNode;
|
|
146
|
+
action?: BackdropPageAction;
|
|
147
|
+
/** The action's button: `outline` (default) or `primary` when it is the screen's one orange action. */
|
|
148
|
+
actionEmphasis?: BackdropChartActionEmphasis;
|
|
149
|
+
linkComponent?: ElementType;
|
|
150
|
+
className?: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A line over time, with up to one muted comparison line. Generic parts only:
|
|
154
|
+
* a dashed segment from an index on, an area under the line, a vertical
|
|
155
|
+
* marker with a label slot, and filled or hollow end points. What the line
|
|
156
|
+
* means, and any zone or event drawn on it, is the product's.
|
|
157
|
+
*/
|
|
158
|
+
export declare function BackdropLineChart({ label, data, categoryHeader, seriesName, comparisonName, yTicks, gridlines, max, dashedFrom, area, marker, end, comparisonEnd, caption, action, actionEmphasis, linkComponent, className, }: BackdropLineChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { jsxs as h, jsx as e, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import l from "./BackdropCharts.module.css.js";
|
|
3
|
+
import q from "./BackdropGlobalPanels.module.css.js";
|
|
4
|
+
import { cx as u } from "./cx.js";
|
|
5
|
+
import { BackdropButton as ll } from "./BackdropButton.js";
|
|
6
|
+
function w(a, n) {
|
|
7
|
+
return n > 0 ? Math.max(0, Math.min(1, a / n)) : 0;
|
|
8
|
+
}
|
|
9
|
+
function b(a) {
|
|
10
|
+
return `${Math.round(a * 1e4) / 100}%`;
|
|
11
|
+
}
|
|
12
|
+
function K(a, n, i) {
|
|
13
|
+
if (i !== void 0 && i > 0) return i;
|
|
14
|
+
const d = Math.max(0, ...a, ...(n ?? []).map((o) => o.value));
|
|
15
|
+
return d > 0 ? d : 1;
|
|
16
|
+
}
|
|
17
|
+
function E({ ticks: a, max: n }) {
|
|
18
|
+
return /* @__PURE__ */ e("div", { className: l.axis, "aria-hidden": "true", children: a.map((i) => /* @__PURE__ */ e("span", { className: l.tick, style: { bottom: b(w(i.value, n)) }, children: i.label }, i.value)) });
|
|
19
|
+
}
|
|
20
|
+
function F({ ticks: a, max: n }) {
|
|
21
|
+
return /* @__PURE__ */ e(_, { children: a.filter((i) => i.value > 0).map((i) => /* @__PURE__ */ e("span", { className: l.gridline, style: { bottom: b(w(i.value, n)) } }, i.value)) });
|
|
22
|
+
}
|
|
23
|
+
function I({ caption: a, action: n, actionEmphasis: i = "outline", linkComponent: d }) {
|
|
24
|
+
return a == null && n === void 0 ? null : /* @__PURE__ */ h("div", { className: l.caption, children: [
|
|
25
|
+
a != null && /* @__PURE__ */ e("p", { className: l.captionText, children: a }),
|
|
26
|
+
n && /* @__PURE__ */ e(ll, { variant: i, size: "lg", href: n.href, linkComponent: d, onClick: n.onClick, className: l.captionAction, children: n.label })
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
function rl({
|
|
30
|
+
label: a,
|
|
31
|
+
data: n,
|
|
32
|
+
categoryHeader: i,
|
|
33
|
+
valueHeader: d,
|
|
34
|
+
highlightIndex: o,
|
|
35
|
+
tone: c = "ink",
|
|
36
|
+
yTicks: s,
|
|
37
|
+
gridlines: C = !0,
|
|
38
|
+
max: y,
|
|
39
|
+
directLabel: P,
|
|
40
|
+
directLabelValue: p,
|
|
41
|
+
directLabelNote: M,
|
|
42
|
+
caption: A,
|
|
43
|
+
action: R,
|
|
44
|
+
actionEmphasis: V,
|
|
45
|
+
linkComponent: z,
|
|
46
|
+
className: G
|
|
47
|
+
}) {
|
|
48
|
+
const S = K(
|
|
49
|
+
n.map((t) => t.value),
|
|
50
|
+
s,
|
|
51
|
+
y
|
|
52
|
+
), f = s !== void 0 && s.length > 0, v = o !== void 0 && o >= 0 && o < n.length ? o : void 0, N = v ?? n.length - 1, g = N >= 0 && n[N] ? w(n[N].value, S) : 0, L = P ?? (p != null || M != null ? /* @__PURE__ */ h(_, { children: [
|
|
53
|
+
p != null && /* @__PURE__ */ e("span", { className: l.directValue, children: p }),
|
|
54
|
+
M != null && /* @__PURE__ */ e("span", { className: l.directNote, children: M })
|
|
55
|
+
] }) : void 0);
|
|
56
|
+
return /* @__PURE__ */ h("figure", { className: u(l.chart, l[`tone-${c}`], G), "aria-label": a, "data-tone": c, children: [
|
|
57
|
+
/* @__PURE__ */ h("div", { className: u(l.frame, f && l.withAxis, L !== void 0 && l.withDirect), children: [
|
|
58
|
+
f && /* @__PURE__ */ e(E, { ticks: s, max: S }),
|
|
59
|
+
/* @__PURE__ */ h("div", { className: u(l.plot, l.barPlot), "aria-hidden": "true", children: [
|
|
60
|
+
f && C && /* @__PURE__ */ e(F, { ticks: s, max: S }),
|
|
61
|
+
/* @__PURE__ */ e("div", { className: l.bars, children: n.map((t, m) => /* @__PURE__ */ e("span", { className: l.slot, children: /* @__PURE__ */ e(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
className: u(l.bar, v === void 0 || m === v ? l.barStrong : l.barMuted),
|
|
65
|
+
"data-highlighted": m === v || void 0,
|
|
66
|
+
style: { height: b(w(t.value, S)) }
|
|
67
|
+
}
|
|
68
|
+
) }, `${t.label}-${m}`)) }),
|
|
69
|
+
/* @__PURE__ */ e("span", { className: l.baseline })
|
|
70
|
+
] }),
|
|
71
|
+
L !== void 0 && /* @__PURE__ */ e("div", { className: l.directColumn, children: /* @__PURE__ */ e("div", { className: l.direct, style: { top: b(1 - g) }, children: L }) }),
|
|
72
|
+
/* @__PURE__ */ e("div", { className: l.xLabels, "aria-hidden": "true", children: n.map((t, m) => /* @__PURE__ */ h("span", { className: u(l.xLabel, m === v && l.xLabelStrong), children: [
|
|
73
|
+
/* @__PURE__ */ e("span", { className: l.xPrimary, children: t.label }),
|
|
74
|
+
t.detail != null && /* @__PURE__ */ e("span", { className: l.xDetail, children: t.detail })
|
|
75
|
+
] }, `${t.label}-${m}`)) })
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ e("div", { className: l.srOnly, children: /* @__PURE__ */ h("table", { children: [
|
|
78
|
+
/* @__PURE__ */ e("caption", { children: a }),
|
|
79
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ h("tr", { children: [
|
|
80
|
+
/* @__PURE__ */ e("th", { scope: "col", children: i }),
|
|
81
|
+
/* @__PURE__ */ e("th", { scope: "col", children: d })
|
|
82
|
+
] }) }),
|
|
83
|
+
/* @__PURE__ */ e("tbody", { children: n.map((t, m) => /* @__PURE__ */ h("tr", { children: [
|
|
84
|
+
/* @__PURE__ */ e("th", { scope: "row", children: t.detail != null ? `${t.label}, ${t.detail}` : t.label }),
|
|
85
|
+
/* @__PURE__ */ e("td", { children: t.valueText ?? String(t.value) })
|
|
86
|
+
] }, `${t.label}-${m}`)) })
|
|
87
|
+
] }) }),
|
|
88
|
+
/* @__PURE__ */ e(I, { caption: A, action: R, actionEmphasis: V, linkComponent: z })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
function cl({ label: a, items: n, max: i, className: d }) {
|
|
92
|
+
const o = K(
|
|
93
|
+
n.map((s) => s.value),
|
|
94
|
+
void 0,
|
|
95
|
+
i
|
|
96
|
+
), c = n.some((s) => s.leading != null);
|
|
97
|
+
return /* @__PURE__ */ e("ul", { className: u(l.barList, c && l.barListLeading, d), "aria-label": a, children: n.map((s) => /* @__PURE__ */ h("li", { className: l.barRow, "data-tone": s.tone ?? "ink", children: [
|
|
98
|
+
c && /* @__PURE__ */ e("span", { className: l.barLeading, "aria-hidden": "true", children: s.leading }),
|
|
99
|
+
/* @__PURE__ */ e("span", { className: l.barLabel, children: s.label }),
|
|
100
|
+
s.note != null ? /* @__PURE__ */ e("span", { className: l.barNote, children: s.note }) : /* @__PURE__ */ e("span", { className: u(q.track, l.barTrack, s.tone === "success" && q["tone-success"]), "aria-hidden": "true", children: /* @__PURE__ */ e("span", { className: q.fillBar, style: { width: b(w(s.value, o)) } }) }),
|
|
101
|
+
/* @__PURE__ */ e("span", { className: u(l.barValue, s.note != null && l.barValueMuted), children: s.valueText ?? String(s.value) })
|
|
102
|
+
] }, s.key)) });
|
|
103
|
+
}
|
|
104
|
+
function O(a, n) {
|
|
105
|
+
return n > 1 ? a / (n - 1) * 100 : 50;
|
|
106
|
+
}
|
|
107
|
+
function J(a, n, i = 0, d = a.length - 1) {
|
|
108
|
+
const o = [];
|
|
109
|
+
let c = [];
|
|
110
|
+
for (let s = i; s <= d; s++) {
|
|
111
|
+
const C = a[s];
|
|
112
|
+
if (C == null) {
|
|
113
|
+
c.length && o.push(c), c = [];
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
c.push({ x: O(s, a.length), y: 100 - w(C, n) * 100, i: s });
|
|
117
|
+
}
|
|
118
|
+
return c.length && o.push(c), o;
|
|
119
|
+
}
|
|
120
|
+
function k(a) {
|
|
121
|
+
return a.map((n) => n.map((i, d) => `${d === 0 ? "M" : "L"}${D(i.x)} ${D(i.y)}`).join(" ")).join(" ");
|
|
122
|
+
}
|
|
123
|
+
function el(a) {
|
|
124
|
+
return a.filter((n) => n.length > 1).map((n) => {
|
|
125
|
+
var o, c;
|
|
126
|
+
const i = ((o = n[0]) == null ? void 0 : o.x) ?? 0, d = ((c = n[n.length - 1]) == null ? void 0 : c.x) ?? i;
|
|
127
|
+
return `${k([n])} L${D(d)} 100 L${D(i)} 100 Z`;
|
|
128
|
+
}).join(" ");
|
|
129
|
+
}
|
|
130
|
+
function D(a) {
|
|
131
|
+
return Math.round(a * 100) / 100;
|
|
132
|
+
}
|
|
133
|
+
function Y(a) {
|
|
134
|
+
for (let n = a.length - 1; n >= 0; n--) if (a[n] != null) return n;
|
|
135
|
+
return -1;
|
|
136
|
+
}
|
|
137
|
+
function ol({
|
|
138
|
+
label: a,
|
|
139
|
+
data: n,
|
|
140
|
+
categoryHeader: i,
|
|
141
|
+
seriesName: d,
|
|
142
|
+
comparisonName: o,
|
|
143
|
+
yTicks: c,
|
|
144
|
+
gridlines: s = !0,
|
|
145
|
+
max: C,
|
|
146
|
+
dashedFrom: y,
|
|
147
|
+
area: P = !1,
|
|
148
|
+
marker: p,
|
|
149
|
+
end: M = "none",
|
|
150
|
+
comparisonEnd: A = "none",
|
|
151
|
+
caption: R,
|
|
152
|
+
action: V,
|
|
153
|
+
actionEmphasis: z,
|
|
154
|
+
linkComponent: G,
|
|
155
|
+
className: S
|
|
156
|
+
}) {
|
|
157
|
+
const f = n.map((r) => r.value), v = n.map((r) => r.comparison), N = v.some((r) => r != null), g = K(
|
|
158
|
+
[...f, ...v].filter((r) => r != null),
|
|
159
|
+
c,
|
|
160
|
+
C
|
|
161
|
+
), L = c !== void 0 && c.length > 0, t = n.length, m = y !== void 0 && y >= 0 && y < t - 1 ? y : void 0, j = J(f, g, 0, m ?? t - 1), Q = m !== void 0 ? J(f, g, m, t - 1) : [], B = Y(f), H = Y(v), x = p && p.index >= 0 && p.index < t ? p.index : void 0, U = x !== void 0 ? f[x] : null, Z = (r, $, W, X, T) => /* @__PURE__ */ e(
|
|
162
|
+
"span",
|
|
163
|
+
{
|
|
164
|
+
className: u(l.point, W === "hollow" && l.pointHollow, X === "comparison" && l.pointComparison),
|
|
165
|
+
"data-point": W,
|
|
166
|
+
"data-series": X,
|
|
167
|
+
style: { left: b(O(r, t) / 100), bottom: b(w($, g)) }
|
|
168
|
+
},
|
|
169
|
+
T
|
|
170
|
+
);
|
|
171
|
+
return /* @__PURE__ */ h("figure", { className: u(l.chart, S), "aria-label": a, children: [
|
|
172
|
+
/* @__PURE__ */ h("div", { className: u(l.frame, L && l.withAxis), children: [
|
|
173
|
+
L && /* @__PURE__ */ e(E, { ticks: c, max: g }),
|
|
174
|
+
/* @__PURE__ */ h("div", { className: u(l.plot, l.linePlot), "aria-hidden": "true", children: [
|
|
175
|
+
L && s && /* @__PURE__ */ e(F, { ticks: c, max: g }),
|
|
176
|
+
/* @__PURE__ */ e("span", { className: l.baseline }),
|
|
177
|
+
/* @__PURE__ */ h("svg", { className: l.lines, viewBox: "0 0 100 100", preserveAspectRatio: "none", focusable: "false", children: [
|
|
178
|
+
P && j.length > 0 && /* @__PURE__ */ e("path", { className: l.area, d: el(j) }),
|
|
179
|
+
N && /* @__PURE__ */ e("path", { className: u(l.line, l.lineComparison), d: k(J(v, g)) }),
|
|
180
|
+
j.length > 0 && /* @__PURE__ */ e("path", { className: l.line, d: k(j) }),
|
|
181
|
+
Q.length > 0 && /* @__PURE__ */ e("path", { className: u(l.line, l.lineDashed), d: k(Q) })
|
|
182
|
+
] }),
|
|
183
|
+
x !== void 0 && /* @__PURE__ */ e("span", { className: l.marker, style: { left: b(O(x, t) / 100) }, children: (p == null ? void 0 : p.label) != null && /* @__PURE__ */ e("span", { className: l.markerLabel, children: p.label }) }),
|
|
184
|
+
x !== void 0 && U != null && x !== B && Z(x, U, "filled", "main", "marker"),
|
|
185
|
+
N && A !== "none" && H >= 0 && Z(H, v[H], A, "comparison", "comparison-end"),
|
|
186
|
+
B >= 0 && (M !== "none" || x === B) && Z(B, f[B], M === "hollow" ? "hollow" : "filled", "main", "end")
|
|
187
|
+
] }),
|
|
188
|
+
/* @__PURE__ */ e("div", { className: l.lineLabels, "aria-hidden": "true", children: n.map(
|
|
189
|
+
(r, $) => r.axisLabel == null ? null : /* @__PURE__ */ e(
|
|
190
|
+
"span",
|
|
191
|
+
{
|
|
192
|
+
className: u(l.lineLabel, r.axisLabelStrong && l.lineLabelStrong),
|
|
193
|
+
"data-edge": $ === 0 ? "start" : $ === t - 1 ? "end" : void 0,
|
|
194
|
+
style: { left: b(O($, t) / 100) },
|
|
195
|
+
children: r.axisLabel
|
|
196
|
+
},
|
|
197
|
+
`${r.label}-${$}`
|
|
198
|
+
)
|
|
199
|
+
) })
|
|
200
|
+
] }),
|
|
201
|
+
/* @__PURE__ */ e("div", { className: l.srOnly, children: /* @__PURE__ */ h("table", { children: [
|
|
202
|
+
/* @__PURE__ */ e("caption", { children: a }),
|
|
203
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ h("tr", { children: [
|
|
204
|
+
/* @__PURE__ */ e("th", { scope: "col", children: i }),
|
|
205
|
+
/* @__PURE__ */ e("th", { scope: "col", children: d }),
|
|
206
|
+
N && o !== void 0 && /* @__PURE__ */ e("th", { scope: "col", children: o })
|
|
207
|
+
] }) }),
|
|
208
|
+
/* @__PURE__ */ e("tbody", { children: n.map((r, $) => /* @__PURE__ */ h("tr", { children: [
|
|
209
|
+
/* @__PURE__ */ e("th", { scope: "row", children: r.label }),
|
|
210
|
+
/* @__PURE__ */ e("td", { children: r.value == null ? null : r.valueText ?? String(r.value) }),
|
|
211
|
+
N && o !== void 0 && /* @__PURE__ */ e("td", { children: r.comparison == null ? null : r.comparisonText ?? String(r.comparison) })
|
|
212
|
+
] }, `${r.label}-${$}`)) })
|
|
213
|
+
] }) }),
|
|
214
|
+
/* @__PURE__ */ e(I, { caption: R, action: V, actionEmphasis: z, linkComponent: G })
|
|
215
|
+
] });
|
|
216
|
+
}
|
|
217
|
+
export {
|
|
218
|
+
rl as BackdropBarChart,
|
|
219
|
+
cl as BackdropBarList,
|
|
220
|
+
ol as BackdropLineChart
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=BackdropCharts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackdropCharts.js","sources":["../../../src/components/Backdrop/BackdropCharts.tsx"],"sourcesContent":["import type { ElementType, ReactNode } from 'react'\nimport styles from './BackdropCharts.module.css'\nimport progressStyles from './BackdropGlobalPanels.module.css'\nimport { cx } from './cx'\nimport { BackdropButton } from './BackdropButton'\nimport type { BackdropPageAction } from './BackdropPage'\n\n/*\n * Batch 4 · Charts (N29–N30). A bar chart over time, a list of proportional\n * bars and a line chart, drawn by hand in CSS and inline SVG: the package has\n * no runtime dependencies, so there is no chart library underneath.\n *\n * Stage A: static and presentational. The charts take numbers and words as\n * props and compute geometry only. They fetch nothing, know nothing about\n * dates or what is being counted, and own no event handler: the caption's\n * action takes the package's one action shape ({ label, onClick?, href? }).\n *\n * Accessibility: each chart's drawing is hidden from assistive tech and the\n * same data is given as a visually hidden table named by the chart's label.\n * Colour is never the only signal: the highlighted bar's x label is bold and\n * its value can be labelled directly beside the plot.\n */\n\n/** `ink` (default) or `success`, where the figure itself is good news. Never orange. */\nexport type BackdropChartTone = 'ink' | 'success'\n\n/** The caption action's button. Outline by default; `primary` only when it is the screen's one orange action. */\nexport type BackdropChartActionEmphasis = 'outline' | 'primary'\n\n/** A y-axis tick: where it sits, and its words (\"3,000\", \"€2,000\"). */\nexport interface BackdropChartTick {\n value: number\n label: string\n}\n\n/* ── Shared parts ──────────────────────────────────────────────────────── */\n\nfunction share(value: number, max: number): number {\n return max > 0 ? Math.max(0, Math.min(1, value / max)) : 0\n}\n\nfunction pct(n: number): string {\n return `${Math.round(n * 10000) / 100}%`\n}\n\nfunction scaleMax(values: number[], ticks: BackdropChartTick[] | undefined, max: number | undefined): number {\n if (max !== undefined && max > 0) return max\n const top = Math.max(0, ...values, ...(ticks ?? []).map((t) => t.value))\n return top > 0 ? top : 1\n}\n\n/** The y-axis labels, right-aligned and centred on their gridlines. Decorative: the table carries the figures. */\nfunction Axis({ ticks, max }: { ticks: BackdropChartTick[]; max: number }) {\n return (\n <div className={styles.axis} aria-hidden=\"true\">\n {ticks.map((t) => (\n <span key={t.value} className={styles.tick} style={{ bottom: pct(share(t.value, max)) }}>\n {t.label}\n </span>\n ))}\n </div>\n )\n}\n\n/** Gridlines at each tick except zero, which the baseline draws. */\nfunction Grid({ ticks, max }: { ticks: BackdropChartTick[]; max: number }) {\n return (\n <>\n {ticks\n .filter((t) => t.value > 0)\n .map((t) => (\n <span key={t.value} className={styles.gridline} style={{ bottom: pct(share(t.value, max)) }} />\n ))}\n </>\n )\n}\n\ninterface CaptionProps {\n caption?: ReactNode\n action?: BackdropPageAction\n actionEmphasis?: BackdropChartActionEmphasis\n linkComponent?: ElementType\n}\n\n/**\n * A hairline, a plain sentence about the chart and at most one action. The\n * action is the outline button unless `actionEmphasis=\"primary\"`: a screen has\n * one orange button, and a chart is rarely where it belongs (Batch 4 gate).\n */\nfunction ChartCaption({ caption, action, actionEmphasis = 'outline', linkComponent }: CaptionProps) {\n if (caption == null && action === undefined) return null\n return (\n <div className={styles.caption}>\n {caption != null && <p className={styles.captionText}>{caption}</p>}\n {action && (\n <BackdropButton variant={actionEmphasis} size=\"lg\" href={action.href} linkComponent={linkComponent} onClick={action.onClick} className={styles.captionAction}>\n {action.label}\n </BackdropButton>\n )}\n </div>\n )\n}\n\n/* ── Bar chart (N29a) ──────────────────────────────────────────────────── */\n\nexport interface BackdropBarChartDatum {\n /** The x label's first line, and the table's row header: \"Nov\", \"2 Nov\". */\n label: string\n /** An optional second line under the x label: \"43 reached\", \"2 posts\". */\n detail?: string\n value: number\n /** The value as written in the table: \"2,280\". Defaults to the number. */\n valueText?: string\n}\n\nexport interface BackdropBarChartProps {\n /** The chart's accessible name, and the hidden table's caption: \"Views by week\". */\n label: string\n data: BackdropBarChartDatum[]\n /** The hidden table's column headers: the category (\"Week\") and the figure (\"Views\"). */\n categoryHeader: string\n valueHeader: string\n /**\n * The bar drawn in the strong colour with a bold x label (usually the\n * current period). The others are the tone's pale partner. Leave it out and\n * every bar is the strong colour.\n */\n highlightIndex?: number\n tone?: BackdropChartTone\n /** Y-axis ticks, labelled in a 48 column at the left. Leave out for no axis. */\n yTicks?: BackdropChartTick[]\n /** A gridline at each tick above zero. Default true; needs `yTicks`. */\n gridlines?: boolean\n /** The value at the top of the plot. Defaults to the highest tick or value. */\n max?: number\n /**\n * Words beside the plot, level with the top of the highlighted bar: a figure\n * and a line under it (\"2 meetings\" / \"this month\"). Pass a node; use\n * `directLabelValue` and `directLabelNote` for the drawn two-line look.\n */\n directLabel?: ReactNode\n /** The direct label's figure, 15/20 semibold, in the tone's text colour. */\n directLabelValue?: ReactNode\n /** The direct label's second line, 13/18 muted. */\n directLabelNote?: ReactNode\n /** A sentence under the chart, after a hairline. */\n caption?: ReactNode\n /** One action at the caption's end. */\n action?: BackdropPageAction\n /** The action's button: `outline` (default) or `primary` when it is the screen's one orange action. */\n actionEmphasis?: BackdropChartActionEmphasis\n linkComponent?: ElementType\n className?: string\n}\n\n/**\n * Single-series vertical bars over time. Fluid width; the plot height is fixed\n * (`--backdrop-chart-bar-plot-height`). Bars grow up from a baseline in equal\n * slots, at most 56 wide.\n */\nexport function BackdropBarChart({\n label,\n data,\n categoryHeader,\n valueHeader,\n highlightIndex,\n tone = 'ink',\n yTicks,\n gridlines = true,\n max,\n directLabel,\n directLabelValue,\n directLabelNote,\n caption,\n action,\n actionEmphasis,\n linkComponent,\n className,\n}: BackdropBarChartProps) {\n const top = scaleMax(\n data.map((d) => d.value),\n yTicks,\n max,\n )\n const hasAxis = yTicks !== undefined && yTicks.length > 0\n const highlighted = highlightIndex !== undefined && highlightIndex >= 0 && highlightIndex < data.length ? highlightIndex : undefined\n const anchor = highlighted ?? data.length - 1\n const anchorShare = anchor >= 0 && data[anchor] ? share(data[anchor].value, top) : 0\n const direct =\n directLabel ??\n (directLabelValue != null || directLabelNote != null ? (\n <>\n {directLabelValue != null && <span className={styles.directValue}>{directLabelValue}</span>}\n {directLabelNote != null && <span className={styles.directNote}>{directLabelNote}</span>}\n </>\n ) : undefined)\n\n return (\n <figure className={cx(styles.chart, styles[`tone-${tone}`], className)} aria-label={label} data-tone={tone}>\n <div className={cx(styles.frame, hasAxis && styles.withAxis, direct !== undefined && styles.withDirect)}>\n {hasAxis && <Axis ticks={yTicks} max={top} />}\n <div className={cx(styles.plot, styles.barPlot)} aria-hidden=\"true\">\n {hasAxis && gridlines && <Grid ticks={yTicks} max={top} />}\n <div className={styles.bars}>\n {data.map((d, i) => (\n <span key={`${d.label}-${i}`} className={styles.slot}>\n <span\n className={cx(styles.bar, highlighted === undefined || i === highlighted ? styles.barStrong : styles.barMuted)}\n data-highlighted={i === highlighted || undefined}\n style={{ height: pct(share(d.value, top)) }}\n />\n </span>\n ))}\n </div>\n <span className={styles.baseline} />\n </div>\n {direct !== undefined && (\n <div className={styles.directColumn}>\n <div className={styles.direct} style={{ top: pct(1 - anchorShare) }}>\n {direct}\n </div>\n </div>\n )}\n <div className={styles.xLabels} aria-hidden=\"true\">\n {data.map((d, i) => (\n <span key={`${d.label}-${i}`} className={cx(styles.xLabel, i === highlighted && styles.xLabelStrong)}>\n <span className={styles.xPrimary}>{d.label}</span>\n {d.detail != null && <span className={styles.xDetail}>{d.detail}</span>}\n </span>\n ))}\n </div>\n </div>\n <div className={styles.srOnly}>\n <table>\n <caption>{label}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{categoryHeader}</th>\n <th scope=\"col\">{valueHeader}</th>\n </tr>\n </thead>\n <tbody>\n {data.map((d, i) => (\n <tr key={`${d.label}-${i}`}>\n <th scope=\"row\">{d.detail != null ? `${d.label}, ${d.detail}` : d.label}</th>\n <td>{d.valueText ?? String(d.value)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <ChartCaption caption={caption} action={action} actionEmphasis={actionEmphasis} linkComponent={linkComponent} />\n </figure>\n )\n}\n\n/* ── Bar list (N29b) ───────────────────────────────────────────────────── */\n\nexport interface BackdropBarListItem {\n key: string\n /** The row's name: \"Outbound\", \"Needs found\". */\n label: ReactNode\n value: number\n /** The figure at the row's end: \"1,429\". Defaults to the number. */\n valueText?: ReactNode\n /** A 24px mark or icon before the label. Decorative: the label names the row. */\n leading?: ReactNode\n /** The fill's tone. `success` for stages that are themselves the good outcome. */\n tone?: BackdropChartTone\n /**\n * Words in place of the bar, for a row with nothing to draw (\"Free\"). The\n * row's figure turns muted with it.\n */\n note?: ReactNode\n}\n\nexport interface BackdropBarListProps {\n /** The list's accessible name: \"Where it goes\", \"From need to paid\". */\n label: string\n items: BackdropBarListItem[]\n /** The value a full bar stands for. Defaults to the largest item. */\n max?: number\n className?: string\n}\n\n/**\n * Rows of label · bar · figure, the bar proportional to the figure. The\n * label and figure columns size to their widest row so every bar starts and\n * ends on one line. The bar is BackdropProgress's track and fill (the same\n * drawing as BackdropMeter `look=\"bar\"`), at the list's 8px height. Each row\n * reads as its label and figure; the bar is decorative.\n */\nexport function BackdropBarList({ label, items, max, className }: BackdropBarListProps) {\n const top = scaleMax(\n items.map((i) => i.value),\n undefined,\n max,\n )\n const hasLeading = items.some((i) => i.leading != null)\n return (\n <ul className={cx(styles.barList, hasLeading && styles.barListLeading, className)} aria-label={label}>\n {items.map((item) => (\n <li key={item.key} className={styles.barRow} data-tone={item.tone ?? 'ink'}>\n {hasLeading && (\n <span className={styles.barLeading} aria-hidden=\"true\">\n {item.leading}\n </span>\n )}\n <span className={styles.barLabel}>{item.label}</span>\n {item.note != null ? (\n <span className={styles.barNote}>{item.note}</span>\n ) : (\n <span className={cx(progressStyles.track, styles.barTrack, item.tone === 'success' && progressStyles['tone-success'])} aria-hidden=\"true\">\n <span className={progressStyles.fillBar} style={{ width: pct(share(item.value, top)) }} />\n </span>\n )}\n <span className={cx(styles.barValue, item.note != null && styles.barValueMuted)}>{item.valueText ?? String(item.value)}</span>\n </li>\n ))}\n </ul>\n )\n}\n\n/* ── Line chart (N30) ──────────────────────────────────────────────────── */\n\n/** `filled` ink dot, `hollow` ringed dot (a projected or expected end), or `none`. */\nexport type BackdropLineChartEnd = 'filled' | 'hollow' | 'none'\n\nexport interface BackdropLineChartPoint {\n /** The table's row header: \"25 Aug\", \"14 Nov\". */\n label: string\n /** The main series. `null` leaves a gap. */\n value: number | null\n /** The value as written in the table. Defaults to the number. */\n valueText?: string\n /** The muted comparison series at this point. `null` or absent leaves a gap. */\n comparison?: number | null\n comparisonText?: string\n /** A label under the x axis at this point. Points without one show none. */\n axisLabel?: ReactNode\n /** Sets this point's axis label in ink and semibold. */\n axisLabelStrong?: boolean\n}\n\nexport interface BackdropLineChartMarker {\n /** The point the vertical rule stands on. A filled dot marks the value there. */\n index: number\n /** Words at the top of the rule, to its right: \"Today · 1,240\". */\n label?: ReactNode\n}\n\nexport interface BackdropLineChartProps {\n /** The chart's accessible name and the hidden table's caption. */\n label: string\n data: BackdropLineChartPoint[]\n /** The hidden table's headers: the category (\"Week\") and each series' name. */\n categoryHeader: string\n seriesName: string\n /** Name of the comparison series. Required for it to appear in the table. */\n comparisonName?: string\n /** Y-axis ticks in a 48 column at the left. Leave out for no axis. */\n yTicks?: BackdropChartTick[]\n /** A gridline at each tick above zero. Default true; needs `yTicks`. */\n gridlines?: boolean\n max?: number\n /** From this index on, the main line is dashed (a projection). */\n dashedFrom?: number\n /** Fill the area under the solid part of the main line. */\n area?: boolean\n marker?: BackdropLineChartMarker\n /** The main series' last point. Default `none`. */\n end?: BackdropLineChartEnd\n /** The comparison series' last point. Default `none`. */\n comparisonEnd?: BackdropLineChartEnd\n caption?: ReactNode\n action?: BackdropPageAction\n /** The action's button: `outline` (default) or `primary` when it is the screen's one orange action. */\n actionEmphasis?: BackdropChartActionEmphasis\n linkComponent?: ElementType\n className?: string\n}\n\ntype Pt = { x: number; y: number; i: number }\n\n/* The SVG is drawn in a 100x100 box stretched to the plot; strokes keep their\n width through `vector-effect: non-scaling-stroke`. Points are HTML so they\n stay round at any width. */\nfunction xOf(i: number, n: number): number {\n return n > 1 ? (i / (n - 1)) * 100 : 50\n}\n\nfunction runs(values: Array<number | null | undefined>, top: number, from = 0, to = values.length - 1): Pt[][] {\n const out: Pt[][] = []\n let run: Pt[] = []\n for (let i = from; i <= to; i++) {\n const v = values[i]\n if (v == null) {\n if (run.length) out.push(run)\n run = []\n continue\n }\n run.push({ x: xOf(i, values.length), y: 100 - share(v, top) * 100, i })\n }\n if (run.length) out.push(run)\n return out\n}\n\nfunction pathOf(pts: Pt[][]): string {\n return pts.map((run) => run.map((p, k) => `${k === 0 ? 'M' : 'L'}${round(p.x)} ${round(p.y)}`).join(' ')).join(' ')\n}\n\nfunction areaOf(pts: Pt[][]): string {\n return pts\n .filter((run) => run.length > 1)\n .map((run) => {\n const first = run[0]?.x ?? 0\n const last = run[run.length - 1]?.x ?? first\n return `${pathOf([run])} L${round(last)} 100 L${round(first)} 100 Z`\n })\n .join(' ')\n}\n\nfunction round(n: number): number {\n return Math.round(n * 100) / 100\n}\n\nfunction lastIndex(values: Array<number | null | undefined>): number {\n for (let i = values.length - 1; i >= 0; i--) if (values[i] != null) return i\n return -1\n}\n\n/**\n * A line over time, with up to one muted comparison line. Generic parts only:\n * a dashed segment from an index on, an area under the line, a vertical\n * marker with a label slot, and filled or hollow end points. What the line\n * means, and any zone or event drawn on it, is the product's.\n */\nexport function BackdropLineChart({\n label,\n data,\n categoryHeader,\n seriesName,\n comparisonName,\n yTicks,\n gridlines = true,\n max,\n dashedFrom,\n area = false,\n marker,\n end = 'none',\n comparisonEnd = 'none',\n caption,\n action,\n actionEmphasis,\n linkComponent,\n className,\n}: BackdropLineChartProps) {\n const values = data.map((d) => d.value)\n const comparisons = data.map((d) => d.comparison)\n const hasComparison = comparisons.some((v) => v != null)\n const top = scaleMax(\n [...values, ...comparisons].filter((v): v is number => v != null),\n yTicks,\n max,\n )\n const hasAxis = yTicks !== undefined && yTicks.length > 0\n const n = data.length\n const split = dashedFrom !== undefined && dashedFrom >= 0 && dashedFrom < n - 1 ? dashedFrom : undefined\n const solid = runs(values, top, 0, split ?? n - 1)\n const dashed = split !== undefined ? runs(values, top, split, n - 1) : []\n const lastMain = lastIndex(values)\n const lastComparison = lastIndex(comparisons)\n const markerAt = marker && marker.index >= 0 && marker.index < n ? marker.index : undefined\n const markerValue = markerAt !== undefined ? values[markerAt] : null\n\n const point = (i: number, v: number, look: 'filled' | 'hollow', series: 'main' | 'comparison', key: string) => (\n <span\n key={key}\n className={cx(styles.point, look === 'hollow' && styles.pointHollow, series === 'comparison' && styles.pointComparison)}\n data-point={look}\n data-series={series}\n style={{ left: pct(xOf(i, n) / 100), bottom: pct(share(v, top)) }}\n />\n )\n\n return (\n <figure className={cx(styles.chart, className)} aria-label={label}>\n <div className={cx(styles.frame, hasAxis && styles.withAxis)}>\n {hasAxis && <Axis ticks={yTicks} max={top} />}\n <div className={cx(styles.plot, styles.linePlot)} aria-hidden=\"true\">\n {hasAxis && gridlines && <Grid ticks={yTicks} max={top} />}\n <span className={styles.baseline} />\n <svg className={styles.lines} viewBox=\"0 0 100 100\" preserveAspectRatio=\"none\" focusable=\"false\">\n {area && solid.length > 0 && <path className={styles.area} d={areaOf(solid)} />}\n {hasComparison && <path className={cx(styles.line, styles.lineComparison)} d={pathOf(runs(comparisons, top))} />}\n {solid.length > 0 && <path className={styles.line} d={pathOf(solid)} />}\n {dashed.length > 0 && <path className={cx(styles.line, styles.lineDashed)} d={pathOf(dashed)} />}\n </svg>\n {markerAt !== undefined && (\n <span className={styles.marker} style={{ left: pct(xOf(markerAt, n) / 100) }}>\n {marker?.label != null && <span className={styles.markerLabel}>{marker.label}</span>}\n </span>\n )}\n {markerAt !== undefined && markerValue != null && markerAt !== lastMain && point(markerAt, markerValue, 'filled', 'main', 'marker')}\n {hasComparison && comparisonEnd !== 'none' && lastComparison >= 0 && point(lastComparison, comparisons[lastComparison] as number, comparisonEnd, 'comparison', 'comparison-end')}\n {lastMain >= 0 && (end !== 'none' || markerAt === lastMain) && point(lastMain, values[lastMain] as number, end === 'hollow' ? 'hollow' : 'filled', 'main', 'end')}\n </div>\n <div className={styles.lineLabels} aria-hidden=\"true\">\n {data.map((d, i) =>\n d.axisLabel == null ? null : (\n <span\n key={`${d.label}-${i}`}\n className={cx(styles.lineLabel, d.axisLabelStrong && styles.lineLabelStrong)}\n data-edge={i === 0 ? 'start' : i === n - 1 ? 'end' : undefined}\n style={{ left: pct(xOf(i, n) / 100) }}\n >\n {d.axisLabel}\n </span>\n ),\n )}\n </div>\n </div>\n <div className={styles.srOnly}>\n <table>\n <caption>{label}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{categoryHeader}</th>\n <th scope=\"col\">{seriesName}</th>\n {hasComparison && comparisonName !== undefined && <th scope=\"col\">{comparisonName}</th>}\n </tr>\n </thead>\n <tbody>\n {data.map((d, i) => (\n <tr key={`${d.label}-${i}`}>\n <th scope=\"row\">{d.label}</th>\n <td>{d.value == null ? null : (d.valueText ?? String(d.value))}</td>\n {hasComparison && comparisonName !== undefined && <td>{d.comparison == null ? null : (d.comparisonText ?? String(d.comparison))}</td>}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n <ChartCaption caption={caption} action={action} actionEmphasis={actionEmphasis} linkComponent={linkComponent} />\n </figure>\n )\n}\n"],"names":["share","value","max","pct","n","scaleMax","values","ticks","top","t","Axis","jsx","styles","Grid","Fragment","ChartCaption","caption","action","actionEmphasis","linkComponent","jsxs","BackdropButton","BackdropBarChart","label","data","categoryHeader","valueHeader","highlightIndex","tone","yTicks","gridlines","directLabel","directLabelValue","directLabelNote","className","d","hasAxis","highlighted","anchor","anchorShare","direct","cx","i","BackdropBarList","items","hasLeading","item","progressStyles","xOf","runs","from","to","out","run","v","pathOf","pts","p","k","round","areaOf","first","_a","last","_b","lastIndex","BackdropLineChart","seriesName","comparisonName","dashedFrom","area","marker","end","comparisonEnd","comparisons","hasComparison","split","solid","dashed","lastMain","lastComparison","markerAt","markerValue","point","look","series","key"],"mappings":";;;;;AAqCA,SAASA,EAAMC,GAAeC,GAAqB;AACjD,SAAOA,IAAM,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGD,IAAQC,CAAG,CAAC,IAAI;AAC3D;AAEA,SAASC,EAAIC,GAAmB;AAC9B,SAAO,GAAG,KAAK,MAAMA,IAAI,GAAK,IAAI,GAAG;AACvC;AAEA,SAASC,EAASC,GAAk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AzD,EAAC,QAAI,UAAAwB,EAAE,cAAc,OAAO,OAAQA,EAAE,kBAAkB,OAAOA,EAAE,UAAU,EAAA,CAAG;AAAA,MAAA,EAAA,GAHzH,GAAGA,EAAE,KAAK,IAAIO,CAAC,EAIxB,CACD,EAAA,CACH;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,IACA,gBAAA/B,EAACI,GAAA,EAAa,SAAAC,GAAkB,QAAAC,GAAgB,gBAAAC,GAAgC,eAAAC,EAAA,CAA8B;AAAA,EAAA,GAChH;AAEJ;"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const n = "_srOnly_mn7dx_29", _ = "_chart_mn7dx_40", t = "_frame_mn7dx_60", a = "_withAxis_mn7dx_72", e = "_withDirect_mn7dx_80", o = "_axis_mn7dx_95", r = "_tick_mn7dx_100", i = "_plot_mn7dx_110", s = "_barPlot_mn7dx_115", c = "_linePlot_mn7dx_119", l = "_gridline_mn7dx_123", d = "_baseline_mn7dx_124", x = "_bars_mn7dx_144", m = "_slot_mn7dx_150", b = "_bar_mn7dx_115", L = "_barStrong_mn7dx_164", p = "_barMuted_mn7dx_168", u = "_xLabels_mn7dx_172", g = "_xLabel_mn7dx_172", h = "_xPrimary_mn7dx_188", k = "_xDetail_mn7dx_193", w = "_xLabelStrong_mn7dx_198", C = "_directColumn_mn7dx_211", D = "_direct_mn7dx_211", P = "_directValue_mn7dx_227", S = "_directNote_mn7dx_234", V = "_caption_mn7dx_242", y = "_captionText_mn7dx_251", A = "_captionAction_mn7dx_259", M = "_lines_mn7dx_265", N = "_line_mn7dx_119", T = "_lineComparison_mn7dx_282", f = "_lineDashed_mn7dx_286", H = "_area_mn7dx_290", O = "_point_mn7dx_295", R = "_pointComparison_mn7dx_304", j = "_pointHollow_mn7dx_308", q = "_marker_mn7dx_313", v = "_markerLabel_mn7dx_321", z = "_lineLabels_mn7dx_332", B = "_lineLabel_mn7dx_332", E = "_lineLabelStrong_mn7dx_356", F = "_barList_mn7dx_365", G = "_barListLeading_mn7dx_377", I = "_barRow_mn7dx_381", J = "_barLeading_mn7dx_389", K = "_barLabel_mn7dx_397", Q = "_barTrack_mn7dx_405", U = "_barNote_mn7dx_409", W = "_barValue_mn7dx_415", X = "_barValueMuted_mn7dx_423", Y = {
|
|
2
|
+
srOnly: n,
|
|
3
|
+
chart: _,
|
|
4
|
+
"tone-success": "_tone-success_mn7dx_54",
|
|
5
|
+
frame: t,
|
|
6
|
+
withAxis: a,
|
|
7
|
+
withDirect: e,
|
|
8
|
+
axis: o,
|
|
9
|
+
tick: r,
|
|
10
|
+
plot: i,
|
|
11
|
+
barPlot: s,
|
|
12
|
+
linePlot: c,
|
|
13
|
+
gridline: l,
|
|
14
|
+
baseline: d,
|
|
15
|
+
bars: x,
|
|
16
|
+
slot: m,
|
|
17
|
+
bar: b,
|
|
18
|
+
barStrong: L,
|
|
19
|
+
barMuted: p,
|
|
20
|
+
xLabels: u,
|
|
21
|
+
xLabel: g,
|
|
22
|
+
xPrimary: h,
|
|
23
|
+
xDetail: k,
|
|
24
|
+
xLabelStrong: w,
|
|
25
|
+
directColumn: C,
|
|
26
|
+
direct: D,
|
|
27
|
+
directValue: P,
|
|
28
|
+
directNote: S,
|
|
29
|
+
caption: V,
|
|
30
|
+
captionText: y,
|
|
31
|
+
captionAction: A,
|
|
32
|
+
lines: M,
|
|
33
|
+
line: N,
|
|
34
|
+
lineComparison: T,
|
|
35
|
+
lineDashed: f,
|
|
36
|
+
area: H,
|
|
37
|
+
point: O,
|
|
38
|
+
pointComparison: R,
|
|
39
|
+
pointHollow: j,
|
|
40
|
+
marker: q,
|
|
41
|
+
markerLabel: v,
|
|
42
|
+
lineLabels: z,
|
|
43
|
+
lineLabel: B,
|
|
44
|
+
lineLabelStrong: E,
|
|
45
|
+
barList: F,
|
|
46
|
+
barListLeading: G,
|
|
47
|
+
barRow: I,
|
|
48
|
+
barLeading: J,
|
|
49
|
+
barLabel: K,
|
|
50
|
+
barTrack: Q,
|
|
51
|
+
barNote: U,
|
|
52
|
+
barValue: W,
|
|
53
|
+
barValueMuted: X
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
H as area,
|
|
57
|
+
o as axis,
|
|
58
|
+
b as bar,
|
|
59
|
+
K as barLabel,
|
|
60
|
+
J as barLeading,
|
|
61
|
+
F as barList,
|
|
62
|
+
G as barListLeading,
|
|
63
|
+
p as barMuted,
|
|
64
|
+
U as barNote,
|
|
65
|
+
s as barPlot,
|
|
66
|
+
I as barRow,
|
|
67
|
+
L as barStrong,
|
|
68
|
+
Q as barTrack,
|
|
69
|
+
W as barValue,
|
|
70
|
+
X as barValueMuted,
|
|
71
|
+
x as bars,
|
|
72
|
+
d as baseline,
|
|
73
|
+
V as caption,
|
|
74
|
+
A as captionAction,
|
|
75
|
+
y as captionText,
|
|
76
|
+
_ as chart,
|
|
77
|
+
Y as default,
|
|
78
|
+
D as direct,
|
|
79
|
+
C as directColumn,
|
|
80
|
+
S as directNote,
|
|
81
|
+
P as directValue,
|
|
82
|
+
t as frame,
|
|
83
|
+
l as gridline,
|
|
84
|
+
N as line,
|
|
85
|
+
T as lineComparison,
|
|
86
|
+
f as lineDashed,
|
|
87
|
+
B as lineLabel,
|
|
88
|
+
E as lineLabelStrong,
|
|
89
|
+
z as lineLabels,
|
|
90
|
+
c as linePlot,
|
|
91
|
+
M as lines,
|
|
92
|
+
q as marker,
|
|
93
|
+
v as markerLabel,
|
|
94
|
+
i as plot,
|
|
95
|
+
O as point,
|
|
96
|
+
R as pointComparison,
|
|
97
|
+
j as pointHollow,
|
|
98
|
+
m as slot,
|
|
99
|
+
n as srOnly,
|
|
100
|
+
r as tick,
|
|
101
|
+
a as withAxis,
|
|
102
|
+
e as withDirect,
|
|
103
|
+
k as xDetail,
|
|
104
|
+
g as xLabel,
|
|
105
|
+
w as xLabelStrong,
|
|
106
|
+
u as xLabels,
|
|
107
|
+
h as xPrimary
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=BackdropCharts.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackdropCharts.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
interface ChromeState {
|
|
3
|
+
openKey: string | null;
|
|
4
|
+
setOpenKey: Dispatch<SetStateAction<string | null>>;
|
|
5
|
+
}
|
|
6
|
+
/** The chrome's one open panel. Put it around the frame; its children may be Server Components. */
|
|
7
|
+
export declare function BackdropChrome({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
export interface BackdropPanelControl {
|
|
11
|
+
/** True while this key is the chrome's open panel. */
|
|
12
|
+
open: boolean;
|
|
13
|
+
/** Opening closes whatever else was open, in the same update. Closing closes only this key. */
|
|
14
|
+
setOpen: (open: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A control that opens a chrome panel it does not draw: the Hub's "All apps"
|
|
18
|
+
* card, a ⌘K shortcut. Throws outside a BackdropChrome, because an opener that
|
|
19
|
+
* silently does nothing survives every screenshot review.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useBackdropPanel(key: string): BackdropPanelControl;
|
|
22
|
+
/** For the overlays themselves: null outside a BackdropChrome, or with no key, so they keep their own state. */
|
|
23
|
+
export declare function useChromePanel(key: string | undefined): BackdropPanelControl | null;
|
|
24
|
+
/** For a modal dialog, which claims the chrome while it is mounted (see BackdropDialog). */
|
|
25
|
+
export declare function useChromeState(): ChromeState | null;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { useState as i, useMemo as l, useContext as u, createContext as a, useCallback as p } from "react";
|
|
4
|
+
const r = a(null);
|
|
5
|
+
function d({ children: n }) {
|
|
6
|
+
const [e, t] = i(null), o = l(() => ({ openKey: e, setOpenKey: t }), [e]);
|
|
7
|
+
return /* @__PURE__ */ c(r.Provider, { value: o, children: n });
|
|
8
|
+
}
|
|
9
|
+
function s(n, e) {
|
|
10
|
+
return p(
|
|
11
|
+
(t) => {
|
|
12
|
+
!n || e === void 0 || n((o) => t ? e : o === e ? null : o);
|
|
13
|
+
},
|
|
14
|
+
[n, e]
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function m(n) {
|
|
18
|
+
const e = u(r), t = s(e == null ? void 0 : e.setOpenKey, n);
|
|
19
|
+
if (!e) throw new Error(`useBackdropPanel('${n}') is outside a BackdropChrome`);
|
|
20
|
+
return { open: e.openKey === n, setOpen: t };
|
|
21
|
+
}
|
|
22
|
+
function x(n) {
|
|
23
|
+
const e = u(r), t = s(e == null ? void 0 : e.setOpenKey, n);
|
|
24
|
+
return !e || n === void 0 ? null : { open: e.openKey === n, setOpen: t };
|
|
25
|
+
}
|
|
26
|
+
function P() {
|
|
27
|
+
return u(r);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
d as BackdropChrome,
|
|
31
|
+
m as useBackdropPanel,
|
|
32
|
+
x as useChromePanel,
|
|
33
|
+
P as useChromeState
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=BackdropChrome.js.map
|