@nysds/components 1.13.0 → 1.14.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.
- package/custom-elements.json +10932 -0
- package/dist/.vscode/vscode.css-custom-data.json +62 -1
- package/dist/.vscode/vscode.html-custom-data.json +1346 -295
- package/dist/custom-elements.json +1251 -198
- package/dist/nys-stepper/newsletter.html +4 -0
- package/dist/nys-stepper/personal.html +6 -0
- package/dist/nys-stepper/survey.html +5 -0
- package/dist/nys-stepper/team.html +6 -0
- package/dist/nysds.es.js +2024 -1650
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +189 -126
- package/dist/nysds.js.map +1 -1
- package/dist/packages/mcp-server/src/index.d.ts +8 -0
- package/dist/packages/mcp-server/src/lib/cem-parser.d.ts +95 -0
- package/dist/packages/mcp-server/src/lib/search.d.ts +19 -0
- package/dist/packages/mcp-server/src/lib/token-parser.d.ts +139 -0
- package/dist/packages/mcp-server/src/prompts/nysds-mode.d.ts +7 -0
- package/dist/packages/mcp-server/src/resources/components.d.ts +11 -0
- package/dist/packages/mcp-server/src/resources/guides.d.ts +10 -0
- package/dist/packages/mcp-server/src/resources/index.d.ts +7 -0
- package/dist/packages/mcp-server/src/resources/tokens.d.ts +16 -0
- package/dist/packages/mcp-server/src/server.d.ts +10 -0
- package/dist/packages/mcp-server/src/tools/component-tools.d.ts +13 -0
- package/dist/packages/mcp-server/src/tools/index.d.ts +7 -0
- package/dist/packages/mcp-server/src/tools/token-tools.d.ts +16 -0
- package/dist/packages/mcp-server/src/tools/validation-tools.d.ts +11 -0
- package/dist/packages/nys-accordion/src/nys-accordion.d.ts +29 -8
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +19 -7
- package/dist/packages/nys-alert/src/nys-alert.d.ts +32 -9
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +26 -7
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +17 -7
- package/dist/packages/nys-badge/src/nys-badge.d.ts +30 -4
- package/dist/packages/nys-button/src/nys-button.d.ts +126 -9
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +53 -11
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +40 -12
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +65 -7
- package/dist/packages/nys-divider/src/nys-divider.d.ts +20 -2
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +10 -3
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +37 -11
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +16 -2
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +16 -7
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +16 -10
- package/dist/packages/nys-icon/src/nys-icon.d.ts +25 -3
- package/dist/packages/nys-label/src/nys-label.d.ts +20 -3
- package/dist/packages/nys-modal/src/nys-modal.d.ts +30 -7
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +17 -5
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +45 -13
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +34 -8
- package/dist/packages/nys-select/src/nys-option.d.ts +24 -0
- package/dist/packages/nys-select/src/nys-select.d.ts +48 -12
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +19 -6
- package/dist/packages/nys-stepper/src/index.d.ts +2 -0
- package/dist/packages/nys-stepper/src/nys-step.d.ts +37 -0
- package/dist/packages/nys-stepper/src/nys-stepper.d.ts +48 -0
- package/dist/packages/nys-stepper/src/nys-stepper.figma.d.ts +1 -0
- package/dist/packages/nys-table/src/nys-table.d.ts +2 -1
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +51 -8
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +67 -9
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +35 -6
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +24 -11
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +12 -5
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +25 -7
- package/package.json +31 -25
|
@@ -1,39 +1,64 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import "./nys-fileitem";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* A file input for uploading files with support for multiple files, drag-and-drop, and progress tracking.
|
|
5
|
+
* Validates file types via magic bytes (not just extension). Form-associated via ElementInternals.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* - Supports single or multiple file uploads
|
|
9
|
-
* - Optional drag-and-drop dropzone
|
|
10
|
-
* - File type validation and upload progress
|
|
11
|
-
* - Form-associated with native validation behavior
|
|
12
|
-
* - Keyboard and screen reader accessible
|
|
7
|
+
* Use for document uploads, image uploads, or any file submission. Enable `dropzone` for drag-and-drop UI.
|
|
13
8
|
*
|
|
14
|
-
* @
|
|
9
|
+
* @summary File input with drag-and-drop, validation, and progress tracking.
|
|
10
|
+
* @element nys-fileinput
|
|
15
11
|
*
|
|
16
|
-
* @
|
|
12
|
+
* @slot description - Custom HTML description content.
|
|
17
13
|
*
|
|
18
|
-
* @
|
|
14
|
+
* @fires nys-change - Fired when files are added or removed. Detail: `{id, files}`.
|
|
15
|
+
*
|
|
16
|
+
* @example Single file upload
|
|
17
|
+
* ```html
|
|
18
|
+
* <nys-fileinput label="Upload document" accept=".pdf,.doc" required></nys-fileinput>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Multiple files with dropzone
|
|
22
|
+
* ```html
|
|
23
|
+
* <nys-fileinput label="Upload images" accept="image/*" multiple dropzone></nys-fileinput>
|
|
24
|
+
* ```
|
|
19
25
|
*/
|
|
20
26
|
export declare class NysFileinput extends LitElement {
|
|
21
27
|
static styles: import("lit").CSSResult;
|
|
28
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
22
29
|
id: string;
|
|
30
|
+
/** Name for form submission. */
|
|
23
31
|
name: string;
|
|
32
|
+
/** Visible label text. */
|
|
24
33
|
label: string;
|
|
34
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
25
35
|
description: string;
|
|
36
|
+
/** Allows selecting multiple files. */
|
|
26
37
|
multiple: boolean;
|
|
38
|
+
/** Form `id` to associate with. */
|
|
27
39
|
form: string | null;
|
|
40
|
+
/** Tooltip text shown on hover/focus of info icon. */
|
|
28
41
|
tooltip: string;
|
|
42
|
+
/** Accepted file types. Use MIME types (`image/*`) or extensions (`.pdf`). Validated via magic bytes. */
|
|
29
43
|
accept: string;
|
|
44
|
+
/** Prevents interaction. */
|
|
30
45
|
disabled: boolean;
|
|
46
|
+
/** Requires at least one file to be uploaded. */
|
|
31
47
|
required: boolean;
|
|
48
|
+
/** Shows "Optional" flag. */
|
|
32
49
|
optional: boolean;
|
|
50
|
+
/** Shows error message when true. */
|
|
33
51
|
showError: boolean;
|
|
52
|
+
/** Error message text. Shown only when `showError` is true. */
|
|
34
53
|
errorMessage: string;
|
|
54
|
+
/** Enables drag-and-drop zone UI. */
|
|
35
55
|
dropzone: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Component width: `lg` (384px) or `full` (100%, default).
|
|
58
|
+
* @default "full"
|
|
59
|
+
*/
|
|
36
60
|
width: "lg" | "full";
|
|
61
|
+
/** Adjusts colors for dark backgrounds. */
|
|
37
62
|
inverted: boolean;
|
|
38
63
|
private _selectedFiles;
|
|
39
64
|
private _dragActive;
|
|
@@ -60,6 +85,7 @@ export declare class NysFileinput extends LitElement {
|
|
|
60
85
|
private _setValidityMessage;
|
|
61
86
|
private _validate;
|
|
62
87
|
checkValidity(): boolean;
|
|
88
|
+
formResetCallback(): void;
|
|
63
89
|
private _handleInvalid;
|
|
64
90
|
/**
|
|
65
91
|
* Functions
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* **Internal component.** Displays an individual file within `nys-fileinput` with status and progress.
|
|
4
|
+
*
|
|
5
|
+
* Rendered automatically by `nys-fileinput` for each selected file. Shows filename, upload status
|
|
6
|
+
* (pending/processing/done/error), progress bar during upload, and error messages. Remove button emits event.
|
|
7
|
+
*
|
|
8
|
+
* @summary Internal file item display with status, progress bar, and remove action.
|
|
9
|
+
* @element nys-fileitem
|
|
10
|
+
*
|
|
11
|
+
* @fires nys-fileRemove - Fired when remove button is clicked. Detail: `{filename}`.
|
|
5
12
|
*/
|
|
6
13
|
export declare class NysFileItem extends LitElement {
|
|
7
14
|
static styles: import("lit").CSSResult;
|
|
15
|
+
/** Name of the file being displayed. */
|
|
8
16
|
filename: string;
|
|
17
|
+
/**
|
|
18
|
+
* Upload status: `pending` (queued), `processing` (uploading), `done` (complete), `error` (failed).
|
|
19
|
+
* @default "pending"
|
|
20
|
+
*/
|
|
9
21
|
status: "pending" | "processing" | "done" | "error";
|
|
22
|
+
/** Upload progress percentage (0-100). Only shown when status is `processing`. */
|
|
10
23
|
progress: number;
|
|
24
|
+
/** Error message displayed when status is `error`. */
|
|
11
25
|
errorMessage: string;
|
|
12
26
|
private _handleRemove;
|
|
13
27
|
private splitFilename;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Agency-branded footer with agency name and slotted content sections. Auto-layouts based on content structure.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Place above `nys-unavfooter`. Slot contact info, links, or other content. Use `<h4>` elements
|
|
6
|
+
* to create multi-column layouts; without `<h4>`, renders as compact single section.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
8
|
+
* @summary Agency footer with auto-layout for contact info and link sections.
|
|
9
|
+
* @element nys-globalfooter
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* @slot - Footer content (links, contact info). Use `<h4>` for column headings.
|
|
12
|
+
*
|
|
13
|
+
* @example Simple footer
|
|
14
|
+
* ```html
|
|
15
|
+
* <nys-globalfooter agencyName="Department of Health" homepageLink="/">
|
|
16
|
+
* <span>123 Main St, Albany NY</span>
|
|
17
|
+
* <span>info@health.ny.gov</span>
|
|
18
|
+
* </nys-globalfooter>
|
|
19
|
+
* ```
|
|
13
20
|
*/
|
|
14
21
|
export declare class NysGlobalFooter extends LitElement {
|
|
15
22
|
static styles: import("lit").CSSResult;
|
|
23
|
+
/** Agency name displayed as the footer heading. */
|
|
16
24
|
agencyName: string;
|
|
25
|
+
/** URL for the agency name link. If empty, name is not clickable. */
|
|
17
26
|
homepageLink: string;
|
|
18
27
|
private slotHasContent;
|
|
19
28
|
/**
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Agency-branded header with app/agency name, navigation, and responsive mobile menu.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* and a responsive mobile menu.
|
|
5
|
+
* Place below `nys-unavheader`. Slot navigation links as `<ul><li><a>` elements; active links
|
|
6
|
+
* are auto-highlighted based on current URL. Mobile menu toggles automatically on narrow screens.
|
|
8
7
|
*
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
8
|
+
* @summary Agency header with navigation, mobile menu, and active link highlighting.
|
|
9
|
+
* @element nys-globalheader
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* @slot - Navigation content (typically `<ul>` with `<li><a>` links). Auto-sanitized.
|
|
12
|
+
*
|
|
13
|
+
* @example Basic header
|
|
14
|
+
* ```html
|
|
15
|
+
* <nys-globalheader appName="My App" agencyName="Department of Health" homepageLink="/">
|
|
16
|
+
* <ul><li><a href="/about">About</a></li><li><a href="/contact">Contact</a></li></ul>
|
|
17
|
+
* </nys-globalheader>
|
|
18
|
+
* ```
|
|
16
19
|
*/
|
|
17
20
|
export declare class NysGlobalHeader extends LitElement {
|
|
18
21
|
static styles: import("lit").CSSResult;
|
|
22
|
+
/** Application name displayed prominently. */
|
|
19
23
|
appName: string;
|
|
24
|
+
/** Agency name displayed below app name (or as main title if no appName). */
|
|
20
25
|
agencyName: string;
|
|
26
|
+
/** URL for the header title link. If empty, title is not clickable. */
|
|
21
27
|
homepageLink: string;
|
|
22
28
|
private isMobileMenuOpen;
|
|
23
29
|
private hasLinkContent;
|
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Renders SVG icons from the NYSDS icon library (Material Symbols). Decorative by default (`aria-hidden`).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* and
|
|
5
|
+
* Pass `name` to select an icon from the library. Use `ariaLabel` to make the icon accessible
|
|
6
|
+
* (removes `aria-hidden`). Supports size presets, rotation, flipping, and custom colors.
|
|
7
|
+
*
|
|
8
|
+
* @summary SVG icon from Material Symbols library with size, rotation, and color options.
|
|
9
|
+
* @element nys-icon
|
|
10
|
+
*
|
|
11
|
+
* @example Basic icon
|
|
12
|
+
* ```html
|
|
13
|
+
* <nys-icon name="check_circle" size="lg"></nys-icon>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Accessible icon with label
|
|
17
|
+
* ```html
|
|
18
|
+
* <nys-icon name="warning" ariaLabel="Warning" color="var(--nys-color-warning)"></nys-icon>
|
|
19
|
+
* ```
|
|
7
20
|
*/
|
|
8
21
|
export declare class NysIcon extends LitElement {
|
|
9
22
|
static styles: import("lit").CSSResult;
|
|
23
|
+
/** Icon name from Material Symbols library. Required. */
|
|
10
24
|
name: string;
|
|
25
|
+
/** Accessible label. When set, removes `aria-hidden` and adds `aria-label` to the SVG. */
|
|
11
26
|
ariaLabel: string;
|
|
27
|
+
/** Rotation in degrees. Applied via CSS `rotate`. */
|
|
12
28
|
rotate: string;
|
|
29
|
+
/** Flip direction: `horizontal`, `vertical`, or empty for none. */
|
|
13
30
|
flip: string;
|
|
31
|
+
/** Icon color. Accepts any CSS color value. Defaults to `currentcolor`. */
|
|
14
32
|
color: string;
|
|
33
|
+
/**
|
|
34
|
+
* Icon size. Semantic sizes: `xs`-`5xl`. Pixel sizes: `12`-`50`.
|
|
35
|
+
* @default "md"
|
|
36
|
+
*/
|
|
15
37
|
size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "12" | "14" | "16" | "18" | "20" | "24" | "32" | "40" | "50";
|
|
16
38
|
/**
|
|
17
39
|
* Retrieves the SVG element for the given icon name and applies
|
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* **Internal component.** Renders form labels with description, required/optional flag, and tooltip.
|
|
4
|
+
*
|
|
5
|
+
* Used internally by form components (textinput, select, checkbox, etc.). Not intended for direct use.
|
|
6
|
+
* Handles label association via `for`, displays asterisk for required fields, and integrates tooltips.
|
|
7
|
+
*
|
|
8
|
+
* @summary Internal label component for form fields with flag and tooltip support.
|
|
9
|
+
* @element nys-label
|
|
10
|
+
*
|
|
11
|
+
* @slot description - Custom HTML description content below the label.
|
|
6
12
|
*/
|
|
7
13
|
export declare class NysLabel extends LitElement {
|
|
8
14
|
static styles: import("lit").CSSResult;
|
|
15
|
+
/** ID of the form element this label is associated with. */
|
|
9
16
|
for: string;
|
|
17
|
+
/** Label text displayed above the form field. */
|
|
10
18
|
label: string;
|
|
19
|
+
/** Helper text displayed below the label. */
|
|
11
20
|
description: string;
|
|
21
|
+
/** Flag type: `required` shows asterisk, `optional` shows "(Optional)". */
|
|
12
22
|
flag: string;
|
|
23
|
+
/** Adjusts colors for dark backgrounds. */
|
|
13
24
|
inverted: boolean;
|
|
25
|
+
/** Tooltip text shown on hover/focus of info icon next to label. */
|
|
14
26
|
get tooltip(): string;
|
|
15
27
|
set tooltip(value: string);
|
|
16
28
|
private _tooltip;
|
|
29
|
+
/**
|
|
30
|
+
* Event Handlers
|
|
31
|
+
* --------------------------------------------------------------------------
|
|
32
|
+
*/
|
|
33
|
+
private _handleLabelClick;
|
|
17
34
|
render(): import("lit-html").TemplateResult<1>;
|
|
18
35
|
}
|
|
@@ -1,23 +1,46 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* An accessible modal dialog with focus trapping, keyboard navigation, and scroll management.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Set `open` to show the modal. Content goes in the default slot; action buttons in the `actions` slot.
|
|
6
|
+
* Dismisses via close button or Escape key unless `mandatory` is set. Focus returns to trigger on close.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
8
|
+
* @summary Accessible modal dialog with focus trap, keyboard support, and action slots.
|
|
9
|
+
* @element nys-modal
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
11
|
+
* @slot - Default slot for body content.
|
|
12
|
+
* @slot actions - Action buttons displayed in footer. Buttons auto-resize on mobile.
|
|
13
|
+
*
|
|
14
|
+
* @fires nys-open - Fired when modal opens. Detail: `{id}`.
|
|
15
|
+
* @fires nys-close - Fired when modal closes. Detail: `{id}`.
|
|
16
|
+
*
|
|
17
|
+
* @example Basic modal
|
|
18
|
+
* ```html
|
|
19
|
+
* <nys-modal id="confirm-modal" heading="Confirm action" open>
|
|
20
|
+
* <p>Are you sure you want to proceed?</p>
|
|
21
|
+
* <div slot="actions">
|
|
22
|
+
* <nys-button label="Cancel" variant="outline"></nys-button>
|
|
23
|
+
* <nys-button label="Confirm" variant="filled"></nys-button>
|
|
24
|
+
* </div>
|
|
25
|
+
* </nys-modal>
|
|
26
|
+
* ```
|
|
13
27
|
*/
|
|
14
28
|
export declare class NysModal extends LitElement {
|
|
15
29
|
static styles: import("lit").CSSResult;
|
|
30
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
16
31
|
id: string;
|
|
32
|
+
/** Modal heading text. Required for accessibility. */
|
|
17
33
|
heading: string;
|
|
34
|
+
/** Secondary heading below the main heading. */
|
|
18
35
|
subheading: string;
|
|
36
|
+
/** Controls modal visibility. Set to `true` to show. */
|
|
19
37
|
open: boolean;
|
|
38
|
+
/** Prevents dismissal via close button or Escape key. User must take an action. */
|
|
20
39
|
mandatory: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Modal width: `sm` (400px), `md` (600px), or `lg` (800px).
|
|
42
|
+
* @default "md"
|
|
43
|
+
*/
|
|
21
44
|
width: "sm" | "md" | "lg";
|
|
22
45
|
private _actionButtonSlot;
|
|
23
46
|
private _prevFocusedElement;
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Page navigation with Previous/Next buttons and numbered page links. Auto-collapses with ellipses for many pages.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* when
|
|
5
|
+
* Set `totalPages` and `currentPage` to control state. Listen to `nys-change` for page selection.
|
|
6
|
+
* Hidden automatically when `totalPages` is 1. Responsive: shows compact controls on mobile.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
8
|
+
* @summary Page navigation with numbered links, prev/next buttons, and responsive layout.
|
|
9
|
+
* @element nys-pagination
|
|
10
|
+
*
|
|
11
|
+
* @fires nys-change - Fired when page changes. Detail: `{page}`.
|
|
12
|
+
*
|
|
13
|
+
* @example Basic pagination
|
|
14
|
+
* ```html
|
|
15
|
+
* <nys-pagination currentPage="1" totalPages="10"></nys-pagination>
|
|
16
|
+
* ```
|
|
10
17
|
*/
|
|
11
18
|
export declare class NysPagination extends LitElement {
|
|
12
19
|
static styles: import("lit").CSSResult;
|
|
20
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
13
21
|
id: string;
|
|
22
|
+
/** Name attribute for form association. */
|
|
14
23
|
name: string;
|
|
24
|
+
/** Currently active page (1-indexed). Clamped to valid range. */
|
|
15
25
|
currentPage: number;
|
|
26
|
+
/** Total number of pages. Must be at least 1. */
|
|
16
27
|
totalPages: number;
|
|
28
|
+
/** Internal state for layout adjustments near the end. */
|
|
17
29
|
_twoBeforeLast: boolean;
|
|
18
30
|
/**
|
|
19
31
|
* Lifecycle Methods
|
|
@@ -1,36 +1,61 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import "./nys-radiogroup";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* A radio button for single selection within a `nys-radiogroup`. Only one radio with the same `name` can be selected.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - Supports labels, descriptions, tile layout, inverted style, and size variants
|
|
9
|
-
* - Integrates with forms and dispatches `nys-change` events on selection
|
|
6
|
+
* Use within `nys-radiogroup` for 2-6 mutually exclusive options. For 7+ options, use `nys-select`.
|
|
7
|
+
* For multiple selections, use `nys-checkbox`.
|
|
10
8
|
*
|
|
11
|
-
* @
|
|
9
|
+
* @summary Radio button for single selection from mutually exclusive options.
|
|
10
|
+
* @element nys-radiobutton
|
|
12
11
|
*
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
15
|
-
* @fires nys-
|
|
16
|
-
* @fires nys-
|
|
12
|
+
* @slot description - Custom HTML description content.
|
|
13
|
+
*
|
|
14
|
+
* @fires nys-change - Fired when selection changes. Detail: `{id, checked, name, value}`.
|
|
15
|
+
* @fires nys-focus - Fired when radio gains focus.
|
|
16
|
+
* @fires nys-blur - Fired when radio loses focus.
|
|
17
|
+
*
|
|
18
|
+
* @example Radio group
|
|
19
|
+
* ```html
|
|
20
|
+
* <nys-radiogroup label="Select borough" required>
|
|
21
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
22
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
23
|
+
* </nys-radiogroup>
|
|
24
|
+
* ```
|
|
17
25
|
*/
|
|
18
26
|
export declare class NysRadiobutton extends LitElement {
|
|
19
27
|
static styles: import("lit").CSSResult;
|
|
28
|
+
/** Whether this radio is selected. Only one per group can be checked. */
|
|
20
29
|
checked: boolean;
|
|
30
|
+
/** Prevents interaction. */
|
|
21
31
|
disabled: boolean;
|
|
32
|
+
/** Marks group as required. Set on radiogroup, not individual radios. */
|
|
22
33
|
required: boolean;
|
|
34
|
+
/** Visible label text. Required for accessibility. */
|
|
23
35
|
label: string;
|
|
36
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
24
37
|
description: string;
|
|
38
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
25
39
|
id: string;
|
|
40
|
+
/** Group name. Radios with same name are mutually exclusive. */
|
|
26
41
|
name: string;
|
|
42
|
+
/** Value submitted when this radio is selected. */
|
|
27
43
|
value: string;
|
|
44
|
+
/** Adjusts colors for dark backgrounds. */
|
|
28
45
|
inverted: boolean;
|
|
46
|
+
/** Form `id` to associate with. */
|
|
29
47
|
form: string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Radio size: `sm` (24px) or `md` (32px, default).
|
|
50
|
+
* @default "md"
|
|
51
|
+
*/
|
|
30
52
|
size: "sm" | "md";
|
|
53
|
+
/** Renders as tile with larger clickable area. */
|
|
31
54
|
tile: boolean;
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
other: boolean;
|
|
56
|
+
showOtherError: boolean;
|
|
57
|
+
private isMobile;
|
|
58
|
+
private _hasUserInteracted;
|
|
34
59
|
static buttonGroup: Record<string, NysRadiobutton>;
|
|
35
60
|
/**
|
|
36
61
|
* Lifecycle methods
|
|
@@ -43,7 +68,10 @@ export declare class NysRadiobutton extends LitElement {
|
|
|
43
68
|
* Functions
|
|
44
69
|
* --------------------------------------------------------------------------
|
|
45
70
|
*/
|
|
46
|
-
|
|
71
|
+
getInputElement(): Promise<HTMLInputElement | null>;
|
|
72
|
+
formResetUpdate(): void;
|
|
73
|
+
private _handleResize;
|
|
74
|
+
private _clearOtherState;
|
|
47
75
|
/**
|
|
48
76
|
* Event Handlers
|
|
49
77
|
* --------------------------------------------------------------------------
|
|
@@ -53,5 +81,9 @@ export declare class NysRadiobutton extends LitElement {
|
|
|
53
81
|
private _handleFocus;
|
|
54
82
|
private _handleBlur;
|
|
55
83
|
private _callInputHandling;
|
|
84
|
+
private _handleTextInput;
|
|
85
|
+
private _handleTextInputBlur;
|
|
86
|
+
private _validateOtherAndEmitError;
|
|
87
|
+
private _handleOtherKeydown;
|
|
56
88
|
render(): import("lit-html").TemplateResult<1>;
|
|
57
89
|
}
|
|
@@ -1,31 +1,56 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* A container for grouping `nys-radiobutton` elements as a single form control with enforced single selection.
|
|
4
|
+
* Handles keyboard navigation (arrow keys), validation, required constraints, and form integration.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Use to let users select exactly one option from 2-6 choices. Apply `tile`, `size`, and `inverted` to the group
|
|
7
|
+
* and all children inherit these styles automatically. For 7+ options, use `nys-select`.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
9
|
+
* @summary Container for grouping radio buttons as a single form control.
|
|
10
|
+
* @element nys-radiogroup
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
12
|
+
* @slot - Default slot for `nys-radiobutton` elements.
|
|
13
|
+
* @slot description - Custom HTML description content.
|
|
14
|
+
*
|
|
15
|
+
* @example Basic radio group
|
|
16
|
+
* ```html
|
|
17
|
+
* <nys-radiogroup label="Select borough" required>
|
|
18
|
+
* <nys-radiobutton name="borough" value="bronx" label="The Bronx"></nys-radiobutton>
|
|
19
|
+
* <nys-radiobutton name="borough" value="brooklyn" label="Brooklyn"></nys-radiobutton>
|
|
20
|
+
* <nys-radiobutton name="borough" value="manhattan" label="Manhattan"></nys-radiobutton>
|
|
21
|
+
* </nys-radiogroup>
|
|
22
|
+
* ```
|
|
14
23
|
*/
|
|
15
24
|
export declare class NysRadiogroup extends LitElement {
|
|
16
25
|
static styles: import("lit").CSSResult;
|
|
26
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
17
27
|
id: string;
|
|
28
|
+
/** Name for form submission. Auto-populated from child radiobuttons. */
|
|
18
29
|
name: string;
|
|
30
|
+
/** Requires a selection before form submission. */
|
|
19
31
|
required: boolean;
|
|
32
|
+
/** Shows "Optional" flag. */
|
|
20
33
|
optional: boolean;
|
|
34
|
+
/** Shows error message when true. */
|
|
21
35
|
showError: boolean;
|
|
36
|
+
/** Error message text. Shown only when `showError` is true. */
|
|
22
37
|
errorMessage: string;
|
|
38
|
+
/** Visible label text for the group. */
|
|
23
39
|
label: string;
|
|
40
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
24
41
|
description: string;
|
|
42
|
+
/** Renders all radiobuttons as tiles with larger clickable area. */
|
|
25
43
|
tile: boolean;
|
|
44
|
+
/** Tooltip text shown on hover/focus of info icon. */
|
|
26
45
|
tooltip: string;
|
|
46
|
+
/** Adjusts colors for dark backgrounds. Applied to all children. */
|
|
27
47
|
inverted: boolean;
|
|
48
|
+
/** Form `id` to associate with. Applied to all children. */
|
|
28
49
|
form: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Radio size for all children: `sm` (24px) or `md` (32px, default).
|
|
52
|
+
* @default "md"
|
|
53
|
+
*/
|
|
29
54
|
size: "sm" | "md";
|
|
30
55
|
private selectedValue;
|
|
31
56
|
private _slottedDescriptionText;
|
|
@@ -70,5 +95,6 @@ export declare class NysRadiogroup extends LitElement {
|
|
|
70
95
|
*/
|
|
71
96
|
private _handleRadioButtonChange;
|
|
72
97
|
private _handleInvalid;
|
|
98
|
+
private _handleChildError;
|
|
73
99
|
render(): import("lit-html").TemplateResult<1>;
|
|
74
100
|
}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* An option item for use within `nys-select`. Wraps a native `<option>` element.
|
|
4
|
+
*
|
|
5
|
+
* Place inside `nys-select`. Set `value` for form submission and `label` for display text.
|
|
6
|
+
* Alternatively, slot text content which auto-populates the label.
|
|
7
|
+
*
|
|
8
|
+
* @summary Option item for nys-select dropdown.
|
|
9
|
+
* @element nys-option
|
|
10
|
+
*
|
|
11
|
+
* @slot - Option label text. Auto-populates the `label` prop if provided.
|
|
12
|
+
*
|
|
13
|
+
* @example Basic options
|
|
14
|
+
* ```html
|
|
15
|
+
* <nys-select>
|
|
16
|
+
* <nys-option value="ny">New York</nys-option>
|
|
17
|
+
* <nys-option value="ca" disabled>California</nys-option>
|
|
18
|
+
* </nys-select>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
2
21
|
export declare class NysOption extends LitElement {
|
|
22
|
+
/** Prevents selection of this option. */
|
|
3
23
|
disabled: boolean;
|
|
24
|
+
/** Pre-selects this option. */
|
|
4
25
|
selected: boolean;
|
|
26
|
+
/** Value submitted when this option is selected. */
|
|
5
27
|
value: string;
|
|
28
|
+
/** Display text for the option. Auto-populated from slot content if not set. */
|
|
6
29
|
label: string;
|
|
30
|
+
/** Hides the option from the dropdown list. */
|
|
7
31
|
hidden: boolean;
|
|
8
32
|
firstUpdated(): void;
|
|
9
33
|
render(): import("lit-html").TemplateResult<1>;
|