@nysds/components 1.16.1 → 1.18.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 (64) hide show
  1. package/custom-elements.json +4245 -3280
  2. package/dist/.vscode/vscode.html-custom-data.json +114 -30
  3. package/dist/custom-elements.json +4245 -3280
  4. package/dist/nysds.es.js +2550 -1977
  5. package/dist/nysds.es.js.map +1 -1
  6. package/dist/nysds.js +186 -164
  7. package/dist/nysds.js.map +1 -1
  8. package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +15 -3
  9. package/dist/packages/nys-badge/src/nys-badge.d.ts +2 -0
  10. package/dist/packages/nys-breadcrumbs/src/index.d.ts +1 -0
  11. package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +119 -0
  12. package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.figma.d.ts +1 -0
  13. package/dist/packages/nys-button/src/nys-button.d.ts +2 -2
  14. package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +0 -2
  15. package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +1 -4
  16. package/dist/packages/nys-combobox/src/nys-combobox.d.ts +8 -0
  17. package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +1 -0
  18. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +3 -1
  19. package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +2 -2
  20. package/dist/packages/nys-label/src/nys-label.d.ts +9 -6
  21. package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +0 -2
  22. package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +1 -4
  23. package/dist/packages/nys-tab/src/index.d.ts +3 -0
  24. package/dist/packages/nys-tab/src/nys-tab.d.ts +116 -0
  25. package/dist/packages/nys-tab/src/nys-tab.figma.d.ts +1 -0
  26. package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +197 -0
  27. package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +46 -0
  28. package/dist/packages/nys-table/src/nys-table.d.ts +10 -7
  29. package/dist/packages/nys-textarea/src/nys-textarea.d.ts +1 -1
  30. package/dist/packages/nys-textinput/src/nys-textinput.d.ts +2 -1
  31. package/dist/packages/nys-video/src/nys-video.d.ts +25 -0
  32. package/dist/src/index.d.ts +2 -0
  33. package/package.json +3 -2
  34. package/packages/react/NysBacktotop.d.ts +1 -1
  35. package/packages/react/NysBadge.d.ts +3 -0
  36. package/packages/react/NysBadge.js +2 -0
  37. package/packages/react/NysBreadcrumbItem.d.ts +72 -0
  38. package/packages/react/NysBreadcrumbItem.js +42 -0
  39. package/packages/react/NysBreadcrumbs.d.ts +89 -0
  40. package/packages/react/NysBreadcrumbs.js +50 -0
  41. package/packages/react/NysButton.d.ts +2 -2
  42. package/packages/react/NysCheckbox.d.ts +0 -3
  43. package/packages/react/NysCheckbox.js +0 -2
  44. package/packages/react/NysCheckboxgroup.d.ts +0 -3
  45. package/packages/react/NysCheckboxgroup.js +0 -2
  46. package/packages/react/NysErrorMessage.d.ts +3 -0
  47. package/packages/react/NysErrorMessage.js +2 -1
  48. package/packages/react/NysLabel.d.ts +16 -4
  49. package/packages/react/NysLabel.js +17 -3
  50. package/packages/react/NysRadiobutton.d.ts +0 -3
  51. package/packages/react/NysRadiobutton.js +0 -2
  52. package/packages/react/NysRadiogroup.d.ts +0 -3
  53. package/packages/react/NysRadiogroup.js +0 -2
  54. package/packages/react/NysTab.d.ts +90 -0
  55. package/packages/react/NysTab.js +39 -0
  56. package/packages/react/NysTabgroup.d.ts +75 -0
  57. package/packages/react/NysTabgroup.js +22 -0
  58. package/packages/react/NysTabpanel.d.ts +63 -0
  59. package/packages/react/NysTabpanel.js +21 -0
  60. package/packages/react/NysVideo.d.ts +7 -1
  61. package/packages/react/NysVideo.js +14 -1
  62. package/packages/react/index.d.ts +4 -0
  63. package/packages/react/index.js +4 -0
  64. package/packages/react/nysds-jsx.d.ts +167 -14
@@ -51,10 +51,10 @@ export interface NysButtonProps extends Pick<
51
51
  /** ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`. */
52
52
  ariaControls?: NysButtonElement["ariaControls"];
53
53
 
54
- /** Material Symbol icon before label. Not shown for `text` variant or `circle` mode. */
54
+ /** Material Symbol icon before label. Not shown for `circle` mode. */
55
55
  prefixIcon?: NysButtonElement["prefixIcon"];
56
56
 
57
- /** Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `text` variant or `circle` mode. */
57
+ /** Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `circle` mode. */
58
58
  suffixIcon?: NysButtonElement["suffixIcon"];
59
59
 
60
60
  /** Icon for circle mode. Required when `circle` is true. Scales with size (sm=24px, md=32px, lg=40px). */
@@ -40,9 +40,6 @@ export interface NysCheckboxProps extends Pick<
40
40
  /** Renders as tile with larger clickable area. Apply to group for consistency. */
41
41
  tile?: boolean;
42
42
 
43
- /** Adjusts colors for dark backgrounds. */
44
- inverted?: boolean;
45
-
46
43
  /** undefined */
47
44
  other?: boolean;
48
45
 
@@ -11,7 +11,6 @@ export const NysCheckbox = forwardRef((props, forwardedRef) => {
11
11
  showError,
12
12
  groupExist,
13
13
  tile,
14
- inverted,
15
14
  other,
16
15
  showOtherError,
17
16
  label,
@@ -66,7 +65,6 @@ export const NysCheckbox = forwardRef((props, forwardedRef) => {
66
65
  showError: props.showError ? true : undefined,
67
66
  groupExist: props.groupExist ? true : undefined,
68
67
  tile: props.tile ? true : undefined,
69
- inverted: props.inverted ? true : undefined,
70
68
  other: props.other ? true : undefined,
71
69
  showOtherError: props.showOtherError ? true : undefined,
72
70
  style: { ...props.style },
@@ -30,9 +30,6 @@ export interface NysCheckboxgroupProps extends Pick<
30
30
  /** Renders all checkboxes as tiles with larger clickable area. */
31
31
  tile?: boolean;
32
32
 
33
- /** Adjusts colors for dark backgrounds. Applied to all children. */
34
- inverted?: boolean;
35
-
36
33
  /** Unique identifier. Auto-generated if not provided. */
37
34
  id?: NysCheckboxgroupElement["id"];
38
35
 
@@ -7,7 +7,6 @@ export const NysCheckboxgroup = forwardRef((props, forwardedRef) => {
7
7
  optional,
8
8
  showError,
9
9
  tile,
10
- inverted,
11
10
  id,
12
11
  name,
13
12
  errorMessage,
@@ -40,7 +39,6 @@ export const NysCheckboxgroup = forwardRef((props, forwardedRef) => {
40
39
  optional: props.optional ? true : undefined,
41
40
  showError: props.showError ? true : undefined,
42
41
  tile: props.tile ? true : undefined,
43
- inverted: props.inverted ? true : undefined,
44
42
  style: { ...props.style },
45
43
  },
46
44
  props.children,
@@ -24,6 +24,9 @@ export interface NysErrorMessageProps extends Pick<
24
24
  /** Shows a divider line above the error message. */
25
25
  showDivider?: boolean;
26
26
 
27
+ /** The "id" of the error message. */
28
+ id?: NysErrorMessageElement["id"];
29
+
27
30
  /** Error text to display. Falls back to native validation message if available. */
28
31
  errorMessage?: NysErrorMessageElement["errorMessage"];
29
32
 
@@ -2,12 +2,13 @@ import React, { forwardRef } from "react";
2
2
  import "../../dist/nysds.es.js";
3
3
 
4
4
  export const NysErrorMessage = forwardRef((props, forwardedRef) => {
5
- const { showError, showDivider, errorMessage, ...filteredProps } = props;
5
+ const { showError, showDivider, id, errorMessage, ...filteredProps } = props;
6
6
 
7
7
  return React.createElement(
8
8
  "nys-errormessage",
9
9
  {
10
10
  ...filteredProps,
11
+ id: props.id,
11
12
  errorMessage: props.errorMessage,
12
13
  class: props.className,
13
14
  exportparts: props.exportparts,
@@ -1,7 +1,10 @@
1
1
  import React from "react";
2
- import { NysLabel as NysLabelElement } from "../../dist/nysds.es.js";
2
+ import {
3
+ NysLabel as NysLabelElement,
4
+ CustomEvent,
5
+ } from "../../dist/nysds.es.js";
3
6
 
4
- export type { NysLabelElement };
7
+ export type { NysLabelElement, CustomEvent };
5
8
 
6
9
  export interface NysLabelProps extends Pick<
7
10
  React.AllHTMLAttributes<HTMLElement>,
@@ -21,8 +24,8 @@ export interface NysLabelProps extends Pick<
21
24
  /** Adjusts colors for dark backgrounds. */
22
25
  inverted?: boolean;
23
26
 
24
- /** ID of the form element this label is associated with. */
25
- for?: NysLabelElement["for"];
27
+ /** The ID of the label. */
28
+ id?: NysLabelElement["id"];
26
29
 
27
30
  /** Label text displayed above the form field. */
28
31
  label?: NysLabelElement["label"];
@@ -42,6 +45,9 @@ export interface NysLabelProps extends Pick<
42
45
  /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
43
46
  exportparts?: string;
44
47
 
48
+ /** Used for labels to link them with their inputs (using input id). */
49
+ htmlFor?: string;
50
+
45
51
  /** Used to help React identify which items have changed, are added, or are removed within a list. */
46
52
  key?: number | string;
47
53
 
@@ -53,6 +59,9 @@ export interface NysLabelProps extends Pick<
53
59
 
54
60
  /** 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. */
55
61
  tabIndex?: number;
62
+
63
+ /** undefined */
64
+ onNysLabelClick?: (event: CustomEvent) => void;
56
65
  }
57
66
 
58
67
  /**
@@ -60,6 +69,9 @@ export interface NysLabelProps extends Pick<
60
69
  * ---
61
70
  *
62
71
  *
72
+ * ### **Events:**
73
+ * - **nys-label-click**
74
+ *
63
75
  * ### **Slots:**
64
76
  * - **description** - Custom HTML description content below the label.
65
77
  */
@@ -1,21 +1,35 @@
1
- import React, { forwardRef } from "react";
1
+ import React, { forwardRef, useRef, useEffect } from "react";
2
2
  import "../../dist/nysds.es.js";
3
+ import { useEventListener } from "./react-utils.js";
3
4
 
4
5
  export const NysLabel = forwardRef((props, forwardedRef) => {
5
- const { inverted, label, description, flag, tooltip, ...filteredProps } =
6
+ const ref = useRef(null);
7
+ const { inverted, id, label, description, flag, tooltip, ...filteredProps } =
6
8
  props;
7
9
 
10
+ /** Event listeners - run once */
11
+ useEventListener(ref, "nys-label-click", props.onNysLabelClick);
12
+
8
13
  return React.createElement(
9
14
  "nys-label",
10
15
  {
16
+ ref: (node) => {
17
+ ref.current = node;
18
+ if (typeof forwardedRef === "function") {
19
+ forwardedRef(node);
20
+ } else if (forwardedRef) {
21
+ forwardedRef.current = node;
22
+ }
23
+ },
11
24
  ...filteredProps,
12
- for: props.for,
25
+ id: props.id,
13
26
  label: props.label,
14
27
  description: props.description,
15
28
  flag: props.flag,
16
29
  tooltip: props.tooltip,
17
30
  class: props.className,
18
31
  exportparts: props.exportparts,
32
+ for: props.htmlFor,
19
33
  part: props.part,
20
34
  tabindex: props.tabIndex,
21
35
  inverted: props.inverted ? true : undefined,
@@ -31,9 +31,6 @@ export interface NysRadiobuttonProps extends Pick<
31
31
  /** Marks group as required. Set on radiogroup, not individual radios. */
32
32
  required?: boolean;
33
33
 
34
- /** Adjusts colors for dark backgrounds. */
35
- inverted?: boolean;
36
-
37
34
  /** Renders as tile with larger clickable area. */
38
35
  tile?: boolean;
39
36
 
@@ -8,7 +8,6 @@ export const NysRadiobutton = forwardRef((props, forwardedRef) => {
8
8
  checked,
9
9
  disabled,
10
10
  required,
11
- inverted,
12
11
  tile,
13
12
  other,
14
13
  showOtherError,
@@ -57,7 +56,6 @@ export const NysRadiobutton = forwardRef((props, forwardedRef) => {
57
56
  checked: props.checked ? true : undefined,
58
57
  disabled: props.disabled ? true : undefined,
59
58
  required: props.required ? true : undefined,
60
- inverted: props.inverted ? true : undefined,
61
59
  tile: props.tile ? true : undefined,
62
60
  other: props.other ? true : undefined,
63
61
  showOtherError: props.showOtherError ? true : undefined,
@@ -30,9 +30,6 @@ export interface NysRadiogroupProps extends Pick<
30
30
  /** Renders all radiobuttons as tiles with larger clickable area. */
31
31
  tile?: boolean;
32
32
 
33
- /** Adjusts colors for dark backgrounds. Applied to all children. */
34
- inverted?: boolean;
35
-
36
33
  /** Unique identifier. Auto-generated if not provided. */
37
34
  id?: NysRadiogroupElement["id"];
38
35
 
@@ -7,7 +7,6 @@ export const NysRadiogroup = forwardRef((props, forwardedRef) => {
7
7
  optional,
8
8
  showError,
9
9
  tile,
10
- inverted,
11
10
  id,
12
11
  name,
13
12
  errorMessage,
@@ -40,7 +39,6 @@ export const NysRadiogroup = forwardRef((props, forwardedRef) => {
40
39
  optional: props.optional ? true : undefined,
41
40
  showError: props.showError ? true : undefined,
42
41
  tile: props.tile ? true : undefined,
43
- inverted: props.inverted ? true : undefined,
44
42
  style: { ...props.style },
45
43
  },
46
44
  props.children,
@@ -0,0 +1,90 @@
1
+ import React from "react";
2
+ import { NysTab as NysTabElement, CustomEvent } from "../../dist/nysds.es.js";
3
+
4
+ export type { NysTabElement, CustomEvent };
5
+
6
+ export interface NysTabProps 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
+ /** Whether this tab is the currently active tab.
22
+ Managed by `<nys-tabgroup>`; reflected for CSS attribute selectors. */
23
+ selected?: boolean;
24
+
25
+ /** Whether this tab is disabled.
26
+ Reflected to the DOM attribute for CSS styling. */
27
+ disabled?: boolean;
28
+
29
+ /** Unique identifier for the tab element.
30
+ Reflected to the DOM attribute so `aria-controls` references resolve. */
31
+ id?: NysTabElement["id"];
32
+
33
+ /** Visible text label rendered inside the inner `<span>`. */
34
+ label?: NysTabElement["label"];
35
+
36
+ /** 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
+ className?: string;
38
+
39
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
40
+ exportparts?: string;
41
+
42
+ /** Used for labels to link them with their inputs (using input id). */
43
+ htmlFor?: string;
44
+
45
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
46
+ key?: number | string;
47
+
48
+ /** 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. */
49
+ part?: string;
50
+
51
+ /** 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. */
52
+ ref?: any;
53
+
54
+ /** 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. */
55
+ tabIndex?: number;
56
+
57
+ /** Dispatched when the tab is activated via click or Enter / Space. Bubbles and crosses shadow DOM boundaries. `detail: { id: string, label: string }` */
58
+ onNysTabSelect?: (event: CustomEvent) => void;
59
+
60
+ /** Dispatched when the host receives focus. Bubbles and crosses shadow DOM boundaries. `detail: { id: string }` */
61
+ onNysTabFocus?: (event: CustomEvent) => void;
62
+
63
+ /** Dispatched when the host loses focus. Bubbles and crosses shadow DOM boundaries. `detail: { id: string }` */
64
+ onNysTabBlur?: (event: CustomEvent) => void;
65
+ }
66
+
67
+ /**
68
+ * `<nys-tab>` is a single tab within a `<nys-tabgroup>`.
69
+ *
70
+ * The host element carries `role="tab"`, `tabindex`, `aria-selected`,
71
+ * `aria-controls`, and `aria-disabled` so assistive technologies see the
72
+ * correct ARIA tab semantics on the element that is actually focused.
73
+ * `<nys-tabgroup>` manages `tabindex`, `aria-selected`, and `aria-controls`
74
+ * via `_applySelection`; do not set them directly on this element.
75
+ * ---
76
+ *
77
+ *
78
+ * ### **Events:**
79
+ * - **nys-tab-select** - Dispatched when the tab is activated via click or Enter / Space. Bubbles and crosses shadow DOM boundaries. `detail: { id: string, label: string }`
80
+ * - **nys-tab-focus** - Dispatched when the host receives focus. Bubbles and crosses shadow DOM boundaries. `detail: { id: string }`
81
+ * - **nys-tab-blur** - Dispatched when the host loses focus. Bubbles and crosses shadow DOM boundaries. `detail: { id: string }`
82
+ *
83
+ * ### **Methods:**
84
+ * - **focus(options: _FocusOptions_): _void_** - Focuses the host element. The host carries `role="tab"` and `tabindex`,
85
+ * so it is the correct element for AT to land on.
86
+ *
87
+ * ### **Slots:**
88
+ * - _default_ - No slots; content is derived from the `label` property.
89
+ */
90
+ export const NysTab: React.ForwardRefExoticComponent<NysTabProps>;
@@ -0,0 +1,39 @@
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 NysTab = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
7
+ const { selected, disabled, id, label, ...filteredProps } = props;
8
+
9
+ /** Event listeners - run once */
10
+ useEventListener(ref, "nys-tab-select", props.onNysTabSelect);
11
+ useEventListener(ref, "nys-tab-focus", props.onNysTabFocus);
12
+ useEventListener(ref, "nys-tab-blur", props.onNysTabBlur);
13
+
14
+ return React.createElement(
15
+ "nys-tab",
16
+ {
17
+ ref: (node) => {
18
+ ref.current = node;
19
+ if (typeof forwardedRef === "function") {
20
+ forwardedRef(node);
21
+ } else if (forwardedRef) {
22
+ forwardedRef.current = node;
23
+ }
24
+ },
25
+ ...filteredProps,
26
+ id: props.id,
27
+ label: props.label,
28
+ class: props.className,
29
+ exportparts: props.exportparts,
30
+ for: props.htmlFor,
31
+ part: props.part,
32
+ tabindex: props.tabIndex,
33
+ selected: props.selected ? true : undefined,
34
+ disabled: props.disabled ? true : undefined,
35
+ style: { ...props.style },
36
+ },
37
+ props.children,
38
+ );
39
+ });
@@ -0,0 +1,75 @@
1
+ import React from "react";
2
+ import { NysTabgroup as NysTabgroupElement } from "../../dist/nysds.es.js";
3
+
4
+ export type { NysTabgroupElement };
5
+
6
+ export interface NysTabgroupProps 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
+ /** Unique identifier for the tabgroup element.
22
+ If not provided, one is auto-generated in `connectedCallback`.
23
+ Reflected to the DOM attribute. */
24
+ id?: NysTabgroupElement["id"];
25
+
26
+ /** The name of the tab group.
27
+ Used for form submission and accessibility purposes. */
28
+ name?: NysTabgroupElement["name"];
29
+
30
+ /** 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
+ className?: string;
32
+
33
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
34
+ exportparts?: string;
35
+
36
+ /** Used for labels to link them with their inputs (using input id). */
37
+ htmlFor?: string;
38
+
39
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
40
+ key?: number | string;
41
+
42
+ /** 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. */
43
+ part?: string;
44
+
45
+ /** 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. */
46
+ ref?: any;
47
+
48
+ /** 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. */
49
+ tabIndex?: number;
50
+ }
51
+
52
+ /**
53
+ * `<nys-tabgroup>` is the container for `<nys-tab>` and `<nys-tabpanel>`
54
+ * elements.
55
+ *
56
+ * Accepts tabs and panels as flat light-DOM children in any order (interleaved
57
+ * or grouped). On slot change, children are sorted into dedicated shadow-DOM
58
+ * containers, ARIA relationships are wired, and the first selected (or first)
59
+ * tab is activated.
60
+ *
61
+ * Scroll shadows are rendered on either side of the tab list and toggled via
62
+ * `ResizeObserver` and a `scroll` listener so they accurately reflect whether
63
+ * overflow content exists in each direction.
64
+ *
65
+ * Keyboard navigation follows the
66
+ * https://www.w3.org/WAI/ARIA/apg/patterns/tabs/ ARIA Tabs Pattern:
67
+ * - Arrow keys move focus without changing selection.
68
+ * - Enter / Space confirm selection on the focused tab.
69
+ * ---
70
+ *
71
+ *
72
+ * ### **Slots:**
73
+ * - _default_ - Accepts `<nys-tab>` and `<nys-tabpanel>` children. Elements are moved into internal shadow-DOM containers on `slotchange`; the slot itself is not rendered visibly.
74
+ */
75
+ export const NysTabgroup: React.ForwardRefExoticComponent<NysTabgroupProps>;
@@ -0,0 +1,22 @@
1
+ import React, { forwardRef } from "react";
2
+ import "../../dist/nysds.es.js";
3
+
4
+ export const NysTabgroup = forwardRef((props, forwardedRef) => {
5
+ const { id, name, ...filteredProps } = props;
6
+
7
+ return React.createElement(
8
+ "nys-tabgroup",
9
+ {
10
+ ...filteredProps,
11
+ id: props.id,
12
+ name: props.name,
13
+ class: props.className,
14
+ exportparts: props.exportparts,
15
+ for: props.htmlFor,
16
+ part: props.part,
17
+ tabindex: props.tabIndex,
18
+ style: { ...props.style },
19
+ },
20
+ props.children,
21
+ );
22
+ });
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import { NysTabpanel as NysTabpanelElement } from "../../dist/nysds.es.js";
3
+
4
+ export type { NysTabpanelElement };
5
+
6
+ export interface NysTabpanelProps 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
+ /** Unique identifier for the panel element.
22
+ If not provided, one is auto-generated in `connectedCallback`.
23
+ Reflected to the DOM attribute so `aria-controls` references on sibling
24
+ `<nys-tab>` elements resolve correctly. */
25
+ id?: NysTabpanelElement["id"];
26
+
27
+ /** 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()`. */
28
+ className?: string;
29
+
30
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
31
+ exportparts?: string;
32
+
33
+ /** Used for labels to link them with their inputs (using input id). */
34
+ htmlFor?: string;
35
+
36
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
37
+ key?: number | string;
38
+
39
+ /** 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. */
40
+ part?: string;
41
+
42
+ /** 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. */
43
+ ref?: any;
44
+
45
+ /** 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. */
46
+ tabIndex?: number;
47
+ }
48
+
49
+ /**
50
+ * `<nys-tabpanel>` is a content panel paired with a `<nys-tab>` inside a
51
+ * `<nys-tabgroup>`.
52
+ *
53
+ * Pairing is determined by render order: the Nth `<nys-tabpanel>` child of a
54
+ * `<nys-tabgroup>` corresponds to the Nth `<nys-tab>` child.
55
+ * `aria-labelledby` and the `hidden` attribute are managed externally by
56
+ * `<nys-tabgroup>` via `_applySelection`; do not set them directly.
57
+ * ---
58
+ *
59
+ *
60
+ * ### **Slots:**
61
+ * - _default_ - Default slot for panel content. Rendered inside a wrapper `<div>` with the `.nys-tabpanel` class for styling.
62
+ */
63
+ export const NysTabpanel: React.ForwardRefExoticComponent<NysTabpanelProps>;
@@ -0,0 +1,21 @@
1
+ import React, { forwardRef } from "react";
2
+ import "../../dist/nysds.es.js";
3
+
4
+ export const NysTabpanel = forwardRef((props, forwardedRef) => {
5
+ const { id, ...filteredProps } = props;
6
+
7
+ return React.createElement(
8
+ "nys-tabpanel",
9
+ {
10
+ ...filteredProps,
11
+ id: props.id,
12
+ class: props.className,
13
+ exportparts: props.exportparts,
14
+ for: props.htmlFor,
15
+ part: props.part,
16
+ tabindex: props.tabIndex,
17
+ style: { ...props.style },
18
+ },
19
+ props.children,
20
+ );
21
+ });
@@ -67,11 +67,17 @@ Falls back to YouTube's auto-generated thumbnail if not provided. */
67
67
 
68
68
  /** 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. */
69
69
  tabIndex?: number;
70
+
71
+ /** Fired when the user clicks the thumbnail to load the player. */
72
+ onNysVideoPlay?: (event: CustomEvent) => void;
70
73
  }
71
74
 
72
75
  /**
73
- *
76
+ * YouTube video player with thumbnail preview and accessibility announcements.
74
77
  * ---
75
78
  *
79
+ *
80
+ * ### **Events:**
81
+ * - **nys-video-play** - Fired when the user clicks the thumbnail to load the player.
76
82
  */
77
83
  export const NysVideo: React.ForwardRefExoticComponent<NysVideoProps>;
@@ -1,7 +1,9 @@
1
- import React, { forwardRef } from "react";
1
+ import React, { forwardRef, useRef, useEffect } from "react";
2
2
  import "../../dist/nysds.es.js";
3
+ import { useEventListener } from "./react-utils.js";
3
4
 
4
5
  export const NysVideo = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
5
7
  const {
6
8
  autoplay,
7
9
  disabled,
@@ -15,9 +17,20 @@ export const NysVideo = forwardRef((props, forwardedRef) => {
15
17
  ...filteredProps
16
18
  } = props;
17
19
 
20
+ /** Event listeners - run once */
21
+ useEventListener(ref, "nys-video-play", props.onNysVideoPlay);
22
+
18
23
  return React.createElement(
19
24
  "nys-video",
20
25
  {
26
+ ref: (node) => {
27
+ ref.current = node;
28
+ if (typeof forwardedRef === "function") {
29
+ forwardedRef(node);
30
+ } else if (forwardedRef) {
31
+ forwardedRef.current = node;
32
+ }
33
+ },
21
34
  ...filteredProps,
22
35
  id: props.id,
23
36
  titleText: props.titleText,
@@ -4,6 +4,7 @@ export * from "./NysAlert.js";
4
4
  export * from "./NysAvatar.js";
5
5
  export * from "./NysBacktotop.js";
6
6
  export * from "./NysBadge.js";
7
+ export * from "./NysBreadcrumbs.js";
7
8
  export * from "./NysButton.js";
8
9
  export * from "./NysCheckbox.js";
9
10
  export * from "./NysCheckboxgroup.js";
@@ -28,6 +29,9 @@ export * from "./NysSelect.js";
28
29
  export * from "./NysSkipnav.js";
29
30
  export * from "./NysStep.js";
30
31
  export * from "./NysStepper.js";
32
+ export * from "./NysTab.js";
33
+ export * from "./NysTabgroup.js";
34
+ export * from "./NysTabpanel.js";
31
35
  export * from "./NysTable.js";
32
36
  export * from "./NysTextarea.js";
33
37
  export * from "./NysTextinput.js";
@@ -4,6 +4,7 @@ export * from "./NysAlert.js";
4
4
  export * from "./NysAvatar.js";
5
5
  export * from "./NysBacktotop.js";
6
6
  export * from "./NysBadge.js";
7
+ export * from "./NysBreadcrumbs.js";
7
8
  export * from "./NysButton.js";
8
9
  export * from "./NysCheckbox.js";
9
10
  export * from "./NysCheckboxgroup.js";
@@ -28,6 +29,9 @@ export * from "./NysSelect.js";
28
29
  export * from "./NysSkipnav.js";
29
30
  export * from "./NysStep.js";
30
31
  export * from "./NysStepper.js";
32
+ export * from "./NysTab.js";
33
+ export * from "./NysTabgroup.js";
34
+ export * from "./NysTabpanel.js";
31
35
  export * from "./NysTable.js";
32
36
  export * from "./NysTextarea.js";
33
37
  export * from "./NysTextinput.js";