@nysds/components 1.12.0 → 1.13.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/README.md +3 -1
- package/custom-elements.json +10506 -0
- package/dist/.vscode/vscode.css-custom-data.json +47 -1
- package/dist/.vscode/vscode.html-custom-data.json +1280 -266
- package/dist/custom-elements.json +2183 -332
- 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 +3325 -1564
- package/dist/nysds.es.js.map +1 -1
- package/dist/nysds.js +280 -164
- 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 +37 -3
- package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +32 -0
- package/dist/packages/nys-alert/src/nys-alert.d.ts +62 -1
- package/dist/packages/nys-avatar/src/nys-avatar.d.ts +44 -0
- package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +29 -0
- package/dist/packages/nys-badge/src/nys-badge.d.ts +46 -0
- package/dist/packages/nys-button/src/nys-button.d.ts +141 -0
- package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +65 -1
- package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +50 -0
- package/dist/packages/nys-datepicker/src/index.d.ts +1 -0
- package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +116 -0
- package/dist/packages/nys-datepicker/src/nys-datepicker.figma.d.ts +1 -0
- package/dist/packages/nys-divider/src/nys-divider.d.ts +22 -0
- package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +16 -0
- package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +59 -0
- package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +18 -0
- package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +29 -0
- package/dist/packages/nys-globalheader/src/nys-global.logo.d.ts +2 -0
- package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +32 -5
- package/dist/packages/nys-icon/src/nys-icon.d.ts +33 -0
- package/dist/packages/nys-label/src/nys-label.d.ts +17 -0
- package/dist/packages/nys-modal/src/nys-modal.d.ts +47 -0
- package/dist/packages/nys-pagination/src/nys-pagination.d.ts +33 -0
- package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +52 -3
- package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +55 -1
- package/dist/packages/nys-select/src/nys-option.d.ts +24 -0
- package/dist/packages/nys-select/src/nys-select.d.ts +70 -1
- package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +26 -0
- 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/index.d.ts +1 -0
- package/dist/packages/nys-table/src/nys-table.d.ts +39 -0
- package/dist/packages/nys-table/src/nys-table.figma.d.ts +1 -0
- package/dist/packages/nys-textarea/src/nys-textarea.d.ts +72 -1
- package/dist/packages/nys-textinput/src/nys-textinput.d.ts +85 -1
- package/dist/packages/nys-toggle/src/nys-toggle.d.ts +52 -0
- package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +41 -0
- package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +19 -0
- package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +38 -2
- package/dist/src/index.d.ts +2 -0
- package/package.json +22 -17
|
@@ -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>;
|
|
@@ -1,36 +1,105 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A dropdown for selecting a single option from a list. Supports native `<option>` and `<optgroup>` elements.
|
|
4
|
+
* Form-associated with validation via ElementInternals.
|
|
5
|
+
*
|
|
6
|
+
* Use when users must choose one option from 7+ items. For fewer options, consider `nys-radiobutton`.
|
|
7
|
+
* For multiple selections, use `nys-checkbox` group instead.
|
|
8
|
+
*
|
|
9
|
+
* @summary Dropdown select for choosing one option from a list.
|
|
10
|
+
* @element nys-select
|
|
11
|
+
*
|
|
12
|
+
* @slot - Default slot for `<option>` and `<optgroup>` elements.
|
|
13
|
+
* @slot description - Custom HTML description content below the label.
|
|
14
|
+
*
|
|
15
|
+
* @fires nys-change - Fired when selection changes. Detail: `{id, value}`.
|
|
16
|
+
* @fires nys-focus - Fired when select gains focus.
|
|
17
|
+
* @fires nys-blur - Fired when select loses focus. Triggers validation.
|
|
18
|
+
*
|
|
19
|
+
* @example Basic select
|
|
20
|
+
* ```html
|
|
21
|
+
* <nys-select label="Select borough">
|
|
22
|
+
* <option value="bronx">The Bronx</option>
|
|
23
|
+
* <option value="brooklyn">Brooklyn</option>
|
|
24
|
+
* <option value="manhattan">Manhattan</option>
|
|
25
|
+
* </nys-select>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example With option groups
|
|
29
|
+
* ```html
|
|
30
|
+
* <nys-select label="Select service">
|
|
31
|
+
* <optgroup label="Transportation">
|
|
32
|
+
* <option value="mta">MTA</option>
|
|
33
|
+
* <option value="dmv">DMV</option>
|
|
34
|
+
* </optgroup>
|
|
35
|
+
* </nys-select>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
2
38
|
export declare class NysSelect extends LitElement {
|
|
3
39
|
static styles: import("lit").CSSResult;
|
|
40
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
41
|
id: string;
|
|
42
|
+
/** Name for form submission. */
|
|
5
43
|
name: string;
|
|
44
|
+
/** Visible label text. Required for accessibility. */
|
|
6
45
|
label: string;
|
|
46
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
7
47
|
description: string;
|
|
48
|
+
/** Currently selected option value. */
|
|
8
49
|
value: string;
|
|
50
|
+
/** Prevents interaction. */
|
|
9
51
|
disabled: boolean;
|
|
52
|
+
/** Marks as required. Shows "Required" flag and validates on blur. */
|
|
10
53
|
required: boolean;
|
|
54
|
+
/** Shows "Optional" flag. Use when most fields are required. */
|
|
11
55
|
optional: boolean;
|
|
56
|
+
/** Tooltip text shown on hover/focus of info icon. */
|
|
12
57
|
tooltip: string;
|
|
58
|
+
/** Form `id` to associate with when select is outside form element. */
|
|
13
59
|
form: string | null;
|
|
60
|
+
/** Adjusts colors for dark backgrounds. */
|
|
14
61
|
inverted: boolean;
|
|
62
|
+
/** Shows error message when true. Set by validation or manually. */
|
|
15
63
|
showError: boolean;
|
|
64
|
+
/** Error message text. Shown only when `showError` is true. */
|
|
16
65
|
errorMessage: string;
|
|
66
|
+
/**
|
|
67
|
+
* Select width: `sm` (88px), `md` (200px), `lg` (384px), `full` (100%, default).
|
|
68
|
+
* @default "full"
|
|
69
|
+
*/
|
|
17
70
|
width: "sm" | "md" | "lg" | "full";
|
|
18
71
|
private _originalErrorMessage;
|
|
19
72
|
private _hasUserInteracted;
|
|
20
73
|
private _internals;
|
|
74
|
+
/**
|
|
75
|
+
* Lifecycle methods
|
|
76
|
+
* --------------------------------------------------------------------------
|
|
77
|
+
*/
|
|
21
78
|
static formAssociated: boolean;
|
|
22
79
|
constructor();
|
|
23
80
|
connectedCallback(): void;
|
|
24
81
|
disconnectedCallback(): void;
|
|
25
82
|
firstUpdated(): void;
|
|
26
|
-
formResetCallback(): void;
|
|
27
83
|
private _handleSlotChange;
|
|
84
|
+
/**
|
|
85
|
+
* Form Integration
|
|
86
|
+
* --------------------------------------------------------------------------
|
|
87
|
+
*/
|
|
28
88
|
private _setValue;
|
|
29
89
|
private _manageRequire;
|
|
30
90
|
private _setValidityMessage;
|
|
31
91
|
private _validate;
|
|
92
|
+
formResetCallback(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Functions
|
|
95
|
+
* --------------------------------------------------------------------------
|
|
96
|
+
*/
|
|
32
97
|
checkValidity(): boolean;
|
|
33
98
|
private _handleInvalid;
|
|
99
|
+
/**
|
|
100
|
+
* Event Handlers
|
|
101
|
+
* --------------------------------------------------------------------------
|
|
102
|
+
*/
|
|
34
103
|
private _handleChange;
|
|
35
104
|
private _handleFocus;
|
|
36
105
|
private _handleBlur;
|
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* An accessible "Skip to main content" link for keyboard and screen reader users. Visually hidden until focused.
|
|
4
|
+
*
|
|
5
|
+
* Place as the first focusable element in the document. Links to `#main-content` by default, or specify `href`
|
|
6
|
+
* for a custom target. The target element receives focus when activated for proper screen reader announcement.
|
|
7
|
+
*
|
|
8
|
+
* @summary Skip navigation link for keyboard accessibility. Hidden until focused.
|
|
9
|
+
* @element nys-skipnav
|
|
10
|
+
*
|
|
11
|
+
* @example Default skip link
|
|
12
|
+
* ```html
|
|
13
|
+
* <nys-skipnav></nys-skipnav>
|
|
14
|
+
* <main id="main-content">...</main>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example Custom target
|
|
18
|
+
* ```html
|
|
19
|
+
* <nys-skipnav href="#content-area"></nys-skipnav>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
2
22
|
export declare class NysSkipnav extends LitElement {
|
|
3
23
|
static styles: import("lit").CSSResult;
|
|
24
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
25
|
id: string;
|
|
26
|
+
/** Target element ID (with `#`). Defaults to `#main-content`. */
|
|
5
27
|
href: string;
|
|
6
28
|
constructor();
|
|
7
29
|
connectedCallback(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Event Handlers
|
|
32
|
+
* --------------------------------------------------------------------------
|
|
33
|
+
*/
|
|
8
34
|
private _handleFocus;
|
|
9
35
|
private _handleBlur;
|
|
10
36
|
private _handleClick;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A single step within `nys-stepper`. Represents one stage in a multi-step process.
|
|
4
|
+
*
|
|
5
|
+
* Mark as `current` to indicate active progress point. Previous steps become clickable for navigation.
|
|
6
|
+
* Set `href` for page-based navigation or listen to `nys-step-click` for SPA routing.
|
|
7
|
+
*
|
|
8
|
+
* @summary Individual step for use within nys-stepper with navigation support.
|
|
9
|
+
* @element nys-step
|
|
10
|
+
*
|
|
11
|
+
* @fires nys-step-click - Fired when a navigable step is clicked. Detail: `{href, label}`. Cancelable.
|
|
12
|
+
*
|
|
13
|
+
* @example Step with navigation
|
|
14
|
+
* ```html
|
|
15
|
+
* <nys-step label="Personal Info" href="/step-1"></nys-step>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class NysStep extends LitElement {
|
|
19
|
+
static styles: import("lit").CSSResult;
|
|
20
|
+
/** Whether this step is currently being viewed. Set by parent stepper. */
|
|
21
|
+
selected: boolean;
|
|
22
|
+
/** Marks the furthest reached step. Steps before this are navigable. */
|
|
23
|
+
current: boolean;
|
|
24
|
+
/** Step label text displayed alongside the step number. */
|
|
25
|
+
label: string;
|
|
26
|
+
/** URL for page navigation when step is clicked. Optional for SPA routing. */
|
|
27
|
+
href: string;
|
|
28
|
+
/** Internal: Whether parent stepper's compact view is expanded. */
|
|
29
|
+
isCompactExpanded: boolean;
|
|
30
|
+
/** Custom click handler. Called before `nys-step-click` event. */
|
|
31
|
+
onClick?: (e: Event) => void;
|
|
32
|
+
/** Step number (1-indexed). Auto-assigned by parent stepper. */
|
|
33
|
+
stepNumber: number;
|
|
34
|
+
private _handleActivate;
|
|
35
|
+
private _handleKeydown;
|
|
36
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "./nys-step";
|
|
3
|
+
/**
|
|
4
|
+
* A multi-step progress indicator for forms or wizards. Manages `nys-step` children with selection and navigation.
|
|
5
|
+
*
|
|
6
|
+
* Add `nys-step` elements as children. Mark one step as `current` to indicate progress; previous steps become
|
|
7
|
+
* navigable. Compact view on mobile expands to show all steps. Use `actions` slot for navigation buttons.
|
|
8
|
+
*
|
|
9
|
+
* @summary Multi-step progress indicator with navigation and mobile-friendly compact view.
|
|
10
|
+
* @element nys-stepper
|
|
11
|
+
*
|
|
12
|
+
* @slot - Default slot for `nys-step` elements.
|
|
13
|
+
* @slot actions - Navigation buttons (e.g., Back, Continue). Must be wrapped in a `<div>`.
|
|
14
|
+
*
|
|
15
|
+
* @example Basic stepper
|
|
16
|
+
* ```html
|
|
17
|
+
* <nys-stepper label="Application Progress">
|
|
18
|
+
* <nys-step label="Personal Info" current></nys-step>
|
|
19
|
+
* <nys-step label="Contact Details"></nys-step>
|
|
20
|
+
* <nys-step label="Review"></nys-step>
|
|
21
|
+
* </nys-stepper>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class NysStepper extends LitElement {
|
|
25
|
+
static styles: import("lit").CSSResult;
|
|
26
|
+
/** Unique identifier. */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Name attribute for form association. */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Title displayed above the step counter. */
|
|
31
|
+
label: string;
|
|
32
|
+
/** Progress text (e.g., "Step 2 of 5"). Auto-updated based on selection. */
|
|
33
|
+
counterText: string;
|
|
34
|
+
/** Whether compact mobile view is expanded to show all steps. */
|
|
35
|
+
isCompactExpanded: boolean;
|
|
36
|
+
private _stepsNumbered;
|
|
37
|
+
constructor();
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
disconnectedCallback(): void;
|
|
40
|
+
private _validateSteps;
|
|
41
|
+
private _validateButtonSlot;
|
|
42
|
+
private _onStepClick;
|
|
43
|
+
private _updateCounter;
|
|
44
|
+
willUpdate(): void;
|
|
45
|
+
private _toggleCompact;
|
|
46
|
+
private _handleCounterKeydown;
|
|
47
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./nys-table";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* `<nys-table>` is a responsive table component that can display native HTML tables,
|
|
4
|
+
* supports striped and bordered styling, sortable columns, and CSV download.
|
|
5
|
+
*
|
|
6
|
+
* @slot - Accepts a `<table>` element. Only the first table is rendered.
|
|
7
|
+
*
|
|
8
|
+
* @fires nys-click - Fired when the download button or sortable headers are clicked.
|
|
9
|
+
*
|
|
10
|
+
* @method downloadFile - Triggers download of the CSV file if `download` is set.
|
|
11
|
+
*/
|
|
12
|
+
export declare class NysTable extends LitElement {
|
|
13
|
+
static styles: import("lit").CSSResult;
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
striped: boolean;
|
|
17
|
+
sortable: boolean;
|
|
18
|
+
bordered: boolean;
|
|
19
|
+
download: string;
|
|
20
|
+
private _sortColumn;
|
|
21
|
+
private _sortDirection;
|
|
22
|
+
private _captionText;
|
|
23
|
+
/**************** Lifecycle Methods ****************/
|
|
24
|
+
constructor();
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
/******************** Functions ********************/
|
|
27
|
+
firstUpdated(): void;
|
|
28
|
+
_handleSlotChange(): void;
|
|
29
|
+
_normalizeTableDOM(table: HTMLTableElement): void;
|
|
30
|
+
willUpdate(): void;
|
|
31
|
+
_addSortIcons(table: HTMLTableElement): void;
|
|
32
|
+
_updateSortIcons(table: HTMLTableElement): void;
|
|
33
|
+
_onSortClick(columnIndex: number, table: HTMLTableElement): void;
|
|
34
|
+
_sortTable(table: HTMLTableElement, columnIndex: number, direction: "asc" | "desc"): void;
|
|
35
|
+
_updateSortedColumnStyles(table: HTMLTableElement): void;
|
|
36
|
+
downloadFile(): void;
|
|
37
|
+
/****************** Event Handlers ******************/
|
|
38
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,40 +1,111 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A multi-line text input for collecting longer responses like comments, descriptions, or feedback.
|
|
4
|
+
* Form-associated with validation support via ElementInternals.
|
|
5
|
+
*
|
|
6
|
+
* Use for detailed responses needing multiple lines. For single-line input, use `nys-textinput`.
|
|
7
|
+
* For predefined options, use `nys-select`, `nys-radiobutton`, or `nys-checkbox`.
|
|
8
|
+
*
|
|
9
|
+
* @summary Multi-line text input for comments, descriptions, and feedback.
|
|
10
|
+
* @element nys-textarea
|
|
11
|
+
*
|
|
12
|
+
* @slot description - Custom HTML description content below the label.
|
|
13
|
+
*
|
|
14
|
+
* @fires nys-input - Fired on input change. Detail: `{id, value}`.
|
|
15
|
+
* @fires nys-focus - Fired when textarea gains focus.
|
|
16
|
+
* @fires nys-blur - Fired when textarea loses focus. Triggers validation.
|
|
17
|
+
* @fires nys-select - Fired when user selects text. Detail: `{id, value}`.
|
|
18
|
+
*
|
|
19
|
+
* @example Basic textarea
|
|
20
|
+
* ```html
|
|
21
|
+
* <nys-textarea label="Comments" rows="4"></nys-textarea>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example Required with description
|
|
25
|
+
* ```html
|
|
26
|
+
* <nys-textarea label="Describe the incident" description="Please provide details" required></nys-textarea>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
2
29
|
export declare class NysTextarea extends LitElement {
|
|
3
30
|
static styles: import("lit").CSSResult;
|
|
31
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
32
|
id: string;
|
|
33
|
+
/** Name for form submission. */
|
|
5
34
|
name: string;
|
|
35
|
+
/** Visible label text. Required for accessibility. */
|
|
6
36
|
label: string;
|
|
37
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
7
38
|
description: string;
|
|
39
|
+
/** Placeholder text. Don't use as label replacement. */
|
|
8
40
|
placeholder: string;
|
|
41
|
+
/** Current textarea value. */
|
|
9
42
|
value: string;
|
|
43
|
+
/** Prevents interaction. */
|
|
10
44
|
disabled: boolean;
|
|
45
|
+
/** Makes textarea read-only but focusable. */
|
|
11
46
|
readonly: boolean;
|
|
47
|
+
/** Marks as required. Shows "Required" flag and validates on blur. */
|
|
12
48
|
required: boolean;
|
|
49
|
+
/** Shows "Optional" flag. Use when most fields are required. */
|
|
13
50
|
optional: boolean;
|
|
51
|
+
/** Tooltip text shown on hover/focus of info icon. */
|
|
14
52
|
tooltip: string;
|
|
53
|
+
/** Adjusts colors for dark backgrounds. */
|
|
15
54
|
inverted: boolean;
|
|
55
|
+
/** Form `id` to associate with when textarea is outside form element. */
|
|
16
56
|
form: string | null;
|
|
57
|
+
/** Maximum character length. */
|
|
17
58
|
maxlength: number | null;
|
|
59
|
+
/**
|
|
60
|
+
* Textarea width: `sm` (88px), `md` (200px), `lg` (384px), `full` (100%, default).
|
|
61
|
+
* @default "full"
|
|
62
|
+
*/
|
|
18
63
|
width: "sm" | "md" | "lg" | "full";
|
|
64
|
+
/**
|
|
65
|
+
* Visible height in lines.
|
|
66
|
+
* @default 4
|
|
67
|
+
*/
|
|
19
68
|
rows: number;
|
|
69
|
+
/**
|
|
70
|
+
* Resize behavior: `vertical` (default, user can resize height), `none` (fixed size).
|
|
71
|
+
* @default "vertical"
|
|
72
|
+
*/
|
|
20
73
|
resize: "vertical" | "none";
|
|
74
|
+
/** Shows error message when true. Set by validation or manually. */
|
|
21
75
|
showError: boolean;
|
|
76
|
+
/** Error message text. Shown only when `showError` is true. */
|
|
22
77
|
errorMessage: string;
|
|
23
78
|
updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
|
|
24
79
|
private _hasUserInteracted;
|
|
25
80
|
private _internals;
|
|
81
|
+
/**
|
|
82
|
+
* Lifecycle methods
|
|
83
|
+
* --------------------------------------------------------------------------
|
|
84
|
+
*/
|
|
26
85
|
static formAssociated: boolean;
|
|
27
86
|
constructor();
|
|
28
87
|
connectedCallback(): void;
|
|
29
88
|
disconnectedCallback(): void;
|
|
30
89
|
firstUpdated(): void;
|
|
31
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Form Integration
|
|
92
|
+
* --------------------------------------------------------------------------
|
|
93
|
+
*/
|
|
32
94
|
private _setValue;
|
|
33
95
|
private _manageRequire;
|
|
34
96
|
private _setValidityMessage;
|
|
35
97
|
private _validate;
|
|
98
|
+
formResetCallback(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Functions
|
|
101
|
+
* --------------------------------------------------------------------------
|
|
102
|
+
*/
|
|
36
103
|
checkValidity(): boolean;
|
|
37
104
|
private _handleInvalid;
|
|
105
|
+
/**
|
|
106
|
+
* Event Handlers
|
|
107
|
+
* --------------------------------------------------------------------------
|
|
108
|
+
*/
|
|
38
109
|
private _handleInput;
|
|
39
110
|
private _handleFocus;
|
|
40
111
|
private _handleBlur;
|
|
@@ -1,49 +1,133 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A text input for collecting short, single-line data. Supports validation, input masking (tel),
|
|
4
|
+
* password visibility toggle, and live error messaging. Form-associated via ElementInternals.
|
|
5
|
+
*
|
|
6
|
+
* Use for names, emails, passwords, phone numbers. For multi-line input, use `nys-textarea` instead.
|
|
7
|
+
* For predefined options, use `nys-select`, `nys-radiobutton`, or `nys-checkbox`.
|
|
8
|
+
*
|
|
9
|
+
* @summary Text input for short single-line data with validation and masking support.
|
|
10
|
+
* @element nys-textinput
|
|
11
|
+
*
|
|
12
|
+
* @slot description - Custom HTML description content below the label.
|
|
13
|
+
* @slot startButton - Button at input start. Use single `nys-button` only.
|
|
14
|
+
* @slot endButton - Button at input end. Use single `nys-button` only.
|
|
15
|
+
*
|
|
16
|
+
* @fires nys-input - Fired on input change. Detail: `{id, value}`.
|
|
17
|
+
* @fires nys-focus - Fired when input gains focus.
|
|
18
|
+
* @fires nys-blur - Fired when input loses focus. Triggers validation.
|
|
19
|
+
*
|
|
20
|
+
* @example Basic text input
|
|
21
|
+
* ```html
|
|
22
|
+
* <nys-textinput label="Full Name" required></nys-textinput>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Email with validation
|
|
26
|
+
* ```html
|
|
27
|
+
* <nys-textinput type="email" label="Email Address" required></nys-textinput>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Phone with masking
|
|
31
|
+
* ```html
|
|
32
|
+
* <nys-textinput type="tel" label="Phone Number"></nys-textinput>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Search with button
|
|
36
|
+
* ```html
|
|
37
|
+
* <nys-textinput type="search" placeholder="Search">
|
|
38
|
+
* <nys-button slot="endButton" label="Search" prefixIcon="search"></nys-button>
|
|
39
|
+
* </nys-textinput>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
2
42
|
export declare class NysTextinput extends LitElement {
|
|
3
43
|
static styles: import("lit").CSSResult;
|
|
44
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
45
|
id: string;
|
|
46
|
+
/** Name for form submission. */
|
|
5
47
|
name: string;
|
|
48
|
+
/**
|
|
49
|
+
* Input type: `text` (default), `email`, `number`, `password`, `search`, `tel` (auto-masked), `url`.
|
|
50
|
+
* @default "text"
|
|
51
|
+
*/
|
|
6
52
|
type: "email" | "number" | "password" | "search" | "tel" | "text" | "url";
|
|
53
|
+
/** Visible label text. Required for accessibility. */
|
|
7
54
|
label: string;
|
|
55
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
8
56
|
description: string;
|
|
57
|
+
/** Placeholder text. Don't use as label replacement. */
|
|
9
58
|
placeholder: string;
|
|
59
|
+
/** Current input value. */
|
|
10
60
|
value: string;
|
|
61
|
+
/** Prevents interaction. */
|
|
11
62
|
disabled: boolean;
|
|
63
|
+
/** Makes input read-only but focusable. */
|
|
12
64
|
readonly: boolean;
|
|
65
|
+
/** Marks as required. Shows "Required" flag and validates on blur. */
|
|
13
66
|
required: boolean;
|
|
67
|
+
/** Shows "Optional" flag. Use when most fields are required. */
|
|
14
68
|
optional: boolean;
|
|
69
|
+
/** Tooltip text shown on hover/focus of info icon. */
|
|
15
70
|
tooltip: string;
|
|
71
|
+
/** Form `id` to associate with when input is outside form element. */
|
|
16
72
|
form: string | null;
|
|
73
|
+
/** Regex pattern for validation. Shows error on mismatch. */
|
|
17
74
|
pattern: string;
|
|
75
|
+
/** Maximum character length. */
|
|
18
76
|
maxlength: number | null;
|
|
77
|
+
/**
|
|
78
|
+
* Input width: `sm` (88px), `md` (200px), `lg` (384px), `full` (100%, default).
|
|
79
|
+
* @default "full"
|
|
80
|
+
*/
|
|
19
81
|
width: "sm" | "md" | "lg" | "full";
|
|
82
|
+
/** Step increment for `type="number"`. */
|
|
20
83
|
step: number | null;
|
|
84
|
+
/** Minimum value for `type="number"`. */
|
|
21
85
|
min: number | null;
|
|
86
|
+
/** Maximum value for `type="number"`. */
|
|
22
87
|
max: number | null;
|
|
88
|
+
/** Adjusts colors for dark backgrounds. */
|
|
23
89
|
inverted: boolean;
|
|
90
|
+
/** Shows error message when true. Set by validation or manually. */
|
|
24
91
|
showError: boolean;
|
|
92
|
+
/** Error message text. Shown only when `showError` is true. */
|
|
25
93
|
errorMessage: string;
|
|
26
94
|
private showPassword;
|
|
27
95
|
private _originalErrorMessage;
|
|
28
96
|
private _hasUserInteracted;
|
|
29
97
|
private _internals;
|
|
30
98
|
private _maskPatterns;
|
|
99
|
+
/**
|
|
100
|
+
* Lifecycle methods
|
|
101
|
+
* --------------------------------------------------------------------------
|
|
102
|
+
*/
|
|
31
103
|
static formAssociated: boolean;
|
|
32
104
|
constructor();
|
|
33
105
|
connectedCallback(): void;
|
|
34
106
|
disconnectedCallback(): void;
|
|
35
107
|
firstUpdated(): void;
|
|
36
108
|
updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
|
|
37
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Form Integration
|
|
111
|
+
* --------------------------------------------------------------------------
|
|
112
|
+
*/
|
|
38
113
|
private _setValue;
|
|
39
114
|
private _manageRequire;
|
|
40
115
|
private _setValidityMessage;
|
|
41
116
|
private _validate;
|
|
117
|
+
formResetCallback(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Functions
|
|
120
|
+
* --------------------------------------------------------------------------
|
|
121
|
+
*/
|
|
42
122
|
checkValidity(): boolean;
|
|
43
123
|
private _handleInvalid;
|
|
44
124
|
private _togglePasswordVisibility;
|
|
45
125
|
private _updateOverlay;
|
|
46
126
|
private _applyMask;
|
|
127
|
+
/**
|
|
128
|
+
* Event Handlers
|
|
129
|
+
* --------------------------------------------------------------------------
|
|
130
|
+
*/
|
|
47
131
|
private _handleInput;
|
|
48
132
|
private _handleFocus;
|
|
49
133
|
private _handleBlur;
|
|
@@ -1,22 +1,74 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A toggle switch for binary settings with immediate effect. Form-associated via ElementInternals.
|
|
4
|
+
*
|
|
5
|
+
* Use when changing a setting takes effect immediately (e.g., dark mode, notifications).
|
|
6
|
+
* For binary choices in forms that submit later, use `nys-checkbox` instead.
|
|
7
|
+
*
|
|
8
|
+
* @summary Toggle switch for binary settings with immediate effect.
|
|
9
|
+
* @element nys-toggle
|
|
10
|
+
*
|
|
11
|
+
* @slot description - Custom HTML description content.
|
|
12
|
+
*
|
|
13
|
+
* @fires nys-change - Fired when toggle state changes. Detail: `{id, checked}`.
|
|
14
|
+
* @fires nys-focus - Fired when toggle gains focus.
|
|
15
|
+
* @fires nys-blur - Fired when toggle loses focus.
|
|
16
|
+
*
|
|
17
|
+
* @example Basic toggle
|
|
18
|
+
* ```html
|
|
19
|
+
* <nys-toggle label="Enable notifications" name="notifications"></nys-toggle>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example Dark mode toggle
|
|
23
|
+
* ```html
|
|
24
|
+
* <nys-toggle label="Dark mode" description="Adjust display for low light" checked></nys-toggle>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
2
27
|
export declare class NysToggle extends LitElement {
|
|
3
28
|
static styles: import("lit").CSSResult;
|
|
29
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
4
30
|
id: string;
|
|
31
|
+
/** Name for form submission. */
|
|
5
32
|
name: string;
|
|
33
|
+
/** Value submitted when toggle is on. */
|
|
6
34
|
value: string;
|
|
35
|
+
/** Visible label text. */
|
|
7
36
|
label: string;
|
|
37
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
8
38
|
description: string;
|
|
39
|
+
/** Form `id` to associate with. */
|
|
9
40
|
form: string | null;
|
|
41
|
+
/** Whether toggle is on. */
|
|
10
42
|
checked: boolean;
|
|
43
|
+
/** Prevents interaction. */
|
|
11
44
|
disabled: boolean;
|
|
45
|
+
/** Hides check/close icon inside toggle knob. */
|
|
12
46
|
noIcon: boolean;
|
|
47
|
+
/** Adjusts colors for dark backgrounds. */
|
|
13
48
|
inverted: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Toggle size: `sm` or `md` (default).
|
|
51
|
+
* @default "md"
|
|
52
|
+
*/
|
|
14
53
|
size: "sm" | "md";
|
|
15
54
|
private _internals;
|
|
55
|
+
/**
|
|
56
|
+
* Lifecycle methods
|
|
57
|
+
* --------------------------------------------------------------------------
|
|
58
|
+
*/
|
|
16
59
|
static formAssociated: boolean;
|
|
17
60
|
constructor();
|
|
18
61
|
connectedCallback(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Form Integration
|
|
64
|
+
* --------------------------------------------------------------------------
|
|
65
|
+
*/
|
|
19
66
|
updated(changedProperties: Map<string, any>): void;
|
|
67
|
+
formResetCallback(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Event Handlers
|
|
70
|
+
* --------------------------------------------------------------------------
|
|
71
|
+
*/
|
|
20
72
|
private _emitChangeEvent;
|
|
21
73
|
private _handleFocus;
|
|
22
74
|
private _handleBlur;
|