@helixui/library 1.1.2-next.8 → 1.1.2-next.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/custom-elements.json +627 -580
- package/dist/components/hx-breadcrumb/hx-breadcrumb-item.d.ts +1 -0
- package/dist/components/hx-breadcrumb/hx-breadcrumb-item.d.ts.map +1 -1
- package/dist/components/hx-breadcrumb/hx-breadcrumb.d.ts +10 -8
- package/dist/components/hx-breadcrumb/hx-breadcrumb.d.ts.map +1 -1
- package/dist/components/hx-breadcrumb/index.js +1 -1
- package/dist/components/hx-menu/hx-menu-item.d.ts +5 -0
- package/dist/components/hx-menu/hx-menu-item.d.ts.map +1 -1
- package/dist/components/hx-menu/hx-menu.d.ts +1 -0
- package/dist/components/hx-menu/hx-menu.d.ts.map +1 -1
- package/dist/components/hx-menu/hx-menu.styles.d.ts.map +1 -1
- package/dist/components/hx-menu/index.js +1 -1
- package/dist/components/hx-nav/hx-nav.d.ts +10 -0
- package/dist/components/hx-nav/hx-nav.d.ts.map +1 -1
- package/dist/components/hx-nav/index.js +1 -1
- package/dist/components/hx-pagination/hx-pagination.d.ts.map +1 -1
- package/dist/components/hx-pagination/index.js +1 -1
- package/dist/components/hx-tabs/hx-tab.styles.d.ts.map +1 -1
- package/dist/components/hx-tabs/hx-tabs.d.ts +10 -0
- package/dist/components/hx-tabs/hx-tabs.d.ts.map +1 -1
- package/dist/components/hx-tabs/index.js +1 -1
- package/dist/components/hx-tree-view/hx-tree-item.d.ts +5 -0
- package/dist/components/hx-tree-view/hx-tree-item.d.ts.map +1 -1
- package/dist/components/hx-tree-view/hx-tree-view.d.ts +6 -0
- package/dist/components/hx-tree-view/hx-tree-view.d.ts.map +1 -1
- package/dist/components/hx-tree-view/index.js +1 -1
- package/dist/css/helix-all.css +2 -0
- package/dist/css/helix-navigation.css +2 -0
- package/dist/css/hx-menu.css +2 -0
- package/dist/css/index.css +1 -1
- package/dist/css/manifest.json +2 -1
- package/dist/index.js +6 -6
- package/dist/shared/{hx-breadcrumb-item-B2rjepqy.js → hx-breadcrumb-item-CObc-WJl.js} +8 -6
- package/dist/shared/hx-breadcrumb-item-CObc-WJl.js.map +1 -0
- package/dist/shared/{hx-menu-divider-DR4G_rqw.js → hx-menu-divider-puPmRAdN.js} +40 -20
- package/dist/shared/hx-menu-divider-puPmRAdN.js.map +1 -0
- package/dist/shared/{hx-nav-D377Ngz4.js → hx-nav-CiyqaW2I.js} +112 -99
- package/dist/shared/hx-nav-CiyqaW2I.js.map +1 -0
- package/dist/shared/{hx-pagination-DYhYPqDn.js → hx-pagination-Cb9UEWXz.js} +74 -66
- package/dist/shared/{hx-pagination-DYhYPqDn.js.map → hx-pagination-Cb9UEWXz.js.map} +1 -1
- package/dist/shared/{hx-tab-panel-GGjk6Qg4.js → hx-tab-panel-Dnt8aA74.js} +89 -61
- package/dist/shared/hx-tab-panel-Dnt8aA74.js.map +1 -0
- package/dist/shared/{hx-tree-item-DTDIBRrI.js → hx-tree-item-C1PhX-HE.js} +50 -19
- package/dist/shared/hx-tree-item-C1PhX-HE.js.map +1 -0
- package/package.json +2 -2
- package/dist/shared/hx-breadcrumb-item-B2rjepqy.js.map +0 -1
- package/dist/shared/hx-menu-divider-DR4G_rqw.js.map +0 -1
- package/dist/shared/hx-nav-D377Ngz4.js.map +0 -1
- package/dist/shared/hx-tab-panel-GGjk6Qg4.js.map +0 -1
- package/dist/shared/hx-tree-item-DTDIBRrI.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as v, LitElement as _, html as m, nothing as N } from "lit";
|
|
2
|
+
import { property as h, state as g, customElement as y } from "lit/decorators.js";
|
|
3
3
|
import { tokenStyles as w } from "@helixui/tokens/lit";
|
|
4
4
|
import { d as E } from "./dev-warn-YlwPHjtX.js";
|
|
5
|
-
const
|
|
5
|
+
const O = v`
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
8
|
font-family: var(--hx-font-family-sans, sans-serif);
|
|
@@ -79,14 +79,14 @@ const N = x`
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
`;
|
|
82
|
-
var
|
|
83
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
84
|
-
(
|
|
85
|
-
return i && s &&
|
|
82
|
+
var I = Object.defineProperty, k = Object.getOwnPropertyDescriptor, p = (e, t, a, i) => {
|
|
83
|
+
for (var s = i > 1 ? void 0 : i ? k(t, a) : t, r = e.length - 1, n; r >= 0; r--)
|
|
84
|
+
(n = e[r]) && (s = (i ? n(t, a, s) : n(s)) || s);
|
|
85
|
+
return i && s && I(t, a, s), s;
|
|
86
86
|
};
|
|
87
|
-
let
|
|
87
|
+
let L = 0, b = class extends _ {
|
|
88
88
|
constructor() {
|
|
89
|
-
super(...arguments), this._id = `hx-tabs-${++
|
|
89
|
+
super(...arguments), this._id = `hx-tabs-${++L}`, this.orientation = "horizontal", this.activation = "automatic", this.label = "", this._activePanel = "", this._cachedTabs = null, this._cachedPanels = null, this._observer = null, this._pendingIndex = null, this._handleTabSelect = (e) => {
|
|
90
90
|
if (!(e instanceof CustomEvent)) return;
|
|
91
91
|
e.stopPropagation();
|
|
92
92
|
const t = e.composedPath().find((a) => a instanceof Element && a.tagName.toLowerCase() === "hx-tab");
|
|
@@ -97,34 +97,51 @@ let z = 0, b = class extends _ {
|
|
|
97
97
|
a ? this._activateTab(a, !1) : this._activePanel = "";
|
|
98
98
|
}
|
|
99
99
|
}, this._handleKeydown = (e) => {
|
|
100
|
-
var P, S,
|
|
101
|
-
const t = this.
|
|
100
|
+
var T, P, S, C;
|
|
101
|
+
const t = this._getTabs();
|
|
102
102
|
if (t.length === 0)
|
|
103
103
|
return;
|
|
104
104
|
const a = this.orientation === "horizontal", i = a ? "ArrowLeft" : "ArrowUp", s = a ? "ArrowRight" : "ArrowDown";
|
|
105
105
|
if (![i, s, "Home", "End", " ", "Enter"].includes(e.key))
|
|
106
106
|
return;
|
|
107
|
-
const
|
|
107
|
+
const n = t.find((u) => u === document.activeElement);
|
|
108
108
|
if (e.key === " " || e.key === "Enter") {
|
|
109
|
-
|
|
109
|
+
n && !n.disabled && (e.preventDefault(), this._activateTab(n), (P = (T = n.shadowRoot) == null ? void 0 : T.querySelector("button")) == null || P.focus());
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
e.preventDefault();
|
|
113
|
-
let
|
|
114
|
-
if (
|
|
115
|
-
const u = t.find((
|
|
116
|
-
|
|
113
|
+
let o = n ? t.indexOf(n) : -1;
|
|
114
|
+
if (o === -1) {
|
|
115
|
+
const u = t.find(($) => $.panel === this._activePanel);
|
|
116
|
+
o = u ? t.indexOf(u) : 0;
|
|
117
117
|
}
|
|
118
|
-
let
|
|
119
|
-
e.key === "Home" ?
|
|
120
|
-
const l = t[
|
|
121
|
-
l && ((C = (
|
|
118
|
+
let d;
|
|
119
|
+
e.key === "Home" ? d = 0 : e.key === "End" ? d = t.length - 1 : e.key === s ? d = (o + 1) % t.length : d = o <= 0 ? t.length - 1 : o - 1;
|
|
120
|
+
const l = t[d];
|
|
121
|
+
l && ((C = (S = l.shadowRoot) == null ? void 0 : S.querySelector("button")) == null || C.focus(), this.activation === "automatic" && !l.disabled && this._activateTab(l));
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
+
// ─── Attribute Observation ───
|
|
125
|
+
static get observedAttributes() {
|
|
126
|
+
return [...super.observedAttributes ?? [], "selected-index"];
|
|
127
|
+
}
|
|
128
|
+
attributeChangedCallback(e, t, a) {
|
|
129
|
+
if (super.attributeChangedCallback(e, t, a), e === "selected-index" && a !== null && t !== a) {
|
|
130
|
+
const i = parseInt(a, 10);
|
|
131
|
+
if (!isNaN(i) && i >= 0)
|
|
132
|
+
if (this.hasUpdated) {
|
|
133
|
+
const s = this._getTabs()[i];
|
|
134
|
+
s && !s.disabled && this._activateTab(s, !1);
|
|
135
|
+
} else
|
|
136
|
+
this._pendingIndex = i;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
124
139
|
// ─── Public API ───
|
|
125
140
|
/**
|
|
126
141
|
* Gets or sets the zero-based index of the currently selected tab.
|
|
127
142
|
* Setting this programmatically activates the tab at the given index.
|
|
143
|
+
* Can also be set via the `selected-index` HTML attribute for server-side
|
|
144
|
+
* pre-selection (e.g. Drupal Twig templates).
|
|
128
145
|
*/
|
|
129
146
|
get selectedIndex() {
|
|
130
147
|
return this._getTabs().findIndex((e) => e.panel === this._activePanel);
|
|
@@ -163,7 +180,14 @@ let z = 0, b = class extends _ {
|
|
|
163
180
|
super.disconnectedCallback(), this.removeEventListener("hx-tab-select", this._handleTabSelect), this.removeEventListener("keydown", this._handleKeydown), (e = this._observer) == null || e.disconnect(), this._observer = null;
|
|
164
181
|
}
|
|
165
182
|
firstUpdated() {
|
|
166
|
-
if (this.label, this._syncTabsAndPanels(),
|
|
183
|
+
if (this.label, this._syncTabsAndPanels(), this._pendingIndex !== null) {
|
|
184
|
+
const e = this._getTabs()[this._pendingIndex];
|
|
185
|
+
if (this._pendingIndex = null, e && !e.disabled) {
|
|
186
|
+
this._activateTab(e, !1);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (!this._activePanel) {
|
|
167
191
|
const e = this._getEnabledTabs()[0];
|
|
168
192
|
e && this._activateTab(e, !1);
|
|
169
193
|
}
|
|
@@ -178,14 +202,14 @@ let z = 0, b = class extends _ {
|
|
|
178
202
|
e.forEach((a, i) => {
|
|
179
203
|
const s = a.id || `hx-tab-${this._id}-${i}`;
|
|
180
204
|
a.id = s;
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
const
|
|
205
|
+
const r = a.panel, n = t.find((o) => o.name === r) ?? t[i];
|
|
206
|
+
if (n) {
|
|
207
|
+
const o = n.id || `hx-panel-${this._id}-${i}`;
|
|
208
|
+
n.id = o, a.controls = o;
|
|
209
|
+
const d = Array.from(a.childNodes).filter(
|
|
186
210
|
(l) => l.nodeType === Node.TEXT_NODE || l.nodeType === Node.ELEMENT_NODE && !l.hasAttribute("slot")
|
|
187
211
|
).map((l) => l.textContent ?? "").join("").trim();
|
|
188
|
-
|
|
212
|
+
d ? (n.setAttribute("aria-label", d), n.removeAttribute("aria-labelledby")) : n.setAttribute("aria-labelledby", s);
|
|
189
213
|
}
|
|
190
214
|
}), this._updateTabsAndPanels();
|
|
191
215
|
}
|
|
@@ -221,17 +245,17 @@ let z = 0, b = class extends _ {
|
|
|
221
245
|
var a, i;
|
|
222
246
|
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelector('slot[name="tab"]'), t = (i = this.shadowRoot) == null ? void 0 : i.querySelector("slot:not([name])");
|
|
223
247
|
if (e) {
|
|
224
|
-
const s = e.assignedElements().filter((
|
|
248
|
+
const s = e.assignedElements().filter((r) => r.tagName.toLowerCase() !== "hx-tab");
|
|
225
249
|
s.length > 0 && E(
|
|
226
250
|
"hx-tabs",
|
|
227
|
-
`Slot "tab" expects <hx-tab> elements. Found unexpected: ${s.map((
|
|
251
|
+
`Slot "tab" expects <hx-tab> elements. Found unexpected: ${s.map((r) => `<${r.tagName.toLowerCase()}>`).join(", ")}`
|
|
228
252
|
);
|
|
229
253
|
}
|
|
230
254
|
if (t) {
|
|
231
|
-
const s = t.assignedElements().filter((
|
|
255
|
+
const s = t.assignedElements().filter((r) => r.tagName.toLowerCase() !== "hx-tab-panel");
|
|
232
256
|
s.length > 0 && E(
|
|
233
257
|
"hx-tabs",
|
|
234
|
-
`Default slot expects <hx-tab-panel> elements. Found unexpected: ${s.map((
|
|
258
|
+
`Default slot expects <hx-tab-panel> elements. Found unexpected: ${s.map((r) => `<${r.tagName.toLowerCase()}>`).join(", ")}`
|
|
235
259
|
);
|
|
236
260
|
}
|
|
237
261
|
}
|
|
@@ -255,15 +279,15 @@ let z = 0, b = class extends _ {
|
|
|
255
279
|
`;
|
|
256
280
|
}
|
|
257
281
|
};
|
|
258
|
-
b.styles = [w,
|
|
282
|
+
b.styles = [w, O];
|
|
259
283
|
p([
|
|
260
|
-
|
|
284
|
+
h({ type: String, reflect: !0 })
|
|
261
285
|
], b.prototype, "orientation", 2);
|
|
262
286
|
p([
|
|
263
|
-
|
|
287
|
+
h({ type: String, attribute: "activation", reflect: !0 })
|
|
264
288
|
], b.prototype, "activation", 2);
|
|
265
289
|
p([
|
|
266
|
-
|
|
290
|
+
h({ type: String, reflect: !0 })
|
|
267
291
|
], b.prototype, "label", 2);
|
|
268
292
|
p([
|
|
269
293
|
g()
|
|
@@ -271,7 +295,7 @@ p([
|
|
|
271
295
|
b = p([
|
|
272
296
|
y("hx-tabs")
|
|
273
297
|
], b);
|
|
274
|
-
const
|
|
298
|
+
const z = v`
|
|
275
299
|
:host {
|
|
276
300
|
display: inline-block;
|
|
277
301
|
}
|
|
@@ -345,8 +369,12 @@ const D = x`
|
|
|
345
369
|
|
|
346
370
|
/* ─── Disabled State ─── */
|
|
347
371
|
|
|
348
|
-
|
|
372
|
+
:host([disabled]) {
|
|
349
373
|
cursor: not-allowed;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.tab[aria-disabled='true'] {
|
|
377
|
+
pointer-events: none;
|
|
350
378
|
color: var(--hx-color-neutral-400, #adb5bd);
|
|
351
379
|
}
|
|
352
380
|
|
|
@@ -367,10 +395,10 @@ const D = x`
|
|
|
367
395
|
}
|
|
368
396
|
}
|
|
369
397
|
`;
|
|
370
|
-
var
|
|
371
|
-
for (var s = i > 1 ? void 0 : i ? j(t, a) : t,
|
|
372
|
-
(
|
|
373
|
-
return i && s &&
|
|
398
|
+
var D = Object.defineProperty, j = Object.getOwnPropertyDescriptor, f = (e, t, a, i) => {
|
|
399
|
+
for (var s = i > 1 ? void 0 : i ? j(t, a) : t, r = e.length - 1, n; r >= 0; r--)
|
|
400
|
+
(n = e[r]) && (s = (i ? n(t, a, s) : n(s)) || s);
|
|
401
|
+
return i && s && D(t, a, s), s;
|
|
374
402
|
};
|
|
375
403
|
let c = class extends _ {
|
|
376
404
|
constructor() {
|
|
@@ -410,7 +438,7 @@ let c = class extends _ {
|
|
|
410
438
|
role="tab"
|
|
411
439
|
aria-selected=${this.selected ? "true" : "false"}
|
|
412
440
|
aria-disabled=${this.disabled ? "true" : "false"}
|
|
413
|
-
aria-controls=${this.controls ||
|
|
441
|
+
aria-controls=${this.controls || N}
|
|
414
442
|
tabindex=${this.selected ? "0" : "-1"}
|
|
415
443
|
@click=${this._handleClick}
|
|
416
444
|
>
|
|
@@ -425,18 +453,18 @@ let c = class extends _ {
|
|
|
425
453
|
`;
|
|
426
454
|
}
|
|
427
455
|
};
|
|
428
|
-
c.styles = [w,
|
|
456
|
+
c.styles = [w, z];
|
|
429
457
|
f([
|
|
430
|
-
|
|
458
|
+
h({ type: String, reflect: !0 })
|
|
431
459
|
], c.prototype, "panel", 2);
|
|
432
460
|
f([
|
|
433
|
-
|
|
461
|
+
h({ type: Boolean, reflect: !0 })
|
|
434
462
|
], c.prototype, "selected", 2);
|
|
435
463
|
f([
|
|
436
|
-
|
|
464
|
+
h({ type: Boolean, reflect: !0 })
|
|
437
465
|
], c.prototype, "disabled", 2);
|
|
438
466
|
f([
|
|
439
|
-
|
|
467
|
+
h({ type: String, attribute: !1 })
|
|
440
468
|
], c.prototype, "controls", 2);
|
|
441
469
|
f([
|
|
442
470
|
g()
|
|
@@ -447,7 +475,7 @@ f([
|
|
|
447
475
|
c = f([
|
|
448
476
|
y("hx-tab")
|
|
449
477
|
], c);
|
|
450
|
-
const H =
|
|
478
|
+
const H = v`
|
|
451
479
|
:host {
|
|
452
480
|
display: block;
|
|
453
481
|
}
|
|
@@ -479,12 +507,12 @@ const H = x`
|
|
|
479
507
|
outline: none;
|
|
480
508
|
}
|
|
481
509
|
`;
|
|
482
|
-
var K = Object.defineProperty, R = Object.getOwnPropertyDescriptor,
|
|
483
|
-
for (var s = i > 1 ? void 0 : i ? R(t, a) : t,
|
|
484
|
-
(
|
|
510
|
+
var K = Object.defineProperty, R = Object.getOwnPropertyDescriptor, A = (e, t, a, i) => {
|
|
511
|
+
for (var s = i > 1 ? void 0 : i ? R(t, a) : t, r = e.length - 1, n; r >= 0; r--)
|
|
512
|
+
(n = e[r]) && (s = (i ? n(t, a, s) : n(s)) || s);
|
|
485
513
|
return i && s && K(t, a, s), s;
|
|
486
514
|
};
|
|
487
|
-
let
|
|
515
|
+
let x = class extends _ {
|
|
488
516
|
constructor() {
|
|
489
517
|
super(...arguments), this.name = "";
|
|
490
518
|
}
|
|
@@ -501,16 +529,16 @@ let v = class extends _ {
|
|
|
501
529
|
`;
|
|
502
530
|
}
|
|
503
531
|
};
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
],
|
|
508
|
-
|
|
532
|
+
x.styles = [w, H];
|
|
533
|
+
A([
|
|
534
|
+
h({ type: String, reflect: !0 })
|
|
535
|
+
], x.prototype, "name", 2);
|
|
536
|
+
x = A([
|
|
509
537
|
y("hx-tab-panel")
|
|
510
|
-
],
|
|
538
|
+
], x);
|
|
511
539
|
export {
|
|
512
540
|
c as H,
|
|
513
|
-
|
|
541
|
+
x as a,
|
|
514
542
|
b
|
|
515
543
|
};
|
|
516
|
-
//# sourceMappingURL=hx-tab-panel-
|
|
544
|
+
//# sourceMappingURL=hx-tab-panel-Dnt8aA74.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hx-tab-panel-Dnt8aA74.js","sources":["../../src/components/hx-tabs/hx-tabs.styles.ts","../../src/components/hx-tabs/hx-tabs.ts","../../src/components/hx-tabs/hx-tab.styles.ts","../../src/components/hx-tabs/hx-tab.ts","../../src/components/hx-tabs/hx-tab-panel.styles.ts","../../src/components/hx-tabs/hx-tab-panel.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const helixTabsStyles = css`\n :host {\n display: block;\n font-family: var(--hx-font-family-sans, sans-serif);\n }\n\n * {\n box-sizing: border-box;\n }\n\n /* ─── Container ─── */\n\n .tabs {\n display: flex;\n flex-direction: column;\n gap: var(--hx-tabs-gap, 0);\n }\n\n :host([orientation='vertical']) .tabs {\n flex-direction: row;\n }\n\n /* ─── Tablist ─── */\n\n .tablist {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n gap: 0;\n border-bottom: var(--hx-tabs-border-width, 1px) solid\n var(--hx-tabs-border-color, var(--hx-color-neutral-200, #e9ecef));\n overflow-x: auto;\n scrollbar-width: none;\n }\n\n .tablist::-webkit-scrollbar {\n display: none;\n }\n\n /* ─── Vertical Orientation ─── */\n\n :host([orientation='vertical']) {\n --_tab-indicator-bottom: 0px;\n --_tab-indicator-end: var(--hx-tabs-indicator-size, 2px);\n --_tab-indicator-bottom-color: transparent;\n --_tab-indicator-end-color: var(\n --hx-tabs-indicator-color,\n var(--hx-color-primary-500, #2563eb)\n );\n }\n\n :host([orientation='vertical']) .tablist {\n flex-direction: column;\n border-bottom: none;\n border-inline-end: var(--hx-tabs-border-width, 1px) solid\n var(--hx-tabs-border-color, var(--hx-color-neutral-200, #e9ecef));\n overflow-x: visible;\n overflow-y: auto;\n min-width: var(--hx-tabs-vertical-width, 12rem);\n flex-shrink: 0;\n }\n\n /* ─── Panels Container ─── */\n\n .panels {\n flex: 1 1 auto;\n min-width: 0;\n }\n\n /* ─── Reduced Motion ─── */\n\n @media (prefers-reduced-motion: reduce) {\n .tablist {\n scroll-behavior: auto;\n }\n }\n`;\n","import { LitElement, html, type PropertyValues } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { tokenStyles } from '@helixui/tokens/lit';\nimport { helixTabsStyles } from './hx-tabs.styles.js';\nimport type { HelixTab } from './hx-tab.js';\nimport type { HelixTabPanel } from './hx-tab-panel.js';\nimport { devWarn } from '../../utils/dev-warn.js';\n\n// Module-level counter for stable, SSR-safe IDs (avoids Math.random() hydration mismatch)\nlet _hxTabsIdCounter = 0;\n\n/**\n * A tabbed content organizer that manages a set of `<hx-tab>` and `<hx-tab-panel>` children.\n * Supports horizontal and vertical orientations, automatic and manual activation modes,\n * and full keyboard navigation per the ARIA Authoring Practices Guide.\n *\n * @summary Tab container that organizes content into selectable panels.\n *\n * @tag hx-tabs\n *\n * @slot tab - Slot for `<hx-tab>` elements. Rendered inside the tablist.\n * @slot - Default slot for `<hx-tab-panel>` elements.\n *\n * @fires {CustomEvent<{tabId: string, index: number}>} hx-tab-change - Dispatched when the active tab changes.\n *\n * @csspart tablist - The tablist container element.\n * @csspart panels - The panel content container element.\n *\n * @cssprop [--hx-tabs-border-color=var(--hx-color-neutral-200, #e9ecef)] - Tablist border color.\n * @cssprop [--hx-tabs-border-width=1px] - Tablist border width.\n * @cssprop [--hx-tabs-vertical-width=12rem] - Width of the tablist in vertical orientation.\n * @cssprop [--hx-tabs-gap=0] - Gap between the tablist and panels container.\n * @cssprop [--hx-tabs-tab-color=var(--hx-color-neutral-600, #495057)] - Inactive tab text color.\n * @cssprop [--hx-tabs-tab-active-color=var(--hx-color-primary-600, #1d4ed8)] - Active tab text color.\n * @cssprop [--hx-tabs-tab-hover-color=var(--hx-color-neutral-800, #212529)] - Tab hover text color.\n * @cssprop [--hx-tabs-tab-hover-bg=var(--hx-color-neutral-50, #f8f9fa)] - Tab hover background.\n * @cssprop [--hx-tabs-tab-font-size=var(--hx-font-size-md, 1rem)] - Tab font size.\n * @cssprop [--hx-tabs-tab-font-weight=var(--hx-font-weight-medium, 500)] - Tab font weight.\n * @cssprop [--hx-tabs-tab-active-font-weight=var(--hx-font-weight-semibold, 600)] - Active tab font weight.\n * @cssprop [--hx-tabs-tab-padding-x=var(--hx-space-4, 1rem)] - Horizontal tab padding.\n * @cssprop [--hx-tabs-tab-padding-y=var(--hx-space-2, 0.5rem)] - Vertical tab padding.\n * @cssprop [--hx-tabs-indicator-color=var(--hx-color-primary-500, #2563eb)] - Active indicator color.\n * @cssprop [--hx-tabs-indicator-size=2px] - Active indicator thickness.\n * @cssprop [--hx-tabs-focus-ring-color=var(--hx-focus-ring-color, #2563eb)] - Focus ring color for tabs and panels.\n * @cssprop [--hx-tabs-panel-padding=var(--hx-space-4, 1rem)] - Panel inner padding.\n * @cssprop [--hx-tabs-panel-color=var(--hx-color-neutral-700, #343a40)] - Panel text color.\n */\n@customElement('hx-tabs')\nexport class HelixTabs extends LitElement {\n static override styles = [tokenStyles, helixTabsStyles];\n\n // ─── Internal ID ───\n\n /** @internal */\n private _id = `hx-tabs-${++_hxTabsIdCounter}`;\n\n // ─── Properties ───\n\n /**\n * The layout orientation of the tabs.\n * @attr orientation\n */\n @property({ type: String, reflect: true })\n orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Controls how keyboard navigation activates tabs.\n * In `automatic` mode, focus also activates the tab.\n * In `manual` mode, focus moves independently; Space or Enter activates.\n * @attr activation\n */\n @property({ type: String, attribute: 'activation', reflect: true })\n activation: 'manual' | 'automatic' = 'automatic';\n\n /**\n * Accessible label for the tablist. Rendered as `aria-label` on the tablist container.\n * Provide a brief description of what the tabs represent (e.g., \"Patient record sections\").\n * @attr label\n */\n @property({ type: String, reflect: true })\n label = '';\n\n // ─── State ───\n\n /** @internal */\n @state() private _activePanel = '';\n\n // ─── Child Accessors ───\n\n /** @internal */\n private _cachedTabs: HelixTab[] | null = null;\n /** @internal */\n private _cachedPanels: HelixTabPanel[] | null = null;\n /** @internal */\n private _observer: MutationObserver | null = null;\n /**\n * Stores a requested tab index from the `selected-index` attribute before the component\n * has finished its first update (e.g. server-rendered Drupal pages).\n * @internal\n */\n private _pendingIndex: number | null = null;\n\n // ─── Attribute Observation ───\n\n static override get observedAttributes(): string[] {\n return [...(super.observedAttributes ?? []), 'selected-index'];\n }\n\n override attributeChangedCallback(name: string, old: string | null, value: string | null): void {\n super.attributeChangedCallback(name, old, value);\n if (name === 'selected-index' && value !== null && old !== value) {\n const index = parseInt(value, 10);\n if (!isNaN(index) && index >= 0) {\n if (this.hasUpdated) {\n // Already initialised — apply immediately\n const tab = this._getTabs()[index];\n if (tab && !tab.disabled) {\n this._activateTab(tab, false);\n }\n } else {\n // Store for application in firstUpdated\n this._pendingIndex = index;\n }\n }\n }\n }\n\n // ─── Public API ───\n\n /**\n * Gets or sets the zero-based index of the currently selected tab.\n * Setting this programmatically activates the tab at the given index.\n * Can also be set via the `selected-index` HTML attribute for server-side\n * pre-selection (e.g. Drupal Twig templates).\n */\n get selectedIndex(): number {\n return this._getTabs().findIndex((tab) => tab.panel === this._activePanel);\n }\n\n set selectedIndex(index: number) {\n const tab = this._getTabs()[index];\n if (tab && !tab.disabled) {\n this._activateTab(tab, true);\n }\n }\n\n /** @internal */\n private _getTabs(): HelixTab[] {\n if (!this._cachedTabs) {\n this._cachedTabs = Array.from(this.querySelectorAll(':scope > hx-tab')).filter(\n (el): el is HelixTab => el.tagName.toLowerCase() === 'hx-tab',\n );\n }\n return this._cachedTabs;\n }\n\n /** @internal */\n private _getPanels(): HelixTabPanel[] {\n if (!this._cachedPanels) {\n this._cachedPanels = Array.from(this.querySelectorAll(':scope > hx-tab-panel')).filter(\n (el): el is HelixTabPanel => el.tagName.toLowerCase() === 'hx-tab-panel',\n );\n }\n return this._cachedPanels;\n }\n\n /** @internal */\n private _getEnabledTabs(): HelixTab[] {\n return this._getTabs().filter((tab) => !tab.disabled);\n }\n\n // ─── Lifecycle ───\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('hx-tab-select', this._handleTabSelect);\n this.addEventListener('keydown', this._handleKeydown);\n // Watch for panel/name attribute changes on child tabs and panels\n if (typeof MutationObserver !== 'undefined') {\n this._observer = new MutationObserver(() => {\n this._cachedTabs = null;\n this._cachedPanels = null;\n this._syncTabsAndPanels();\n });\n this._observer.observe(this, {\n subtree: false,\n attributeFilter: ['panel', 'name'],\n });\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('hx-tab-select', this._handleTabSelect);\n this.removeEventListener('keydown', this._handleKeydown);\n this._observer?.disconnect();\n this._observer = null;\n }\n\n override firstUpdated(): void {\n if (this.label === '') {\n devWarn(\n 'hx-tabs',\n 'No accessible label provided. Set the `label` attribute on hx-tabs to describe what the tabs represent (e.g., \"Patient record sections\"). An unlabeled tablist violates WCAG 4.1.2.',\n );\n }\n\n this._syncTabsAndPanels();\n\n // Apply a pending selected-index (set via HTML attribute before upgrade, e.g. Drupal Twig)\n if (this._pendingIndex !== null) {\n const pendingTab = this._getTabs()[this._pendingIndex];\n this._pendingIndex = null;\n if (pendingTab && !pendingTab.disabled) {\n this._activateTab(pendingTab, false);\n return;\n }\n }\n\n // Activate the first enabled tab if none is selected\n if (!this._activePanel) {\n const firstEnabled = this._getEnabledTabs()[0];\n if (firstEnabled) {\n this._activateTab(firstEnabled, false);\n }\n }\n }\n\n override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties);\n if ((changedProperties as Map<PropertyKey, unknown>).has('_activePanel')) {\n this._updateTabsAndPanels();\n }\n }\n\n // ─── Tab / Panel Sync ───\n\n /** @internal */\n private _syncTabsAndPanels(): void {\n const tabs = this._getTabs();\n const panels = this._getPanels();\n\n tabs.forEach((tab, i) => {\n const tabId = tab.id || `hx-tab-${this._id}-${i}`;\n tab.id = tabId;\n\n // Connect tab to its panel by aria-controls\n const panelName = tab.panel;\n const panel = panels.find((p) => p.name === panelName) ?? panels[i];\n if (panel) {\n const panelId = panel.id || `hx-panel-${this._id}-${i}`;\n panel.id = panelId;\n // Set controls on the tab so aria-controls lands on the inner button (role=\"tab\")\n tab.controls = panelId;\n // Use aria-label instead of aria-labelledby to avoid shadow boundary failures.\n // aria-labelledby pointing to hx-tab host IDs fails because the host element's\n // accessible text is inside its shadow DOM (the inner <button>), which AT cannot\n // traverse via aria-labelledby references across shadow roots.\n // Extract only default-slot children (no `slot` attribute) to exclude prefix/suffix\n // slot content (e.g. badge counts) from the panel accessible name (WCAG 1.3.1).\n const tabLabel = Array.from(tab.childNodes)\n .filter(\n (node) =>\n node.nodeType === Node.TEXT_NODE ||\n (node.nodeType === Node.ELEMENT_NODE && !(node as Element).hasAttribute('slot')),\n )\n .map((node) => node.textContent ?? '')\n .join('')\n .trim();\n if (tabLabel) {\n panel.setAttribute('aria-label', tabLabel);\n panel.removeAttribute('aria-labelledby');\n } else {\n // Fall back to aria-labelledby if no text content is yet available;\n // this will be corrected on slotchange once content is assigned.\n panel.setAttribute('aria-labelledby', tabId);\n }\n }\n });\n\n this._updateTabsAndPanels();\n }\n\n /** @internal */\n private _updateTabsAndPanels(): void {\n const tabs = this._getTabs();\n const panels = this._getPanels();\n\n tabs.forEach((tab) => {\n const isSelected = tab.panel === this._activePanel;\n tab.selected = isSelected;\n // Dual tabindex is intentional: the inner button in hx-tab manages its own tabindex\n // via the `selected` property. We also set it on the host element for the roving\n // tabindex pattern so document.activeElement comparisons work correctly when the\n // inner button is focused. This is safe because the inner button is the only\n // focusable element in hx-tab's shadow DOM (WCAG 2.4.3).\n tab.tabIndex = isSelected ? 0 : -1;\n });\n\n panels.forEach((panel) => {\n const isActive = panel.name === this._activePanel;\n if (isActive) {\n panel.removeAttribute('hidden');\n panel.setAttribute('tabindex', '0');\n } else {\n panel.setAttribute('hidden', '');\n panel.setAttribute('tabindex', '-1');\n }\n });\n }\n\n // ─── Tab Activation ───\n\n /** @internal */\n private _activateTab(tab: HelixTab, dispatchEvent = true): void {\n if (tab.disabled) {\n return;\n }\n\n const tabs = this._getTabs();\n const previousPanel = this._activePanel;\n this._activePanel = tab.panel;\n\n if (dispatchEvent && previousPanel !== this._activePanel) {\n const index = tabs.indexOf(tab);\n /**\n * Dispatched when the active tab changes.\n * @event hx-tab-change\n */\n this.dispatchEvent(\n new CustomEvent<{ tabId: string; index: number }>('hx-tab-change', {\n bubbles: true,\n composed: true,\n detail: { tabId: tab.id, index },\n }),\n );\n }\n }\n\n // ─── Event Handling ───\n\n /** @internal */\n private _handleTabSelect = (e: Event): void => {\n if (!(e instanceof CustomEvent)) return;\n e.stopPropagation();\n const tab = e\n .composedPath()\n .find((el): el is HelixTab => el instanceof Element && el.tagName.toLowerCase() === 'hx-tab');\n if (tab) {\n this._activateTab(tab);\n }\n };\n\n /** @internal */\n private _warnInvalidSlotContent(): void {\n const tabSlot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"tab\"]');\n const panelSlot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot:not([name])');\n if (tabSlot) {\n const invalid = tabSlot\n .assignedElements()\n .filter((el) => el.tagName.toLowerCase() !== 'hx-tab');\n if (invalid.length > 0) {\n devWarn(\n 'hx-tabs',\n `Slot \"tab\" expects <hx-tab> elements. Found unexpected: ${invalid.map((el) => `<${el.tagName.toLowerCase()}>`).join(', ')}`,\n );\n }\n }\n if (panelSlot) {\n const invalid = panelSlot\n .assignedElements()\n .filter((el) => el.tagName.toLowerCase() !== 'hx-tab-panel');\n if (invalid.length > 0) {\n devWarn(\n 'hx-tabs',\n `Default slot expects <hx-tab-panel> elements. Found unexpected: ${invalid.map((el) => `<${el.tagName.toLowerCase()}>`).join(', ')}`,\n );\n }\n }\n }\n\n /** @internal */\n private _handleSlotChange = (): void => {\n this._warnInvalidSlotContent();\n this._cachedTabs = null;\n this._cachedPanels = null;\n this._syncTabsAndPanels();\n // If the active panel was removed, fall back to the first enabled tab\n const panels = this._getPanels();\n const activePanelExists = panels.some((p) => p.name === this._activePanel);\n if (!activePanelExists) {\n const firstEnabled = this._getEnabledTabs()[0];\n if (firstEnabled) {\n this._activateTab(firstEnabled, false);\n } else {\n this._activePanel = '';\n }\n }\n };\n\n /** @internal */\n private _handleKeydown = (e: KeyboardEvent): void => {\n // Use ALL tabs (including disabled) so keyboard users can discover disabled tabs\n // per ARIA APG tab pattern — disabled tabs receive focus but are not activated.\n const allTabs = this._getTabs();\n if (allTabs.length === 0) {\n return;\n }\n\n const isHorizontal = this.orientation === 'horizontal';\n const prevKey = isHorizontal ? 'ArrowLeft' : 'ArrowUp';\n const nextKey = isHorizontal ? 'ArrowRight' : 'ArrowDown';\n\n const isNavigationKey = [prevKey, nextKey, 'Home', 'End', ' ', 'Enter'].includes(e.key);\n if (!isNavigationKey) {\n return;\n }\n\n // Determine focused tab — when a button inside shadow DOM is focused,\n // document.activeElement returns the shadow host (hx-tab), not the inner button.\n const focusedTab = allTabs.find((tab) => tab === document.activeElement);\n\n if (e.key === ' ' || e.key === 'Enter') {\n // Only activate if the focused tab is not disabled\n if (focusedTab && !focusedTab.disabled) {\n e.preventDefault();\n this._activateTab(focusedTab);\n focusedTab.shadowRoot?.querySelector('button')?.focus();\n }\n return;\n }\n\n e.preventDefault();\n\n let currentIndex = focusedTab ? allTabs.indexOf(focusedTab) : -1;\n // Fall back to the active tab's index if nothing is focused yet\n if (currentIndex === -1) {\n const activeTab = allTabs.find((tab) => tab.panel === this._activePanel);\n currentIndex = activeTab ? allTabs.indexOf(activeTab) : 0;\n }\n\n let nextIndex: number;\n\n if (e.key === 'Home') {\n nextIndex = 0;\n } else if (e.key === 'End') {\n nextIndex = allTabs.length - 1;\n } else if (e.key === nextKey) {\n nextIndex = (currentIndex + 1) % allTabs.length;\n } else {\n // prevKey\n nextIndex = currentIndex <= 0 ? allTabs.length - 1 : currentIndex - 1;\n }\n\n const targetTab = allTabs[nextIndex];\n if (!targetTab) {\n return;\n }\n\n // Focus the tab button inside the shadow root\n targetTab.shadowRoot?.querySelector('button')?.focus();\n\n // Only activate in automatic mode if the target tab is not disabled\n if (this.activation === 'automatic' && !targetTab.disabled) {\n this._activateTab(targetTab);\n }\n };\n\n // ─── Render ───\n\n override render() {\n return html`\n <div class=\"tabs\">\n <div\n part=\"tablist\"\n class=\"tablist\"\n role=\"tablist\"\n aria-orientation=${this.orientation}\n aria-label=${this.label || 'Tabs'}\n >\n <slot name=\"tab\" @slotchange=${this._handleSlotChange}></slot>\n </div>\n <div part=\"panels\" class=\"panels\">\n <slot @slotchange=${this._handleSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hx-tabs': HelixTabs;\n }\n}\n","import { css } from 'lit';\n\nexport const helixTabStyles = css`\n :host {\n display: inline-block;\n }\n\n :host([disabled]) {\n opacity: var(--hx-opacity-disabled, 0.5);\n }\n\n * {\n box-sizing: border-box;\n }\n\n .tab {\n display: inline-flex;\n align-items: center;\n gap: var(--hx-space-2, 0.5rem);\n padding: var(--hx-tabs-tab-padding-y, var(--hx-space-2, 0.5rem))\n var(--hx-tabs-tab-padding-x, var(--hx-space-4, 1rem));\n border: none;\n border-bottom: var(--_tab-indicator-bottom, var(--hx-tabs-indicator-size, 2px)) solid\n transparent;\n border-inline-end: var(--_tab-indicator-end, 0px) solid transparent;\n background: none;\n font-family: var(--hx-tabs-tab-font-family, var(--hx-font-family-sans, sans-serif));\n font-size: var(--hx-tabs-tab-font-size, var(--hx-font-size-md, 1rem));\n font-weight: var(--hx-tabs-tab-font-weight, var(--hx-font-weight-medium, 500));\n color: var(--hx-tabs-tab-color, var(--hx-color-neutral-600, #495057));\n line-height: var(--hx-line-height-tight, 1.25);\n cursor: pointer;\n white-space: nowrap;\n user-select: none;\n -webkit-user-select: none;\n transition:\n color var(--hx-transition-fast, 150ms ease),\n border-color var(--hx-transition-fast, 150ms ease),\n border-inline-end-color var(--hx-transition-fast, 150ms ease),\n background-color var(--hx-transition-fast, 150ms ease);\n position: relative;\n }\n\n /* ─── Hover State ─── */\n\n .tab:not([aria-selected='true']):not([aria-disabled='true']):hover {\n color: var(--hx-tabs-tab-hover-color, var(--hx-color-neutral-800, #212529));\n background-color: var(--hx-tabs-tab-hover-bg, var(--hx-color-neutral-50, #f8f9fa));\n }\n\n /* ─── Selected State ─── */\n\n .tab[aria-selected='true'] {\n color: var(--hx-tabs-tab-active-color, var(--hx-color-primary-600, #1d4ed8));\n border-bottom-color: var(\n --_tab-indicator-bottom-color,\n var(--hx-tabs-indicator-color, var(--hx-color-primary-500, #2563eb))\n );\n border-inline-end-color: var(--_tab-indicator-end-color, transparent);\n font-weight: var(--hx-tabs-tab-active-font-weight, var(--hx-font-weight-semibold, 600));\n }\n\n /* ─── Focus State ─── */\n\n .tab:focus-visible {\n outline: var(--hx-focus-ring-width, 2px) solid\n var(\n --hx-tabs-focus-ring-color,\n var(--hx-focus-ring-color, var(--hx-color-primary-400, #60a5fa))\n );\n outline-offset: var(--hx-focus-ring-offset, 2px);\n border-radius: var(--hx-border-radius-sm, 0.125rem);\n }\n\n /* ─── Disabled State ─── */\n\n :host([disabled]) {\n cursor: not-allowed;\n }\n\n .tab[aria-disabled='true'] {\n pointer-events: none;\n color: var(--hx-color-neutral-400, #adb5bd);\n }\n\n /* ─── Prefix / Suffix Slots ─── */\n\n .tab__prefix,\n .tab__suffix {\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n /* ─── Reduced Motion ─── */\n\n @media (prefers-reduced-motion: reduce) {\n .tab {\n transition: none;\n }\n }\n`;\n","import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { tokenStyles } from '@helixui/tokens/lit';\nimport { helixTabStyles } from './hx-tab.styles.js';\nimport { devWarn } from '../../utils/dev-warn.js';\n\n/**\n * An individual tab button, designed to be used inside an `<hx-tabs>` container.\n * Must be placed in the `tab` named slot of `<hx-tabs>`.\n *\n * @summary Presentational tab button that activates a corresponding panel.\n *\n * @tag hx-tab\n *\n * @slot - Default slot for the tab label text or content.\n * @slot prefix - Icon or content rendered before the label.\n * @slot suffix - Icon or content rendered after the label.\n *\n * @csspart tab - The underlying button element.\n * @csspart prefix - The container for prefix slot content (e.g. icons).\n * @csspart suffix - The container for suffix slot content (e.g. badges).\n *\n * @cssprop [--hx-tabs-tab-color=var(--hx-color-neutral-600, #495057)] - Inactive tab text color.\n * @cssprop [--hx-tabs-tab-active-color=var(--hx-color-primary-600, #1d4ed8)] - Active tab text color.\n * @cssprop [--hx-tabs-tab-hover-color=var(--hx-color-neutral-800, #212529)] - Tab hover text color.\n * @cssprop [--hx-tabs-tab-hover-bg=var(--hx-color-neutral-50, #f8f9fa)] - Tab hover background.\n * @cssprop [--hx-tabs-tab-font-size=var(--hx-font-size-md, 1rem)] - Tab font size.\n * @cssprop [--hx-tabs-tab-font-weight=var(--hx-font-weight-medium, 500)] - Tab font weight.\n * @cssprop [--hx-tabs-tab-active-font-weight=var(--hx-font-weight-semibold, 600)] - Active tab font weight.\n * @cssprop [--hx-tabs-tab-padding-x=var(--hx-space-4, 1rem)] - Horizontal tab padding.\n * @cssprop [--hx-tabs-tab-padding-y=var(--hx-space-2, 0.5rem)] - Vertical tab padding.\n * @cssprop [--hx-tabs-indicator-color=var(--hx-color-primary-500, #2563eb)] - Active indicator color.\n * @cssprop [--hx-tabs-indicator-size=2px] - Active indicator thickness.\n * @cssprop [--hx-tabs-focus-ring-color=var(--hx-focus-ring-color, #2563eb)] - Focus ring color.\n */\n@customElement('hx-tab')\nexport class HelixTab extends LitElement {\n static override styles = [tokenStyles, helixTabStyles];\n\n // ─── Properties ───\n\n /**\n * The name of the `<hx-tab-panel>` this tab controls. Must match the `name`\n * attribute on the corresponding `<hx-tab-panel>`.\n * @attr panel\n */\n @property({ type: String, reflect: true })\n panel = '';\n\n /**\n * Whether this tab is currently selected. Managed by the parent `<hx-tabs>`.\n * @attr selected\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * Whether this tab is disabled. Prevents selection and keyboard navigation.\n * @attr disabled\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * The id of the panel this tab controls. Set by the parent `<hx-tabs>` to establish the\n * aria-controls relationship on the inner button element (which carries role=\"tab\").\n * @internal\n */\n @property({ type: String, attribute: false })\n controls = '';\n\n // ─── Lifecycle ───\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.closest('hx-tabs')) {\n devWarn('hx-tab', 'hx-tab must be a direct child of hx-tabs to function correctly.');\n }\n }\n\n // ─── Slot Visibility ───\n\n /** @internal */\n @state() private _hasPrefixSlot = false;\n /** @internal */\n @state() private _hasSuffixSlot = false;\n\n // ─── Event Handling ───\n\n /** @internal */\n private _handleClick(): void {\n if (this.disabled) {\n return;\n }\n /**\n * Internal event dispatched to signal tab selection to the parent container.\n * Not part of the public API.\n * @internal\n */\n this.dispatchEvent(\n new CustomEvent<{ panel: string }>('hx-tab-select', {\n bubbles: true,\n composed: true,\n detail: { panel: this.panel },\n }),\n );\n }\n\n /** @internal */\n private _handlePrefixSlotChange(e: Event): void {\n const slot = e.target as HTMLSlotElement;\n this._hasPrefixSlot = slot.assignedNodes({ flatten: true }).length > 0;\n }\n\n /** @internal */\n private _handleSuffixSlotChange(e: Event): void {\n const slot = e.target as HTMLSlotElement;\n this._hasSuffixSlot = slot.assignedNodes({ flatten: true }).length > 0;\n }\n\n // ─── Render ───\n\n override render() {\n return html`\n <button\n part=\"tab\"\n class=\"tab\"\n role=\"tab\"\n aria-selected=${this.selected ? 'true' : 'false'}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n aria-controls=${this.controls || nothing}\n tabindex=${this.selected ? '0' : '-1'}\n @click=${this._handleClick}\n >\n <span part=\"prefix\" class=\"tab__prefix\" ?hidden=${!this._hasPrefixSlot}>\n <slot name=\"prefix\" @slotchange=${this._handlePrefixSlotChange}></slot>\n </span>\n <slot></slot>\n <span part=\"suffix\" class=\"tab__suffix\" ?hidden=${!this._hasSuffixSlot}>\n <slot name=\"suffix\" @slotchange=${this._handleSuffixSlotChange}></slot>\n </span>\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hx-tab': HelixTab;\n }\n}\n","import { css } from 'lit';\n\nexport const helixTabPanelStyles = css`\n :host {\n display: block;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n * {\n box-sizing: border-box;\n }\n\n :host(:focus-visible) {\n outline: var(--hx-focus-ring-width, 2px) solid\n var(\n --hx-tabs-focus-ring-color,\n var(--hx-focus-ring-color, var(--hx-color-primary-400, #60a5fa))\n );\n outline-offset: var(--hx-focus-ring-offset, 2px);\n border-radius: var(--hx-border-radius-sm, 0.125rem);\n }\n\n .panel {\n padding: var(--hx-tabs-panel-padding, var(--hx-space-4, 1rem));\n font-family: var(--hx-font-family-sans, sans-serif);\n font-size: var(--hx-font-size-md, 1rem);\n color: var(--hx-tabs-panel-color, var(--hx-color-neutral-700, #343a40));\n line-height: var(--hx-line-height-normal, 1.5);\n outline: none;\n }\n`;\n","import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { tokenStyles } from '@helixui/tokens/lit';\nimport { helixTabPanelStyles } from './hx-tab-panel.styles.js';\n\n/**\n * A content panel associated with an `<hx-tab>`, managed by a parent `<hx-tabs>`.\n *\n * @summary Tab content panel shown when its corresponding tab is selected.\n *\n * @tag hx-tab-panel\n *\n * @slot - Default slot for panel content.\n *\n * @csspart panel - The panel content wrapper.\n *\n * @cssprop [--hx-tabs-panel-padding=var(--hx-space-4, 1rem)] - Panel inner padding.\n * @cssprop [--hx-tabs-panel-color=var(--hx-color-neutral-700, #343a40)] - Panel text color.\n * @cssprop [--hx-tabs-focus-ring-color=var(--hx-focus-ring-color, #2563eb)] - Focus ring color.\n */\n@customElement('hx-tab-panel')\nexport class HelixTabPanel extends LitElement {\n static override styles = [tokenStyles, helixTabPanelStyles];\n\n // ─── Properties ───\n\n /**\n * The name that corresponds to the `panel` attribute on the associated `<hx-tab>`.\n * @attr name\n */\n @property({ type: String, reflect: true })\n name = '';\n\n // ─── Lifecycle ───\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute('role', 'tabpanel');\n // tabindex is managed dynamically by the parent hx-tabs component:\n // active panels get tabindex=\"0\", hidden panels get tabindex=\"-1\"\n }\n\n // ─── Render ───\n\n override render() {\n return html`\n <div part=\"panel\" class=\"panel\">\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hx-tab-panel': HelixTabPanel;\n }\n}\n"],"names":["helixTabsStyles","css","_hxTabsIdCounter","HelixTabs","LitElement","tab","el","p","firstEnabled","allTabs","isHorizontal","prevKey","nextKey","focusedTab","_b","_a","currentIndex","activeTab","nextIndex","targetTab","_d","_c","name","old","value","index","pendingTab","changedProperties","tabs","panels","tabId","panelName","panel","panelId","tabLabel","node","isSelected","dispatchEvent","previousPanel","tabSlot","panelSlot","invalid","devWarn","html","tokenStyles","__decorateClass","property","state","customElement","helixTabStyles","HelixTab","slot","nothing","helixTabPanelStyles","HelixTabPanel"],"mappings":";;;;AAEO,MAAMA,IAAkBC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;ACO/B,IAAIC,IAAmB,GAuCVC,IAAN,cAAwBC,EAAW;AAAA,EAAnC,cAAA;AAAA,UAAA,GAAA,SAAA,GAML,KAAQ,MAAM,WAAW,EAAEF,CAAgB,IAS3C,KAAA,cAAyC,cASzC,KAAA,aAAqC,aAQrC,KAAA,QAAQ,IAKC,KAAQ,eAAe,IAKhC,KAAQ,cAAiC,MAEzC,KAAQ,gBAAwC,MAEhD,KAAQ,YAAqC,MAM7C,KAAQ,gBAA+B,MAkPvC,KAAQ,mBAAmB,CAAC,MAAmB;AAC7C,UAAI,EAAE,aAAa,aAAc;AACjC,QAAE,gBAAA;AACF,YAAMG,IAAM,EACT,aAAA,EACA,KAAK,CAACC,MAAuBA,aAAc,WAAWA,EAAG,QAAQ,YAAA,MAAkB,QAAQ;AAC9F,MAAID,KACF,KAAK,aAAaA,CAAG;AAAA,IAEzB,GA+BA,KAAQ,oBAAoB,MAAY;A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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;ACmB5B,IAAMqD,IAAN,cAA4BlD,EAAW;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA,GAUL,KAAA,OAAO;AAAA,EAAA;AAAA;AAAA,EAIE,oBAA0B;AACjC,UAAM,kBAAA,GACN,KAAK,aAAa,QAAQ,UAAU;AAAA,EAGtC;AAAA;AAAA,EAIS,SAAS;AAChB,WAAOuC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKT;AACF;AA9BaW,EACK,SAAS,CAACV,GAAaS,CAAmB;AAS1DR,EAAA;AAAA,EADCC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAT9BQ,EAUX,WAAA,QAAA,CAAA;AAVWA,IAANT,EAAA;AAAA,EADNG,EAAc,cAAc;AAAA,GAChBM,CAAA;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { css as b, LitElement as _, nothing as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as b, LitElement as _, nothing as p, html as x } from "lit";
|
|
2
|
+
import { property as m, state as c, customElement as g, query as w } from "lit/decorators.js";
|
|
3
3
|
import { tokenStyles as y } from "@helixui/tokens/lit";
|
|
4
4
|
import { classMap as I } from "lit/directives/class-map.js";
|
|
5
5
|
const C = b`
|
|
@@ -25,10 +25,10 @@ const C = b`
|
|
|
25
25
|
border-radius: var(--hx-border-radius-sm, 0.25rem);
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
|
-
var
|
|
29
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
28
|
+
var k = Object.defineProperty, S = Object.getOwnPropertyDescriptor, f = (e, t, i, s) => {
|
|
29
|
+
for (var r = s > 1 ? void 0 : s ? S(t, i) : t, n = e.length - 1, o; n >= 0; n--)
|
|
30
30
|
(o = e[n]) && (r = (s ? o(t, i, r) : o(r)) || r);
|
|
31
|
-
return s && r &&
|
|
31
|
+
return s && r && k(t, i, r), r;
|
|
32
32
|
};
|
|
33
33
|
let d = class extends _ {
|
|
34
34
|
constructor() {
|
|
@@ -160,8 +160,31 @@ let d = class extends _ {
|
|
|
160
160
|
e.preventDefault(), this._focusItem(t.length - 1);
|
|
161
161
|
break;
|
|
162
162
|
}
|
|
163
|
+
default: {
|
|
164
|
+
if (e.key.length === 1) {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
const a = this._findTypeaheadMatch(e.key.toLowerCase(), i);
|
|
167
|
+
a !== -1 && this._focusItem(a);
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
163
171
|
}
|
|
164
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Finds the next visible item (starting after `currentIndex`, wrapping around) whose
|
|
175
|
+
* label text begins with the given lowercase character. Returns -1 if no match.
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
_findTypeaheadMatch(e, t) {
|
|
179
|
+
const i = this._getVisibleItems();
|
|
180
|
+
if (i.length === 0) return -1;
|
|
181
|
+
for (let s = 1; s <= i.length; s++) {
|
|
182
|
+
const r = (t + s) % i.length, n = i[r];
|
|
183
|
+
if (n && n.labelText.toLowerCase().startsWith(e))
|
|
184
|
+
return r;
|
|
185
|
+
}
|
|
186
|
+
return -1;
|
|
187
|
+
}
|
|
165
188
|
/** @internal */
|
|
166
189
|
_handleFocusIn(e) {
|
|
167
190
|
e.target === e.currentTarget && this._getVisibleItems().length > 0 && this._focusItem(this._currentIndex);
|
|
@@ -209,7 +232,7 @@ let d = class extends _ {
|
|
|
209
232
|
role="tree"
|
|
210
233
|
tabindex=${e}
|
|
211
234
|
aria-label=${this.label || "Tree"}
|
|
212
|
-
aria-multiselectable=${this.selection === "none" ?
|
|
235
|
+
aria-multiselectable=${this.selection === "none" ? p : this.selection === "multiple" ? "true" : "false"}
|
|
213
236
|
@hx-tree-item-select=${this._handleTreeItemSelect}
|
|
214
237
|
@keydown=${this._handleKeyDown}
|
|
215
238
|
@focusin=${this._handleFocusIn}
|
|
@@ -220,19 +243,19 @@ let d = class extends _ {
|
|
|
220
243
|
}
|
|
221
244
|
};
|
|
222
245
|
d.styles = [y, C];
|
|
223
|
-
|
|
224
|
-
|
|
246
|
+
f([
|
|
247
|
+
m({ type: String, reflect: !0 })
|
|
225
248
|
], d.prototype, "label", 2);
|
|
226
|
-
|
|
227
|
-
|
|
249
|
+
f([
|
|
250
|
+
m({ type: String, reflect: !0 })
|
|
228
251
|
], d.prototype, "selection", 2);
|
|
229
|
-
|
|
252
|
+
f([
|
|
230
253
|
c()
|
|
231
254
|
], d.prototype, "_currentIndex", 2);
|
|
232
|
-
|
|
255
|
+
f([
|
|
233
256
|
c()
|
|
234
257
|
], d.prototype, "_hasVisibleItems", 2);
|
|
235
|
-
d =
|
|
258
|
+
d = f([
|
|
236
259
|
g("hx-tree-view")
|
|
237
260
|
], d);
|
|
238
261
|
const E = b`
|
|
@@ -430,6 +453,13 @@ let l = class extends _ {
|
|
|
430
453
|
get hasChildItems() {
|
|
431
454
|
return this._hasChildren;
|
|
432
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* The text content of the item's label slot, used for typeahead keyboard navigation.
|
|
458
|
+
* Returns an empty string until the label slot has been assigned.
|
|
459
|
+
*/
|
|
460
|
+
get labelText() {
|
|
461
|
+
return this._labelText;
|
|
462
|
+
}
|
|
433
463
|
/**
|
|
434
464
|
* Recompute all cached ARIA metadata in a single DOM pass.
|
|
435
465
|
* Called on connect, slotchange, and whenever structural context may change.
|
|
@@ -561,7 +591,7 @@ let l = class extends _ {
|
|
|
561
591
|
` : x`<span class="expand-placeholder" aria-hidden="true"></span>`;
|
|
562
592
|
}
|
|
563
593
|
render() {
|
|
564
|
-
const e = this._hasChildren ? String(this.expanded) :
|
|
594
|
+
const e = this._hasChildren ? String(this.expanded) : p, t = this._selectable ? String(this.selected) : p;
|
|
565
595
|
return x`
|
|
566
596
|
<div part="item" class="item">
|
|
567
597
|
<div
|
|
@@ -571,7 +601,7 @@ let l = class extends _ {
|
|
|
571
601
|
tabindex=${this._rovingActive ? "0" : "-1"}
|
|
572
602
|
aria-expanded=${e}
|
|
573
603
|
aria-selected=${t}
|
|
574
|
-
aria-disabled=${this.disabled ? "true" :
|
|
604
|
+
aria-disabled=${this.disabled ? "true" : p}
|
|
575
605
|
aria-level=${this._level}
|
|
576
606
|
aria-posinset=${this._posInSet}
|
|
577
607
|
aria-setsize=${this._setSize}
|
|
@@ -591,6 +621,7 @@ let l = class extends _ {
|
|
|
591
621
|
class=${I({ children: !0, "children--expanded": this.expanded })}
|
|
592
622
|
role="group"
|
|
593
623
|
aria-label=${this._labelText ? `${this._labelText} children` : "children"}
|
|
624
|
+
aria-hidden=${!this.expanded || p}
|
|
594
625
|
>
|
|
595
626
|
<div class="children-inner">
|
|
596
627
|
<slot name="children" @slotchange=${this._handleChildrenSlotChange}></slot>
|
|
@@ -602,13 +633,13 @@ let l = class extends _ {
|
|
|
602
633
|
};
|
|
603
634
|
l.styles = [y, E];
|
|
604
635
|
h([
|
|
605
|
-
|
|
636
|
+
m({ type: Boolean, reflect: !0 })
|
|
606
637
|
], l.prototype, "expanded", 2);
|
|
607
638
|
h([
|
|
608
|
-
|
|
639
|
+
m({ type: Boolean, reflect: !0 })
|
|
609
640
|
], l.prototype, "selected", 2);
|
|
610
641
|
h([
|
|
611
|
-
|
|
642
|
+
m({ type: Boolean, reflect: !0 })
|
|
612
643
|
], l.prototype, "disabled", 2);
|
|
613
644
|
h([
|
|
614
645
|
c()
|
|
@@ -641,4 +672,4 @@ export {
|
|
|
641
672
|
l as H,
|
|
642
673
|
d as a
|
|
643
674
|
};
|
|
644
|
-
//# sourceMappingURL=hx-tree-item-
|
|
675
|
+
//# sourceMappingURL=hx-tree-item-C1PhX-HE.js.map
|