@nysds/components 1.19.3-alpha-1 → 1.19.3
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 +1156 -195
- package/dist/.vscode/vscode.html-custom-data.json +10 -10
- package/dist/custom-elements.json +1156 -195
- package/dist/nys-icon.library-ChLRj3i-.js +696 -0
- package/dist/nys-icon.library-ChLRj3i-.js.map +1 -0
- package/dist/nysds.es.js +1747 -1676
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +750 -147
- package/dist/nysds.js.map +1 -1
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +35 -6
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +8 -3
- package/dist/packages/nys-alert/src/nys-alert.d.ts +81 -4
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +44 -4
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +70 -3
- package/dist/packages/nys-badge/src/nys-badge.d.ts +54 -4
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +75 -7
- package/dist/packages/nys-button/src/nys-button.d.ts +62 -7
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +5 -7
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +75 -1
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +164 -0
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +64 -8
- package/dist/packages/nys-divider/src/nys-divider.d.ts +24 -1
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +19 -12
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +0 -10
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +10 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +94 -4
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +50 -7
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +65 -4
- 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 +83 -6
- package/dist/packages/nys-label/src/nys-label.d.ts +32 -2
- package/dist/packages/nys-modal/src/nys-modal.d.ts +130 -5
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +11 -1
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +4 -3
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +74 -1
- package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
- package/dist/packages/nys-select/src/nys-select.d.ts +141 -10
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +2 -2
- package/dist/packages/nys-stepper/src/nys-step.d.ts +0 -13
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +119 -69
- package/dist/packages/nys-tab/src/nys-tab.d.ts +17 -8
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +77 -15
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +0 -17
- package/dist/packages/nys-table/src/nys-table.d.ts +71 -0
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +52 -5
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +63 -9
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +40 -4
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +38 -6
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +10 -2
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +54 -8
- package/dist/packages/nys-video/src/nys-video.d.ts +65 -3
- package/package.json +11 -5
- package/packages/react/NysBreadcrumbs.d.ts +1 -1
- package/packages/react/NysButton.d.ts +2 -1
- package/packages/react/NysDropdownMenu.d.ts +1 -1
- package/packages/react/NysFileinput.d.ts +24 -2
- package/packages/react/NysFileinput.js +8 -1
- package/packages/react/NysGlobalHeader.d.ts +6 -1
- package/packages/react/NysLabel.d.ts +4 -1
- package/packages/react/NysTextarea.d.ts +1 -1
- package/packages/react/NysUnavHeader.d.ts +11 -1
- package/packages/react/NysUnavHeader.js +15 -1
- package/packages/react/nysds-jsx.d.ts +47 -10
|
@@ -13,16 +13,78 @@ declare global {
|
|
|
13
13
|
*
|
|
14
14
|
* For use with YouTube URLs only. Component renders nothing if the URL is invalid.
|
|
15
15
|
*
|
|
16
|
+
* @accessibility
|
|
17
|
+
* - Title text is announced to screen readers when the video is not yet loaded.
|
|
18
|
+
* - When the video loads, the iframe title and aria-label are set to the `titleText`.
|
|
19
|
+
* - Live region announces playback state ("Video is playing", "Advertisement is playing").
|
|
20
|
+
* - Play button is properly labeled and keyboard accessible.
|
|
21
|
+
* - Disabled state prevents play button interaction.
|
|
22
|
+
* - Focus is transferred to the iframe once the video is loaded (for keyboard users).
|
|
23
|
+
*
|
|
16
24
|
* @summary YouTube video player with thumbnail preview and accessibility announcements.
|
|
17
25
|
* @element nys-video
|
|
18
26
|
*
|
|
19
27
|
* @fires nys-video-play - Fired when the user clicks the thumbnail to load the player.
|
|
20
28
|
*
|
|
21
|
-
* @example Basic
|
|
29
|
+
* @example Basic
|
|
30
|
+
* ```html
|
|
31
|
+
* <nys-video
|
|
32
|
+
* videourl="https://www.youtube.com/watch?v=TBfFzt0150Q"
|
|
33
|
+
* titleText="IT'S a Tech Podcast, Episode 3: Human-Centered Design"
|
|
34
|
+
* ></nys-video>
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example Thumbnail
|
|
38
|
+
* ```html
|
|
39
|
+
* <nys-video
|
|
40
|
+
* videourl="https://www.youtube.com/watch?v=TBfFzt0150Q"
|
|
41
|
+
* titleText="IT'S a Tech Podcast, Episode 3: Human-Centered Design"
|
|
42
|
+
* thumbnail="https://designsystem.ny.gov/assets/img/homepage-grid-3.svg"
|
|
43
|
+
* ></nys-video>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Autoplay
|
|
47
|
+
* ```html
|
|
48
|
+
* <nys-video
|
|
49
|
+
* videourl="https://www.youtube.com/watch?v=TBfFzt0150Q"
|
|
50
|
+
* titleText="IT'S a Tech Podcast, Episode 3: Human-Centered Design"
|
|
51
|
+
* autoplay
|
|
52
|
+
* ></nys-video>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @example Start Time
|
|
56
|
+
* ```html
|
|
57
|
+
* <nys-video
|
|
58
|
+
* videourl="https://www.youtube.com/watch?v=TBfFzt0150Q"
|
|
59
|
+
* titleText="IT'S a Tech Podcast, Episode 3: Human-Centered Design"
|
|
60
|
+
* starttime="43"
|
|
61
|
+
* ></nys-video>
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Disabled
|
|
65
|
+
* ```html
|
|
66
|
+
* <nys-video
|
|
67
|
+
* videourl="https://www.youtube.com/watch?v=TBfFzt0150Q"
|
|
68
|
+
* titleText="IT'S a Tech Podcast, Episode 3: Human-Centered Design"
|
|
69
|
+
* disabled
|
|
70
|
+
* ></nys-video>
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example Size full
|
|
74
|
+
* ```html
|
|
75
|
+
* <nys-video
|
|
76
|
+
* size="full"
|
|
77
|
+
* videourl="https://www.youtube.com/watch?v=TBfFzt0150Q"
|
|
78
|
+
* titleText="Small (width: 320-439px)"
|
|
79
|
+
* ></nys-video>
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example Size small
|
|
22
83
|
* ```html
|
|
23
84
|
* <nys-video
|
|
24
|
-
*
|
|
25
|
-
*
|
|
85
|
+
* size="sm"
|
|
86
|
+
* videourl="https://www.youtube.com/watch?v=TBfFzt0150Q"
|
|
87
|
+
* titleText="Small (width: 320-439px)"
|
|
26
88
|
* ></nys-video>
|
|
27
89
|
* ```
|
|
28
90
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/components",
|
|
3
|
-
"version": "1.19.3
|
|
3
|
+
"version": "1.19.3",
|
|
4
4
|
"description": "New York State's design system and code component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -29,12 +29,14 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"dev": "vite",
|
|
31
31
|
"gen": "plop",
|
|
32
|
+
"gen-stories": "npm run cem && node src/scripts/generate-stories.mjs",
|
|
33
|
+
"gen-stories:component": "npm run cem && sh -c 'node src/scripts/generate-stories.mjs \"$@\" && npm run lint:fix' --",
|
|
32
34
|
"build": "tsc --emitDeclarationOnly && vite build",
|
|
33
35
|
"build:umd": "cross-env BUILD_FORMAT=umd vite build",
|
|
34
36
|
"tsc:packages": "tsc -b tsconfig.build.json",
|
|
35
37
|
"build:packages": "npm run tsc:packages && turbo run build --filter='./packages/*' --log-order=grouped",
|
|
36
38
|
"build:root": "cross-env NODE_ENV=production npm run build && cross-env NODE_ENV=production npm run build:umd",
|
|
37
|
-
"build:all": "npm run clean:dist && npm run
|
|
39
|
+
"build:all": "npm run clean:dist && npm run lit-analyze || true && cross-env NODE_ENV=production npm run build:packages && npm run build:root && npm run cem && npm run gen-stories && npm run build:mcp && npm run lint:fix",
|
|
38
40
|
"build:mcp": "npm run build -w @nysds/mcp-server",
|
|
39
41
|
"build:link": "npm run build:all && npm link && cd packages/styles && npm link",
|
|
40
42
|
"lint": "eslint --cache --cache-strategy=content --cache-location node_modules/.cache/eslint && (stylelint \"**/*.scss\" || true)",
|
|
@@ -47,7 +49,8 @@
|
|
|
47
49
|
"release:zip": "npm run build:all && node src/scripts/create-release-zip.js",
|
|
48
50
|
"pretest": "playwright install",
|
|
49
51
|
"test": "wtr --node-resolve",
|
|
50
|
-
"test:ssr": "node scripts/test-ssr.mjs",
|
|
52
|
+
"test:ssr": "node src/scripts/test-ssr.mjs && npm run audit:dist",
|
|
53
|
+
"audit:dist": "node src/scripts/audit-dist.mjs",
|
|
51
54
|
"test:build": "npm run build:all && npm run test",
|
|
52
55
|
"test:compact": "export NYSDS_TEST_OUTPUT=compact && wtr --node-resolve",
|
|
53
56
|
"test:ai": "export NYSDS_TEST_OUTPUT=ai && wtr --node-resolve",
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
"clean:cache": "rm -rf node_modules/.cache",
|
|
63
66
|
"clean:all": "npm run clean:dist && npm run clean:node && npm run clean:cache && find packages -name '*.tsbuildinfo' -delete 2>/dev/null || true && npm run clean:turbo",
|
|
64
67
|
"code-connect": "dotenv -- npx figma connect publish",
|
|
65
|
-
"cem": "npx cem analyze --config
|
|
68
|
+
"cem": "npx cem analyze --config src/scripts/custom-elements-manifest.config.mjs && cp ./custom-elements.json dist/ && node src/scripts/patch-react-utils.js"
|
|
66
69
|
},
|
|
67
70
|
"repository": {
|
|
68
71
|
"type": "git",
|
|
@@ -136,5 +139,8 @@
|
|
|
136
139
|
"dompurify": "^3.4.7",
|
|
137
140
|
"wc-datepicker": "^0.10.0"
|
|
138
141
|
},
|
|
139
|
-
"sideEffects": true
|
|
142
|
+
"sideEffects": true,
|
|
143
|
+
"peerDependencies": {
|
|
144
|
+
"lit": "^3.3.1"
|
|
145
|
+
}
|
|
140
146
|
}
|
|
@@ -84,6 +84,6 @@ Override when multiple crumbs exist on the same page. */
|
|
|
84
84
|
* - **nys-breadcrumbs-expand** - Fired when the user clicks the ellipsis to expand the trail.
|
|
85
85
|
*
|
|
86
86
|
* ### **Slots:**
|
|
87
|
-
* - _default_ - One or more `
|
|
87
|
+
* - _default_ - One or more `li` elements defining the trail.
|
|
88
88
|
*/
|
|
89
89
|
export const NysBreadcrumbs: React.ForwardRefExoticComponent<NysBreadcrumbsProps>;
|
|
@@ -123,7 +123,8 @@ export interface NysButtonProps extends Pick<
|
|
|
123
123
|
* - **nys-click** - Fired when the button is clicked (mouse or keyboard). Not fired when disabled.
|
|
124
124
|
*
|
|
125
125
|
* ### **Slots:**
|
|
126
|
-
* -
|
|
126
|
+
* - _default_ - Button label text. Use as fallback when `label` prop is not provided.
|
|
127
|
+
* - **prefix-icon** - Icon before label. Not shown for `text` variant.
|
|
127
128
|
* - **suffix-icon** - Icon after label. Not shown for `text` variant.
|
|
128
129
|
* - **circle-icon** - Icon for circle mode. Overrides `icon` prop.
|
|
129
130
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
NysFileinput as NysFileinputElement,
|
|
4
|
+
Event,
|
|
4
5
|
CustomEvent,
|
|
5
6
|
} from "../../dist/nysds.es.js";
|
|
6
7
|
|
|
7
|
-
export type { NysFileinputElement, CustomEvent };
|
|
8
|
+
export type { NysFileinputElement, Event, CustomEvent };
|
|
8
9
|
|
|
9
10
|
export interface NysFileinputProps extends Pick<
|
|
10
11
|
React.AllHTMLAttributes<HTMLElement>,
|
|
@@ -90,6 +91,20 @@ export interface NysFileinputProps extends Pick<
|
|
|
90
91
|
/** 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. */
|
|
91
92
|
tabIndex?: number;
|
|
92
93
|
|
|
94
|
+
/** The currently selected files. Read to get the current selection; set to
|
|
95
|
+
replace it (e.g. rehydrating state after navigation, or binding from a
|
|
96
|
+
framework form model). Property-only — a `File[]` cannot round-trip through
|
|
97
|
+
an HTML attribute. Setting this is silent (does not emit `nys-change`),
|
|
98
|
+
matching native input behavior and avoiding feedback loops in two-way bindings. */
|
|
99
|
+
files?: NysFileinputElement["files"];
|
|
100
|
+
|
|
101
|
+
/** Single-file convenience accessor (parity with `nys-textinput`'s `value`).
|
|
102
|
+
Reads the first selected file (or `null`); setting replaces the selection. */
|
|
103
|
+
value?: NysFileinputElement["value"];
|
|
104
|
+
|
|
105
|
+
/** Fired when focus leaves the component. Triggers validation. */
|
|
106
|
+
onNysBlur?: (event: CustomEvent) => void;
|
|
107
|
+
|
|
93
108
|
/** Fired when files are added or removed. Detail: `{id, files}`. */
|
|
94
109
|
onNysChange?: (event: CustomEvent) => void;
|
|
95
110
|
}
|
|
@@ -100,7 +115,14 @@ export interface NysFileinputProps extends Pick<
|
|
|
100
115
|
*
|
|
101
116
|
*
|
|
102
117
|
* ### **Events:**
|
|
103
|
-
* - **nys-
|
|
118
|
+
* - **nys-blur** - Fired when focus leaves the component. Triggers validation.
|
|
119
|
+
* - **nys-change** - Fired when files are added or removed. Detail: `{id, files}`.
|
|
120
|
+
*
|
|
121
|
+
* ### **Methods:**
|
|
122
|
+
* - **setFiles(incoming: _File[]_): _Promise<void>_** - Programmatically set the selection and await async validation/processing.
|
|
123
|
+
* Same as assigning `files`, but resolves once every file has finished its
|
|
124
|
+
* magic-byte validation and read — use when you need to read `checkValidity()`
|
|
125
|
+
* or the settled selection immediately after.
|
|
104
126
|
*
|
|
105
127
|
* ### **Slots:**
|
|
106
128
|
* - **description** - Custom HTML description content.
|
|
@@ -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 NysFileinput = forwardRef((props, forwardedRef) => {
|
|
6
6
|
const ref = useRef(null);
|
|
@@ -21,12 +21,19 @@ export const NysFileinput = forwardRef((props, forwardedRef) => {
|
|
|
21
21
|
accept,
|
|
22
22
|
errorMessage,
|
|
23
23
|
width,
|
|
24
|
+
files,
|
|
25
|
+
value,
|
|
24
26
|
...filteredProps
|
|
25
27
|
} = props;
|
|
26
28
|
|
|
27
29
|
/** Event listeners - run once */
|
|
30
|
+
useEventListener(ref, "nys-blur", props.onNysBlur);
|
|
28
31
|
useEventListener(ref, "nys-change", props.onNysChange);
|
|
29
32
|
|
|
33
|
+
/** Properties - run whenever a property has changed */
|
|
34
|
+
useProperties(ref, "files", props.files);
|
|
35
|
+
useProperties(ref, "value", props.value);
|
|
36
|
+
|
|
30
37
|
return React.createElement(
|
|
31
38
|
"nys-fileinput",
|
|
32
39
|
{
|
|
@@ -18,7 +18,11 @@ export interface NysGlobalHeaderProps extends Pick<
|
|
|
18
18
|
| "onFocus"
|
|
19
19
|
| "onBlur"
|
|
20
20
|
> {
|
|
21
|
-
/**
|
|
21
|
+
/** Displays the NYS brand mark in the header. Off by default.
|
|
22
|
+
|
|
23
|
+
Enable only for internal, state-employee (back-office) applications that omit
|
|
24
|
+
`nys-unavheader`. Any resident-facing app — even one requiring login — should
|
|
25
|
+
keep `nys-unavheader` for trust and leave this off. */
|
|
22
26
|
nysLogo?: boolean;
|
|
23
27
|
|
|
24
28
|
/** Application name displayed prominently. */
|
|
@@ -59,5 +63,6 @@ export interface NysGlobalHeaderProps extends Pick<
|
|
|
59
63
|
*
|
|
60
64
|
* ### **Slots:**
|
|
61
65
|
* - _default_ - Navigation content (typically `<ul>` with `<li><a>` links). Auto-sanitized.
|
|
66
|
+
* - **user-actions** - User-account controls (e.g. profile link, settings, log-out button) shown in the header.
|
|
62
67
|
*/
|
|
63
68
|
export const NysGlobalHeader: React.ForwardRefExoticComponent<NysGlobalHeaderProps>;
|
|
@@ -65,7 +65,10 @@ export interface NysLabelProps extends Pick<
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Internal
|
|
68
|
+
* **Internal component.** Renders form labels with description, required/optional flag, and tooltip.
|
|
69
|
+
*
|
|
70
|
+
* Used internally by form components (textinput, select, checkbox, etc.). Not intended for direct use.
|
|
71
|
+
* Handles label association via `for`, displays asterisk for required fields, and integrates tooltips.
|
|
69
72
|
* ---
|
|
70
73
|
*
|
|
71
74
|
*
|
|
@@ -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. */
|
|
@@ -62,11 +62,21 @@ export interface NysUnavHeaderProps extends Pick<
|
|
|
62
62
|
|
|
63
63
|
/** 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
64
|
tabIndex?: number;
|
|
65
|
+
|
|
66
|
+
/** Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect. */
|
|
67
|
+
onNysLanguageSelect?: (event: CustomEvent) => void;
|
|
68
|
+
|
|
69
|
+
/** Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect. */
|
|
70
|
+
onNysSearchSubmit?: (event: CustomEvent) => void;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
/**
|
|
68
|
-
*
|
|
74
|
+
* Universal NYS header with trust bar, search, and translation. Required site-wide.
|
|
69
75
|
* ---
|
|
70
76
|
*
|
|
77
|
+
*
|
|
78
|
+
* ### **Events:**
|
|
79
|
+
* - **nys-language-select** - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect.
|
|
80
|
+
* - **nys-search-submit** - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
71
81
|
*/
|
|
72
82
|
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,
|
|
@@ -14,9 +16,21 @@ export const NysUnavHeader = forwardRef((props, forwardedRef) => {
|
|
|
14
16
|
...filteredProps
|
|
15
17
|
} = props;
|
|
16
18
|
|
|
19
|
+
/** Event listeners - run once */
|
|
20
|
+
useEventListener(ref, "nys-language-select", props.onNysLanguageSelect);
|
|
21
|
+
useEventListener(ref, "nys-search-submit", props.onNysSearchSubmit);
|
|
22
|
+
|
|
17
23
|
return React.createElement(
|
|
18
24
|
"nys-unavheader",
|
|
19
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
|
+
},
|
|
20
34
|
...filteredProps,
|
|
21
35
|
searchUrl: props.searchUrl,
|
|
22
36
|
languages: props.languages,
|
|
@@ -180,7 +180,7 @@ export type NysBreadcrumbsProps = {
|
|
|
180
180
|
Override when multiple crumbs exist on the same page. */
|
|
181
181
|
ariaLabel?: string;
|
|
182
182
|
/** Controls the visual size of the breadcrumb text and spacing: `sm` for dense layouts, `md` (default) for standard use. */
|
|
183
|
-
size?: "sm" | "md"
|
|
183
|
+
size?: "sm" | "md";
|
|
184
184
|
/** On mobile, renders the trail as a single back-to-parent link pointing to the item before the current page.
|
|
185
185
|
Has no effect on desktop or when only one item is present (which always renders as a back link). */
|
|
186
186
|
backToParent?: boolean;
|
|
@@ -287,6 +287,8 @@ export type NysCheckboxProps = {
|
|
|
287
287
|
showOtherError?: boolean;
|
|
288
288
|
/** */
|
|
289
289
|
_hasDescription?: string;
|
|
290
|
+
/** */
|
|
291
|
+
_isStandalone?: string;
|
|
290
292
|
/** Fired when checked state changes. Detail: `{id, checked, name, value}`. */
|
|
291
293
|
"onnys-change"?: (e: CustomEvent<CustomEvent>) => void;
|
|
292
294
|
/** Fired when "other" text input value changes. Detail: `{id, name, value}`. */
|
|
@@ -496,7 +498,17 @@ export type NysFileinputProps = {
|
|
|
496
498
|
width?: "lg" | "full";
|
|
497
499
|
/** Adjusts colors for dark backgrounds. */
|
|
498
500
|
inverted?: boolean;
|
|
499
|
-
|
|
501
|
+
/** The currently selected files. Read to get the current selection; set to
|
|
502
|
+
replace it (e.g. rehydrating state after navigation, or binding from a
|
|
503
|
+
framework form model). Property-only — a `File[]` cannot round-trip through
|
|
504
|
+
an HTML attribute. Setting this is silent (does not emit `nys-change`),
|
|
505
|
+
matching native input behavior and avoiding feedback loops in two-way bindings. */
|
|
506
|
+
files?: File[];
|
|
507
|
+
/** Single-file convenience accessor (parity with `nys-textinput`'s `value`).
|
|
508
|
+
Reads the first selected file (or `null`); setting replaces the selection. */
|
|
509
|
+
value?: File | null;
|
|
510
|
+
/** Fired when focus leaves the component. Triggers validation. */
|
|
511
|
+
"onnys-blur"?: (e: CustomEvent<Event>) => void;
|
|
500
512
|
/** Fired when files are added or removed. Detail: `{id, files}`. */
|
|
501
513
|
"onnys-change"?: (e: CustomEvent<CustomEvent>) => void;
|
|
502
514
|
};
|
|
@@ -531,7 +543,11 @@ export type NysGlobalHeaderProps = {
|
|
|
531
543
|
agencyName?: string;
|
|
532
544
|
/** URL for the header title link. If empty, title is not clickable. */
|
|
533
545
|
homepageLink?: string;
|
|
534
|
-
/**
|
|
546
|
+
/** Displays the NYS brand mark in the header. Off by default.
|
|
547
|
+
|
|
548
|
+
Enable only for internal, state-employee (back-office) applications that omit
|
|
549
|
+
`nys-unavheader`. Any resident-facing app — even one requiring login — should
|
|
550
|
+
keep `nys-unavheader` for trust and leave this off. */
|
|
535
551
|
nysLogo?: boolean;
|
|
536
552
|
};
|
|
537
553
|
|
|
@@ -862,7 +878,7 @@ export type NysTextareaProps = {
|
|
|
862
878
|
value?: string;
|
|
863
879
|
/** Prevents interaction. */
|
|
864
880
|
disabled?: boolean;
|
|
865
|
-
/** Makes textarea
|
|
881
|
+
/** Makes textarea readonly but focusable. */
|
|
866
882
|
readonly?: boolean;
|
|
867
883
|
/** Marks as required. Shows "Required" flag and validates on blur. */
|
|
868
884
|
required?: boolean;
|
|
@@ -1019,6 +1035,11 @@ export type NysUnavHeaderProps = {
|
|
|
1019
1035
|
searchUrl?: string;
|
|
1020
1036
|
/** The list of languages this site can be translated to, default to use Smartling */
|
|
1021
1037
|
languages?: Language[];
|
|
1038
|
+
|
|
1039
|
+
/** Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect. */
|
|
1040
|
+
"onnys-language-select"?: (e: CustomEvent<never>) => void;
|
|
1041
|
+
/** Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect. */
|
|
1042
|
+
"onnys-search-submit"?: (e: CustomEvent<never>) => void;
|
|
1022
1043
|
};
|
|
1023
1044
|
|
|
1024
1045
|
export type NysVideoProps = {
|
|
@@ -1123,7 +1144,7 @@ export type CustomElements = {
|
|
|
1123
1144
|
* - **nys-breadcrumbs-expand** - Fired when the user clicks the ellipsis to expand the trail.
|
|
1124
1145
|
*
|
|
1125
1146
|
* ### **Slots:**
|
|
1126
|
-
* - _default_ - One or more `
|
|
1147
|
+
* - _default_ - One or more `li` elements defining the trail.
|
|
1127
1148
|
*/
|
|
1128
1149
|
"nys-breadcrumbs": Partial<NysBreadcrumbsProps & BaseProps & BaseEvents>;
|
|
1129
1150
|
|
|
@@ -1138,7 +1159,8 @@ export type CustomElements = {
|
|
|
1138
1159
|
* - **nys-click** - Fired when the button is clicked (mouse or keyboard). Not fired when disabled.
|
|
1139
1160
|
*
|
|
1140
1161
|
* ### **Slots:**
|
|
1141
|
-
* -
|
|
1162
|
+
* - _default_ - Button label text. Use as fallback when `label` prop is not provided.
|
|
1163
|
+
* - **prefix-icon** - Icon before label. Not shown for `text` variant.
|
|
1142
1164
|
* - **suffix-icon** - Icon after label. Not shown for `text` variant.
|
|
1143
1165
|
* - **circle-icon** - Icon for circle mode. Overrides `icon` prop.
|
|
1144
1166
|
*
|
|
@@ -1240,7 +1262,7 @@ export type CustomElements = {
|
|
|
1240
1262
|
"nys-divider": Partial<NysDividerProps & BaseProps & BaseEvents>;
|
|
1241
1263
|
|
|
1242
1264
|
/**
|
|
1243
|
-
*
|
|
1265
|
+
* Action menu with auto-positioning, keyboard support, and screen reader integration.
|
|
1244
1266
|
* ---
|
|
1245
1267
|
*
|
|
1246
1268
|
*/
|
|
@@ -1269,7 +1291,14 @@ export type CustomElements = {
|
|
|
1269
1291
|
*
|
|
1270
1292
|
*
|
|
1271
1293
|
* ### **Events:**
|
|
1272
|
-
* - **nys-
|
|
1294
|
+
* - **nys-blur** - Fired when focus leaves the component. Triggers validation.
|
|
1295
|
+
* - **nys-change** - Fired when files are added or removed. Detail: `{id, files}`.
|
|
1296
|
+
*
|
|
1297
|
+
* ### **Methods:**
|
|
1298
|
+
* - **setFiles(incoming: _File[]_): _Promise<void>_** - Programmatically set the selection and await async validation/processing.
|
|
1299
|
+
* Same as assigning `files`, but resolves once every file has finished its
|
|
1300
|
+
* magic-byte validation and read — use when you need to read `checkValidity()`
|
|
1301
|
+
* or the settled selection immediately after.
|
|
1273
1302
|
*
|
|
1274
1303
|
* ### **Slots:**
|
|
1275
1304
|
* - **description** - Custom HTML description content.
|
|
@@ -1303,6 +1332,7 @@ export type CustomElements = {
|
|
|
1303
1332
|
*
|
|
1304
1333
|
* ### **Slots:**
|
|
1305
1334
|
* - _default_ - Navigation content (typically `<ul>` with `<li><a>` links). Auto-sanitized.
|
|
1335
|
+
* - **user-actions** - User-account controls (e.g. profile link, settings, log-out button) shown in the header.
|
|
1306
1336
|
*/
|
|
1307
1337
|
"nys-globalheader": Partial<NysGlobalHeaderProps & BaseProps & BaseEvents>;
|
|
1308
1338
|
|
|
@@ -1317,7 +1347,10 @@ export type CustomElements = {
|
|
|
1317
1347
|
"nys-icon": Partial<NysIconProps & BaseProps & BaseEvents>;
|
|
1318
1348
|
|
|
1319
1349
|
/**
|
|
1320
|
-
* Internal
|
|
1350
|
+
* **Internal component.** Renders form labels with description, required/optional flag, and tooltip.
|
|
1351
|
+
*
|
|
1352
|
+
* Used internally by form components (textinput, select, checkbox, etc.). Not intended for direct use.
|
|
1353
|
+
* Handles label association via `for`, displays asterisk for required fields, and integrates tooltips.
|
|
1321
1354
|
* ---
|
|
1322
1355
|
*
|
|
1323
1356
|
*
|
|
@@ -1596,9 +1629,13 @@ export type CustomElements = {
|
|
|
1596
1629
|
"nys-unavfooter": Partial<NysUnavFooterProps & BaseProps & BaseEvents>;
|
|
1597
1630
|
|
|
1598
1631
|
/**
|
|
1599
|
-
*
|
|
1632
|
+
* Universal NYS header with trust bar, search, and translation. Required site-wide.
|
|
1600
1633
|
* ---
|
|
1601
1634
|
*
|
|
1635
|
+
*
|
|
1636
|
+
* ### **Events:**
|
|
1637
|
+
* - **nys-language-select** - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect.
|
|
1638
|
+
* - **nys-search-submit** - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
1602
1639
|
*/
|
|
1603
1640
|
"nys-unavheader": Partial<NysUnavHeaderProps & BaseProps & BaseEvents>;
|
|
1604
1641
|
|