@zeyos/zx 5.4.0 → 5.6.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 +136 -0
- package/README.md +23 -16
- package/dist/types/components/agent-thread/agent-thread.d.ts +583 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -0
- package/dist/types/components/approval-card/approval-card.d.ts +596 -0
- package/dist/types/components/avatar/avatar.d.ts +91 -4
- package/dist/types/components/badge/badge.d.ts +5 -4
- package/dist/types/components/block-view/block-view.d.ts +205 -0
- package/dist/types/components/composer/composer.d.ts +736 -0
- 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/run-status/run-status.d.ts +393 -0
- package/dist/types/components/run-trace/run-trace.d.ts +624 -0
- package/dist/types/components/source-list/source-list.d.ts +177 -0
- 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/core/messages.d.ts +135 -0
- package/dist/types/index.d.ts +12 -2
- package/dist/types/internal/agent-model.d.ts +587 -0
- package/dist/types/internal/app-rail.d.ts +10 -3
- package/dist/types/internal/highlight.d.ts +24 -0
- package/dist/types/internal/presence-loop.d.ts +148 -0
- package/dist/types/internal/row-actions.d.ts +151 -0
- package/dist/zx-zeyos.esm.js +4852 -4535
- package/dist/zx-zeyos.esm.min.js +4 -4
- package/dist/zx.css +3152 -434
- package/dist/zx.esm.js +13730 -6595
- package/dist/zx.esm.min.js +27 -8
- package/dist/zx.global.js +13730 -6595
- package/dist/zx.global.min.js +27 -8
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1474 -205
- package/docs/llms.md +698 -39
- package/docs/llms.txt +12 -1
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.js +2 -2
- package/src/components/agent-thread/agent-thread.css +417 -0
- package/src/components/agent-thread/agent-thread.js +1365 -0
- 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/approval-card/approval-card.css +289 -0
- package/src/components/approval-card/approval-card.js +1377 -0
- package/src/components/avatar/avatar.css +56 -1
- package/src/components/avatar/avatar.js +148 -26
- package/src/components/badge/badge.css +33 -20
- package/src/components/badge/badge.js +5 -4
- package/src/components/block-view/block-view.css +300 -0
- package/src/components/block-view/block-view.js +523 -0
- 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/composer/composer.css +403 -0
- package/src/components/composer/composer.js +1441 -0
- 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.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/run-status/run-status.css +208 -0
- package/src/components/run-status/run-status.js +782 -0
- package/src/components/run-trace/run-trace.css +443 -0
- package/src/components/run-trace/run-trace.js +1209 -0
- 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/source-list/source-list.css +208 -0
- package/src/components/source-list/source-list.js +355 -0
- 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/core/messages.js +143 -0
- package/src/elements/define.js +1 -0
- package/src/index.js +12 -2
- package/src/internal/agent-model.js +488 -0
- package/src/internal/app-rail.js +5 -1
- package/src/internal/highlight.js +104 -0
- package/src/internal/presence-loop.js +343 -0
- 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 +97 -120
- package/styles/tokens/global.css +24 -9
- package/styles/tokens/semantic.css +464 -184
- package/styles/tokens/themes.css +9 -0
- package/styles/zx.css +10 -0
|
@@ -277,6 +277,19 @@
|
|
|
277
277
|
inset-block-start: 0;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
/*
|
|
281
|
+
* Body rows keep one rhythm: a single-line row is exactly `--zx-row-height`, its divider included,
|
|
282
|
+
* whatever the cells hold. On a table cell `block-size` is a minimum, so wrapped text or a taller
|
|
283
|
+
* control still grows its row; the slim block padding leaves a content box large enough for a
|
|
284
|
+
* checkbox, an avatar or a badge, which the middle alignment centres. Sized as a border box here
|
|
285
|
+
* rather than by the scope, so the height holds in any host.
|
|
286
|
+
*/
|
|
287
|
+
.zx-table__body > tr:not(.zx-table__empty-row) > :is(td, th) {
|
|
288
|
+
box-sizing: border-box;
|
|
289
|
+
block-size: var(--zx-row-height);
|
|
290
|
+
padding-block: var(--zx-space-1);
|
|
291
|
+
}
|
|
292
|
+
|
|
280
293
|
.zx-table th[data-align="center"],
|
|
281
294
|
.zx-table td[data-align="center"] {
|
|
282
295
|
text-align: center;
|
|
@@ -305,14 +318,17 @@
|
|
|
305
318
|
align-items: center;
|
|
306
319
|
justify-content: space-between;
|
|
307
320
|
gap: var(--zx-space-2);
|
|
308
|
-
|
|
321
|
+
/* Wider than the cell by an inset on each side, handed back by the margins, so the hover fill
|
|
322
|
+
clears the label instead of hugging it while the label stays on the column's text edge. */
|
|
323
|
+
inline-size: calc(100% + 2 * var(--zx-space-2));
|
|
309
324
|
min-block-size: 24px;
|
|
310
325
|
border: 0;
|
|
311
326
|
border-radius: var(--zx-radius-sm);
|
|
312
327
|
background: inherit;
|
|
313
328
|
color: inherit;
|
|
314
329
|
margin-block: calc(-1 * var(--zx-table-sort-slack));
|
|
315
|
-
|
|
330
|
+
margin-inline: calc(-1 * var(--zx-space-2));
|
|
331
|
+
padding: var(--zx-table-sort-slack) var(--zx-space-2);
|
|
316
332
|
/* The header's type, not a control's: base.css sets buttons in the control size and weight, and
|
|
317
333
|
the browser resets their tracking, so a sortable label would not match its unsortable
|
|
318
334
|
neighbours. */
|
|
@@ -341,14 +357,20 @@
|
|
|
341
357
|
box-shadow: var(--zx-focus-ring);
|
|
342
358
|
}
|
|
343
359
|
|
|
344
|
-
|
|
345
|
-
|
|
360
|
+
/* The direction arrow: shown on the sorted column only, and turned to point down for a descending
|
|
361
|
+
sort. */
|
|
362
|
+
.zx-table__sort-icon {
|
|
363
|
+
display: none;
|
|
364
|
+
flex: none;
|
|
346
365
|
color: var(--zx-color-text-muted);
|
|
347
366
|
}
|
|
348
367
|
|
|
349
|
-
.zx-table th[aria-sort
|
|
350
|
-
|
|
351
|
-
|
|
368
|
+
.zx-table th[aria-sort] .zx-table__sort-icon {
|
|
369
|
+
display: inline-flex;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.zx-table th[aria-sort="descending"] .zx-table__sort-icon {
|
|
373
|
+
transform: rotate(180deg);
|
|
352
374
|
}
|
|
353
375
|
|
|
354
376
|
.zx-table__body tr:last-child td {
|
|
@@ -356,22 +378,32 @@
|
|
|
356
378
|
}
|
|
357
379
|
|
|
358
380
|
.zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"]) {
|
|
359
|
-
|
|
381
|
+
--zx-table-row-fill: var(--zx-color-bg-page);
|
|
382
|
+
background: var(--zx-table-row-fill);
|
|
360
383
|
}
|
|
361
384
|
|
|
362
385
|
/* Checked rows of a multi-selection are picks and keep the accent tint. The selected row of a
|
|
363
386
|
single-selection table — no checkbox column — is the record you are on, the current row of a
|
|
364
387
|
master–detail list, and takes the neutral current fill instead. */
|
|
365
388
|
.zx-table__body tr[aria-selected="true"] {
|
|
366
|
-
|
|
389
|
+
--zx-table-row-fill: var(--zx-table-row-selected-bg, var(--zx-color-bg-selected));
|
|
390
|
+
background: var(--zx-table-row-fill);
|
|
367
391
|
}
|
|
368
392
|
|
|
369
393
|
.zx-table__body tr[aria-selected="true"]:not(:has(> .zx-table__selection-cell)) {
|
|
370
|
-
|
|
394
|
+
--zx-table-row-fill: var(--zx-table-row-selected-bg, var(--zx-color-bg-current));
|
|
371
395
|
}
|
|
372
396
|
|
|
373
397
|
.zx-table__body tr[data-row]:hover {
|
|
374
|
-
background: var(--zx-color-bg-hover);
|
|
398
|
+
background: var(--zx-table-row-hover-bg, var(--zx-color-bg-hover));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* State is never lost under the pointer: a selected, current or striped row lays the hover step
|
|
402
|
+
over its own fill instead of trading it for the hover fill. */
|
|
403
|
+
.zx-table__body tr[data-row][aria-selected="true"]:hover,
|
|
404
|
+
.zx-table__scroll[data-zebra="true"] .zx-table__body tr[data-row]:nth-child(even):not([aria-selected="true"]):hover {
|
|
405
|
+
background: linear-gradient(var(--zx-table-row-hover-bg, var(--zx-color-bg-hover)),
|
|
406
|
+
var(--zx-table-row-hover-bg, var(--zx-color-bg-hover))), var(--zx-table-row-fill);
|
|
375
407
|
}
|
|
376
408
|
|
|
377
409
|
/* ------------------------------------------------------------------ plain -- */
|
|
@@ -400,8 +432,9 @@
|
|
|
400
432
|
background: transparent;
|
|
401
433
|
}
|
|
402
434
|
|
|
435
|
+
/* The stripe's own rule paints this fill, and the hover step lays over it, so nothing more. */
|
|
403
436
|
.zx-table[data-variant="plain"] .zx-table__scroll[data-zebra="true"] .zx-table__body tr:nth-child(even):not([aria-selected="true"]) {
|
|
404
|
-
|
|
437
|
+
--zx-table-row-fill: transparent;
|
|
405
438
|
}
|
|
406
439
|
|
|
407
440
|
.zx-table[data-variant="plain"] .zx-table__body tr:last-child td {
|
|
@@ -566,6 +599,7 @@
|
|
|
566
599
|
.zx-table[data-stacked] .zx-table__body > tr[data-span] > * {
|
|
567
600
|
display: block;
|
|
568
601
|
inline-size: auto;
|
|
602
|
+
block-size: auto;
|
|
569
603
|
padding-inline: 0;
|
|
570
604
|
text-align: start;
|
|
571
605
|
}
|
|
@@ -576,11 +610,12 @@
|
|
|
576
610
|
|
|
577
611
|
/* --- Inline editing (Table editMode) -------------------------------------------------------- */
|
|
578
612
|
|
|
579
|
-
/*
|
|
580
|
-
|
|
581
|
-
|
|
613
|
+
/* Every body cell of an editable table holds an editor's height above its divider — the row
|
|
614
|
+
height already does, unless a theme sets rows tighter than a control — so opening an editor
|
|
615
|
+
never changes a row's height. On a table cell `block-size` is a minimum, which is exactly the
|
|
616
|
+
wanted behaviour: taller content still grows the row. */
|
|
582
617
|
.zx-table[data-edit-mode] .zx-table__body td {
|
|
583
|
-
block-size: var(--zx-control-height);
|
|
618
|
+
block-size: max(var(--zx-row-height), calc(var(--zx-control-height) + 1px));
|
|
584
619
|
}
|
|
585
620
|
|
|
586
621
|
.zx-table__body td[data-editable="true"] {
|
|
@@ -704,6 +739,7 @@
|
|
|
704
739
|
justify-content: space-between;
|
|
705
740
|
gap: var(--zx-space-4);
|
|
706
741
|
inline-size: auto;
|
|
742
|
+
block-size: auto;
|
|
707
743
|
padding-block: var(--zx-space-1);
|
|
708
744
|
padding-inline: 0;
|
|
709
745
|
border: 0;
|
|
@@ -2,7 +2,7 @@ import { Component } from '../../core/component.js';
|
|
|
2
2
|
import { breakpoints, onBreakpoint } from '../../core/breakpoint.js';
|
|
3
3
|
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
4
4
|
import { formatCurrency, formatNumber, formatPercent } from '../../core/format.js';
|
|
5
|
-
import { icon } from '../../core/icons.js';
|
|
5
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
6
6
|
import { printf } from '../../core/i18n.js';
|
|
7
7
|
import { uid } from '../../core/util.js';
|
|
8
8
|
import { Datebox } from '../datebox/datebox.js';
|
|
@@ -1438,12 +1438,12 @@ export class Table extends Component {
|
|
|
1438
1438
|
class: 'zx-table__column-move', type: 'button', disabled: index === 0,
|
|
1439
1439
|
ariaLabel: `Move ${name} earlier`,
|
|
1440
1440
|
dataset: { columnId: column.id, columnAction: 'up' }
|
|
1441
|
-
}, icon('chevron-up', { size:
|
|
1441
|
+
}, icon('chevron-up', { size: ICON_SIZE.chevron })),
|
|
1442
1442
|
h('button', {
|
|
1443
1443
|
class: 'zx-table__column-move', type: 'button', disabled: index === this._columns.length - 1,
|
|
1444
1444
|
ariaLabel: `Move ${name} later`,
|
|
1445
1445
|
dataset: { columnId: column.id, columnAction: 'down' }
|
|
1446
|
-
}, icon('chevron-down', { size:
|
|
1446
|
+
}, icon('chevron-down', { size: ICON_SIZE.chevron }))) : null;
|
|
1447
1447
|
return h('div', { class: 'zx-table__column-option', dataset: { columnId: column.id } }, label, order);
|
|
1448
1448
|
});
|
|
1449
1449
|
this._columnList.replaceChildren(...controls, this._columnStatus);
|
|
@@ -1717,7 +1717,9 @@ export class Table extends Component {
|
|
|
1717
1717
|
class: 'zx-table__sort-button',
|
|
1718
1718
|
type: 'button',
|
|
1719
1719
|
ariaLabel: name ?? undefined
|
|
1720
|
-
}, h('span', { class: 'zx-table__header-label' }, column.label)
|
|
1720
|
+
}, h('span', { class: 'zx-table__header-label' }, column.label),
|
|
1721
|
+
// One arrow per sortable header; `aria-sort` on the header shows it and says which way.
|
|
1722
|
+
h('span', { class: 'zx-table__sort-icon', ariaHidden: 'true' }, icon('arrow-up', { size: ICON_SIZE.sort })));
|
|
1721
1723
|
this.listen(button, 'click', () => {
|
|
1722
1724
|
const direction = this._sort?.id === column.id && this._sort.dir === 'asc' ? 'desc' : 'asc';
|
|
1723
1725
|
this.setSort(column.id, direction);
|
|
@@ -1955,7 +1957,7 @@ export class Table extends Component {
|
|
|
1955
1957
|
type: 'button',
|
|
1956
1958
|
tabIndex: -1,
|
|
1957
1959
|
ariaExpanded: String(expanded)
|
|
1958
|
-
}, icon(expanded ? 'chevron-down' : 'chevron-right', { size:
|
|
1960
|
+
}, icon(expanded ? 'chevron-down' : 'chevron-right', { size: ICON_SIZE.chevron })));
|
|
1959
1961
|
} else {
|
|
1960
1962
|
branch.append(h('span', { class: 'zx-table__tree-spacer', ariaHidden: 'true' }));
|
|
1961
1963
|
}
|
|
@@ -42,24 +42,29 @@
|
|
|
42
42
|
display: contents;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
/*
|
|
46
|
+
* A tag is a Badge — `badge()` with the item's tone, and this class added — so its height (from
|
|
47
|
+
* the row), its 12px medium type, its padding, its one fill and its tone pairs are the Badge's, and
|
|
48
|
+
* a label reads the same in the field as in a list row or a record header. What follows is the
|
|
49
|
+
* picker's own.
|
|
50
|
+
*
|
|
51
|
+
* An untoned tag is still a tag, so it keeps the tag's small corners rather than the status pill's;
|
|
52
|
+
* and it is the field's value, so it keeps the text ink rather than a status's muted one.
|
|
53
|
+
*/
|
|
54
|
+
.zx-tag-picker .zx-tag-picker__tag {
|
|
52
55
|
border-radius: var(--zx-radius-md);
|
|
53
|
-
background: var(--zx-color-bg-muted);
|
|
54
|
-
font-size: var(--zx-text-sm);
|
|
55
|
-
line-height: 1.5;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
.zx-tag-picker .zx-tag-picker__tag:not([data-tone]) {
|
|
59
|
+
color: var(--zx-color-text);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* A host colour (`colorKey`) tints the tag's one fill. */
|
|
58
63
|
.zx-tag-picker__tag[data-colored="true"] {
|
|
59
|
-
border-color: color-mix(in srgb, var(--zx-tag-color) 48%, var(--zx-color-border));
|
|
60
64
|
background: color-mix(in srgb, var(--zx-tag-color) 14%, var(--zx-color-bg-muted));
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
/* An option's icon sits on a tile of its colour, beside a label that has no fill of its own. */
|
|
63
68
|
.zx-tag-picker__visual {
|
|
64
69
|
display: inline-grid;
|
|
65
70
|
place-items: center;
|
|
@@ -71,52 +76,59 @@
|
|
|
71
76
|
color: var(--zx-tag-color, var(--zx-color-accent));
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
/* A categorical tone
|
|
75
|
-
text, no border — and an icon tile the same pair, so a label keeps one colour everywhere. */
|
|
76
|
-
.zx-tag-picker__tag[data-tone] {
|
|
77
|
-
border-color: transparent;
|
|
78
|
-
background: var(--zx-tag-tone-bg);
|
|
79
|
-
color: var(--zx-tag-tone-fg);
|
|
80
|
-
}
|
|
81
|
-
|
|
79
|
+
/* A categorical tone gives an option's tile the Badge tone pair, so it matches the tag it becomes. */
|
|
82
80
|
.zx-tag-picker__visual[data-tone] {
|
|
83
81
|
background: var(--zx-tag-tone-bg);
|
|
84
82
|
color: var(--zx-tag-tone-fg);
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
.zx-tag-
|
|
85
|
+
.zx-tag-picker__visual[data-tone="blue"] { --zx-tag-tone-bg: var(--zx-color-tone-blue-bg); --zx-tag-tone-fg: var(--zx-color-tone-blue-fg); }
|
|
86
|
+
.zx-tag-picker__visual[data-tone="teal"] { --zx-tag-tone-bg: var(--zx-color-tone-teal-bg); --zx-tag-tone-fg: var(--zx-color-tone-teal-fg); }
|
|
87
|
+
.zx-tag-picker__visual[data-tone="green"] { --zx-tag-tone-bg: var(--zx-color-tone-green-bg); --zx-tag-tone-fg: var(--zx-color-tone-green-fg); }
|
|
88
|
+
.zx-tag-picker__visual[data-tone="amber"] { --zx-tag-tone-bg: var(--zx-color-tone-amber-bg); --zx-tag-tone-fg: var(--zx-color-tone-amber-fg); }
|
|
89
|
+
.zx-tag-picker__visual[data-tone="orange"] { --zx-tag-tone-bg: var(--zx-color-tone-orange-bg); --zx-tag-tone-fg: var(--zx-color-tone-orange-fg); }
|
|
90
|
+
.zx-tag-picker__visual[data-tone="red"] { --zx-tag-tone-bg: var(--zx-color-tone-red-bg); --zx-tag-tone-fg: var(--zx-color-tone-red-fg); }
|
|
91
|
+
.zx-tag-picker__visual[data-tone="pink"] { --zx-tag-tone-bg: var(--zx-color-tone-pink-bg); --zx-tag-tone-fg: var(--zx-color-tone-pink-fg); }
|
|
92
|
+
.zx-tag-picker__visual[data-tone="violet"] { --zx-tag-tone-bg: var(--zx-color-tone-violet-bg); --zx-tag-tone-fg: var(--zx-color-tone-violet-fg); }
|
|
93
|
+
.zx-tag-picker__visual[data-tone="slate"] { --zx-tag-tone-bg: var(--zx-color-tone-slate-bg); --zx-tag-tone-fg: var(--zx-color-tone-slate-fg); }
|
|
94
|
+
|
|
95
|
+
/* Inside a tag the icon is a bare glyph in the tag's ink: the tag is already the fill, and a tile
|
|
96
|
+
on top of it would be a second one. A host colour still marks the glyph. */
|
|
97
|
+
.zx-tag-picker .zx-tag-picker__tag .zx-tag-picker__visual {
|
|
98
|
+
inline-size: auto;
|
|
99
|
+
block-size: auto;
|
|
100
|
+
background: none;
|
|
88
101
|
color: inherit;
|
|
89
102
|
}
|
|
90
103
|
|
|
91
|
-
.zx-tag-picker .zx-tag-picker__tag[data-
|
|
92
|
-
|
|
93
|
-
color: inherit;
|
|
104
|
+
.zx-tag-picker .zx-tag-picker__tag[data-colored="true"] .zx-tag-picker__visual {
|
|
105
|
+
color: var(--zx-tag-color);
|
|
94
106
|
}
|
|
95
107
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
:is(.zx-tag-picker__tag, .zx-tag-picker__visual)[data-tone="orange"] { --zx-tag-tone-bg: var(--zx-color-tone-orange-bg); --zx-tag-tone-fg: var(--zx-color-tone-orange-fg); }
|
|
101
|
-
:is(.zx-tag-picker__tag, .zx-tag-picker__visual)[data-tone="red"] { --zx-tag-tone-bg: var(--zx-color-tone-red-bg); --zx-tag-tone-fg: var(--zx-color-tone-red-fg); }
|
|
102
|
-
:is(.zx-tag-picker__tag, .zx-tag-picker__visual)[data-tone="pink"] { --zx-tag-tone-bg: var(--zx-color-tone-pink-bg); --zx-tag-tone-fg: var(--zx-color-tone-pink-fg); }
|
|
103
|
-
:is(.zx-tag-picker__tag, .zx-tag-picker__visual)[data-tone="violet"] { --zx-tag-tone-bg: var(--zx-color-tone-violet-bg); --zx-tag-tone-fg: var(--zx-color-tone-violet-fg); }
|
|
104
|
-
:is(.zx-tag-picker__tag, .zx-tag-picker__visual)[data-tone="slate"] { --zx-tag-tone-bg: var(--zx-color-tone-slate-bg); --zx-tag-tone-fg: var(--zx-color-tone-slate-fg); }
|
|
108
|
+
/* The remove button replaces the tag's end padding. */
|
|
109
|
+
.zx-tag-picker .zx-tag-picker__tag:has(> .zx-tag-picker__remove) {
|
|
110
|
+
padding-inline-end: 0;
|
|
111
|
+
}
|
|
105
112
|
|
|
106
|
-
|
|
107
|
-
|
|
113
|
+
/* The × is stretched to the tag's height and held 1px in from it, so with the tag's own 1px edge
|
|
114
|
+
its hover fill sits 2px inside the tag on every side and never touches the tag's edge. */
|
|
115
|
+
.zx-tag-picker .zx-tag-picker__remove {
|
|
116
|
+
inline-size: 18px;
|
|
117
|
+
block-size: auto;
|
|
118
|
+
min-block-size: 0;
|
|
119
|
+
align-self: stretch;
|
|
120
|
+
margin-block: 1px;
|
|
121
|
+
margin-inline-end: 1px;
|
|
122
|
+
border-radius: var(--zx-radius-sm);
|
|
108
123
|
}
|
|
109
124
|
|
|
110
|
-
.zx-tag-picker__tag-
|
|
111
|
-
|
|
112
|
-
text-overflow: ellipsis;
|
|
113
|
-
white-space: nowrap;
|
|
125
|
+
.zx-tag-picker .zx-tag-picker__tag[data-tone] .zx-tag-picker__remove {
|
|
126
|
+
color: inherit;
|
|
114
127
|
}
|
|
115
128
|
|
|
116
|
-
.zx-tag-picker .zx-tag-picker__remove {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
border-radius: var(--zx-radius-sm);
|
|
129
|
+
.zx-tag-picker .zx-tag-picker__tag[data-tone] .zx-tag-picker__remove:hover {
|
|
130
|
+
background: color-mix(in srgb, currentColor 14%, transparent);
|
|
131
|
+
color: inherit;
|
|
120
132
|
}
|
|
121
133
|
|
|
122
134
|
.zx-tag-picker__input {
|
|
@@ -163,7 +175,8 @@
|
|
|
163
175
|
max-inline-size: calc(100vw - var(--zx-space-4));
|
|
164
176
|
overflow: hidden;
|
|
165
177
|
border: 1px solid var(--zx-color-overlay-border);
|
|
166
|
-
|
|
178
|
+
/* Concentric with the options inside it: their corner plus the inset around them. */
|
|
179
|
+
border-radius: var(--zx-radius-panel);
|
|
167
180
|
background-color: var(--zx-color-overlay-surface);
|
|
168
181
|
background-image: var(--zx-overlay-surface-image);
|
|
169
182
|
background-clip: padding-box;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
import { h, restoreTarget, snapshotTarget } from '../../core/dom.js';
|
|
3
|
-
import { icon } from '../../core/icons.js';
|
|
3
|
+
import { ICON_SIZE, icon } from '../../core/icons.js';
|
|
4
4
|
import { position } from '../../core/position.js';
|
|
5
5
|
import { uid } from '../../core/util.js';
|
|
6
|
-
import { normalizeBadgeTone } from '../badge/badge.js';
|
|
6
|
+
import { badge, normalizeBadgeTone } from '../badge/badge.js';
|
|
7
7
|
import { itemColor } from '../select/color.js';
|
|
8
8
|
import { matchItems } from '../select/filter.js';
|
|
9
9
|
|
|
@@ -21,8 +21,9 @@ import { matchItems } from '../select/filter.js';
|
|
|
21
21
|
* or a token reference such as `var(--zx-color-tone-blue-fg)`.
|
|
22
22
|
* @property {TagValueReader} [toneKey='tone'] Optional item tone property or reader: a categorical
|
|
23
23
|
* tone name from the Badge palette (`blue`, `teal`, `green`, `amber`, `orange`, `red`, `pink`,
|
|
24
|
-
* `violet`, `slate`).
|
|
25
|
-
*
|
|
24
|
+
* `violet`, `slate`). Every tag is built by `badge()`, so a toned tag is the Badge with that `tone`
|
|
25
|
+
* — the same shape, size, fill and ink it has in a list row or a record header; a tone wins over a
|
|
26
|
+
* colour, and unknown names are ignored.
|
|
26
27
|
* @property {Array<TagValueReader>|null} [searchKeys=null] Fields searched by local filtering.
|
|
27
28
|
* @property {'local'|((query: string) => Promise<TagItem[]>|TagItem[])} [filter='local'] Filtering mode.
|
|
28
29
|
* @property {number} [minQuery=0] Minimum async query length.
|
|
@@ -136,7 +137,7 @@ export class TagPicker extends Component {
|
|
|
136
137
|
type: 'button',
|
|
137
138
|
tabIndex: -1,
|
|
138
139
|
ariaLabel: this._message('tagPicker.toggle', 'Toggle options')
|
|
139
|
-
}, icon('chevron-down', { size:
|
|
140
|
+
}, icon('chevron-down', { size: ICON_SIZE.chevron }));
|
|
140
141
|
const control = h('div', { ref: 'control', class: 'zx-tag-picker__control' },
|
|
141
142
|
tags, input, toggle);
|
|
142
143
|
|
|
@@ -420,25 +421,29 @@ export class TagPicker extends Component {
|
|
|
420
421
|
|
|
421
422
|
/* ------------------------------------------------------------------ rendering -- */
|
|
422
423
|
|
|
423
|
-
/**
|
|
424
|
+
/**
|
|
425
|
+
* Draws the selection. A tag is a Badge — `badge({ tone })` with the picker's own class — so it
|
|
426
|
+
* has one construction wherever a label appears, and only the remove button is the picker's.
|
|
427
|
+
* @returns {void}
|
|
428
|
+
*/
|
|
424
429
|
_renderTags() {
|
|
425
430
|
const tags = this._selected.map((item) => {
|
|
426
431
|
const label = this._labelOf(item);
|
|
427
432
|
const tone = this._toneOf(item);
|
|
428
433
|
const color = tone ? null : this._colorOf(item);
|
|
429
|
-
const content = this.options.renderTag ? this.options.renderTag(item)
|
|
430
|
-
: [this._iconOf(item), h('span', { class: 'zx-tag-picker__tag-label' }, label)];
|
|
431
|
-
const tag =
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
const content = this.options.renderTag ? [this.options.renderTag(item)]
|
|
435
|
+
: [this._iconOf(item), h('span', { class: 'zx-badge__label zx-tag-picker__tag-label' }, label)];
|
|
436
|
+
const tag = badge({ tone });
|
|
437
|
+
tag.classList.add('zx-tag-picker__tag');
|
|
438
|
+
tag.dataset.colored = String(Boolean(color));
|
|
439
|
+
if (color) tag.style.setProperty('--zx-tag-color', color);
|
|
440
|
+
tag.append(...content.filter((node) => node !== null && node !== undefined));
|
|
436
441
|
if (!this._readonly && !this._disabled) {
|
|
437
442
|
tag.append(h('button', {
|
|
438
443
|
class: 'zx-icon-btn zx-tag-picker__remove',
|
|
439
444
|
type: 'button',
|
|
440
445
|
ariaLabel: this._message('tagPicker.remove', 'Remove %1', [label])
|
|
441
|
-
}, icon('x', { size:
|
|
446
|
+
}, icon('x', { size: ICON_SIZE.chip })));
|
|
442
447
|
}
|
|
443
448
|
return tag;
|
|
444
449
|
});
|
|
@@ -463,7 +468,7 @@ export class TagPicker extends Component {
|
|
|
463
468
|
ariaSelected: String(selected)
|
|
464
469
|
},
|
|
465
470
|
h('span', { class: 'zx-tag-picker__check', ariaHidden: 'true' },
|
|
466
|
-
selected ? icon('check', { size:
|
|
471
|
+
selected ? icon('check', { size: ICON_SIZE.check }) : null),
|
|
467
472
|
h('span', { class: 'zx-tag-picker__option-label' },
|
|
468
473
|
this.options.renderItem ? this.options.renderItem(item)
|
|
469
474
|
: [this._iconOf(item), h('span', {}, this._labelOf(item))]));
|
|
@@ -481,7 +486,7 @@ export class TagPicker extends Component {
|
|
|
481
486
|
ariaSelected: 'false',
|
|
482
487
|
dataset: { create: 'true' }
|
|
483
488
|
},
|
|
484
|
-
h('span', { class: 'zx-tag-picker__check', ariaHidden: 'true' }, icon('plus', { size:
|
|
489
|
+
h('span', { class: 'zx-tag-picker__check', ariaHidden: 'true' }, icon('plus', { size: ICON_SIZE.check })),
|
|
485
490
|
h('span', { class: 'zx-tag-picker__option-label' },
|
|
486
491
|
this._message('tagPicker.create', 'Create “%1”', [query])));
|
|
487
492
|
this._entries.push({ item: null, element: option, create: true });
|
|
@@ -100,6 +100,50 @@
|
|
|
100
100
|
font-variant-numeric: tabular-nums;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/* Row actions. The row is the reveal host (`data-zx-reveal-host` in base.css): the strip keeps its
|
|
104
|
+
room at the row's end and shows while the row is pointed at, focused or selected. Each control
|
|
105
|
+
is a square a little smaller than a control, pulled into the row's padding so the row keeps its
|
|
106
|
+
height. */
|
|
107
|
+
.zx-tree__actions {
|
|
108
|
+
display: inline-flex;
|
|
109
|
+
flex: none;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 2px;
|
|
112
|
+
margin-inline: auto calc(var(--zx-space-1) - var(--zx-space-2));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.zx-tree__badge + .zx-tree__actions {
|
|
116
|
+
margin-inline-start: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.zx-tree .zx-tree__action {
|
|
120
|
+
display: inline-grid;
|
|
121
|
+
place-items: center;
|
|
122
|
+
inline-size: calc(var(--zx-control-height) - var(--zx-space-1) - 2px);
|
|
123
|
+
block-size: calc(var(--zx-control-height) - var(--zx-space-1) - 2px);
|
|
124
|
+
min-block-size: 0;
|
|
125
|
+
margin-block: calc(1px - var(--zx-space-1));
|
|
126
|
+
padding: 0;
|
|
127
|
+
border: 0;
|
|
128
|
+
border-radius: var(--zx-radius-sm);
|
|
129
|
+
background: none;
|
|
130
|
+
color: var(--zx-color-text-muted);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.zx-tree .zx-tree__action:is(:hover, [aria-expanded="true"]):not(:disabled) {
|
|
134
|
+
background: var(--zx-color-bg-hover);
|
|
135
|
+
color: var(--zx-color-text);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.zx-tree .zx-tree__action:focus-visible {
|
|
139
|
+
outline-color: transparent;
|
|
140
|
+
box-shadow: inset var(--zx-focus-ring);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.zx-tree .zx-tree__action .zx-btn__label:empty {
|
|
144
|
+
display: none;
|
|
145
|
+
}
|
|
146
|
+
|
|
103
147
|
.zx-tree__empty {
|
|
104
148
|
padding: var(--zx-space-5);
|
|
105
149
|
color: var(--zx-color-text-muted);
|