@nysds/components 1.19.3-alpha-1 → 1.19.4
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 +1243 -203
- package/dist/.vscode/vscode.html-custom-data.json +13 -13
- package/dist/custom-elements.json +1243 -203
- package/dist/nys-icon.library-r6nNUTzA.js +696 -0
- package/dist/nys-icon.library-r6nNUTzA.js.map +1 -0
- package/dist/nysds.es.js +2746 -2617
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +757 -155
- 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 +170 -35
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +13 -22
- package/dist/packages/nys-table/src/nys-table.d.ts +80 -1
- 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/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 +1 -1
- package/packages/react/NysUnavHeader.d.ts +11 -1
- package/packages/react/NysUnavHeader.js +15 -1
- package/packages/react/nysds-jsx.d.ts +64 -19
|
@@ -5,19 +5,51 @@ import { LitElement } from "lit";
|
|
|
5
5
|
* Link to a trigger element via `for` attribute matching the trigger's `id`. Tooltip appears on hover or focus
|
|
6
6
|
* and dismisses on blur, mouse leave, or Escape key. Use for supplementary info only—not critical content.
|
|
7
7
|
*
|
|
8
|
+
* @accessibility
|
|
9
|
+
* - Linked to trigger element via `for` attribute (must match trigger's `id`).
|
|
10
|
+
* - `role="tooltip"` with dynamic `aria-hidden` based on visibility.
|
|
11
|
+
* - Keyboard accessible: Tab to trigger, Enter/Space shows tooltip, Escape dismisses.
|
|
12
|
+
* - Screen readers announce tooltip text when visible.
|
|
13
|
+
* - Visual focus indicators on trigger elements meet WCAG 2.2 AA standards.
|
|
14
|
+
* - Auto-positioning respects viewport bounds to prevent content loss.
|
|
15
|
+
*
|
|
8
16
|
* @summary Contextual tooltip with auto-positioning, keyboard support, and screen reader integration.
|
|
9
17
|
* @element nys-tooltip
|
|
10
18
|
*
|
|
11
|
-
* @example
|
|
19
|
+
* @example Basic
|
|
20
|
+
* ```html
|
|
21
|
+
* <div style="display: flex; justify-content: center; gap: 5px; padding: 40px;">
|
|
22
|
+
* <nys-tooltip for="my-button" text="I am a tooltip."></nys-tooltip>
|
|
23
|
+
* <nys-button id="my-button" label="Hover Me"></nys-button>
|
|
24
|
+
* </div>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Position
|
|
12
28
|
* ```html
|
|
13
|
-
* <
|
|
14
|
-
*
|
|
29
|
+
* <div style="display: flex; justify-content: center; gap: 5px; padding: 40px;">
|
|
30
|
+
* <p>Hover over the icon</p>
|
|
31
|
+
* <nys-tooltip
|
|
32
|
+
* for="my-icon2"
|
|
33
|
+
* text="I am a tooltip."
|
|
34
|
+
* position="right"
|
|
35
|
+
* >
|
|
36
|
+
* </nys-tooltip>
|
|
37
|
+
* <nys-icon id="my-icon2" name="info" size="3xl"></nys-icon>
|
|
38
|
+
* </div>
|
|
15
39
|
* ```
|
|
16
40
|
*
|
|
17
|
-
* @example
|
|
41
|
+
* @example Inverted
|
|
18
42
|
* ```html
|
|
19
|
-
* <
|
|
20
|
-
*
|
|
43
|
+
* <div style="background-color: #1b1b1b; color: #ffffff; padding: 40px; display: flex; gap: 5px">
|
|
44
|
+
* <p>Hover over the icon</p>
|
|
45
|
+
* <nys-tooltip
|
|
46
|
+
* for="my-tooltip3"
|
|
47
|
+
* text="I am a tooltip."
|
|
48
|
+
* inverted
|
|
49
|
+
* >
|
|
50
|
+
* </nys-tooltip>
|
|
51
|
+
* <nys-icon id="my-tooltip3" name="info" size="3xl"></nys-icon>
|
|
52
|
+
* </div>
|
|
21
53
|
* ```
|
|
22
54
|
*/
|
|
23
55
|
export declare class NysTooltip extends LitElement {
|
|
@@ -5,12 +5,20 @@ import { LitElement } from "lit";
|
|
|
5
5
|
* Place as the last element before `</body>`. Displays NY.gov logo and links to Agencies,
|
|
6
6
|
* App Directory, Counties, Events, Programs, and Services. No configuration needed.
|
|
7
7
|
*
|
|
8
|
+
* @accessibility
|
|
9
|
+
* - Uses semantic `<footer>` element for assistive technology recognition.
|
|
10
|
+
* - All links are keyboard-navigable via Tab.
|
|
11
|
+
* - Proper link text for screen reader users.
|
|
12
|
+
* - Links open in same window (no target="_blank") unless external policy requires otherwise.
|
|
13
|
+
* - Visual design meets WCAG 2.2 AA contrast and focus indicator standards.
|
|
14
|
+
* - Footer is not hidden from screen readers and is announced as navigation.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
8
17
|
* @summary Universal NYS footer with logo and statewide links. Required site-wide.
|
|
9
18
|
* @element nys-unavfooter
|
|
10
19
|
*
|
|
11
|
-
* @example
|
|
20
|
+
* @example Basic
|
|
12
21
|
* ```html
|
|
13
|
-
* <nys-globalfooter>...</nys-globalfooter>
|
|
14
22
|
* <nys-unavfooter></nys-unavfooter>
|
|
15
23
|
* ```
|
|
16
24
|
*/
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
interface Language {
|
|
3
|
+
code: string;
|
|
4
|
+
label: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* Universal NYS header with trust bar, logo, search, and language translation. Required on all NYS sites.
|
|
4
9
|
*
|
|
@@ -6,25 +11,66 @@ import { LitElement } from "lit";
|
|
|
6
11
|
* site search (searches ny.gov), and 14-language translation dropdown. Use `hideSearch` or `hideTranslate`
|
|
7
12
|
* to remove features if not applicable.
|
|
8
13
|
*
|
|
14
|
+
* @accessibility
|
|
15
|
+
* - Semantic `<header>` element ensures assistive technology recognition.
|
|
16
|
+
* - Trust bar button: `role="button"`, `aria-expanded`, descriptive `aria-label`.
|
|
17
|
+
* - All links and buttons are keyboard-navigable via Tab.
|
|
18
|
+
* - Language dropdown announces current language and list on focus.
|
|
19
|
+
* - Search input announces field purpose and keyboard shortcuts (Enter to submit, Escape to dismiss).
|
|
20
|
+
* - Visual focus indicators meet WCAG 2.2 AA standards.
|
|
21
|
+
* - All text has sufficient color contrast (4.5:1 minimum).
|
|
22
|
+
* - Icons have text labels or `aria-label` attributes.
|
|
23
|
+
*
|
|
9
24
|
* @summary Universal NYS header with trust bar, search, and translation. Required site-wide.
|
|
10
25
|
* @element nys-unavheader
|
|
11
26
|
*
|
|
12
|
-
* @
|
|
27
|
+
* @fires nys-language-select - Fired when a language is selected. Detail: `{language: {code, label, url?}}`. Cancelable; `preventDefault()` overrides the default Smartling redirect.
|
|
28
|
+
* @fires nys-search-submit - Fired when a search is submitted. Detail: `{query}`. Cancelable; `preventDefault()` overrides the default search redirect.
|
|
29
|
+
*
|
|
30
|
+
* @example Basic
|
|
13
31
|
* ```html
|
|
14
32
|
* <nys-unavheader></nys-unavheader>
|
|
15
|
-
* <nys-globalheader>...</nys-globalheader>
|
|
16
33
|
* ```
|
|
17
34
|
*
|
|
18
|
-
* @example
|
|
35
|
+
* @example Hide search
|
|
19
36
|
* ```html
|
|
20
37
|
* <nys-unavheader hideSearch></nys-unavheader>
|
|
21
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Hide translate
|
|
41
|
+
* ```html
|
|
42
|
+
* <nys-unavheader hideTranslate></nys-unavheader>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example Custom Search URL
|
|
46
|
+
* ```html
|
|
47
|
+
* <nys-unavheader searchUrl="https://designsystem.ny.gov/search/?q="></nys-unavheader>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Custom Language List
|
|
51
|
+
* ```html
|
|
52
|
+
* <nys-unavheader id="my-header"></nys-unavheader>
|
|
53
|
+
* <script>
|
|
54
|
+
* const header = document.querySelector('#my-header');
|
|
55
|
+
* header.languages = [
|
|
56
|
+
* { code: 'en', label: 'English' },
|
|
57
|
+
* { code: 'es', label: 'Español' , url: '"https://ny.gov/?lang=es"'},
|
|
58
|
+
* { code: 'fr', label: 'Français', url: '"https://ny.gov/?lang=fr"'},
|
|
59
|
+
* ];
|
|
60
|
+
* </script>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example Custom Language List JS
|
|
64
|
+
* ```html
|
|
65
|
+
* <nys-unavheader id="my-header2"></nys-unavheader>
|
|
66
|
+
* <script>
|
|
67
|
+
* document.querySelector('#my-header2').addEventListener('nys-language-select', (event) => {
|
|
68
|
+
* event.preventDefault();
|
|
69
|
+
* const selectedLanguage = event.detail.language.label;
|
|
70
|
+
* });
|
|
71
|
+
* </script>
|
|
72
|
+
* ```
|
|
22
73
|
*/
|
|
23
|
-
interface Language {
|
|
24
|
-
code: string;
|
|
25
|
-
label: string;
|
|
26
|
-
url?: string;
|
|
27
|
-
}
|
|
28
74
|
export declare class NysUnavHeader extends LitElement {
|
|
29
75
|
static styles: import("lit").CSSResult;
|
|
30
76
|
/** Internal: Whether trust bar panel is expanded. */
|
|
@@ -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
|
+
"version": "1.19.4",
|
|
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
|
*
|
|
@@ -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. */
|
|
@@ -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,
|