@apliteni/apliteni-ui 0.190.0 → 0.193.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.
@@ -1114,9 +1114,9 @@ itself: the readout then adds no Tab stop and no description.
1114
1114
 
1115
1115
  **What the user sees.** A pointer that rests for 300ms opens the readout, and it closes at once when
1116
1116
  the pointer leaves. Within 300ms after one closes, the next opens at once. The readout is in the
1117
- top layer, over a sticky cell. It stays inside the viewport and moves with a scroll or a resize. It
1118
- never moves anything else on the page. On a touch screen, a tap opens the readout and does not
1119
- also run the mark's action.
1117
+ top layer, over a sticky cell. It stays inside the viewport, at least 8px from each edge, and moves
1118
+ with a scroll or a resize. It never moves anything else on the page. On a touch screen, a tap
1119
+ opens the readout and does not also run the mark's action.
1120
1120
 
1121
1121
  **Keyboard and screen reader.** Keyboard focus opens the readout at once, and the trigger gets it
1122
1122
  as its description. Escape closes only the readout and keeps the focus on the trigger. The next
@@ -1246,17 +1246,24 @@ All figures read at one size.
1246
1246
  change shows an arrow from the sign that you print, and its colour follows your `tone` only. A
1247
1247
  figure with nothing to compare shows no change row, never `+0%`. A figure shows at most one line
1248
1248
  under its value. A row of tiles keeps a soft line around each tile, also on the light page where a
1249
- lone card draws none. An open band draws a vertical soft line between figures in a row on the
1250
- light page. Use a caption only for a unit, a period or a limit that the figure cannot say.
1249
+ lone card draws none. An open band draws no rule over a figure, on a page or in a card: space and
1250
+ the value divide the figures. On the light page it also draws a vertical soft line between figures
1251
+ in a row, and none where the figures fold onto a new row. Use a caption only for a unit, a period or a limit that the figure cannot say.
1251
1252
  `trend` is a slot for a small chart, such as a `Chart variant="spark"`.
1252
1253
 
1253
1254
  **Say what a change compares with.** Put it once for the band in `basis`, or with `basisId` point
1254
1255
  at text before the figures. A caption comes before the figures. A hover `title` does not count.
1255
- When a period control already states the window, do not repeat it.
1256
+ When a period control already states the window, do not repeat it. To show no caption, put the basis
1257
+ in the `tooltip` of each `delta`, and with `basisId` point at screen-reader-only text that says it.
1258
+ The arrow and the change are one target, so the tooltip opens from either on hover, focus and tap.
1259
+ On a touch phone, the change is a 44 by 44px target in the layout, in every variant and
1260
+ container. The figure is taller there by the difference. With a mouse, the figure keeps its size.
1256
1261
 
1257
1262
  **Room on the screen.** A band folds by its own width, not the window's, so give it a width in a
1258
1263
  flex row or an `auto` grid track. On a page, a `StatBand` closes a section, so the block after it
1259
- keeps one group gap of air below the figures, on top of the body's own gap.
1264
+ keeps one group gap of air below the figures, on top of the body's own gap. A toolbar directly before
1265
+ an open band keeps 24px to the figure labels, in the page body and in a card stack, also on a touch
1266
+ phone.
1260
1267
 
1261
1268
  | Layout | Four fold two by two at | An odd count stacks at | One column at | Smaller value below |
1262
1269
  |---|---|---|---|---|
@@ -498,6 +498,8 @@ or a dense table's action cell opens across. Some families get no layer. The Acc
498
498
  minimums page names all of them. Rows that share an edge have no space outside a row for a
499
499
  layer. `input`, `select` and `textarea` generate no pseudo-element and use their own height.
500
500
  A back link draws 32 high, and its layer reaches 6 above and 6 below it to make 44.
501
+ A stat band's change with a tooltip has no layer. On a touch phone it is a 44 by 44 target
502
+ in the layout, so its figure is taller there.
501
503
 
502
504
  The whole system applies only below 560px with a coarse pointer, because a coarse pointer has
503
505
  no hover. `--tap-min` is a token, and you can move it.
@@ -24,7 +24,7 @@
24
24
 
25
25
  **Don't:** Grow the drawn control to 44 and push out every row that holds one.
26
26
 
27
- **Except:** Only a coarse pointer gets the layer, or a cursor lights a control it is not over. Rows that share an edge — a menu, a dense table, a settings list — have nothing to grow into and stay as they are drawn. Fields generate no layer, so a field reaches the floor by its own height or not at all.
27
+ **Except:** Only a coarse pointer gets the layer, or a cursor lights a control it is not over. Rows that share an edge, such as a menu, a dense table or a settings list, stay as drawn. A field has no layer and reaches the floor by its own height. A stat band's change grows to 44 in its row.
28
28
 
29
29
  ## Space between small targets
30
30
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  **Why:** A shared layout puts every figure's value, change and basis in the same place.
10
10
 
11
- **Do:** One card per figure: one size, a soft line each, arrow, signed change, caption above the row.
11
+ **Do:** One card per figure: one size, a soft line each, arrow, signed change, basis in a tooltip.
12
12
 
13
13
  **Don't:** Heading-sized figures, a capitalised 10px status chip, no comparison basis.
14
14
 
@@ -30,12 +30,12 @@
30
30
 
31
31
  <!-- rule: say-the-basis -->
32
32
 
33
- **Rule:** State in reachable text what each change is measured against.
33
+ **Rule:** State what each change is measured against, in reachable text or in its tooltip.
34
34
 
35
35
  **Why:** Percentages need a basis that readers can find.
36
36
 
37
- **Except:** A comparison basis may be screen-reader-only when the visible control names the period. Use this exception for the dashboard pattern.
37
+ **Except:** The basis may be screen-reader-only when a tooltip on each change shows it, or, on a dashboard, when a visible control names the period.
38
38
 
39
- **Do:** The basis once, in a caption each change references or beside one exception; the caption before and outside every figure.
39
+ **Do:** Each change's tooltip and screen-reader text state the basis, and one exception states its own.
40
40
 
41
- **Don't:** The caption below the tiles, after the changes it explains.
41
+ **Don't:** Percentages that no text or tooltip explains.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.190.0",
3
+ "version": "0.193.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
@@ -84,8 +84,8 @@
84
84
  .ui-toolbar--split .ui-filter-bar {
85
85
  column-gap: calc(var(--tap-gap) + var(--space-1) + 1px) !important;
86
86
  }
87
- :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:not(:last-child) {
88
- margin-bottom: calc(var(--tap-gap) - var(--space-10)) !important;
87
+ :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:not(:last-child, :has(+ .ui-stats--open)) {
88
+ margin-bottom: calc(var(--tap-gap) - var(--ui-block-gap, 0px)) !important;
89
89
  }
90
90
  .ui-stack > .ui-toolbar:not(:last-child) {
91
91
  margin-bottom: var(--tap-gap) !important;
@@ -482,7 +482,7 @@ function placeTip(host, mark, tip, placement = "top") {
482
482
  const view = host.ownerDocument.documentElement;
483
483
  const declared = parseFloat(getComputedStyle(tip).getPropertyValue("--ui-tip-gap"));
484
484
  const gap = Number.isFinite(declared) ? declared : TIP_GAP;
485
- const clip = { top: 0, left: 0, right: view.clientWidth, bottom: view.clientHeight };
485
+ const clip = { top: TIP_GAP, left: TIP_GAP, right: view.clientWidth - TIP_GAP, bottom: view.clientHeight - TIP_GAP };
486
486
  const layered = typeof tip.showPopover === "function" && tip.matches(":popover-open");
487
487
  for (let el = host; el && el !== host.ownerDocument.body; el = el.parentElement) {
488
488
  const style = getComputedStyle(el);
@@ -769,8 +769,13 @@ function ContextRow({ caption, delta, basisId }) {
769
769
  const own = delta.basis || "";
770
770
  return /* @__PURE__ */ jsxs8("dd", { className: "ui-stat__delta", "aria-describedby": !own && basisId ? basisId : void 0, children: [
771
771
  lead,
772
- /* @__PURE__ */ jsx12(Icon, { name: GLYPH[dir] }),
773
- delta.tooltip ? /* @__PURE__ */ jsx12(Tooltip, { text: delta.tooltip, children: /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value }) }) : /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value }),
772
+ delta.tooltip ? /* @__PURE__ */ jsxs8(Tooltip, { text: delta.tooltip, children: [
773
+ /* @__PURE__ */ jsx12(Icon, { name: GLYPH[dir] }),
774
+ /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value })
775
+ ] }) : /* @__PURE__ */ jsxs8(Fragment4, { children: [
776
+ /* @__PURE__ */ jsx12(Icon, { name: GLYPH[dir] }),
777
+ /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value })
778
+ ] }),
774
779
  own ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
775
780
  " ",
776
781
  /* @__PURE__ */ jsx12("span", { className: "ui-stat__basis", children: own })
@@ -60,10 +60,10 @@
60
60
 
61
61
  /* Vertical stacks space cards with the container's gap — see .ui-card-stack.
62
62
  (No `.ui-card + .ui-card` margin: it leaks into grid/flex rows and misaligns.) */
63
- .ui-card-stack { display: flex; flex-direction: column; gap: var(--space-5); }
63
+ .ui-card-stack { --ui-block-gap: var(--space-5); display: flex; flex-direction: column; gap: var(--ui-block-gap); }
64
64
  /* #850: on the light page a card draws no box, so the stack opens to the page's group gap.
65
65
  why: docs/foundations.md#spacing-and-rhythm */
66
- :root[data-theme="light"] .ui-card-stack { gap: var(--space-10); }
66
+ :root[data-theme="light"] .ui-card-stack { --ui-block-gap: var(--space-10); gap: var(--ui-block-gap); }
67
67
 
68
68
  /* A padding modifier moves the vertical rhythm and keeps the text edge, so cards of
69
69
  different padding line up in one column. --pad-lg is the centred landing card, never
@@ -432,10 +432,12 @@
432
432
  .ui-app__main .ui-app__title-row > h1 { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
433
433
  /* The tools wrap at the narrowest phone, so a period picker and a view action stay in the column. #832 */
434
434
  .ui-app__tools { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: var(--space-3); max-width: 100%; }
435
- .ui-app__body { display: flex; flex-direction: column; gap: var(--space-5); }
435
+ /* --ui-block-gap is the gap between two blocks. A control row above a block reads it, so
436
+ its margin holds in each theme. */
437
+ .ui-app__body { --ui-block-gap: var(--space-5); display: flex; flex-direction: column; gap: var(--ui-block-gap); }
436
438
  /* #850: on the light page a card draws no box, so the body opens to the page's group gap.
437
439
  why: docs/foundations.md#spacing-and-rhythm */
438
- :root[data-theme="light"] .ui-app__body { gap: var(--space-10); }
440
+ :root[data-theme="light"] .ui-app__body { --ui-block-gap: var(--space-10); gap: var(--ui-block-gap); }
439
441
  /* A stat band closes one section, so the block after it keeps the group gap on
440
442
  top of the body's: the air the old soft line used to give, now as space alone.
441
443
  why: guidelines/dashboards-and-reports.md, #850 */
@@ -463,9 +465,11 @@
463
465
  on the page meets its table card at the same distance. Not on the last row:
464
466
  there the gap is the page's bottom and nothing is being narrowed. tap-zone.css
465
467
  widens it on a touch phone. why: docs/foundations.md#spacing-and-rhythm */
466
- :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:not(:last-child) { margin-bottom: calc(var(--space-2) - var(--space-5)); }
467
- :root[data-theme="light"] :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:not(:last-child) { margin-bottom: calc(var(--space-2) - var(--space-10)); }
468
+ :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:not(:last-child) { margin-bottom: calc(var(--space-2) - var(--ui-block-gap)); }
468
469
  .ui-stack > .ui-toolbar + * { margin-top: var(--space-2); }
470
+ /* An open figure has no surface and no padding, so the row keeps 24px to its label: a
471
+ recorded exception to the inner gap, also on a touch phone. why: docs/components.md#stat-bands, #849 */
472
+ :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:has(+ .ui-stats--open) { margin-bottom: calc(var(--space-6) - var(--ui-block-gap)); }
469
473
  /* A filter bar inside its table's card sits one inner gap above the table, the
470
474
  same step the card title keeps above the bar. why: guidelines/dense-tables.md */
471
475
  .ui-card > .ui-toolbar:not(:last-child) { margin-bottom: var(--space-2); }
@@ -2,7 +2,7 @@
2
2
  * Stat band — .ui-stats (a row of key figures: label, value, change, trend)
3
3
  * .ui-stats--tiles one card per figure — the default
4
4
  * .ui-stats--band one card, figures divided by space
5
- * .ui-stats--open no surface; a rule over each figure
5
+ * .ui-stats--open no surface and no rule; space and a larger value divide
6
6
  * why: docs/components.md#stat-bands
7
7
  * ========================================================================== */
8
8
 
@@ -77,6 +77,17 @@ dd.ui-stat__caption { margin-top: var(--space-2); }
77
77
  line-height: var(--leading-snug);
78
78
  }
79
79
  .ui-stat__delta svg { width: 14px; height: 14px; flex: none; stroke-width: 2.7; } /* 2.7 of a 24 box drawn at 14px = 1.58 CSS px. docs/foundations.md#icons-and-glyphs */
80
+ /* A change with a tooltip holds its arrow inside the focus target, set as the row sets it.
81
+ The focus ring's block padding is lent back, so focus moves no line. #849 */
82
+ .ui-stat__delta .ui-tip-host > .ui-focusable { display: inline-flex; align-items: center; gap: var(--space-1); vertical-align: top; }
83
+ .ui-stat__delta .ui-tip-host > .ui-focusable:focus-visible { margin-block: calc(-1 * var(--space-1)); }
84
+ /* On a touch phone the change is its own 44px target in the row, as an underline tab is.
85
+ The figure grows by the difference, and no layer reaches past the target into a
86
+ neighbour. The ring goes round the target's own box, so it lends no padding. #849 */
87
+ @media (max-width: 560px) and (pointer: coarse) {
88
+ .ui-stat__delta .ui-tip-host > .ui-focusable { min-inline-size: var(--tap-min, 44px); min-block-size: var(--tap-min, 44px); }
89
+ .ui-stat__delta .ui-tip-host > .ui-focusable:focus-visible { padding: 0; margin: 0; }
90
+ }
80
91
  .ui-stat__change { font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
81
92
  .ui-stat__basis { color: var(--text); font-weight: var(--weight-normal); }
82
93
 
@@ -126,13 +137,7 @@ dd.ui-stat__caption { contain: inline-size; }
126
137
  margin-inline: 0;
127
138
  }
128
139
 
129
- .ui-stats--open .ui-stat {
130
- border-top: 1px solid var(--border-strong);
131
- padding-top: var(--space-4);
132
- }
133
- /* #850: on the light page no hairline above an open stat; the value is the signal. */
134
- :root[data-theme="light"] .ui-stats--open .ui-stat { border-top: 0; }
135
- /* #850 round 34: without that rule the light open figures read as one band, so a
140
+ /* #850 round 34: on one white ground the light open figures read as one band, so a
136
141
  vertical soft line between figures in a row keeps the columns apart. The line
137
142
  stops where a figure starts a new row: the odd fold stacks every figure, and the
138
143
  pairs fold starts its second row at the third figure. The column gap halves so the
@@ -124,8 +124,7 @@
124
124
  and declared SMALL on purpose: the pill rule above hands every strip
125
125
  --tap-gap, and this one has 4px of row to give, not 20. So a layer here can
126
126
  never reach past the gap it was promised, whatever a tab draws. A pill draws
127
- 31 tall and does want the full 20. #527, measured in
128
- stories/segmented-wrap.test.js. */
127
+ 31 tall and does want the full 20. #527 */
129
128
  .ui-seg--underline { row-gap: var(--space-1, 4px) !important; --tap-clear-y: var(--space-1, 4px); }
130
129
 
131
130
  /* Tabs are wide enough across; down, the panel under them has the room. */
@@ -148,8 +147,9 @@
148
147
  .ui-toolbar--split .ui-filter-bar { column-gap: calc(var(--tap-gap) + var(--space-1) + 1px) !important; }
149
148
  /* The table under a filter bar moves down with the chips: the bar's inner gap
150
149
  opens to --tap-gap too, so the last row's layers stop short of the table.
151
- In .ui-stack the bar's margin collapses with the block's 8px one. */
152
- :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:not(:last-child) { margin-bottom: calc(var(--tap-gap) - var(--space-10)) !important; }
150
+ The stack's own gap is --ui-block-gap in each theme, so the margin takes it back.
151
+ In .ui-stack the bar's margin collapses with the block's 8px one. An open band keeps its 24px. */
152
+ :is(.ui-app__body, .ui-card-stack) > .ui-toolbar:not(:last-child, :has(+ .ui-stats--open)) { margin-bottom: calc(var(--tap-gap) - var(--ui-block-gap, 0px)) !important; }
153
153
  .ui-stack > .ui-toolbar:not(:last-child) { margin-bottom: var(--tap-gap) !important; --tap-clear-y: var(--tap-gap); }
154
154
 
155
155
  /* Inside a chip there is nothing to open: parting the value from its remove