@apliteni/apliteni-ui 0.142.8 → 0.146.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.
@@ -184,6 +184,10 @@ export const iconOnlyAllowed = {
184
184
  // and one button opens the full navigation in a drawer. The three-bar glyph is the
185
185
  // reader's own mark for this action.
186
186
  menu: 'open the navigation drawer',
187
+ // A chart card's view switch, decided by Artur on #742: the bars and the grid
188
+ // are the two views themselves, side by side in one toolbar at the card's corner.
189
+ chart: 'show the values as a chart',
190
+ table: 'show the values as a table',
187
191
  };
188
192
 
189
193
  // The word a wordless control's name may open with. The list above says which
@@ -205,6 +209,8 @@ export const iconOnlyNames = {
205
209
  // something else.
206
210
  download: ['export', 'download'],
207
211
  menu: ['menu'],
212
+ chart: ['chart'],
213
+ table: ['table'],
208
214
  };
209
215
 
210
216
  // What a glyph means when a component picks it for the reader rather than a
@@ -1,8 +1,9 @@
1
1
  /* ============================================================================
2
2
  * Chart — .ui-chart, the shapes a money dashboard keeps redrawing.
3
+ * .ui-chart__head the opt-in legend and the chart and table switch
3
4
  * .ui-chart__legend one key per series, plus the unfinished-period key
4
5
  * .ui-chart__frame the tab stop; the value axis beside the scroller
5
- * .ui-chart__scroll the scroller, masked on whichever side hides columns
6
+ * .ui-chart__scroll the scroller
6
7
  * .ui-chart__plot the drawing and its column labels
7
8
  * .ui-chart__data the same numbers as a table
8
9
  * The component sets --ui-chart-h, the plot's height, which the axis matches.
@@ -81,6 +82,8 @@
81
82
  padding-block: calc(var(--ring-width, 2px) + var(--ring-offset, 1px));
82
83
  border-radius: var(--radius-xs);
83
84
  }
85
+ /* The grid would beat the hidden attribute. */
86
+ .ui-chart__frame[hidden] { display: none; /* motion: still — the table view takes the frame's place at once */ }
84
87
  .ui-chart__frame:focus-visible {
85
88
  outline-offset: var(--ring-offset, 1px);
86
89
  }
@@ -98,25 +101,13 @@
98
101
  }
99
102
  .ui-chart__tick { line-height: 1.45; }
100
103
 
101
- /* The mask fades whichever side still hides periods. It paints no ground of its
102
- own, so a chart on the card and one on the page both fade correctly — and it
103
- sits on the scroller rather than the tab stop, which would mask its ring. */
104
+ /* The scroller paints nothing over the data. A mask that faded the hidden side
105
+ also faded the last column, which then read as a smaller value. #742 */
104
106
  .ui-chart__scroll {
105
107
  overflow-x: auto;
106
108
  overflow-y: hidden;
107
109
  overscroll-behavior-x: contain;
108
110
  }
109
- .ui-chart__scroll.is-more-before {
110
- mask-image: linear-gradient(to right, transparent 0, #000 var(--space-6));
111
- }
112
- .ui-chart__scroll.is-more-after {
113
- mask-image: linear-gradient(to right, #000 calc(100% - var(--space-6)), transparent 100%);
114
- }
115
- .ui-chart__scroll.is-more-before.is-more-after {
116
- mask-image: linear-gradient(
117
- to right, transparent 0, #000 var(--space-6),
118
- #000 calc(100% - var(--space-6)), transparent 100%);
119
- }
120
111
 
121
112
  .ui-chart__plot { min-width: calc(var(--ui-chart-col) * var(--ui-chart-cols, 1)); }
122
113
  .ui-chart__svg { display: block; }
@@ -170,16 +161,20 @@
170
161
  .ui-chart__band { fill: var(--surface-3); }
171
162
 
172
163
  .ui-chart__bar {
173
- /* One flat tone, the whole bar. A ramp down the bar was the one thing in the
174
- drawing that carried no number: it let the middle go while both edges held,
175
- so a reader comparing two months compared two shaded cylinders. */
176
- fill: var(--ui-chart-tone);
164
+ /* A bar fades from a tint of its tone at the base to the full tone at the data
165
+ end. The fade is allowed because it carries no value: the strong data end, the
166
+ zero line and the base hold the bar's length, and the data end alone clears
167
+ 3:1. The component names the ramp per bar as --ui-chart-paint. A bridge bar
168
+ fades from the previous running total to the new one. */
169
+ fill: var(--ui-chart-paint, var(--ui-chart-tone));
177
170
  stroke: none;
178
171
  }
179
- /* Keep each series' fill weight. Ground-coloured dashes mark unfinished data
172
+ /* The ramp's two stops. Each reads the tone of the gradient that holds it. */
173
+ .ui-chart__fade-base { stop-color: var(--ui-chart-fade); }
174
+ .ui-chart__fade-end { stop-color: var(--ui-chart-tone); }
175
+ /* Keep each series' fill. Ground-coloured dashes mark unfinished data
180
176
  without joining the mirrored bars across the zero channel. */
181
177
  .ui-chart__bar.is-estimated {
182
- fill: var(--ui-chart-tone);
183
178
  stroke: var(--ui-chart-ground);
184
179
  stroke-width: 1;
185
180
  stroke-dasharray: 3 2;
@@ -231,40 +226,119 @@
231
226
  chrome to measure. */
232
227
  .ui-chart--pick [data-mark] { cursor: pointer; }
233
228
 
234
- /* The tones. A series names one; the token behind it is the kit's, and the same
235
- in both themes' terms. The neutral one is --muted, which is what
236
- --signal-solid-neutral already is: a mid grey in both themes, where --dim
237
- would paint a bridge's totals near-black in light and near-white in dark. */
238
- .ui-chart__tone--accent { --ui-chart-tone: var(--accent); }
239
- /* The accent's second weight: the same hue, let down towards the ground rather
240
- than given an opacity, so a mark painted with it is opaque and a reader
241
- measures one colour. The mix crosses 3:1 at 67% against the card AND against
242
- the page, in both themes, under all four accents, so 70% ships with room over
243
- the bar rather than sitting on it — the 40% the restyle's mock drew measures
244
- 1.99:1 and 2.03:1 and does not ship. */
245
- .ui-chart__tone--accent-soft {
246
- --ui-chart-tone: color-mix(in srgb, var(--accent) 70%, var(--ui-chart-ground));
229
+ /* The tones. A series names one, and each is the kit's own pair of tokens: the
230
+ tone, which is the data end and every line, legend key and dot, and its fade,
231
+ which is a bar's base. Both are fixed steps in each theme, so a chart does not
232
+ follow the product accent and accent-soft is not a mix towards the ground. */
233
+ .ui-chart__tone--accent { --ui-chart-tone: var(--chart-accent); --ui-chart-fade: var(--chart-accent-fade); }
234
+ .ui-chart__tone--accent-soft { --ui-chart-tone: var(--chart-accent-soft); --ui-chart-fade: var(--chart-accent-soft-fade); }
235
+ .ui-chart__tone--good { --ui-chart-tone: var(--chart-good); --ui-chart-fade: var(--chart-good-fade); }
236
+ .ui-chart__tone--bad { --ui-chart-tone: var(--chart-bad); --ui-chart-fade: var(--chart-bad-fade); }
237
+ .ui-chart__tone--warn { --ui-chart-tone: var(--chart-warn); --ui-chart-fade: var(--chart-warn-fade); }
238
+ .ui-chart__tone--info { --ui-chart-tone: var(--chart-info); --ui-chart-fade: var(--chart-info-fade); }
239
+ .ui-chart__tone--neutral { --ui-chart-tone: var(--chart-neutral); --ui-chart-fade: var(--chart-neutral-fade); }
240
+
241
+ /* -- the looks of a line, an area, a stack and a ring ----------------------- */
242
+
243
+ /* The rule under the column the reader is on. It is the zero rule's weight: a
244
+ line read across, not a mark. */
245
+ .ui-chart__cross { stroke: var(--border-strong); stroke-width: 1; }
246
+ /* A point, cut out of the ground like an unfinished bar, so two lines that
247
+ meet still show both points. */
248
+ .ui-chart__dot { fill: var(--ui-chart-tone); stroke: var(--ui-chart-ground); stroke-width: 2; }
249
+ .ui-chart--line-thin .ui-chart__line { stroke-width: 1.5; }
250
+ .ui-chart--line-points .ui-chart__line { stroke-width: 2.5; }
251
+ /* An area is the fade of its tone. Where its values vary, the component names a
252
+ ramp as --ui-chart-paint: the fade at the lowest value, the tone at the highest.
253
+ The edge line on top of it holds the value. */
254
+ .ui-chart__area { fill: var(--ui-chart-paint, var(--ui-chart-fade)); stroke: none; }
255
+ /* A stacked part, a share band and a ring slice. The ground between two parts
256
+ keeps them apart where two tones of one hue meet. */
257
+ .ui-chart__segment {
258
+ fill: var(--ui-chart-tone);
259
+ stroke: var(--ui-chart-ground);
260
+ stroke-width: 2;
261
+ stroke-linejoin: round;
247
262
  }
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); }
263
+ .ui-chart__segment.is-estimated { stroke-dasharray: 3 2; }
264
+ /* Words drawn in the plot: a value at a line's end, a row's total, a slice's
265
+ name. They are the chart's own figures, so they take the body ink. */
266
+ .ui-chart__text { fill: var(--text); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
267
+ .ui-chart__text--strong { fill: var(--strong); font-weight: var(--weight-semibold); }
268
+ .ui-chart__total {
269
+ fill: var(--strong);
270
+ font-size: var(--text-xl);
271
+ font-weight: var(--weight-semibold);
272
+ font-variant-numeric: tabular-nums;
273
+ }
274
+ .ui-chart__caption {
275
+ /* muted-ink: chrome — a row's period, an axis step or the ring's caption names what the figures are */
276
+ color: var(--muted);
277
+ fill: currentColor;
278
+ font-size: var(--text-xs);
279
+ }
280
+ /* One series in a column's readout: its key and name, then its figure. */
281
+ .ui-chart__row { display: flex; justify-content: space-between; gap: var(--space-3); }
282
+ .ui-chart__row .ui-chart__key { color: var(--text); font-weight: var(--weight-normal); }
253
283
 
254
- /* -- the table ------------------------------------------------------------- */
284
+ /* The rows look and the ring draw their own scale, so the scroller takes the
285
+ whole frame and the plot needs no column floor. */
286
+ .ui-chart--stacked-rows .ui-chart__frame,
287
+ .ui-chart--donut .ui-chart__frame { grid-template-columns: minmax(0, 1fr); }
288
+ .ui-chart--stacked-rows .ui-chart__plot,
289
+ .ui-chart--donut .ui-chart__plot { min-width: 0; }
290
+ /* The table look's ring too, so it stays centred over a list that drops under it. */
291
+ .ui-chart--donut-thin .ui-chart__svg,
292
+ .ui-chart--donut-table .ui-chart__svg,
293
+ .ui-chart--donut-labels .ui-chart__svg { margin-inline: auto; }
294
+ .ui-chart--donut-thin .ui-chart__legend { justify-content: center; }
295
+ .ui-chart--donut-table .ui-chart__plot {
296
+ display: flex;
297
+ flex-wrap: wrap;
298
+ align-items: center;
299
+ gap: var(--space-8);
300
+ }
255
301
 
256
- .ui-chart__data > summary {
257
- width: max-content;
258
- min-height: var(--tap-min, 44px);
259
- display: inline-flex;
302
+ /* The table look's list beside the ring: key, name, value and share. */
303
+ .ui-chart__shares {
304
+ display: grid;
305
+ grid-template-columns: auto minmax(0, 1fr) auto auto;
260
306
  align-items: center;
261
- box-sizing: border-box;
262
- padding: var(--space-1) var(--space-2);
263
- border-radius: var(--radius-xs);
264
- cursor: pointer;
307
+ column-gap: var(--space-3);
308
+ row-gap: var(--space-2);
309
+ /* The list sits beside the ring when its widest row fits, and drops under it when not. */
310
+ flex: 1 1 auto;
311
+ min-width: 0;
312
+ max-width: var(--prose-caption);
313
+ margin: 0;
314
+ padding: 0;
315
+ list-style: none;
265
316
  font-size: var(--text-sm);
266
317
  }
267
- .ui-chart__data[open] > summary { margin-bottom: var(--space-3); }
318
+ .ui-chart__shares > li { display: contents; }
319
+ .ui-chart__shares-value { color: var(--strong); font-weight: var(--weight-semibold); text-align: right; font-variant-numeric: tabular-nums; }
320
+ .ui-chart__shares-pct {
321
+ /* muted-ink: chrome — the share restates the value beside it as a part of the whole */
322
+ color: var(--muted);
323
+ text-align: right;
324
+ font-variant-numeric: tabular-nums;
325
+ }
326
+ /* The rule starts at the name, so the swatch column under the keys stays empty. */
327
+ .ui-chart__shares-total > span + span { padding-top: var(--space-2); border-top: 1px solid var(--border); }
328
+
329
+ /* -- the table ------------------------------------------------------------- */
330
+
331
+ /* The legend, when the caller asks for one, and the chart and table switch in
332
+ the top right corner. The switch keeps its corner when there is no legend. */
333
+ .ui-chart__head {
334
+ display: flex;
335
+ flex-wrap: wrap;
336
+ align-items: center;
337
+ justify-content: space-between;
338
+ gap: var(--space-2) var(--space-4);
339
+ }
340
+ .ui-chart__head > .ui-seg { margin-inline-start: auto; }
341
+
268
342
  /* The table is the one place a phone reader gets exact values, and how wide it
269
343
  is depends on the caller's series: it carries them sideways inside the kit's
270
344
  own scroller, so the card and the page keep their width whatever it holds.
@@ -64,6 +64,11 @@
64
64
  .ui-seg:not(.ui-seg--sm):not(.ui-seg--underline) button { padding: var(--space-2) var(--space-3); }
65
65
  }
66
66
 
67
+ /* A segment with a glyph centres it on the word, or stands alone when the glyph is
68
+ the whole label. The glyph keeps the button glyph's size and line. */
69
+ .ui-seg button:has(> span > svg) { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); }
70
+ .ui-seg button svg { display: block; width: 16px; height: 16px; flex: none; stroke-width: 2.4; }
71
+
67
72
  .ui-seg--sm button { min-height: var(--space-6); padding: var(--space-1) var(--space-3); font-size: calc(var(--text-xs) + 1px); }
68
73
  .ui-seg--block { display: flex; align-self: stretch; justify-self: stretch; }
69
74
  .ui-seg--block button { flex: 1; }
@@ -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
  }