@apliteni/apliteni-ui 0.145.0 → 0.146.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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; }
@@ -247,20 +238,107 @@
247
238
  .ui-chart__tone--info { --ui-chart-tone: var(--chart-info); --ui-chart-fade: var(--chart-info-fade); }
248
239
  .ui-chart__tone--neutral { --ui-chart-tone: var(--chart-neutral); --ui-chart-fade: var(--chart-neutral-fade); }
249
240
 
250
- /* -- the table ------------------------------------------------------------- */
241
+ /* -- the looks of a line, an area, a stack and a ring ----------------------- */
251
242
 
252
- .ui-chart__data > summary {
253
- width: max-content;
254
- min-height: var(--tap-min, 44px);
255
- display: inline-flex;
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;
262
+ }
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); }
283
+
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;
256
298
  align-items: center;
257
- box-sizing: border-box;
258
- padding: var(--space-1) var(--space-2);
259
- border-radius: var(--radius-xs);
260
- cursor: pointer;
299
+ gap: var(--space-8);
300
+ }
301
+
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;
306
+ align-items: center;
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;
261
316
  font-size: var(--text-sm);
262
317
  }
263
- .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
+
264
342
  /* The table is the one place a phone reader gets exact values, and how wide it
265
343
  is depends on the caller's series: it carries them sideways inside the kit's
266
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; }