@nysds/components 1.21.1 → 1.22.1
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.
- package/custom-elements.json +1562 -1029
- package/dist/.vscode/vscode.css-custom-data.json +75 -0
- package/dist/.vscode/vscode.html-custom-data.json +129 -60
- package/dist/custom-elements.json +1562 -1029
- package/dist/{nys-icon.library-BxwfG3ym-D4Dl8jc_.js → nys-icon.library-715cAMBp-BmiCym2_.js} +3 -3
- package/dist/{nys-icon.library-BxwfG3ym-D4Dl8jc_.js.map → nys-icon.library-715cAMBp-BmiCym2_.js.map} +1 -1
- package/dist/{nys-icon.library-C02yNW9R.js → nys-icon.library-C0_LOBWi.js} +2 -2
- package/dist/{nys-icon.library-C02yNW9R.js.map → nys-icon.library-C0_LOBWi.js.map} +1 -1
- package/dist/nysds.es.js +5074 -3645
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +252 -248
- package/dist/nysds.js.map +1 -1
- package/dist/packages/codegen/src/index.d.ts +16 -0
- package/dist/packages/codegen/src/manifest/components.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/filters.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/form-control.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/load.d.ts +10 -0
- package/dist/packages/codegen/src/manifest/naming.d.ts +6 -0
- package/dist/packages/codegen/src/manifest/packages.d.ts +5 -0
- package/dist/packages/codegen/src/manifest/types.d.ts +6 -0
- package/dist/packages/codegen/src/transform/index.d.ts +19 -0
- package/dist/packages/codegen/src/transform/parse.d.ts +18 -0
- package/dist/packages/codegen/src/transform/shared.d.ts +61 -0
- package/dist/packages/codegen/src/transform/to-angular.d.ts +6 -0
- package/dist/packages/codegen/src/transform/to-jsx.d.ts +6 -0
- package/dist/packages/internals/src/form-control-mixin.d.ts +16 -0
- package/dist/packages/internals/src/form-events.d.ts +22 -0
- package/dist/packages/internals/src/index.d.ts +2 -1
- package/dist/packages/internals/src/types.d.ts +6 -0
- package/dist/packages/mcp-server/src/lib/cem-parser.d.ts +12 -0
- package/dist/packages/mcp-server/src/lib/framework-snippets.d.ts +35 -0
- package/dist/packages/mcp-server/src/lib/framework-usage.d.ts +19 -0
- package/dist/packages/mcp-server/src/lib/frameworks-data.d.ts +18 -0
- package/dist/packages/mcp-server/src/resources/frameworks.d.ts +14 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +12 -0
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +9 -1
- package/dist/packages/nys-alert/src/nys-alert.d.ts +39 -1
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +16 -0
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +12 -0
- package/dist/packages/nys-badge/src/nys-badge.d.ts +18 -0
- package/dist/packages/nys-breadcrumbs/src/nys-breadcrumbs.d.ts +22 -1
- package/dist/packages/nys-button/src/nys-button.d.ts +35 -4
- package/dist/packages/nys-card/src/nys-card.d.ts +20 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +77 -7
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +46 -0
- package/dist/packages/nys-combobox/src/nys-combobox.d.ts +51 -6
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +44 -2
- package/dist/packages/nys-divider/src/nys-divider.d.ts +9 -0
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenu.d.ts +43 -0
- package/dist/packages/nys-dropdownmenu/src/nys-dropdownmenuitem.d.ts +21 -1
- package/dist/packages/nys-fileinput/src/index.d.ts +1 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +42 -6
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +9 -1
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +17 -0
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +18 -0
- package/dist/packages/nys-icon/src/nys-icon.d.ts +18 -0
- package/dist/packages/nys-iconlist/src/nys-iconlist.d.ts +16 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +3 -1
- package/dist/packages/nys-modal/src/nys-modal.d.ts +26 -2
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +21 -2
- package/dist/packages/nys-processlist/src/nys-processlist.d.ts +16 -0
- package/dist/packages/nys-processlist/src/nys-processlistitem.d.ts +1 -1
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +29 -5
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +66 -4
- package/dist/packages/nys-select/src/nys-select.d.ts +22 -4
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +8 -0
- package/dist/packages/nys-stepper/src/nys-step.d.ts +8 -1
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +8 -0
- package/dist/packages/nys-tab/src/nys-tab.d.ts +22 -3
- package/dist/packages/nys-tab/src/nys-tabgroup.d.ts +12 -0
- package/dist/packages/nys-tab/src/nys-tabpanel.d.ts +2 -0
- package/dist/packages/nys-table/src/nys-table.d.ts +39 -2
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +47 -4
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +42 -4
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +37 -3
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +13 -0
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +13 -0
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +26 -4
- package/dist/packages/nys-verticalnav/src/nys-verticalnav.d.ts +14 -0
- package/dist/packages/nys-verticalnav/src/nys-verticalnavgroup.d.ts +11 -0
- package/dist/packages/nys-video/src/nys-video.d.ts +14 -1
- package/package.json +31 -26
- package/packages/react/.turbo/turbo-build.log +0 -59
- package/packages/react/NysAccordion.d.ts +0 -75
- package/packages/react/NysAccordion.js +0 -24
- package/packages/react/NysAccordionItem.d.ts +0 -82
- package/packages/react/NysAccordionItem.js +0 -43
- package/packages/react/NysAlert.d.ts +0 -102
- package/packages/react/NysAlert.js +0 -61
- package/packages/react/NysAvatar.d.ts +0 -88
- package/packages/react/NysAvatar.js +0 -40
- package/packages/react/NysBacktotop.d.ts +0 -57
- package/packages/react/NysBacktotop.js +0 -23
- package/packages/react/NysBadge.d.ts +0 -78
- package/packages/react/NysBadge.js +0 -42
- package/packages/react/NysBreadcrumbItem.d.ts +0 -72
- package/packages/react/NysBreadcrumbItem.js +0 -42
- package/packages/react/NysBreadcrumbs.d.ts +0 -89
- package/packages/react/NysBreadcrumbs.js +0 -50
- package/packages/react/NysButton.d.ts +0 -171
- package/packages/react/NysButton.js +0 -83
- package/packages/react/NysCard.d.ts +0 -121
- package/packages/react/NysCard.js +0 -63
- package/packages/react/NysCheckbox.d.ts +0 -145
- package/packages/react/NysCheckbox.js +0 -78
- package/packages/react/NysCheckboxgroup.d.ts +0 -88
- package/packages/react/NysCheckboxgroup.js +0 -46
- package/packages/react/NysCombobox.d.ts +0 -126
- package/packages/react/NysCombobox.js +0 -66
- package/packages/react/NysDatepicker.d.ts +0 -128
- package/packages/react/NysDatepicker.js +0 -76
- package/packages/react/NysDivider.d.ts +0 -54
- package/packages/react/NysDivider.js +0 -22
- package/packages/react/NysDropdownMenu.d.ts +0 -59
- package/packages/react/NysDropdownMenu.js +0 -23
- package/packages/react/NysDropdownMenuItem.d.ts +0 -75
- package/packages/react/NysDropdownMenuItem.js +0 -47
- package/packages/react/NysErrorMessage.d.ts +0 -60
- package/packages/react/NysErrorMessage.js +0 -24
- package/packages/react/NysFileItem.d.ts +0 -69
- package/packages/react/NysFileItem.js +0 -37
- package/packages/react/NysFileinput.d.ts +0 -130
- package/packages/react/NysFileinput.js +0 -74
- package/packages/react/NysGlobalFooter.d.ts +0 -77
- package/packages/react/NysGlobalFooter.js +0 -32
- package/packages/react/NysGlobalHeader.d.ts +0 -82
- package/packages/react/NysGlobalHeader.js +0 -32
- package/packages/react/NysIcon.d.ts +0 -75
- package/packages/react/NysIcon.js +0 -50
- package/packages/react/NysIconlist.d.ts +0 -57
- package/packages/react/NysIconlist.js +0 -23
- package/packages/react/NysIconlistitem.d.ts +0 -63
- package/packages/react/NysIconlistitem.js +0 -23
- package/packages/react/NysLabel.d.ts +0 -81
- package/packages/react/NysLabel.js +0 -40
- package/packages/react/NysModal.d.ts +0 -90
- package/packages/react/NysModal.js +0 -50
- package/packages/react/NysOption.d.ts +0 -66
- package/packages/react/NysOption.js +0 -25
- package/packages/react/NysPagination.d.ts +0 -72
- package/packages/react/NysPagination.js +0 -45
- package/packages/react/NysProcesslist.d.ts +0 -65
- package/packages/react/NysProcesslist.js +0 -25
- package/packages/react/NysProcesslistitem.d.ts +0 -61
- package/packages/react/NysProcesslistitem.js +0 -35
- package/packages/react/NysRadiobutton.d.ts +0 -132
- package/packages/react/NysRadiobutton.js +0 -72
- package/packages/react/NysRadiogroup.d.ts +0 -104
- package/packages/react/NysRadiogroup.js +0 -62
- package/packages/react/NysSelect.d.ts +0 -119
- package/packages/react/NysSelect.js +0 -67
- package/packages/react/NysSkipnav.d.ts +0 -54
- package/packages/react/NysSkipnav.js +0 -22
- package/packages/react/NysStep.d.ts +0 -73
- package/packages/react/NysStep.js +0 -40
- package/packages/react/NysStepper.d.ts +0 -67
- package/packages/react/NysStepper.js +0 -26
- package/packages/react/NysTab.d.ts +0 -90
- package/packages/react/NysTab.js +0 -39
- package/packages/react/NysTabgroup.d.ts +0 -76
- package/packages/react/NysTabgroup.js +0 -22
- package/packages/react/NysTable.d.ts +0 -80
- package/packages/react/NysTable.js +0 -41
- package/packages/react/NysTabpanel.d.ts +0 -70
- package/packages/react/NysTabpanel.js +0 -21
- package/packages/react/NysTextarea.d.ts +0 -141
- package/packages/react/NysTextarea.js +0 -79
- package/packages/react/NysTextinput.d.ts +0 -144
- package/packages/react/NysTextinput.js +0 -83
- package/packages/react/NysToggle.d.ts +0 -102
- package/packages/react/NysToggle.js +0 -59
- package/packages/react/NysTooltip.d.ts +0 -60
- package/packages/react/NysTooltip.js +0 -24
- package/packages/react/NysUnavFooter.d.ts +0 -61
- package/packages/react/NysUnavFooter.js +0 -21
- package/packages/react/NysUnavHeader.d.ts +0 -95
- package/packages/react/NysUnavHeader.js +0 -54
- package/packages/react/NysVerticalnav.d.ts +0 -67
- package/packages/react/NysVerticalnav.js +0 -26
- package/packages/react/NysVerticalnavGroup.d.ts +0 -76
- package/packages/react/NysVerticalnavGroup.js +0 -43
- package/packages/react/NysVideo.d.ts +0 -83
- package/packages/react/NysVideo.js +0 -53
- package/packages/react/README.md +0 -92
- package/packages/react/index.d.ts +0 -49
- package/packages/react/index.js +0 -49
- package/packages/react/nysds-jsx.d.ts +0 -2009
- package/packages/react/react-utils.js +0 -40
|
@@ -28,9 +28,24 @@ import "@nysds/nys-icon";
|
|
|
28
28
|
* @cssprop [--nys-button-border-color--hover] - Border color when hovered.
|
|
29
29
|
* @cssprop [--nys-button-border-color--active] - Border color when active/pressed.
|
|
30
30
|
*
|
|
31
|
-
* @fires nys-click - Fired when the button is clicked (mouse or keyboard). Not fired when disabled.
|
|
32
|
-
* @fires nys-focus - Fired when the button receives focus.
|
|
33
|
-
* @fires nys-blur - Fired when the button loses focus.
|
|
31
|
+
* @fires {Event} nys-click - Fired when the button is clicked (mouse or keyboard). Not fired when disabled.
|
|
32
|
+
* @fires {Event} nys-focus - Fired when the button receives focus.
|
|
33
|
+
* @fires {Event} nys-blur - Fired when the button loses focus.
|
|
34
|
+
*
|
|
35
|
+
* @usagedos
|
|
36
|
+
* - Use for the most important actions you want users to take, such as "Download", "Sign up", or "Log out".
|
|
37
|
+
* - Use `variant="fill"` for the primary action on the page. There should be only one primary action per page.
|
|
38
|
+
* - Use `variant="outline"` for secondary actions, placed next to the primary Fill button.
|
|
39
|
+
* - Use `variant="ghost"` buttons for additional actions beyond primary and secondary.
|
|
40
|
+
* - Use `variant="text"` buttons when an action needs to appear within a text block. If clicking takes the user somewhere else, use a Link instead.
|
|
41
|
+
* - Always set the `type` attribute (`submit`, `button`, or `reset`). The default is `button`.
|
|
42
|
+
* - Use sentence case for button labels, only capitalizing the first word.
|
|
43
|
+
* - Place a `chevron_down icon` on the right for buttons that open a dropdown.
|
|
44
|
+
*
|
|
45
|
+
* @usagedonts
|
|
46
|
+
* - Use buttons for navigation. Use an `<a>` element or Text button for links that take users somewhere else.
|
|
47
|
+
* - Use icons in buttons without a text label. Very few icons are universally understood.
|
|
48
|
+
* - Create custom button styles (color, shape, size). Consistency helps users recognize buttons and predict behavior.
|
|
34
49
|
*
|
|
35
50
|
* @example Basic
|
|
36
51
|
* ```html
|
|
@@ -245,7 +260,18 @@ export declare class NysButton extends NysFormControlElement {
|
|
|
245
260
|
*/
|
|
246
261
|
form: string | null;
|
|
247
262
|
/**
|
|
248
|
-
* Value submitted with form data
|
|
263
|
+
* Value submitted with the form data, mirroring a native submit button.
|
|
264
|
+
*
|
|
265
|
+
* When `type="submit"` and both `name` and `value` are set, the entry
|
|
266
|
+
* `name=value` is included in the form's data only for submissions this
|
|
267
|
+
* button triggers. It is not included when the form is submitted another
|
|
268
|
+
* way (Enter in a text field, another button, `form.requestSubmit()`),
|
|
269
|
+
* and it is not readable from `new FormData(form)` outside a submission,
|
|
270
|
+
* matching native submitter semantics.
|
|
271
|
+
*
|
|
272
|
+
* A form-associated custom element cannot act as a native submitter, so
|
|
273
|
+
* the value is staged through `ElementInternals.setFormValue()` for the
|
|
274
|
+
* duration of the submission and cleared afterward.
|
|
249
275
|
*/
|
|
250
276
|
value: string;
|
|
251
277
|
/**
|
|
@@ -259,6 +285,11 @@ export declare class NysButton extends NysFormControlElement {
|
|
|
259
285
|
type: "submit" | "reset" | "button";
|
|
260
286
|
/**
|
|
261
287
|
* Click handler. Use instead of `@click` to ensure keyboard accessibility.
|
|
288
|
+
*
|
|
289
|
+
* @deprecated Listen for the `nys-click` event instead. `nys-click`
|
|
290
|
+
* bubbles, is composed, and fires for both mouse and keyboard activation
|
|
291
|
+
* but never while disabled. This property still works but is excluded
|
|
292
|
+
* from generated framework wrappers and goes away in 2.0.
|
|
262
293
|
*/
|
|
263
294
|
onClick: ((event: Event) => void) | null;
|
|
264
295
|
/**
|
|
@@ -35,6 +35,26 @@ type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
|
35
35
|
* @fires nys-focus - Fired when an interactive card receives focus.
|
|
36
36
|
* @fires nys-blur - Fired when an interactive card loses focus.
|
|
37
37
|
*
|
|
38
|
+
* @usagedos
|
|
39
|
+
* - Use a card to group content and actions about a single subject, such as one program, event, or news item.
|
|
40
|
+
* - Set `headingLevel` so the card heading fits the surrounding page hierarchy.
|
|
41
|
+
* - Keep headings short and specific, so a card is understandable on its own.
|
|
42
|
+
* - Put actions in the `footer` slot as real buttons or links.
|
|
43
|
+
* - Use `href` or `onClick` when the whole card leads to one destination or performs one action, and add an icon to the footer slot so the interaction is visible.
|
|
44
|
+
* - Keep cards in the same group consistent in structure, so they are easy to scan and compare.
|
|
45
|
+
* - Repeat any information shown in the `media` or the `media-accent` slot in the card's text.
|
|
46
|
+
* - Place each card in a grid column to control its width, and set `--nys-card-height: 100%` when a row of cards should share one height.
|
|
47
|
+
*
|
|
48
|
+
* @usagedonts
|
|
49
|
+
* - Use a card as a substitute for a page section heading or for content that belongs in the page flow.
|
|
50
|
+
* - Put buttons, links, or other interactive elements in the slots of a card that has `href` or a click handler. That card is already a single control.
|
|
51
|
+
* - Set both `href` and a click handler on the same card.
|
|
52
|
+
* - Put more than one primary action in a card.
|
|
53
|
+
* - Rely on the `media` image or the `media-accent` slot to convey information that appears nowhere else.
|
|
54
|
+
* - Mix `elevated` and non-elevated cards within the same group.
|
|
55
|
+
* - Skip heading levels to get a particular text size. Use `headingLevel` for structure, not for styling.
|
|
56
|
+
* - Use cards for long-form content that a user needs to read in order.
|
|
57
|
+
*
|
|
38
58
|
* @example Basic
|
|
39
59
|
* ```html
|
|
40
60
|
* <div class="nys-tablet:nys-grid-col-6 nys-desktop:nys-grid-col-3">
|
|
@@ -4,6 +4,51 @@ import "@nysds/nys-label";
|
|
|
4
4
|
import "@nysds/nys-errormessage";
|
|
5
5
|
import "@nysds/nys-icon";
|
|
6
6
|
import "@nysds/nys-textinput";
|
|
7
|
+
/** Detail payload for the `nys-change` event fired by `nys-checkbox`. */
|
|
8
|
+
export interface NysCheckboxChangeDetail {
|
|
9
|
+
id: string;
|
|
10
|
+
checked: boolean;
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
/** The `nys-change` event fired by `nys-checkbox`. */
|
|
15
|
+
export type NysCheckboxChangeEvent = CustomEvent<NysCheckboxChangeDetail>;
|
|
16
|
+
/** Detail payload for the `nys-other-input` event fired by `nys-checkbox`. */
|
|
17
|
+
export interface NysCheckboxOtherInputDetail {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}
|
|
22
|
+
/** The `nys-other-input` event fired by `nys-checkbox`. */
|
|
23
|
+
export type NysCheckboxOtherInputEvent = CustomEvent<NysCheckboxOtherInputDetail>;
|
|
24
|
+
/**
|
|
25
|
+
* Detail payload for the `nys-error` group-coordination event.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export interface NysCheckboxErrorDetail {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
type: "other";
|
|
32
|
+
message: string;
|
|
33
|
+
sourceCheckbox: NysCheckbox;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The `nys-error` group-coordination event.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export type NysCheckboxErrorEvent = CustomEvent<NysCheckboxErrorDetail>;
|
|
40
|
+
/**
|
|
41
|
+
* Detail payload for the `nys-error-clear` group-coordination event.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export interface NysCheckboxErrorClearDetail {
|
|
45
|
+
sourceCheckbox: NysCheckbox;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The `nys-error-clear` group-coordination event.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export type NysCheckboxErrorClearEvent = CustomEvent<NysCheckboxErrorClearDetail>;
|
|
7
52
|
/**
|
|
8
53
|
* A checkbox input for binary choices or multi-select lists. Can be used standalone or in a `nys-checkboxgroup`.
|
|
9
54
|
* Form-associated with validation via ElementInternals.
|
|
@@ -13,13 +58,27 @@ import "@nysds/nys-textinput";
|
|
|
13
58
|
*
|
|
14
59
|
* @summary Checkbox for binary choices or multi-select options.
|
|
15
60
|
* @element nys-checkbox
|
|
61
|
+
* @formControl checked nys-change
|
|
16
62
|
*
|
|
17
63
|
* @slot description - Custom HTML description content.
|
|
18
64
|
*
|
|
19
|
-
* @fires nys-change - Fired when checked state changes. Detail: `{id, checked, name, value}`.
|
|
20
|
-
* @fires nys-focus - Fired when checkbox gains focus.
|
|
21
|
-
* @fires nys-blur - Fired when checkbox loses focus.
|
|
22
|
-
* @fires nys-other-input - Fired when "other" text input value changes. Detail: `{id, name, value}`.
|
|
65
|
+
* @fires {NysCheckboxChangeEvent} nys-change - Fired when checked state changes. Detail: `{id, checked, name, value}`. Bubbles and composed.
|
|
66
|
+
* @fires {Event} nys-focus - Fired when checkbox gains focus. Bubbles and composed.
|
|
67
|
+
* @fires {Event} nys-blur - Fired when checkbox loses focus. Bubbles and composed.
|
|
68
|
+
* @fires {NysCheckboxOtherInputEvent} nys-other-input - Fired when "other" text input value changes. Detail: `{id, name, value}`.
|
|
69
|
+
* @fires {NysCheckboxErrorEvent} nys-error - Internal group coordination: reports an empty "other" field to the parent `nys-checkboxgroup`. Not part of the public API.
|
|
70
|
+
* @fires {NysCheckboxErrorClearEvent} nys-error-clear - Internal group coordination: clears a previously reported "other" field error. Not part of the public API.
|
|
71
|
+
*
|
|
72
|
+
* @usagedos
|
|
73
|
+
* - Use for binary decisions (agree/disagree), confirmation, or multi-select lists.
|
|
74
|
+
* - Use for selecting multiple options from a list of up to 10 choices.
|
|
75
|
+
* - Use `nys-checkboxgroup` to group checkboxes with a shared label and description.
|
|
76
|
+
*
|
|
77
|
+
* @usagedonts
|
|
78
|
+
* - Use when users need to select only one option. Use a `<nys-radiobutton>` for 1–6 choices or a <nys-select> for 7 or more.
|
|
79
|
+
* - Use a checkbox when changing its state immediately affects the system. Use a `<nys-toggle>` instead (e.g., enabling Dark Mode).
|
|
80
|
+
* - Use when you have more than 10 options to choose from.
|
|
81
|
+
* - Change the state of one checkbox based on another being clicked.
|
|
23
82
|
*
|
|
24
83
|
* @example Single
|
|
25
84
|
* ```html
|
|
@@ -63,7 +122,12 @@ export declare class NysCheckbox extends NysFormControlElement {
|
|
|
63
122
|
showError: boolean;
|
|
64
123
|
/** Error message text. Shown only when `showError` is true. */
|
|
65
124
|
errorMessage: string;
|
|
66
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Set by the parent `nys-checkboxgroup` (via property) when all checkboxes
|
|
127
|
+
* in the group share a name, so the group owns the combined form value.
|
|
128
|
+
* Internal coordination state. Do not set manually.
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
67
131
|
groupExist: boolean;
|
|
68
132
|
/** Renders as tile with larger clickable area. Apply to group for consistency. */
|
|
69
133
|
tile: boolean;
|
|
@@ -74,7 +138,13 @@ export declare class NysCheckbox extends NysFormControlElement {
|
|
|
74
138
|
* @default "md"
|
|
75
139
|
*/
|
|
76
140
|
size: "sm" | "md";
|
|
141
|
+
/** Renders an additional free-text input when checked ("Other" option). */
|
|
77
142
|
other: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether the "other" free-text field is in an error state. Managed by the
|
|
145
|
+
* component during validation; treat as read-only.
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
78
148
|
showOtherError: boolean;
|
|
79
149
|
/**
|
|
80
150
|
* Id of an element in the host's light-DOM tree to borrow the accessible name
|
|
@@ -129,8 +199,8 @@ export declare class NysCheckbox extends NysFormControlElement {
|
|
|
129
199
|
checkValidity(): boolean;
|
|
130
200
|
private _handleInvalid;
|
|
131
201
|
private _manageLabelClick;
|
|
132
|
-
get _hasDescription()
|
|
133
|
-
get _isStandalone()
|
|
202
|
+
private get _hasDescription();
|
|
203
|
+
private get _isStandalone();
|
|
134
204
|
/**
|
|
135
205
|
* Event Handlers
|
|
136
206
|
* --------------------------------------------------------------------------
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { NysFormControlElement } from "@nysds/internals";
|
|
2
2
|
import "@nysds/nys-label";
|
|
3
3
|
import "@nysds/nys-errormessage";
|
|
4
|
+
/** Detail payload for the `nys-change` event fired by `nys-checkboxgroup`. */
|
|
5
|
+
export interface NysCheckboxgroupChangeDetail {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
value: string[];
|
|
9
|
+
}
|
|
10
|
+
/** The `nys-change` event fired by `nys-checkboxgroup`. */
|
|
11
|
+
export type NysCheckboxgroupChangeEvent = CustomEvent<NysCheckboxgroupChangeDetail>;
|
|
4
12
|
/**
|
|
5
13
|
* A container for grouping multiple `nys-checkbox` components as a single form control.
|
|
6
14
|
* Handles validation, required constraints, and submits comma-separated values.
|
|
@@ -10,10 +18,15 @@ import "@nysds/nys-errormessage";
|
|
|
10
18
|
*
|
|
11
19
|
* @summary Container for grouping checkboxes as a single form control.
|
|
12
20
|
* @element nys-checkboxgroup
|
|
21
|
+
* @formControl value nys-change
|
|
13
22
|
*
|
|
14
23
|
* @slot - Default slot for `nys-checkbox` elements.
|
|
15
24
|
* @slot description - Custom HTML description content.
|
|
16
25
|
*
|
|
26
|
+
* @fires {NysCheckboxgroupChangeEvent} nys-change - Fired when any child checkbox changes. Detail: `{id, name, value}` where `value` is the checked values as a string array. Bubbles and composed. The child's own `nys-change` keeps bubbling alongside it.
|
|
27
|
+
* @fires {Event} nys-focus - Fired when focus enters the group from outside. Bubbles and composed.
|
|
28
|
+
* @fires {Event} nys-blur - Fired when focus leaves the group. Bubbles and composed.
|
|
29
|
+
*
|
|
17
30
|
* @example Basic
|
|
18
31
|
* ```html
|
|
19
32
|
* <nys-checkboxgroup label="Select landmarks" required>
|
|
@@ -133,6 +146,15 @@ export declare class NysCheckboxgroup extends NysFormControlElement {
|
|
|
133
146
|
* @default "md"
|
|
134
147
|
*/
|
|
135
148
|
size: "sm" | "md";
|
|
149
|
+
private _value;
|
|
150
|
+
private _syncingValueFromChildren;
|
|
151
|
+
/**
|
|
152
|
+
* Values of the checked child checkboxes, in DOM order. Setting it
|
|
153
|
+
* programmatically checks the matching children and updates the form value
|
|
154
|
+
* without firing `nys-change`.
|
|
155
|
+
*/
|
|
156
|
+
get value(): string[];
|
|
157
|
+
set value(next: string[]);
|
|
136
158
|
private _slottedDescriptionText;
|
|
137
159
|
private _hasOtherError;
|
|
138
160
|
private _otherErrorCheckbox;
|
|
@@ -171,6 +193,30 @@ export declare class NysCheckboxgroup extends NysFormControlElement {
|
|
|
171
193
|
private _handleChildError;
|
|
172
194
|
private _handleChildErrorClear;
|
|
173
195
|
private _handleOtherInput;
|
|
196
|
+
/**
|
|
197
|
+
* Group-level focus: fired only when focus enters from outside the group,
|
|
198
|
+
* so moving between child checkboxes stays silent.
|
|
199
|
+
*/
|
|
200
|
+
private _handleFocusIn;
|
|
201
|
+
/** Group-level blur: fired only when focus leaves the group entirely. */
|
|
202
|
+
private _handleFocusOut;
|
|
203
|
+
/**
|
|
204
|
+
* Set `value` from the children's checked state without pushing the same
|
|
205
|
+
* state back down (and without firing `nys-change`).
|
|
206
|
+
*/
|
|
207
|
+
private _setValueFromChildren;
|
|
208
|
+
/**
|
|
209
|
+
* Apply a programmatically set `value` to the child checkboxes and the form
|
|
210
|
+
* value. Setting `checked` on a child never fires its `nys-change` (only
|
|
211
|
+
* user interaction does), so no change events echo back.
|
|
212
|
+
*/
|
|
213
|
+
private _applyValueToChildren;
|
|
214
|
+
/**
|
|
215
|
+
* Derive `value` from the checked children. Runs off the default slot's
|
|
216
|
+
* `slotchange`, so it covers first render and dynamically added checkboxes
|
|
217
|
+
* without scheduling a second update cycle.
|
|
218
|
+
*/
|
|
219
|
+
private _handleDefaultSlotChange;
|
|
174
220
|
private _checkOtherInputs;
|
|
175
221
|
/** Drupal-like naming support **/
|
|
176
222
|
private _checkSharedNames;
|
|
@@ -3,6 +3,25 @@ import "@nysds/nys-label";
|
|
|
3
3
|
import "@nysds/nys-errormessage";
|
|
4
4
|
import "@nysds/nys-icon";
|
|
5
5
|
import "@nysds/nys-button";
|
|
6
|
+
/** Detail payload for the `nys-input` event. */
|
|
7
|
+
export interface NysComboboxInputDetail {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** The committed value (the selected option's value), not the filter text. */
|
|
11
|
+
value: string;
|
|
12
|
+
/** The raw filter text the user has typed. */
|
|
13
|
+
query: string;
|
|
14
|
+
}
|
|
15
|
+
/** The `nys-input` event, fired on each keystroke while filtering. */
|
|
16
|
+
export type NysComboboxInputEvent = CustomEvent<NysComboboxInputDetail>;
|
|
17
|
+
/** Detail payload for the `nys-change` event. */
|
|
18
|
+
export interface NysComboboxChangeDetail {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
/** The `nys-change` event, fired when a selection is committed. */
|
|
24
|
+
export type NysComboboxChangeEvent = CustomEvent<NysComboboxChangeDetail>;
|
|
6
25
|
/**
|
|
7
26
|
* `<nys-combobox>` is a form-enabled combo box combining text input with a filterable dropdown.
|
|
8
27
|
*
|
|
@@ -19,11 +38,21 @@ import "@nysds/nys-button";
|
|
|
19
38
|
* @slot description - Optional custom description content below the label.
|
|
20
39
|
* @slot default - Options (<option>, <optgroup>) to populate the dropdown
|
|
21
40
|
*
|
|
22
|
-
* @
|
|
23
|
-
*
|
|
24
|
-
* @fires nys-
|
|
25
|
-
* @fires nys-
|
|
41
|
+
* @formControl value nys-change nys-input
|
|
42
|
+
*
|
|
43
|
+
* @fires {NysComboboxChangeEvent} nys-change - Fired when a selection is committed (option chosen or cleared). Detail: `{id, name, value}`.
|
|
44
|
+
* @fires {NysComboboxInputEvent} nys-input - Fired on each keystroke while filtering. Detail: `{id, name, value, query}`. `value` is the committed value; `query` is the current filter text.
|
|
45
|
+
* @fires {Event} nys-focus - Fired when the combobox gains focus.
|
|
46
|
+
* @fires {Event} nys-blur - Fired when the combobox loses focus. Triggers validation.
|
|
47
|
+
*
|
|
48
|
+
* @usagedos
|
|
49
|
+
* - Use when there are more than 15 options to choose from.
|
|
50
|
+
* - Use when screen real estate is limited.
|
|
51
|
+
* - Use when users can predict or recognize the value they're looking for.
|
|
26
52
|
*
|
|
53
|
+
* @usagedonts
|
|
54
|
+
* - Use when the number of options is small. Use `<nys-select>` or `<nys-radiobutton>` instead.
|
|
55
|
+
* - Use when options are unfamiliar to users and browsing the full list is necessary.
|
|
27
56
|
*
|
|
28
57
|
* @example Basic
|
|
29
58
|
* ```html
|
|
@@ -153,7 +182,7 @@ import "@nysds/nys-button";
|
|
|
153
182
|
* <option value="orange">Orange</option>
|
|
154
183
|
* <option value="strawberry">Strawberry</option>
|
|
155
184
|
* </nys-combobox>
|
|
156
|
-
* ```
|
|
185
|
+
* ```
|
|
157
186
|
*
|
|
158
187
|
* @example Description Slot
|
|
159
188
|
* ```html
|
|
@@ -198,19 +227,36 @@ export declare class NysCombobox extends NysFormControlElement {
|
|
|
198
227
|
serializable?: boolean;
|
|
199
228
|
slotAssignment?: SlotAssignmentMode;
|
|
200
229
|
};
|
|
230
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
201
231
|
id: string;
|
|
232
|
+
/** Name for form submission. */
|
|
202
233
|
name: string;
|
|
234
|
+
/** Visible label text. Required for accessibility. */
|
|
203
235
|
label: string;
|
|
236
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
204
237
|
description: string;
|
|
238
|
+
/** Current committed value: the selected option's value, not the typed filter text. */
|
|
205
239
|
value: string;
|
|
240
|
+
/** Prevents interaction. */
|
|
206
241
|
disabled: boolean;
|
|
242
|
+
/** Marks as required. Shows "Required" flag and validates on blur. */
|
|
207
243
|
required: boolean;
|
|
244
|
+
/** Shows "Optional" flag. Use when most fields are required. */
|
|
208
245
|
optional: boolean;
|
|
246
|
+
/** Tooltip text shown on hover/focus of info icon. */
|
|
209
247
|
tooltip: string;
|
|
248
|
+
/** Form `id` to associate with when the combobox is outside the form element. */
|
|
210
249
|
form: string | null;
|
|
250
|
+
/**
|
|
251
|
+
* Input width: `md` (200px), `lg` (384px), `full` (100%, default).
|
|
252
|
+
* @default "full"
|
|
253
|
+
*/
|
|
211
254
|
width: "md" | "lg" | "full";
|
|
255
|
+
/** Adjusts colors for dark backgrounds. */
|
|
212
256
|
inverted: boolean;
|
|
257
|
+
/** Shows error message when true. Set by validation or manually. */
|
|
213
258
|
showError: boolean;
|
|
259
|
+
/** Error message text. Shown only when `showError` is true. Never overwritten by internal validation. */
|
|
214
260
|
errorMessage: string;
|
|
215
261
|
private _isOpen;
|
|
216
262
|
private _filterText;
|
|
@@ -221,7 +267,6 @@ export declare class NysCombobox extends NysFormControlElement {
|
|
|
221
267
|
private _announcement;
|
|
222
268
|
private _input;
|
|
223
269
|
private _listbox?;
|
|
224
|
-
private _originalErrorMessage;
|
|
225
270
|
private _hasUserInteracted;
|
|
226
271
|
private _selectedLabel;
|
|
227
272
|
private _defaultValue;
|
|
@@ -3,6 +3,24 @@ import "@nysds/nys-label";
|
|
|
3
3
|
import "@nysds/nys-errormessage";
|
|
4
4
|
import "@nysds/nys-icon";
|
|
5
5
|
import "@nysds/nys-button";
|
|
6
|
+
/** Detail payload for the `nys-input` event. */
|
|
7
|
+
export interface NysDatepickerInputDetail {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** The current `value` property: a `Date`, a `YYYY-MM-DD` string, or `undefined`. */
|
|
11
|
+
value: string | Date | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** The `nys-input` event, fired as the date value updates. */
|
|
14
|
+
export type NysDatepickerInputEvent = CustomEvent<NysDatepickerInputDetail>;
|
|
15
|
+
/** Detail payload for the `nys-change` event. */
|
|
16
|
+
export interface NysDatepickerChangeDetail {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
/** The committed date, always a `YYYY-MM-DD` string. Empty string when cleared. */
|
|
20
|
+
value: string;
|
|
21
|
+
}
|
|
22
|
+
/** The `nys-change` event, fired on a committed selection. */
|
|
23
|
+
export type NysDatepickerChangeEvent = CustomEvent<NysDatepickerChangeDetail>;
|
|
6
24
|
/**
|
|
7
25
|
* Date picker with calendar popup and form validation. Falls back to native date input
|
|
8
26
|
* on Safari and mobile.
|
|
@@ -10,8 +28,26 @@ import "@nysds/nys-button";
|
|
|
10
28
|
* @summary Date picker with calendar popup and native fallback.
|
|
11
29
|
* @element nys-datepicker
|
|
12
30
|
*
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
31
|
+
* @formControl value nys-change nys-input
|
|
32
|
+
*
|
|
33
|
+
* @fires {NysDatepickerInputEvent} nys-input - Fired as the date value updates (valid typed date, calendar pick, Today, Clear). Detail: `{id, name, value}` where `value` is the current `value` property.
|
|
34
|
+
* @fires {NysDatepickerChangeEvent} nys-change - Fired on committed selection: calendar pick, valid typed date on blur, Today, Clear. Detail: `{id, name, value}` where `value` is always the `YYYY-MM-DD` string, empty string when cleared.
|
|
35
|
+
* @fires {Event} nys-focus - Fired when focus enters the component from outside.
|
|
36
|
+
* @fires {Event} nys-blur - Fired when input or calendar loses focus. Triggers validation.
|
|
37
|
+
*
|
|
38
|
+
* @usagedos
|
|
39
|
+
* - Use when users need to select a single calendar date, such as scheduling an appointment or choosing a filing deadline, especially when the day of the week matters.
|
|
40
|
+
* - Set the `label` property to clearly describe what date is being collected. Every datepicker needs one for accessibility.
|
|
41
|
+
* - Add `description` text to specify the expected format or provide context.
|
|
42
|
+
* - Set `required` when the date is mandatory for form submission; don't set both `required` and `optional` on the same component.
|
|
43
|
+
* - Use `startDate` to open the calendar to a relevant month when the expected date is far from today.
|
|
44
|
+
* - Pass date values as ISO strings (`"YYYY-MM-DD"`) rather than `Date` objects to avoid timezone issues.
|
|
45
|
+
*
|
|
46
|
+
* @usagedonts
|
|
47
|
+
* - Use for dates users know from memory, such as date of birth or document issue dates. A text input with separate month/day/year fields is more efficient.
|
|
48
|
+
* - Use when users need to select multiple dates or a date range, or when time selection is required alongside the date.
|
|
49
|
+
* - Rely on the calendar popup alone. Safari and mobile browsers use the native date picker instead.
|
|
50
|
+
* - Use `hideTodayButton` and `hideClearButton` together unless users must select a specific date and cannot be allowed to clear it.
|
|
15
51
|
*
|
|
16
52
|
* @example Basic
|
|
17
53
|
* ```html
|
|
@@ -158,6 +194,7 @@ export declare class NysDatepicker extends NysFormControlElement {
|
|
|
158
194
|
private datepickerIsOpen;
|
|
159
195
|
private readonly DATEPICKER_GAP;
|
|
160
196
|
private _hasUserInteracted;
|
|
197
|
+
private _dirtySinceCommit;
|
|
161
198
|
/**
|
|
162
199
|
* Lifecycle methods
|
|
163
200
|
* --------------------------------------------------------------------------
|
|
@@ -214,12 +251,17 @@ export declare class NysDatepicker extends NysFormControlElement {
|
|
|
214
251
|
private _setTodayDate;
|
|
215
252
|
private _setFocusOnTodayDate;
|
|
216
253
|
private _isOutOfRange;
|
|
254
|
+
private _valueAsString;
|
|
217
255
|
private _dispatchInputEvent;
|
|
256
|
+
private _dispatchChangeEvent;
|
|
257
|
+
private _closeCalendar;
|
|
258
|
+
private _focusInput;
|
|
218
259
|
/**
|
|
219
260
|
* Event Handlers
|
|
220
261
|
* --------------------------------------------------------------------------
|
|
221
262
|
*/
|
|
222
263
|
private _handleInputKeydown;
|
|
264
|
+
private _handleFocus;
|
|
223
265
|
private _handleBlur;
|
|
224
266
|
private _onDocumentClick;
|
|
225
267
|
private _onKeydownEsc;
|
|
@@ -8,6 +8,15 @@ import { NysReflectsAriaElement } from "@nysds/internals";
|
|
|
8
8
|
* @summary Horizontal divider for visual separation of content sections.
|
|
9
9
|
* @element nys-divider
|
|
10
10
|
*
|
|
11
|
+
* @usagedos
|
|
12
|
+
* - Ensure consistent padding/margin above and below dividers to avoid crowding.
|
|
13
|
+
* - Use the `inverted` option on dark backgrounds.
|
|
14
|
+
*
|
|
15
|
+
* @usagedonts
|
|
16
|
+
* - Overuse dividers and clutter the interface, reducing scannability.
|
|
17
|
+
* - Use the divider to separate content appearing side bys side.
|
|
18
|
+
* - Use the `inverted` option on light backgrounds.
|
|
19
|
+
*
|
|
11
20
|
* @example Basic
|
|
12
21
|
* ```html
|
|
13
22
|
* <p>Section one content</p>
|
|
@@ -8,6 +8,20 @@ type Position = "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
|
8
8
|
* @summary Action menu with auto-positioning, keyboard support, and screen reader integration.
|
|
9
9
|
* @element nys-dropdownmenu
|
|
10
10
|
*
|
|
11
|
+
* @usagedos
|
|
12
|
+
* - Use to display a list of 5–15 actions or links under a single trigger, such as navigation, commands, or user profile access.
|
|
13
|
+
* - Keep to 3–7 actions when possible.
|
|
14
|
+
* - Order actions by frequency or importance.
|
|
15
|
+
* - Separate destructive actions with a divider.
|
|
16
|
+
* - Use clear, specific labels (e.g., "Profile", "Account Settings", "Sign out").
|
|
17
|
+
*
|
|
18
|
+
* @usagedonts
|
|
19
|
+
* - Use for form inputs or selectable values. Use `<nys-select>` for standard selection or `<nys-combobox>` when users need to filter or search through many options.
|
|
20
|
+
* - Use when the action is always visible and frequently used. Use `<nys-button>` instead.
|
|
21
|
+
* - Use without a label or accessible description on the trigger.
|
|
22
|
+
* - Nest dropdown menus inside other dropdown menus.
|
|
23
|
+
* - Use vague labels like "Manage" or "Options".
|
|
24
|
+
*
|
|
11
25
|
* @example Basic
|
|
12
26
|
* ```html
|
|
13
27
|
* <nys-button id="my-trigger-id" label="Open Menu"></nys-button>
|
|
@@ -32,6 +46,32 @@ type Position = "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
|
32
46
|
* </nys-dropdownmenu>
|
|
33
47
|
* </div>
|
|
34
48
|
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Prefix & Suffix Icon
|
|
51
|
+
* ```html
|
|
52
|
+
* <div>
|
|
53
|
+
* <nys-button id="my-trigger-id" label="Open Menu"></nys-button>
|
|
54
|
+
* <nys-dropdownmenu id="my-dropdownmenu" for="my-trigger-id">
|
|
55
|
+
* <nys-dropdownmenuitem label="Profile" href="/profile" prefixIcon="account_circle"></nys-dropdownmenuitem>
|
|
56
|
+
* <nys-dropdownmenuitem label="Repositories & Github Pages" href="/repos" prefixIcon="drive_folder_upload" suffixIcon="open_in_new"></nys-dropdownmenuitem>
|
|
57
|
+
* <nys-dropdownmenuitem label="Organizations" href="/organizations" prefixIcon="account_balance_filled" suffixIcon="chevron_right"></nys-dropdownmenuitem>
|
|
58
|
+
* <nys-dropdownmenuitem label="Sign out" href="/logout" suffixIcon="lock_filled"></nys-dropdownmenuitem>
|
|
59
|
+
* </nys-dropdownmenu>
|
|
60
|
+
* </div>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @render Prefix & Suffix Icon
|
|
64
|
+
* ```html
|
|
65
|
+
* <div style="margin: 200px; display: flex; justify-content: center; align-items: center;">
|
|
66
|
+
* <nys-button id="my-trigger-id" label="Open Menu"></nys-button>
|
|
67
|
+
* <nys-dropdownmenu id="my-dropdownmenu" for="my-trigger-id">
|
|
68
|
+
* <nys-dropdownmenuitem label="Profile" href="/profile" prefixIcon="account_circle"></nys-dropdownmenuitem>
|
|
69
|
+
* <nys-dropdownmenuitem label="Repositories & Github Pages" href="/repos" prefixIcon="drive_folder_upload" suffixIcon="open_in_new"></nys-dropdownmenuitem>
|
|
70
|
+
* <nys-dropdownmenuitem label="Organizations" href="/organizations" prefixIcon="account_balance_filled" suffixIcon="chevron_right"></nys-dropdownmenuitem>
|
|
71
|
+
* <nys-dropdownmenuitem label="Sign out" href="/logout" suffixIcon="lock_filled"></nys-dropdownmenuitem>
|
|
72
|
+
* </nys-dropdownmenu>
|
|
73
|
+
* </div>
|
|
74
|
+
* ```
|
|
35
75
|
*/
|
|
36
76
|
export declare class NysDropdownMenu extends NysElement {
|
|
37
77
|
static styles: import("lit").CSSResult;
|
|
@@ -55,6 +95,7 @@ export declare class NysDropdownMenu extends NysElement {
|
|
|
55
95
|
private _lastFocusedIndex;
|
|
56
96
|
private readonly GAP;
|
|
57
97
|
private _resizeObserver;
|
|
98
|
+
private _wiredFor;
|
|
58
99
|
/**
|
|
59
100
|
* Lifecycle Methods
|
|
60
101
|
* --------------------------------------------------------------------------
|
|
@@ -63,12 +104,14 @@ export declare class NysDropdownMenu extends NysElement {
|
|
|
63
104
|
connectedCallback(): void;
|
|
64
105
|
disconnectedCallback(): void;
|
|
65
106
|
firstUpdated(): Promise<void>;
|
|
107
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
66
108
|
/**
|
|
67
109
|
* Functions
|
|
68
110
|
* --------------------------------------------------------------------------
|
|
69
111
|
*/
|
|
70
112
|
private _findTrigger;
|
|
71
113
|
private _connectTrigger;
|
|
114
|
+
private _disconnectTrigger;
|
|
72
115
|
private _toggleDropdown;
|
|
73
116
|
private _closeDropdown;
|
|
74
117
|
private _getMenuItems;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { NysElement } from "@nysds/internals";
|
|
2
2
|
import "@nysds/nys-icon";
|
|
3
|
+
/** Detail payload for the `nys-click` event fired by `nys-dropdownmenuitem`. */
|
|
4
|
+
export interface NysDropdownmenuitemClickDetail {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The `nys-click` event fired by `nys-dropdownmenuitem`. */
|
|
10
|
+
export type NysDropdownmenuitemClickEvent = CustomEvent<NysDropdownmenuitemClickDetail>;
|
|
3
11
|
/**
|
|
4
12
|
* **Slotted component.** Displays an individual dropdown item within `nys-dropdown` with label.
|
|
5
13
|
*
|
|
@@ -8,6 +16,8 @@ import "@nysds/nys-icon";
|
|
|
8
16
|
*
|
|
9
17
|
* @summary Dropdown item to display label and provide href link.
|
|
10
18
|
* @element nys-dropdownmenuitem
|
|
19
|
+
*
|
|
20
|
+
* @fires {NysDropdownmenuitemClickEvent} nys-click - Fired when the item is activated (unless disabled). Detail: `{id, label, href?}` — `href` is present only when set. Bubbles and composed.
|
|
11
21
|
*/
|
|
12
22
|
export declare class NysDropdownMenuItem extends NysElement {
|
|
13
23
|
static styles: import("lit").CSSResult;
|
|
@@ -19,13 +29,23 @@ export declare class NysDropdownMenuItem extends NysElement {
|
|
|
19
29
|
serializable?: boolean;
|
|
20
30
|
slotAssignment?: SlotAssignmentMode;
|
|
21
31
|
};
|
|
32
|
+
/** Text shown in the item. Also the accessible name and the `nys-click` detail label. */
|
|
22
33
|
label: string;
|
|
34
|
+
/** Link URL. Renders a link when set, a button when empty. */
|
|
23
35
|
href: string;
|
|
36
|
+
/** Disables the item. No `nys-click` event and no link navigation. */
|
|
24
37
|
disabled: boolean;
|
|
38
|
+
/** Where the link opens (e.g. `_self`, `_blank`). Only used with `href`. */
|
|
25
39
|
target: string;
|
|
40
|
+
/** Icon name shown before the label. */
|
|
26
41
|
prefixIcon: string;
|
|
27
|
-
|
|
42
|
+
/** Icon name shown after the label. */
|
|
43
|
+
suffixIcon: string;
|
|
44
|
+
/** Divider setting for the item.
|
|
45
|
+
* Update: commenting out, perhaps implementing at a future date.
|
|
46
|
+
*/
|
|
28
47
|
connectedCallback(): void;
|
|
29
48
|
private _handleClick;
|
|
49
|
+
private _renderIcon;
|
|
30
50
|
render(): import("lit-html").TemplateResult<1>;
|
|
31
51
|
}
|