@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.
Files changed (63) hide show
  1. package/custom-elements.json +10932 -0
  2. package/dist/.vscode/vscode.css-custom-data.json +62 -1
  3. package/dist/.vscode/vscode.html-custom-data.json +1346 -295
  4. package/dist/custom-elements.json +1251 -198
  5. package/dist/nys-stepper/newsletter.html +4 -0
  6. package/dist/nys-stepper/personal.html +6 -0
  7. package/dist/nys-stepper/survey.html +5 -0
  8. package/dist/nys-stepper/team.html +6 -0
  9. package/dist/nysds.es.js +2024 -1650
  10. package/dist/nysds.es.js.map +1 -1
  11. package/dist/nysds.js +189 -126
  12. package/dist/nysds.js.map +1 -1
  13. package/dist/packages/mcp-server/src/index.d.ts +8 -0
  14. package/dist/packages/mcp-server/src/lib/cem-parser.d.ts +95 -0
  15. package/dist/packages/mcp-server/src/lib/search.d.ts +19 -0
  16. package/dist/packages/mcp-server/src/lib/token-parser.d.ts +139 -0
  17. package/dist/packages/mcp-server/src/prompts/nysds-mode.d.ts +7 -0
  18. package/dist/packages/mcp-server/src/resources/components.d.ts +11 -0
  19. package/dist/packages/mcp-server/src/resources/guides.d.ts +10 -0
  20. package/dist/packages/mcp-server/src/resources/index.d.ts +7 -0
  21. package/dist/packages/mcp-server/src/resources/tokens.d.ts +16 -0
  22. package/dist/packages/mcp-server/src/server.d.ts +10 -0
  23. package/dist/packages/mcp-server/src/tools/component-tools.d.ts +13 -0
  24. package/dist/packages/mcp-server/src/tools/index.d.ts +7 -0
  25. package/dist/packages/mcp-server/src/tools/token-tools.d.ts +16 -0
  26. package/dist/packages/mcp-server/src/tools/validation-tools.d.ts +11 -0
  27. package/dist/packages/nys-accordion/src/nys-accordion.d.ts +29 -8
  28. package/dist/packages/nys-accordion/src/nys-accordionitem.d.ts +19 -7
  29. package/dist/packages/nys-alert/src/nys-alert.d.ts +32 -9
  30. package/dist/packages/nys-avatar/src/nys-avatar.d.ts +26 -7
  31. package/dist/packages/nys-backtotop/src/nys-backtotop.d.ts +17 -7
  32. package/dist/packages/nys-badge/src/nys-badge.d.ts +30 -4
  33. package/dist/packages/nys-button/src/nys-button.d.ts +126 -9
  34. package/dist/packages/nys-checkbox/src/nys-checkbox.d.ts +53 -11
  35. package/dist/packages/nys-checkbox/src/nys-checkboxgroup.d.ts +40 -12
  36. package/dist/packages/nys-datepicker/src/nys-datepicker.d.ts +65 -7
  37. package/dist/packages/nys-divider/src/nys-divider.d.ts +20 -2
  38. package/dist/packages/nys-errormessage/src/nys-errormessage.d.ts +10 -3
  39. package/dist/packages/nys-fileinput/src/nys-fileinput.d.ts +37 -11
  40. package/dist/packages/nys-fileinput/src/nys-fileitem.d.ts +16 -2
  41. package/dist/packages/nys-globalfooter/src/nys-globalfooter.d.ts +16 -7
  42. package/dist/packages/nys-globalheader/src/nys-globalheader.d.ts +16 -10
  43. package/dist/packages/nys-icon/src/nys-icon.d.ts +25 -3
  44. package/dist/packages/nys-label/src/nys-label.d.ts +20 -3
  45. package/dist/packages/nys-modal/src/nys-modal.d.ts +30 -7
  46. package/dist/packages/nys-pagination/src/nys-pagination.d.ts +17 -5
  47. package/dist/packages/nys-radiobutton/src/nys-radiobutton.d.ts +45 -13
  48. package/dist/packages/nys-radiobutton/src/nys-radiogroup.d.ts +34 -8
  49. package/dist/packages/nys-select/src/nys-option.d.ts +24 -0
  50. package/dist/packages/nys-select/src/nys-select.d.ts +48 -12
  51. package/dist/packages/nys-skipnav/src/nys-skipnav.d.ts +19 -6
  52. package/dist/packages/nys-stepper/src/index.d.ts +2 -0
  53. package/dist/packages/nys-stepper/src/nys-step.d.ts +37 -0
  54. package/dist/packages/nys-stepper/src/nys-stepper.d.ts +48 -0
  55. package/dist/packages/nys-stepper/src/nys-stepper.figma.d.ts +1 -0
  56. package/dist/packages/nys-table/src/nys-table.d.ts +2 -1
  57. package/dist/packages/nys-textarea/src/nys-textarea.d.ts +51 -8
  58. package/dist/packages/nys-textinput/src/nys-textinput.d.ts +67 -9
  59. package/dist/packages/nys-toggle/src/nys-toggle.d.ts +35 -6
  60. package/dist/packages/nys-tooltip/src/nys-tooltip.d.ts +24 -11
  61. package/dist/packages/nys-unavfooter/src/nys-unavfooter.d.ts +12 -5
  62. package/dist/packages/nys-unavheader/src/nys-unavheader.d.ts +25 -7
  63. package/package.json +31 -25
@@ -1,19 +1,45 @@
1
1
  import { LitElement } from "lit";
2
2
  /**
3
- * `<nys-badge>` displays a badge with optional prefix/suffix icons and labels.
3
+ * A compact label for status, counts, or categorization. Supports semantic intents with auto-selected icons.
4
4
  *
5
- * Features:
6
- * - Conveys an intent (`neutral`, `error`, `success`, `warning`) which affects default icons and styling.
7
- * - Supports custom prefix and suffix icons.
5
+ * Use badges to highlight metadata like status ("Approved"), counts ("3 new"), or categories.
6
+ * Set `intent` to apply semantic meaning. Add `prefixIcon` or `suffixIcon` as boolean for default icons,
7
+ * or pass icon name strings for custom icons.
8
+ *
9
+ * @summary Compact label for status, counts, or categorization with semantic styling.
10
+ * @element nys-badge
11
+ *
12
+ * @example Status badge
13
+ * ```html
14
+ * <nys-badge intent="success" label="Approved" prefixIcon></nys-badge>
15
+ * ```
16
+ *
17
+ * @example Count badge
18
+ * ```html
19
+ * <nys-badge prefixLabel="Messages" label="12"></nys-badge>
20
+ * ```
8
21
  */
9
22
  export declare class NysBadge extends LitElement {
10
23
  static styles: import("lit").CSSResult;
24
+ /** Unique identifier. */
11
25
  id: string;
26
+ /** Name attribute for form association. */
12
27
  name: string;
28
+ /**
29
+ * Badge size: `sm` (smaller text) or `md` (default).
30
+ * @default "md"
31
+ */
13
32
  size: "sm" | "md";
33
+ /**
34
+ * Semantic intent affecting color: `neutral`, `error`, `success`, or `warning`.
35
+ * @default "neutral"
36
+ */
14
37
  intent: "neutral" | "error" | "success" | "warning";
38
+ /** Secondary label displayed before the main label. */
15
39
  prefixLabel: string;
40
+ /** Primary label text displayed in the badge. */
16
41
  label: string;
42
+ variant: "strong" | "";
17
43
  private _prefixIcon;
18
44
  get prefixIcon(): string | boolean;
19
45
  set prefixIcon(value: string | boolean);
@@ -1,38 +1,155 @@
1
1
  import { LitElement } from "lit";
2
2
  /**
3
- * `<nys-button>` is a versatile button component supporting:
4
- * - Multiple variants (`filled`, `outline`, `ghost`, `text`)
5
- * - Sizes (`sm`, `md`, `lg`) and full-width layout
6
- * - Icons (prefix, suffix, or circle) and optional labels
7
- * - Native `<button>` or link `<a>` behavior with form association
8
- * - Keyboard and accessibility support (`aria-label`, `aria-controls`, `aria-description`)
3
+ * A button for actions like saving, submitting, or navigating. Form-associated with full keyboard support.
9
4
  *
10
- * @fires nys-click - Fired on button click
11
- * @fires nys-focus - Fired when button receives focus
12
- * @fires nys-blur - Fired when button loses focus
5
+ * Use `filled` for primary actions (one per section), `outline` for secondary, `ghost` for tertiary,
6
+ * `text` for inline. Set `href` to render as a navigation link.
7
+ *
8
+ * @summary Button for actions and CTAs with variants, sizes, and icon support.
9
+ * @element nys-button
10
+ *
11
+ * @slot prefix-icon - Icon before label. Not shown for `text` variant.
12
+ * @slot suffix-icon - Icon after label. Not shown for `text` variant.
13
+ * @slot circle-icon - Icon for circle mode. Overrides `icon` prop.
14
+ *
15
+ * @cssprop [--nys-button-color] - Text color of the button label.
16
+ * @cssprop [--nys-button-color--hover] - Text color when hovered.
17
+ * @cssprop [--nys-button-color--active] - Text color when active/pressed.
18
+ * @cssprop [--nys-button-background-color] - Background color of the button.
19
+ * @cssprop [--nys-button-background-color--hover] - Background color when hovered.
20
+ * @cssprop [--nys-button-background-color--active] - Background color when active/pressed.
21
+ * @cssprop [--nys-button-border-color] - Border color of the button.
22
+ * @cssprop [--nys-button-border-color--hover] - Border color when hovered.
23
+ * @cssprop [--nys-button-border-color--active] - Border color when active/pressed.
24
+ *
25
+ * @fires nys-click - Fired when the button is clicked (mouse or keyboard). Not fired when disabled.
26
+ * @fires nys-focus - Fired when the button receives focus.
27
+ * @fires nys-blur - Fired when the button loses focus.
28
+ *
29
+ * @example Basic filled button
30
+ * ```html
31
+ * <nys-button label="Submit" variant="filled"></nys-button>
32
+ * ```
33
+ *
34
+ * @example Secondary outline button
35
+ * ```html
36
+ * <nys-button label="Cancel" variant="outline"></nys-button>
37
+ * ```
38
+ *
39
+ * @example Button with icons
40
+ * ```html
41
+ * <nys-button label="Previous" prefixIcon="chevron_left"></nys-button>
42
+ * <nys-button label="Next" suffixIcon="chevron_right"></nys-button>
43
+ * ```
44
+ *
45
+ * @example Circle icon button
46
+ * ```html
47
+ * <nys-button circle icon="close" label="Close dialog"></nys-button>
48
+ * ```
49
+ *
50
+ * @example Link-style button for navigation
51
+ * ```html
52
+ * <nys-button label="Visit NY.gov" href="https://www.ny.gov/" target="_blank" suffixIcon="open_in_new"></nys-button>
53
+ * ```
54
+ *
55
+ * @example Form submit button
56
+ * ```html
57
+ * <nys-button type="submit" label="Save Changes" variant="filled"></nys-button>
58
+ * ```
13
59
  */
14
60
  export declare class NysButton extends LitElement {
15
61
  static styles: import("lit").CSSResult;
62
+ /**
63
+ * Unique identifier. Auto-generated if not provided.
64
+ */
16
65
  id: string;
66
+ /**
67
+ * Name for form submission.
68
+ */
17
69
  name: string;
70
+ /**
71
+ * Button height: `sm` (40px) for dense UIs, `md` (48px, default) for standard use, `lg` (56px) for prominent CTAs.
72
+ * @default "md"
73
+ */
18
74
  size: "sm" | "md" | "lg";
75
+ /**
76
+ * Expands button to fill container width. Use for mobile layouts or stacked button groups.
77
+ * @default false
78
+ */
19
79
  fullWidth: boolean;
80
+ /**
81
+ * Visual style: `filled` for primary (one per section), `outline` for secondary, `ghost` for tertiary, `text` for inline actions. Avoid `text` for navigation.
82
+ * @default "filled"
83
+ */
20
84
  variant: "filled" | "outline" | "ghost" | "text";
85
+ /**
86
+ * Adjusts colors for dark backgrounds.
87
+ * @default false
88
+ */
21
89
  inverted: boolean;
90
+ /**
91
+ * Visible button text. Use sentence case, action-oriented text (e.g., "Save Draft"). Becomes aria-label in `circle` mode.
92
+ */
22
93
  label: string;
94
+ /**
95
+ * Screen reader label. Required for icon-only buttons if `label` is not set.
96
+ */
23
97
  ariaLabel: string;
98
+ /**
99
+ * ID of controlled element (e.g., dropdown or modal). Sets `aria-controls`.
100
+ */
24
101
  ariaControls: string;
102
+ /**
103
+ * Material Symbol icon before label. Not shown for `text` variant or `circle` mode.
104
+ */
25
105
  prefixIcon: string;
106
+ /**
107
+ * Material Symbol icon after label. Use `chevron_down` for dropdowns, `open_in_new` for external links. Not shown for `text` variant or `circle` mode.
108
+ */
26
109
  suffixIcon: string;
110
+ /**
111
+ * Renders circular icon-only button. Requires `icon` prop. `label` becomes aria-label.
112
+ * @default false
113
+ */
27
114
  circle: boolean;
115
+ /**
116
+ * Icon for circle mode. Required when `circle` is true. Scales with size (sm=24px, md=32px, lg=40px).
117
+ */
28
118
  icon: string;
119
+ /**
120
+ * Prevents interaction. Avoid disabling without explanation—show validation errors instead.
121
+ * @default false
122
+ */
29
123
  disabled: boolean;
124
+ /**
125
+ * Form `id` to associate with. Use when button is outside the form element.
126
+ */
30
127
  form: string | null;
128
+ /**
129
+ * Value submitted with form data. Only used when `type="submit"`.
130
+ */
31
131
  value: string;
132
+ /**
133
+ * Additional screen reader description. Sets `aria-description`.
134
+ */
32
135
  ariaDescription: string;
136
+ /**
137
+ * Form behavior: `button` (default, no form action), `submit` (submits form), `reset` (resets form). Always set explicitly to avoid unintended submissions.
138
+ * @default "button"
139
+ */
33
140
  type: "submit" | "reset" | "button";
141
+ /**
142
+ * Click handler. Use instead of `@click` to ensure keyboard accessibility.
143
+ */
34
144
  onClick: ((event: Event) => void) | null;
145
+ /**
146
+ * URL to navigate to. Renders as `<a>` tag. Omit for action buttons.
147
+ */
35
148
  href: string;
149
+ /**
150
+ * Link target: `_self` (same tab), `_blank` (new tab—add `suffixIcon="open_in_new"`), `_parent`, `_top`, or frame name.
151
+ * @default "_self"
152
+ */
36
153
  target: "_self" | "_blank" | "_parent" | "_top" | "framename";
37
154
  getButtonElement(): Promise<HTMLElement | null>;
38
155
  private _internals;
@@ -1,39 +1,75 @@
1
1
  import { LitElement } from "lit";
2
2
  import "./nys-checkboxgroup";
3
3
  /**
4
- * `<nys-checkbox>` is an accessible, form-associated checkbox component.
5
- * Can be used standalone or within a `<nys-checkboxgroup>`.
4
+ * A checkbox input for binary choices or multi-select lists. Can be used standalone or in a `nys-checkboxgroup`.
5
+ * Form-associated with validation via ElementInternals.
6
6
  *
7
- * Features:
8
- * - Supports labels, descriptions, and tooltips
9
- * - Displays error messages with `showError` and `errorMessage`
10
- * - Keyboard interaction with spacebar toggle
11
- * - Form integration via ElementInternals (`checked` value submitted)
7
+ * Use for binary decisions (agree/disagree) or selecting multiple options from a list.
8
+ * For single selection from 2-6 options, use `nys-radiobutton`. For immediate state changes, use `nys-toggle`.
12
9
  *
13
- * @fires nys-change - Fired when checkbox value changes
14
- * @fires nys-focus - Fired on focus
15
- * @fires nys-blur - Fired on blur
10
+ * @summary Checkbox for binary choices or multi-select options.
11
+ * @element nys-checkbox
16
12
  *
17
- * @slot description - Slot to provide a custom description element
13
+ * @slot description - Custom HTML description content.
14
+ *
15
+ * @fires nys-change - Fired when checked state changes. Detail: `{id, checked, name, value}`.
16
+ * @fires nys-focus - Fired when checkbox gains focus.
17
+ * @fires nys-blur - Fired when checkbox loses focus.
18
+ *
19
+ * @example Single checkbox
20
+ * ```html
21
+ * <nys-checkbox label="I agree to the terms" name="terms" required></nys-checkbox>
22
+ * ```
23
+ *
24
+ * @example Checkbox group
25
+ * ```html
26
+ * <nys-checkboxgroup label="Select landmarks">
27
+ * <nys-checkbox name="landmarks" value="adirondacks" label="Adirondacks"></nys-checkbox>
28
+ * <nys-checkbox name="landmarks" value="niagara" label="Niagara Falls"></nys-checkbox>
29
+ * </nys-checkboxgroup>
30
+ * ```
18
31
  */
19
32
  export declare class NysCheckbox extends LitElement {
20
33
  static styles: import("lit").CSSResult;
34
+ /** Whether checkbox is checked. */
21
35
  checked: boolean;
36
+ /** Prevents interaction. */
22
37
  disabled: boolean;
38
+ /** Marks as required. Validates that checkbox is checked. */
23
39
  required: boolean;
40
+ /** Visible label text. Required for accessibility. */
24
41
  label: string;
42
+ /** Helper text below label. Use slot for custom HTML. */
25
43
  description: string;
44
+ /** Unique identifier. Auto-generated if not provided. */
26
45
  id: string;
46
+ /** Name for form submission. Use same name for grouped checkboxes. */
27
47
  name: string;
48
+ /** Value submitted when checked. */
28
49
  value: string;
50
+ /** Form `id` to associate with when checkbox is outside form element. */
29
51
  form: string | null;
52
+ /** Shows error message when true. */
30
53
  showError: boolean;
54
+ /** Error message text. Shown only when `showError` is true. */
31
55
  errorMessage: string;
56
+ /** Internal: Set by parent checkboxgroup. Do not set manually. */
32
57
  groupExist: boolean;
58
+ /** Renders as tile with larger clickable area. Apply to group for consistency. */
33
59
  tile: boolean;
60
+ /** Adjusts colors for dark backgrounds. */
34
61
  inverted: boolean;
62
+ /** Tooltip text shown on hover/focus of info icon. */
35
63
  tooltip: string;
64
+ /**
65
+ * Checkbox size: `sm` (24px) or `md` (32px, default).
66
+ * @default "md"
67
+ */
36
68
  size: "sm" | "md";
69
+ other: boolean;
70
+ showOtherError: boolean;
71
+ private isMobile;
72
+ private _hasUserInteracted;
37
73
  getInputElement(): Promise<HTMLInputElement | null>;
38
74
  private _internals;
39
75
  /**
@@ -61,6 +97,8 @@ export declare class NysCheckbox extends LitElement {
61
97
  checkValidity(): boolean;
62
98
  private _handleInvalid;
63
99
  private _manageLabelClick;
100
+ get _hasDescription(): boolean;
101
+ private _handleResize;
64
102
  /**
65
103
  * Event Handlers
66
104
  * --------------------------------------------------------------------------
@@ -69,6 +107,10 @@ export declare class NysCheckbox extends LitElement {
69
107
  private _handleChange;
70
108
  private _handleFocus;
71
109
  private _handleBlur;
110
+ private _handleTextInputBlur;
72
111
  private _handleKeydown;
112
+ private _handleTextInput;
113
+ private _validateOtherAndEmitError;
114
+ private _dispatchClearError;
73
115
  render(): import("lit-html").TemplateResult<1>;
74
116
  }
@@ -1,37 +1,59 @@
1
1
  import { LitElement } from "lit";
2
2
  /**
3
- * `<nys-checkboxgroup>` is a form-associated container for multiple `<nys-checkbox>` components.
4
- * Handles grouping, validation, required constraints, form submission, and accessibility.
3
+ * A container for grouping multiple `nys-checkbox` components as a single form control.
4
+ * Handles validation, required constraints, and submits comma-separated values.
5
5
  *
6
- * Features:
7
- * - Manages multiple checkboxes as a single form field
8
- * - Supports required/optional flags and error messages
9
- * - Propagates size, tile, and inverted styling to child checkboxes
10
- * - Keyboard and screen reader accessible via fieldset/legend
6
+ * Use to allow users to select multiple options from a list. Apply `tile`, `size`, and `inverted` to the group
7
+ * and all children inherit these styles automatically.
11
8
  *
12
- * @slot default - Slot for child `<nys-checkbox>` elements
13
- * @slot description - Slot for custom description content
9
+ * @summary Container for grouping checkboxes as a single form control.
10
+ * @element nys-checkboxgroup
14
11
  *
15
- * @fires nys-change - Fired when any child checkbox changes
16
- * @fires nys-focus - Fired when any child checkbox gains focus
17
- * @fires nys-blur - Fired when any child checkbox loses focus
12
+ * @slot - Default slot for `nys-checkbox` elements.
13
+ * @slot description - Custom HTML description content.
14
+ *
15
+ * @example Basic checkbox group
16
+ * ```html
17
+ * <nys-checkboxgroup label="Select landmarks" required>
18
+ * <nys-checkbox name="landmarks" value="adirondacks" label="Adirondacks"></nys-checkbox>
19
+ * <nys-checkbox name="landmarks" value="niagara" label="Niagara Falls"></nys-checkbox>
20
+ * </nys-checkboxgroup>
21
+ * ```
18
22
  */
19
23
  export declare class NysCheckboxgroup extends LitElement {
20
24
  static styles: import("lit").CSSResult;
25
+ /** Unique identifier. Auto-generated if not provided. */
21
26
  id: string;
27
+ /** Name for form submission. Set on group, not individual checkboxes. */
22
28
  name: string;
29
+ /** Requires at least one checkbox to be checked. */
23
30
  required: boolean;
31
+ /** Shows "Optional" flag. */
24
32
  optional: boolean;
33
+ /** Shows error message when true. */
25
34
  showError: boolean;
35
+ /** Error message text. Shown only when `showError` is true. */
26
36
  errorMessage: string;
37
+ /** Visible label text for the group. */
27
38
  label: string;
39
+ /** Helper text below label. Use slot for custom HTML. */
28
40
  description: string;
41
+ /** Renders all checkboxes as tiles with larger clickable area. */
29
42
  tile: boolean;
43
+ /** Tooltip text shown on hover/focus of info icon. */
30
44
  tooltip: string;
45
+ /** Adjusts colors for dark backgrounds. Applied to all children. */
31
46
  inverted: boolean;
47
+ /** Form `id` to associate with. Applied to all children. */
32
48
  form: string | null;
49
+ /**
50
+ * Checkbox size for all children: `sm` (24px) or `md` (32px, default).
51
+ * @default "md"
52
+ */
33
53
  size: "sm" | "md";
34
54
  private _slottedDescriptionText;
55
+ private _hasOtherError;
56
+ private _otherErrorCheckbox;
35
57
  private _internals;
36
58
  /**
37
59
  * Lifecycle methods
@@ -47,20 +69,26 @@ export declare class NysCheckboxgroup extends LitElement {
47
69
  * Functions
48
70
  * --------------------------------------------------------------------------
49
71
  */
72
+ private _hasAtLeastOneChecked;
50
73
  private _setGroupExist;
51
74
  private _setupCheckboxRequired;
52
75
  private _manageRequire;
76
+ private _setCustomOtherError;
53
77
  private _updateCheckboxSize;
54
78
  private _updateCheckboxTile;
55
79
  private _updateCheckboxInvert;
56
80
  private _updateCheckboxShowError;
57
81
  private _updateCheckboxForm;
58
82
  private _getSlotDescriptionForAria;
83
+ formResetCallback(): void;
59
84
  private _handleInvalid;
60
85
  /**
61
86
  * Event Handlers
62
87
  * --------------------------------------------------------------------------
63
88
  */
64
89
  private _handleCheckboxChange;
90
+ private _handleChildError;
91
+ private _handleChildErrorClear;
92
+ private _checkOtherInputs;
65
93
  render(): import("lit-html").TemplateResult<1>;
66
94
  }
@@ -1,35 +1,89 @@
1
1
  import { LitElement } from "lit";
2
2
  /**
3
- * `<nys-datepicker>` is a form-associated, accessible date picker component.
4
- * Optionally wraps a `<wc-datepicker>` for custom calendar UI.
3
+ * Date picker with calendar popup and form validation. Falls back to native date input
4
+ * on Safari and mobile.
5
5
  *
6
- * Events:
7
- * @fires nys-blur - Dispatched when input or calendar loses focus
8
- * @fires nys-input - Dispatched when user selects or types a valid date
6
+ * @summary Date picker with calendar popup and native fallback.
7
+ * @element nys-datepicker
9
8
  *
10
- * Notes:
11
- * - Uses native date input on Safari or mobile devices (custom calendar removed for these scenarios)
9
+ * @fires nys-blur - Fired when input or calendar loses focus. Triggers validation.
10
+ * @fires nys-input - Fired on date selection. Detail: `{id, value}`.
11
+ *
12
+ * @example Basic date picker
13
+ * ```html
14
+ * <nys-datepicker label="Birth Date" required></nys-datepicker>
15
+ * ```
16
+ *
17
+ * @example With width and description
18
+ * ```html
19
+ * <nys-datepicker
20
+ * label="Event Date"
21
+ * description="Select the date of your event"
22
+ * width="lg">
23
+ * </nys-datepicker>
24
+ * ```
25
+ *
26
+ * @example Hide buttons, set start date
27
+ * ```html
28
+ * <nys-datepicker
29
+ * label="Appointment"
30
+ * hideTodayButton
31
+ * hideClearButton
32
+ * startDate="2024-01-01">
33
+ * </nys-datepicker>
34
+ * ```
35
+ *
36
+ * @example With validation error message
37
+ * ```html
38
+ * <nys-datepicker
39
+ * label="Start Date"
40
+ * required
41
+ * errorMessage="Please select a valid start date">
42
+ * </nys-datepicker>
43
+ * ```
12
44
  */
13
45
  export declare class NysDatepicker extends LitElement {
14
46
  static styles: import("lit").CSSResult;
47
+ /** Unique identifier. Auto-generated if not provided. */
15
48
  id: string;
49
+ /** Name for form submission. */
16
50
  name: string;
51
+ /**
52
+ * Input width: `md` (200px), `lg` (384px), `full` (100%).
53
+ * @default "md"
54
+ */
17
55
  width: "md" | "lg" | "full";
56
+ /** Hide the "Today" button in calendar popup. */
18
57
  hideTodayButton: boolean;
58
+ /** Hide the "Clear" button in calendar popup. */
19
59
  hideClearButton: boolean;
60
+ /** Disable interaction. */
20
61
  disabled: boolean;
62
+ /** Mark as required. Shows "Required" flag and validates on blur. */
21
63
  required: boolean;
64
+ /** Show "Optional" flag. Use when most fields are required. */
22
65
  optional: boolean;
66
+ /** Show error state. */
23
67
  showError: boolean;
68
+ /** Error message text. */
24
69
  errorMessage: string;
70
+ /** Form `id` to associate with when input is outside form. */
25
71
  form: string | null;
72
+ /** Tooltip text on info icon hover. */
26
73
  tooltip: string;
74
+ /** Input type. Currently only supports `date`. */
27
75
  type: string;
76
+ /** Label text. Required for accessibility. */
28
77
  label: string;
78
+ /** Helper text below label. */
29
79
  description: string;
80
+ /** Initial date when calendar opens (YYYY-MM-DD). */
30
81
  startDate: string;
82
+ /** Dark background mode. */
31
83
  inverted: boolean;
84
+ /** Selected date. Accepts Date object or ISO string (YYYY-MM-DD). */
32
85
  value: string | Date | undefined;
86
+ private datepickerIsOpen;
33
87
  private _hasUserInteracted;
34
88
  private _internals;
35
89
  /**
@@ -84,6 +138,8 @@ export declare class NysDatepicker extends LitElement {
84
138
  private _replaceButtonSVG;
85
139
  private _addMonthDropdownIcon;
86
140
  private _parseLocalDate;
141
+ private _setTodayDate;
142
+ private _setFocusOnTodayDate;
87
143
  /**
88
144
  * Event Handlers
89
145
  * --------------------------------------------------------------------------
@@ -91,6 +147,7 @@ export declare class NysDatepicker extends LitElement {
91
147
  private _handleInputKeydown;
92
148
  private _handleBlur;
93
149
  private _onDocumentClick;
150
+ private _onKeydownEsc;
94
151
  private _toggleDatepicker;
95
152
  private _openDatepicker;
96
153
  private _handleDateChange;
@@ -98,6 +155,7 @@ export declare class NysDatepicker extends LitElement {
98
155
  private _handleClearClick;
99
156
  private _handleInputChange;
100
157
  private _getValidDateFromInput;
158
+ private _handleFocusTrap;
101
159
  private _isSafari;
102
160
  /**
103
161
  * Determines whether the current device uses a coarse pointer.
@@ -1,11 +1,29 @@
1
1
  import { LitElement } from "lit";
2
2
  /**
3
- * `<nys-divider>` renders a horizontal rule `<hr>` element with optional styling.
4
- * Can be inverted for dark backgrounds.
3
+ * A horizontal rule for visual separation between content sections. Renders a semantic `<hr>` element.
4
+ *
5
+ * Use to separate distinct content areas within a page. Set `inverted` for use on dark backgrounds.
6
+ *
7
+ * @summary Horizontal divider for visual separation of content sections.
8
+ * @element nys-divider
9
+ *
10
+ * @example Basic divider
11
+ * ```html
12
+ * <p>Section one content</p>
13
+ * <nys-divider></nys-divider>
14
+ * <p>Section two content</p>
15
+ * ```
5
16
  */
6
17
  export declare class NysDivider extends LitElement {
7
18
  static styles: import("lit").CSSResult;
19
+ /** Adjusts colors for dark backgrounds. */
8
20
  inverted: boolean;
9
21
  constructor();
22
+ connectedCallback(): void;
23
+ /**
24
+ * Functions
25
+ * --------------------------------------------------------------------------
26
+ */
27
+ private _generateUniqueId;
10
28
  render(): import("lit-html").TemplateResult<1>;
11
29
  }
@@ -1,13 +1,20 @@
1
1
  import { LitElement } from "lit";
2
2
  /**
3
- * THIS IS A PRIVATE COMPONENT!
4
- * `<nys-errormessage>` displays an error message for form elements.
5
- * Can optionally show a divider and supports native form validation messages.
3
+ * **Internal component.** Displays error messages for form validation with icon and ARIA alert role.
4
+ *
5
+ * Used internally by form components. Not intended for direct use. Shows error icon and message
6
+ * when `showError` is true. Integrates with ElementInternals for native form validation messages.
7
+ *
8
+ * @summary Internal error message display with icon and ARIA alert support.
9
+ * @element nys-errormessage
6
10
  */
7
11
  export declare class NysErrorMessage extends LitElement {
8
12
  static styles: import("lit").CSSResult;
13
+ /** Whether to display the error message. */
9
14
  showError: boolean;
15
+ /** Error text to display. Falls back to native validation message if available. */
10
16
  errorMessage: string;
17
+ /** Shows a divider line above the error message. */
11
18
  showDivider: boolean;
12
19
  private _internals;
13
20
  /**