@nysds/components 1.20.0-alpha1 → 1.20.1

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.
Files changed (135) hide show
  1. package/custom-elements.json +7119 -3701
  2. package/dist/.vscode/vscode.css-custom-data.json +5 -0
  3. package/dist/.vscode/vscode.html-custom-data.json +317 -38
  4. package/dist/custom-elements.json +7119 -3701
  5. package/dist/nys-icon.library-Cfdq5Zdc.js +696 -0
  6. package/dist/nys-icon.library-Cfdq5Zdc.js.map +1 -0
  7. package/dist/nys-icon.library-DHBltclg-BYYeCcpo.js +706 -0
  8. package/dist/nys-icon.library-DHBltclg-BYYeCcpo.js.map +1 -0
  9. package/dist/nysds.es.js +9113 -4162
  10. package/dist/nysds.es.js.map +1 -1
  11. package/dist/nysds.js +2413 -492
  12. package/dist/nysds.js.map +1 -1
  13. package/dist/packages/internals/src/aria-associate.d.ts +41 -0
  14. package/dist/packages/internals/src/form-control-mixin.d.ts +34 -0
  15. package/dist/packages/internals/src/id.d.ts +8 -0
  16. package/dist/packages/internals/src/identified-mixin.d.ts +23 -0
  17. package/dist/packages/internals/src/index.d.ts +7 -0
  18. package/dist/packages/internals/src/reflects-aria-mixin.d.ts +33 -0
  19. package/dist/packages/internals/src/test-helpers.d.ts +29 -0
  20. package/dist/packages/internals/src/types.d.ts +9 -0
  21. package/dist/packages/nys-accordion/src/nys-accordion.d.ts +72 -10
  22. package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +63 -8
  23. package/dist/packages/nys-alert/src/nys-alert.d.ts +95 -20
  24. package/dist/packages/nys-avatar/src/nys-avatar.d.ts +100 -7
  25. package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +75 -5
  26. package/dist/packages/nys-badge/src/nys-badge.d.ts +63 -6
  27. package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +79 -10
  28. package/dist/packages/nys-button/src/nys-button.d.ts +132 -26
  29. package/dist/packages/nys-card/src/index.d.ts +1 -0
  30. package/dist/packages/nys-card/src/nys-card.d.ts +325 -0
  31. package/dist/packages/nys-card/src/nys-card.figma.d.ts +1 -0
  32. package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +37 -12
  33. package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +84 -6
  34. package/dist/packages/nys-combobox/src/nys-combobox.d.ts +174 -5
  35. package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +83 -13
  36. package/dist/packages/nys-divider/src/nys-divider.d.ts +33 -9
  37. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +24 -15
  38. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +3 -12
  39. package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +22 -0
  40. package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +129 -12
  41. package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +23 -2
  42. package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +99 -9
  43. package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +197 -7
  44. package/dist/packages/nys-icon/src/icon-cache.d.ts +11 -4
  45. package/dist/packages/nys-icon/src/icon-library-registry.d.ts +33 -16
  46. package/dist/packages/nys-icon/src/index.d.ts +2 -2
  47. package/dist/packages/nys-icon/src/nys-icon.d.ts +98 -8
  48. package/dist/packages/nys-iconlist/src/index.d.ts +2 -0
  49. package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +92 -0
  50. package/dist/packages/nys-iconlist/src/nys-iconlist.figma.d.ts +1 -0
  51. package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +32 -0
  52. package/dist/packages/nys-label/src/nys-label.d.ts +37 -2
  53. package/dist/packages/nys-modal/src/nys-modal.d.ts +145 -13
  54. package/dist/packages/nys-pagination/src/nys-pagination.d.ts +67 -3
  55. package/dist/packages/nys-processlist/src/index.d.ts +2 -0
  56. package/dist/packages/nys-processlist/src/nys-processlist.d.ts +184 -0
  57. package/dist/packages/nys-processlist/src/nys-processlist.figma.d.ts +1 -0
  58. package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +41 -0
  59. package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +201 -7
  60. package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +88 -6
  61. package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
  62. package/dist/packages/nys-select/src/nys-select.d.ts +150 -15
  63. package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +4 -4
  64. package/dist/packages/nys-stepper/src/nys-step.d.ts +26 -20
  65. package/dist/packages/nys-stepper/src/nys-stepper.d.ts +128 -75
  66. package/dist/packages/nys-tab/src/nys-tab.d.ts +19 -10
  67. package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +181 -39
  68. package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +15 -24
  69. package/dist/packages/nys-table/src/nys-table.d.ts +90 -3
  70. package/dist/packages/nys-textarea/src/nys-textarea.d.ts +60 -10
  71. package/dist/packages/nys-textinput/src/nys-textinput.d.ts +77 -14
  72. package/dist/packages/nys-toggle/src/nys-toggle.d.ts +47 -10
  73. package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +48 -8
  74. package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +45 -4
  75. package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +219 -10
  76. package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +421 -37
  77. package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +4 -54
  78. package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
  79. package/dist/src/index.d.ts +5 -2
  80. package/package.json +14 -6
  81. package/packages/react/NysAccordion.d.ts +10 -0
  82. package/packages/react/NysAccordion.js +2 -1
  83. package/packages/react/NysAccordionItem.d.ts +10 -0
  84. package/packages/react/NysAccordionItem.js +3 -1
  85. package/packages/react/NysAlert.d.ts +8 -10
  86. package/packages/react/NysAlert.js +0 -2
  87. package/packages/react/NysAvatar.d.ts +11 -1
  88. package/packages/react/NysBacktotop.d.ts +3 -0
  89. package/packages/react/NysBacktotop.js +2 -1
  90. package/packages/react/NysBreadcrumbs.d.ts +2 -2
  91. package/packages/react/NysButton.d.ts +38 -8
  92. package/packages/react/NysButton.js +6 -4
  93. package/packages/react/NysCard.d.ts +110 -0
  94. package/packages/react/NysCard.js +61 -0
  95. package/packages/react/NysCheckbox.d.ts +9 -0
  96. package/packages/react/NysCheckbox.js +4 -0
  97. package/packages/react/NysDropdownMenu.d.ts +4 -2
  98. package/packages/react/NysFileinput.d.ts +25 -3
  99. package/packages/react/NysFileinput.js +8 -1
  100. package/packages/react/NysGlobalFooter.d.ts +17 -0
  101. package/packages/react/NysGlobalFooter.js +10 -2
  102. package/packages/react/NysGlobalHeader.d.ts +23 -1
  103. package/packages/react/NysGlobalHeader.js +11 -2
  104. package/packages/react/NysIconlist.d.ts +54 -0
  105. package/packages/react/NysIconlist.js +22 -0
  106. package/packages/react/NysIconlistitem.d.ts +59 -0
  107. package/packages/react/NysIconlistitem.js +22 -0
  108. package/packages/react/NysLabel.d.ts +4 -1
  109. package/packages/react/NysModal.d.ts +8 -1
  110. package/packages/react/NysModal.js +11 -2
  111. package/packages/react/NysProcesslist.d.ts +65 -0
  112. package/packages/react/NysProcesslist.js +25 -0
  113. package/packages/react/NysProcesslistitem.d.ts +61 -0
  114. package/packages/react/NysProcesslistitem.js +35 -0
  115. package/packages/react/NysRadiobutton.d.ts +27 -3
  116. package/packages/react/NysRadiobutton.js +9 -1
  117. package/packages/react/NysSelect.d.ts +3 -0
  118. package/packages/react/NysSelect.js +2 -0
  119. package/packages/react/NysStepper.d.ts +1 -1
  120. package/packages/react/NysTabgroup.d.ts +5 -4
  121. package/packages/react/NysTable.d.ts +1 -1
  122. package/packages/react/NysTabpanel.d.ts +11 -4
  123. package/packages/react/NysTextarea.d.ts +4 -1
  124. package/packages/react/NysTextarea.js +2 -0
  125. package/packages/react/NysUnavFooter.d.ts +13 -0
  126. package/packages/react/NysUnavFooter.js +4 -1
  127. package/packages/react/NysUnavHeader.d.ts +24 -1
  128. package/packages/react/NysUnavHeader.js +17 -1
  129. package/packages/react/NysVerticalnav.d.ts +15 -8
  130. package/packages/react/NysVerticalnav.js +6 -4
  131. package/packages/react/NysVerticalnavGroup.d.ts +4 -0
  132. package/packages/react/NysVerticalnavGroup.js +5 -0
  133. package/packages/react/index.d.ts +5 -0
  134. package/packages/react/index.js +5 -0
  135. package/packages/react/nysds-jsx.d.ts +394 -56
@@ -1,4 +1,4 @@
1
- import { LitElement } from "lit";
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-{n}-{timestamp}`.
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
- * - Each `nys-step` label is keyboard-focusable and activatable for navigable steps.
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 stepper
55
+ * @example Basic
52
56
  * ```html
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>
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-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>
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 Navigation buttons in actions slot
85
- * Add Previous/Next buttons using the actions slot. Wrap buttons in a `<div>`.
120
+ * @example Actions slot
86
121
  * ```html
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>
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
- * </nys-stepper>
140
+ * </div>
95
141
  * ```
96
- *
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);
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
- * // 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
- * }
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 LitElement {
188
+ export declare class NysStepper extends NysElement {
135
189
  static styles: import("lit").CSSResult;
136
- /** Unique identifier. Auto-generated as `nys-stepper-{n}-{timestamp}` if not provided. */
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 { LitElement } from "lit";
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 `<nys-tab>` and `<nys-tabpanel>` should always be wrapped by `<nys-tabgroup>`
23
+ * @example Disabled
24
24
  * ```html
25
- * <!-- Always place <nys-tab> elements inside a <nys-tabgroup>. -->
26
- * <nys-tabgroup name="My Tabs">
27
- * <nys-tab label="Overview"></nys-tab>
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-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>
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 LitElement {
45
+ export declare class NysTab extends NysElement {
37
46
  static styles: import("lit").CSSResult;
38
47
  /**
39
48
  * Unique identifier for the tab element.
@@ -1,12 +1,13 @@
1
- import { LitElement } from "lit";
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, children are sorted into dedicated shadow-DOM
8
- * containers, ARIA relationships are wired, and the first selected (or first)
9
- * tab is activated.
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. Elements are
23
- * moved into internal shadow-DOM containers on `slotchange`; the slot
24
- * itself is not rendered visibly.
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 Disable a tab using the `disabled` attribute on `<nys-tab>`.
28
+ * @example Basic
27
29
  * ```html
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>
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 Pre-select a tab using the `selected` attribute on `<nys-tab>`.
131
+ * @example Custom Styling
39
132
  * ```html
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>
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 LitElement {
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>` elements currently residing in the shadow-DOM
121
- * tabs container, in DOM order.
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 all `<nys-tabpanel>` elements currently residing in the
128
- * shadow-DOM panels container, in DOM order.
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>` child.
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` on the default slot.
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
- * Iterates over all assigned elements and moves each `<nys-tab>` into
156
- * `.nys-tabgroup__tabs` and each `<nys-tabpanel>` into
157
- * `.nys-tabgroup__panels`. If a panel has an `aria-labelledby` attribute,
158
- * it is explicitly paired with the tab it references; otherwise panels are
159
- * paired with tabs by index order. After sorting, calls `_applySelection`
160
- * using the first element that already has a `selected` attribute, or
161
- * index `0` if none is found.
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 _sortChildren;
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 ARIA radio-button keyboard pattern:
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>._handleKeydown`) confirm selection.
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 { LitElement } from "lit";
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 externally by
9
- * `<nys-tabgroup>` via `_applySelection`; do not set them directly.
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
- * @element nys-tabpanel
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
- * @slot - Default slot for panel content. Rendered inside a wrapper `<div>`
14
- * with the `.nys-tabpanel` class for styling.
18
+ * @element nys-tabpanel
15
19
  *
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
- * ```
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 LitElement {
24
+ export declare class NysTabpanel extends NysElement {
34
25
  static styles: import("lit").CSSResult;
35
26
  /**
36
27
  * Unique identifier for the panel element.