basalt-ui 2.18.0 → 2.20.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 +90 -0
- package/MIGRATING.md +238 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/skills/basalt-app/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/templates/DESIGN.md.tpl +1 -1
- package/configs/oxlint-plugin.js +33 -19
- package/configs/oxlint-plugin.test.ts +32 -2
- package/dist/charts/ChartCard.d.ts +28 -3
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +33 -11
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +13 -1
- package/dist/charts/Heatmap.js +1 -1
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +137 -18
- package/dist/charts/box.d.ts +2 -0
- package/dist/charts/box.d.ts.map +1 -1
- package/dist/charts/box.js +2 -0
- package/dist/charts/chart-box.module.css +30 -0
- package/dist/charts/chart-box.module.css.d.ts +1 -0
- package/dist/charts/chart-card.module.css +47 -0
- package/dist/charts/chart-card.module.css.d.ts +7 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +35 -8
- package/dist/charts/host.d.ts.map +1 -1
- package/dist/charts/host.js +2 -1
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/sparkline.module.css +59 -0
- package/dist/charts/sparkline.module.css.d.ts +13 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +32 -4
- package/dist/charts/types.d.ts +6 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/commands/notifications/center.d.ts.map +1 -1
- package/dist/commands/notifications/center.js +18 -26
- package/dist/content/callout.d.ts +1 -1
- package/dist/content/callout.d.ts.map +1 -1
- package/dist/content/callout.js +10 -1
- package/dist/content/callout.module.css +15 -3
- package/dist/content/callout.module.css.d.ts +1 -0
- package/dist/controls/sync-button.d.ts +3 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/dashboard/bar-list.d.ts +15 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +56 -19
- package/dist/dashboard/bar-list.module.css +110 -17
- package/dist/dashboard/bar-list.module.css.d.ts +2 -0
- package/dist/dashboard/delta-badge.d.ts +8 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +9 -2
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +68 -1
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +65 -4
- package/dist/dashboard/meter-parts.d.ts +5 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +234 -60
- package/dist/dashboard/meter.d.ts +38 -6
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +4 -1
- package/dist/dashboard/meter.module.css +209 -13
- package/dist/dashboard/meter.module.css.d.ts +16 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +14 -9
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +14 -25
- package/dist/dashboard/stat-card-parts.d.ts +3 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +18 -3
- package/dist/dashboard/stat-card.d.ts +7 -6
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +51 -83
- package/dist/dashboard/stat-card.module.css +42 -14
- package/dist/dashboard/stat-group.d.ts +11 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +9 -7
- package/dist/dashboard/stat-strip.d.ts +50 -0
- package/dist/dashboard/stat-strip.d.ts.map +1 -0
- package/dist/dashboard/stat-strip.js +85 -0
- package/dist/dashboard/stat-strip.module.css +208 -0
- package/dist/dashboard/stat-strip.module.css.d.ts +28 -0
- package/dist/dashboard/widget-header.d.ts +3 -3
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +2 -1
- package/dist/dashboard/widget-header.module.css +38 -7
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +4 -3
- package/dist/format/shared.d.ts +6 -0
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +6 -2
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/styles.css +6 -0
- package/dist/theme/card-inset.module.css +76 -0
- package/dist/theme/card-inset.module.css.d.ts +9 -0
- package/dist/theme/chrome-vars.d.ts +29 -17
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +18 -8
- package/dist/theme/controls.module.css +3 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +32 -5
- package/dist/theme/nav-link.module.css +8 -10
- package/dist/theme/status-dot.d.ts +7 -0
- package/dist/theme/status-dot.d.ts.map +1 -0
- package/dist/theme/status-dot.js +18 -0
- package/dist/theme/status-dot.module.css +9 -0
- package/dist/theme/status-dot.module.css.d.ts +8 -0
- package/dist/theme/status-verdict.d.ts +10 -0
- package/dist/theme/status-verdict.d.ts.map +1 -0
- package/dist/theme/status-verdict.js +14 -0
- package/dist/theme/status-verdict.module.css +25 -0
- package/dist/theme/status-verdict.module.css.d.ts +9 -0
- package/llms.txt +30 -6
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +70 -4
- package/src/charts/Donut.tsx +9 -1
- package/src/charts/Heatmap.tsx +1 -1
- package/src/charts/Sparkline.tsx +180 -18
- package/src/charts/box.tsx +2 -0
- package/src/charts/chart-box.module.css +30 -0
- package/src/charts/chart-box.module.css.d.ts +1 -0
- package/src/charts/chart-card.module.css +47 -0
- package/src/charts/chart-card.module.css.d.ts +7 -0
- package/src/charts/compile.ts +42 -9
- package/src/charts/host.tsx +6 -3
- package/src/charts/index.ts +1 -1
- package/src/charts/sparkline.module.css +59 -0
- package/src/charts/sparkline.module.css.d.ts +13 -0
- package/src/charts/state.tsx +44 -4
- package/src/charts/types.ts +6 -0
- package/src/commands/notifications/center.tsx +29 -32
- package/src/content/callout.module.css +15 -3
- package/src/content/callout.module.css.d.ts +1 -0
- package/src/content/callout.tsx +15 -2
- package/src/controls/sync-button.tsx +3 -0
- package/src/dashboard/bar-list.module.css +110 -17
- package/src/dashboard/bar-list.module.css.d.ts +2 -0
- package/src/dashboard/bar-list.tsx +102 -21
- package/src/dashboard/delta-badge.tsx +21 -5
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +132 -4
- package/src/dashboard/meter-parts.tsx +305 -25
- package/src/dashboard/meter.module.css +209 -13
- package/src/dashboard/meter.module.css.d.ts +16 -0
- package/src/dashboard/meter.tsx +42 -7
- package/src/dashboard/query-state.tsx +28 -19
- package/src/dashboard/settings-section.tsx +1 -8
- package/src/dashboard/stat-card-parts.tsx +22 -2
- package/src/dashboard/stat-card.module.css +42 -14
- package/src/dashboard/stat-card.tsx +23 -60
- package/src/dashboard/stat-group.tsx +19 -8
- package/src/dashboard/stat-strip.module.css +208 -0
- package/src/dashboard/stat-strip.module.css.d.ts +28 -0
- package/src/dashboard/stat-strip.tsx +183 -0
- package/src/dashboard/widget-header.module.css +38 -7
- package/src/dashboard/widget-header.tsx +7 -4
- package/src/format/date.ts +6 -3
- package/src/format/shared.ts +11 -2
- package/src/guard/index.ts +1 -1
- package/src/index.ts +7 -0
- package/src/styles.css +6 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +242 -26
- package/src/theme/card-inset.module.css +76 -0
- package/src/theme/card-inset.module.css.d.ts +9 -0
- package/src/theme/chrome-vars.ts +48 -23
- package/src/theme/controls.module.css +3 -0
- package/src/theme/index.ts +40 -6
- package/src/theme/nav-link.module.css +8 -10
- package/src/theme/status-dot.module.css +9 -0
- package/src/theme/status-dot.module.css.d.ts +8 -0
- package/src/theme/status-dot.tsx +31 -0
- package/src/theme/status-verdict.module.css +25 -0
- package/src/theme/status-verdict.module.css.d.ts +9 -0
- package/src/theme/status-verdict.tsx +32 -0
|
@@ -2,12 +2,22 @@ import type { ReactElement, ReactNode } from 'react';
|
|
|
2
2
|
import type { BasaltProps, SlotStylesProps } from '../common/props.js';
|
|
3
3
|
import type { DeltaPolarity } from '../dashboard/delta-badge.js';
|
|
4
4
|
import type { ChartState, ResponsiveChartHeight } from './types.js';
|
|
5
|
+
/** One headline figure: the value is the hero, then its unit, a comparison node and the period. */
|
|
6
|
+
export type ChartFact = {
|
|
7
|
+
value: ReactNode;
|
|
8
|
+
unit?: string | undefined;
|
|
9
|
+
/** Usually a `DeltaBadge`. */
|
|
10
|
+
comparison?: ReactNode;
|
|
11
|
+
/** Plain text the figure covers, e.g. `last 30 d`. */
|
|
12
|
+
period?: string | undefined;
|
|
13
|
+
};
|
|
5
14
|
/** The three boxes a `ChartCard` paints. */
|
|
6
15
|
export type ChartCardSlot = 'root' | 'header' | 'body';
|
|
7
|
-
|
|
16
|
+
type ChartCardBaseProps = BasaltProps & SlotStylesProps<ChartCardSlot> & {
|
|
8
17
|
title?: string | undefined;
|
|
9
18
|
icon?: ReactNode;
|
|
10
|
-
/** A muted line below the title row; does not by itself render the header.
|
|
19
|
+
/** A muted line below the title row; does not by itself render the header. With `facts` it is the
|
|
20
|
+
* basis/as-of line after the facts row (always visible, never folded into the info glyph). */
|
|
11
21
|
subtitle?: string | undefined;
|
|
12
22
|
/** `WidgetHeader`'s info glyph beside the title. */
|
|
13
23
|
info?: string | undefined;
|
|
@@ -30,5 +40,20 @@ export type ChartCardProps = BasaltProps & SlotStylesProps<ChartCardSlot> & {
|
|
|
30
40
|
stateAction?: ReactNode;
|
|
31
41
|
children?: ReactNode;
|
|
32
42
|
};
|
|
33
|
-
|
|
43
|
+
/**
|
|
44
|
+
* `facts` replaces the legacy `value`/`delta` hero: the two are mutually exclusive in the type. The
|
|
45
|
+
* facts show only at rest: while `state` is pending, errored or empty the figure would sit above a
|
|
46
|
+
* skeleton or a placeholder that contradicts it, so the header keeps its title row alone.
|
|
47
|
+
*/
|
|
48
|
+
export type ChartCardProps = ChartCardBaseProps & ({
|
|
49
|
+
/** The headline figure(s) under the title: value, unit, comparison, period. Wraps at half
|
|
50
|
+
* width, never clips. Replaces `value`/`delta`. */
|
|
51
|
+
facts: ChartFact | readonly ChartFact[];
|
|
52
|
+
value?: undefined;
|
|
53
|
+
delta?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
facts?: undefined;
|
|
56
|
+
});
|
|
57
|
+
export declare function ChartCard({ actions, state, placeholderHeight, stateAction, className, classNames, style, children, facts, ...header }: ChartCardProps): ReactElement;
|
|
58
|
+
export {};
|
|
34
59
|
//# sourceMappingURL=ChartCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartCard.d.ts","sourceRoot":"","sources":["../../src/charts/ChartCard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAM7D,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAoEhE,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEtD,
|
|
1
|
+
{"version":3,"file":"ChartCard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9B,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,mFAAmF;IACnF,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAC9B;;wFAEoF;IACpF,iBAAiB,CAAC,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;IAC9D,sEAAsE;IACtE,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAC7C,CACI;IACE;uDACmD;IACnD,KAAK,EAAE,SAAS,GAAG,SAAS,SAAS,EAAE,CAAA;IACvC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,GACD;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,CACxB,CAAA;AA0CH,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,MAAM,EACV,EAAE,cAAc,GAAG,YAAY,CAkD/B"}
|
package/dist/charts/ChartCard.js
CHANGED
|
@@ -57,6 +57,21 @@ const bodyClipStyle = {
|
|
|
57
57
|
};
|
|
58
58
|
const definedOnly = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
59
59
|
const HEADER_TRIGGERS = ["title", "info", "value", "icon", "count"];
|
|
60
|
+
function Facts({
|
|
61
|
+
facts,
|
|
62
|
+
basis
|
|
63
|
+
}) {
|
|
64
|
+
const list = Array.isArray(facts) ? facts : [facts];
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { "data-basalt-facts": "", className: classes.facts, children: [
|
|
66
|
+
/* @__PURE__ */ jsx("div", { className: classes.factsRow, children: list.map((f, i) => /* @__PURE__ */ jsxs("span", { "data-basalt-fact": "", className: classes.fact, children: [
|
|
67
|
+
/* @__PURE__ */ jsx("span", { "data-basalt-fact-value": "", className: classes.factValue, children: f.value }),
|
|
68
|
+
f.unit !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.factUnit, children: f.unit }),
|
|
69
|
+
f.comparison,
|
|
70
|
+
f.period !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.factPeriod, children: f.period })
|
|
71
|
+
] }, i)) }),
|
|
72
|
+
basis !== void 0 && /* @__PURE__ */ jsx("p", { "data-basalt-facts-basis": "", className: classes.factsBasis, children: basis })
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
60
75
|
function ChartCard({
|
|
61
76
|
actions,
|
|
62
77
|
state,
|
|
@@ -66,11 +81,15 @@ function ChartCard({
|
|
|
66
81
|
classNames,
|
|
67
82
|
style,
|
|
68
83
|
children,
|
|
84
|
+
facts,
|
|
69
85
|
...header
|
|
70
86
|
}) {
|
|
71
87
|
const { ref, short } = useShortCard();
|
|
72
88
|
const resolved = resolveChartState(state);
|
|
73
|
-
const
|
|
89
|
+
const showFacts = facts !== void 0 && resolved === null;
|
|
90
|
+
const hasHeader = actions !== void 0 || showFacts || HEADER_TRIGGERS.some((k) => header[k] !== void 0);
|
|
91
|
+
const { subtitle, ...rest } = header;
|
|
92
|
+
const headerProps = facts === void 0 ? header : rest;
|
|
74
93
|
return /* @__PURE__ */ jsx(ChartCardContext.Provider, { value: true, children: /* @__PURE__ */ jsxs(
|
|
75
94
|
"div",
|
|
76
95
|
{
|
|
@@ -81,17 +100,20 @@ function ChartCard({
|
|
|
81
100
|
...resolved === "pending" && { "aria-busy": "true" },
|
|
82
101
|
...short && { "data-basalt-card-short": "" },
|
|
83
102
|
children: [
|
|
84
|
-
hasHeader && /* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
actions
|
|
103
|
+
hasHeader && /* @__PURE__ */ jsxs("div", { className: cx(classes.header, classNames?.header), children: [
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
WidgetHeader,
|
|
106
|
+
{
|
|
107
|
+
tier: "widget",
|
|
108
|
+
...definedOnly(headerProps),
|
|
109
|
+
title: header.title ?? "",
|
|
110
|
+
...actions !== void 0 && {
|
|
111
|
+
actions: /* @__PURE__ */ jsx("span", { "data-basalt-tier": "widget", children: actions })
|
|
112
|
+
}
|
|
92
113
|
}
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
),
|
|
115
|
+
showFacts && /* @__PURE__ */ jsx(Facts, { facts, basis: subtitle })
|
|
116
|
+
] }),
|
|
95
117
|
/* @__PURE__ */ jsx(
|
|
96
118
|
"div",
|
|
97
119
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.d.ts","sourceRoot":"","sources":["../../src/charts/Donut.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAWlD,OAAO,KAAK,EAAe,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE7E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAAE,GAAG,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,WAAW,GAAG;IAChE,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9B,uDAAuD;IACvD,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAA;IAC/B,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAClC,4DAA4D;IAC5D,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAA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;IAC9C,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAAA;IACnD,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CAC/B,CAAA;AAkED,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,YAAY,CA0JnF"}
|
package/dist/charts/Donut.js
CHANGED
|
@@ -175,7 +175,19 @@ function Donut(props) {
|
|
|
175
175
|
}
|
|
176
176
|
) : /* @__PURE__ */ jsx(ChartPlaceholder, { state, height: "fill" }),
|
|
177
177
|
resolved === null && (centerLabel !== void 0 || centerSubLabel !== void 0) && /* @__PURE__ */ jsxs("div", { style: centerStyle, children: [
|
|
178
|
-
centerLabel !== void 0 && /* @__PURE__ */ jsx(
|
|
178
|
+
centerLabel !== void 0 && /* @__PURE__ */ jsx(
|
|
179
|
+
"span",
|
|
180
|
+
{
|
|
181
|
+
style: {
|
|
182
|
+
color: VX.ink,
|
|
183
|
+
fontFamily: "var(--basalt-font-numeral, var(--basalt-font-sans))",
|
|
184
|
+
fontVariantNumeric: "lining-nums",
|
|
185
|
+
fontSize: VX.text.lg,
|
|
186
|
+
fontWeight: 600
|
|
187
|
+
},
|
|
188
|
+
children: centerLabel
|
|
189
|
+
}
|
|
190
|
+
),
|
|
179
191
|
centerSubLabel !== void 0 && /* @__PURE__ */ jsx("span", { style: { color: VX.axis, fontSize: VX.text.micro }, children: centerSubLabel })
|
|
180
192
|
] })
|
|
181
193
|
]
|
package/dist/charts/Heatmap.js
CHANGED
|
@@ -132,7 +132,7 @@ function Heatmap(props) {
|
|
|
132
132
|
const ticks = { line: false, size: 0 };
|
|
133
133
|
const cls = resolveContainerClass(width);
|
|
134
134
|
const tickLabels = {
|
|
135
|
-
fontSize:
|
|
135
|
+
fontSize: VX.text.micro,
|
|
136
136
|
opacity: 1,
|
|
137
137
|
thin: true
|
|
138
138
|
};
|
|
@@ -22,6 +22,13 @@ export type SparklineProps = BasaltProps & {
|
|
|
22
22
|
/** Pending / error / empty, the same contract as every other kind. The placeholder fills the
|
|
23
23
|
* sparkline's own `width` × `height`, so a loading tile does not shift when the trend lands. */
|
|
24
24
|
state?: ChartState | undefined;
|
|
25
|
+
/** A quiet dashed hairline at a value, or at the mean of the plotted values (`'mean'`). The y
|
|
26
|
+
* domain widens to include it. Not a legend item, never a status colour. */
|
|
27
|
+
reference?: number | 'mean' | undefined;
|
|
28
|
+
/** Formats the readout's value. Default: the compact number format. */
|
|
29
|
+
format?: ((value: number) => string) | undefined;
|
|
30
|
+
/** The readout's x label per point, index-aligned with `data`. Omitted: the value alone. */
|
|
31
|
+
labels?: readonly string[] | undefined;
|
|
25
32
|
};
|
|
26
33
|
type Point = {
|
|
27
34
|
i: number;
|
|
@@ -34,7 +41,6 @@ type Point = {
|
|
|
34
41
|
* (unmeasured) pools nothing. A line is never pooled below its two endpoints.
|
|
35
42
|
*/
|
|
36
43
|
export declare function poolSparkline(rows: readonly Point[], width: number, mark: 'line' | 'bar'): readonly Point[];
|
|
37
|
-
/** `useId` output (`«r1»`, `:r1:`) is not a safe SVG id fragment. */
|
|
38
44
|
export declare function Sparkline(props: SparklineProps): ReactElement;
|
|
39
45
|
export {};
|
|
40
46
|
//# sourceMappingURL=Sparkline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../src/charts/Sparkline.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../src/charts/Sparkline.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAA2C,YAAY,EAAE,MAAM,OAAO,CAAA;AAElF,OAAO,KAAK,EAAE,WAAW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AAG,YAAY,CA0I7D"}
|
package/dist/charts/Sparkline.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { dot } from "@tanstack/charts/dot";
|
|
3
3
|
import { decorative } from "@tanstack/charts/mark/decorative";
|
|
4
4
|
import { lineY } from "@tanstack/charts/line";
|
|
5
|
+
import { ruleY } from "@tanstack/charts/rule";
|
|
5
6
|
import { scaleBand } from "@tanstack/charts/scales/band";
|
|
6
7
|
import { scaleLinear } from "@tanstack/charts/scales/linear";
|
|
7
|
-
import { useId, useMemo } from "react";
|
|
8
|
+
import { useId, useMemo, useState } from "react";
|
|
9
|
+
import { cx } from "../common/props.js";
|
|
8
10
|
import { VX } from "../tokens/index.js";
|
|
9
11
|
import { chartCurve } from "./curves.js";
|
|
10
12
|
import { barMark } from "./marks.js";
|
|
13
|
+
import { defaultNumberFormat } from "./compile.js";
|
|
11
14
|
import { ChartEngine, idPrefixOf } from "./host.js";
|
|
15
|
+
import classes from "./sparkline.module.css";
|
|
12
16
|
import { ChartPlaceholder, resolveChartState } from "./state.js";
|
|
13
|
-
import { CHART_THEME } from "./theme.js";
|
|
17
|
+
import { CHART_THEME, DASH } from "./theme.js";
|
|
14
18
|
const LINE_WIDTH = 1.5;
|
|
15
19
|
const DOT_R = 2.5;
|
|
16
20
|
const BAR_GAP = 0.15;
|
|
@@ -86,7 +90,23 @@ function poolSparkline(rows, width, mark) {
|
|
|
86
90
|
if (width <= 0 || rows.length <= Math.max(cap, mark === "bar" ? 1 : 2)) return rows;
|
|
87
91
|
return mark === "bar" ? poolBar(rows, cap) : poolLine(rows, cap);
|
|
88
92
|
}
|
|
89
|
-
function
|
|
93
|
+
function frameOf([lo, hi], mark, count, hasEnd) {
|
|
94
|
+
if (mark === "bar") return { x: [0, count], y: [Math.min(lo, 0), Math.max(hi, 0) || 1] };
|
|
95
|
+
const pad = (hi - lo) * 0.1 || 1;
|
|
96
|
+
const xPad = hasEnd ? (count - 1) * 0.04 || 0.5 : 0;
|
|
97
|
+
return { x: [-xPad, Math.max(count - 1, 1) + xPad], y: [lo - pad, hi + pad] };
|
|
98
|
+
}
|
|
99
|
+
function compileSparkline(source, extentOf, mark, color, emphasisColor, reference) {
|
|
100
|
+
const frame = frameOf(extentOf, mark, source.length, emphasisColor !== null);
|
|
101
|
+
const referenceMark = () => reference === null ? [] : [
|
|
102
|
+
ruleY([reference], {
|
|
103
|
+
id: "reference",
|
|
104
|
+
stroke: VX.line,
|
|
105
|
+
strokeOpacity: 1,
|
|
106
|
+
strokeWidth: 1,
|
|
107
|
+
strokeDasharray: DASH
|
|
108
|
+
})
|
|
109
|
+
];
|
|
90
110
|
return {
|
|
91
111
|
chart: ({ width }) => {
|
|
92
112
|
const rows = poolSparkline(source, width, mark);
|
|
@@ -94,6 +114,7 @@ function compileSparkline(source, [lo, hi], mark, color, emphasisColor) {
|
|
|
94
114
|
if (mark === "bar") {
|
|
95
115
|
return {
|
|
96
116
|
marks: [
|
|
117
|
+
...referenceMark(),
|
|
97
118
|
barMark(rows, {
|
|
98
119
|
id: "bars",
|
|
99
120
|
x: "i",
|
|
@@ -107,7 +128,7 @@ function compileSparkline(source, [lo, hi], mark, color, emphasisColor) {
|
|
|
107
128
|
axis: false
|
|
108
129
|
},
|
|
109
130
|
y: {
|
|
110
|
-
scale: scaleLinear().domain(
|
|
131
|
+
scale: scaleLinear().domain(frame.y),
|
|
111
132
|
axis: false
|
|
112
133
|
}
|
|
113
134
|
},
|
|
@@ -116,10 +137,9 @@ function compileSparkline(source, [lo, hi], mark, color, emphasisColor) {
|
|
|
116
137
|
margin: 0
|
|
117
138
|
};
|
|
118
139
|
}
|
|
119
|
-
const pad = (hi - lo) * 0.1 || 1;
|
|
120
|
-
const xPad = emphasisColor === null ? 0 : (source.length - 1) * 0.04 || 0.5;
|
|
121
140
|
return {
|
|
122
141
|
marks: [
|
|
142
|
+
...referenceMark(),
|
|
123
143
|
lineY(rows, {
|
|
124
144
|
id: "line",
|
|
125
145
|
x: "i",
|
|
@@ -136,10 +156,10 @@ function compileSparkline(source, [lo, hi], mark, color, emphasisColor) {
|
|
|
136
156
|
],
|
|
137
157
|
scales: {
|
|
138
158
|
x: {
|
|
139
|
-
scale: scaleLinear().domain(
|
|
159
|
+
scale: scaleLinear().domain(frame.x),
|
|
140
160
|
axis: false
|
|
141
161
|
},
|
|
142
|
-
y: { scale: scaleLinear().domain(
|
|
162
|
+
y: { scale: scaleLinear().domain(frame.y), axis: false }
|
|
143
163
|
},
|
|
144
164
|
theme: CHART_THEME,
|
|
145
165
|
guides: false,
|
|
@@ -148,6 +168,25 @@ function compileSparkline(source, [lo, hi], mark, color, emphasisColor) {
|
|
|
148
168
|
}
|
|
149
169
|
};
|
|
150
170
|
}
|
|
171
|
+
const hidden = (el) => el.closest('[aria-hidden="true"]') !== null;
|
|
172
|
+
function stepFrom(rows, from, dir) {
|
|
173
|
+
for (let i = from + dir; i >= 0 && i < rows.length; i += dir) if (rows[i]?.v !== null) return i;
|
|
174
|
+
return from;
|
|
175
|
+
}
|
|
176
|
+
const lastFinite = (rows) => {
|
|
177
|
+
const i = rows.findLastIndex((r) => r.v !== null);
|
|
178
|
+
return i < 0 ? null : i;
|
|
179
|
+
};
|
|
180
|
+
function meanOf(rows) {
|
|
181
|
+
let sum = 0;
|
|
182
|
+
let n = 0;
|
|
183
|
+
for (const r of rows) {
|
|
184
|
+
if (r.v === null) continue;
|
|
185
|
+
sum += r.v;
|
|
186
|
+
n += 1;
|
|
187
|
+
}
|
|
188
|
+
return sum / n;
|
|
189
|
+
}
|
|
151
190
|
function Sparkline(props) {
|
|
152
191
|
const {
|
|
153
192
|
ariaLabel,
|
|
@@ -159,35 +198,115 @@ function Sparkline(props) {
|
|
|
159
198
|
emphasizeLast = true,
|
|
160
199
|
emphasisColor = VX.line,
|
|
161
200
|
state,
|
|
201
|
+
reference,
|
|
202
|
+
format = defaultNumberFormat,
|
|
203
|
+
labels,
|
|
162
204
|
className,
|
|
163
205
|
style
|
|
164
206
|
} = props;
|
|
165
207
|
const id = useId();
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
208
|
+
const [hover, setHover] = useState(null);
|
|
209
|
+
const [keyed, setKeyed] = useState(null);
|
|
210
|
+
const active = hover ?? keyed;
|
|
211
|
+
const model = useMemo(() => {
|
|
212
|
+
const rows2 = data.map((v, i) => ({ i, v: finite(v) }));
|
|
213
|
+
const range = extent(rows2);
|
|
169
214
|
if (range === null) return null;
|
|
170
|
-
|
|
171
|
-
|
|
215
|
+
const at2 = reference === "mean" ? meanOf(rows2) : reference ?? null;
|
|
216
|
+
const ref = at2 !== null && Number.isFinite(at2) ? at2 : null;
|
|
217
|
+
const full = ref === null ? range : [Math.min(range[0], ref), Math.max(range[1], ref)];
|
|
218
|
+
const end = emphasizeLast ? emphasisColor : null;
|
|
219
|
+
return {
|
|
220
|
+
rows: rows2,
|
|
221
|
+
frame: frameOf(full, mark, rows2.length, end !== null),
|
|
222
|
+
definition: compileSparkline(rows2, full, mark, color, end, ref)
|
|
223
|
+
};
|
|
224
|
+
}, [data, mark, color, emphasizeLast, emphasisColor, reference]);
|
|
172
225
|
const resolved = resolveChartState(state);
|
|
226
|
+
const rows = model?.rows;
|
|
227
|
+
const interactive = resolved === null && model !== null;
|
|
228
|
+
const onPointerMove = (e) => {
|
|
229
|
+
if (!interactive || rows === void 0 || hidden(e.currentTarget)) return;
|
|
230
|
+
const box = e.currentTarget.getBoundingClientRect();
|
|
231
|
+
if (box.width <= 0) return;
|
|
232
|
+
const frac = Math.min(Math.max((e.clientX - box.left) / box.width, 0), 1);
|
|
233
|
+
const [x0, x1] = model.frame.x;
|
|
234
|
+
const i = mark === "bar" ? Math.min(Math.floor(frac * rows.length), rows.length - 1) : Math.min(Math.max(Math.round(x0 + frac * (x1 - x0)), 0), rows.length - 1);
|
|
235
|
+
setHover(rows[i]?.v === null ? null : i);
|
|
236
|
+
};
|
|
237
|
+
const onKeyDown = (e) => {
|
|
238
|
+
if (!interactive || rows === void 0 || hidden(e.currentTarget)) return;
|
|
239
|
+
const from = keyed ?? lastFinite(rows);
|
|
240
|
+
if (from === null) return;
|
|
241
|
+
const next = e.key === "ArrowLeft" ? stepFrom(rows, from, -1) : e.key === "ArrowRight" ? stepFrom(rows, from, 1) : e.key === "Home" ? stepFrom(rows, -1, 1) : e.key === "End" ? stepFrom(rows, rows.length, -1) : e.key === "Escape" ? null : void 0;
|
|
242
|
+
if (next === void 0) return;
|
|
243
|
+
e.preventDefault();
|
|
244
|
+
setHover(null);
|
|
245
|
+
setKeyed(next);
|
|
246
|
+
};
|
|
247
|
+
const onFocus = (e) => {
|
|
248
|
+
if (!interactive || rows === void 0 || keyed !== null || hidden(e.currentTarget)) return;
|
|
249
|
+
setKeyed(lastFinite(rows));
|
|
250
|
+
};
|
|
251
|
+
const value = active === null ? null : rows?.[active]?.v ?? null;
|
|
252
|
+
const at = interactive && active !== null && value !== null ? {
|
|
253
|
+
value,
|
|
254
|
+
fx: mark === "bar" ? (active + 0.5) / model.rows.length : (active - model.frame.x[0]) / (model.frame.x[1] - model.frame.x[0]),
|
|
255
|
+
fy: (model.frame.y[1] - value) / (model.frame.y[1] - model.frame.y[0]),
|
|
256
|
+
label: labels?.[active]
|
|
257
|
+
} : null;
|
|
173
258
|
return /* @__PURE__ */ jsxs(
|
|
174
259
|
"div",
|
|
175
260
|
{
|
|
176
261
|
"data-basalt-sparkline": "",
|
|
177
|
-
|
|
262
|
+
role: "presentation",
|
|
263
|
+
className: cx(classes.root, className),
|
|
178
264
|
style: { width: width ?? "100%", height, minWidth: 0, ...style },
|
|
265
|
+
onPointerMove,
|
|
266
|
+
onPointerLeave: () => setHover(null),
|
|
267
|
+
onKeyDown,
|
|
268
|
+
onFocus,
|
|
269
|
+
onBlur: () => {
|
|
270
|
+
setHover(null);
|
|
271
|
+
setKeyed(null);
|
|
272
|
+
},
|
|
179
273
|
children: [
|
|
180
274
|
resolved !== null && /* @__PURE__ */ jsx(ChartPlaceholder, { state, height, compact: true }),
|
|
181
|
-
resolved === null &&
|
|
275
|
+
resolved === null && model !== null && /* @__PURE__ */ jsx(
|
|
182
276
|
ChartEngine,
|
|
183
277
|
{
|
|
184
|
-
definition,
|
|
278
|
+
definition: model.definition,
|
|
185
279
|
ariaLabel,
|
|
186
280
|
height,
|
|
187
281
|
idPrefix: idPrefixOf(id, "spark"),
|
|
188
282
|
coarse: false
|
|
189
283
|
}
|
|
190
|
-
)
|
|
284
|
+
),
|
|
285
|
+
at !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
286
|
+
/* @__PURE__ */ jsx(
|
|
287
|
+
"span",
|
|
288
|
+
{
|
|
289
|
+
"data-basalt-sparkline-dot": "",
|
|
290
|
+
className: classes.dot,
|
|
291
|
+
style: { left: `${at.fx * 100}%`, top: `${at.fy * 100}%` }
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ jsxs(
|
|
295
|
+
"output",
|
|
296
|
+
{
|
|
297
|
+
"data-basalt-sparkline-readout": "",
|
|
298
|
+
"aria-live": hover === null ? "polite" : "off",
|
|
299
|
+
className: cx(classes.readout, at.fx > 0.5 ? classes.start : classes.end),
|
|
300
|
+
children: [
|
|
301
|
+
at.label !== void 0 && /* @__PURE__ */ jsxs("span", { className: classes.label, children: [
|
|
302
|
+
at.label,
|
|
303
|
+
" "
|
|
304
|
+
] }),
|
|
305
|
+
format(at.value)
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] })
|
|
191
310
|
]
|
|
192
311
|
}
|
|
193
312
|
);
|
package/dist/charts/box.d.ts
CHANGED
|
@@ -35,4 +35,6 @@ export declare function ChartBox(props: {
|
|
|
35
35
|
children: ReactNode;
|
|
36
36
|
}): ReactElement;
|
|
37
37
|
export declare const stateClass: string;
|
|
38
|
+
/** Lets the box outgrow its stated height (an error body holding an action). */
|
|
39
|
+
export declare const growClass: string;
|
|
38
40
|
//# sourceMappingURL=box.d.ts.map
|
package/dist/charts/box.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/charts/box.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAAA;AAEhF,qGAAqG;AACrG,eAAO,MAAM,YAAY;;;;;CAAkE,CAAA;AAC3F,eAAO,MAAM,UAAU,MAAM,CAAA;AAC7B,eAAO,MAAM,UAAU,MAAM,CAAA;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAYrC,gGAAgG;AAChG,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,MAAM,CAAC,YAAY,GAAG,cAAc,GAAG,cAAc,GAAG,WAAW,EAAE,MAAM,CAAC,CAAA;AAiB9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,YAAY,CAQlF;AAED,yFAAyF;AACzF,eAAO,MAAM,YAAY,GAAI,QAAQ,cAAc,KAAG,OACiB,CAAA;AAEvE,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB,GAAG,YAAY,CAmBf;AAED,eAAO,MAAM,UAAU,QAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/charts/box.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAAA;AAEhF,qGAAqG;AACrG,eAAO,MAAM,YAAY;;;;;CAAkE,CAAA;AAC3F,eAAO,MAAM,UAAU,MAAM,CAAA;AAC7B,eAAO,MAAM,UAAU,MAAM,CAAA;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAYrC,gGAAgG;AAChG,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,MAAM,CAAC,YAAY,GAAG,cAAc,GAAG,cAAc,GAAG,WAAW,EAAE,MAAM,CAAC,CAAA;AAiB9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,YAAY,CAQlF;AAED,yFAAyF;AACzF,eAAO,MAAM,YAAY,GAAI,QAAQ,cAAc,KAAG,OACiB,CAAA;AAEvE,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB,GAAG,YAAY,CAmBf;AAED,eAAO,MAAM,UAAU,QAAgB,CAAA;AACvC,gFAAgF;AAChF,eAAO,MAAM,SAAS,QAAe,CAAA"}
|
package/dist/charts/box.js
CHANGED
|
@@ -60,6 +60,7 @@ function ChartBox(props) {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
const stateClass = classes.state;
|
|
63
|
+
const growClass = classes.grow;
|
|
63
64
|
export {
|
|
64
65
|
ChartBox,
|
|
65
66
|
HEIGHT_MAX,
|
|
@@ -67,6 +68,7 @@ export {
|
|
|
67
68
|
HEIGHT_RATIO,
|
|
68
69
|
SHORT_CHART_HEIGHT,
|
|
69
70
|
chartBoxVars,
|
|
71
|
+
growClass,
|
|
70
72
|
isShortChart,
|
|
71
73
|
stateClass
|
|
72
74
|
};
|
|
@@ -62,3 +62,33 @@
|
|
|
62
62
|
width: 100%;
|
|
63
63
|
height: 100%;
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
/* An error body: the box's height is the floor, so its content (and the action) always fit. */
|
|
67
|
+
.grow {
|
|
68
|
+
height: auto;
|
|
69
|
+
max-height: none;
|
|
70
|
+
min-height: var(--bc-micro);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@container (min-width: 240px) {
|
|
74
|
+
.grow {
|
|
75
|
+
min-height: var(--bc-compact);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@container (min-width: 480px) {
|
|
80
|
+
.grow {
|
|
81
|
+
min-height: var(--bc-regular);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@container (min-width: 800px) {
|
|
86
|
+
.grow {
|
|
87
|
+
min-height: var(--bc-wide);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.grow > .state {
|
|
92
|
+
height: auto;
|
|
93
|
+
min-height: inherit;
|
|
94
|
+
}
|
|
@@ -23,3 +23,50 @@
|
|
|
23
23
|
:is([data-basalt-card-short], [data-basalt-chart-card]:has([data-basalt-chart-short])) .header {
|
|
24
24
|
padding-top: 4px;
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* The facts line (`facts` prop): the headline figure under the title, in place of a subtitle. It wraps
|
|
29
|
+
* (rows and the pieces inside a row), so a half-width card never clips the value. The value is the
|
|
30
|
+
* proportional sans with lining figures (Wave 35); the unit and period are muted. Weight and tracking
|
|
31
|
+
* are StatCard's hero values (`stat-card.module.css` `.value`: 500 / -0.02em, which no token names).
|
|
32
|
+
*/
|
|
33
|
+
.facts {
|
|
34
|
+
margin-top: var(--vx-space-stack-xs);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.factsRow {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
align-items: baseline;
|
|
41
|
+
gap: var(--vx-space-stack-xs) var(--vx-space-stack-md);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fact {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
align-items: baseline;
|
|
48
|
+
gap: var(--vx-space-stack-xs);
|
|
49
|
+
min-width: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.factValue {
|
|
53
|
+
min-width: 0;
|
|
54
|
+
overflow-wrap: anywhere;
|
|
55
|
+
font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
|
|
56
|
+
font-size: var(--vx-text-kpi);
|
|
57
|
+
font-weight: 500;
|
|
58
|
+
font-variant-numeric: lining-nums;
|
|
59
|
+
letter-spacing: -0.02em;
|
|
60
|
+
color: var(--vx-ink);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.factUnit,
|
|
64
|
+
.factPeriod,
|
|
65
|
+
.factsBasis {
|
|
66
|
+
font-size: var(--vx-text-sm);
|
|
67
|
+
color: var(--vx-muted);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.factsBasis {
|
|
71
|
+
margin: var(--vx-space-stack-xs) 0 0;
|
|
72
|
+
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare const classes: {
|
|
6
6
|
readonly header: string
|
|
7
|
+
readonly facts: string
|
|
8
|
+
readonly factsRow: string
|
|
9
|
+
readonly factsBasis: string
|
|
10
|
+
readonly fact: string
|
|
11
|
+
readonly factValue: string
|
|
12
|
+
readonly factUnit: string
|
|
13
|
+
readonly factPeriod: string
|
|
7
14
|
}
|
|
8
15
|
export default classes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/charts/compile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/charts/compile.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAEV,aAAa,EAEb,yBAAyB,EACzB,eAAe,IAAI,gBAAgB,EACnC,UAAU,EACV,yBAAyB,EAE1B,MAAM,6BAA6B,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAK5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EAEnB,WAAW,EACX,eAAe,EACf,MAAM,EAEN,OAAO,EAEP,QAAQ,EACT,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAE/F,gGAAgG;AAChG,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,IAAI,CACpD,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EACvB,MAAM,GACN,GAAG,GACH,QAAQ,GACR,OAAO,GACP,GAAG,GACH,IAAI,GACJ,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,QAAQ,GACR,UAAU,GACV,aAAa,GACb,kBAAkB,GAClB,SAAS,CACZ,GAAG;IACF,8FAA8F;IAC9F,OAAO,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC5B,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,wDAAwD;IACxD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,qDAA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