@nysds/components 1.20.0-alpha-3 → 1.20.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 +9101 -5385
- package/dist/.vscode/vscode.css-custom-data.json +5 -0
- package/dist/.vscode/vscode.html-custom-data.json +332 -30
- package/dist/custom-elements.json +9101 -5385
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js +706 -0
- package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js.map +1 -0
- package/dist/nys-icon.library-eNVZmfkf.js +696 -0
- package/dist/nys-icon.library-eNVZmfkf.js.map +1 -0
- package/dist/nysds.es.js +10460 -5393
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +2436 -472
- package/dist/nysds.js.map +1 -1
- package/dist/packages/internals/src/aria-associate.d.ts +41 -0
- package/dist/packages/internals/src/form-control-mixin.d.ts +34 -0
- package/dist/packages/internals/src/id.d.ts +8 -0
- package/dist/packages/internals/src/identified-mixin.d.ts +23 -0
- package/dist/packages/internals/src/index.d.ts +7 -0
- package/dist/packages/internals/src/reflects-aria-mixin.d.ts +33 -0
- package/dist/packages/internals/src/test-helpers.d.ts +29 -0
- package/dist/packages/internals/src/types.d.ts +9 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +72 -10
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +63 -8
- package/dist/packages/nys-alert/src/nys-alert.d.ts +95 -20
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +100 -7
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +75 -5
- package/dist/packages/nys-badge/src/nys-badge.d.ts +63 -6
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +79 -10
- package/dist/packages/nys-button/src/nys-button.d.ts +132 -26
- package/dist/packages/nys-card/src/index.d.ts +1 -0
- package/dist/packages/nys-card/src/nys-card.d.ts +325 -0
- package/dist/packages/nys-card/src/nys-card.figma.d.ts +1 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +36 -12
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +81 -6
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +174 -5
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +83 -13
- package/dist/packages/nys-divider/src/nys-divider.d.ts +33 -9
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +24 -15
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +3 -12
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +22 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +101 -12
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +23 -2
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +99 -9
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +189 -6
- package/dist/packages/nys-icon/src/icon-cache.d.ts +11 -4
- package/dist/packages/nys-icon/src/icon-library-registry.d.ts +33 -16
- package/dist/packages/nys-icon/src/index.d.ts +2 -2
- package/dist/packages/nys-icon/src/nys-icon.d.ts +98 -8
- package/dist/packages/nys-iconlist/src/index.d.ts +2 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +92 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.figma.d.ts +1 -0
- package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +32 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +37 -2
- package/dist/packages/nys-modal/src/nys-modal.d.ts +145 -13
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +67 -3
- package/dist/packages/nys-processlist/src/index.d.ts +2 -0
- package/dist/packages/nys-processlist/src/nys-processlist.d.ts +184 -0
- package/dist/packages/nys-processlist/src/nys-processlist.figma.d.ts +1 -0
- package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +41 -0
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +201 -7
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +88 -6
- package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
- package/dist/packages/nys-select/src/nys-select.d.ts +150 -15
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +4 -4
- package/dist/packages/nys-stepper/src/nys-step.d.ts +26 -20
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +128 -75
- package/dist/packages/nys-tab/src/nys-tab.d.ts +19 -10
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +181 -39
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +15 -24
- package/dist/packages/nys-table/src/nys-table.d.ts +90 -3
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +60 -10
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +77 -14
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +47 -10
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +48 -8
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +45 -4
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +216 -11
- package/dist/packages/nys-verticalnav/src/index.d.ts +2 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +572 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.figma.d.ts +1 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +24 -0
- package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
- package/dist/src/index.d.ts +6 -2
- package/package.json +11 -6
- package/packages/react/NysAccordion.d.ts +10 -0
- package/packages/react/NysAccordion.js +2 -1
- package/packages/react/NysAccordionItem.d.ts +10 -0
- package/packages/react/NysAccordionItem.js +3 -1
- package/packages/react/NysAlert.d.ts +8 -10
- package/packages/react/NysAlert.js +0 -2
- package/packages/react/NysAvatar.d.ts +11 -1
- package/packages/react/NysBacktotop.d.ts +3 -0
- package/packages/react/NysBacktotop.js +2 -1
- package/packages/react/NysBreadcrumbs.d.ts +2 -2
- package/packages/react/NysButton.d.ts +38 -8
- package/packages/react/NysButton.js +6 -4
- package/packages/react/NysCard.d.ts +110 -0
- package/packages/react/NysCard.js +61 -0
- package/packages/react/NysCheckbox.d.ts +9 -0
- package/packages/react/NysCheckbox.js +4 -0
- package/packages/react/NysDropdownMenu.d.ts +4 -2
- package/packages/react/NysFileinput.d.ts +2 -2
- package/packages/react/NysGlobalFooter.d.ts +17 -0
- package/packages/react/NysGlobalFooter.js +10 -2
- package/packages/react/NysGlobalHeader.d.ts +17 -0
- package/packages/react/NysGlobalHeader.js +11 -2
- package/packages/react/NysIconlist.d.ts +54 -0
- package/packages/react/NysIconlist.js +22 -0
- package/packages/react/NysIconlistitem.d.ts +59 -0
- package/packages/react/NysIconlistitem.js +22 -0
- package/packages/react/NysLabel.d.ts +4 -1
- package/packages/react/NysModal.d.ts +8 -1
- package/packages/react/NysModal.js +11 -2
- package/packages/react/NysProcesslist.d.ts +65 -0
- package/packages/react/NysProcesslist.js +25 -0
- package/packages/react/NysProcesslistitem.d.ts +61 -0
- package/packages/react/NysProcesslistitem.js +35 -0
- package/packages/react/NysRadiobutton.d.ts +27 -3
- package/packages/react/NysRadiobutton.js +9 -1
- package/packages/react/NysSelect.d.ts +3 -0
- package/packages/react/NysSelect.js +2 -0
- package/packages/react/NysStepper.d.ts +1 -1
- package/packages/react/NysTabgroup.d.ts +5 -4
- package/packages/react/NysTable.d.ts +1 -1
- package/packages/react/NysTabpanel.d.ts +11 -4
- package/packages/react/NysTextarea.d.ts +4 -1
- package/packages/react/NysTextarea.js +2 -0
- package/packages/react/NysUnavFooter.d.ts +13 -0
- package/packages/react/NysUnavFooter.js +4 -1
- package/packages/react/NysUnavHeader.d.ts +24 -1
- package/packages/react/NysUnavHeader.js +17 -1
- package/packages/react/NysVerticalnav.d.ts +67 -0
- package/packages/react/NysVerticalnav.js +26 -0
- package/packages/react/NysVerticalnavGroup.d.ts +76 -0
- package/packages/react/NysVerticalnavGroup.js +43 -0
- package/packages/react/index.d.ts +7 -0
- package/packages/react/index.js +7 -0
- package/packages/react/nysds-jsx.d.ts +404 -46
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
+
import "../../dist/nysds.es.js";
|
|
3
|
+
import { useProperties } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const NysProcesslistitem = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const { label, description, _hasDescription, ...filteredProps } = props;
|
|
8
|
+
|
|
9
|
+
/** Properties - run whenever a property has changed */
|
|
10
|
+
useProperties(ref, "_hasDescription", props._hasDescription);
|
|
11
|
+
|
|
12
|
+
return React.createElement(
|
|
13
|
+
"nys-processlistitem",
|
|
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
|
+
label: props.label,
|
|
25
|
+
description: props.description,
|
|
26
|
+
class: props.className,
|
|
27
|
+
exportparts: props.exportparts,
|
|
28
|
+
for: props.htmlFor,
|
|
29
|
+
part: props.part,
|
|
30
|
+
tabindex: props.tabIndex,
|
|
31
|
+
style: { ...props.style },
|
|
32
|
+
},
|
|
33
|
+
props.children,
|
|
34
|
+
);
|
|
35
|
+
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
NysRadiobutton as NysRadiobuttonElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../../dist/nysds.es.js";
|
|
3
6
|
|
|
4
|
-
export type { NysRadiobuttonElement };
|
|
7
|
+
export type { NysRadiobuttonElement, CustomEvent };
|
|
5
8
|
|
|
6
9
|
export interface NysRadiobuttonProps extends Pick<
|
|
7
10
|
React.AllHTMLAttributes<HTMLElement>,
|
|
@@ -36,6 +39,12 @@ export interface NysRadiobuttonProps extends Pick<
|
|
|
36
39
|
/** undefined */
|
|
37
40
|
showOtherError?: boolean;
|
|
38
41
|
|
|
42
|
+
/** Suppress the internal visible `<nys-label>` (use with `labelledby` for
|
|
43
|
+
table cells). Without `labelledby` there is no visible element left to name
|
|
44
|
+
the radio from, so the accessible name falls back to the `label` string —
|
|
45
|
+
pair `hideLabel` with `labelledby` wherever a visible element exists. */
|
|
46
|
+
hideLabel?: boolean;
|
|
47
|
+
|
|
39
48
|
/** Visible label text. Required for accessibility. */
|
|
40
49
|
label?: NysRadiobuttonElement["label"];
|
|
41
50
|
|
|
@@ -57,6 +66,14 @@ export interface NysRadiobuttonProps extends Pick<
|
|
|
57
66
|
/** Radio size: `sm` (24px) or `md` (32px, default). */
|
|
58
67
|
size?: NysRadiobuttonElement["size"];
|
|
59
68
|
|
|
69
|
+
/** Id of an element in the host's light-DOM tree to borrow the accessible name
|
|
70
|
+
from (e.g. a table row `<th>`). Enables labelling a radio button that has no
|
|
71
|
+
visible label of its own.
|
|
72
|
+
|
|
73
|
+
Standalone radios only: inside a `nys-radiogroup` the group renders the
|
|
74
|
+
native inputs and names them from the group's own labels. */
|
|
75
|
+
labelledby?: NysRadiobuttonElement["labelledby"];
|
|
76
|
+
|
|
60
77
|
/** 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()`. */
|
|
61
78
|
className?: string;
|
|
62
79
|
|
|
@@ -78,6 +95,10 @@ export interface NysRadiobuttonProps extends Pick<
|
|
|
78
95
|
/** 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. */
|
|
79
96
|
tabIndex?: number;
|
|
80
97
|
|
|
98
|
+
/** Public validation API (Form Association)
|
|
99
|
+
-------------------------------------------------------------------------- */
|
|
100
|
+
validity?: NysRadiobuttonElement["validity"];
|
|
101
|
+
|
|
81
102
|
/** Fired when selection changes. Detail: `{id, checked, name, value}`. */
|
|
82
103
|
onNysChange?: (event: CustomEvent) => void;
|
|
83
104
|
|
|
@@ -92,7 +113,10 @@ export interface NysRadiobuttonProps extends Pick<
|
|
|
92
113
|
}
|
|
93
114
|
|
|
94
115
|
/**
|
|
95
|
-
* Radio button for single selection from mutually exclusive options.
|
|
116
|
+
* Radio button for single selection from mutually exclusive options.
|
|
117
|
+
* This is a READONLY data component when there is no `nys-radiogroup` wrapping the `nys-radiobutton`.
|
|
118
|
+
* Otherwise this radiobutton mockup the native grouping of radio buttons via "name" attribute.
|
|
119
|
+
* Since we can't do that naturally, we have supporting functions to keep track of keyboard navigation, a11y VO, and single radiobutton checked at all times.
|
|
96
120
|
* ---
|
|
97
121
|
*
|
|
98
122
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
2
|
import "../../dist/nysds.es.js";
|
|
3
|
-
import { useEventListener } from "./react-utils.js";
|
|
3
|
+
import { useEventListener, useProperties } from "./react-utils.js";
|
|
4
4
|
|
|
5
5
|
export const NysRadiobutton = forwardRef((props, forwardedRef) => {
|
|
6
6
|
const ref = useRef(null);
|
|
@@ -11,6 +11,7 @@ export const NysRadiobutton = forwardRef((props, forwardedRef) => {
|
|
|
11
11
|
tile,
|
|
12
12
|
other,
|
|
13
13
|
showOtherError,
|
|
14
|
+
hideLabel,
|
|
14
15
|
label,
|
|
15
16
|
description,
|
|
16
17
|
id,
|
|
@@ -18,6 +19,8 @@ export const NysRadiobutton = forwardRef((props, forwardedRef) => {
|
|
|
18
19
|
value,
|
|
19
20
|
form,
|
|
20
21
|
size,
|
|
22
|
+
labelledby,
|
|
23
|
+
validity,
|
|
21
24
|
...filteredProps
|
|
22
25
|
} = props;
|
|
23
26
|
|
|
@@ -27,6 +30,9 @@ export const NysRadiobutton = forwardRef((props, forwardedRef) => {
|
|
|
27
30
|
useEventListener(ref, "nys-blur", props.onNysBlur);
|
|
28
31
|
useEventListener(ref, "nys-other-input", props.onNysOtherInput);
|
|
29
32
|
|
|
33
|
+
/** Properties - run whenever a property has changed */
|
|
34
|
+
useProperties(ref, "validity", props.validity);
|
|
35
|
+
|
|
30
36
|
return React.createElement(
|
|
31
37
|
"nys-radiobutton",
|
|
32
38
|
{
|
|
@@ -46,6 +52,7 @@ export const NysRadiobutton = forwardRef((props, forwardedRef) => {
|
|
|
46
52
|
value: props.value,
|
|
47
53
|
form: props.form,
|
|
48
54
|
size: props.size,
|
|
55
|
+
labelledby: props.labelledby,
|
|
49
56
|
class: props.className,
|
|
50
57
|
exportparts: props.exportparts,
|
|
51
58
|
for: props.htmlFor,
|
|
@@ -57,6 +64,7 @@ export const NysRadiobutton = forwardRef((props, forwardedRef) => {
|
|
|
57
64
|
tile: props.tile ? true : undefined,
|
|
58
65
|
other: props.other ? true : undefined,
|
|
59
66
|
showOtherError: props.showOtherError ? true : undefined,
|
|
67
|
+
hideLabel: props.hideLabel ? true : undefined,
|
|
60
68
|
style: { ...props.style },
|
|
61
69
|
},
|
|
62
70
|
props.children,
|
|
@@ -49,6 +49,9 @@ export interface NysSelectProps extends Pick<
|
|
|
49
49
|
/** Helper text below label. Use slot for custom HTML. */
|
|
50
50
|
description?: NysSelectElement["description"];
|
|
51
51
|
|
|
52
|
+
/** Accessible label. Used as a fallback when `label` is not provided. */
|
|
53
|
+
ariaLabel?: NysSelectElement["ariaLabel"];
|
|
54
|
+
|
|
52
55
|
/** Currently selected option value. */
|
|
53
56
|
value?: NysSelectElement["value"];
|
|
54
57
|
|
|
@@ -14,6 +14,7 @@ export const NysSelect = forwardRef((props, forwardedRef) => {
|
|
|
14
14
|
name,
|
|
15
15
|
label,
|
|
16
16
|
description,
|
|
17
|
+
ariaLabel,
|
|
17
18
|
value,
|
|
18
19
|
tooltip,
|
|
19
20
|
form,
|
|
@@ -43,6 +44,7 @@ export const NysSelect = forwardRef((props, forwardedRef) => {
|
|
|
43
44
|
name: props.name,
|
|
44
45
|
label: props.label,
|
|
45
46
|
description: props.description,
|
|
47
|
+
ariaLabel: props.ariaLabel,
|
|
46
48
|
value: props.value,
|
|
47
49
|
tooltip: props.tooltip,
|
|
48
50
|
form: props.form,
|
|
@@ -21,7 +21,7 @@ export interface NysStepperProps extends Pick<
|
|
|
21
21
|
/** Whether compact mobile view is expanded to show all steps. Toggled by clicking the counter. */
|
|
22
22
|
isCompactExpanded?: boolean;
|
|
23
23
|
|
|
24
|
-
/** Unique identifier. Auto-generated as `nys-stepper-{
|
|
24
|
+
/** Unique identifier. Auto-generated as `nys-stepper-{timestamp}-{n}` if not provided. */
|
|
25
25
|
id?: NysStepperElement["id"];
|
|
26
26
|
|
|
27
27
|
/** Name attribute for form association. */
|
|
@@ -54,9 +54,10 @@ Used for form submission and accessibility purposes. */
|
|
|
54
54
|
* elements.
|
|
55
55
|
*
|
|
56
56
|
* Accepts tabs and panels as flat light-DOM children in any order (interleaved
|
|
57
|
-
* or grouped). On slot change,
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* or grouped). On slot change, each child is assigned `slot="tab"` or
|
|
58
|
+
* `slot="panel"` so it is projected into the correct shadow-DOM container
|
|
59
|
+
* while remaining in the light DOM, ARIA relationships are wired, and the
|
|
60
|
+
* first selected (or first) tab is activated.
|
|
60
61
|
*
|
|
61
62
|
* Scroll shadows are rendered on either side of the tab list and toggled via
|
|
62
63
|
* `ResizeObserver` and a `scroll` listener so they accurately reflect whether
|
|
@@ -70,6 +71,6 @@ Used for form submission and accessibility purposes. */
|
|
|
70
71
|
*
|
|
71
72
|
*
|
|
72
73
|
* ### **Slots:**
|
|
73
|
-
* - _default_ - Accepts `<nys-tab>` and `<nys-tabpanel>` children.
|
|
74
|
+
* - _default_ - Accepts `<nys-tab>` and `<nys-tabpanel>` children. On `slotchange` they are assigned `slot="tab"` / `slot="panel"` and projected into the tablist and panel containers; they stay in the light DOM. Any other children remain in the default slot, rendered below the panels.
|
|
74
75
|
*/
|
|
75
76
|
export const NysTabgroup: React.ForwardRefExoticComponent<NysTabgroupProps>;
|
|
@@ -75,6 +75,6 @@ export interface NysTableProps extends Pick<
|
|
|
75
75
|
* - **nys-column-sort** - Fired when a sortable column header is clicked. Can be prevented by calling `event.preventDefault()` to override default sort behavior. Detail: { columnIndex: number, columnLabel: string, sortDirection: "asc" | "desc" | "none" }
|
|
76
76
|
*
|
|
77
77
|
* ### **Slots:**
|
|
78
|
-
* - _default_ - Accepts a `<table>` element. Only the first table is
|
|
78
|
+
* - _default_ - Accepts a `<table>` element. Only the first table is used. The table is enhanced in place and stays in the light DOM (projected through a slot, never cloned), so embedded components remain interactive and reachable by consumer CSS/JS. Its cell styling is applied from `nys-table.light.scss`, adopted once onto `document.adoptedStyleSheets`.
|
|
79
79
|
*/
|
|
80
80
|
export const NysTable: React.ForwardRefExoticComponent<NysTableProps>;
|
|
@@ -51,13 +51,20 @@ Reflected to the DOM attribute so `aria-controls` references on sibling
|
|
|
51
51
|
* `<nys-tabgroup>`.
|
|
52
52
|
*
|
|
53
53
|
* Pairing is determined by render order: the Nth `<nys-tabpanel>` child of a
|
|
54
|
-
* `<nys-tabgroup>` corresponds to the Nth `<nys-tab>` child
|
|
55
|
-
* `aria-labelledby` and the `hidden` attribute are managed
|
|
56
|
-
* `<nys-tabgroup>` via `_applySelection`; do not set them
|
|
54
|
+
* `<nys-tabgroup>` corresponds to the Nth `<nys-tab>` child (or by explicit
|
|
55
|
+
* `aria-labelledby`). `aria-labelledby` and the `hidden` attribute are managed
|
|
56
|
+
* externally by `<nys-tabgroup>` via `_applySelection`; do not set them
|
|
57
|
+
* directly.
|
|
58
|
+
*
|
|
59
|
+
* The panel container is styled from the light DOM (`nys-tabpanel.light.scss`,
|
|
60
|
+
* adopted on the document) rather than a shadow-DOM wrapper. This keeps the
|
|
61
|
+
* slotted panel content in the light DOM — reachable by consumer CSS and
|
|
62
|
+
* JavaScript — and lets consumers override the panel's own styling (e.g.
|
|
63
|
+
* `nys-tabpanel { padding: 0 }`), which a shadow wrapper would prevent.
|
|
57
64
|
* ---
|
|
58
65
|
*
|
|
59
66
|
*
|
|
60
67
|
* ### **Slots:**
|
|
61
|
-
* - _default_ - Default slot for panel content. Rendered
|
|
68
|
+
* - _default_ - Default slot for panel content. Rendered directly under the host, which is the scrollable, focusable (`tabindex="0"`) `role="tabpanel"` region.
|
|
62
69
|
*/
|
|
63
70
|
export const NysTabpanel: React.ForwardRefExoticComponent<NysTabpanelProps>;
|
|
@@ -25,7 +25,7 @@ export interface NysTextareaProps extends Pick<
|
|
|
25
25
|
/** Prevents interaction. */
|
|
26
26
|
disabled?: boolean;
|
|
27
27
|
|
|
28
|
-
/** Makes textarea
|
|
28
|
+
/** Makes textarea readonly but focusable. */
|
|
29
29
|
readonly?: boolean;
|
|
30
30
|
|
|
31
31
|
/** Marks as required. Shows "Required" flag and validates on blur. */
|
|
@@ -79,6 +79,9 @@ export interface NysTextareaProps extends Pick<
|
|
|
79
79
|
/** Error message text. Shown only when `showError` is true. */
|
|
80
80
|
errorMessage?: NysTextareaElement["errorMessage"];
|
|
81
81
|
|
|
82
|
+
/** Accessible label used only when no visible `label` is provided. */
|
|
83
|
+
ariaLabel?: NysTextareaElement["ariaLabel"];
|
|
84
|
+
|
|
82
85
|
/** 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()`. */
|
|
83
86
|
className?: string;
|
|
84
87
|
|
|
@@ -24,6 +24,7 @@ export const NysTextarea = forwardRef((props, forwardedRef) => {
|
|
|
24
24
|
rows,
|
|
25
25
|
resize,
|
|
26
26
|
errorMessage,
|
|
27
|
+
ariaLabel,
|
|
27
28
|
...filteredProps
|
|
28
29
|
} = props;
|
|
29
30
|
|
|
@@ -59,6 +60,7 @@ export const NysTextarea = forwardRef((props, forwardedRef) => {
|
|
|
59
60
|
rows: props.rows,
|
|
60
61
|
resize: props.resize,
|
|
61
62
|
errorMessage: props.errorMessage,
|
|
63
|
+
ariaLabel: props.ariaLabel,
|
|
62
64
|
class: props.className,
|
|
63
65
|
exportparts: props.exportparts,
|
|
64
66
|
for: props.htmlFor,
|
|
@@ -18,6 +18,19 @@ export interface NysUnavFooterProps extends Pick<
|
|
|
18
18
|
| "onFocus"
|
|
19
19
|
| "onBlur"
|
|
20
20
|
> {
|
|
21
|
+
/** Accessible name for the `contentinfo` landmark this footer renders.
|
|
22
|
+
Defaults to `"New York State"`.
|
|
23
|
+
|
|
24
|
+
A page pairing this footer with `nys-globalfooter` carries two `contentinfo`
|
|
25
|
+
landmarks; distinct names are what keep landmark navigation useful instead of
|
|
26
|
+
announcing "content information" twice. Override only when your wording is
|
|
27
|
+
clearer for your audience — and keep it distinct from the agency footer's
|
|
28
|
+
name, which comes from that footer's visible heading.
|
|
29
|
+
|
|
30
|
+
A blank value falls back to the default rather than leaving the landmark
|
|
31
|
+
unnamed. */
|
|
32
|
+
landmarkLabel?: NysUnavFooterElement["landmarkLabel"];
|
|
33
|
+
|
|
21
34
|
/** 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()`. */
|
|
22
35
|
className?: string;
|
|
23
36
|
|
|
@@ -2,10 +2,13 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import "../../dist/nysds.es.js";
|
|
3
3
|
|
|
4
4
|
export const NysUnavFooter = forwardRef((props, forwardedRef) => {
|
|
5
|
+
const { landmarkLabel, ...filteredProps } = props;
|
|
6
|
+
|
|
5
7
|
return React.createElement(
|
|
6
8
|
"nys-unavfooter",
|
|
7
9
|
{
|
|
8
|
-
...
|
|
10
|
+
...filteredProps,
|
|
11
|
+
landmarkLabel: props.landmarkLabel,
|
|
9
12
|
class: props.className,
|
|
10
13
|
exportparts: props.exportparts,
|
|
11
14
|
for: props.htmlFor,
|
|
@@ -39,6 +39,19 @@ export interface NysUnavHeaderProps extends Pick<
|
|
|
39
39
|
/** The URL endpoint of the search, make sure to include the query param. */
|
|
40
40
|
searchUrl?: NysUnavHeaderElement["searchUrl"];
|
|
41
41
|
|
|
42
|
+
/** Accessible name for the `banner` landmark this header renders.
|
|
43
|
+
Defaults to `"New York State"`.
|
|
44
|
+
|
|
45
|
+
A page pairing this header with `nys-globalheader` carries two `banner`
|
|
46
|
+
landmarks; distinct names are what keep landmark navigation useful instead of
|
|
47
|
+
announcing "banner, banner". Override only when your wording is clearer for
|
|
48
|
+
your audience — and keep it distinct from the agency header's name, which
|
|
49
|
+
comes from that header's visible title.
|
|
50
|
+
|
|
51
|
+
A blank value falls back to the default rather than leaving the landmark
|
|
52
|
+
unnamed. */
|
|
53
|
+
landmarkLabel?: NysUnavHeaderElement["landmarkLabel"];
|
|
54
|
+
|
|
42
55
|
/** The list of languages this site can be translated to, default to use Smartling */
|
|
43
56
|
languages?: NysUnavHeaderElement["languages"];
|
|
44
57
|
|
|
@@ -62,11 +75,21 @@ export interface NysUnavHeaderProps extends Pick<
|
|
|
62
75
|
|
|
63
76
|
/** 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. */
|
|
64
77
|
tabIndex?: number;
|
|
78
|
+
|
|
79
|
+
/** Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect. */
|
|
80
|
+
onNysLanguageSelect?: (event: CustomEvent) => void;
|
|
81
|
+
|
|
82
|
+
/** Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect. */
|
|
83
|
+
onNysSearchSubmit?: (event: CustomEvent) => void;
|
|
65
84
|
}
|
|
66
85
|
|
|
67
86
|
/**
|
|
68
|
-
*
|
|
87
|
+
* Universal NYS header with trust bar, search, and translation. Required site-wide.
|
|
69
88
|
* ---
|
|
70
89
|
*
|
|
90
|
+
*
|
|
91
|
+
* ### **Events:**
|
|
92
|
+
* - **nys-language-select** - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect.
|
|
93
|
+
* - **nys-search-submit** - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
71
94
|
*/
|
|
72
95
|
export const NysUnavHeader: React.ForwardRefExoticComponent<NysUnavHeaderProps>;
|
|
@@ -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 NysUnavHeader = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
5
7
|
const {
|
|
6
8
|
trustbarVisible,
|
|
7
9
|
searchDropdownVisible,
|
|
@@ -10,15 +12,29 @@ export const NysUnavHeader = forwardRef((props, forwardedRef) => {
|
|
|
10
12
|
hideTranslate,
|
|
11
13
|
hideSearch,
|
|
12
14
|
searchUrl,
|
|
15
|
+
landmarkLabel,
|
|
13
16
|
languages,
|
|
14
17
|
...filteredProps
|
|
15
18
|
} = props;
|
|
16
19
|
|
|
20
|
+
/** Event listeners - run once */
|
|
21
|
+
useEventListener(ref, "nys-language-select", props.onNysLanguageSelect);
|
|
22
|
+
useEventListener(ref, "nys-search-submit", props.onNysSearchSubmit);
|
|
23
|
+
|
|
17
24
|
return React.createElement(
|
|
18
25
|
"nys-unavheader",
|
|
19
26
|
{
|
|
27
|
+
ref: (node) => {
|
|
28
|
+
ref.current = node;
|
|
29
|
+
if (typeof forwardedRef === "function") {
|
|
30
|
+
forwardedRef(node);
|
|
31
|
+
} else if (forwardedRef) {
|
|
32
|
+
forwardedRef.current = node;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
20
35
|
...filteredProps,
|
|
21
36
|
searchUrl: props.searchUrl,
|
|
37
|
+
landmarkLabel: props.landmarkLabel,
|
|
22
38
|
languages: props.languages,
|
|
23
39
|
class: props.className,
|
|
24
40
|
exportparts: props.exportparts,
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
/** Hides the visible heading while keeping an accessible label for the navigation. */
|
|
22
|
+
hideHeading?: boolean;
|
|
23
|
+
|
|
24
|
+
/** Expands or collapses the navigation on mobile. */
|
|
25
|
+
expanded?: boolean;
|
|
26
|
+
|
|
27
|
+
/** ID for the navigation. Generated automatically if not provided. */
|
|
28
|
+
id?: NysVerticalnavElement["id"];
|
|
29
|
+
|
|
30
|
+
/** Heading text displayed at the top of the navigation. Defaults to "Page navigation". */
|
|
31
|
+
heading?: NysVerticalnavElement["heading"];
|
|
32
|
+
|
|
33
|
+
/** Heading level used for the navigation heading (`h1` through `h6`). */
|
|
34
|
+
headingLevel?: NysVerticalnavElement["headingLevel"];
|
|
35
|
+
|
|
36
|
+
/** 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()`. */
|
|
37
|
+
className?: string;
|
|
38
|
+
|
|
39
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
40
|
+
exportparts?: string;
|
|
41
|
+
|
|
42
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
43
|
+
htmlFor?: string;
|
|
44
|
+
|
|
45
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
46
|
+
key?: number | string;
|
|
47
|
+
|
|
48
|
+
/** 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. */
|
|
49
|
+
part?: string;
|
|
50
|
+
|
|
51
|
+
/** 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. */
|
|
52
|
+
ref?: any;
|
|
53
|
+
|
|
54
|
+
/** 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
|
+
tabIndex?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Responsive navigation that becomes an accordion on smaller screens.
|
|
60
|
+
* ---
|
|
61
|
+
*
|
|
62
|
+
*
|
|
63
|
+
* ### **Methods:**
|
|
64
|
+
* - **open()** - Public API for controlling the mobile accordion from outside the component
|
|
65
|
+
* --------------------------------------------------------------------------
|
|
66
|
+
*/
|
|
67
|
+
export const NysVerticalnav: React.ForwardRefExoticComponent<NysVerticalnavProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import "../../dist/nysds.es.js";
|
|
3
|
+
|
|
4
|
+
export const NysVerticalnav = forwardRef((props, forwardedRef) => {
|
|
5
|
+
const { hideHeading, expanded, id, heading, headingLevel, ...filteredProps } =
|
|
6
|
+
props;
|
|
7
|
+
|
|
8
|
+
return React.createElement(
|
|
9
|
+
"nys-verticalnav",
|
|
10
|
+
{
|
|
11
|
+
...filteredProps,
|
|
12
|
+
id: props.id,
|
|
13
|
+
heading: props.heading,
|
|
14
|
+
headingLevel: props.headingLevel,
|
|
15
|
+
class: props.className,
|
|
16
|
+
exportparts: props.exportparts,
|
|
17
|
+
for: props.htmlFor,
|
|
18
|
+
part: props.part,
|
|
19
|
+
tabindex: props.tabIndex,
|
|
20
|
+
hideHeading: props.hideHeading ? true : undefined,
|
|
21
|
+
expanded: props.expanded ? true : undefined,
|
|
22
|
+
style: { ...props.style },
|
|
23
|
+
},
|
|
24
|
+
props.children,
|
|
25
|
+
);
|
|
26
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
/** undefined */
|
|
64
|
+
onNysVerticalnavgroupToggle?: (event: CustomEvent) => void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Collapsible link group for use within `<nys-verticalnav>`.
|
|
69
|
+
* ---
|
|
70
|
+
*
|
|
71
|
+
*
|
|
72
|
+
* ### **Events:**
|
|
73
|
+
* - **nys-child-resize**
|
|
74
|
+
* - **nys-verticalnavgroup-toggle**
|
|
75
|
+
*/
|
|
76
|
+
export const NysVerticalnavGroup: React.ForwardRefExoticComponent<NysVerticalnavGroupProps>;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
useEventListener(
|
|
12
|
+
ref,
|
|
13
|
+
"nys-verticalnavgroup-toggle",
|
|
14
|
+
props.onNysVerticalnavgroupToggle,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return React.createElement(
|
|
18
|
+
"nys-verticalnavgroup",
|
|
19
|
+
{
|
|
20
|
+
ref: (node) => {
|
|
21
|
+
ref.current = node;
|
|
22
|
+
if (typeof forwardedRef === "function") {
|
|
23
|
+
forwardedRef(node);
|
|
24
|
+
} else if (forwardedRef) {
|
|
25
|
+
forwardedRef.current = node;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
...filteredProps,
|
|
29
|
+
id: props.id,
|
|
30
|
+
label: props.label,
|
|
31
|
+
class: props.className,
|
|
32
|
+
exportparts: props.exportparts,
|
|
33
|
+
for: props.htmlFor,
|
|
34
|
+
part: props.part,
|
|
35
|
+
tabindex: props.tabIndex,
|
|
36
|
+
expanded: props.expanded ? true : undefined,
|
|
37
|
+
disabled: props.disabled ? true : undefined,
|
|
38
|
+
active: props.active ? true : undefined,
|
|
39
|
+
style: { ...props.style },
|
|
40
|
+
},
|
|
41
|
+
props.children,
|
|
42
|
+
);
|
|
43
|
+
});
|
|
@@ -6,6 +6,7 @@ export * from "./NysBacktotop.js";
|
|
|
6
6
|
export * from "./NysBadge.js";
|
|
7
7
|
export * from "./NysBreadcrumbs.js";
|
|
8
8
|
export * from "./NysButton.js";
|
|
9
|
+
export * from "./NysCard.js";
|
|
9
10
|
export * from "./NysCheckbox.js";
|
|
10
11
|
export * from "./NysCheckboxgroup.js";
|
|
11
12
|
export * from "./NysCombobox.js";
|
|
@@ -19,9 +20,13 @@ export * from "./NysFileItem.js";
|
|
|
19
20
|
export * from "./NysGlobalFooter.js";
|
|
20
21
|
export * from "./NysGlobalHeader.js";
|
|
21
22
|
export * from "./NysIcon.js";
|
|
23
|
+
export * from "./NysIconlist.js";
|
|
24
|
+
export * from "./NysIconlistitem.js";
|
|
22
25
|
export * from "./NysLabel.js";
|
|
23
26
|
export * from "./NysModal.js";
|
|
24
27
|
export * from "./NysPagination.js";
|
|
28
|
+
export * from "./NysProcesslist.js";
|
|
29
|
+
export * from "./NysProcesslistitem.js";
|
|
25
30
|
export * from "./NysRadiobutton.js";
|
|
26
31
|
export * from "./NysRadiogroup.js";
|
|
27
32
|
export * from "./NysOption.js";
|
|
@@ -39,4 +44,6 @@ export * from "./NysToggle.js";
|
|
|
39
44
|
export * from "./NysTooltip.js";
|
|
40
45
|
export * from "./NysUnavFooter.js";
|
|
41
46
|
export * from "./NysUnavHeader.js";
|
|
47
|
+
export * from "./NysVerticalnav.js";
|
|
48
|
+
export * from "./NysVerticalnavGroup.js";
|
|
42
49
|
export * from "./NysVideo.js";
|