@nysds/components 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +543 -52
- package/dist/.vscode/vscode.html-custom-data.json +62 -9
- package/dist/custom-elements.json +543 -52
- package/dist/nysds.es.js +2030 -1773
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +172 -168
- package/dist/nysds.js.map +1 -1
- package/dist/packages/nys-breadcrumbs/src/index.d.ts +1 -0
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +119 -0
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.figma.d.ts +1 -0
- package/dist/packages/nys-button/src/nys-button.d.ts +2 -2
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +8 -0
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +6 -0
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +3 -1
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +2 -2
- package/dist/packages/nys-label/src/nys-label.d.ts +9 -6
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +1 -1
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +2 -1
- package/dist/packages/nys-video/src/nys-video.d.ts +25 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +11 -10
- package/packages/react/NysBreadcrumbItem.d.ts +72 -0
- package/packages/react/NysBreadcrumbItem.js +42 -0
- package/packages/react/NysBreadcrumbs.d.ts +89 -0
- package/packages/react/NysBreadcrumbs.js +50 -0
- package/packages/react/NysButton.d.ts +2 -2
- package/packages/react/NysDatepicker.d.ts +6 -0
- package/packages/react/NysDatepicker.js +4 -0
- package/packages/react/NysErrorMessage.d.ts +3 -0
- package/packages/react/NysErrorMessage.js +2 -1
- package/packages/react/NysLabel.d.ts +16 -4
- package/packages/react/NysLabel.js +17 -3
- package/packages/react/NysVideo.d.ts +7 -1
- package/packages/react/NysVideo.js +14 -1
- package/packages/react/index.d.ts +1 -0
- package/packages/react/index.js +1 -0
- package/packages/react/nysds-jsx.d.ts +63 -5
|
@@ -51,10 +51,10 @@ export interface NysButtonProps extends Pick<
|
|
|
51
51
|
/** ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`. */
|
|
52
52
|
ariaControls?: NysButtonElement["ariaControls"];
|
|
53
53
|
|
|
54
|
-
/** Material Symbol icon before label. Not shown for `
|
|
54
|
+
/** Material Symbol icon before label. Not shown for `circle` mode. */
|
|
55
55
|
prefixIcon?: NysButtonElement["prefixIcon"];
|
|
56
56
|
|
|
57
|
-
/** Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `
|
|
57
|
+
/** Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `circle` mode. */
|
|
58
58
|
suffixIcon?: NysButtonElement["suffixIcon"];
|
|
59
59
|
|
|
60
60
|
/** Icon for circle mode. Required when `circle` is true. Scales with size (sm=24px, md=32px, lg=40px). */
|
|
@@ -73,6 +73,12 @@ export interface NysDatepickerProps extends Pick<
|
|
|
73
73
|
/** Initial date when calendar opens (YYYY-MM-DD). */
|
|
74
74
|
startDate?: NysDatepickerElement["startDate"];
|
|
75
75
|
|
|
76
|
+
/** The earliest selectable date (YYYY-MM-DD). */
|
|
77
|
+
minDate?: NysDatepickerElement["minDate"];
|
|
78
|
+
|
|
79
|
+
/** The latest selectable date (YYYY-MM-DD). */
|
|
80
|
+
maxDate?: NysDatepickerElement["maxDate"];
|
|
81
|
+
|
|
76
82
|
/** Selected date. Accepts Date object or ISO string (YYYY-MM-DD). */
|
|
77
83
|
value?: NysDatepickerElement["value"];
|
|
78
84
|
|
|
@@ -22,6 +22,8 @@ export const NysDatepicker = forwardRef((props, forwardedRef) => {
|
|
|
22
22
|
label,
|
|
23
23
|
description,
|
|
24
24
|
startDate,
|
|
25
|
+
minDate,
|
|
26
|
+
maxDate,
|
|
25
27
|
value,
|
|
26
28
|
...filteredProps
|
|
27
29
|
} = props;
|
|
@@ -52,6 +54,8 @@ export const NysDatepicker = forwardRef((props, forwardedRef) => {
|
|
|
52
54
|
label: props.label,
|
|
53
55
|
description: props.description,
|
|
54
56
|
startDate: props.startDate,
|
|
57
|
+
minDate: props.minDate,
|
|
58
|
+
maxDate: props.maxDate,
|
|
55
59
|
value: props.value,
|
|
56
60
|
class: props.className,
|
|
57
61
|
exportparts: props.exportparts,
|
|
@@ -24,6 +24,9 @@ export interface NysErrorMessageProps extends Pick<
|
|
|
24
24
|
/** Shows a divider line above the error message. */
|
|
25
25
|
showDivider?: boolean;
|
|
26
26
|
|
|
27
|
+
/** The "id" of the error message. */
|
|
28
|
+
id?: NysErrorMessageElement["id"];
|
|
29
|
+
|
|
27
30
|
/** Error text to display. Falls back to native validation message if available. */
|
|
28
31
|
errorMessage?: NysErrorMessageElement["errorMessage"];
|
|
29
32
|
|
|
@@ -2,12 +2,13 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import "../../dist/nysds.es.js";
|
|
3
3
|
|
|
4
4
|
export const NysErrorMessage = forwardRef((props, forwardedRef) => {
|
|
5
|
-
const { showError, showDivider, errorMessage, ...filteredProps } = props;
|
|
5
|
+
const { showError, showDivider, id, errorMessage, ...filteredProps } = props;
|
|
6
6
|
|
|
7
7
|
return React.createElement(
|
|
8
8
|
"nys-errormessage",
|
|
9
9
|
{
|
|
10
10
|
...filteredProps,
|
|
11
|
+
id: props.id,
|
|
11
12
|
errorMessage: props.errorMessage,
|
|
12
13
|
class: props.className,
|
|
13
14
|
exportparts: props.exportparts,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
NysLabel as NysLabelElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../../dist/nysds.es.js";
|
|
3
6
|
|
|
4
|
-
export type { NysLabelElement };
|
|
7
|
+
export type { NysLabelElement, CustomEvent };
|
|
5
8
|
|
|
6
9
|
export interface NysLabelProps extends Pick<
|
|
7
10
|
React.AllHTMLAttributes<HTMLElement>,
|
|
@@ -21,8 +24,8 @@ export interface NysLabelProps extends Pick<
|
|
|
21
24
|
/** Adjusts colors for dark backgrounds. */
|
|
22
25
|
inverted?: boolean;
|
|
23
26
|
|
|
24
|
-
/** ID of the
|
|
25
|
-
|
|
27
|
+
/** The ID of the label. */
|
|
28
|
+
id?: NysLabelElement["id"];
|
|
26
29
|
|
|
27
30
|
/** Label text displayed above the form field. */
|
|
28
31
|
label?: NysLabelElement["label"];
|
|
@@ -42,6 +45,9 @@ export interface NysLabelProps extends Pick<
|
|
|
42
45
|
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
43
46
|
exportparts?: string;
|
|
44
47
|
|
|
48
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
49
|
+
htmlFor?: string;
|
|
50
|
+
|
|
45
51
|
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
46
52
|
key?: number | string;
|
|
47
53
|
|
|
@@ -53,6 +59,9 @@ export interface NysLabelProps extends Pick<
|
|
|
53
59
|
|
|
54
60
|
/** 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. */
|
|
55
61
|
tabIndex?: number;
|
|
62
|
+
|
|
63
|
+
/** undefined */
|
|
64
|
+
onNysLabelClick?: (event: CustomEvent) => void;
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
/**
|
|
@@ -60,6 +69,9 @@ export interface NysLabelProps extends Pick<
|
|
|
60
69
|
* ---
|
|
61
70
|
*
|
|
62
71
|
*
|
|
72
|
+
* ### **Events:**
|
|
73
|
+
* - **nys-label-click**
|
|
74
|
+
*
|
|
63
75
|
* ### **Slots:**
|
|
64
76
|
* - **description** - Custom HTML description content below the label.
|
|
65
77
|
*/
|
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
2
|
import "../../dist/nysds.es.js";
|
|
3
|
+
import { useEventListener } from "./react-utils.js";
|
|
3
4
|
|
|
4
5
|
export const NysLabel = forwardRef((props, forwardedRef) => {
|
|
5
|
-
const
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const { inverted, id, label, description, flag, tooltip, ...filteredProps } =
|
|
6
8
|
props;
|
|
7
9
|
|
|
10
|
+
/** Event listeners - run once */
|
|
11
|
+
useEventListener(ref, "nys-label-click", props.onNysLabelClick);
|
|
12
|
+
|
|
8
13
|
return React.createElement(
|
|
9
14
|
"nys-label",
|
|
10
15
|
{
|
|
16
|
+
ref: (node) => {
|
|
17
|
+
ref.current = node;
|
|
18
|
+
if (typeof forwardedRef === "function") {
|
|
19
|
+
forwardedRef(node);
|
|
20
|
+
} else if (forwardedRef) {
|
|
21
|
+
forwardedRef.current = node;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
11
24
|
...filteredProps,
|
|
12
|
-
|
|
25
|
+
id: props.id,
|
|
13
26
|
label: props.label,
|
|
14
27
|
description: props.description,
|
|
15
28
|
flag: props.flag,
|
|
16
29
|
tooltip: props.tooltip,
|
|
17
30
|
class: props.className,
|
|
18
31
|
exportparts: props.exportparts,
|
|
32
|
+
for: props.htmlFor,
|
|
19
33
|
part: props.part,
|
|
20
34
|
tabindex: props.tabIndex,
|
|
21
35
|
inverted: props.inverted ? true : undefined,
|
|
@@ -67,11 +67,17 @@ Falls back to YouTube's auto-generated thumbnail if not provided. */
|
|
|
67
67
|
|
|
68
68
|
/** 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. */
|
|
69
69
|
tabIndex?: number;
|
|
70
|
+
|
|
71
|
+
/** Fired when the user clicks the thumbnail to load the player. */
|
|
72
|
+
onNysVideoPlay?: (event: CustomEvent) => void;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
/**
|
|
73
|
-
*
|
|
76
|
+
* YouTube video player with thumbnail preview and accessibility announcements.
|
|
74
77
|
* ---
|
|
75
78
|
*
|
|
79
|
+
*
|
|
80
|
+
* ### **Events:**
|
|
81
|
+
* - **nys-video-play** - Fired when the user clicks the thumbnail to load the player.
|
|
76
82
|
*/
|
|
77
83
|
export const NysVideo: React.ForwardRefExoticComponent<NysVideoProps>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
2
|
import "../../dist/nysds.es.js";
|
|
3
|
+
import { useEventListener } from "./react-utils.js";
|
|
3
4
|
|
|
4
5
|
export const NysVideo = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
5
7
|
const {
|
|
6
8
|
autoplay,
|
|
7
9
|
disabled,
|
|
@@ -15,9 +17,20 @@ export const NysVideo = forwardRef((props, forwardedRef) => {
|
|
|
15
17
|
...filteredProps
|
|
16
18
|
} = props;
|
|
17
19
|
|
|
20
|
+
/** Event listeners - run once */
|
|
21
|
+
useEventListener(ref, "nys-video-play", props.onNysVideoPlay);
|
|
22
|
+
|
|
18
23
|
return React.createElement(
|
|
19
24
|
"nys-video",
|
|
20
25
|
{
|
|
26
|
+
ref: (node) => {
|
|
27
|
+
ref.current = node;
|
|
28
|
+
if (typeof forwardedRef === "function") {
|
|
29
|
+
forwardedRef(node);
|
|
30
|
+
} else if (forwardedRef) {
|
|
31
|
+
forwardedRef.current = node;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
21
34
|
...filteredProps,
|
|
22
35
|
id: props.id,
|
|
23
36
|
titleText: props.titleText,
|
|
@@ -4,6 +4,7 @@ export * from "./NysAlert.js";
|
|
|
4
4
|
export * from "./NysAvatar.js";
|
|
5
5
|
export * from "./NysBacktotop.js";
|
|
6
6
|
export * from "./NysBadge.js";
|
|
7
|
+
export * from "./NysBreadcrumbs.js";
|
|
7
8
|
export * from "./NysButton.js";
|
|
8
9
|
export * from "./NysCheckbox.js";
|
|
9
10
|
export * from "./NysCheckboxgroup.js";
|
package/packages/react/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./NysAlert.js";
|
|
|
4
4
|
export * from "./NysAvatar.js";
|
|
5
5
|
export * from "./NysBacktotop.js";
|
|
6
6
|
export * from "./NysBadge.js";
|
|
7
|
+
export * from "./NysBreadcrumbs.js";
|
|
7
8
|
export * from "./NysButton.js";
|
|
8
9
|
export * from "./NysCheckbox.js";
|
|
9
10
|
export * from "./NysCheckboxgroup.js";
|
|
@@ -171,6 +171,32 @@ export type NysBadgeProps = {
|
|
|
171
171
|
suffixicon?: string | boolean;
|
|
172
172
|
};
|
|
173
173
|
|
|
174
|
+
export type NysBreadcrumbsProps = {
|
|
175
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
176
|
+
id?: string;
|
|
177
|
+
/** Accessible label for the `<nav>` landmark. Defaults to "path to this page" if not set.
|
|
178
|
+
Override when multiple crumbs exist on the same page. */
|
|
179
|
+
ariaLabel?: string;
|
|
180
|
+
/** Controls the visual size of the breadcrumb text and spacing: `sm` for dense layouts, `md` (default) for standard use. */
|
|
181
|
+
size?: "sm" | "md" | "";
|
|
182
|
+
/** On mobile, renders the trail as a single back-to-parent link pointing to the item before the current page.
|
|
183
|
+
Has no effect on desktop or when only one item is present (which always renders as a back link). */
|
|
184
|
+
backToParent?: boolean;
|
|
185
|
+
/** Forces the trail into its collapsed state.
|
|
186
|
+
It shows only the first item, an ellipsis, and the last two items.
|
|
187
|
+
The user can still expand the trail by clicking the ellipsis. */
|
|
188
|
+
collapsed?: boolean;
|
|
189
|
+
/** Renders a filled light theme background bar behind the breadcrumb trail. */
|
|
190
|
+
backgroundBar?: boolean;
|
|
191
|
+
/** Prevents interaction. */
|
|
192
|
+
disabled?: boolean;
|
|
193
|
+
|
|
194
|
+
/** */
|
|
195
|
+
"onnys-expand"?: (e: CustomEvent<CustomEvent>) => void;
|
|
196
|
+
/** Fired when the user clicks the ellipsis to expand the trail. */
|
|
197
|
+
"onnys-breadcrumbs-expand"?: (e: CustomEvent<never>) => void;
|
|
198
|
+
};
|
|
199
|
+
|
|
174
200
|
export type NysButtonProps = {
|
|
175
201
|
/** Unique identifier. Auto-generated if not provided. */
|
|
176
202
|
id?: string;
|
|
@@ -190,9 +216,9 @@ export type NysButtonProps = {
|
|
|
190
216
|
ariaLabel?: string;
|
|
191
217
|
/** ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`. */
|
|
192
218
|
ariaControls?: string;
|
|
193
|
-
/** Material Symbol icon before label. Not shown for `
|
|
219
|
+
/** Material Symbol icon before label. Not shown for `circle` mode. */
|
|
194
220
|
prefixIcon?: string;
|
|
195
|
-
/** Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `
|
|
221
|
+
/** Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `circle` mode. */
|
|
196
222
|
suffixIcon?: string;
|
|
197
223
|
/** Renders circular icon-only button. Requires `icon` prop. `label` becomes aria-label. */
|
|
198
224
|
circle?: boolean;
|
|
@@ -377,6 +403,10 @@ export type NysDatepickerProps = {
|
|
|
377
403
|
description?: string;
|
|
378
404
|
/** Initial date when calendar opens (YYYY-MM-DD). */
|
|
379
405
|
startDate?: string;
|
|
406
|
+
/** The earliest selectable date (YYYY-MM-DD). */
|
|
407
|
+
minDate?: string;
|
|
408
|
+
/** The latest selectable date (YYYY-MM-DD). */
|
|
409
|
+
maxDate?: string;
|
|
380
410
|
/** Dark background mode. */
|
|
381
411
|
inverted?: boolean;
|
|
382
412
|
/** Selected date. Accepts Date object or ISO string (YYYY-MM-DD). */
|
|
@@ -421,6 +451,8 @@ export type NysDropdownMenuItemProps = {
|
|
|
421
451
|
};
|
|
422
452
|
|
|
423
453
|
export type NysErrorMessageProps = {
|
|
454
|
+
/** The "id" of the error message. */
|
|
455
|
+
id?: string;
|
|
424
456
|
/** Whether to display the error message. */
|
|
425
457
|
showError?: boolean;
|
|
426
458
|
/** Error text to display. Falls back to native validation message if available. */
|
|
@@ -533,8 +565,8 @@ export type NysIconProps = {
|
|
|
533
565
|
};
|
|
534
566
|
|
|
535
567
|
export type NysLabelProps = {
|
|
536
|
-
/** ID of the
|
|
537
|
-
|
|
568
|
+
/** The ID of the label. */
|
|
569
|
+
id?: string;
|
|
538
570
|
/** Label text displayed above the form field. */
|
|
539
571
|
label?: string;
|
|
540
572
|
/** Helper text displayed below the label. */
|
|
@@ -545,6 +577,9 @@ export type NysLabelProps = {
|
|
|
545
577
|
inverted?: boolean;
|
|
546
578
|
/** Tooltip text shown on hover/focus of info icon next to label. */
|
|
547
579
|
tooltip?: string;
|
|
580
|
+
|
|
581
|
+
/** */
|
|
582
|
+
"onnys-label-click"?: (e: CustomEvent<CustomEvent>) => void;
|
|
548
583
|
};
|
|
549
584
|
|
|
550
585
|
export type NysModalProps = {
|
|
@@ -961,6 +996,9 @@ Falls back to YouTube's auto-generated thumbnail if not provided. */
|
|
|
961
996
|
autoplay?: boolean;
|
|
962
997
|
/** Prevents the video from being played */
|
|
963
998
|
disabled?: boolean;
|
|
999
|
+
|
|
1000
|
+
/** Fired when the user clicks the thumbnail to load the player. */
|
|
1001
|
+
"onnys-video-play"?: (e: CustomEvent<never>) => void;
|
|
964
1002
|
};
|
|
965
1003
|
|
|
966
1004
|
export type CustomElements = {
|
|
@@ -1029,6 +1067,20 @@ export type CustomElements = {
|
|
|
1029
1067
|
*/
|
|
1030
1068
|
"nys-badge": Partial<NysBadgeProps & BaseProps & BaseEvents>;
|
|
1031
1069
|
|
|
1070
|
+
/**
|
|
1071
|
+
* Breadcrumb navigation trail with responsive collapse support.
|
|
1072
|
+
* ---
|
|
1073
|
+
*
|
|
1074
|
+
*
|
|
1075
|
+
* ### **Events:**
|
|
1076
|
+
* - **nys-expand**
|
|
1077
|
+
* - **nys-breadcrumbs-expand** - Fired when the user clicks the ellipsis to expand the trail.
|
|
1078
|
+
*
|
|
1079
|
+
* ### **Slots:**
|
|
1080
|
+
* - _default_ - One or more `nys-breadcrumbitem` elements defining the trail.
|
|
1081
|
+
*/
|
|
1082
|
+
"nys-breadcrumbs": Partial<NysBreadcrumbsProps & BaseProps & BaseEvents>;
|
|
1083
|
+
|
|
1032
1084
|
/**
|
|
1033
1085
|
* Button for actions and CTAs with variants, sizes, and icon support.
|
|
1034
1086
|
* ---
|
|
@@ -1220,6 +1272,9 @@ export type CustomElements = {
|
|
|
1220
1272
|
* ---
|
|
1221
1273
|
*
|
|
1222
1274
|
*
|
|
1275
|
+
* ### **Events:**
|
|
1276
|
+
* - **nys-label-click**
|
|
1277
|
+
*
|
|
1223
1278
|
* ### **Slots:**
|
|
1224
1279
|
* - **description** - Custom HTML description content below the label.
|
|
1225
1280
|
*/
|
|
@@ -1435,9 +1490,12 @@ export type CustomElements = {
|
|
|
1435
1490
|
"nys-unavheader": Partial<NysUnavHeaderProps & BaseProps & BaseEvents>;
|
|
1436
1491
|
|
|
1437
1492
|
/**
|
|
1438
|
-
*
|
|
1493
|
+
* YouTube video player with thumbnail preview and accessibility announcements.
|
|
1439
1494
|
* ---
|
|
1440
1495
|
*
|
|
1496
|
+
*
|
|
1497
|
+
* ### **Events:**
|
|
1498
|
+
* - **nys-video-play** - Fired when the user clicks the thumbnail to load the player.
|
|
1441
1499
|
*/
|
|
1442
1500
|
"nys-video": Partial<NysVideoProps & BaseProps & BaseEvents>;
|
|
1443
1501
|
};
|