@compa11y/web 0.1.11 → 0.1.12
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 +429 -169
- package/dist/compa11y.js +792 -230
- package/dist/components/pagination.d.ts +45 -0
- package/dist/components/popover.d.ts +0 -5
- package/dist/index.d.ts +2 -1
- package/dist/utils/styles.d.ts +4 -0
- package/package.json +2 -2
package/dist/compa11y.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { generateId as
|
|
2
|
-
import { KeyboardPatterns as
|
|
1
|
+
import { generateId as wt, announce as v, announcePolite as f, createTypeAhead as R, announceAssertive as O, createComponentWarnings as w, prefersDarkMode as St, prefersHighContrast as $t, prefersReducedMotion as Lt, isBrowser as It, hasAccessibleName as Tt, buildAriaProps as Ct, aria as zt, KeyboardPatterns as Dt, createKeyboardManager as qt, createRovingTabindex as Rt, createFocusScope as Ot, createFocusTrap as Ht, initFocusVisible as P, announceError as Pt, announceStatus as Bt, initAnnouncer as B } from "@compa11y/core";
|
|
2
|
+
import { KeyboardPatterns as Le, announce as Ie, announceAssertive as Te, announceError as Ce, announcePolite as ze, announceStatus as De, aria as qe, buildAriaProps as Re, createFocusScope as Oe, createFocusTrap as He, createKeyboardManager as Pe, createRovingTabindex as Be, createTypeAhead as Me, hasAccessibleName as Fe, initAnnouncer as Ke, initFocusVisible as Ne, isBrowser as je, prefersDarkMode as Ye, prefersHighContrast as Ue, prefersReducedMotion as Ge } from "@compa11y/core";
|
|
3
3
|
class u extends HTMLElement {
|
|
4
4
|
constructor() {
|
|
5
|
-
super(), this._internals = null, this._id =
|
|
5
|
+
super(), this._internals = null, this._id = wt(this.tagName.toLowerCase().replace("a11y-", "")), "attachInternals" in this && (this._internals = this.attachInternals());
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Standard observed attributes
|
|
@@ -74,10 +74,10 @@ class u extends HTMLElement {
|
|
|
74
74
|
return (i == null ? void 0 : i.assignedElements()) ?? [];
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function p(l, t) {
|
|
78
78
|
customElements.get(l) || customElements.define(l, t);
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const U = `
|
|
81
81
|
position: absolute;
|
|
82
82
|
width: 1px;
|
|
83
83
|
height: 1px;
|
|
@@ -158,7 +158,7 @@ const V = `
|
|
|
158
158
|
margin: 0 0 1rem 0;
|
|
159
159
|
color: var(--compa11y-dialog-description-color, #666);
|
|
160
160
|
}
|
|
161
|
-
`,
|
|
161
|
+
`, Ft = `
|
|
162
162
|
${g}
|
|
163
163
|
|
|
164
164
|
:host {
|
|
@@ -210,7 +210,7 @@ const V = `
|
|
|
210
210
|
margin: 0.25rem 0;
|
|
211
211
|
background: var(--compa11y-menu-separator-color, #e0e0e0);
|
|
212
212
|
}
|
|
213
|
-
`,
|
|
213
|
+
`, Kt = `
|
|
214
214
|
${g}
|
|
215
215
|
|
|
216
216
|
.tablist {
|
|
@@ -256,7 +256,7 @@ const V = `
|
|
|
256
256
|
::slotted([role="tabpanel"][hidden]) {
|
|
257
257
|
display: none;
|
|
258
258
|
}
|
|
259
|
-
`,
|
|
259
|
+
`, Nt = `
|
|
260
260
|
${g}
|
|
261
261
|
|
|
262
262
|
:host {
|
|
@@ -397,7 +397,7 @@ const V = `
|
|
|
397
397
|
.options-source {
|
|
398
398
|
display: none;
|
|
399
399
|
}
|
|
400
|
-
`,
|
|
400
|
+
`, jt = `
|
|
401
401
|
${g}
|
|
402
402
|
|
|
403
403
|
:host {
|
|
@@ -527,7 +527,7 @@ const V = `
|
|
|
527
527
|
.options-source {
|
|
528
528
|
display: none;
|
|
529
529
|
}
|
|
530
|
-
`,
|
|
530
|
+
`, Yt = `
|
|
531
531
|
${g}
|
|
532
532
|
|
|
533
533
|
:host {
|
|
@@ -631,7 +631,7 @@ const V = `
|
|
|
631
631
|
opacity: 0.5;
|
|
632
632
|
cursor: not-allowed;
|
|
633
633
|
}
|
|
634
|
-
`,
|
|
634
|
+
`, Ut = `
|
|
635
635
|
${g}
|
|
636
636
|
|
|
637
637
|
:host {
|
|
@@ -710,7 +710,7 @@ const V = `
|
|
|
710
710
|
color: var(--compa11y-input-error-color, #ef4444);
|
|
711
711
|
font-size: var(--compa11y-input-error-size, 0.8125rem);
|
|
712
712
|
}
|
|
713
|
-
`,
|
|
713
|
+
`, Gt = `
|
|
714
714
|
${g}
|
|
715
715
|
|
|
716
716
|
:host {
|
|
@@ -791,7 +791,7 @@ const V = `
|
|
|
791
791
|
color: var(--compa11y-textarea-error-color, #ef4444);
|
|
792
792
|
font-size: var(--compa11y-textarea-error-size, 0.8125rem);
|
|
793
793
|
}
|
|
794
|
-
`,
|
|
794
|
+
`, Vt = `
|
|
795
795
|
${g}
|
|
796
796
|
|
|
797
797
|
:host {
|
|
@@ -906,7 +906,7 @@ const V = `
|
|
|
906
906
|
border-radius: 50%;
|
|
907
907
|
animation: compa11y-spin 0.6s linear infinite;
|
|
908
908
|
}
|
|
909
|
-
`,
|
|
909
|
+
`, Wt = `
|
|
910
910
|
${g}
|
|
911
911
|
|
|
912
912
|
:host {
|
|
@@ -989,7 +989,7 @@ const V = `
|
|
|
989
989
|
:host([aria-selected="true"]) .check-mark {
|
|
990
990
|
visibility: visible;
|
|
991
991
|
}
|
|
992
|
-
`,
|
|
992
|
+
`, Jt = `
|
|
993
993
|
${g}
|
|
994
994
|
|
|
995
995
|
:host {
|
|
@@ -1008,7 +1008,7 @@ const V = `
|
|
|
1008
1008
|
:host([disabled]) {
|
|
1009
1009
|
opacity: 0.5;
|
|
1010
1010
|
}
|
|
1011
|
-
`,
|
|
1011
|
+
`, Qt = `
|
|
1012
1012
|
${g}
|
|
1013
1013
|
|
|
1014
1014
|
:host {
|
|
@@ -1171,7 +1171,7 @@ const V = `
|
|
|
1171
1171
|
color: HighlightText;
|
|
1172
1172
|
}
|
|
1173
1173
|
}
|
|
1174
|
-
`,
|
|
1174
|
+
`, Zt = `
|
|
1175
1175
|
${g}
|
|
1176
1176
|
|
|
1177
1177
|
:host {
|
|
@@ -1213,7 +1213,7 @@ const V = `
|
|
|
1213
1213
|
:host([disabled]) {
|
|
1214
1214
|
opacity: 0.5;
|
|
1215
1215
|
}
|
|
1216
|
-
`,
|
|
1216
|
+
`, te = `
|
|
1217
1217
|
${g}
|
|
1218
1218
|
|
|
1219
1219
|
:host {
|
|
@@ -1266,7 +1266,7 @@ const V = `
|
|
|
1266
1266
|
:host([disabled]) {
|
|
1267
1267
|
opacity: 0.5;
|
|
1268
1268
|
}
|
|
1269
|
-
`,
|
|
1269
|
+
`, ee = `
|
|
1270
1270
|
${g}
|
|
1271
1271
|
|
|
1272
1272
|
:host {
|
|
@@ -1386,7 +1386,7 @@ const V = `
|
|
|
1386
1386
|
background: HighlightText;
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
|
-
`,
|
|
1389
|
+
`, ie = `
|
|
1390
1390
|
${g}
|
|
1391
1391
|
|
|
1392
1392
|
:host {
|
|
@@ -1495,7 +1495,7 @@ const V = `
|
|
|
1495
1495
|
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
1496
1496
|
outline-offset: 2px;
|
|
1497
1497
|
}
|
|
1498
|
-
`,
|
|
1498
|
+
`, se = `
|
|
1499
1499
|
a11y-accordion {
|
|
1500
1500
|
display: block;
|
|
1501
1501
|
border: 1px solid var(--compa11y-accordion-border-color, #e0e0e0);
|
|
@@ -1596,7 +1596,7 @@ const V = `
|
|
|
1596
1596
|
forced-color-adjust: none;
|
|
1597
1597
|
}
|
|
1598
1598
|
}
|
|
1599
|
-
`,
|
|
1599
|
+
`, ae = `
|
|
1600
1600
|
/* ── Host ── */
|
|
1601
1601
|
a11y-table {
|
|
1602
1602
|
display: block;
|
|
@@ -1738,15 +1738,187 @@ const V = `
|
|
|
1738
1738
|
outline: 2px solid Highlight;
|
|
1739
1739
|
}
|
|
1740
1740
|
}
|
|
1741
|
-
`,
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1741
|
+
`, re = `
|
|
1742
|
+
${g}
|
|
1743
|
+
|
|
1744
|
+
:host {
|
|
1745
|
+
display: block;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
/* Visually hidden — live region always in DOM */
|
|
1749
|
+
.sr-only {
|
|
1750
|
+
position: absolute;
|
|
1751
|
+
width: 1px;
|
|
1752
|
+
height: 1px;
|
|
1753
|
+
padding: 0;
|
|
1754
|
+
margin: -1px;
|
|
1755
|
+
overflow: hidden;
|
|
1756
|
+
clip: rect(0, 0, 0, 0);
|
|
1757
|
+
white-space: nowrap;
|
|
1758
|
+
border: 0;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
nav {
|
|
1762
|
+
display: flex;
|
|
1763
|
+
flex-wrap: wrap;
|
|
1764
|
+
align-items: center;
|
|
1765
|
+
gap: var(--compa11y-pagination-gap, 0.5rem);
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
ul {
|
|
1769
|
+
display: flex;
|
|
1770
|
+
flex-wrap: wrap;
|
|
1771
|
+
align-items: center;
|
|
1772
|
+
gap: var(--compa11y-pagination-btn-gap, 2px);
|
|
1773
|
+
list-style: none;
|
|
1774
|
+
padding: 0;
|
|
1775
|
+
margin: 0;
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
[data-compa11y-pagination-btn] {
|
|
1779
|
+
display: inline-flex;
|
|
1780
|
+
align-items: center;
|
|
1781
|
+
justify-content: center;
|
|
1782
|
+
min-width: var(--compa11y-pagination-btn-size, 44px);
|
|
1783
|
+
min-height: var(--compa11y-pagination-btn-size, 44px);
|
|
1784
|
+
padding: var(--compa11y-pagination-btn-padding, 0.25rem 0.5rem);
|
|
1785
|
+
border: var(--compa11y-pagination-btn-border, 1px solid #d1d5db);
|
|
1786
|
+
border-radius: var(--compa11y-pagination-btn-radius, 4px);
|
|
1787
|
+
background: var(--compa11y-pagination-btn-bg, transparent);
|
|
1788
|
+
color: var(--compa11y-pagination-btn-color, inherit);
|
|
1789
|
+
font: inherit;
|
|
1790
|
+
cursor: pointer;
|
|
1791
|
+
user-select: none;
|
|
1792
|
+
transition: background 0.15s ease, border-color 0.15s ease;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
[data-compa11y-pagination-btn]:not([disabled]):hover {
|
|
1796
|
+
background: var(--compa11y-pagination-btn-hover-bg, #f3f4f6);
|
|
1797
|
+
border-color: var(--compa11y-pagination-btn-hover-border, #9ca3af);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
[data-compa11y-pagination-btn]:focus-visible {
|
|
1801
|
+
outline: var(--compa11y-focus-width, 2px) solid
|
|
1802
|
+
var(--compa11y-focus-color, #0066cc);
|
|
1803
|
+
outline-offset: 2px;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
[data-compa11y-pagination-btn][disabled] {
|
|
1807
|
+
opacity: 0.4;
|
|
1808
|
+
cursor: not-allowed;
|
|
1809
|
+
pointer-events: none;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
/* Current page — background + border so color is not the only indicator */
|
|
1813
|
+
[data-compa11y-pagination-page][data-current="true"] {
|
|
1814
|
+
background: var(--compa11y-pagination-current-bg, #0066cc);
|
|
1815
|
+
color: var(--compa11y-pagination-current-color, #fff);
|
|
1816
|
+
border-color: var(--compa11y-pagination-current-bg, #0066cc);
|
|
1817
|
+
font-weight: 600;
|
|
1818
|
+
text-decoration: underline;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
[aria-hidden="true"] span {
|
|
1822
|
+
display: inline-flex;
|
|
1823
|
+
align-items: center;
|
|
1824
|
+
justify-content: center;
|
|
1825
|
+
min-width: var(--compa11y-pagination-btn-size, 44px);
|
|
1826
|
+
min-height: var(--compa11y-pagination-btn-size, 44px);
|
|
1827
|
+
color: var(--compa11y-pagination-ellipsis-color, #9ca3af);
|
|
1828
|
+
user-select: none;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/* Rows-per-page selector */
|
|
1832
|
+
.page-size-wrapper {
|
|
1833
|
+
display: flex;
|
|
1834
|
+
align-items: center;
|
|
1835
|
+
gap: 0.5rem;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
.page-size-wrapper label {
|
|
1839
|
+
white-space: nowrap;
|
|
1840
|
+
font-size: 0.875rem;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
[data-compa11y-pagination-pagesize] {
|
|
1844
|
+
padding: 0.25rem 0.5rem;
|
|
1845
|
+
border: 1px solid #d1d5db;
|
|
1846
|
+
border-radius: 4px;
|
|
1847
|
+
font: inherit;
|
|
1848
|
+
font-size: 0.875rem;
|
|
1849
|
+
background: var(--compa11y-pagination-select-bg, #fff);
|
|
1850
|
+
cursor: pointer;
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
[data-compa11y-pagination-pagesize]:focus-visible {
|
|
1854
|
+
outline: var(--compa11y-focus-width, 2px) solid
|
|
1855
|
+
var(--compa11y-focus-color, #0066cc);
|
|
1856
|
+
outline-offset: 2px;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
/* Jump-to-page input */
|
|
1860
|
+
.jump-wrapper {
|
|
1861
|
+
display: flex;
|
|
1862
|
+
align-items: center;
|
|
1863
|
+
gap: 0.5rem;
|
|
1864
|
+
flex-wrap: wrap;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
.jump-wrapper label {
|
|
1868
|
+
white-space: nowrap;
|
|
1869
|
+
font-size: 0.875rem;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
[data-compa11y-pagination-jump] {
|
|
1873
|
+
width: 5rem;
|
|
1874
|
+
padding: 0.25rem 0.5rem;
|
|
1875
|
+
border: 1px solid #d1d5db;
|
|
1876
|
+
border-radius: 4px;
|
|
1877
|
+
font: inherit;
|
|
1878
|
+
font-size: 0.875rem;
|
|
1879
|
+
background: var(--compa11y-pagination-input-bg, #fff);
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
[data-compa11y-pagination-jump]:focus-visible {
|
|
1883
|
+
outline: var(--compa11y-focus-width, 2px) solid
|
|
1884
|
+
var(--compa11y-focus-color, #0066cc);
|
|
1885
|
+
outline-offset: 2px;
|
|
1886
|
+
border-color: var(--compa11y-focus-color, #0066cc);
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
[data-compa11y-pagination-error] {
|
|
1890
|
+
color: var(--compa11y-pagination-error-color, #dc2626);
|
|
1891
|
+
font-size: 0.75rem;
|
|
1892
|
+
width: 100%;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
/* Reduced motion */
|
|
1896
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1897
|
+
[data-compa11y-pagination-btn] {
|
|
1898
|
+
transition: none !important;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
/* Forced colours / high contrast */
|
|
1903
|
+
@media (forced-colors: active) {
|
|
1904
|
+
[data-compa11y-pagination-page][data-current="true"] {
|
|
1905
|
+
border: 2px solid ButtonText;
|
|
1906
|
+
forced-color-adjust: none;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
[data-compa11y-pagination-btn]:focus-visible {
|
|
1910
|
+
outline: 2px solid Highlight;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
`, M = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1914
|
+
let L = 0, V = "";
|
|
1915
|
+
function oe() {
|
|
1916
|
+
L === 0 && (V = document.body.style.overflow, document.body.style.overflow = "hidden"), L++;
|
|
1745
1917
|
}
|
|
1746
|
-
function
|
|
1747
|
-
L--, L <= 0 && (L = 0, document.body.style.overflow =
|
|
1918
|
+
function ne() {
|
|
1919
|
+
L--, L <= 0 && (L = 0, document.body.style.overflow = V);
|
|
1748
1920
|
}
|
|
1749
|
-
class
|
|
1921
|
+
class W extends u {
|
|
1750
1922
|
constructor() {
|
|
1751
1923
|
super(...arguments), this._open = !1, this._previouslyFocused = null, this._triggerElement = null, this.handleTriggerClick = () => {
|
|
1752
1924
|
this.open = !0;
|
|
@@ -1847,7 +2019,7 @@ class X extends u {
|
|
|
1847
2019
|
*/
|
|
1848
2020
|
getFocusableElements() {
|
|
1849
2021
|
const t = [];
|
|
1850
|
-
return this.querySelectorAll(
|
|
2022
|
+
return this.querySelectorAll(M).forEach((i) => t.push(i)), this.shadowRoot && this.shadowRoot.querySelectorAll(M).forEach((s) => {
|
|
1851
2023
|
s.classList.contains("overlay") || t.push(s);
|
|
1852
2024
|
}), t;
|
|
1853
2025
|
}
|
|
@@ -1855,11 +2027,11 @@ class X extends u {
|
|
|
1855
2027
|
this._previouslyFocused = document.activeElement, this.style.display = "flex", requestAnimationFrame(() => {
|
|
1856
2028
|
const e = this.getFocusableElements()[0];
|
|
1857
2029
|
e && e.focus();
|
|
1858
|
-
}),
|
|
2030
|
+
}), oe(), v("Dialog opened", { politeness: "polite" }), this.emit("a11y-dialog-open");
|
|
1859
2031
|
}
|
|
1860
2032
|
hideDialog() {
|
|
1861
2033
|
var t;
|
|
1862
|
-
this.style.display = "none",
|
|
2034
|
+
this.style.display = "none", ne(), (t = this._previouslyFocused) == null || t.focus(), this._previouslyFocused = null, v("Dialog closed", { politeness: "polite" }), this.emit("a11y-dialog-close");
|
|
1863
2035
|
}
|
|
1864
2036
|
/**
|
|
1865
2037
|
* Programmatic open
|
|
@@ -1874,8 +2046,8 @@ class X extends u {
|
|
|
1874
2046
|
this.open = !1;
|
|
1875
2047
|
}
|
|
1876
2048
|
}
|
|
1877
|
-
|
|
1878
|
-
class
|
|
2049
|
+
p("a11y-dialog", W);
|
|
2050
|
+
class X extends u {
|
|
1879
2051
|
constructor() {
|
|
1880
2052
|
super(...arguments), this._open = !1, this._highlightedIndex = -1, this._menuItems = [], this._triggerEl = null, this._triggerSlotEl = null, this._defaultSlotEl = null, this.updateMenuItems = () => {
|
|
1881
2053
|
this._menuItems = Array.from(
|
|
@@ -1965,7 +2137,7 @@ class W extends u {
|
|
|
1965
2137
|
render() {
|
|
1966
2138
|
const t = this.attachShadow({ mode: "open" });
|
|
1967
2139
|
t.innerHTML = `
|
|
1968
|
-
<style>${
|
|
2140
|
+
<style>${Ft}</style>
|
|
1969
2141
|
<slot name="trigger"></slot>
|
|
1970
2142
|
<div
|
|
1971
2143
|
class="menu-content"
|
|
@@ -2040,7 +2212,7 @@ class W extends u {
|
|
|
2040
2212
|
this.open = !this._open;
|
|
2041
2213
|
}
|
|
2042
2214
|
}
|
|
2043
|
-
|
|
2215
|
+
p("a11y-menu", X);
|
|
2044
2216
|
class J extends u {
|
|
2045
2217
|
constructor() {
|
|
2046
2218
|
super(...arguments), this._tabs = [], this._panels = [], this._selectedIndex = 0, this._focusedIndex = 0, this._tabSlotEl = null, this._panelSlotEl = null, this._defaultSlotEl = null, this.updateTabsAndPanels = () => {
|
|
@@ -2107,7 +2279,7 @@ class J extends u {
|
|
|
2107
2279
|
render() {
|
|
2108
2280
|
const t = this.attachShadow({ mode: "open" });
|
|
2109
2281
|
t.innerHTML = `
|
|
2110
|
-
<style>${
|
|
2282
|
+
<style>${Kt}</style>
|
|
2111
2283
|
<div class="tablist" role="tablist" aria-orientation="${this.orientation}" part="tablist">
|
|
2112
2284
|
<slot name="tab"></slot>
|
|
2113
2285
|
</div>
|
|
@@ -2173,7 +2345,7 @@ class J extends u {
|
|
|
2173
2345
|
);
|
|
2174
2346
|
}
|
|
2175
2347
|
}
|
|
2176
|
-
|
|
2348
|
+
p("a11y-tabs", J);
|
|
2177
2349
|
class Q extends u {
|
|
2178
2350
|
constructor() {
|
|
2179
2351
|
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 = () => {
|
|
@@ -2266,7 +2438,7 @@ class Q extends u {
|
|
|
2266
2438
|
render() {
|
|
2267
2439
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-input`, i = `${this._id}-listbox`, s = this.getAttribute("placeholder") || "Search...", a = this.hasAttribute("clearable");
|
|
2268
2440
|
t.innerHTML = `
|
|
2269
|
-
<style>${
|
|
2441
|
+
<style>${Nt}</style>
|
|
2270
2442
|
<div class="combobox-wrapper" part="wrapper">
|
|
2271
2443
|
<div class="input-wrapper" part="input-wrapper">
|
|
2272
2444
|
<input
|
|
@@ -2399,7 +2571,7 @@ class Q extends u {
|
|
|
2399
2571
|
this.handleClear();
|
|
2400
2572
|
}
|
|
2401
2573
|
}
|
|
2402
|
-
|
|
2574
|
+
p("a11y-combobox", Q);
|
|
2403
2575
|
class Z extends u {
|
|
2404
2576
|
constructor() {
|
|
2405
2577
|
super(...arguments), this._checked = !1, this._button = null, this._label = null, this.handleClick = () => {
|
|
@@ -2462,7 +2634,7 @@ class Z extends u {
|
|
|
2462
2634
|
render() {
|
|
2463
2635
|
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}"` : "";
|
|
2464
2636
|
t.innerHTML = `
|
|
2465
|
-
<style>${
|
|
2637
|
+
<style>${Yt}</style>
|
|
2466
2638
|
<div class="switch-wrapper size-${this.size}" part="wrapper">
|
|
2467
2639
|
<button
|
|
2468
2640
|
type="button"
|
|
@@ -2542,7 +2714,7 @@ class Z extends u {
|
|
|
2542
2714
|
this.checked = t;
|
|
2543
2715
|
}
|
|
2544
2716
|
}
|
|
2545
|
-
|
|
2717
|
+
p("a11y-switch", Z);
|
|
2546
2718
|
class tt extends u {
|
|
2547
2719
|
constructor() {
|
|
2548
2720
|
super(...arguments), this._open = !1, this._highlightedIndex = -1, this._options = [], this._selectedValue = null, this._triggerElement = null, this._listboxElement = null, this._typeAhead = null, this.updateOptions = () => {
|
|
@@ -2552,7 +2724,7 @@ class tt extends u {
|
|
|
2552
2724
|
label: e.textContent || "",
|
|
2553
2725
|
disabled: e.hasAttribute("disabled"),
|
|
2554
2726
|
element: e
|
|
2555
|
-
})), this._typeAhead =
|
|
2727
|
+
})), this._typeAhead = R(
|
|
2556
2728
|
this._options.map((e) => e.label),
|
|
2557
2729
|
{ timeout: 500 }
|
|
2558
2730
|
), this.renderOptions(), this.updateTriggerText();
|
|
@@ -2643,7 +2815,7 @@ class tt extends u {
|
|
|
2643
2815
|
render() {
|
|
2644
2816
|
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") || "";
|
|
2645
2817
|
t.innerHTML = `
|
|
2646
|
-
<style>${
|
|
2818
|
+
<style>${jt}</style>
|
|
2647
2819
|
<div class="select-wrapper" part="wrapper">
|
|
2648
2820
|
<button
|
|
2649
2821
|
id="${e}"
|
|
@@ -2794,7 +2966,7 @@ class tt extends u {
|
|
|
2794
2966
|
this.open = !1;
|
|
2795
2967
|
}
|
|
2796
2968
|
}
|
|
2797
|
-
|
|
2969
|
+
p("a11y-select", tt);
|
|
2798
2970
|
class et extends u {
|
|
2799
2971
|
constructor() {
|
|
2800
2972
|
super(...arguments), this._value = "", this._inputEl = null, this._labelEl = null, this._hintEl = null, this._errorEl = null, this.handleInput = (t) => {
|
|
@@ -2875,11 +3047,11 @@ class et extends u {
|
|
|
2875
3047
|
));
|
|
2876
3048
|
}
|
|
2877
3049
|
render() {
|
|
2878
|
-
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") || "", o = this.getAttribute("hint") || "", n = this.getAttribute("error") || "", d = this.getAttribute("type") || "text",
|
|
3050
|
+
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") || "", o = this.getAttribute("hint") || "", n = this.getAttribute("error") || "", d = this.getAttribute("type") || "text", h = this.getAttribute("placeholder") || "", c = this.getAttribute("name") || "", b = this.getAttribute("autocomplete") || "", m = this.getAttribute("maxlength"), _ = this.getAttribute("minlength"), y = this.getAttribute("pattern"), S = this.getAttribute("inputmode"), I = this.getAttribute("aria-label") || "", T = this.getAttribute("aria-labelledby") || "", C = this.disabled, A = this.readOnly, x = this.required, E = !!n, k = [];
|
|
2879
3051
|
o && k.push(s), E && k.push(a);
|
|
2880
|
-
const D = k.length ? `aria-describedby="${k.join(" ")}"` : "",
|
|
3052
|
+
const D = k.length ? `aria-describedby="${k.join(" ")}"` : "", $ = !r && I ? `aria-label="${I}"` : "", kt = !r && T ? `aria-labelledby="${T}"` : r ? `aria-labelledby="${i}"` : "";
|
|
2881
3053
|
this.setAttribute("data-error", E ? "true" : "false"), t.innerHTML = `
|
|
2882
|
-
<style>${
|
|
3054
|
+
<style>${Ut}</style>
|
|
2883
3055
|
<div class="input-wrapper" part="wrapper">
|
|
2884
3056
|
${r ? `<label id="${i}" for="${e}" class="input-label" part="label">
|
|
2885
3057
|
${r}${x ? '<span class="input-required" aria-hidden="true" part="required">*</span>' : ""}
|
|
@@ -2888,19 +3060,19 @@ class et extends u {
|
|
|
2888
3060
|
id="${e}"
|
|
2889
3061
|
type="${d}"
|
|
2890
3062
|
value="${this._value}"
|
|
2891
|
-
${
|
|
2892
|
-
${
|
|
2893
|
-
${
|
|
3063
|
+
${h ? `placeholder="${h}"` : ""}
|
|
3064
|
+
${c ? `name="${c}"` : ""}
|
|
3065
|
+
${b ? `autocomplete="${b}"` : ""}
|
|
2894
3066
|
${m ? `maxlength="${m}"` : ""}
|
|
2895
3067
|
${_ ? `minlength="${_}"` : ""}
|
|
2896
3068
|
${y ? `pattern="${y}"` : ""}
|
|
2897
|
-
${
|
|
2898
|
-
${
|
|
2899
|
-
${
|
|
3069
|
+
${S ? `inputmode="${S}"` : ""}
|
|
3070
|
+
${$}
|
|
3071
|
+
${kt}
|
|
2900
3072
|
${D}
|
|
2901
3073
|
${E ? 'aria-invalid="true"' : ""}
|
|
2902
3074
|
${x ? 'aria-required="true"' : ""}
|
|
2903
|
-
${
|
|
3075
|
+
${C ? "disabled" : ""}
|
|
2904
3076
|
${A ? "readonly" : ""}
|
|
2905
3077
|
part="field"
|
|
2906
3078
|
/>
|
|
@@ -2983,7 +3155,7 @@ class et extends u {
|
|
|
2983
3155
|
const s = `${this._id}-error`, a = document.createElement("div");
|
|
2984
3156
|
a.id = s, a.className = "input-error", a.setAttribute("role", "alert"), a.setAttribute("part", "error"), a.textContent = t;
|
|
2985
3157
|
const r = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".input-wrapper");
|
|
2986
|
-
r == null || r.appendChild(a), this._errorEl = a,
|
|
3158
|
+
r == null || r.appendChild(a), this._errorEl = a, O(t);
|
|
2987
3159
|
}
|
|
2988
3160
|
this.updateAriaDescribedBy();
|
|
2989
3161
|
} else
|
|
@@ -3036,7 +3208,7 @@ class et extends u {
|
|
|
3036
3208
|
(t = this._inputEl) == null || t.select();
|
|
3037
3209
|
}
|
|
3038
3210
|
}
|
|
3039
|
-
|
|
3211
|
+
p("a11y-input", et);
|
|
3040
3212
|
class it extends u {
|
|
3041
3213
|
constructor() {
|
|
3042
3214
|
super(...arguments), this._value = "", this._textareaEl = null, this._labelEl = null, this._hintEl = null, this._errorEl = null, this.handleInput = (t) => {
|
|
@@ -3116,38 +3288,38 @@ class it extends u {
|
|
|
3116
3288
|
));
|
|
3117
3289
|
}
|
|
3118
3290
|
render() {
|
|
3119
|
-
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") || "", o = this.getAttribute("hint") || "", n = this.getAttribute("error") || "", d = this.getAttribute("rows") || "3",
|
|
3291
|
+
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") || "", o = this.getAttribute("hint") || "", n = this.getAttribute("error") || "", d = this.getAttribute("rows") || "3", h = this.getAttribute("placeholder") || "", c = this.getAttribute("name") || "", b = this.getAttribute("autocomplete") || "", m = this.getAttribute("maxlength"), _ = this.getAttribute("minlength"), y = this.getAttribute("aria-label") || "", S = this.getAttribute("aria-labelledby") || "", I = this.disabled, T = this.readOnly, C = this.required, A = !!n, x = [];
|
|
3120
3292
|
o && x.push(s), A && x.push(a);
|
|
3121
|
-
const E = x.length ? `aria-describedby="${x.join(" ")}"` : "", k = !r && y ? `aria-label="${y}"` : "", D = !r &&
|
|
3293
|
+
const E = x.length ? `aria-describedby="${x.join(" ")}"` : "", k = !r && y ? `aria-label="${y}"` : "", D = !r && S ? `aria-labelledby="${S}"` : r ? `aria-labelledby="${i}"` : "";
|
|
3122
3294
|
this.setAttribute("data-error", A ? "true" : "false"), t.innerHTML = `
|
|
3123
|
-
<style>${
|
|
3295
|
+
<style>${Gt}</style>
|
|
3124
3296
|
<div class="textarea-wrapper" part="wrapper">
|
|
3125
3297
|
${r ? `<label id="${i}" for="${e}" class="textarea-label" part="label">
|
|
3126
|
-
${r}${
|
|
3298
|
+
${r}${C ? '<span class="textarea-required" aria-hidden="true" part="required">*</span>' : ""}
|
|
3127
3299
|
</label>` : ""}
|
|
3128
3300
|
<textarea
|
|
3129
3301
|
id="${e}"
|
|
3130
3302
|
rows="${d}"
|
|
3131
|
-
${
|
|
3132
|
-
${
|
|
3133
|
-
${
|
|
3303
|
+
${h ? `placeholder="${h}"` : ""}
|
|
3304
|
+
${c ? `name="${c}"` : ""}
|
|
3305
|
+
${b ? `autocomplete="${b}"` : ""}
|
|
3134
3306
|
${m ? `maxlength="${m}"` : ""}
|
|
3135
3307
|
${_ ? `minlength="${_}"` : ""}
|
|
3136
3308
|
${k}
|
|
3137
3309
|
${D}
|
|
3138
3310
|
${E}
|
|
3139
3311
|
${A ? 'aria-invalid="true"' : ""}
|
|
3140
|
-
${
|
|
3312
|
+
${C ? 'aria-required="true"' : ""}
|
|
3141
3313
|
${I ? "disabled" : ""}
|
|
3142
|
-
${
|
|
3314
|
+
${T ? "readonly" : ""}
|
|
3143
3315
|
part="field"
|
|
3144
3316
|
>${this._value}</textarea>
|
|
3145
3317
|
${o ? `<div id="${s}" class="textarea-hint" part="hint">${o}</div>` : ""}
|
|
3146
3318
|
${A ? `<div id="${a}" class="textarea-error" role="alert" part="error">${n}</div>` : ""}
|
|
3147
3319
|
</div>
|
|
3148
3320
|
`, this._textareaEl = t.querySelector("textarea"), this._labelEl = t.querySelector("label"), this._hintEl = t.querySelector(".textarea-hint"), this._errorEl = t.querySelector(".textarea-error");
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3321
|
+
const $ = this.getAttribute("value");
|
|
3322
|
+
$ && this._textareaEl && (this._value = $, this._textareaEl.value = $);
|
|
3151
3323
|
}
|
|
3152
3324
|
setupEventListeners() {
|
|
3153
3325
|
var t, e, i, s;
|
|
@@ -3218,7 +3390,7 @@ class it extends u {
|
|
|
3218
3390
|
const s = `${this._id}-error`, a = document.createElement("div");
|
|
3219
3391
|
a.id = s, a.className = "textarea-error", a.setAttribute("role", "alert"), a.setAttribute("part", "error"), a.textContent = t;
|
|
3220
3392
|
const r = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".textarea-wrapper");
|
|
3221
|
-
r == null || r.appendChild(a), this._errorEl = a,
|
|
3393
|
+
r == null || r.appendChild(a), this._errorEl = a, O(t);
|
|
3222
3394
|
}
|
|
3223
3395
|
this.updateAriaDescribedBy();
|
|
3224
3396
|
} else
|
|
@@ -3271,7 +3443,7 @@ class it extends u {
|
|
|
3271
3443
|
(t = this._textareaEl) == null || t.select();
|
|
3272
3444
|
}
|
|
3273
3445
|
}
|
|
3274
|
-
|
|
3446
|
+
p("a11y-textarea", it);
|
|
3275
3447
|
class st extends u {
|
|
3276
3448
|
constructor() {
|
|
3277
3449
|
super(...arguments), this._buttonEl = null, this.handleClick = (t) => {
|
|
@@ -3337,13 +3509,13 @@ class st extends u {
|
|
|
3337
3509
|
));
|
|
3338
3510
|
}
|
|
3339
3511
|
render() {
|
|
3340
|
-
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, o = this.discoverable, n = this.loading, d = r || n,
|
|
3512
|
+
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, o = this.discoverable, n = this.loading, d = r || n, h = r && !o;
|
|
3341
3513
|
t.innerHTML = `
|
|
3342
|
-
<style>${
|
|
3514
|
+
<style>${Vt}</style>
|
|
3343
3515
|
<button
|
|
3344
3516
|
class="variant-${e} size-${i}"
|
|
3345
3517
|
type="${s}"
|
|
3346
|
-
${
|
|
3518
|
+
${h ? "disabled" : ""}
|
|
3347
3519
|
${d ? 'aria-disabled="true"' : ""}
|
|
3348
3520
|
${n ? 'aria-busy="true"' : ""}
|
|
3349
3521
|
${a ? `aria-label="${a}"` : ""}
|
|
@@ -3428,7 +3600,7 @@ class st extends u {
|
|
|
3428
3600
|
(t = this._buttonEl) == null || t.click();
|
|
3429
3601
|
}
|
|
3430
3602
|
}
|
|
3431
|
-
|
|
3603
|
+
p("a11y-button", st);
|
|
3432
3604
|
class at extends u {
|
|
3433
3605
|
constructor() {
|
|
3434
3606
|
super(...arguments), this._label = "", this._disabled = !1;
|
|
@@ -3456,7 +3628,7 @@ class at extends u {
|
|
|
3456
3628
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
3457
3629
|
const t = `${this._id}-label`;
|
|
3458
3630
|
this.shadowRoot.innerHTML = `
|
|
3459
|
-
<style>${
|
|
3631
|
+
<style>${Jt}</style>
|
|
3460
3632
|
<div class="optgroup-wrapper" part="group">
|
|
3461
3633
|
<div class="optgroup-label" part="label" id="${t}" role="presentation">
|
|
3462
3634
|
${this._label}
|
|
@@ -3633,9 +3805,9 @@ class ot extends u {
|
|
|
3633
3805
|
const n = (a = this._typeAhead) == null ? void 0 : a.type(t.key);
|
|
3634
3806
|
if (n) {
|
|
3635
3807
|
const d = e.findIndex(
|
|
3636
|
-
(
|
|
3637
|
-
var
|
|
3638
|
-
return (((
|
|
3808
|
+
(h) => {
|
|
3809
|
+
var c;
|
|
3810
|
+
return (((c = h.textContent) == null ? void 0 : c.trim()) || "") === n && !h.effectivelyDisabled;
|
|
3639
3811
|
}
|
|
3640
3812
|
);
|
|
3641
3813
|
d >= 0 && (i = d, s = !0);
|
|
@@ -3662,9 +3834,9 @@ class ot extends u {
|
|
|
3662
3834
|
const n = (r = this._typeAhead) == null ? void 0 : r.type(t.key);
|
|
3663
3835
|
if (n) {
|
|
3664
3836
|
const d = e.findIndex(
|
|
3665
|
-
(
|
|
3666
|
-
var
|
|
3667
|
-
return (((
|
|
3837
|
+
(h) => {
|
|
3838
|
+
var c;
|
|
3839
|
+
return (((c = h.textContent) == null ? void 0 : c.trim()) || "") === n && !h.effectivelyDisabled;
|
|
3668
3840
|
}
|
|
3669
3841
|
);
|
|
3670
3842
|
d >= 0 && (i = d, s = !0);
|
|
@@ -3678,8 +3850,8 @@ class ot extends u {
|
|
|
3678
3850
|
if (!this._multiple && n)
|
|
3679
3851
|
this.selectSingle(n);
|
|
3680
3852
|
else if (n) {
|
|
3681
|
-
const d = ((o = n.textContent) == null ? void 0 : o.trim()) || n.value,
|
|
3682
|
-
f(`${d}${
|
|
3853
|
+
const d = ((o = n.textContent) == null ? void 0 : o.trim()) || n.value, h = this._values.has(n.value);
|
|
3854
|
+
f(`${d}${h ? ", selected" : ""}`);
|
|
3683
3855
|
}
|
|
3684
3856
|
}
|
|
3685
3857
|
};
|
|
@@ -3749,7 +3921,7 @@ class ot extends u {
|
|
|
3749
3921
|
}
|
|
3750
3922
|
render() {
|
|
3751
3923
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
3752
|
-
<style>${
|
|
3924
|
+
<style>${Wt}</style>
|
|
3753
3925
|
<div class="listbox-wrapper" part="wrapper">
|
|
3754
3926
|
<slot></slot>
|
|
3755
3927
|
</div>
|
|
@@ -3856,7 +4028,7 @@ class ot extends u {
|
|
|
3856
4028
|
return ((i = e.textContent) == null ? void 0 : i.trim()) || "";
|
|
3857
4029
|
}
|
|
3858
4030
|
);
|
|
3859
|
-
this._typeAhead =
|
|
4031
|
+
this._typeAhead = R(t, { timeout: 500 });
|
|
3860
4032
|
}
|
|
3861
4033
|
// ===== Attribute Changes =====
|
|
3862
4034
|
onAttributeChange(t, e, i) {
|
|
@@ -3881,12 +4053,12 @@ class ot extends u {
|
|
|
3881
4053
|
}
|
|
3882
4054
|
}
|
|
3883
4055
|
}
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
const
|
|
4056
|
+
p("a11y-optgroup", at);
|
|
4057
|
+
p("a11y-option", rt);
|
|
4058
|
+
p("a11y-listbox", ot);
|
|
4059
|
+
const le = `<svg class="checkbox-check" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
|
3888
4060
|
<path d="M2.5 6L5 8.5L9.5 3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3889
|
-
</svg>`,
|
|
4061
|
+
</svg>`, de = `<svg class="checkbox-dash" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
|
3890
4062
|
<path d="M3 6H9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
3891
4063
|
</svg>`;
|
|
3892
4064
|
class H extends u {
|
|
@@ -4006,18 +4178,18 @@ class H extends u {
|
|
|
4006
4178
|
);
|
|
4007
4179
|
}
|
|
4008
4180
|
render() {
|
|
4009
|
-
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, o = !!this.hint, n = !!this.error, d = this.getAttribute("aria-label"),
|
|
4010
|
-
|
|
4011
|
-
const m =
|
|
4181
|
+
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, o = !!this.hint, n = !!this.error, d = this.getAttribute("aria-label"), h = this.getAttribute("name") || "", c = this.getAttribute("aria-describedby") || "", b = [];
|
|
4182
|
+
c && b.push(c), o && b.push(s), n && b.push(a);
|
|
4183
|
+
const m = b.length ? `aria-describedby="${b.join(" ")}"` : "", _ = !r && d ? `aria-label="${d}"` : "";
|
|
4012
4184
|
t.innerHTML = `
|
|
4013
|
-
<style>${
|
|
4185
|
+
<style>${Qt}</style>
|
|
4014
4186
|
<div class="checkbox-wrapper size-${this.size}" part="wrapper">
|
|
4015
4187
|
<div class="checkbox-control">
|
|
4016
4188
|
<input
|
|
4017
4189
|
type="checkbox"
|
|
4018
4190
|
class="checkbox-input"
|
|
4019
4191
|
id="${e}"
|
|
4020
|
-
${
|
|
4192
|
+
${h ? `name="${h}"` : ""}
|
|
4021
4193
|
${this.value ? `value="${this.value}"` : ""}
|
|
4022
4194
|
${this._checked ? "checked" : ""}
|
|
4023
4195
|
${this.disabled ? "disabled" : ""}
|
|
@@ -4028,8 +4200,8 @@ class H extends u {
|
|
|
4028
4200
|
part="input"
|
|
4029
4201
|
/>
|
|
4030
4202
|
<div class="checkbox-indicator" part="indicator" aria-hidden="true">
|
|
4031
|
-
${
|
|
4032
|
-
${
|
|
4203
|
+
${le}
|
|
4204
|
+
${de}
|
|
4033
4205
|
</div>
|
|
4034
4206
|
</div>
|
|
4035
4207
|
${r || o || n ? `<div class="checkbox-content">
|
|
@@ -4183,7 +4355,7 @@ class nt extends u {
|
|
|
4183
4355
|
render() {
|
|
4184
4356
|
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");
|
|
4185
4357
|
t.innerHTML = `
|
|
4186
|
-
<style>${
|
|
4358
|
+
<style>${Zt}</style>
|
|
4187
4359
|
<fieldset
|
|
4188
4360
|
part="fieldset"
|
|
4189
4361
|
${a ? `aria-label="${a}"` : ""}
|
|
@@ -4249,8 +4421,8 @@ class nt extends u {
|
|
|
4249
4421
|
t && (this.disabled ? t.setAttribute("disabled", "") : t.removeAttribute("disabled"));
|
|
4250
4422
|
}
|
|
4251
4423
|
}
|
|
4252
|
-
|
|
4253
|
-
|
|
4424
|
+
p("a11y-checkbox", H);
|
|
4425
|
+
p("a11y-checkbox-group", nt);
|
|
4254
4426
|
class lt extends u {
|
|
4255
4427
|
constructor() {
|
|
4256
4428
|
super(...arguments), this._value = "", this._disabled = !1, this._discoverable = !0, this._orientation = "vertical", this._required = !1, this._name = "", this.handleRadioSelect = (t) => {
|
|
@@ -4377,7 +4549,7 @@ class lt extends u {
|
|
|
4377
4549
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4378
4550
|
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` : "", o = [a, r].filter(Boolean).join(" ");
|
|
4379
4551
|
o ? this.setAttribute("aria-describedby", o) : this.removeAttribute("aria-describedby"), t.innerHTML = `
|
|
4380
|
-
<style>${
|
|
4552
|
+
<style>${te}</style>
|
|
4381
4553
|
<fieldset part="fieldset">
|
|
4382
4554
|
${e ? `<legend part="legend">${e}${this._required ? '<span class="radio-group-required" aria-hidden="true"> *</span>' : ""}</legend>` : ""}
|
|
4383
4555
|
<div class="radio-group-items" part="items">
|
|
@@ -4527,7 +4699,7 @@ class dt extends u {
|
|
|
4527
4699
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4528
4700
|
const t = this.shadowRoot, e = this.getAttribute("label") || "", i = this.getAttribute("hint") || "", s = e ? `${this._id}-label` : "", a = i ? `${this._id}-hint` : "";
|
|
4529
4701
|
s && this.setAttribute("aria-labelledby", s), a && this.setAttribute("aria-describedby", a), t.innerHTML = `
|
|
4530
|
-
<style>${
|
|
4702
|
+
<style>${ee}</style>
|
|
4531
4703
|
<div class="radio-wrapper" part="wrapper">
|
|
4532
4704
|
<div class="radio-control" part="control">
|
|
4533
4705
|
<input
|
|
@@ -4588,9 +4760,9 @@ class dt extends u {
|
|
|
4588
4760
|
}
|
|
4589
4761
|
}
|
|
4590
4762
|
}
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
class
|
|
4763
|
+
p("a11y-radio-group", lt);
|
|
4764
|
+
p("a11y-radio", dt);
|
|
4765
|
+
class ct extends u {
|
|
4594
4766
|
constructor() {
|
|
4595
4767
|
super(...arguments), this._toasts = [], this._counter = 0, this._containerEl = null, this._maxToasts = 5, this._handleClick = (t) => {
|
|
4596
4768
|
var a;
|
|
@@ -4628,7 +4800,7 @@ class ht extends u {
|
|
|
4628
4800
|
render() {
|
|
4629
4801
|
const t = this.attachShadow({ mode: "open" });
|
|
4630
4802
|
t.innerHTML = `
|
|
4631
|
-
<style>${
|
|
4803
|
+
<style>${ie}</style>
|
|
4632
4804
|
<div
|
|
4633
4805
|
class="toast-container"
|
|
4634
4806
|
role="region"
|
|
@@ -4728,8 +4900,8 @@ class ht extends u {
|
|
|
4728
4900
|
return e.textContent = t, e.innerHTML;
|
|
4729
4901
|
}
|
|
4730
4902
|
}
|
|
4731
|
-
|
|
4732
|
-
class
|
|
4903
|
+
p("a11y-toast", ct);
|
|
4904
|
+
class ht extends u {
|
|
4733
4905
|
static get observedAttributes() {
|
|
4734
4906
|
return ["focusable"];
|
|
4735
4907
|
}
|
|
@@ -4739,7 +4911,7 @@ class ct extends u {
|
|
|
4739
4911
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
4740
4912
|
<style>
|
|
4741
4913
|
:host {
|
|
4742
|
-
${
|
|
4914
|
+
${U}
|
|
4743
4915
|
}
|
|
4744
4916
|
|
|
4745
4917
|
:host([hidden]) {
|
|
@@ -4767,8 +4939,8 @@ class ct extends u {
|
|
|
4767
4939
|
cleanupEventListeners() {
|
|
4768
4940
|
}
|
|
4769
4941
|
}
|
|
4770
|
-
|
|
4771
|
-
const
|
|
4942
|
+
p("a11y-visually-hidden", ht);
|
|
4943
|
+
const ce = w("SkipLink");
|
|
4772
4944
|
class ut extends u {
|
|
4773
4945
|
constructor() {
|
|
4774
4946
|
super(...arguments), this.handleClick = (t) => {
|
|
@@ -4780,7 +4952,7 @@ class ut extends u {
|
|
|
4780
4952
|
return ["target", "label"];
|
|
4781
4953
|
}
|
|
4782
4954
|
setupAccessibility() {
|
|
4783
|
-
this.getAttribute("target") ||
|
|
4955
|
+
this.getAttribute("target") || ce.warning(
|
|
4784
4956
|
'Missing "target" attribute. Provide a CSS selector (e.g. target="#main-content") pointing to the skip destination.'
|
|
4785
4957
|
);
|
|
4786
4958
|
}
|
|
@@ -4798,7 +4970,7 @@ class ut extends u {
|
|
|
4798
4970
|
}
|
|
4799
4971
|
|
|
4800
4972
|
.skip-link {
|
|
4801
|
-
${
|
|
4973
|
+
${U}
|
|
4802
4974
|
display: inline-block;
|
|
4803
4975
|
text-decoration: none;
|
|
4804
4976
|
}
|
|
@@ -4848,8 +5020,8 @@ class ut extends u {
|
|
|
4848
5020
|
(t === "target" || t === "label") && this.render();
|
|
4849
5021
|
}
|
|
4850
5022
|
}
|
|
4851
|
-
|
|
4852
|
-
const
|
|
5023
|
+
p("a11y-skip-link", ut);
|
|
5024
|
+
const he = w("Alert"), ue = `
|
|
4853
5025
|
:host {
|
|
4854
5026
|
display: block;
|
|
4855
5027
|
box-sizing: border-box;
|
|
@@ -4984,7 +5156,7 @@ const de = $("Alert"), he = `
|
|
|
4984
5156
|
error: "❌"
|
|
4985
5157
|
// ❌
|
|
4986
5158
|
};
|
|
4987
|
-
class
|
|
5159
|
+
class pt extends u {
|
|
4988
5160
|
constructor() {
|
|
4989
5161
|
super(...arguments), this._closeButton = null, this.handleDismiss = () => {
|
|
4990
5162
|
this.emit("dismiss", { type: this.alertType }), this.remove();
|
|
@@ -5007,7 +5179,7 @@ class bt extends u {
|
|
|
5007
5179
|
}
|
|
5008
5180
|
setupAccessibility() {
|
|
5009
5181
|
const t = ["info", "success", "warning", "error"], e = this.getAttribute("type");
|
|
5010
|
-
e && !t.includes(e) &&
|
|
5182
|
+
e && !t.includes(e) && he.warning(
|
|
5011
5183
|
`Invalid type="${e}". Use one of: ${t.join(", ")}.`
|
|
5012
5184
|
);
|
|
5013
5185
|
}
|
|
@@ -5015,7 +5187,7 @@ class bt extends u {
|
|
|
5015
5187
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5016
5188
|
const t = this.getAttribute("title"), e = this.hasAttribute("dismissible"), i = F[this.alertType] || F.info;
|
|
5017
5189
|
this.shadowRoot.innerHTML = `
|
|
5018
|
-
<style>${
|
|
5190
|
+
<style>${ue}</style>
|
|
5019
5191
|
<div
|
|
5020
5192
|
class="alert"
|
|
5021
5193
|
role="${this.alertRole}"
|
|
@@ -5056,8 +5228,8 @@ class bt extends u {
|
|
|
5056
5228
|
this.handleDismiss();
|
|
5057
5229
|
}
|
|
5058
5230
|
}
|
|
5059
|
-
|
|
5060
|
-
const
|
|
5231
|
+
p("a11y-alert", pt);
|
|
5232
|
+
const pe = `
|
|
5061
5233
|
:host {
|
|
5062
5234
|
display: inline;
|
|
5063
5235
|
}
|
|
@@ -5123,7 +5295,7 @@ const ce = `
|
|
|
5123
5295
|
}
|
|
5124
5296
|
}
|
|
5125
5297
|
`;
|
|
5126
|
-
class
|
|
5298
|
+
class bt extends u {
|
|
5127
5299
|
static get observedAttributes() {
|
|
5128
5300
|
return ["href", "external", "current", "disabled"];
|
|
5129
5301
|
}
|
|
@@ -5139,7 +5311,7 @@ class pt extends u {
|
|
|
5139
5311
|
<line x1="10" y1="14" x2="21" y2="3"/>
|
|
5140
5312
|
</svg>` : "", o = e ? '<span class="sr-only" style="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;">(opens in new tab)</span>' : "";
|
|
5141
5313
|
this.shadowRoot.innerHTML = `
|
|
5142
|
-
<style>${
|
|
5314
|
+
<style>${pe}</style>
|
|
5143
5315
|
<a ${a.join(" ")} part="link">
|
|
5144
5316
|
<slot></slot>${r}${o}
|
|
5145
5317
|
</a>
|
|
@@ -5149,7 +5321,7 @@ class pt extends u {
|
|
|
5149
5321
|
["href", "external", "current", "disabled"].includes(t) && this.render();
|
|
5150
5322
|
}
|
|
5151
5323
|
}
|
|
5152
|
-
|
|
5324
|
+
p("a11y-link", bt);
|
|
5153
5325
|
const gt = `
|
|
5154
5326
|
:host {
|
|
5155
5327
|
display: block;
|
|
@@ -5214,7 +5386,7 @@ const gt = `
|
|
|
5214
5386
|
color: CanvasText;
|
|
5215
5387
|
}
|
|
5216
5388
|
}
|
|
5217
|
-
`,
|
|
5389
|
+
`, be = `
|
|
5218
5390
|
${gt}
|
|
5219
5391
|
|
|
5220
5392
|
h1, h2, h3, h4, h5, h6 {
|
|
@@ -5229,7 +5401,7 @@ const gt = `
|
|
|
5229
5401
|
h4 { font-size: var(--compa11y-heading-4-size, 1.25rem); line-height: 1.35; font-weight: 600; }
|
|
5230
5402
|
h5 { font-size: var(--compa11y-heading-5-size, 1.125rem); line-height: 1.4; font-weight: 600; }
|
|
5231
5403
|
h6 { font-size: var(--compa11y-heading-6-size, 1rem); line-height: 1.5; font-weight: 600; }
|
|
5232
|
-
`,
|
|
5404
|
+
`, ge = `
|
|
5233
5405
|
${gt}
|
|
5234
5406
|
|
|
5235
5407
|
p, span, div, label {
|
|
@@ -5255,7 +5427,7 @@ class ft extends u {
|
|
|
5255
5427
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5256
5428
|
const t = `h${this.headingLevel}`, e = mt(this), i = this.getAttribute("size") ? `size-${this.getAttribute("size")}` : "", s = e;
|
|
5257
5429
|
this.shadowRoot.innerHTML = `
|
|
5258
|
-
<style>${
|
|
5430
|
+
<style>${be}</style>
|
|
5259
5431
|
<${t} class="${s}" part="heading">
|
|
5260
5432
|
<slot></slot>
|
|
5261
5433
|
</${t}>
|
|
@@ -5279,7 +5451,7 @@ class vt extends u {
|
|
|
5279
5451
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5280
5452
|
const t = this.tagName_, e = mt(this, "md");
|
|
5281
5453
|
this.shadowRoot.innerHTML = `
|
|
5282
|
-
<style>${
|
|
5454
|
+
<style>${ge}</style>
|
|
5283
5455
|
<${t} class="${e}" part="text">
|
|
5284
5456
|
<slot></slot>
|
|
5285
5457
|
</${t}>
|
|
@@ -5289,9 +5461,9 @@ class vt extends u {
|
|
|
5289
5461
|
this.render();
|
|
5290
5462
|
}
|
|
5291
5463
|
}
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
const
|
|
5464
|
+
p("a11y-heading", ft);
|
|
5465
|
+
p("a11y-text", vt);
|
|
5466
|
+
const me = `
|
|
5295
5467
|
:host {
|
|
5296
5468
|
display: block;
|
|
5297
5469
|
box-sizing: border-box;
|
|
@@ -5369,7 +5541,7 @@ class yt extends u {
|
|
|
5369
5541
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5370
5542
|
const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", s = this.hasAttribute("required"), a = !!i, r = `${this._id}-label`, o = `${this._id}-hint`, n = `${this._id}-error`;
|
|
5371
5543
|
this.setAttribute("data-error", a ? "true" : "false"), this.shadowRoot.innerHTML = `
|
|
5372
|
-
<style>${
|
|
5544
|
+
<style>${me}</style>
|
|
5373
5545
|
<div class="field-wrapper" part="wrapper">
|
|
5374
5546
|
${t ? `<label
|
|
5375
5547
|
class="field-label"
|
|
@@ -5403,61 +5575,61 @@ class yt extends u {
|
|
|
5403
5575
|
(y) => y instanceof HTMLInputElement || y instanceof HTMLSelectElement || y instanceof HTMLTextAreaElement || y.hasAttribute("role") || y.hasAttribute("tabindex")
|
|
5404
5576
|
) || e[0];
|
|
5405
5577
|
if (!i) return;
|
|
5406
|
-
const s = this.getAttribute("label") || "", a = this.getAttribute("hint") || "", r = this.getAttribute("error") || "", o = this.hasAttribute("required"), n = this.hasAttribute("disabled"), d = !!r,
|
|
5407
|
-
s && !i.hasAttribute("aria-label") && i.setAttribute("aria-labelledby",
|
|
5578
|
+
const s = this.getAttribute("label") || "", a = this.getAttribute("hint") || "", r = this.getAttribute("error") || "", o = this.hasAttribute("required"), n = this.hasAttribute("disabled"), d = !!r, h = `${this._id}-label`, c = `${this._id}-hint`, b = `${this._id}-error`;
|
|
5579
|
+
s && !i.hasAttribute("aria-label") && i.setAttribute("aria-labelledby", h);
|
|
5408
5580
|
const m = [];
|
|
5409
|
-
a && m.push(
|
|
5581
|
+
a && m.push(c), d && m.push(b), m.length ? i.setAttribute("aria-describedby", m.join(" ")) : i.removeAttribute("aria-describedby"), d ? i.setAttribute("aria-invalid", "true") : i.removeAttribute("aria-invalid"), o ? i.setAttribute("aria-required", "true") : i.removeAttribute("aria-required"), n ? ("disabled" in i && (i.disabled = !0), i.setAttribute("aria-disabled", "true")) : ("disabled" in i && (i.disabled = !1), i.removeAttribute("aria-disabled"));
|
|
5410
5582
|
}
|
|
5411
5583
|
onAttributeChange(t, e, i) {
|
|
5412
5584
|
["label", "hint", "error", "required", "disabled"].includes(t) && (this.render(), this.setupEventListeners());
|
|
5413
5585
|
}
|
|
5414
5586
|
}
|
|
5415
|
-
|
|
5416
|
-
const
|
|
5417
|
-
function
|
|
5418
|
-
const s = window.innerWidth, a = window.innerHeight, r = t.offsetWidth, o = t.offsetHeight, n = e.indexOf("-"), d = n === -1 ? e : e.slice(0, n),
|
|
5419
|
-
let
|
|
5587
|
+
p("a11y-form-field", yt);
|
|
5588
|
+
const K = w("Popover");
|
|
5589
|
+
function fe(l, t, e, i) {
|
|
5590
|
+
const s = window.innerWidth, a = window.innerHeight, r = t.offsetWidth, o = t.offsetHeight, n = e.indexOf("-"), d = n === -1 ? e : e.slice(0, n), h = n === -1 ? "center" : e.slice(n + 1);
|
|
5591
|
+
let c = 0, b = 0;
|
|
5420
5592
|
switch (d) {
|
|
5421
5593
|
case "top":
|
|
5422
|
-
|
|
5594
|
+
c = l.top - o - i;
|
|
5423
5595
|
break;
|
|
5424
5596
|
case "bottom":
|
|
5425
|
-
|
|
5597
|
+
c = l.bottom + i;
|
|
5426
5598
|
break;
|
|
5427
5599
|
case "left":
|
|
5428
|
-
|
|
5600
|
+
b = l.left - r - i;
|
|
5429
5601
|
break;
|
|
5430
5602
|
case "right":
|
|
5431
|
-
|
|
5603
|
+
b = l.right + i;
|
|
5432
5604
|
break;
|
|
5433
5605
|
}
|
|
5434
5606
|
if (d === "top" || d === "bottom")
|
|
5435
|
-
switch (
|
|
5607
|
+
switch (h) {
|
|
5436
5608
|
case "start":
|
|
5437
|
-
|
|
5609
|
+
b = l.left;
|
|
5438
5610
|
break;
|
|
5439
5611
|
case "end":
|
|
5440
|
-
|
|
5612
|
+
b = l.right - r;
|
|
5441
5613
|
break;
|
|
5442
5614
|
default:
|
|
5443
|
-
|
|
5615
|
+
b = l.left + (l.width - r) / 2;
|
|
5444
5616
|
}
|
|
5445
5617
|
else
|
|
5446
|
-
switch (
|
|
5618
|
+
switch (h) {
|
|
5447
5619
|
case "start":
|
|
5448
|
-
|
|
5620
|
+
c = l.top;
|
|
5449
5621
|
break;
|
|
5450
5622
|
case "end":
|
|
5451
|
-
|
|
5623
|
+
c = l.bottom - o;
|
|
5452
5624
|
break;
|
|
5453
5625
|
default:
|
|
5454
|
-
|
|
5626
|
+
c = l.top + (l.height - o) / 2;
|
|
5455
5627
|
}
|
|
5456
|
-
d === "bottom" &&
|
|
5628
|
+
d === "bottom" && c + o > a && l.top - o - i > 0 ? c = l.top - o - i : d === "top" && c < 0 && l.bottom + i + o < a ? c = l.bottom + i : d === "right" && b + r > s && l.left - r - i > 0 ? b = l.left - r - i : d === "left" && b < 0 && l.right + i + r < s && (b = l.right + i);
|
|
5457
5629
|
const m = 8;
|
|
5458
|
-
return
|
|
5630
|
+
return b = Math.max(m, Math.min(b, s - r - m)), c = Math.max(m, Math.min(c, a - o - m)), { top: c, left: b };
|
|
5459
5631
|
}
|
|
5460
|
-
const
|
|
5632
|
+
const ve = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), details > summary', ye = `
|
|
5461
5633
|
:host {
|
|
5462
5634
|
display: inline-block;
|
|
5463
5635
|
}
|
|
@@ -5514,7 +5686,7 @@ const me = 'button:not([disabled]), [href], input:not([disabled]), select:not([d
|
|
|
5514
5686
|
`;
|
|
5515
5687
|
class _t extends u {
|
|
5516
5688
|
constructor() {
|
|
5517
|
-
super(...arguments), this._open = !1, this._placement = "bottom", this._offset = 8, this._disabled = !1, this._haspopup = "dialog", this._contentRole = "dialog", this._contentLabel = "", this._focusPolicy = "first", this._triggerEl = null, this._contentEl = null, this.
|
|
5689
|
+
super(...arguments), this._open = !1, this._placement = "bottom", this._offset = 8, this._disabled = !1, this._haspopup = "dialog", this._contentRole = "dialog", this._contentLabel = "", this._focusPolicy = "first", this._triggerEl = null, this._contentEl = null, this._weMovedFocus = !1, this._onTriggerSlotChange = () => {
|
|
5518
5690
|
const t = `${this._id}-content`;
|
|
5519
5691
|
this._wireTrigger(t);
|
|
5520
5692
|
}, this._onOutsidePointerDown = (t) => {
|
|
@@ -5562,7 +5734,7 @@ class _t extends u {
|
|
|
5562
5734
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5563
5735
|
const t = `${this._id}-content`, e = this._contentLabel ? `aria-label="${this._contentLabel}"` : "";
|
|
5564
5736
|
this.shadowRoot.innerHTML = `
|
|
5565
|
-
<style>${
|
|
5737
|
+
<style>${ye}</style>
|
|
5566
5738
|
<slot name="trigger" part="trigger-slot"></slot>
|
|
5567
5739
|
<div
|
|
5568
5740
|
class="popover-content"
|
|
@@ -5624,7 +5796,7 @@ class _t extends u {
|
|
|
5624
5796
|
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelector('slot[name="trigger"]');
|
|
5625
5797
|
if (!e) return;
|
|
5626
5798
|
const s = e.assignedElements({ flatten: !0 })[0] || null;
|
|
5627
|
-
typeof process < "u" && ((r = process.env) == null ? void 0 : r.NODE_ENV) !== "production" && (s ||
|
|
5799
|
+
typeof process < "u" && ((r = process.env) == null ? void 0 : r.NODE_ENV) !== "production" && (s || K.warning(
|
|
5628
5800
|
'Popover has no trigger. Add an element to the "trigger" slot.',
|
|
5629
5801
|
'<a11y-popover><button slot="trigger">Open</button>...</a11y-popover>'
|
|
5630
5802
|
)), this._detachTriggerListeners(), this._triggerEl = s, s && (this._updateTriggerAria(t), this._updateTriggerDisabled(), s.addEventListener("click", this._onTriggerClick), s.addEventListener("keydown", this._onTriggerKeyDown));
|
|
@@ -5647,14 +5819,14 @@ class _t extends u {
|
|
|
5647
5819
|
// ─── Open / Close ──────────────────────────────────────────────────────────
|
|
5648
5820
|
_show() {
|
|
5649
5821
|
var t;
|
|
5650
|
-
this._contentEl && (this.
|
|
5822
|
+
this._contentEl && (this._contentEl.removeAttribute("hidden"), this._updateTriggerAria(), this._updatePosition(), requestAnimationFrame(() => {
|
|
5651
5823
|
var e;
|
|
5652
5824
|
(e = this._contentEl) == null || e.setAttribute("data-open", "true");
|
|
5653
5825
|
}), typeof process < "u" && ((t = process.env) == null ? void 0 : t.NODE_ENV) !== "production" && requestAnimationFrame(() => {
|
|
5654
5826
|
const e = this._contentEl;
|
|
5655
5827
|
if (!e) return;
|
|
5656
5828
|
const i = e.hasAttribute("aria-label") || e.hasAttribute("aria-labelledby"), s = !!e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]');
|
|
5657
|
-
!i && !s &&
|
|
5829
|
+
!i && !s && K.warning(
|
|
5658
5830
|
'Popover content has no accessible name. Add content-label="..." on <a11y-popover>, or place a heading inside the content.',
|
|
5659
5831
|
'Example: <a11y-popover content-label="Filter options">...</a11y-popover>'
|
|
5660
5832
|
);
|
|
@@ -5664,7 +5836,7 @@ class _t extends u {
|
|
|
5664
5836
|
const i = this._contentEl;
|
|
5665
5837
|
if (!i) return;
|
|
5666
5838
|
let s = null;
|
|
5667
|
-
e === "first" && (s = i.querySelector(
|
|
5839
|
+
e === "first" && (s = i.querySelector(ve)), s || (s = i), this._weMovedFocus = !0, s.focus();
|
|
5668
5840
|
}), this._addGlobalListeners(), this.emit("a11y-popover-open"));
|
|
5669
5841
|
}
|
|
5670
5842
|
_hide() {
|
|
@@ -5677,12 +5849,12 @@ class _t extends u {
|
|
|
5677
5849
|
};
|
|
5678
5850
|
getComputedStyle(this._contentEl).transitionDuration !== "0s" ? (this._contentEl.addEventListener("transitionend", t), setTimeout(t, 200)) : this._contentEl.setAttribute("hidden", ""), this._removeGlobalListeners();
|
|
5679
5851
|
const i = this._weMovedFocus || this._contentEl.contains(document.activeElement);
|
|
5680
|
-
this._weMovedFocus = !1,
|
|
5852
|
+
this._weMovedFocus = !1, i && ((s = this._triggerEl) == null || s.focus()), this.emit("a11y-popover-close");
|
|
5681
5853
|
}
|
|
5682
5854
|
// ─── Positioning ───────────────────────────────────────────────────────────
|
|
5683
5855
|
_updatePosition() {
|
|
5684
5856
|
if (!this._triggerEl || !this._contentEl || !this._open) return;
|
|
5685
|
-
const t = this._triggerEl.getBoundingClientRect(), { top: e, left: i } =
|
|
5857
|
+
const t = this._triggerEl.getBoundingClientRect(), { top: e, left: i } = fe(
|
|
5686
5858
|
t,
|
|
5687
5859
|
this._contentEl,
|
|
5688
5860
|
this._placement,
|
|
@@ -5698,14 +5870,14 @@ class _t extends u {
|
|
|
5698
5870
|
document.removeEventListener("pointerdown", this._onOutsidePointerDown, !0), document.removeEventListener("keydown", this._onDocumentKeyDown, !0), window.removeEventListener("scroll", this._onScrollOrResize, !0), window.removeEventListener("resize", this._onScrollOrResize);
|
|
5699
5871
|
}
|
|
5700
5872
|
}
|
|
5701
|
-
|
|
5702
|
-
const
|
|
5873
|
+
p("a11y-popover", _t);
|
|
5874
|
+
const _e = w("A11yAccordion");
|
|
5703
5875
|
let N = !1;
|
|
5704
|
-
function
|
|
5876
|
+
function xe() {
|
|
5705
5877
|
if (N || typeof document > "u") return;
|
|
5706
5878
|
N = !0;
|
|
5707
5879
|
const l = document.createElement("style");
|
|
5708
|
-
l.setAttribute("data-compa11y-accordion", ""), l.textContent =
|
|
5880
|
+
l.setAttribute("data-compa11y-accordion", ""), l.textContent = se, document.head.appendChild(l);
|
|
5709
5881
|
}
|
|
5710
5882
|
class xt extends u {
|
|
5711
5883
|
constructor() {
|
|
@@ -5718,7 +5890,7 @@ class xt extends u {
|
|
|
5718
5890
|
const i = this._panels[e], s = t.id || `${this._id}-trigger-${e}`, a = (i == null ? void 0 : i.id) || `${this._id}-panel-${e}`;
|
|
5719
5891
|
t.id = s, t.getAttribute("aria-controls") || t.setAttribute("aria-controls", a);
|
|
5720
5892
|
const r = this._openItems.has(e);
|
|
5721
|
-
t.setAttribute("aria-expanded", String(r)), i && (i.id = a, i.getAttribute("role") || i.setAttribute("role", "region"), i.getAttribute("aria-labelledby") || i.setAttribute("aria-labelledby", s), i.hidden = !r),
|
|
5893
|
+
t.setAttribute("aria-expanded", String(r)), i && (i.id = a, i.getAttribute("role") || i.setAttribute("role", "region"), i.getAttribute("aria-labelledby") || i.setAttribute("aria-labelledby", s), i.hidden = !r), _e.checks.accessibleLabel(
|
|
5722
5894
|
t,
|
|
5723
5895
|
`a11y-accordion trigger[${e}]`
|
|
5724
5896
|
);
|
|
@@ -5731,13 +5903,13 @@ class xt extends u {
|
|
|
5731
5903
|
const a = this._triggers.indexOf(i);
|
|
5732
5904
|
a !== -1 && this.toggleItem(a);
|
|
5733
5905
|
}, this.handleKeyDown = (t) => {
|
|
5734
|
-
var o, n, d,
|
|
5906
|
+
var o, n, d, h;
|
|
5735
5907
|
const i = t.target.closest(
|
|
5736
5908
|
"[data-accordion-trigger]"
|
|
5737
5909
|
);
|
|
5738
5910
|
if (!i || this._triggers.indexOf(i) === -1) return;
|
|
5739
5911
|
const a = this._triggers.filter(
|
|
5740
|
-
(
|
|
5912
|
+
(c) => !c.hasAttribute("disabled") && c.getAttribute("aria-disabled") !== "true"
|
|
5741
5913
|
), r = a.indexOf(i);
|
|
5742
5914
|
if (r !== -1)
|
|
5743
5915
|
switch (t.key) {
|
|
@@ -5751,7 +5923,7 @@ class xt extends u {
|
|
|
5751
5923
|
t.preventDefault(), (d = a[0]) == null || d.focus();
|
|
5752
5924
|
break;
|
|
5753
5925
|
case "End":
|
|
5754
|
-
t.preventDefault(), (
|
|
5926
|
+
t.preventDefault(), (h = a[a.length - 1]) == null || h.focus();
|
|
5755
5927
|
break;
|
|
5756
5928
|
}
|
|
5757
5929
|
};
|
|
@@ -5768,7 +5940,7 @@ class xt extends u {
|
|
|
5768
5940
|
return this.hasAttribute("collapsible");
|
|
5769
5941
|
}
|
|
5770
5942
|
setupAccessibility() {
|
|
5771
|
-
|
|
5943
|
+
xe(), this.updateItems();
|
|
5772
5944
|
}
|
|
5773
5945
|
render() {
|
|
5774
5946
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
@@ -5798,14 +5970,14 @@ class xt extends u {
|
|
|
5798
5970
|
toggleItem(t) {
|
|
5799
5971
|
var n, d;
|
|
5800
5972
|
const e = this._openItems.has(t), i = [];
|
|
5801
|
-
this.type === "single" ? e && this.collapsible ? i.push(t) : e || this._openItems.forEach((
|
|
5802
|
-
const s = document.activeElement, a = i.find((
|
|
5803
|
-
const
|
|
5804
|
-
return
|
|
5973
|
+
this.type === "single" ? e && this.collapsible ? i.push(t) : e || this._openItems.forEach((h) => i.push(h)) : e && i.push(t);
|
|
5974
|
+
const s = document.activeElement, a = i.find((h) => {
|
|
5975
|
+
const c = this._panels[h];
|
|
5976
|
+
return c && c.contains(s);
|
|
5805
5977
|
});
|
|
5806
5978
|
this.type === "single" ? e ? this.collapsible && this._openItems.delete(t) : (this._openItems.clear(), this._openItems.add(t)) : e ? this._openItems.delete(t) : this._openItems.add(t), this.syncState(), a !== void 0 && requestAnimationFrame(() => {
|
|
5807
|
-
var
|
|
5808
|
-
(
|
|
5979
|
+
var h;
|
|
5980
|
+
(h = this._triggers[a]) == null || h.focus();
|
|
5809
5981
|
});
|
|
5810
5982
|
const r = this._openItems.has(t), o = ((d = (n = this._triggers[t]) == null ? void 0 : n.textContent) == null ? void 0 : d.trim()) || "Section";
|
|
5811
5983
|
v(`${o} ${r ? "expanded" : "collapsed"}`), this.emit("a11y-accordion-change", {
|
|
@@ -5834,14 +6006,14 @@ class xt extends u {
|
|
|
5834
6006
|
this.toggleItem(t);
|
|
5835
6007
|
}
|
|
5836
6008
|
}
|
|
5837
|
-
|
|
5838
|
-
const j =
|
|
6009
|
+
p("a11y-accordion", xt);
|
|
6010
|
+
const j = w("A11yTable");
|
|
5839
6011
|
let Y = !1;
|
|
5840
|
-
function
|
|
6012
|
+
function Ae() {
|
|
5841
6013
|
if (Y || typeof document > "u") return;
|
|
5842
6014
|
Y = !0;
|
|
5843
6015
|
const l = document.createElement("style");
|
|
5844
|
-
l.setAttribute("data-compa11y-table", ""), l.textContent =
|
|
6016
|
+
l.setAttribute("data-compa11y-table", ""), l.textContent = ae, document.head.appendChild(l);
|
|
5845
6017
|
}
|
|
5846
6018
|
class At extends u {
|
|
5847
6019
|
constructor() {
|
|
@@ -5949,7 +6121,7 @@ class At extends u {
|
|
|
5949
6121
|
}
|
|
5950
6122
|
}
|
|
5951
6123
|
setupAccessibility() {
|
|
5952
|
-
|
|
6124
|
+
Ae(), this.upgradeProperty("columns"), this.upgradeProperty("rows"), this.upgradeProperty("selectedRows"), this.upgradeProperty("sortKey"), this.upgradeProperty("sortDirection");
|
|
5953
6125
|
const t = this.getAttribute("sort-key");
|
|
5954
6126
|
t && (this._sortKey = t);
|
|
5955
6127
|
const e = this.getAttribute("sort-direction");
|
|
@@ -6130,15 +6302,403 @@ class At extends u {
|
|
|
6130
6302
|
});
|
|
6131
6303
|
}
|
|
6132
6304
|
}
|
|
6133
|
-
|
|
6305
|
+
p("a11y-table", At);
|
|
6306
|
+
const Ee = w("Pagination");
|
|
6307
|
+
function ke(l, t, e, i) {
|
|
6308
|
+
if (t <= 0) return [];
|
|
6309
|
+
if (t === 1) return [1];
|
|
6310
|
+
const s = /* @__PURE__ */ new Set();
|
|
6311
|
+
for (let o = 1; o <= Math.min(i, t); o++)
|
|
6312
|
+
s.add(o);
|
|
6313
|
+
for (let o = Math.max(t - i + 1, 1); o <= t; o++)
|
|
6314
|
+
s.add(o);
|
|
6315
|
+
for (let o = Math.max(l - e, 1); o <= Math.min(l + e, t); o++)
|
|
6316
|
+
s.add(o);
|
|
6317
|
+
const a = Array.from(s).sort((o, n) => o - n), r = [];
|
|
6318
|
+
for (let o = 0; o < a.length; o++) {
|
|
6319
|
+
const n = a[o], d = a[o - 1];
|
|
6320
|
+
if (n !== void 0) {
|
|
6321
|
+
if (d !== void 0) {
|
|
6322
|
+
const h = n - d;
|
|
6323
|
+
if (h === 2)
|
|
6324
|
+
r.push(d + 1);
|
|
6325
|
+
else if (h > 2) {
|
|
6326
|
+
const c = (d + n) / 2;
|
|
6327
|
+
r.push(c < l ? "ellipsis-start" : "ellipsis-end");
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6330
|
+
r.push(n);
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
return r;
|
|
6334
|
+
}
|
|
6335
|
+
class Et extends u {
|
|
6336
|
+
constructor() {
|
|
6337
|
+
super(...arguments), this._currentPage = 1, this._totalPages = 1, this._totalItems = null, this._pageSize = 25, this._siblingCount = 1, this._boundaryCount = 1, this._showFirstLast = !1, this._showPageSize = !1, this._showJumpTo = !1, this._disabled = !1, this._pageSizeOptions = [10, 25, 50], this._handleClick = (t) => {
|
|
6338
|
+
const e = t.target.closest(
|
|
6339
|
+
"button[data-action]"
|
|
6340
|
+
);
|
|
6341
|
+
if (!e || e.disabled) return;
|
|
6342
|
+
switch (e.dataset.action) {
|
|
6343
|
+
case "first":
|
|
6344
|
+
this._goToPage(1, "first");
|
|
6345
|
+
break;
|
|
6346
|
+
case "prev":
|
|
6347
|
+
this._goToPage(this._currentPage - 1, "prev");
|
|
6348
|
+
break;
|
|
6349
|
+
case "page": {
|
|
6350
|
+
const s = parseInt(e.dataset.page ?? "", 10);
|
|
6351
|
+
isNaN(s) || this._goToPage(s, "page");
|
|
6352
|
+
break;
|
|
6353
|
+
}
|
|
6354
|
+
case "next":
|
|
6355
|
+
this._goToPage(this._currentPage + 1, "next");
|
|
6356
|
+
break;
|
|
6357
|
+
case "last":
|
|
6358
|
+
this._goToPage(this._totalPages, "last");
|
|
6359
|
+
break;
|
|
6360
|
+
}
|
|
6361
|
+
}, this._handleChange = (t) => {
|
|
6362
|
+
const e = t.target;
|
|
6363
|
+
if (!e.matches("[data-compa11y-pagination-pagesize]")) return;
|
|
6364
|
+
const i = parseInt(e.value, 10);
|
|
6365
|
+
this._pageSize = i, this._recomputeTotalPages(), this._currentPage = 1, this._syncUI(), this._totalItems != null ? f(
|
|
6366
|
+
`Showing 1–${Math.min(i, this._totalItems)} of ${this._totalItems}`
|
|
6367
|
+
) : f(`Page 1 of ${this._totalPages}`), this.emit("page-change", { page: 1 }), this.emit("page-size-change", { pageSize: i });
|
|
6368
|
+
}, this._handleKeyDown = (t) => {
|
|
6369
|
+
var r;
|
|
6370
|
+
const e = t.target;
|
|
6371
|
+
if (!e.matches("[data-compa11y-pagination-jump]") || t.key !== "Enter") return;
|
|
6372
|
+
const i = e, s = parseInt(i.value, 10), a = (r = this.shadowRoot) == null ? void 0 : r.querySelector(
|
|
6373
|
+
"[data-compa11y-pagination-error]"
|
|
6374
|
+
);
|
|
6375
|
+
if (isNaN(s) || s < 1 || s > this._totalPages) {
|
|
6376
|
+
a && (a.textContent = `Enter a page between 1 and ${this._totalPages}`, a.style.display = "", i.setAttribute("aria-describedby", `${this._id}-jump-error`));
|
|
6377
|
+
return;
|
|
6378
|
+
}
|
|
6379
|
+
a && (a.textContent = "", a.style.display = "none", i.removeAttribute("aria-describedby")), this._goToPage(s, "page"), i.value = "";
|
|
6380
|
+
};
|
|
6381
|
+
}
|
|
6382
|
+
static get observedAttributes() {
|
|
6383
|
+
return [
|
|
6384
|
+
"current-page",
|
|
6385
|
+
"total-pages",
|
|
6386
|
+
"total-items",
|
|
6387
|
+
"page-size",
|
|
6388
|
+
"page-size-options",
|
|
6389
|
+
"show-first-last",
|
|
6390
|
+
"show-page-size",
|
|
6391
|
+
"show-jump-to",
|
|
6392
|
+
"sibling-count",
|
|
6393
|
+
"boundary-count",
|
|
6394
|
+
"disabled",
|
|
6395
|
+
"aria-label"
|
|
6396
|
+
];
|
|
6397
|
+
}
|
|
6398
|
+
// ------------------------------------------------------------------
|
|
6399
|
+
// Attribute-backed properties
|
|
6400
|
+
// ------------------------------------------------------------------
|
|
6401
|
+
get currentPage() {
|
|
6402
|
+
return this._currentPage;
|
|
6403
|
+
}
|
|
6404
|
+
set currentPage(t) {
|
|
6405
|
+
const e = Math.max(1, Math.min(t, this._totalPages));
|
|
6406
|
+
e !== this._currentPage && (this._currentPage = e, this._syncUI());
|
|
6407
|
+
}
|
|
6408
|
+
get totalPages() {
|
|
6409
|
+
return this._totalPages;
|
|
6410
|
+
}
|
|
6411
|
+
set totalPages(t) {
|
|
6412
|
+
this._totalPages = Math.max(1, t), this._syncUI();
|
|
6413
|
+
}
|
|
6414
|
+
// ------------------------------------------------------------------
|
|
6415
|
+
// Lifecycle
|
|
6416
|
+
// ------------------------------------------------------------------
|
|
6417
|
+
setupAccessibility() {
|
|
6418
|
+
this._readAttributes();
|
|
6419
|
+
}
|
|
6420
|
+
render() {
|
|
6421
|
+
const t = this.attachShadow({ mode: "open" });
|
|
6422
|
+
t.innerHTML = `
|
|
6423
|
+
<style>${re}</style>
|
|
6424
|
+
<nav part="nav" data-compa11y-pagination>
|
|
6425
|
+
<div
|
|
6426
|
+
class="sr-only"
|
|
6427
|
+
role="status"
|
|
6428
|
+
aria-live="polite"
|
|
6429
|
+
aria-atomic="true"
|
|
6430
|
+
part="live-region"
|
|
6431
|
+
></div>
|
|
6432
|
+
<ul part="list"></ul>
|
|
6433
|
+
<div class="extras" part="extras"></div>
|
|
6434
|
+
</nav>
|
|
6435
|
+
`, this._syncUI();
|
|
6436
|
+
}
|
|
6437
|
+
setupEventListeners() {
|
|
6438
|
+
const t = this.shadowRoot;
|
|
6439
|
+
t == null || t.addEventListener("click", this._handleClick), t == null || t.addEventListener("change", this._handleChange), t == null || t.addEventListener("keydown", this._handleKeyDown);
|
|
6440
|
+
}
|
|
6441
|
+
cleanupEventListeners() {
|
|
6442
|
+
const t = this.shadowRoot;
|
|
6443
|
+
t == null || t.removeEventListener("click", this._handleClick), t == null || t.removeEventListener("change", this._handleChange), t == null || t.removeEventListener("keydown", this._handleKeyDown);
|
|
6444
|
+
}
|
|
6445
|
+
onAttributeChange(t, e, i) {
|
|
6446
|
+
var s;
|
|
6447
|
+
switch (t) {
|
|
6448
|
+
case "current-page":
|
|
6449
|
+
this._currentPage = Math.max(
|
|
6450
|
+
1,
|
|
6451
|
+
Math.min(parseInt(i ?? "1", 10), this._totalPages)
|
|
6452
|
+
);
|
|
6453
|
+
break;
|
|
6454
|
+
case "total-pages":
|
|
6455
|
+
this._totalPages = Math.max(1, parseInt(i ?? "1", 10));
|
|
6456
|
+
break;
|
|
6457
|
+
case "total-items":
|
|
6458
|
+
this._totalItems = i != null ? parseInt(i, 10) : null, this._recomputeTotalPages();
|
|
6459
|
+
break;
|
|
6460
|
+
case "page-size":
|
|
6461
|
+
this._pageSize = Math.max(1, parseInt(i ?? "25", 10)), this._recomputeTotalPages();
|
|
6462
|
+
break;
|
|
6463
|
+
case "page-size-options":
|
|
6464
|
+
i && (this._pageSizeOptions = i.split(",").map((a) => parseInt(a.trim(), 10)).filter((a) => !isNaN(a) && a > 0));
|
|
6465
|
+
break;
|
|
6466
|
+
case "show-first-last":
|
|
6467
|
+
this._showFirstLast = i !== null;
|
|
6468
|
+
break;
|
|
6469
|
+
case "show-page-size":
|
|
6470
|
+
this._showPageSize = i !== null;
|
|
6471
|
+
break;
|
|
6472
|
+
case "show-jump-to":
|
|
6473
|
+
this._showJumpTo = i !== null;
|
|
6474
|
+
break;
|
|
6475
|
+
case "sibling-count":
|
|
6476
|
+
this._siblingCount = Math.max(0, parseInt(i ?? "1", 10));
|
|
6477
|
+
break;
|
|
6478
|
+
case "boundary-count":
|
|
6479
|
+
this._boundaryCount = Math.max(0, parseInt(i ?? "1", 10));
|
|
6480
|
+
break;
|
|
6481
|
+
case "disabled":
|
|
6482
|
+
this._disabled = i !== null;
|
|
6483
|
+
break;
|
|
6484
|
+
case "aria-label": {
|
|
6485
|
+
const a = (s = this.shadowRoot) == null ? void 0 : s.querySelector("nav");
|
|
6486
|
+
a && a.setAttribute("aria-label", i ?? "Pagination");
|
|
6487
|
+
return;
|
|
6488
|
+
}
|
|
6489
|
+
}
|
|
6490
|
+
this._syncUI();
|
|
6491
|
+
}
|
|
6492
|
+
// ------------------------------------------------------------------
|
|
6493
|
+
// Internal helpers
|
|
6494
|
+
// ------------------------------------------------------------------
|
|
6495
|
+
_readAttributes() {
|
|
6496
|
+
const t = (i) => this.getAttribute(i);
|
|
6497
|
+
this._currentPage = Math.max(1, parseInt(t("current-page") ?? "1", 10)), this._totalPages = Math.max(1, parseInt(t("total-pages") ?? "1", 10)), this._totalItems = t("total-items") != null ? parseInt(t("total-items"), 10) : null, this._pageSize = Math.max(1, parseInt(t("page-size") ?? "25", 10)), this._siblingCount = Math.max(
|
|
6498
|
+
0,
|
|
6499
|
+
parseInt(t("sibling-count") ?? "1", 10)
|
|
6500
|
+
), this._boundaryCount = Math.max(
|
|
6501
|
+
0,
|
|
6502
|
+
parseInt(t("boundary-count") ?? "1", 10)
|
|
6503
|
+
), this._showFirstLast = this.hasAttribute("show-first-last"), this._showPageSize = this.hasAttribute("show-page-size"), this._showJumpTo = this.hasAttribute("show-jump-to"), this._disabled = this.hasAttribute("disabled");
|
|
6504
|
+
const e = t("page-size-options");
|
|
6505
|
+
e && (this._pageSizeOptions = e.split(",").map((i) => parseInt(i.trim(), 10)).filter((i) => !isNaN(i) && i > 0)), this._recomputeTotalPages(), this._devWarnings();
|
|
6506
|
+
}
|
|
6507
|
+
_recomputeTotalPages() {
|
|
6508
|
+
this._totalItems != null && (this._totalPages = Math.max(
|
|
6509
|
+
1,
|
|
6510
|
+
Math.ceil(this._totalItems / this._pageSize)
|
|
6511
|
+
));
|
|
6512
|
+
}
|
|
6513
|
+
_devWarnings() {
|
|
6514
|
+
this.hasAttribute("total-pages") || this.hasAttribute("total-items") || Ee.error(
|
|
6515
|
+
"Either total-pages or total-items attribute is required.",
|
|
6516
|
+
'Add total-pages="n" or total-items="n" to <a11y-pagination>.'
|
|
6517
|
+
);
|
|
6518
|
+
}
|
|
6519
|
+
_ariaLabel() {
|
|
6520
|
+
return this.getAttribute("aria-label") ?? "Pagination";
|
|
6521
|
+
}
|
|
6522
|
+
_announce(t) {
|
|
6523
|
+
var i;
|
|
6524
|
+
const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector('[role="status"]');
|
|
6525
|
+
e && (e.textContent = t, setTimeout(() => {
|
|
6526
|
+
e.textContent = "";
|
|
6527
|
+
}, 1e3));
|
|
6528
|
+
}
|
|
6529
|
+
_goToPage(t, e) {
|
|
6530
|
+
if (!(t < 1 || t > this._totalPages || t === this._currentPage)) {
|
|
6531
|
+
if (this._currentPage = t, this._syncUI(), e !== void 0) {
|
|
6532
|
+
const i = e;
|
|
6533
|
+
requestAnimationFrame(() => this._restoreFocus(i, t));
|
|
6534
|
+
}
|
|
6535
|
+
this._announce(`Page ${t} of ${this._totalPages}`), this.emit("page-change", { page: t });
|
|
6536
|
+
}
|
|
6537
|
+
}
|
|
6538
|
+
_restoreFocus(t, e) {
|
|
6539
|
+
if (!this.shadowRoot) return;
|
|
6540
|
+
let i = null;
|
|
6541
|
+
t === "page" ? i = this.shadowRoot.querySelector(`button[data-page="${e}"]`) : (i = this.shadowRoot.querySelector(`button[data-action="${t}"]`), i && i.disabled && (t === "prev" || t === "first" ? i = this.shadowRoot.querySelector('button[data-action="next"]:not([disabled])') ?? this.shadowRoot.querySelector('button[data-action="last"]:not([disabled])') : i = this.shadowRoot.querySelector('button[data-action="prev"]:not([disabled])') ?? this.shadowRoot.querySelector('button[data-action="first"]:not([disabled])'))), i == null || i.focus();
|
|
6542
|
+
}
|
|
6543
|
+
// ------------------------------------------------------------------
|
|
6544
|
+
// Full UI sync
|
|
6545
|
+
// ------------------------------------------------------------------
|
|
6546
|
+
_syncUI() {
|
|
6547
|
+
if (!this.shadowRoot) return;
|
|
6548
|
+
const t = this.shadowRoot.querySelector("nav");
|
|
6549
|
+
t && t.setAttribute("aria-label", this._ariaLabel()), this._renderList(), this._renderExtras();
|
|
6550
|
+
}
|
|
6551
|
+
_renderList() {
|
|
6552
|
+
var o;
|
|
6553
|
+
const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("ul");
|
|
6554
|
+
if (!t) return;
|
|
6555
|
+
const e = this._currentPage <= 1, i = this._currentPage >= this._totalPages, s = this._disabled, a = [];
|
|
6556
|
+
this._showFirstLast && a.push(
|
|
6557
|
+
`<li>
|
|
6558
|
+
<button
|
|
6559
|
+
type="button"
|
|
6560
|
+
aria-label="First page"
|
|
6561
|
+
data-compa11y-pagination-btn
|
|
6562
|
+
data-action="first"
|
|
6563
|
+
${e || s ? "disabled" : ""}
|
|
6564
|
+
part="btn btn-first"
|
|
6565
|
+
>«</button>
|
|
6566
|
+
</li>`
|
|
6567
|
+
), a.push(
|
|
6568
|
+
`<li>
|
|
6569
|
+
<button
|
|
6570
|
+
type="button"
|
|
6571
|
+
aria-label="Previous page"
|
|
6572
|
+
data-compa11y-pagination-btn
|
|
6573
|
+
data-action="prev"
|
|
6574
|
+
${e || s ? "disabled" : ""}
|
|
6575
|
+
part="btn btn-prev"
|
|
6576
|
+
>‹</button>
|
|
6577
|
+
</li>`
|
|
6578
|
+
);
|
|
6579
|
+
const r = ke(
|
|
6580
|
+
this._currentPage,
|
|
6581
|
+
this._totalPages,
|
|
6582
|
+
this._siblingCount,
|
|
6583
|
+
this._boundaryCount
|
|
6584
|
+
);
|
|
6585
|
+
for (const n of r) {
|
|
6586
|
+
if (n === "ellipsis-start" || n === "ellipsis-end") {
|
|
6587
|
+
a.push(
|
|
6588
|
+
'<li aria-hidden="true" part="ellipsis"><span>…</span></li>'
|
|
6589
|
+
);
|
|
6590
|
+
continue;
|
|
6591
|
+
}
|
|
6592
|
+
const d = n === this._currentPage;
|
|
6593
|
+
a.push(
|
|
6594
|
+
`<li>
|
|
6595
|
+
<button
|
|
6596
|
+
type="button"
|
|
6597
|
+
aria-label="Page ${n}"
|
|
6598
|
+
${d ? 'aria-current="page"' : ""}
|
|
6599
|
+
${s ? "disabled" : ""}
|
|
6600
|
+
data-compa11y-pagination-btn
|
|
6601
|
+
data-compa11y-pagination-page
|
|
6602
|
+
data-current="${d}"
|
|
6603
|
+
data-action="page"
|
|
6604
|
+
data-page="${n}"
|
|
6605
|
+
part="btn btn-page${d ? " btn-current" : ""}"
|
|
6606
|
+
>${n}</button>
|
|
6607
|
+
</li>`
|
|
6608
|
+
);
|
|
6609
|
+
}
|
|
6610
|
+
a.push(
|
|
6611
|
+
`<li>
|
|
6612
|
+
<button
|
|
6613
|
+
type="button"
|
|
6614
|
+
aria-label="Next page"
|
|
6615
|
+
data-compa11y-pagination-btn
|
|
6616
|
+
data-action="next"
|
|
6617
|
+
${i || s ? "disabled" : ""}
|
|
6618
|
+
part="btn btn-next"
|
|
6619
|
+
>›</button>
|
|
6620
|
+
</li>`
|
|
6621
|
+
), this._showFirstLast && a.push(
|
|
6622
|
+
`<li>
|
|
6623
|
+
<button
|
|
6624
|
+
type="button"
|
|
6625
|
+
aria-label="Last page"
|
|
6626
|
+
data-compa11y-pagination-btn
|
|
6627
|
+
data-action="last"
|
|
6628
|
+
${i || s ? "disabled" : ""}
|
|
6629
|
+
part="btn btn-last"
|
|
6630
|
+
>»</button>
|
|
6631
|
+
</li>`
|
|
6632
|
+
), t.innerHTML = a.join("");
|
|
6633
|
+
}
|
|
6634
|
+
_renderExtras() {
|
|
6635
|
+
var i;
|
|
6636
|
+
const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".extras");
|
|
6637
|
+
if (!t) return;
|
|
6638
|
+
const e = [];
|
|
6639
|
+
if (this._showPageSize) {
|
|
6640
|
+
const s = this._pageSizeOptions.map(
|
|
6641
|
+
(a) => `<option value="${a}"${a === this._pageSize ? " selected" : ""}>${a}</option>`
|
|
6642
|
+
).join("");
|
|
6643
|
+
e.push(
|
|
6644
|
+
`<div class="page-size-wrapper" part="page-size-wrapper">
|
|
6645
|
+
<label for="${this._id}-pagesize">Rows per page</label>
|
|
6646
|
+
<select
|
|
6647
|
+
id="${this._id}-pagesize"
|
|
6648
|
+
data-compa11y-pagination-pagesize
|
|
6649
|
+
${this._disabled ? "disabled" : ""}
|
|
6650
|
+
part="page-size-select"
|
|
6651
|
+
>${s}</select>
|
|
6652
|
+
</div>`
|
|
6653
|
+
);
|
|
6654
|
+
}
|
|
6655
|
+
this._showJumpTo && e.push(
|
|
6656
|
+
`<div class="jump-wrapper" part="jump-wrapper">
|
|
6657
|
+
<label for="${this._id}-jump">Go to page</label>
|
|
6658
|
+
<input
|
|
6659
|
+
id="${this._id}-jump"
|
|
6660
|
+
type="number"
|
|
6661
|
+
min="1"
|
|
6662
|
+
max="${this._totalPages}"
|
|
6663
|
+
data-compa11y-pagination-jump
|
|
6664
|
+
${this._disabled ? "disabled" : ""}
|
|
6665
|
+
part="jump-input"
|
|
6666
|
+
/>
|
|
6667
|
+
<span
|
|
6668
|
+
id="${this._id}-jump-error"
|
|
6669
|
+
role="alert"
|
|
6670
|
+
data-compa11y-pagination-error
|
|
6671
|
+
part="jump-error"
|
|
6672
|
+
style="display:none"
|
|
6673
|
+
></span>
|
|
6674
|
+
</div>`
|
|
6675
|
+
), t.innerHTML = e.join("");
|
|
6676
|
+
}
|
|
6677
|
+
// ------------------------------------------------------------------
|
|
6678
|
+
// Public API
|
|
6679
|
+
// ------------------------------------------------------------------
|
|
6680
|
+
/** Navigate to a specific page. */
|
|
6681
|
+
goTo(t) {
|
|
6682
|
+
this._goToPage(t);
|
|
6683
|
+
}
|
|
6684
|
+
/** Navigate to the next page. */
|
|
6685
|
+
next() {
|
|
6686
|
+
this._goToPage(this._currentPage + 1);
|
|
6687
|
+
}
|
|
6688
|
+
/** Navigate to the previous page. */
|
|
6689
|
+
previous() {
|
|
6690
|
+
this._goToPage(this._currentPage - 1);
|
|
6691
|
+
}
|
|
6692
|
+
}
|
|
6693
|
+
p("a11y-pagination", Et);
|
|
6134
6694
|
if (typeof window < "u") {
|
|
6135
6695
|
const l = () => {
|
|
6136
|
-
|
|
6696
|
+
B(), P();
|
|
6137
6697
|
};
|
|
6138
6698
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l) : l(), window.compa11y = {
|
|
6139
6699
|
// Components (classes)
|
|
6140
|
-
A11yDialog:
|
|
6141
|
-
A11yMenu:
|
|
6700
|
+
A11yDialog: W,
|
|
6701
|
+
A11yMenu: X,
|
|
6142
6702
|
A11yTabs: J,
|
|
6143
6703
|
A11yCombobox: Q,
|
|
6144
6704
|
A11ySwitch: Z,
|
|
@@ -6153,60 +6713,62 @@ if (typeof window < "u") {
|
|
|
6153
6713
|
A11yCheckboxGroup: nt,
|
|
6154
6714
|
A11yRadioGroup: lt,
|
|
6155
6715
|
A11yRadio: dt,
|
|
6156
|
-
A11yToast:
|
|
6157
|
-
A11yVisuallyHidden:
|
|
6716
|
+
A11yToast: ct,
|
|
6717
|
+
A11yVisuallyHidden: ht,
|
|
6158
6718
|
A11ySkipLink: ut,
|
|
6159
|
-
A11yAlert:
|
|
6160
|
-
A11yLink:
|
|
6719
|
+
A11yAlert: pt,
|
|
6720
|
+
A11yLink: bt,
|
|
6161
6721
|
A11yHeading: ft,
|
|
6162
6722
|
A11yText: vt,
|
|
6163
6723
|
A11yFormField: yt,
|
|
6164
6724
|
A11yPopover: _t,
|
|
6165
6725
|
A11yAccordion: xt,
|
|
6166
6726
|
A11yTable: At,
|
|
6727
|
+
A11yPagination: Et,
|
|
6167
6728
|
// Announcer utilities
|
|
6168
|
-
initAnnouncer:
|
|
6729
|
+
initAnnouncer: B,
|
|
6169
6730
|
announce: v,
|
|
6170
6731
|
announcePolite: f,
|
|
6171
|
-
announceAssertive:
|
|
6732
|
+
announceAssertive: O,
|
|
6172
6733
|
announceStatus: Bt,
|
|
6173
|
-
announceError:
|
|
6734
|
+
announceError: Pt,
|
|
6174
6735
|
// Focus utilities
|
|
6175
|
-
initFocusVisible:
|
|
6176
|
-
createFocusTrap:
|
|
6736
|
+
initFocusVisible: P,
|
|
6737
|
+
createFocusTrap: Ht,
|
|
6177
6738
|
createFocusScope: Ot,
|
|
6178
|
-
createRovingTabindex:
|
|
6739
|
+
createRovingTabindex: Rt,
|
|
6179
6740
|
// Keyboard utilities
|
|
6180
|
-
createKeyboardManager:
|
|
6181
|
-
KeyboardPatterns:
|
|
6182
|
-
createTypeAhead:
|
|
6741
|
+
createKeyboardManager: qt,
|
|
6742
|
+
KeyboardPatterns: Dt,
|
|
6743
|
+
createTypeAhead: R,
|
|
6183
6744
|
// ARIA utilities
|
|
6184
|
-
aria:
|
|
6745
|
+
aria: zt,
|
|
6185
6746
|
buildAriaProps: Ct,
|
|
6186
|
-
hasAccessibleName:
|
|
6747
|
+
hasAccessibleName: Tt,
|
|
6187
6748
|
// Platform detection
|
|
6188
|
-
isBrowser:
|
|
6749
|
+
isBrowser: It,
|
|
6189
6750
|
prefersReducedMotion: Lt,
|
|
6190
|
-
prefersHighContrast:
|
|
6191
|
-
prefersDarkMode:
|
|
6751
|
+
prefersHighContrast: $t,
|
|
6752
|
+
prefersDarkMode: St
|
|
6192
6753
|
};
|
|
6193
6754
|
}
|
|
6194
6755
|
export {
|
|
6195
6756
|
xt as A11yAccordion,
|
|
6196
|
-
|
|
6757
|
+
pt as A11yAlert,
|
|
6197
6758
|
st as A11yButton,
|
|
6198
6759
|
H as A11yCheckbox,
|
|
6199
6760
|
nt as A11yCheckboxGroup,
|
|
6200
6761
|
Q as A11yCombobox,
|
|
6201
|
-
|
|
6762
|
+
W as A11yDialog,
|
|
6202
6763
|
yt as A11yFormField,
|
|
6203
6764
|
ft as A11yHeading,
|
|
6204
6765
|
et as A11yInput,
|
|
6205
|
-
|
|
6766
|
+
bt as A11yLink,
|
|
6206
6767
|
ot as A11yListbox,
|
|
6207
|
-
|
|
6768
|
+
X as A11yMenu,
|
|
6208
6769
|
at as A11yOptgroup,
|
|
6209
6770
|
rt as A11yOption,
|
|
6771
|
+
Et as A11yPagination,
|
|
6210
6772
|
_t as A11yPopover,
|
|
6211
6773
|
dt as A11yRadio,
|
|
6212
6774
|
lt as A11yRadioGroup,
|
|
@@ -6217,26 +6779,26 @@ export {
|
|
|
6217
6779
|
J as A11yTabs,
|
|
6218
6780
|
vt as A11yText,
|
|
6219
6781
|
it as A11yTextarea,
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6782
|
+
ct as A11yToast,
|
|
6783
|
+
ht as A11yVisuallyHidden,
|
|
6784
|
+
Le as KeyboardPatterns,
|
|
6785
|
+
Ie as announce,
|
|
6786
|
+
Te as announceAssertive,
|
|
6787
|
+
Ce as announceError,
|
|
6788
|
+
ze as announcePolite,
|
|
6789
|
+
De as announceStatus,
|
|
6790
|
+
qe as aria,
|
|
6791
|
+
Re as buildAriaProps,
|
|
6792
|
+
Oe as createFocusScope,
|
|
6793
|
+
He as createFocusTrap,
|
|
6794
|
+
Pe as createKeyboardManager,
|
|
6795
|
+
Be as createRovingTabindex,
|
|
6796
|
+
Me as createTypeAhead,
|
|
6797
|
+
Fe as hasAccessibleName,
|
|
6798
|
+
Ke as initAnnouncer,
|
|
6799
|
+
Ne as initFocusVisible,
|
|
6800
|
+
je as isBrowser,
|
|
6801
|
+
Ye as prefersDarkMode,
|
|
6802
|
+
Ue as prefersHighContrast,
|
|
6803
|
+
Ge as prefersReducedMotion
|
|
6242
6804
|
};
|