@nysds/components 1.23.2 → 1.24.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.
Files changed (25) hide show
  1. package/custom-elements.json +500 -25
  2. package/dist/.vscode/vscode.html-custom-data.json +50 -8
  3. package/dist/custom-elements.json +500 -25
  4. package/dist/{nys-icon.library-BRplkAua.js → nys-icon.library-C3fdrsXK.js} +2 -2
  5. package/dist/{nys-icon.library-BRplkAua.js.map → nys-icon.library-C3fdrsXK.js.map} +1 -1
  6. package/dist/{nys-icon.library-DPR9yd8U-CCjVAKg8.js → nys-icon.library-CHrtmOCL-BdLMRCBm.js} +3 -3
  7. package/dist/{nys-icon.library-DPR9yd8U-CCjVAKg8.js.map → nys-icon.library-CHrtmOCL-BdLMRCBm.js.map} +1 -1
  8. package/dist/nysds.es.js +4403 -4182
  9. package/dist/nysds.es.js.map +1 -1
  10. package/dist/nysds.js +188 -193
  11. package/dist/nysds.js.map +1 -1
  12. package/dist/packages/mcp-server/src/lib/icons.d.ts +18 -0
  13. package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +7 -27
  14. package/dist/packages/nys-button/src/nys-button.d.ts +5 -4
  15. package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +8 -18
  16. package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +8 -0
  17. package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +2 -1
  18. package/dist/packages/nys-icon/src/nys-icon.d.ts +6 -4
  19. package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +2 -2
  20. package/dist/packages/nys-onthispage/src/index.d.ts +1 -0
  21. package/dist/packages/nys-onthispage/src/nys-onthispage.d.ts +418 -0
  22. package/dist/packages/nys-onthispage/src/nys-onthispage.figma.d.ts +1 -0
  23. package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +2 -0
  24. package/dist/src/index.d.ts +1 -0
  25. package/package.json +2 -2
@@ -0,0 +1,18 @@
1
+ /**
2
+ * NYSDS Icon Set
3
+ *
4
+ * The names of the icons built into nys-icon's "default" library, read from
5
+ * the manifest @nysds/nys-icon generates from nys-icon.library.ts. Only these
6
+ * names render without registering another library, so the MCP server lists
7
+ * them instead of leaving agents to guess (and guess Material Symbols names).
8
+ */
9
+ import type { CEMDeclaration } from "./cem-parser.js";
10
+ /** Built-in NYSDS icon names, sorted. Empty if the manifest can't be found. */
11
+ export declare function getIconNames(): string[];
12
+ /**
13
+ * Attributes on a component whose value is an icon name from the NYSDS set:
14
+ * nys-icon's `name`, and other components' `icon`, `prefixIcon`,
15
+ * `suffixIcon`, etc. Boolean flags such as `noIcon` aren't names.
16
+ */
17
+ export declare function iconAttributes(component: CEMDeclaration): string[];
18
+ export declare const ICON_GUIDE_POINTER = "Only these names render by default. For an icon the NYSDS set doesn't have, register another library; see get_guide({ topic: \"icons\" }).";
@@ -15,10 +15,8 @@ export type NysAccordionitemToggleEvent = CustomEvent<NysAccordionitemToggleDeta
15
15
  * Place inside `nys-accordion`. Set `expanded` to open by default. The heading acts as a toggle button
16
16
  * accessible via click, Enter, or Space. Parent accordion controls `bordered` and `singleSelect` behavior.
17
17
  *
18
- * Per the WAI-ARIA Accordion pattern the toggle button is wrapped in a real
19
- * heading element so the panels appear in the document outline and screen
20
- * reader users can jump between them by heading. Set `headingLevel` (here or on
21
- * the parent `nys-accordion`) to the level that fits the surrounding page.
18
+ * The toggle button sits inside a real heading (`h2`-`h6`). Set `headingLevel`
19
+ * here or on the parent `nys-accordion` to match the surrounding page.
22
20
  *
23
21
  * @summary Collapsible panel for use within nys-accordion with keyboard support.
24
22
  * @element nys-accordionitem
@@ -60,14 +58,10 @@ export declare class NysAccordionItem extends NysElement {
60
58
  /**
61
59
  * Heading element that wraps the toggle button (`h2` through `h6`).
62
60
  *
63
- * Pick the level that puts the trigger in the right place in the page
64
- * outline — one level below the heading that introduces the accordion. Leave
65
- * it empty to follow the `headingLevel` of the enclosing `nys-accordion`,
66
- * which is the usual way to set it for a whole group; `h3` applies when
67
- * neither is specified. `h1` is not offered because an accordion trigger is
68
- * never the page title.
61
+ * Use one level below the heading that introduces the accordion. If unset,
62
+ * the item follows the parent `nys-accordion`, then falls back to `h3`.
69
63
  */
70
- headingLevel: "h2" | "h3" | "h4" | "h5" | "h6" | "";
64
+ headingLevel: "h2" | "h3" | "h4" | "h5" | "h6" | undefined;
71
65
  /** Whether the content panel is visible. Toggle via click or keyboard. */
72
66
  expanded: boolean;
73
67
  /** Adds border styling. Set by parent `nys-accordion`, not directly. */
@@ -83,15 +77,7 @@ export declare class NysAccordionItem extends NysElement {
83
77
  * Functions
84
78
  * --------------------------------------------------------------------------
85
79
  */
86
- /**
87
- * The level actually rendered: this item's own `headingLevel`, otherwise the
88
- * one set on the enclosing `nys-accordion`, otherwise the `h3` default.
89
- *
90
- * The group's value is read here rather than pushed down from the container
91
- * so there is a single source of truth per item and an item-level value
92
- * always wins. `nys-accordion` re-renders its items when its own level
93
- * changes (see `_notifyHeadingLevel` there).
94
- */
80
+ /** The item's own level, else the parent accordion's, else `h3`. */
95
81
  private _resolveHeadingLevel;
96
82
  private _dispatchEvent;
97
83
  private _handleExpand;
@@ -102,13 +88,7 @@ export declare class NysAccordionItem extends NysElement {
102
88
  * Helper Render Functions
103
89
  * --------------------------------------------------------------------------
104
90
  */
105
- /**
106
- * WAI-ARIA Accordion pattern: the toggle button must be contained in a
107
- * heading at the level appropriate for the surrounding page. A real `h2`-`h6`
108
- * element is used rather than `role="heading"` + `aria-level` so the trigger
109
- * carries native heading semantics everywhere — including the places that
110
- * read the DOM instead of the accessibility tree.
111
- */
91
+ /** Wraps the toggle button in a real heading, per the WAI-ARIA accordion pattern. */
112
92
  private _renderHeading;
113
93
  render(): TemplateResult<1>;
114
94
  }
@@ -232,11 +232,11 @@ export declare class NysButton extends NysFormControlElement {
232
232
  */
233
233
  ariaCurrent: "page" | "step" | "location" | "date" | "time" | "true" | "false" | "";
234
234
  /**
235
- * Material Symbol icon before label. Not shown for `circle` mode.
235
+ * NYSDS icon name (see `nys-icon`) shown before the label. Not shown for `circle` mode.
236
236
  */
237
237
  prefixIcon: string;
238
238
  /**
239
- * Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `circle` mode.
239
+ * NYSDS icon name (see `nys-icon`) shown after the label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `circle` mode.
240
240
  */
241
241
  suffixIcon: string;
242
242
  /**
@@ -273,9 +273,10 @@ export declare class NysButton extends NysFormControlElement {
273
273
  */
274
274
  value: string;
275
275
  /**
276
- * ID(s) of element(s) describing this button. Sets `aria-describedby`.
276
+ * Aria description for the button's name. Useful for adding additional SR context
277
+ * such as hint texts from the nys-tooltip (since that cannot be resolved by `ariaDescribedBy`).
277
278
  */
278
- ariaDescribedBy: string;
279
+ ariaDescription: string;
279
280
  /**
280
281
  * Form behavior: `button` (default, no form action), `submit` (submits form), `reset` (resets form). Always set explicitly to avoid unintended submissions.
281
282
  * @default "button"
@@ -199,6 +199,7 @@ export declare class NysFileinput extends NysFormControlElement {
199
199
  private _dragActive;
200
200
  private get _isDropDisabled();
201
201
  private get _innerNysButton();
202
+ private get _selectionSummary();
202
203
  /**
203
204
  * Lifecycle methods
204
205
  * --------------------------------------------------------------------------
@@ -211,25 +212,14 @@ export declare class NysFileinput extends NysFormControlElement {
211
212
  willUpdate(changedProperties: Map<string, unknown>): void;
212
213
  updated(changedProperties: Map<string, unknown>): void;
213
214
  /**
214
- * Point the exposed control at the rendered <nys-errormessage> and, in
215
- * dropzone mode, at the "or drag here" instructional text.
215
+ * Sets the accessible description of the "Choose file" button.
216
216
  *
217
- * The native <input type="file"> is `hidden`, `aria-hidden` and `tabindex="-1"`,
218
- * so it is not in the accessibility tree and must not carry these
219
- * associations. The element a user actually reaches is the <button> inside the
220
- * "Choose file" <nys-button>'s shadow root — that's also the keyboard path for
221
- * the dropzone (Enter/Space opens the native file picker via real button
222
- * semantics); the dropzone `<div>` itself is a non-interactive, pointer-only
223
- * drop target and never receives focus.
224
- *
225
- * The button and these targets sit in different shadow roots, so an IDREF
226
- * written on the button would dangle. ARIA element reflection does cross into a
227
- * shadow-including ancestor tree, so associateControlRefs sets the control's own
228
- * ariaDescribedByElements (plus an aria-description string fallback for engines
229
- * that expose the IDL but do not yet honor it). aria-describedby — not
230
- * aria-errormessage — is what Blink actually surfaces for a control inside a
231
- * shadow root; see src/scripts/verify-a11y-names.mjs. aria-errormessage is set
232
- * through its element-reflection form where the engine supports it.
217
+ * The real button lives inside <nys-button>'s shadow root, so a normal
218
+ * aria-describedby id can't reach elements out here. Instead we link the
219
+ * elements directly with associateControlRefs. The description is built, in
220
+ * order, from: the dropzone hint, the selected-files summary, and the error
221
+ * message. An aria-description string is also set for browsers that ignore
222
+ * element references.
233
223
  */
234
224
  private _syncControlErrorAssociation;
235
225
  /**
@@ -45,6 +45,12 @@ export declare class NysFileItem extends NysElement {
45
45
  progress: number;
46
46
  /** Error message displayed when status is `error`. */
47
47
  errorMessage: string;
48
+ /**
49
+ * Label of the field this file belongs to. Set by `nys-fileinput` so screen
50
+ * readers know which field a remove button or progress bar belongs to.
51
+ * @internal
52
+ */
53
+ fieldLabel: string;
48
54
  /**
49
55
  * True when this item is actually in an error state. `aria-invalid` reflects
50
56
  * this rather than being hardcoded, so a healthy item is never announced as
@@ -60,6 +66,8 @@ export declare class NysFileItem extends NysElement {
60
66
  * rather than the filename, which is not id-safe and not stable.
61
67
  */
62
68
  private get _errorId();
69
+ /** Accessible name for the remove button. Includes the field label from `nys-fileinput` when set. */
70
+ private get _removeAriaLabel();
63
71
  private _handleRemove;
64
72
  private splitFilename;
65
73
  render(): import("lit-html").TemplateResult<1>;
@@ -89,7 +89,7 @@ import { NysElement } from "@nysds/internals";
89
89
  * <nys-globalheader nysLogo appName="Admin Dashboard"></nys-globalheader>
90
90
  * ```
91
91
  *
92
- * * @example Custom landmark label
92
+ * @example Custom landmark label
93
93
  * ```html
94
94
  * <!-- Names the banner landmark directly instead of from the visible title.
95
95
  * Keep it distinct from nys-unavheader's ("New York State"). -->
@@ -219,5 +219,6 @@ export declare class NysGlobalHeader extends NysElement {
219
219
  * has something to point at, so the landmark never carries both.
220
220
  */
221
221
  private get _bannerLabel();
222
+ private _renderNames;
222
223
  render(): import("lit-html").TemplateResult<1>;
223
224
  }
@@ -1,9 +1,11 @@
1
1
  import { NysElement } from "@nysds/internals";
2
2
  import { NysIconWatcher } from "./icon-library-registry";
3
3
  /**
4
- * Renders SVG icons from a registered icon library. The built-in NYSDS icon
5
- * library (Material Symbols) is the default. Custom libraries (Font Awesome,
6
- * Material Icons, etc.) can be registered via `registerIconLibrary()`.
4
+ * Renders SVG icons from a registered icon library. The default library is
5
+ * the curated NYSDS icon set built into the package; only its names render
6
+ * without setup. Other libraries (Font Awesome, Material Icons, your own
7
+ * SVGs, etc.) can be registered via `registerIconLibrary()` and selected with
8
+ * `library`.
7
9
  *
8
10
  * Pass `name` to select an icon. Use `library` to choose a registered library
9
11
  * (defaults to `"default"` for NYSDS icons). Use `ariaLabel` to make the icon
@@ -20,7 +22,7 @@ import { NysIconWatcher } from "./icon-library-registry";
20
22
  * - Pair icons with a text label—few icons are universally understood alone.
21
23
  * - Use icons consistently: same icon and label for the same meaning throughout your app.
22
24
  * - Use `ariaLabel` when the icon conveys meaning, so screen readers can announce its purpose.
23
- * - Use icons from the NYS Design System library; if unavailable, use Google Material Symbols (rounded, unfilled).
25
+ * - Use icons from the NYS Design System library. If it doesn't have the icon you need, register another library with `registerIconLibrary()` and set `library`.
24
26
  * - Match icon size and color to the design system.
25
27
  * - Don't use an icon if its meaning isn't immediately clear—if you suspect users won't recognize it, remove it.
26
28
  * - Don't use icons to compensate for unclear page hierarchy or confusing content organization.
@@ -9,7 +9,7 @@ import "@nysds/nys-icon";
9
9
  * @summary An icon-paired list item for use inside `<nys-iconlist>`.
10
10
  * @element nys-iconlistitem
11
11
  *
12
- * @prop {string} icon - Material Symbols icon name passed to `<nys-icon>`.
12
+ * @prop {string} icon - NYSDS icon name passed to `<nys-icon>`.
13
13
  *
14
14
  * @slot - Primary label text.
15
15
  * @slot secondary - Optional second line of text rendered below the primary label.
@@ -17,7 +17,7 @@ import "@nysds/nys-icon";
17
17
  export declare class NysIconlistitem extends NysElement {
18
18
  static styles: import("lit").CSSResult;
19
19
  /**
20
- * Material Symbols icon name displayed beside the label.
20
+ * NYSDS icon name (see `nys-icon`) displayed beside the label.
21
21
  */
22
22
  icon: string;
23
23
  /**
@@ -0,0 +1 @@
1
+ export * from "./nys-onthispage";
@@ -0,0 +1,418 @@
1
+ import { nothing } from "lit";
2
+ import { NysElement } from "@nysds/internals";
3
+ type HeadingTag = "h2" | "h3" | "h4" | "h5" | "h6";
4
+ type HashBehavior = "none" | "hash" | "replace";
5
+ /** Detail payload for the `nys-click` event. */
6
+ interface NysOnThisPageClickDetail {
7
+ id: string;
8
+ label: string;
9
+ index: number;
10
+ }
11
+ /** The `nys-click` event, fired on a committed selection. */
12
+ export type NysOnThisPageClickEvent = CustomEvent<NysOnThisPageClickDetail>;
13
+ /**
14
+ * In-page navigation that lists the headings on a page as links, so users can jump to a section.
15
+ * The link for the section the user is currently reading is highlighted.
16
+ *
17
+ * The component collects headings from the `scope` element (default `main`) at the `headingTracker`
18
+ * level (default `h2`). Headings without an `id` get one generated from their text. Headings inside
19
+ * `nys-accordion`, inside a `[hidden]` element, or marked with `data-nys-onthispage-ignore` are left out.
20
+ * Nothing renders until at least two headings are found.
21
+ *
22
+ * Clicking a link scrolls to the heading and moves focus to it.
23
+ *
24
+ * @summary In-page navigation that links to page headings and highlights the current section.
25
+ * @element nys-onthispage
26
+ *
27
+ * @fires {NysOnThisPageClickEvent} nys-click - Fired when a link is activated, by mouse or keyboard. Detail: `{id, label, index}`.
28
+ *
29
+ * @usage
30
+ * - Use as a table of contents on lengthy pages to give a structural overview and let users jump to a section.
31
+ * - Use on pages with at least three distinct sections, or content longer than three screen heights.
32
+ * - Keep the link order the same as the order of the section headings on the page.
33
+ * - Use "On this page" as the heading so the nav is clearly labeled and stands apart from other links.
34
+ * - Keep the link text identical to the heading it links to.
35
+ * - Let link text wrap to a second line instead of truncating it.
36
+ * - Clearly show the active link so users can track their position as they scroll or after they click a link.
37
+ * - On desktop, place it in the left sidebar. If vertical navigation is on the left, place it in the right sidebar.
38
+ * - On tablet and mobile, place it above the main content and below the page heading.
39
+ * - Don't use on pages with minimal content or a small number of sections, where scrolling isn't an issue.
40
+ * - Don't use to link to other pages. Use `<nys-verticalnav>` instead.
41
+ * - Don't use for heading levels lower than H3, such as H4, H5, or H6.
42
+ * - Don't shorten, rephrase, or summarize a heading for its link.
43
+ *
44
+ * @example Basic
45
+ * ```html
46
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
47
+ * <nys-onthispage style="flex: 0 0 220px;"></nys-onthispage>
48
+ *
49
+ * <main style="flex: 1; min-width: 0;">
50
+ * <h1>Apply for a permit</h1>
51
+ * <p>Use this guide to find out if you qualify and how to apply.</p>
52
+ *
53
+ * <h2>Eligibility</h2>
54
+ * <p>You must be a New York State resident aged 18 or older.</p>
55
+ * <p>Additional eligibility requirements may apply.</p>
56
+ * <p>Review the requirements before submitting your application.</p>
57
+ *
58
+ * <h2>How to apply</h2>
59
+ * <p>Complete the online form and upload your supporting documents.</p>
60
+ * <p>Make sure all information is accurate before submitting.</p>
61
+ * <p>Keep a copy of your application for your records.</p>
62
+ *
63
+ * <h2>Required documents</h2>
64
+ * <p>Bring a valid proof of identity, proof of address, and any other supporting documentation.</p>
65
+ * <p>Additional documents may be requested during review.</p>
66
+ * <p>Ensure your documents are current and legible.</p>
67
+ *
68
+ * <h2>What happens next</h2>
69
+ * <p>We review applications within 10 business days.</p>
70
+ * <p>You may be contacted if additional information is needed.</p>
71
+ * <p>You will receive a notification when a decision has been made.</p>
72
+ * </main>
73
+ * </div>
74
+ * ```
75
+ *
76
+ * @example Turn off sticky
77
+ * ```html
78
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
79
+ * <nys-onthispage disableSticky offset="24"></nys-onthispage>
80
+ *
81
+ * <main style="flex: 1; min-width: 0;">
82
+ * <h1>Apply for a permit</h1>
83
+ * <p>Use this guide to find out if you qualify and how to apply.</p>
84
+ *
85
+ * <h2>Eligibility</h2>
86
+ * <p>You must be a New York State resident aged 18 or older.</p>
87
+ * <p style="min-height: 60vh;">Review the requirements before submitting your application.</p>
88
+ *
89
+ * <h2>How to apply</h2>
90
+ * <p>Complete the online form and upload your supporting documents.</p>
91
+ * <p style="min-height: 60vh;">Keep a copy of your application for your records.</p>
92
+ *
93
+ * <h2>Required documents</h2>
94
+ * <p>Bring a valid proof of identity, proof of address, and any other supporting documentation.</p>
95
+ * <p style="min-height: 60vh;">Ensure your documents are current and legible.</p>
96
+ *
97
+ * <h2>What happens next</h2>
98
+ * <p>We review applications within 10 business days.</p>
99
+ * <p style="min-height: 60vh;">You will receive a notification when a decision has been made.</p>
100
+ * </main>
101
+ * </div>
102
+ * ```
103
+ *
104
+ * @example Custom heading
105
+ * ```html
106
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
107
+ * <nys-onthispage
108
+ * heading="In this guide"
109
+ * ></nys-onthispage>
110
+ *
111
+ * <main style="flex: 1; min-width: 0;">
112
+ * <h1>Apply for a permit</h1>
113
+ *
114
+ * <h2>Eligibility</h2>
115
+ * <p>You must be a New York State resident aged 18 or older.</p>
116
+ *
117
+ * <h2>How to apply</h2>
118
+ * <p>Complete the online form and upload your supporting documents.</p>
119
+ *
120
+ * <h2>What happens next</h2>
121
+ * <p>We review applications within 10 business days.</p>
122
+ * </main>
123
+ * </div>
124
+ * ```
125
+ *
126
+ * @example Track a different heading level
127
+ * ```html
128
+ * <nys-onthispage headingTracker="h3" scope="#guide"></nys-onthispage>
129
+ *
130
+ * <article id="guide">
131
+ * <h1>Part 1 (h1 tag)</h1>
132
+ * <h2>Part 2 (h2 tag)</h2>
133
+ * <h3>Eligibility (h3 tag)</h3>
134
+ * <h3>How to apply (h3 tag)</h3>
135
+ * </article>
136
+ * ```
137
+ *
138
+ * @example Exclude a heading
139
+ * ```html
140
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
141
+ * <nys-onthispage></nys-onthispage>
142
+ *
143
+ * <main style="flex: 1; min-width: 0;">
144
+ * <h1>Apply for a permit</h1>
145
+ *
146
+ * <h2>Eligibility</h2>
147
+ * <p>You must be a New York State resident aged 18 or older.</p>
148
+ *
149
+ * <h2>How to apply</h2>
150
+ * <p>Complete the online form and upload your supporting documents.</p>
151
+ *
152
+ * <h2 data-nys-onthispage-ignore>Related links</h2>
153
+ * <p>This heading does not appear in the list.</p>
154
+ * </main>
155
+ * </div>
156
+ * ```
157
+ *
158
+ * @example Use your own heading ids
159
+ * ```html
160
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
161
+ * <nys-onthispage style="flex: 0 0 220px;"></nys-onthispage>
162
+ *
163
+ * <main style="flex: 1; min-width: 0;">
164
+ * <h1>Apply for a permit</h1>
165
+ *
166
+ * <h2 id="eligibility">Eligibility</h2>
167
+ * <p>The link uses your id: #eligibility.</p>
168
+ *
169
+ * <h2>How to apply</h2>
170
+ * <p>No id set, so one is generated: #how-to-apply.</p>
171
+ *
172
+ * <h2>How to apply</h2>
173
+ * <p>Same text, so the generated id gets a suffix: #how-to-apply-2.</p>
174
+ * </main>
175
+ * </div>
176
+ * ```
177
+ *
178
+ * @example Update the URL hash
179
+ * ```html
180
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
181
+ * <nys-onthispage
182
+ * hashBehavior="replace"
183
+ * style="flex: 0 0 220px;"
184
+ * ></nys-onthispage>
185
+ *
186
+ * <main style="flex: 1; min-width: 0;">
187
+ * <h1>Apply for a permit</h1>
188
+ *
189
+ * <h2>Eligibility</h2>
190
+ * <p style="min-height: 80vh;">You must be a New York State resident.</p>
191
+ *
192
+ * <h2>How to apply</h2>
193
+ * <p style="min-height: 80vh;">Complete the online form.</p>
194
+ *
195
+ * <h2>What happens next</h2>
196
+ * <p style="min-height: 80vh;">We review applications within 10 business days.</p>
197
+ * </main>
198
+ * </div>
199
+ * ```
200
+ * Clicking a link updates the URL to `#how-to-apply`, for example.
201
+ * `hash` adds a history entry per click, `replace` does not, and `none`
202
+ * (the default) leaves the URL alone.
203
+ *
204
+ * @example Turn off smooth scrolling
205
+ * ```html
206
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
207
+ * <nys-onthispage
208
+ * disableSmoothScroll
209
+ * style="flex: 0 0 220px;"
210
+ * ></nys-onthispage>
211
+ *
212
+ * <main style="flex: 1; min-width: 0;">
213
+ * <h1>Apply for a permit</h1>
214
+ *
215
+ * <h2>Eligibility</h2>
216
+ * <p style="min-height: 80vh;">You must be a New York State resident.</p>
217
+ *
218
+ * <h2>How to apply</h2>
219
+ * <p style="min-height: 80vh;">Complete the online form.</p>
220
+ *
221
+ * <h2>What happens next</h2>
222
+ * <p style="min-height: 80vh;">We review applications within 10 business days.</p>
223
+ * </main>
224
+ * </div>
225
+ * ```
226
+ * Smooth scrolling is also turned off automatically for visitors who have
227
+ * `prefers-reduced-motion` enabled.
228
+ *
229
+ * @example Page layout
230
+ * ```html
231
+ * <nys-unavheader></nys-unavheader>
232
+ *
233
+ * <nys-globalheader appName="NYS Design System" homepageLink="/">
234
+ * <ul>
235
+ * <li><a href="#">Item 1</a></li>
236
+ * <li><a href="#">Item 2</a></li>
237
+ * <li><a href="#">Item 3</a></li>
238
+ * <li><a href="#">Item 4</a></li>
239
+ * <li><a href="#">Item 5</a></li>
240
+ * </ul>
241
+ * </nys-globalheader>
242
+ *
243
+ * <div class="nys-grid-container">
244
+ * <div class="nys-grid-row nys-grid-gap">
245
+ * <main class="nys-desktop:nys-grid-col-9">
246
+ * <h1>Welcome to the Empire State of Mind</h1>
247
+ * <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit? Nope. Here, we say: grab a bagel, check the Erie Canal, and see what the Adirondacks are up to today.</p>
248
+ *
249
+ * <h2>Apple picking season</h2>
250
+ * <p style="min-height: 60vh;">Orchards from the Hudson Valley to the Finger Lakes are open. Bring a basket, a sweater, and a strong opinion about cider donuts. Honeycrisp is the correct answer, but we will hear other opinions.</p>
251
+ *
252
+ * <h2>Pizza by the slice</h2>
253
+ * <p style="min-height: 60vh;">Fold it. Do not eat it with a fork. A proper slice is hot, floppy, and cheaper than your parking meter. Every borough believes theirs is the best, and every borough is slightly right.</p>
254
+ *
255
+ * <h2>Road trip to Niagara Falls</h2>
256
+ * <p style="min-height: 60vh;">Pack snacks and head west on the Thruway. Rest stops are plentiful, the falls are loud, and the mist is free. Bring a poncho if you plan to get close.</p>
257
+ *
258
+ * <h2>Snow day survival guide</h2>
259
+ * <p style="min-height: 60vh;">Upstate gets a lot of snow, and Upstate is not impressed. Shovel early, check on your neighbors, and keep the hot chocolate within reach.</p>
260
+ * </main>
261
+ *
262
+ * <aside class="nys-desktop:nys-grid-col-3 nys-order-first nys-desktop:nys-order-last" style="margin-top: var(--nys-space-600)">
263
+ * <nys-onthispage offset="24"></nys-onthispage>
264
+ * </aside>
265
+ * </div>
266
+ * </div>
267
+ *
268
+ * <nys-globalfooter agencyName="NYS Design System" homepageLink="/">
269
+ * <ul>
270
+ * <li><a href="#">Privacy Policy</a></li>
271
+ * <li><a href="#">Terms of Use</a></li>
272
+ * </ul>
273
+ * </nys-globalfooter>
274
+ * <nys-unavfooter></nys-unavfooter>
275
+ * ```
276
+ * On mobile and tablet, the nav sits above the content. On desktop, this
277
+ * example puts it in the right column, but it can go on the left too.
278
+ *
279
+ * In your HTML, put `main` before the `aside` so screen readers read the
280
+ * content first. Then use order classes on the `aside` to change where it
281
+ * shows up on screen:
282
+ * - `nys-order-first` puts the nav on top for mobile and tablet.
283
+ * - `nys-desktop:nys-order-last` moves it to the right on desktop. Leave this
284
+ * class off to keep it on the left.
285
+ *
286
+ * The grid classes set the widths. Here, `main` uses
287
+ * `nys-desktop:nys-grid-col-9` and the `aside` uses
288
+ * `nys-desktop:nys-grid-col-3`. See the grid utility docs for more.
289
+ *
290
+ * @example Listen for link activation
291
+ * ```html
292
+ * <div style="display: flex; gap: 2rem; align-items: flex-start;">
293
+ * <nys-onthispage id="toc" style="flex: 0 0 220px;"></nys-onthispage>
294
+ *
295
+ * <main style="flex: 1; min-width: 0;">
296
+ * <h1>Apply for a permit</h1>
297
+ *
298
+ * <h2>Eligibility</h2>
299
+ * <p>You must be a New York State resident aged 18 or older.</p>
300
+ *
301
+ * <h2>How to apply</h2>
302
+ * <p>Complete the online form and upload your supporting documents.</p>
303
+ *
304
+ * <h2>What happens next</h2>
305
+ * <p>We review applications within 10 business days.</p>
306
+ * </main>
307
+ * </div>
308
+ *
309
+ * <script>
310
+ * document.querySelector("#toc").addEventListener("nys-click", (e) => {
311
+ * const { id, label, index } = e.detail;
312
+ * console.log(`Clicked "${label}" (#${id}, position ${index})`);
313
+ * });
314
+ * </script>
315
+ * ```
316
+ * For example, clicking "How to apply" logs: `Clicked "How to apply" (#how-to-apply, position 1)`.
317
+ */
318
+ export declare class NysOnthispage extends NysElement {
319
+ static styles: import("lit").CSSResult;
320
+ /** Unique identifier. Auto-generated by the shared base if not provided. */
321
+ id: string;
322
+ /** Heading level to track and link. `h1` is excluded.
323
+ * @default "h2"
324
+ */
325
+ headingTracker: HeadingTag;
326
+ /** Nav heading text.
327
+ * @default "On this page"
328
+ */
329
+ heading: string;
330
+ /** CSS selector for the container whose headings are tracked.
331
+ * @default "main"
332
+ */
333
+ scope: string;
334
+ /**
335
+ * Turns off the sticky behavior, so the nav scrolls with the page.
336
+ * Sticky only applies on viewports 480px wide or larger.
337
+ * @default false
338
+ */
339
+ disableSticky: boolean;
340
+ /**
341
+ * Distance (px) from the viewport top to the trigger line. Also sets
342
+ * `scroll-margin-top` on tracked headings and the sticky `top` value.
343
+ * @default 80
344
+ */
345
+ offset: number;
346
+ /** Turns off smooth scrolling. Already off for visitors with `prefers-reduced-motion`.
347
+ * @default false
348
+ */
349
+ disableSmoothScroll: boolean;
350
+ /** `hash` pushes history, `replace` updates the URL silently, `none` leaves it alone.
351
+ * @default "none"
352
+ */
353
+ hashBehavior: HashBehavior;
354
+ private _items;
355
+ private _activeId;
356
+ private _observer?;
357
+ private _scrollFrame;
358
+ private _rebuildFrame;
359
+ /** True while a link-click scroll is in flight, so scroll events don't override the clicked link. */
360
+ private _holdingActive;
361
+ private _holdTimer;
362
+ /**
363
+ * Lifecycle methods
364
+ * --------------------------------------------------------------------------
365
+ * Automatic id generation is provided by NysElement (@nysds/internals).
366
+ */
367
+ connectedCallback(): void;
368
+ disconnectedCallback(): void;
369
+ /**
370
+ * Derive state BEFORE rendering.
371
+ *
372
+ * Anything computed from another property — a `@state`, a formatted label, a
373
+ * filtered list — belongs here. Setting a reactive property in `updated()`
374
+ * lands after the render finished, so Lit has to schedule a second one and
375
+ * warns about it (see https://lit.dev/msg/change-in-update).
376
+ *
377
+ * Reserve `updated()` for work that needs the rendered DOM: measuring
378
+ * layout, syncing a native element, or `ElementInternals` calls.
379
+ */
380
+ willUpdate(changeProperties: Map<string | number | symbol, unknown>): void;
381
+ /**
382
+ * Functions
383
+ * --------------------------------------------------------------------------
384
+ */
385
+ private _getScope;
386
+ /**
387
+ * Checks if the header element is trackable:
388
+ * Meaning the element doesn't contain hidden data attribute, or is hidden, or is inside an accordion.
389
+ * Visibility must be true.
390
+ *
391
+ * @returns {boolean} True if the element is trackable
392
+ */
393
+ private _isTrackable;
394
+ private _scheduleRebuild;
395
+ private _slugify;
396
+ private _applyScrollMargin;
397
+ /***
398
+ * Collects the headings, assigns ids where missing, and updates state if changed.
399
+ * Rebuilds the content in this function.
400
+ */
401
+ private _rebuild;
402
+ /**
403
+ * Active item = the last tracked heading with the top edge at or above the trigger line. Not "nearest to top" since that would flicker at the boundaries
404
+ */
405
+ private _computeActive;
406
+ /**
407
+ * Keeps the clicked link active until scrolling has been idle for 150ms.
408
+ */
409
+ private _holdActive;
410
+ private _onScroll;
411
+ /**
412
+ * Event Handlers
413
+ * --------------------------------------------------------------------------
414
+ */
415
+ private _handleClick;
416
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
417
+ }
418
+ export {};