@zeyos/zx 5.4.0 → 5.5.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +23 -16
  3. package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
  4. package/dist/types/components/badge/badge.d.ts +5 -4
  5. package/dist/types/components/datebox/date-range-box.d.ts +15 -2
  6. package/dist/types/components/datebox/datebox.d.ts +37 -3
  7. package/dist/types/components/kbd/kbd.d.ts +41 -0
  8. package/dist/types/components/launcher/launcher.d.ts +4 -2
  9. package/dist/types/components/prose/prose.d.ts +69 -0
  10. package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
  11. package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
  12. package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
  13. package/dist/types/components/tree/tree.d.ts +44 -3
  14. package/dist/types/core/icons.d.ts +22 -1
  15. package/dist/types/index.d.ts +4 -2
  16. package/dist/types/internal/app-rail.d.ts +10 -3
  17. package/dist/types/internal/row-actions.d.ts +151 -0
  18. package/dist/zx-zeyos.esm.js +264 -82
  19. package/dist/zx-zeyos.esm.min.js +4 -4
  20. package/dist/zx.css +1225 -433
  21. package/dist/zx.esm.js +952 -392
  22. package/dist/zx.esm.min.js +6 -6
  23. package/dist/zx.global.js +952 -392
  24. package/dist/zx.global.min.js +6 -6
  25. package/dist/zx.min.css +1 -1
  26. package/docs/api.json +112 -4
  27. package/docs/llms.md +243 -37
  28. package/docs/llms.txt +2 -0
  29. package/package.json +1 -1
  30. package/src/components/account-menu/account-menu.js +2 -2
  31. package/src/components/app-rail/app-rail.css +11 -11
  32. package/src/components/app-sidebar/app-sidebar.css +90 -17
  33. package/src/components/app-sidebar/app-sidebar.js +120 -12
  34. package/src/components/badge/badge.css +33 -20
  35. package/src/components/badge/badge.js +5 -4
  36. package/src/components/breadcrumb/breadcrumb.css +28 -3
  37. package/src/components/breadcrumb/breadcrumb.js +2 -2
  38. package/src/components/button/button.css +24 -13
  39. package/src/components/button/button.js +20 -2
  40. package/src/components/calendar/calendar.css +14 -4
  41. package/src/components/card-view/card-view.js +2 -2
  42. package/src/components/chart/chart.js +20 -5
  43. package/src/components/check-button/check-button.css +11 -3
  44. package/src/components/check-button/check-button.js +3 -3
  45. package/src/components/context-menu/context-menu.css +7 -1
  46. package/src/components/date-picker/date-picker.css +6 -0
  47. package/src/components/date-picker/date-picker.js +5 -5
  48. package/src/components/date-picker/date-range-picker.css +6 -0
  49. package/src/components/date-picker/date-range-picker.js +3 -3
  50. package/src/components/date-picker/month-picker.js +3 -3
  51. package/src/components/date-picker/time-picker.css +6 -0
  52. package/src/components/datebox/date-range-box.js +30 -6
  53. package/src/components/datebox/datebox.js +44 -7
  54. package/src/components/dialog/dialog.css +0 -1
  55. package/src/components/dialog/dialog.js +2 -1
  56. package/src/components/dock/dock.js +2 -2
  57. package/src/components/dropdown/dropdown.css +2 -1
  58. package/src/components/entity-ref/entity-ref.css +8 -1
  59. package/src/components/file-item/file-item.css +1 -1
  60. package/src/components/finder/finder.js +2 -2
  61. package/src/components/groupbox/groupbox.js +2 -2
  62. package/src/components/kanban-view/kanban-view.css +8 -4
  63. package/src/components/kanban-view/kanban-view.js +3 -3
  64. package/src/components/kbd/kbd.css +64 -0
  65. package/src/components/kbd/kbd.js +121 -0
  66. package/src/components/launcher/launcher.css +30 -25
  67. package/src/components/launcher/launcher.js +15 -21
  68. package/src/components/list-toolbar/list-toolbar.css +7 -1
  69. package/src/components/menu-button/menu-button.css +9 -2
  70. package/src/components/message/message.js +2 -2
  71. package/src/components/module-bar/module-bar.css +11 -1
  72. package/src/components/multi-value-editor/multi-value-editor.js +4 -4
  73. package/src/components/navigation-bar/navigation-bar.css +3 -2
  74. package/src/components/pagination/pagination.js +2 -2
  75. package/src/components/panel/panel.js +2 -2
  76. package/src/components/prose/prose.css +53 -0
  77. package/src/components/prose/prose.js +152 -0
  78. package/src/components/questionnaire/questionnaire.css +7 -17
  79. package/src/components/questionnaire/questionnaire.js +16 -1
  80. package/src/components/rating/rating.css +3 -1
  81. package/src/components/search/search.js +2 -2
  82. package/src/components/select/glyphs.js +3 -3
  83. package/src/components/select/select.css +35 -7
  84. package/src/components/select/select.js +4 -4
  85. package/src/components/stat-tile/stat-tile.css +56 -2
  86. package/src/components/stat-tile/stat-tile.js +25 -2
  87. package/src/components/stepper/stepper.css +2 -1
  88. package/src/components/stepper/stepper.js +3 -3
  89. package/src/components/tabbox/tabbox.css +2 -2
  90. package/src/components/tabbox/tabbox.js +2 -2
  91. package/src/components/table/table.css +52 -16
  92. package/src/components/table/table.js +7 -5
  93. package/src/components/tag-picker/tag-picker.css +56 -43
  94. package/src/components/tag-picker/tag-picker.js +21 -16
  95. package/src/components/tree/tree.css +44 -0
  96. package/src/components/tree/tree.js +97 -9
  97. package/src/components/value-list/value-list.css +25 -4
  98. package/src/components/value-list/value-list.js +2 -1
  99. package/src/components/view/record-view.js +3 -3
  100. package/src/components/view-settings/view-settings.css +2 -1
  101. package/src/components/workspace-switcher/workspace-switcher.js +3 -3
  102. package/src/core/icons.js +34 -3
  103. package/src/elements/define.js +1 -0
  104. package/src/index.js +4 -2
  105. package/src/internal/app-rail.js +5 -1
  106. package/src/internal/row-actions.js +203 -0
  107. package/styles/base.css +26 -1
  108. package/styles/prose.css +306 -0
  109. package/styles/tokens/dark.css +97 -120
  110. package/styles/tokens/global.css +24 -9
  111. package/styles/tokens/semantic.css +464 -184
  112. package/styles/tokens/themes.css +9 -0
  113. package/styles/zx.css +3 -0
@@ -108,7 +108,8 @@
108
108
  max-inline-size: calc(100vw - var(--zx-space-4));
109
109
  overflow: hidden;
110
110
  border: 1px solid var(--zx-color-overlay-border);
111
- border-radius: var(--zx-radius-lg);
111
+ /* Concentric with the options inside it: their corner plus the inset around them. */
112
+ border-radius: var(--zx-radius-panel);
112
113
  background-color: var(--zx-color-overlay-surface);
113
114
  background-image: var(--zx-overlay-surface-image);
114
115
  background-clip: padding-box;
@@ -156,6 +157,21 @@
156
157
  background: var(--zx-color-overlay-selected);
157
158
  }
158
159
 
160
+ /* A chosen option under the cursor or the pointer is both, and shows both: the pick's tint one
161
+ step stronger, never the plain highlight and never the plain pick. More specific than either
162
+ rule above, so neither can overwrite it whatever their order. */
163
+ .zx-select__option[aria-selected="true"][data-active="true"],
164
+ .zx-select__option[aria-selected="true"]:hover {
165
+ background: color-mix(in srgb, var(--zx-color-accent) 26%, transparent);
166
+ }
167
+
168
+ @media (forced-colors: active) {
169
+ .zx-select__option[aria-selected="true"][data-active="true"],
170
+ .zx-select__option[aria-selected="true"]:hover {
171
+ background: var(--zx-color-overlay-selected);
172
+ }
173
+ }
174
+
159
175
  .zx-select__option > .zx-icon {
160
176
  flex: none;
161
177
  color: var(--zx-color-accent);
@@ -298,12 +314,15 @@
298
314
  white-space: nowrap;
299
315
  }
300
316
 
317
+ /* The same type as a menu's shortcut and a keycap's label. */
301
318
  .zx-select__status-shortcut {
302
319
  border: 0;
303
320
  background: transparent;
304
321
  color: var(--zx-color-text-muted);
305
- font-family: var(--zx-font-mono);
322
+ font-family: var(--zx-font-sans);
306
323
  font-size: var(--zx-text-xs);
324
+ font-weight: var(--zx-weight-medium);
325
+ font-feature-settings: "case", "tnum";
307
326
  }
308
327
 
309
328
  /* The workflow-status glyph — `statusIcon()`, and the one Select.status() draws, which also carries
@@ -322,7 +341,7 @@
322
341
  color: var(--zx-color-text-muted);
323
342
  }
324
343
 
325
- .zx-status-icon[data-tone="neutral"] { color: var(--zx-color-border-strong); }
344
+ .zx-status-icon[data-tone="neutral"] { color: var(--zx-color-text-subtle); }
326
345
  .zx-status-icon[data-tone="warning"] { color: var(--zx-color-warning); }
327
346
  .zx-status-icon[data-tone="info"] { color: var(--zx-color-info); }
328
347
  .zx-status-icon[data-tone="accent"] { color: var(--zx-color-accent); }
@@ -337,17 +356,26 @@
337
356
  border-radius: inherit;
338
357
  background: currentColor;
339
358
  }
359
+ /* The fill stops at the ring's inner edge, so the ring is painted over nothing — in a colour that
360
+ is not fully opaque the two would otherwise overlap and the ring would show denser than the
361
+ rest of the glyph. */
362
+ .zx-status-icon:is(
363
+ [data-indicator="review"], [data-indicator="ready"], [data-indicator="waiting"],
364
+ [data-indicator="done"], [data-indicator="canceled"]
365
+ ) {
366
+ background-clip: padding-box;
367
+ }
340
368
  .zx-status-icon[data-indicator="review"] {
341
- background: linear-gradient(90deg, currentColor 50%, transparent 50%);
369
+ background-image: linear-gradient(90deg, currentColor 50%, transparent 50%);
342
370
  }
343
371
  .zx-status-icon[data-indicator="ready"] {
344
- background: conic-gradient(currentColor 0 35%, transparent 35% 100%);
372
+ background-image: conic-gradient(currentColor 0 35%, transparent 35% 100%);
345
373
  }
346
374
  .zx-status-icon[data-indicator="waiting"] {
347
- background: conic-gradient(currentColor 0 70%, transparent 70% 100%);
375
+ background-image: conic-gradient(currentColor 0 70%, transparent 70% 100%);
348
376
  }
349
377
  .zx-status-icon:is([data-indicator="done"], [data-indicator="canceled"]) {
350
- background: currentColor;
378
+ background-color: currentColor;
351
379
  }
352
380
  .zx-status-icon:is([data-indicator="done"], [data-indicator="canceled"]) > .zx-icon {
353
381
  color: var(--zx-color-bg-raised);
@@ -1,6 +1,6 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
3
- import { icon } from '../../core/icons.js';
3
+ import { ICON_SIZE, icon } from '../../core/icons.js';
4
4
  import { typeahead } from '../../core/keyboard.js';
5
5
  import { position } from '../../core/position.js';
6
6
  import { uid } from '../../core/util.js';
@@ -154,7 +154,7 @@ export class Select extends Component {
154
154
  tabIndex: -1,
155
155
  ariaLabel: this._message('select.clear', 'Clear selection'),
156
156
  hidden: true
157
- }, icon('x', { size: 13 }));
157
+ }, icon('x', { size: ICON_SIZE.dismiss }));
158
158
  const loading = h('span', {
159
159
  ref: 'loading',
160
160
  class: 'zx-select__loading',
@@ -168,7 +168,7 @@ export class Select extends Component {
168
168
  type: 'button',
169
169
  tabIndex: -1,
170
170
  ariaLabel: this._message('select.toggle', 'Toggle options')
171
- }, icon('chevron-down', { size: 16 }));
171
+ }, icon('chevron-down', { size: ICON_SIZE.chevron }));
172
172
  const control = h('div', { ref: 'control', class: 'zx-select__control' },
173
173
  valueAdornment, input, clear, loading, toggle
174
174
  );
@@ -766,7 +766,7 @@ export class Select extends Component {
766
766
  ariaSelected: String(selected),
767
767
  dataset: { index }
768
768
  }, h('span', { class: 'zx-select__option-content' }, content));
769
- if (selected) option.append(icon('check', { size: 15 }));
769
+ if (selected) option.append(icon('check', { size: ICON_SIZE.check }));
770
770
  this.refs.list.append(option);
771
771
  this._optionEntries.push({ item, clear, action: null, element: option });
772
772
  }
@@ -20,6 +20,53 @@
20
20
  color: var(--zx-color-text);
21
21
  }
22
22
 
23
+ /* One figure leads a row: a framed tile steps past the display size, and a plain row sets its
24
+ figures a size down so the emphasised one can lead at the display size. */
25
+ .zx-stat-tile[data-emphasis="true"] {
26
+ --zx-stat-tile-value-size: var(--zx-text-3xl);
27
+ }
28
+
29
+ /*
30
+ * Plain: a figure on the page rather than a tile on it. No frame, no fill, no padding — its text
31
+ * sits on the content edge beside the title above it, and space alone separates it from the next.
32
+ * The label and caption stay muted and the figure keeps its weight and tabular digits; only its
33
+ * size steps down, so the emphasised figure in the row is the one that reads first.
34
+ */
35
+ .zx-stat-tile[data-variant="plain"] {
36
+ --zx-stat-tile-value-size: var(--zx-text-lg);
37
+ padding: 0;
38
+ border: 0;
39
+ border-radius: var(--zx-radius-md);
40
+ background: none;
41
+ }
42
+
43
+ .zx-stat-tile[data-variant="plain"][data-emphasis="true"] {
44
+ --zx-stat-tile-value-size: var(--zx-text-2xl);
45
+ }
46
+
47
+ /* Without a frame there is no corner to hold the icon, so it leads the label instead. */
48
+ .zx-stat-tile[data-variant="plain"] .zx-stat-tile__header {
49
+ justify-content: start;
50
+ gap: var(--zx-space-1);
51
+ }
52
+
53
+ .zx-stat-tile[data-variant="plain"] .zx-stat-tile__icon {
54
+ order: -1;
55
+ }
56
+
57
+ .zx-stat-tile[data-variant="plain"] .zx-stat-tile__value {
58
+ margin-block-start: 0;
59
+ }
60
+
61
+ /* A plain tile you can activate keeps its text on the edge; its hover fill and focus ring bleed
62
+ past it instead of pushing the figure inwards. */
63
+ a.zx-stat-tile[data-variant="plain"],
64
+ button.zx-stat-tile[data-variant="plain"] {
65
+ margin: calc(var(--zx-space-2) * -1);
66
+ inline-size: calc(100% + var(--zx-space-2) * 2);
67
+ padding: var(--zx-space-2);
68
+ }
69
+
23
70
  /* The link and button shapes are the same tile, so their native chrome is taken back off. */
24
71
  a.zx-stat-tile,
25
72
  button.zx-stat-tile {
@@ -86,7 +133,7 @@ button.zx-stat-tile:focus-visible {
86
133
  min-inline-size: 0;
87
134
  margin-block-start: var(--zx-space-1);
88
135
  font-size: var(--zx-stat-tile-value-size);
89
- font-weight: 650;
136
+ font-weight: var(--zx-weight-title);
90
137
  font-variant-numeric: tabular-nums;
91
138
  letter-spacing: var(--zx-tracking-title);
92
139
  line-height: 1.15;
@@ -159,7 +206,8 @@ button.zx-stat-tile:focus-visible {
159
206
  block-size: 2rem;
160
207
  margin-block-start: auto;
161
208
  padding-block-start: var(--zx-space-2);
162
- color: var(--zx-color-text-placeholder);
209
+ /* The sparkline is the tile's only data mark, so it needs a mark's 3:1, not placeholder ink. */
210
+ color: var(--zx-color-text-subtle);
163
211
  }
164
212
 
165
213
  .zx-stat-tile__loading {
@@ -193,6 +241,12 @@ button.zx-stat-tile:focus-visible {
193
241
  border-color: CanvasText;
194
242
  }
195
243
 
244
+ /* A plain figure has no frame to restore; its hover outline is the one a linked tile draws. */
245
+ a.zx-stat-tile[data-variant="plain"]:hover,
246
+ button.zx-stat-tile[data-variant="plain"]:hover {
247
+ outline: 1px solid Highlight;
248
+ }
249
+
196
250
  a.zx-stat-tile:hover,
197
251
  button.zx-stat-tile:hover {
198
252
  border-color: Highlight;
@@ -12,6 +12,7 @@ import { skeleton } from '../skeleton/skeleton.js';
12
12
  /** @typedef {'neutral'|'accent'|'success'|'warning'|'danger'|'info'} StatTileKind */
13
13
  /** @typedef {'positive'|'negative'|'neutral'} StatTileDeltaKind */
14
14
  /** @typedef {'up'|'down'|'flat'} StatTileDirection */
15
+ /** @typedef {'default'|'plain'} StatTileVariant */
15
16
 
16
17
  /**
17
18
  * @typedef {Object} StatTileDelta
@@ -53,6 +54,13 @@ import { skeleton } from '../skeleton/skeleton.js';
53
54
  * a glyph, not a coloured chip.
54
55
  * @property {StatTileKind} [kind='neutral'] Semantic intent. It tints the sparkline and never the
55
56
  * value, which stays at full text contrast whatever intent a record carries.
57
+ * @property {StatTileVariant} [variant='default'] `'default'` is a framed tile on its own surface,
58
+ * for a figure that stands among other content (a dashboard). `'plain'` drops the frame, the fill
59
+ * and the padding and sets the figure a size smaller, for a row of figures on a page (a record's
60
+ * amounts under its title). Reflected as `data-variant` on the root.
61
+ * @property {boolean} [emphasis=false] The figure leads its row: in a plain row it is set at the
62
+ * display size while the others stay smaller, on a framed tile one step above the display size.
63
+ * Give it to one tile per row. Reflected as `data-emphasis="true"`.
56
64
  * @property {string|null} [href=null] Destination. A tile with an href is an `<a>`.
57
65
  * @property {boolean} [clickable=false] Renders a `<button>` without an href. Passing `onclick`
58
66
  * sets this implicitly; set it directly to subscribe with `on('click', …)` instead.
@@ -104,6 +112,8 @@ const defaults = Object.freeze({
104
112
  trend: [],
105
113
  icon: null,
106
114
  kind: 'neutral',
115
+ variant: 'default',
116
+ emphasis: false,
107
117
  href: null,
108
118
  clickable: false,
109
119
  loading: false
@@ -293,6 +303,15 @@ export function statDelta(delta, options = {}) {
293
303
  return { direction, sign, magnitude, text: `${sign}${magnitude}` };
294
304
  }
295
305
 
306
+ /**
307
+ * Resolves the `variant` option to one the stylesheet knows; anything else is the framed tile.
308
+ * @param {unknown} value Requested variant.
309
+ * @returns {StatTileVariant}
310
+ */
311
+ export function normalizeStatTileVariant(value) {
312
+ return value === 'plain' ? 'plain' : 'default';
313
+ }
314
+
296
315
  /**
297
316
  * Chooses the element a tile must be, from what the tile does.
298
317
  *
@@ -374,6 +393,9 @@ function fillStatTile(root, options, message) {
374
393
  // put on it, and a redraw through `update()` does not quietly strip them.
375
394
  root.classList.add('zx-stat-tile');
376
395
  root.dataset.kind = kind;
396
+ root.dataset.variant = normalizeStatTileVariant(options.variant);
397
+ if (options.emphasis === true) root.dataset.emphasis = 'true';
398
+ else delete root.dataset.emphasis;
377
399
  root.dataset.loading = String(loading);
378
400
  if (root.tagName.toLowerCase() === 'a') {
379
401
  // `setAttribute` rather than the reflected property, so `update()` can also take a destination
@@ -482,14 +504,15 @@ function trendBody(values) {
482
504
 
483
505
  /**
484
506
  * Builds the placeholder: the tile's own shape in grey, not a spinner, so nothing moves when the
485
- * numbers arrive.
507
+ * numbers arrive. The figure's block reads the same size property as the figure, so a plain or an
508
+ * emphasised tile's placeholder is as tall as the number that replaces it.
486
509
  * @param {StatTileOptions} options Fully merged options.
487
510
  * @returns {HTMLElement}
488
511
  */
489
512
  function loadingBody(options) {
490
513
  const blocks = [
491
514
  h('div', { class: 'zx-stat-tile__header' }, skeleton({ width: '55%', height: '0.75rem' })),
492
- skeleton({ width: '70%', height: '1.75rem', radius: 'md' })
515
+ skeleton({ width: '70%', height: 'calc(var(--zx-stat-tile-value-size) * 1.15)', radius: 'md' })
493
516
  ];
494
517
  if (asText(options.caption).trim()) blocks.push(skeleton({ width: '35%', height: '0.75rem' }));
495
518
  if (options.delta !== null && options.delta !== undefined) {
@@ -144,8 +144,9 @@ button.zx-stepper__control:disabled {
144
144
  overflow-wrap: anywhere;
145
145
  }
146
146
 
147
+ /* Real text, so it takes the muted text role: placeholder ink is for empty fields only. */
147
148
  .zx-stepper__optional {
148
- color: var(--zx-color-text-placeholder);
149
+ color: var(--zx-color-text-muted);
149
150
  font-size: var(--zx-text-xs);
150
151
  font-style: italic;
151
152
  }
@@ -1,7 +1,7 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
3
3
  import { printf } from '../../core/i18n.js';
4
- import { icon } from '../../core/icons.js';
4
+ import { ICON_SIZE, icon } from '../../core/icons.js';
5
5
  import { completedByAdvance, normalizeSteps, resolveStepIndex, stepIndex, stepState } from './steps.js';
6
6
 
7
7
  /** @typedef {import('./steps.js').StepDefinition} StepDefinition */
@@ -387,8 +387,8 @@ export class Stepper extends Component {
387
387
  * @returns {Array<Node|string>}
388
388
  */
389
389
  _markerContent(state, index) {
390
- if (state === 'complete') return [icon('check', { size: 12 })];
391
- if (state === 'error') return [icon('warning', { size: 12 })];
390
+ if (state === 'complete') return [icon('check', { size: ICON_SIZE.check })];
391
+ if (state === 'error') return [icon('warning', { size: ICON_SIZE.check })];
392
392
  return this.options.showNumbers ? [String(index + 1)] : [];
393
393
  }
394
394
 
@@ -207,8 +207,8 @@
207
207
 
208
208
  .zx-tabbox[data-variant="segmented"] .zx-tabbox__tab {
209
209
  block-size: 100%;
210
- /* Nested inside the frame's 2px padding, so the inner corner is one step tighter. */
211
- border-radius: max(0px, calc(var(--zx-tabbox-radius) - 2px));
210
+ /* Concentric with the frame: its corner less the 1px border and the 2px padding between them. */
211
+ border-radius: max(0px, calc(var(--zx-tabbox-radius) - 3px));
212
212
  padding-inline: var(--zx-space-3);
213
213
  font-size: var(--zx-text-sm);
214
214
  }
@@ -1,6 +1,6 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h } from '../../core/dom.js';
3
- import { icon } from '../../core/icons.js';
3
+ import { ICON_SIZE, icon } from '../../core/icons.js';
4
4
  import { uid } from '../../core/util.js';
5
5
 
6
6
  /** @typedef {Node|Component|(() => Node|Component)} TabContent */
@@ -184,7 +184,7 @@ export class Tabbox extends Component {
184
184
  class: 'zx-tabbox__close zx-icon-btn',
185
185
  ariaHidden: 'true',
186
186
  title: this._message('tabbox.close', 'Close')
187
- }, icon('x', { size: 14 })));
187
+ }, icon('x', { size: ICON_SIZE.dismiss })));
188
188
  }
189
189
  const tab = /** @type {HTMLButtonElement} */ (h('button', {
190
190
  class: 'zx-tabbox__tab',
@@ -277,6 +277,19 @@
277
277
  inset-block-start: 0;
278
278
  }
279
279
 
280
+ /*
281
+ * Body rows keep one rhythm: a single-line row is exactly `--zx-row-height`, its divider included,
282
+ * whatever the cells hold. On a table cell `block-size` is a minimum, so wrapped text or a taller
283
+ * control still grows its row; the slim block padding leaves a content box large enough for a
284
+ * checkbox, an avatar or a badge, which the middle alignment centres. Sized as a border box here
285
+ * rather than by the scope, so the height holds in any host.
286
+ */
287
+ .zx-table__body > tr:not(.zx-table__empty-row) > :is(td, th) {
288
+ box-sizing: border-box;
289
+ block-size: var(--zx-row-height);
290
+ padding-block: var(--zx-space-1);
291
+ }
292
+
280
293
  .zx-table th[data-align="center"],
281
294
  .zx-table td[data-align="center"] {
282
295
  text-align: center;
@@ -305,14 +318,17 @@
305
318
  align-items: center;
306
319
  justify-content: space-between;
307
320
  gap: var(--zx-space-2);
308
- inline-size: 100%;
321
+ /* Wider than the cell by an inset on each side, handed back by the margins, so the hover fill
322
+ clears the label instead of hugging it while the label stays on the column's text edge. */
323
+ inline-size: calc(100% + 2 * var(--zx-space-2));
309
324
  min-block-size: 24px;
310
325
  border: 0;
311
326
  border-radius: var(--zx-radius-sm);
312
327
  background: inherit;
313
328
  color: inherit;
314
329
  margin-block: calc(-1 * var(--zx-table-sort-slack));
315
- padding: var(--zx-table-sort-slack) 0;
330
+ margin-inline: calc(-1 * var(--zx-space-2));
331
+ padding: var(--zx-table-sort-slack) var(--zx-space-2);
316
332
  /* The header's type, not a control's: base.css sets buttons in the control size and weight, and
317
333
  the browser resets their tracking, so a sortable label would not match its unsortable
318
334
  neighbours. */
@@ -341,14 +357,20 @@
341
357
  box-shadow: var(--zx-focus-ring);
342
358
  }
343
359
 
344
- .zx-table th[aria-sort="ascending"] .zx-table__sort-button::after {
345
- content: "↑";
360
+ /* The direction arrow: shown on the sorted column only, and turned to point down for a descending
361
+ sort. */
362
+ .zx-table__sort-icon {
363
+ display: none;
364
+ flex: none;
346
365
  color: var(--zx-color-text-muted);
347
366
  }
348
367
 
349
- .zx-table th[aria-sort="descending"] .zx-table__sort-button::after {
350
- content: "↓";
351
- color: var(--zx-color-text-muted);
368
+ .zx-table th[aria-sort] .zx-table__sort-icon {
369
+ display: inline-flex;
370
+ }
371
+
372
+ .zx-table th[aria-sort="descending"] .zx-table__sort-icon {
373
+ transform: rotate(180deg);
352
374
  }
353
375
 
354
376
  .zx-table__body tr:last-child td {
@@ -356,22 +378,32 @@
356
378
  }
357
379
 
358
380
  .zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"]) {
359
- background: var(--zx-color-bg-page);
381
+ --zx-table-row-fill: var(--zx-color-bg-page);
382
+ background: var(--zx-table-row-fill);
360
383
  }
361
384
 
362
385
  /* Checked rows of a multi-selection are picks and keep the accent tint. The selected row of a
363
386
  single-selection table — no checkbox column — is the record you are on, the current row of a
364
387
  master–detail list, and takes the neutral current fill instead. */
365
388
  .zx-table__body tr[aria-selected="true"] {
366
- background: var(--zx-table-row-selected-bg, var(--zx-color-bg-selected));
389
+ --zx-table-row-fill: var(--zx-table-row-selected-bg, var(--zx-color-bg-selected));
390
+ background: var(--zx-table-row-fill);
367
391
  }
368
392
 
369
393
  .zx-table__body tr[aria-selected="true"]:not(:has(> .zx-table__selection-cell)) {
370
- background: var(--zx-table-row-selected-bg, var(--zx-color-bg-current));
394
+ --zx-table-row-fill: var(--zx-table-row-selected-bg, var(--zx-color-bg-current));
371
395
  }
372
396
 
373
397
  .zx-table__body tr[data-row]:hover {
374
- background: var(--zx-color-bg-hover);
398
+ background: var(--zx-table-row-hover-bg, var(--zx-color-bg-hover));
399
+ }
400
+
401
+ /* State is never lost under the pointer: a selected, current or striped row lays the hover step
402
+ over its own fill instead of trading it for the hover fill. */
403
+ .zx-table__body tr[data-row][aria-selected="true"]:hover,
404
+ .zx-table__scroll[data-zebra="true"] .zx-table__body tr[data-row]:nth-child(even):not([aria-selected="true"]):hover {
405
+ background: linear-gradient(var(--zx-table-row-hover-bg, var(--zx-color-bg-hover)),
406
+ var(--zx-table-row-hover-bg, var(--zx-color-bg-hover))), var(--zx-table-row-fill);
375
407
  }
376
408
 
377
409
  /* ------------------------------------------------------------------ plain -- */
@@ -400,8 +432,9 @@
400
432
  background: transparent;
401
433
  }
402
434
 
435
+ /* The stripe's own rule paints this fill, and the hover step lays over it, so nothing more. */
403
436
  .zx-table[data-variant="plain"] .zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"]) {
404
- background: transparent;
437
+ --zx-table-row-fill: transparent;
405
438
  }
406
439
 
407
440
  .zx-table[data-variant="plain"] .zx-table__body tr:last-child td {
@@ -566,6 +599,7 @@
566
599
  .zx-table[data-stacked] .zx-table__body > tr[data-span] > * {
567
600
  display: block;
568
601
  inline-size: auto;
602
+ block-size: auto;
569
603
  padding-inline: 0;
570
604
  text-align: start;
571
605
  }
@@ -576,11 +610,12 @@
576
610
 
577
611
  /* --- Inline editing (Table editMode) -------------------------------------------------------- */
578
612
 
579
- /* Reserve a control-sized content box in every body cell as soon as the table is editable, so
580
- opening an editor never changes a row's height. On a table cell `block-size` is a minimum, which
581
- is exactly the wanted behaviour: taller content still grows the row. */
613
+ /* Every body cell of an editable table holds an editor's height above its divider — the row
614
+ height already does, unless a theme sets rows tighter than a control — so opening an editor
615
+ never changes a row's height. On a table cell `block-size` is a minimum, which is exactly the
616
+ wanted behaviour: taller content still grows the row. */
582
617
  .zx-table[data-edit-mode] .zx-table__body td {
583
- block-size: var(--zx-control-height);
618
+ block-size: max(var(--zx-row-height), calc(var(--zx-control-height) + 1px));
584
619
  }
585
620
 
586
621
  .zx-table__body td[data-editable="true"] {
@@ -704,6 +739,7 @@
704
739
  justify-content: space-between;
705
740
  gap: var(--zx-space-4);
706
741
  inline-size: auto;
742
+ block-size: auto;
707
743
  padding-block: var(--zx-space-1);
708
744
  padding-inline: 0;
709
745
  border: 0;
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
2
2
  import { breakpoints, onBreakpoint } from '../../core/breakpoint.js';
3
3
  import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
4
4
  import { formatCurrency, formatNumber, formatPercent } from '../../core/format.js';
5
- import { icon } from '../../core/icons.js';
5
+ import { ICON_SIZE, icon } from '../../core/icons.js';
6
6
  import { printf } from '../../core/i18n.js';
7
7
  import { uid } from '../../core/util.js';
8
8
  import { Datebox } from '../datebox/datebox.js';
@@ -1438,12 +1438,12 @@ export class Table extends Component {
1438
1438
  class: 'zx-table__column-move', type: 'button', disabled: index === 0,
1439
1439
  ariaLabel: `Move ${name} earlier`,
1440
1440
  dataset: { columnId: column.id, columnAction: 'up' }
1441
- }, icon('chevron-up', { size: 11 })),
1441
+ }, icon('chevron-up', { size: ICON_SIZE.chevron })),
1442
1442
  h('button', {
1443
1443
  class: 'zx-table__column-move', type: 'button', disabled: index === this._columns.length - 1,
1444
1444
  ariaLabel: `Move ${name} later`,
1445
1445
  dataset: { columnId: column.id, columnAction: 'down' }
1446
- }, icon('chevron-down', { size: 11 }))) : null;
1446
+ }, icon('chevron-down', { size: ICON_SIZE.chevron }))) : null;
1447
1447
  return h('div', { class: 'zx-table__column-option', dataset: { columnId: column.id } }, label, order);
1448
1448
  });
1449
1449
  this._columnList.replaceChildren(...controls, this._columnStatus);
@@ -1717,7 +1717,9 @@ export class Table extends Component {
1717
1717
  class: 'zx-table__sort-button',
1718
1718
  type: 'button',
1719
1719
  ariaLabel: name ?? undefined
1720
- }, h('span', { class: 'zx-table__header-label' }, column.label));
1720
+ }, h('span', { class: 'zx-table__header-label' }, column.label),
1721
+ // One arrow per sortable header; `aria-sort` on the header shows it and says which way.
1722
+ h('span', { class: 'zx-table__sort-icon', ariaHidden: 'true' }, icon('arrow-up', { size: ICON_SIZE.sort })));
1721
1723
  this.listen(button, 'click', () => {
1722
1724
  const direction = this._sort?.id === column.id && this._sort.dir === 'asc' ? 'desc' : 'asc';
1723
1725
  this.setSort(column.id, direction);
@@ -1955,7 +1957,7 @@ export class Table extends Component {
1955
1957
  type: 'button',
1956
1958
  tabIndex: -1,
1957
1959
  ariaExpanded: String(expanded)
1958
- }, icon(expanded ? 'chevron-down' : 'chevron-right', { size: 14 })));
1960
+ }, icon(expanded ? 'chevron-down' : 'chevron-right', { size: ICON_SIZE.chevron })));
1959
1961
  } else {
1960
1962
  branch.append(h('span', { class: 'zx-table__tree-spacer', ariaHidden: 'true' }));
1961
1963
  }