@compa11y/web 0.1.9 → 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 +1006 -174
- package/dist/compa11y.js +2199 -306
- package/dist/components/accordion.d.ts +30 -0
- package/dist/components/form-field.d.ts +14 -0
- package/dist/components/link.d.ts +8 -0
- package/dist/components/pagination.d.ts +45 -0
- package/dist/components/popover.d.ts +47 -0
- package/dist/components/table.d.ts +78 -0
- package/dist/components/text.d.ts +16 -0
- package/dist/index.d.ts +8 -1
- package/dist/utils/styles.d.ts +9 -0
- 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 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
|
+
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 h extends HTMLElement {
|
|
|
74
74
|
return (i == null ? void 0 : i.assignedElements()) ?? [];
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
customElements.get(
|
|
77
|
+
function p(l, t) {
|
|
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;
|
|
@@ -87,7 +87,7 @@ const F = `
|
|
|
87
87
|
clip: rect(0, 0, 0, 0);
|
|
88
88
|
white-space: nowrap;
|
|
89
89
|
border: 0;
|
|
90
|
-
`,
|
|
90
|
+
`, z = `
|
|
91
91
|
appearance: none;
|
|
92
92
|
background: none;
|
|
93
93
|
border: none;
|
|
@@ -96,13 +96,13 @@ const F = `
|
|
|
96
96
|
font: inherit;
|
|
97
97
|
color: inherit;
|
|
98
98
|
cursor: pointer;
|
|
99
|
-
`,
|
|
99
|
+
`, G = `
|
|
100
100
|
:host(:focus-visible),
|
|
101
101
|
:focus-visible {
|
|
102
102
|
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
103
103
|
outline-offset: 2px;
|
|
104
104
|
}
|
|
105
|
-
`,
|
|
105
|
+
`, g = `
|
|
106
106
|
:host {
|
|
107
107
|
display: block;
|
|
108
108
|
box-sizing: border-box;
|
|
@@ -118,9 +118,9 @@ const F = `
|
|
|
118
118
|
box-sizing: inherit;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
${
|
|
122
|
-
`,
|
|
123
|
-
${
|
|
121
|
+
${G}
|
|
122
|
+
`, Mt = `
|
|
123
|
+
${g}
|
|
124
124
|
|
|
125
125
|
:host {
|
|
126
126
|
position: fixed;
|
|
@@ -158,8 +158,8 @@ const F = `
|
|
|
158
158
|
margin: 0 0 1rem 0;
|
|
159
159
|
color: var(--compa11y-dialog-description-color, #666);
|
|
160
160
|
}
|
|
161
|
-
`,
|
|
162
|
-
${
|
|
161
|
+
`, Ft = `
|
|
162
|
+
${g}
|
|
163
163
|
|
|
164
164
|
:host {
|
|
165
165
|
position: relative;
|
|
@@ -210,8 +210,8 @@ const F = `
|
|
|
210
210
|
margin: 0.25rem 0;
|
|
211
211
|
background: var(--compa11y-menu-separator-color, #e0e0e0);
|
|
212
212
|
}
|
|
213
|
-
`,
|
|
214
|
-
${
|
|
213
|
+
`, Kt = `
|
|
214
|
+
${g}
|
|
215
215
|
|
|
216
216
|
.tablist {
|
|
217
217
|
display: flex;
|
|
@@ -226,7 +226,7 @@ const F = `
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
::slotted([role="tab"]) {
|
|
229
|
-
${
|
|
229
|
+
${z}
|
|
230
230
|
padding: var(--compa11y-tab-padding, 0.75rem 1rem);
|
|
231
231
|
border-bottom: 2px solid transparent;
|
|
232
232
|
margin-bottom: -1px;
|
|
@@ -256,8 +256,8 @@ const F = `
|
|
|
256
256
|
::slotted([role="tabpanel"][hidden]) {
|
|
257
257
|
display: none;
|
|
258
258
|
}
|
|
259
|
-
`,
|
|
260
|
-
${
|
|
259
|
+
`, Nt = `
|
|
260
|
+
${g}
|
|
261
261
|
|
|
262
262
|
:host {
|
|
263
263
|
display: inline-block;
|
|
@@ -315,7 +315,7 @@ const F = `
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
.clear-button {
|
|
318
|
-
${
|
|
318
|
+
${z}
|
|
319
319
|
position: absolute;
|
|
320
320
|
right: 1.5rem;
|
|
321
321
|
width: 1.25rem;
|
|
@@ -397,8 +397,8 @@ const F = `
|
|
|
397
397
|
.options-source {
|
|
398
398
|
display: none;
|
|
399
399
|
}
|
|
400
|
-
`,
|
|
401
|
-
${
|
|
400
|
+
`, jt = `
|
|
401
|
+
${g}
|
|
402
402
|
|
|
403
403
|
:host {
|
|
404
404
|
display: inline-block;
|
|
@@ -527,8 +527,8 @@ const F = `
|
|
|
527
527
|
.options-source {
|
|
528
528
|
display: none;
|
|
529
529
|
}
|
|
530
|
-
`,
|
|
531
|
-
${
|
|
530
|
+
`, Yt = `
|
|
531
|
+
${g}
|
|
532
532
|
|
|
533
533
|
:host {
|
|
534
534
|
display: inline-block;
|
|
@@ -631,8 +631,8 @@ const F = `
|
|
|
631
631
|
opacity: 0.5;
|
|
632
632
|
cursor: not-allowed;
|
|
633
633
|
}
|
|
634
|
-
`,
|
|
635
|
-
${
|
|
634
|
+
`, Ut = `
|
|
635
|
+
${g}
|
|
636
636
|
|
|
637
637
|
:host {
|
|
638
638
|
display: block;
|
|
@@ -710,8 +710,8 @@ const F = `
|
|
|
710
710
|
color: var(--compa11y-input-error-color, #ef4444);
|
|
711
711
|
font-size: var(--compa11y-input-error-size, 0.8125rem);
|
|
712
712
|
}
|
|
713
|
-
`,
|
|
714
|
-
${
|
|
713
|
+
`, Gt = `
|
|
714
|
+
${g}
|
|
715
715
|
|
|
716
716
|
:host {
|
|
717
717
|
display: block;
|
|
@@ -791,8 +791,8 @@ const F = `
|
|
|
791
791
|
color: var(--compa11y-textarea-error-color, #ef4444);
|
|
792
792
|
font-size: var(--compa11y-textarea-error-size, 0.8125rem);
|
|
793
793
|
}
|
|
794
|
-
`,
|
|
795
|
-
${
|
|
794
|
+
`, Vt = `
|
|
795
|
+
${g}
|
|
796
796
|
|
|
797
797
|
:host {
|
|
798
798
|
display: inline-block;
|
|
@@ -906,8 +906,8 @@ const F = `
|
|
|
906
906
|
border-radius: 50%;
|
|
907
907
|
animation: compa11y-spin 0.6s linear infinite;
|
|
908
908
|
}
|
|
909
|
-
`,
|
|
910
|
-
${
|
|
909
|
+
`, Wt = `
|
|
910
|
+
${g}
|
|
911
911
|
|
|
912
912
|
:host {
|
|
913
913
|
display: block;
|
|
@@ -940,8 +940,8 @@ const F = `
|
|
|
940
940
|
max-height: none;
|
|
941
941
|
overflow-y: visible;
|
|
942
942
|
}
|
|
943
|
-
`,
|
|
944
|
-
${
|
|
943
|
+
`, Xt = `
|
|
944
|
+
${g}
|
|
945
945
|
|
|
946
946
|
:host {
|
|
947
947
|
display: block;
|
|
@@ -989,8 +989,8 @@ const F = `
|
|
|
989
989
|
:host([aria-selected="true"]) .check-mark {
|
|
990
990
|
visibility: visible;
|
|
991
991
|
}
|
|
992
|
-
`,
|
|
993
|
-
${
|
|
992
|
+
`, Jt = `
|
|
993
|
+
${g}
|
|
994
994
|
|
|
995
995
|
:host {
|
|
996
996
|
display: block;
|
|
@@ -1008,8 +1008,8 @@ const F = `
|
|
|
1008
1008
|
:host([disabled]) {
|
|
1009
1009
|
opacity: 0.5;
|
|
1010
1010
|
}
|
|
1011
|
-
`,
|
|
1012
|
-
${
|
|
1011
|
+
`, Qt = `
|
|
1012
|
+
${g}
|
|
1013
1013
|
|
|
1014
1014
|
:host {
|
|
1015
1015
|
display: inline-block;
|
|
@@ -1171,8 +1171,8 @@ const F = `
|
|
|
1171
1171
|
color: HighlightText;
|
|
1172
1172
|
}
|
|
1173
1173
|
}
|
|
1174
|
-
`,
|
|
1175
|
-
${
|
|
1174
|
+
`, Zt = `
|
|
1175
|
+
${g}
|
|
1176
1176
|
|
|
1177
1177
|
:host {
|
|
1178
1178
|
display: block;
|
|
@@ -1213,8 +1213,8 @@ const F = `
|
|
|
1213
1213
|
:host([disabled]) {
|
|
1214
1214
|
opacity: 0.5;
|
|
1215
1215
|
}
|
|
1216
|
-
`,
|
|
1217
|
-
${
|
|
1216
|
+
`, te = `
|
|
1217
|
+
${g}
|
|
1218
1218
|
|
|
1219
1219
|
:host {
|
|
1220
1220
|
display: block;
|
|
@@ -1266,8 +1266,8 @@ const F = `
|
|
|
1266
1266
|
:host([disabled]) {
|
|
1267
1267
|
opacity: 0.5;
|
|
1268
1268
|
}
|
|
1269
|
-
`,
|
|
1270
|
-
${
|
|
1269
|
+
`, ee = `
|
|
1270
|
+
${g}
|
|
1271
1271
|
|
|
1272
1272
|
:host {
|
|
1273
1273
|
display: inline-block;
|
|
@@ -1386,8 +1386,8 @@ const F = `
|
|
|
1386
1386
|
background: HighlightText;
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
|
-
`,
|
|
1390
|
-
${
|
|
1389
|
+
`, ie = `
|
|
1390
|
+
${g}
|
|
1391
1391
|
|
|
1392
1392
|
:host {
|
|
1393
1393
|
position: fixed;
|
|
@@ -1455,7 +1455,7 @@ const F = `
|
|
|
1455
1455
|
}
|
|
1456
1456
|
|
|
1457
1457
|
.toast-close {
|
|
1458
|
-
${
|
|
1458
|
+
${z}
|
|
1459
1459
|
flex-shrink: 0;
|
|
1460
1460
|
width: 1.5rem;
|
|
1461
1461
|
height: 1.5rem;
|
|
@@ -1479,7 +1479,7 @@ const F = `
|
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
1481
1481
|
.toast-action {
|
|
1482
|
-
${
|
|
1482
|
+
${z}
|
|
1483
1483
|
margin-top: 0.375rem;
|
|
1484
1484
|
font-size: var(--compa11y-toast-action-size, 0.8125rem);
|
|
1485
1485
|
font-weight: 500;
|
|
@@ -1495,15 +1495,430 @@ const F = `
|
|
|
1495
1495
|
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
1496
1496
|
outline-offset: 2px;
|
|
1497
1497
|
}
|
|
1498
|
+
`, se = `
|
|
1499
|
+
a11y-accordion {
|
|
1500
|
+
display: block;
|
|
1501
|
+
border: 1px solid var(--compa11y-accordion-border-color, #e0e0e0);
|
|
1502
|
+
border-radius: var(--compa11y-accordion-radius, 6px);
|
|
1503
|
+
overflow: hidden;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
a11y-accordion h1,
|
|
1507
|
+
a11y-accordion h2,
|
|
1508
|
+
a11y-accordion h3,
|
|
1509
|
+
a11y-accordion h4,
|
|
1510
|
+
a11y-accordion h5,
|
|
1511
|
+
a11y-accordion h6 {
|
|
1512
|
+
margin: 0;
|
|
1513
|
+
font-size: inherit;
|
|
1514
|
+
font-weight: inherit;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
a11y-accordion [data-accordion-trigger] {
|
|
1518
|
+
appearance: none;
|
|
1519
|
+
-webkit-appearance: none;
|
|
1520
|
+
background: var(--compa11y-accordion-trigger-bg, #ffffff);
|
|
1521
|
+
border: none;
|
|
1522
|
+
border-bottom: 1px solid var(--compa11y-accordion-border-color, #e0e0e0);
|
|
1523
|
+
padding: var(--compa11y-accordion-trigger-padding, 1rem);
|
|
1524
|
+
font: inherit;
|
|
1525
|
+
font-size: 1rem;
|
|
1526
|
+
font-weight: 500;
|
|
1527
|
+
color: var(--compa11y-accordion-trigger-color, #1a1a1a);
|
|
1528
|
+
width: 100%;
|
|
1529
|
+
text-align: left;
|
|
1530
|
+
cursor: pointer;
|
|
1531
|
+
display: flex;
|
|
1532
|
+
align-items: center;
|
|
1533
|
+
justify-content: space-between;
|
|
1534
|
+
gap: 0.5rem;
|
|
1535
|
+
transition: background 0.15s ease;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
a11y-accordion [data-accordion-trigger]:hover {
|
|
1539
|
+
background: var(--compa11y-accordion-trigger-hover-bg, #f9f9f9);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
a11y-accordion [data-accordion-trigger]:focus-visible {
|
|
1543
|
+
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
1544
|
+
outline-offset: -2px;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
a11y-accordion [data-accordion-trigger][aria-disabled="true"],
|
|
1548
|
+
a11y-accordion [data-accordion-trigger]:disabled {
|
|
1549
|
+
opacity: 0.5;
|
|
1550
|
+
cursor: not-allowed;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
a11y-accordion [data-accordion-trigger]::after {
|
|
1554
|
+
content: '';
|
|
1555
|
+
flex-shrink: 0;
|
|
1556
|
+
width: 0.5rem;
|
|
1557
|
+
height: 0.5rem;
|
|
1558
|
+
border-right: 2px solid currentColor;
|
|
1559
|
+
border-bottom: 2px solid currentColor;
|
|
1560
|
+
transform: rotate(45deg) translateY(-2px);
|
|
1561
|
+
transition: transform 0.2s ease;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
a11y-accordion [data-accordion-trigger][aria-expanded="true"]::after {
|
|
1565
|
+
transform: rotate(-135deg) translateY(-2px);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
a11y-accordion [data-accordion-panel] {
|
|
1569
|
+
padding: var(--compa11y-accordion-content-padding, 1rem);
|
|
1570
|
+
background: var(--compa11y-accordion-content-bg, #ffffff);
|
|
1571
|
+
border-bottom: 1px solid var(--compa11y-accordion-border-color, #e0e0e0);
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
a11y-accordion [data-accordion-panel][hidden] {
|
|
1575
|
+
display: none;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
a11y-accordion > *:last-child [data-accordion-trigger],
|
|
1579
|
+
a11y-accordion > [data-accordion-panel]:last-child {
|
|
1580
|
+
border-bottom: none;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1584
|
+
a11y-accordion [data-accordion-trigger],
|
|
1585
|
+
a11y-accordion [data-accordion-trigger]::after {
|
|
1586
|
+
transition: none;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
@media (forced-colors: active) {
|
|
1591
|
+
a11y-accordion {
|
|
1592
|
+
border: 2px solid ButtonText;
|
|
1593
|
+
}
|
|
1594
|
+
a11y-accordion [data-accordion-trigger] {
|
|
1595
|
+
border-bottom: 1px solid ButtonText;
|
|
1596
|
+
forced-color-adjust: none;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
`, ae = `
|
|
1600
|
+
/* ── Host ── */
|
|
1601
|
+
a11y-table {
|
|
1602
|
+
display: block;
|
|
1603
|
+
overflow-x: auto;
|
|
1604
|
+
-webkit-overflow-scrolling: touch;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
/* ── Table element ── */
|
|
1608
|
+
a11y-table table {
|
|
1609
|
+
border-collapse: collapse;
|
|
1610
|
+
width: 100%;
|
|
1611
|
+
font-size: 0.9375rem;
|
|
1612
|
+
color: var(--compa11y-table-color, #1a1a1a);
|
|
1613
|
+
background: var(--compa11y-table-bg, #ffffff);
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
/* ── Caption ── */
|
|
1617
|
+
a11y-table caption {
|
|
1618
|
+
caption-side: top;
|
|
1619
|
+
text-align: left;
|
|
1620
|
+
font-weight: 600;
|
|
1621
|
+
font-size: 1rem;
|
|
1622
|
+
padding-bottom: 0.5rem;
|
|
1623
|
+
color: var(--compa11y-table-caption-color, #1a1a1a);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/* ── Header cells ── */
|
|
1627
|
+
a11y-table th {
|
|
1628
|
+
text-align: left;
|
|
1629
|
+
font-weight: 600;
|
|
1630
|
+
padding: var(--compa11y-table-cell-padding, 0.625rem 0.875rem);
|
|
1631
|
+
background: var(--compa11y-table-head-bg, #f5f5f5);
|
|
1632
|
+
border-bottom: 2px solid var(--compa11y-table-border-color, #d0d0d0);
|
|
1633
|
+
white-space: nowrap;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/* ── Data cells ── */
|
|
1637
|
+
a11y-table td {
|
|
1638
|
+
padding: var(--compa11y-table-cell-padding, 0.625rem 0.875rem);
|
|
1639
|
+
border-bottom: 1px solid var(--compa11y-table-border-color, #e8e8e8);
|
|
1640
|
+
vertical-align: top;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
/* ── Row hover ── */
|
|
1644
|
+
a11y-table tbody tr:hover {
|
|
1645
|
+
background: var(--compa11y-table-row-hover-bg, #fafafa);
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
/* ── Selected row ── */
|
|
1649
|
+
a11y-table tr[aria-selected="true"] {
|
|
1650
|
+
background: var(--compa11y-table-selected-bg, #e8f0fe);
|
|
1651
|
+
}
|
|
1652
|
+
a11y-table tr[aria-selected="true"]:hover {
|
|
1653
|
+
background: var(--compa11y-table-selected-hover-bg, #dde7fd);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/* ── Sort button ── */
|
|
1657
|
+
a11y-table [data-sort-btn] {
|
|
1658
|
+
appearance: none;
|
|
1659
|
+
-webkit-appearance: none;
|
|
1660
|
+
background: none;
|
|
1661
|
+
border: none;
|
|
1662
|
+
padding: 0;
|
|
1663
|
+
margin: 0;
|
|
1664
|
+
font: inherit;
|
|
1665
|
+
color: inherit;
|
|
1666
|
+
cursor: pointer;
|
|
1667
|
+
display: inline-flex;
|
|
1668
|
+
align-items: center;
|
|
1669
|
+
gap: 0.375em;
|
|
1670
|
+
text-align: left;
|
|
1671
|
+
width: 100%;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
a11y-table [data-sort-btn]:focus-visible {
|
|
1675
|
+
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
1676
|
+
outline-offset: 2px;
|
|
1677
|
+
border-radius: 2px;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
a11y-table [data-sort-icon] {
|
|
1681
|
+
font-size: 0.75em;
|
|
1682
|
+
opacity: 0.6;
|
|
1683
|
+
flex-shrink: 0;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/* ── Select checkboxes ── */
|
|
1687
|
+
a11y-table [data-select-cb] {
|
|
1688
|
+
cursor: pointer;
|
|
1689
|
+
width: 1rem;
|
|
1690
|
+
height: 1rem;
|
|
1691
|
+
}
|
|
1692
|
+
a11y-table [data-select-cb]:focus-visible {
|
|
1693
|
+
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
1694
|
+
outline-offset: 2px;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
/* ── Empty / Loading cells ── */
|
|
1698
|
+
a11y-table [data-empty-cell],
|
|
1699
|
+
a11y-table [data-loading-cell] {
|
|
1700
|
+
text-align: center;
|
|
1701
|
+
padding: 2rem 1rem;
|
|
1702
|
+
color: var(--compa11y-table-muted-color, #6b6b6b);
|
|
1703
|
+
font-style: italic;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
/* ── Footer ── */
|
|
1707
|
+
a11y-table tfoot td,
|
|
1708
|
+
a11y-table tfoot th {
|
|
1709
|
+
background: var(--compa11y-table-foot-bg, #f5f5f5);
|
|
1710
|
+
border-top: 2px solid var(--compa11y-table-border-color, #d0d0d0);
|
|
1711
|
+
border-bottom: none;
|
|
1712
|
+
font-weight: 600;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
/* ── Reduced motion ── */
|
|
1716
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1717
|
+
a11y-table tr,
|
|
1718
|
+
a11y-table td,
|
|
1719
|
+
a11y-table th {
|
|
1720
|
+
transition: none;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/* ── Windows High Contrast ── */
|
|
1725
|
+
@media (forced-colors: active) {
|
|
1726
|
+
a11y-table table {
|
|
1727
|
+
border: 1px solid ButtonText;
|
|
1728
|
+
forced-color-adjust: none;
|
|
1729
|
+
}
|
|
1730
|
+
a11y-table th,
|
|
1731
|
+
a11y-table td {
|
|
1732
|
+
border: 1px solid ButtonText;
|
|
1733
|
+
}
|
|
1734
|
+
a11y-table tr[aria-selected="true"] {
|
|
1735
|
+
outline: 2px solid Highlight;
|
|
1736
|
+
}
|
|
1737
|
+
a11y-table [data-sort-btn]:focus-visible {
|
|
1738
|
+
outline: 2px solid Highlight;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
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
|
+
}
|
|
1498
1913
|
`, M = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
1499
|
-
let L = 0,
|
|
1500
|
-
function
|
|
1501
|
-
L === 0 && (
|
|
1914
|
+
let L = 0, V = "";
|
|
1915
|
+
function oe() {
|
|
1916
|
+
L === 0 && (V = document.body.style.overflow, document.body.style.overflow = "hidden"), L++;
|
|
1502
1917
|
}
|
|
1503
|
-
function
|
|
1504
|
-
L--, L <= 0 && (L = 0, document.body.style.overflow =
|
|
1918
|
+
function ne() {
|
|
1919
|
+
L--, L <= 0 && (L = 0, document.body.style.overflow = V);
|
|
1505
1920
|
}
|
|
1506
|
-
class
|
|
1921
|
+
class W extends u {
|
|
1507
1922
|
constructor() {
|
|
1508
1923
|
super(...arguments), this._open = !1, this._previouslyFocused = null, this._triggerElement = null, this.handleTriggerClick = () => {
|
|
1509
1924
|
this.open = !0;
|
|
@@ -1522,13 +1937,13 @@ class j extends h {
|
|
|
1522
1937
|
if (i.length === 0) return;
|
|
1523
1938
|
const s = ((e = this.shadowRoot) == null ? void 0 : e.activeElement) || document.activeElement;
|
|
1524
1939
|
let a = i.findIndex(
|
|
1525
|
-
(
|
|
1940
|
+
(n) => n === s
|
|
1526
1941
|
);
|
|
1527
1942
|
a === -1 && (a = t.shiftKey ? 0 : i.length - 1);
|
|
1528
1943
|
let r;
|
|
1529
1944
|
t.shiftKey ? r = a === 0 ? i.length - 1 : a - 1 : r = a === i.length - 1 ? 0 : a + 1;
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1945
|
+
const o = i[r];
|
|
1946
|
+
o && o.focus();
|
|
1532
1947
|
}
|
|
1533
1948
|
}
|
|
1534
1949
|
};
|
|
@@ -1548,7 +1963,7 @@ class j extends h {
|
|
|
1548
1963
|
render() {
|
|
1549
1964
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-title`, i = `${this._id}-desc`;
|
|
1550
1965
|
t.innerHTML = `
|
|
1551
|
-
<style>${
|
|
1966
|
+
<style>${Mt}</style>
|
|
1552
1967
|
<div class="overlay" part="overlay"></div>
|
|
1553
1968
|
<div
|
|
1554
1969
|
class="dialog"
|
|
@@ -1612,11 +2027,11 @@ class j extends h {
|
|
|
1612
2027
|
this._previouslyFocused = document.activeElement, this.style.display = "flex", requestAnimationFrame(() => {
|
|
1613
2028
|
const e = this.getFocusableElements()[0];
|
|
1614
2029
|
e && e.focus();
|
|
1615
|
-
}),
|
|
2030
|
+
}), oe(), v("Dialog opened", { politeness: "polite" }), this.emit("a11y-dialog-open");
|
|
1616
2031
|
}
|
|
1617
2032
|
hideDialog() {
|
|
1618
2033
|
var t;
|
|
1619
|
-
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");
|
|
1620
2035
|
}
|
|
1621
2036
|
/**
|
|
1622
2037
|
* Programmatic open
|
|
@@ -1631,8 +2046,8 @@ class j extends h {
|
|
|
1631
2046
|
this.open = !1;
|
|
1632
2047
|
}
|
|
1633
2048
|
}
|
|
1634
|
-
|
|
1635
|
-
class
|
|
2049
|
+
p("a11y-dialog", W);
|
|
2050
|
+
class X extends u {
|
|
1636
2051
|
constructor() {
|
|
1637
2052
|
super(...arguments), this._open = !1, this._highlightedIndex = -1, this._menuItems = [], this._triggerEl = null, this._triggerSlotEl = null, this._defaultSlotEl = null, this.updateMenuItems = () => {
|
|
1638
2053
|
this._menuItems = Array.from(
|
|
@@ -1722,7 +2137,7 @@ class Y extends h {
|
|
|
1722
2137
|
render() {
|
|
1723
2138
|
const t = this.attachShadow({ mode: "open" });
|
|
1724
2139
|
t.innerHTML = `
|
|
1725
|
-
<style>${
|
|
2140
|
+
<style>${Ft}</style>
|
|
1726
2141
|
<slot name="trigger"></slot>
|
|
1727
2142
|
<div
|
|
1728
2143
|
class="menu-content"
|
|
@@ -1797,8 +2212,8 @@ class Y extends h {
|
|
|
1797
2212
|
this.open = !this._open;
|
|
1798
2213
|
}
|
|
1799
2214
|
}
|
|
1800
|
-
|
|
1801
|
-
class
|
|
2215
|
+
p("a11y-menu", X);
|
|
2216
|
+
class J extends u {
|
|
1802
2217
|
constructor() {
|
|
1803
2218
|
super(...arguments), this._tabs = [], this._panels = [], this._selectedIndex = 0, this._focusedIndex = 0, this._tabSlotEl = null, this._panelSlotEl = null, this._defaultSlotEl = null, this.updateTabsAndPanels = () => {
|
|
1804
2219
|
this._tabs = Array.from(
|
|
@@ -1816,7 +2231,7 @@ class U extends h {
|
|
|
1816
2231
|
i !== -1 && e.getAttribute("aria-disabled") !== "true" && (this._focusedIndex = i, this.selectTab(i));
|
|
1817
2232
|
}
|
|
1818
2233
|
}, this.handleKeyDown = (t) => {
|
|
1819
|
-
var
|
|
2234
|
+
var o;
|
|
1820
2235
|
if (t.target.getAttribute("role") !== "tab") return;
|
|
1821
2236
|
const i = this.orientation === "horizontal", s = i ? "ArrowRight" : "ArrowDown", a = i ? "ArrowLeft" : "ArrowUp";
|
|
1822
2237
|
let r = this._focusedIndex;
|
|
@@ -1840,7 +2255,7 @@ class U extends h {
|
|
|
1840
2255
|
default:
|
|
1841
2256
|
return;
|
|
1842
2257
|
}
|
|
1843
|
-
this._focusedIndex = r, (
|
|
2258
|
+
this._focusedIndex = r, (o = this._tabs[r]) == null || o.focus(), this.activationMode === "automatic" && this.selectTab(r);
|
|
1844
2259
|
};
|
|
1845
2260
|
}
|
|
1846
2261
|
static get observedAttributes() {
|
|
@@ -1864,7 +2279,7 @@ class U extends h {
|
|
|
1864
2279
|
render() {
|
|
1865
2280
|
const t = this.attachShadow({ mode: "open" });
|
|
1866
2281
|
t.innerHTML = `
|
|
1867
|
-
<style>${
|
|
2282
|
+
<style>${Kt}</style>
|
|
1868
2283
|
<div class="tablist" role="tablist" aria-orientation="${this.orientation}" part="tablist">
|
|
1869
2284
|
<slot name="tab"></slot>
|
|
1870
2285
|
</div>
|
|
@@ -1930,8 +2345,8 @@ class U extends h {
|
|
|
1930
2345
|
);
|
|
1931
2346
|
}
|
|
1932
2347
|
}
|
|
1933
|
-
|
|
1934
|
-
class
|
|
2348
|
+
p("a11y-tabs", J);
|
|
2349
|
+
class Q extends u {
|
|
1935
2350
|
constructor() {
|
|
1936
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 = () => {
|
|
1937
2352
|
const t = Array.from(this.querySelectorAll("option"));
|
|
@@ -2023,7 +2438,7 @@ class V extends h {
|
|
|
2023
2438
|
render() {
|
|
2024
2439
|
const t = this.attachShadow({ mode: "open" }), e = `${this._id}-input`, i = `${this._id}-listbox`, s = this.getAttribute("placeholder") || "Search...", a = this.hasAttribute("clearable");
|
|
2025
2440
|
t.innerHTML = `
|
|
2026
|
-
<style>${
|
|
2441
|
+
<style>${Nt}</style>
|
|
2027
2442
|
<div class="combobox-wrapper" part="wrapper">
|
|
2028
2443
|
<div class="input-wrapper" part="input-wrapper">
|
|
2029
2444
|
<input
|
|
@@ -2066,11 +2481,11 @@ class V extends h {
|
|
|
2066
2481
|
`, this._inputElement = t.querySelector("input"), this._listboxElement = t.querySelector(".listbox");
|
|
2067
2482
|
}
|
|
2068
2483
|
setupEventListeners() {
|
|
2069
|
-
var i, s, a, r,
|
|
2484
|
+
var i, s, a, r, o, n;
|
|
2070
2485
|
(i = this._inputElement) == null || i.addEventListener("input", this.handleInput), (s = this._inputElement) == null || s.addEventListener("focus", this.handleFocus), (a = this._inputElement) == null || a.addEventListener("blur", this.handleBlur), (r = this._inputElement) == null || r.addEventListener("keydown", this.handleKeyDown);
|
|
2071
|
-
const t = (
|
|
2486
|
+
const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".clear-button");
|
|
2072
2487
|
t == null || t.addEventListener("click", this.handleClear), document.addEventListener("mousedown", this.handleOutsideClick);
|
|
2073
|
-
const e = (
|
|
2488
|
+
const e = (n = this.shadowRoot) == null ? void 0 : n.querySelector("slot");
|
|
2074
2489
|
e == null || e.addEventListener("slotchange", this.updateOptions), this.updateOptions();
|
|
2075
2490
|
}
|
|
2076
2491
|
cleanupEventListeners() {
|
|
@@ -2156,8 +2571,8 @@ class V extends h {
|
|
|
2156
2571
|
this.handleClear();
|
|
2157
2572
|
}
|
|
2158
2573
|
}
|
|
2159
|
-
|
|
2160
|
-
class
|
|
2574
|
+
p("a11y-combobox", Q);
|
|
2575
|
+
class Z extends u {
|
|
2161
2576
|
constructor() {
|
|
2162
2577
|
super(...arguments), this._checked = !1, this._button = null, this._label = null, this.handleClick = () => {
|
|
2163
2578
|
this.toggle();
|
|
@@ -2219,7 +2634,7 @@ class G extends h {
|
|
|
2219
2634
|
render() {
|
|
2220
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}"` : "";
|
|
2221
2636
|
t.innerHTML = `
|
|
2222
|
-
<style>${
|
|
2637
|
+
<style>${Yt}</style>
|
|
2223
2638
|
<div class="switch-wrapper size-${this.size}" part="wrapper">
|
|
2224
2639
|
<button
|
|
2225
2640
|
type="button"
|
|
@@ -2290,7 +2705,7 @@ class G extends h {
|
|
|
2290
2705
|
if (this.disabled) return;
|
|
2291
2706
|
this.checked = !this.checked;
|
|
2292
2707
|
const t = this.label || this.getAttribute("aria-label") || "Switch";
|
|
2293
|
-
|
|
2708
|
+
f(`${t} ${this.checked ? "on" : "off"}`);
|
|
2294
2709
|
}
|
|
2295
2710
|
/**
|
|
2296
2711
|
* Public method to open/close programmatically
|
|
@@ -2299,8 +2714,8 @@ class G extends h {
|
|
|
2299
2714
|
this.checked = t;
|
|
2300
2715
|
}
|
|
2301
2716
|
}
|
|
2302
|
-
|
|
2303
|
-
class
|
|
2717
|
+
p("a11y-switch", Z);
|
|
2718
|
+
class tt extends u {
|
|
2304
2719
|
constructor() {
|
|
2305
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 = () => {
|
|
2306
2721
|
const t = Array.from(this.querySelectorAll("option"));
|
|
@@ -2309,7 +2724,7 @@ class X extends h {
|
|
|
2309
2724
|
label: e.textContent || "",
|
|
2310
2725
|
disabled: e.hasAttribute("disabled"),
|
|
2311
2726
|
element: e
|
|
2312
|
-
})), this._typeAhead =
|
|
2727
|
+
})), this._typeAhead = R(
|
|
2313
2728
|
this._options.map((e) => e.label),
|
|
2314
2729
|
{ timeout: 500 }
|
|
2315
2730
|
), this.renderOptions(), this.updateTriggerText();
|
|
@@ -2400,7 +2815,7 @@ class X extends h {
|
|
|
2400
2815
|
render() {
|
|
2401
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") || "";
|
|
2402
2817
|
t.innerHTML = `
|
|
2403
|
-
<style>${
|
|
2818
|
+
<style>${jt}</style>
|
|
2404
2819
|
<div class="select-wrapper" part="wrapper">
|
|
2405
2820
|
<button
|
|
2406
2821
|
id="${e}"
|
|
@@ -2551,8 +2966,8 @@ class X extends h {
|
|
|
2551
2966
|
this.open = !1;
|
|
2552
2967
|
}
|
|
2553
2968
|
}
|
|
2554
|
-
|
|
2555
|
-
class
|
|
2969
|
+
p("a11y-select", tt);
|
|
2970
|
+
class et extends u {
|
|
2556
2971
|
constructor() {
|
|
2557
2972
|
super(...arguments), this._value = "", this._inputEl = null, this._labelEl = null, this._hintEl = null, this._errorEl = null, this.handleInput = (t) => {
|
|
2558
2973
|
const e = t.target;
|
|
@@ -2632,41 +3047,41 @@ class W extends h {
|
|
|
2632
3047
|
));
|
|
2633
3048
|
}
|
|
2634
3049
|
render() {
|
|
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") || "",
|
|
2636
|
-
|
|
2637
|
-
const
|
|
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 = [];
|
|
3051
|
+
o && k.push(s), E && k.push(a);
|
|
3052
|
+
const D = k.length ? `aria-describedby="${k.join(" ")}"` : "", $ = !r && I ? `aria-label="${I}"` : "", kt = !r && T ? `aria-labelledby="${T}"` : r ? `aria-labelledby="${i}"` : "";
|
|
2638
3053
|
this.setAttribute("data-error", E ? "true" : "false"), t.innerHTML = `
|
|
2639
|
-
<style>${
|
|
3054
|
+
<style>${Ut}</style>
|
|
2640
3055
|
<div class="input-wrapper" part="wrapper">
|
|
2641
3056
|
${r ? `<label id="${i}" for="${e}" class="input-label" part="label">
|
|
2642
|
-
${r}${
|
|
3057
|
+
${r}${x ? '<span class="input-required" aria-hidden="true" part="required">*</span>' : ""}
|
|
2643
3058
|
</label>` : ""}
|
|
2644
3059
|
<input
|
|
2645
3060
|
id="${e}"
|
|
2646
|
-
type="${
|
|
3061
|
+
type="${d}"
|
|
2647
3062
|
value="${this._value}"
|
|
2648
|
-
${
|
|
2649
|
-
${
|
|
2650
|
-
${
|
|
2651
|
-
${
|
|
3063
|
+
${h ? `placeholder="${h}"` : ""}
|
|
3064
|
+
${c ? `name="${c}"` : ""}
|
|
3065
|
+
${b ? `autocomplete="${b}"` : ""}
|
|
3066
|
+
${m ? `maxlength="${m}"` : ""}
|
|
2652
3067
|
${_ ? `minlength="${_}"` : ""}
|
|
2653
|
-
${
|
|
2654
|
-
${
|
|
3068
|
+
${y ? `pattern="${y}"` : ""}
|
|
3069
|
+
${S ? `inputmode="${S}"` : ""}
|
|
2655
3070
|
${$}
|
|
2656
|
-
${
|
|
2657
|
-
${
|
|
3071
|
+
${kt}
|
|
3072
|
+
${D}
|
|
2658
3073
|
${E ? 'aria-invalid="true"' : ""}
|
|
2659
|
-
${
|
|
3074
|
+
${x ? 'aria-required="true"' : ""}
|
|
2660
3075
|
${C ? "disabled" : ""}
|
|
2661
|
-
${
|
|
3076
|
+
${A ? "readonly" : ""}
|
|
2662
3077
|
part="field"
|
|
2663
3078
|
/>
|
|
2664
|
-
${
|
|
2665
|
-
${E ? `<div id="${a}" class="input-error" role="alert" part="error">${
|
|
3079
|
+
${o ? `<div id="${s}" class="input-hint" part="hint">${o}</div>` : ""}
|
|
3080
|
+
${E ? `<div id="${a}" class="input-error" role="alert" part="error">${n}</div>` : ""}
|
|
2666
3081
|
</div>
|
|
2667
3082
|
`, this._inputEl = t.querySelector("input"), this._labelEl = t.querySelector("label"), this._hintEl = t.querySelector(".input-hint"), this._errorEl = t.querySelector(".input-error");
|
|
2668
|
-
const
|
|
2669
|
-
|
|
3083
|
+
const q = this.getAttribute("value");
|
|
3084
|
+
q && this._inputEl && (this._value = q, this._inputEl.value = q);
|
|
2670
3085
|
}
|
|
2671
3086
|
setupEventListeners() {
|
|
2672
3087
|
var t, e, i, s;
|
|
@@ -2793,8 +3208,8 @@ class W extends h {
|
|
|
2793
3208
|
(t = this._inputEl) == null || t.select();
|
|
2794
3209
|
}
|
|
2795
3210
|
}
|
|
2796
|
-
|
|
2797
|
-
class
|
|
3211
|
+
p("a11y-input", et);
|
|
3212
|
+
class it extends u {
|
|
2798
3213
|
constructor() {
|
|
2799
3214
|
super(...arguments), this._value = "", this._textareaEl = null, this._labelEl = null, this._hintEl = null, this._errorEl = null, this.handleInput = (t) => {
|
|
2800
3215
|
const e = t.target;
|
|
@@ -2873,34 +3288,34 @@ class J extends h {
|
|
|
2873
3288
|
));
|
|
2874
3289
|
}
|
|
2875
3290
|
render() {
|
|
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") || "",
|
|
2877
|
-
|
|
2878
|
-
const E =
|
|
2879
|
-
this.setAttribute("data-error",
|
|
2880
|
-
<style>${
|
|
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 = [];
|
|
3292
|
+
o && x.push(s), A && x.push(a);
|
|
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}"` : "";
|
|
3294
|
+
this.setAttribute("data-error", A ? "true" : "false"), t.innerHTML = `
|
|
3295
|
+
<style>${Gt}</style>
|
|
2881
3296
|
<div class="textarea-wrapper" part="wrapper">
|
|
2882
3297
|
${r ? `<label id="${i}" for="${e}" class="textarea-label" part="label">
|
|
2883
3298
|
${r}${C ? '<span class="textarea-required" aria-hidden="true" part="required">*</span>' : ""}
|
|
2884
3299
|
</label>` : ""}
|
|
2885
3300
|
<textarea
|
|
2886
3301
|
id="${e}"
|
|
2887
|
-
rows="${
|
|
2888
|
-
${
|
|
2889
|
-
${
|
|
2890
|
-
${
|
|
2891
|
-
${
|
|
3302
|
+
rows="${d}"
|
|
3303
|
+
${h ? `placeholder="${h}"` : ""}
|
|
3304
|
+
${c ? `name="${c}"` : ""}
|
|
3305
|
+
${b ? `autocomplete="${b}"` : ""}
|
|
3306
|
+
${m ? `maxlength="${m}"` : ""}
|
|
2892
3307
|
${_ ? `minlength="${_}"` : ""}
|
|
2893
|
-
${
|
|
2894
|
-
${
|
|
3308
|
+
${k}
|
|
3309
|
+
${D}
|
|
2895
3310
|
${E}
|
|
2896
|
-
${
|
|
3311
|
+
${A ? 'aria-invalid="true"' : ""}
|
|
2897
3312
|
${C ? 'aria-required="true"' : ""}
|
|
2898
|
-
${
|
|
2899
|
-
${
|
|
3313
|
+
${I ? "disabled" : ""}
|
|
3314
|
+
${T ? "readonly" : ""}
|
|
2900
3315
|
part="field"
|
|
2901
3316
|
>${this._value}</textarea>
|
|
2902
|
-
${
|
|
2903
|
-
${
|
|
3317
|
+
${o ? `<div id="${s}" class="textarea-hint" part="hint">${o}</div>` : ""}
|
|
3318
|
+
${A ? `<div id="${a}" class="textarea-error" role="alert" part="error">${n}</div>` : ""}
|
|
2904
3319
|
</div>
|
|
2905
3320
|
`, this._textareaEl = t.querySelector("textarea"), this._labelEl = t.querySelector("label"), this._hintEl = t.querySelector(".textarea-hint"), this._errorEl = t.querySelector(".textarea-error");
|
|
2906
3321
|
const $ = this.getAttribute("value");
|
|
@@ -3028,8 +3443,8 @@ class J extends h {
|
|
|
3028
3443
|
(t = this._textareaEl) == null || t.select();
|
|
3029
3444
|
}
|
|
3030
3445
|
}
|
|
3031
|
-
|
|
3032
|
-
class
|
|
3446
|
+
p("a11y-textarea", it);
|
|
3447
|
+
class st extends u {
|
|
3033
3448
|
constructor() {
|
|
3034
3449
|
super(...arguments), this._buttonEl = null, this.handleClick = (t) => {
|
|
3035
3450
|
if (this.disabled || this.loading) {
|
|
@@ -3094,18 +3509,18 @@ class Q extends h {
|
|
|
3094
3509
|
));
|
|
3095
3510
|
}
|
|
3096
3511
|
render() {
|
|
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,
|
|
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;
|
|
3098
3513
|
t.innerHTML = `
|
|
3099
|
-
<style>${
|
|
3514
|
+
<style>${Vt}</style>
|
|
3100
3515
|
<button
|
|
3101
3516
|
class="variant-${e} size-${i}"
|
|
3102
3517
|
type="${s}"
|
|
3103
|
-
${
|
|
3104
|
-
${
|
|
3105
|
-
${
|
|
3518
|
+
${h ? "disabled" : ""}
|
|
3519
|
+
${d ? 'aria-disabled="true"' : ""}
|
|
3520
|
+
${n ? 'aria-busy="true"' : ""}
|
|
3106
3521
|
${a ? `aria-label="${a}"` : ""}
|
|
3107
3522
|
part="button"
|
|
3108
|
-
>${
|
|
3523
|
+
>${n ? '<span class="button-spinner" aria-hidden="true" part="spinner"></span>' : ""}<slot></slot></button>
|
|
3109
3524
|
`, this._buttonEl = t.querySelector("button");
|
|
3110
3525
|
}
|
|
3111
3526
|
setupEventListeners() {
|
|
@@ -3185,8 +3600,8 @@ class Q extends h {
|
|
|
3185
3600
|
(t = this._buttonEl) == null || t.click();
|
|
3186
3601
|
}
|
|
3187
3602
|
}
|
|
3188
|
-
|
|
3189
|
-
class
|
|
3603
|
+
p("a11y-button", st);
|
|
3604
|
+
class at extends u {
|
|
3190
3605
|
constructor() {
|
|
3191
3606
|
super(...arguments), this._label = "", this._disabled = !1;
|
|
3192
3607
|
}
|
|
@@ -3213,7 +3628,7 @@ class Z extends h {
|
|
|
3213
3628
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
3214
3629
|
const t = `${this._id}-label`;
|
|
3215
3630
|
this.shadowRoot.innerHTML = `
|
|
3216
|
-
<style>${
|
|
3631
|
+
<style>${Jt}</style>
|
|
3217
3632
|
<div class="optgroup-wrapper" part="group">
|
|
3218
3633
|
<div class="optgroup-label" part="label" id="${t}" role="presentation">
|
|
3219
3634
|
${this._label}
|
|
@@ -3244,7 +3659,7 @@ class Z extends h {
|
|
|
3244
3659
|
}
|
|
3245
3660
|
}
|
|
3246
3661
|
}
|
|
3247
|
-
class
|
|
3662
|
+
class rt extends u {
|
|
3248
3663
|
constructor() {
|
|
3249
3664
|
super(...arguments), this._value = "", this._disabled = !1, this._selected = !1, this._discoverable = !0, this.handleClick = (t) => {
|
|
3250
3665
|
if (this.effectivelyDisabled) {
|
|
@@ -3304,7 +3719,7 @@ class tt extends h {
|
|
|
3304
3719
|
}
|
|
3305
3720
|
render() {
|
|
3306
3721
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
3307
|
-
<style>${
|
|
3722
|
+
<style>${Xt}</style>
|
|
3308
3723
|
<div class="option-wrapper" part="option">
|
|
3309
3724
|
<span class="option-content" part="content"><slot></slot></span>
|
|
3310
3725
|
<span class="check-mark" part="check" aria-hidden="true">✓</span>
|
|
@@ -3331,7 +3746,7 @@ class tt extends h {
|
|
|
3331
3746
|
}
|
|
3332
3747
|
}
|
|
3333
3748
|
}
|
|
3334
|
-
class
|
|
3749
|
+
class ot extends u {
|
|
3335
3750
|
constructor() {
|
|
3336
3751
|
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 = () => {
|
|
3337
3752
|
if (this._focusedIndex >= 0) return;
|
|
@@ -3355,12 +3770,12 @@ class et extends h {
|
|
|
3355
3770
|
if (this._disabled) return;
|
|
3356
3771
|
const e = (r = t.detail) == null ? void 0 : r.value;
|
|
3357
3772
|
if (e === void 0) return;
|
|
3358
|
-
const i = this.getAllOptions(), s = i.find((
|
|
3773
|
+
const i = this.getAllOptions(), s = i.find((o) => o.value === e);
|
|
3359
3774
|
if (!s) return;
|
|
3360
3775
|
const a = i.indexOf(s);
|
|
3361
3776
|
this._focusedIndex = a, this.updateFocusHighlight(), this.selectOption(s), this.focus();
|
|
3362
3777
|
}, this.handleKeyDown = (t) => {
|
|
3363
|
-
var a, r,
|
|
3778
|
+
var a, r, o;
|
|
3364
3779
|
if (this._disabled && !this._discoverable) return;
|
|
3365
3780
|
const e = this.getAllOptions();
|
|
3366
3781
|
if (e.length === 0) return;
|
|
@@ -3387,15 +3802,15 @@ class et extends h {
|
|
|
3387
3802
|
break;
|
|
3388
3803
|
default:
|
|
3389
3804
|
if (t.key.length === 1 && !t.ctrlKey && !t.altKey && !t.metaKey) {
|
|
3390
|
-
const
|
|
3391
|
-
if (
|
|
3392
|
-
const
|
|
3393
|
-
(
|
|
3394
|
-
var
|
|
3395
|
-
return (((
|
|
3805
|
+
const n = (a = this._typeAhead) == null ? void 0 : a.type(t.key);
|
|
3806
|
+
if (n) {
|
|
3807
|
+
const d = e.findIndex(
|
|
3808
|
+
(h) => {
|
|
3809
|
+
var c;
|
|
3810
|
+
return (((c = h.textContent) == null ? void 0 : c.trim()) || "") === n && !h.effectivelyDisabled;
|
|
3396
3811
|
}
|
|
3397
3812
|
);
|
|
3398
|
-
|
|
3813
|
+
d >= 0 && (i = d, s = !0);
|
|
3399
3814
|
}
|
|
3400
3815
|
}
|
|
3401
3816
|
break;
|
|
@@ -3416,27 +3831,27 @@ class et extends h {
|
|
|
3416
3831
|
break;
|
|
3417
3832
|
default:
|
|
3418
3833
|
if (t.key.length === 1 && !t.ctrlKey && !t.altKey && !t.metaKey) {
|
|
3419
|
-
const
|
|
3420
|
-
if (
|
|
3421
|
-
const
|
|
3422
|
-
(
|
|
3423
|
-
var
|
|
3424
|
-
return (((
|
|
3834
|
+
const n = (r = this._typeAhead) == null ? void 0 : r.type(t.key);
|
|
3835
|
+
if (n) {
|
|
3836
|
+
const d = e.findIndex(
|
|
3837
|
+
(h) => {
|
|
3838
|
+
var c;
|
|
3839
|
+
return (((c = h.textContent) == null ? void 0 : c.trim()) || "") === n && !h.effectivelyDisabled;
|
|
3425
3840
|
}
|
|
3426
3841
|
);
|
|
3427
|
-
|
|
3842
|
+
d >= 0 && (i = d, s = !0);
|
|
3428
3843
|
}
|
|
3429
3844
|
}
|
|
3430
3845
|
break;
|
|
3431
3846
|
}
|
|
3432
3847
|
if (s && (t.preventDefault(), t.stopPropagation()), i !== null && i >= 0) {
|
|
3433
3848
|
this._focusedIndex = i, this.updateFocusHighlight();
|
|
3434
|
-
const
|
|
3435
|
-
if (!this._multiple &&
|
|
3436
|
-
this.selectSingle(
|
|
3437
|
-
else if (
|
|
3438
|
-
const
|
|
3439
|
-
|
|
3849
|
+
const n = e[i];
|
|
3850
|
+
if (!this._multiple && n)
|
|
3851
|
+
this.selectSingle(n);
|
|
3852
|
+
else if (n) {
|
|
3853
|
+
const d = ((o = n.textContent) == null ? void 0 : o.trim()) || n.value, h = this._values.has(n.value);
|
|
3854
|
+
f(`${d}${h ? ", selected" : ""}`);
|
|
3440
3855
|
}
|
|
3441
3856
|
}
|
|
3442
3857
|
};
|
|
@@ -3506,7 +3921,7 @@ class et extends h {
|
|
|
3506
3921
|
}
|
|
3507
3922
|
render() {
|
|
3508
3923
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
3509
|
-
<style>${
|
|
3924
|
+
<style>${Wt}</style>
|
|
3510
3925
|
<div class="listbox-wrapper" part="wrapper">
|
|
3511
3926
|
<slot></slot>
|
|
3512
3927
|
</div>
|
|
@@ -3577,31 +3992,31 @@ class et extends h {
|
|
|
3577
3992
|
const e = this._value;
|
|
3578
3993
|
if (this._value = t.value, this.setAttribute("value", t.value), this.syncOptionStates(), e !== this._value) {
|
|
3579
3994
|
const s = ((i = t.textContent) == null ? void 0 : i.trim()) || t.value;
|
|
3580
|
-
this.emit("change", { value: this._value, label: s }), this.emit("a11y-listbox-change", { value: this._value, label: s }),
|
|
3995
|
+
this.emit("change", { value: this._value, label: s }), this.emit("a11y-listbox-change", { value: this._value, label: s }), f(`${s} selected`);
|
|
3581
3996
|
}
|
|
3582
3997
|
}
|
|
3583
3998
|
toggleOptionSelection(t) {
|
|
3584
3999
|
var s;
|
|
3585
4000
|
if (t.effectivelyDisabled || this._disabled) return;
|
|
3586
4001
|
const e = ((s = t.textContent) == null ? void 0 : s.trim()) || t.value;
|
|
3587
|
-
this._values.has(t.value) ? (this._values.delete(t.value), t.selected = !1,
|
|
4002
|
+
this._values.has(t.value) ? (this._values.delete(t.value), t.selected = !1, f(`${e} deselected`)) : (this._values.add(t.value), t.selected = !0, f(`${e} selected`));
|
|
3588
4003
|
const i = Array.from(this._values);
|
|
3589
4004
|
this.setAttribute("value", i.join(",")), this.emit("change", { value: i }), this.emit("a11y-listbox-change", { value: i });
|
|
3590
4005
|
}
|
|
3591
4006
|
selectRange(t, e) {
|
|
3592
4007
|
const i = this.getAllOptions(), s = Math.min(t, e), a = Math.max(t, e);
|
|
3593
|
-
for (let
|
|
3594
|
-
const
|
|
3595
|
-
|
|
4008
|
+
for (let o = s; o <= a; o++) {
|
|
4009
|
+
const n = i[o];
|
|
4010
|
+
n && !n.effectivelyDisabled && (this._values.add(n.value), n.selected = !0);
|
|
3596
4011
|
}
|
|
3597
4012
|
const r = Array.from(this._values);
|
|
3598
|
-
this.setAttribute("value", r.join(",")), this.emit("change", { value: r }), this.emit("a11y-listbox-change", { value: r }),
|
|
4013
|
+
this.setAttribute("value", r.join(",")), this.emit("change", { value: r }), this.emit("a11y-listbox-change", { value: r }), f(`${a - s + 1} items selected`);
|
|
3599
4014
|
}
|
|
3600
4015
|
toggleSelectAll() {
|
|
3601
4016
|
const t = this.getEnabledOptions();
|
|
3602
|
-
t.every((s) => this._values.has(s.value)) ? (this._values.clear(), this.getAllOptions().forEach((s) => s.selected = !1),
|
|
4017
|
+
t.every((s) => this._values.has(s.value)) ? (this._values.clear(), this.getAllOptions().forEach((s) => s.selected = !1), f("All deselected")) : (t.forEach((s) => {
|
|
3603
4018
|
this._values.add(s.value), s.selected = !0;
|
|
3604
|
-
}),
|
|
4019
|
+
}), f("All selected"));
|
|
3605
4020
|
const i = Array.from(this._values);
|
|
3606
4021
|
this.setAttribute("value", i.join(",")), this.emit("change", { value: i }), this.emit("a11y-listbox-change", { value: i });
|
|
3607
4022
|
}
|
|
@@ -3613,7 +4028,7 @@ class et extends h {
|
|
|
3613
4028
|
return ((i = e.textContent) == null ? void 0 : i.trim()) || "";
|
|
3614
4029
|
}
|
|
3615
4030
|
);
|
|
3616
|
-
this._typeAhead =
|
|
4031
|
+
this._typeAhead = R(t, { timeout: 500 });
|
|
3617
4032
|
}
|
|
3618
4033
|
// ===== Attribute Changes =====
|
|
3619
4034
|
onAttributeChange(t, e, i) {
|
|
@@ -3638,21 +4053,21 @@ class et extends h {
|
|
|
3638
4053
|
}
|
|
3639
4054
|
}
|
|
3640
4055
|
}
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
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">
|
|
3645
4060
|
<path d="M2.5 6L5 8.5L9.5 3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3646
|
-
</svg>`,
|
|
4061
|
+
</svg>`, de = `<svg class="checkbox-dash" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
|
3647
4062
|
<path d="M3 6H9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
3648
4063
|
</svg>`;
|
|
3649
|
-
class
|
|
4064
|
+
class H extends u {
|
|
3650
4065
|
constructor() {
|
|
3651
4066
|
super(...arguments), this._checked = !1, this._indeterminate = !1, this._input = null, this.handleChange = () => {
|
|
3652
4067
|
if (!this._input) return;
|
|
3653
4068
|
this._checked = this._input.checked, this.toggleAttribute("checked", this._checked), this._indeterminate && (this._indeterminate = !1, this.removeAttribute("indeterminate"), this._input.indeterminate = !1), this.updateVisualState(), this.emit("change", { checked: this._checked, value: this.value });
|
|
3654
4069
|
const t = this.label || this.getAttribute("aria-label") || "Checkbox";
|
|
3655
|
-
|
|
4070
|
+
f(`${t} ${this._checked ? "checked" : "unchecked"}`);
|
|
3656
4071
|
};
|
|
3657
4072
|
}
|
|
3658
4073
|
static get observedAttributes() {
|
|
@@ -3763,36 +4178,36 @@ class R extends h {
|
|
|
3763
4178
|
);
|
|
3764
4179
|
}
|
|
3765
4180
|
render() {
|
|
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,
|
|
3767
|
-
|
|
3768
|
-
const
|
|
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}"` : "";
|
|
3769
4184
|
t.innerHTML = `
|
|
3770
|
-
<style>${
|
|
4185
|
+
<style>${Qt}</style>
|
|
3771
4186
|
<div class="checkbox-wrapper size-${this.size}" part="wrapper">
|
|
3772
4187
|
<div class="checkbox-control">
|
|
3773
4188
|
<input
|
|
3774
4189
|
type="checkbox"
|
|
3775
4190
|
class="checkbox-input"
|
|
3776
4191
|
id="${e}"
|
|
3777
|
-
${
|
|
4192
|
+
${h ? `name="${h}"` : ""}
|
|
3778
4193
|
${this.value ? `value="${this.value}"` : ""}
|
|
3779
4194
|
${this._checked ? "checked" : ""}
|
|
3780
4195
|
${this.disabled ? "disabled" : ""}
|
|
3781
4196
|
${this.required ? 'required aria-required="true"' : ""}
|
|
3782
|
-
${
|
|
4197
|
+
${m}
|
|
3783
4198
|
${_}
|
|
3784
|
-
${
|
|
4199
|
+
${n ? 'aria-invalid="true"' : ""}
|
|
3785
4200
|
part="input"
|
|
3786
4201
|
/>
|
|
3787
4202
|
<div class="checkbox-indicator" part="indicator" aria-hidden="true">
|
|
3788
|
-
${
|
|
3789
|
-
${
|
|
4203
|
+
${le}
|
|
4204
|
+
${de}
|
|
3790
4205
|
</div>
|
|
3791
4206
|
</div>
|
|
3792
|
-
${r ||
|
|
4207
|
+
${r || o || n ? `<div class="checkbox-content">
|
|
3793
4208
|
${r ? `<label for="${e}" id="${i}" class="checkbox-label" part="label">${this.label}${this.required ? '<span class="checkbox-required" aria-hidden="true">*</span>' : ""}</label>` : ""}
|
|
3794
|
-
${
|
|
3795
|
-
${
|
|
4209
|
+
${o ? `<div id="${s}" class="checkbox-hint" part="hint">${this.hint}</div>` : ""}
|
|
4210
|
+
${n ? `<div id="${a}" class="checkbox-error" role="alert" part="error">${this.error}</div>` : ""}
|
|
3796
4211
|
</div>` : ""}
|
|
3797
4212
|
</div>
|
|
3798
4213
|
`, this._input = t.querySelector("input"), this._input && this._indeterminate && (this._input.indeterminate = !0);
|
|
@@ -3857,7 +4272,7 @@ class R extends h {
|
|
|
3857
4272
|
if (this.disabled) return;
|
|
3858
4273
|
this._indeterminate ? (this.indeterminate = !1, this.checked = !0) : this.checked = !this.checked;
|
|
3859
4274
|
const t = this.label || this.getAttribute("aria-label") || "Checkbox";
|
|
3860
|
-
|
|
4275
|
+
f(`${t} ${this.checked ? "checked" : "unchecked"}`);
|
|
3861
4276
|
}
|
|
3862
4277
|
/**
|
|
3863
4278
|
* Set checked state programmatically
|
|
@@ -3866,11 +4281,11 @@ class R extends h {
|
|
|
3866
4281
|
this.checked = t;
|
|
3867
4282
|
}
|
|
3868
4283
|
}
|
|
3869
|
-
class
|
|
4284
|
+
class nt extends u {
|
|
3870
4285
|
constructor() {
|
|
3871
4286
|
super(...arguments), this._value = [], this.handleChildChange = (t) => {
|
|
3872
4287
|
const e = t.target;
|
|
3873
|
-
if (!(e instanceof
|
|
4288
|
+
if (!(e instanceof H) || e === this) return;
|
|
3874
4289
|
const i = e.value;
|
|
3875
4290
|
i && (e.checked ? this._value.includes(i) || (this._value = [...this._value, i]) : this._value = this._value.filter((s) => s !== i), this.emit("change", { value: this._value }));
|
|
3876
4291
|
};
|
|
@@ -3940,7 +4355,7 @@ class it extends h {
|
|
|
3940
4355
|
render() {
|
|
3941
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");
|
|
3942
4357
|
t.innerHTML = `
|
|
3943
|
-
<style>${
|
|
4358
|
+
<style>${Zt}</style>
|
|
3944
4359
|
<fieldset
|
|
3945
4360
|
part="fieldset"
|
|
3946
4361
|
${a ? `aria-label="${a}"` : ""}
|
|
@@ -4006,9 +4421,9 @@ class it extends h {
|
|
|
4006
4421
|
t && (this.disabled ? t.setAttribute("disabled", "") : t.removeAttribute("disabled"));
|
|
4007
4422
|
}
|
|
4008
4423
|
}
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
class
|
|
4424
|
+
p("a11y-checkbox", H);
|
|
4425
|
+
p("a11y-checkbox-group", nt);
|
|
4426
|
+
class lt extends u {
|
|
4012
4427
|
constructor() {
|
|
4013
4428
|
super(...arguments), this._value = "", this._disabled = !1, this._discoverable = !0, this._orientation = "vertical", this._required = !1, this._name = "", this.handleRadioSelect = (t) => {
|
|
4014
4429
|
var i;
|
|
@@ -4047,7 +4462,7 @@ class st extends h {
|
|
|
4047
4462
|
if (a && a.value !== this._value) {
|
|
4048
4463
|
this.selectRadio(a.value);
|
|
4049
4464
|
const r = a.getAttribute("label") || a.value;
|
|
4050
|
-
|
|
4465
|
+
f(`${r} selected`);
|
|
4051
4466
|
}
|
|
4052
4467
|
}
|
|
4053
4468
|
return;
|
|
@@ -4060,7 +4475,7 @@ class st extends h {
|
|
|
4060
4475
|
if (a) {
|
|
4061
4476
|
this.selectRadio(a.value), a.focus();
|
|
4062
4477
|
const r = a.getAttribute("label") || a.value;
|
|
4063
|
-
|
|
4478
|
+
f(`${r} selected`);
|
|
4064
4479
|
}
|
|
4065
4480
|
}
|
|
4066
4481
|
};
|
|
@@ -4132,9 +4547,9 @@ class st extends h {
|
|
|
4132
4547
|
}
|
|
4133
4548
|
render() {
|
|
4134
4549
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
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` : "",
|
|
4136
|
-
|
|
4137
|
-
<style>${
|
|
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(" ");
|
|
4551
|
+
o ? this.setAttribute("aria-describedby", o) : this.removeAttribute("aria-describedby"), t.innerHTML = `
|
|
4552
|
+
<style>${te}</style>
|
|
4138
4553
|
<fieldset part="fieldset">
|
|
4139
4554
|
${e ? `<legend part="legend">${e}${this._required ? '<span class="radio-group-required" aria-hidden="true"> *</span>' : ""}</legend>` : ""}
|
|
4140
4555
|
<div class="radio-group-items" part="items">
|
|
@@ -4213,7 +4628,7 @@ class st extends h {
|
|
|
4213
4628
|
}
|
|
4214
4629
|
}
|
|
4215
4630
|
}
|
|
4216
|
-
class
|
|
4631
|
+
class dt extends u {
|
|
4217
4632
|
constructor() {
|
|
4218
4633
|
super(...arguments), this._value = "", this._checked = !1, this._disabled = !1, this._discoverable = !0, this.handleClick = (t) => {
|
|
4219
4634
|
if (this._disabled) {
|
|
@@ -4228,7 +4643,7 @@ class at extends h {
|
|
|
4228
4643
|
})
|
|
4229
4644
|
);
|
|
4230
4645
|
const e = this.getAttribute("label") || this._value;
|
|
4231
|
-
|
|
4646
|
+
f(`${e} selected`);
|
|
4232
4647
|
}, this.handleKeyDown = (t) => {
|
|
4233
4648
|
if (!this._disabled && t.key === "Enter") {
|
|
4234
4649
|
t.preventDefault(), this.dispatchEvent(
|
|
@@ -4239,7 +4654,7 @@ class at extends h {
|
|
|
4239
4654
|
})
|
|
4240
4655
|
);
|
|
4241
4656
|
const e = this.getAttribute("label") || this._value;
|
|
4242
|
-
|
|
4657
|
+
f(`${e} selected`);
|
|
4243
4658
|
}
|
|
4244
4659
|
};
|
|
4245
4660
|
}
|
|
@@ -4284,7 +4699,7 @@ class at extends h {
|
|
|
4284
4699
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4285
4700
|
const t = this.shadowRoot, e = this.getAttribute("label") || "", i = this.getAttribute("hint") || "", s = e ? `${this._id}-label` : "", a = i ? `${this._id}-hint` : "";
|
|
4286
4701
|
s && this.setAttribute("aria-labelledby", s), a && this.setAttribute("aria-describedby", a), t.innerHTML = `
|
|
4287
|
-
<style>${
|
|
4702
|
+
<style>${ee}</style>
|
|
4288
4703
|
<div class="radio-wrapper" part="wrapper">
|
|
4289
4704
|
<div class="radio-control" part="control">
|
|
4290
4705
|
<input
|
|
@@ -4345,9 +4760,9 @@ class at extends h {
|
|
|
4345
4760
|
}
|
|
4346
4761
|
}
|
|
4347
4762
|
}
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
class
|
|
4763
|
+
p("a11y-radio-group", lt);
|
|
4764
|
+
p("a11y-radio", dt);
|
|
4765
|
+
class ct extends u {
|
|
4351
4766
|
constructor() {
|
|
4352
4767
|
super(...arguments), this._toasts = [], this._counter = 0, this._containerEl = null, this._maxToasts = 5, this._handleClick = (t) => {
|
|
4353
4768
|
var a;
|
|
@@ -4358,7 +4773,7 @@ class rt extends h {
|
|
|
4358
4773
|
}
|
|
4359
4774
|
const s = e.getAttribute("data-action-id");
|
|
4360
4775
|
if (s) {
|
|
4361
|
-
const r = this._toasts.find((
|
|
4776
|
+
const r = this._toasts.find((o) => o.id === s);
|
|
4362
4777
|
(a = r == null ? void 0 : r.action) == null || a.onClick(), this.removeToast(s);
|
|
4363
4778
|
}
|
|
4364
4779
|
};
|
|
@@ -4385,7 +4800,7 @@ class rt extends h {
|
|
|
4385
4800
|
render() {
|
|
4386
4801
|
const t = this.attachShadow({ mode: "open" });
|
|
4387
4802
|
t.innerHTML = `
|
|
4388
|
-
<style>${
|
|
4803
|
+
<style>${ie}</style>
|
|
4389
4804
|
<div
|
|
4390
4805
|
class="toast-container"
|
|
4391
4806
|
role="region"
|
|
@@ -4485,8 +4900,8 @@ class rt extends h {
|
|
|
4485
4900
|
return e.textContent = t, e.innerHTML;
|
|
4486
4901
|
}
|
|
4487
4902
|
}
|
|
4488
|
-
|
|
4489
|
-
class
|
|
4903
|
+
p("a11y-toast", ct);
|
|
4904
|
+
class ht extends u {
|
|
4490
4905
|
static get observedAttributes() {
|
|
4491
4906
|
return ["focusable"];
|
|
4492
4907
|
}
|
|
@@ -4496,7 +4911,7 @@ class ot extends h {
|
|
|
4496
4911
|
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
4497
4912
|
<style>
|
|
4498
4913
|
:host {
|
|
4499
|
-
${
|
|
4914
|
+
${U}
|
|
4500
4915
|
}
|
|
4501
4916
|
|
|
4502
4917
|
:host([hidden]) {
|
|
@@ -4524,9 +4939,9 @@ class ot extends h {
|
|
|
4524
4939
|
cleanupEventListeners() {
|
|
4525
4940
|
}
|
|
4526
4941
|
}
|
|
4527
|
-
|
|
4528
|
-
const
|
|
4529
|
-
class
|
|
4942
|
+
p("a11y-visually-hidden", ht);
|
|
4943
|
+
const ce = w("SkipLink");
|
|
4944
|
+
class ut extends u {
|
|
4530
4945
|
constructor() {
|
|
4531
4946
|
super(...arguments), this.handleClick = (t) => {
|
|
4532
4947
|
const e = this.getAttribute("target") || "#main-content", i = document.querySelector(e);
|
|
@@ -4537,7 +4952,7 @@ class lt extends h {
|
|
|
4537
4952
|
return ["target", "label"];
|
|
4538
4953
|
}
|
|
4539
4954
|
setupAccessibility() {
|
|
4540
|
-
this.getAttribute("target") ||
|
|
4955
|
+
this.getAttribute("target") || ce.warning(
|
|
4541
4956
|
'Missing "target" attribute. Provide a CSS selector (e.g. target="#main-content") pointing to the skip destination.'
|
|
4542
4957
|
);
|
|
4543
4958
|
}
|
|
@@ -4555,7 +4970,7 @@ class lt extends h {
|
|
|
4555
4970
|
}
|
|
4556
4971
|
|
|
4557
4972
|
.skip-link {
|
|
4558
|
-
${
|
|
4973
|
+
${U}
|
|
4559
4974
|
display: inline-block;
|
|
4560
4975
|
text-decoration: none;
|
|
4561
4976
|
}
|
|
@@ -4605,8 +5020,8 @@ class lt extends h {
|
|
|
4605
5020
|
(t === "target" || t === "label") && this.render();
|
|
4606
5021
|
}
|
|
4607
5022
|
}
|
|
4608
|
-
|
|
4609
|
-
const
|
|
5023
|
+
p("a11y-skip-link", ut);
|
|
5024
|
+
const he = w("Alert"), ue = `
|
|
4610
5025
|
:host {
|
|
4611
5026
|
display: block;
|
|
4612
5027
|
box-sizing: border-box;
|
|
@@ -4731,7 +5146,7 @@ const Gt = N("Alert"), Xt = `
|
|
|
4731
5146
|
outline: 2px solid Highlight;
|
|
4732
5147
|
}
|
|
4733
5148
|
}
|
|
4734
|
-
`,
|
|
5149
|
+
`, F = {
|
|
4735
5150
|
info: "ℹ️",
|
|
4736
5151
|
// ℹ️
|
|
4737
5152
|
success: "✅",
|
|
@@ -4741,7 +5156,7 @@ const Gt = N("Alert"), Xt = `
|
|
|
4741
5156
|
error: "❌"
|
|
4742
5157
|
// ❌
|
|
4743
5158
|
};
|
|
4744
|
-
class
|
|
5159
|
+
class pt extends u {
|
|
4745
5160
|
constructor() {
|
|
4746
5161
|
super(...arguments), this._closeButton = null, this.handleDismiss = () => {
|
|
4747
5162
|
this.emit("dismiss", { type: this.alertType }), this.remove();
|
|
@@ -4764,15 +5179,15 @@ class nt extends h {
|
|
|
4764
5179
|
}
|
|
4765
5180
|
setupAccessibility() {
|
|
4766
5181
|
const t = ["info", "success", "warning", "error"], e = this.getAttribute("type");
|
|
4767
|
-
e && !t.includes(e) &&
|
|
5182
|
+
e && !t.includes(e) && he.warning(
|
|
4768
5183
|
`Invalid type="${e}". Use one of: ${t.join(", ")}.`
|
|
4769
5184
|
);
|
|
4770
5185
|
}
|
|
4771
5186
|
render() {
|
|
4772
5187
|
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
4773
|
-
const t = this.getAttribute("title"), e = this.hasAttribute("dismissible"), i =
|
|
5188
|
+
const t = this.getAttribute("title"), e = this.hasAttribute("dismissible"), i = F[this.alertType] || F.info;
|
|
4774
5189
|
this.shadowRoot.innerHTML = `
|
|
4775
|
-
<style>${
|
|
5190
|
+
<style>${ue}</style>
|
|
4776
5191
|
<div
|
|
4777
5192
|
class="alert"
|
|
4778
5193
|
role="${this.alertRole}"
|
|
@@ -4813,99 +5228,1577 @@ class nt extends h {
|
|
|
4813
5228
|
this.handleDismiss();
|
|
4814
5229
|
}
|
|
4815
5230
|
}
|
|
4816
|
-
|
|
5231
|
+
p("a11y-alert", pt);
|
|
5232
|
+
const pe = `
|
|
5233
|
+
:host {
|
|
5234
|
+
display: inline;
|
|
5235
|
+
}
|
|
5236
|
+
|
|
5237
|
+
:host([hidden]) {
|
|
5238
|
+
display: none !important;
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5241
|
+
a {
|
|
5242
|
+
color: var(--compa11y-link-color, #0066cc);
|
|
5243
|
+
text-decoration: var(--compa11y-link-underline, underline);
|
|
5244
|
+
cursor: pointer;
|
|
5245
|
+
border-radius: 2px;
|
|
5246
|
+
}
|
|
5247
|
+
|
|
5248
|
+
a:hover {
|
|
5249
|
+
color: var(--compa11y-link-color-hover, #004499);
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5252
|
+
a:visited {
|
|
5253
|
+
color: var(--compa11y-link-color-visited, #551a8b);
|
|
5254
|
+
}
|
|
5255
|
+
|
|
5256
|
+
a:focus-visible {
|
|
5257
|
+
outline: 2px solid var(--compa11y-focus-color, #0066cc);
|
|
5258
|
+
outline-offset: 2px;
|
|
5259
|
+
}
|
|
5260
|
+
|
|
5261
|
+
/* Disabled state */
|
|
5262
|
+
:host([disabled]) a {
|
|
5263
|
+
color: var(--compa11y-link-color-disabled, #999);
|
|
5264
|
+
cursor: not-allowed;
|
|
5265
|
+
pointer-events: none;
|
|
5266
|
+
text-decoration: none;
|
|
5267
|
+
}
|
|
5268
|
+
|
|
5269
|
+
/* External link indicator */
|
|
5270
|
+
.external-icon {
|
|
5271
|
+
display: inline-block;
|
|
5272
|
+
width: 0.75em;
|
|
5273
|
+
height: 0.75em;
|
|
5274
|
+
margin-left: 0.25em;
|
|
5275
|
+
vertical-align: baseline;
|
|
5276
|
+
}
|
|
5277
|
+
|
|
5278
|
+
/* Forced colors / high contrast mode */
|
|
5279
|
+
@media (forced-colors: active) {
|
|
5280
|
+
a {
|
|
5281
|
+
forced-color-adjust: none;
|
|
5282
|
+
color: LinkText;
|
|
5283
|
+
}
|
|
5284
|
+
|
|
5285
|
+
a:visited {
|
|
5286
|
+
color: VisitedText;
|
|
5287
|
+
}
|
|
5288
|
+
|
|
5289
|
+
a:focus-visible {
|
|
5290
|
+
outline: 2px solid Highlight;
|
|
5291
|
+
}
|
|
5292
|
+
|
|
5293
|
+
:host([disabled]) a {
|
|
5294
|
+
color: GrayText;
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
`;
|
|
5298
|
+
class bt extends u {
|
|
5299
|
+
static get observedAttributes() {
|
|
5300
|
+
return ["href", "external", "current", "disabled"];
|
|
5301
|
+
}
|
|
5302
|
+
setupAccessibility() {
|
|
5303
|
+
}
|
|
5304
|
+
render() {
|
|
5305
|
+
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5306
|
+
const t = this.getAttribute("href") || "", e = this.hasAttribute("external"), i = this.getAttribute("current"), s = this.hasAttribute("disabled"), a = [];
|
|
5307
|
+
s ? (a.push('role="link"'), a.push('aria-disabled="true"'), a.push('tabindex="-1"')) : a.push(`href="${t}"`), e && !s && (a.push('target="_blank"'), a.push('rel="noopener noreferrer"')), i && a.push(`aria-current="${i}"`);
|
|
5308
|
+
const r = e ? `<svg class="external-icon" part="external-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
5309
|
+
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
|
|
5310
|
+
<polyline points="15 3 21 3 21 9"/>
|
|
5311
|
+
<line x1="10" y1="14" x2="21" y2="3"/>
|
|
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>' : "";
|
|
5313
|
+
this.shadowRoot.innerHTML = `
|
|
5314
|
+
<style>${pe}</style>
|
|
5315
|
+
<a ${a.join(" ")} part="link">
|
|
5316
|
+
<slot></slot>${r}${o}
|
|
5317
|
+
</a>
|
|
5318
|
+
`;
|
|
5319
|
+
}
|
|
5320
|
+
onAttributeChange(t, e, i) {
|
|
5321
|
+
["href", "external", "current", "disabled"].includes(t) && this.render();
|
|
5322
|
+
}
|
|
5323
|
+
}
|
|
5324
|
+
p("a11y-link", bt);
|
|
5325
|
+
const gt = `
|
|
5326
|
+
:host {
|
|
5327
|
+
display: block;
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5330
|
+
:host([hidden]) {
|
|
5331
|
+
display: none !important;
|
|
5332
|
+
}
|
|
5333
|
+
|
|
5334
|
+
:host([as="span"]) {
|
|
5335
|
+
display: inline;
|
|
5336
|
+
}
|
|
5337
|
+
|
|
5338
|
+
*,
|
|
5339
|
+
*::before,
|
|
5340
|
+
*::after {
|
|
5341
|
+
box-sizing: border-box;
|
|
5342
|
+
}
|
|
5343
|
+
|
|
5344
|
+
/* Size scale */
|
|
5345
|
+
.size-xs { font-size: var(--compa11y-text-size-xs, 0.75rem); line-height: 1.5; }
|
|
5346
|
+
.size-sm { font-size: var(--compa11y-text-size-sm, 0.875rem); line-height: 1.5; }
|
|
5347
|
+
.size-md { font-size: var(--compa11y-text-size-md, 1rem); line-height: 1.5; }
|
|
5348
|
+
.size-lg { font-size: var(--compa11y-text-size-lg, 1.125rem); line-height: 1.5; }
|
|
5349
|
+
.size-xl { font-size: var(--compa11y-text-size-xl, 1.25rem); line-height: 1.4; }
|
|
5350
|
+
.size-2xl { font-size: var(--compa11y-text-size-2xl, 1.5rem); line-height: 1.3; }
|
|
5351
|
+
.size-3xl { font-size: var(--compa11y-text-size-3xl, 1.875rem); line-height: 1.25; }
|
|
5352
|
+
|
|
5353
|
+
/* Color variants */
|
|
5354
|
+
.color-default { color: var(--compa11y-text-color, inherit); }
|
|
5355
|
+
.color-muted { color: var(--compa11y-text-color-muted, #666); }
|
|
5356
|
+
.color-accent { color: var(--compa11y-text-color-accent, #0066cc); }
|
|
5357
|
+
.color-error { color: var(--compa11y-text-color-error, #dc2626); }
|
|
5358
|
+
.color-success { color: var(--compa11y-text-color-success, #16a34a); }
|
|
5359
|
+
.color-warning { color: var(--compa11y-text-color-warning, #d97706); }
|
|
5360
|
+
|
|
5361
|
+
/* Weight */
|
|
5362
|
+
.weight-normal { font-weight: 400; }
|
|
5363
|
+
.weight-medium { font-weight: 500; }
|
|
5364
|
+
.weight-semibold { font-weight: 600; }
|
|
5365
|
+
.weight-bold { font-weight: 700; }
|
|
5366
|
+
|
|
5367
|
+
/* Alignment */
|
|
5368
|
+
.align-left { text-align: left; }
|
|
5369
|
+
.align-center { text-align: center; }
|
|
5370
|
+
.align-right { text-align: right; }
|
|
5371
|
+
|
|
5372
|
+
/* Truncation */
|
|
5373
|
+
.truncate {
|
|
5374
|
+
overflow: hidden;
|
|
5375
|
+
text-overflow: ellipsis;
|
|
5376
|
+
white-space: nowrap;
|
|
5377
|
+
}
|
|
5378
|
+
|
|
5379
|
+
/* Forced colors */
|
|
5380
|
+
@media (forced-colors: active) {
|
|
5381
|
+
.color-muted,
|
|
5382
|
+
.color-accent,
|
|
5383
|
+
.color-error,
|
|
5384
|
+
.color-success,
|
|
5385
|
+
.color-warning {
|
|
5386
|
+
color: CanvasText;
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
`, be = `
|
|
5390
|
+
${gt}
|
|
5391
|
+
|
|
5392
|
+
h1, h2, h3, h4, h5, h6 {
|
|
5393
|
+
margin: 0;
|
|
5394
|
+
font-family: var(--compa11y-heading-font-family, inherit);
|
|
5395
|
+
}
|
|
5396
|
+
|
|
5397
|
+
/* Default heading sizes (when no size attr) */
|
|
5398
|
+
h1 { font-size: var(--compa11y-heading-1-size, 2.25rem); line-height: 1.2; font-weight: 700; }
|
|
5399
|
+
h2 { font-size: var(--compa11y-heading-2-size, 1.875rem); line-height: 1.25; font-weight: 700; }
|
|
5400
|
+
h3 { font-size: var(--compa11y-heading-3-size, 1.5rem); line-height: 1.3; font-weight: 600; }
|
|
5401
|
+
h4 { font-size: var(--compa11y-heading-4-size, 1.25rem); line-height: 1.35; font-weight: 600; }
|
|
5402
|
+
h5 { font-size: var(--compa11y-heading-5-size, 1.125rem); line-height: 1.4; font-weight: 600; }
|
|
5403
|
+
h6 { font-size: var(--compa11y-heading-6-size, 1rem); line-height: 1.5; font-weight: 600; }
|
|
5404
|
+
`, ge = `
|
|
5405
|
+
${gt}
|
|
5406
|
+
|
|
5407
|
+
p, span, div, label {
|
|
5408
|
+
margin: 0;
|
|
5409
|
+
font-family: var(--compa11y-text-font-family, inherit);
|
|
5410
|
+
}
|
|
5411
|
+
`;
|
|
5412
|
+
function mt(l, t) {
|
|
5413
|
+
const e = [], i = l.getAttribute("size"), s = l.getAttribute("color") || "default", a = l.getAttribute("weight"), r = l.getAttribute("align"), o = l.hasAttribute("truncate");
|
|
5414
|
+
return i ? e.push(`size-${i}`) : t && e.push(`size-${t}`), e.push(`color-${s}`), a && e.push(`weight-${a}`), r && e.push(`align-${r}`), o && e.push("truncate"), e.join(" ");
|
|
5415
|
+
}
|
|
5416
|
+
class ft extends u {
|
|
5417
|
+
static get observedAttributes() {
|
|
5418
|
+
return ["level", "size", "color", "weight", "align", "truncate"];
|
|
5419
|
+
}
|
|
5420
|
+
get headingLevel() {
|
|
5421
|
+
const t = parseInt(this.getAttribute("level") || "2", 10);
|
|
5422
|
+
return t >= 1 && t <= 6 ? t : 2;
|
|
5423
|
+
}
|
|
5424
|
+
setupAccessibility() {
|
|
5425
|
+
}
|
|
5426
|
+
render() {
|
|
5427
|
+
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5428
|
+
const t = `h${this.headingLevel}`, e = mt(this), i = this.getAttribute("size") ? `size-${this.getAttribute("size")}` : "", s = e;
|
|
5429
|
+
this.shadowRoot.innerHTML = `
|
|
5430
|
+
<style>${be}</style>
|
|
5431
|
+
<${t} class="${s}" part="heading">
|
|
5432
|
+
<slot></slot>
|
|
5433
|
+
</${t}>
|
|
5434
|
+
`;
|
|
5435
|
+
}
|
|
5436
|
+
onAttributeChange() {
|
|
5437
|
+
this.render();
|
|
5438
|
+
}
|
|
5439
|
+
}
|
|
5440
|
+
class vt extends u {
|
|
5441
|
+
static get observedAttributes() {
|
|
5442
|
+
return ["as", "size", "color", "weight", "align", "truncate"];
|
|
5443
|
+
}
|
|
5444
|
+
get tagName_() {
|
|
5445
|
+
const t = this.getAttribute("as");
|
|
5446
|
+
return t && ["p", "span", "div", "label"].includes(t) ? t : "p";
|
|
5447
|
+
}
|
|
5448
|
+
setupAccessibility() {
|
|
5449
|
+
}
|
|
5450
|
+
render() {
|
|
5451
|
+
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5452
|
+
const t = this.tagName_, e = mt(this, "md");
|
|
5453
|
+
this.shadowRoot.innerHTML = `
|
|
5454
|
+
<style>${ge}</style>
|
|
5455
|
+
<${t} class="${e}" part="text">
|
|
5456
|
+
<slot></slot>
|
|
5457
|
+
</${t}>
|
|
5458
|
+
`;
|
|
5459
|
+
}
|
|
5460
|
+
onAttributeChange() {
|
|
5461
|
+
this.render();
|
|
5462
|
+
}
|
|
5463
|
+
}
|
|
5464
|
+
p("a11y-heading", ft);
|
|
5465
|
+
p("a11y-text", vt);
|
|
5466
|
+
const me = `
|
|
5467
|
+
:host {
|
|
5468
|
+
display: block;
|
|
5469
|
+
box-sizing: border-box;
|
|
5470
|
+
}
|
|
5471
|
+
|
|
5472
|
+
:host([hidden]) {
|
|
5473
|
+
display: none !important;
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5476
|
+
*,
|
|
5477
|
+
*::before,
|
|
5478
|
+
*::after {
|
|
5479
|
+
box-sizing: inherit;
|
|
5480
|
+
}
|
|
5481
|
+
|
|
5482
|
+
.field-wrapper {
|
|
5483
|
+
display: flex;
|
|
5484
|
+
flex-direction: column;
|
|
5485
|
+
gap: var(--compa11y-field-gap, 0.25rem);
|
|
5486
|
+
}
|
|
5487
|
+
|
|
5488
|
+
.field-label {
|
|
5489
|
+
display: block;
|
|
5490
|
+
color: var(--compa11y-field-label-color, inherit);
|
|
5491
|
+
font-size: var(--compa11y-field-label-size, 0.875rem);
|
|
5492
|
+
font-weight: var(--compa11y-field-label-weight, 500);
|
|
5493
|
+
}
|
|
5494
|
+
|
|
5495
|
+
:host([disabled]) .field-label {
|
|
5496
|
+
color: var(--compa11y-field-disabled-color, #999);
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5499
|
+
.field-required {
|
|
5500
|
+
color: var(--compa11y-field-required-color, #ef4444);
|
|
5501
|
+
margin-left: 0.125rem;
|
|
5502
|
+
}
|
|
5503
|
+
|
|
5504
|
+
.field-hint {
|
|
5505
|
+
color: var(--compa11y-field-hint-color, #666);
|
|
5506
|
+
font-size: var(--compa11y-field-hint-size, 0.8125rem);
|
|
5507
|
+
}
|
|
5508
|
+
|
|
5509
|
+
.field-error {
|
|
5510
|
+
color: var(--compa11y-field-error-color, #ef4444);
|
|
5511
|
+
font-size: var(--compa11y-field-error-size, 0.8125rem);
|
|
5512
|
+
}
|
|
5513
|
+
|
|
5514
|
+
/* Forced colors */
|
|
5515
|
+
@media (forced-colors: active) {
|
|
5516
|
+
.field-label {
|
|
5517
|
+
color: CanvasText;
|
|
5518
|
+
}
|
|
5519
|
+
|
|
5520
|
+
:host([disabled]) .field-label {
|
|
5521
|
+
color: GrayText;
|
|
5522
|
+
}
|
|
5523
|
+
|
|
5524
|
+
.field-error {
|
|
5525
|
+
color: LinkText;
|
|
5526
|
+
}
|
|
5527
|
+
}
|
|
5528
|
+
`;
|
|
5529
|
+
class yt extends u {
|
|
5530
|
+
static get observedAttributes() {
|
|
5531
|
+
return ["label", "hint", "error", "required", "disabled"];
|
|
5532
|
+
}
|
|
5533
|
+
setupAccessibility() {
|
|
5534
|
+
var t;
|
|
5535
|
+
typeof process < "u" && ((t = process.env) == null ? void 0 : t.NODE_ENV) !== "production" && (this.hasAttribute("label") || console.warn(
|
|
5536
|
+
`[compa11y/FormField] FormField has no label. Add label="..." attribute.
|
|
5537
|
+
💡 Suggestion: <a11y-form-field label="Email">...</a11y-form-field>`
|
|
5538
|
+
));
|
|
5539
|
+
}
|
|
5540
|
+
render() {
|
|
5541
|
+
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
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`;
|
|
5543
|
+
this.setAttribute("data-error", a ? "true" : "false"), this.shadowRoot.innerHTML = `
|
|
5544
|
+
<style>${me}</style>
|
|
5545
|
+
<div class="field-wrapper" part="wrapper">
|
|
5546
|
+
${t ? `<label
|
|
5547
|
+
class="field-label"
|
|
5548
|
+
id="${r}"
|
|
5549
|
+
part="label"
|
|
5550
|
+
>${t}${s ? '<span class="field-required" aria-hidden="true" part="required">*</span>' : ""}</label>` : ""}
|
|
5551
|
+
<slot></slot>
|
|
5552
|
+
${e ? `<div class="field-hint" id="${o}" part="hint">${e}</div>` : ""}
|
|
5553
|
+
${a ? `<div class="field-error" id="${n}" role="alert" part="error">${i}</div>` : ""}
|
|
5554
|
+
</div>
|
|
5555
|
+
`, this.wireControl();
|
|
5556
|
+
}
|
|
5557
|
+
setupEventListeners() {
|
|
5558
|
+
var e;
|
|
5559
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
|
|
5560
|
+
t == null || t.addEventListener("slotchange", () => this.wireControl());
|
|
5561
|
+
}
|
|
5562
|
+
cleanupEventListeners() {
|
|
5563
|
+
var e;
|
|
5564
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot");
|
|
5565
|
+
t == null || t.removeEventListener("slotchange", () => this.wireControl());
|
|
5566
|
+
}
|
|
5567
|
+
/**
|
|
5568
|
+
* Find the first focusable control in the slot and wire ARIA attributes.
|
|
5569
|
+
*/
|
|
5570
|
+
wireControl() {
|
|
5571
|
+
var _;
|
|
5572
|
+
const t = (_ = this.shadowRoot) == null ? void 0 : _.querySelector("slot");
|
|
5573
|
+
if (!t) return;
|
|
5574
|
+
const e = t.assignedElements({ flatten: !0 }), i = e.find(
|
|
5575
|
+
(y) => y instanceof HTMLInputElement || y instanceof HTMLSelectElement || y instanceof HTMLTextAreaElement || y.hasAttribute("role") || y.hasAttribute("tabindex")
|
|
5576
|
+
) || e[0];
|
|
5577
|
+
if (!i) return;
|
|
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);
|
|
5580
|
+
const m = [];
|
|
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"));
|
|
5582
|
+
}
|
|
5583
|
+
onAttributeChange(t, e, i) {
|
|
5584
|
+
["label", "hint", "error", "required", "disabled"].includes(t) && (this.render(), this.setupEventListeners());
|
|
5585
|
+
}
|
|
5586
|
+
}
|
|
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;
|
|
5592
|
+
switch (d) {
|
|
5593
|
+
case "top":
|
|
5594
|
+
c = l.top - o - i;
|
|
5595
|
+
break;
|
|
5596
|
+
case "bottom":
|
|
5597
|
+
c = l.bottom + i;
|
|
5598
|
+
break;
|
|
5599
|
+
case "left":
|
|
5600
|
+
b = l.left - r - i;
|
|
5601
|
+
break;
|
|
5602
|
+
case "right":
|
|
5603
|
+
b = l.right + i;
|
|
5604
|
+
break;
|
|
5605
|
+
}
|
|
5606
|
+
if (d === "top" || d === "bottom")
|
|
5607
|
+
switch (h) {
|
|
5608
|
+
case "start":
|
|
5609
|
+
b = l.left;
|
|
5610
|
+
break;
|
|
5611
|
+
case "end":
|
|
5612
|
+
b = l.right - r;
|
|
5613
|
+
break;
|
|
5614
|
+
default:
|
|
5615
|
+
b = l.left + (l.width - r) / 2;
|
|
5616
|
+
}
|
|
5617
|
+
else
|
|
5618
|
+
switch (h) {
|
|
5619
|
+
case "start":
|
|
5620
|
+
c = l.top;
|
|
5621
|
+
break;
|
|
5622
|
+
case "end":
|
|
5623
|
+
c = l.bottom - o;
|
|
5624
|
+
break;
|
|
5625
|
+
default:
|
|
5626
|
+
c = l.top + (l.height - o) / 2;
|
|
5627
|
+
}
|
|
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);
|
|
5629
|
+
const m = 8;
|
|
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 };
|
|
5631
|
+
}
|
|
5632
|
+
const ve = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), details > summary', ye = `
|
|
5633
|
+
:host {
|
|
5634
|
+
display: inline-block;
|
|
5635
|
+
}
|
|
5636
|
+
|
|
5637
|
+
:host([hidden]) {
|
|
5638
|
+
display: none !important;
|
|
5639
|
+
}
|
|
5640
|
+
|
|
5641
|
+
*,
|
|
5642
|
+
*::before,
|
|
5643
|
+
*::after {
|
|
5644
|
+
box-sizing: border-box;
|
|
5645
|
+
}
|
|
5646
|
+
|
|
5647
|
+
.popover-content {
|
|
5648
|
+
position: fixed;
|
|
5649
|
+
z-index: var(--compa11y-popover-z-index, 1000);
|
|
5650
|
+
background: var(--compa11y-popover-bg, #fff);
|
|
5651
|
+
color: var(--compa11y-popover-color, inherit);
|
|
5652
|
+
border: var(--compa11y-popover-border, 1px solid rgba(0, 0, 0, 0.15));
|
|
5653
|
+
border-radius: var(--compa11y-popover-radius, 0.375rem);
|
|
5654
|
+
box-shadow: var(--compa11y-popover-shadow, 0 4px 16px rgba(0, 0, 0, 0.12));
|
|
5655
|
+
padding: var(--compa11y-popover-padding, 1rem);
|
|
5656
|
+
max-width: var(--compa11y-popover-max-width, 320px);
|
|
5657
|
+
min-width: 100px;
|
|
5658
|
+
outline: none;
|
|
5659
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
5660
|
+
opacity: 0;
|
|
5661
|
+
transform: scale(0.96) translateY(-2px);
|
|
5662
|
+
}
|
|
5663
|
+
|
|
5664
|
+
.popover-content[data-open="true"] {
|
|
5665
|
+
opacity: 1;
|
|
5666
|
+
transform: scale(1) translateY(0);
|
|
5667
|
+
}
|
|
5668
|
+
|
|
5669
|
+
.popover-content[hidden] {
|
|
5670
|
+
display: none !important;
|
|
5671
|
+
}
|
|
5672
|
+
|
|
5673
|
+
@media (prefers-reduced-motion: reduce) {
|
|
5674
|
+
.popover-content {
|
|
5675
|
+
transition: none;
|
|
5676
|
+
}
|
|
5677
|
+
}
|
|
5678
|
+
|
|
5679
|
+
${G}
|
|
5680
|
+
|
|
5681
|
+
@media (forced-colors: active) {
|
|
5682
|
+
.popover-content {
|
|
5683
|
+
border: 2px solid ButtonText;
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5686
|
+
`;
|
|
5687
|
+
class _t extends u {
|
|
5688
|
+
constructor() {
|
|
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 = () => {
|
|
5690
|
+
const t = `${this._id}-content`;
|
|
5691
|
+
this._wireTrigger(t);
|
|
5692
|
+
}, this._onOutsidePointerDown = (t) => {
|
|
5693
|
+
t.composedPath().includes(this) || (this.open = !1);
|
|
5694
|
+
}, this._onDocumentKeyDown = (t) => {
|
|
5695
|
+
t.key === "Escape" && (t.stopPropagation(), this.open = !1);
|
|
5696
|
+
}, this._onScrollOrResize = () => {
|
|
5697
|
+
this._open && this._updatePosition();
|
|
5698
|
+
}, this._onTriggerClick = () => {
|
|
5699
|
+
this._disabled || (this.open = !this._open);
|
|
5700
|
+
}, this._onTriggerKeyDown = (t) => {
|
|
5701
|
+
this._disabled || (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.open = !this._open);
|
|
5702
|
+
};
|
|
5703
|
+
}
|
|
5704
|
+
static get observedAttributes() {
|
|
5705
|
+
return [
|
|
5706
|
+
"open",
|
|
5707
|
+
"placement",
|
|
5708
|
+
"offset",
|
|
5709
|
+
"disabled",
|
|
5710
|
+
"haspopup",
|
|
5711
|
+
"content-role",
|
|
5712
|
+
"content-label",
|
|
5713
|
+
"focus-policy"
|
|
5714
|
+
];
|
|
5715
|
+
}
|
|
5716
|
+
// ─── Public API ────────────────────────────────────────────────────────────
|
|
5717
|
+
get open() {
|
|
5718
|
+
return this._open;
|
|
5719
|
+
}
|
|
5720
|
+
set open(t) {
|
|
5721
|
+
this._open !== t && (this._open = t, this.toggleAttribute("open", t), t ? this._show() : this._hide());
|
|
5722
|
+
}
|
|
5723
|
+
get disabled() {
|
|
5724
|
+
return this._disabled;
|
|
5725
|
+
}
|
|
5726
|
+
set disabled(t) {
|
|
5727
|
+
this._disabled = t, this.toggleAttribute("disabled", t), this._updateTriggerDisabled();
|
|
5728
|
+
}
|
|
5729
|
+
// ─── Lifecycle ─────────────────────────────────────────────────────────────
|
|
5730
|
+
setupAccessibility() {
|
|
5731
|
+
this._open = this.hasAttribute("open"), this._placement = this.getAttribute("placement") || "bottom", this._offset = parseInt(this.getAttribute("offset") || "8", 10), this._disabled = this.hasAttribute("disabled"), this._haspopup = this.getAttribute("haspopup") || "dialog", this._contentRole = this.getAttribute("content-role") || "dialog", this._contentLabel = this.getAttribute("content-label") || "", this._focusPolicy = this.getAttribute("focus-policy") || "first";
|
|
5732
|
+
}
|
|
5733
|
+
render() {
|
|
5734
|
+
this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
5735
|
+
const t = `${this._id}-content`, e = this._contentLabel ? `aria-label="${this._contentLabel}"` : "";
|
|
5736
|
+
this.shadowRoot.innerHTML = `
|
|
5737
|
+
<style>${ye}</style>
|
|
5738
|
+
<slot name="trigger" part="trigger-slot"></slot>
|
|
5739
|
+
<div
|
|
5740
|
+
class="popover-content"
|
|
5741
|
+
id="${t}"
|
|
5742
|
+
part="content"
|
|
5743
|
+
role="${this._contentRole}"
|
|
5744
|
+
aria-modal="false"
|
|
5745
|
+
tabindex="-1"
|
|
5746
|
+
${e}
|
|
5747
|
+
${this._open ? 'data-open="true"' : ""}
|
|
5748
|
+
${this._open ? "" : "hidden"}
|
|
5749
|
+
>
|
|
5750
|
+
<slot></slot>
|
|
5751
|
+
</div>
|
|
5752
|
+
`, this._contentEl = this.shadowRoot.querySelector(".popover-content"), this._wireTrigger(t), this._open && requestAnimationFrame(() => this._updatePosition());
|
|
5753
|
+
}
|
|
5754
|
+
setupEventListeners() {
|
|
5755
|
+
var e;
|
|
5756
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector('slot[name="trigger"]');
|
|
5757
|
+
t == null || t.addEventListener("slotchange", this._onTriggerSlotChange);
|
|
5758
|
+
}
|
|
5759
|
+
cleanupEventListeners() {
|
|
5760
|
+
var e;
|
|
5761
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector('slot[name="trigger"]');
|
|
5762
|
+
t == null || t.removeEventListener("slotchange", this._onTriggerSlotChange), this._removeGlobalListeners(), this._detachTriggerListeners();
|
|
5763
|
+
}
|
|
5764
|
+
onAttributeChange(t, e, i) {
|
|
5765
|
+
var s, a, r;
|
|
5766
|
+
switch (t) {
|
|
5767
|
+
case "open":
|
|
5768
|
+
this.open = i !== null;
|
|
5769
|
+
break;
|
|
5770
|
+
case "placement":
|
|
5771
|
+
this._placement = i || "bottom", this._open && this._updatePosition();
|
|
5772
|
+
break;
|
|
5773
|
+
case "offset":
|
|
5774
|
+
this._offset = parseInt(i || "8", 10), this._open && this._updatePosition();
|
|
5775
|
+
break;
|
|
5776
|
+
case "disabled":
|
|
5777
|
+
this._disabled = i !== null, this._updateTriggerDisabled();
|
|
5778
|
+
break;
|
|
5779
|
+
case "haspopup":
|
|
5780
|
+
this._haspopup = i || "dialog", this._updateTriggerAria();
|
|
5781
|
+
break;
|
|
5782
|
+
case "content-role":
|
|
5783
|
+
this._contentRole = i || "dialog", (s = this._contentEl) == null || s.setAttribute("role", this._contentRole);
|
|
5784
|
+
break;
|
|
5785
|
+
case "content-label":
|
|
5786
|
+
this._contentLabel = i || "", this._contentLabel ? (a = this._contentEl) == null || a.setAttribute("aria-label", this._contentLabel) : (r = this._contentEl) == null || r.removeAttribute("aria-label");
|
|
5787
|
+
break;
|
|
5788
|
+
case "focus-policy":
|
|
5789
|
+
this._focusPolicy = i || "first";
|
|
5790
|
+
break;
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5793
|
+
// ─── Trigger Wiring ────────────────────────────────────────────────────────
|
|
5794
|
+
_wireTrigger(t) {
|
|
5795
|
+
var a, r;
|
|
5796
|
+
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelector('slot[name="trigger"]');
|
|
5797
|
+
if (!e) return;
|
|
5798
|
+
const s = e.assignedElements({ flatten: !0 })[0] || null;
|
|
5799
|
+
typeof process < "u" && ((r = process.env) == null ? void 0 : r.NODE_ENV) !== "production" && (s || K.warning(
|
|
5800
|
+
'Popover has no trigger. Add an element to the "trigger" slot.',
|
|
5801
|
+
'<a11y-popover><button slot="trigger">Open</button>...</a11y-popover>'
|
|
5802
|
+
)), this._detachTriggerListeners(), this._triggerEl = s, s && (this._updateTriggerAria(t), this._updateTriggerDisabled(), s.addEventListener("click", this._onTriggerClick), s.addEventListener("keydown", this._onTriggerKeyDown));
|
|
5803
|
+
}
|
|
5804
|
+
/** Update ARIA attributes on the trigger without re-wiring listeners. */
|
|
5805
|
+
_updateTriggerAria(t) {
|
|
5806
|
+
const e = this._triggerEl;
|
|
5807
|
+
if (!e) return;
|
|
5808
|
+
const i = t || `${this._id}-content`;
|
|
5809
|
+
this._haspopup && this._haspopup !== "false" ? e.setAttribute("aria-haspopup", this._haspopup) : e.removeAttribute("aria-haspopup"), e.setAttribute("aria-expanded", String(this._open)), this._open ? e.setAttribute("aria-controls", i) : e.removeAttribute("aria-controls");
|
|
5810
|
+
}
|
|
5811
|
+
/** Apply disabled state to the trigger element. */
|
|
5812
|
+
_updateTriggerDisabled() {
|
|
5813
|
+
const t = this._triggerEl;
|
|
5814
|
+
t && (this._disabled ? "disabled" in t ? t.disabled = !0 : (t.setAttribute("aria-disabled", "true"), t.setAttribute("tabindex", "-1")) : "disabled" in t ? t.disabled = !1 : (t.removeAttribute("aria-disabled"), t.removeAttribute("tabindex")));
|
|
5815
|
+
}
|
|
5816
|
+
_detachTriggerListeners() {
|
|
5817
|
+
this._triggerEl && (this._triggerEl.removeEventListener("click", this._onTriggerClick), this._triggerEl.removeEventListener("keydown", this._onTriggerKeyDown), this._triggerEl.removeAttribute("aria-haspopup"), this._triggerEl.removeAttribute("aria-expanded"), this._triggerEl.removeAttribute("aria-controls"));
|
|
5818
|
+
}
|
|
5819
|
+
// ─── Open / Close ──────────────────────────────────────────────────────────
|
|
5820
|
+
_show() {
|
|
5821
|
+
var t;
|
|
5822
|
+
this._contentEl && (this._contentEl.removeAttribute("hidden"), this._updateTriggerAria(), this._updatePosition(), requestAnimationFrame(() => {
|
|
5823
|
+
var e;
|
|
5824
|
+
(e = this._contentEl) == null || e.setAttribute("data-open", "true");
|
|
5825
|
+
}), typeof process < "u" && ((t = process.env) == null ? void 0 : t.NODE_ENV) !== "production" && requestAnimationFrame(() => {
|
|
5826
|
+
const e = this._contentEl;
|
|
5827
|
+
if (!e) return;
|
|
5828
|
+
const i = e.hasAttribute("aria-label") || e.hasAttribute("aria-labelledby"), s = !!e.querySelector('h1, h2, h3, h4, h5, h6, [role="heading"]');
|
|
5829
|
+
!i && !s && K.warning(
|
|
5830
|
+
'Popover content has no accessible name. Add content-label="..." on <a11y-popover>, or place a heading inside the content.',
|
|
5831
|
+
'Example: <a11y-popover content-label="Filter options">...</a11y-popover>'
|
|
5832
|
+
);
|
|
5833
|
+
}), requestAnimationFrame(() => {
|
|
5834
|
+
const e = this._focusPolicy;
|
|
5835
|
+
if (e === "none") return;
|
|
5836
|
+
const i = this._contentEl;
|
|
5837
|
+
if (!i) return;
|
|
5838
|
+
let s = null;
|
|
5839
|
+
e === "first" && (s = i.querySelector(ve)), s || (s = i), this._weMovedFocus = !0, s.focus();
|
|
5840
|
+
}), this._addGlobalListeners(), this.emit("a11y-popover-open"));
|
|
5841
|
+
}
|
|
5842
|
+
_hide() {
|
|
5843
|
+
var s;
|
|
5844
|
+
if (!this._contentEl) return;
|
|
5845
|
+
this._contentEl.removeAttribute("data-open"), this._updateTriggerAria();
|
|
5846
|
+
const t = () => {
|
|
5847
|
+
var a, r;
|
|
5848
|
+
(a = this._contentEl) == null || a.setAttribute("hidden", ""), (r = this._contentEl) == null || r.removeEventListener("transitionend", t);
|
|
5849
|
+
};
|
|
5850
|
+
getComputedStyle(this._contentEl).transitionDuration !== "0s" ? (this._contentEl.addEventListener("transitionend", t), setTimeout(t, 200)) : this._contentEl.setAttribute("hidden", ""), this._removeGlobalListeners();
|
|
5851
|
+
const i = this._weMovedFocus || this._contentEl.contains(document.activeElement);
|
|
5852
|
+
this._weMovedFocus = !1, i && ((s = this._triggerEl) == null || s.focus()), this.emit("a11y-popover-close");
|
|
5853
|
+
}
|
|
5854
|
+
// ─── Positioning ───────────────────────────────────────────────────────────
|
|
5855
|
+
_updatePosition() {
|
|
5856
|
+
if (!this._triggerEl || !this._contentEl || !this._open) return;
|
|
5857
|
+
const t = this._triggerEl.getBoundingClientRect(), { top: e, left: i } = fe(
|
|
5858
|
+
t,
|
|
5859
|
+
this._contentEl,
|
|
5860
|
+
this._placement,
|
|
5861
|
+
this._offset
|
|
5862
|
+
);
|
|
5863
|
+
this._contentEl.style.top = `${e}px`, this._contentEl.style.left = `${i}px`;
|
|
5864
|
+
}
|
|
5865
|
+
// ─── Global Dismiss Listeners ──────────────────────────────────────────────
|
|
5866
|
+
_addGlobalListeners() {
|
|
5867
|
+
document.addEventListener("pointerdown", this._onOutsidePointerDown, !0), document.addEventListener("keydown", this._onDocumentKeyDown, !0), window.addEventListener("scroll", this._onScrollOrResize, { passive: !0, capture: !0 }), window.addEventListener("resize", this._onScrollOrResize, { passive: !0 });
|
|
5868
|
+
}
|
|
5869
|
+
_removeGlobalListeners() {
|
|
5870
|
+
document.removeEventListener("pointerdown", this._onOutsidePointerDown, !0), document.removeEventListener("keydown", this._onDocumentKeyDown, !0), window.removeEventListener("scroll", this._onScrollOrResize, !0), window.removeEventListener("resize", this._onScrollOrResize);
|
|
5871
|
+
}
|
|
5872
|
+
}
|
|
5873
|
+
p("a11y-popover", _t);
|
|
5874
|
+
const _e = w("A11yAccordion");
|
|
5875
|
+
let N = !1;
|
|
5876
|
+
function xe() {
|
|
5877
|
+
if (N || typeof document > "u") return;
|
|
5878
|
+
N = !0;
|
|
5879
|
+
const l = document.createElement("style");
|
|
5880
|
+
l.setAttribute("data-compa11y-accordion", ""), l.textContent = se, document.head.appendChild(l);
|
|
5881
|
+
}
|
|
5882
|
+
class xt extends u {
|
|
5883
|
+
constructor() {
|
|
5884
|
+
super(...arguments), this._triggers = [], this._panels = [], this._openItems = /* @__PURE__ */ new Set(), this._defaultSlotEl = null, this.updateItems = () => {
|
|
5885
|
+
this._triggers = Array.from(
|
|
5886
|
+
this.querySelectorAll("[data-accordion-trigger]")
|
|
5887
|
+
), this._panels = Array.from(
|
|
5888
|
+
this.querySelectorAll("[data-accordion-panel]")
|
|
5889
|
+
), this._triggers.forEach((t, e) => {
|
|
5890
|
+
const i = this._panels[e], s = t.id || `${this._id}-trigger-${e}`, a = (i == null ? void 0 : i.id) || `${this._id}-panel-${e}`;
|
|
5891
|
+
t.id = s, t.getAttribute("aria-controls") || t.setAttribute("aria-controls", a);
|
|
5892
|
+
const r = this._openItems.has(e);
|
|
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(
|
|
5894
|
+
t,
|
|
5895
|
+
`a11y-accordion trigger[${e}]`
|
|
5896
|
+
);
|
|
5897
|
+
});
|
|
5898
|
+
}, this.handleClick = (t) => {
|
|
5899
|
+
const i = t.target.closest(
|
|
5900
|
+
"[data-accordion-trigger]"
|
|
5901
|
+
);
|
|
5902
|
+
if (!i || i.hasAttribute("disabled") || i.getAttribute("aria-disabled") === "true") return;
|
|
5903
|
+
const a = this._triggers.indexOf(i);
|
|
5904
|
+
a !== -1 && this.toggleItem(a);
|
|
5905
|
+
}, this.handleKeyDown = (t) => {
|
|
5906
|
+
var o, n, d, h;
|
|
5907
|
+
const i = t.target.closest(
|
|
5908
|
+
"[data-accordion-trigger]"
|
|
5909
|
+
);
|
|
5910
|
+
if (!i || this._triggers.indexOf(i) === -1) return;
|
|
5911
|
+
const a = this._triggers.filter(
|
|
5912
|
+
(c) => !c.hasAttribute("disabled") && c.getAttribute("aria-disabled") !== "true"
|
|
5913
|
+
), r = a.indexOf(i);
|
|
5914
|
+
if (r !== -1)
|
|
5915
|
+
switch (t.key) {
|
|
5916
|
+
case "ArrowDown":
|
|
5917
|
+
t.preventDefault(), (o = a[(r + 1) % a.length]) == null || o.focus();
|
|
5918
|
+
break;
|
|
5919
|
+
case "ArrowUp":
|
|
5920
|
+
t.preventDefault(), (n = a[(r - 1 + a.length) % a.length]) == null || n.focus();
|
|
5921
|
+
break;
|
|
5922
|
+
case "Home":
|
|
5923
|
+
t.preventDefault(), (d = a[0]) == null || d.focus();
|
|
5924
|
+
break;
|
|
5925
|
+
case "End":
|
|
5926
|
+
t.preventDefault(), (h = a[a.length - 1]) == null || h.focus();
|
|
5927
|
+
break;
|
|
5928
|
+
}
|
|
5929
|
+
};
|
|
5930
|
+
}
|
|
5931
|
+
static get observedAttributes() {
|
|
5932
|
+
return ["type", "collapsible"];
|
|
5933
|
+
}
|
|
5934
|
+
/** Whether one or multiple items can be open at once. @default 'single' */
|
|
5935
|
+
get type() {
|
|
5936
|
+
return this.getAttribute("type") || "single";
|
|
5937
|
+
}
|
|
5938
|
+
/** Whether the open item can be collapsed in single mode. */
|
|
5939
|
+
get collapsible() {
|
|
5940
|
+
return this.hasAttribute("collapsible");
|
|
5941
|
+
}
|
|
5942
|
+
setupAccessibility() {
|
|
5943
|
+
xe(), this.updateItems();
|
|
5944
|
+
}
|
|
5945
|
+
render() {
|
|
5946
|
+
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
5947
|
+
<style>
|
|
5948
|
+
${g}
|
|
5949
|
+
:host {
|
|
5950
|
+
display: block;
|
|
5951
|
+
}
|
|
5952
|
+
</style>
|
|
5953
|
+
<slot></slot>
|
|
5954
|
+
`;
|
|
5955
|
+
}
|
|
5956
|
+
setupEventListeners() {
|
|
5957
|
+
var t, e;
|
|
5958
|
+
this.addEventListener("click", this.handleClick), this.addEventListener("keydown", this.handleKeyDown), this._defaultSlotEl = ((t = this.shadowRoot) == null ? void 0 : t.querySelector("slot")) ?? null, (e = this._defaultSlotEl) == null || e.addEventListener("slotchange", this.updateItems);
|
|
5959
|
+
}
|
|
5960
|
+
cleanupEventListeners() {
|
|
5961
|
+
var t;
|
|
5962
|
+
this.removeEventListener("click", this.handleClick), this.removeEventListener("keydown", this.handleKeyDown), (t = this._defaultSlotEl) == null || t.removeEventListener(
|
|
5963
|
+
"slotchange",
|
|
5964
|
+
this.updateItems
|
|
5965
|
+
);
|
|
5966
|
+
}
|
|
5967
|
+
onAttributeChange(t, e, i) {
|
|
5968
|
+
t === "type" && (this._openItems.clear(), this.syncState());
|
|
5969
|
+
}
|
|
5970
|
+
toggleItem(t) {
|
|
5971
|
+
var n, d;
|
|
5972
|
+
const e = this._openItems.has(t), i = [];
|
|
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);
|
|
5977
|
+
});
|
|
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(() => {
|
|
5979
|
+
var h;
|
|
5980
|
+
(h = this._triggers[a]) == null || h.focus();
|
|
5981
|
+
});
|
|
5982
|
+
const r = this._openItems.has(t), o = ((d = (n = this._triggers[t]) == null ? void 0 : n.textContent) == null ? void 0 : d.trim()) || "Section";
|
|
5983
|
+
v(`${o} ${r ? "expanded" : "collapsed"}`), this.emit("a11y-accordion-change", {
|
|
5984
|
+
index: t,
|
|
5985
|
+
expanded: r,
|
|
5986
|
+
trigger: this._triggers[t],
|
|
5987
|
+
panel: this._panels[t]
|
|
5988
|
+
});
|
|
5989
|
+
}
|
|
5990
|
+
syncState() {
|
|
5991
|
+
this._triggers.forEach((t, e) => {
|
|
5992
|
+
const i = this._panels[e], s = this._openItems.has(e);
|
|
5993
|
+
t.setAttribute("aria-expanded", String(s)), i && (i.hidden = !s);
|
|
5994
|
+
});
|
|
5995
|
+
}
|
|
5996
|
+
/** Open an item by index */
|
|
5997
|
+
open(t) {
|
|
5998
|
+
this.type === "single" && this._openItems.clear(), this._openItems.add(t), this.syncState();
|
|
5999
|
+
}
|
|
6000
|
+
/** Close an item by index */
|
|
6001
|
+
close(t) {
|
|
6002
|
+
this._openItems.delete(t), this.syncState();
|
|
6003
|
+
}
|
|
6004
|
+
/** Toggle an item by index */
|
|
6005
|
+
toggle(t) {
|
|
6006
|
+
this.toggleItem(t);
|
|
6007
|
+
}
|
|
6008
|
+
}
|
|
6009
|
+
p("a11y-accordion", xt);
|
|
6010
|
+
const j = w("A11yTable");
|
|
6011
|
+
let Y = !1;
|
|
6012
|
+
function Ae() {
|
|
6013
|
+
if (Y || typeof document > "u") return;
|
|
6014
|
+
Y = !0;
|
|
6015
|
+
const l = document.createElement("style");
|
|
6016
|
+
l.setAttribute("data-compa11y-table", ""), l.textContent = ae, document.head.appendChild(l);
|
|
6017
|
+
}
|
|
6018
|
+
class At extends u {
|
|
6019
|
+
constructor() {
|
|
6020
|
+
super(...arguments), this._columns = [], this._rows = [], this._sortKey = null, this._sortDirection = "none", this._selectedRows = /* @__PURE__ */ new Set(), this._tableEl = null, this.handleClick = (t) => {
|
|
6021
|
+
const i = t.target.closest("[data-sort-btn]");
|
|
6022
|
+
if (i) {
|
|
6023
|
+
const s = i.dataset.sortKey;
|
|
6024
|
+
if (s) {
|
|
6025
|
+
this.sort(s);
|
|
6026
|
+
const a = this._columns.find((n) => n.key === s), r = (a == null ? void 0 : a.label) ?? s, o = this._sortDirection === "none" ? "sort cleared" : `sorted ${this._sortDirection}`;
|
|
6027
|
+
v(`${r} ${o}`), this.emit("a11y-table-sort", {
|
|
6028
|
+
sortKey: this._sortKey,
|
|
6029
|
+
sortDirection: this._sortDirection
|
|
6030
|
+
});
|
|
6031
|
+
}
|
|
6032
|
+
}
|
|
6033
|
+
}, this.handleChange = (t) => {
|
|
6034
|
+
const e = t.target;
|
|
6035
|
+
if (!(!e || e.type !== "checkbox")) {
|
|
6036
|
+
if ("selectAll" in e.dataset) {
|
|
6037
|
+
e.checked ? this.selectAll() : this.deselectAll();
|
|
6038
|
+
const i = this._selectedRows.size;
|
|
6039
|
+
v(
|
|
6040
|
+
i === 0 ? "Selection cleared" : `All ${i} rows selected`
|
|
6041
|
+
);
|
|
6042
|
+
return;
|
|
6043
|
+
}
|
|
6044
|
+
if ("selectRow" in e.dataset) {
|
|
6045
|
+
const i = e.dataset.rowId ?? "";
|
|
6046
|
+
if (!i) return;
|
|
6047
|
+
e.checked ? this._selectedRows.add(i) : this._selectedRows.delete(i), this.syncSelectionState(), this.emitSelectEvent();
|
|
6048
|
+
const s = this._selectedRows.size;
|
|
6049
|
+
v(
|
|
6050
|
+
s === 0 ? "Selection cleared" : `${s} row${s === 1 ? "" : "s"} selected`
|
|
6051
|
+
);
|
|
6052
|
+
}
|
|
6053
|
+
}
|
|
6054
|
+
};
|
|
6055
|
+
}
|
|
6056
|
+
static get observedAttributes() {
|
|
6057
|
+
return ["caption", "sort-key", "sort-direction", "selectable", "loading", "empty-message"];
|
|
6058
|
+
}
|
|
6059
|
+
// ── Attribute-backed getters ──────────────────────────────────────────────
|
|
6060
|
+
get caption() {
|
|
6061
|
+
return this.getAttribute("caption") || "";
|
|
6062
|
+
}
|
|
6063
|
+
set caption(t) {
|
|
6064
|
+
this.setAttribute("caption", t);
|
|
6065
|
+
}
|
|
6066
|
+
get selectable() {
|
|
6067
|
+
return this.hasAttribute("selectable");
|
|
6068
|
+
}
|
|
6069
|
+
get loading() {
|
|
6070
|
+
return this.hasAttribute("loading");
|
|
6071
|
+
}
|
|
6072
|
+
get emptyMessage() {
|
|
6073
|
+
return this.getAttribute("empty-message") || "No results found";
|
|
6074
|
+
}
|
|
6075
|
+
// ── Property-backed sort state ────────────────────────────────────────────
|
|
6076
|
+
get sortKey() {
|
|
6077
|
+
return this._sortKey;
|
|
6078
|
+
}
|
|
6079
|
+
set sortKey(t) {
|
|
6080
|
+
this._sortKey = t, this.rerenderTable();
|
|
6081
|
+
}
|
|
6082
|
+
get sortDirection() {
|
|
6083
|
+
return this._sortDirection;
|
|
6084
|
+
}
|
|
6085
|
+
set sortDirection(t) {
|
|
6086
|
+
this._sortDirection = t, this.rerenderTable();
|
|
6087
|
+
}
|
|
6088
|
+
// ── Data properties ───────────────────────────────────────────────────────
|
|
6089
|
+
get columns() {
|
|
6090
|
+
return this._columns;
|
|
6091
|
+
}
|
|
6092
|
+
set columns(t) {
|
|
6093
|
+
this._columns = t, this.rerenderTable();
|
|
6094
|
+
}
|
|
6095
|
+
get rows() {
|
|
6096
|
+
return this._rows;
|
|
6097
|
+
}
|
|
6098
|
+
set rows(t) {
|
|
6099
|
+
this._rows = t, this.rerenderTable();
|
|
6100
|
+
}
|
|
6101
|
+
get selectedRows() {
|
|
6102
|
+
return Array.from(this._selectedRows);
|
|
6103
|
+
}
|
|
6104
|
+
set selectedRows(t) {
|
|
6105
|
+
this._selectedRows = new Set(t), this.syncSelectionState();
|
|
6106
|
+
}
|
|
6107
|
+
// ── Lifecycle ─────────────────────────────────────────────────────────────
|
|
6108
|
+
/**
|
|
6109
|
+
* Re-apply JS properties that were set before the element was upgraded.
|
|
6110
|
+
*
|
|
6111
|
+
* When a custom element is used before its class is registered (e.g. inline
|
|
6112
|
+
* script sets `el.columns = [...]` before the module loads), the value lands
|
|
6113
|
+
* as a plain "own" property on the HTMLElement, shadowing the class
|
|
6114
|
+
* getter/setter. This method detects that, removes the own property, and
|
|
6115
|
+
* re-routes the value through the real setter so private fields are updated.
|
|
6116
|
+
*/
|
|
6117
|
+
upgradeProperty(t) {
|
|
6118
|
+
if (Object.prototype.hasOwnProperty.call(this, t)) {
|
|
6119
|
+
const e = this[t];
|
|
6120
|
+
delete this[t], this[t] = e;
|
|
6121
|
+
}
|
|
6122
|
+
}
|
|
6123
|
+
setupAccessibility() {
|
|
6124
|
+
Ae(), this.upgradeProperty("columns"), this.upgradeProperty("rows"), this.upgradeProperty("selectedRows"), this.upgradeProperty("sortKey"), this.upgradeProperty("sortDirection");
|
|
6125
|
+
const t = this.getAttribute("sort-key");
|
|
6126
|
+
t && (this._sortKey = t);
|
|
6127
|
+
const e = this.getAttribute("sort-direction");
|
|
6128
|
+
e && (this._sortDirection = e), !this.caption && !this.getAttribute("aria-label") && !this.getAttribute("aria-labelledby") && j.warning(
|
|
6129
|
+
"a11y-table must have an accessible name. Provide a caption attribute, aria-label, or aria-labelledby."
|
|
6130
|
+
);
|
|
6131
|
+
}
|
|
6132
|
+
render() {
|
|
6133
|
+
this.shadowRoot || this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = `
|
|
6134
|
+
<style>
|
|
6135
|
+
${g}
|
|
6136
|
+
:host { display: block; overflow-x: auto; }
|
|
6137
|
+
</style>
|
|
6138
|
+
<slot></slot>
|
|
6139
|
+
`, this._tableEl || (this._tableEl = document.createElement("table"), this.appendChild(this._tableEl)), this.renderTable();
|
|
6140
|
+
}
|
|
6141
|
+
setupEventListeners() {
|
|
6142
|
+
this.addEventListener("click", this.handleClick), this.addEventListener("change", this.handleChange);
|
|
6143
|
+
}
|
|
6144
|
+
cleanupEventListeners() {
|
|
6145
|
+
this.removeEventListener("click", this.handleClick), this.removeEventListener("change", this.handleChange);
|
|
6146
|
+
}
|
|
6147
|
+
onAttributeChange(t, e, i) {
|
|
6148
|
+
switch (t) {
|
|
6149
|
+
case "caption":
|
|
6150
|
+
case "empty-message":
|
|
6151
|
+
this.rerenderTable();
|
|
6152
|
+
break;
|
|
6153
|
+
case "sort-key":
|
|
6154
|
+
this._sortKey = i, this.rerenderTable();
|
|
6155
|
+
break;
|
|
6156
|
+
case "sort-direction":
|
|
6157
|
+
this._sortDirection = i || "none", this.rerenderTable();
|
|
6158
|
+
break;
|
|
6159
|
+
case "selectable":
|
|
6160
|
+
case "loading":
|
|
6161
|
+
this.rerenderTable();
|
|
6162
|
+
break;
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
6166
|
+
/** Sort the table by a column key, cycling direction automatically */
|
|
6167
|
+
sort(t, e) {
|
|
6168
|
+
e ? (this._sortKey = e === "none" ? null : t, this._sortDirection = e) : this._sortKey !== t ? (this._sortKey = t, this._sortDirection = "ascending") : this._sortDirection === "ascending" ? this._sortDirection = "descending" : this._sortDirection === "descending" ? (this._sortKey = null, this._sortDirection = "none") : (this._sortKey = t, this._sortDirection = "ascending"), this.rerenderTable();
|
|
6169
|
+
}
|
|
6170
|
+
selectRow(t) {
|
|
6171
|
+
this._selectedRows.add(t), this.syncSelectionState(), this.emitSelectEvent();
|
|
6172
|
+
}
|
|
6173
|
+
deselectRow(t) {
|
|
6174
|
+
this._selectedRows.delete(t), this.syncSelectionState(), this.emitSelectEvent();
|
|
6175
|
+
}
|
|
6176
|
+
selectAll() {
|
|
6177
|
+
for (const t of this._rows) {
|
|
6178
|
+
const e = String(t.id ?? "");
|
|
6179
|
+
e && this._selectedRows.add(e);
|
|
6180
|
+
}
|
|
6181
|
+
this.syncSelectionState(), this.emitSelectEvent();
|
|
6182
|
+
}
|
|
6183
|
+
deselectAll() {
|
|
6184
|
+
this._selectedRows.clear(), this.syncSelectionState(), this.emitSelectEvent();
|
|
6185
|
+
}
|
|
6186
|
+
// ── Rendering ─────────────────────────────────────────────────────────────
|
|
6187
|
+
/**
|
|
6188
|
+
* Preserve focus on a sort button across full re-renders.
|
|
6189
|
+
* We save the sort-key of the focused sort button, re-render, then
|
|
6190
|
+
* move focus back to the newly rendered sort button.
|
|
6191
|
+
*/
|
|
6192
|
+
rerenderTable() {
|
|
6193
|
+
if (!this._tableEl) return;
|
|
6194
|
+
const t = document.activeElement, e = (t == null ? void 0 : t.dataset.sortKey) ?? null, i = this._tableEl.contains(t);
|
|
6195
|
+
this.renderTable(), i && e && requestAnimationFrame(() => {
|
|
6196
|
+
var a;
|
|
6197
|
+
const s = (a = this._tableEl) == null ? void 0 : a.querySelector(
|
|
6198
|
+
`[data-sort-key="${e}"]`
|
|
6199
|
+
);
|
|
6200
|
+
s == null || s.focus();
|
|
6201
|
+
});
|
|
6202
|
+
}
|
|
6203
|
+
renderTable() {
|
|
6204
|
+
if (!this._tableEl) return;
|
|
6205
|
+
const t = this._tableEl;
|
|
6206
|
+
this.loading ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy");
|
|
6207
|
+
let e = t.querySelector("caption");
|
|
6208
|
+
this.caption ? (e || (e = document.createElement("caption"), t.prepend(e)), e.textContent = this.caption) : e && e.remove();
|
|
6209
|
+
let i = t.querySelector("thead");
|
|
6210
|
+
i || (i = document.createElement("thead"), t.appendChild(i)), this.renderThead(i);
|
|
6211
|
+
let s = t.querySelector("tbody");
|
|
6212
|
+
s || (s = document.createElement("tbody"), t.appendChild(s)), this.renderTbody(s);
|
|
6213
|
+
}
|
|
6214
|
+
renderThead(t) {
|
|
6215
|
+
t.innerHTML = "";
|
|
6216
|
+
const e = document.createElement("tr");
|
|
6217
|
+
if (this.selectable) {
|
|
6218
|
+
const i = document.createElement("th");
|
|
6219
|
+
i.scope = "col", i.style.width = "2.5rem";
|
|
6220
|
+
const s = this._rows.map((d) => String(d.id ?? "")).filter(Boolean), a = s.filter(
|
|
6221
|
+
(d) => this._selectedRows.has(d)
|
|
6222
|
+
).length, r = s.length > 0 && a === s.length, o = a > 0 && a < s.length, n = document.createElement("input");
|
|
6223
|
+
n.type = "checkbox", n.dataset.selectAll = "", n.setAttribute("data-select-cb", ""), n.setAttribute("aria-label", "Select all rows"), n.checked = r, n.indeterminate = o, i.appendChild(n), e.appendChild(i);
|
|
6224
|
+
}
|
|
6225
|
+
for (const i of this._columns) {
|
|
6226
|
+
const s = document.createElement("th");
|
|
6227
|
+
if (s.scope = "col", i.align && (s.style.textAlign = i.align), i.sortable) {
|
|
6228
|
+
const a = this._sortKey === i.key, r = a ? this._sortDirection : "none";
|
|
6229
|
+
s.setAttribute("aria-sort", r);
|
|
6230
|
+
const o = document.createElement("button");
|
|
6231
|
+
o.type = "button", o.setAttribute("data-sort-btn", ""), o.setAttribute("data-sort-key", i.key);
|
|
6232
|
+
const n = document.createElement("span");
|
|
6233
|
+
n.textContent = i.label;
|
|
6234
|
+
const d = document.createElement("span");
|
|
6235
|
+
d.setAttribute("aria-hidden", "true"), d.setAttribute("data-sort-icon", ""), d.textContent = a && r === "ascending" ? "↑" : a && r === "descending" ? "↓" : "↕", o.appendChild(n), o.appendChild(d), s.appendChild(o);
|
|
6236
|
+
} else
|
|
6237
|
+
s.textContent = i.label;
|
|
6238
|
+
e.appendChild(s);
|
|
6239
|
+
}
|
|
6240
|
+
t.appendChild(e);
|
|
6241
|
+
}
|
|
6242
|
+
renderTbody(t) {
|
|
6243
|
+
if (t.innerHTML = "", this.loading) {
|
|
6244
|
+
const e = document.createElement("tr");
|
|
6245
|
+
e.setAttribute("aria-busy", "true");
|
|
6246
|
+
const i = document.createElement("td");
|
|
6247
|
+
i.setAttribute("data-loading-cell", ""), i.colSpan = this._columns.length + (this.selectable ? 1 : 0), i.textContent = "Loading…", e.appendChild(i), t.appendChild(e);
|
|
6248
|
+
return;
|
|
6249
|
+
}
|
|
6250
|
+
if (this._rows.length === 0) {
|
|
6251
|
+
const e = document.createElement("tr"), i = document.createElement("td");
|
|
6252
|
+
i.setAttribute("data-empty-cell", ""), i.colSpan = this._columns.length + (this.selectable ? 1 : 0), i.textContent = this.emptyMessage, e.appendChild(i), t.appendChild(e);
|
|
6253
|
+
return;
|
|
6254
|
+
}
|
|
6255
|
+
this.selectable && this._rows.some((i) => !i.id) && j.warning(
|
|
6256
|
+
'a11y-table: When selectable is enabled, each row object must have an "id" field.'
|
|
6257
|
+
);
|
|
6258
|
+
for (const e of this._rows) {
|
|
6259
|
+
const i = String(e.id ?? ""), s = i ? this._selectedRows.has(i) : !1, a = document.createElement("tr");
|
|
6260
|
+
if (i && this.selectable && a.setAttribute("aria-selected", String(s)), this.selectable) {
|
|
6261
|
+
const r = document.createElement("td");
|
|
6262
|
+
r.style.width = "2.5rem";
|
|
6263
|
+
const o = document.createElement("input");
|
|
6264
|
+
o.type = "checkbox", o.dataset.rowId = i, o.dataset.selectRow = "", o.setAttribute("data-select-cb", ""), o.checked = s;
|
|
6265
|
+
const n = this._columns[0], d = n ? String(e[n.key] ?? i) : i;
|
|
6266
|
+
o.setAttribute("aria-label", `Select ${d}`), r.appendChild(o), a.appendChild(r);
|
|
6267
|
+
}
|
|
6268
|
+
for (const r of this._columns) {
|
|
6269
|
+
const o = e[r.key], n = o == null ? "" : String(o);
|
|
6270
|
+
if (r.rowHeader) {
|
|
6271
|
+
const d = document.createElement("th");
|
|
6272
|
+
d.scope = "row", r.align && (d.style.textAlign = r.align), d.textContent = n, a.appendChild(d);
|
|
6273
|
+
} else {
|
|
6274
|
+
const d = document.createElement("td");
|
|
6275
|
+
r.align && (d.style.textAlign = r.align), d.textContent = n, a.appendChild(d);
|
|
6276
|
+
}
|
|
6277
|
+
}
|
|
6278
|
+
t.appendChild(a);
|
|
6279
|
+
}
|
|
6280
|
+
}
|
|
6281
|
+
/** Re-sync selection state without full re-render (preserves focus) */
|
|
6282
|
+
syncSelectionState() {
|
|
6283
|
+
if (!this._tableEl) return;
|
|
6284
|
+
const t = this._tableEl.querySelectorAll("tbody tr");
|
|
6285
|
+
for (const i of Array.from(t)) {
|
|
6286
|
+
const s = i.querySelector("[data-select-row]");
|
|
6287
|
+
if (!s) continue;
|
|
6288
|
+
const a = s.dataset.rowId ?? "", r = this._selectedRows.has(a);
|
|
6289
|
+
i.setAttribute("aria-selected", String(r)), s.checked = r;
|
|
6290
|
+
}
|
|
6291
|
+
const e = this._tableEl.querySelector("[data-select-all]");
|
|
6292
|
+
if (e) {
|
|
6293
|
+
const i = this._rows.map((a) => String(a.id ?? "")).filter(Boolean), s = i.filter(
|
|
6294
|
+
(a) => this._selectedRows.has(a)
|
|
6295
|
+
).length;
|
|
6296
|
+
e.checked = i.length > 0 && s === i.length, e.indeterminate = s > 0 && s < i.length;
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6299
|
+
emitSelectEvent() {
|
|
6300
|
+
this.emit("a11y-table-select", {
|
|
6301
|
+
selectedRows: Array.from(this._selectedRows)
|
|
6302
|
+
});
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
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);
|
|
4817
6694
|
if (typeof window < "u") {
|
|
4818
|
-
const
|
|
4819
|
-
B(),
|
|
6695
|
+
const l = () => {
|
|
6696
|
+
B(), P();
|
|
4820
6697
|
};
|
|
4821
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
6698
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", l) : l(), window.compa11y = {
|
|
4822
6699
|
// Components (classes)
|
|
4823
|
-
A11yDialog:
|
|
4824
|
-
A11yMenu:
|
|
4825
|
-
A11yTabs:
|
|
4826
|
-
A11yCombobox:
|
|
4827
|
-
A11ySwitch:
|
|
4828
|
-
A11ySelect:
|
|
4829
|
-
A11yInput:
|
|
4830
|
-
A11yTextarea:
|
|
4831
|
-
A11yButton:
|
|
4832
|
-
A11yListbox:
|
|
4833
|
-
A11yOption:
|
|
4834
|
-
A11yOptgroup:
|
|
4835
|
-
A11yCheckbox:
|
|
4836
|
-
A11yCheckboxGroup:
|
|
4837
|
-
A11yRadioGroup:
|
|
4838
|
-
A11yRadio:
|
|
4839
|
-
A11yToast:
|
|
4840
|
-
A11yVisuallyHidden:
|
|
4841
|
-
A11ySkipLink:
|
|
4842
|
-
A11yAlert:
|
|
6700
|
+
A11yDialog: W,
|
|
6701
|
+
A11yMenu: X,
|
|
6702
|
+
A11yTabs: J,
|
|
6703
|
+
A11yCombobox: Q,
|
|
6704
|
+
A11ySwitch: Z,
|
|
6705
|
+
A11ySelect: tt,
|
|
6706
|
+
A11yInput: et,
|
|
6707
|
+
A11yTextarea: it,
|
|
6708
|
+
A11yButton: st,
|
|
6709
|
+
A11yListbox: ot,
|
|
6710
|
+
A11yOption: rt,
|
|
6711
|
+
A11yOptgroup: at,
|
|
6712
|
+
A11yCheckbox: H,
|
|
6713
|
+
A11yCheckboxGroup: nt,
|
|
6714
|
+
A11yRadioGroup: lt,
|
|
6715
|
+
A11yRadio: dt,
|
|
6716
|
+
A11yToast: ct,
|
|
6717
|
+
A11yVisuallyHidden: ht,
|
|
6718
|
+
A11ySkipLink: ut,
|
|
6719
|
+
A11yAlert: pt,
|
|
6720
|
+
A11yLink: bt,
|
|
6721
|
+
A11yHeading: ft,
|
|
6722
|
+
A11yText: vt,
|
|
6723
|
+
A11yFormField: yt,
|
|
6724
|
+
A11yPopover: _t,
|
|
6725
|
+
A11yAccordion: xt,
|
|
6726
|
+
A11yTable: At,
|
|
6727
|
+
A11yPagination: Et,
|
|
4843
6728
|
// Announcer utilities
|
|
4844
6729
|
initAnnouncer: B,
|
|
4845
6730
|
announce: v,
|
|
4846
|
-
announcePolite:
|
|
6731
|
+
announcePolite: f,
|
|
4847
6732
|
announceAssertive: O,
|
|
4848
|
-
announceStatus:
|
|
4849
|
-
announceError:
|
|
6733
|
+
announceStatus: Bt,
|
|
6734
|
+
announceError: Pt,
|
|
4850
6735
|
// Focus utilities
|
|
4851
|
-
initFocusVisible:
|
|
4852
|
-
createFocusTrap:
|
|
4853
|
-
createFocusScope:
|
|
4854
|
-
createRovingTabindex:
|
|
6736
|
+
initFocusVisible: P,
|
|
6737
|
+
createFocusTrap: Ht,
|
|
6738
|
+
createFocusScope: Ot,
|
|
6739
|
+
createRovingTabindex: Rt,
|
|
4855
6740
|
// Keyboard utilities
|
|
4856
|
-
createKeyboardManager:
|
|
4857
|
-
KeyboardPatterns:
|
|
4858
|
-
createTypeAhead:
|
|
6741
|
+
createKeyboardManager: qt,
|
|
6742
|
+
KeyboardPatterns: Dt,
|
|
6743
|
+
createTypeAhead: R,
|
|
4859
6744
|
// ARIA utilities
|
|
4860
|
-
aria:
|
|
4861
|
-
buildAriaProps:
|
|
4862
|
-
hasAccessibleName:
|
|
6745
|
+
aria: zt,
|
|
6746
|
+
buildAriaProps: Ct,
|
|
6747
|
+
hasAccessibleName: Tt,
|
|
4863
6748
|
// Platform detection
|
|
4864
|
-
isBrowser:
|
|
4865
|
-
prefersReducedMotion:
|
|
4866
|
-
prefersHighContrast:
|
|
4867
|
-
prefersDarkMode:
|
|
6749
|
+
isBrowser: It,
|
|
6750
|
+
prefersReducedMotion: Lt,
|
|
6751
|
+
prefersHighContrast: $t,
|
|
6752
|
+
prefersDarkMode: St
|
|
4868
6753
|
};
|
|
4869
6754
|
}
|
|
4870
6755
|
export {
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
W as
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
6756
|
+
xt as A11yAccordion,
|
|
6757
|
+
pt as A11yAlert,
|
|
6758
|
+
st as A11yButton,
|
|
6759
|
+
H as A11yCheckbox,
|
|
6760
|
+
nt as A11yCheckboxGroup,
|
|
6761
|
+
Q as A11yCombobox,
|
|
6762
|
+
W as A11yDialog,
|
|
6763
|
+
yt as A11yFormField,
|
|
6764
|
+
ft as A11yHeading,
|
|
6765
|
+
et as A11yInput,
|
|
6766
|
+
bt as A11yLink,
|
|
6767
|
+
ot as A11yListbox,
|
|
6768
|
+
X as A11yMenu,
|
|
6769
|
+
at as A11yOptgroup,
|
|
6770
|
+
rt as A11yOption,
|
|
6771
|
+
Et as A11yPagination,
|
|
6772
|
+
_t as A11yPopover,
|
|
6773
|
+
dt as A11yRadio,
|
|
6774
|
+
lt as A11yRadioGroup,
|
|
6775
|
+
tt as A11ySelect,
|
|
6776
|
+
ut as A11ySkipLink,
|
|
6777
|
+
Z as A11ySwitch,
|
|
6778
|
+
At as A11yTable,
|
|
6779
|
+
J as A11yTabs,
|
|
6780
|
+
vt as A11yText,
|
|
6781
|
+
it as A11yTextarea,
|
|
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
|
|
4911
6804
|
};
|