@compa11y/web 0.1.6 → 0.1.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/dist/compa11y.iife.js +303 -73
- package/dist/compa11y.js +519 -175
- package/dist/components/alert.d.ts +23 -0
- package/dist/components/skip-link.d.ts +11 -0
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/visually-hidden.d.ts +9 -0
- package/dist/index.d.ts +4 -1
- package/package.json +2 -2
package/dist/compa11y.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { generateId as
|
|
2
|
-
import { KeyboardPatterns as
|
|
3
|
-
class
|
|
1
|
+
import { generateId as dt, announce as v, announcePolite as p, createTypeAhead as q, announceAssertive as O, createComponentWarnings as N, prefersDarkMode as ct, prefersHighContrast as ut, prefersReducedMotion as bt, isBrowser as pt, hasAccessibleName as mt, buildAriaProps as gt, aria as vt, KeyboardPatterns as ft, createKeyboardManager as _t, createRovingTabindex as yt, createFocusScope as xt, createFocusTrap as Et, initFocusVisible as H, announceError as At, announceStatus as kt, initAnnouncer as B } from "@compa11y/core";
|
|
2
|
+
import { KeyboardPatterns as Zt, announce as te, announceAssertive as ee, announceError as ie, announcePolite as se, announceStatus as ae, aria as re, buildAriaProps as oe, createFocusScope as le, createFocusTrap as ne, createKeyboardManager as he, createRovingTabindex as de, createTypeAhead as ce, hasAccessibleName as ue, initAnnouncer as be, initFocusVisible as pe, isBrowser as me, prefersDarkMode as ge, prefersHighContrast as ve, prefersReducedMotion as fe } from "@compa11y/core";
|
|
3
|
+
class h extends HTMLElement {
|
|
4
4
|
constructor() {
|
|
5
|
-
super(), this._internals = null, this._id =
|
|
5
|
+
super(), this._internals = null, this._id = dt(this.tagName.toLowerCase().replace("a11y-", "")), "attachInternals" in this && (this._internals = this.attachInternals());
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Standard observed attributes
|
|
@@ -74,10 +74,20 @@ class d extends HTMLElement {
|
|
|
74
74
|
return (i == null ? void 0 : i.assignedElements()) ?? [];
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function d(n, t) {
|
|
78
78
|
customElements.get(n) || customElements.define(n, t);
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const F = `
|
|
81
|
+
position: absolute;
|
|
82
|
+
width: 1px;
|
|
83
|
+
height: 1px;
|
|
84
|
+
padding: 0;
|
|
85
|
+
margin: -1px;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
clip: rect(0, 0, 0, 0);
|
|
88
|
+
white-space: nowrap;
|
|
89
|
+
border: 0;
|
|
90
|
+
`, T = `
|
|
81
91
|
appearance: none;
|
|
82
92
|
background: none;
|
|
83
93
|
border: none;
|
|
@@ -86,7 +96,7 @@ const T = `
|
|
|
86
96
|
font: inherit;
|
|
87
97
|
color: inherit;
|
|
88
98
|
cursor: pointer;
|
|
89
|
-
`,
|
|
99
|
+
`, wt = `
|
|
90
100
|
:host(:focus-visible),
|
|
91
101
|
:focus-visible {
|
|
92
102
|
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
@@ -108,8 +118,8 @@ const T = `
|
|
|
108
118
|
box-sizing: inherit;
|
|
109
119
|
}
|
|
110
120
|
|
|
111
|
-
${
|
|
112
|
-
`,
|
|
121
|
+
${wt}
|
|
122
|
+
`, $t = `
|
|
113
123
|
${u}
|
|
114
124
|
|
|
115
125
|
:host {
|
|
@@ -148,7 +158,7 @@ const T = `
|
|
|
148
158
|
margin: 0 0 1rem 0;
|
|
149
159
|
color: var(--compa11y-dialog-description-color, #666);
|
|
150
160
|
}
|
|
151
|
-
`,
|
|
161
|
+
`, Lt = `
|
|
152
162
|
${u}
|
|
153
163
|
|
|
154
164
|
:host {
|
|
@@ -200,7 +210,7 @@ const T = `
|
|
|
200
210
|
margin: 0.25rem 0;
|
|
201
211
|
background: var(--compa11y-menu-separator-color, #e0e0e0);
|
|
202
212
|
}
|
|
203
|
-
`,
|
|
213
|
+
`, St = `
|
|
204
214
|
${u}
|
|
205
215
|
|
|
206
216
|
.tablist {
|
|
@@ -246,7 +256,7 @@ const T = `
|
|
|
246
256
|
::slotted([role="tabpanel"][hidden]) {
|
|
247
257
|
display: none;
|
|
248
258
|
}
|
|
249
|
-
`,
|
|
259
|
+
`, It = `
|
|
250
260
|
${u}
|
|
251
261
|
|
|
252
262
|
:host {
|
|
@@ -387,7 +397,7 @@ const T = `
|
|
|
387
397
|
.options-source {
|
|
388
398
|
display: none;
|
|
389
399
|
}
|
|
390
|
-
`,
|
|
400
|
+
`, Ct = `
|
|
391
401
|
${u}
|
|
392
402
|
|
|
393
403
|
:host {
|
|
@@ -517,7 +527,7 @@ const T = `
|
|
|
517
527
|
.options-source {
|
|
518
528
|
display: none;
|
|
519
529
|
}
|
|
520
|
-
`,
|
|
530
|
+
`, Tt = `
|
|
521
531
|
${u}
|
|
522
532
|
|
|
523
533
|
:host {
|
|
@@ -621,7 +631,7 @@ const T = `
|
|
|
621
631
|
opacity: 0.5;
|
|
622
632
|
cursor: not-allowed;
|
|
623
633
|
}
|
|
624
|
-
`,
|
|
634
|
+
`, zt = `
|
|
625
635
|
${u}
|
|
626
636
|
|
|
627
637
|
:host {
|
|
@@ -700,7 +710,7 @@ const T = `
|
|
|
700
710
|
color: var(--compa11y-input-error-color, #ef4444);
|
|
701
711
|
font-size: var(--compa11y-input-error-size, 0.8125rem);
|
|
702
712
|
}
|
|
703
|
-
`,
|
|
713
|
+
`, Dt = `
|
|
704
714
|
${u}
|
|
705
715
|
|
|
706
716
|
:host {
|
|
@@ -781,7 +791,7 @@ const T = `
|
|
|
781
791
|
color: var(--compa11y-textarea-error-color, #ef4444);
|
|
782
792
|
font-size: var(--compa11y-textarea-error-size, 0.8125rem);
|
|
783
793
|
}
|
|
784
|
-
`,
|
|
794
|
+
`, qt = `
|
|
785
795
|
${u}
|
|
786
796
|
|
|
787
797
|
:host {
|
|
@@ -896,7 +906,7 @@ const T = `
|
|
|
896
906
|
border-radius: 50%;
|
|
897
907
|
animation: compa11y-spin 0.6s linear infinite;
|
|
898
908
|
}
|
|
899
|
-
`,
|
|
909
|
+
`, Ot = `
|
|
900
910
|
${u}
|
|
901
911
|
|
|
902
912
|
:host {
|
|
@@ -930,7 +940,7 @@ const T = `
|
|
|
930
940
|
max-height: none;
|
|
931
941
|
overflow-y: visible;
|
|
932
942
|
}
|
|
933
|
-
`,
|
|
943
|
+
`, Rt = `
|
|
934
944
|
${u}
|
|
935
945
|
|
|
936
946
|
:host {
|
|
@@ -979,7 +989,7 @@ const T = `
|
|
|
979
989
|
:host([aria-selected="true"]) .check-mark {
|
|
980
990
|
visibility: visible;
|
|
981
991
|
}
|
|
982
|
-
`,
|
|
992
|
+
`, Ht = `
|
|
983
993
|
${u}
|
|
984
994
|
|
|
985
995
|
:host {
|
|
@@ -998,7 +1008,7 @@ const T = `
|
|
|
998
1008
|
:host([disabled]) {
|
|
999
1009
|
opacity: 0.5;
|
|
1000
1010
|
}
|
|
1001
|
-
`,
|
|
1011
|
+
`, Bt = `
|
|
1002
1012
|
${u}
|
|
1003
1013
|
|
|
1004
1014
|
:host {
|
|
@@ -1161,7 +1171,7 @@ const T = `
|
|
|
1161
1171
|
color: HighlightText;
|
|
1162
1172
|
}
|
|
1163
1173
|
}
|
|
1164
|
-
`,
|
|
1174
|
+
`, Mt = `
|
|
1165
1175
|
${u}
|
|
1166
1176
|
|
|
1167
1177
|
:host {
|
|
@@ -1203,7 +1213,7 @@ const T = `
|
|
|
1203
1213
|
:host([disabled]) {
|
|
1204
1214
|
opacity: 0.5;
|
|
1205
1215
|
}
|
|
1206
|
-
`,
|
|
1216
|
+
`, Kt = `
|
|
1207
1217
|
${u}
|
|
1208
1218
|
|
|
1209
1219
|
:host {
|
|
@@ -1256,7 +1266,7 @@ const T = `
|
|
|
1256
1266
|
:host([disabled]) {
|
|
1257
1267
|
opacity: 0.5;
|
|
1258
1268
|
}
|
|
1259
|
-
`,
|
|
1269
|
+
`, Nt = `
|
|
1260
1270
|
${u}
|
|
1261
1271
|
|
|
1262
1272
|
:host {
|
|
@@ -1376,7 +1386,7 @@ const T = `
|
|
|
1376
1386
|
background: HighlightText;
|
|
1377
1387
|
}
|
|
1378
1388
|
}
|
|
1379
|
-
`,
|
|
1389
|
+
`, Ft = `
|
|
1380
1390
|
${u}
|
|
1381
1391
|
|
|
1382
1392
|
:host {
|
|
@@ -1486,14 +1496,14 @@ const T = `
|
|
|
1486
1496
|
outline-offset: 2px;
|
|
1487
1497
|
}
|
|
1488
1498
|
`, M = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1489
|
-
let L = 0,
|
|
1490
|
-
function
|
|
1491
|
-
L === 0 && (
|
|
1499
|
+
let L = 0, P = "";
|
|
1500
|
+
function Pt() {
|
|
1501
|
+
L === 0 && (P = document.body.style.overflow, document.body.style.overflow = "hidden"), L++;
|
|
1492
1502
|
}
|
|
1493
|
-
function
|
|
1494
|
-
L--, L <= 0 && (L = 0, document.body.style.overflow =
|
|
1503
|
+
function jt() {
|
|
1504
|
+
L--, L <= 0 && (L = 0, document.body.style.overflow = P);
|
|
1495
1505
|
}
|
|
1496
|
-
class
|
|
1506
|
+
class j extends h {
|
|
1497
1507
|
constructor() {
|
|
1498
1508
|
super(...arguments), this._open = !1, this._previouslyFocused = null, this._triggerElement = null, this.handleTriggerClick = () => {
|
|
1499
1509
|
this.open = !0;
|
|
@@ -1538,7 +1548,7 @@ class N extends d {
|
|
|
1538
1548
|
render() {
|
|
1539
1549
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-title`, i = `${this._id}-desc`;
|
|
1540
1550
|
t.innerHTML = `
|
|
1541
|
-
<style>${
|
|
1551
|
+
<style>${$t}</style>
|
|
1542
1552
|
<div class="overlay" part="overlay"></div>
|
|
1543
1553
|
<div
|
|
1544
1554
|
class="dialog"
|
|
@@ -1602,11 +1612,11 @@ class N extends d {
|
|
|
1602
1612
|
this._previouslyFocused = document.activeElement, this.style.display = "flex", requestAnimationFrame(() => {
|
|
1603
1613
|
const e = this.getFocusableElements()[0];
|
|
1604
1614
|
e && e.focus();
|
|
1605
|
-
}),
|
|
1615
|
+
}), Pt(), v("Dialog opened", { politeness: "polite" }), this.emit("a11y-dialog-open");
|
|
1606
1616
|
}
|
|
1607
1617
|
hideDialog() {
|
|
1608
1618
|
var t;
|
|
1609
|
-
this.style.display = "none",
|
|
1619
|
+
this.style.display = "none", jt(), (t = this._previouslyFocused) == null || t.focus(), this._previouslyFocused = null, v("Dialog closed", { politeness: "polite" }), this.emit("a11y-dialog-close");
|
|
1610
1620
|
}
|
|
1611
1621
|
/**
|
|
1612
1622
|
* Programmatic open
|
|
@@ -1621,8 +1631,8 @@ class N extends d {
|
|
|
1621
1631
|
this.open = !1;
|
|
1622
1632
|
}
|
|
1623
1633
|
}
|
|
1624
|
-
|
|
1625
|
-
class
|
|
1634
|
+
d("a11y-dialog", j);
|
|
1635
|
+
class Y extends h {
|
|
1626
1636
|
constructor() {
|
|
1627
1637
|
super(...arguments), this._open = !1, this._highlightedIndex = -1, this._menuItems = [], this._triggerEl = null, this._triggerSlotEl = null, this._defaultSlotEl = null, this.updateMenuItems = () => {
|
|
1628
1638
|
this._menuItems = Array.from(
|
|
@@ -1712,7 +1722,7 @@ class F extends d {
|
|
|
1712
1722
|
render() {
|
|
1713
1723
|
const t = this.attachShadow({ mode: "open" });
|
|
1714
1724
|
t.innerHTML = `
|
|
1715
|
-
<style>${
|
|
1725
|
+
<style>${Lt}</style>
|
|
1716
1726
|
<slot name="trigger"></slot>
|
|
1717
1727
|
<div
|
|
1718
1728
|
class="menu-content"
|
|
@@ -1787,8 +1797,8 @@ class F extends d {
|
|
|
1787
1797
|
this.open = !this._open;
|
|
1788
1798
|
}
|
|
1789
1799
|
}
|
|
1790
|
-
|
|
1791
|
-
class
|
|
1800
|
+
d("a11y-menu", Y);
|
|
1801
|
+
class U extends h {
|
|
1792
1802
|
constructor() {
|
|
1793
1803
|
super(...arguments), this._tabs = [], this._panels = [], this._selectedIndex = 0, this._focusedIndex = 0, this._tabSlotEl = null, this._panelSlotEl = null, this._defaultSlotEl = null, this.updateTabsAndPanels = () => {
|
|
1794
1804
|
this._tabs = Array.from(
|
|
@@ -1854,7 +1864,7 @@ class P extends d {
|
|
|
1854
1864
|
render() {
|
|
1855
1865
|
const t = this.attachShadow({ mode: "open" });
|
|
1856
1866
|
t.innerHTML = `
|
|
1857
|
-
<style>${
|
|
1867
|
+
<style>${St}</style>
|
|
1858
1868
|
<div class="tablist" role="tablist" aria-orientation="${this.orientation}" part="tablist">
|
|
1859
1869
|
<slot name="tab"></slot>
|
|
1860
1870
|
</div>
|
|
@@ -1920,8 +1930,8 @@ class P extends d {
|
|
|
1920
1930
|
);
|
|
1921
1931
|
}
|
|
1922
1932
|
}
|
|
1923
|
-
|
|
1924
|
-
class
|
|
1933
|
+
d("a11y-tabs", U);
|
|
1934
|
+
class V extends h {
|
|
1925
1935
|
constructor() {
|
|
1926
1936
|
super(...arguments), this._open = !1, this._highlightedIndex = -1, this._options = [], this._filteredOptions = [], this._inputValue = "", this._selectedValue = null, this._inputElement = null, this._listboxElement = null, this.updateOptions = () => {
|
|
1927
1937
|
const t = Array.from(this.querySelectorAll("option"));
|
|
@@ -2013,7 +2023,7 @@ class j extends d {
|
|
|
2013
2023
|
render() {
|
|
2014
2024
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-input`, i = `${this._id}-listbox`, s = this.getAttribute("placeholder") || "Search...", a = this.hasAttribute("clearable");
|
|
2015
2025
|
t.innerHTML = `
|
|
2016
|
-
<style>${
|
|
2026
|
+
<style>${It}</style>
|
|
2017
2027
|
<div class="combobox-wrapper" part="wrapper">
|
|
2018
2028
|
<div class="input-wrapper" part="input-wrapper">
|
|
2019
2029
|
<input
|
|
@@ -2146,8 +2156,8 @@ class j extends d {
|
|
|
2146
2156
|
this.handleClear();
|
|
2147
2157
|
}
|
|
2148
2158
|
}
|
|
2149
|
-
|
|
2150
|
-
class
|
|
2159
|
+
d("a11y-combobox", V);
|
|
2160
|
+
class G extends h {
|
|
2151
2161
|
constructor() {
|
|
2152
2162
|
super(...arguments), this._checked = !1, this._button = null, this._label = null, this.handleClick = () => {
|
|
2153
2163
|
this.toggle();
|
|
@@ -2209,7 +2219,7 @@ class U extends d {
|
|
|
2209
2219
|
render() {
|
|
2210
2220
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-label`, i = !!this.label, s = this.getAttribute("aria-label"), a = i ? "" : s ? `aria-label="${s}"` : "", r = i ? `aria-labelledby="${e}"` : "";
|
|
2211
2221
|
t.innerHTML = `
|
|
2212
|
-
<style>${
|
|
2222
|
+
<style>${Tt}</style>
|
|
2213
2223
|
<div class="switch-wrapper size-${this.size}" part="wrapper">
|
|
2214
2224
|
<button
|
|
2215
2225
|
type="button"
|
|
@@ -2289,8 +2299,8 @@ class U extends d {
|
|
|
2289
2299
|
this.checked = t;
|
|
2290
2300
|
}
|
|
2291
2301
|
}
|
|
2292
|
-
|
|
2293
|
-
class
|
|
2302
|
+
d("a11y-switch", G);
|
|
2303
|
+
class X extends h {
|
|
2294
2304
|
constructor() {
|
|
2295
2305
|
super(...arguments), this._open = !1, this._highlightedIndex = -1, this._options = [], this._selectedValue = null, this._triggerElement = null, this._listboxElement = null, this._typeAhead = null, this.updateOptions = () => {
|
|
2296
2306
|
const t = Array.from(this.querySelectorAll("option"));
|
|
@@ -2390,7 +2400,7 @@ class Y extends d {
|
|
|
2390
2400
|
render() {
|
|
2391
2401
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-trigger`, i = `${this._id}-listbox`, s = this.getAttribute("placeholder") || "Select an option...", a = this.getAttribute("aria-label") || "", r = this.getAttribute("aria-labelledby") || "";
|
|
2392
2402
|
t.innerHTML = `
|
|
2393
|
-
<style>${
|
|
2403
|
+
<style>${Ct}</style>
|
|
2394
2404
|
<div class="select-wrapper" part="wrapper">
|
|
2395
2405
|
<button
|
|
2396
2406
|
id="${e}"
|
|
@@ -2541,8 +2551,8 @@ class Y extends d {
|
|
|
2541
2551
|
this.open = !1;
|
|
2542
2552
|
}
|
|
2543
2553
|
}
|
|
2544
|
-
|
|
2545
|
-
class
|
|
2554
|
+
d("a11y-select", X);
|
|
2555
|
+
class W extends h {
|
|
2546
2556
|
constructor() {
|
|
2547
2557
|
super(...arguments), this._value = "", this._inputEl = null, this._labelEl = null, this._hintEl = null, this._errorEl = null, this.handleInput = (t) => {
|
|
2548
2558
|
const e = t.target;
|
|
@@ -2622,11 +2632,11 @@ class G extends d {
|
|
|
2622
2632
|
));
|
|
2623
2633
|
}
|
|
2624
2634
|
render() {
|
|
2625
|
-
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-field`, i = `${this._id}-label`, s = `${this._id}-hint`, a = `${this._id}-error`, r = this.getAttribute("label") || "", l = this.getAttribute("hint") || "", o = this.getAttribute("error") || "", b = this.getAttribute("type") || "text",
|
|
2635
|
+
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-field`, i = `${this._id}-label`, s = `${this._id}-hint`, a = `${this._id}-error`, r = this.getAttribute("label") || "", l = this.getAttribute("hint") || "", o = this.getAttribute("error") || "", b = this.getAttribute("type") || "text", c = this.getAttribute("placeholder") || "", m = this.getAttribute("name") || "", g = this.getAttribute("autocomplete") || "", f = this.getAttribute("maxlength"), _ = this.getAttribute("minlength"), k = this.getAttribute("pattern"), w = this.getAttribute("inputmode"), S = this.getAttribute("aria-label") || "", I = this.getAttribute("aria-labelledby") || "", C = this.disabled, x = this.readOnly, y = this.required, E = !!o, A = [];
|
|
2626
2636
|
l && A.push(s), E && A.push(a);
|
|
2627
|
-
const z = A.length ? `aria-describedby="${A.join(" ")}"` : "", $ = !r && S ? `aria-label="${S}"` : "",
|
|
2637
|
+
const z = A.length ? `aria-describedby="${A.join(" ")}"` : "", $ = !r && S ? `aria-label="${S}"` : "", ht = !r && I ? `aria-labelledby="${I}"` : r ? `aria-labelledby="${i}"` : "";
|
|
2628
2638
|
this.setAttribute("data-error", E ? "true" : "false"), t.innerHTML = `
|
|
2629
|
-
<style>${
|
|
2639
|
+
<style>${zt}</style>
|
|
2630
2640
|
<div class="input-wrapper" part="wrapper">
|
|
2631
2641
|
${r ? `<label id="${i}" for="${e}" class="input-label" part="label">
|
|
2632
2642
|
${r}${y ? '<span class="input-required" aria-hidden="true" part="required">*</span>' : ""}
|
|
@@ -2635,7 +2645,7 @@ class G extends d {
|
|
|
2635
2645
|
id="${e}"
|
|
2636
2646
|
type="${b}"
|
|
2637
2647
|
value="${this._value}"
|
|
2638
|
-
${
|
|
2648
|
+
${c ? `placeholder="${c}"` : ""}
|
|
2639
2649
|
${m ? `name="${m}"` : ""}
|
|
2640
2650
|
${g ? `autocomplete="${g}"` : ""}
|
|
2641
2651
|
${f ? `maxlength="${f}"` : ""}
|
|
@@ -2643,7 +2653,7 @@ class G extends d {
|
|
|
2643
2653
|
${k ? `pattern="${k}"` : ""}
|
|
2644
2654
|
${w ? `inputmode="${w}"` : ""}
|
|
2645
2655
|
${$}
|
|
2646
|
-
${
|
|
2656
|
+
${ht}
|
|
2647
2657
|
${z}
|
|
2648
2658
|
${E ? 'aria-invalid="true"' : ""}
|
|
2649
2659
|
${y ? 'aria-required="true"' : ""}
|
|
@@ -2783,8 +2793,8 @@ class G extends d {
|
|
|
2783
2793
|
(t = this._inputEl) == null || t.select();
|
|
2784
2794
|
}
|
|
2785
2795
|
}
|
|
2786
|
-
|
|
2787
|
-
class
|
|
2796
|
+
d("a11y-input", W);
|
|
2797
|
+
class J extends h {
|
|
2788
2798
|
constructor() {
|
|
2789
2799
|
super(...arguments), this._value = "", this._textareaEl = null, this._labelEl = null, this._hintEl = null, this._errorEl = null, this.handleInput = (t) => {
|
|
2790
2800
|
const e = t.target;
|
|
@@ -2863,11 +2873,11 @@ class V extends d {
|
|
|
2863
2873
|
));
|
|
2864
2874
|
}
|
|
2865
2875
|
render() {
|
|
2866
|
-
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-field`, i = `${this._id}-label`, s = `${this._id}-hint`, a = `${this._id}-error`, r = this.getAttribute("label") || "", l = this.getAttribute("hint") || "", o = this.getAttribute("error") || "", b = this.getAttribute("rows") || "3",
|
|
2876
|
+
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-field`, i = `${this._id}-label`, s = `${this._id}-hint`, a = `${this._id}-error`, r = this.getAttribute("label") || "", l = this.getAttribute("hint") || "", o = this.getAttribute("error") || "", b = this.getAttribute("rows") || "3", c = this.getAttribute("placeholder") || "", m = this.getAttribute("name") || "", g = this.getAttribute("autocomplete") || "", f = this.getAttribute("maxlength"), _ = this.getAttribute("minlength"), k = this.getAttribute("aria-label") || "", w = this.getAttribute("aria-labelledby") || "", S = this.disabled, I = this.readOnly, C = this.required, x = !!o, y = [];
|
|
2867
2877
|
l && y.push(s), x && y.push(a);
|
|
2868
2878
|
const E = y.length ? `aria-describedby="${y.join(" ")}"` : "", A = !r && k ? `aria-label="${k}"` : "", z = !r && w ? `aria-labelledby="${w}"` : r ? `aria-labelledby="${i}"` : "";
|
|
2869
2879
|
this.setAttribute("data-error", x ? "true" : "false"), t.innerHTML = `
|
|
2870
|
-
<style>${
|
|
2880
|
+
<style>${Dt}</style>
|
|
2871
2881
|
<div class="textarea-wrapper" part="wrapper">
|
|
2872
2882
|
${r ? `<label id="${i}" for="${e}" class="textarea-label" part="label">
|
|
2873
2883
|
${r}${C ? '<span class="textarea-required" aria-hidden="true" part="required">*</span>' : ""}
|
|
@@ -2875,7 +2885,7 @@ class V extends d {
|
|
|
2875
2885
|
<textarea
|
|
2876
2886
|
id="${e}"
|
|
2877
2887
|
rows="${b}"
|
|
2878
|
-
${
|
|
2888
|
+
${c ? `placeholder="${c}"` : ""}
|
|
2879
2889
|
${m ? `name="${m}"` : ""}
|
|
2880
2890
|
${g ? `autocomplete="${g}"` : ""}
|
|
2881
2891
|
${f ? `maxlength="${f}"` : ""}
|
|
@@ -3018,8 +3028,8 @@ class V extends d {
|
|
|
3018
3028
|
(t = this._textareaEl) == null || t.select();
|
|
3019
3029
|
}
|
|
3020
3030
|
}
|
|
3021
|
-
|
|
3022
|
-
class
|
|
3031
|
+
d("a11y-textarea", J);
|
|
3032
|
+
class Q extends h {
|
|
3023
3033
|
constructor() {
|
|
3024
3034
|
super(...arguments), this._buttonEl = null, this.handleClick = (t) => {
|
|
3025
3035
|
if (this.disabled || this.loading) {
|
|
@@ -3084,13 +3094,13 @@ class X extends d {
|
|
|
3084
3094
|
));
|
|
3085
3095
|
}
|
|
3086
3096
|
render() {
|
|
3087
|
-
const t = this.attachShadow({ mode: "open" }), e = this.variant, i = this.size, s = this.getAttribute("type") || "button", a = this.getAttribute("aria-label") || "", r = this.disabled, l = this.discoverable, o = this.loading, b = r || o,
|
|
3097
|
+
const t = this.attachShadow({ mode: "open" }), e = this.variant, i = this.size, s = this.getAttribute("type") || "button", a = this.getAttribute("aria-label") || "", r = this.disabled, l = this.discoverable, o = this.loading, b = r || o, c = r && !l;
|
|
3088
3098
|
t.innerHTML = `
|
|
3089
|
-
<style>${
|
|
3099
|
+
<style>${qt}</style>
|
|
3090
3100
|
<button
|
|
3091
3101
|
class="variant-${e} size-${i}"
|
|
3092
3102
|
type="${s}"
|
|
3093
|
-
${
|
|
3103
|
+
${c ? "disabled" : ""}
|
|
3094
3104
|
${b ? 'aria-disabled="true"' : ""}
|
|
3095
3105
|
${o ? 'aria-busy="true"' : ""}
|
|
3096
3106
|
${a ? `aria-label="${a}"` : ""}
|
|
@@ -3175,8 +3185,8 @@ class X extends d {
|
|
|
3175
3185
|
(t = this._buttonEl) == null || t.click();
|
|
3176
3186
|
}
|
|
3177
3187
|
}
|
|
3178
|
-
|
|
3179
|
-
class
|
|
3188
|
+
d("a11y-button", Q);
|
|
3189
|
+
class Z extends h {
|
|
3180
3190
|
constructor() {
|
|
3181
3191
|
super(...arguments), this._label = "", this._disabled = !1;
|
|
3182
3192
|
}
|
|
@@ -3203,7 +3213,7 @@ class W extends d {
|
|
|
3203
3213
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
3204
3214
|
const t = `${this._id}-label`;
|
|
3205
3215
|
this.shadowRoot.innerHTML = `
|
|
3206
|
-
<style>${
|
|
3216
|
+
<style>${Ht}</style>
|
|
3207
3217
|
<div class="optgroup-wrapper" part="group">
|
|
3208
3218
|
<div class="optgroup-label" part="label" id="${t}" role="presentation">
|
|
3209
3219
|
${this._label}
|
|
@@ -3234,7 +3244,7 @@ class W extends d {
|
|
|
3234
3244
|
}
|
|
3235
3245
|
}
|
|
3236
3246
|
}
|
|
3237
|
-
class
|
|
3247
|
+
class tt extends h {
|
|
3238
3248
|
constructor() {
|
|
3239
3249
|
super(...arguments), this._value = "", this._disabled = !1, this._selected = !1, this._discoverable = !0, this.handleClick = (t) => {
|
|
3240
3250
|
if (this.effectivelyDisabled) {
|
|
@@ -3294,7 +3304,7 @@ class J extends d {
|
|
|
3294
3304
|
}
|
|
3295
3305
|
render() {
|
|
3296
3306
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
3297
|
-
<style>${
|
|
3307
|
+
<style>${Rt}</style>
|
|
3298
3308
|
<div class="option-wrapper" part="option">
|
|
3299
3309
|
<span class="option-content" part="content"><slot></slot></span>
|
|
3300
3310
|
<span class="check-mark" part="check" aria-hidden="true">✓</span>
|
|
@@ -3321,7 +3331,7 @@ class J extends d {
|
|
|
3321
3331
|
}
|
|
3322
3332
|
}
|
|
3323
3333
|
}
|
|
3324
|
-
class
|
|
3334
|
+
class et extends h {
|
|
3325
3335
|
constructor() {
|
|
3326
3336
|
super(...arguments), this._value = null, this._values = /* @__PURE__ */ new Set(), this._multiple = !1, this._disabled = !1, this._discoverable = !0, this._orientation = "vertical", this._focusedIndex = -1, this._typeAhead = null, this.handleFocus = () => {
|
|
3327
3337
|
if (this._focusedIndex >= 0) return;
|
|
@@ -3380,9 +3390,9 @@ class Q extends d {
|
|
|
3380
3390
|
const o = (a = this._typeAhead) == null ? void 0 : a.type(t.key);
|
|
3381
3391
|
if (o) {
|
|
3382
3392
|
const b = e.findIndex(
|
|
3383
|
-
(
|
|
3393
|
+
(c) => {
|
|
3384
3394
|
var m;
|
|
3385
|
-
return (((m =
|
|
3395
|
+
return (((m = c.textContent) == null ? void 0 : m.trim()) || "") === o && !c.effectivelyDisabled;
|
|
3386
3396
|
}
|
|
3387
3397
|
);
|
|
3388
3398
|
b >= 0 && (i = b, s = !0);
|
|
@@ -3409,9 +3419,9 @@ class Q extends d {
|
|
|
3409
3419
|
const o = (r = this._typeAhead) == null ? void 0 : r.type(t.key);
|
|
3410
3420
|
if (o) {
|
|
3411
3421
|
const b = e.findIndex(
|
|
3412
|
-
(
|
|
3422
|
+
(c) => {
|
|
3413
3423
|
var m;
|
|
3414
|
-
return (((m =
|
|
3424
|
+
return (((m = c.textContent) == null ? void 0 : m.trim()) || "") === o && !c.effectivelyDisabled;
|
|
3415
3425
|
}
|
|
3416
3426
|
);
|
|
3417
3427
|
b >= 0 && (i = b, s = !0);
|
|
@@ -3425,8 +3435,8 @@ class Q extends d {
|
|
|
3425
3435
|
if (!this._multiple && o)
|
|
3426
3436
|
this.selectSingle(o);
|
|
3427
3437
|
else if (o) {
|
|
3428
|
-
const b = ((l = o.textContent) == null ? void 0 : l.trim()) || o.value,
|
|
3429
|
-
p(`${b}${
|
|
3438
|
+
const b = ((l = o.textContent) == null ? void 0 : l.trim()) || o.value, c = this._values.has(o.value);
|
|
3439
|
+
p(`${b}${c ? ", selected" : ""}`);
|
|
3430
3440
|
}
|
|
3431
3441
|
}
|
|
3432
3442
|
};
|
|
@@ -3496,7 +3506,7 @@ class Q extends d {
|
|
|
3496
3506
|
}
|
|
3497
3507
|
render() {
|
|
3498
3508
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
3499
|
-
<style>${
|
|
3509
|
+
<style>${Ot}</style>
|
|
3500
3510
|
<div class="listbox-wrapper" part="wrapper">
|
|
3501
3511
|
<slot></slot>
|
|
3502
3512
|
</div>
|
|
@@ -3628,15 +3638,15 @@ class Q extends d {
|
|
|
3628
3638
|
}
|
|
3629
3639
|
}
|
|
3630
3640
|
}
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
const
|
|
3641
|
+
d("a11y-optgroup", Z);
|
|
3642
|
+
d("a11y-option", tt);
|
|
3643
|
+
d("a11y-listbox", et);
|
|
3644
|
+
const Yt = `<svg class="checkbox-check" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
|
3635
3645
|
<path d="M2.5 6L5 8.5L9.5 3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3636
|
-
</svg>`,
|
|
3646
|
+
</svg>`, Ut = `<svg class="checkbox-dash" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
|
3637
3647
|
<path d="M3 6H9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
3638
3648
|
</svg>`;
|
|
3639
|
-
class R extends
|
|
3649
|
+
class R extends h {
|
|
3640
3650
|
constructor() {
|
|
3641
3651
|
super(...arguments), this._checked = !1, this._indeterminate = !1, this._input = null, this.handleChange = () => {
|
|
3642
3652
|
if (!this._input) return;
|
|
@@ -3753,18 +3763,18 @@ class R extends d {
|
|
|
3753
3763
|
);
|
|
3754
3764
|
}
|
|
3755
3765
|
render() {
|
|
3756
|
-
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-input`, i = `${this._id}-label`, s = `${this._id}-hint`, a = `${this._id}-error`, r = !!this.label, l = !!this.hint, o = !!this.error, b = this.getAttribute("aria-label"),
|
|
3766
|
+
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-input`, i = `${this._id}-label`, s = `${this._id}-hint`, a = `${this._id}-error`, r = !!this.label, l = !!this.hint, o = !!this.error, b = this.getAttribute("aria-label"), c = this.getAttribute("name") || "", m = this.getAttribute("aria-describedby") || "", g = [];
|
|
3757
3767
|
m && g.push(m), l && g.push(s), o && g.push(a);
|
|
3758
3768
|
const f = g.length ? `aria-describedby="${g.join(" ")}"` : "", _ = !r && b ? `aria-label="${b}"` : "";
|
|
3759
3769
|
t.innerHTML = `
|
|
3760
|
-
<style>${
|
|
3770
|
+
<style>${Bt}</style>
|
|
3761
3771
|
<div class="checkbox-wrapper size-${this.size}" part="wrapper">
|
|
3762
3772
|
<div class="checkbox-control">
|
|
3763
3773
|
<input
|
|
3764
3774
|
type="checkbox"
|
|
3765
3775
|
class="checkbox-input"
|
|
3766
3776
|
id="${e}"
|
|
3767
|
-
${
|
|
3777
|
+
${c ? `name="${c}"` : ""}
|
|
3768
3778
|
${this.value ? `value="${this.value}"` : ""}
|
|
3769
3779
|
${this._checked ? "checked" : ""}
|
|
3770
3780
|
${this.disabled ? "disabled" : ""}
|
|
@@ -3775,8 +3785,8 @@ class R extends d {
|
|
|
3775
3785
|
part="input"
|
|
3776
3786
|
/>
|
|
3777
3787
|
<div class="checkbox-indicator" part="indicator" aria-hidden="true">
|
|
3778
|
-
${
|
|
3779
|
-
${
|
|
3788
|
+
${Yt}
|
|
3789
|
+
${Ut}
|
|
3780
3790
|
</div>
|
|
3781
3791
|
</div>
|
|
3782
3792
|
${r || l || o ? `<div class="checkbox-content">
|
|
@@ -3856,7 +3866,7 @@ class R extends d {
|
|
|
3856
3866
|
this.checked = t;
|
|
3857
3867
|
}
|
|
3858
3868
|
}
|
|
3859
|
-
class
|
|
3869
|
+
class it extends h {
|
|
3860
3870
|
constructor() {
|
|
3861
3871
|
super(...arguments), this._value = [], this.handleChildChange = (t) => {
|
|
3862
3872
|
const e = t.target;
|
|
@@ -3930,7 +3940,7 @@ class Z extends d {
|
|
|
3930
3940
|
render() {
|
|
3931
3941
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-error`, i = !!this.legend, s = !!this.error, a = this.getAttribute("aria-label"), r = this.getAttribute("aria-labelledby");
|
|
3932
3942
|
t.innerHTML = `
|
|
3933
|
-
<style>${
|
|
3943
|
+
<style>${Mt}</style>
|
|
3934
3944
|
<fieldset
|
|
3935
3945
|
part="fieldset"
|
|
3936
3946
|
${a ? `aria-label="${a}"` : ""}
|
|
@@ -3996,9 +4006,9 @@ class Z extends d {
|
|
|
3996
4006
|
t && (this.disabled ? t.setAttribute("disabled", "") : t.removeAttribute("disabled"));
|
|
3997
4007
|
}
|
|
3998
4008
|
}
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
class
|
|
4009
|
+
d("a11y-checkbox", R);
|
|
4010
|
+
d("a11y-checkbox-group", it);
|
|
4011
|
+
class st extends h {
|
|
4002
4012
|
constructor() {
|
|
4003
4013
|
super(...arguments), this._value = "", this._disabled = !1, this._discoverable = !0, this._orientation = "vertical", this._required = !1, this._name = "", this.handleRadioSelect = (t) => {
|
|
4004
4014
|
var i;
|
|
@@ -4124,7 +4134,7 @@ class tt extends d {
|
|
|
4124
4134
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4125
4135
|
const t = this.shadowRoot, e = this.getAttribute("legend") || "", i = this.getAttribute("hint") || "", s = this.getAttribute("error") || "", a = i ? `${this._id}-hint` : "", r = s ? `${this._id}-error` : "", l = [a, r].filter(Boolean).join(" ");
|
|
4126
4136
|
l ? this.setAttribute("aria-describedby", l) : this.removeAttribute("aria-describedby"), t.innerHTML = `
|
|
4127
|
-
<style>${
|
|
4137
|
+
<style>${Kt}</style>
|
|
4128
4138
|
<fieldset part="fieldset">
|
|
4129
4139
|
${e ? `<legend part="legend">${e}${this._required ? '<span class="radio-group-required" aria-hidden="true"> *</span>' : ""}</legend>` : ""}
|
|
4130
4140
|
<div class="radio-group-items" part="items">
|
|
@@ -4203,7 +4213,7 @@ class tt extends d {
|
|
|
4203
4213
|
}
|
|
4204
4214
|
}
|
|
4205
4215
|
}
|
|
4206
|
-
class
|
|
4216
|
+
class at extends h {
|
|
4207
4217
|
constructor() {
|
|
4208
4218
|
super(...arguments), this._value = "", this._checked = !1, this._disabled = !1, this._discoverable = !0, this.handleClick = (t) => {
|
|
4209
4219
|
if (this._disabled) {
|
|
@@ -4274,7 +4284,7 @@ class et extends d {
|
|
|
4274
4284
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4275
4285
|
const t = this.shadowRoot, e = this.getAttribute("label") || "", i = this.getAttribute("hint") || "", s = e ? `${this._id}-label` : "", a = i ? `${this._id}-hint` : "";
|
|
4276
4286
|
s && this.setAttribute("aria-labelledby", s), a && this.setAttribute("aria-describedby", a), t.innerHTML = `
|
|
4277
|
-
<style>${
|
|
4287
|
+
<style>${Nt}</style>
|
|
4278
4288
|
<div class="radio-wrapper" part="wrapper">
|
|
4279
4289
|
<div class="radio-control" part="control">
|
|
4280
4290
|
<input
|
|
@@ -4335,21 +4345,21 @@ class et extends d {
|
|
|
4335
4345
|
}
|
|
4336
4346
|
}
|
|
4337
4347
|
}
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
class
|
|
4348
|
+
d("a11y-radio-group", st);
|
|
4349
|
+
d("a11y-radio", at);
|
|
4350
|
+
class rt extends h {
|
|
4341
4351
|
constructor() {
|
|
4342
4352
|
super(...arguments), this._toasts = [], this._counter = 0, this._containerEl = null, this._maxToasts = 5, this._handleClick = (t) => {
|
|
4343
4353
|
var a;
|
|
4344
4354
|
const e = t.target, i = e.getAttribute("data-close-id");
|
|
4345
4355
|
if (i) {
|
|
4346
|
-
this.
|
|
4356
|
+
this.removeToast(i);
|
|
4347
4357
|
return;
|
|
4348
4358
|
}
|
|
4349
4359
|
const s = e.getAttribute("data-action-id");
|
|
4350
4360
|
if (s) {
|
|
4351
4361
|
const r = this._toasts.find((l) => l.id === s);
|
|
4352
|
-
(a = r == null ? void 0 : r.action) == null || a.onClick(), this.
|
|
4362
|
+
(a = r == null ? void 0 : r.action) == null || a.onClick(), this.removeToast(s);
|
|
4353
4363
|
}
|
|
4354
4364
|
};
|
|
4355
4365
|
}
|
|
@@ -4375,7 +4385,7 @@ class it extends d {
|
|
|
4375
4385
|
render() {
|
|
4376
4386
|
const t = this.attachShadow({ mode: "open" });
|
|
4377
4387
|
t.innerHTML = `
|
|
4378
|
-
<style>${
|
|
4388
|
+
<style>${Ft}</style>
|
|
4379
4389
|
<div
|
|
4380
4390
|
class="toast-container"
|
|
4381
4391
|
role="region"
|
|
@@ -4426,11 +4436,11 @@ class it extends d {
|
|
|
4426
4436
|
/**
|
|
4427
4437
|
* Remove a toast by ID.
|
|
4428
4438
|
*/
|
|
4429
|
-
|
|
4439
|
+
removeToast(t) {
|
|
4430
4440
|
const e = this._toasts.findIndex((s) => s.id === t);
|
|
4431
4441
|
if (e === -1) return;
|
|
4432
4442
|
const i = this._toasts[e];
|
|
4433
|
-
i.timerId && clearTimeout(i.timerId), this._toasts.splice(e, 1), this._removeElement(t), this.emit("a11y-toast-remove", { id: t });
|
|
4443
|
+
i && i.timerId && clearTimeout(i.timerId), this._toasts.splice(e, 1), this._removeElement(t), this.emit("a11y-toast-remove", { id: t });
|
|
4434
4444
|
}
|
|
4435
4445
|
/**
|
|
4436
4446
|
* Remove all toasts.
|
|
@@ -4449,7 +4459,7 @@ class it extends d {
|
|
|
4449
4459
|
i.className = "toast", i.setAttribute("data-toast-id", t.id), i.setAttribute("data-type", t.type), i.setAttribute("role", e ? "alert" : "status"), i.setAttribute("aria-atomic", "true"), i.setAttribute("tabindex", "0");
|
|
4450
4460
|
let s = '<div class="toast-content">';
|
|
4451
4461
|
t.title && (s += `<div class="toast-title">${this._escapeHtml(t.title)}</div>`), t.description && (s += `<div class="toast-description">${this._escapeHtml(t.description)}</div>`), t.action && (s += `<button type="button" class="toast-action" data-action-id="${t.id}" tabindex="0">${this._escapeHtml(t.action.label)}</button>`), s += "</div>", s += `<button type="button" class="toast-close" aria-label="Dismiss" data-close-id="${t.id}" tabindex="0">×</button>`, i.innerHTML = s, i.addEventListener("mouseenter", () => this._pauseTimer(t)), i.addEventListener("mouseleave", () => this._resumeTimer(t)), i.addEventListener("keydown", (a) => {
|
|
4452
|
-
a.key === "Escape" && this.
|
|
4462
|
+
a.key === "Escape" && this.removeToast(t.id);
|
|
4453
4463
|
}), this._containerEl.appendChild(i);
|
|
4454
4464
|
}
|
|
4455
4465
|
_removeElement(t) {
|
|
@@ -4461,7 +4471,7 @@ class it extends d {
|
|
|
4461
4471
|
}
|
|
4462
4472
|
_startTimer(t) {
|
|
4463
4473
|
t.duration !== 0 && (t.startTime = Date.now(), t.timerId = setTimeout(() => {
|
|
4464
|
-
this.
|
|
4474
|
+
this.removeToast(t.id);
|
|
4465
4475
|
}, t.remaining));
|
|
4466
4476
|
}
|
|
4467
4477
|
_pauseTimer(t) {
|
|
@@ -4475,93 +4485,427 @@ class it extends d {
|
|
|
4475
4485
|
return e.textContent = t, e.innerHTML;
|
|
4476
4486
|
}
|
|
4477
4487
|
}
|
|
4478
|
-
|
|
4488
|
+
d("a11y-toast", rt);
|
|
4489
|
+
class ot extends h {
|
|
4490
|
+
static get observedAttributes() {
|
|
4491
|
+
return ["focusable"];
|
|
4492
|
+
}
|
|
4493
|
+
setupAccessibility() {
|
|
4494
|
+
}
|
|
4495
|
+
render() {
|
|
4496
|
+
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
4497
|
+
<style>
|
|
4498
|
+
:host {
|
|
4499
|
+
${F}
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4502
|
+
:host([hidden]) {
|
|
4503
|
+
display: none !important;
|
|
4504
|
+
}
|
|
4505
|
+
|
|
4506
|
+
/* When focusable, become visible when a child receives focus */
|
|
4507
|
+
:host([focusable]:focus-within) {
|
|
4508
|
+
position: static;
|
|
4509
|
+
width: auto;
|
|
4510
|
+
height: auto;
|
|
4511
|
+
padding: 0;
|
|
4512
|
+
margin: 0;
|
|
4513
|
+
overflow: visible;
|
|
4514
|
+
clip: auto;
|
|
4515
|
+
white-space: normal;
|
|
4516
|
+
border: 0;
|
|
4517
|
+
}
|
|
4518
|
+
</style>
|
|
4519
|
+
<slot></slot>
|
|
4520
|
+
`;
|
|
4521
|
+
}
|
|
4522
|
+
setupEventListeners() {
|
|
4523
|
+
}
|
|
4524
|
+
cleanupEventListeners() {
|
|
4525
|
+
}
|
|
4526
|
+
}
|
|
4527
|
+
d("a11y-visually-hidden", ot);
|
|
4528
|
+
const Vt = N("SkipLink");
|
|
4529
|
+
class lt extends h {
|
|
4530
|
+
constructor() {
|
|
4531
|
+
super(...arguments), this.handleClick = (t) => {
|
|
4532
|
+
const e = this.getAttribute("target") || "#main-content", i = document.querySelector(e);
|
|
4533
|
+
i && (t.preventDefault(), !i.hasAttribute("tabindex") && i.tabIndex < 0 && i.setAttribute("tabindex", "-1"), i.focus(), i.scrollIntoView({ behavior: "smooth", block: "start" }));
|
|
4534
|
+
};
|
|
4535
|
+
}
|
|
4536
|
+
static get observedAttributes() {
|
|
4537
|
+
return ["target", "label"];
|
|
4538
|
+
}
|
|
4539
|
+
setupAccessibility() {
|
|
4540
|
+
this.getAttribute("target") || Vt.warning(
|
|
4541
|
+
'Missing "target" attribute. Provide a CSS selector (e.g. target="#main-content") pointing to the skip destination.'
|
|
4542
|
+
);
|
|
4543
|
+
}
|
|
4544
|
+
render() {
|
|
4545
|
+
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4546
|
+
const t = this.getAttribute("target") || "#main-content", e = this.getAttribute("label");
|
|
4547
|
+
this.shadowRoot.innerHTML = `
|
|
4548
|
+
<style>
|
|
4549
|
+
:host {
|
|
4550
|
+
display: block;
|
|
4551
|
+
}
|
|
4552
|
+
|
|
4553
|
+
:host([hidden]) {
|
|
4554
|
+
display: none !important;
|
|
4555
|
+
}
|
|
4556
|
+
|
|
4557
|
+
.skip-link {
|
|
4558
|
+
${F}
|
|
4559
|
+
display: inline-block;
|
|
4560
|
+
text-decoration: none;
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4563
|
+
.skip-link:focus {
|
|
4564
|
+
position: fixed;
|
|
4565
|
+
top: var(--compa11y-skip-link-top, 0.5rem);
|
|
4566
|
+
left: var(--compa11y-skip-link-left, 0.5rem);
|
|
4567
|
+
z-index: var(--compa11y-skip-link-z-index, 99999);
|
|
4568
|
+
width: auto;
|
|
4569
|
+
height: auto;
|
|
4570
|
+
padding: var(--compa11y-skip-link-padding, 0.75rem 1.5rem);
|
|
4571
|
+
margin: 0;
|
|
4572
|
+
overflow: visible;
|
|
4573
|
+
clip: auto;
|
|
4574
|
+
white-space: normal;
|
|
4575
|
+
background: var(--compa11y-skip-link-bg, #0066cc);
|
|
4576
|
+
color: var(--compa11y-skip-link-color, white);
|
|
4577
|
+
font-size: var(--compa11y-skip-link-font-size, 1rem);
|
|
4578
|
+
font-weight: var(--compa11y-skip-link-font-weight, 600);
|
|
4579
|
+
border-radius: var(--compa11y-skip-link-radius, 4px);
|
|
4580
|
+
border: var(--compa11y-skip-link-border, 2px solid transparent);
|
|
4581
|
+
box-shadow: var(--compa11y-skip-link-shadow, 0 2px 8px rgba(0, 0, 0, 0.2));
|
|
4582
|
+
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
4583
|
+
outline-offset: 2px;
|
|
4584
|
+
}
|
|
4585
|
+
|
|
4586
|
+
@media (forced-colors: active) {
|
|
4587
|
+
.skip-link:focus {
|
|
4588
|
+
border: 2px solid ButtonText;
|
|
4589
|
+
outline: 2px solid Highlight;
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
</style>
|
|
4593
|
+
<a class="skip-link" href="${t}" part="link">
|
|
4594
|
+
${e || "<slot>Skip to main content</slot>"}
|
|
4595
|
+
</a>
|
|
4596
|
+
`;
|
|
4597
|
+
}
|
|
4598
|
+
setupEventListeners() {
|
|
4599
|
+
this.addEventListener("click", this.handleClick);
|
|
4600
|
+
}
|
|
4601
|
+
cleanupEventListeners() {
|
|
4602
|
+
this.removeEventListener("click", this.handleClick);
|
|
4603
|
+
}
|
|
4604
|
+
onAttributeChange(t, e, i) {
|
|
4605
|
+
(t === "target" || t === "label") && this.render();
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
d("a11y-skip-link", lt);
|
|
4609
|
+
const Gt = N("Alert"), Xt = `
|
|
4610
|
+
:host {
|
|
4611
|
+
display: block;
|
|
4612
|
+
box-sizing: border-box;
|
|
4613
|
+
}
|
|
4614
|
+
|
|
4615
|
+
:host([hidden]) {
|
|
4616
|
+
display: none !important;
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
*,
|
|
4620
|
+
*::before,
|
|
4621
|
+
*::after {
|
|
4622
|
+
box-sizing: inherit;
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4625
|
+
.alert {
|
|
4626
|
+
display: flex;
|
|
4627
|
+
align-items: flex-start;
|
|
4628
|
+
gap: 0.75rem;
|
|
4629
|
+
padding: var(--compa11y-alert-padding, 0.75rem 1rem);
|
|
4630
|
+
background: var(--compa11y-alert-bg, white);
|
|
4631
|
+
border: var(--compa11y-alert-border, 1px solid #e0e0e0);
|
|
4632
|
+
border-radius: var(--compa11y-alert-radius, 6px);
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
/* Type variants — left border accent */
|
|
4636
|
+
:host([type="info"]) .alert,
|
|
4637
|
+
:host(:not([type])) .alert {
|
|
4638
|
+
border-left: 4px solid var(--compa11y-alert-info-color, #3b82f6);
|
|
4639
|
+
}
|
|
4640
|
+
|
|
4641
|
+
:host([type="success"]) .alert {
|
|
4642
|
+
border-left: 4px solid var(--compa11y-alert-success-color, #22c55e);
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4645
|
+
:host([type="warning"]) .alert {
|
|
4646
|
+
border-left: 4px solid var(--compa11y-alert-warning-color, #f59e0b);
|
|
4647
|
+
}
|
|
4648
|
+
|
|
4649
|
+
:host([type="error"]) .alert {
|
|
4650
|
+
border-left: 4px solid var(--compa11y-alert-error-color, #ef4444);
|
|
4651
|
+
}
|
|
4652
|
+
|
|
4653
|
+
.alert-icon {
|
|
4654
|
+
flex-shrink: 0;
|
|
4655
|
+
font-size: 1.25rem;
|
|
4656
|
+
line-height: 1;
|
|
4657
|
+
margin-top: 0.125rem;
|
|
4658
|
+
}
|
|
4659
|
+
|
|
4660
|
+
:host([type="info"]) .alert-icon,
|
|
4661
|
+
:host(:not([type])) .alert-icon {
|
|
4662
|
+
color: var(--compa11y-alert-info-color, #3b82f6);
|
|
4663
|
+
}
|
|
4664
|
+
|
|
4665
|
+
:host([type="success"]) .alert-icon {
|
|
4666
|
+
color: var(--compa11y-alert-success-color, #22c55e);
|
|
4667
|
+
}
|
|
4668
|
+
|
|
4669
|
+
:host([type="warning"]) .alert-icon {
|
|
4670
|
+
color: var(--compa11y-alert-warning-color, #f59e0b);
|
|
4671
|
+
}
|
|
4672
|
+
|
|
4673
|
+
:host([type="error"]) .alert-icon {
|
|
4674
|
+
color: var(--compa11y-alert-error-color, #ef4444);
|
|
4675
|
+
}
|
|
4676
|
+
|
|
4677
|
+
.alert-content {
|
|
4678
|
+
flex: 1;
|
|
4679
|
+
min-width: 0;
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4682
|
+
.alert-title {
|
|
4683
|
+
font-weight: var(--compa11y-alert-title-weight, 600);
|
|
4684
|
+
font-size: var(--compa11y-alert-title-size, 0.875rem);
|
|
4685
|
+
margin-bottom: 0.125rem;
|
|
4686
|
+
}
|
|
4687
|
+
|
|
4688
|
+
.alert-description {
|
|
4689
|
+
color: var(--compa11y-alert-description-color, #555);
|
|
4690
|
+
font-size: var(--compa11y-alert-description-size, 0.8125rem);
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
.alert-close {
|
|
4694
|
+
appearance: none;
|
|
4695
|
+
background: none;
|
|
4696
|
+
border: none;
|
|
4697
|
+
padding: 0;
|
|
4698
|
+
margin: 0;
|
|
4699
|
+
font: inherit;
|
|
4700
|
+
color: inherit;
|
|
4701
|
+
cursor: pointer;
|
|
4702
|
+
flex-shrink: 0;
|
|
4703
|
+
width: 1.5rem;
|
|
4704
|
+
height: 1.5rem;
|
|
4705
|
+
display: flex;
|
|
4706
|
+
align-items: center;
|
|
4707
|
+
justify-content: center;
|
|
4708
|
+
border-radius: var(--compa11y-alert-close-radius, 4px);
|
|
4709
|
+
color: var(--compa11y-alert-close-color, #999);
|
|
4710
|
+
font-size: 1.125rem;
|
|
4711
|
+
line-height: 1;
|
|
4712
|
+
}
|
|
4713
|
+
|
|
4714
|
+
.alert-close:hover {
|
|
4715
|
+
background: var(--compa11y-alert-close-hover-bg, rgba(0, 0, 0, 0.05));
|
|
4716
|
+
color: var(--compa11y-alert-close-hover-color, #333);
|
|
4717
|
+
}
|
|
4718
|
+
|
|
4719
|
+
.alert-close:focus-visible {
|
|
4720
|
+
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
4721
|
+
outline-offset: 2px;
|
|
4722
|
+
}
|
|
4723
|
+
|
|
4724
|
+
/* Forced colors / high contrast mode */
|
|
4725
|
+
@media (forced-colors: active) {
|
|
4726
|
+
.alert {
|
|
4727
|
+
border: 2px solid ButtonText;
|
|
4728
|
+
}
|
|
4729
|
+
|
|
4730
|
+
.alert-close:focus-visible {
|
|
4731
|
+
outline: 2px solid Highlight;
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
`, K = {
|
|
4735
|
+
info: "ℹ️",
|
|
4736
|
+
// ℹ️
|
|
4737
|
+
success: "✅",
|
|
4738
|
+
// ✅
|
|
4739
|
+
warning: "⚠️",
|
|
4740
|
+
// ⚠️
|
|
4741
|
+
error: "❌"
|
|
4742
|
+
// ❌
|
|
4743
|
+
};
|
|
4744
|
+
class nt extends h {
|
|
4745
|
+
constructor() {
|
|
4746
|
+
super(...arguments), this._closeButton = null, this.handleDismiss = () => {
|
|
4747
|
+
this.emit("dismiss", { type: this.alertType }), this.remove();
|
|
4748
|
+
};
|
|
4749
|
+
}
|
|
4750
|
+
static get observedAttributes() {
|
|
4751
|
+
return ["type", "title", "dismissible"];
|
|
4752
|
+
}
|
|
4753
|
+
get alertType() {
|
|
4754
|
+
return this.getAttribute("type") || "info";
|
|
4755
|
+
}
|
|
4756
|
+
/**
|
|
4757
|
+
* Determine the ARIA role based on alert type.
|
|
4758
|
+
* error/warning → role="alert" (assertive)
|
|
4759
|
+
* info/success → role="status" (polite)
|
|
4760
|
+
*/
|
|
4761
|
+
get alertRole() {
|
|
4762
|
+
const t = this.alertType;
|
|
4763
|
+
return t === "error" || t === "warning" ? "alert" : "status";
|
|
4764
|
+
}
|
|
4765
|
+
setupAccessibility() {
|
|
4766
|
+
const t = ["info", "success", "warning", "error"], e = this.getAttribute("type");
|
|
4767
|
+
e && !t.includes(e) && Gt.warning(
|
|
4768
|
+
`Invalid type="${e}". Use one of: ${t.join(", ")}.`
|
|
4769
|
+
);
|
|
4770
|
+
}
|
|
4771
|
+
render() {
|
|
4772
|
+
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4773
|
+
const t = this.getAttribute("title"), e = this.hasAttribute("dismissible"), i = K[this.alertType] || K.info;
|
|
4774
|
+
this.shadowRoot.innerHTML = `
|
|
4775
|
+
<style>${Xt}</style>
|
|
4776
|
+
<div
|
|
4777
|
+
class="alert"
|
|
4778
|
+
role="${this.alertRole}"
|
|
4779
|
+
aria-live="${this.alertRole === "alert" ? "assertive" : "polite"}"
|
|
4780
|
+
part="alert"
|
|
4781
|
+
>
|
|
4782
|
+
<span class="alert-icon" part="icon" aria-hidden="true">${i}</span>
|
|
4783
|
+
<div class="alert-content" part="content">
|
|
4784
|
+
${t ? `<div class="alert-title" part="title">${t}</div>` : ""}
|
|
4785
|
+
<div class="alert-description" part="description">
|
|
4786
|
+
<slot></slot>
|
|
4787
|
+
</div>
|
|
4788
|
+
</div>
|
|
4789
|
+
${e ? `<button
|
|
4790
|
+
class="alert-close"
|
|
4791
|
+
part="close"
|
|
4792
|
+
aria-label="Dismiss alert"
|
|
4793
|
+
type="button"
|
|
4794
|
+
>×</button>` : ""}
|
|
4795
|
+
</div>
|
|
4796
|
+
`, this._closeButton = this.shadowRoot.querySelector(".alert-close");
|
|
4797
|
+
}
|
|
4798
|
+
setupEventListeners() {
|
|
4799
|
+
var t;
|
|
4800
|
+
(t = this._closeButton) == null || t.addEventListener("click", this.handleDismiss);
|
|
4801
|
+
}
|
|
4802
|
+
cleanupEventListeners() {
|
|
4803
|
+
var t;
|
|
4804
|
+
(t = this._closeButton) == null || t.removeEventListener("click", this.handleDismiss);
|
|
4805
|
+
}
|
|
4806
|
+
onAttributeChange(t, e, i) {
|
|
4807
|
+
(t === "type" || t === "title" || t === "dismissible") && (this.render(), this.setupEventListeners());
|
|
4808
|
+
}
|
|
4809
|
+
/**
|
|
4810
|
+
* Programmatically dismiss the alert
|
|
4811
|
+
*/
|
|
4812
|
+
dismiss() {
|
|
4813
|
+
this.handleDismiss();
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
d("a11y-alert", nt);
|
|
4479
4817
|
if (typeof window < "u") {
|
|
4480
4818
|
const n = () => {
|
|
4481
4819
|
B(), H();
|
|
4482
4820
|
};
|
|
4483
4821
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", n) : n(), window.compa11y = {
|
|
4484
4822
|
// Components (classes)
|
|
4485
|
-
A11yDialog:
|
|
4486
|
-
A11yMenu:
|
|
4487
|
-
A11yTabs:
|
|
4488
|
-
A11yCombobox:
|
|
4489
|
-
A11ySwitch:
|
|
4490
|
-
A11ySelect:
|
|
4491
|
-
A11yInput:
|
|
4492
|
-
A11yTextarea:
|
|
4493
|
-
A11yButton:
|
|
4494
|
-
A11yListbox:
|
|
4495
|
-
A11yOption:
|
|
4496
|
-
A11yOptgroup:
|
|
4823
|
+
A11yDialog: j,
|
|
4824
|
+
A11yMenu: Y,
|
|
4825
|
+
A11yTabs: U,
|
|
4826
|
+
A11yCombobox: V,
|
|
4827
|
+
A11ySwitch: G,
|
|
4828
|
+
A11ySelect: X,
|
|
4829
|
+
A11yInput: W,
|
|
4830
|
+
A11yTextarea: J,
|
|
4831
|
+
A11yButton: Q,
|
|
4832
|
+
A11yListbox: et,
|
|
4833
|
+
A11yOption: tt,
|
|
4834
|
+
A11yOptgroup: Z,
|
|
4497
4835
|
A11yCheckbox: R,
|
|
4498
|
-
A11yCheckboxGroup:
|
|
4499
|
-
A11yRadioGroup:
|
|
4500
|
-
A11yRadio:
|
|
4501
|
-
A11yToast:
|
|
4836
|
+
A11yCheckboxGroup: it,
|
|
4837
|
+
A11yRadioGroup: st,
|
|
4838
|
+
A11yRadio: at,
|
|
4839
|
+
A11yToast: rt,
|
|
4840
|
+
A11yVisuallyHidden: ot,
|
|
4841
|
+
A11ySkipLink: lt,
|
|
4842
|
+
A11yAlert: nt,
|
|
4502
4843
|
// Announcer utilities
|
|
4503
4844
|
initAnnouncer: B,
|
|
4504
4845
|
announce: v,
|
|
4505
4846
|
announcePolite: p,
|
|
4506
4847
|
announceAssertive: O,
|
|
4507
|
-
announceStatus:
|
|
4508
|
-
announceError:
|
|
4848
|
+
announceStatus: kt,
|
|
4849
|
+
announceError: At,
|
|
4509
4850
|
// Focus utilities
|
|
4510
4851
|
initFocusVisible: H,
|
|
4511
|
-
createFocusTrap:
|
|
4512
|
-
createFocusScope:
|
|
4513
|
-
createRovingTabindex:
|
|
4852
|
+
createFocusTrap: Et,
|
|
4853
|
+
createFocusScope: xt,
|
|
4854
|
+
createRovingTabindex: yt,
|
|
4514
4855
|
// Keyboard utilities
|
|
4515
|
-
createKeyboardManager:
|
|
4516
|
-
KeyboardPatterns:
|
|
4856
|
+
createKeyboardManager: _t,
|
|
4857
|
+
KeyboardPatterns: ft,
|
|
4517
4858
|
createTypeAhead: q,
|
|
4518
4859
|
// ARIA utilities
|
|
4519
|
-
aria:
|
|
4520
|
-
buildAriaProps:
|
|
4521
|
-
hasAccessibleName:
|
|
4860
|
+
aria: vt,
|
|
4861
|
+
buildAriaProps: gt,
|
|
4862
|
+
hasAccessibleName: mt,
|
|
4522
4863
|
// Platform detection
|
|
4523
|
-
isBrowser:
|
|
4524
|
-
prefersReducedMotion:
|
|
4525
|
-
prefersHighContrast:
|
|
4526
|
-
prefersDarkMode:
|
|
4864
|
+
isBrowser: pt,
|
|
4865
|
+
prefersReducedMotion: bt,
|
|
4866
|
+
prefersHighContrast: ut,
|
|
4867
|
+
prefersDarkMode: ct
|
|
4527
4868
|
};
|
|
4528
4869
|
}
|
|
4529
4870
|
export {
|
|
4530
|
-
|
|
4871
|
+
nt as A11yAlert,
|
|
4872
|
+
Q as A11yButton,
|
|
4531
4873
|
R as A11yCheckbox,
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4874
|
+
it as A11yCheckboxGroup,
|
|
4875
|
+
V as A11yCombobox,
|
|
4876
|
+
j as A11yDialog,
|
|
4877
|
+
W as A11yInput,
|
|
4878
|
+
et as A11yListbox,
|
|
4879
|
+
Y as A11yMenu,
|
|
4880
|
+
Z as A11yOptgroup,
|
|
4881
|
+
tt as A11yOption,
|
|
4882
|
+
at as A11yRadio,
|
|
4883
|
+
st as A11yRadioGroup,
|
|
4884
|
+
X as A11ySelect,
|
|
4885
|
+
lt as A11ySkipLink,
|
|
4886
|
+
G as A11ySwitch,
|
|
4887
|
+
U as A11yTabs,
|
|
4888
|
+
J as A11yTextarea,
|
|
4889
|
+
rt as A11yToast,
|
|
4890
|
+
ot as A11yVisuallyHidden,
|
|
4891
|
+
Zt as KeyboardPatterns,
|
|
4892
|
+
te as announce,
|
|
4893
|
+
ee as announceAssertive,
|
|
4894
|
+
ie as announceError,
|
|
4895
|
+
se as announcePolite,
|
|
4896
|
+
ae as announceStatus,
|
|
4897
|
+
re as aria,
|
|
4898
|
+
oe as buildAriaProps,
|
|
4899
|
+
le as createFocusScope,
|
|
4900
|
+
ne as createFocusTrap,
|
|
4901
|
+
he as createKeyboardManager,
|
|
4902
|
+
de as createRovingTabindex,
|
|
4903
|
+
ce as createTypeAhead,
|
|
4904
|
+
ue as hasAccessibleName,
|
|
4905
|
+
be as initAnnouncer,
|
|
4906
|
+
pe as initFocusVisible,
|
|
4907
|
+
me as isBrowser,
|
|
4908
|
+
ge as prefersDarkMode,
|
|
4909
|
+
ve as prefersHighContrast,
|
|
4910
|
+
fe as prefersReducedMotion
|
|
4567
4911
|
};
|