@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,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysFormControlElement } from "@nysds/internals";
|
|
2
|
+
import "@nysds/nys-label";
|
|
3
|
+
import "@nysds/nys-errormessage";
|
|
4
|
+
import "@nysds/nys-icon";
|
|
2
5
|
/**
|
|
3
6
|
* A dropdown for selecting a single option from a list. Supports native `<option>` and `<optgroup>` elements.
|
|
4
7
|
* Form-associated with validation via ElementInternals.
|
|
@@ -16,26 +19,157 @@ import { LitElement } from "lit";
|
|
|
16
19
|
* @fires nys-focus - Fired when select gains focus.
|
|
17
20
|
* @fires nys-blur - Fired when select loses focus. Triggers validation.
|
|
18
21
|
*
|
|
19
|
-
* @example Basic
|
|
22
|
+
* @example Basic
|
|
20
23
|
* ```html
|
|
21
|
-
*
|
|
22
|
-
* <option value="bronx"
|
|
23
|
-
* <option value="brooklyn"
|
|
24
|
-
* <option value="manhattan"
|
|
24
|
+
* <nys-select label="Select your favorite borough" id="borough">
|
|
25
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
26
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
27
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
28
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
29
|
+
* <option value="queens" label="Queens"></option>
|
|
25
30
|
* </nys-select>
|
|
26
31
|
* ```
|
|
27
32
|
*
|
|
28
|
-
* @example
|
|
33
|
+
* @example Default value
|
|
29
34
|
* ```html
|
|
30
|
-
* <nys-select label="Select
|
|
31
|
-
* <
|
|
32
|
-
*
|
|
33
|
-
*
|
|
35
|
+
* <nys-select label="Select your favorite borough" id="borough">
|
|
36
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
37
|
+
* <option value="brooklyn" label="Brooklyn" selected></option>
|
|
38
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
39
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
40
|
+
* <option value="queens" label="Queens"></option>
|
|
41
|
+
* </nys-select>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Option Group
|
|
45
|
+
* ```html
|
|
46
|
+
* <nys-select
|
|
47
|
+
* label="Which New York State service are you contacting us about?"
|
|
48
|
+
* description="This is for demo purposes and the list might not be exhaustive."
|
|
49
|
+
* >
|
|
50
|
+
* <optgroup label="Transportation Services">
|
|
51
|
+
* <option value="mta">MTA / Public Transit</option>
|
|
52
|
+
* <option value="dmv">Department of Motor Vehicles (DMV)</option>
|
|
53
|
+
* <option value="highway">Highway Maintenance</option>
|
|
54
|
+
* </optgroup>
|
|
55
|
+
* <optgroup label="Health & Human Services">
|
|
56
|
+
* <option value="medicaid">Medicaid / Health Insurance</option>
|
|
57
|
+
* <option value="mental-health">Mental Health Support</option>
|
|
58
|
+
* <option value="child-family">Child and Family Services</option>
|
|
34
59
|
* </optgroup>
|
|
60
|
+
* <optgroup label="Public Safety">
|
|
61
|
+
* <option value="state-police">State Police</option>
|
|
62
|
+
* <option value="emergency-management">Emergency Management</option>
|
|
63
|
+
* <option value="fire-safety">Fire Safety</option>
|
|
64
|
+
* </optgroup>
|
|
65
|
+
* <optgroup label="Environment & Energy">
|
|
66
|
+
* <option value="environmental-conservation">
|
|
67
|
+
* Environmental Conservation
|
|
68
|
+
* </option>
|
|
69
|
+
* <option value="clean-energy">Clean Energy Programs</option>
|
|
70
|
+
* <option value="waste-management">Waste Management</option>
|
|
71
|
+
* </optgroup>
|
|
72
|
+
* </nys-select>
|
|
73
|
+
* ```
|
|
74
|
+
* @example Disabled
|
|
75
|
+
* ```html
|
|
76
|
+
* <nys-select label="Select your favorite borough" id="borough" disabled>
|
|
77
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
78
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
79
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
80
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
81
|
+
* <option value="queens" label="Queens"></option>
|
|
82
|
+
* </nys-select>
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example Disabled Option
|
|
86
|
+
* ```html
|
|
87
|
+
* <nys-select label="Select your favorite borough" id="borough">
|
|
88
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
89
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
90
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
91
|
+
* <option value="staten_island" label="Staten Island" disabled></option>
|
|
92
|
+
* <option value="queens" label="Queens" disabled></option>
|
|
93
|
+
* </nys-select>
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example Required
|
|
97
|
+
* ```html
|
|
98
|
+
* <nys-select label="Select your favorite borough" id="borough" required>
|
|
99
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
100
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
101
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
102
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
103
|
+
* <option value="queens" label="Queens"></option>
|
|
104
|
+
* </nys-select>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example Optional
|
|
108
|
+
* ```html
|
|
109
|
+
* <nys-select label="Select your favorite borough" id="borough" optional>
|
|
110
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
111
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
112
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
113
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
114
|
+
* <option value="queens" label="Queens"></option>
|
|
115
|
+
* </nys-select>
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @example Width small
|
|
119
|
+
* ```html
|
|
120
|
+
* <nys-select label="Select your favorite borough" id="borough" width="sm">
|
|
121
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
122
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
123
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
124
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
125
|
+
* <option value="queens" label="Queens"></option>
|
|
126
|
+
* </nys-select>
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @example Width medium
|
|
130
|
+
* ```html
|
|
131
|
+
* <nys-select label="Select your favorite borough" id="borough" width="md">
|
|
132
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
133
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
134
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
135
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
136
|
+
* <option value="queens" label="Queens"></option>
|
|
35
137
|
* </nys-select>
|
|
36
138
|
* ```
|
|
139
|
+
*
|
|
140
|
+
* @example Width large
|
|
141
|
+
* ```html
|
|
142
|
+
* <nys-select label="Select your favorite borough" id="borough" width="lg">
|
|
143
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
144
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
145
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
146
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
147
|
+
* <option value="queens" label="Queens"></option>
|
|
148
|
+
* </nys-select>
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @example Slotted Description
|
|
152
|
+
* ```html
|
|
153
|
+
* <nys-select label="Select your favorite borough" id="borough">
|
|
154
|
+
* <label slot="description">This is a slotted description</label>
|
|
155
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
156
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
157
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
158
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
159
|
+
* <option value="queens" label="Queens"></option>
|
|
160
|
+
* </nys-select>
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @example Error Message
|
|
164
|
+
* <nys-select label="Select your favorite borough" id="borough" errorMessage="You did not select a borough" showError>
|
|
165
|
+
* <option value="bronx" label="The Bronx"></option>
|
|
166
|
+
* <option value="brooklyn" label="Brooklyn"></option>
|
|
167
|
+
* <option value="manhattan" label="Manhattan"></option>
|
|
168
|
+
* <option value="staten_island" label="Staten Island"></option>
|
|
169
|
+
* <option value="queens" label="Queens"></option>
|
|
170
|
+
* </nys-select>
|
|
37
171
|
*/
|
|
38
|
-
export declare class NysSelect extends
|
|
172
|
+
export declare class NysSelect extends NysFormControlElement {
|
|
39
173
|
static styles: import("lit").CSSResult;
|
|
40
174
|
static shadowRootOptions: {
|
|
41
175
|
delegatesFocus: boolean;
|
|
@@ -53,6 +187,8 @@ export declare class NysSelect extends LitElement {
|
|
|
53
187
|
label: string;
|
|
54
188
|
/** Helper text below label. Use slot for custom HTML. */
|
|
55
189
|
description: string;
|
|
190
|
+
/** Accessible label. Used as a fallback when `label` is not provided. */
|
|
191
|
+
ariaLabel: string;
|
|
56
192
|
/** Currently selected option value. */
|
|
57
193
|
value: string;
|
|
58
194
|
/** Prevents interaction. */
|
|
@@ -78,13 +214,12 @@ export declare class NysSelect extends LitElement {
|
|
|
78
214
|
width: "sm" | "md" | "lg" | "full";
|
|
79
215
|
private _originalErrorMessage;
|
|
80
216
|
private _hasUserInteracted;
|
|
81
|
-
private _internals;
|
|
82
217
|
/**
|
|
83
218
|
* Lifecycle methods
|
|
84
219
|
* --------------------------------------------------------------------------
|
|
220
|
+
* Form association, ElementInternals, and id generation are provided by
|
|
221
|
+
* NysFormControlElement (@nysds/internals).
|
|
85
222
|
*/
|
|
86
|
-
static formAssociated: boolean;
|
|
87
|
-
constructor();
|
|
88
223
|
connectedCallback(): void;
|
|
89
224
|
disconnectedCallback(): void;
|
|
90
225
|
firstUpdated(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
/**
|
|
3
3
|
* An accessible "Skip to main content" link for keyboard and screen reader users. Visually hidden until focused.
|
|
4
4
|
*
|
|
@@ -8,18 +8,18 @@ import { LitElement } from "lit";
|
|
|
8
8
|
* @summary Skip navigation link for keyboard accessibility. Hidden until focused.
|
|
9
9
|
* @element nys-skipnav
|
|
10
10
|
*
|
|
11
|
-
* @example
|
|
11
|
+
* @example Basic
|
|
12
12
|
* ```html
|
|
13
13
|
* <nys-skipnav></nys-skipnav>
|
|
14
|
-
* <main id="main-content">...</main>
|
|
15
14
|
* ```
|
|
16
15
|
*
|
|
17
16
|
* @example Custom target
|
|
18
17
|
* ```html
|
|
19
18
|
* <nys-skipnav href="#content-area"></nys-skipnav>
|
|
19
|
+
* <p id="content-area">...</p>
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export declare class NysSkipnav extends
|
|
22
|
+
export declare class NysSkipnav extends NysElement {
|
|
23
23
|
static styles: import("lit").CSSResult;
|
|
24
24
|
/** Unique identifier. Auto-generated if not provided. */
|
|
25
25
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
/**
|
|
3
3
|
* A single step within `nys-stepper`. Represents one stage in a multi-step process.
|
|
4
4
|
*
|
|
@@ -43,10 +43,18 @@ import { LitElement } from "lit";
|
|
|
43
43
|
* as the `onClick` prop on `NysStep`.
|
|
44
44
|
*
|
|
45
45
|
* ## Accessibility
|
|
46
|
-
* - The
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* - `
|
|
46
|
+
* - The host carries `role="listitem"` so the parent stepper's `<ol>` and its slotted
|
|
47
|
+
* `<nys-step>` children form a real list — assistive technology announces each step's
|
|
48
|
+
* position and count (e.g. "2 of 4") automatically.
|
|
49
|
+
* - Navigable steps (`current`, `previous`, `selected`) render a real `<button>` for their
|
|
50
|
+
* row, giving native keyboard activation (Enter/Space), focus handling, and semantics for
|
|
51
|
+
* free — no manual `tabindex`/`keydown` scaffolding required.
|
|
52
|
+
* - Future (non-navigable) steps render the row as a plain, non-interactive `<div>` — not a
|
|
53
|
+
* disabled button. They are not focusable and carry no `role`, `tabindex`, or `aria-disabled`.
|
|
54
|
+
* - `aria-label` announces the step name and 1-indexed position, e.g. `"Personal Info, step 1"`.
|
|
55
|
+
* - The `current` step (progress boundary) is marked with `aria-current="step"` on the
|
|
56
|
+
* `<button>` itself so assistive technology announces the user's current position.
|
|
57
|
+
* - The visual step number is `aria-hidden` (its meaning is folded into the row's accessible name).
|
|
50
58
|
*
|
|
51
59
|
* ## Common patterns
|
|
52
60
|
*
|
|
@@ -74,21 +82,8 @@ import { LitElement } from "lit";
|
|
|
74
82
|
* @fires nys-step-click - Fired when a navigable (`previous` or `current`) non-selected step is clicked
|
|
75
83
|
* or activated by keyboard. Detail: `{ href: string, label: string }`. Cancelable — call
|
|
76
84
|
* `e.preventDefault()` to suppress `window.location.href` navigation.
|
|
77
|
-
*
|
|
78
|
-
* @example Step with page navigation
|
|
79
|
-
* ```html
|
|
80
|
-
* <nys-step label="Personal Info" href="/step-1"></nys-step>
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @example Step with SPA navigation (no href)
|
|
84
|
-
* ```js
|
|
85
|
-
* step.addEventListener('nys-step-click', (e) => {
|
|
86
|
-
* e.preventDefault(); // no href set, but good practice
|
|
87
|
-
* showStepContent(e.detail.label);
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
85
|
*/
|
|
91
|
-
export declare class NysStep extends
|
|
86
|
+
export declare class NysStep extends NysElement {
|
|
92
87
|
static styles: import("lit").CSSResult;
|
|
93
88
|
/**
|
|
94
89
|
* Which step is currently being displayed. If not set, defaults to the `current` step.
|
|
@@ -118,7 +113,18 @@ export declare class NysStep extends LitElement {
|
|
|
118
113
|
onClick?: (e: Event) => void;
|
|
119
114
|
/** @internal 1-indexed position. Auto-assigned by the parent stepper on first render. Do not set manually. */
|
|
120
115
|
stepNumber: number;
|
|
116
|
+
/** A step is navigable (focusable + activatable) when it is the displayed,
|
|
117
|
+
* current, or a previously-reached step. Future steps are inert. */
|
|
118
|
+
private get _navigable();
|
|
119
|
+
/**
|
|
120
|
+
* Sets `role="listitem"` on the host so the parent stepper's `<ol>` (which
|
|
121
|
+
* only ever slots `<nys-step>` elements, never real `<li>`s) still forms a
|
|
122
|
+
* valid ARIA list. This is what lets assistive technology announce each
|
|
123
|
+
* step's position and count. Uses a plain attribute (not ElementInternals)
|
|
124
|
+
* so `getAttribute("role")` keeps working for existing consumers/tests,
|
|
125
|
+
* matching the convention used by `<nys-tab>`.
|
|
126
|
+
*/
|
|
127
|
+
connectedCallback(): void;
|
|
121
128
|
private _handleActivate;
|
|
122
|
-
private _handleKeydown;
|
|
123
129
|
render(): import("lit-html").TemplateResult<1>;
|
|
124
130
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
import "./nys-step";
|
|
3
3
|
/**
|
|
4
4
|
* A multi-step progress indicator for forms or wizards. Manages `nys-step` children with selection and navigation.
|
|
@@ -33,13 +33,17 @@ import "./nys-step";
|
|
|
33
33
|
*
|
|
34
34
|
* ## id auto-generation
|
|
35
35
|
* If no `id` is provided, a unique id is generated automatically in the form
|
|
36
|
-
* `nys-stepper-{
|
|
36
|
+
* `nys-stepper-{timestamp}-{n}`.
|
|
37
37
|
*
|
|
38
38
|
* ## Accessibility
|
|
39
39
|
* - The compact counter is rendered as a `role="button"` with `aria-expanded` and a descriptive
|
|
40
40
|
* `aria-label` that announces the current step (e.g., "Expand step navigation. You are on Step 2 of 4").
|
|
41
41
|
* - Keyboard: Enter or Space toggles the compact view.
|
|
42
|
-
* -
|
|
42
|
+
* - Steps are rendered inside an `<ol>` so assistive technology announces each step's position
|
|
43
|
+
* and count (e.g. "2 of 4"). Each slotted `<nys-step>` carries `role="listitem"` since it
|
|
44
|
+
* can't itself be a real `<li>`.
|
|
45
|
+
* - Navigable steps render as real `<button>` elements — keyboard-focusable and activatable
|
|
46
|
+
* (Enter/Space) natively. Future (non-navigable) steps render as plain, non-interactive rows.
|
|
43
47
|
* - Visual focus indicators are provided on all interactive elements.
|
|
44
48
|
*
|
|
45
49
|
* @summary Multi-step progress indicator with navigation and mobile-friendly compact view.
|
|
@@ -48,92 +52,142 @@ import "./nys-step";
|
|
|
48
52
|
* @slot - Default slot for `nys-step` elements. Only `nys-step` children are accepted; others are removed.
|
|
49
53
|
* @slot actions - Persistent navigation buttons. Must contain exactly one `<div>` wrapping only `<nys-button>` elements.
|
|
50
54
|
*
|
|
51
|
-
* @example Basic
|
|
55
|
+
* @example Basic
|
|
52
56
|
* ```html
|
|
53
|
-
* <
|
|
54
|
-
* <nys-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
57
|
+
* <div class="nys-grid-row">
|
|
58
|
+
* <nys-stepper
|
|
59
|
+
* id="stepper"
|
|
60
|
+
* name="stepper"
|
|
61
|
+
* label="Register for Design System Office Hours"
|
|
62
|
+
* class="nys-desktop:nys-grid-col-3"
|
|
63
|
+
* >
|
|
64
|
+
* <nys-step label="Personal Details" href="/nys-stepper/personal.html"></nys-step>
|
|
65
|
+
* <nys-step label="Team Info" selected href="/nys-stepper/team.html"></nys-step>
|
|
66
|
+
* <nys-step label="Usage Survey" current href="/nys-stepper/survey.html"></nys-step>
|
|
67
|
+
* <nys-step label="Newsletter Opt-In" href="/nys-stepper/newsletter.html"></nys-step>
|
|
68
|
+
* <div slot="actions">
|
|
69
|
+
* <nys-button variant="outline" label="Save & Exit" fullWidth></nys-button>
|
|
70
|
+
* </div>
|
|
71
|
+
* </nys-stepper>
|
|
72
|
+
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
73
|
+
* Loading...
|
|
74
|
+
* </div>
|
|
75
|
+
* </div>
|
|
58
76
|
* ```
|
|
59
|
-
*
|
|
60
|
-
* @example Grid layout with sidebar placement
|
|
61
|
-
* Use NYSDS grid utilities to position the stepper as a sidebar alongside form content.
|
|
62
|
-
* **Layout requirements:**
|
|
63
|
-
* - Wrap in `nys-grid-container` > `nys-grid-row`
|
|
64
|
-
* - Use mobile-first classes: `nys-grid-col-12` (stacks on mobile) plus `nys-desktop:nys-grid-col-*`
|
|
65
|
-
* - Columns must total 12 (e.g., 3+9 or 4+8)
|
|
66
|
-
* - Recommended: stepper 3-4 cols, content 8-9 cols
|
|
77
|
+
* @render Basic
|
|
67
78
|
* ```html
|
|
68
|
-
* <div class="nys-grid-
|
|
69
|
-
* <
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* <
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
79
|
+
* <div class="nys-grid-row">
|
|
80
|
+
* <nys-stepper
|
|
81
|
+
* id="stepper"
|
|
82
|
+
* name="stepper"
|
|
83
|
+
* label="Register for Design System Office Hours"
|
|
84
|
+
* class="nys-desktop:nys-grid-col-3"
|
|
85
|
+
* >
|
|
86
|
+
* <nys-step label="Personal Details" href="/nys-stepper/personal.html"></nys-step>
|
|
87
|
+
* <nys-step label="Team Info" selected href="/nys-stepper/team.html"></nys-step>
|
|
88
|
+
* <nys-step label="Usage Survey" current href="/nys-stepper/survey.html"></nys-step>
|
|
89
|
+
* <nys-step label="Newsletter Opt-In" href="/nys-stepper/newsletter.html"></nys-step>
|
|
90
|
+
* </nys-stepper>
|
|
91
|
+
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
92
|
+
* Loading...
|
|
80
93
|
* </div>
|
|
81
94
|
* </div>
|
|
95
|
+
* <script>
|
|
96
|
+
* document.addEventListener("DOMContentLoaded", async () => {
|
|
97
|
+
* const stepper = document.querySelector("nys-stepper");
|
|
98
|
+
* if (stepper?.updateComplete) await stepper.updateComplete;
|
|
99
|
+
* const selectedStep = document.querySelector("nys-step[selected]");
|
|
100
|
+
* const href = selectedStep?.getAttribute("href");
|
|
101
|
+
* if (!href) return;
|
|
102
|
+
* const res = await fetch(href);
|
|
103
|
+
* if (!res.ok) return;
|
|
104
|
+
* const container = document.querySelector("#nys-stepper-content");
|
|
105
|
+
* if (container) container.innerHTML = await res.text();
|
|
106
|
+
* });
|
|
107
|
+
*
|
|
108
|
+
* document.addEventListener("nys-step-click", async (e) => {
|
|
109
|
+
* const href = e.detail?.href;
|
|
110
|
+
* if (!href) return;
|
|
111
|
+
* e.preventDefault();
|
|
112
|
+
* const res = await fetch(href);
|
|
113
|
+
* if (!res.ok) return;
|
|
114
|
+
* const container = document.querySelector("#nys-stepper-content");
|
|
115
|
+
* if (container) container.innerHTML = await res.text();
|
|
116
|
+
* });
|
|
117
|
+
* </script>
|
|
82
118
|
* ```
|
|
83
119
|
*
|
|
84
|
-
* @example
|
|
85
|
-
* Add Previous/Next buttons using the actions slot. Wrap buttons in a `<div>`.
|
|
120
|
+
* @example Actions slot
|
|
86
121
|
* ```html
|
|
87
|
-
* <
|
|
88
|
-
* <nys-
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
122
|
+
* <div class="nys-grid-row">
|
|
123
|
+
* <nys-stepper
|
|
124
|
+
* id="stepper"
|
|
125
|
+
* name="stepper"
|
|
126
|
+
* label="Register for Design System Office Hours"
|
|
127
|
+
* class="nys-desktop:nys-grid-col-3"
|
|
128
|
+
* >
|
|
129
|
+
* <nys-step label="Personal Details" href="/nys-stepper/personal.html"></nys-step>
|
|
130
|
+
* <nys-step label="Team Info" selected href="/nys-stepper/team.html"></nys-step>
|
|
131
|
+
* <nys-step label="Usage Survey" current href="/nys-stepper/survey.html"></nys-step>
|
|
132
|
+
* <nys-step label="Newsletter Opt-In" href="/nys-stepper/newsletter.html"></nys-step>
|
|
133
|
+
* <div slot="actions">
|
|
134
|
+
* <nys-button variant="outline" label="Save & Exit" fullWidth></nys-button>
|
|
135
|
+
* </div>
|
|
136
|
+
* </nys-stepper>
|
|
137
|
+
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
138
|
+
* Loading...
|
|
93
139
|
* </div>
|
|
94
|
-
* </
|
|
140
|
+
* </div>
|
|
95
141
|
* ```
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
142
|
+
* @render Actions slot
|
|
143
|
+
* ```html
|
|
144
|
+
* <div class="nys-grid-row">
|
|
145
|
+
* <nys-stepper
|
|
146
|
+
* id="stepper"
|
|
147
|
+
* name="stepper"
|
|
148
|
+
* label="Register for Design System Office Hours"
|
|
149
|
+
* class="nys-desktop:nys-grid-col-3"
|
|
150
|
+
* >
|
|
151
|
+
* <nys-step label="Personal Details" href="/nys-stepper/personal.html"></nys-step>
|
|
152
|
+
* <nys-step label="Team Info" selected href="/nys-stepper/team.html"></nys-step>
|
|
153
|
+
* <nys-step label="Usage Survey" current href="/nys-stepper/survey.html"></nys-step>
|
|
154
|
+
* <nys-step label="Newsletter Opt-In" href="/nys-stepper/newsletter.html"></nys-step>
|
|
155
|
+
* <div slot="actions">
|
|
156
|
+
* <nys-button variant="outline" label="Save & Exit" fullWidth></nys-button>
|
|
157
|
+
* </div>
|
|
158
|
+
* </nys-stepper>
|
|
159
|
+
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
160
|
+
* Loading...
|
|
161
|
+
* </div>
|
|
162
|
+
* </div>
|
|
163
|
+
* <script>
|
|
164
|
+
* document.addEventListener("DOMContentLoaded", async () => {
|
|
165
|
+
* const stepper = document.querySelector("nys-stepper");
|
|
166
|
+
* if (stepper?.updateComplete) await stepper.updateComplete;
|
|
167
|
+
* const selectedStep = document.querySelector("nys-step[selected]");
|
|
168
|
+
* const href = selectedStep?.getAttribute("href");
|
|
169
|
+
* if (!href) return;
|
|
170
|
+
* const res = await fetch(href);
|
|
171
|
+
* if (!res.ok) return;
|
|
172
|
+
* const container = document.querySelector("#nys-stepper-content");
|
|
173
|
+
* if (container) container.innerHTML = await res.text();
|
|
113
174
|
* });
|
|
114
|
-
* }
|
|
115
|
-
*
|
|
116
|
-
* document.querySelector('nys-stepper').addEventListener('nys-step-click', (e) => {
|
|
117
|
-
* e.preventDefault();
|
|
118
|
-
* const steps = Array.from(document.querySelectorAll('nys-step'));
|
|
119
|
-
* const clicked = e.composedPath().find(el => el.tagName?.toLowerCase() === 'nys-step');
|
|
120
|
-
* const index = steps.indexOf(clicked);
|
|
121
|
-
* if (index !== -1) { viewingStep = index; updateStepper(steps); }
|
|
122
|
-
* });
|
|
123
175
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
176
|
+
* document.addEventListener("nys-step-click", async (e) => {
|
|
177
|
+
* const href = e.detail?.href;
|
|
178
|
+
* if (!href) return;
|
|
179
|
+
* e.preventDefault();
|
|
180
|
+
* const res = await fetch(href);
|
|
181
|
+
* if (!res.ok) return;
|
|
182
|
+
* const container = document.querySelector("#nys-stepper-content");
|
|
183
|
+
* if (container) container.innerHTML = await res.text();
|
|
184
|
+
* });
|
|
185
|
+
* </script>
|
|
132
186
|
* ```
|
|
133
187
|
*/
|
|
134
|
-
export declare class NysStepper extends
|
|
188
|
+
export declare class NysStepper extends NysElement {
|
|
135
189
|
static styles: import("lit").CSSResult;
|
|
136
|
-
/** Unique identifier. Auto-generated as `nys-stepper-{
|
|
190
|
+
/** Unique identifier. Auto-generated as `nys-stepper-{timestamp}-{n}` if not provided. */
|
|
137
191
|
id: string;
|
|
138
192
|
/** Name attribute for form association. */
|
|
139
193
|
name: string;
|
|
@@ -144,7 +198,6 @@ export declare class NysStepper extends LitElement {
|
|
|
144
198
|
/** Whether compact mobile view is expanded to show all steps. Toggled by clicking the counter. */
|
|
145
199
|
isCompactExpanded: boolean;
|
|
146
200
|
private _stepsNumbered;
|
|
147
|
-
constructor();
|
|
148
201
|
connectedCallback(): void;
|
|
149
202
|
disconnectedCallback(): void;
|
|
150
203
|
private _validateSteps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NysElement } from "@nysds/internals";
|
|
2
2
|
/**
|
|
3
3
|
* `<nys-tab>` is a single tab within a `<nys-tabgroup>`.
|
|
4
4
|
*
|
|
@@ -20,20 +20,29 @@ import { LitElement } from "lit";
|
|
|
20
20
|
*
|
|
21
21
|
* @slot - No slots; content is derived from the `label` property.
|
|
22
22
|
*
|
|
23
|
-
* @example
|
|
23
|
+
* @example Disabled
|
|
24
24
|
* ```html
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* <nys-tab label="
|
|
25
|
+
* <nys-tabgroup name="Account Settings">
|
|
26
|
+
* <nys-tab label="Profile"></nys-tab>
|
|
27
|
+
* <nys-tab label="Security"></nys-tab>
|
|
28
|
+
* <nys-tab label="Notifications" disabled></nys-tab>
|
|
29
|
+
* <nys-tabpanel><p>Manage your profile information.</p></nys-tabpanel>
|
|
30
|
+
* <nys-tabpanel><p>Update your password and 2FA settings.</p></nys-tabpanel>
|
|
31
|
+
* <nys-tabpanel><p>Notification preferences (coming soon).</p></nys-tabpanel>
|
|
32
|
+
* </nys-tabgroup>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Preselected
|
|
36
|
+
* ```html
|
|
37
|
+
* <nys-tabgroup name="Reports">
|
|
38
|
+
* <nys-tab label="Summary"></nys-tab>
|
|
28
39
|
* <nys-tab label="Details" selected></nys-tab>
|
|
29
|
-
* <nys-
|
|
30
|
-
* <nys-tabpanel><p>
|
|
31
|
-
* <nys-tabpanel><p>Details content (shown by default)</p></nys-tabpanel>
|
|
32
|
-
* <nys-tabpanel><p>Archived content</p></nys-tabpanel>
|
|
40
|
+
* <nys-tabpanel><p>Summary view</p></nys-tabpanel>
|
|
41
|
+
* <nys-tabpanel><p>Detailed view (shown by default)</p></nys-tabpanel>
|
|
33
42
|
* </nys-tabgroup>
|
|
34
43
|
* ```
|
|
35
44
|
*/
|
|
36
|
-
export declare class NysTab extends
|
|
45
|
+
export declare class NysTab extends NysElement {
|
|
37
46
|
static styles: import("lit").CSSResult;
|
|
38
47
|
/**
|
|
39
48
|
* Unique identifier for the tab element.
|