@adia-ai/web-components 0.8.7 → 0.8.9
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 +22 -0
- package/README.md +3 -3
- package/components/select/select.a2ui.json +6 -1
- package/components/select/select.class.js +39 -20
- package/components/select/select.d.ts +4 -0
- package/components/select/select.examples.md +12 -23
- package/components/select/select.test.js +91 -0
- package/components/select/select.yaml +16 -7
- package/dist/host.min.css +1 -1
- package/dist/host.sheet.js +1 -1
- package/dist/theme-provider.min.js +1 -1
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +2 -2
- package/dist/web-components.sheet.js +1 -1
- package/package.json +1 -1
- package/patterns/permissions-matrix/permissions-matrix.examples.html +1 -1
- package/patterns/permissions-matrix/permissions-matrix.html +1 -1
- package/styles/type/roles.css +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog — @adia-ai/web-components
|
|
2
2
|
|
|
3
|
+
## [0.8.9] — 2026-07-19
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **`<select-ui mark>`** (gh#339) — a first-class `mark` boolean (host-level and per-option) renders `<adia-mark-ui>` (the token-driven Adia brand mark) as the leading visual, following the existing `icon`/`avatar` precedent exactly: `mark` wins over `avatar`, which wins over `icon`. Fits the workspace/app-switcher row that represents the Adia platform itself, where a static scheme-locked logo URL can't invert with the color scheme.
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- **`select-ui`'s `.options = [...]` setter now syncs the trigger's leading visual** — it previously only rebuilt the listbox rows (`#renderOptions()`), never reconciling the *trigger's* icon/avatar/mark to the selected option (`#syncLeading()`, only ever called from `render()`). Setting `.options` programmatically after connect — a documented, supported path — left the trigger stale even though the listbox rows were correct. Found and fixed while adding `mark` test coverage; affected the pre-existing `icon`/`avatar` props too, not just `mark`.
|
|
10
|
+
|
|
11
|
+
### Maintenance
|
|
12
|
+
- **`components/` touched in this release window** (7 file(s), e.g. `select/select.a2ui.json`) — carried by the entries above.
|
|
13
|
+
- **`dist/` bundles rebuilt** in this cut's window (1 file(s)) — regenerated from the source changes described above, not independent edits.
|
|
14
|
+
- **`patterns/` touched in this release window** (2 file(s), e.g. `permissions-matrix/permissions-matrix.examples.html`) — carried by the entries above.
|
|
15
|
+
|
|
16
|
+
## [0.8.8] — 2026-07-19
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Default type scale tightened one step** (`styles/type/roles.css`): `--a-body-*` 14/15/16 → **13/14/15** (base 15px → 14px) and `--a-ui-*` down 1px with `--a-ui-tiny` floored at 10px — the used UI ladder is a clean 10/11/12/13/14 (tiny/xs/sm/md/lg; nav/buttons = md = **13px**). Running text now shares a 14px base with `--a-code-*`, removing the old 1px body↔ui offset. Untouched by design: the `prose` register (16/18 long-form reading), `verse`, `--a-code-*`, `--a-kicker-*`. `--a-ui-2xs` (unused, pre-staged) shares the 10px floor with `tiny`; re-space it if it's ever wired up.
|
|
20
|
+
- **`dist/` bundles regenerated** for the type scale: `web-components.min.css`, `host.min.css`, both `.sheet.js`, and `theme-provider.min.js` (it inlines the regenerated CSS sheet — the documented PR-#275 build-order coupling).
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- **README CDN pins un-drifted**: `@0.7` → `@0.8` (3 pins), the range prose now describes the actual `0.8.x` tracking behavior, and the exact-pin example is current — the pins had shipped a full minor stale for the entire 0.8 line (caught by the newly-wired repo cut-hygiene gate).
|
|
24
|
+
|
|
3
25
|
## [0.8.7] — 2026-07-19
|
|
4
26
|
|
|
5
27
|
### Changed
|
package/README.md
CHANGED
|
@@ -38,13 +38,13 @@ Since **v0.6.30**, this package ships pre-flattened + minified bundles under `di
|
|
|
38
38
|
|
|
39
39
|
```html
|
|
40
40
|
<!-- CSS: all primitives, tokens, resets (443 KB raw / ~50 KB gzipped) -->
|
|
41
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@adia-ai/web-components@0.
|
|
41
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@adia-ai/web-components@0.8/dist/web-components.min.css">
|
|
42
42
|
|
|
43
43
|
<!-- JS: registers all 122 primitives (~250 KB gzipped via Brotli) -->
|
|
44
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@adia-ai/web-components@0.
|
|
44
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@adia-ai/web-components@0.8/dist/web-components.min.js"></script>
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
The `@0.
|
|
47
|
+
The `@0.8` range tracks the latest `0.8.x` patch automatically (won't jump to a breaking `0.9`). For reproducible builds, pin an exact version instead — e.g. `@adia-ai/web-components@0.8.7/dist/web-components.min.css`.
|
|
48
48
|
|
|
49
49
|
For composite shells, add the corresponding bundle from `@adia-ai/web-modules` — see [its README](../web-modules/#cdn-no-bundler--codepen-marketing-pages-static-html) or the [CDN usage guide](https://ui-kit.exe.xyz/site/cdn-usage). The kitchen-sink path is `@adia-ai/web-modules/dist/everything.min.js` (all primitives + all 4 shells; ~190 KB gzipped) — one tag for CodePen demos.
|
|
50
50
|
|
|
@@ -66,6 +66,11 @@
|
|
|
66
66
|
"type": "string",
|
|
67
67
|
"default": ""
|
|
68
68
|
},
|
|
69
|
+
"mark": {
|
|
70
|
+
"description": "Renders the Adia brand mark (`<adia-mark-ui>`) as the leading visual — takes precedence over avatar and icon. Token-driven (light/dark handled internally), so it fits a scheme-switching workspace/app switcher where a static logo URL can't invert. Per-option `mark` on an `<option>`/options-array entry works the same way, scoped to that row.",
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"default": false
|
|
73
|
+
},
|
|
69
74
|
"max": {
|
|
70
75
|
"description": "Multi-select only. Maximum allowed selections. Toggling past the\ncap is suppressed; the `invalid` event fires with reason=\"max\".\n`0` (default) = unlimited.\n",
|
|
71
76
|
"type": "number",
|
|
@@ -107,7 +112,7 @@
|
|
|
107
112
|
"default": false
|
|
108
113
|
},
|
|
109
114
|
"options": {
|
|
110
|
-
"description": "Option list. Array of {value, label, disabled?, icon?, avatar?} or grouped {label, options: [...]}. Alternative to declarative <option> / <optgroup> children. Per-option icon/avatar render in the list AND reflect in the trigger's selected state.",
|
|
115
|
+
"description": "Option list. Array of {value, label, disabled?, icon?, avatar?, mark?} or grouped {label, options: [...]}. Alternative to declarative <option> / <optgroup> children. Per-option icon/avatar/mark render in the list AND reflect in the trigger's selected state (mark takes precedence over avatar, which takes precedence over icon).",
|
|
111
116
|
"$ref": "common_types.json#/$defs/DynamicStringList"
|
|
112
117
|
},
|
|
113
118
|
"pattern": {
|
|
@@ -48,6 +48,7 @@ export class UISelect extends UIFormElement {
|
|
|
48
48
|
label: { type: String, default: '', reflect: true },
|
|
49
49
|
icon: { type: String, default: '', reflect: true },
|
|
50
50
|
avatar: { type: String, default: '', reflect: true },
|
|
51
|
+
mark: { type: Boolean, default: false, reflect: true },
|
|
51
52
|
multiple: { type: Boolean, default: false, reflect: true },
|
|
52
53
|
searchable: { type: Boolean, default: false, reflect: true },
|
|
53
54
|
freeText: { type: Boolean, default: false, reflect: true, attribute: 'free-text' },
|
|
@@ -417,14 +418,17 @@ export class UISelect extends UIFormElement {
|
|
|
417
418
|
const lb = this.#listbox;
|
|
418
419
|
if (lb?.parentNode === this) this.removeChild(lb);
|
|
419
420
|
|
|
420
|
-
// Initial leading reflects the host [avatar]/[icon]; #syncLeading()
|
|
421
|
-
// reconciles it to the SELECTED option's
|
|
422
|
-
// `data-select-leading` marker scopes that reconciliation to
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
421
|
+
// Initial leading reflects the host [mark]/[avatar]/[icon]; #syncLeading()
|
|
422
|
+
// then reconciles it to the SELECTED option's mark/avatar/icon on every
|
|
423
|
+
// render. The `data-select-leading` marker scopes that reconciliation to
|
|
424
|
+
// our element. mark wins over avatar, which wins over icon (gh#339).
|
|
425
|
+
const leading = this.mark
|
|
426
|
+
? `<adia-mark-ui slot="leading" data-select-leading size="xs"></adia-mark-ui>`
|
|
427
|
+
: this.avatar
|
|
428
|
+
? `<img slot="leading" data-select-leading src="${escapeHTML(this.avatar)}" alt="" />`
|
|
429
|
+
: this.icon
|
|
430
|
+
? `<icon-ui slot="leading" data-select-leading name="${escapeHTML(this.icon)}"></icon-ui>`
|
|
431
|
+
: '';
|
|
428
432
|
const displayMarkup = this.searchable
|
|
429
433
|
? `<input slot="display" type="text" role="combobox" aria-autocomplete="list" autocomplete="off" placeholder="${escapeHTML(this.placeholder || '')}" value="${escapeHTML(this.#displayText() === this.placeholder ? '' : this.#displayText())}" />`
|
|
430
434
|
: `<span slot="display">${escapeHTML(this.#displayText())}</span>`;
|
|
@@ -498,7 +502,7 @@ export class UISelect extends UIFormElement {
|
|
|
498
502
|
}
|
|
499
503
|
}
|
|
500
504
|
|
|
501
|
-
// Reflect the selected option's
|
|
505
|
+
// Reflect the selected option's mark/avatar/icon in the trigger leading.
|
|
502
506
|
this.#syncLeading();
|
|
503
507
|
|
|
504
508
|
// SPEC-040 — stamp / reconcile chips + "+N more" pill on every render.
|
|
@@ -599,12 +603,12 @@ export class UISelect extends UIFormElement {
|
|
|
599
603
|
if (child.tagName === 'OPTGROUP') {
|
|
600
604
|
const group = { label: child.label || child.getAttribute('label') || '', options: [] };
|
|
601
605
|
for (const opt of child.querySelectorAll('option')) {
|
|
602
|
-
group.options.push({ value: opt.value, label: opt.textContent.trim(), disabled: opt.disabled, icon: opt.getAttribute('icon') || '', avatar: opt.getAttribute('avatar') || '' });
|
|
606
|
+
group.options.push({ value: opt.value, label: opt.textContent.trim(), disabled: opt.disabled, icon: opt.getAttribute('icon') || '', avatar: opt.getAttribute('avatar') || '', mark: opt.hasAttribute('mark') });
|
|
603
607
|
if (opt.hasAttribute('selected')) preSelectedArr.push(opt.value);
|
|
604
608
|
}
|
|
605
609
|
this.#options.push(group);
|
|
606
610
|
} else if (child.tagName === 'OPTION') {
|
|
607
|
-
this.#options.push({ value: child.value, label: child.textContent.trim(), disabled: child.disabled, icon: child.getAttribute('icon') || '', avatar: child.getAttribute('avatar') || '' });
|
|
611
|
+
this.#options.push({ value: child.value, label: child.textContent.trim(), disabled: child.disabled, icon: child.getAttribute('icon') || '', avatar: child.getAttribute('avatar') || '', mark: child.hasAttribute('mark') });
|
|
608
612
|
if (child.hasAttribute('selected')) preSelectedArr.push(child.value);
|
|
609
613
|
} else if (
|
|
610
614
|
// §225: skip [slot="display"] / [slot="listbox"] / [slot="action"] etc. — these are
|
|
@@ -660,26 +664,38 @@ export class UISelect extends UIFormElement {
|
|
|
660
664
|
this.#renderOptions();
|
|
661
665
|
const display = this.querySelector('[slot="display"]');
|
|
662
666
|
if (display) display.textContent = this.#displayText();
|
|
667
|
+
// Pre-existing gap surfaced while adding mark (gh#339): #renderOptions()
|
|
668
|
+
// only rebuilds the LISTBOX rows — the trigger's leading visual
|
|
669
|
+
// (icon/avatar/mark) was only ever reconciled from render()'s call to
|
|
670
|
+
// #syncLeading(), never from this setter. So setting `.options = [...]`
|
|
671
|
+
// programmatically after connect (a documented, supported path) left a
|
|
672
|
+
// stale or missing leading on the trigger even though the listbox rows
|
|
673
|
+
// were correct. #syncLeading() already self-guards (multi-select /
|
|
674
|
+
// consumer-custom-trigger), so calling it here is safe.
|
|
675
|
+
this.#syncLeading();
|
|
663
676
|
});
|
|
664
677
|
}
|
|
665
678
|
|
|
666
679
|
get options() { return this.#options; }
|
|
667
680
|
|
|
668
|
-
// Per-option leading markup:
|
|
669
|
-
// the listbox rows AND the trigger
|
|
681
|
+
// Per-option leading markup: mark (adia-mark-ui) beats avatar (img) beats
|
|
682
|
+
// icon (icon-ui) — gh#339. Shared by the listbox rows AND the trigger
|
|
683
|
+
// (resolved against the selected option).
|
|
670
684
|
static #optionLeadHTML(opt) {
|
|
671
685
|
if (!opt) return '';
|
|
686
|
+
if (opt.mark) return `<adia-mark-ui size="xs"></adia-mark-ui>`;
|
|
672
687
|
if (opt.avatar) return `<img data-option-avatar src="${escapeHTML(opt.avatar)}" alt="" />`;
|
|
673
688
|
if (opt.icon) return `<icon-ui name="${escapeHTML(opt.icon)}"></icon-ui>`;
|
|
674
689
|
return '';
|
|
675
690
|
}
|
|
676
691
|
|
|
677
692
|
/**
|
|
678
|
-
* Reflect the SELECTED option's
|
|
679
|
-
* Single-select only (multi-select shows chips). Falls back to the
|
|
680
|
-
* [avatar]/[icon] when the selected option carries
|
|
681
|
-
*
|
|
682
|
-
*
|
|
693
|
+
* Reflect the SELECTED option's mark/avatar/icon in the trigger's leading
|
|
694
|
+
* slot. Single-select only (multi-select shows chips). Falls back to the
|
|
695
|
+
* host [mark]/[avatar]/[icon] when the selected option carries none of the
|
|
696
|
+
* three (mark wins over avatar, which wins over icon — gh#339). Only
|
|
697
|
+
* manages the leading WE stamped (`[data-select-leading]`) — a
|
|
698
|
+
* consumer-custom trigger owns its own leading.
|
|
683
699
|
*/
|
|
684
700
|
#syncLeading() {
|
|
685
701
|
if (this.multiple || !this.#ownTrigger) return;
|
|
@@ -687,11 +703,13 @@ export class UISelect extends UIFormElement {
|
|
|
687
703
|
if (!trigger) return;
|
|
688
704
|
const flat = this.#options.flatMap((o) => o.options || [o]);
|
|
689
705
|
const sel = flat.find((o) => !o.header && !o.separator && o.value === this.value);
|
|
706
|
+
const mark = (sel && sel.mark) || this.mark || false;
|
|
690
707
|
const avatar = (sel && sel.avatar) || this.avatar || '';
|
|
691
708
|
const icon = (sel && sel.icon) || this.icon || '';
|
|
692
709
|
const existing = trigger.querySelector(':scope > [data-select-leading]');
|
|
693
710
|
let html = '';
|
|
694
|
-
if (
|
|
711
|
+
if (mark) html = `<adia-mark-ui slot="leading" data-select-leading size="xs"></adia-mark-ui>`;
|
|
712
|
+
else if (avatar) html = `<img slot="leading" data-select-leading src="${escapeHTML(avatar)}" alt="" />`;
|
|
695
713
|
else if (icon) html = `<icon-ui slot="leading" data-select-leading name="${escapeHTML(icon)}"></icon-ui>`;
|
|
696
714
|
if (!html) { existing?.remove(); return; }
|
|
697
715
|
const tmp = document.createElement('template');
|
|
@@ -751,7 +769,8 @@ export class UISelect extends UIFormElement {
|
|
|
751
769
|
// SPEC-040 — multi-select option rows render a leading checkbox
|
|
752
770
|
// indicator (CSS-driven via [data-multi-option]); the `check` icon
|
|
753
771
|
// shows when aria-selected="true".
|
|
754
|
-
// Per-option leading glyph —
|
|
772
|
+
// Per-option leading glyph — mark (adia-mark-ui) wins over avatar
|
|
773
|
+
// (img), which wins over icon (icon-ui).
|
|
755
774
|
const lead = UISelect.#optionLeadHTML(opt);
|
|
756
775
|
if (this.multiple) {
|
|
757
776
|
el.setAttribute('data-multi-option', '');
|
|
@@ -11,6 +11,8 @@ export interface SelectOption {
|
|
|
11
11
|
label?: string;
|
|
12
12
|
icon?: string;
|
|
13
13
|
avatar?: string;
|
|
14
|
+
/** Renders the Adia brand mark as this option's leading visual. Takes precedence over avatar/icon. */
|
|
15
|
+
mark?: boolean;
|
|
14
16
|
disabled?: boolean;
|
|
15
17
|
action?: string;
|
|
16
18
|
divider?: boolean;
|
|
@@ -47,6 +49,8 @@ export class UISelect extends UIFormElement {
|
|
|
47
49
|
icon: string;
|
|
48
50
|
/** Leading avatar URL or name. */
|
|
49
51
|
avatar: string;
|
|
52
|
+
/** Renders the Adia brand mark as the leading visual — takes precedence over avatar and icon (gh#339). */
|
|
53
|
+
mark: boolean;
|
|
50
54
|
multiple: boolean;
|
|
51
55
|
searchable: boolean;
|
|
52
56
|
/** Allow values not in the option list (combobox mode). */
|
|
@@ -13,37 +13,26 @@
|
|
|
13
13
|
</field-ui>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## variant
|
|
17
17
|
|
|
18
18
|
```html
|
|
19
|
-
<field-ui label="
|
|
20
|
-
<select-ui
|
|
21
|
-
<option value="
|
|
22
|
-
<option value="
|
|
23
|
-
<option value="
|
|
19
|
+
<field-ui label="Sort by">
|
|
20
|
+
<select-ui variant="ghost" value="recent">
|
|
21
|
+
<option value="recent">Most recent</option>
|
|
22
|
+
<option value="popular">Most popular</option>
|
|
23
|
+
<option value="name">Name (A–Z)</option>
|
|
24
24
|
</select-ui>
|
|
25
25
|
</field-ui>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## size
|
|
29
29
|
|
|
30
30
|
```html
|
|
31
|
-
<field-ui label="
|
|
32
|
-
<select-ui placeholder="
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<option value="toronto">Toronto</option>
|
|
37
|
-
</optgroup>
|
|
38
|
-
<optgroup label="Europe">
|
|
39
|
-
<option value="london">London</option>
|
|
40
|
-
<option value="paris">Paris</option>
|
|
41
|
-
<option value="berlin">Berlin</option>
|
|
42
|
-
</optgroup>
|
|
43
|
-
<optgroup label="Asia">
|
|
44
|
-
<option value="tokyo">Tokyo</option>
|
|
45
|
-
<option value="singapore">Singapore</option>
|
|
46
|
-
</optgroup>
|
|
31
|
+
<field-ui label="Small">
|
|
32
|
+
<select-ui size="sm" placeholder="Pick a fruit">
|
|
33
|
+
<option value="apple">Apple</option>
|
|
34
|
+
<option value="banana">Banana</option>
|
|
35
|
+
<option value="cherry">Cherry</option>
|
|
47
36
|
</select-ui>
|
|
48
37
|
</field-ui>
|
|
49
38
|
```
|
|
@@ -359,4 +359,95 @@ describe('select-ui', () => {
|
|
|
359
359
|
expect(s.hasAttribute('aria-label')).toBe(false);
|
|
360
360
|
});
|
|
361
361
|
});
|
|
362
|
+
|
|
363
|
+
// gh#339 — mark (adia-mark-ui) as a leading visual, alongside icon/avatar.
|
|
364
|
+
describe('mark (gh#339)', () => {
|
|
365
|
+
it('renders <adia-mark-ui> in the listbox row for a declarative <option mark>', async () => {
|
|
366
|
+
const s = mount(`
|
|
367
|
+
<select-ui placeholder="Choose…">
|
|
368
|
+
<option value="adia" mark>Adia</option>
|
|
369
|
+
<option value="acme" avatar="https://example.test/acme.png">Acme</option>
|
|
370
|
+
</select-ui>
|
|
371
|
+
`);
|
|
372
|
+
await tick();
|
|
373
|
+
const row = s.querySelector('[role="option"][data-value="adia"]');
|
|
374
|
+
expect(row.querySelector('adia-mark-ui')).not.toBeNull();
|
|
375
|
+
expect(s.options.find((o) => o.value === 'adia').mark).toBe(true);
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
it('reflects the SELECTED option\'s mark in the trigger leading slot', async () => {
|
|
379
|
+
const s = mount(`
|
|
380
|
+
<select-ui value="adia">
|
|
381
|
+
<option value="adia" mark>Adia</option>
|
|
382
|
+
<option value="acme" avatar="https://example.test/acme.png">Acme</option>
|
|
383
|
+
</select-ui>
|
|
384
|
+
`);
|
|
385
|
+
await tick();
|
|
386
|
+
const leading = s.querySelector('[slot="trigger"] > [data-select-leading]');
|
|
387
|
+
expect(leading.tagName).toBe('ADIA-MARK-UI');
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
it('mark wins over avatar and icon when more than one is set on the same option', async () => {
|
|
391
|
+
const s = mount(`<select-ui value="a"></select-ui>`);
|
|
392
|
+
await tick();
|
|
393
|
+
s.options = [{ value: 'a', label: 'A', mark: true, avatar: 'https://example.test/a.png', icon: 'star' }];
|
|
394
|
+
await tick();
|
|
395
|
+
const leading = s.querySelector('[slot="trigger"] > [data-select-leading]');
|
|
396
|
+
expect(leading.tagName).toBe('ADIA-MARK-UI');
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
it('switching the SELECTED option from mark to avatar swaps the trigger leading element (not just its attributes)', async () => {
|
|
400
|
+
const s = mount(`
|
|
401
|
+
<select-ui value="adia">
|
|
402
|
+
<option value="adia" mark>Adia</option>
|
|
403
|
+
<option value="acme" avatar="https://example.test/acme.png">Acme</option>
|
|
404
|
+
</select-ui>
|
|
405
|
+
`);
|
|
406
|
+
await tick();
|
|
407
|
+
expect(s.querySelector('[slot="trigger"] > [data-select-leading]').tagName).toBe('ADIA-MARK-UI');
|
|
408
|
+
s.value = 'acme';
|
|
409
|
+
await tick();
|
|
410
|
+
const leading = s.querySelector('[slot="trigger"] > [data-select-leading]');
|
|
411
|
+
expect(leading.tagName).toBe('IMG');
|
|
412
|
+
expect(leading.getAttribute('src')).toBe('https://example.test/acme.png');
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
it('a host-level [mark] renders the brand mark as a static leading visual when no option overrides it', async () => {
|
|
416
|
+
const s = mount(`
|
|
417
|
+
<select-ui mark value="adia">
|
|
418
|
+
<option value="adia">Adia</option>
|
|
419
|
+
</select-ui>
|
|
420
|
+
`);
|
|
421
|
+
await tick();
|
|
422
|
+
const leading = s.querySelector('[slot="trigger"] > [data-select-leading]');
|
|
423
|
+
expect(leading.tagName).toBe('ADIA-MARK-UI');
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
it('renders <adia-mark-ui> in a listbox ROW under [multiple] mode too (shares #optionLeadHTML with single-select)', async () => {
|
|
427
|
+
const s = mount(`
|
|
428
|
+
<select-ui multiple value="adia">
|
|
429
|
+
<option value="adia" mark>Adia</option>
|
|
430
|
+
<option value="acme" avatar="https://example.test/acme.png">Acme</option>
|
|
431
|
+
</select-ui>
|
|
432
|
+
`);
|
|
433
|
+
await tick();
|
|
434
|
+
const row = s.querySelector('[role="option"][data-value="adia"]');
|
|
435
|
+
expect(row.querySelector('adia-mark-ui')).not.toBeNull();
|
|
436
|
+
// Multi-select shows chips, not a leading visual, in the TRIGGER — mark
|
|
437
|
+
// is a correct no-op there (#syncLeading's `if (this.multiple) return`).
|
|
438
|
+
expect(s.querySelector('[slot="trigger"] > [data-select-leading]')).toBeNull();
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('mark set via the .options property (not just the declarative attribute) is honoured', async () => {
|
|
442
|
+
const s = mount(`<select-ui value="adia"></select-ui>`);
|
|
443
|
+
await tick();
|
|
444
|
+
s.options = [
|
|
445
|
+
{ value: 'adia', label: 'Adia', mark: true },
|
|
446
|
+
{ value: 'acme', label: 'Acme', avatar: 'https://example.test/acme.png' },
|
|
447
|
+
];
|
|
448
|
+
await tick();
|
|
449
|
+
const leading = s.querySelector('[slot="trigger"] > [data-select-leading]');
|
|
450
|
+
expect(leading.tagName).toBe('ADIA-MARK-UI');
|
|
451
|
+
});
|
|
452
|
+
});
|
|
362
453
|
});
|
|
@@ -56,6 +56,11 @@ props:
|
|
|
56
56
|
description: URL for leading avatar image (takes precedence over icon)
|
|
57
57
|
type: string
|
|
58
58
|
default: ""
|
|
59
|
+
mark:
|
|
60
|
+
description: Renders the Adia brand mark (`<adia-mark-ui>`) as the leading visual — takes precedence over avatar and icon. Token-driven (light/dark handled internally), so it fits a scheme-switching workspace/app switcher where a static logo URL can't invert. Per-option `mark` on an `<option>`/options-array entry works the same way, scoped to that row.
|
|
61
|
+
type: boolean
|
|
62
|
+
default: false
|
|
63
|
+
reflect: true
|
|
59
64
|
disabled:
|
|
60
65
|
description: Disables interaction and dims the control
|
|
61
66
|
type: boolean
|
|
@@ -153,7 +158,7 @@ props:
|
|
|
153
158
|
default: false
|
|
154
159
|
reflect: true
|
|
155
160
|
options:
|
|
156
|
-
description: "Option list. Array of {value, label, disabled?, icon?, avatar?} or grouped {label, options: [...]}. Alternative to declarative <option> / <optgroup> children. Per-option icon/avatar render in the list AND reflect in the trigger's selected state."
|
|
161
|
+
description: "Option list. Array of {value, label, disabled?, icon?, avatar?, mark?} or grouped {label, options: [...]}. Alternative to declarative <option> / <optgroup> children. Per-option icon/avatar/mark render in the list AND reflect in the trigger's selected state (mark takes precedence over avatar, which takes precedence over icon)."
|
|
157
162
|
type: array
|
|
158
163
|
default: []
|
|
159
164
|
dynamic: true # JS-set collection prop with a custom setter — deliberately not in static properties
|
|
@@ -253,12 +258,16 @@ a2ui:
|
|
|
253
258
|
at runtime. Or set `.options` programmatically as an array of
|
|
254
259
|
`{value, label, disabled?}` (grouped form: `{label, options:[…]}`).
|
|
255
260
|
- >-
|
|
256
|
-
Per-option visuals: give each <option> an `icon` (Phosphor name)
|
|
257
|
-
`avatar` (image URL)
|
|
258
|
-
|
|
259
|
-
option's icon/avatar
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
Per-option visuals: give each <option> an `icon` (Phosphor name),
|
|
262
|
+
`avatar` (image URL), or `mark` (Adia brand mark) —
|
|
263
|
+
`<option value="light" icon="sun">`. Each row renders its glyph in
|
|
264
|
+
the list AND the trigger reflects the SELECTED option's icon/avatar/mark
|
|
265
|
+
(theme pickers, assignee/account switchers, workspace switchers).
|
|
266
|
+
`mark` wins over `avatar`, which wins over `icon`; a host-level
|
|
267
|
+
[mark]/[icon]/[avatar] is the fallback when the selected option
|
|
268
|
+
carries none of the three. `mark` renders `<adia-mark-ui>` — a
|
|
269
|
+
token-driven brand mark that inverts with the color scheme, so a
|
|
270
|
+
workspace/app switcher doesn't need a static, scheme-locked logo URL.
|
|
262
271
|
- >-
|
|
263
272
|
For dynamic option lists rendered inside <editor-shell>, set the
|
|
264
273
|
JSON via the [data-options] attribute — <editor-shell>'s
|