@adia-ai/web-components 0.0.27 → 0.0.29
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/README.md +4 -8
- package/a2ui/index.js +1 -1
- package/components/agent-questions/agent-questions.css +20 -1
- package/components/agent-trace/agent-trace.css +17 -12
- package/components/badge/badge.js +9 -1
- package/components/breadcrumb/breadcrumb.a2ui.json +16 -1
- package/components/breadcrumb/breadcrumb.css +27 -0
- package/components/breadcrumb/breadcrumb.js +95 -17
- package/components/breadcrumb/breadcrumb.yaml +15 -1
- package/components/canvas/canvas.js +1 -1
- package/components/chart/chart.css +20 -13
- package/components/chart/chart.js +49 -17
- package/components/chart-legend/chart-legend.css +30 -54
- package/components/chart-legend/chart-legend.js +48 -30
- package/components/command/command.js +52 -1
- package/components/feed/feed-item.yaml +50 -0
- package/components/feed/feed.a2ui.json +59 -0
- package/components/feed/feed.css +150 -0
- package/components/feed/feed.js +385 -0
- package/components/feed/feed.yaml +33 -0
- package/components/index.js +2 -0
- package/components/swatch/swatch.a2ui.json +116 -0
- package/components/swatch/swatch.css +141 -0
- package/components/swatch/swatch.js +121 -0
- package/components/swatch/swatch.yaml +101 -0
- package/components/timeline/timeline.css +5 -1
- package/components/toast/toast.js +48 -178
- package/components/tooltip/tooltip.css +3 -3
- package/core/provider.js +1 -0
- package/index.css +3 -2
- package/index.js +15 -7
- package/package.json +1 -5
- package/styles/components.css +1 -0
- package/patterns/a2ui-root/a2ui-root.a2ui.json +0 -125
- package/patterns/a2ui-root/a2ui-root.js +0 -191
- package/patterns/a2ui-root/a2ui-root.yaml +0 -87
- package/patterns/adia-chat/adia-chat.a2ui.json +0 -149
- package/patterns/adia-chat/adia-chat.css +0 -10
- package/patterns/adia-chat/adia-chat.js +0 -297
- package/patterns/adia-chat/adia-chat.yaml +0 -118
- package/patterns/adia-chat/css/adia-chat.empty.css +0 -12
- package/patterns/adia-chat/css/adia-chat.layout.css +0 -60
- package/patterns/adia-chat/css/adia-chat.markdown.css +0 -74
- package/patterns/adia-chat/css/adia-chat.messages.css +0 -87
- package/patterns/adia-chat/css/adia-chat.streaming.css +0 -30
- package/patterns/adia-chat/css/adia-chat.tokens.css +0 -95
- package/patterns/adia-editor/adia-editor.a2ui.json +0 -73
- package/patterns/adia-editor/adia-editor.css +0 -6
- package/patterns/adia-editor/adia-editor.js +0 -56
- package/patterns/adia-editor/adia-editor.yaml +0 -59
- package/patterns/adia-editor/css/adia-editor.layout.css +0 -171
- package/patterns/adia-editor/css/adia-editor.tokens.css +0 -28
- package/patterns/app-nav/app-nav.a2ui.json +0 -89
- package/patterns/app-nav/app-nav.css +0 -92
- package/patterns/app-nav/app-nav.js +0 -112
- package/patterns/app-nav/app-nav.yaml +0 -54
- package/patterns/app-nav-group/app-nav-group.a2ui.json +0 -82
- package/patterns/app-nav-group/app-nav-group.css +0 -264
- package/patterns/app-nav-group/app-nav-group.js +0 -116
- package/patterns/app-nav-group/app-nav-group.yaml +0 -59
- package/patterns/app-nav-item/app-nav-item.a2ui.json +0 -83
- package/patterns/app-nav-item/app-nav-item.css +0 -162
- package/patterns/app-nav-item/app-nav-item.js +0 -42
- package/patterns/app-nav-item/app-nav-item.yaml +0 -62
- package/patterns/app-shell/app-shell.a2ui.json +0 -129
- package/patterns/app-shell/app-shell.css +0 -14
- package/patterns/app-shell/app-shell.js +0 -251
- package/patterns/app-shell/app-shell.yaml +0 -89
- package/patterns/app-shell/css/app-shell.collapsed.css +0 -86
- package/patterns/app-shell/css/app-shell.helpers.css +0 -42
- package/patterns/app-shell/css/app-shell.main.css +0 -172
- package/patterns/app-shell/css/app-shell.shell.css +0 -44
- package/patterns/app-shell/css/app-shell.sidebar.css +0 -161
- package/patterns/app-shell/css/app-shell.templates.css +0 -214
- package/patterns/app-shell/css/app-shell.tokens.css +0 -119
- package/patterns/gen-ui/gen-ui.a2ui.json +0 -72
- package/patterns/gen-ui/gen-ui.css +0 -83
- package/patterns/gen-ui/gen-ui.js +0 -136
- package/patterns/gen-ui/gen-ui.yaml +0 -43
- package/patterns/index.js +0 -11
- package/patterns/section-nav/section-nav.a2ui.json +0 -91
- package/patterns/section-nav/section-nav.css +0 -60
- package/patterns/section-nav/section-nav.js +0 -42
- package/patterns/section-nav/section-nav.yaml +0 -58
- package/patterns/section-nav-group/section-nav-group.a2ui.json +0 -95
- package/patterns/section-nav-group/section-nav-group.css +0 -74
- package/patterns/section-nav-group/section-nav-group.js +0 -84
- package/patterns/section-nav-group/section-nav-group.yaml +0 -66
- package/patterns/section-nav-item/section-nav-item.a2ui.json +0 -97
- package/patterns/section-nav-item/section-nav-item.css +0 -106
- package/patterns/section-nav-item/section-nav-item.js +0 -66
- package/patterns/section-nav-item/section-nav-item.yaml +0 -70
- package/styles/layouts/admin.css +0 -7
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* <section-nav-group-ui> — Labeled group inside section-nav-ui.
|
|
3
|
-
* When [collapsible], the header row becomes a keyboard-activatable toggle
|
|
4
|
-
* that emits `group-toggle` (detail: { text, open }).
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { AdiaElement } from '../../core/element.js';
|
|
8
|
-
|
|
9
|
-
class AdiaSectionNavGroup extends AdiaElement {
|
|
10
|
-
static properties = {
|
|
11
|
-
text: { type: String, default: '', reflect: true },
|
|
12
|
-
icon: { type: String, default: '', reflect: true },
|
|
13
|
-
collapsible: { type: Boolean, default: false, reflect: true },
|
|
14
|
-
open: { type: Boolean, default: false, reflect: true },
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
static template = () => null;
|
|
18
|
-
|
|
19
|
-
#headerEl = null;
|
|
20
|
-
|
|
21
|
-
#onHeaderClick = () => {
|
|
22
|
-
if (!this.collapsible) return;
|
|
23
|
-
this.open = !this.open;
|
|
24
|
-
this.dispatchEvent(new CustomEvent('group-toggle', {
|
|
25
|
-
bubbles: true,
|
|
26
|
-
detail: { text: this.text, open: this.open },
|
|
27
|
-
}));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
#onHeaderKey = (e) => {
|
|
31
|
-
if (!this.collapsible) return;
|
|
32
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
this.#onHeaderClick();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
connected() {
|
|
39
|
-
this.#headerEl = this.querySelector(':scope > [data-section-nav-group-header]');
|
|
40
|
-
if (!this.#headerEl) {
|
|
41
|
-
this.#headerEl = document.createElement('div');
|
|
42
|
-
this.#headerEl.setAttribute('data-section-nav-group-header', '');
|
|
43
|
-
this.#buildHeader();
|
|
44
|
-
this.insertBefore(this.#headerEl, this.firstChild);
|
|
45
|
-
}
|
|
46
|
-
if (this.collapsible) {
|
|
47
|
-
this.#headerEl.setAttribute('role', 'button');
|
|
48
|
-
this.#headerEl.setAttribute('tabindex', '0');
|
|
49
|
-
this.#headerEl.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
50
|
-
this.#headerEl.addEventListener('click', this.#onHeaderClick);
|
|
51
|
-
this.#headerEl.addEventListener('keydown', this.#onHeaderKey);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
if (!this.#headerEl) return;
|
|
57
|
-
this.#buildHeader();
|
|
58
|
-
if (this.collapsible) {
|
|
59
|
-
this.#headerEl.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
60
|
-
} else {
|
|
61
|
-
this.#headerEl.removeAttribute('role');
|
|
62
|
-
this.#headerEl.removeAttribute('tabindex');
|
|
63
|
-
this.#headerEl.removeAttribute('aria-expanded');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
#buildHeader() {
|
|
68
|
-
const iconHtml = this.icon ? `<icon-ui name="${this.icon}"></icon-ui>` : '';
|
|
69
|
-
const caretHtml = this.collapsible
|
|
70
|
-
? `<icon-ui name="caret-right" data-section-nav-group-caret></icon-ui>`
|
|
71
|
-
: '';
|
|
72
|
-
this.#headerEl.innerHTML =
|
|
73
|
-
`${iconHtml}<span data-section-nav-group-label>${this.text}</span>${caretHtml}`;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
disconnected() {
|
|
77
|
-
this.#headerEl?.removeEventListener('click', this.#onHeaderClick);
|
|
78
|
-
this.#headerEl?.removeEventListener('keydown', this.#onHeaderKey);
|
|
79
|
-
this.#headerEl = null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
customElements.define('section-nav-group-ui', AdiaSectionNavGroup);
|
|
83
|
-
|
|
84
|
-
export { AdiaSectionNavGroup };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
2
|
-
name: AdiaSectionNavGroup
|
|
3
|
-
tag: section-nav-group-ui
|
|
4
|
-
component: SectionNavGroup
|
|
5
|
-
category: nav
|
|
6
|
-
version: 1
|
|
7
|
-
description: |
|
|
8
|
-
Optional labeled group inside section-nav-ui. Auto-generates a header row
|
|
9
|
-
with label and optional leading icon. When [collapsible], the header row
|
|
10
|
-
is a keyboard-activatable toggle that emits `group-toggle`.
|
|
11
|
-
|
|
12
|
-
props:
|
|
13
|
-
text:
|
|
14
|
-
type: string
|
|
15
|
-
default: ""
|
|
16
|
-
reflect: true
|
|
17
|
-
description: Group label rendered in the header row.
|
|
18
|
-
|
|
19
|
-
icon:
|
|
20
|
-
type: string
|
|
21
|
-
default: ""
|
|
22
|
-
reflect: true
|
|
23
|
-
description: Optional Phosphor icon name (leading).
|
|
24
|
-
|
|
25
|
-
collapsible:
|
|
26
|
-
type: boolean
|
|
27
|
-
default: false
|
|
28
|
-
reflect: true
|
|
29
|
-
description: When true, the header becomes a click/keyboard toggle that expands and collapses the group.
|
|
30
|
-
|
|
31
|
-
open:
|
|
32
|
-
type: boolean
|
|
33
|
-
default: false
|
|
34
|
-
reflect: true
|
|
35
|
-
description: Expanded state. Only meaningful when collapsible=true.
|
|
36
|
-
|
|
37
|
-
events:
|
|
38
|
-
group-toggle:
|
|
39
|
-
description: Fired when the group is toggled via header click or keyboard (Enter/Space).
|
|
40
|
-
detail:
|
|
41
|
-
text: string
|
|
42
|
-
open: boolean
|
|
43
|
-
|
|
44
|
-
slots:
|
|
45
|
-
default:
|
|
46
|
-
description: section-nav-item-ui children rendered under the header.
|
|
47
|
-
|
|
48
|
-
states:
|
|
49
|
-
- name: idle
|
|
50
|
-
description: Default.
|
|
51
|
-
- name: collapsible
|
|
52
|
-
attribute: collapsible
|
|
53
|
-
description: Header is interactive.
|
|
54
|
-
- name: open
|
|
55
|
-
attribute: open
|
|
56
|
-
description: Children visible.
|
|
57
|
-
|
|
58
|
-
traits: []
|
|
59
|
-
|
|
60
|
-
a2ui:
|
|
61
|
-
rules:
|
|
62
|
-
- Must be a direct child of section-nav-ui.
|
|
63
|
-
- Children must be section-nav-item-ui.
|
|
64
|
-
|
|
65
|
-
keywords: [section-nav-group, sub-nav-group, nav-section, rail-group]
|
|
66
|
-
related: [SectionNav, SectionNavItem]
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://adiaui.dev/a2ui/v0_9/components/SectionNavItem.json",
|
|
4
|
-
"title": "SectionNavItem",
|
|
5
|
-
"description": "Single nav link in a section-nav-ui rail. Icon + label. Supports disabled\nstate and keyboard activation (Enter/Space). Selection updates the\nparent section-nav-ui's selection state.\n",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"allOf": [
|
|
8
|
-
{
|
|
9
|
-
"$ref": "common_types.json#/$defs/ComponentCommon"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"$ref": "common_types.json#/$defs/CatalogComponentCommon"
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"properties": {
|
|
16
|
-
"component": {
|
|
17
|
-
"const": "SectionNavItem"
|
|
18
|
-
},
|
|
19
|
-
"disabled": {
|
|
20
|
-
"description": "Non-interactive; tab-skipped; dim visual.",
|
|
21
|
-
"type": "boolean",
|
|
22
|
-
"default": false
|
|
23
|
-
},
|
|
24
|
-
"icon": {
|
|
25
|
-
"description": "Optional Phosphor icon name (leading).",
|
|
26
|
-
"type": "string",
|
|
27
|
-
"default": ""
|
|
28
|
-
},
|
|
29
|
-
"selected": {
|
|
30
|
-
"description": "Current selection. Managed by parent section-nav-ui.",
|
|
31
|
-
"type": "boolean",
|
|
32
|
-
"default": false
|
|
33
|
-
},
|
|
34
|
-
"text": {
|
|
35
|
-
"description": "Item label.",
|
|
36
|
-
"type": "string",
|
|
37
|
-
"default": ""
|
|
38
|
-
},
|
|
39
|
-
"value": {
|
|
40
|
-
"description": "Unique identifier (route / target id).",
|
|
41
|
-
"type": "string",
|
|
42
|
-
"default": ""
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"required": [
|
|
46
|
-
"component"
|
|
47
|
-
],
|
|
48
|
-
"unevaluatedProperties": false,
|
|
49
|
-
"x-adiaui": {
|
|
50
|
-
"anti_patterns": [],
|
|
51
|
-
"category": "nav",
|
|
52
|
-
"events": {
|
|
53
|
-
"nav-select": {
|
|
54
|
-
"description": "Fired on click or Enter/Space (suppressed when disabled).",
|
|
55
|
-
"detail": {
|
|
56
|
-
"item": "HTMLElement",
|
|
57
|
-
"text": "string",
|
|
58
|
-
"value": "string"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"examples": [],
|
|
63
|
-
"keywords": [
|
|
64
|
-
"section-nav-item",
|
|
65
|
-
"sub-nav-item",
|
|
66
|
-
"nav-link",
|
|
67
|
-
"rail-item"
|
|
68
|
-
],
|
|
69
|
-
"name": "AdiaSectionNavItem",
|
|
70
|
-
"related": [
|
|
71
|
-
"SectionNav",
|
|
72
|
-
"SectionNavGroup"
|
|
73
|
-
],
|
|
74
|
-
"slots": {},
|
|
75
|
-
"states": [
|
|
76
|
-
{
|
|
77
|
-
"description": "Default.",
|
|
78
|
-
"name": "idle"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"description": "Currently selected destination.",
|
|
82
|
-
"attribute": "selected",
|
|
83
|
-
"name": "selected"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"description": "Non-interactive.",
|
|
87
|
-
"attribute": "disabled",
|
|
88
|
-
"name": "disabled"
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"synonyms": {},
|
|
92
|
-
"tag": "section-nav-item-ui",
|
|
93
|
-
"tokens": {},
|
|
94
|
-
"traits": [],
|
|
95
|
-
"version": 1
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/* Safari 17.x bug: `:scope:hover` (Flavor A) and `:scope[selected]`
|
|
2
|
-
(Flavor B — attribute-removal restyle) both fail inside `@scope`.
|
|
3
|
-
Selectors moved out. `:focus-visible` matches correctly inside `@scope`,
|
|
4
|
-
so the combined `:hover, :focus-visible` rule was split — `:hover`
|
|
5
|
-
moves out, `:focus-visible` stays. See docs/BROWSER-COMPAT.md §3a. */
|
|
6
|
-
section-nav-item-ui:hover:not([disabled]) {
|
|
7
|
-
background: var(--section-nav-item-bg-hover);
|
|
8
|
-
color: var(--section-nav-item-fg-hover);
|
|
9
|
-
}
|
|
10
|
-
section-nav-item-ui:hover:not([disabled]) > icon-ui {
|
|
11
|
-
color: var(--section-nav-item-fg-hover);
|
|
12
|
-
}
|
|
13
|
-
section-nav-item-ui[selected] {
|
|
14
|
-
background: var(--section-nav-item-bg-selected);
|
|
15
|
-
color: var(--section-nav-item-fg-selected);
|
|
16
|
-
font-weight: var(--section-nav-item-selected-weight);
|
|
17
|
-
}
|
|
18
|
-
section-nav-item-ui[selected] > icon-ui {
|
|
19
|
-
color: var(--section-nav-item-icon-fg-selected);
|
|
20
|
-
}
|
|
21
|
-
section-nav-item-ui[selected]:not(:has(> icon-ui))::before {
|
|
22
|
-
content: '';
|
|
23
|
-
position: absolute;
|
|
24
|
-
inset-inline-start: calc(var(--section-nav-item-row-px) - var(--a-space-1));
|
|
25
|
-
inset-block: 25%;
|
|
26
|
-
width: 2px;
|
|
27
|
-
border-radius: 1px;
|
|
28
|
-
background: var(--section-nav-item-accent);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@scope (section-nav-item-ui) {
|
|
32
|
-
:where(:scope) {
|
|
33
|
-
--section-nav-item-row-height: var(--a-size);
|
|
34
|
-
--section-nav-item-row-px: var(--a-ui-px);
|
|
35
|
-
--section-nav-item-row-gap: var(--a-space-1);
|
|
36
|
-
--section-nav-item-row-radius: var(--a-radius-md);
|
|
37
|
-
--section-nav-item-font-size: var(--a-ui-size);
|
|
38
|
-
--section-nav-item-icon-size: calc(var(--section-nav-item-row-height) - var(--a-space-2));
|
|
39
|
-
|
|
40
|
-
--section-nav-item-fg: var(--a-ui-text-subtle);
|
|
41
|
-
--section-nav-item-fg-hover: var(--a-ui-text-hover);
|
|
42
|
-
--section-nav-item-fg-selected: var(--a-ui-text-selected);
|
|
43
|
-
--section-nav-item-fg-disabled: var(--a-fg-disabled);
|
|
44
|
-
--section-nav-item-icon-fg: var(--a-fg-muted);
|
|
45
|
-
--section-nav-item-icon-fg-selected: var(--a-accent);
|
|
46
|
-
--section-nav-item-bg-hover: var(--a-bg-muted);
|
|
47
|
-
--section-nav-item-bg-selected: var(--a-bg-selected);
|
|
48
|
-
--section-nav-item-accent: transparent;
|
|
49
|
-
--section-nav-item-selected-weight: var(--a-weight-medium);
|
|
50
|
-
|
|
51
|
-
--section-nav-item-duration: var(--a-duration-fast);
|
|
52
|
-
--section-nav-item-easing: var(--a-easing);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
:scope {
|
|
56
|
-
position: relative;
|
|
57
|
-
box-sizing: border-box;
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
gap: var(--section-nav-item-row-gap);
|
|
61
|
-
height: var(--section-nav-item-row-height);
|
|
62
|
-
padding: 0 var(--section-nav-item-row-px);
|
|
63
|
-
border-radius: var(--section-nav-item-row-radius);
|
|
64
|
-
font-size: var(--section-nav-item-font-size);
|
|
65
|
-
color: var(--section-nav-item-fg);
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
user-select: none;
|
|
68
|
-
white-space: nowrap;
|
|
69
|
-
text-decoration: none;
|
|
70
|
-
transition:
|
|
71
|
-
background var(--section-nav-item-duration) var(--section-nav-item-easing),
|
|
72
|
-
color var(--section-nav-item-duration) var(--section-nav-item-easing);
|
|
73
|
-
outline: none;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
:scope > icon-ui {
|
|
77
|
-
width: var(--section-nav-item-icon-size);
|
|
78
|
-
height: var(--section-nav-item-icon-size);
|
|
79
|
-
flex-shrink: 0;
|
|
80
|
-
color: var(--section-nav-item-icon-fg);
|
|
81
|
-
transition: color var(--section-nav-item-duration) var(--section-nav-item-easing);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
:scope > [data-section-nav-item-label] {
|
|
85
|
-
flex: 1;
|
|
86
|
-
min-width: 0;
|
|
87
|
-
overflow: hidden;
|
|
88
|
-
text-overflow: ellipsis;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
:scope:focus-visible:not([disabled]) {
|
|
92
|
-
background: var(--section-nav-item-bg-hover);
|
|
93
|
-
color: var(--section-nav-item-fg-hover);
|
|
94
|
-
}
|
|
95
|
-
:scope:focus-visible:not([disabled]) > icon-ui {
|
|
96
|
-
color: var(--section-nav-item-fg-hover);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/* :scope[selected] rules moved outside @scope — see Safari 17.x bug note at top. */
|
|
100
|
-
|
|
101
|
-
:scope[disabled] {
|
|
102
|
-
color: var(--section-nav-item-fg-disabled);
|
|
103
|
-
cursor: not-allowed;
|
|
104
|
-
pointer-events: none;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* <section-nav-item-ui> — Single nav link in a section-nav-ui rail.
|
|
3
|
-
* Supports icon, label, disabled state, and keyboard activation (Enter/Space).
|
|
4
|
-
* Selection updates the parent section-nav-ui's selection state.
|
|
5
|
-
* Event: nav-select. detail: { item, text, value }
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { AdiaElement } from '../../core/element.js';
|
|
9
|
-
|
|
10
|
-
class AdiaSectionNavItem extends AdiaElement {
|
|
11
|
-
static properties = {
|
|
12
|
-
text: { type: String, default: '', reflect: true },
|
|
13
|
-
value: { type: String, default: '', reflect: true },
|
|
14
|
-
icon: { type: String, default: '', reflect: true },
|
|
15
|
-
selected: { type: Boolean, default: false, reflect: true },
|
|
16
|
-
disabled: { type: Boolean, default: false, reflect: true },
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
static template = () => null;
|
|
20
|
-
|
|
21
|
-
#onClick = (e) => {
|
|
22
|
-
if (this.disabled) { e.preventDefault(); return; }
|
|
23
|
-
const parent = this.closest('section-nav-ui');
|
|
24
|
-
parent?.select(this);
|
|
25
|
-
this.dispatchEvent(new CustomEvent('nav-select', {
|
|
26
|
-
bubbles: true,
|
|
27
|
-
detail: { item: this, text: this.text, value: this.value },
|
|
28
|
-
}));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
#onKey = (e) => {
|
|
32
|
-
if (this.disabled) return;
|
|
33
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
this.#onClick(e);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
connected() {
|
|
40
|
-
this.setAttribute('role', 'link');
|
|
41
|
-
this.setAttribute('tabindex', this.disabled ? '-1' : '0');
|
|
42
|
-
this.#buildBody();
|
|
43
|
-
this.addEventListener('click', this.#onClick);
|
|
44
|
-
this.addEventListener('keydown', this.#onKey);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
render() {
|
|
48
|
-
this.#buildBody();
|
|
49
|
-
this.setAttribute('tabindex', this.disabled ? '-1' : '0');
|
|
50
|
-
if (this.selected) this.setAttribute('aria-current', 'page');
|
|
51
|
-
else this.removeAttribute('aria-current');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
#buildBody() {
|
|
55
|
-
const iconHtml = this.icon ? `<icon-ui name="${this.icon}"></icon-ui>` : '';
|
|
56
|
-
this.innerHTML = `${iconHtml}<span data-section-nav-item-label>${this.text}</span>`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
disconnected() {
|
|
60
|
-
this.removeEventListener('click', this.#onClick);
|
|
61
|
-
this.removeEventListener('keydown', this.#onKey);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
customElements.define('section-nav-item-ui', AdiaSectionNavItem);
|
|
65
|
-
|
|
66
|
-
export { AdiaSectionNavItem };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
2
|
-
name: AdiaSectionNavItem
|
|
3
|
-
tag: section-nav-item-ui
|
|
4
|
-
component: SectionNavItem
|
|
5
|
-
category: nav
|
|
6
|
-
version: 1
|
|
7
|
-
description: |
|
|
8
|
-
Single nav link in a section-nav-ui rail. Icon + label. Supports disabled
|
|
9
|
-
state and keyboard activation (Enter/Space). Selection updates the
|
|
10
|
-
parent section-nav-ui's selection state.
|
|
11
|
-
|
|
12
|
-
props:
|
|
13
|
-
text:
|
|
14
|
-
type: string
|
|
15
|
-
default: ""
|
|
16
|
-
reflect: true
|
|
17
|
-
description: Item label.
|
|
18
|
-
|
|
19
|
-
value:
|
|
20
|
-
type: string
|
|
21
|
-
default: ""
|
|
22
|
-
reflect: true
|
|
23
|
-
description: Unique identifier (route / target id).
|
|
24
|
-
|
|
25
|
-
icon:
|
|
26
|
-
type: string
|
|
27
|
-
default: ""
|
|
28
|
-
reflect: true
|
|
29
|
-
description: Optional Phosphor icon name (leading).
|
|
30
|
-
|
|
31
|
-
selected:
|
|
32
|
-
type: boolean
|
|
33
|
-
default: false
|
|
34
|
-
reflect: true
|
|
35
|
-
description: Current selection. Managed by parent section-nav-ui.
|
|
36
|
-
|
|
37
|
-
disabled:
|
|
38
|
-
type: boolean
|
|
39
|
-
default: false
|
|
40
|
-
reflect: true
|
|
41
|
-
description: Non-interactive; tab-skipped; dim visual.
|
|
42
|
-
|
|
43
|
-
events:
|
|
44
|
-
nav-select:
|
|
45
|
-
description: Fired on click or Enter/Space (suppressed when disabled).
|
|
46
|
-
detail:
|
|
47
|
-
item: HTMLElement
|
|
48
|
-
text: string
|
|
49
|
-
value: string
|
|
50
|
-
|
|
51
|
-
slots: {}
|
|
52
|
-
|
|
53
|
-
states:
|
|
54
|
-
- name: idle
|
|
55
|
-
description: Default.
|
|
56
|
-
- name: selected
|
|
57
|
-
attribute: selected
|
|
58
|
-
description: Currently selected destination.
|
|
59
|
-
- name: disabled
|
|
60
|
-
attribute: disabled
|
|
61
|
-
description: Non-interactive.
|
|
62
|
-
|
|
63
|
-
traits: []
|
|
64
|
-
|
|
65
|
-
a2ui:
|
|
66
|
-
rules:
|
|
67
|
-
- Must be a descendant of section-nav-ui (direct child or via section-nav-group-ui).
|
|
68
|
-
|
|
69
|
-
keywords: [section-nav-item, sub-nav-item, nav-link, rail-item]
|
|
70
|
-
related: [SectionNav, SectionNavGroup]
|
package/styles/layouts/admin.css
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* Backward-compatible shim — the app shell CSS now lives in patterns/.
|
|
2
|
-
This file re-exports it so existing <link> tags in admin.html keep working.
|
|
3
|
-
New pages should import patterns/app-shell/app-shell.css directly. */
|
|
4
|
-
@import "../../patterns/app-shell/app-shell.css";
|
|
5
|
-
@import "../../patterns/app-nav/app-nav.css";
|
|
6
|
-
@import "../../patterns/app-nav-group/app-nav-group.css";
|
|
7
|
-
@import "../../patterns/app-nav-item/app-nav-item.css";
|