@nysds/components 1.20.0-alpha1 → 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.
Files changed (135) hide show
  1. package/custom-elements.json +7119 -3701
  2. package/dist/.vscode/vscode.css-custom-data.json +5 -0
  3. package/dist/.vscode/vscode.html-custom-data.json +317 -38
  4. package/dist/custom-elements.json +7119 -3701
  5. package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js +706 -0
  6. package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js.map +1 -0
  7. package/dist/nys-icon.library-eNVZmfkf.js +696 -0
  8. package/dist/nys-icon.library-eNVZmfkf.js.map +1 -0
  9. package/dist/nysds.es.js +9119 -4161
  10. package/dist/nysds.es.js.map +1 -1
  11. package/dist/nysds.js +2413 -492
  12. package/dist/nysds.js.map +1 -1
  13. package/dist/packages/internals/src/aria-associate.d.ts +41 -0
  14. package/dist/packages/internals/src/form-control-mixin.d.ts +34 -0
  15. package/dist/packages/internals/src/id.d.ts +8 -0
  16. package/dist/packages/internals/src/identified-mixin.d.ts +23 -0
  17. package/dist/packages/internals/src/index.d.ts +7 -0
  18. package/dist/packages/internals/src/reflects-aria-mixin.d.ts +33 -0
  19. package/dist/packages/internals/src/test-helpers.d.ts +29 -0
  20. package/dist/packages/internals/src/types.d.ts +9 -0
  21. package/dist/packages/nys-accordion/src/nys-accordion.d.ts +72 -10
  22. package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +63 -8
  23. package/dist/packages/nys-alert/src/nys-alert.d.ts +95 -20
  24. package/dist/packages/nys-avatar/src/nys-avatar.d.ts +100 -7
  25. package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +75 -5
  26. package/dist/packages/nys-badge/src/nys-badge.d.ts +63 -6
  27. package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +79 -10
  28. package/dist/packages/nys-button/src/nys-button.d.ts +132 -26
  29. package/dist/packages/nys-card/src/index.d.ts +1 -0
  30. package/dist/packages/nys-card/src/nys-card.d.ts +325 -0
  31. package/dist/packages/nys-card/src/nys-card.figma.d.ts +1 -0
  32. package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +37 -12
  33. package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +84 -6
  34. package/dist/packages/nys-combobox/src/nys-combobox.d.ts +174 -5
  35. package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +83 -13
  36. package/dist/packages/nys-divider/src/nys-divider.d.ts +33 -9
  37. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +24 -15
  38. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +3 -12
  39. package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +22 -0
  40. package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +129 -12
  41. package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +23 -2
  42. package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +99 -9
  43. package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +197 -7
  44. package/dist/packages/nys-icon/src/icon-cache.d.ts +11 -4
  45. package/dist/packages/nys-icon/src/icon-library-registry.d.ts +33 -16
  46. package/dist/packages/nys-icon/src/index.d.ts +2 -2
  47. package/dist/packages/nys-icon/src/nys-icon.d.ts +98 -8
  48. package/dist/packages/nys-iconlist/src/index.d.ts +2 -0
  49. package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +92 -0
  50. package/dist/packages/nys-iconlist/src/nys-iconlist.figma.d.ts +1 -0
  51. package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +32 -0
  52. package/dist/packages/nys-label/src/nys-label.d.ts +37 -2
  53. package/dist/packages/nys-modal/src/nys-modal.d.ts +145 -13
  54. package/dist/packages/nys-pagination/src/nys-pagination.d.ts +67 -3
  55. package/dist/packages/nys-processlist/src/index.d.ts +2 -0
  56. package/dist/packages/nys-processlist/src/nys-processlist.d.ts +184 -0
  57. package/dist/packages/nys-processlist/src/nys-processlist.figma.d.ts +1 -0
  58. package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +41 -0
  59. package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +201 -7
  60. package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +88 -6
  61. package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
  62. package/dist/packages/nys-select/src/nys-select.d.ts +150 -15
  63. package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +4 -4
  64. package/dist/packages/nys-stepper/src/nys-step.d.ts +26 -20
  65. package/dist/packages/nys-stepper/src/nys-stepper.d.ts +128 -75
  66. package/dist/packages/nys-tab/src/nys-tab.d.ts +19 -10
  67. package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +181 -39
  68. package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +15 -24
  69. package/dist/packages/nys-table/src/nys-table.d.ts +90 -3
  70. package/dist/packages/nys-textarea/src/nys-textarea.d.ts +60 -10
  71. package/dist/packages/nys-textinput/src/nys-textinput.d.ts +77 -14
  72. package/dist/packages/nys-toggle/src/nys-toggle.d.ts +47 -10
  73. package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +48 -8
  74. package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +45 -4
  75. package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +219 -10
  76. package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +421 -37
  77. package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +4 -54
  78. package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
  79. package/dist/src/index.d.ts +5 -2
  80. package/package.json +15 -7
  81. package/packages/react/NysAccordion.d.ts +10 -0
  82. package/packages/react/NysAccordion.js +2 -1
  83. package/packages/react/NysAccordionItem.d.ts +10 -0
  84. package/packages/react/NysAccordionItem.js +3 -1
  85. package/packages/react/NysAlert.d.ts +8 -10
  86. package/packages/react/NysAlert.js +0 -2
  87. package/packages/react/NysAvatar.d.ts +11 -1
  88. package/packages/react/NysBacktotop.d.ts +3 -0
  89. package/packages/react/NysBacktotop.js +2 -1
  90. package/packages/react/NysBreadcrumbs.d.ts +2 -2
  91. package/packages/react/NysButton.d.ts +38 -8
  92. package/packages/react/NysButton.js +6 -4
  93. package/packages/react/NysCard.d.ts +110 -0
  94. package/packages/react/NysCard.js +61 -0
  95. package/packages/react/NysCheckbox.d.ts +9 -0
  96. package/packages/react/NysCheckbox.js +4 -0
  97. package/packages/react/NysDropdownMenu.d.ts +4 -2
  98. package/packages/react/NysFileinput.d.ts +25 -3
  99. package/packages/react/NysFileinput.js +8 -1
  100. package/packages/react/NysGlobalFooter.d.ts +17 -0
  101. package/packages/react/NysGlobalFooter.js +10 -2
  102. package/packages/react/NysGlobalHeader.d.ts +23 -1
  103. package/packages/react/NysGlobalHeader.js +11 -2
  104. package/packages/react/NysIconlist.d.ts +54 -0
  105. package/packages/react/NysIconlist.js +22 -0
  106. package/packages/react/NysIconlistitem.d.ts +59 -0
  107. package/packages/react/NysIconlistitem.js +22 -0
  108. package/packages/react/NysLabel.d.ts +4 -1
  109. package/packages/react/NysModal.d.ts +8 -1
  110. package/packages/react/NysModal.js +11 -2
  111. package/packages/react/NysProcesslist.d.ts +65 -0
  112. package/packages/react/NysProcesslist.js +25 -0
  113. package/packages/react/NysProcesslistitem.d.ts +61 -0
  114. package/packages/react/NysProcesslistitem.js +35 -0
  115. package/packages/react/NysRadiobutton.d.ts +27 -3
  116. package/packages/react/NysRadiobutton.js +9 -1
  117. package/packages/react/NysSelect.d.ts +3 -0
  118. package/packages/react/NysSelect.js +2 -0
  119. package/packages/react/NysStepper.d.ts +1 -1
  120. package/packages/react/NysTabgroup.d.ts +5 -4
  121. package/packages/react/NysTable.d.ts +1 -1
  122. package/packages/react/NysTabpanel.d.ts +11 -4
  123. package/packages/react/NysTextarea.d.ts +4 -1
  124. package/packages/react/NysTextarea.js +2 -0
  125. package/packages/react/NysUnavFooter.d.ts +13 -0
  126. package/packages/react/NysUnavFooter.js +4 -1
  127. package/packages/react/NysUnavHeader.d.ts +24 -1
  128. package/packages/react/NysUnavHeader.js +17 -1
  129. package/packages/react/NysVerticalnav.d.ts +15 -8
  130. package/packages/react/NysVerticalnav.js +6 -4
  131. package/packages/react/NysVerticalnavGroup.d.ts +4 -0
  132. package/packages/react/NysVerticalnavGroup.js +5 -0
  133. package/packages/react/index.d.ts +5 -0
  134. package/packages/react/index.js +5 -0
  135. package/packages/react/nysds-jsx.d.ts +394 -56
@@ -1,4 +1,4 @@
1
- import { LitElement } from "lit";
1
+ import { NysElement } from "@nysds/internals";
2
2
  declare global {
3
3
  interface Window {
4
4
  YT: any;
@@ -13,20 +13,82 @@ 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 usage
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
- * videourl="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
25
- * titleText="Video Title"
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
  */
29
- export declare class NysVideo extends LitElement {
91
+ export declare class NysVideo extends NysElement {
30
92
  static styles: import("lit").CSSResult;
31
93
  /** Full YouTube URL — required. Component will not render if invalid. */
32
94
  id: string;
@@ -61,9 +123,7 @@ export declare class NysVideo extends LitElement {
61
123
  * Lifecycle methods
62
124
  * --------------------------------------------------------------------------
63
125
  */
64
- constructor();
65
126
  connectedCallback(): void;
66
- disconnectedCallback(): void;
67
127
  /**
68
128
  * Functions
69
129
  * --------------------------------------------------------------------------
@@ -5,6 +5,7 @@ export * from "../packages/nys-backtotop/src/index";
5
5
  export * from "../packages/nys-breadcrumbs/src/index";
6
6
  export * from "../packages/nys-button/src/index";
7
7
  export * from "../packages/nys-badge/src/index";
8
+ export * from "../packages/nys-card/src/index";
8
9
  export * from "../packages/nys-checkbox/src/index";
9
10
  export * from "../packages/nys-combobox/src/index";
10
11
  export * from "../packages/nys-datepicker/src/index";
@@ -12,10 +13,14 @@ export * from "../packages/nys-divider/src/index";
12
13
  export * from "../packages/nys-dropdownmenu/src/index";
13
14
  export * from "../packages/nys-errormessage/src/index";
14
15
  export * from "../packages/nys-fileinput/src/index";
16
+ export * from "../packages/nys-globalheader/src/index";
17
+ export * from "../packages/nys-globalfooter/src/index";
15
18
  export * from "../packages/nys-icon/src/index";
19
+ export * from "../packages/nys-iconlist/src/index";
16
20
  export * from "../packages/nys-label/src/index";
17
21
  export * from "../packages/nys-modal/src/index";
18
22
  export * from "../packages/nys-pagination/src/index";
23
+ export * from "../packages/nys-processlist/src/index";
19
24
  export * from "../packages/nys-radiobutton/src/index";
20
25
  export * from "../packages/nys-select/src/index";
21
26
  export * from "../packages/nys-skipnav/src/index";
@@ -27,8 +32,6 @@ export * from "../packages/nys-textinput/src/index";
27
32
  export * from "../packages/nys-toggle/src/index";
28
33
  export * from "../packages/nys-tooltip/src/index";
29
34
  export * from "../packages/nys-unavheader/src/index";
30
- export * from "../packages/nys-globalheader/src/index";
31
- export * from "../packages/nys-globalfooter/src/index";
32
35
  export * from "../packages/nys-unavfooter/src/index";
33
36
  export * from "../packages/nys-verticalnav/src/index";
34
37
  export * from "../packages/nys-video/src/index";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/components",
3
- "version": "1.20.0-alpha1",
3
+ "version": "1.20.0",
4
4
  "description": "New York State's design system and code component library.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -29,26 +29,30 @@
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 lint && npm run lit-analyze || true && cross-env NODE_ENV=production npm run build:packages && npm run build:root && npm run cem && npm run build:mcp",
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)",
41
43
  "lint:fix": "bash src/scripts/lint-fix.sh",
42
44
  "lit-analyze": "find ./packages/nys-*/ -name '*.ts' ! -name '*.figma.*' | xargs lit-analyzer {}",
43
45
  "playwright:install": "npx playwright install --with-deps",
44
- "release": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && cross-env NODE_ENV=production npm publish --workspaces --access public && cross-env NODE_ENV=production npm publish --access public",
46
+ "release": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm publish --workspaces --access public && cross-env NODE_ENV=production npm publish --access public",
45
47
  "release:dry-run": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && node src/scripts/publish-dry-run.js",
46
48
  "release:alpha": "npm run build && npm run build:umd && npm publish --tag next",
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",
55
+ "test:report": "wtr --node-resolve || true && open coverage/lcov-report/index.html",
52
56
  "test:compact": "export NYSDS_TEST_OUTPUT=compact && wtr --node-resolve",
53
57
  "test:ai": "export NYSDS_TEST_OUTPUT=ai && wtr --node-resolve",
54
58
  "storybook": "cross-env NODE_ENV=production storybook dev -p 6006",
@@ -57,12 +61,13 @@
57
61
  "storybook:cibuild": "storybook build",
58
62
  "mcp-server:build": "turbo run build --filter=@nysds/mcp-server",
59
63
  "clean:node": "rm -rf node_modules && rm -rf packages/*/node_modules && rm -rf packages/**/*/node_modules",
60
- "clean:dist": "rm -rf storybook-static && rm -rf coverage && rm -rf packages/*/coverage && rm -rf dist && find packages -type d -name dist ! -path '*/mcp-server/dist' -exec rm -rf {} + 2>/dev/null || true",
64
+ "clean:dist": "rm -rf storybook-static && rm -rf coverage && rm -rf packages/*/coverage && rm -rf dist && find packages -type d -name dist ! -path '*/mcp-server/dist' -exec rm -rf {} + 2>/dev/null && find packages -name '*.tsbuildinfo' ! -path '*/mcp-server/*' -delete 2>/dev/null && rm -f ./*.tsbuildinfo 2>/dev/null || true",
61
65
  "clean:turbo": "find packages -type d -name '.turbo' -exec rm -rf {} + && rm -rf .turbo",
62
66
  "clean:cache": "rm -rf node_modules/.cache",
63
67
  "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
68
  "code-connect": "dotenv -- npx figma connect publish",
65
- "cem": "npx cem analyze --config ./custom-elements-manifest.config.mjs && cp ./custom-elements.json dist/ && node src/scripts/patch-react-utils.js"
69
+ "cem": "npx cem analyze --config src/scripts/custom-elements-manifest.config.mjs && cp ./custom-elements.json dist/ && node src/scripts/patch-react-utils.js",
70
+ "verify:a11y-names": "node src/scripts/verify-a11y-names.mjs"
66
71
  },
67
72
  "repository": {
68
73
  "type": "git",
@@ -136,5 +141,8 @@
136
141
  "dompurify": "^3.4.7",
137
142
  "wc-datepicker": "^0.10.0"
138
143
  },
139
- "sideEffects": true
144
+ "sideEffects": true,
145
+ "peerDependencies": {
146
+ "lit": "^3.3.1"
147
+ }
140
148
  }
@@ -27,6 +27,16 @@ export interface NysAccordionProps extends Pick<
27
27
  /** Unique identifier. Auto-generated if not provided. */
28
28
  id?: NysAccordionElement["id"];
29
29
 
30
+ /** Heading element wrapping every item's toggle button (`h2` through `h6`).
31
+
32
+ Each item's trigger is a real heading, so this is what places the accordion
33
+ in the page outline: choose one level below the heading that introduces the
34
+ accordion (an accordion under an `h2` section heading uses the `h3`
35
+ default). An individual `nys-accordionitem` can override it with its own
36
+ `headingLevel`. `h1` is not offered because an accordion trigger is never
37
+ the page title. */
38
+ headingLevel?: NysAccordionElement["headingLevel"];
39
+
30
40
  /** 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()`. */
31
41
  className?: string;
32
42
 
@@ -2,13 +2,14 @@ import React, { forwardRef } from "react";
2
2
  import "../../dist/nysds.es.js";
3
3
 
4
4
  export const NysAccordion = forwardRef((props, forwardedRef) => {
5
- const { singleSelect, bordered, id, ...filteredProps } = props;
5
+ const { singleSelect, bordered, id, headingLevel, ...filteredProps } = props;
6
6
 
7
7
  return React.createElement(
8
8
  "nys-accordion",
9
9
  {
10
10
  ...filteredProps,
11
11
  id: props.id,
12
+ headingLevel: props.headingLevel,
12
13
  class: props.className,
13
14
  exportparts: props.exportparts,
14
15
  for: props.htmlFor,
@@ -33,6 +33,16 @@ export interface NysAccordionItemProps extends Pick<
33
33
  /** Heading text displayed in the clickable toggle button. */
34
34
  heading?: NysAccordionItemElement["heading"];
35
35
 
36
+ /** Heading element that wraps the toggle button (`h2` through `h6`).
37
+
38
+ Pick the level that puts the trigger in the right place in the page
39
+ outline — one level below the heading that introduces the accordion. Leave
40
+ it empty to follow the `headingLevel` of the enclosing `nys-accordion`,
41
+ which is the usual way to set it for a whole group; `h3` applies when
42
+ neither is specified. `h1` is not offered because an accordion trigger is
43
+ never the page title. */
44
+ headingLevel?: NysAccordionItemElement["headingLevel"];
45
+
36
46
  /** 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
47
  className?: string;
38
48
 
@@ -4,7 +4,8 @@ import { useEventListener } from "./react-utils.js";
4
4
 
5
5
  export const NysAccordionItem = forwardRef((props, forwardedRef) => {
6
6
  const ref = useRef(null);
7
- const { expanded, bordered, id, heading, ...filteredProps } = props;
7
+ const { expanded, bordered, id, heading, headingLevel, ...filteredProps } =
8
+ props;
8
9
 
9
10
  /** Event listeners - run once */
10
11
  useEventListener(
@@ -27,6 +28,7 @@ export const NysAccordionItem = forwardRef((props, forwardedRef) => {
27
28
  ...filteredProps,
28
29
  id: props.id,
29
30
  heading: props.heading,
31
+ headingLevel: props.headingLevel,
30
32
  class: props.className,
31
33
  exportparts: props.exportparts,
32
34
  for: props.htmlFor,
@@ -51,7 +51,8 @@ export interface NysAlertProps extends Pick<
51
51
  /** Label text for secondary action link. */
52
52
  secondaryLabel?: NysAlertElement["secondaryLabel"];
53
53
 
54
- /** Semantic alert type affecting color and ARIA role. `danger`/`emergency` use assertive live region. */
54
+ /** Semantic alert type affecting color and ARIA role. `warning`/`danger`/`emergency` use
55
+ `role="alert"` (assertive live region); `base`/`info`/`success` use `role="status"` (polite). */
55
56
  type?: NysAlertElement["type"];
56
57
 
57
58
  /** 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()`. */
@@ -75,16 +76,13 @@ export interface NysAlertProps extends Pick<
75
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. */
76
77
  tabIndex?: number;
77
78
 
78
- /** Returns ARIA role and label based on alert type.
79
- - 'alert' => assertive live region (implied)
80
- - 'status' => polite live region
81
- - 'region' => generic, requires aria-label */
82
- ariaAttributes?: NysAlertElement["ariaAttributes"];
79
+ /** Returns the ARIA role and aria-live setting for the alert's live region based on type.
80
+ - `warning`/`danger`/`emergency` => role="alert", aria-live="assertive" (urgent, interrupts)
81
+ - `base`/`info`/`success` => role="status", aria-live="polite" (waits its turn)
83
82
 
84
- /** Returns live-region type for screen readers if applicable.
85
- - 'polite' for status role
86
- - undefined for alert (since it's implicitly assertive) or region */
87
- liveRegion?: NysAlertElement["liveRegion"];
83
+ `aria-live` is set explicitly alongside `role` (rather than relying on the role's implicit
84
+ live-region semantics) for more consistent behavior across browser/AT combinations. */
85
+ ariaAttributes?: NysAlertElement["ariaAttributes"];
88
86
 
89
87
  /** Fired when alert is dismissed. Detail: `{id, type, label}`. */
90
88
  onNysClose?: (event: CustomEvent) => void;
@@ -17,7 +17,6 @@ export const NysAlert = forwardRef((props, forwardedRef) => {
17
17
  secondaryLabel,
18
18
  type,
19
19
  ariaAttributes,
20
- liveRegion,
21
20
  ...filteredProps
22
21
  } = props;
23
22
 
@@ -26,7 +25,6 @@ export const NysAlert = forwardRef((props, forwardedRef) => {
26
25
 
27
26
  /** Properties - run whenever a property has changed */
28
27
  useProperties(ref, "ariaAttributes", props.ariaAttributes);
29
- useProperties(ref, "liveRegion", props.liveRegion);
30
28
 
31
29
  return React.createElement(
32
30
  "nys-alert",
@@ -30,7 +30,17 @@ export interface NysAvatarProps extends Pick<
30
30
  /** Unique identifier. Auto-generated if not provided. */
31
31
  id?: NysAvatarElement["id"];
32
32
 
33
- /** Accessible label for screen readers. Required when no image `alt` is available. */
33
+ /** Accessible name for the avatar — who or what it represents ("Jane Smith"),
34
+ not what it is ("avatar").
35
+
36
+ Leave it unset for a decorative avatar and the whole thing is hidden from
37
+ assistive tech, which is the right outcome next to a visible name. Set it
38
+ whenever the avatar is the only thing identifying the person, and always when
39
+ `interactive` is set: that renders a `<button>`, and a nameless button cannot
40
+ be operated by screen reader or voice-control users (WCAG 4.1.2). An
41
+ interactive avatar without a name logs a console warning.
42
+
43
+ Whitespace-only values — including a non-breaking space — count as no name. */
34
44
  ariaLabel?: NysAvatarElement["ariaLabel"];
35
45
 
36
46
  /** Image URL. Takes priority over initials and icon. */
@@ -21,6 +21,9 @@ export interface NysBacktotopProps extends Pick<
21
21
  /** Force button visibility. Overrides auto-show scroll behavior. */
22
22
  visible?: boolean;
23
23
 
24
+ /** Unique identifier. Auto-generated if not provided. */
25
+ id?: NysBacktotopElement["id"];
26
+
24
27
  /** Horizontal position: `left` or `right`. */
25
28
  position?: NysBacktotopElement["position"];
26
29
 
@@ -2,12 +2,13 @@ import React, { forwardRef } from "react";
2
2
  import "../../dist/nysds.es.js";
3
3
 
4
4
  export const NysBacktotop = forwardRef((props, forwardedRef) => {
5
- const { visible, position, ...filteredProps } = props;
5
+ const { visible, id, position, ...filteredProps } = props;
6
6
 
7
7
  return React.createElement(
8
8
  "nys-backtotop",
9
9
  {
10
10
  ...filteredProps,
11
+ id: props.id,
11
12
  position: props.position,
12
13
  class: props.className,
13
14
  exportparts: props.exportparts,
@@ -39,7 +39,7 @@ The user can still expand the trail by clicking the ellipsis. */
39
39
  /** Unique identifier. Auto-generated if not provided. */
40
40
  id?: NysBreadcrumbsElement["id"];
41
41
 
42
- /** Accessible label for the `<nav>` landmark. Defaults to "path to this page" if not set.
42
+ /** Accessible label for the `<nav>` landmark. Defaults to "Breadcrumb" if not set.
43
43
  Override when multiple crumbs exist on the same page. */
44
44
  ariaLabel?: NysBreadcrumbsElement["ariaLabel"];
45
45
 
@@ -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 `nys-breadcrumbitem` elements defining the trail.
87
+ * - _default_ - One or more `li` elements defining the trail.
88
88
  */
89
89
  export const NysBreadcrumbs: React.ForwardRefExoticComponent<NysBreadcrumbsProps>;
@@ -24,7 +24,7 @@ export interface NysButtonProps extends Pick<
24
24
  /** Adjusts colors for dark backgrounds. */
25
25
  inverted?: boolean;
26
26
 
27
- /** Renders circular icon-only button. Requires `icon` prop. `label` becomes aria-label. */
27
+ /** Renders circular icon-only button. Requires `icon` prop. `label` is rendered as visually-hidden text for the accessible name. */
28
28
  circle?: boolean;
29
29
 
30
30
  /** Prevents interaction. Avoid disabling without explanation—show validation errors instead. */
@@ -42,15 +42,44 @@ export interface NysButtonProps extends Pick<
42
42
  /** Visual style: `filled` for primary (one per section), `outline` for secondary, `ghost` for tertiary, `text` for inline actions. Avoid `text` for navigation. */
43
43
  variant?: NysButtonElement["variant"];
44
44
 
45
- /** Visible button text. Use sentence case, action-oriented text (e.g., "Save Draft"). Becomes aria-label in `circle` mode. */
45
+ /** Visible button text. Use sentence case, action-oriented text (e.g., "Save Draft"). In `circle` mode it is visually hidden but still exposed to assistive tech as the accessible name. */
46
46
  label?: NysButtonElement["label"];
47
47
 
48
- /** Screen reader label. Required for icon-only buttons if `label` is not set. */
49
- ariaLabel?: NysButtonElement["ariaLabel"];
48
+ /** ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`.
50
49
 
51
- /** ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`. */
50
+ Set this on `<nys-button>` rather than putting `aria-controls` on the host:
51
+ the host has no role, so ARIA placed there is not mapped into the
52
+ accessibility tree and never reaches the internal `<button>`. */
52
53
  ariaControls?: NysButtonElement["ariaControls"];
53
54
 
55
+ /** Disclosure state for buttons that show/hide content. Sets `aria-expanded`
56
+ on the internal `<button>`/`<a>`.
57
+
58
+ Use `"false"` when the controlled content is collapsed and `"true"` when it
59
+ is expanded, updating it every time the content toggles. Leave unset for
60
+ buttons that are not disclosure triggers — an `aria-expanded` that never
61
+ changes is worse than none. Pair with `ariaControls` pointing at the
62
+ element being shown or hidden.
63
+
64
+ Setting `aria-expanded` directly on the `<nys-button>` host does nothing:
65
+ a custom element with no role does not map its ARIA attributes into the
66
+ accessibility tree, and host ARIA does not cross into the shadow root. */
67
+ ariaExpanded?: NysButtonElement["ariaExpanded"];
68
+
69
+ /** Marks this button as the current item within a set of related controls — the current
70
+ page of a pagination control, the current step of a wizard. Sets `aria-current` on the
71
+ internal `<button>`/`<a>`.
72
+
73
+ Use `"page"` inside a pagination landmark, `"step"` inside a step indicator, and
74
+ `"true"` when no more specific token fits. Only one control in a set is ever current:
75
+ leave the property unset on all the others rather than setting `"false"`, which the
76
+ spec reads as "explicitly not current" and adds nothing.
77
+
78
+ Setting `aria-current` directly on the `<nys-button>` host does nothing: a custom
79
+ element with no role does not map its ARIA attributes into the accessibility tree,
80
+ and host ARIA does not cross into the shadow root. */
81
+ ariaCurrent?: NysButtonElement["ariaCurrent"];
82
+
54
83
  /** Material Symbol icon before label. Not shown for `circle` mode. */
55
84
  prefixIcon?: NysButtonElement["prefixIcon"];
56
85
 
@@ -66,8 +95,8 @@ export interface NysButtonProps extends Pick<
66
95
  /** Value submitted with form data. Only used when `type="submit"`. */
67
96
  value?: NysButtonElement["value"];
68
97
 
69
- /** Additional screen reader description. Sets `aria-description`. */
70
- ariaDescription?: NysButtonElement["ariaDescription"];
98
+ /** ID(s) of element(s) describing this button. Sets `aria-describedby`. */
99
+ ariaDescribedBy?: NysButtonElement["ariaDescribedBy"];
71
100
 
72
101
  /** Form behavior: `button` (default, no form action), `submit` (submits form), `reset` (resets form). Always set explicitly to avoid unintended submissions. */
73
102
  type?: NysButtonElement["type"];
@@ -123,7 +152,8 @@ export interface NysButtonProps extends Pick<
123
152
  * - **nys-click** - Fired when the button is clicked (mouse or keyboard). Not fired when disabled.
124
153
  *
125
154
  * ### **Slots:**
126
- * - **prefix-icon** - Icon before label. Not shown for `text` variant.
155
+ * - _default_ - Button label text. Use as fallback when `label` prop is not provided.
156
+ * - **prefix-icon** - Icon before label. Not shown for `text` variant.
127
157
  * - **suffix-icon** - Icon after label. Not shown for `text` variant.
128
158
  * - **circle-icon** - Icon for circle mode. Overrides `icon` prop.
129
159
  *
@@ -14,14 +14,15 @@ export const NysButton = forwardRef((props, forwardedRef) => {
14
14
  size,
15
15
  variant,
16
16
  label,
17
- ariaLabel,
18
17
  ariaControls,
18
+ ariaExpanded,
19
+ ariaCurrent,
19
20
  prefixIcon,
20
21
  suffixIcon,
21
22
  icon,
22
23
  form,
23
24
  value,
24
- ariaDescription,
25
+ ariaDescribedBy,
25
26
  type,
26
27
  href,
27
28
  target,
@@ -54,14 +55,15 @@ export const NysButton = forwardRef((props, forwardedRef) => {
54
55
  size: props.size,
55
56
  variant: props.variant,
56
57
  label: props.label,
57
- ariaLabel: props.ariaLabel,
58
58
  ariaControls: props.ariaControls,
59
+ ariaExpanded: props.ariaExpanded,
60
+ ariaCurrent: props.ariaCurrent,
59
61
  prefixIcon: props.prefixIcon,
60
62
  suffixIcon: props.suffixIcon,
61
63
  icon: props.icon,
62
64
  form: props.form,
63
65
  value: props.value,
64
- ariaDescription: props.ariaDescription,
66
+ ariaDescribedBy: props.ariaDescribedBy,
65
67
  type: props.type,
66
68
  href: props.href,
67
69
  target: props.target,
@@ -0,0 +1,110 @@
1
+ import React from "react";
2
+ import { NysCard as NysCardElement, Event } from "../../dist/nysds.es.js";
3
+
4
+ export type { NysCardElement, Event };
5
+
6
+ export interface NysCardProps 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
+ /** When true, adds padding around the media to visually contain it. */
22
+ inset?: boolean;
23
+
24
+ /** When true, adds a drop shadow to the card, giving it a raised appearance. */
25
+ elevated?: boolean;
26
+
27
+ /** Unique identifier. Auto-generated if not provided. */
28
+ id?: NysCardElement["id"];
29
+
30
+ /** Appears above the heading text. */
31
+ preheading?: NysCardElement["preheading"];
32
+
33
+ /** Heading text in the card. */
34
+ heading?: NysCardElement["heading"];
35
+
36
+ /** Heading level used for the card heading (`h1` through `h6`). */
37
+ headingLevel?: NysCardElement["headingLevel"];
38
+
39
+ /** Appears below the heading text. */
40
+ subheading?: NysCardElement["subheading"];
41
+
42
+ /** Appears below the subheading text. Takes in plain text. Use the main slot if the description requires rich text or more content. */
43
+ description?: NysCardElement["description"];
44
+
45
+ /** URL to navigate to. Makes the whole card a single `<a>`. Keep the card's slots
46
+ free of other interactive elements when using this — nesting them inside the
47
+ card control is invalid HTML and unreachable for keyboard and screen reader users. */
48
+ href?: NysCardElement["href"];
49
+
50
+ /** Link target: `_self` (same tab), `_blank` (new tab), `_parent`, `_top`, or frame name. Only used with `href`. */
51
+ target?: NysCardElement["target"];
52
+
53
+ /** 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()`. */
54
+ className?: string;
55
+
56
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
57
+ exportparts?: string;
58
+
59
+ /** Used for labels to link them with their inputs (using input id). */
60
+ htmlFor?: string;
61
+
62
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
63
+ key?: number | string;
64
+
65
+ /** 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. */
66
+ part?: string;
67
+
68
+ /** 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. */
69
+ ref?: any;
70
+
71
+ /** 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. */
72
+ tabIndex?: number;
73
+
74
+ /** Click handler. Makes the whole card a single `<button>`. Use instead of
75
+ `@click` to ensure keyboard accessibility. Keep the card's slots free of
76
+ other interactive elements when using this — nesting them inside the card
77
+ control is invalid HTML and unreachable for keyboard and screen reader users. */
78
+ onClick?: NysCardElement["onClick"];
79
+
80
+ /** Fired when an interactive card is activated (mouse or keyboard). */
81
+ onNysClick?: (event: CustomEvent) => void;
82
+
83
+ /** Fired when an interactive card receives focus. */
84
+ onNysFocus?: (event: CustomEvent) => void;
85
+
86
+ /** Fired when an interactive card loses focus. */
87
+ onNysBlur?: (event: CustomEvent) => void;
88
+ }
89
+
90
+ /**
91
+ * Flexible container that groups related content and actions about a single subject.
92
+ * ---
93
+ *
94
+ *
95
+ * ### **Events:**
96
+ * - **nys-click** - Fired when an interactive card is activated (mouse or keyboard).
97
+ * - **nys-focus** - Fired when an interactive card receives focus.
98
+ * - **nys-blur** - Fired when an interactive card loses focus.
99
+ *
100
+ * ### **Slots:**
101
+ * - **preheading** - Content rendered above the heading block (e.g. a badge or label).
102
+ * - _default_ - Default slot for the card's main body. Use for rich content when the `description` property is not enough.
103
+ * - **footer** - Content rendered at the footer of the card, typically actions like buttons or links.
104
+ * - **media** - Visual content displayed at the top of the card, typically an `<img>`.
105
+ * - **media-accent** - Text for the accent badge displayed over the media, typically a date. Pass a wrapper holding two elements: the first is rendered as the month line, the second as the day line. Only renders when the `media` slot has content. The card becomes a single interactive control when it is given something to do: an `href` renders it as an `<a>`, a click handler (`onClick` or an inline `onclick`) renders it as a `<button>`.
106
+ *
107
+ * ### **CSS Properties:**
108
+ * - **--nys-card-height** - Height of the card. Set to `100%` to stretch the card to its container's height, so a row of cards renders at an equal height. The extra height is absorbed by the main content area, keeping the `footer` slot pinned to the bottom of the card. Requires the container to give the card a height to fill (e.g. a grid column with `nys-display-flex`). _(default: fit-content)_
109
+ */
110
+ export const NysCard: React.ForwardRefExoticComponent<NysCardProps>;