@nysds/components 1.19.2 → 1.20.0-alpha1

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.
@@ -162,6 +162,7 @@ export declare class NysButton extends LitElement {
162
162
  private _internals;
163
163
  private _hasPrefixSlot;
164
164
  private _hasSuffixSlot;
165
+ private _hasCircleSlot;
165
166
  /**
166
167
  * Lifecycle methods
167
168
  * --------------------------------------------------------------------------
@@ -176,6 +177,7 @@ export declare class NysButton extends LitElement {
176
177
  private _generateUniqueId;
177
178
  private _onPrefixSlotChange;
178
179
  private _onSuffixSlotChange;
180
+ private _onCircleSlotChange;
179
181
  private _manageFormAction;
180
182
  /**
181
183
  * Event Handlers
@@ -0,0 +1,2 @@
1
+ export * from "./nys-verticalnav";
2
+ export * from "./nys-verticalnavgroup";
@@ -0,0 +1,188 @@
1
+ import { LitElement } from "lit";
2
+ import "./nys-verticalnavgroup";
3
+ type HeaderLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
4
+ /**
5
+ * Vertical navigation component with responsive desktop/mobile behavior.
6
+ *
7
+ * Renders as a side vertical navigation with heading and slotted link list on desktop. On tablet/mobile
8
+ * it collapses into a `<nys-accordion>`. The default slot accepts a
9
+ * `<ul>` of links; subheader `<li>` items (containing `<h2>`-`<h6>`). Use the `header` slot to replace the
10
+ * auto-generated heading, and the `footer` slot for metadata or extra actions
11
+ * below the link list.
12
+ *
13
+ * @summary Responsive vertical navigation — nav on desktop, accordion on mobile.
14
+ * @element nys-verticalnav
15
+ *
16
+ * @example Basic usage
17
+ * ```html
18
+ * <nys-verticalnav header="Freshwater Fishing" headerLevel="h2">
19
+ * <ul>
20
+ * <li><a href="/">Home</a></li>
21
+ * <li><a href="/services">Services</a></li>
22
+ * <li>
23
+ * <h3>Freshwater Fishing Regulations</h3>
24
+ * <ul>
25
+ * <li><a href="">Places to Fish</a></li>
26
+ * <li><a href="">Learn to Fish</a></li>
27
+ * <li><a href="">Ice Fishing</a></li>
28
+ * </ul>
29
+ * </li>
30
+ * </ul>
31
+ * </nys-verticalnav>
32
+ * ```
33
+ *
34
+ * @example With custom header slot
35
+ * ```html
36
+ * <nys-verticalnav header="Freshwater Fishing" headerLevel="h2">
37
+ * <div slot="header">
38
+ * <h2>Freshwater Fishing</h2>
39
+ * <p>2026 Season Open</p>
40
+ * </div>
41
+ * <ul>
42
+ * <li><a href="/">Home</a></li>
43
+ * <li><a href="/services">Services</a></li>
44
+ * <li>
45
+ * <h3>Freshwater Fishing Regulations</h3>
46
+ * <ul>
47
+ * <li><a href="">Places to Fish</a></li>
48
+ * <li><a href="">Learn to Fish</a></li>
49
+ * <li><a href="">Ice Fishing</a></li>
50
+ * </ul>
51
+ * </li>
52
+ * </ul>
53
+ * </nys-verticalnav>
54
+ * ```
55
+ *
56
+ * @example With footer slot
57
+ * ```html
58
+ * <nys-verticalnav header="Freshwater Fishing" headerLevel="h2">
59
+ * <ul>
60
+ * <li><a href="/">Home</a></li>
61
+ * <li><a href="/services">Services</a></li>
62
+ * <li>
63
+ * <h3>Freshwater Fishing Regulations</h3>
64
+ * <ul>
65
+ * <li><a href="">Places to Fish</a></li>
66
+ * <li><a href="">Learn to Fish</a></li>
67
+ * <li><a href="">Ice Fishing</a></li>
68
+ * </ul>
69
+ * </li>
70
+ * </ul>
71
+ * <div slot="footer">
72
+ * <nys-divider></nys-divider>
73
+ * <p>Regulations last updated: January 2026</p>
74
+ * <a href="/contact-dec">Contact the DEC for fishing inquiries</a>
75
+ * </div>
76
+ * </nys-verticalnav>
77
+ * ```
78
+ *
79
+ * @example With dropdown group
80
+ * ```html
81
+ * <nys-verticalnav header="NYS Design System" headerLevel="h2">
82
+ * <ul>
83
+ * <li><a href="/">Foundations</a></li>
84
+ * <li><a href="/components">Components</a></li>
85
+ * <li>
86
+ * <nys-verticalnavgroup label="Accessibility">
87
+ * <ul>
88
+ * <li><a href="">WCAG Guidelines</a></li>
89
+ * <li><a href="">Screen Readers</a></li>
90
+ * <li><a href="">Color Contrast</a></li>
91
+ * </ul>
92
+ * </nys-verticalnavgroup>
93
+ * </li>
94
+ * <li>
95
+ * <h3>Resources</h3>
96
+ * <ul>
97
+ * <li><a href="">Design Tokens</a></li>
98
+ * <li><a href="">Utilities</a></li>
99
+ * </ul>
100
+ * </li>
101
+ * </ul>
102
+ * </nys-verticalnav>
103
+ * ```
104
+ *
105
+ * @example With active link (aria-current="page")
106
+ * ```html
107
+ * <nys-verticalnav header="NYS Design System" headerLevel="h2">
108
+ * <ul>
109
+ * <li><a href="/">Foundations</a></li>
110
+ * <li><a href="/components">Components</a></li>
111
+ * <li>
112
+ * <nys-verticalnavgroup label="Accessibility">
113
+ * <ul>
114
+ * <li><a aria-current="page" href="">WCAG Guidelines</a></li>
115
+ * <li><a href="">Screen Readers</a></li>
116
+ * <li><a href="">Color Contrast</a></li>
117
+ * </ul>
118
+ * </nys-verticalnavgroup>
119
+ * </li>
120
+ * </ul>
121
+ * </nys-verticalnav>
122
+ * ```
123
+ *
124
+ * @example With disabled links and group
125
+ * ```html
126
+ * <nys-verticalnav header="NYS Design System" headerLevel="h2">
127
+ * <ul>
128
+ * <li><a href="/">Foundations</a></li>
129
+ * <li>
130
+ * <nys-verticalnavgroup disabled label="Accessibility">
131
+ * <ul>
132
+ * <li><a aria-disabled="true">WCAG Guidelines</a></li>
133
+ * <li><a href="">Screen Readers</a></li>
134
+ * </ul>
135
+ * </nys-verticalnavgroup>
136
+ * </li>
137
+ * <li>
138
+ * <h3>Resources</h3>
139
+ * <ul>
140
+ * <li><a aria-disabled="true">Design Tokens</a></li>
141
+ * <li><a href="">Utilities</a></li>
142
+ * </ul>
143
+ * </li>
144
+ * </ul>
145
+ * </nys-verticalnav>
146
+ * ```
147
+ *
148
+ * @example Hidden header (aria-label used instead)
149
+ * ```html
150
+ * <nys-verticalnav header="Section nav" hideHeader>
151
+ * <ul>
152
+ * <li><a href="/home">Home</a></li>
153
+ * </ul>
154
+ * </nys-verticalnav>
155
+ * ```
156
+ */
157
+ export declare class NysVerticalnav extends LitElement {
158
+ static styles: import("lit").CSSResult;
159
+ id: string;
160
+ header: string;
161
+ hideHeader: boolean;
162
+ headerLevel: HeaderLevel;
163
+ private _isMobile;
164
+ private _mediaQuery;
165
+ /**
166
+ * Lifecycle methods
167
+ * --------------------------------------------------------------------------
168
+ */
169
+ constructor();
170
+ connectedCallback(): void;
171
+ disconnectedCallback(): void;
172
+ firstUpdated(): void;
173
+ /**
174
+ * Functions
175
+ * --------------------------------------------------------------------------
176
+ */
177
+ private _handleResize;
178
+ private _applyActiveState;
179
+ /**
180
+ * Helper Render Functions
181
+ * --------------------------------------------------------------------------
182
+ */
183
+ private _renderHeader;
184
+ private renderContentDesktop;
185
+ private renderContentMobile;
186
+ render(): import("lit-html").TemplateResult<1>;
187
+ }
188
+ export {};
@@ -0,0 +1,74 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * Collapsible dropdown group for use inside `<nys-verticalnav>`.
4
+ *
5
+ * Renders a toggle button and an expandable panel for a nested `<ul>` of links.
6
+ * Designed to be placed as a direct child of a `<li>` inside the vertical nav's
7
+ * default slot. Use `expanded` to open it by default, and `disabled` to prevent
8
+ * interaction. Set `aria-current="page"` on an `<a>` inside to automatically
9
+ * expand the group and apply the active state.
10
+ *
11
+ * @summary Collapsible link group for use within `<nys-verticalnav>`.
12
+ * @element nys-verticalnavgroup
13
+ *
14
+ * @example Basic usage
15
+ * ```html
16
+ * <nys-verticalnav header="NYS Design System">
17
+ * <ul>
18
+ * <li><a href="/foundations">Foundations</a></li>
19
+ * <li>
20
+ * <nys-verticalnavgroup label="Accessibility">
21
+ * <ul>
22
+ * <li><a href="">WCAG Guidelines</a></li>
23
+ * <li><a href="">Screen Readers</a></li>
24
+ * <li><a href="">Color Contrast</a></li>
25
+ * </ul>
26
+ * </nys-verticalnavgroup>
27
+ * </li>
28
+ * </ul>
29
+ * </nys-verticalnav>
30
+ * ```
31
+ *
32
+ * @example With active link — group auto-expands
33
+ * ```html
34
+ * <nys-verticalnavgroup label="Accessibility">
35
+ * <ul>
36
+ * <li><a aria-current="page" href="">WCAG Guidelines</a></li>
37
+ * <li><a href="">Screen Readers</a></li>
38
+ * <li><a href="">Color Contrast</a></li>
39
+ * </ul>
40
+ * </nys-verticalnavgroup>
41
+ * ```
42
+ *
43
+ * @example Expanded by default
44
+ * ```html
45
+ * <nys-verticalnavgroup label="Resources" expanded>
46
+ * <ul>
47
+ * <li><a href="">Design Tokens</a></li>
48
+ * <li><a href="">Utilities</a></li>
49
+ * </ul>
50
+ * </nys-verticalnavgroup>
51
+ * ```
52
+ *
53
+ * @example Disabled group with disabled links
54
+ * ```html
55
+ * <nys-verticalnavgroup disabled label="Accessibility">
56
+ * <ul>
57
+ * <li><a aria-disabled="true">WCAG Guidelines</a></li>
58
+ * <li><a href="">Screen Readers</a></li>
59
+ * <li><a href="">Color Contrast</a></li>
60
+ * </ul>
61
+ * </nys-verticalnavgroup>
62
+ * ```
63
+ */
64
+ export declare class NysVerticalnavGroup extends LitElement {
65
+ static styles: import("lit").CSSResult;
66
+ id: string;
67
+ label: string;
68
+ expanded: boolean;
69
+ disabled: boolean;
70
+ active: boolean;
71
+ connectedCallback(): void;
72
+ private _toggle;
73
+ render(): import("lit-html").TemplateResult<1>;
74
+ }
@@ -30,4 +30,5 @@ export * from "../packages/nys-unavheader/src/index";
30
30
  export * from "../packages/nys-globalheader/src/index";
31
31
  export * from "../packages/nys-globalfooter/src/index";
32
32
  export * from "../packages/nys-unavfooter/src/index";
33
+ export * from "../packages/nys-verticalnav/src/index";
33
34
  export * from "../packages/nys-video/src/index";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/components",
3
- "version": "1.19.2",
3
+ "version": "1.20.0-alpha1",
4
4
  "description": "New York State's design system and code component library.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -0,0 +1,60 @@
1
+ import React from "react";
2
+ import { NysVerticalnav as NysVerticalnavElement } from "../../dist/nysds.es.js";
3
+
4
+ export type { NysVerticalnavElement };
5
+
6
+ export interface NysVerticalnavProps extends Pick<
7
+ React.AllHTMLAttributes<HTMLElement>,
8
+ | "children"
9
+ | "dir"
10
+ | "hidden"
11
+ | "id"
12
+ | "lang"
13
+ | "slot"
14
+ | "style"
15
+ | "title"
16
+ | "translate"
17
+ | "onClick"
18
+ | "onFocus"
19
+ | "onBlur"
20
+ > {
21
+ /** undefined */
22
+ hideHeader?: boolean;
23
+
24
+ /** undefined */
25
+ id?: NysVerticalnavElement["id"];
26
+
27
+ /** undefined */
28
+ header?: NysVerticalnavElement["header"];
29
+
30
+ /** undefined */
31
+ headerLevel?: NysVerticalnavElement["headerLevel"];
32
+
33
+ /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
34
+ className?: string;
35
+
36
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
37
+ exportparts?: string;
38
+
39
+ /** Used for labels to link them with their inputs (using input id). */
40
+ htmlFor?: string;
41
+
42
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
43
+ key?: number | string;
44
+
45
+ /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
46
+ part?: string;
47
+
48
+ /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
49
+ ref?: any;
50
+
51
+ /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
52
+ tabIndex?: number;
53
+ }
54
+
55
+ /**
56
+ * Responsive vertical navigation — nav on desktop, accordion on mobile.
57
+ * ---
58
+ *
59
+ */
60
+ export const NysVerticalnav: React.ForwardRefExoticComponent<NysVerticalnavProps>;
@@ -0,0 +1,24 @@
1
+ import React, { forwardRef } from "react";
2
+ import "../../dist/nysds.es.js";
3
+
4
+ export const NysVerticalnav = forwardRef((props, forwardedRef) => {
5
+ const { hideHeader, id, header, headerLevel, ...filteredProps } = props;
6
+
7
+ return React.createElement(
8
+ "nys-verticalnav",
9
+ {
10
+ ...filteredProps,
11
+ id: props.id,
12
+ header: props.header,
13
+ headerLevel: props.headerLevel,
14
+ class: props.className,
15
+ exportparts: props.exportparts,
16
+ for: props.htmlFor,
17
+ part: props.part,
18
+ tabindex: props.tabIndex,
19
+ hideHeader: props.hideHeader ? true : undefined,
20
+ style: { ...props.style },
21
+ },
22
+ props.children,
23
+ );
24
+ });
@@ -0,0 +1,72 @@
1
+ import React from "react";
2
+ import {
3
+ NysVerticalnavGroup as NysVerticalnavGroupElement,
4
+ CustomEvent,
5
+ } from "../../dist/nysds.es.js";
6
+
7
+ export type { NysVerticalnavGroupElement, CustomEvent };
8
+
9
+ export interface NysVerticalnavGroupProps extends Pick<
10
+ React.AllHTMLAttributes<HTMLElement>,
11
+ | "children"
12
+ | "dir"
13
+ | "hidden"
14
+ | "id"
15
+ | "lang"
16
+ | "slot"
17
+ | "style"
18
+ | "title"
19
+ | "translate"
20
+ | "onClick"
21
+ | "onFocus"
22
+ | "onBlur"
23
+ > {
24
+ /** undefined */
25
+ expanded?: boolean;
26
+
27
+ /** undefined */
28
+ disabled?: boolean;
29
+
30
+ /** undefined */
31
+ active?: boolean;
32
+
33
+ /** undefined */
34
+ id?: NysVerticalnavGroupElement["id"];
35
+
36
+ /** undefined */
37
+ label?: NysVerticalnavGroupElement["label"];
38
+
39
+ /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
40
+ className?: string;
41
+
42
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
43
+ exportparts?: string;
44
+
45
+ /** Used for labels to link them with their inputs (using input id). */
46
+ htmlFor?: string;
47
+
48
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
49
+ key?: number | string;
50
+
51
+ /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
52
+ part?: string;
53
+
54
+ /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
55
+ ref?: any;
56
+
57
+ /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
58
+ tabIndex?: number;
59
+
60
+ /** undefined */
61
+ onNysChildResize?: (event: CustomEvent) => void;
62
+ }
63
+
64
+ /**
65
+ * Collapsible link group for use within `<nys-verticalnav>`.
66
+ * ---
67
+ *
68
+ *
69
+ * ### **Events:**
70
+ * - **nys-child-resize**
71
+ */
72
+ export const NysVerticalnavGroup: React.ForwardRefExoticComponent<NysVerticalnavGroupProps>;
@@ -0,0 +1,38 @@
1
+ import React, { forwardRef, useRef, useEffect } from "react";
2
+ import "../../dist/nysds.es.js";
3
+ import { useEventListener } from "./react-utils.js";
4
+
5
+ export const NysVerticalnavGroup = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
7
+ const { expanded, disabled, active, id, label, ...filteredProps } = props;
8
+
9
+ /** Event listeners - run once */
10
+ useEventListener(ref, "nys-child-resize", props.onNysChildResize);
11
+
12
+ return React.createElement(
13
+ "nys-verticalnavgroup",
14
+ {
15
+ ref: (node) => {
16
+ ref.current = node;
17
+ if (typeof forwardedRef === "function") {
18
+ forwardedRef(node);
19
+ } else if (forwardedRef) {
20
+ forwardedRef.current = node;
21
+ }
22
+ },
23
+ ...filteredProps,
24
+ id: props.id,
25
+ label: props.label,
26
+ class: props.className,
27
+ exportparts: props.exportparts,
28
+ for: props.htmlFor,
29
+ part: props.part,
30
+ tabindex: props.tabIndex,
31
+ expanded: props.expanded ? true : undefined,
32
+ disabled: props.disabled ? true : undefined,
33
+ active: props.active ? true : undefined,
34
+ style: { ...props.style },
35
+ },
36
+ props.children,
37
+ );
38
+ });
@@ -39,4 +39,6 @@ export * from "./NysToggle.js";
39
39
  export * from "./NysTooltip.js";
40
40
  export * from "./NysUnavFooter.js";
41
41
  export * from "./NysUnavHeader.js";
42
+ export * from "./NysVerticalnav.js";
43
+ export * from "./NysVerticalnavGroup.js";
42
44
  export * from "./NysVideo.js";
@@ -39,4 +39,6 @@ export * from "./NysToggle.js";
39
39
  export * from "./NysTooltip.js";
40
40
  export * from "./NysUnavFooter.js";
41
41
  export * from "./NysUnavHeader.js";
42
+ export * from "./NysVerticalnav.js";
43
+ export * from "./NysVerticalnavGroup.js";
42
44
  export * from "./NysVideo.js";
@@ -1021,6 +1021,33 @@ export type NysUnavHeaderProps = {
1021
1021
  languages?: Language[];
1022
1022
  };
1023
1023
 
1024
+ export type NysVerticalnavProps = {
1025
+ /** */
1026
+ id?: string;
1027
+ /** */
1028
+ header?: string;
1029
+ /** */
1030
+ hideHeader?: boolean;
1031
+ /** */
1032
+ headerLevel?: HeaderLevel;
1033
+ };
1034
+
1035
+ export type NysVerticalnavGroupProps = {
1036
+ /** */
1037
+ id?: string;
1038
+ /** */
1039
+ label?: string;
1040
+ /** */
1041
+ expanded?: boolean;
1042
+ /** */
1043
+ disabled?: boolean;
1044
+ /** */
1045
+ active?: boolean;
1046
+
1047
+ /** */
1048
+ "onnys-child-resize"?: (e: CustomEvent<CustomEvent>) => void;
1049
+ };
1050
+
1024
1051
  export type NysVideoProps = {
1025
1052
  /** Full YouTube URL — required. Component will not render if invalid. */
1026
1053
  id?: string;
@@ -1602,6 +1629,23 @@ export type CustomElements = {
1602
1629
  */
1603
1630
  "nys-unavheader": Partial<NysUnavHeaderProps & BaseProps & BaseEvents>;
1604
1631
 
1632
+ /**
1633
+ * Responsive vertical navigation — nav on desktop, accordion on mobile.
1634
+ * ---
1635
+ *
1636
+ */
1637
+ "nys-verticalnav": Partial<NysVerticalnavProps & BaseProps & BaseEvents>;
1638
+
1639
+ /**
1640
+ * Collapsible link group for use within `<nys-verticalnav>`.
1641
+ * ---
1642
+ *
1643
+ *
1644
+ * ### **Events:**
1645
+ * - **nys-child-resize**
1646
+ */
1647
+ "nys-verticalnavgroup": Partial<NysVerticalnavGroupProps & BaseProps & BaseEvents>;
1648
+
1605
1649
  /**
1606
1650
  * YouTube video player with thumbnail preview and accessibility announcements.
1607
1651
  * ---