@nysds/components 1.21.1-alpha-1 → 1.22.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 (193) hide show
  1. package/custom-elements.json +1794 -1170
  2. package/dist/.vscode/vscode.css-custom-data.json +115 -0
  3. package/dist/.vscode/vscode.html-custom-data.json +116 -61
  4. package/dist/custom-elements.json +1791 -1119
  5. package/dist/{nys-icon.library-CwuPZJAc.js → nys-icon.library-BZ3jVyhP.js} +2 -2
  6. package/dist/{nys-icon.library-D_YvOGLH.js.map → nys-icon.library-BZ3jVyhP.js.map} +1 -1
  7. package/dist/{nys-icon.library-Bi_7DKlD-BEL9M8Q4.js → nys-icon.library-DYsQ8Tiv-DYS-TkV2.js} +12 -4
  8. package/dist/nys-icon.library-DYsQ8Tiv-DYS-TkV2.js.map +1 -0
  9. package/dist/nysds.es.js +5422 -4579
  10. package/dist/nysds.es.js.map +1 -1
  11. package/dist/nysds.js +479 -457
  12. package/dist/nysds.js.map +1 -1
  13. package/dist/packages/codegen/src/index.d.ts +16 -0
  14. package/dist/packages/codegen/src/manifest/components.d.ts +5 -0
  15. package/dist/packages/codegen/src/manifest/filters.d.ts +5 -0
  16. package/dist/packages/codegen/src/manifest/form-control.d.ts +5 -0
  17. package/dist/packages/codegen/src/manifest/load.d.ts +10 -0
  18. package/dist/packages/codegen/src/manifest/naming.d.ts +6 -0
  19. package/dist/packages/codegen/src/manifest/packages.d.ts +5 -0
  20. package/dist/packages/codegen/src/manifest/types.d.ts +6 -0
  21. package/dist/packages/codegen/src/transform/index.d.ts +19 -0
  22. package/dist/packages/codegen/src/transform/parse.d.ts +18 -0
  23. package/dist/packages/codegen/src/transform/shared.d.ts +61 -0
  24. package/dist/packages/codegen/src/transform/to-angular.d.ts +6 -0
  25. package/dist/packages/codegen/src/transform/to-jsx.d.ts +6 -0
  26. package/dist/packages/internals/src/form-control-mixin.d.ts +16 -0
  27. package/dist/packages/internals/src/form-events.d.ts +22 -0
  28. package/dist/packages/internals/src/index.d.ts +2 -1
  29. package/dist/packages/internals/src/types.d.ts +6 -0
  30. package/dist/packages/mcp-server/src/lib/cem-parser.d.ts +12 -0
  31. package/dist/packages/mcp-server/src/lib/framework-snippets.d.ts +35 -0
  32. package/dist/packages/mcp-server/src/lib/framework-usage.d.ts +19 -0
  33. package/dist/packages/mcp-server/src/lib/frameworks-data.d.ts +18 -0
  34. package/dist/packages/mcp-server/src/resources/frameworks.d.ts +14 -0
  35. package/dist/packages/nys-accordion/src/nys-accordion.d.ts +12 -0
  36. package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +9 -1
  37. package/dist/packages/nys-alert/src/nys-alert.d.ts +39 -1
  38. package/dist/packages/nys-avatar/src/nys-avatar.d.ts +16 -0
  39. package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +14 -2
  40. package/dist/packages/nys-badge/src/nys-badge.d.ts +18 -0
  41. package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +29 -3
  42. package/dist/packages/nys-button/src/nys-button.d.ts +35 -4
  43. package/dist/packages/nys-card/src/nys-card.d.ts +72 -0
  44. package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +77 -7
  45. package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +46 -0
  46. package/dist/packages/nys-combobox/src/nys-combobox.d.ts +51 -6
  47. package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +44 -2
  48. package/dist/packages/nys-divider/src/nys-divider.d.ts +9 -0
  49. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +17 -0
  50. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +10 -0
  51. package/dist/packages/nys-fileinput/src/index.d.ts +1 -0
  52. package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +42 -6
  53. package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +9 -1
  54. package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +18 -0
  55. package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +36 -55
  56. package/dist/packages/nys-icon/src/nys-icon.d.ts +18 -0
  57. package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +38 -1
  58. package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +6 -0
  59. package/dist/packages/nys-label/src/nys-label.d.ts +3 -1
  60. package/dist/packages/nys-modal/src/nys-modal.d.ts +26 -2
  61. package/dist/packages/nys-pagination/src/nys-pagination.d.ts +21 -2
  62. package/dist/packages/nys-processlist/src/nys-processlist.d.ts +16 -0
  63. package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +1 -1
  64. package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +29 -5
  65. package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +66 -4
  66. package/dist/packages/nys-select/src/nys-select.d.ts +22 -4
  67. package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +8 -0
  68. package/dist/packages/nys-stepper/src/nys-step.d.ts +8 -1
  69. package/dist/packages/nys-stepper/src/nys-stepper.d.ts +8 -0
  70. package/dist/packages/nys-tab/src/nys-tab.d.ts +22 -3
  71. package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +12 -0
  72. package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +2 -0
  73. package/dist/packages/nys-table/src/nys-table.d.ts +39 -2
  74. package/dist/packages/nys-textarea/src/nys-textarea.d.ts +47 -4
  75. package/dist/packages/nys-textinput/src/nys-textinput.d.ts +42 -4
  76. package/dist/packages/nys-toggle/src/nys-toggle.d.ts +37 -3
  77. package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +13 -0
  78. package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +13 -0
  79. package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +28 -19
  80. package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +14 -0
  81. package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +11 -0
  82. package/dist/packages/nys-video/src/nys-video.d.ts +14 -1
  83. package/package.json +32 -27
  84. package/dist/nys-icon.library-Bi_7DKlD-BEL9M8Q4.js.map +0 -1
  85. package/dist/nys-icon.library-Bi_7DKlD-YSs5zqZy.js +0 -698
  86. package/dist/nys-icon.library-Bi_7DKlD-YSs5zqZy.js.map +0 -1
  87. package/dist/nys-icon.library-CwuPZJAc.js.map +0 -1
  88. package/dist/nys-icon.library-D_YvOGLH.js +0 -696
  89. package/packages/react/NysAccordion.d.ts +0 -75
  90. package/packages/react/NysAccordion.js +0 -24
  91. package/packages/react/NysAccordionItem.d.ts +0 -82
  92. package/packages/react/NysAccordionItem.js +0 -43
  93. package/packages/react/NysAlert.d.ts +0 -102
  94. package/packages/react/NysAlert.js +0 -61
  95. package/packages/react/NysAvatar.d.ts +0 -88
  96. package/packages/react/NysAvatar.js +0 -40
  97. package/packages/react/NysBacktotop.d.ts +0 -57
  98. package/packages/react/NysBacktotop.js +0 -23
  99. package/packages/react/NysBadge.d.ts +0 -78
  100. package/packages/react/NysBadge.js +0 -42
  101. package/packages/react/NysBreadcrumbItem.d.ts +0 -72
  102. package/packages/react/NysBreadcrumbItem.js +0 -42
  103. package/packages/react/NysBreadcrumbs.d.ts +0 -89
  104. package/packages/react/NysBreadcrumbs.js +0 -50
  105. package/packages/react/NysButton.d.ts +0 -171
  106. package/packages/react/NysButton.js +0 -83
  107. package/packages/react/NysCard.d.ts +0 -110
  108. package/packages/react/NysCard.js +0 -61
  109. package/packages/react/NysCheckbox.d.ts +0 -145
  110. package/packages/react/NysCheckbox.js +0 -78
  111. package/packages/react/NysCheckboxgroup.d.ts +0 -88
  112. package/packages/react/NysCheckboxgroup.js +0 -46
  113. package/packages/react/NysCombobox.d.ts +0 -126
  114. package/packages/react/NysCombobox.js +0 -66
  115. package/packages/react/NysDatepicker.d.ts +0 -128
  116. package/packages/react/NysDatepicker.js +0 -76
  117. package/packages/react/NysDivider.d.ts +0 -54
  118. package/packages/react/NysDivider.js +0 -22
  119. package/packages/react/NysDropdownMenu.d.ts +0 -59
  120. package/packages/react/NysDropdownMenu.js +0 -23
  121. package/packages/react/NysDropdownMenuItem.d.ts +0 -75
  122. package/packages/react/NysDropdownMenuItem.js +0 -47
  123. package/packages/react/NysErrorMessage.d.ts +0 -60
  124. package/packages/react/NysErrorMessage.js +0 -24
  125. package/packages/react/NysFileItem.d.ts +0 -69
  126. package/packages/react/NysFileItem.js +0 -37
  127. package/packages/react/NysFileinput.d.ts +0 -130
  128. package/packages/react/NysFileinput.js +0 -74
  129. package/packages/react/NysGlobalFooter.d.ts +0 -77
  130. package/packages/react/NysGlobalFooter.js +0 -32
  131. package/packages/react/NysGlobalHeader.d.ts +0 -85
  132. package/packages/react/NysGlobalHeader.js +0 -34
  133. package/packages/react/NysIcon.d.ts +0 -75
  134. package/packages/react/NysIcon.js +0 -50
  135. package/packages/react/NysIconlist.d.ts +0 -54
  136. package/packages/react/NysIconlist.js +0 -22
  137. package/packages/react/NysIconlistitem.d.ts +0 -59
  138. package/packages/react/NysIconlistitem.js +0 -22
  139. package/packages/react/NysLabel.d.ts +0 -81
  140. package/packages/react/NysLabel.js +0 -40
  141. package/packages/react/NysModal.d.ts +0 -90
  142. package/packages/react/NysModal.js +0 -50
  143. package/packages/react/NysOption.d.ts +0 -66
  144. package/packages/react/NysOption.js +0 -25
  145. package/packages/react/NysPagination.d.ts +0 -72
  146. package/packages/react/NysPagination.js +0 -45
  147. package/packages/react/NysProcesslist.d.ts +0 -65
  148. package/packages/react/NysProcesslist.js +0 -25
  149. package/packages/react/NysProcesslistitem.d.ts +0 -61
  150. package/packages/react/NysProcesslistitem.js +0 -35
  151. package/packages/react/NysRadiobutton.d.ts +0 -132
  152. package/packages/react/NysRadiobutton.js +0 -72
  153. package/packages/react/NysRadiogroup.d.ts +0 -104
  154. package/packages/react/NysRadiogroup.js +0 -62
  155. package/packages/react/NysSelect.d.ts +0 -119
  156. package/packages/react/NysSelect.js +0 -67
  157. package/packages/react/NysSkipnav.d.ts +0 -54
  158. package/packages/react/NysSkipnav.js +0 -22
  159. package/packages/react/NysStep.d.ts +0 -73
  160. package/packages/react/NysStep.js +0 -40
  161. package/packages/react/NysStepper.d.ts +0 -67
  162. package/packages/react/NysStepper.js +0 -26
  163. package/packages/react/NysTab.d.ts +0 -90
  164. package/packages/react/NysTab.js +0 -39
  165. package/packages/react/NysTabgroup.d.ts +0 -76
  166. package/packages/react/NysTabgroup.js +0 -22
  167. package/packages/react/NysTable.d.ts +0 -80
  168. package/packages/react/NysTable.js +0 -41
  169. package/packages/react/NysTabpanel.d.ts +0 -70
  170. package/packages/react/NysTabpanel.js +0 -21
  171. package/packages/react/NysTextarea.d.ts +0 -141
  172. package/packages/react/NysTextarea.js +0 -79
  173. package/packages/react/NysTextinput.d.ts +0 -144
  174. package/packages/react/NysTextinput.js +0 -83
  175. package/packages/react/NysToggle.d.ts +0 -102
  176. package/packages/react/NysToggle.js +0 -59
  177. package/packages/react/NysTooltip.d.ts +0 -60
  178. package/packages/react/NysTooltip.js +0 -24
  179. package/packages/react/NysUnavFooter.d.ts +0 -61
  180. package/packages/react/NysUnavFooter.js +0 -21
  181. package/packages/react/NysUnavHeader.d.ts +0 -98
  182. package/packages/react/NysUnavHeader.js +0 -56
  183. package/packages/react/NysVerticalnav.d.ts +0 -67
  184. package/packages/react/NysVerticalnav.js +0 -26
  185. package/packages/react/NysVerticalnavGroup.d.ts +0 -76
  186. package/packages/react/NysVerticalnavGroup.js +0 -43
  187. package/packages/react/NysVideo.d.ts +0 -83
  188. package/packages/react/NysVideo.js +0 -53
  189. package/packages/react/README.md +0 -92
  190. package/packages/react/index.d.ts +0 -49
  191. package/packages/react/index.js +0 -49
  192. package/packages/react/nysds-jsx.d.ts +0 -1998
  193. package/packages/react/react-utils.js +0 -40
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @nysds/codegen public API.
3
+ *
4
+ * One package that reads the custom elements manifest and derives every
5
+ * framework artifact: metadata for generators, naming rules, and the HTML
6
+ * to JSX / Angular snippet transformer. The CEM plugins ship separately as
7
+ * `@nysds/codegen/cem-plugins`.
8
+ */
9
+ export { loadManifest } from "./manifest/load.js";
10
+ export { listComponents, normalizeTypeText } from "./manifest/components.js";
11
+ export { parseFormControlTag } from "./manifest/form-control.js";
12
+ export { isPublicMember, isPublicProp, isExposedEvent, } from "./manifest/filters.js";
13
+ export { NYS_PREFIX, NYS_BLUR_EVENT, pascalize, tagToClass, classToAngularClass, eventToReactProp, eventToAngularOutput, tagToSubpath, tagToPackage, } from "./manifest/naming.js";
14
+ export type { Manifest, ManifestModule, ComponentMeta, PropMeta, EventMeta, SlotMeta, FormControlMeta, } from "./manifest/types.js";
15
+ export { transformExample, toJsx, toAngular } from "./transform/index.js";
16
+ export type { TransformExampleInput, TransformResult, FormsMode, } from "./transform/index.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Component metadata reader. Logic lives in `cem-plugins/lib/core.mjs`;
3
+ * this module re-exports it with types.
4
+ */
5
+ export { listComponents, normalizeTypeText, } from "../../cem-plugins/lib/core.mjs";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Member and event filters. Logic lives in `cem-plugins/lib/core.mjs`;
3
+ * this module re-exports it with types.
4
+ */
5
+ export { isPublicMember, isPublicProp, isExposedEvent, } from "../../cem-plugins/lib/core.mjs";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `@formControl` tag parsing. Logic lives in `cem-plugins/lib/core.mjs`;
3
+ * this module re-exports it with types.
4
+ */
5
+ export { parseFormControlTag } from "../../cem-plugins/lib/core.mjs";
@@ -0,0 +1,10 @@
1
+ import type { Manifest } from "./types.js";
2
+ /**
3
+ * Loads and validates a custom elements manifest.
4
+ *
5
+ * Without an argument, resolves the manifest that ships with
6
+ * `@nysds/components`. The root package's `exports` map doesn't expose
7
+ * `./custom-elements.json` as a subpath, so resolution goes through the
8
+ * package entry point and walks up to the package root.
9
+ */
10
+ export declare function loadManifest(manifestPath?: string): Manifest;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Naming rules (README section 4.1 of the framework-support plan is
3
+ * normative). Logic lives in `cem-plugins/lib/core.mjs`; this module
4
+ * re-exports it with types.
5
+ */
6
+ export { NYS_PREFIX, NYS_BLUR_EVENT, pascalize, tagToClass, classToAngularClass, eventToReactProp, eventToAngularOutput, tagToSubpath, tagToPackage, } from "../../cem-plugins/lib/core.mjs";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Package derivation from manifest module paths. Logic lives in
3
+ * `cem-plugins/lib/core.mjs`; this module re-exports it with types.
4
+ */
5
+ export { tagToPackage } from "../../cem-plugins/lib/core.mjs";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Metadata types. Declared once in `cem-plugins/lib/core.d.mts` (next to the
3
+ * runtime rules) and re-exported here so the TypeScript API and the plugins
4
+ * can never disagree.
5
+ */
6
+ export type { Manifest, ManifestModule, ComponentMeta, PropMeta, EventMeta, SlotMeta, FormControlMeta, } from "../../cem-plugins/lib/core.mjs";
@@ -0,0 +1,19 @@
1
+ import type { Manifest } from "../manifest/types.js";
2
+ import type { FormsMode, TransformResult } from "./shared.js";
3
+ export type { FormsMode, TransformResult } from "./shared.js";
4
+ export { toJsx } from "./to-jsx.js";
5
+ export { toAngular } from "./to-angular.js";
6
+ export interface TransformExampleInput {
7
+ /** The canonical HTML example. */
8
+ html: string;
9
+ framework: "react" | "angular";
10
+ manifest: Manifest;
11
+ /**
12
+ * How form components render. `"none"` (default) keeps snippets static;
13
+ * `"template"` emits `[(ngModel)]` (Angular) or the controlled pattern
14
+ * (React); `"reactive"` emits `formControlName` (Angular).
15
+ */
16
+ formsMode?: FormsMode;
17
+ }
18
+ /** Transforms one HTML example into a framework snippet. */
19
+ export declare function transformExample(input: TransformExampleInput): TransformResult;
@@ -0,0 +1,18 @@
1
+ import type { DefaultTreeAdapterMap } from "parse5";
2
+ export type P5Node = DefaultTreeAdapterMap["childNode"];
3
+ export type P5Element = DefaultTreeAdapterMap["element"];
4
+ export type P5Text = DefaultTreeAdapterMap["textNode"];
5
+ export type P5Comment = DefaultTreeAdapterMap["commentNode"];
6
+ /**
7
+ * Parses an HTML fragment (a docs `preview` block or an `@example` block)
8
+ * into parse5 nodes. parse5 lowercases element and attribute names, matching
9
+ * what a browser does to the same markup.
10
+ */
11
+ export declare function parseHtmlFragment(html: string): P5Node[];
12
+ export declare function isElement(node: P5Node): node is P5Element;
13
+ export declare function isText(node: P5Node): node is P5Text;
14
+ export declare function isComment(node: P5Node): node is P5Comment;
15
+ /** Child nodes, reading through `<template>` content. */
16
+ export declare function childNodesOf(element: P5Element): P5Node[];
17
+ /** Concatenated text content of an element's direct text children. */
18
+ export declare function textContent(element: P5Element): string;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Rules shared by both emitters: component lookup, attribute
3
+ * classification, and the script/style/inline-handler policy.
4
+ */
5
+ import type { ComponentMeta, Manifest, PropMeta } from "../manifest/types.js";
6
+ import { type P5Element } from "./parse.js";
7
+ export type FormsMode = "none" | "template" | "reactive";
8
+ export interface TransformResult {
9
+ /** The transformed snippet. Imports are listed separately. */
10
+ code: string;
11
+ language: "jsx" | "html";
12
+ warnings: string[];
13
+ /**
14
+ * True when the example depends on something the target framework snippet
15
+ * cannot express (imperative script against a component, inline handlers).
16
+ * The code is still returned as a best effort.
17
+ */
18
+ unsupported: boolean;
19
+ /**
20
+ * Names the docs partial needs to import: component class names for
21
+ * React, Angular component class names for Angular.
22
+ */
23
+ imports: string[];
24
+ }
25
+ export interface TransformContext {
26
+ byTag: Map<string, ComponentMeta>;
27
+ propLookups: Map<string, Map<string, PropMeta>>;
28
+ warnings: string[];
29
+ imports: Set<string>;
30
+ unsupported: boolean;
31
+ formsMode: FormsMode;
32
+ }
33
+ export declare function buildContext(manifest: Manifest, formsMode: FormsMode): TransformContext;
34
+ /**
35
+ * Props indexed by lowercased attribute name and lowercased property name.
36
+ * parse5 lowercases attribute names, so a camelCase manifest attribute
37
+ * (`errorMessage`) arrives as `errormessage`.
38
+ */
39
+ export declare function propLookup(context: TransformContext, component: ComponentMeta): Map<string, PropMeta>;
40
+ /** True for a component tag from this design system. */
41
+ export declare function isNysTag(tagName: string): boolean;
42
+ /** True for `onclick`-style inline handler attributes. */
43
+ export declare function isInlineHandler(attrName: string): boolean;
44
+ /** Global attributes that pass through without a warning. */
45
+ export declare function isSilentGlobalAttr(attrName: string): boolean;
46
+ /**
47
+ * Handles `<script>`, `<style>`, and inline handlers for both emitters.
48
+ * Returns true when the element was consumed (dropped) by the policy.
49
+ */
50
+ export declare function dropScriptOrStyle(context: TransformContext, element: P5Element): boolean;
51
+ export declare function warnInlineHandler(context: TransformContext, attrName: string, tagName: string): void;
52
+ export declare function warnUnknownAttr(context: TransformContext, attrName: string, tagName: string): void;
53
+ /** True when an attribute value is a numeric literal. */
54
+ export declare function isNumericLiteral(value: string): boolean;
55
+ /**
56
+ * The name a form model field gets in generated form bindings, taken from
57
+ * the example's own `name` (then `id`) attribute, then the component
58
+ * subpath.
59
+ */
60
+ export declare function modelFieldName(element: P5Element, component: ComponentMeta): string;
61
+ export declare function elementChildren(element: P5Element): P5Element[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * HTML example to Angular template snippet.
3
+ */
4
+ import type { Manifest } from "../manifest/types.js";
5
+ import { type FormsMode, type TransformResult } from "./shared.js";
6
+ export declare function toAngular(html: string, manifest: Manifest, formsMode?: FormsMode): TransformResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * HTML example to JSX snippet.
3
+ */
4
+ import type { Manifest } from "../manifest/types.js";
5
+ import { type FormsMode, type TransformResult } from "./shared.js";
6
+ export declare function toJsx(html: string, manifest: Manifest, formsMode?: FormsMode): TransformResult;
@@ -11,6 +11,22 @@ export declare class FormControlInterface extends ReflectsAriaInterface {
11
11
  protected setValidityFromState(flags: ValidityStateFlags, message?: string, anchor?: HTMLElement): void;
12
12
  /** Clear validity and reset `aria-invalid`. */
13
13
  protected clearValidity(): void;
14
+ /**
15
+ * Consumer-supplied error message. Concrete form controls declare this as a
16
+ * public reactive `@property`; the mixin declares only the type so
17
+ * {@link resolvedErrorMessage} can read it. The mixin never writes it.
18
+ */
19
+ errorMessage?: string;
20
+ /**
21
+ * Component-owned validation text. Store validation output here instead of
22
+ * overwriting `errorMessage`. Assigning a new value schedules a re-render.
23
+ */
24
+ protected internalValidationMessage: string;
25
+ /**
26
+ * The error text to render: a consumer-supplied `errorMessage` always wins;
27
+ * the component's own validation text fills in otherwise.
28
+ */
29
+ protected resolvedErrorMessage(): string;
14
30
  checkValidity(): boolean;
15
31
  reportValidity(): boolean;
16
32
  formResetCallback(): void;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Event-dispatch helpers for NYSDS components. Every `nys-*` contract event
3
+ * crosses shadow boundaries, so these helpers hard-code `bubbles: true` and
4
+ * `composed: true`. Components dispatch contract events through them instead
5
+ * of calling `dispatchEvent` directly.
6
+ */
7
+ /**
8
+ * Dispatch a `nys-*` CustomEvent from a component host.
9
+ *
10
+ * Pass the full event name, including the `nys-` prefix (for example
11
+ * `"nys-change"`). The event always bubbles and is composed, so delegated
12
+ * listeners and listeners outside any shadow root receive it.
13
+ */
14
+ export declare function dispatchNysEvent<T>(host: HTMLElement, name: string, detail: T): void;
15
+ /**
16
+ * Dispatch `nys-focus` or `nys-blur` from a component host.
17
+ *
18
+ * The contract uses a plain `Event` (no detail) for focus and blur, always
19
+ * bubbling and composed. Pass the bare kind (`"focus"` or `"blur"`); the
20
+ * helper adds the `nys-` prefix.
21
+ */
22
+ export declare function dispatchNysFocusBlur(host: HTMLElement, kind: "focus" | "blur"): void;
@@ -1,5 +1,6 @@
1
1
  export { generateId } from "./id";
2
- export type { AriaRelation, AriaTargets, FormValue } from "./types";
2
+ export type { AriaRelation, AriaTargets, FormControlKind, FormValue, } from "./types";
3
+ export { dispatchNysEvent, dispatchNysFocusBlur } from "./form-events";
3
4
  export { supportsElementRefs, associateControl, associateControlRefs, associateHost, } from "./aria-associate";
4
5
  export { IdentifiedMixin, NysElement, type IdentifiedInterface, type Constructor, } from "./identified-mixin";
5
6
  export { ReflectsAriaMixin, NysReflectsAriaElement, type ReflectsAriaInterface, } from "./reflects-aria-mixin";
@@ -7,3 +7,9 @@ export type FormValue = Parameters<ElementInternals["setFormValue"]>[0];
7
7
  export type AriaRelation = "labelledby" | "describedby" | "errormessage";
8
8
  /** A list of association targets, tolerant of null/undefined entries. */
9
9
  export type AriaTargets = Array<Element | null | undefined>;
10
+ /**
11
+ * How a form component binds its value: the name of the public property that
12
+ * frameworks read and write. Declared by each component's `@formControl`
13
+ * JSDoc tag and validated by `@nysds/codegen`.
14
+ */
15
+ export type FormControlKind = "value" | "checked" | "files";
@@ -48,6 +48,17 @@ export interface CEMExample {
48
48
  code: string;
49
49
  lang?: string;
50
50
  }
51
+ /**
52
+ * `@formControl <kind> <changeEvent> [inputEvent]` metadata, written by WS1
53
+ * on every form-control component's class JSDoc and parsed into the
54
+ * manifest by the CEM plugin. Drives the Angular `ControlValueAccessor`
55
+ * base class choice and the React/Angular snippet transformer's forms mode.
56
+ */
57
+ export interface CEMFormControl {
58
+ kind: "value" | "checked" | "files";
59
+ changeEvent: string;
60
+ inputEvent?: string;
61
+ }
51
62
  export interface CEMDeclaration {
52
63
  kind: "class";
53
64
  name: string;
@@ -65,6 +76,7 @@ export interface CEMDeclaration {
65
76
  package?: string;
66
77
  };
67
78
  examples?: CEMExample[];
79
+ formControl?: CEMFormControl;
68
80
  }
69
81
  export interface CEMModule {
70
82
  kind: "javascript-module";
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Framework snippet generation
3
+ *
4
+ * Turns a component's canonical HTML examples into React and Angular
5
+ * snippets using `@nysds/codegen`'s `transformExample` — the same
6
+ * transformer the docs site and Storybook autodocs use, so an AI assistant
7
+ * asking the MCP server sees exactly the same code a developer sees on
8
+ * designsystem.ny.gov.
9
+ */
10
+ import { type CEMExample, type CEMFormControl } from "./cem-parser.js";
11
+ export type FrameworkFilter = "html" | "react" | "angular";
12
+ export interface FrameworkSnippet {
13
+ code: string;
14
+ imports: string[];
15
+ warnings: string[];
16
+ unsupported: boolean;
17
+ }
18
+ export interface ExampleWithSnippets {
19
+ title: string;
20
+ html: string;
21
+ react: FrameworkSnippet;
22
+ angular: FrameworkSnippet;
23
+ }
24
+ /**
25
+ * Builds React and Angular snippets for every HTML example on a component.
26
+ *
27
+ * When `framework` names one target explicitly, that framework's snippet
28
+ * uses its most idiomatic forms binding for a form-control component —
29
+ * React's controlled pattern (`value` + `onNys*`), Angular's
30
+ * `formControlName` (Reactive Forms). The unrequested framework, and every
31
+ * snippet when `framework` is `"html"` (the default), stays a plain
32
+ * attribute-for-attribute conversion so the default response isn't
33
+ * surprising.
34
+ */
35
+ export declare function buildExampleSnippets(examples: CEMExample[] | undefined, framework: FrameworkFilter, formControl: CEMFormControl | undefined): ExampleWithSnippets[];
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Framework usage notes
3
+ *
4
+ * Short, framework-specific guidance attached to `get_component` responses
5
+ * when the caller asks for `framework: "react"` or `"angular"` — the import
6
+ * line, the event-prop naming rule, and (when the component is a form
7
+ * control) how it binds into that framework's forms. Naming follows the
8
+ * rules in `.claude/plans/framework-support/README.md` section 4.1, reused
9
+ * here via `@nysds/codegen` rather than re-derived.
10
+ */
11
+ import type { CEMFormControl } from "./cem-parser.js";
12
+ export interface FrameworkUsageNotes {
13
+ package: string;
14
+ import: string;
15
+ events: string;
16
+ forms?: string;
17
+ }
18
+ export declare function buildReactUsageNotes(tagName: string, className: string, formControl: CEMFormControl | undefined): FrameworkUsageNotes;
19
+ export declare function buildAngularUsageNotes(tagName: string, className: string, formControl: CEMFormControl | undefined): FrameworkUsageNotes;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Framework package index
3
+ *
4
+ * Reads `data/frameworks.json`, written by `scripts/sync-guides.mjs` from
5
+ * the `package.json` of each framework package (react, vue, angular). Gives
6
+ * tools and resources the published package name and version without
7
+ * hand-maintaining either.
8
+ */
9
+ export interface FrameworkPackageInfo {
10
+ packageName: string;
11
+ version: string;
12
+ }
13
+ export interface FrameworksIndex {
14
+ react: FrameworkPackageInfo;
15
+ vue: FrameworkPackageInfo;
16
+ angular: FrameworkPackageInfo;
17
+ }
18
+ export declare function getFrameworksIndex(): FrameworksIndex;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Framework Resources
3
+ *
4
+ * MCP resources for NYSDS framework packages (@nysds/react, @nysds/vue,
5
+ * @nysds/angular).
6
+ *
7
+ * Resources:
8
+ * - nysds://frameworks - Index of framework packages with version and guide URI
9
+ * - nysds://frameworks/react - @nysds/react guide (synced from its README)
10
+ * - nysds://frameworks/vue - @nysds/vue guide (synced from its README)
11
+ * - nysds://frameworks/angular - @nysds/angular guide (synced from its README)
12
+ */
13
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
14
+ export declare function registerFrameworkResources(server: McpServer): void;
@@ -18,6 +18,18 @@ import "./nys-accordionitem";
18
18
  * @cssprop [--nys-accordion-background-color--header--hover] - Background hover color of the accordion header.
19
19
  * @cssprop [--nys-accordion-content-max-width] - Maximum readable width of accordion content. Defaults to a character-based width (80ch) for readability.
20
20
  *
21
+ * @usagedos
22
+ * - Use accordions for FAQs on state services like DMV procedures or benefits information.
23
+ * - Break up long program descriptions or supplemental details (such as optional steps, extra instructions, or secondary eligibility notes) into manageable sections without overwhelming the reader.
24
+ * - Label headings clearly so users understand the content before expanding.
25
+ * - Consider accordions in mobile layouts to keep pages compact while still allowing access to full details.
26
+ *
27
+ * @usagedonts
28
+ * - Hide time-sensitive deadlines, required steps, or critical eligibility criteria in a collapsed section. Keep essential information visible by default.
29
+ * - Use vague or unclear headings that make it hard to know what is inside.
30
+ * - Overuse accordions for content that is short enough to display fully on the page.
31
+ * - Use an accordion when users need to compare details from multiple sections at once. Consider a table or side-by-side layout instead.
32
+ *
21
33
  * @example Basic
22
34
  * ```html
23
35
  * <nys-accordion>
@@ -1,6 +1,14 @@
1
1
  import { type TemplateResult } from "lit";
2
2
  import { NysElement } from "@nysds/internals";
3
3
  import "@nysds/nys-icon";
4
+ /** Detail payload for the `nys-accordionitem-toggle` event fired by `nys-accordionitem`. */
5
+ export interface NysAccordionitemToggleDetail {
6
+ id: string;
7
+ heading: string;
8
+ expanded: boolean;
9
+ }
10
+ /** The `nys-accordionitem-toggle` event fired by `nys-accordionitem`. */
11
+ export type NysAccordionitemToggleEvent = CustomEvent<NysAccordionitemToggleDetail>;
4
12
  /**
5
13
  * A collapsible content panel used within `nys-accordion`. Supports keyboard navigation and smooth animations.
6
14
  *
@@ -17,7 +25,7 @@ import "@nysds/nys-icon";
17
25
  *
18
26
  * @slot - Default slot for panel content shown when expanded.
19
27
  *
20
- * @fires nys-accordionitem-toggle - Fired when expanded state changes. Detail: `{id, heading, expanded}`.
28
+ * @fires {NysAccordionitemToggleEvent} nys-accordionitem-toggle - Fired when expanded state changes. Detail: `{id, heading, expanded}`.
21
29
  *
22
30
  * @example Expanded item
23
31
  * ```html
@@ -1,6 +1,14 @@
1
1
  import { NysElement } from "@nysds/internals";
2
2
  import "@nysds/nys-icon";
3
3
  import "@nysds/nys-button";
4
+ /** Detail payload for the `nys-close` event fired by `nys-alert`. */
5
+ export interface NysAlertCloseDetail {
6
+ id: string;
7
+ type: "base" | "info" | "success" | "warning" | "danger" | "emergency";
8
+ label: string;
9
+ }
10
+ /** The `nys-close` event fired by `nys-alert`. */
11
+ export type NysAlertCloseEvent = CustomEvent<NysAlertCloseDetail>;
4
12
  /**
5
13
  * Displays contextual feedback messages with semantic styling. Uses ARIA live regions for screen reader announcements.
6
14
  *
@@ -12,7 +20,37 @@ import "@nysds/nys-button";
12
20
  *
13
21
  * @slot - Default slot for custom body content. Overrides `text` prop when provided.
14
22
  *
15
- * @fires nys-close - Fired when alert is dismissed. Detail: `{id, type, label}`.
23
+ * @cssprop [--nys-alert-color] - Text color of heading and description
24
+ * @cssprop [--nys-alert-color-link] - Text color of action links
25
+ * @cssprop [--nys-alert-color--link--hover] - Text color of action links when hovered
26
+ * @cssprop [--nys-alert-color--link--active] - Text color of action links when active
27
+ * @cssprop [--nys-alert-border-color] - Color of border accent color
28
+ * @cssprop [--nys-alert-background-color] - Background color of component
29
+ *
30
+ * @fires {NysAlertCloseEvent} nys-close - Fired when alert is dismissed. Detail: `{id, type, label}`.
31
+ *
32
+ * @usagedos
33
+ * - Communicate important, time-sensitive information to users in a visually prominent way.
34
+ * - Use for messages such as success notifications, danger alerts, warnings, or informational updates.
35
+ * - Use for dismissible or temporary alerts when the message is not critical to user workflow.
36
+ * - Use the appropriate theme (e.g., info, success, warning, or danger) to match the intent of the alert.
37
+ * - Use the dismissible property for non-critical alerts.
38
+ * - Keep the alert content concise and focused on the message.
39
+ * - Limit alerts to one per page.
40
+ * - Use success type to confirm a positive system status to users such as saving a form.
41
+ * - Use danger type to display system status error messages.
42
+ * - Only use emergency for real emergencies (e.g., missing person, severe weather). Remember to swap icon if a more relevant one exists.
43
+ *
44
+ * @usagedonts
45
+ * - Use alerts for information that is not time-sensitive or critical; consider using an inline message instead.
46
+ * - Use alerts for repetitive or non-actionable content that could frustrate users.
47
+ * - Remove the left icon, it is required for accessibility.
48
+ * - Use alerts to highlight actions that should be clear in the UI itself.
49
+ * - Use error messages to communicate form field validation issues; use field error states instead.
50
+ * - Include more than two link actions in an alert.
51
+ * - Overuse alerts for low-priority info. This can desensitize users.
52
+ * - Use alerts as toasts. Place them at the top of the page content.
53
+ * - Add any shadows to alerts.
16
54
  *
17
55
  * @example Basic
18
56
  * ```html
@@ -14,8 +14,24 @@ import "@nysds/nys-icon";
14
14
  * @summary User avatar with image, initials, or icon fallback and contrast-aware colors.
15
15
  * @element nys-avatar
16
16
  *
17
+ * @cssprop [--nys-avatar-size] - Width and height of the component
18
+ *
17
19
  * @slot - Custom icon content. Overrides default icon when no image or initials.
18
20
  *
21
+ * @usagedos
22
+ * - Use for clear, simple user or entity representation in UIs such as profiles, account settings, or comment threads.
23
+ * - Prefer showing the full name next to the avatar on tablets and larger breakpoints.
24
+ * - Place the full name of the user or entity to the right of the avatar.
25
+ * - Ensure the text of initial avatars meets WCAG 2.1 contrast ratio against the avatar's background.
26
+ * - Use the `<nys-icon>` slot only when the icon prop isn't sufficient.
27
+ *
28
+ * @usagedonts
29
+ * - Skip the `ariaLabel` attribute for screen reader users.
30
+ * - Use the `<nys-icon>` as a slot when the icon prop can satisfy your use.
31
+ * - Overload the avatar with unnecessary customizations or override default avatar icons unless additional context is essential. Doing so creates inconsistency across NYS interfaces.
32
+ * - Use an avatar when a large visual representation is needed; use a photo instead.
33
+ * - Replace an avatar with a simple label or text when that would communicate the information more clearly.
34
+ *
19
35
  * @example Basic
20
36
  * ```html
21
37
  * <nys-avatar ariaLabel="User avatar"></nys-avatar>
@@ -17,6 +17,18 @@ import "@nysds/nys-button";
17
17
  * @summary Floating back-to-top button with auto-show behavior, smooth scroll, and focus management.
18
18
  * @element nys-backtotop
19
19
  *
20
+ * @usagedos
21
+ * - Place exactly one `<nys-backtotop>` per page, above the `<nys-globalfooter>` in your markup.
22
+ * - Use on long-form content pages such as state policy documents, agency service directories, program eligibility guides, extensive search results, or data tables.
23
+ * - Set `position="left"` when the bottom-right corner is occupied by another floating element, such as a chatbot button.
24
+ * - Let the component manage its own visibility. The auto-show behavior activates after 1.5 viewport heights on pages that are at least 4 screens tall.
25
+ *
26
+ * @usagedonts
27
+ * - Don't add multiple `<nys-backtotop>` components to a single page.
28
+ * - Don't use on pages where content fits within a single viewport without scrolling.
29
+ * - Don't use if your page already has anchor-based in-page navigation such as a table of contents. A back-to-top button is likely redundant.
30
+ * - Don't set `visible` in production unless you have a specific reason to override the auto-show behavior. Forcing visibility on short pages creates unnecessary clutter.
31
+ *
20
32
  * @example Basic
21
33
  * ```html
22
34
  * <footer>
@@ -37,7 +49,7 @@ import "@nysds/nys-button";
37
49
  * font-size: var(--nys-font-size-sm);
38
50
  * }
39
51
  * </style>
40
- * <nys-unavheader translateKey="NEf4Y5qMb9PGP"></nys-unavheader>
52
+ * <nys-unavheader hideTranslate hideSearch></nys-unavheader>
41
53
  * <nys-globalheader appName="Back to Top Example"></nys-globalheader>
42
54
  * <main style="padding: 0 2rem">
43
55
  * <h1>Sample Content on page</h1>
@@ -79,7 +91,7 @@ import "@nysds/nys-button";
79
91
  * --_nys-button-border-radius: var(--nys-radius-round);
80
92
  * }
81
93
  * </style>
82
- * <nys-unavheader translateKey="NEf4Y5qMb9PGP"></nys-unavheader>
94
+ * <nys-unavheader hideTranslate hideSearch></nys-unavheader>
83
95
  * <nys-globalheader appName="Back to Top Example"></nys-globalheader>
84
96
  * <main style="padding: 0 2rem">
85
97
  * <h1>Sample Content on page</h1>
@@ -10,6 +10,24 @@ import "@nysds/nys-icon";
10
10
  * @summary Compact label for status, counts, or categorization with semantic styling.
11
11
  * @element nys-badge
12
12
  *
13
+ * @usagedos
14
+ * - Indicate the status of an item, such as "new", "updated", or "beta".
15
+ * - Provide additional context or information about an item without cluttering the interface.
16
+ * - Keep badge labels short -- one or two words like "New", "Beta", or "Updated".
17
+ * - Use the `intent` property to match the badge's visual style to its meaning (e.g., `success` for positive statuses, `warning` for caution).
18
+ * - Place badges near the element they describe so the relationship is clear.
19
+ * - Use the `prefixIcon` or `suffixIcon` attributes to reinforce meaning when the label alone may be ambiguous.
20
+ * - Apply the `strong` variant when the badge appears on a raised surface or needs extra emphasis.
21
+ *
22
+ * @usagedonts
23
+ * - Use badges when the information is too complex to be conveyed in a small badge.
24
+ * - Use badges when they would not add significant value to the user experience.
25
+ * - Use badges as interactive elements -- they are not buttons or links.
26
+ * - Pack long sentences or multiple values into a single badge label.
27
+ * - Mix badge sizes within the same group; pick either `md` or `sm` and stay consistent.
28
+ * - Rely on color alone to convey meaning; always include a text label.
29
+ * - Stack multiple badges on a single element unless each communicates a distinct, necessary status.
30
+ *
13
31
  * @example Basic
14
32
  * ```html
15
33
  * <nys-badge label="Basic badge"></nys-badge>
@@ -1,5 +1,11 @@
1
1
  import { NysElement } from "@nysds/internals";
2
2
  import "@nysds/nys-icon";
3
+ /** Detail payload for the `nys-expand` event fired by `nys-breadcrumbs`. */
4
+ export interface NysBreadcrumbsExpandDetail {
5
+ id: string;
6
+ }
7
+ /** The `nys-expand` event fired by `nys-breadcrumbs`. */
8
+ export type NysBreadcrumbsExpandEvent = CustomEvent<NysBreadcrumbsExpandDetail>;
3
9
  /**
4
10
  * A breadcrumb navigation trail composed of `li` elements.
5
11
  * Collapses when the trail exceeds 5 items on desktop or 3 items on mobile,
@@ -11,7 +17,22 @@ import "@nysds/nys-icon";
11
17
  *
12
18
  * @slot - One or more `li` elements defining the trail.
13
19
  *
14
- * @fires nys-breadcrumbs-expand - Fired when the user clicks the ellipsis to expand the trail.
20
+ * @cssprop [--nys-max-width--content] - Overrides the inner content max width across the grid, header, footer, and breadcrumb. Set at a higher level like `:root` to apply to all instances. Takes priority over the size-specific variable.
21
+ *
22
+ * @fires {NysBreadcrumbsExpandEvent} nys-expand - Fired when the user clicks the ellipsis to expand the trail. Detail: `{id}`.
23
+ *
24
+ * @usagedos
25
+ * - Use on pages at level 2 and deeper in a site hierarchy. If a level 2 page has child pages, all pages starting at that level should include a breadcrumb.
26
+ * - Place breadcrumb below the header and above the main content.
27
+ * - Show the site hierarchy, not the path a user took.
28
+ * - For the home page of a site, use a specific label rather than a generic "Home." This differentiates the main site home from other landing pages (e.g., "myBenefits Home" instead of just "Home").
29
+ *
30
+ * @usagedonts
31
+ * - Use on top-level pages, or on sites with only one or two levels of hierarchy.
32
+ * - Make the current page clickable.
33
+ * - Use breadcrumbs as the only navigation method.
34
+ * - Use breadcrumbs for sequential processes like multi-step forms or wizards. Use a stepper instead.
35
+ * - Add breadcrumbs when they don't provide meaningful context or navigation value.
15
36
  *
16
37
  * @example Basic
17
38
  * ```html
@@ -167,12 +188,17 @@ export declare class NysBreadcrumbs extends NysElement {
167
188
  * --------------------------------------------------------------------------
168
189
  */
169
190
  private _updateCollapseThreshold;
191
+ private _boundDisabledClickGuard;
170
192
  private _getSlottedOl;
171
193
  private _getSlottedItems;
172
194
  private _getAnchor;
173
195
  private _isCurrentPage;
174
- private _createBackToParentElement;
175
- private _createCrumbElement;
196
+ private _createIcon;
197
+ private _resetItem;
198
+ private _applyDisabledState;
199
+ private _applyBackToParentStyle;
200
+ private _applyCrumbStyle;
201
+ private _insertEllipsis;
176
202
  /**
177
203
  * Main logic for cloning and handling user slots.
178
204
  * New <ol>, <li>, and <a> tags are created and rendered out as crumbs for the breadcrumbs trail.