@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
@@ -1,42 +0,0 @@
1
- import React, { forwardRef } from "react";
2
- import "../../dist/nysds.es.js";
3
-
4
- export const NysBadge = forwardRef((props, forwardedRef) => {
5
- const {
6
- strong,
7
- prefixIcon,
8
- suffixIcon,
9
- id,
10
- name,
11
- size,
12
- intent,
13
- prefixLabel,
14
- label,
15
- srText,
16
- ...filteredProps
17
- } = props;
18
-
19
- return React.createElement(
20
- "nys-badge",
21
- {
22
- ...filteredProps,
23
- id: props.id,
24
- name: props.name,
25
- size: props.size,
26
- intent: props.intent,
27
- prefixLabel: props.prefixLabel,
28
- label: props.label,
29
- srText: props.srText,
30
- class: props.className,
31
- exportparts: props.exportparts,
32
- for: props.htmlFor,
33
- part: props.part,
34
- tabindex: props.tabIndex,
35
- strong: props.strong ? true : undefined,
36
- prefixicon: props.prefixIcon ? true : undefined,
37
- suffixicon: props.suffixIcon ? true : undefined,
38
- style: { ...props.style },
39
- },
40
- props.children,
41
- );
42
- });
@@ -1,72 +0,0 @@
1
- import React from "react";
2
- import {
3
- NysBreadcrumbItem as NysBreadcrumbItemElement,
4
- CustomEvent,
5
- } from "../../dist/nysds.es.js";
6
-
7
- export type { NysBreadcrumbItemElement, CustomEvent };
8
-
9
- export interface NysBreadcrumbItemProps extends Pick<
10
- React.AllHTMLAttributes<HTMLElement>,
11
- | "children"
12
- | "dir"
13
- | "hidden"
14
- | "id"
15
- | "lang"
16
- | "slot"
17
- | "style"
18
- | "title"
19
- | "translate"
20
- | "onClick"
21
- | "onFocus"
22
- | "onBlur"
23
- > {
24
- /** Private property used by nys-breadcrumbs to indicate this breadcrumb item is the last in the trail * */
25
- isLast?: boolean;
26
-
27
- /** undefined */
28
- isBackToParent?: boolean;
29
-
30
- /** undefined */
31
- id?: NysBreadcrumbItemElement["id"];
32
-
33
- /** undefined */
34
- label?: NysBreadcrumbItemElement["label"];
35
-
36
- /** undefined */
37
- link?: NysBreadcrumbItemElement["link"];
38
-
39
- /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
40
- className?: string;
41
-
42
- /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
43
- exportparts?: string;
44
-
45
- /** Used for labels to link them with their inputs (using input id). */
46
- htmlFor?: string;
47
-
48
- /** Used to help React identify which items have changed, are added, or are removed within a list. */
49
- key?: number | string;
50
-
51
- /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
52
- part?: string;
53
-
54
- /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
55
- ref?: any;
56
-
57
- /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
58
- tabIndex?: number;
59
-
60
- /** Fired when the link is clicked. Detail: `{id, link}`. */
61
- onNysBreadcrumbitemClick?: (event: CustomEvent) => void;
62
- }
63
-
64
- /**
65
- * Single breadcrumb trail item with chevron separator and current page support.
66
- * ---
67
- *
68
- *
69
- * ### **Events:**
70
- * - **nys-breadcrumbitem-click** - Fired when the link is clicked. Detail: `{id, link}`.
71
- */
72
- export const NysBreadcrumbItem: React.ForwardRefExoticComponent<NysBreadcrumbItemProps>;
@@ -1,42 +0,0 @@
1
- import React, { forwardRef, useRef, useEffect } from "react";
2
- import "../../dist/nysds.es.js";
3
- import { useEventListener } from "./react-utils.js";
4
-
5
- export const NysBreadcrumbItem = forwardRef((props, forwardedRef) => {
6
- const ref = useRef(null);
7
- const { isLast, isBackToParent, id, label, link, ...filteredProps } = props;
8
-
9
- /** Event listeners - run once */
10
- useEventListener(
11
- ref,
12
- "nys-breadcrumbitem-click",
13
- props.onNysBreadcrumbitemClick,
14
- );
15
-
16
- return React.createElement(
17
- "nys-breadcrumbitem",
18
- {
19
- ref: (node) => {
20
- ref.current = node;
21
- if (typeof forwardedRef === "function") {
22
- forwardedRef(node);
23
- } else if (forwardedRef) {
24
- forwardedRef.current = node;
25
- }
26
- },
27
- ...filteredProps,
28
- id: props.id,
29
- label: props.label,
30
- link: props.link,
31
- class: props.className,
32
- exportparts: props.exportparts,
33
- for: props.htmlFor,
34
- part: props.part,
35
- tabindex: props.tabIndex,
36
- isLast: props.isLast ? true : undefined,
37
- isBackToParent: props.isBackToParent ? true : undefined,
38
- style: { ...props.style },
39
- },
40
- props.children,
41
- );
42
- });
@@ -1,89 +0,0 @@
1
- import React from "react";
2
- import {
3
- NysBreadcrumbs as NysBreadcrumbsElement,
4
- CustomEvent,
5
- } from "../../dist/nysds.es.js";
6
-
7
- export type { NysBreadcrumbsElement, CustomEvent };
8
-
9
- export interface NysBreadcrumbsProps extends Pick<
10
- React.AllHTMLAttributes<HTMLElement>,
11
- | "children"
12
- | "dir"
13
- | "hidden"
14
- | "id"
15
- | "lang"
16
- | "slot"
17
- | "style"
18
- | "title"
19
- | "translate"
20
- | "onClick"
21
- | "onFocus"
22
- | "onBlur"
23
- > {
24
- /** On mobile, renders the trail as a single back-to-parent link pointing to the item before the current page.
25
- Has no effect on desktop or when only one item is present (which always renders as a back link). */
26
- backToParent?: boolean;
27
-
28
- /** Forces the trail into its collapsed state.
29
- It shows only the first item, an ellipsis, and the last two items.
30
- The user can still expand the trail by clicking the ellipsis. */
31
- collapsed?: boolean;
32
-
33
- /** Renders a filled light theme background bar behind the breadcrumb trail. */
34
- backgroundBar?: boolean;
35
-
36
- /** Prevents interaction. */
37
- disabled?: boolean;
38
-
39
- /** Unique identifier. Auto-generated if not provided. */
40
- id?: NysBreadcrumbsElement["id"];
41
-
42
- /** Accessible label for the `<nav>` landmark. Defaults to "Breadcrumb" if not set.
43
- Override when multiple crumbs exist on the same page. */
44
- ariaLabel?: NysBreadcrumbsElement["ariaLabel"];
45
-
46
- /** Controls the visual size of the breadcrumb text and spacing: `sm` for dense layouts, `md` (default) for standard use. */
47
- size?: NysBreadcrumbsElement["size"];
48
-
49
- /** 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()`. */
50
- className?: string;
51
-
52
- /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
53
- exportparts?: string;
54
-
55
- /** Used for labels to link them with their inputs (using input id). */
56
- htmlFor?: string;
57
-
58
- /** Used to help React identify which items have changed, are added, or are removed within a list. */
59
- key?: number | string;
60
-
61
- /** 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. */
62
- part?: string;
63
-
64
- /** 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. */
65
- ref?: any;
66
-
67
- /** 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. */
68
- tabIndex?: number;
69
-
70
- /** undefined */
71
- onNysExpand?: (event: CustomEvent) => void;
72
-
73
- /** Fired when the user clicks the ellipsis to expand the trail. */
74
- onNysBreadcrumbsExpand?: (event: CustomEvent) => void;
75
- }
76
-
77
- /**
78
- * Breadcrumb navigation trail with responsive collapse support.
79
- * ---
80
- *
81
- *
82
- * ### **Events:**
83
- * - **nys-expand**
84
- * - **nys-breadcrumbs-expand** - Fired when the user clicks the ellipsis to expand the trail.
85
- *
86
- * ### **Slots:**
87
- * - _default_ - One or more `li` elements defining the trail.
88
- */
89
- export const NysBreadcrumbs: React.ForwardRefExoticComponent<NysBreadcrumbsProps>;
@@ -1,50 +0,0 @@
1
- import React, { forwardRef, useRef, useEffect } from "react";
2
- import "../../dist/nysds.es.js";
3
- import { useEventListener } from "./react-utils.js";
4
-
5
- export const NysBreadcrumbs = forwardRef((props, forwardedRef) => {
6
- const ref = useRef(null);
7
- const {
8
- backToParent,
9
- collapsed,
10
- backgroundBar,
11
- disabled,
12
- id,
13
- ariaLabel,
14
- size,
15
- ...filteredProps
16
- } = props;
17
-
18
- /** Event listeners - run once */
19
- useEventListener(ref, "nys-expand", props.onNysExpand);
20
- useEventListener(ref, "nys-breadcrumbs-expand", props.onNysBreadcrumbsExpand);
21
-
22
- return React.createElement(
23
- "nys-breadcrumbs",
24
- {
25
- ref: (node) => {
26
- ref.current = node;
27
- if (typeof forwardedRef === "function") {
28
- forwardedRef(node);
29
- } else if (forwardedRef) {
30
- forwardedRef.current = node;
31
- }
32
- },
33
- ...filteredProps,
34
- id: props.id,
35
- ariaLabel: props.ariaLabel,
36
- size: props.size,
37
- class: props.className,
38
- exportparts: props.exportparts,
39
- for: props.htmlFor,
40
- part: props.part,
41
- tabindex: props.tabIndex,
42
- backToParent: props.backToParent ? true : undefined,
43
- collapsed: props.collapsed ? true : undefined,
44
- backgroundBar: props.backgroundBar ? true : undefined,
45
- disabled: props.disabled ? true : undefined,
46
- style: { ...props.style },
47
- },
48
- props.children,
49
- );
50
- });
@@ -1,171 +0,0 @@
1
- import React from "react";
2
- import { NysButton as NysButtonElement, Event } from "../../dist/nysds.es.js";
3
-
4
- export type { NysButtonElement, Event };
5
-
6
- export interface NysButtonProps 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
- /** Expands button to fill container width. Use for mobile layouts or stacked button groups. */
22
- fullWidth?: boolean;
23
-
24
- /** Adjusts colors for dark backgrounds. */
25
- inverted?: boolean;
26
-
27
- /** Renders circular icon-only button. Requires `icon` prop. `label` is rendered as visually-hidden text for the accessible name. */
28
- circle?: boolean;
29
-
30
- /** Prevents interaction. Avoid disabling without explanation—show validation errors instead. */
31
- disabled?: boolean;
32
-
33
- /** Unique identifier. Auto-generated if not provided. */
34
- id?: NysButtonElement["id"];
35
-
36
- /** Name for form submission. */
37
- name?: NysButtonElement["name"];
38
-
39
- /** Button height: `sm` (40px) for dense UIs, `md` (48px, default) for standard use, `lg` (56px) for prominent CTAs. */
40
- size?: NysButtonElement["size"];
41
-
42
- /** Visual style: `filled` for primary (one per section), `outline` for secondary, `ghost` for tertiary, `text` for inline actions. Avoid `text` for navigation. */
43
- variant?: NysButtonElement["variant"];
44
-
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
- label?: NysButtonElement["label"];
47
-
48
- /** ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`.
49
-
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>`. */
53
- ariaControls?: NysButtonElement["ariaControls"];
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
-
83
- /** Material Symbol icon before label. Not shown for `circle` mode. */
84
- prefixIcon?: NysButtonElement["prefixIcon"];
85
-
86
- /** Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `circle` mode. */
87
- suffixIcon?: NysButtonElement["suffixIcon"];
88
-
89
- /** Icon for circle mode. Required when `circle` is true. Scales with size (sm=24px, md=32px, lg=40px). */
90
- icon?: NysButtonElement["icon"];
91
-
92
- /** Form `id` to associate with. Use when button is outside the form element. */
93
- form?: NysButtonElement["form"];
94
-
95
- /** Value submitted with form data. Only used when `type="submit"`. */
96
- value?: NysButtonElement["value"];
97
-
98
- /** ID(s) of element(s) describing this button. Sets `aria-describedby`. */
99
- ariaDescribedBy?: NysButtonElement["ariaDescribedBy"];
100
-
101
- /** Form behavior: `button` (default, no form action), `submit` (submits form), `reset` (resets form). Always set explicitly to avoid unintended submissions. */
102
- type?: NysButtonElement["type"];
103
-
104
- /** URL to navigate to. Renders as `<a>` tag. Omit for action buttons. */
105
- href?: NysButtonElement["href"];
106
-
107
- /** Link target: `_self` (same tab), `_blank` (new tab—add `suffixIcon="open_in_new"`), `_parent`, `_top`, or frame name. */
108
- target?: NysButtonElement["target"];
109
-
110
- /** 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()`. */
111
- className?: string;
112
-
113
- /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
114
- exportparts?: string;
115
-
116
- /** Used for labels to link them with their inputs (using input id). */
117
- htmlFor?: string;
118
-
119
- /** Used to help React identify which items have changed, are added, or are removed within a list. */
120
- key?: number | string;
121
-
122
- /** 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. */
123
- part?: string;
124
-
125
- /** 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. */
126
- ref?: any;
127
-
128
- /** 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. */
129
- tabIndex?: number;
130
-
131
- /** Click handler. Use instead of `@click` to ensure keyboard accessibility. */
132
- onClick?: NysButtonElement["onClick"];
133
-
134
- /** Fired when the button receives focus. */
135
- onNysFocus?: (event: CustomEvent) => void;
136
-
137
- /** Fired when the button loses focus. */
138
- onNysBlur?: (event: CustomEvent) => void;
139
-
140
- /** Fired when the button is clicked (mouse or keyboard). Not fired when disabled. */
141
- onNysClick?: (event: CustomEvent) => void;
142
- }
143
-
144
- /**
145
- * Button for actions and CTAs with variants, sizes, and icon support.
146
- * ---
147
- *
148
- *
149
- * ### **Events:**
150
- * - **nys-focus** - Fired when the button receives focus.
151
- * - **nys-blur** - Fired when the button loses focus.
152
- * - **nys-click** - Fired when the button is clicked (mouse or keyboard). Not fired when disabled.
153
- *
154
- * ### **Slots:**
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.
157
- * - **suffix-icon** - Icon after label. Not shown for `text` variant.
158
- * - **circle-icon** - Icon for circle mode. Overrides `icon` prop.
159
- *
160
- * ### **CSS Properties:**
161
- * - **--nys-button-color** - Text color of the button label. _(default: undefined)_
162
- * - **--nys-button-color--hover** - Text color when hovered. _(default: undefined)_
163
- * - **--nys-button-color--active** - Text color when active/pressed. _(default: undefined)_
164
- * - **--nys-button-background-color** - Background color of the button. _(default: undefined)_
165
- * - **--nys-button-background-color--hover** - Background color when hovered. _(default: undefined)_
166
- * - **--nys-button-background-color--active** - Background color when active/pressed. _(default: undefined)_
167
- * - **--nys-button-border-color** - Border color of the button. _(default: undefined)_
168
- * - **--nys-button-border-color--hover** - Border color when hovered. _(default: undefined)_
169
- * - **--nys-button-border-color--active** - Border color when active/pressed. _(default: undefined)_
170
- */
171
- export const NysButton: React.ForwardRefExoticComponent<NysButtonProps>;
@@ -1,83 +0,0 @@
1
- import React, { forwardRef, useRef, useEffect } from "react";
2
- import "../../dist/nysds.es.js";
3
- import { useEventListener, useProperties } from "./react-utils.js";
4
-
5
- export const NysButton = forwardRef((props, forwardedRef) => {
6
- const ref = useRef(null);
7
- const {
8
- fullWidth,
9
- inverted,
10
- circle,
11
- disabled,
12
- id,
13
- name,
14
- size,
15
- variant,
16
- label,
17
- ariaControls,
18
- ariaExpanded,
19
- ariaCurrent,
20
- prefixIcon,
21
- suffixIcon,
22
- icon,
23
- form,
24
- value,
25
- ariaDescribedBy,
26
- type,
27
- href,
28
- target,
29
- onClick,
30
- ...filteredProps
31
- } = props;
32
-
33
- /** Event listeners - run once */
34
- useEventListener(ref, "nys-focus", props.onNysFocus);
35
- useEventListener(ref, "nys-blur", props.onNysBlur);
36
- useEventListener(ref, "nys-click", props.onNysClick);
37
-
38
- /** Properties - run whenever a property has changed */
39
- useProperties(ref, "onClick", props.onClick);
40
-
41
- return React.createElement(
42
- "nys-button",
43
- {
44
- ref: (node) => {
45
- ref.current = node;
46
- if (typeof forwardedRef === "function") {
47
- forwardedRef(node);
48
- } else if (forwardedRef) {
49
- forwardedRef.current = node;
50
- }
51
- },
52
- ...filteredProps,
53
- id: props.id,
54
- name: props.name,
55
- size: props.size,
56
- variant: props.variant,
57
- label: props.label,
58
- ariaControls: props.ariaControls,
59
- ariaExpanded: props.ariaExpanded,
60
- ariaCurrent: props.ariaCurrent,
61
- prefixIcon: props.prefixIcon,
62
- suffixIcon: props.suffixIcon,
63
- icon: props.icon,
64
- form: props.form,
65
- value: props.value,
66
- ariaDescribedBy: props.ariaDescribedBy,
67
- type: props.type,
68
- href: props.href,
69
- target: props.target,
70
- class: props.className,
71
- exportparts: props.exportparts,
72
- for: props.htmlFor,
73
- part: props.part,
74
- tabindex: props.tabIndex,
75
- fullWidth: props.fullWidth ? true : undefined,
76
- inverted: props.inverted ? true : undefined,
77
- circle: props.circle ? true : undefined,
78
- disabled: props.disabled ? true : undefined,
79
- style: { ...props.style },
80
- },
81
- props.children,
82
- );
83
- });
@@ -1,110 +0,0 @@
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>;