@nysds/components 1.19.3 → 1.20.0-alpha-3
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 +180 -1055
- package/dist/.vscode/vscode.html-custom-data.json +7 -7
- package/dist/custom-elements.json +180 -1055
- package/dist/nysds.es.js +724 -731
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +136 -730
- package/dist/nysds.js.map +1 -1
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +6 -35
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +3 -8
- package/dist/packages/nys-alert/src/nys-alert.d.ts +4 -81
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +4 -44
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +3 -70
- package/dist/packages/nys-badge/src/nys-badge.d.ts +4 -54
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +7 -75
- package/dist/packages/nys-button/src/nys-button.d.ts +7 -60
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +7 -4
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +1 -75
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +0 -164
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +8 -64
- package/dist/packages/nys-divider/src/nys-divider.d.ts +1 -24
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +12 -19
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +10 -0
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +0 -10
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +4 -66
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +7 -50
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +3 -57
- package/dist/packages/nys-icon/src/icon-cache.d.ts +4 -11
- package/dist/packages/nys-icon/src/icon-library-registry.d.ts +16 -33
- package/dist/packages/nys-icon/src/index.d.ts +2 -2
- package/dist/packages/nys-icon/src/nys-icon.d.ts +6 -83
- package/dist/packages/nys-label/src/nys-label.d.ts +2 -32
- package/dist/packages/nys-modal/src/nys-modal.d.ts +5 -130
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +1 -11
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +3 -4
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +1 -74
- package/dist/packages/nys-select/src/nys-option.d.ts +8 -0
- package/dist/packages/nys-select/src/nys-select.d.ts +10 -141
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +2 -2
- package/dist/packages/nys-stepper/src/nys-step.d.ts +13 -0
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +69 -119
- package/dist/packages/nys-tab/src/nys-tab.d.ts +8 -17
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +15 -77
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +17 -0
- package/dist/packages/nys-table/src/nys-table.d.ts +0 -71
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +5 -52
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +9 -63
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +4 -40
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +6 -38
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +2 -10
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +9 -51
- package/dist/packages/nys-video/src/nys-video.d.ts +3 -65
- package/package.json +4 -7
- package/packages/react/NysBreadcrumbs.d.ts +1 -1
- package/packages/react/NysButton.d.ts +1 -2
- package/packages/react/NysDropdownMenu.d.ts +1 -1
- package/packages/react/NysLabel.d.ts +1 -4
- package/packages/react/NysTextarea.d.ts +1 -1
- package/packages/react/NysUnavHeader.d.ts +1 -11
- package/packages/react/NysUnavHeader.js +1 -15
- package/packages/react/nysds-jsx.d.ts +7 -20
- package/dist/nys-icon.library-ChLRj3i-.js +0 -696
- package/dist/nys-icon.library-ChLRj3i-.js.map +0 -1
|
@@ -16,155 +16,24 @@ import { LitElement } from "lit";
|
|
|
16
16
|
* @fires nys-focus - Fired when select gains focus.
|
|
17
17
|
* @fires nys-blur - Fired when select loses focus. Triggers validation.
|
|
18
18
|
*
|
|
19
|
-
* @example Basic
|
|
19
|
+
* @example Basic select
|
|
20
20
|
* ```html
|
|
21
|
-
*
|
|
22
|
-
* <option value="bronx"
|
|
23
|
-
* <option value="brooklyn"
|
|
24
|
-
* <option value="manhattan"
|
|
25
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
26
|
-
* <option value="queens" label="Queens"></option>
|
|
21
|
+
* <nys-select label="Select borough">
|
|
22
|
+
* <option value="bronx">The Bronx</option>
|
|
23
|
+
* <option value="brooklyn">Brooklyn</option>
|
|
24
|
+
* <option value="manhattan">Manhattan</option>
|
|
27
25
|
* </nys-select>
|
|
28
26
|
* ```
|
|
29
27
|
*
|
|
30
|
-
* @example
|
|
28
|
+
* @example With option groups
|
|
31
29
|
* ```html
|
|
32
|
-
* <nys-select label="Select
|
|
33
|
-
* <
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
37
|
-
* <option value="queens" label="Queens"></option>
|
|
38
|
-
* </nys-select>
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example Option Group
|
|
42
|
-
* ```html
|
|
43
|
-
* <nys-select
|
|
44
|
-
* label="Which New York State service are you contacting us about?"
|
|
45
|
-
* description="This is for demo purposes and the list might not be exhaustive."
|
|
46
|
-
* >
|
|
47
|
-
* <optgroup label="Transportation Services">
|
|
48
|
-
* <option value="mta">MTA / Public Transit</option>
|
|
49
|
-
* <option value="dmv">Department of Motor Vehicles (DMV)</option>
|
|
50
|
-
* <option value="highway">Highway Maintenance</option>
|
|
51
|
-
* </optgroup>
|
|
52
|
-
* <optgroup label="Health & Human Services">
|
|
53
|
-
* <option value="medicaid">Medicaid / Health Insurance</option>
|
|
54
|
-
* <option value="mental-health">Mental Health Support</option>
|
|
55
|
-
* <option value="child-family">Child and Family Services</option>
|
|
30
|
+
* <nys-select label="Select service">
|
|
31
|
+
* <optgroup label="Transportation">
|
|
32
|
+
* <option value="mta">MTA</option>
|
|
33
|
+
* <option value="dmv">DMV</option>
|
|
56
34
|
* </optgroup>
|
|
57
|
-
* <optgroup label="Public Safety">
|
|
58
|
-
* <option value="state-police">State Police</option>
|
|
59
|
-
* <option value="emergency-management">Emergency Management</option>
|
|
60
|
-
* <option value="fire-safety">Fire Safety</option>
|
|
61
|
-
* </optgroup>
|
|
62
|
-
* <optgroup label="Environment & Energy">
|
|
63
|
-
* <option value="environmental-conservation">
|
|
64
|
-
* Environmental Conservation
|
|
65
|
-
* </option>
|
|
66
|
-
* <option value="clean-energy">Clean Energy Programs</option>
|
|
67
|
-
* <option value="waste-management">Waste Management</option>
|
|
68
|
-
* </optgroup>
|
|
69
|
-
* </nys-select>
|
|
70
|
-
* ```
|
|
71
|
-
* @example Disabled
|
|
72
|
-
* ```html
|
|
73
|
-
* <nys-select label="Select your favorite borough" id="borough" disabled>
|
|
74
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
75
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
76
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
77
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
78
|
-
* <option value="queens" label="Queens"></option>
|
|
79
|
-
* </nys-select>
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @example Disabled Option
|
|
83
|
-
* ```html
|
|
84
|
-
* <nys-select label="Select your favorite borough" id="borough">
|
|
85
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
86
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
87
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
88
|
-
* <option value="staten_island" label="Staten Island" disabled></option>
|
|
89
|
-
* <option value="queens" label="Queens" disabled></option>
|
|
90
|
-
* </nys-select>
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* @example Required
|
|
94
|
-
* ```html
|
|
95
|
-
* <nys-select label="Select your favorite borough" id="borough" required>
|
|
96
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
97
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
98
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
99
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
100
|
-
* <option value="queens" label="Queens"></option>
|
|
101
|
-
* </nys-select>
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @example Optional
|
|
105
|
-
* ```html
|
|
106
|
-
* <nys-select label="Select your favorite borough" id="borough" optional>
|
|
107
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
108
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
109
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
110
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
111
|
-
* <option value="queens" label="Queens"></option>
|
|
112
|
-
* </nys-select>
|
|
113
|
-
* ```
|
|
114
|
-
*
|
|
115
|
-
* @example Width small
|
|
116
|
-
* ```html
|
|
117
|
-
* <nys-select label="Select your favorite borough" id="borough" width="sm">
|
|
118
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
119
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
120
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
121
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
122
|
-
* <option value="queens" label="Queens"></option>
|
|
123
|
-
* </nys-select>
|
|
124
|
-
* ```
|
|
125
|
-
*
|
|
126
|
-
* @example Width medium
|
|
127
|
-
* ```html
|
|
128
|
-
* <nys-select label="Select your favorite borough" id="borough" width="md">
|
|
129
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
130
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
131
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
132
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
133
|
-
* <option value="queens" label="Queens"></option>
|
|
134
35
|
* </nys-select>
|
|
135
36
|
* ```
|
|
136
|
-
*
|
|
137
|
-
* @example Width large
|
|
138
|
-
* ```html
|
|
139
|
-
* <nys-select label="Select your favorite borough" id="borough" width="lg">
|
|
140
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
141
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
142
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
143
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
144
|
-
* <option value="queens" label="Queens"></option>
|
|
145
|
-
* </nys-select>
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @example Slotted Description
|
|
149
|
-
* ```html
|
|
150
|
-
* <nys-select label="Select your favorite borough" id="borough">
|
|
151
|
-
* <label slot="description">This is a slotted description</label>
|
|
152
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
153
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
154
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
155
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
156
|
-
* <option value="queens" label="Queens"></option>
|
|
157
|
-
* </nys-select>
|
|
158
|
-
* ```
|
|
159
|
-
*
|
|
160
|
-
* @example Error Message
|
|
161
|
-
* <nys-select label="Select your favorite borough" id="borough" errorMessage="You did not select a borough" showError>
|
|
162
|
-
* <option value="bronx" label="The Bronx"></option>
|
|
163
|
-
* <option value="brooklyn" label="Brooklyn"></option>
|
|
164
|
-
* <option value="manhattan" label="Manhattan"></option>
|
|
165
|
-
* <option value="staten_island" label="Staten Island"></option>
|
|
166
|
-
* <option value="queens" label="Queens"></option>
|
|
167
|
-
* </nys-select>
|
|
168
37
|
*/
|
|
169
38
|
export declare class NysSelect extends LitElement {
|
|
170
39
|
static styles: import("lit").CSSResult;
|
|
@@ -8,15 +8,15 @@ 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 Default skip link
|
|
12
12
|
* ```html
|
|
13
13
|
* <nys-skipnav></nys-skipnav>
|
|
14
|
+
* <main id="main-content">...</main>
|
|
14
15
|
* ```
|
|
15
16
|
*
|
|
16
17
|
* @example Custom target
|
|
17
18
|
* ```html
|
|
18
19
|
* <nys-skipnav href="#content-area"></nys-skipnav>
|
|
19
|
-
* <p id="content-area">...</p>
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
export declare class NysSkipnav extends LitElement {
|
|
@@ -74,6 +74,19 @@ import { LitElement } from "lit";
|
|
|
74
74
|
* @fires nys-step-click - Fired when a navigable (`previous` or `current`) non-selected step is clicked
|
|
75
75
|
* or activated by keyboard. Detail: `{ href: string, label: string }`. Cancelable — call
|
|
76
76
|
* `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
|
+
* ```
|
|
77
90
|
*/
|
|
78
91
|
export declare class NysStep extends LitElement {
|
|
79
92
|
static styles: import("lit").CSSResult;
|
|
@@ -48,137 +48,87 @@ import "./nys-step";
|
|
|
48
48
|
* @slot - Default slot for `nys-step` elements. Only `nys-step` children are accepted; others are removed.
|
|
49
49
|
* @slot actions - Persistent navigation buttons. Must contain exactly one `<div>` wrapping only `<nys-button>` elements.
|
|
50
50
|
*
|
|
51
|
-
* @example Basic
|
|
51
|
+
* @example Basic stepper
|
|
52
52
|
* ```html
|
|
53
|
-
* <
|
|
54
|
-
* <nys-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* class="nys-desktop:nys-grid-col-3"
|
|
59
|
-
* >
|
|
60
|
-
* <nys-step label="Personal Details" href="/nys-stepper/personal.html"></nys-step>
|
|
61
|
-
* <nys-step label="Team Info" selected href="/nys-stepper/team.html"></nys-step>
|
|
62
|
-
* <nys-step label="Usage Survey" current href="/nys-stepper/survey.html"></nys-step>
|
|
63
|
-
* <nys-step label="Newsletter Opt-In" href="/nys-stepper/newsletter.html"></nys-step>
|
|
64
|
-
* <div slot="actions">
|
|
65
|
-
* <nys-button variant="outline" label="Save & Exit" fullWidth></nys-button>
|
|
66
|
-
* </div>
|
|
67
|
-
* </nys-stepper>
|
|
68
|
-
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
69
|
-
* Loading...
|
|
70
|
-
* </div>
|
|
71
|
-
* </div>
|
|
53
|
+
* <nys-stepper label="Application Progress">
|
|
54
|
+
* <nys-step label="Personal Info" current></nys-step>
|
|
55
|
+
* <nys-step label="Contact Details"></nys-step>
|
|
56
|
+
* <nys-step label="Review"></nys-step>
|
|
57
|
+
* </nys-stepper>
|
|
72
58
|
* ```
|
|
73
|
-
*
|
|
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
|
|
74
67
|
* ```html
|
|
75
|
-
* <div class="nys-grid-
|
|
76
|
-
* <nys-
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* <
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
88
|
-
* Loading...
|
|
68
|
+
* <div class="nys-grid-container">
|
|
69
|
+
* <div class="nys-grid-row">
|
|
70
|
+
* <nys-stepper label="Application" class="nys-grid-col-12 nys-desktop:nys-grid-col-3">
|
|
71
|
+
* <nys-step label="Personal Info"></nys-step>
|
|
72
|
+
* <nys-step label="Contact" current></nys-step>
|
|
73
|
+
* <nys-step label="Review"></nys-step>
|
|
74
|
+
* </nys-stepper>
|
|
75
|
+
* <main class="nys-grid-col-12 nys-desktop:nys-grid-col-9" id="main-content">
|
|
76
|
+
* <!-- Form content for current step -->
|
|
77
|
+
* <nys-textinput label="Email" required></nys-textinput>
|
|
78
|
+
* <nys-textinput label="Phone"></nys-textinput>
|
|
79
|
+
* </main>
|
|
89
80
|
* </div>
|
|
90
81
|
* </div>
|
|
91
|
-
* <script>
|
|
92
|
-
* document.addEventListener("DOMContentLoaded", async () => {
|
|
93
|
-
* const stepper = document.querySelector("nys-stepper");
|
|
94
|
-
* if (stepper?.updateComplete) await stepper.updateComplete;
|
|
95
|
-
* const selectedStep = document.querySelector("nys-step[selected]");
|
|
96
|
-
* const href = selectedStep?.getAttribute("href");
|
|
97
|
-
* if (!href) return;
|
|
98
|
-
* const res = await fetch(href);
|
|
99
|
-
* if (!res.ok) return;
|
|
100
|
-
* const container = document.querySelector("#nys-stepper-content");
|
|
101
|
-
* if (container) container.innerHTML = await res.text();
|
|
102
|
-
* });
|
|
103
|
-
*
|
|
104
|
-
* document.addEventListener("nys-step-click", async (e) => {
|
|
105
|
-
* const href = e.detail?.href;
|
|
106
|
-
* if (!href) return;
|
|
107
|
-
* e.preventDefault();
|
|
108
|
-
* const res = await fetch(href);
|
|
109
|
-
* if (!res.ok) return;
|
|
110
|
-
* const container = document.querySelector("#nys-stepper-content");
|
|
111
|
-
* if (container) container.innerHTML = await res.text();
|
|
112
|
-
* });
|
|
113
|
-
* </script>
|
|
114
82
|
* ```
|
|
115
83
|
*
|
|
116
|
-
* @example
|
|
84
|
+
* @example Navigation buttons in actions slot
|
|
85
|
+
* Add Previous/Next buttons using the actions slot. Wrap buttons in a `<div>`.
|
|
117
86
|
* ```html
|
|
118
|
-
* <
|
|
119
|
-
* <nys-
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* >
|
|
125
|
-
* <nys-step label="Personal Details" href="/nys-stepper/personal.html"></nys-step>
|
|
126
|
-
* <nys-step label="Team Info" selected href="/nys-stepper/team.html"></nys-step>
|
|
127
|
-
* <nys-step label="Usage Survey" current href="/nys-stepper/survey.html"></nys-step>
|
|
128
|
-
* <nys-step label="Newsletter Opt-In" href="/nys-stepper/newsletter.html"></nys-step>
|
|
129
|
-
* <div slot="actions">
|
|
130
|
-
* <nys-button variant="outline" label="Save & Exit" fullWidth></nys-button>
|
|
131
|
-
* </div>
|
|
132
|
-
* </nys-stepper>
|
|
133
|
-
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
134
|
-
* Loading...
|
|
87
|
+
* <nys-stepper label="Application">
|
|
88
|
+
* <nys-step label="Step 1"></nys-step>
|
|
89
|
+
* <nys-step label="Step 2" current></nys-step>
|
|
90
|
+
* <nys-step label="Step 3"></nys-step>
|
|
91
|
+
* <div slot="actions">
|
|
92
|
+
* <nys-button label="Save and Exit" variant="outline" size="sm" fullWidth></nys-button>
|
|
135
93
|
* </div>
|
|
136
|
-
* </
|
|
94
|
+
* </nys-stepper>
|
|
137
95
|
* ```
|
|
138
|
-
* @render Actions slot
|
|
139
|
-
* ```html
|
|
140
|
-
* <div class="nys-grid-row">
|
|
141
|
-
* <nys-stepper
|
|
142
|
-
* id="stepper"
|
|
143
|
-
* name="stepper"
|
|
144
|
-
* label="Register for Design System Office Hours"
|
|
145
|
-
* class="nys-desktop:nys-grid-col-3"
|
|
146
|
-
* >
|
|
147
|
-
* <nys-step label="Personal Details" href="/nys-stepper/personal.html"></nys-step>
|
|
148
|
-
* <nys-step label="Team Info" selected href="/nys-stepper/team.html"></nys-step>
|
|
149
|
-
* <nys-step label="Usage Survey" current href="/nys-stepper/survey.html"></nys-step>
|
|
150
|
-
* <nys-step label="Newsletter Opt-In" href="/nys-stepper/newsletter.html"></nys-step>
|
|
151
|
-
* <div slot="actions">
|
|
152
|
-
* <nys-button variant="outline" label="Save & Exit" fullWidth></nys-button>
|
|
153
|
-
* </div>
|
|
154
|
-
* </nys-stepper>
|
|
155
|
-
* <div class="nys-desktop:nys-grid-col-9" id="nys-stepper-content">
|
|
156
|
-
* Loading...
|
|
157
|
-
* </div>
|
|
158
|
-
* </div>
|
|
159
|
-
* <script>
|
|
160
|
-
* document.addEventListener("DOMContentLoaded", async () => {
|
|
161
|
-
* const stepper = document.querySelector("nys-stepper");
|
|
162
|
-
* if (stepper?.updateComplete) await stepper.updateComplete;
|
|
163
|
-
* const selectedStep = document.querySelector("nys-step[selected]");
|
|
164
|
-
* const href = selectedStep?.getAttribute("href");
|
|
165
|
-
* if (!href) return;
|
|
166
|
-
* const res = await fetch(href);
|
|
167
|
-
* if (!res.ok) return;
|
|
168
|
-
* const container = document.querySelector("#nys-stepper-content");
|
|
169
|
-
* if (container) container.innerHTML = await res.text();
|
|
170
|
-
* });
|
|
171
96
|
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
97
|
+
* @example SPA / programmatic navigation
|
|
98
|
+
* Two state variables drive the stepper in any framework or vanilla JS:
|
|
99
|
+
* - `currentStep` (progress boundary) → set `current` on the matching step
|
|
100
|
+
* - `viewingStep` (displayed content) → set `selected` on the matching step
|
|
101
|
+
*
|
|
102
|
+
* Always set both explicitly. Always call `e.preventDefault()` in the
|
|
103
|
+
* `nys-step-click` listener to suppress href navigation. Do NOT nest inside a
|
|
104
|
+
* `<form>` element.
|
|
105
|
+
* ```js
|
|
106
|
+
* let currentStep = 0; // furthest reached
|
|
107
|
+
* let viewingStep = 0; // currently displayed
|
|
108
|
+
*
|
|
109
|
+
* function updateStepper(steps) {
|
|
110
|
+
* steps.forEach((step, i) => {
|
|
111
|
+
* step.toggleAttribute('current', i === currentStep);
|
|
112
|
+
* step.toggleAttribute('selected', i === viewingStep);
|
|
180
113
|
* });
|
|
181
|
-
*
|
|
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
|
+
*
|
|
124
|
+
* // Advance to next step (call on form submit / "Continue" click)
|
|
125
|
+
* function advance(steps) {
|
|
126
|
+
* if (currentStep < steps.length - 1) {
|
|
127
|
+
* currentStep++;
|
|
128
|
+
* viewingStep = currentStep;
|
|
129
|
+
* updateStepper(steps);
|
|
130
|
+
* }
|
|
131
|
+
* }
|
|
182
132
|
* ```
|
|
183
133
|
*/
|
|
184
134
|
export declare class NysStepper extends LitElement {
|
|
@@ -20,25 +20,16 @@ import { LitElement } from "lit";
|
|
|
20
20
|
*
|
|
21
21
|
* @slot - No slots; content is derived from the `label` property.
|
|
22
22
|
*
|
|
23
|
-
* @example
|
|
23
|
+
* @example `<nys-tab>` and `<nys-tabpanel>` should always be wrapped by `<nys-tabgroup>`
|
|
24
24
|
* ```html
|
|
25
|
-
* <nys-tabgroup
|
|
26
|
-
*
|
|
27
|
-
* <nys-tab label="
|
|
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>
|
|
25
|
+
* <!-- Always place <nys-tab> elements inside a <nys-tabgroup>. -->
|
|
26
|
+
* <nys-tabgroup name="My Tabs">
|
|
27
|
+
* <nys-tab label="Overview"></nys-tab>
|
|
39
28
|
* <nys-tab label="Details" selected></nys-tab>
|
|
40
|
-
* <nys-
|
|
41
|
-
* <nys-tabpanel><p>
|
|
29
|
+
* <nys-tab label="Archived" disabled></nys-tab>
|
|
30
|
+
* <nys-tabpanel><p>Overview content</p></nys-tabpanel>
|
|
31
|
+
* <nys-tabpanel><p>Details content (shown by default)</p></nys-tabpanel>
|
|
32
|
+
* <nys-tabpanel><p>Archived content</p></nys-tabpanel>
|
|
42
33
|
* </nys-tabgroup>
|
|
43
34
|
* ```
|
|
44
35
|
*/
|
|
@@ -23,87 +23,25 @@ import { LitElement } from "lit";
|
|
|
23
23
|
* moved into internal shadow-DOM containers on `slotchange`; the slot
|
|
24
24
|
* itself is not rendered visibly.
|
|
25
25
|
*
|
|
26
|
-
* @example
|
|
26
|
+
* @example Disable a tab using the `disabled` attribute on `<nys-tab>`.
|
|
27
27
|
* ```html
|
|
28
|
-
* <nys-tabgroup>
|
|
29
|
-
* <nys-tab label="
|
|
30
|
-
* <nys-tab label="
|
|
31
|
-
* <nys-tab label="
|
|
32
|
-
*
|
|
33
|
-
* <nys-tabpanel
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* top is 14.8 miles and is an out-and-back route.
|
|
37
|
-
* </nys-tabpanel>
|
|
38
|
-
* <nys-tabpanel
|
|
39
|
-
* >Algonquin Peak is the 2nd tallest peak in the Adirondacks. It has an
|
|
40
|
-
* elevation of 5114 feet with 3050 feet of elevation gain. The roundtrip
|
|
41
|
-
* hike to the top is 7.8 miles and is an out-and-back route.</nys-tabpanel
|
|
42
|
-
* >
|
|
43
|
-
* <nys-tabpanel
|
|
44
|
-
* >Mount Haystack is the 3rd tallest peak in the Adirondacks. It has an
|
|
45
|
-
* elevation of 4960 feet with 4000 feet of elevation gain. The roundtrip
|
|
46
|
-
* hike to the top is 16.4 miles and is an out-and-back
|
|
47
|
-
* route.</nys-tabpanel
|
|
48
|
-
* >
|
|
49
|
-
* // rest of tab panel content
|
|
50
|
-
* </nys-tabgroup>
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @render Basic
|
|
54
|
-
* ```html
|
|
55
|
-
* <nys-tabgroup>
|
|
56
|
-
* <nys-tab label="Marcy"></nys-tab>
|
|
57
|
-
* <nys-tab label="Algonquin"></nys-tab>
|
|
58
|
-
* <nys-tab label="Haystack"></nys-tab>
|
|
59
|
-
* <nys-tab label="Skylight" id="tab4"></nys-tab>
|
|
60
|
-
* <nys-tab label="Whiteface" id="tab5"></nys-tab>
|
|
61
|
-
* <nys-tabpanel
|
|
62
|
-
* >Mount Marcy is the tallest peak in the Adirondacks. It has an elevation
|
|
63
|
-
* of 5344 feet with 3166 feet of elevation gain. The roundtrip hike to the
|
|
64
|
-
* top is 14.8 miles and is an out-and-back route.
|
|
65
|
-
* </nys-tabpanel>
|
|
66
|
-
* <nys-tabpanel
|
|
67
|
-
* >Algonquin Peak is the 2nd tallest peak in the Adirondacks. It has an
|
|
68
|
-
* elevation of 5114 feet with 3050 feet of elevation gain. The roundtrip
|
|
69
|
-
* hike to the top is 7.8 miles and is an out-and-back route.</nys-tabpanel
|
|
70
|
-
* >
|
|
71
|
-
* <nys-tabpanel
|
|
72
|
-
* >Mount Haystack is the 3rd tallest peak in the Adirondacks. It has an
|
|
73
|
-
* elevation of 4960 feet with 4000 feet of elevation gain. The roundtrip
|
|
74
|
-
* hike to the top is 16.4 miles and is an out-and-back
|
|
75
|
-
* route.</nys-tabpanel
|
|
76
|
-
* >
|
|
77
|
-
* <nys-tabpanel
|
|
78
|
-
* >Mount Skylight is the 4th tallest peak in the Adirondacks. It has an
|
|
79
|
-
* elevation of 4926 feet with 5100 feet of elevation gain. The roundtrip
|
|
80
|
-
* hike to the top is 16 miles and is an out-and-back route.</nys-tabpanel
|
|
81
|
-
* >
|
|
82
|
-
* <nys-tabpanel
|
|
83
|
-
* >Whiteface is the 5th tallest peak in the Adirondacks. It has an
|
|
84
|
-
* elevation of 4867 feet with 3050 feet of elevation gain. The roundtrip
|
|
85
|
-
* hike to the top is 7.2 miles and is an out-and-back route.</nys-tabpanel
|
|
86
|
-
* >
|
|
87
|
-
* <p style="padding: 1rem;">
|
|
88
|
-
* <strong>Note:</strong> The content in the tab panels was gathered from
|
|
89
|
-
* <a href="https://www.lakeplacid.com/do/outdoors/summerfall/hiking"
|
|
90
|
-
* >lakeplacid.com</a
|
|
91
|
-
* >
|
|
92
|
-
* and may not be completely accurate. This is meant to be a demo of how
|
|
93
|
-
* the component works, not a hiking guide.
|
|
94
|
-
* </p>
|
|
95
|
-
* </nys-tabgroup>
|
|
28
|
+
* <nys-tabgroup name="Account Settings">
|
|
29
|
+
* <nys-tab label="Profile"></nys-tab>
|
|
30
|
+
* <nys-tab label="Security"></nys-tab>
|
|
31
|
+
* <nys-tab label="Notifications" disabled></nys-tab>
|
|
32
|
+
* <nys-tabpanel><p>Manage your profile information.</p></nys-tabpanel>
|
|
33
|
+
* <nys-tabpanel><p>Update your password and 2FA settings.</p></nys-tabpanel>
|
|
34
|
+
* <nys-tabpanel><p>Notification preferences (coming soon).</p></nys-tabpanel>
|
|
35
|
+
* </nys-tabgroup>
|
|
96
36
|
* ```
|
|
97
37
|
*
|
|
98
|
-
* @example
|
|
38
|
+
* @example Pre-select a tab using the `selected` attribute on `<nys-tab>`.
|
|
99
39
|
* ```html
|
|
100
|
-
* <nys-tabgroup
|
|
101
|
-
* <nys-tab label="
|
|
102
|
-
* <nys-tab label="
|
|
103
|
-
* <nys-
|
|
104
|
-
* <nys-tabpanel
|
|
105
|
-
* <nys-tabpanel aria-labelledby="tab3">Content for tab 3</nys-tabpanel>
|
|
106
|
-
* <nys-tabpanel aria-labelledby="tab1">Content for tab 1</nys-tabpanel>
|
|
40
|
+
* <nys-tabgroup name="Reports">
|
|
41
|
+
* <nys-tab label="Summary"></nys-tab>
|
|
42
|
+
* <nys-tab label="Details" selected></nys-tab>
|
|
43
|
+
* <nys-tabpanel><p>Summary view</p></nys-tabpanel>
|
|
44
|
+
* <nys-tabpanel><p>Detailed view (shown by default)</p></nys-tabpanel>
|
|
107
45
|
* </nys-tabgroup>
|
|
108
46
|
* ```
|
|
109
47
|
*/
|
|
@@ -12,6 +12,23 @@ import { LitElement } from "lit";
|
|
|
12
12
|
*
|
|
13
13
|
* @slot - Default slot for panel content. Rendered inside a wrapper `<div>`
|
|
14
14
|
* with the `.nys-tabpanel` class for styling.
|
|
15
|
+
*
|
|
16
|
+
* @example Panel content is wrapped by `<nys-tabpanel>`.
|
|
17
|
+
* ```html
|
|
18
|
+
* <!-- Panels are paired by position with <nys-tab> elements in the same <nys-tabgroup>. -->
|
|
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
|
+
* ```
|
|
15
32
|
*/
|
|
16
33
|
export declare class NysTabpanel extends LitElement {
|
|
17
34
|
static styles: import("lit").CSSResult;
|