@nysds/components 1.13.1 → 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.
@@ -11,6 +11,10 @@ import "./nys-accordionitem";
11
11
  *
12
12
  * @slot - Default slot for `nys-accordionitem` elements.
13
13
  *
14
+ * @cssprop [--nys-accordion-background-color--header] - Background color of the accordion header.
15
+ * @cssprop [--nys-accordion-background-color--header--hover] - Background hover color of the accordion header.
16
+ * @cssprop [--nys-accordion-content-max-width] - Maximum readable width of accordion content. Defaults to a character-based width (80ch) for readability.
17
+ *
14
18
  * @example Basic accordion
15
19
  * ```html
16
20
  * <nys-accordion>
@@ -66,6 +66,10 @@ export declare class NysCheckbox extends LitElement {
66
66
  * @default "md"
67
67
  */
68
68
  size: "sm" | "md";
69
+ other: boolean;
70
+ showOtherError: boolean;
71
+ private isMobile;
72
+ private _hasUserInteracted;
69
73
  getInputElement(): Promise<HTMLInputElement | null>;
70
74
  private _internals;
71
75
  /**
@@ -93,6 +97,8 @@ export declare class NysCheckbox extends LitElement {
93
97
  checkValidity(): boolean;
94
98
  private _handleInvalid;
95
99
  private _manageLabelClick;
100
+ get _hasDescription(): boolean;
101
+ private _handleResize;
96
102
  /**
97
103
  * Event Handlers
98
104
  * --------------------------------------------------------------------------
@@ -101,6 +107,10 @@ export declare class NysCheckbox extends LitElement {
101
107
  private _handleChange;
102
108
  private _handleFocus;
103
109
  private _handleBlur;
110
+ private _handleTextInputBlur;
104
111
  private _handleKeydown;
112
+ private _handleTextInput;
113
+ private _validateOtherAndEmitError;
114
+ private _dispatchClearError;
105
115
  render(): import("lit-html").TemplateResult<1>;
106
116
  }
@@ -52,6 +52,8 @@ export declare class NysCheckboxgroup extends LitElement {
52
52
  */
53
53
  size: "sm" | "md";
54
54
  private _slottedDescriptionText;
55
+ private _hasOtherError;
56
+ private _otherErrorCheckbox;
55
57
  private _internals;
56
58
  /**
57
59
  * Lifecycle methods
@@ -67,9 +69,11 @@ export declare class NysCheckboxgroup extends LitElement {
67
69
  * Functions
68
70
  * --------------------------------------------------------------------------
69
71
  */
72
+ private _hasAtLeastOneChecked;
70
73
  private _setGroupExist;
71
74
  private _setupCheckboxRequired;
72
75
  private _manageRequire;
76
+ private _setCustomOtherError;
73
77
  private _updateCheckboxSize;
74
78
  private _updateCheckboxTile;
75
79
  private _updateCheckboxInvert;
@@ -83,5 +87,8 @@ export declare class NysCheckboxgroup extends LitElement {
83
87
  * --------------------------------------------------------------------------
84
88
  */
85
89
  private _handleCheckboxChange;
90
+ private _handleChildError;
91
+ private _handleChildErrorClear;
92
+ private _checkOtherInputs;
86
93
  render(): import("lit-html").TemplateResult<1>;
87
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.
@@ -26,5 +26,10 @@ export declare class NysLabel extends LitElement {
26
26
  get tooltip(): string;
27
27
  set tooltip(value: string);
28
28
  private _tooltip;
29
+ /**
30
+ * Event Handlers
31
+ * --------------------------------------------------------------------------
32
+ */
33
+ private _handleLabelClick;
29
34
  render(): import("lit-html").TemplateResult<1>;
30
35
  }
@@ -52,6 +52,10 @@ export declare class NysRadiobutton extends LitElement {
52
52
  size: "sm" | "md";
53
53
  /** Renders as tile with larger clickable area. */
54
54
  tile: boolean;
55
+ other: boolean;
56
+ showOtherError: boolean;
57
+ private isMobile;
58
+ private _hasUserInteracted;
55
59
  static buttonGroup: Record<string, NysRadiobutton>;
56
60
  /**
57
61
  * Lifecycle methods
@@ -66,6 +70,8 @@ export declare class NysRadiobutton extends LitElement {
66
70
  */
67
71
  getInputElement(): Promise<HTMLInputElement | null>;
68
72
  formResetUpdate(): void;
73
+ private _handleResize;
74
+ private _clearOtherState;
69
75
  /**
70
76
  * Event Handlers
71
77
  * --------------------------------------------------------------------------
@@ -75,5 +81,9 @@ export declare class NysRadiobutton extends LitElement {
75
81
  private _handleFocus;
76
82
  private _handleBlur;
77
83
  private _callInputHandling;
84
+ private _handleTextInput;
85
+ private _handleTextInputBlur;
86
+ private _validateOtherAndEmitError;
87
+ private _handleOtherKeydown;
78
88
  render(): import("lit-html").TemplateResult<1>;
79
89
  }
@@ -95,5 +95,6 @@ export declare class NysRadiogroup extends LitElement {
95
95
  */
96
96
  private _handleRadioButtonChange;
97
97
  private _handleInvalid;
98
+ private _handleChildError;
98
99
  render(): import("lit-html").TemplateResult<1>;
99
100
  }
@@ -22,7 +22,7 @@ import { LitElement } from "lit";
22
22
  * <nys-textinput label="Full Name" required></nys-textinput>
23
23
  * ```
24
24
  *
25
- * @example Email with validation
25
+ * @example Required Email
26
26
  * ```html
27
27
  * <nys-textinput type="email" label="Email Address" required></nys-textinput>
28
28
  * ```
@@ -74,6 +74,8 @@ export declare class NysTextinput extends LitElement {
74
74
  pattern: string;
75
75
  /** Maximum character length. */
76
76
  maxlength: number | null;
77
+ /** Accessible label. When set, assuming "label" isn't provided for private special cases (i.e., <checkbox other>). */
78
+ ariaLabel: string;
77
79
  /**
78
80
  * Input width: `sm` (88px), `md` (200px), `lg` (384px), `full` (100%, default).
79
81
  * @default "full"
@@ -106,6 +108,7 @@ export declare class NysTextinput extends LitElement {
106
108
  disconnectedCallback(): void;
107
109
  firstUpdated(): void;
108
110
  updated(changedProperties: Map<string | number | symbol, unknown>): Promise<void>;
111
+ focus(): void;
109
112
  /**
110
113
  * Form Integration
111
114
  * --------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/components",
3
- "version": "1.13.1",
3
+ "version": "1.14.0",
4
4
  "description": "New York State's design system and code component library.",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -27,10 +27,10 @@
27
27
  "build": "tsc --emitDeclarationOnly && vite build",
28
28
  "build:umd": "tsc --emitDeclarationOnly && vite build --config vite.config.umd.js",
29
29
  "build:packages": "node src/scripts/build-order.js",
30
- "build:all": "npm run clean:dist && npm run lint && cross-env NODE_ENV=production npm run build:packages && cross-env NODE_ENV=production npm run build && cross-env NODE_ENV=production npm run build:umd && npm run lit-analyze || true && npm run cem && npm run cem:copy",
30
+ "build:all": "npm run clean:dist && npm run lint && cross-env NODE_ENV=production npm run build:packages && cross-env NODE_ENV=production npm run build && cross-env NODE_ENV=production npm run build:umd && npm run lit-analyze || true && npm run cem && npm run cem:copy && npm run mcp-server:build",
31
31
  "build:link": "npm run build:all && npm link",
32
- "lint": "eslint",
33
- "lint:fix": "eslint --fix",
32
+ "lint": "eslint && stylelint **/*.scss || true",
33
+ "lint:fix": "eslint --fix && stylelint **/*.scss --fix",
34
34
  "lit-analyze": "find ./packages/nys-*/ -name '*.ts' ! -name '*.figma.*' | xargs lit-analyzer {}",
35
35
  "release": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && cross-env NODE_ENV=production npm publish --workspaces --access public && cross-env NODE_ENV=production npm publish --access public",
36
36
  "release:dry-run": "cross-env NODE_ENV=production npm run build:all && cross-env NODE_ENV=production npm run test && npm run cem && node src/scripts/publish-dry-run.js",
@@ -41,8 +41,9 @@
41
41
  "storybook:build:all": "cross-env NODE_ENV=production npm run build:all && npm run storybook",
42
42
  "build-storybook": "npm run build:packages && storybook build",
43
43
  "storybook:cibuild": "storybook build",
44
+ "mcp-server:build": "node src/scripts/build-mcp-server.js",
44
45
  "clean:node": "rm -rf node_modules && rm -rf packages/*/node_modules && rm -rf packages/**/*/node_modules",
45
- "clean:dist": "rm -rf storybook-static && rm -rf coverage && rm -rf packages/*/coverage && rm -rf dist && rm -rf packages/*/dist && rm -rf packages/**/*/dist",
46
+ "clean:dist": "rm -rf storybook-static && rm -rf coverage && rm -rf packages/*/coverage && rm -rf dist && find packages -type d -name dist ! -path '*/mcp-server/dist' -exec rm -rf {} + 2>/dev/null || true",
46
47
  "clean:all": "npm run clean:dist && npm run clean:node",
47
48
  "code-connect": "dotenv -- npx figma connect publish",
48
49
  "cem": "npx cem analyze --config ./custom-elements-manifest.config.mjs",
@@ -59,15 +60,15 @@
59
60
  },
60
61
  "homepage": "https://designsystem.ny.gov/",
61
62
  "devDependencies": {
62
- "@chromatic-com/storybook": "^5.0.0",
63
+ "@chromatic-com/storybook": "^5.0.1",
63
64
  "@custom-elements-manifest/analyzer": "^0.11.0",
64
- "@figma/code-connect": "^1.3.7",
65
+ "@figma/code-connect": "^1.4.0",
65
66
  "@floating-ui/dom": "^1.7.4",
66
67
  "@open-wc/testing": "^4.0.0",
67
- "@storybook/addon-a11y": "10.2.0",
68
- "@storybook/addon-docs": "10.2.0",
69
- "@storybook/addon-links": "10.2.0",
70
- "@storybook/web-components-vite": "10.2.0",
68
+ "@storybook/addon-a11y": "10.2.10",
69
+ "@storybook/addon-docs": "10.2.10",
70
+ "@storybook/addon-links": "10.2.10",
71
+ "@storybook/web-components-vite": "10.2.10",
71
72
  "@types/mocha": "^10.0.10",
72
73
  "@typescript-eslint/eslint-plugin": "^8.46.2",
73
74
  "@typescript-eslint/parser": "^8.46.2",
@@ -80,10 +81,10 @@
80
81
  "custom-element-react-wrappers": "^1.7.3",
81
82
  "custom-element-vs-code-integration": "^1.5.0",
82
83
  "dotenv-cli": "^10.0.0",
83
- "eslint": "^9.38.0",
84
- "eslint-plugin-lit": "^2.1.1",
85
- "eslint-plugin-prettier": "^5.5.4",
86
- "eslint-plugin-storybook": "10.2.0",
84
+ "eslint": "^10.0.0",
85
+ "eslint-plugin-lit": "^2.2.1",
86
+ "eslint-plugin-prettier": "^5.5.5",
87
+ "eslint-plugin-storybook": "10.2.10",
87
88
  "i": "^0.3.7",
88
89
  "lit": "^3.3.1",
89
90
  "lit-analyzer": "^2.0.3",
@@ -93,10 +94,13 @@
93
94
  "rollup-plugin-visualizer": "^6.0.5",
94
95
  "sass": "^1.94.0",
95
96
  "sinon": "^21.0.0",
96
- "storybook": "10.2.0",
97
+ "storybook": "10.2.10",
98
+ "stylelint": "^17.1.1",
99
+ "stylelint-config-standard": "^40.0.0",
100
+ "stylelint-config-standard-scss": "^17.0.0",
97
101
  "tslib": "^2.8.1",
98
102
  "typescript": "^5.9.3",
99
- "vite": "^7.2.2"
103
+ "vite": "^7.3.1"
100
104
  },
101
105
  "eslintConfig": {
102
106
  "extends": [