@zeyos/zx 5.3.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.
- package/CHANGELOG.md +125 -0
- package/README.md +49 -16
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
- package/dist/types/components/badge/badge.d.ts +5 -4
- package/dist/types/components/datebox/date-range-box.d.ts +15 -2
- package/dist/types/components/datebox/datebox.d.ts +37 -3
- package/dist/types/components/kbd/kbd.d.ts +41 -0
- package/dist/types/components/launcher/launcher.d.ts +4 -2
- package/dist/types/components/prose/prose.d.ts +69 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +0 -36
- package/dist/types/components/stat-tile/stat-tile.d.ts +20 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +11 -5
- package/dist/types/components/tree/tree.d.ts +44 -3
- package/dist/types/core/icons.d.ts +22 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/internal/app-rail.d.ts +10 -3
- package/dist/types/internal/row-actions.d.ts +151 -0
- package/dist/zx-zeyos.esm.js +264 -82
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.css +1288 -439
- package/dist/zx.esm.js +952 -392
- package/dist/zx.esm.min.js +6 -6
- package/dist/zx.global.js +952 -392
- package/dist/zx.global.min.js +6 -6
- package/dist/zx.min.css +1 -1
- package/docs/api.json +112 -4
- package/docs/llms.md +433 -38
- package/docs/llms.txt +21 -1
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.js +2 -2
- package/src/components/app-rail/app-rail.css +11 -11
- package/src/components/app-sidebar/app-sidebar.css +90 -17
- package/src/components/app-sidebar/app-sidebar.js +120 -12
- package/src/components/badge/badge.css +33 -20
- package/src/components/badge/badge.js +5 -4
- package/src/components/breadcrumb/breadcrumb.css +28 -3
- package/src/components/breadcrumb/breadcrumb.js +2 -2
- package/src/components/button/button.css +24 -13
- package/src/components/button/button.js +20 -2
- package/src/components/calendar/calendar.css +14 -4
- package/src/components/card-view/card-view.js +2 -2
- package/src/components/chart/chart.js +20 -5
- package/src/components/check-button/check-button.css +11 -3
- package/src/components/check-button/check-button.js +3 -3
- package/src/components/context-menu/context-menu.css +7 -1
- package/src/components/date-picker/date-picker.css +6 -0
- package/src/components/date-picker/date-picker.js +5 -5
- package/src/components/date-picker/date-range-picker.css +6 -0
- package/src/components/date-picker/date-range-picker.js +3 -3
- package/src/components/date-picker/month-picker.js +3 -3
- package/src/components/date-picker/time-picker.css +6 -0
- package/src/components/datebox/date-range-box.js +30 -6
- package/src/components/datebox/datebox.js +44 -7
- package/src/components/dialog/dialog.css +0 -1
- package/src/components/dialog/dialog.js +2 -1
- package/src/components/dock/dock.js +2 -2
- package/src/components/dropdown/dropdown.css +2 -1
- package/src/components/entity-ref/entity-ref.css +8 -1
- package/src/components/file-item/file-item.css +1 -1
- package/src/components/finder/finder.js +2 -2
- package/src/components/groupbox/groupbox.js +2 -2
- package/src/components/kanban-view/kanban-view.css +8 -4
- package/src/components/kanban-view/kanban-view.js +3 -3
- package/src/components/kbd/kbd.css +64 -0
- package/src/components/kbd/kbd.js +121 -0
- package/src/components/launcher/launcher.css +30 -25
- package/src/components/launcher/launcher.js +15 -21
- package/src/components/list-toolbar/list-toolbar.css +7 -1
- package/src/components/menu-button/menu-button.css +9 -2
- package/src/components/message/message.css +6 -2
- package/src/components/message/message.js +2 -2
- package/src/components/module-bar/module-bar.css +11 -1
- package/src/components/multi-value-editor/multi-value-editor.js +4 -4
- package/src/components/navigation-bar/navigation-bar.css +3 -2
- package/src/components/pagination/pagination.js +2 -2
- package/src/components/panel/panel.js +2 -2
- package/src/components/prose/prose.css +53 -0
- package/src/components/prose/prose.js +152 -0
- package/src/components/questionnaire/questionnaire.css +7 -17
- package/src/components/questionnaire/questionnaire.js +16 -1
- package/src/components/rating/rating.css +3 -1
- package/src/components/search/search.js +2 -2
- package/src/components/select/glyphs.js +3 -3
- package/src/components/select/select.css +35 -7
- package/src/components/select/select.js +4 -4
- package/src/components/stat-tile/stat-tile.css +56 -2
- package/src/components/stat-tile/stat-tile.js +25 -2
- package/src/components/stepper/stepper.css +2 -1
- package/src/components/stepper/stepper.js +3 -3
- package/src/components/tabbox/tabbox.css +2 -2
- package/src/components/tabbox/tabbox.js +2 -2
- package/src/components/table/table.css +52 -16
- package/src/components/table/table.js +7 -5
- package/src/components/tag-picker/tag-picker.css +56 -43
- package/src/components/tag-picker/tag-picker.js +21 -16
- package/src/components/tree/tree.css +44 -0
- package/src/components/tree/tree.js +97 -9
- package/src/components/value-list/value-list.css +25 -4
- package/src/components/value-list/value-list.js +2 -1
- package/src/components/view/record-view.js +3 -3
- package/src/components/view-settings/view-settings.css +2 -1
- package/src/components/workspace-switcher/workspace-switcher.js +3 -3
- package/src/core/icons.js +34 -3
- package/src/elements/define.js +1 -0
- package/src/index.js +4 -2
- package/src/internal/app-rail.js +5 -1
- package/src/internal/row-actions.js +203 -0
- package/styles/base.css +26 -1
- package/styles/prose.css +306 -0
- package/styles/tokens/dark.css +108 -103
- package/styles/tokens/global.css +24 -9
- package/styles/tokens/semantic.css +520 -198
- package/styles/tokens/themes.css +9 -0
- package/styles/zx.css +3 -0
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
/*
|
|
2
|
+
* One chip, two shapes. A status — how something is doing — is a pill; a tag — what something is,
|
|
3
|
+
* a `tone` — is a small rectangle (below). Both are one fill and no line, 12px at weight 500 at
|
|
4
|
+
* either size, and as tall as the row they sit in allows: five ninths of `--zx-row-height` (20px
|
|
5
|
+
* in the default 36px row), never below a line of their own text and never above two, so a chip
|
|
6
|
+
* follows the row height setting without making a row taller.
|
|
7
|
+
*
|
|
2
8
|
* The neutral soft fill is a wash of the text colour rather than an opaque step of the surface
|
|
3
9
|
* scale: it darkens whatever it sits on by the same amount. In the dark theme the muted step is
|
|
4
10
|
* the raised one, so an opaque muted badge vanished on a raised card, a menu, or a dialog.
|
|
5
11
|
*/
|
|
6
12
|
.zx-badge {
|
|
13
|
+
--zx-badge-height: clamp(calc(var(--zx-text-xs) * 1.4), calc(var(--zx-row-height) * 5 / 9), calc(var(--zx-text-xs) * 2));
|
|
7
14
|
display: inline-flex;
|
|
8
15
|
align-items: center;
|
|
9
16
|
gap: var(--zx-space-1);
|
|
17
|
+
box-sizing: border-box;
|
|
10
18
|
max-inline-size: 100%;
|
|
19
|
+
block-size: var(--zx-badge-height);
|
|
11
20
|
border: 1px solid transparent;
|
|
12
21
|
border-radius: var(--zx-radius-full);
|
|
13
22
|
background: color-mix(in srgb, var(--zx-color-text) 7%, transparent);
|
|
14
23
|
color: var(--zx-color-text-muted);
|
|
15
|
-
padding-block:
|
|
24
|
+
padding-block: 0;
|
|
16
25
|
padding-inline: var(--zx-space-2);
|
|
17
26
|
font-size: var(--zx-text-xs);
|
|
18
27
|
font-weight: var(--zx-weight-medium);
|
|
19
28
|
font-variant-numeric: tabular-nums;
|
|
20
|
-
line-height: 1.
|
|
29
|
+
line-height: 1.25;
|
|
21
30
|
white-space: nowrap;
|
|
22
31
|
vertical-align: middle;
|
|
23
32
|
}
|
|
@@ -136,10 +145,12 @@
|
|
|
136
145
|
* Tone — categorical colour from the tone palette, for what a badge *is* (a project, a label, a
|
|
137
146
|
* module) rather than how it is doing. Declared after every `kind` rule so a tone wins at equal
|
|
138
147
|
* specificity: a badge has one colour, and a tone is the more specific request. Soft by default,
|
|
139
|
-
* borderless; solid fills with the tone's foreground; outline draws it.
|
|
148
|
+
* borderless; solid fills with the tone's foreground; outline draws it. A toned badge is a tag, so
|
|
149
|
+
* it takes the tag's small corners in every variant.
|
|
140
150
|
*/
|
|
141
151
|
.zx-badge[data-tone] {
|
|
142
152
|
border-color: transparent;
|
|
153
|
+
border-radius: var(--zx-radius-md);
|
|
143
154
|
background: var(--zx-badge-tone-bg);
|
|
144
155
|
color: var(--zx-badge-tone-fg);
|
|
145
156
|
}
|
|
@@ -165,30 +176,32 @@
|
|
|
165
176
|
color: var(--zx-badge-tone-fg);
|
|
166
177
|
}
|
|
167
178
|
|
|
179
|
+
/* Small is shorter and tighter, never smaller type: 12px is the floor for anything read as a word.
|
|
180
|
+
Half the row's height — 18px in the default row. */
|
|
168
181
|
.zx-badge[data-size="sm"] {
|
|
169
|
-
|
|
170
|
-
padding-
|
|
171
|
-
padding-inline: var(--zx-space-1);
|
|
172
|
-
font-size: calc(var(--zx-text-xs) - 1px);
|
|
182
|
+
--zx-badge-height: clamp(calc(var(--zx-text-xs) * 1.4), calc(var(--zx-row-height) / 2), calc(var(--zx-text-xs) * 1.75));
|
|
183
|
+
padding-inline: calc(var(--zx-space-1) * 1.5);
|
|
173
184
|
}
|
|
174
185
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
/* A status dot sits at the centre of the pill's round end, whatever the height, with a full step
|
|
187
|
+
to the label. */
|
|
188
|
+
.zx-badge:has(> .zx-badge__dot) {
|
|
189
|
+
padding-inline-start: calc(var(--zx-badge-height) / 2 - 4px);
|
|
178
190
|
}
|
|
179
191
|
|
|
180
|
-
/*
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
.zx-badge[data-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
font-size: var(--zx-text-xs);
|
|
192
|
+
/* Someone who asked for more contrast, or whose colours are forced, gets the chip's edge back:
|
|
193
|
+
a fill alone may not separate it from the surface any more. */
|
|
194
|
+
@media (prefers-contrast: more) {
|
|
195
|
+
.zx-badge:not([data-variant="solid"], [data-variant="outline"]) {
|
|
196
|
+
border-color: var(--zx-color-border-strong);
|
|
197
|
+
}
|
|
187
198
|
}
|
|
188
199
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
@media (forced-colors: active) {
|
|
201
|
+
.zx-badge,
|
|
202
|
+
.zx-badge[data-tone] {
|
|
203
|
+
border-color: CanvasText;
|
|
204
|
+
}
|
|
192
205
|
}
|
|
193
206
|
|
|
194
207
|
.zx-badge-group {
|
|
@@ -13,8 +13,8 @@ import { icon as createIcon } from '../../core/icons.js';
|
|
|
13
13
|
* @property {'neutral'|'accent'|'success'|'warning'|'danger'|'info'} [kind='neutral'] Semantic intent.
|
|
14
14
|
* @property {BadgeTone|null} [tone=null] Categorical colour — a project, a label, a module — from
|
|
15
15
|
* the tone palette rather than the status set, so a tag never reads as a warning. When set it
|
|
16
|
-
* decides the colour and
|
|
17
|
-
* ignored.
|
|
16
|
+
* decides the colour and the shape — a tag's small corners instead of a status pill — and `kind`
|
|
17
|
+
* is ignored for it; `variant` still applies. Unknown names are ignored.
|
|
18
18
|
* @property {'soft'|'solid'|'outline'} [variant='soft'] Fill treatment.
|
|
19
19
|
* @property {'md'|'sm'} [size='md'] Badge size.
|
|
20
20
|
* @property {boolean} [dot=false] Renders a small leading status dot instead of an icon.
|
|
@@ -45,8 +45,9 @@ const defaults = Object.freeze({
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Creates a
|
|
49
|
-
* `tone`, a categorical one.
|
|
48
|
+
* Creates a chip: a small, non-interactive label carrying a semantic colour as a status pill — or,
|
|
49
|
+
* with `tone`, a categorical one as a tag. `TagPicker` builds its tags with it, so a label has one
|
|
50
|
+
* construction wherever it appears.
|
|
50
51
|
*
|
|
51
52
|
* The badge is plain text content, so it needs no ARIA of its own. A badge without a label but
|
|
52
53
|
* with a `title` is named for assistive technology through `role="img"`.
|
|
@@ -21,15 +21,31 @@
|
|
|
21
21
|
font-size: var(--zx-text-sm);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/*
|
|
25
|
+
* When the trail runs short of room — a host that keeps it on one line — the ancestors give way
|
|
26
|
+
* first: each shortens to an ellipsis, down to its separator and a letter or two, before the page
|
|
27
|
+
* you are on gives anything. The folded levels behind "…" and the separators never shrink. An
|
|
28
|
+
* item's floor is its own minimum width (see the label below), so a shortened level never spills
|
|
29
|
+
* over its neighbour.
|
|
30
|
+
*/
|
|
24
31
|
.zx-breadcrumb__item {
|
|
25
32
|
display: inline-flex;
|
|
33
|
+
flex: 0 1000 auto;
|
|
26
34
|
align-items: center;
|
|
27
35
|
gap: var(--zx-space-1);
|
|
28
|
-
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.zx-breadcrumb__item:has(> .zx-breadcrumb__current) {
|
|
39
|
+
flex-shrink: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.zx-breadcrumb__item:has(> .zx-breadcrumb__more) {
|
|
43
|
+
flex-shrink: 0;
|
|
29
44
|
}
|
|
30
45
|
|
|
31
46
|
.zx-breadcrumb__separator {
|
|
32
47
|
display: inline-flex;
|
|
48
|
+
flex: none;
|
|
33
49
|
align-items: center;
|
|
34
50
|
color: var(--zx-color-text-placeholder);
|
|
35
51
|
}
|
|
@@ -72,10 +88,19 @@
|
|
|
72
88
|
font-weight: 600;
|
|
73
89
|
}
|
|
74
90
|
|
|
91
|
+
/* One line, ending in an ellipsis when it is cut. Clamped rather than kept from wrapping: a label
|
|
92
|
+
that may break between any two letters fills its line before the ellipsis, and is narrow at its
|
|
93
|
+
narrowest — a letter and the ellipsis — which is what lets an item shrink to a stub instead of
|
|
94
|
+
holding its full width or collapsing to nothing. Start-aligned, since a crumb without an href is
|
|
95
|
+
a button, which centres its text. */
|
|
75
96
|
.zx-breadcrumb__label {
|
|
97
|
+
display: -webkit-box;
|
|
98
|
+
min-inline-size: 1.5em;
|
|
76
99
|
overflow: hidden;
|
|
77
|
-
text-
|
|
78
|
-
|
|
100
|
+
text-align: start;
|
|
101
|
+
word-break: break-all;
|
|
102
|
+
-webkit-box-orient: vertical;
|
|
103
|
+
-webkit-line-clamp: 1;
|
|
79
104
|
}
|
|
80
105
|
|
|
81
106
|
.zx-breadcrumb__icon {
|
|
@@ -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 { MenuButton } from '../menu-button/menu-button.js';
|
|
6
6
|
|
|
7
7
|
/** @typedef {'chevron'|'slash'} BreadcrumbSeparator */
|
|
@@ -296,7 +296,7 @@ export class Breadcrumb extends Component {
|
|
|
296
296
|
/** @returns {HTMLElement} */
|
|
297
297
|
_renderSeparator() {
|
|
298
298
|
return h('span', { class: 'zx-breadcrumb__separator', ariaHidden: 'true' },
|
|
299
|
-
this.options.separator === 'slash' ? '/' : icon('chevron-right', { size:
|
|
299
|
+
this.options.separator === 'slash' ? '/' : icon('chevron-right', { size: ICON_SIZE.chevron }));
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
/**
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
box-shadow var(--zx-dur-fast) var(--zx-ease);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/* A trigger whose menu or popover is open holds its hover fill for as long as the panel is open,
|
|
27
|
+
in every kind, so the panel in front always points back to what opened it. */
|
|
28
|
+
.zx-btn:hover:not(:disabled),
|
|
29
|
+
.zx-btn[aria-expanded="true"]:not(:disabled) {
|
|
27
30
|
background: var(--zx-color-glass-control-hover);
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -48,7 +51,8 @@
|
|
|
48
51
|
color: var(--zx-color-on-accent-solid);
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
.zx-btn[data-kind="primary"]:hover:not(:disabled)
|
|
54
|
+
.zx-btn[data-kind="primary"]:hover:not(:disabled),
|
|
55
|
+
.zx-btn[data-kind="primary"][aria-expanded="true"]:not(:disabled) {
|
|
52
56
|
border-color: var(--zx-color-accent-solid-hover);
|
|
53
57
|
background: var(--zx-color-accent-solid-hover);
|
|
54
58
|
}
|
|
@@ -58,13 +62,20 @@
|
|
|
58
62
|
background: var(--zx-color-accent-solid-active);
|
|
59
63
|
}
|
|
60
64
|
|
|
65
|
+
/* The focus ring is the accent too, so on the solid fill a 1px line in the button's own ink keeps
|
|
66
|
+
the two apart; without it focus would only make the button look two pixels larger. */
|
|
67
|
+
.zx-btn[data-kind="primary"]:focus-visible {
|
|
68
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent-solid), var(--zx-focus-ring);
|
|
69
|
+
}
|
|
70
|
+
|
|
61
71
|
.zx-btn[data-kind="danger"] {
|
|
62
72
|
border-color: var(--zx-color-danger);
|
|
63
73
|
background: var(--zx-color-danger);
|
|
64
74
|
color: var(--zx-color-on-accent);
|
|
65
75
|
}
|
|
66
76
|
|
|
67
|
-
.zx-btn[data-kind="danger"]:hover:not(:disabled)
|
|
77
|
+
.zx-btn[data-kind="danger"]:hover:not(:disabled),
|
|
78
|
+
.zx-btn[data-kind="danger"][aria-expanded="true"]:not(:disabled) {
|
|
68
79
|
background: color-mix(in srgb, var(--zx-color-danger) 88%, var(--zx-color-text));
|
|
69
80
|
}
|
|
70
81
|
|
|
@@ -86,12 +97,14 @@
|
|
|
86
97
|
color: var(--zx-color-text-subtle);
|
|
87
98
|
}
|
|
88
99
|
|
|
89
|
-
.zx-btn[data-kind="ghost"]:hover:not(:disabled)
|
|
100
|
+
.zx-btn[data-kind="ghost"]:hover:not(:disabled),
|
|
101
|
+
.zx-btn[data-kind="ghost"][aria-expanded="true"]:not(:disabled) {
|
|
90
102
|
border-color: transparent;
|
|
91
103
|
background: var(--zx-color-bg-hover);
|
|
92
104
|
}
|
|
93
105
|
|
|
94
|
-
.zx-btn[data-kind="ghost"]:hover:not(:disabled) > .zx-icon
|
|
106
|
+
.zx-btn[data-kind="ghost"]:hover:not(:disabled) > .zx-icon,
|
|
107
|
+
.zx-btn[data-kind="ghost"][aria-expanded="true"]:not(:disabled) > .zx-icon {
|
|
95
108
|
color: var(--zx-color-text);
|
|
96
109
|
}
|
|
97
110
|
|
|
@@ -143,19 +156,17 @@
|
|
|
143
156
|
flex: none;
|
|
144
157
|
}
|
|
145
158
|
|
|
146
|
-
/* The key hint is
|
|
147
|
-
|
|
159
|
+
/* The key hint is a keycap (`kbd()`), so "New company N" reads as a label and a key, not as a
|
|
160
|
+
typo. On a solid button the cap is drawn in the button's own ink — a tint of it for the fill,
|
|
161
|
+
a stronger one for the edge — never a faded white, which falls below 4.5:1. */
|
|
148
162
|
.zx-btn__shortcut {
|
|
149
|
-
font: inherit;
|
|
150
|
-
font-size: var(--zx-text-xs);
|
|
151
|
-
font-weight: 400;
|
|
152
|
-
color: var(--zx-color-text-muted);
|
|
153
163
|
margin-inline-start: var(--zx-space-1);
|
|
154
|
-
white-space: nowrap;
|
|
155
164
|
}
|
|
156
165
|
|
|
157
166
|
.zx-btn:is([data-kind="primary"], [data-kind="danger"]) .zx-btn__shortcut {
|
|
158
|
-
|
|
167
|
+
--zx-kbd-ink: currentColor;
|
|
168
|
+
--zx-kbd-fill: color-mix(in srgb, currentColor 14%, transparent);
|
|
169
|
+
--zx-kbd-line: color-mix(in srgb, currentColor 32%, transparent);
|
|
159
170
|
}
|
|
160
171
|
|
|
161
172
|
.zx-btn-group > .zx-btn:not(:first-child) {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { h } from '../../core/dom.js';
|
|
2
2
|
import { icon as createIcon } from '../../core/icons.js';
|
|
3
|
+
import { kbd } from '../kbd/kbd.js';
|
|
3
4
|
import { spinner } from '../loading/spinner.js';
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {{label:string,keys:string}} ButtonShortcut Visible hint and ARIA key combination; the
|
|
8
|
+
* host binds the action. `label` is drawn as keycaps by `kbd()` — a chord such as `'Mod+K'`
|
|
9
|
+
* shows the platform's glyphs — and `keys` goes to `aria-keyshortcuts` as written.
|
|
10
|
+
*/
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* @typedef {Object} ButtonOptions
|
|
@@ -52,7 +57,7 @@ export function button(opts = {}) {
|
|
|
52
57
|
if (options.label !== '') {
|
|
53
58
|
element.append(h('span', { class: 'zx-btn__label' }, String(options.label)));
|
|
54
59
|
}
|
|
55
|
-
if (options.shortcut) element.append(
|
|
60
|
+
if (options.shortcut) element.append(shortcutHint(options.shortcut.label));
|
|
56
61
|
if (!options.label && options.title) element.setAttribute('aria-label', options.title);
|
|
57
62
|
if (typeof options.onclick === 'function') element.onclick = options.onclick;
|
|
58
63
|
if (options.busy) setButtonBusy(element, true);
|
|
@@ -107,6 +112,19 @@ export function setButtonBusy(element, busy) {
|
|
|
107
112
|
return element;
|
|
108
113
|
}
|
|
109
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The visible key hint: small keycaps, hidden from assistive technology because the button
|
|
117
|
+
* already announces its shortcut through `aria-keyshortcuts` and its title.
|
|
118
|
+
* @param {string} label Key or chord to draw.
|
|
119
|
+
* @returns {HTMLElement}
|
|
120
|
+
*/
|
|
121
|
+
function shortcutHint(label) {
|
|
122
|
+
const hint = kbd(String(label), { size: 'sm' });
|
|
123
|
+
hint.classList.add('zx-btn__shortcut');
|
|
124
|
+
hint.setAttribute('aria-hidden', 'true');
|
|
125
|
+
return hint;
|
|
126
|
+
}
|
|
127
|
+
|
|
110
128
|
/** @param {unknown} value @returns {'default'|'primary'|'danger'|'ghost'} */
|
|
111
129
|
function normalizeKind(value) {
|
|
112
130
|
return ['primary', 'danger', 'ghost'].includes(String(value)) ?
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
block-size: 100%;
|
|
78
78
|
min-block-size: 0;
|
|
79
79
|
border-color: transparent;
|
|
80
|
-
|
|
80
|
+
/* Concentric with the view switch's frame: its corner less the 1px border and 2px padding. */
|
|
81
|
+
border-radius: max(0px, calc(var(--zx-control-radius) - 3px));
|
|
81
82
|
background: transparent;
|
|
82
83
|
color: var(--zx-color-text-muted);
|
|
83
84
|
padding-inline: var(--zx-space-3);
|
|
@@ -100,7 +101,11 @@
|
|
|
100
101
|
font-weight: var(--zx-weight-medium);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
/* A toolbar button's hover is laid over its control fill, so it still shows in dark where both are
|
|
105
|
+
a few percent of white; a view button sits on the frame and takes the hover fill alone. */
|
|
106
|
+
.zx-calendar__toolbar-button:hover:not(:disabled) {
|
|
107
|
+
background: linear-gradient(var(--zx-color-bg-hover), var(--zx-color-bg-hover)), var(--zx-color-bg-control);
|
|
108
|
+
}
|
|
104
109
|
.zx-calendar__view-button:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--zx-color-bg-hover); }
|
|
105
110
|
.zx-calendar__new:hover:not(:disabled) { border-color: var(--zx-color-accent-solid-hover); background: var(--zx-color-accent-solid-hover); }
|
|
106
111
|
.zx-calendar button:disabled { cursor: default; opacity: .55; }
|
|
@@ -122,6 +127,11 @@
|
|
|
122
127
|
box-shadow: var(--zx-focus-ring);
|
|
123
128
|
}
|
|
124
129
|
|
|
130
|
+
/* A solid accent under the accent ring: an inner line in its own ink keeps them apart. */
|
|
131
|
+
.zx-calendar__new:focus-visible {
|
|
132
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent-solid), var(--zx-focus-ring);
|
|
133
|
+
}
|
|
134
|
+
|
|
125
135
|
.zx-calendar__heading {
|
|
126
136
|
min-inline-size: 0;
|
|
127
137
|
margin: 0;
|
|
@@ -179,7 +189,7 @@
|
|
|
179
189
|
|
|
180
190
|
.zx-calendar__day-heading:last-child { border-inline-end: 0; }
|
|
181
191
|
.zx-calendar__day-heading:hover:not(:disabled) { background: var(--zx-color-bg-hover); }
|
|
182
|
-
.zx-calendar__day-heading[aria-current="date"] .zx-calendar__day-number { color: var(--zx-color-accent); font-weight:
|
|
192
|
+
.zx-calendar__day-heading[aria-current="date"] .zx-calendar__day-number { color: var(--zx-color-accent); font-weight: var(--zx-weight-title); }
|
|
183
193
|
.zx-calendar__day-weekday { color: var(--zx-color-text-muted); font-size: var(--zx-text-xs); font-weight: var(--zx-weight-medium); }
|
|
184
194
|
.zx-calendar__day-number { font-size: var(--zx-text-sm); }
|
|
185
195
|
|
|
@@ -503,7 +513,7 @@
|
|
|
503
513
|
.zx-calendar__month-day[data-other-month="true"] { color: var(--zx-color-text-muted); background: var(--zx-color-bg-muted); }
|
|
504
514
|
.zx-calendar__month-day[aria-current="date"] {
|
|
505
515
|
color: var(--zx-color-accent);
|
|
506
|
-
font-weight:
|
|
516
|
+
font-weight: var(--zx-weight-title);
|
|
507
517
|
}
|
|
508
518
|
.zx-calendar__month-day:hover:not(:disabled) { background: var(--zx-color-bg-hover); }
|
|
509
519
|
.zx-calendar__month-events {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
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 { uid } from '../../core/util.js';
|
|
5
5
|
import { normalizeViewFieldControls, RecordView, readViewField } from '../view/record-view.js';
|
|
6
6
|
import {
|
|
@@ -486,7 +486,7 @@ export class CardView extends RecordView {
|
|
|
486
486
|
ariaExpanded: String(!collapsed),
|
|
487
487
|
ariaControls: `${headingId}-list`,
|
|
488
488
|
dataset: { groupToggle: '' }
|
|
489
|
-
}, icon('chevron-down', { size:
|
|
489
|
+
}, icon('chevron-down', { size: ICON_SIZE.chevron }), labelNode) : labelNode;
|
|
490
490
|
const heading = h('h2', { class: 'zx-card-view__group-heading', id: headingId }, content);
|
|
491
491
|
const header = h('div', {
|
|
492
492
|
class: 'zx-card-view__group-header',
|
|
@@ -514,15 +514,30 @@ function summaryValue(value) {
|
|
|
514
514
|
/** @param {HTMLElement} root @returns {Record<string, unknown>} */
|
|
515
515
|
function themeChartOptions(root) {
|
|
516
516
|
if (typeof getComputedStyle !== 'function') return {};
|
|
517
|
-
const style = getComputedStyle(root);
|
|
518
|
-
const color = style.getPropertyValue('--zx-color-text').trim();
|
|
519
|
-
const borderColor = style.getPropertyValue('--zx-color-border').trim();
|
|
520
517
|
return {
|
|
521
|
-
color: color
|
|
522
|
-
borderColor:
|
|
518
|
+
color: themeColour(root, '--zx-color-text'),
|
|
519
|
+
borderColor: themeColour(root, '--zx-color-border')
|
|
523
520
|
};
|
|
524
521
|
}
|
|
525
522
|
|
|
523
|
+
/**
|
|
524
|
+
* A colour token as the chart root paints it. The token's text may be a `light-dark()` pair, which
|
|
525
|
+
* only an element can resolve (it takes that element's colour scheme) and a canvas cannot parse, so
|
|
526
|
+
* the colour is read back from a hidden probe inside the root.
|
|
527
|
+
* @param {HTMLElement} root
|
|
528
|
+
* @param {string} token
|
|
529
|
+
* @returns {string | undefined} The computed colour, or undefined where the token is not defined.
|
|
530
|
+
*/
|
|
531
|
+
function themeColour(root, token) {
|
|
532
|
+
if (!getComputedStyle(root).getPropertyValue(token).trim()) return undefined;
|
|
533
|
+
const probe = h('span', { hidden: true });
|
|
534
|
+
probe.style.color = `var(${token})`;
|
|
535
|
+
root.append(probe);
|
|
536
|
+
const colour = getComputedStyle(probe).color;
|
|
537
|
+
probe.remove();
|
|
538
|
+
return colour || undefined;
|
|
539
|
+
}
|
|
540
|
+
|
|
526
541
|
/** @param {unknown} error @param {unknown} fallback @returns {string} */
|
|
527
542
|
function errorMessage(error, fallback) {
|
|
528
543
|
const message = error && typeof error === 'object' && 'message' in error ? String(error.message) : '';
|
|
@@ -15,19 +15,27 @@
|
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/* The hover fill is laid over the button's own fill rather than swapped in for it: in dark both
|
|
19
|
+
the control fill and the hover step are a few percent of white, and a swap would show nothing. */
|
|
18
20
|
.zx-check-button:hover:not(:disabled) {
|
|
19
|
-
background: var(--zx-color-bg-hover);
|
|
21
|
+
background: linear-gradient(var(--zx-color-bg-hover), var(--zx-color-bg-hover)), var(--zx-color-bg-control);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
/* Pressed is a state the button is in, so the button itself goes neutral — the current fill, a
|
|
23
25
|
stronger border, the full text colour — and only the check glyph, which is the mark, keeps the
|
|
24
|
-
accent, as a checkbox would.
|
|
26
|
+
accent, as a checkbox would. The current fill is laid over the control fill too, so pressed
|
|
27
|
+
stays a step above hover in dark; pointed at, it keeps that fill and takes the hover on top. */
|
|
25
28
|
.zx-check-button[aria-pressed="true"] {
|
|
26
29
|
border-color: var(--zx-color-border-strong);
|
|
27
|
-
background: var(--zx-color-bg-current);
|
|
30
|
+
background: linear-gradient(var(--zx-color-bg-current), var(--zx-color-bg-current)), var(--zx-color-bg-control);
|
|
28
31
|
color: var(--zx-color-text);
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
.zx-check-button[aria-pressed="true"]:hover:not(:disabled) {
|
|
35
|
+
background: linear-gradient(var(--zx-color-bg-hover), var(--zx-color-bg-hover)),
|
|
36
|
+
linear-gradient(var(--zx-color-bg-current), var(--zx-color-bg-current)), var(--zx-color-bg-control);
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
.zx-check-button__on {
|
|
32
40
|
color: var(--zx-color-accent);
|
|
33
41
|
}
|
|
@@ -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
|
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} CheckButtonOptions
|
|
@@ -47,8 +47,8 @@ export class CheckButton extends Component {
|
|
|
47
47
|
// Both states carry a glyph — an empty box when off, a check when on — so the control still
|
|
48
48
|
// reads as a two-state control while pressed, unpressed, or disabled.
|
|
49
49
|
children.push(h('span', { class: 'zx-check-button__icon', ariaHidden: 'true' },
|
|
50
|
-
h('span', { class: 'zx-check-button__off' }, icon('square', { size:
|
|
51
|
-
h('span', { class: 'zx-check-button__on' }, icon('check', { size:
|
|
50
|
+
h('span', { class: 'zx-check-button__off' }, icon('square', { size: ICON_SIZE.check })),
|
|
51
|
+
h('span', { class: 'zx-check-button__on' }, icon('check', { size: ICON_SIZE.check }))));
|
|
52
52
|
}
|
|
53
53
|
children.push(h('span', { class: 'zx-check-button__label', ref: 'label' }));
|
|
54
54
|
root.replaceChildren(...children);
|
|
@@ -94,14 +94,20 @@
|
|
|
94
94
|
padding-inline: var(--zx-space-1);
|
|
95
95
|
color: var(--zx-color-text-muted);
|
|
96
96
|
font-size: var(--zx-text-xs);
|
|
97
|
+
font-variant-numeric: tabular-nums;
|
|
97
98
|
text-align: center;
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
/* A shortcut is text at the right edge, no box — set the way a keycap's label is, so every key
|
|
102
|
+
hint in the library shares one type treatment. */
|
|
100
103
|
.zx-context-menu__shortcut {
|
|
101
104
|
border: 0;
|
|
102
105
|
background: transparent;
|
|
103
106
|
padding: 0;
|
|
104
|
-
font-family: var(--zx-font-
|
|
107
|
+
font-family: var(--zx-font-sans);
|
|
108
|
+
font-weight: var(--zx-weight-medium);
|
|
109
|
+
font-feature-settings: "case", "tnum";
|
|
110
|
+
white-space: nowrap;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
.zx-context-menu__check {
|
|
@@ -113,6 +113,12 @@
|
|
|
113
113
|
box-shadow: var(--zx-focus-ring);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/* Focus usually lands on the chosen day, an accent fill under the accent ring: an inner line in its
|
|
117
|
+
own ink keeps the two apart. */
|
|
118
|
+
.zx-date-picker__day[aria-selected="true"]:focus-visible {
|
|
119
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent), var(--zx-focus-ring);
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
.zx-date-picker__week,
|
|
117
123
|
.zx-date-picker__week-heading {
|
|
118
124
|
inline-size: 24px;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import { icon } from '../../core/icons.js';
|
|
4
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
5
5
|
import { printf } from '../../core/i18n.js';
|
|
6
6
|
import { TimePicker } from './time-picker.js';
|
|
7
7
|
|
|
@@ -57,7 +57,7 @@ export class DatePicker extends Component {
|
|
|
57
57
|
class: 'zx-date-picker__nav',
|
|
58
58
|
type: 'button',
|
|
59
59
|
ariaLabel: this._message('datePicker.previousMonth', 'Previous month')
|
|
60
|
-
}, icon('chevron-left')),
|
|
60
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
61
61
|
h('button', {
|
|
62
62
|
ref: 'heading',
|
|
63
63
|
class: 'zx-date-picker__heading',
|
|
@@ -70,7 +70,7 @@ export class DatePicker extends Component {
|
|
|
70
70
|
class: 'zx-date-picker__nav',
|
|
71
71
|
type: 'button',
|
|
72
72
|
ariaLabel: this._message('datePicker.nextMonth', 'Next month')
|
|
73
|
-
}, icon('chevron-right'))
|
|
73
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))
|
|
74
74
|
),
|
|
75
75
|
h('div', {
|
|
76
76
|
ref: 'quickPanel',
|
|
@@ -83,14 +83,14 @@ export class DatePicker extends Component {
|
|
|
83
83
|
class: 'zx-date-picker__nav',
|
|
84
84
|
type: 'button',
|
|
85
85
|
ariaLabel: this._message('datePicker.previousYear', 'Previous year')
|
|
86
|
-
}, icon('chevron-left')),
|
|
86
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
87
87
|
h('span', { ref: 'quickYear', class: 'zx-date-picker__quick-year', ariaLive: 'polite' }),
|
|
88
88
|
h('button', {
|
|
89
89
|
ref: 'quickNext',
|
|
90
90
|
class: 'zx-date-picker__nav',
|
|
91
91
|
type: 'button',
|
|
92
92
|
ariaLabel: this._message('datePicker.nextYear', 'Next year')
|
|
93
|
-
}, icon('chevron-right'))
|
|
93
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))
|
|
94
94
|
),
|
|
95
95
|
h('div', { ref: 'quickGrid', class: 'zx-date-picker__quick-grid', role: 'grid' })),
|
|
96
96
|
h('table', {
|
|
@@ -241,6 +241,12 @@
|
|
|
241
241
|
box-shadow: var(--zx-focus-ring);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
/* The range ends are accent fills under the accent ring: an inner line in their own ink keeps the
|
|
245
|
+
two apart. */
|
|
246
|
+
.zx-date-range-picker__grid td:is([data-range="start"], [data-range="end"]) > .zx-date-range-picker__day:focus-visible {
|
|
247
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent), var(--zx-focus-ring);
|
|
248
|
+
}
|
|
249
|
+
|
|
244
250
|
.zx-date-range-picker[aria-disabled="true"] .zx-date-range-picker__surface {
|
|
245
251
|
background: var(--zx-color-bg-page);
|
|
246
252
|
opacity: 0.65;
|
|
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
|
|
|
2
2
|
import { addDays, addMonths, formatDate, getWeekStart, isSameDay } from '../../core/date.js';
|
|
3
3
|
import { h } from '../../core/dom.js';
|
|
4
4
|
import { printf, translate } from '../../core/i18n.js';
|
|
5
|
-
import { icon } from '../../core/icons.js';
|
|
5
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
6
6
|
|
|
7
7
|
/** @typedef {{start: Date|null, end: Date|null}} DateRange */
|
|
8
8
|
/** @typedef {'start'|'middle'|'end'} DateRangeState */
|
|
@@ -617,14 +617,14 @@ export class DateRangePicker extends Component {
|
|
|
617
617
|
type: 'button',
|
|
618
618
|
dataset: { nav: 'previous' },
|
|
619
619
|
ariaLabel: text('daterange.previousMonth', 'Previous month')
|
|
620
|
-
}, icon('chevron-left')),
|
|
620
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
621
621
|
h('div', { class: 'zx-date-range-picker__caption', ariaHidden: 'true' }, caption),
|
|
622
622
|
h('button', {
|
|
623
623
|
class: 'zx-date-range-picker__nav',
|
|
624
624
|
type: 'button',
|
|
625
625
|
dataset: { nav: 'next' },
|
|
626
626
|
ariaLabel: text('daterange.nextMonth', 'Next month')
|
|
627
|
-
}, icon('chevron-right'))),
|
|
627
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))),
|
|
628
628
|
h('table', {
|
|
629
629
|
class: 'zx-date-range-picker__grid',
|
|
630
630
|
role: 'grid',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatDate } from '../../core/date.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 { DatePicker } from './date-picker.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -48,14 +48,14 @@ export class MonthPicker extends DatePicker {
|
|
|
48
48
|
class: 'zx-month-picker__nav',
|
|
49
49
|
type: 'button',
|
|
50
50
|
ariaLabel: this._message('monthPicker.previousYear', 'Previous year')
|
|
51
|
-
}, icon('chevron-left')),
|
|
51
|
+
}, icon('chevron-left', { size: ICON_SIZE.chevron })),
|
|
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
57
|
ariaLabel: this._message('monthPicker.nextYear', 'Next year')
|
|
58
|
-
}, icon('chevron-right'))
|
|
58
|
+
}, icon('chevron-right', { size: ICON_SIZE.chevron }))
|
|
59
59
|
),
|
|
60
60
|
h('div', {
|
|
61
61
|
ref: 'grid',
|
|
@@ -150,6 +150,12 @@
|
|
|
150
150
|
box-shadow: var(--zx-focus-ring);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
/* The chosen mark is an accent fill under the accent ring: an inner line in its own ink keeps the
|
|
154
|
+
two apart. */
|
|
155
|
+
.zx-time-picker__mark[aria-checked="true"]:focus-visible {
|
|
156
|
+
box-shadow: inset 0 0 0 1px var(--zx-color-on-accent), var(--zx-focus-ring);
|
|
157
|
+
}
|
|
158
|
+
|
|
153
159
|
/* The hand's box hangs from the dial centre, so a plain rotation sweeps it around the face. */
|
|
154
160
|
.zx-time-picker__hand {
|
|
155
161
|
position: absolute;
|