@zeyos/zx 4.3.4 → 5.0.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 (231) hide show
  1. package/CHANGELOG.md +438 -0
  2. package/README.md +49 -10
  3. package/dist/types/components/activity-item/activity-item.d.ts +351 -0
  4. package/dist/types/components/activity-list/activity-list.d.ts +217 -0
  5. package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -3
  6. package/dist/types/components/avatar/avatar.d.ts +46 -7
  7. package/dist/types/components/badge/badge.d.ts +21 -1
  8. package/dist/types/components/button/button.d.ts +23 -0
  9. package/dist/types/components/calendar/calendar.d.ts +19 -0
  10. package/dist/types/components/card/card.d.ts +7 -0
  11. package/dist/types/components/card-view/card-view.d.ts +11 -3
  12. package/dist/types/components/card-view/record-card.d.ts +7 -1
  13. package/dist/types/components/chart/chart.d.ts +10 -0
  14. package/dist/types/components/checklist/checklist.d.ts +9 -0
  15. package/dist/types/components/code-editor/code-editor.d.ts +149 -0
  16. package/dist/types/components/code-editor/field-adapter.d.ts +5 -0
  17. package/dist/types/components/context-menu/context-menu.d.ts +18 -2
  18. package/dist/types/components/date-picker/date-picker.d.ts +8 -0
  19. package/dist/types/components/date-picker/time-picker.d.ts +7 -0
  20. package/dist/types/components/datebox/date-range-box.d.ts +5 -1
  21. package/dist/types/components/datebox/datebox.d.ts +7 -2
  22. package/dist/types/components/dialog/dialog.d.ts +75 -6
  23. package/dist/types/components/dropdown/dropdown.d.ts +2 -2
  24. package/dist/types/components/entity-ref/entity-ref.d.ts +331 -0
  25. package/dist/types/components/field/field.d.ts +24 -2
  26. package/dist/types/components/fieldset/fieldset.d.ts +19 -1
  27. package/dist/types/components/file-item/file-item.d.ts +262 -0
  28. package/dist/types/components/file-list/file-list.d.ts +171 -0
  29. package/dist/types/components/filter/filter.d.ts +91 -36
  30. package/dist/types/components/filter-panel/filter-panel.d.ts +449 -0
  31. package/dist/types/components/form/form.d.ts +12 -1
  32. package/dist/types/components/kanban-view/kanban-card.d.ts +146 -0
  33. package/dist/types/components/kanban-view/kanban-view.d.ts +170 -4
  34. package/dist/types/components/launcher/launcher.d.ts +278 -26
  35. package/dist/types/components/list-toolbar/list-toolbar.d.ts +599 -0
  36. package/dist/types/components/menu-button/menu-button.d.ts +37 -42
  37. package/dist/types/components/message/message.d.ts +126 -17
  38. package/dist/types/components/modal/modal.d.ts +61 -2
  39. package/dist/types/components/navigation-bar/navigation-bar.d.ts +105 -21
  40. package/dist/types/components/panel/panel.d.ts +7 -0
  41. package/dist/types/components/search/search.d.ts +7 -0
  42. package/dist/types/components/select/color.d.ts +12 -0
  43. package/dist/types/components/select/glyphs.d.ts +124 -0
  44. package/dist/types/components/select/select.d.ts +15 -3
  45. package/dist/types/components/sort-control/sort-control.d.ts +105 -0
  46. package/dist/types/components/stat-tile/stat-tile.d.ts +288 -0
  47. package/dist/types/components/tabbox/tabbox.d.ts +16 -0
  48. package/dist/types/components/table/table.d.ts +190 -1
  49. package/dist/types/components/table-view/table-view.d.ts +11 -5
  50. package/dist/types/components/tag-picker/tag-picker.d.ts +21 -4
  51. package/dist/types/components/timebox/timebox.d.ts +7 -0
  52. package/dist/types/components/tree/tree.d.ts +13 -0
  53. package/dist/types/components/value-list/value-list.d.ts +8 -0
  54. package/dist/types/components/view/record-view.d.ts +96 -5
  55. package/dist/types/core/breakpoint.d.ts +1 -1
  56. package/dist/types/core/icons.d.ts +37 -22
  57. package/dist/types/core/motion.d.ts +59 -0
  58. package/dist/types/core/overlay-host.d.ts +15 -1
  59. package/dist/types/index.d.ts +16 -3
  60. package/dist/types/internal/app-rail.d.ts +10 -0
  61. package/dist/types/internal/menu-items.d.ts +134 -0
  62. package/dist/types/zeyos/connect.d.ts +6 -0
  63. package/dist/types/zeyos/form.d.ts +50 -9
  64. package/dist/types/zeyos/index.d.ts +1 -1
  65. package/dist/types/zeyos/query.d.ts +79 -0
  66. package/dist/types/zeyos/schema.d.ts +24 -1
  67. package/dist/types/zeyos/table.d.ts +100 -14
  68. package/dist/types/zeyos/view.d.ts +10 -0
  69. package/dist/zx-zeyos.esm.js +2206 -489
  70. package/dist/zx-zeyos.esm.min.js +56 -1
  71. package/dist/zx.css +3322 -724
  72. package/dist/zx.esm.js +12244 -5809
  73. package/dist/zx.esm.min.js +58 -3
  74. package/dist/zx.global.js +12246 -5811
  75. package/dist/zx.global.min.js +58 -3
  76. package/dist/zx.min.css +1 -1
  77. package/docs/api.json +1683 -146
  78. package/docs/llms.md +777 -110
  79. package/docs/llms.txt +14 -8
  80. package/package.json +1 -1
  81. package/src/components/account-menu/account-menu.css +35 -10
  82. package/src/components/activity-item/activity-item.css +137 -0
  83. package/src/components/activity-item/activity-item.js +602 -0
  84. package/src/components/activity-list/activity-list.css +99 -0
  85. package/src/components/activity-list/activity-list.js +409 -0
  86. package/src/components/app-icon/app-icon.css +1 -1
  87. package/src/components/app-rail/app-rail.css +191 -22
  88. package/src/components/app-sidebar/app-sidebar.css +349 -24
  89. package/src/components/app-sidebar/app-sidebar.js +86 -11
  90. package/src/components/aurora/aurora.css +5 -3
  91. package/src/components/avatar/avatar.css +32 -7
  92. package/src/components/avatar/avatar.js +72 -8
  93. package/src/components/badge/badge.css +54 -2
  94. package/src/components/badge/badge.js +29 -2
  95. package/src/components/button/button.css +74 -8
  96. package/src/components/button/button.js +44 -1
  97. package/src/components/calendar/calendar.css +46 -46
  98. package/src/components/calendar/calendar.js +33 -3
  99. package/src/components/card/card.css +2 -2
  100. package/src/components/card/card.js +12 -1
  101. package/src/components/card-view/card-view.css +10 -7
  102. package/src/components/card-view/card-view.js +25 -9
  103. package/src/components/card-view/record-card.js +7 -3
  104. package/src/components/chart/chart.css +4 -1
  105. package/src/components/chart/chart.js +12 -0
  106. package/src/components/check-button/check-button.css +10 -2
  107. package/src/components/checklist/checklist.css +9 -2
  108. package/src/components/checklist/checklist.js +11 -5
  109. package/src/components/checklist/field-adapter.js +3 -1
  110. package/src/components/code-editor/code-editor.css +68 -0
  111. package/src/components/code-editor/code-editor.js +306 -0
  112. package/src/components/code-editor/field-adapter.js +34 -0
  113. package/src/components/context-menu/context-menu.css +87 -5
  114. package/src/components/context-menu/context-menu.js +22 -30
  115. package/src/components/copy/copy-button.css +6 -0
  116. package/src/components/copy/copy-input.css +8 -3
  117. package/src/components/data-filter/data-filter.css +5 -4
  118. package/src/components/date-picker/date-picker.css +6 -6
  119. package/src/components/date-picker/date-picker.js +22 -8
  120. package/src/components/date-picker/date-range-picker.css +3 -3
  121. package/src/components/date-picker/month-picker.js +3 -3
  122. package/src/components/date-picker/time-picker.css +1 -1
  123. package/src/components/date-picker/time-picker.js +20 -8
  124. package/src/components/datebox/date-range-box.css +79 -2
  125. package/src/components/datebox/date-range-box.js +13 -2
  126. package/src/components/datebox/datebox.css +79 -2
  127. package/src/components/datebox/datebox.js +13 -2
  128. package/src/components/dialog/dialog.css +26 -0
  129. package/src/components/dialog/dialog.js +174 -70
  130. package/src/components/dropdown/dropdown.css +1 -1
  131. package/src/components/dropdown/dropdown.js +7 -5
  132. package/src/components/empty-state/empty-state.css +2 -2
  133. package/src/components/entity-ref/entity-ref.css +182 -0
  134. package/src/components/entity-ref/entity-ref.js +496 -0
  135. package/src/components/field/field.css +28 -9
  136. package/src/components/field/field.js +68 -26
  137. package/src/components/field-upload/field-upload.css +1 -1
  138. package/src/components/fieldset/fieldset.css +5 -3
  139. package/src/components/fieldset/fieldset.js +28 -5
  140. package/src/components/file-item/file-item.css +88 -0
  141. package/src/components/file-item/file-item.js +505 -0
  142. package/src/components/file-list/file-list.css +51 -0
  143. package/src/components/file-list/file-list.js +320 -0
  144. package/src/components/filter/filter.css +27 -1
  145. package/src/components/filter/filter.js +205 -47
  146. package/src/components/filter-panel/filter-panel.css +104 -0
  147. package/src/components/filter-panel/filter-panel.js +964 -0
  148. package/src/components/finder/finder.css +15 -13
  149. package/src/components/form/form.css +5 -4
  150. package/src/components/form/form.js +11 -2
  151. package/src/components/grid/grid.css +1 -1
  152. package/src/components/groupbox/groupbox.css +1 -1
  153. package/src/components/kanban-view/kanban-card.js +247 -0
  154. package/src/components/kanban-view/kanban-view.css +226 -8
  155. package/src/components/kanban-view/kanban-view.js +255 -12
  156. package/src/components/launcher/launcher.css +107 -25
  157. package/src/components/launcher/launcher.js +557 -63
  158. package/src/components/list-toolbar/list-toolbar.css +194 -0
  159. package/src/components/list-toolbar/list-toolbar.js +851 -0
  160. package/src/components/master-panel/master-panel.css +2 -0
  161. package/src/components/menu-button/menu-button.css +87 -5
  162. package/src/components/menu-button/menu-button.js +86 -46
  163. package/src/components/message/message.css +38 -5
  164. package/src/components/message/message.js +230 -17
  165. package/src/components/modal/modal.css +15 -0
  166. package/src/components/modal/modal.js +159 -3
  167. package/src/components/navigation-bar/navigation-bar.css +95 -11
  168. package/src/components/navigation-bar/navigation-bar.js +171 -4
  169. package/src/components/number-field/field-adapter.js +1 -0
  170. package/src/components/number-field/number-field.css +70 -0
  171. package/src/components/number-field/number-field.js +2 -0
  172. package/src/components/pagination/pagination.css +8 -6
  173. package/src/components/panel/panel.css +1 -1
  174. package/src/components/panel/panel.js +13 -2
  175. package/src/components/rating/rating.css +7 -0
  176. package/src/components/search/search.js +17 -5
  177. package/src/components/select/color.js +22 -0
  178. package/src/components/select/field-adapter.js +6 -1
  179. package/src/components/select/glyphs.js +165 -0
  180. package/src/components/select/select.css +138 -45
  181. package/src/components/select/select.js +86 -47
  182. package/src/components/sheet/sheet.css +11 -8
  183. package/src/components/slider/slider.css +16 -2
  184. package/src/components/slider/slider.js +1 -1
  185. package/src/components/sort-control/sort-control.css +20 -0
  186. package/src/components/sort-control/sort-control.js +140 -0
  187. package/src/components/stat-tile/stat-tile.css +208 -0
  188. package/src/components/stat-tile/stat-tile.js +601 -0
  189. package/src/components/tabbox/tabbox.css +32 -27
  190. package/src/components/tabbox/tabbox.js +17 -2
  191. package/src/components/table/table.css +155 -31
  192. package/src/components/table/table.js +386 -33
  193. package/src/components/table-view/table-view.css +8 -2
  194. package/src/components/table-view/table-view.js +21 -6
  195. package/src/components/tag-picker/tag-picker.css +86 -6
  196. package/src/components/tag-picker/tag-picker.js +25 -8
  197. package/src/components/timebox/timebox.css +22 -2
  198. package/src/components/timebox/timebox.js +18 -5
  199. package/src/components/toggle/toggle.css +12 -1
  200. package/src/components/toolbar/toolbar.js +2 -2
  201. package/src/components/tooltip/tooltip.css +4 -0
  202. package/src/components/tooltip/tooltip.js +10 -3
  203. package/src/components/tree/tree.css +25 -16
  204. package/src/components/tree/tree.js +31 -0
  205. package/src/components/value-list/value-list.css +3 -3
  206. package/src/components/value-list/value-list.js +22 -6
  207. package/src/components/view/record-view.css +5 -0
  208. package/src/components/view/record-view.js +100 -7
  209. package/src/core/breakpoint.js +1 -1
  210. package/src/core/icons.js +259 -57
  211. package/src/core/motion.js +147 -0
  212. package/src/core/overlay-host.js +21 -2
  213. package/src/index.js +30 -3
  214. package/src/internal/app-rail.js +18 -1
  215. package/src/internal/menu-items.js +142 -0
  216. package/src/zeyos/connect.js +6 -2
  217. package/src/zeyos/form.js +67 -27
  218. package/src/zeyos/index.js +1 -1
  219. package/src/zeyos/query.js +153 -0
  220. package/src/zeyos/schema.js +144 -27
  221. package/src/zeyos/table.js +68 -5
  222. package/src/zeyos/view.js +6 -0
  223. package/styles/base.css +56 -0
  224. package/styles/icons.css +11 -1
  225. package/styles/print.css +192 -0
  226. package/styles/tokens/dark.css +113 -37
  227. package/styles/tokens/global.css +121 -27
  228. package/styles/tokens/semantic.css +100 -31
  229. package/styles/tokens/themes.css +7 -6
  230. package/styles/zx.css +11 -1
  231. package/styles/tokens/density.css +0 -9
@@ -16,15 +16,23 @@
16
16
  }
17
17
 
18
18
  .zx-context-menu__item {
19
- display: flex;
19
+ display: grid;
20
+ grid-template-columns: auto minmax(0, 1fr) auto;
20
21
  align-items: center;
21
22
  gap: var(--zx-space-2);
22
23
  inline-size: 100%;
23
- min-block-size: var(--zx-control-height);
24
- border-color: transparent;
24
+ /* A menu row sits a little under a control so a list of them reads lighter than a column of
25
+ fields; the radius is the smallest step, inset inside the panel's own. */
26
+ min-block-size: calc(var(--zx-control-height) - 2px);
27
+ border: 0;
28
+ border-radius: var(--zx-radius-sm);
25
29
  background: transparent;
26
- padding-inline: var(--zx-control-pad-x);
30
+ padding: var(--zx-space-1) var(--zx-space-2);
31
+ color: inherit;
32
+ font: inherit;
33
+ line-height: 1.35;
27
34
  text-align: start;
35
+ text-decoration: none;
28
36
  }
29
37
 
30
38
  .zx-context-menu__item:hover,
@@ -42,11 +50,85 @@
42
50
  opacity: 0.65;
43
51
  }
44
52
 
45
- .zx-context-menu__icon {
53
+ .zx-context-menu__leading,
54
+ .zx-context-menu__meta {
46
55
  display: inline-flex;
56
+ align-items: center;
57
+ gap: var(--zx-space-2);
47
58
  flex: none;
48
59
  }
49
60
 
61
+ .zx-context-menu__meta {
62
+ justify-content: flex-end;
63
+ }
64
+
65
+ .zx-context-menu__leading {
66
+ justify-content: center;
67
+ inline-size: var(--zx-space-4);
68
+ }
69
+
70
+ .zx-context-menu__body {
71
+ display: flex;
72
+ min-inline-size: 0;
73
+ flex-direction: column;
74
+ }
75
+
76
+ .zx-context-menu__label,
77
+ .zx-context-menu__description {
78
+ overflow: hidden;
79
+ text-overflow: ellipsis;
80
+ white-space: nowrap;
81
+ }
82
+
83
+ .zx-context-menu__description,
84
+ .zx-context-menu__shortcut,
85
+ .zx-context-menu__adornment {
86
+ color: var(--zx-color-text-muted);
87
+ font-size: var(--zx-text-xs);
88
+ }
89
+
90
+ .zx-context-menu__badge {
91
+ min-inline-size: var(--zx-space-4);
92
+ border-radius: var(--zx-radius-full);
93
+ background: var(--zx-color-bg-muted);
94
+ padding-inline: var(--zx-space-1);
95
+ color: var(--zx-color-text-muted);
96
+ font-size: var(--zx-text-xs);
97
+ text-align: center;
98
+ }
99
+
100
+ .zx-context-menu__shortcut {
101
+ border: 0;
102
+ background: transparent;
103
+ padding: 0;
104
+ font-family: var(--zx-font-mono);
105
+ }
106
+
107
+ .zx-context-menu__check {
108
+ inline-size: var(--zx-space-3);
109
+ block-size: var(--zx-space-3);
110
+ border: 1px solid var(--zx-color-border-strong);
111
+ border-radius: var(--zx-radius-sm);
112
+ }
113
+
114
+ .zx-context-menu__check[data-check-kind="radio"] {
115
+ border-radius: var(--zx-radius-full);
116
+ }
117
+
118
+ .zx-context-menu__item[aria-checked="true"] .zx-context-menu__check {
119
+ border-color: var(--zx-color-accent);
120
+ background: var(--zx-color-accent);
121
+ box-shadow: inset 0 0 0 2px var(--zx-color-bg-raised);
122
+ }
123
+
124
+ /* A section label is a caption, never taller than the rows it introduces. */
125
+ .zx-context-menu__heading {
126
+ padding: var(--zx-space-1) var(--zx-space-2);
127
+ color: var(--zx-color-text-muted);
128
+ font-size: var(--zx-text-xs);
129
+ font-weight: 600;
130
+ }
131
+
50
132
  .zx-context-menu__separator {
51
133
  block-size: 1px;
52
134
  margin: var(--zx-space-1) var(--zx-space-2);
@@ -1,11 +1,15 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h, resolveElement } from '../../core/dom.js';
3
- import { icon } from '../../core/icons.js';
4
3
  import { rovingTabindex, typeahead } from '../../core/keyboard.js';
4
+ import {
5
+ isMenuItem,
6
+ MENU_ITEM_SELECTOR,
7
+ renderMenuEntries
8
+ } from '../../internal/menu-items.js';
5
9
  import { Dropdown } from '../dropdown/dropdown.js';
6
10
 
7
- /** @typedef {import('../menu-button/menu-button.js').MenuItem} MenuItem */
8
- /** @typedef {MenuItem|'-'} ContextMenuEntry */
11
+ /** @typedef {import('../../internal/menu-items.js').MenuItem} MenuItem */
12
+ /** @typedef {import('../../internal/menu-items.js').MenuEntry} ContextMenuEntry */
9
13
 
10
14
  /**
11
15
  * @typedef {Object} ContextMenuOptions
@@ -22,8 +26,6 @@ import { Dropdown } from '../dropdown/dropdown.js';
22
26
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close listener.
23
27
  */
24
28
 
25
- const MENU_ITEM_SELECTOR = '[role="menuitem"]';
26
-
27
29
  /**
28
30
  * Right-click menu for a region, implementing the APG menu pattern.
29
31
  *
@@ -107,7 +109,7 @@ export class ContextMenu extends Component {
107
109
  this.listen(this.#target, 'keydown', (event) => this.#onTargetKeydown(event));
108
110
  this.listen(this.#panel, 'click', (event) => {
109
111
  const item = event.target.closest?.(MENU_ITEM_SELECTOR);
110
- if (item && this.#panel.contains(item)) this.#select(item);
112
+ if (item && this.#panel.contains(item)) this.#select(item, event);
111
113
  });
112
114
  this.listen(this.#panel, 'keydown', (event) => this.#onMenuKeydown(event));
113
115
  }
@@ -127,25 +129,7 @@ export class ContextMenu extends Component {
127
129
  */
128
130
  setItems(items) {
129
131
  this.#items = Array.isArray(items) ? items.slice() : [];
130
- this.#panel.replaceChildren();
131
- this.#items.forEach((item, index) => {
132
- if (item === '-') {
133
- this.#panel.append(h('div', { class: 'zx-context-menu__separator', role: 'separator' }));
134
- return;
135
- }
136
- const children = [];
137
- if (item.icon) children.push(h('span', { class: 'zx-context-menu__icon' }, icon(item.icon)));
138
- children.push(h('span', { class: 'zx-context-menu__label' }, String(item.label ?? '')));
139
- this.#panel.append(h('button', {
140
- class: 'zx-context-menu__item',
141
- type: 'button',
142
- role: 'menuitem',
143
- tabindex: '-1',
144
- 'data-menu-item': String(index),
145
- 'data-danger': item.danger ? 'true' : null,
146
- ariaDisabled: item.disabled ? 'true' : null
147
- }, children));
148
- });
132
+ this.#panel.replaceChildren(...renderMenuEntries(this.#items, 'context-menu'));
149
133
  return this;
150
134
  }
151
135
 
@@ -292,20 +276,28 @@ export class ContextMenu extends Component {
292
276
  if (key.key === 'Enter' || key.key === ' ') {
293
277
  const item = /** @type {Element} */ (key.target).closest?.(MENU_ITEM_SELECTOR);
294
278
  if (!item || !this.#panel.contains(item)) return;
279
+ if (key.key === 'Enter' && item.tagName === 'A') return;
295
280
  event.preventDefault();
296
- this.#select(item);
281
+ /** @type {HTMLElement} */ (item).click();
297
282
  return;
298
283
  }
299
284
  this.#typeahead(key);
300
285
  }
301
286
 
302
- /** @param {Element} element @returns {void} */
303
- #select(element) {
287
+ /** @param {Element} element @param {Event|null} [event=null] @returns {void} */
288
+ #select(element, event = null) {
304
289
  const index = Number(element.getAttribute('data-menu-item'));
305
290
  const item = this.#items[index];
306
- if (!item || item === '-' || item.disabled) return;
291
+ if (!isMenuItem(item) || item.disabled) {
292
+ event?.preventDefault();
293
+ return;
294
+ }
307
295
  const context = this.#context;
308
- this.emit('select', { value: item.value, item, context });
296
+ const selected = this.emit('select', { value: item.value, item, context });
297
+ if (selected.defaultPrevented) {
298
+ event?.preventDefault();
299
+ return;
300
+ }
309
301
  try {
310
302
  item.onselect?.(item.value, item, this);
311
303
  } finally {
@@ -1,4 +1,8 @@
1
+ /* Positioned so the hidden status line below is placed inside the button. Without a positioned
2
+ ancestor it would hang off the page instead, adding scrollable overflow that focus() can scroll
3
+ into view. */
1
4
  .zx-copy-button {
5
+ position: relative;
2
6
  display: inline-flex;
3
7
  align-items: center;
4
8
  gap: var(--zx-space-2);
@@ -19,6 +23,8 @@
19
23
  */
20
24
  .zx-copy-button__status {
21
25
  position: absolute;
26
+ inset-block-start: 0;
27
+ inset-inline-start: 0;
22
28
  clip-path: inset(50%);
23
29
  inline-size: 1px;
24
30
  block-size: 1px;
@@ -1,18 +1,23 @@
1
1
  .zx-copy-input {
2
+ /* Holds the visually hidden label below, which would otherwise hang off the page. */
3
+ position: relative;
2
4
  display: flex;
3
5
  flex-direction: column;
4
6
  gap: var(--zx-space-1);
5
7
  inline-size: 100%;
6
8
  }
7
9
 
10
+ /* The same quiet label a Field draws, so a copy field sits in a form without standing out. */
8
11
  .zx-copy-input__label {
9
- color: var(--zx-color-text);
10
- font-size: var(--zx-control-font-size);
11
- font-weight: 500;
12
+ color: var(--zx-color-text-muted);
13
+ font-size: var(--zx-text-sm);
14
+ font-weight: var(--zx-weight-medium);
12
15
  }
13
16
 
14
17
  .zx-copy-input[data-hide-label] .zx-copy-input__label {
15
18
  position: absolute;
19
+ inset-block-start: 0;
20
+ inset-inline-start: 0;
16
21
  clip-path: inset(50%);
17
22
  inline-size: 1px;
18
23
  block-size: 1px;
@@ -28,18 +28,19 @@
28
28
  .zx-data-filter__label {
29
29
  color: var(--zx-color-text-muted);
30
30
  font-size: var(--zx-text-sm);
31
- font-weight: 650;
31
+ font-weight: var(--zx-weight-medium);
32
32
  }
33
33
 
34
34
  .zx-data-filter__badge {
35
35
  align-self: center;
36
36
  min-inline-size: var(--zx-control-height);
37
37
  border-radius: var(--zx-radius-full);
38
- background: var(--zx-color-bg-selected);
39
- color: var(--zx-color-accent);
38
+ background: var(--zx-color-bg-current);
39
+ color: var(--zx-color-text);
40
40
  padding: var(--zx-space-1) var(--zx-space-2);
41
41
  font-size: var(--zx-text-sm);
42
- font-weight: 650;
42
+ font-variant-numeric: tabular-nums;
43
+ font-weight: var(--zx-weight-medium);
43
44
  text-align: center;
44
45
  }
45
46
 
@@ -39,7 +39,7 @@
39
39
  overflow: hidden;
40
40
  border-color: transparent;
41
41
  background: transparent;
42
- font-weight: 650;
42
+ font-weight: var(--zx-weight-semibold);
43
43
  text-overflow: ellipsis;
44
44
  text-wrap: nowrap;
45
45
  }
@@ -47,7 +47,7 @@
47
47
  .zx-month-picker__year,
48
48
  .zx-date-picker__quick-year {
49
49
  text-align: center;
50
- font-weight: 650;
50
+ font-weight: var(--zx-weight-semibold);
51
51
  }
52
52
 
53
53
  .zx-date-picker__grid {
@@ -62,7 +62,7 @@
62
62
  padding: 0;
63
63
  color: var(--zx-color-text-muted);
64
64
  font-size: var(--zx-text-xs);
65
- font-weight: 600;
65
+ font-weight: var(--zx-weight-medium);
66
66
  text-align: center;
67
67
  }
68
68
 
@@ -94,7 +94,7 @@
94
94
  border-color: var(--zx-color-accent);
95
95
  background: var(--zx-color-accent);
96
96
  color: var(--zx-color-on-accent);
97
- font-weight: 700;
97
+ font-weight: var(--zx-weight-semibold);
98
98
  }
99
99
 
100
100
  .zx-date-picker__day[aria-disabled="true"] {
@@ -166,13 +166,13 @@
166
166
  .zx-date-picker__quick-month[aria-selected="true"] {
167
167
  background: var(--zx-color-overlay-selected);
168
168
  color: var(--zx-color-accent);
169
- font-weight: 700;
169
+ font-weight: var(--zx-weight-semibold);
170
170
  }
171
171
 
172
172
  .zx-month-picker__month[aria-selected="true"] {
173
173
  background: var(--zx-color-bg-selected);
174
174
  color: var(--zx-color-accent);
175
- font-weight: 700;
175
+ font-weight: var(--zx-weight-semibold);
176
176
  }
177
177
 
178
178
  .zx-month-picker__month[aria-disabled="true"] {
@@ -2,6 +2,7 @@ import { Component } from '../../core/component.js';
2
2
  import { addDays, addMonths, formatDate, getWeekStart, isSameDay, parseDate } from '../../core/date.js';
3
3
  import { h } from '../../core/dom.js';
4
4
  import { icon } from '../../core/icons.js';
5
+ import { printf } from '../../core/i18n.js';
5
6
  import { TimePicker } from './time-picker.js';
6
7
 
7
8
  /**
@@ -55,7 +56,7 @@ export class DatePicker extends Component {
55
56
  ref: 'previous',
56
57
  class: 'zx-date-picker__nav',
57
58
  type: 'button',
58
- ariaLabel: 'Previous month'
59
+ ariaLabel: this._message('datePicker.previousMonth', 'Previous month')
59
60
  }, icon('chevron-left')),
60
61
  h('button', {
61
62
  ref: 'heading',
@@ -68,7 +69,7 @@ export class DatePicker extends Component {
68
69
  ref: 'next',
69
70
  class: 'zx-date-picker__nav',
70
71
  type: 'button',
71
- ariaLabel: 'Next month'
72
+ ariaLabel: this._message('datePicker.nextMonth', 'Next month')
72
73
  }, icon('chevron-right'))
73
74
  ),
74
75
  h('div', {
@@ -81,14 +82,14 @@ export class DatePicker extends Component {
81
82
  ref: 'quickPrevious',
82
83
  class: 'zx-date-picker__nav',
83
84
  type: 'button',
84
- ariaLabel: 'Previous year'
85
+ ariaLabel: this._message('datePicker.previousYear', 'Previous year')
85
86
  }, icon('chevron-left')),
86
87
  h('span', { ref: 'quickYear', class: 'zx-date-picker__quick-year', ariaLive: 'polite' }),
87
88
  h('button', {
88
89
  ref: 'quickNext',
89
90
  class: 'zx-date-picker__nav',
90
91
  type: 'button',
91
- ariaLabel: 'Next year'
92
+ ariaLabel: this._message('datePicker.nextYear', 'Next year')
92
93
  }, icon('chevron-right'))
93
94
  ),
94
95
  h('div', { ref: 'quickGrid', class: 'zx-date-picker__quick-grid', role: 'grid' })),
@@ -96,7 +97,7 @@ export class DatePicker extends Component {
96
97
  ref: 'grid',
97
98
  class: 'zx-date-picker__grid',
98
99
  role: 'grid',
99
- ariaLabel: 'Calendar'
100
+ ariaLabel: this._message('datePicker.calendar', 'Calendar')
100
101
  },
101
102
  h('thead', { ref: 'weekdays' }),
102
103
  h('tbody', { ref: 'days' }))
@@ -203,7 +204,7 @@ export class DatePicker extends Component {
203
204
  row.append(h('th', {
204
205
  class: 'zx-date-picker__week-heading',
205
206
  scope: 'col',
206
- ariaLabel: 'Week number'
207
+ ariaLabel: this._message('datePicker.weekNumber', 'Week number')
207
208
  }, '#'));
208
209
  }
209
210
  const sunday = new Date(2023, 0, 1);
@@ -224,7 +225,8 @@ export class DatePicker extends Component {
224
225
  const offset = (first.getDay() - this._weekStart + 7) % 7;
225
226
  const start = addDays(first, -offset);
226
227
  this.refs.heading.textContent = formatDate(first, '%B %Y');
227
- this.refs.heading.setAttribute('aria-label', `Choose month and year, ${formatDate(first, '%B %Y')}`);
228
+ this.refs.heading.setAttribute('aria-label',
229
+ this._message('datePicker.chooseMonthYear', 'Choose month and year, %1', formatDate(first, '%B %Y')));
228
230
  const rows = [];
229
231
 
230
232
  for (let week = 0; week < 6; week += 1) {
@@ -234,7 +236,7 @@ export class DatePicker extends Component {
234
236
  row.append(h('th', {
235
237
  class: 'zx-date-picker__week',
236
238
  scope: 'row',
237
- ariaLabel: `Week ${isoWeekNumber(rowStart)}`
239
+ ariaLabel: this._message('datePicker.week', 'Week %1', isoWeekNumber(rowStart))
238
240
  }, String(isoWeekNumber(rowStart))));
239
241
  }
240
242
  for (let column = 0; column < 7; column += 1) {
@@ -450,6 +452,18 @@ export class DatePicker extends Component {
450
452
  _buttonForDate(date) {
451
453
  return this.refs.days.querySelector(`[data-date="${formatDate(date, '%Y-%m-%d')}"]`);
452
454
  }
455
+
456
+ /**
457
+ * Resolves a message through the host translator, falling back to the built-in English text.
458
+ * @param {string} key Message key.
459
+ * @param {string} fallback Built-in text, with `%1`-style placeholders.
460
+ * @param {...unknown} args Interpolation values.
461
+ * @returns {string}
462
+ */
463
+ _message(key, fallback, ...args) {
464
+ const message = this.msg(key, ...args);
465
+ return message === key ? printf(fallback, args) : message;
466
+ }
453
467
  }
454
468
 
455
469
  /**
@@ -83,7 +83,7 @@
83
83
 
84
84
  .zx-date-range-picker__caption {
85
85
  overflow: hidden;
86
- font-weight: 650;
86
+ font-weight: var(--zx-weight-semibold);
87
87
  text-align: center;
88
88
  text-overflow: ellipsis;
89
89
  text-wrap: nowrap;
@@ -147,7 +147,7 @@
147
147
  padding: 0;
148
148
  color: var(--zx-color-text-muted);
149
149
  font-size: var(--zx-text-xs);
150
- font-weight: 600;
150
+ font-weight: var(--zx-weight-medium);
151
151
  text-align: center;
152
152
  }
153
153
 
@@ -223,7 +223,7 @@
223
223
  border-radius: var(--zx-radius-full);
224
224
  background: var(--zx-color-accent);
225
225
  color: var(--zx-color-on-accent);
226
- font-weight: 700;
226
+ font-weight: var(--zx-weight-semibold);
227
227
  }
228
228
 
229
229
  .zx-date-range-picker__grid td[data-range="middle"] > .zx-date-range-picker__day,
@@ -47,21 +47,21 @@ export class MonthPicker extends DatePicker {
47
47
  ref: 'previousYear',
48
48
  class: 'zx-month-picker__nav',
49
49
  type: 'button',
50
- ariaLabel: 'Previous year'
50
+ ariaLabel: this._message('monthPicker.previousYear', 'Previous year')
51
51
  }, icon('chevron-left')),
52
52
  h('span', { ref: 'year', class: 'zx-month-picker__year', ariaLive: 'polite' }),
53
53
  h('button', {
54
54
  ref: 'nextYear',
55
55
  class: 'zx-month-picker__nav',
56
56
  type: 'button',
57
- ariaLabel: 'Next year'
57
+ ariaLabel: this._message('monthPicker.nextYear', 'Next year')
58
58
  }, icon('chevron-right'))
59
59
  ),
60
60
  h('div', {
61
61
  ref: 'grid',
62
62
  class: 'zx-month-picker__grid',
63
63
  role: 'grid',
64
- ariaLabel: 'Choose month'
64
+ ariaLabel: this._message('monthPicker.chooseMonth', 'Choose month')
65
65
  })
66
66
  );
67
67
  this._content = content;
@@ -23,7 +23,7 @@
23
23
 
24
24
  .zx-time-picker__separator {
25
25
  color: var(--zx-color-text-muted);
26
- font-weight: 700;
26
+ font-weight: var(--zx-weight-semibold);
27
27
  }
28
28
 
29
29
  .zx-time-picker__clock-toggle {
@@ -48,15 +48,15 @@ export class TimePicker extends Component {
48
48
  const content = h('div', {
49
49
  class: 'zx-time-picker__segments',
50
50
  role: 'group',
51
- ariaLabel: 'Time'
51
+ ariaLabel: this._message('timePicker.label', 'Time')
52
52
  });
53
53
  this._content = content;
54
- this._addSpin(content, 'h', 'Hour', 23);
54
+ this._addSpin(content, 'h', this._message('timePicker.hour', 'Hour'), 23);
55
55
  content.append(h('span', { class: 'zx-time-picker__separator', ariaHidden: 'true' }, ':'));
56
- this._addSpin(content, 'm', 'Minute', 59);
56
+ this._addSpin(content, 'm', this._message('timePicker.minute', 'Minute'), 59);
57
57
  if (this.options.seconds) {
58
58
  content.append(h('span', { class: 'zx-time-picker__separator', ariaHidden: 'true' }, ':'));
59
- this._addSpin(content, 's', 'Second', 59);
59
+ this._addSpin(content, 's', this._message('timePicker.second', 'Second'), 59);
60
60
  }
61
61
  root.append(content);
62
62
 
@@ -66,7 +66,7 @@ export class TimePicker extends Component {
66
66
  ref: 'clockToggle',
67
67
  class: 'zx-icon-btn zx-time-picker__clock-toggle',
68
68
  type: 'button',
69
- ariaLabel: 'Pick the time on a clock',
69
+ ariaLabel: this._message('timePicker.clock', 'Pick the time on a clock'),
70
70
  ariaExpanded: 'false',
71
71
  ariaControls: clockId
72
72
  }, icon('clock', { size: 15 })));
@@ -223,7 +223,7 @@ export class TimePicker extends Component {
223
223
  ref: 'headHour',
224
224
  class: 'zx-time-picker__clock-unit',
225
225
  type: 'button',
226
- ariaLabel: 'Select the hour',
226
+ ariaLabel: this._message('timePicker.selectHour', 'Select the hour'),
227
227
  dataset: { unit: 'h' }
228
228
  }),
229
229
  h('span', { class: 'zx-time-picker__clock-colon', ariaHidden: 'true' }, ':'),
@@ -231,7 +231,7 @@ export class TimePicker extends Component {
231
231
  ref: 'headMinute',
232
232
  class: 'zx-time-picker__clock-unit',
233
233
  type: 'button',
234
- ariaLabel: 'Select the minutes',
234
+ ariaLabel: this._message('timePicker.selectMinutes', 'Select the minutes'),
235
235
  dataset: { unit: 'm' }
236
236
  })),
237
237
  h('div', { ref: 'dial', class: 'zx-time-picker__dial', role: 'radiogroup' },
@@ -290,7 +290,8 @@ export class TimePicker extends Component {
290
290
  this.refs.headMinute.textContent = pad(this._display.m);
291
291
  this.refs.headHour.setAttribute('aria-pressed', String(hours));
292
292
  this.refs.headMinute.setAttribute('aria-pressed', String(!hours));
293
- this.refs.dial.setAttribute('aria-label', hours ? 'Hour' : 'Minutes');
293
+ this.refs.dial.setAttribute('aria-label', hours
294
+ ? this._message('timePicker.hour', 'Hour') : this._message('timePicker.minutes', 'Minutes'));
294
295
  if (!this._clockOpen) return;
295
296
 
296
297
  const selected = hours ? this._display.h : this._display.m;
@@ -330,6 +331,17 @@ export class TimePicker extends Component {
330
331
  element.setAttribute('aria-checked', String(checked));
331
332
  element.tabIndex = checked ? 0 : -1;
332
333
  }
334
+
335
+ /**
336
+ * Resolves a message through the host translator, falling back to the built-in English text.
337
+ * @param {string} key Message key.
338
+ * @param {string} fallback English default.
339
+ * @returns {string}
340
+ */
341
+ _message(key, fallback) {
342
+ const message = this.msg(key);
343
+ return message === key ? fallback : message;
344
+ }
333
345
  }
334
346
 
335
347
  /**
@@ -10,6 +10,12 @@
10
10
  align-items: stretch;
11
11
  }
12
12
 
13
+ /* The box draws the frame, so the input and buttons inside it are one border shorter on each side:
14
+ the control as a whole is one control height, like a text input beside it. */
15
+ .zx-date-range-box__control > :is(input, button) {
16
+ min-block-size: calc(var(--zx-control-height) - 2px);
17
+ }
18
+
13
19
  .zx-date-range-box__control {
14
20
  position: relative;
15
21
  border: 1px solid var(--zx-color-border-control);
@@ -26,16 +32,40 @@
26
32
  background: var(--zx-color-danger-bg);
27
33
  }
28
34
 
29
- /* The input always reserves room for the clear button, which floats over its trailing edge —
30
- showing or hiding the button must not change the control's total width. */
35
+ /* A clearable input always reserves room for the clear button, which floats over its trailing
36
+ edge — showing or hiding the button must not change the control's total width. Without
37
+ `clearable` there is no button, and no room is kept for one. */
31
38
  .zx-date-range-box__input {
32
39
  min-inline-size: 16em;
33
40
  border: 0;
34
41
  border-radius: var(--zx-control-radius) 0 0 var(--zx-control-radius);
35
42
  background: inherit;
43
+ }
44
+
45
+ .zx-date-range-box[data-clearable] .zx-date-range-box__input {
36
46
  padding-inline-end: var(--zx-control-height);
37
47
  }
38
48
 
49
+ /* In a Field the control fills its column, as a text input does, and gives way in a narrow one
50
+ instead of holding a minimum width that overflows a two-column row. */
51
+ .zx-field__control > .zx-date-range-box {
52
+ display: block;
53
+ }
54
+
55
+ .zx-field__control > .zx-date-range-box :is(.zx-date-range-box__content, .zx-date-range-box__control) {
56
+ display: flex;
57
+ }
58
+
59
+ .zx-field__control > .zx-date-range-box .zx-date-range-box__control {
60
+ flex: 1 1 auto;
61
+ min-inline-size: 0;
62
+ }
63
+
64
+ .zx-field__control > .zx-date-range-box .zx-date-range-box__input {
65
+ flex: 1 1 auto;
66
+ min-inline-size: 0;
67
+ }
68
+
39
69
  /* Focused controls lift above their siblings so the ring is never clipped. */
40
70
  .zx-date-range-box__input:focus-visible,
41
71
  .zx-date-range-box__toggle:focus-visible {
@@ -141,3 +171,50 @@
141
171
  box-shadow: var(--zx-overlay-shadow);
142
172
  }
143
173
  }
174
+
175
+ /*
176
+ * Quiet fields. Inside `[data-zx-fields="quiet"]` the date reads as text: no border, no fill, and
177
+ * the calendar button and its divider hidden. Hover brings the hover fill and the button back;
178
+ * focus brings back the border, the control fill and the focus ring. An invalid value keeps its
179
+ * danger border, quiet or not. A disabled control never lights up.
180
+ */
181
+ [data-zx-fields="quiet"] .zx-date-range-box:not([data-state="invalid"]) .zx-date-range-box__control {
182
+ border-color: transparent;
183
+ background: transparent;
184
+ }
185
+
186
+ [data-zx-fields="quiet"] .zx-date-range-box__toggle {
187
+ border-inline-start-color: transparent;
188
+ opacity: 0;
189
+ }
190
+
191
+ [data-zx-fields="quiet"] .zx-date-range-box__clear {
192
+ opacity: 0;
193
+ }
194
+
195
+ [data-zx-fields="quiet"] .zx-date-range-box:not([aria-disabled="true"], [data-state="invalid"]):hover .zx-date-range-box__control {
196
+ background: var(--zx-color-bg-hover);
197
+ }
198
+
199
+ [data-zx-fields="quiet"] .zx-date-range-box:not([aria-disabled="true"]):is(:hover, :focus-within) :is(.zx-date-range-box__toggle, .zx-date-range-box__clear) {
200
+ opacity: 1;
201
+ }
202
+
203
+ [data-zx-fields="quiet"] .zx-date-range-box:not([aria-disabled="true"]):focus-within .zx-date-range-box__toggle {
204
+ border-inline-start-color: var(--zx-color-border-control);
205
+ }
206
+
207
+ [data-zx-fields="quiet"] .zx-date-range-box:not([aria-disabled="true"], [data-state="invalid"]):focus-within .zx-date-range-box__control {
208
+ border-color: var(--zx-color-border-control);
209
+ background: var(--zx-color-bg-control);
210
+ }
211
+
212
+ @media (prefers-reduced-motion: no-preference) {
213
+ [data-zx-fields="quiet"] .zx-date-range-box__control {
214
+ transition: background-color var(--zx-dur-fast) var(--zx-ease), border-color var(--zx-dur-fast) var(--zx-ease);
215
+ }
216
+
217
+ [data-zx-fields="quiet"] :is(.zx-date-range-box__toggle, .zx-date-range-box__clear) {
218
+ transition: opacity var(--zx-dur-fast) var(--zx-ease), border-color var(--zx-dur-fast) var(--zx-ease);
219
+ }
220
+ }