@apliteni/apliteni-ui 0.142.8 → 0.145.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/package.json +1 -1
- package/react/README.md +2 -2
- package/react/dist/index.d.ts +3 -2
- package/react/dist/index.js +42 -21
- package/src/styles/chart.css +21 -25
- package/src/tokens/tokens.css +34 -0
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -925,8 +925,8 @@ to `format`. A `bars-below` series takes positive magnitudes and is drawn under
|
|
|
925
925
|
A period marked `estimated` keeps its series fill with a dashed edge. The legend names the state.
|
|
926
926
|
The readout and the optional table show the state and its `note`.
|
|
927
927
|
|
|
928
|
-
A bar series names a tone. `accent` and `accent-soft`
|
|
929
|
-
two series read apart
|
|
928
|
+
A bar series names a tone. Each tone has its own hue: `accent` is blue and `accent-soft` is
|
|
929
|
+
cyan, so two series read apart by hue. `good` and `bad` say which way
|
|
930
930
|
the news runs, and belong to a series where some direction is better. Every tone is opaque and
|
|
931
931
|
clears 3:1 against the card and against the page, in both themes and under every accent.
|
|
932
932
|
|
package/react/dist/index.d.ts
CHANGED
|
@@ -1120,8 +1120,9 @@ type ChartSeries = {
|
|
|
1120
1120
|
shape?: 'bars' | 'bars-below' | 'line';
|
|
1121
1121
|
/**
|
|
1122
1122
|
* Bars take a tone. A line is `neutral` unless the caller says otherwise.
|
|
1123
|
-
*
|
|
1124
|
-
*
|
|
1123
|
+
* The tones are the chart's own fixed palette and do not follow the product
|
|
1124
|
+
* accent. Each tone has its own hue: `accent` is blue and `accent-soft` is
|
|
1125
|
+
* cyan, so two series read apart by hue.
|
|
1125
1126
|
*/
|
|
1126
1127
|
tone?: ChartTone;
|
|
1127
1128
|
};
|
package/react/dist/index.js
CHANGED
|
@@ -4875,11 +4875,15 @@ var TAP_FLOOR = 44;
|
|
|
4875
4875
|
var PHONE_MAX2 = 560;
|
|
4876
4876
|
var FALLBACK_COL = 48;
|
|
4877
4877
|
var BAR_SHARE = 0.5;
|
|
4878
|
-
var BAR_MAX =
|
|
4879
|
-
var BAR_MAX_BRIDGE =
|
|
4878
|
+
var BAR_MAX = 12;
|
|
4879
|
+
var BAR_MAX_BRIDGE = 22;
|
|
4880
4880
|
var LANE_GAP = 2;
|
|
4881
|
-
var BAR_RADIUS = 4;
|
|
4882
4881
|
var MISSING = "\u2014";
|
|
4882
|
+
function fadeOf(uid, m, bridge) {
|
|
4883
|
+
if (!bridge && !m.foot) return null;
|
|
4884
|
+
const up = bridge ? m.value >= 0 : m.foot === "bottom";
|
|
4885
|
+
return { id: `${uid}-fade-${m.tone}-${up ? "up" : "down"}`, tone: m.tone, up };
|
|
4886
|
+
}
|
|
4883
4887
|
var cx8 = (...parts) => parts.filter(Boolean).join(" ");
|
|
4884
4888
|
var px = (n) => Math.round(n * 10) / 10;
|
|
4885
4889
|
var columnOf = (p, fallback) => ({
|
|
@@ -4894,7 +4898,7 @@ function onPrevious(value, previous, when) {
|
|
|
4894
4898
|
return `${pct < 0 ? "\u2212" : "+"}${Math.abs(pct).toFixed(1)}% on ${when}`;
|
|
4895
4899
|
}
|
|
4896
4900
|
function barPath(m) {
|
|
4897
|
-
const r = Math.min(
|
|
4901
|
+
const r = Math.min(m.w / 2, m.h / (m.foot ? 1 : 4));
|
|
4898
4902
|
const { x, y: top, w, h } = m;
|
|
4899
4903
|
const bottom = top + h;
|
|
4900
4904
|
const arc = (dx, dy, sweep) => `a${px(r)} ${px(r)} 0 0 ${sweep} ${px(dx)} ${px(dy)}`;
|
|
@@ -5145,6 +5149,7 @@ function Chart(props) {
|
|
|
5145
5149
|
return [...out, ...dots];
|
|
5146
5150
|
}, [frame, lines, keys, columns, centre, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
|
|
5147
5151
|
const byId = useMemo5(() => new Map(marks.map((m) => [m.id, m])), [marks]);
|
|
5152
|
+
const fades = useMemo5(() => new Map(marks.filter((m) => m.kind === "bar").map((m) => fadeOf(uid, m, variant === "bridge")).filter((f) => f !== null).map((f) => [f.id, f])), [marks, uid, variant]);
|
|
5148
5153
|
const lead = useCallback7((column) => marks.find((m) => m.column === column), [marks]);
|
|
5149
5154
|
const open = openId ? byId.get(openId) : void 0;
|
|
5150
5155
|
useEffect17(() => {
|
|
@@ -5256,20 +5261,16 @@ function Chart(props) {
|
|
|
5256
5261
|
!spark && keys.length > 0 && /* @__PURE__ */ jsxs38("ul", { className: "ui-chart__legend", children: [
|
|
5257
5262
|
keys.map((key) => /* @__PURE__ */ jsxs38("li", { className: cx8("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
|
|
5258
5263
|
key.shape === "line" ? /* @__PURE__ */ jsx43("svg", { className: "ui-chart__key-mark", width: "18", height: "12", viewBox: "0 0 18 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx43("path", { className: "ui-chart__key-line", d: "M1 9 L6 5 L12 7 L17 3" }) }) : /* @__PURE__ */ jsx43("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx43(
|
|
5259
|
-
"
|
|
5264
|
+
"path",
|
|
5260
5265
|
{
|
|
5261
5266
|
className: "ui-chart__key-swatch",
|
|
5262
|
-
x:
|
|
5263
|
-
width: "10",
|
|
5264
|
-
height: "5",
|
|
5265
|
-
rx: "1",
|
|
5266
|
-
y: key.shape === "bars-below" ? 6 : 1
|
|
5267
|
+
d: barPath({ x: 3.5, y: 1, w: 5, h: 10, foot: key.shape === "bars-below" ? "top" : "bottom" })
|
|
5267
5268
|
}
|
|
5268
5269
|
) }),
|
|
5269
5270
|
key.name
|
|
5270
5271
|
] }, key.id)),
|
|
5271
5272
|
estimated.length > 0 && /* @__PURE__ */ jsxs38("li", { className: cx8("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
|
|
5272
|
-
/* @__PURE__ */ jsx43("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx43("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "
|
|
5273
|
+
/* @__PURE__ */ jsx43("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx43("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "2.5" }) }),
|
|
5273
5274
|
"Estimated"
|
|
5274
5275
|
] })
|
|
5275
5276
|
] }),
|
|
@@ -5413,18 +5414,38 @@ function Chart(props) {
|
|
|
5413
5414
|
y2: px(y(0))
|
|
5414
5415
|
}
|
|
5415
5416
|
),
|
|
5416
|
-
|
|
5417
|
-
"
|
|
5417
|
+
fades.size > 0 && /* @__PURE__ */ jsx43("defs", { children: [...fades.values()].map((fade) => /* @__PURE__ */ jsxs38(
|
|
5418
|
+
"linearGradient",
|
|
5418
5419
|
{
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5420
|
+
id: fade.id,
|
|
5421
|
+
className: `ui-chart__tone--${fade.tone}`,
|
|
5422
|
+
x1: "0",
|
|
5423
|
+
x2: "0",
|
|
5424
|
+
y1: fade.up ? "1" : "0",
|
|
5425
|
+
y2: fade.up ? "0" : "1",
|
|
5426
|
+
children: [
|
|
5427
|
+
/* @__PURE__ */ jsx43("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
5428
|
+
/* @__PURE__ */ jsx43("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
5429
|
+
]
|
|
5425
5430
|
},
|
|
5426
|
-
|
|
5427
|
-
)),
|
|
5431
|
+
fade.id
|
|
5432
|
+
)) }),
|
|
5433
|
+
marks.filter((m) => m.kind === "bar").map((mark) => {
|
|
5434
|
+
const fade = fadeOf(uid, mark, variant === "bridge");
|
|
5435
|
+
return /* @__PURE__ */ jsx43(
|
|
5436
|
+
"path",
|
|
5437
|
+
{
|
|
5438
|
+
className: cx8(
|
|
5439
|
+
"ui-chart__bar",
|
|
5440
|
+
`ui-chart__tone--${mark.tone}`,
|
|
5441
|
+
mark.estimated && "is-estimated"
|
|
5442
|
+
),
|
|
5443
|
+
style: fade ? { "--ui-chart-paint": `url(#${fade.id})` } : void 0,
|
|
5444
|
+
d: barPath(mark)
|
|
5445
|
+
},
|
|
5446
|
+
`bar-${mark.id}`
|
|
5447
|
+
);
|
|
5448
|
+
}),
|
|
5428
5449
|
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
5429
5450
|
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx43(
|
|
5430
5451
|
"line",
|
package/src/styles/chart.css
CHANGED
|
@@ -170,16 +170,20 @@
|
|
|
170
170
|
.ui-chart__band { fill: var(--surface-3); }
|
|
171
171
|
|
|
172
172
|
.ui-chart__bar {
|
|
173
|
-
/*
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
/* A bar fades from a tint of its tone at the base to the full tone at the data
|
|
174
|
+
end. The fade is allowed because it carries no value: the strong data end, the
|
|
175
|
+
zero line and the base hold the bar's length, and the data end alone clears
|
|
176
|
+
3:1. The component names the ramp per bar as --ui-chart-paint. A bridge bar
|
|
177
|
+
fades from the previous running total to the new one. */
|
|
178
|
+
fill: var(--ui-chart-paint, var(--ui-chart-tone));
|
|
177
179
|
stroke: none;
|
|
178
180
|
}
|
|
179
|
-
/*
|
|
181
|
+
/* The ramp's two stops. Each reads the tone of the gradient that holds it. */
|
|
182
|
+
.ui-chart__fade-base { stop-color: var(--ui-chart-fade); }
|
|
183
|
+
.ui-chart__fade-end { stop-color: var(--ui-chart-tone); }
|
|
184
|
+
/* Keep each series' fill. Ground-coloured dashes mark unfinished data
|
|
180
185
|
without joining the mirrored bars across the zero channel. */
|
|
181
186
|
.ui-chart__bar.is-estimated {
|
|
182
|
-
fill: var(--ui-chart-tone);
|
|
183
187
|
stroke: var(--ui-chart-ground);
|
|
184
188
|
stroke-width: 1;
|
|
185
189
|
stroke-dasharray: 3 2;
|
|
@@ -231,25 +235,17 @@
|
|
|
231
235
|
chrome to measure. */
|
|
232
236
|
.ui-chart--pick [data-mark] { cursor: pointer; }
|
|
233
237
|
|
|
234
|
-
/* The tones. A series names one
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
.ui-chart__tone--accent { --ui-chart-tone: var(--accent); }
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
.ui-chart__tone--accent-soft {
|
|
246
|
-
--ui-chart-tone: color-mix(in srgb, var(--accent) 70%, var(--ui-chart-ground));
|
|
247
|
-
}
|
|
248
|
-
.ui-chart__tone--good { --ui-chart-tone: var(--green); }
|
|
249
|
-
.ui-chart__tone--bad { --ui-chart-tone: var(--pink); }
|
|
250
|
-
.ui-chart__tone--warn { --ui-chart-tone: var(--amber); }
|
|
251
|
-
.ui-chart__tone--info { --ui-chart-tone: var(--cyan); }
|
|
252
|
-
.ui-chart__tone--neutral { --ui-chart-tone: var(--muted); }
|
|
238
|
+
/* The tones. A series names one, and each is the kit's own pair of tokens: the
|
|
239
|
+
tone, which is the data end and every line, legend key and dot, and its fade,
|
|
240
|
+
which is a bar's base. Both are fixed steps in each theme, so a chart does not
|
|
241
|
+
follow the product accent and accent-soft is not a mix towards the ground. */
|
|
242
|
+
.ui-chart__tone--accent { --ui-chart-tone: var(--chart-accent); --ui-chart-fade: var(--chart-accent-fade); }
|
|
243
|
+
.ui-chart__tone--accent-soft { --ui-chart-tone: var(--chart-accent-soft); --ui-chart-fade: var(--chart-accent-soft-fade); }
|
|
244
|
+
.ui-chart__tone--good { --ui-chart-tone: var(--chart-good); --ui-chart-fade: var(--chart-good-fade); }
|
|
245
|
+
.ui-chart__tone--bad { --ui-chart-tone: var(--chart-bad); --ui-chart-fade: var(--chart-bad-fade); }
|
|
246
|
+
.ui-chart__tone--warn { --ui-chart-tone: var(--chart-warn); --ui-chart-fade: var(--chart-warn-fade); }
|
|
247
|
+
.ui-chart__tone--info { --ui-chart-tone: var(--chart-info); --ui-chart-fade: var(--chart-info-fade); }
|
|
248
|
+
.ui-chart__tone--neutral { --ui-chart-tone: var(--chart-neutral); --ui-chart-fade: var(--chart-neutral-fade); }
|
|
253
249
|
|
|
254
250
|
/* -- the table ------------------------------------------------------------- */
|
|
255
251
|
|
package/src/tokens/tokens.css
CHANGED
|
@@ -331,6 +331,24 @@
|
|
|
331
331
|
/* Backdrop that dims the page behind an overlay (drawer, modal, composer). */
|
|
332
332
|
--scrim: rgba(0, 0, 0, 0.58);
|
|
333
333
|
|
|
334
|
+
/* Chart series tones (#740, the "Soft fade" palette), the same under every accent. A tone is the bar's data
|
|
335
|
+
end and clears 3:1 on the card and the page; its -fade is the bar's base, a tint
|
|
336
|
+
of the tone that does not clear 3:1 on the card by design. why: docs/components.md#react-charts */
|
|
337
|
+
--chart-accent: #347bcd;
|
|
338
|
+
--chart-accent-fade: #2b5185;
|
|
339
|
+
--chart-accent-soft: #26a7a9;
|
|
340
|
+
--chart-accent-soft-fade: #246971;
|
|
341
|
+
--chart-bad: #dd6a77;
|
|
342
|
+
--chart-bad-fade: #884856;
|
|
343
|
+
--chart-good: #4c7a37;
|
|
344
|
+
--chart-good-fade: #395133;
|
|
345
|
+
--chart-warn: #b78c26;
|
|
346
|
+
--chart-warn-fade: #745b29;
|
|
347
|
+
--chart-info: #9256a0;
|
|
348
|
+
--chart-info-fade: #5f3d6c;
|
|
349
|
+
--chart-neutral: #a29db6;
|
|
350
|
+
--chart-neutral-fade: #686478;
|
|
351
|
+
|
|
334
352
|
/* Accent gradient stops (hero headline, marketing) — overridden per sub-theme.
|
|
335
353
|
--grad-from is pinned to a literal rather than tracking --purple-light, which #157
|
|
336
354
|
moved up a step; every --grad-from in accents.css is a literal for the same reason. */
|
|
@@ -500,6 +518,22 @@
|
|
|
500
518
|
|
|
501
519
|
--scrim: rgba(20, 22, 40, 0.38);
|
|
502
520
|
|
|
521
|
+
/* Chart series tones (#740): the dark block's comment holds for these. */
|
|
522
|
+
--chart-accent: #236cbd;
|
|
523
|
+
--chart-accent-fade: #86aedb;
|
|
524
|
+
--chart-accent-soft: #04999c;
|
|
525
|
+
--chart-accent-soft-fade: #75c7c9;
|
|
526
|
+
--chart-bad: #c15260;
|
|
527
|
+
--chart-bad-fade: #dda0a8;
|
|
528
|
+
--chart-good: #3e6c29;
|
|
529
|
+
--chart-good-fade: #95ae89;
|
|
530
|
+
--chart-warn: #a97e0e;
|
|
531
|
+
--chart-warn-fade: #d0b87a;
|
|
532
|
+
--chart-info: #80448d;
|
|
533
|
+
--chart-info-fade: #b998c0;
|
|
534
|
+
--chart-neutral: #5c6270;
|
|
535
|
+
--chart-neutral-fade: #a5a9b0;
|
|
536
|
+
|
|
503
537
|
--grad-from: var(--purple-light);
|
|
504
538
|
--grad-to: var(--cyan);
|
|
505
539
|
}
|