@nysds/components 1.20.0-alpha-3 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/custom-elements.json +9101 -5385
  2. package/dist/.vscode/vscode.css-custom-data.json +5 -0
  3. package/dist/.vscode/vscode.html-custom-data.json +332 -30
  4. package/dist/custom-elements.json +9101 -5385
  5. package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js +706 -0
  6. package/dist/nys-icon.library-Bu3noJqZ-1mvg_e5Y.js.map +1 -0
  7. package/dist/nys-icon.library-eNVZmfkf.js +696 -0
  8. package/dist/nys-icon.library-eNVZmfkf.js.map +1 -0
  9. package/dist/nysds.es.js +10460 -5393
  10. package/dist/nysds.es.js.map +1 -1
  11. package/dist/nysds.js +2436 -472
  12. package/dist/nysds.js.map +1 -1
  13. package/dist/packages/internals/src/aria-associate.d.ts +41 -0
  14. package/dist/packages/internals/src/form-control-mixin.d.ts +34 -0
  15. package/dist/packages/internals/src/id.d.ts +8 -0
  16. package/dist/packages/internals/src/identified-mixin.d.ts +23 -0
  17. package/dist/packages/internals/src/index.d.ts +7 -0
  18. package/dist/packages/internals/src/reflects-aria-mixin.d.ts +33 -0
  19. package/dist/packages/internals/src/test-helpers.d.ts +29 -0
  20. package/dist/packages/internals/src/types.d.ts +9 -0
  21. package/dist/packages/nys-accordion/src/nys-accordion.d.ts +72 -10
  22. package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +63 -8
  23. package/dist/packages/nys-alert/src/nys-alert.d.ts +95 -20
  24. package/dist/packages/nys-avatar/src/nys-avatar.d.ts +100 -7
  25. package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +75 -5
  26. package/dist/packages/nys-badge/src/nys-badge.d.ts +63 -6
  27. package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +79 -10
  28. package/dist/packages/nys-button/src/nys-button.d.ts +132 -26
  29. package/dist/packages/nys-card/src/index.d.ts +1 -0
  30. package/dist/packages/nys-card/src/nys-card.d.ts +325 -0
  31. package/dist/packages/nys-card/src/nys-card.figma.d.ts +1 -0
  32. package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +36 -12
  33. package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +81 -6
  34. package/dist/packages/nys-combobox/src/nys-combobox.d.ts +174 -5
  35. package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +83 -13
  36. package/dist/packages/nys-divider/src/nys-divider.d.ts +33 -9
  37. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +24 -15
  38. package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +3 -12
  39. package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +22 -0
  40. package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +101 -12
  41. package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +23 -2
  42. package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +99 -9
  43. package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +189 -6
  44. package/dist/packages/nys-icon/src/icon-cache.d.ts +11 -4
  45. package/dist/packages/nys-icon/src/icon-library-registry.d.ts +33 -16
  46. package/dist/packages/nys-icon/src/index.d.ts +2 -2
  47. package/dist/packages/nys-icon/src/nys-icon.d.ts +98 -8
  48. package/dist/packages/nys-iconlist/src/index.d.ts +2 -0
  49. package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +92 -0
  50. package/dist/packages/nys-iconlist/src/nys-iconlist.figma.d.ts +1 -0
  51. package/dist/packages/nys-iconlist/src/nys-iconlistitem.d.ts +32 -0
  52. package/dist/packages/nys-label/src/nys-label.d.ts +37 -2
  53. package/dist/packages/nys-modal/src/nys-modal.d.ts +145 -13
  54. package/dist/packages/nys-pagination/src/nys-pagination.d.ts +67 -3
  55. package/dist/packages/nys-processlist/src/index.d.ts +2 -0
  56. package/dist/packages/nys-processlist/src/nys-processlist.d.ts +184 -0
  57. package/dist/packages/nys-processlist/src/nys-processlist.figma.d.ts +1 -0
  58. package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +41 -0
  59. package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +201 -7
  60. package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +88 -6
  61. package/dist/packages/nys-select/src/nys-option.d.ts +0 -8
  62. package/dist/packages/nys-select/src/nys-select.d.ts +150 -15
  63. package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +4 -4
  64. package/dist/packages/nys-stepper/src/nys-step.d.ts +26 -20
  65. package/dist/packages/nys-stepper/src/nys-stepper.d.ts +128 -75
  66. package/dist/packages/nys-tab/src/nys-tab.d.ts +19 -10
  67. package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +181 -39
  68. package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +15 -24
  69. package/dist/packages/nys-table/src/nys-table.d.ts +90 -3
  70. package/dist/packages/nys-textarea/src/nys-textarea.d.ts +60 -10
  71. package/dist/packages/nys-textinput/src/nys-textinput.d.ts +77 -14
  72. package/dist/packages/nys-toggle/src/nys-toggle.d.ts +47 -10
  73. package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +48 -8
  74. package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +45 -4
  75. package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +216 -11
  76. package/dist/packages/nys-verticalnav/src/index.d.ts +2 -0
  77. package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +572 -0
  78. package/dist/packages/nys-verticalnav/src/nys-verticalnav.figma.d.ts +1 -0
  79. package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +24 -0
  80. package/dist/packages/nys-video/src/nys-video.d.ts +67 -7
  81. package/dist/src/index.d.ts +6 -2
  82. package/package.json +11 -6
  83. package/packages/react/NysAccordion.d.ts +10 -0
  84. package/packages/react/NysAccordion.js +2 -1
  85. package/packages/react/NysAccordionItem.d.ts +10 -0
  86. package/packages/react/NysAccordionItem.js +3 -1
  87. package/packages/react/NysAlert.d.ts +8 -10
  88. package/packages/react/NysAlert.js +0 -2
  89. package/packages/react/NysAvatar.d.ts +11 -1
  90. package/packages/react/NysBacktotop.d.ts +3 -0
  91. package/packages/react/NysBacktotop.js +2 -1
  92. package/packages/react/NysBreadcrumbs.d.ts +2 -2
  93. package/packages/react/NysButton.d.ts +38 -8
  94. package/packages/react/NysButton.js +6 -4
  95. package/packages/react/NysCard.d.ts +110 -0
  96. package/packages/react/NysCard.js +61 -0
  97. package/packages/react/NysCheckbox.d.ts +9 -0
  98. package/packages/react/NysCheckbox.js +4 -0
  99. package/packages/react/NysDropdownMenu.d.ts +4 -2
  100. package/packages/react/NysFileinput.d.ts +2 -2
  101. package/packages/react/NysGlobalFooter.d.ts +17 -0
  102. package/packages/react/NysGlobalFooter.js +10 -2
  103. package/packages/react/NysGlobalHeader.d.ts +17 -0
  104. package/packages/react/NysGlobalHeader.js +11 -2
  105. package/packages/react/NysIconlist.d.ts +54 -0
  106. package/packages/react/NysIconlist.js +22 -0
  107. package/packages/react/NysIconlistitem.d.ts +59 -0
  108. package/packages/react/NysIconlistitem.js +22 -0
  109. package/packages/react/NysLabel.d.ts +4 -1
  110. package/packages/react/NysModal.d.ts +8 -1
  111. package/packages/react/NysModal.js +11 -2
  112. package/packages/react/NysProcesslist.d.ts +65 -0
  113. package/packages/react/NysProcesslist.js +25 -0
  114. package/packages/react/NysProcesslistitem.d.ts +61 -0
  115. package/packages/react/NysProcesslistitem.js +35 -0
  116. package/packages/react/NysRadiobutton.d.ts +27 -3
  117. package/packages/react/NysRadiobutton.js +9 -1
  118. package/packages/react/NysSelect.d.ts +3 -0
  119. package/packages/react/NysSelect.js +2 -0
  120. package/packages/react/NysStepper.d.ts +1 -1
  121. package/packages/react/NysTabgroup.d.ts +5 -4
  122. package/packages/react/NysTable.d.ts +1 -1
  123. package/packages/react/NysTabpanel.d.ts +11 -4
  124. package/packages/react/NysTextarea.d.ts +4 -1
  125. package/packages/react/NysTextarea.js +2 -0
  126. package/packages/react/NysUnavFooter.d.ts +13 -0
  127. package/packages/react/NysUnavFooter.js +4 -1
  128. package/packages/react/NysUnavHeader.d.ts +24 -1
  129. package/packages/react/NysUnavHeader.js +17 -1
  130. package/packages/react/NysVerticalnav.d.ts +67 -0
  131. package/packages/react/NysVerticalnav.js +26 -0
  132. package/packages/react/NysVerticalnavGroup.d.ts +76 -0
  133. package/packages/react/NysVerticalnavGroup.js +43 -0
  134. package/packages/react/index.d.ts +7 -0
  135. package/packages/react/index.js +7 -0
  136. package/packages/react/nysds-jsx.d.ts +404 -46
@@ -1,13 +1,19 @@
1
- import { LitElement } from "lit";
1
+ import { NysFormControlElement } from "@nysds/internals";
2
+ import "@nysds/nys-icon";
2
3
  /**
3
4
  * A button for actions like saving, submitting, or navigating. Form-associated with full keyboard support.
4
5
  *
5
6
  * Use `filled` for primary actions (one per section), `outline` for secondary, `ghost` for tertiary,
6
7
  * `text` for inline. Set `href` to render as a navigation link.
7
8
  *
9
+ * ARIA belongs on the component's props, not on the `<nys-button>` host. The host has no role,
10
+ * so attributes placed there are not mapped into the accessibility tree and never reach the
11
+ * internal `<button>`. For a disclosure trigger use `ariaExpanded` together with `ariaControls`.
12
+ *
8
13
  * @summary Button for actions and CTAs with variants, sizes, and icon support.
9
14
  * @element nys-button
10
15
  *
16
+ * @slot - Button label text. Use as fallback when `label` prop is not provided.
11
17
  * @slot prefix-icon - Icon before label. Not shown for `text` variant.
12
18
  * @slot suffix-icon - Icon after label. Not shown for `text` variant.
13
19
  * @slot circle-icon - Icon for circle mode. Overrides `icon` prop.
@@ -26,38 +32,99 @@ import { LitElement } from "lit";
26
32
  * @fires nys-focus - Fired when the button receives focus.
27
33
  * @fires nys-blur - Fired when the button loses focus.
28
34
  *
29
- * @example Basic filled button
35
+ * @example Basic
36
+ * ```html
37
+ * <nys-button label="Button" variant="filled"></nys-button>
38
+ * ```
39
+ *
40
+ * @example Variant Outline
41
+ * ```html
42
+ * <nys-button label="Button" variant="outline"></nys-button>
43
+ * ```
44
+ *
45
+ * @example Variant Ghost
30
46
  * ```html
31
- * <nys-button label="Submit" variant="filled"></nys-button>
47
+ * <nys-button label="Button" variant="ghost"></nys-button>
32
48
  * ```
33
49
  *
34
- * @example Secondary outline button
50
+ * @example Variant Text
35
51
  * ```html
36
- * <nys-button label="Cancel" variant="outline"></nys-button>
52
+ * <nys-button label="Button" variant="text"></nys-button>
37
53
  * ```
38
54
  *
39
- * @example Button with icons
55
+ * @example Prefix Icon
40
56
  * ```html
41
57
  * <nys-button label="Previous" prefixIcon="chevron_left"></nys-button>
58
+ * ```
59
+ *
60
+ * @example Suffix Icon
61
+ * ```html
42
62
  * <nys-button label="Next" suffixIcon="chevron_right"></nys-button>
43
63
  * ```
44
64
  *
65
+ * @example Slotted Icons
66
+ * ```html
67
+ * <nys-button label="Slotted icons">
68
+ * <nys-icon color="#db117d" slot="prefix-icon" name="chevron_left"></nys-icon>
69
+ * <nys-icon color="#db117d" slot="suffix-icon" name="chevron_right"></nys-icon>
70
+ * </nys-button>
71
+ * ```
72
+ *
45
73
  * @example Circle icon button
46
74
  * ```html
47
75
  * <nys-button circle icon="close" label="Close dialog"></nys-button>
48
76
  * ```
49
77
  *
50
- * @example Link-style button for navigation
78
+ * @example Size Small
79
+ * ```html
80
+ * <nys-button label="Small" size="sm"></nys-button>
81
+ * ```
82
+ * @example Size Large
83
+ * ```html
84
+ * <nys-button label="Large" size="lg"></nys-button>
85
+ * ```
86
+ *
87
+ * @example Full width
88
+ * ```html
89
+ * <nys-button label="Full width" fullWidth></nys-button>
90
+ * ```
91
+ *
92
+ * @example Inverted
93
+ * ```html
94
+ * <nys-button label="Inverted" inverted></nys-button>
95
+ * ```
96
+ * @render Inverted
97
+ * ```html
98
+ * <div style="background: #1b1b1b; padding: 1rem;">
99
+ * <nys-button label="Inverted" inverted></nys-button>
100
+ * </div>
101
+ * ```
102
+ *
103
+ * @example Disabled
104
+ * ```html
105
+ * <nys-button label="Disabled" disabled></nys-button>
106
+ * ```
107
+ *
108
+ * @example Href
51
109
  * ```html
52
110
  * <nys-button label="Visit NY.gov" href="https://www.ny.gov/" target="_blank" suffixIcon="open_in_new"></nys-button>
53
111
  * ```
54
112
  *
55
- * @example Form submit button
113
+ * @example Type
56
114
  * ```html
57
115
  * <nys-button type="submit" label="Save Changes" variant="filled"></nys-button>
58
116
  * ```
117
+ *
118
+ * @example Disclosure trigger
119
+ * ```html
120
+ * <nys-button
121
+ * label="Here's how you know"
122
+ * ariaExpanded="false"
123
+ * ariaControls="trust-bar"
124
+ * ></nys-button>
125
+ * ```
59
126
  */
60
- export declare class NysButton extends LitElement {
127
+ export declare class NysButton extends NysFormControlElement {
61
128
  static styles: import("lit").CSSResult;
62
129
  static shadowRootOptions: {
63
130
  delegatesFocus: boolean;
@@ -96,17 +163,61 @@ export declare class NysButton extends LitElement {
96
163
  */
97
164
  inverted: boolean;
98
165
  /**
99
- * Visible button text. Use sentence case, action-oriented text (e.g., "Save Draft"). Becomes aria-label in `circle` mode.
166
+ * 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.
100
167
  */
101
168
  label: string;
102
- /**
103
- * Screen reader label. Required for icon-only buttons if `label` is not set.
104
- */
105
- ariaLabel: string;
106
169
  /**
107
170
  * ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`.
171
+ *
172
+ * Set this on `<nys-button>` rather than putting `aria-controls` on the host:
173
+ * the host has no role, so ARIA placed there is not mapped into the
174
+ * accessibility tree and never reaches the internal `<button>`.
108
175
  */
109
176
  ariaControls: string;
177
+ /**
178
+ * Disclosure state for buttons that show/hide content. Sets `aria-expanded`
179
+ * on the internal `<button>`/`<a>`.
180
+ *
181
+ * Use `"false"` when the controlled content is collapsed and `"true"` when it
182
+ * is expanded, updating it every time the content toggles. Leave unset for
183
+ * buttons that are not disclosure triggers — an `aria-expanded` that never
184
+ * changes is worse than none. Pair with `ariaControls` pointing at the
185
+ * element being shown or hidden.
186
+ *
187
+ * Setting `aria-expanded` directly on the `<nys-button>` host does nothing:
188
+ * a custom element with no role does not map its ARIA attributes into the
189
+ * accessibility tree, and host ARIA does not cross into the shadow root.
190
+ *
191
+ * @example
192
+ * ```html
193
+ * <nys-button
194
+ * label="Here's how you know"
195
+ * ariaExpanded="false"
196
+ * ariaControls="trust-bar"
197
+ * ></nys-button>
198
+ * ```
199
+ */
200
+ ariaExpanded: "true" | "false" | "";
201
+ /**
202
+ * Marks this button as the current item within a set of related controls — the current
203
+ * page of a pagination control, the current step of a wizard. Sets `aria-current` on the
204
+ * internal `<button>`/`<a>`.
205
+ *
206
+ * Use `"page"` inside a pagination landmark, `"step"` inside a step indicator, and
207
+ * `"true"` when no more specific token fits. Only one control in a set is ever current:
208
+ * leave the property unset on all the others rather than setting `"false"`, which the
209
+ * spec reads as "explicitly not current" and adds nothing.
210
+ *
211
+ * Setting `aria-current` directly on the `<nys-button>` host does nothing: a custom
212
+ * element with no role does not map its ARIA attributes into the accessibility tree,
213
+ * and host ARIA does not cross into the shadow root.
214
+ *
215
+ * @example
216
+ * ```html
217
+ * <nys-button label="3" ariaCurrent="page"></nys-button>
218
+ * ```
219
+ */
220
+ ariaCurrent: "page" | "step" | "location" | "date" | "time" | "true" | "false" | "";
110
221
  /**
111
222
  * Material Symbol icon before label. Not shown for `circle` mode.
112
223
  */
@@ -116,7 +227,7 @@ export declare class NysButton extends LitElement {
116
227
  */
117
228
  suffixIcon: string;
118
229
  /**
119
- * Renders circular icon-only button. Requires `icon` prop. `label` becomes aria-label.
230
+ * Renders circular icon-only button. Requires `icon` prop. `label` is rendered as visually-hidden text for the accessible name.
120
231
  * @default false
121
232
  */
122
233
  circle: boolean;
@@ -138,9 +249,9 @@ export declare class NysButton extends LitElement {
138
249
  */
139
250
  value: string;
140
251
  /**
141
- * Additional screen reader description. Sets `aria-description`.
252
+ * ID(s) of element(s) describing this button. Sets `aria-describedby`.
142
253
  */
143
- ariaDescription: string;
254
+ ariaDescribedBy: string;
144
255
  /**
145
256
  * Form behavior: `button` (default, no form action), `submit` (submits form), `reset` (resets form). Always set explicitly to avoid unintended submissions.
146
257
  * @default "button"
@@ -159,22 +270,17 @@ export declare class NysButton extends LitElement {
159
270
  * @default "_self"
160
271
  */
161
272
  target: "_self" | "_blank" | "_parent" | "_top" | "framename";
162
- private _internals;
163
273
  private _hasPrefixSlot;
164
274
  private _hasSuffixSlot;
165
275
  private _hasCircleSlot;
166
- /**
167
- * Lifecycle methods
168
- * --------------------------------------------------------------------------
169
- */
170
- static formAssociated: boolean;
171
- constructor();
172
- connectedCallback(): void;
173
276
  /**
174
277
  * Functions
175
278
  * --------------------------------------------------------------------------
279
+ *
280
+ * Form association, ElementInternals, and id generation are provided by
281
+ * NysFormControlElement (@nysds/internals). super.connectedCallback() assigns
282
+ * an id when one is not provided (prefix = the element's localName).
176
283
  */
177
- private _generateUniqueId;
178
284
  private _onPrefixSlotChange;
179
285
  private _onSuffixSlotChange;
180
286
  private _onCircleSlotChange;
@@ -0,0 +1 @@
1
+ export * from "./nys-card";
@@ -0,0 +1,325 @@
1
+ import { NysElement } from "@nysds/internals";
2
+ type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
3
+ /**
4
+ * A reusable, self-contained container that groups related content and actions
5
+ * about a single subject into a distinct, flexible container.
6
+ *
7
+ * Text content is supplied through the `preheading`, `heading`, `subheading`, and
8
+ * `description` properties. For richer content, use the `preheading`, default, and
9
+ * `footer` slots to project custom markup such as buttons, lists, or links.
10
+ *
11
+ * @summary Flexible container that groups related content and actions about a single subject.
12
+ * @element nys-card
13
+ *
14
+ * @slot preheading - Content rendered above the heading block (e.g. a badge or label).
15
+ * @slot - Default slot for the card's main body. Use for rich content when the `description` property is not enough.
16
+ * @slot footer - Content rendered at the footer of the card, typically actions like buttons or links.
17
+ * @slot media - Visual content displayed at the top of the card, typically an `<img>`.
18
+ * @slot 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.
19
+ *
20
+ * The card becomes a single interactive control when it is given something to do:
21
+ * an `href` renders it as an `<a>`, a click handler (`onClick` or an inline
22
+ * `onclick`) renders it as a `<button>`.
23
+ *
24
+ * @cssprop [--nys-card-height=fit-content] - 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`).
25
+ *
26
+ * @fires nys-click - Fired when an interactive card is activated (mouse or keyboard).
27
+ * @fires nys-focus - Fired when an interactive card receives focus.
28
+ * @fires nys-blur - Fired when an interactive card loses focus.
29
+ *
30
+ * @example Basic
31
+ * ```html
32
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
33
+ * <nys-card
34
+ * heading="Heading"
35
+ * description="A short description of the card's subject."
36
+ * ></nys-card>
37
+ * </div>
38
+ * ```
39
+ *
40
+ * @example Preheading
41
+ * ```html
42
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
43
+ * <nys-card
44
+ * preheading="Preheading"
45
+ * heading="Heading"
46
+ * description="A short description of the card's subject."
47
+ * ></nys-card>
48
+ * </div>
49
+ * ```
50
+ *
51
+ * @example Heading Level
52
+ * ```html
53
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
54
+ * <nys-card
55
+ * heading="Heading"
56
+ * headingLevel="h3"
57
+ * description="Set the heading level to fit the page's heading hierarchy."
58
+ * ></nys-card>
59
+ * </div>
60
+ * ```
61
+ *
62
+ * @example Subheading
63
+ * ```html
64
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
65
+ * <nys-card
66
+ * heading="Heading"
67
+ * subheading="Subheading"
68
+ * description="A short description of the card's subject."
69
+ * ></nys-card>
70
+ * </div>
71
+ * ```
72
+ *
73
+ * @example Media
74
+ * ```html
75
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
76
+ * <nys-card
77
+ * heading="Heading"
78
+ * description="A card with a media image."
79
+ * >
80
+ * <img slot="media"
81
+ * src="https://images.unsplash.com/photo-1513360371669-4adf3dd7dff8?q=80&w=2070&auto=format&fit=crop"
82
+ * role="presentation"
83
+ * />
84
+ * </nys-card>
85
+ * </div>
86
+ * ```
87
+ *
88
+ * @example Inset Media
89
+ * ```html
90
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
91
+ * <nys-card
92
+ * heading="Heading"
93
+ * description="Inset adds padding around the media to visually contain it."
94
+ * inset
95
+ * >
96
+ * <img slot="media"
97
+ * src="https://images.unsplash.com/photo-1513360371669-4adf3dd7dff8?q=80&w=2070&auto=format&fit=crop"
98
+ * role="presentation"
99
+ * />
100
+ * </nys-card>
101
+ * </div>
102
+ * ```
103
+ *
104
+ * @example Media Accent
105
+ * ```html
106
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
107
+ * <nys-card
108
+ * heading="Heading"
109
+ * description="A card with a media image and a date accent."
110
+ * >
111
+ * <img slot="media"
112
+ * src="https://images.unsplash.com/photo-1513360371669-4adf3dd7dff8?q=80&w=2070&auto=format&fit=crop"
113
+ * role="presentation"
114
+ * />
115
+ * <div slot="media-accent">
116
+ * <span>Oct</span>
117
+ * <span>16</span>
118
+ * </div>
119
+ * </nys-card>
120
+ * </div>
121
+ * ```
122
+ *
123
+ * @example Inset Media Accent
124
+ * ```html
125
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
126
+ * <nys-card
127
+ * heading="Heading"
128
+ * description="A card with a media image and a date accent."
129
+ * inset
130
+ * >
131
+ * <img slot="media"
132
+ * src="https://images.unsplash.com/photo-1513360371669-4adf3dd7dff8?q=80&w=2070&auto=format&fit=crop"
133
+ * role="presentation"
134
+ * />
135
+ * <div slot="media-accent">
136
+ * <span>Oct</span>
137
+ * <span>16</span>
138
+ * </div>
139
+ * </nys-card>
140
+ * </div>
141
+ * ```
142
+ *
143
+ * @example Elevated
144
+ * ```html
145
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
146
+ * <nys-card
147
+ * heading="Heading"
148
+ * description="Elevated adds a drop shadow to give the card a raised appearance."
149
+ * elevated
150
+ * ></nys-card>
151
+ * </div>
152
+ * ```
153
+ *
154
+ * @example Clickable
155
+ * ```html
156
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
157
+ * <nys-card
158
+ * onclick="alert('you clicked me')"
159
+ * heading="Heading"
160
+ * description="The whole card is one button. To visually indicate this you should add the arrow icon to the footer slot."
161
+ * >
162
+ * <nys-icon slot="footer" name="arrow_forward" size="5xl"></nys-icon>
163
+ * </nys-card>
164
+ * </div>
165
+ * ```
166
+ *
167
+ * @example Clickable Link
168
+ * ```html
169
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
170
+ * <nys-card
171
+ * href="https://www.ny.gov/"
172
+ * target="_blank"
173
+ * heading="Visit NY.gov"
174
+ * description="The whole card is one link. To visually indicate this you should add the arrow icon to the footer slot."
175
+ * >
176
+ * <nys-icon slot="footer" name="open_in_new" size="5xl" style="justify-content: end;"></nys-icon>
177
+ * </nys-card>
178
+ * </div>
179
+ * ```
180
+ *
181
+ * @example Footer Slot
182
+ * ```html
183
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
184
+ * <nys-card heading="Heading" description="A card with actions in the footer slot.">
185
+ * <nys-button slot="footer" label="Learn more"></nys-button>
186
+ * </nys-card>
187
+ * </div>
188
+ * ```
189
+ *
190
+ * @example Preheading Slot
191
+ * ```html
192
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
193
+ * <nys-card heading="Heading" description="A card with content in the preheading slot.">
194
+ * <nys-badge slot="preheading" label="New" intent="success"></nys-badge>
195
+ * </nys-card>
196
+ * </div>
197
+ * ```
198
+ *
199
+ * @example Icon List
200
+ * ```html
201
+ * <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
202
+ * <nys-card heading="What's included">
203
+ * <nys-iconlist divider>
204
+ * <nys-iconlistitem icon="check">First item</nys-iconlistitem>
205
+ * <nys-iconlistitem icon="check">Second item</nys-iconlistitem>
206
+ * <nys-iconlistitem icon="check">Third item</nys-iconlistitem>
207
+ * </nys-iconlist>
208
+ * </nys-card>
209
+ * </div>
210
+ * ```
211
+ *
212
+ * @example Stretch to Fill Column Height
213
+ * ```html
214
+ * <div class="nys-grid-row nys-grid-gap" style="--nys-card-height: 100%">
215
+ * <div
216
+ * class="nys-mobile-lg:nys-grid-col-6 nys-tablet:nys-grid-col-4 nys-display-flex"
217
+ * >
218
+ * <nys-card
219
+ * heading="Roosevelt Island Four Freedoms State Park"
220
+ * description="A memorial park on Roosevelt Island dedicated to Franklin D. Roosevelt, featuring sweeping lawns, formal gardens, and panoramic views of the Manhattan and Queens waterfronts on all sides."
221
+ * >
222
+ * <img slot="media" src="/assets/images/card/manhattan.png" role="presentation" />
223
+ * <nys-button slot="footer" label="Visit Manhattan" fullWidth></nys-button>
224
+ * </nys-card>
225
+ * </div>
226
+ * <div
227
+ * class="nys-mobile-lg:nys-grid-col-6 nys-tablet:nys-grid-col-4 nys-display-flex"
228
+ * >
229
+ * <nys-card heading="Astoria Park" description="A waterfront park.">
230
+ * <img slot="media" src="/assets/images/card/astoria.jpg" role="presentation" />
231
+ * <nys-button slot="footer" label="Visit Queens" fullWidth></nys-button>
232
+ * </nys-card>
233
+ * </div>
234
+ * <div
235
+ * class="nys-mobile-lg:nys-grid-col-6 nys-tablet:nys-grid-col-4 nys-display-flex"
236
+ * >
237
+ * <nys-card heading="Brooklyn Bridge Park" description="A park.">
238
+ * <img slot="media" src="/assets/images/card/brooklynbridge.png" role="presentation" />
239
+ * <nys-button slot="footer" label="Visit Brooklyn" fullWidth></nys-button>
240
+ * </nys-card>
241
+ * </div>
242
+ * </div>
243
+ * ```
244
+ */
245
+ export declare class NysCard extends NysElement {
246
+ static styles: import("lit").CSSResult;
247
+ /**
248
+ * Unique identifier. Auto-generated if not provided.
249
+ */
250
+ id: string;
251
+ /**
252
+ * Appears above the heading text.
253
+ */
254
+ preheading: string;
255
+ /**
256
+ * Heading text in the card.
257
+ */
258
+ heading: string;
259
+ /**
260
+ * Heading level used for the card heading (`h1` through `h6`).
261
+ */
262
+ headingLevel: HeadingLevel;
263
+ /**
264
+ * Appears below the heading text.
265
+ */
266
+ subheading: string;
267
+ /**
268
+ * Appears below the subheading text. Takes in plain text. Use the main slot if the description requires rich text or more content.
269
+ */
270
+ description: string;
271
+ /**
272
+ * When true, adds padding around the media to visually contain it.
273
+ */
274
+ inset: boolean;
275
+ /**
276
+ * When true, adds a drop shadow to the card, giving it a raised appearance.
277
+ */
278
+ elevated: boolean;
279
+ /**
280
+ * URL to navigate to. Makes the whole card a single `<a>`. Keep the card's slots
281
+ * free of other interactive elements when using this — nesting them inside the
282
+ * card control is invalid HTML and unreachable for keyboard and screen reader users.
283
+ */
284
+ href: string;
285
+ /**
286
+ * Link target: `_self` (same tab), `_blank` (new tab), `_parent`, `_top`, or frame name. Only used with `href`.
287
+ */
288
+ target: "_self" | "_blank" | "_parent" | "_top" | "framename";
289
+ /**
290
+ * Click handler. Makes the whole card a single `<button>`. Use instead of
291
+ * `@click` to ensure keyboard accessibility. Keep the card's slots free of
292
+ * other interactive elements when using this — nesting them inside the card
293
+ * control is invalid HTML and unreachable for keyboard and screen reader users.
294
+ */
295
+ onClick: ((event: Event) => void) | null;
296
+ private _hasMedia;
297
+ private _hasPreheadingSlot;
298
+ private _accentMonth;
299
+ private _accentDay;
300
+ /**
301
+ * Lifecycle methods
302
+ * --------------------------------------------------------------------------
303
+ */
304
+ connectedCallback(): void;
305
+ /**
306
+ * Functions
307
+ * --------------------------------------------------------------------------
308
+ */
309
+ private get isClickable();
310
+ private renderHeading;
311
+ private readMediaAccent;
312
+ /**
313
+ * Event Handlers
314
+ * --------------------------------------------------------------------------
315
+ */
316
+ private hasSlotContent;
317
+ private handleMediaSlotChange;
318
+ private handlePreheadingSlotChange;
319
+ private handleMediaAccentSlotChange;
320
+ private handleClick;
321
+ private handleFocus;
322
+ private handleBlur;
323
+ render(): import("lit-html").TemplateResult<1>;
324
+ }
325
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,9 @@
1
- import { LitElement } from "lit";
1
+ import { NysFormControlElement } from "@nysds/internals";
2
2
  import "./nys-checkboxgroup";
3
+ import "@nysds/nys-label";
4
+ import "@nysds/nys-errormessage";
5
+ import "@nysds/nys-icon";
6
+ import "@nysds/nys-textinput";
3
7
  /**
4
8
  * A checkbox input for binary choices or multi-select lists. Can be used standalone or in a `nys-checkboxgroup`.
5
9
  * Form-associated with validation via ElementInternals.
@@ -17,20 +21,17 @@ import "./nys-checkboxgroup";
17
21
  * @fires nys-blur - Fired when checkbox loses focus.
18
22
  * @fires nys-other-input - Fired when "other" text input value changes. Detail: `{id, name, value}`.
19
23
  *
20
- * @example Single checkbox
24
+ * @example Single
21
25
  * ```html
22
- * <nys-checkbox label="I agree to the terms" name="terms" required></nys-checkbox>
26
+ * <nys-checkbox label="I agree to the terms" name="terms"></nys-checkbox>
23
27
  * ```
24
28
  *
25
- * @example Checkbox group
29
+ * @example Preselected
26
30
  * ```html
27
- * <nys-checkboxgroup label="Select landmarks">
28
- * <nys-checkbox name="landmarks" value="adirondacks" label="Adirondacks"></nys-checkbox>
29
- * <nys-checkbox name="landmarks" value="niagara" label="Niagara Falls"></nys-checkbox>
30
- * </nys-checkboxgroup>
31
+ * <nys-checkbox label="I agree to the terms" name="terms" checked></nys-checkbox>
31
32
  * ```
32
33
  */
33
- export declare class NysCheckbox extends LitElement {
34
+ export declare class NysCheckbox extends NysFormControlElement {
34
35
  static styles: import("lit").CSSResult;
35
36
  static shadowRootOptions: {
36
37
  delegatesFocus: boolean;
@@ -75,20 +76,43 @@ export declare class NysCheckbox extends LitElement {
75
76
  size: "sm" | "md";
76
77
  other: boolean;
77
78
  showOtherError: boolean;
79
+ /**
80
+ * Id of an element in the host's light-DOM tree to borrow the accessible name
81
+ * from (e.g. a table column `<th>`). Enables labelling a checkbox that has no
82
+ * visible label of its own.
83
+ */
84
+ labelledby: string;
85
+ /**
86
+ * Suppress the internal visible `<nys-label>` (use with `labelledby` for
87
+ * table cells).
88
+ */
89
+ hideLabel: boolean;
78
90
  private _mobileQuery;
79
91
  private isMobile;
80
92
  private _hasUserInteracted;
81
93
  getInputElement(): Promise<HTMLInputElement | null>;
82
- private _internals;
83
94
  /**
84
95
  * Lifecycle methods
85
96
  * --------------------------------------------------------------------------
97
+ * Form association, ElementInternals, and id generation are provided by
98
+ * NysFormControlElement (@nysds/internals).
86
99
  */
87
- static formAssociated: boolean;
88
- constructor();
89
100
  connectedCallback(): void;
90
101
  disconnectedCallback(): void;
91
102
  firstUpdated(): void;
103
+ willUpdate(changed: Map<string, unknown>): void;
104
+ updated(changed: Map<string, unknown>): void;
105
+ /**
106
+ * Point the native <input> at a light-DOM element that IDREF attributes cannot
107
+ * reach across the shadow boundary. associateControlRefs sets the control's own
108
+ * ariaLabelledByElements (honored in Chromium) plus a string aria-label fallback
109
+ * for engines that do not yet resolve element references.
110
+ *
111
+ * Only ever called with an external labelledby set: with no external target the
112
+ * native input keeps the internal same-root aria-labelledby IDREF that render()
113
+ * emits, and must not be touched.
114
+ */
115
+ private _syncExternalLabel;
92
116
  /**
93
117
  * Form Integration
94
118
  * --------------------------------------------------------------------------