@nysds/components 1.20.0-alpha-3 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +9101 -5385
- package/dist/.vscode/vscode.css-custom-data.json +5 -0
- package/dist/.vscode/vscode.html-custom-data.json +332 -30
- package/dist/custom-elements.json +9101 -5385
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js +706 -0
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js.map +1 -0
- package/dist/nys-icon.library-eNVZmfkf.js +696 -0
- package/dist/nys-icon.library-eNVZmfkf.js.map +1 -0
- package/dist/nysds.es.js +10460 -5393
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +2436 -472
- package/dist/nysds.js.map +1 -1
- package/dist/packages/internals/src/aria-associate.d.ts +41 -0
- package/dist/packages/internals/src/form-control-mixin.d.ts +34 -0
- package/dist/packages/internals/src/id.d.ts +8 -0
- package/dist/packages/internals/src/identified-mixin.d.ts +23 -0
- package/dist/packages/internals/src/index.d.ts +7 -0
- package/dist/packages/internals/src/reflects-aria-mixin.d.ts +33 -0
- package/dist/packages/internals/src/test-helpers.d.ts +29 -0
- package/dist/packages/internals/src/types.d.ts +9 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +72 -10
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +63 -8
- package/dist/packages/nys-alert/src/nys-alert.d.ts +95 -20
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +100 -7
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +75 -5
- package/dist/packages/nys-badge/src/nys-badge.d.ts +63 -6
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +79 -10
- package/dist/packages/nys-button/src/nys-button.d.ts +132 -26
- package/dist/packages/nys-card/src/index.d.ts +1 -0
- package/dist/packages/nys-card/src/nys-card.d.ts +325 -0
- package/dist/packages/nys-card/src/nys-card.figma.d.ts +1 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +36 -12
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +81 -6
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +174 -5
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +83 -13
- package/dist/packages/nys-divider/src/nys-divider.d.ts +33 -9
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +24 -15
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +3 -12
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +22 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +101 -12
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +23 -2
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +99 -9
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +189 -6
- package/dist/packages/nys-icon/src/icon-cache.d.ts +11 -4
- package/dist/packages/nys-icon/src/icon-library-registry.d.ts +33 -16
- package/dist/packages/nys-icon/src/index.d.ts +2 -2
- package/dist/packages/nys-icon/src/nys-icon.d.ts +98 -8
- package/dist/packages/nys-iconlist/src/index.d.ts +2 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +92 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.figma.d.ts +1 -0
- package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +32 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +37 -2
- package/dist/packages/nys-modal/src/nys-modal.d.ts +145 -13
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +67 -3
- package/dist/packages/nys-processlist/src/index.d.ts +2 -0
- package/dist/packages/nys-processlist/src/nys-processlist.d.ts +184 -0
- package/dist/packages/nys-processlist/src/nys-processlist.figma.d.ts +1 -0
- package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +41 -0
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +201 -7
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +88 -6
- package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
- package/dist/packages/nys-select/src/nys-select.d.ts +150 -15
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +4 -4
- package/dist/packages/nys-stepper/src/nys-step.d.ts +26 -20
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +128 -75
- package/dist/packages/nys-tab/src/nys-tab.d.ts +19 -10
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +181 -39
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +15 -24
- package/dist/packages/nys-table/src/nys-table.d.ts +90 -3
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +60 -10
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +77 -14
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +47 -10
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +48 -8
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +45 -4
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +216 -11
- package/dist/packages/nys-verticalnav/src/index.d.ts +2 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +572 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.figma.d.ts +1 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +24 -0
- package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
- package/dist/src/index.d.ts +6 -2
- package/package.json +11 -6
- package/packages/react/NysAccordion.d.ts +10 -0
- package/packages/react/NysAccordion.js +2 -1
- package/packages/react/NysAccordionItem.d.ts +10 -0
- package/packages/react/NysAccordionItem.js +3 -1
- package/packages/react/NysAlert.d.ts +8 -10
- package/packages/react/NysAlert.js +0 -2
- package/packages/react/NysAvatar.d.ts +11 -1
- package/packages/react/NysBacktotop.d.ts +3 -0
- package/packages/react/NysBacktotop.js +2 -1
- package/packages/react/NysBreadcrumbs.d.ts +2 -2
- package/packages/react/NysButton.d.ts +38 -8
- package/packages/react/NysButton.js +6 -4
- package/packages/react/NysCard.d.ts +110 -0
- package/packages/react/NysCard.js +61 -0
- package/packages/react/NysCheckbox.d.ts +9 -0
- package/packages/react/NysCheckbox.js +4 -0
- package/packages/react/NysDropdownMenu.d.ts +4 -2
- package/packages/react/NysFileinput.d.ts +2 -2
- package/packages/react/NysGlobalFooter.d.ts +17 -0
- package/packages/react/NysGlobalFooter.js +10 -2
- package/packages/react/NysGlobalHeader.d.ts +17 -0
- package/packages/react/NysGlobalHeader.js +11 -2
- package/packages/react/NysIconlist.d.ts +54 -0
- package/packages/react/NysIconlist.js +22 -0
- package/packages/react/NysIconlistitem.d.ts +59 -0
- package/packages/react/NysIconlistitem.js +22 -0
- package/packages/react/NysLabel.d.ts +4 -1
- package/packages/react/NysModal.d.ts +8 -1
- package/packages/react/NysModal.js +11 -2
- package/packages/react/NysProcesslist.d.ts +65 -0
- package/packages/react/NysProcesslist.js +25 -0
- package/packages/react/NysProcesslistitem.d.ts +61 -0
- package/packages/react/NysProcesslistitem.js +35 -0
- package/packages/react/NysRadiobutton.d.ts +27 -3
- package/packages/react/NysRadiobutton.js +9 -1
- package/packages/react/NysSelect.d.ts +3 -0
- package/packages/react/NysSelect.js +2 -0
- package/packages/react/NysStepper.d.ts +1 -1
- package/packages/react/NysTabgroup.d.ts +5 -4
- package/packages/react/NysTable.d.ts +1 -1
- package/packages/react/NysTabpanel.d.ts +11 -4
- package/packages/react/NysTextarea.d.ts +4 -1
- package/packages/react/NysTextarea.js +2 -0
- package/packages/react/NysUnavFooter.d.ts +13 -0
- package/packages/react/NysUnavFooter.js +4 -1
- package/packages/react/NysUnavHeader.d.ts +24 -1
- package/packages/react/NysUnavHeader.js +17 -1
- package/packages/react/NysVerticalnav.d.ts +67 -0
- package/packages/react/NysVerticalnav.js +26 -0
- package/packages/react/NysVerticalnavGroup.d.ts +76 -0
- package/packages/react/NysVerticalnavGroup.js +43 -0
- package/packages/react/index.d.ts +7 -0
- package/packages/react/index.js +7 -0
- package/packages/react/nysds-jsx.d.ts +404 -46
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
/**
|
|
3
3
|
* `<nys-tabgroup>` is the container for `<nys-tab>` and `<nys-tabpanel>`
|
|
4
4
|
* elements.
|
|
5
5
|
*
|
|
6
6
|
* Accepts tabs and panels as flat light-DOM children in any order (interleaved
|
|
7
|
-
* or grouped). On slot change,
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* or grouped). On slot change, each child is assigned `slot="tab"` or
|
|
8
|
+
* `slot="panel"` so it is projected into the correct shadow-DOM container
|
|
9
|
+
* while remaining in the light DOM, ARIA relationships are wired, and the
|
|
10
|
+
* first selected (or first) tab is activated.
|
|
10
11
|
*
|
|
11
12
|
* Scroll shadows are rendered on either side of the tab list and toggled via
|
|
12
13
|
* `ResizeObserver` and a `scroll` listener so they accurately reflect whether
|
|
@@ -19,33 +20,137 @@ import { LitElement } from "lit";
|
|
|
19
20
|
*
|
|
20
21
|
* @element nys-tabgroup
|
|
21
22
|
*
|
|
22
|
-
* @slot - Accepts `<nys-tab>` and `<nys-tabpanel>` children.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* @slot - Accepts `<nys-tab>` and `<nys-tabpanel>` children. On `slotchange`
|
|
24
|
+
* they are assigned `slot="tab"` / `slot="panel"` and projected into the
|
|
25
|
+
* tablist and panel containers; they stay in the light DOM. Any other
|
|
26
|
+
* children remain in the default slot, rendered below the panels.
|
|
25
27
|
*
|
|
26
|
-
* @example
|
|
28
|
+
* @example Basic
|
|
27
29
|
* ```html
|
|
28
|
-
* <nys-tabgroup
|
|
29
|
-
* <nys-tab label="
|
|
30
|
-
* <nys-tab label="
|
|
31
|
-
* <nys-tab label="
|
|
32
|
-
*
|
|
33
|
-
* <nys-tabpanel
|
|
34
|
-
*
|
|
30
|
+
* <nys-tabgroup>
|
|
31
|
+
* <nys-tab label="Marcy"></nys-tab>
|
|
32
|
+
* <nys-tab label="Algonquin"></nys-tab>
|
|
33
|
+
* <nys-tab label="Haystack"></nys-tab>
|
|
34
|
+
* // rest of tabs
|
|
35
|
+
* <nys-tabpanel
|
|
36
|
+
* >Mount Marcy is the tallest peak in the Adirondacks. It has an elevation
|
|
37
|
+
* of 5344 feet with 3166 feet of elevation gain. The roundtrip hike to the
|
|
38
|
+
* top is 14.8 miles and is an out-and-back route.
|
|
39
|
+
* </nys-tabpanel>
|
|
40
|
+
* <nys-tabpanel
|
|
41
|
+
* >Algonquin Peak is the 2nd tallest peak in the Adirondacks. It has an
|
|
42
|
+
* elevation of 5114 feet with 3050 feet of elevation gain. The roundtrip
|
|
43
|
+
* hike to the top is 7.8 miles and is an out-and-back route.</nys-tabpanel
|
|
44
|
+
* >
|
|
45
|
+
* <nys-tabpanel
|
|
46
|
+
* >Mount Haystack is the 3rd tallest peak in the Adirondacks. It has an
|
|
47
|
+
* elevation of 4960 feet with 4000 feet of elevation gain. The roundtrip
|
|
48
|
+
* hike to the top is 16.4 miles and is an out-and-back
|
|
49
|
+
* route.</nys-tabpanel
|
|
50
|
+
* >
|
|
51
|
+
* // rest of tab panel content
|
|
52
|
+
* </nys-tabgroup>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @render Basic
|
|
56
|
+
* ```html
|
|
57
|
+
* <nys-tabgroup>
|
|
58
|
+
* <nys-tab label="Marcy"></nys-tab>
|
|
59
|
+
* <nys-tab label="Algonquin"></nys-tab>
|
|
60
|
+
* <nys-tab label="Haystack"></nys-tab>
|
|
61
|
+
* <nys-tab label="Skylight" id="tab4"></nys-tab>
|
|
62
|
+
* <nys-tab label="Whiteface" id="tab5"></nys-tab>
|
|
63
|
+
* <nys-tabpanel
|
|
64
|
+
* >Mount Marcy is the tallest peak in the Adirondacks. It has an elevation
|
|
65
|
+
* of 5344 feet with 3166 feet of elevation gain. The roundtrip hike to the
|
|
66
|
+
* top is 14.8 miles and is an out-and-back route.
|
|
67
|
+
* </nys-tabpanel>
|
|
68
|
+
* <nys-tabpanel
|
|
69
|
+
* >Algonquin Peak is the 2nd tallest peak in the Adirondacks. It has an
|
|
70
|
+
* elevation of 5114 feet with 3050 feet of elevation gain. The roundtrip
|
|
71
|
+
* hike to the top is 7.8 miles and is an out-and-back route.</nys-tabpanel
|
|
72
|
+
* >
|
|
73
|
+
* <nys-tabpanel
|
|
74
|
+
* >Mount Haystack is the 3rd tallest peak in the Adirondacks. It has an
|
|
75
|
+
* elevation of 4960 feet with 4000 feet of elevation gain. The roundtrip
|
|
76
|
+
* hike to the top is 16.4 miles and is an out-and-back
|
|
77
|
+
* route.</nys-tabpanel
|
|
78
|
+
* >
|
|
79
|
+
* <nys-tabpanel
|
|
80
|
+
* >Mount Skylight is the 4th tallest peak in the Adirondacks. It has an
|
|
81
|
+
* elevation of 4926 feet with 5100 feet of elevation gain. The roundtrip
|
|
82
|
+
* hike to the top is 16 miles and is an out-and-back route.</nys-tabpanel
|
|
83
|
+
* >
|
|
84
|
+
* <nys-tabpanel
|
|
85
|
+
* >Whiteface is the 5th tallest peak in the Adirondacks. It has an
|
|
86
|
+
* elevation of 4867 feet with 3050 feet of elevation gain. The roundtrip
|
|
87
|
+
* hike to the top is 7.2 miles and is an out-and-back route.</nys-tabpanel
|
|
88
|
+
* >
|
|
89
|
+
* <p style="padding: 1rem;">
|
|
90
|
+
* <strong>Note:</strong> The content in the tab panels was gathered from
|
|
91
|
+
* <a href="https://www.lakeplacid.com/do/outdoors/summerfall/hiking"
|
|
92
|
+
* >lakeplacid.com</a
|
|
93
|
+
* >
|
|
94
|
+
* and may not be completely accurate. This is meant to be a demo of how
|
|
95
|
+
* the component works, not a hiking guide.
|
|
96
|
+
* </p>
|
|
97
|
+
* </nys-tabgroup>
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example Explicit Ordering
|
|
101
|
+
* ```html
|
|
102
|
+
* <nys-tabgroup id="explicit-ordering">
|
|
103
|
+
* <nys-tab label="1st Tab" id="tab1"></nys-tab>
|
|
104
|
+
* <nys-tab label="2nd Tab" id="tab2"></nys-tab>
|
|
105
|
+
* <nys-tab label="3rd Tab" id="tab3"></nys-tab>
|
|
106
|
+
* <nys-tabpanel aria-labelledby="tab2">Content for tab 2</nys-tabpanel>
|
|
107
|
+
* <nys-tabpanel aria-labelledby="tab3">Content for tab 3</nys-tabpanel>
|
|
108
|
+
* <nys-tabpanel aria-labelledby="tab1">Content for tab 1</nys-tabpanel>
|
|
109
|
+
* </nys-tabgroup>
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @example JS in tabpanel
|
|
113
|
+
* ```html
|
|
114
|
+
* <nys-tabgroup>
|
|
115
|
+
* <nys-tab label="Tab 1"></nys-tab>
|
|
116
|
+
* <nys-tab label="Tab 2"></nys-tab>
|
|
117
|
+
* <nys-tabpanel>
|
|
118
|
+
* <p>Content for tab 1</p>
|
|
119
|
+
* </nys-tabpanel>
|
|
120
|
+
* <nys-tabpanel>
|
|
121
|
+
* <p>Content for tab 2</p>
|
|
122
|
+
* </nys-tabpanel>
|
|
35
123
|
* </nys-tabgroup>
|
|
124
|
+
* <script>
|
|
125
|
+
* const tabgroup = document.querySelector("nys-tabgroup");
|
|
126
|
+
* const panels = tabgroup.querySelectorAll("nys-tabpanel");
|
|
127
|
+
* panels[0].innerHTML += "<p>Added via JS</p>";
|
|
128
|
+
* </script>
|
|
36
129
|
* ```
|
|
37
130
|
*
|
|
38
|
-
* @example
|
|
131
|
+
* @example Custom Styling
|
|
39
132
|
* ```html
|
|
40
|
-
* <
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
133
|
+
* <style>
|
|
134
|
+
* nys-tabpanel {
|
|
135
|
+
* --_nys-tabpanel-background-color: var(--nys-color-theme-faint);
|
|
136
|
+
* border: solid 2px var(--nys-color-theme-strong);
|
|
137
|
+
* --nys-button-background-color: var(--nys-color-success);
|
|
138
|
+
* }
|
|
139
|
+
* </style>
|
|
140
|
+
* <nys-tabgroup>
|
|
141
|
+
* <nys-tab label="Tab 1"></nys-tab>
|
|
142
|
+
* <nys-tab label="Tab 2"></nys-tab>
|
|
143
|
+
* <nys-tabpanel>
|
|
144
|
+
* <p>Content for tab 1</p>
|
|
145
|
+
* <nys-button>Click me</nys-button>
|
|
146
|
+
* </nys-tabpanel>
|
|
147
|
+
* <nys-tabpanel>
|
|
148
|
+
* <p>Content for tab 2</p>
|
|
149
|
+
* </nys-tabpanel>
|
|
45
150
|
* </nys-tabgroup>
|
|
46
151
|
* ```
|
|
47
152
|
*/
|
|
48
|
-
export declare class NysTabgroup extends
|
|
153
|
+
export declare class NysTabgroup extends NysElement {
|
|
49
154
|
static styles: import("lit").CSSResult;
|
|
50
155
|
/**
|
|
51
156
|
* Unique identifier for the tabgroup element.
|
|
@@ -117,19 +222,42 @@ export declare class NysTabgroup extends LitElement {
|
|
|
117
222
|
*/
|
|
118
223
|
private _updateScrollShadows;
|
|
119
224
|
/**
|
|
120
|
-
* Returns all `<nys-tab>`
|
|
121
|
-
*
|
|
225
|
+
* Returns all `<nys-tab>` light-DOM children in DOM order.
|
|
226
|
+
*
|
|
227
|
+
* Tabs are projected into the shadow-DOM tablist via the `tab` slot but
|
|
228
|
+
* remain light-DOM children of the group, so they stay reachable by consumer
|
|
229
|
+
* CSS and JavaScript.
|
|
122
230
|
*
|
|
123
231
|
* @returns An array of `HTMLElement` references to every `<nys-tab>` child.
|
|
124
232
|
*/
|
|
125
233
|
private _getTabs;
|
|
126
234
|
/**
|
|
127
|
-
* Returns
|
|
128
|
-
*
|
|
235
|
+
* Returns the `<nys-tabpanel>` light-DOM children ordered to align with
|
|
236
|
+
* `_getTabs()` — i.e. `panels[i]` is the panel paired with `tabs[i]`.
|
|
237
|
+
*
|
|
238
|
+
* Pairing honors explicit `aria-labelledby` references first, then falls
|
|
239
|
+
* back to source order for the remaining panels. See {@link _pairPanels}.
|
|
129
240
|
*
|
|
130
|
-
* @returns An array of `HTMLElement` references to every `<nys-tabpanel
|
|
241
|
+
* @returns An array of `HTMLElement` references to every `<nys-tabpanel>`,
|
|
242
|
+
* in tab-paired order.
|
|
131
243
|
*/
|
|
132
244
|
private _getPanels;
|
|
245
|
+
/**
|
|
246
|
+
* Orders `panels` to align 1:1 with `tabs`.
|
|
247
|
+
*
|
|
248
|
+
* A panel is paired with a tab when its `aria-labelledby` matches that tab's
|
|
249
|
+
* `id`; explicit references win over position. Panels without a reference
|
|
250
|
+
* fill the remaining tab slots in source order. Any panels whose reference
|
|
251
|
+
* does not resolve to a tab are appended at the end.
|
|
252
|
+
*
|
|
253
|
+
* Idempotent: after `_applySelection` writes `aria-labelledby` onto every
|
|
254
|
+
* panel, re-running this yields the same order.
|
|
255
|
+
*
|
|
256
|
+
* @param tabs - Ordered `<nys-tab>` elements.
|
|
257
|
+
* @param panels - `<nys-tabpanel>` elements in source order.
|
|
258
|
+
* @returns The panels reordered to tab-paired order.
|
|
259
|
+
*/
|
|
260
|
+
private _pairPanels;
|
|
133
261
|
/**
|
|
134
262
|
* Single source of truth for ARIA wiring, `tabindex`, and panel visibility.
|
|
135
263
|
*
|
|
@@ -150,20 +278,27 @@ export declare class NysTabgroup extends LitElement {
|
|
|
150
278
|
*/
|
|
151
279
|
private _applySelection;
|
|
152
280
|
/**
|
|
153
|
-
* Handles `slotchange`
|
|
281
|
+
* Handles `slotchange` and keeps the tabs/panels wired without ever removing
|
|
282
|
+
* them from the light DOM.
|
|
283
|
+
*
|
|
284
|
+
* Consumers author `<nys-tab>` / `<nys-tabpanel>` as flat children with no
|
|
285
|
+
* `slot` attribute. This assigns `slot="tab"` / `slot="panel"` so each is
|
|
286
|
+
* projected into the correct shadow-DOM container while remaining a
|
|
287
|
+
* light-DOM child of the group (reachable by consumer CSS/JS). Any other
|
|
288
|
+
* children (e.g. a footnote `<p>`) are left untouched in the default slot.
|
|
154
289
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
290
|
+
* Reads all current light-DOM children on every call (rather than a single
|
|
291
|
+
* slot's assigned nodes), so it is robust to dynamic additions/removals and
|
|
292
|
+
* idempotent: setting the `slot` attributes triggers further `slotchange`
|
|
293
|
+
* events, but once the attributes are stable no more mutations occur and the
|
|
294
|
+
* cascade settles.
|
|
295
|
+
*
|
|
296
|
+
* After (re)assignment, `_applySelection` is called honoring the first tab
|
|
297
|
+
* that already has a `selected` attribute, or index `0` if none is found.
|
|
162
298
|
*
|
|
163
|
-
* @param e - The `Event` fired by the `<slot>` element on slot change.
|
|
164
299
|
* @returns void
|
|
165
300
|
*/
|
|
166
|
-
private
|
|
301
|
+
private _syncChildren;
|
|
167
302
|
/**
|
|
168
303
|
* Handles the `nys-tab-select` custom event bubbled up from a child
|
|
169
304
|
* `<nys-tab>`.
|
|
@@ -177,12 +312,19 @@ export declare class NysTabgroup extends LitElement {
|
|
|
177
312
|
*/
|
|
178
313
|
private _handleTabSelect;
|
|
179
314
|
/**
|
|
180
|
-
* Implements the
|
|
315
|
+
* Implements the
|
|
316
|
+
* {@link https://www.w3.org/WAI/ARIA/apg/patterns/tabs/ ARIA Tabs Pattern}
|
|
317
|
+
* keyboard interaction for a horizontal tablist:
|
|
181
318
|
* - `ArrowRight` — moves focus to the next enabled tab (wraps).
|
|
182
319
|
* - `ArrowLeft` — moves focus to the previous enabled tab (wraps).
|
|
320
|
+
* - `Home` — moves focus to the first enabled tab.
|
|
321
|
+
* - `End` — moves focus to the last enabled tab.
|
|
322
|
+
*
|
|
323
|
+
* Handled keys call `preventDefault()` so they don't trigger the browser's
|
|
324
|
+
* default behavior (e.g. Home/End scrolling the page) — WCAG 2.1.1 Keyboard.
|
|
183
325
|
*
|
|
184
326
|
* Focus is moved without changing selection; Enter / Space on the newly
|
|
185
|
-
* focused tab (handled by `<nys-tab>.
|
|
327
|
+
* focused tab (handled by `<nys-tab>._onKeydown`) confirm selection.
|
|
186
328
|
*
|
|
187
329
|
* The currently focused tab is resolved via `composedPath()` because focus
|
|
188
330
|
* may sit on a shadow-DOM descendant of `<nys-tab>` rather than the host
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
/**
|
|
3
3
|
* `<nys-tabpanel>` is a content panel paired with a `<nys-tab>` inside a
|
|
4
4
|
* `<nys-tabgroup>`.
|
|
5
5
|
*
|
|
6
6
|
* Pairing is determined by render order: the Nth `<nys-tabpanel>` child of a
|
|
7
|
-
* `<nys-tabgroup>` corresponds to the Nth `<nys-tab>` child
|
|
8
|
-
* `aria-labelledby` and the `hidden` attribute are managed
|
|
9
|
-
* `<nys-tabgroup>` via `_applySelection`; do not set them
|
|
7
|
+
* `<nys-tabgroup>` corresponds to the Nth `<nys-tab>` child (or by explicit
|
|
8
|
+
* `aria-labelledby`). `aria-labelledby` and the `hidden` attribute are managed
|
|
9
|
+
* externally by `<nys-tabgroup>` via `_applySelection`; do not set them
|
|
10
|
+
* directly.
|
|
10
11
|
*
|
|
11
|
-
*
|
|
12
|
+
* The panel container is styled from the light DOM (`nys-tabpanel.light.scss`,
|
|
13
|
+
* adopted on the document) rather than a shadow-DOM wrapper. This keeps the
|
|
14
|
+
* slotted panel content in the light DOM — reachable by consumer CSS and
|
|
15
|
+
* JavaScript — and lets consumers override the panel's own styling (e.g.
|
|
16
|
+
* `nys-tabpanel { padding: 0 }`), which a shadow wrapper would prevent.
|
|
12
17
|
*
|
|
13
|
-
* @
|
|
14
|
-
* with the `.nys-tabpanel` class for styling.
|
|
18
|
+
* @element nys-tabpanel
|
|
15
19
|
*
|
|
16
|
-
* @
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* <nys-tabgroup name="Steps">
|
|
20
|
-
* <nys-tab label="Step 1"></nys-tab>
|
|
21
|
-
* <nys-tab label="Step 2"></nys-tab>
|
|
22
|
-
* <nys-tabpanel>
|
|
23
|
-
* <h2>Step 1: Enter your information</h2>
|
|
24
|
-
* <p>Fill out the form below.</p>
|
|
25
|
-
* </nys-tabpanel>
|
|
26
|
-
* <nys-tabpanel>
|
|
27
|
-
* <h2>Step 2: Review and submit</h2>
|
|
28
|
-
* <p>Confirm your details before submitting.</p>
|
|
29
|
-
* </nys-tabpanel>
|
|
30
|
-
* </nys-tabgroup>
|
|
31
|
-
* ```
|
|
20
|
+
* @slot - Default slot for panel content. Rendered directly under the host,
|
|
21
|
+
* which is the scrollable, focusable (`tabindex="0"`) `role="tabpanel"`
|
|
22
|
+
* region.
|
|
32
23
|
*/
|
|
33
|
-
export declare class NysTabpanel extends
|
|
24
|
+
export declare class NysTabpanel extends NysElement {
|
|
34
25
|
static styles: import("lit").CSSResult;
|
|
35
26
|
/**
|
|
36
27
|
* Unique identifier for the panel element.
|
|
@@ -1,17 +1,94 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-icon";
|
|
3
|
+
import "@nysds/nys-button";
|
|
2
4
|
/**
|
|
3
5
|
* `<nys-table>` is a responsive table component that can display native HTML tables,
|
|
4
6
|
* supports striped and bordered styling, sortable columns, and CSV download.
|
|
5
7
|
*
|
|
6
|
-
* @slot - Accepts a `<table>` element. Only the first table is
|
|
8
|
+
* @slot - Accepts a `<table>` element. Only the first table is used. The table
|
|
9
|
+
* is enhanced in place and stays in the light DOM (projected through a slot,
|
|
10
|
+
* never cloned), so embedded components remain interactive and reachable by
|
|
11
|
+
* consumer CSS/JS. Its cell styling is applied from `nys-table.light.scss`,
|
|
12
|
+
* adopted once onto `document.adoptedStyleSheets`.
|
|
7
13
|
*
|
|
8
14
|
* @fires nys-click - Fired when the download button or sortable headers are clicked.
|
|
9
15
|
* @fires nys-column-sort - Fired when a sortable column header is clicked. Can be prevented by calling `event.preventDefault()` to override default sort behavior.
|
|
10
16
|
* Detail: { columnIndex: number, columnLabel: string, sortDirection: "asc" | "desc" | "none" }
|
|
11
17
|
*
|
|
12
18
|
* @method downloadFile - Triggers download of the CSV file if `download` is set.
|
|
19
|
+
*
|
|
20
|
+
* @example Basic
|
|
21
|
+
* ```html
|
|
22
|
+
* <nys-table id="table1" name="table1">
|
|
23
|
+
* <table>
|
|
24
|
+
* <caption>New York State High Peaks and Popular Hikes</caption>
|
|
25
|
+
* <tr><th>Mountain</th><th>Peak Height (ft)</th><th>Hike Name</th></tr>
|
|
26
|
+
* <tr><td>Marcy</td><td>5,344</td><td>Van Hoevenberg Trail</td></tr>
|
|
27
|
+
* <tr><td>Algonquin</td><td>5,114</td><td>Northeast Trail</td></tr>
|
|
28
|
+
* <tr><td>Haystack</td><td>4,960</td><td>Johns Brook Trail</td></tr>
|
|
29
|
+
* <tr><td>Skylight</td><td>4,926</td><td>Lake Tear Trail</td></tr>
|
|
30
|
+
* <tr><td>Whiteface</td><td>4,867</td><td>Whiteface Mountain Trail</td></tr>
|
|
31
|
+
* </table>
|
|
32
|
+
* </nys-table>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Striped
|
|
36
|
+
* ```html
|
|
37
|
+
* <nys-table id="table2" name="table2" striped>
|
|
38
|
+
* <table>
|
|
39
|
+
* <caption>New York State High Peaks and Popular Hikes</caption>
|
|
40
|
+
* <tr><th>Mountain</th><th>Peak Height (ft)</th><th>Hike Name</th></tr>
|
|
41
|
+
* <tr><td>Marcy</td><td>5,344</td><td>Van Hoevenberg Trail</td></tr>
|
|
42
|
+
* <tr><td>Haystack</td><td>4,960</td><td>Johns Brook Trail</td></tr>
|
|
43
|
+
* <tr><td>Skylight</td><td>4,926</td><td>Lake Tear Trail</td></tr>
|
|
44
|
+
* <tr><td>Whiteface</td><td>4,867</td><td>Whiteface Mountain Trail</td></tr>
|
|
45
|
+
* </table>
|
|
46
|
+
* </nys-table>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example Bordered
|
|
50
|
+
* ```html
|
|
51
|
+
* <nys-table id="table3" name="table3" bordered>
|
|
52
|
+
* <table>
|
|
53
|
+
* <caption>New York State High Peaks and Popular Hikes</caption>
|
|
54
|
+
* <tr><th>Mountain</th><th>Peak Height (ft)</th><th>Hike Name</th></tr>
|
|
55
|
+
* <tr><td>Marcy</td><td>5,344</td><td>Van Hoevenberg Trail</td></tr>
|
|
56
|
+
* <tr><td>Haystack</td><td>4,960</td><td>Johns Brook Trail</td></tr>
|
|
57
|
+
* <tr><td>Skylight</td><td>4,926</td><td>Lake Tear Trail</td></tr>
|
|
58
|
+
* <tr><td>Whiteface</td><td>4,867</td><td>Whiteface Mountain Trail</td></tr>
|
|
59
|
+
* </table>
|
|
60
|
+
* </nys-table>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example Sortable
|
|
64
|
+
* ```html
|
|
65
|
+
* <nys-table id="table4" name="table4" sortable>
|
|
66
|
+
* <table>
|
|
67
|
+
* <caption>New York State High Peaks and Popular Hikes</caption>
|
|
68
|
+
* <tr><th>Mountain</th><th>Peak Height (ft)</th><th>Hike Name</th></tr>
|
|
69
|
+
* <tr><td>Marcy</td><td>5,344</td><td>Van Hoevenberg Trail</td></tr>
|
|
70
|
+
* <tr><td>Haystack</td><td>4,960</td><td>Johns Brook Trail</td></tr>
|
|
71
|
+
* <tr><td>Skylight</td><td>4,926</td><td>Lake Tear Trail</td></tr>
|
|
72
|
+
* <tr><td>Whiteface</td><td>4,867</td><td>Whiteface Mountain Trail</td></tr>
|
|
73
|
+
* </table>
|
|
74
|
+
* </nys-table>
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example Downloadable
|
|
78
|
+
* ```html
|
|
79
|
+
* <nys-table id="table5" name="table5" download="path/to/downloadable/version/of/table.filetype">
|
|
80
|
+
* <table>
|
|
81
|
+
* <caption>New York State High Peaks and Popular Hikes</caption>
|
|
82
|
+
* <tr><th>Mountain</th><th>Peak Height (ft)</th><th>Hike Name</th></tr>
|
|
83
|
+
* <tr><td>Marcy</td><td>5,344</td><td>Van Hoevenberg Trail</td></tr>
|
|
84
|
+
* <tr><td>Haystack</td><td>4,960</td><td>Johns Brook Trail</td></tr>
|
|
85
|
+
* <tr><td>Skylight</td><td>4,926</td><td>Lake Tear Trail</td></tr>
|
|
86
|
+
* <tr><td>Whiteface</td><td>4,867</td><td>Whiteface Mountain Trail</td></tr>
|
|
87
|
+
* </table>
|
|
88
|
+
* </nys-table>
|
|
89
|
+
* ```
|
|
13
90
|
*/
|
|
14
|
-
export declare class NysTable extends
|
|
91
|
+
export declare class NysTable extends NysElement {
|
|
15
92
|
static styles: import("lit").CSSResult;
|
|
16
93
|
id: string;
|
|
17
94
|
name: string;
|
|
@@ -23,6 +100,7 @@ export declare class NysTable extends LitElement {
|
|
|
23
100
|
private _sortDirection;
|
|
24
101
|
private _captionText;
|
|
25
102
|
private _observer;
|
|
103
|
+
private _enhancing;
|
|
26
104
|
/**************** Lifecycle Methods ****************/
|
|
27
105
|
constructor();
|
|
28
106
|
connectedCallback(): void;
|
|
@@ -30,9 +108,18 @@ export declare class NysTable extends LitElement {
|
|
|
30
108
|
disconnectedCallback(): void;
|
|
31
109
|
willUpdate(): void;
|
|
32
110
|
/******************** Functions ********************/
|
|
111
|
+
private _getSlottedTable;
|
|
112
|
+
private _observeTable;
|
|
113
|
+
private _withObserverPaused;
|
|
33
114
|
private _handleSlotChange;
|
|
34
115
|
private _setupMutationObserver;
|
|
35
116
|
private _normalizeTableDOM;
|
|
117
|
+
/**
|
|
118
|
+
* Adds scope="col" to every column-header cell in the table head. Header cells
|
|
119
|
+
* inside the body (row headers) are left untouched so authors can still mark
|
|
120
|
+
* them scope="row" themselves; we only set a scope where one is missing.
|
|
121
|
+
*/
|
|
122
|
+
private _applyHeaderScopes;
|
|
36
123
|
private _addSortIcons;
|
|
37
124
|
private _updateSortIcons;
|
|
38
125
|
private _onSortClick;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysFormControlElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-label";
|
|
3
|
+
import "@nysds/nys-errormessage";
|
|
2
4
|
/**
|
|
3
5
|
* A multi-line text input for collecting longer responses like comments, descriptions, or feedback.
|
|
4
6
|
* Form-associated with validation support via ElementInternals.
|
|
@@ -16,17 +18,64 @@ import { LitElement } from "lit";
|
|
|
16
18
|
* @fires nys-blur - Fired when textarea loses focus. Triggers validation.
|
|
17
19
|
* @fires nys-select - Fired when user selects text. Detail: `{id, value}`.
|
|
18
20
|
*
|
|
19
|
-
* @example Basic
|
|
21
|
+
* @example Basic
|
|
20
22
|
* ```html
|
|
21
|
-
* <nys-textarea label="Comments"
|
|
23
|
+
* <nys-textarea label="Comments"></nys-textarea>
|
|
22
24
|
* ```
|
|
23
25
|
*
|
|
24
|
-
* @example
|
|
26
|
+
* @example Disabled
|
|
25
27
|
* ```html
|
|
26
|
-
* <nys-textarea label="
|
|
28
|
+
* <nys-textarea label="Comments" disabled></nys-textarea>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Readonly
|
|
32
|
+
* ```html
|
|
33
|
+
* <nys-textarea label="Comments" readonly value="You can see me but not edit me"></nys-textarea>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Required
|
|
37
|
+
* ```html
|
|
38
|
+
* <nys-textarea label="Describe the incident" required></nys-textarea>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example Optional
|
|
42
|
+
* ```html
|
|
43
|
+
* <nys-textarea label="Comments" optional></nys-textarea>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Max length
|
|
47
|
+
* ```html
|
|
48
|
+
* <nys-textarea label="Comments" maxlength="100"></nys-textarea>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Width Small
|
|
52
|
+
* ```html
|
|
53
|
+
* <nys-textarea label="Comments" width="sm"></nys-textarea>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example Width Medium
|
|
57
|
+
* ```html
|
|
58
|
+
* <nys-textarea label="Comments" width="md"></nys-textarea>
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example Width Large
|
|
62
|
+
* ```html
|
|
63
|
+
* <nys-textarea label="Comments" width="lg"></nys-textarea>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @example Description
|
|
67
|
+
* ```html
|
|
68
|
+
* <nys-textarea label="Describe the incident" description="Please provide details"></nys-textarea>
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example Description Slot
|
|
72
|
+
* ```html
|
|
73
|
+
* <nys-textarea label="Describe the incident">
|
|
74
|
+
* <div slot="description">Please provide details</div>
|
|
75
|
+
* </nys-textarea>
|
|
27
76
|
* ```
|
|
28
77
|
*/
|
|
29
|
-
export declare class NysTextarea extends
|
|
78
|
+
export declare class NysTextarea extends NysFormControlElement {
|
|
30
79
|
static styles: import("lit").CSSResult;
|
|
31
80
|
static shadowRootOptions: {
|
|
32
81
|
delegatesFocus: boolean;
|
|
@@ -50,7 +99,7 @@ export declare class NysTextarea extends LitElement {
|
|
|
50
99
|
value: string;
|
|
51
100
|
/** Prevents interaction. */
|
|
52
101
|
disabled: boolean;
|
|
53
|
-
/** Makes textarea
|
|
102
|
+
/** Makes textarea readonly but focusable. */
|
|
54
103
|
readonly: boolean;
|
|
55
104
|
/** Marks as required. Shows "Required" flag and validates on blur. */
|
|
56
105
|
required: boolean;
|
|
@@ -83,14 +132,15 @@ export declare class NysTextarea extends LitElement {
|
|
|
83
132
|
showError: boolean;
|
|
84
133
|
/** Error message text. Shown only when `showError` is true. */
|
|
85
134
|
errorMessage: string;
|
|
135
|
+
/** Accessible label used only when no visible `label` is provided. */
|
|
136
|
+
ariaLabel: string;
|
|
86
137
|
private _hasUserInteracted;
|
|
87
|
-
private _internals;
|
|
88
138
|
/**
|
|
89
139
|
* Lifecycle methods
|
|
90
140
|
* --------------------------------------------------------------------------
|
|
141
|
+
* Form association, ElementInternals, and id generation are provided by
|
|
142
|
+
* NysFormControlElement (@nysds/internals).
|
|
91
143
|
*/
|
|
92
|
-
static formAssociated: boolean;
|
|
93
|
-
constructor();
|
|
94
144
|
connectedCallback(): void;
|
|
95
145
|
disconnectedCallback(): void;
|
|
96
146
|
firstUpdated(): void;
|