@zeyos/zx 5.6.0 → 5.7.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.
Files changed (227) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +73 -7
  3. package/bin/zx-css.js +328 -0
  4. package/dist/types/components/account-menu/account-menu.d.ts +4 -2
  5. package/dist/types/components/activity-list/activity-list.d.ts +14 -8
  6. package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
  7. package/dist/types/components/agent-thread/agent-thread.d.ts +142 -14
  8. package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
  9. package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
  10. package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
  11. package/dist/types/components/calendar/calendar-model.d.ts +9 -2
  12. package/dist/types/components/calendar/calendar.d.ts +12 -4
  13. package/dist/types/components/chart/chart.d.ts +25 -13
  14. package/dist/types/components/checklist/checklist.d.ts +29 -0
  15. package/dist/types/components/code-editor/code-editor.d.ts +7 -2
  16. package/dist/types/components/composer/composer.d.ts +206 -4
  17. package/dist/types/components/composer/queue.d.ts +76 -0
  18. package/dist/types/components/copy/copy-button.d.ts +6 -4
  19. package/dist/types/components/copy/copy-input.d.ts +10 -6
  20. package/dist/types/components/datebox/date-range-box.d.ts +33 -0
  21. package/dist/types/components/datebox/placeholder.d.ts +7 -0
  22. package/dist/types/components/dialog/dialog.d.ts +2 -2
  23. package/dist/types/components/dock/dock.d.ts +12 -3
  24. package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
  25. package/dist/types/components/field-upload/field-upload.d.ts +3 -2
  26. package/dist/types/components/file-item/file-item.d.ts +3 -2
  27. package/dist/types/components/file-list/file-list.d.ts +14 -8
  28. package/dist/types/components/filter/filter-model.d.ts +31 -1
  29. package/dist/types/components/filter/filter.d.ts +20 -2
  30. package/dist/types/components/finder/finder.d.ts +14 -6
  31. package/dist/types/components/flag/flag.d.ts +99 -0
  32. package/dist/types/components/grid/grid.d.ts +1 -1
  33. package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
  34. package/dist/types/components/launcher/launcher.d.ts +2 -0
  35. package/dist/types/components/modal/modal.d.ts +34 -8
  36. package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
  37. package/dist/types/components/number-field/number-field.d.ts +41 -7
  38. package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
  39. package/dist/types/components/prose/prose.d.ts +9 -6
  40. package/dist/types/components/questionnaire/conditions.d.ts +270 -0
  41. package/dist/types/components/questionnaire/items.d.ts +52 -30
  42. package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
  43. package/dist/types/components/rating/rating.d.ts +5 -3
  44. package/dist/types/components/select/country.d.ts +106 -0
  45. package/dist/types/components/select/field-adapter.d.ts +2 -1
  46. package/dist/types/components/select/locale.d.ts +102 -0
  47. package/dist/types/components/select/select.d.ts +41 -2
  48. package/dist/types/components/sheet/sheet.d.ts +2 -2
  49. package/dist/types/components/slider/slider.d.ts +1 -0
  50. package/dist/types/components/sort-control/sort-control.d.ts +7 -3
  51. package/dist/types/components/source-list/source-list.d.ts +7 -5
  52. package/dist/types/components/split-view/split-view.d.ts +5 -3
  53. package/dist/types/components/surface/catalog.d.ts +260 -0
  54. package/dist/types/components/surface/elicit.d.ts +81 -0
  55. package/dist/types/components/surface/mcp.d.ts +165 -0
  56. package/dist/types/components/surface/schema.d.ts +314 -0
  57. package/dist/types/components/surface/stream.d.ts +118 -0
  58. package/dist/types/components/surface/surface.d.ts +718 -0
  59. package/dist/types/components/surface/text.d.ts +277 -0
  60. package/dist/types/components/surface/validate.d.ts +339 -0
  61. package/dist/types/components/table/table.d.ts +55 -3
  62. package/dist/types/components/table/window.d.ts +203 -0
  63. package/dist/types/components/toolbar/toolbar.d.ts +10 -6
  64. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  65. package/dist/types/components/tree/tree.d.ts +20 -13
  66. package/dist/types/core/component.d.ts +10 -0
  67. package/dist/types/core/date.d.ts +8 -1
  68. package/dist/types/core/dom.d.ts +15 -0
  69. package/dist/types/core/http.d.ts +10 -0
  70. package/dist/types/core/i18n.d.ts +38 -0
  71. package/dist/types/core/messages.d.ts +344 -1
  72. package/dist/types/core/storage.d.ts +7 -2
  73. package/dist/types/elements/define.d.ts +21 -46
  74. package/dist/types/elements/definitions.d.ts +147 -0
  75. package/dist/types/elements/kit.d.ts +7 -0
  76. package/dist/types/elements/reflect.d.ts +6 -3
  77. package/dist/types/index.d.ts +10 -1
  78. package/dist/types/internal/date-locale.d.ts +7 -0
  79. package/dist/types/internal/json-patch.d.ts +146 -0
  80. package/dist/types/locales/de.d.ts +13 -0
  81. package/dist/types/locales/en.d.ts +2 -0
  82. package/dist/types/locales/index.d.ts +823 -0
  83. package/dist/types/zeyos/view.d.ts +8 -1
  84. package/dist/zx-zeyos.esm.js +16852 -15131
  85. package/dist/zx-zeyos.esm.min.js +5 -5
  86. package/dist/zx.core.css +1276 -0
  87. package/dist/zx.core.min.css +1 -0
  88. package/dist/zx.css +520 -143
  89. package/dist/zx.esm.js +40940 -29684
  90. package/dist/zx.esm.min.js +36 -23
  91. package/dist/zx.global.js +40940 -29684
  92. package/dist/zx.global.min.js +36 -23
  93. package/dist/zx.layered.css +17315 -0
  94. package/dist/zx.layered.min.css +1 -0
  95. package/dist/zx.min.css +1 -1
  96. package/docs/agent-catalog.json +12501 -0
  97. package/docs/agent-surfaces.md +340 -0
  98. package/docs/api.json +909 -137
  99. package/docs/llms.md +1046 -80
  100. package/docs/llms.txt +30 -9
  101. package/package.json +29 -6
  102. package/src/components/account-menu/account-menu.js +6 -3
  103. package/src/components/activity-item/activity-item.js +2 -1
  104. package/src/components/activity-list/activity-list.js +16 -10
  105. package/src/components/agent-thread/ag-ui.js +1439 -0
  106. package/src/components/agent-thread/agent-thread.js +359 -54
  107. package/src/components/agent-thread/ui-message-stream.js +1281 -0
  108. package/src/components/app-sidebar/app-sidebar.js +18 -8
  109. package/src/components/approval-card/approval-card.js +3 -2
  110. package/src/components/block-view/block-view.js +7 -6
  111. package/src/components/breadcrumb/breadcrumb.js +8 -5
  112. package/src/components/button/button.css +24 -11
  113. package/src/components/calendar/calendar-model.js +8 -2
  114. package/src/components/calendar/calendar.js +53 -18
  115. package/src/components/chart/chart.js +54 -23
  116. package/src/components/checklist/checklist.css +9 -1
  117. package/src/components/checklist/checklist.js +59 -3
  118. package/src/components/checklist/field-adapter.js +2 -11
  119. package/src/components/code-editor/code-editor.js +45 -8
  120. package/src/components/code-editor/field-adapter.js +1 -1
  121. package/src/components/composer/composer.css +80 -1
  122. package/src/components/composer/composer.js +390 -16
  123. package/src/components/composer/queue.js +78 -0
  124. package/src/components/context-menu/context-menu.js +12 -1
  125. package/src/components/copy/copy-button.js +9 -7
  126. package/src/components/copy/copy-input.js +10 -6
  127. package/src/components/date-picker/date-picker.js +2 -1
  128. package/src/components/date-picker/date-range-picker.js +8 -7
  129. package/src/components/datebox/date-range-box.js +3 -9
  130. package/src/components/datebox/datebox.js +18 -21
  131. package/src/components/datebox/placeholder.js +18 -0
  132. package/src/components/dialog/dialog.js +4 -5
  133. package/src/components/dock/dock.js +34 -13
  134. package/src/components/entity-ref/entity-ref.js +16 -5
  135. package/src/components/field-upload/field-upload.js +81 -38
  136. package/src/components/file-item/file-item.js +70 -40
  137. package/src/components/file-list/file-list.js +15 -9
  138. package/src/components/filter/filter-model.js +46 -8
  139. package/src/components/filter/filter.css +3 -3
  140. package/src/components/filter/filter.js +29 -10
  141. package/src/components/filter-panel/filter-panel.js +13 -5
  142. package/src/components/finder/finder.js +50 -26
  143. package/src/components/flag/flag.css +40 -0
  144. package/src/components/flag/flag.js +177 -0
  145. package/src/components/form/form.js +1 -1
  146. package/src/components/grid/grid.js +22 -8
  147. package/src/components/kanban-view/kanban-view.js +51 -81
  148. package/src/components/launcher/launcher.js +17 -2
  149. package/src/components/list-toolbar/list-toolbar.js +2 -1
  150. package/src/components/master-panel/master-panel.js +1 -1
  151. package/src/components/menu-button/menu-button.js +4 -0
  152. package/src/components/message/message.js +3 -0
  153. package/src/components/modal/modal.js +62 -8
  154. package/src/components/multi-value-editor/multi-value-editor.js +10 -9
  155. package/src/components/navigation-bar/navigation-bar.js +3 -3
  156. package/src/components/number-field/number-field.js +98 -29
  157. package/src/components/prompt-starters/prompt-starters.css +91 -0
  158. package/src/components/prompt-starters/prompt-starters.js +206 -0
  159. package/src/components/prose/prose.js +14 -10
  160. package/src/components/questionnaire/conditions.js +666 -0
  161. package/src/components/questionnaire/items.js +150 -41
  162. package/src/components/questionnaire/questionnaire.js +126 -32
  163. package/src/components/rating/rating.js +5 -4
  164. package/src/components/run-status/run-status.js +2 -2
  165. package/src/components/select/country.js +136 -0
  166. package/src/components/select/field-adapter.js +7 -2
  167. package/src/components/select/locale.js +219 -0
  168. package/src/components/select/select.css +20 -22
  169. package/src/components/select/select.js +94 -12
  170. package/src/components/sheet/sheet-stack.js +10 -1
  171. package/src/components/sheet/sheet.js +12 -5
  172. package/src/components/slider/slider.js +7 -2
  173. package/src/components/sort-control/sort-control.js +15 -5
  174. package/src/components/source-list/source-list.js +7 -4
  175. package/src/components/split-view/split-view.js +5 -3
  176. package/src/components/surface/catalog.js +1334 -0
  177. package/src/components/surface/elicit.js +107 -0
  178. package/src/components/surface/mcp.js +243 -0
  179. package/src/components/surface/schema.js +644 -0
  180. package/src/components/surface/stream.js +245 -0
  181. package/src/components/surface/surface.css +308 -0
  182. package/src/components/surface/surface.js +2291 -0
  183. package/src/components/surface/text.js +513 -0
  184. package/src/components/surface/validate.js +2218 -0
  185. package/src/components/tabbox/tabbox.js +9 -0
  186. package/src/components/table/table.css +63 -3
  187. package/src/components/table/table.js +167 -28
  188. package/src/components/table/window.js +317 -0
  189. package/src/components/toolbar/toolbar.js +12 -7
  190. package/src/components/tooltip/tooltip.css +2 -3
  191. package/src/components/tooltip/tooltip.js +32 -5
  192. package/src/components/tree/tree.js +53 -23
  193. package/src/core/component.js +25 -1
  194. package/src/core/date.js +62 -16
  195. package/src/core/dom.js +67 -4
  196. package/src/core/format.js +15 -13
  197. package/src/core/http.js +29 -20
  198. package/src/core/i18n.js +83 -10
  199. package/src/core/icons.js +13 -2
  200. package/src/core/keyboard.js +79 -8
  201. package/src/core/messages.js +376 -2
  202. package/src/core/overlay-host.js +1 -0
  203. package/src/core/position.js +3 -2
  204. package/src/core/storage.js +59 -6
  205. package/src/elements/define.js +178 -130
  206. package/src/elements/definitions.js +229 -0
  207. package/src/elements/kit.js +444 -0
  208. package/src/elements/reflect.js +8 -3
  209. package/src/index.js +10 -1
  210. package/src/internal/date-locale.js +11 -0
  211. package/src/internal/json-patch.js +405 -0
  212. package/src/locales/de.js +911 -0
  213. package/src/locales/en.js +2 -0
  214. package/src/locales/index.js +7 -0
  215. package/src/zeyos/calendar.js +2 -1
  216. package/src/zeyos/form.js +2 -1
  217. package/src/zeyos/launcher.js +7 -6
  218. package/src/zeyos/module-bar.js +2 -1
  219. package/src/zeyos/schema.js +37 -23
  220. package/src/zeyos/select.js +4 -3
  221. package/src/zeyos/table.js +2 -13
  222. package/src/zeyos/view.js +57 -17
  223. package/styles/core.css +11 -0
  224. package/styles/tokens/semantic.css +1 -0
  225. package/styles/zeyos.css +2 -0
  226. package/styles/zx.css +4 -8
  227. package/styles/zx.layered.css +1 -0
@@ -54,9 +54,11 @@ const PRESENTATIONS = Object.freeze(['expanded', 'compact', 'collapsed']);
54
54
  * @property {boolean} [presentationSwitch=true] Modules layout: whether the strip's foot carries the
55
55
  * switch between presentations. Turn it off when the choice lives elsewhere — an account menu,
56
56
  * through `presentationChoice()`.
57
- * @property {string} [label='Applications'] Navigation accessible label.
58
- * @property {string} [moreLabel='More actions'] Name of a destination's overflow menu when its
59
- * `actions` fold; every action name is followed by the destination's label.
57
+ * @property {string|null} [label] Navigation accessible label, by default the `appSidebar.label`
58
+ * message ("Applications"). Null leaves the navigation unnamed.
59
+ * @property {string|null} [moreLabel=null] Name of a destination's overflow menu when its `actions`
60
+ * fold; every action name is followed by the destination's label. Null reads the `appSidebar.more`
61
+ * message ("More actions").
60
62
  * @property {Node|string|number|{toElement: () => Node|null}|null} [header=null] Expanded header content;
61
63
  * in the modules layout, content above every module's menu.
62
64
  * @property {Node|string|number|{toElement: () => Node|null}|null} [footer=null] Expanded sticky footer content.
@@ -105,8 +107,9 @@ export class AppSidebar extends Component {
105
107
  presentation: null,
106
108
  presentations: ['expanded', 'compact', 'collapsed'],
107
109
  presentationSwitch: true,
108
- label: 'Applications',
109
- moreLabel: 'More actions',
110
+ // Undefined rather than null, which leaves the navigation unnamed.
111
+ label: undefined,
112
+ moreLabel: null,
110
113
  header: null,
111
114
  footer: null,
112
115
  railHeader: null,
@@ -500,6 +503,12 @@ export class AppSidebar extends Component {
500
503
  else this._renderExpanded();
501
504
  }
502
505
 
506
+ /** @returns {string|null} The navigation's name: unset reads the catalogue, and null is no name. */
507
+ _navigationLabel() {
508
+ const { label = this.msg('appSidebar.label') } = this.options;
509
+ return label;
510
+ }
511
+
503
512
  /** @returns {void} */
504
513
  _renderExpanded() {
505
514
  const headerContent = h('div', { class: 'zx-app-sidebar__header-content' });
@@ -511,7 +520,7 @@ export class AppSidebar extends Component {
511
520
  const list = h('ul', { class: 'zx-app-sidebar__list' });
512
521
  const expanded = h('div', { class: 'zx-app-sidebar__expanded' },
513
522
  h('header', { class: 'zx-app-sidebar__header' }, headerContent, collapseButton),
514
- h('nav', { class: 'zx-app-sidebar__nav', ariaLabel: this.options.label }, list),
523
+ h('nav', { class: 'zx-app-sidebar__nav', ariaLabel: this._navigationLabel() }, list),
515
524
  footer);
516
525
  this.refs.expanded = expanded;
517
526
  this.refs.list = list;
@@ -567,7 +576,7 @@ export class AppSidebar extends Component {
567
576
  active: this._active,
568
577
  orientation: this._orientation,
569
578
  side: this._side,
570
- label: this.options.label,
579
+ label: this._navigationLabel(),
571
580
  header: railHeader.hasChildNodes() ? railHeader : null,
572
581
  footer: this.options.railFooter,
573
582
  openDelay: this.options.openDelay,
@@ -1023,7 +1032,7 @@ export class AppSidebar extends Component {
1023
1032
  const strip = renderRowActions(entries, {
1024
1033
  block: 'app-sidebar',
1025
1034
  name: item.label,
1026
- moreLabel: String(this.options.moreLabel ?? 'More actions'),
1035
+ moreLabel: String(this.options.moreLabel ?? this.msg('appSidebar.more')),
1027
1036
  run: (action) => action.onSelect(item)
1028
1037
  });
1029
1038
  if (strip) this._strips.set(String(item.id), strip);
@@ -1088,6 +1097,7 @@ export class AppSidebar extends Component {
1088
1097
  const index = controls.indexOf(current);
1089
1098
  if (event.key === 'ArrowRight' && item?.children?.length) {
1090
1099
  event.preventDefault();
1100
+ if (item.disabled) return;
1091
1101
  if (!this._expanded.has(String(item.id))) this.toggleBranch(item.id);
1092
1102
  else visibleTreeControls(current.closest('.zx-app-sidebar__row')?.querySelector(':scope > .zx-app-sidebar__sublist'))[0]?.focus();
1093
1103
  return;
@@ -2,6 +2,7 @@
2
2
  import { Component } from '../../core/component.js';
3
3
  import { formatDate } from '../../core/date.js';
4
4
  import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
5
+ import { translate } from '../../core/i18n.js';
5
6
  import { icon } from '../../core/icons.js';
6
7
  import { isEditableTarget } from '../../core/keyboard.js';
7
8
  import { uid } from '../../core/util.js';
@@ -1129,8 +1130,8 @@ export function toDate(value) {
1129
1130
  * @returns {string} A `formatDate()` pattern.
1130
1131
  */
1131
1132
  export function answeredTimeFormat(date, now = new Date()) {
1132
- if (date.getFullYear() !== now.getFullYear()) return '%e %b %Y, %H:%M';
1133
- if (date.getMonth() !== now.getMonth() || date.getDate() !== now.getDate()) return '%e %b, %H:%M';
1133
+ if (date.getFullYear() !== now.getFullYear()) return translate('approvalCard.fullDateTimeFormat');
1134
+ if (date.getMonth() !== now.getMonth() || date.getDate() !== now.getDate()) return translate('approvalCard.dateTimeFormat');
1134
1135
  return '%H:%M';
1135
1136
  }
1136
1137
 
@@ -1,6 +1,7 @@
1
1
  // @ts-check
2
2
  import { Component } from '../../core/component.js';
3
3
  import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
4
+ import { translate } from '../../core/i18n.js';
4
5
  import { icon } from '../../core/icons.js';
5
6
  import { blocksToMarkdown, blocksToText, figureRow, parseInline } from '../../internal/agent-model.js';
6
7
  import { highlight } from '../../internal/highlight.js';
@@ -376,13 +377,13 @@ export function renderBlocks(blocks, options = {}) {
376
377
  }
377
378
 
378
379
  /**
379
- * @param {string} key
380
- * @param {...unknown} args
380
+ * Resolves a message when no component does: the host translator, then the catalogue.
381
+ * @param {string} key Message key.
382
+ * @param {...unknown} args Placeholder values.
381
383
  * @returns {string}
382
384
  */
383
- function englishMessage(key, ...args) {
384
- const text = MESSAGES[/** @type {keyof typeof MESSAGES} */ (key)] ?? key;
385
- return text.replace(/%(\d+)/g, (match, index) => String(args[Number(index) - 1] ?? match));
385
+ function catalogueMessage(key, ...args) {
386
+ return translate(key, args);
386
387
  }
387
388
 
388
389
  /**
@@ -406,7 +407,7 @@ function inlineNodes(text, cite) {
406
407
  * @returns {HTMLElement}
407
408
  */
408
409
  function renderBlock(block, options) {
409
- const msg = options.msg ?? englishMessage;
410
+ const msg = options.msg ?? catalogueMessage;
410
411
  const cite = options.cite;
411
412
  const base = Math.min(5, Math.max(2, Number(options.headingLevel) || 3));
412
413
  switch (block.type) {
@@ -104,7 +104,7 @@ export class Breadcrumb extends Component {
104
104
  const control = /** @type {Element} */ (event.target).closest?.('[data-crumb]');
105
105
  if (!control || !list.contains(control)) return;
106
106
  // A crumb with an href is an ordinary link: report the selection and let the browser follow.
107
- this._select(/** @type {HTMLElement} */ (control).dataset.crumb);
107
+ if (this._select(/** @type {HTMLElement} */ (control).dataset.crumb)?.defaultPrevented) event.preventDefault();
108
108
  });
109
109
  return root;
110
110
  }
@@ -283,11 +283,14 @@ export class Breadcrumb extends Component {
283
283
  const trigger = this._overflow.toElement();
284
284
  trigger.classList.add('zx-breadcrumb__more');
285
285
  trigger.setAttribute('aria-label', this._message('breadcrumb.more', 'Show hidden levels'));
286
- this._overflow.on('select', (event) => this._select(String(event.detail.value)));
286
+ this._overflow.on('select', (event) => {
287
+ if (this._select(String(event.detail.value))?.defaultPrevented) event.preventDefault();
288
+ });
287
289
  }
288
290
  this._overflow.setItems(hidden.map((item) => ({
289
291
  label: item.label,
290
292
  value: item.name,
293
+ href: item.href ?? undefined,
291
294
  icon: item.icon ?? undefined
292
295
  })));
293
296
  return /** @type {HTMLElement} */ (this._overflow.toElement());
@@ -301,13 +304,13 @@ export class Breadcrumb extends Component {
301
304
 
302
305
  /**
303
306
  * @param {string|undefined} name Item name from a control's `data-crumb`.
304
- * @returns {void}
307
+ * @returns {CustomEvent<BreadcrumbSelectDetail>|undefined}
305
308
  * @fires Breadcrumb#select
306
309
  */
307
310
  _select(name) {
308
311
  const index = this._items.findIndex((item) => item.name === name);
309
312
  if (index < 0) return;
310
- this.emit('select', { name: this._items[index].name, item: { ...this._items[index] }, index });
313
+ return this.emit('select', { name: this._items[index].name, item: { ...this._items[index] }, index });
311
314
  }
312
315
 
313
316
  /**
@@ -325,7 +328,7 @@ export class Breadcrumb extends Component {
325
328
 
326
329
  /**
327
330
  * Fired when an interactive crumb is chosen, from the trail itself or from the overflow menu. A
328
- * crumb with an `href` still navigates: the event reports the choice, it does not gate it.
331
+ * crumb with an `href` navigates natively unless the selection is prevented.
329
332
  * @event Breadcrumb#select
330
333
  * @type {CustomEvent<BreadcrumbSelectDetail>}
331
334
  */
@@ -108,24 +108,32 @@
108
108
  color: var(--zx-color-text);
109
109
  }
110
110
 
111
- /* A pressed toggle (`aria-pressed="true"`, e.g. a Toolbar item with `active`) is a mode you are
112
- in, not a pick: the neutral current fill and the full text colour, never the accent. */
111
+ /* A pressed toggle (`aria-pressed="true"`, e.g. a Toolbar item with `active`, a segment of a
112
+ button group) is a mode you are in, not a pick: neutral, never the accent. Two cues carry it,
113
+ because a few percent of fill alone disappears beside an unpressed neighbour, in dark most of
114
+ all: a fill clearly stronger than hover, and a frame in the subtle ink, which holds 3:1 on every
115
+ surface. The raised highlight goes, so the control reads as pushed in. A ghost button gains the
116
+ frame too; it is the only edge its pressed state has. */
113
117
  .zx-btn[aria-pressed="true"] {
114
- border-color: var(--zx-color-border-control);
115
- background: var(--zx-color-bg-current);
118
+ border-color: var(--zx-color-text-subtle);
119
+ background: color-mix(in srgb, var(--zx-color-text) 14%, transparent);
116
120
  color: var(--zx-color-text);
117
- }
118
-
119
- .zx-btn[data-kind="ghost"][aria-pressed="true"] {
120
- border-color: transparent;
121
+ box-shadow: none;
121
122
  }
122
123
 
123
124
  .zx-btn[aria-pressed="true"] > .zx-icon {
124
125
  color: var(--zx-color-text);
125
126
  }
126
127
 
127
- .zx-btn[aria-pressed="true"]:hover:not(:disabled) {
128
- background: var(--zx-color-bg-current);
128
+ .zx-btn[aria-pressed="true"]:hover:not(:disabled),
129
+ .zx-btn[aria-pressed="true"]:active:not(:disabled),
130
+ .zx-btn[data-kind="ghost"][aria-pressed="true"][aria-expanded="true"]:not(:disabled) {
131
+ border-color: var(--zx-color-text-subtle);
132
+ background: color-mix(in srgb, var(--zx-color-text) 14%, transparent);
133
+ }
134
+
135
+ .zx-btn[aria-pressed="true"]:focus-visible {
136
+ box-shadow: var(--zx-focus-ring);
129
137
  }
130
138
 
131
139
  .zx-btn[data-size="sm"] {
@@ -180,10 +188,15 @@
180
188
  border-end-end-radius: 0;
181
189
  }
182
190
 
183
- .zx-btn-group > .zx-btn:focus-visible {
191
+ /* Neighbours overlap by their border; the pressed segment's frame stays on top of both. */
192
+ .zx-btn-group > .zx-btn[aria-pressed="true"] {
184
193
  z-index: 1;
185
194
  }
186
195
 
196
+ .zx-btn-group > .zx-btn:focus-visible {
197
+ z-index: 2;
198
+ }
199
+
187
200
  @media (prefers-reduced-transparency: reduce) {
188
201
  .zx-btn {
189
202
  background: var(--zx-color-bg-control);
@@ -1,3 +1,5 @@
1
+ import { translate } from '../../core/i18n.js';
2
+
1
3
  /** @typedef {'agenda'|'day'|'week'|'month'|'year'} CalendarView */
2
4
  /** @typedef {string|((record: Record<string, any>) => unknown)} CalendarReader */
3
5
 
@@ -27,6 +29,8 @@
27
29
  * @property {CalendarReader} [eventEditable='editable'] Move-policy reader.
28
30
  * @property {CalendarReader} [eventDurationEditable='durationEditable'] Resize-policy reader.
29
31
  * @property {'milliseconds'|'seconds'} [dateUnit='milliseconds'] Unit used for numeric dates.
32
+ * @property {string} [untitledTitle] Title of an event without one, by default the `calendar.untitled`
33
+ * message ("Untitled event").
30
34
  */
31
35
 
32
36
  /** @type {readonly CalendarView[]} */
@@ -152,7 +156,8 @@ export function normalizeCalendarEvents(records, options = {}) {
152
156
  : calendarDate(rawEnd, unit, `event ${key} end`);
153
157
  if (end < start) throw new RangeError(`Calendar event ${key} ends before it starts`);
154
158
 
155
- const title = String(readCalendarValue(record, readers.title) ?? '').trim() || 'Untitled event';
159
+ const title = String(readCalendarValue(record, readers.title) ?? '').trim()
160
+ || (options.untitledTitle ?? translate('calendar.untitled'));
156
161
  const location = String(readCalendarValue(record, readers.location) ?? '').trim();
157
162
  const editable = optionalBoolean(readCalendarValue(record, readers.editable));
158
163
  const durationEditable = optionalBoolean(readCalendarValue(record, readers.durationEditable));
@@ -408,7 +413,8 @@ function dateAtMinutes(day, minutes) {
408
413
 
409
414
  /** @param {Date} day @param {Date} value @returns {number} */
410
415
  function minutesSinceDay(day, value) {
411
- return (value.getTime() - day.getTime()) / 60_000;
416
+ return calendarDayDifference(day, value) * 1440 + value.getHours() * 60
417
+ + value.getMinutes() + value.getSeconds() / 60 + value.getMilliseconds() / 60_000;
412
418
  }
413
419
 
414
420
  /** @param {unknown} value @param {string} label @returns {Date} */
@@ -8,6 +8,7 @@ import {
8
8
  cloneCalendarEvent, layoutCalendarSpans, layoutTimedCalendarEvents, normalizeCalendarEvents,
9
9
  shiftCalendarEvent, startOfCalendarDay
10
10
  } from './calendar-model.js';
11
+ import { dateLocale } from '../../internal/date-locale.js';
11
12
 
12
13
  /** @typedef {import('./calendar-model.js').CalendarEvent} CalendarEvent */
13
14
  /** @typedef {import('./calendar-model.js').CalendarView} CalendarView */
@@ -19,7 +20,8 @@ import {
19
20
  * @property {Date|string|number|null} [date=null] Initial local anchor date; null uses today.
20
21
  * @property {CalendarView} [view='month'] Initial view.
21
22
  * @property {CalendarView[]} [views=['agenda','day','week','month','year']] Allowed views.
22
- * @property {string|string[]} [locale] Intl locale override.
23
+ * @property {string|string[]} [locale] Intl locale override. Unset, dates follow `setLanguage()`, and
24
+ * the browser's language under an English one.
23
25
  * @property {number} [weekStart=1] First weekday, 0 (Sunday) through 6 (Saturday).
24
26
  * @property {boolean} [weekNumbers=true] Show ISO week numbers in month view.
25
27
  * @property {boolean} [workweek=false] Show Monday–Friday in the week time grid.
@@ -268,7 +270,9 @@ export class Calendar extends Component {
268
270
  };
269
271
  // `source` is assembled from canonical keys, so the configured readers must not be reapplied
270
272
  // here — but `dateUnit` must, or a numeric change is read in the wrong unit.
271
- const [next] = normalizeCalendarEvents([source], { dateUnit: this.options.dateUnit });
273
+ const [next] = normalizeCalendarEvents([source], {
274
+ dateUnit: this.options.dateUnit, untitledTitle: this.msg('calendar.untitled')
275
+ });
272
276
  next.data = source.data;
273
277
  this._events = this._events.map((event, eventIndex) => eventIndex === index ? next : event);
274
278
  this._mutationVersions.delete(String(id));
@@ -386,6 +390,7 @@ export class Calendar extends Component {
386
390
  eventLocation: this.options.eventLocation,
387
391
  eventEditable: this.options.eventEditable,
388
392
  eventDurationEditable: this.options.eventDurationEditable,
393
+ untitledTitle: this.msg('calendar.untitled'),
389
394
  dateUnit: this.options.dateUnit
390
395
  };
391
396
  }
@@ -497,11 +502,11 @@ export class Calendar extends Component {
497
502
  let firstTabStop = true;
498
503
  for (let row = 0; row < slotCount; row += 1) {
499
504
  const minutes = min + row * slot;
500
- axis.append(h('span', { class: 'zx-calendar__time-label' }, minutes % 60 === 0 ? formatTimeMinutes(minutes, this.options.locale) : ''));
505
+ axis.append(h('span', { class: 'zx-calendar__time-label' }, minutes % 60 === 0 ? formatTimeMinutes(minutes, this._locale()) : ''));
501
506
  for (let column = 0; column < days.length; column += 1) {
502
507
  const date = dateWithMinutes(days[column], minutes);
503
508
  const key = String(date.getTime());
504
- const tabbable = this._focusedSlot ? this._focusedSlot === key : firstTabStop;
509
+ const tabbable = firstTabStop && (!this._focusedSlot || this._focusedSlot === key);
505
510
  if (tabbable) firstTabStop = false;
506
511
  slots.append(h('button', {
507
512
  type: 'button',
@@ -521,6 +526,9 @@ export class Calendar extends Component {
521
526
  }));
522
527
  }
523
528
  }
529
+ // A remembered date can leave the visible period. Keep a reachable stop even when navigation
530
+ // happened while focus was outside the grid; focus restoration may choose a relative slot.
531
+ if (firstTabStop && slots.firstElementChild) slots.firstElementChild.tabIndex = 0;
524
532
  const eventsLayer = h('div', { class: 'zx-calendar__timed-events', ariaHidden: 'false' });
525
533
  days.forEach((day, dayIndex) => {
526
534
  const layouts = layoutTimedCalendarEvents(this._events, day, {
@@ -756,7 +764,7 @@ export class Calendar extends Component {
756
764
  insetBlockStart: `${((minutes - min) / (max - min)) * 100}%`,
757
765
  '--zx-calendar-now-day': String(dayIndex)
758
766
  } : null
759
- }, h('span', { class: 'zx-calendar__now-time' }, formatTimeMinutes(minutes, this.options.locale)));
767
+ }, h('span', { class: 'zx-calendar__now-time' }, formatTimeMinutes(minutes, this._locale())));
760
768
  }
761
769
 
762
770
  /** @param {Event} event @returns {void} */
@@ -891,6 +899,9 @@ export class Calendar extends Component {
891
899
  const edit = this._keyboardEdit;
892
900
  if (edit.action === 'move') edit.event = shiftCalendarEvent(edit.event, { days, minutes });
893
901
  else {
902
+ const end = addCalendarDays(edit.event.end, days);
903
+ end.setMinutes(end.getMinutes() + minutes);
904
+ if (end <= edit.event.start) return;
894
905
  const proposed = shiftCalendarEvent(edit.event, { days: 0, minutes: 0, endDays: days, endMinutes: minutes });
895
906
  if (proposed.end > proposed.start) edit.event = proposed;
896
907
  }
@@ -1325,7 +1336,7 @@ export class Calendar extends Component {
1325
1336
  if (this._view === 'month') return this._format(this._date, { month: 'long', year: 'numeric' });
1326
1337
  if (this._view === 'year') return this._format(this._date, { year: 'numeric' });
1327
1338
  const last = addCalendarDays(range.end, -1);
1328
- const formatter = new Intl.DateTimeFormat(this.options.locale, {
1339
+ const formatter = new Intl.DateTimeFormat(this._locale(), {
1329
1340
  day: 'numeric', month: 'long', year: 'numeric'
1330
1341
  });
1331
1342
  if (typeof formatter.formatRange === 'function') return formatter.formatRange(range.start, last);
@@ -1342,29 +1353,36 @@ export class Calendar extends Component {
1342
1353
  _eventTime(event, day) {
1343
1354
  if (event.allDay) return this.msg('calendar.allDay');
1344
1355
  if (calendarEventSpansDays(event)) {
1345
- if (sameCalendarDay(event.start, day)) return `${formatDateTime(event.start, this.options.locale)} →`;
1346
- if (sameCalendarDay(event.end, day)) return `→ ${formatDateTime(event.end, this.options.locale)}`;
1356
+ if (sameCalendarDay(event.start, day)) return `${formatDateTime(event.start, this._locale())} →`;
1357
+ if (sameCalendarDay(event.end, day)) return `→ ${formatDateTime(event.end, this._locale())}`;
1347
1358
  return this.msg('calendar.allDay');
1348
1359
  }
1349
- const start = formatTimeDate(event.start, this.options.locale);
1360
+ const start = formatTimeDate(event.start, this._locale());
1350
1361
  if (event.end <= event.start) return start;
1351
- return `${start}–${formatTimeDate(event.end, this.options.locale)}`;
1362
+ return `${start}–${formatTimeDate(event.end, this._locale())}`;
1352
1363
  }
1353
1364
 
1354
1365
  /** @param {CalendarEvent} event @returns {string} */
1355
1366
  _eventLabel(event) {
1356
1367
  const location = event.location ? `, ${event.location}` : '';
1357
- return `${event.title}, ${formatDateTime(event.start, this.options.locale)} to ${formatDateTime(event.end, this.options.locale)}${location}`;
1368
+ const label = this.msg('calendar.eventLabel', event.title,
1369
+ formatDateTime(event.start, this._locale()), formatDateTime(event.end, this._locale()));
1370
+ return `${label}${location}`;
1358
1371
  }
1359
1372
 
1360
1373
  /** @param {Date} date @returns {string} */
1361
1374
  _dateTimeLabel(date) {
1362
- return formatDateTime(date, this.options.locale);
1375
+ return formatDateTime(date, this._locale());
1376
+ }
1377
+
1378
+ /** @returns {string|string[]|undefined} The locale this calendar writes its dates in. */
1379
+ _locale() {
1380
+ return dateLocale(this.options.locale);
1363
1381
  }
1364
1382
 
1365
1383
  /** @param {Date} date @param {Intl.DateTimeFormatOptions} options @returns {string} */
1366
1384
  _format(date, options) {
1367
- return new Intl.DateTimeFormat(this.options.locale, options).format(date);
1385
+ return new Intl.DateTimeFormat(this._locale(), options).format(date);
1368
1386
  }
1369
1387
 
1370
1388
  /** @returns {Date} */
@@ -1389,7 +1407,7 @@ export class Calendar extends Component {
1389
1407
  if (target.dataset.slot) this._focusedSlot = target.dataset.slot;
1390
1408
  }
1391
1409
 
1392
- /** @returns {{eventId?: string, eventAction?: string, date?: string, slot?: string}|null} */
1410
+ /** @returns {{eventId?: string, eventAction?: string, date?: string, slot?: string, row?: string, column?: string}|null} */
1393
1411
  _focusIdentity() {
1394
1412
  const active = document.activeElement;
1395
1413
  if (!(active instanceof HTMLElement) || !this.el.contains(active)) return null;
@@ -1397,16 +1415,33 @@ export class Calendar extends Component {
1397
1415
  eventId: active.dataset.eventId,
1398
1416
  eventAction: active.dataset.eventAction,
1399
1417
  date: active.dataset.date,
1400
- slot: active.dataset.slot
1418
+ slot: active.dataset.slot,
1419
+ row: active.dataset.rowIndex,
1420
+ column: active.dataset.dayIndex
1401
1421
  };
1402
1422
  }
1403
1423
 
1404
- /** @param {{eventId?: string, eventAction?: string, date?: string, slot?: string}} identity @returns {void} */
1424
+ /** @param {{eventId?: string, eventAction?: string, date?: string, slot?: string, row?: string, column?: string}} identity @returns {void} */
1405
1425
  _restoreFocus(identity) {
1406
1426
  let target = null;
1407
1427
  if (identity.eventId) target = this.el.querySelector(
1408
1428
  `[data-event-id="${cssEscape(identity.eventId)}"][data-event-action="${identity.eventAction ?? 'activate'}"]`);
1409
- if (!target && identity.slot) target = this.el.querySelector(`[data-slot="${cssEscape(identity.slot)}"]`);
1429
+ if (!target && identity.slot) {
1430
+ const slots = [...this.el.querySelectorAll('[data-slot]:not(:disabled)')];
1431
+ target = slots.find((slot) => slot.dataset.slot === identity.slot) ?? null;
1432
+ if (!target) {
1433
+ // Rows and columns describe local time and relative day, unlike the old absolute timestamp.
1434
+ const row = Number(identity.row) || 0;
1435
+ const column = Number(identity.column) || 0;
1436
+ target = slots.sort((left, right) =>
1437
+ Math.abs(Number(left.dataset.rowIndex) - row) - Math.abs(Number(right.dataset.rowIndex) - row)
1438
+ || Math.abs(Number(left.dataset.dayIndex) - column) - Math.abs(Number(right.dataset.dayIndex) - column))[0] ?? null;
1439
+ }
1440
+ if (target) {
1441
+ for (const slot of slots) slot.tabIndex = slot === target ? 0 : -1;
1442
+ this._focusedSlot = target.dataset.slot;
1443
+ }
1444
+ }
1410
1445
  if (!target && identity.date) target = this.el.querySelector(`[data-date-cell][data-date="${cssEscape(identity.date)}"]`);
1411
1446
  target?.focus?.();
1412
1447
  }
@@ -1440,7 +1475,7 @@ export class Calendar extends Component {
1440
1475
  if (!visible) return;
1441
1476
  line.style.insetBlockStart = `${((minutes - min) / (max - min)) * 100}%`;
1442
1477
  line.style.setProperty('--zx-calendar-now-day', String(dayIndex));
1443
- line.querySelector('.zx-calendar__now-time').textContent = formatTimeMinutes(minutes, this.options.locale);
1478
+ line.querySelector('.zx-calendar__now-time').textContent = formatTimeMinutes(minutes, this._locale());
1444
1479
  }
1445
1480
 
1446
1481
  /** @param {string} message @returns {void} */
@@ -1,10 +1,12 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h } from '../../core/dom.js';
3
+ import { translate } from '../../core/i18n.js';
3
4
  import { prefersReducedMotion, watchMotion } from '../../core/motion.js';
4
5
  import { uid } from '../../core/util.js';
5
6
 
6
7
  /** @typedef {{label?: string, data?: unknown[], [key: string]: unknown}} ChartDataset */
7
8
  /** @typedef {{labels?: unknown[], datasets?: ChartDataset[], [key: string]: unknown}} ChartData */
9
+ /** @typedef {(key: string, ...args: unknown[]) => string} ChartText Resolves a message. */
8
10
  /**
9
11
  * @typedef {Object} ChartSpec
10
12
  * @property {string} type Chart type.
@@ -43,13 +45,17 @@ import { uid } from '../../core/util.js';
43
45
  * @property {string} [type='bar'] Chart type passed to the adapter.
44
46
  * @property {ChartData} [data={labels: [], datasets: []}] Chart data.
45
47
  * @property {Record<string, unknown>} [chartOptions={}] Engine-specific options.
46
- * @property {string} [label='Chart'] Accessible canvas and summary label; blank text falls back to `Chart`.
48
+ * @property {string|null} [label=null] Accessible canvas and summary label; null or blank text reads
49
+ * the `chart.label` message ("Chart").
47
50
  * @property {string} [description=''] Accessible description.
48
51
  * @property {'hidden'|'visible'} [summary='hidden'] Semantic data-table presentation.
49
52
  * @property {boolean} [loading=false] Initial loading state.
50
- * @property {string} [emptyText='No chart data'] Empty-state text.
51
- * @property {string} [loadingText='Loading chart…'] Loading-state text.
52
- * @property {string} [errorText='Unable to render chart'] Error fallback text.
53
+ * @property {string|null} [emptyText] Empty-state text, by default the `chart.empty` message
54
+ * ("No chart data"). Null shows none.
55
+ * @property {string|null} [loadingText] Loading-state text, by default the `chart.loading` message
56
+ * ("Loading chart…"). Null shows none.
57
+ * @property {string|null} [errorText] Error fallback text, by default the `chart.error` message
58
+ * ("Unable to render chart"). Null shows none.
53
59
  * @property {string} [aspectRatio='16 / 9'] Responsive container aspect ratio.
54
60
  * @property {(event: CustomEvent<{instance: unknown}>) => void} [onready] Engine-ready listener.
55
61
  * @property {(event: CustomEvent<{data: ChartData, type: string}>) => void} [onupdate] Update listener.
@@ -74,13 +80,14 @@ export class Chart extends Component {
74
80
  type: 'bar',
75
81
  data: { labels: [], datasets: [] },
76
82
  chartOptions: {},
77
- label: 'Chart',
83
+ label: null,
78
84
  description: '',
79
85
  summary: 'hidden',
80
86
  loading: false,
81
- emptyText: 'No chart data',
82
- loadingText: 'Loading chart…',
83
- errorText: 'Unable to render chart',
87
+ // Undefined rather than null, which shows nothing.
88
+ emptyText: undefined,
89
+ loadingText: undefined,
90
+ errorText: undefined,
84
91
  aspectRatio: '16 / 9'
85
92
  };
86
93
 
@@ -106,7 +113,7 @@ export class Chart extends Component {
106
113
  this._adapter = this.options.adapter;
107
114
  this._type = String(this.options.type || 'bar');
108
115
  this._data = normalizeChartData(this.options.data);
109
- this._label = normalizeChartLabel(this.options.label);
116
+ this._label = String(this.options.label ?? '').trim() || this.msg('chart.label');
110
117
  this._chartOptions = cloneChartValue(this.options.chartOptions);
111
118
  this._loading = Boolean(this.options.loading);
112
119
  this._error = null;
@@ -199,7 +206,7 @@ export class Chart extends Component {
199
206
 
200
207
  /** Shows an error and destroys the current engine. @param {unknown} error @returns {this} */
201
208
  setError(error) {
202
- this._error = error ?? new Error(String(this.options.errorText));
209
+ this._error = error ?? new Error(this._errorText());
203
210
  this._hasError = true;
204
211
  this._loading = false;
205
212
  this._destroyHandle();
@@ -304,25 +311,27 @@ export class Chart extends Component {
304
311
  const state = this._loading ? 'loading' : this._hasError ? 'error' : empty ? 'empty' : 'ready';
305
312
  this.el.dataset.state = state;
306
313
  this.refs.viewport.hidden = state !== 'ready';
314
+ const { loadingText = this.msg('chart.loading'), emptyText = this.msg('chart.empty') } = this.options;
307
315
  let text = '';
308
- if (state === 'loading') text = String(this.options.loadingText);
309
- else if (state === 'error') text = errorMessage(this._error, this.options.errorText);
310
- else if (state === 'empty') text = String(this.options.emptyText);
316
+ if (state === 'loading') text = String(loadingText ?? '');
317
+ else if (state === 'error') text = errorMessage(this._error, this._errorText());
318
+ else if (state === 'empty') text = String(emptyText ?? '');
311
319
  this.refs.status.textContent = text;
312
320
  this.refs.status.hidden = !text;
313
321
  }
314
322
 
323
+ /** @returns {string} What an error without a message of its own says. */
324
+ _errorText() {
325
+ const { errorText = this.msg('chart.error') } = this.options;
326
+ return String(errorText ?? '');
327
+ }
328
+
315
329
  /** @returns {void} */
316
330
  _renderSummary() {
317
- this.refs.summary.replaceChildren(chartSummaryTable(this._data, this._label));
331
+ this.refs.summary.replaceChildren(summaryTable(this._data, this._label, (key, ...args) => this.msg(key, ...args)));
318
332
  }
319
333
  }
320
334
 
321
- /** @param {unknown} value @returns {string} */
322
- function normalizeChartLabel(value) {
323
- return String(value ?? '').trim() || 'Chart';
324
- }
325
-
326
335
  /**
327
336
  * Adapter for an injected Chart.js 4 constructor or namespace.
328
337
  */
@@ -463,17 +472,30 @@ export function isEmptyChartData(data) {
463
472
  return !Array.isArray(data?.datasets) || !data.datasets.some((dataset) => Array.isArray(dataset?.data) && dataset.data.length > 0);
464
473
  }
465
474
 
475
+ /** The catalogue, for the summary helpers when no Chart called them. @type {ChartText} */
476
+ const catalogueText = (key, ...args) => translate(key, args);
477
+
466
478
  /**
467
479
  * Builds the semantic table mirrored alongside the canvas.
480
+ * @param {ChartData} data Chart data.
481
+ * @param {string} [label] Caption, by default the `chart.summary` message ("Chart data").
482
+ * @returns {HTMLTableElement}
483
+ */
484
+ export function chartSummaryTable(data, label = translate('chart.summary')) {
485
+ return summaryTable(data, label, catalogueText);
486
+ }
487
+
488
+ /**
468
489
  * @param {ChartData} data Chart data.
469
490
  * @param {string} label Caption.
491
+ * @param {ChartText} text Resolves the table's own words; a Chart passes its `msg()`.
470
492
  * @returns {HTMLTableElement}
471
493
  */
472
- export function chartSummaryTable(data, label = 'Chart data') {
473
- const summary = chartSummaryModel(data);
494
+ function summaryTable(data, label, text) {
495
+ const summary = summaryModel(data, text);
474
496
  const table = /** @type {HTMLTableElement} */ (h('table', { class: 'zx-chart__table' },
475
497
  h('caption', {}, label),
476
- h('thead', {}, h('tr', {}, h('th', { scope: 'col' }, 'Label'),
498
+ h('thead', {}, h('tr', {}, h('th', { scope: 'col' }, text('chart.summaryLabel')),
477
499
  summary.headers.map((header) => h('th', { scope: 'col' }, header)))),
478
500
  h('tbody', {}, summary.rows.map((row) => h('tr', {},
479
501
  h('th', { scope: 'row' }, row.label),
@@ -487,12 +509,21 @@ export function chartSummaryTable(data, label = 'Chart data') {
487
509
  * @returns {{headers: string[], rows: Array<{label: string, values: string[]}>}}
488
510
  */
489
511
  export function chartSummaryModel(data) {
512
+ return summaryModel(data, catalogueText);
513
+ }
514
+
515
+ /**
516
+ * @param {ChartData} data Chart data.
517
+ * @param {ChartText} text Resolves the name of an unnamed series.
518
+ * @returns {{headers: string[], rows: Array<{label: string, values: string[]}>}}
519
+ */
520
+ function summaryModel(data, text) {
490
521
  const datasets = Array.isArray(data?.datasets) ? data.datasets : [];
491
522
  const labels = Array.isArray(data?.labels) ? data.labels : [];
492
523
  const length = Math.max(labels.length,
493
524
  ...datasets.map((dataset) => Array.isArray(dataset.data) ? dataset.data.length : 0), 0);
494
525
  return {
495
- headers: datasets.map((dataset, index) => String(dataset.label ?? `Series ${index + 1}`)),
526
+ headers: datasets.map((dataset, index) => String(dataset.label ?? text('chart.series', index + 1))),
496
527
  rows: Array.from({ length }, (_, index) => ({
497
528
  label: String(labels[index] ?? index + 1),
498
529
  values: datasets.map((dataset) => summaryValue(dataset.data?.[index]))
@@ -41,7 +41,7 @@
41
41
  line-height: 1.35;
42
42
  }
43
43
 
44
- .zx-checklist__item:hover {
44
+ .zx-checklist:not([aria-disabled="true"]) .zx-checklist__item:hover {
45
45
  background: var(--zx-color-bg-hover);
46
46
  }
47
47
 
@@ -70,3 +70,11 @@
70
70
  .zx-checklist[data-state="loading"] .zx-checklist__list {
71
71
  color: var(--zx-color-text-muted);
72
72
  }
73
+
74
+ .zx-checklist[aria-disabled="true"] {
75
+ opacity: var(--zx-control-disabled-opacity);
76
+ }
77
+
78
+ .zx-checklist[aria-disabled="true"] .zx-checklist__item {
79
+ cursor: default;
80
+ }