@nysds/nys-checkbox 1.18.1 → 1.19.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/dist/nys-checkbox.js +8 -10
- package/dist/nys-checkbox.js.map +1 -1
- package/package.json +4 -4
package/dist/nys-checkbox.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ifDefined as u } from "lit/directives/if-defined.js";
|
|
|
6
6
|
* █ █ █ █▄▄▄█ ▀▀▀▄▄ █ █ ▀▀▀▄▄
|
|
7
7
|
* █ ▀█ █ █▄▄▄█ █▄▄▀ █▄▄▄█
|
|
8
8
|
*
|
|
9
|
-
* Checkbox Component v1.
|
|
9
|
+
* Checkbox Component v1.19.0
|
|
10
10
|
* Part of the New York State Design System
|
|
11
11
|
* Repository: https://github.com/its-hcd/nysds
|
|
12
12
|
* License: MIT
|
|
@@ -271,15 +271,15 @@ let C = 0;
|
|
|
271
271
|
const k = class k extends _ {
|
|
272
272
|
// allows use of elementInternals' API
|
|
273
273
|
constructor() {
|
|
274
|
-
super(), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this.form = null, this.showError = !1, this.errorMessage = "", this.groupExist = !1, this.tile = !1, this.tooltip = "", this.size = "md", this.other = !1, this.showOtherError = !1, this.
|
|
274
|
+
super(), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this.form = null, this.showError = !1, this.errorMessage = "", this.groupExist = !1, this.tile = !1, this.tooltip = "", this.size = "md", this.other = !1, this.showOtherError = !1, this._mobileQuery = window.matchMedia("(max-width: 479px)"), this.isMobile = this._mobileQuery.matches, this._hasUserInteracted = !1, this._manageLabelClick = () => {
|
|
275
275
|
const e = this.shadowRoot?.querySelector(
|
|
276
276
|
".nys-checkbox__main-container"
|
|
277
277
|
), t = this.shadowRoot?.querySelector("input");
|
|
278
278
|
!e || !t || e.addEventListener("click", (r) => {
|
|
279
279
|
r.target.tagName.toLowerCase() !== "input" && (this.disabled || (t.click(), t.focus()));
|
|
280
280
|
});
|
|
281
|
-
}, this.
|
|
282
|
-
this.isMobile =
|
|
281
|
+
}, this._handleMobileQuery = () => {
|
|
282
|
+
this.isMobile = this._mobileQuery.matches;
|
|
283
283
|
}, this._internals = this.attachInternals();
|
|
284
284
|
}
|
|
285
285
|
// need this flag for "eager mode"
|
|
@@ -288,10 +288,10 @@ const k = class k extends _ {
|
|
|
288
288
|
}
|
|
289
289
|
// Generate a unique ID if one is not provided
|
|
290
290
|
connectedCallback() {
|
|
291
|
-
super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${C++}`), this.addEventListener("invalid", this._handleInvalid), this.addEventListener("blur", this._handleBlur),
|
|
291
|
+
super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${C++}`), this.addEventListener("invalid", this._handleInvalid), this.addEventListener("blur", this._handleBlur), this._mobileQuery.addEventListener("change", this._handleMobileQuery);
|
|
292
292
|
}
|
|
293
293
|
disconnectedCallback() {
|
|
294
|
-
super.disconnectedCallback(), this.removeEventListener("invalid", this._handleInvalid), this.removeEventListener("blur", this._handleBlur),
|
|
294
|
+
super.disconnectedCallback(), this.removeEventListener("invalid", this._handleInvalid), this.removeEventListener("blur", this._handleBlur), this._mobileQuery.removeEventListener("change", this._handleMobileQuery);
|
|
295
295
|
}
|
|
296
296
|
firstUpdated() {
|
|
297
297
|
this._setValue(), this._manageRequire(), this._manageLabelClick();
|
|
@@ -353,10 +353,6 @@ const k = class k extends _ {
|
|
|
353
353
|
const e = this.querySelector('[slot="description"]');
|
|
354
354
|
return !!this.description || !!e;
|
|
355
355
|
}
|
|
356
|
-
/**
|
|
357
|
-
* Event Handlers
|
|
358
|
-
* --------------------------------------------------------------------------
|
|
359
|
-
*/
|
|
360
356
|
_emitChangeEvent() {
|
|
361
357
|
this.dispatchEvent(
|
|
362
358
|
new CustomEvent("nys-change", {
|
|
@@ -469,6 +465,7 @@ const k = class k extends _ {
|
|
|
469
465
|
</div>
|
|
470
466
|
${(this.label || this.other) && d`
|
|
471
467
|
<nys-label
|
|
468
|
+
aria-hidden="true"
|
|
472
469
|
tooltip=${this.tooltip}
|
|
473
470
|
label="${this.label || (this.other ? "Other" : "")}"
|
|
474
471
|
description=${u(this.description || void 0)}
|
|
@@ -490,6 +487,7 @@ const k = class k extends _ {
|
|
|
490
487
|
ariaLabel="Other"
|
|
491
488
|
aria-invalid=${this.showOtherError ? "true" : "false"}
|
|
492
489
|
width=${this.isMobile ? "full" : "md"}
|
|
490
|
+
?disabled=${this.disabled}
|
|
493
491
|
></nys-textinput>
|
|
494
492
|
` : ""}
|
|
495
493
|
</div>
|
package/dist/nys-checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nys-checkbox.js","sources":["../src/nys-checkboxgroup.ts","../src/nys-checkbox.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\nimport type { NysCheckbox } from \"./nys-checkbox\";\n\nlet checkboxgroupIdCounter = 0;\n\n/**\n * A container for grouping multiple `nys-checkbox` components as a single form control.\n * Handles validation, required constraints, and submits comma-separated values.\n *\n * Use to allow users to select multiple options from a list. Apply `tile` and `size` to the group\n * and all children inherit these styles automatically.\n *\n * @summary Container for grouping checkboxes as a single form control.\n * @element nys-checkboxgroup\n *\n * @slot - Default slot for `nys-checkbox` elements.\n * @slot description - Custom HTML description content.\n *\n * @example Basic checkbox group\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" required>\n * <nys-checkbox name=\"landmarks\" value=\"adirondacks\" label=\"Adirondacks\"></nys-checkbox>\n * <nys-checkbox name=\"landmarks\" value=\"niagara\" label=\"Niagara Falls\"></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n */\n\nexport class NysCheckboxgroup extends LitElement {\n static styles = unsafeCSS(styles);\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /** Unique identifier. Auto-generated if not provided. */\n @property({ type: String, reflect: true }) id = \"\";\n\n /** Name for form submission. Set on group, not individual checkboxes. */\n @property({ type: String, reflect: true }) name = \"\";\n\n /** Requires at least one checkbox to be checked. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Shows \"Optional\" flag. */\n @property({ type: Boolean, reflect: true }) optional = false;\n\n /** Shows error message when true. */\n @property({ type: Boolean, reflect: true }) showError = false;\n\n /** Error message text. Shown only when `showError` is true. */\n @property({ type: String }) errorMessage = \"\";\n\n /** Visible label text for the group. */\n @property({ type: String }) label = \"\";\n\n /** Helper text below label. Use slot for custom HTML. */\n @property({ type: String }) description = \"\";\n\n /** Renders all checkboxes as tiles with larger clickable area. */\n @property({ type: Boolean, reflect: true }) tile = false;\n\n /** Tooltip text shown on hover/focus of info icon. */\n @property({ type: String }) tooltip = \"\";\n\n /** Form `id` to associate with. Applied to all children. */\n @property({ type: String, reflect: true }) form: string | null = null;\n\n /**\n * Checkbox size for all children: `sm` (24px) or `md` (32px, default).\n * @default \"md\"\n */\n @property({ type: String, reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n @state() private _slottedDescriptionText = \"\";\n @state() private _hasOtherError = false;\n @state() private _otherErrorCheckbox: NysCheckbox | null = null;\n\n private _internals: ElementInternals;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n */\n\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkboxgroup-${Date.now()}-${checkboxgroupIdCounter++}`;\n }\n this.addEventListener(\"nys-change\", this._handleCheckboxChange);\n this.addEventListener(\"nys-other-input\", this._handleOtherInput);\n this.addEventListener(\"invalid\", this._handleInvalid);\n this.addEventListener(\"nys-error\", this._handleChildError);\n this.addEventListener(\"nys-error-clear\", this._handleChildErrorClear);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"nys-change\", this._handleCheckboxChange);\n this.removeEventListener(\"nys-other-input\", this._handleOtherInput);\n this.removeEventListener(\"invalid\", this._handleInvalid);\n this.removeEventListener(\"nys-error\", this._handleChildError);\n this.removeEventListener(\"nys-error-clear\", this._handleChildErrorClear);\n }\n\n firstUpdated() {\n // This ensures our checkboxes sets the value only once for formData (not within the individual checkboxes)\n this._setGroupExist();\n this._updateCheckboxSize();\n this._updateCheckboxTile();\n this._updateCheckboxShowError();\n this._getSlotDescriptionForAria();\n }\n\n updated(changedProperties: Map<string | symbol, unknown>) {\n if (changedProperties.has(\"required\")) {\n if (this.required) {\n this._setupCheckboxRequired();\n }\n }\n if (changedProperties.has(\"size\")) {\n this._updateCheckboxSize();\n }\n if (changedProperties.has(\"tile\")) {\n this._updateCheckboxTile();\n }\n if (changedProperties.has(\"showError\")) {\n this._updateCheckboxShowError();\n }\n if (changedProperties.has(\"form\")) {\n this._updateCheckboxForm();\n }\n }\n\n /**\n * Functions\n * --------------------------------------------------------------------------\n */\n\n private _hasAtLeastOneChecked() {\n return Array.from(this.querySelectorAll(\"nys-checkbox\")).some(\n (checkbox: any) => checkbox.checked,\n );\n }\n\n private _setGroupExist() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox: any) => {\n checkbox.groupExist = true;\n });\n }\n\n // Initial update on checkbox required attribute\n private async _setupCheckboxRequired() {\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const message = this.errorMessage || \"This field is required\";\n\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ? firstCheckboxInput : this,\n );\n }\n\n // Updates the required attribute of each checkbox in the group\n private async _manageRequire() {\n if (!this.required) return;\n\n const message =\n this.errorMessage || \"You must make a selection to proceed.\";\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as any[];\n\n // Loop through each child checkbox to see if one is checked.\n const atLeastOneChecked = this._hasAtLeastOneChecked();\n\n const firstCheckboxInput = checkboxes\n ? await checkboxes[0].getInputElement().catch(() => null)\n : null;\n\n // Always clear validation first to prevent message lingering\n this._internals.setValidity({});\n this.showError = false;\n\n if (!atLeastOneChecked) {\n // Only set valueMissing if there's no active \"other\" error\n // If there IS an \"other\" error, keep that as the primary error\n if (!this._hasOtherError) {\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ?? this,\n );\n this.showError = true;\n } else {\n // Re-set the other error since we just cleared everything\n this._setCustomOtherError();\n this.showError = true;\n }\n } else {\n // At least one checkbox is checked\n // If there's an \"other\" error, reset it since we cleared everything above\n if (this._hasOtherError && this._otherErrorCheckbox) {\n this._setCustomOtherError();\n this.showError = true;\n }\n }\n }\n\n private _setCustomOtherError() {\n const textInput =\n this._otherErrorCheckbox?.shadowRoot?.querySelector(\"nys-textinput\");\n const targetElement = textInput || this._otherErrorCheckbox;\n this._internals.setValidity(\n { customError: true },\n \"Please complete this field.\",\n targetElement as HTMLElement,\n );\n }\n\n // Updates the size of each checkbox in the group\n private _updateCheckboxSize() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n checkbox.setAttribute(\"size\", this.size);\n });\n }\n\n private _updateCheckboxTile() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.tile) {\n checkbox.toggleAttribute(\"tile\", true);\n } else {\n checkbox.removeAttribute(\"tile\");\n }\n });\n }\n\n private _updateCheckboxShowError() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.showError) {\n checkbox.setAttribute(\"showError\", \"\");\n } else {\n checkbox.removeAttribute(\"showError\");\n }\n });\n }\n\n private _updateCheckboxForm() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.showError) {\n if (this.form !== null) {\n checkbox.setAttribute(\"form\", this.form);\n } else {\n checkbox.removeAttribute(\"form\");\n }\n } else {\n checkbox.removeAttribute(\"form\");\n }\n });\n }\n\n // Get the slotted text contents so native VO can attempt to announce it within the legend in the fieldset\n private _getSlotDescriptionForAria() {\n const slot = this.shadowRoot?.querySelector(\n 'slot[name=\"description\"]',\n ) as HTMLSlotElement;\n const nodes = slot?.assignedNodes({ flatten: true }) || [];\n\n this._slottedDescriptionText = nodes\n .map((node) => node.textContent?.trim())\n .filter(Boolean)\n .join(\", \");\n }\n\n // This callback is automatically called when the parent form is reset.\n public formResetCallback() {\n // Reset all child checkboxes\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox: any) => {\n checkbox.formResetCallback();\n });\n\n this._internals.setFormValue(\"\");\n\n // Reset validation UI\n this.showError = false;\n this._internals.setValidity({});\n\n // Re-render UI\n this.requestUpdate();\n }\n\n private async _handleInvalid(event: Event) {\n event.preventDefault();\n\n // Priority 1: Focus \"other\" text input when customError is set\n if (this._internals.validity.customError) {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n\n const otherCheckbox = checkboxes.find(\n (checkbox) => checkbox.other && checkbox.checked,\n );\n\n if (otherCheckbox) {\n const textInput =\n otherCheckbox.shadowRoot?.querySelector(\"nys-textinput\");\n\n if (textInput) {\n await (textInput as any).updateComplete;\n (textInput as HTMLElement).focus();\n return;\n }\n }\n }\n\n // Priority 2: Handle valueMissing (required validation)\n this.showError = true;\n await this._manageRequire(); // Refresh validation message\n\n // Fallback behavior\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n if (firstCheckboxInput) {\n // Focus only if this is the first invalid element (top-down approach)\n const form = this._internals.form;\n if (form) {\n const elements = Array.from(form.elements) as Array<\n HTMLElement & { checkValidity?: () => boolean }\n >;\n // Find the first element in the form that is invalid\n const firstInvalidElement = elements.find((element) => {\n // If element is <nys-checkboxgroup>, we see if anyone checkboxes within the group is checked to fulfill required constraint\n if (element.tagName.toLowerCase() === \"nys-checkboxgroup\") {\n const allCheckboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as any[];\n const hasCheckedCheckbox = allCheckboxes.filter(\n (checkbox) => checkbox.checked,\n );\n // Required constraint not met, continue logic to have this component be focused\n if (hasCheckedCheckbox.length === 0) {\n return element;\n }\n } else {\n return (\n typeof element.checkValidity === \"function\" &&\n !element.checkValidity()\n );\n }\n });\n\n if (firstInvalidElement === this) {\n firstCheckboxInput.focus();\n }\n } else {\n // If not part of a form, simply focus.\n firstCheckboxInput.focus();\n }\n }\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n // Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.\n private _handleCheckboxChange(event: Event) {\n const customEvent = event as CustomEvent;\n const { name } = customEvent.detail;\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n\n // Filter to only the checked ones and extract their values.\n const selectedValues = checkboxes\n .filter((checkbox: any) => checkbox.checked)\n .map((checkbox: any) => checkbox.value);\n\n this.name = name;\n this._internals.setFormValue(selectedValues.join(\", \"));\n\n // Check \"other\" inputs first (they take priority)\n this._checkOtherInputs(checkboxes);\n\n // Only run required validation if no \"other\" error is active\n if (!this._hasOtherError) {\n this._manageRequire();\n }\n }\n\n private async _handleChildError(event: Event) {\n event.stopPropagation();\n\n const { sourceCheckbox } = (event as CustomEvent).detail;\n if (!sourceCheckbox) return;\n\n // Track which checkbox has the error\n this._hasOtherError = true;\n this._otherErrorCheckbox = sourceCheckbox;\n this.showError = true;\n\n this._setCustomOtherError();\n }\n\n private _handleChildErrorClear(event: Event) {\n const customEvent = event as CustomEvent;\n const sourceCheckbox = customEvent.detail?.sourceCheckbox;\n\n if (\n this._otherErrorCheckbox &&\n sourceCheckbox !== this._otherErrorCheckbox\n ) {\n return;\n }\n\n // Clear the old validation state first so to prevent the old customError message from persisting\n this._hasOtherError = false;\n this._otherErrorCheckbox = null;\n this._internals.setValidity({});\n this.showError = false;\n\n // Then check if we need to set a new required error\n if (this.required && !this._hasAtLeastOneChecked()) {\n this._manageRequire();\n }\n }\n\n private _handleOtherInput() {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n const selectedValues = checkboxes\n .filter((checkbox: any) => checkbox.checked)\n .map((checkbox: any) => checkbox.value);\n this._internals.setFormValue(selectedValues.join(\", \"));\n }\n\n private async _checkOtherInputs(checkboxes: NysCheckbox[]) {\n for (const checkbox of checkboxes) {\n if (checkbox.checked && checkbox.other) {\n const value = checkbox.value.trim();\n\n const hasUserInteracted = (checkbox as any)._hasUserInteracted;\n\n if (!hasUserInteracted) {\n // User hasn't interacted yet, skip validation\n continue;\n }\n\n if (!value || value === \"\") {\n this._hasOtherError = true;\n this._otherErrorCheckbox = checkbox;\n this._setCustomOtherError();\n this.showError = true;\n return;\n }\n }\n }\n\n // If we reached here, no other invalid \"other\" was found.\n // Clear any previous \"other\" error\n if (this._hasOtherError) {\n this._hasOtherError = false;\n this._otherErrorCheckbox = null;\n\n // Re-check required constraint\n if (this.required) {\n this._manageRequire();\n } else {\n this._internals.setValidity({});\n this.showError = false;\n }\n }\n }\n\n render() {\n return html`\n <fieldset\n aria-label=\"${this.label}${this._slottedDescriptionText\n ? ` ${this._slottedDescriptionText}`\n : this.description\n ? ` ${this.description}`\n : \"\"}\"\n class=\"nys-checkboxgroup\"\n role=\"radiogroup\"\n >\n <nys-label\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this.tooltip}\n >\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n </nys-label>\n <div class=\"nys-checkboxgroup__content\">\n <slot></slot>\n </div>\n <nys-errormessage\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage || this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>\n </fieldset>\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkboxgroup\")) {\n customElements.define(\"nys-checkboxgroup\", NysCheckboxgroup);\n}\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport \"./nys-checkboxgroup\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\nlet checkboxIdCounter = 0;\n\n/**\n * A checkbox input for binary choices or multi-select lists. Can be used standalone or in a `nys-checkboxgroup`.\n * Form-associated with validation via ElementInternals.\n *\n * Use for binary decisions (agree/disagree) or selecting multiple options from a list.\n * For single selection from 2-6 options, use `nys-radiobutton`. For immediate state changes, use `nys-toggle`.\n *\n * @summary Checkbox for binary choices or multi-select options.\n * @element nys-checkbox\n *\n * @slot description - Custom HTML description content.\n *\n * @fires nys-change - Fired when checked state changes. Detail: `{id, checked, name, value}`.\n * @fires nys-focus - Fired when checkbox gains focus.\n * @fires nys-blur - Fired when checkbox loses focus.\n * @fires nys-other-input - Fired when \"other\" text input value changes. Detail: `{id, name, value}`.\n *\n * @example Single checkbox\n * ```html\n * <nys-checkbox label=\"I agree to the terms\" name=\"terms\" required></nys-checkbox>\n * ```\n *\n * @example Checkbox group\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\">\n * <nys-checkbox name=\"landmarks\" value=\"adirondacks\" label=\"Adirondacks\"></nys-checkbox>\n * <nys-checkbox name=\"landmarks\" value=\"niagara\" label=\"Niagara Falls\"></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n */\n\nexport class NysCheckbox extends LitElement {\n static styles = unsafeCSS(styles);\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /** Whether checkbox is checked. */\n @property({ type: Boolean, reflect: true }) checked = false;\n\n /** Prevents interaction. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Marks as required. Validates that checkbox is checked. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Visible label text. Required for accessibility. */\n @property({ type: String }) label = \"\";\n\n /** Helper text below label. Use slot for custom HTML. */\n @property({ type: String }) description = \"\";\n\n /** Unique identifier. Auto-generated if not provided. */\n @property({ type: String, reflect: true }) id = \"\";\n\n /** Name for form submission. Use same name for grouped checkboxes. */\n @property({ type: String, reflect: true }) name = \"\";\n\n /** Value submitted when checked. */\n @property({ type: String }) value = \"\";\n\n /** Form `id` to associate with when checkbox is outside form element. */\n @property({ type: String, reflect: true }) form: string | null = null;\n\n /** Shows error message when true. */\n @property({ type: Boolean, reflect: true }) showError = false;\n\n /** Error message text. Shown only when `showError` is true. */\n @property({ type: String }) errorMessage = \"\";\n\n /** Internal: Set by parent checkboxgroup. Do not set manually. */\n @property({ type: Boolean }) groupExist = false;\n\n /** Renders as tile with larger clickable area. Apply to group for consistency. */\n @property({ type: Boolean, reflect: true }) tile = false;\n\n /** Tooltip text shown on hover/focus of info icon. */\n @property({ type: String }) tooltip = \"\";\n\n /**\n * Checkbox size: `sm` (24px) or `md` (32px, default).\n * @default \"md\"\n */\n @property({ type: String, reflect: true }) size: \"sm\" | \"md\" = \"md\";\n @property({ type: Boolean, reflect: true }) other = false;\n @property({ type: Boolean }) showOtherError = false;\n @state() private isMobile = window.innerWidth < 480;\n\n private _hasUserInteracted = false; // need this flag for \"eager mode\"\n\n public async getInputElement(): Promise<HTMLInputElement | null> {\n await this.updateComplete; // Wait for the component to finish rendering\n return this.shadowRoot?.querySelector(\"input\") || null;\n }\n\n private _internals: ElementInternals;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n */\n\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkbox-${Date.now()}-${checkboxIdCounter++}`;\n }\n this.addEventListener(\"invalid\", this._handleInvalid);\n this.addEventListener(\"blur\", this._handleBlur);\n window.addEventListener(\"resize\", this._handleResize);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"invalid\", this._handleInvalid);\n this.removeEventListener(\"blur\", this._handleBlur);\n window.removeEventListener(\"resize\", this._handleResize);\n }\n\n firstUpdated() {\n // This ensures our element always participates in the form\n this._setValue();\n this._manageRequire();\n this._manageLabelClick();\n }\n\n /**\n * Form Integration\n * --------------------------------------------------------------------------\n */\n\n private _setValue() {\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n }\n\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n const message = this.errorMessage || \"This field is required\";\n if (!input) return;\n\n if (this.required && !this.checked) {\n this._internals.ariaInvalid = \"true\";\n this._internals.setValidity({ valueMissing: true }, message, input);\n } else {\n this._internals.ariaInvalid = \"false\";\n this._internals.setValidity({});\n }\n }\n\n private _setValidityMessage(message: string = \"\") {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Toggle the HTML <div> tag error message\n this.showError = !!message;\n // If user sets errorMessage, this will always override the native validation message\n if (this.errorMessage?.trim() && message !== \"\") {\n message = this.errorMessage;\n }\n\n this._internals.setValidity(\n message ? { customError: true } : {},\n message,\n input,\n );\n }\n\n private _validate() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Get the native validation state\n const validity = input.validity;\n let message = \"\";\n\n if (validity.valueMissing) {\n message = \"This field is required\";\n }\n\n this._setValidityMessage(message);\n }\n\n // Called automatically when the parent form is reset\n public formResetCallback() {\n this.checked = false;\n\n this._internals.setFormValue(null);\n\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) {\n input.checked = false;\n }\n\n // Reset validation UI\n this.showError = false;\n this.errorMessage = \"\";\n this._internals.setValidity({});\n\n // Re-render UI\n this.requestUpdate();\n }\n\n /**\n * Functions\n * --------------------------------------------------------------------------\n */\n\n // This helper function is called to perform the element's native validation.\n checkValidity(): boolean {\n // If the radiogroup is required but no radio is selected, return false.\n if (this.required && !this.checked) {\n return false;\n }\n\n // Otherwise, optionally check the native input's validity if available.\n const input = this.shadowRoot?.querySelector(\"input\");\n return input ? input.checkValidity() : true;\n }\n\n private _handleInvalid(event: Event) {\n event.preventDefault();\n\n this.showError = true;\n this._validate(); // Make sure validation message appears\n\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) {\n // Focus only if this is the first invalid element (top-down approach)\n const form = this._internals.form;\n if (form) {\n const elements = Array.from(form.elements) as Array<\n HTMLElement & { checkValidity?: () => boolean }\n >;\n // Find the first element in the form that is invalid\n const firstInvalidElement = elements.find(\n (element) =>\n typeof element.checkValidity === \"function\" &&\n !element.checkValidity(),\n );\n if (firstInvalidElement === this) {\n input.focus();\n }\n } else {\n // If not part of a form, simply focus.\n input.focus();\n }\n }\n }\n\n private _manageLabelClick = () => {\n const main = this.shadowRoot?.querySelector(\n \".nys-checkbox__main-container\",\n );\n const inputEl = this.shadowRoot?.querySelector(\"input\");\n\n if (!main || !inputEl) return;\n\n main.addEventListener(\"click\", (e) => {\n const target = e.target as HTMLElement;\n\n // Let native input behavior work. Avoid double toggling the checkbox.\n if (target.tagName.toLowerCase() === \"input\") return;\n\n if (!this.disabled) {\n inputEl.click();\n inputEl.focus();\n }\n });\n };\n\n get _hasDescription() {\n // This accounts for both description prop or slotted content. Used for styling text alignment.\n const slot = this.querySelector('[slot=\"description\"]');\n return !!this.description || !!slot;\n }\n\n private _handleResize = () => {\n this.isMobile = window.innerWidth < 480;\n };\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n private _emitChangeEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-change\", {\n detail: {\n id: this.id,\n checked: this.checked,\n name: this.name,\n value: this.value,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _emitOtherInputEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-other-input\", {\n detail: {\n id: this.id,\n name: this.name,\n value: this.value,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n // Handle checkbox change event\n private async _handleChange(e: Event) {\n const { checked } = e.target as HTMLInputElement;\n const wasChecked = this.checked;\n\n this.checked = checked;\n\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n\n // If unchecking \"other\", clear error state\n if (this.other && wasChecked && !checked) {\n this.showOtherError = false;\n this._hasUserInteracted = false;\n this._dispatchClearError();\n }\n\n this._validate();\n this._emitChangeEvent();\n }\n\n private _handleFocus() {\n this.dispatchEvent(new Event(\"nys-focus\"));\n }\n\n private _handleBlur() {\n this.dispatchEvent(new Event(\"nys-blur\"));\n\n if (this.other && this.checked) {\n this._hasUserInteracted = true;\n this._validateOtherAndEmitError();\n }\n }\n\n private _handleTextInputBlur() {\n this._hasUserInteracted = true;\n this._validateOtherAndEmitError();\n }\n\n private async _handleKeydown(e: KeyboardEvent) {\n if (e.code === \"Space\") {\n e.preventDefault();\n if (!this.disabled) {\n this.checked = !this.checked;\n this._internals.setFormValue(this.checked ? this.value : null);\n\n // Wait for DOM updates before validating. This is necessary to ensure the native input validation state is updated before this.validate().\n await this.updateComplete;\n this._validate();\n\n this._emitChangeEvent();\n }\n }\n }\n\n private _handleTextInput(event: Event) {\n const input = event.target as HTMLInputElement;\n let newValue = input.value;\n this.value = newValue;\n\n if (this._hasUserInteracted) {\n this._validateOtherAndEmitError();\n }\n\n this._emitOtherInputEvent();\n }\n\n private _validateOtherAndEmitError() {\n if (!this.other) return;\n\n // Prevent early validation of the \"other\" input before the user interacts with it.\n // Additionally clear validation when \"other\" checkbox is unchecked\n if (!this.checked || !this._hasUserInteracted) {\n this.showOtherError = false;\n\n this._dispatchClearError();\n return;\n }\n\n const isInvalid = this.value.trim() === \"\";\n this.showOtherError = isInvalid;\n\n if (isInvalid) {\n this.dispatchEvent(\n new CustomEvent(\"nys-error\", {\n detail: {\n id: this.id,\n name: this.name,\n type: \"other\",\n message: \"Please enter a value for this option.\",\n sourceCheckbox: this,\n },\n bubbles: true,\n composed: true,\n }),\n );\n } else {\n this._dispatchClearError();\n }\n }\n\n private _dispatchClearError() {\n this.dispatchEvent(\n new CustomEvent(\"nys-error-clear\", {\n detail: { sourceCheckbox: this },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n render() {\n return html`\n <div class=\"nys-checkbox\">\n <div\n class=\"nys-checkbox__main-container ${this._hasDescription\n ? \"has-description\"\n : \"\"}\"\n >\n <div class=\"nys-checkbox__checkbox-wrapper\">\n <input\n id=${this.id + \"--native\"}\n class=\"nys-checkbox__checkbox\"\n type=\"checkbox\"\n name=\"${ifDefined(this.name ? this.name : undefined)}\"\n .checked=${this.checked}\n ?disabled=${this.disabled}\n .value=${this.value}\n ?required=\"${this.required}\"\n form=${ifDefined(this.form || undefined)}\n aria-checked=\"${this.checked}\"\n aria-disabled=\"${this.disabled ? \"true\" : \"false\"}\"\n aria-required=\"${this.required}\"\n aria-describedby=\"group-info\"\n @change=\"${this._handleChange}\"\n @focus=\"${this._handleFocus}\"\n @keydown=\"${this._handleKeydown}\"\n aria-label=${this.label ||\n ifDefined(this.other ? \"Other\" : undefined)}\n />\n ${this.checked\n ? html`<nys-icon\n name=\"check\"\n size=\"${this.size === \"md\"\n ? \"4xl\"\n : this.size === \"sm\"\n ? \"2xl\"\n : \"4xl\"}\"\n class=\"nys-checkbox__icon\"\n ></nys-icon>`\n : \"\"}\n </div>\n ${(this.label || this.other) &&\n html`\n <nys-label\n tooltip=${this.tooltip}\n label=\"${this.label || (this.other ? \"Other\" : \"\")}\"\n description=${ifDefined(this.description || undefined)}\n flag=${ifDefined(this.required ? \"required\" : undefined)}\n >\n <slot name=\"description\" slot=\"description\"\n >${this.description}</slot\n >\n </nys-label>\n `}\n </div>\n <div class=\"nys-checkbox__other-container\">\n ${this.other && this.checked\n ? html`\n <nys-textinput\n .value=${this.value}\n id=${\"radiobutton-other-\" + this.id}\n @nys-input=${this._handleTextInput}\n @nys-blur=${this._handleTextInputBlur}\n ariaLabel=\"Other\"\n aria-invalid=${this.showOtherError ? \"true\" : \"false\"}\n width=${this.isMobile ? \"full\" : \"md\"}\n ></nys-textinput>\n `\n : \"\"}\n </div>\n </div>\n ${this.parentElement?.tagName.toLowerCase() !== \"nys-checkboxgroup\"\n ? html`<nys-errormessage\n id=\"single-error-message\"\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage ||\n this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>`\n : \"\"}\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkbox\")) {\n customElements.define(\"nys-checkbox\", NysCheckbox);\n}\n"],"names":["checkboxgroupIdCounter","_NysCheckboxgroup","LitElement","changedProperties","checkbox","firstCheckbox","message","firstCheckboxInput","checkboxes","atLeastOneChecked","targetElement","nodes","node","event","otherCheckbox","textInput","form","element","customEvent","name","selectedValues","sourceCheckbox","value","html","unsafeCSS","styles","NysCheckboxgroup","__decorateClass","property","state","checkboxIdCounter","_NysCheckbox","main","inputEl","e","input","validity","slot","checked","wasChecked","newValue","isInvalid","ifDefined","NysCheckbox"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,IAAIA,IAAyB;AAwBtB,MAAMC,IAAN,MAAMA,UAAyBC,EAAW;AAAA;AAAA,EA2D/C,cAAc;AACZ,UAAA,GApDyC,KAAA,KAAK,IAGL,KAAA,OAAO,IAGN,KAAA,WAAW,IAGX,KAAA,WAAW,IAGX,KAAA,YAAY,IAG5B,KAAA,eAAe,IAGf,KAAA,QAAQ,IAGR,KAAA,cAAc,IAGE,KAAA,OAAO,IAGvB,KAAA,UAAU,IAGK,KAAA,OAAsB,MAMtB,KAAA,OAAoB,MAEtD,KAAQ,0BAA0B,IAClC,KAAQ,iBAAiB,IACzB,KAAQ,sBAA0C,MAazD,KAAK,aAAa,KAAK,gBAAA;AAAA,EACzB;AAAA;A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,cAAc,KACpC,eAAe,OAAO,gBAAgBA,CAAW;"}
|
|
1
|
+
{"version":3,"file":"nys-checkbox.js","sources":["../src/nys-checkboxgroup.ts","../src/nys-checkbox.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\nimport type { NysCheckbox } from \"./nys-checkbox\";\n\nlet checkboxgroupIdCounter = 0;\n\n/**\n * A container for grouping multiple `nys-checkbox` components as a single form control.\n * Handles validation, required constraints, and submits comma-separated values.\n *\n * Use to allow users to select multiple options from a list. Apply `tile` and `size` to the group\n * and all children inherit these styles automatically.\n *\n * @summary Container for grouping checkboxes as a single form control.\n * @element nys-checkboxgroup\n *\n * @slot - Default slot for `nys-checkbox` elements.\n * @slot description - Custom HTML description content.\n *\n * @example Basic checkbox group\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" required>\n * <nys-checkbox name=\"landmarks\" value=\"adirondacks\" label=\"Adirondacks\"></nys-checkbox>\n * <nys-checkbox name=\"landmarks\" value=\"niagara\" label=\"Niagara Falls\"></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n */\n\nexport class NysCheckboxgroup extends LitElement {\n static styles = unsafeCSS(styles);\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /** Unique identifier. Auto-generated if not provided. */\n @property({ type: String, reflect: true }) id = \"\";\n\n /** Name for form submission. Set on group, not individual checkboxes. */\n @property({ type: String, reflect: true }) name = \"\";\n\n /** Requires at least one checkbox to be checked. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Shows \"Optional\" flag. */\n @property({ type: Boolean, reflect: true }) optional = false;\n\n /** Shows error message when true. */\n @property({ type: Boolean, reflect: true }) showError = false;\n\n /** Error message text. Shown only when `showError` is true. */\n @property({ type: String }) errorMessage = \"\";\n\n /** Visible label text for the group. */\n @property({ type: String }) label = \"\";\n\n /** Helper text below label. Use slot for custom HTML. */\n @property({ type: String }) description = \"\";\n\n /** Renders all checkboxes as tiles with larger clickable area. */\n @property({ type: Boolean, reflect: true }) tile = false;\n\n /** Tooltip text shown on hover/focus of info icon. */\n @property({ type: String }) tooltip = \"\";\n\n /** Form `id` to associate with. Applied to all children. */\n @property({ type: String, reflect: true }) form: string | null = null;\n\n /**\n * Checkbox size for all children: `sm` (24px) or `md` (32px, default).\n * @default \"md\"\n */\n @property({ type: String, reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n @state() private _slottedDescriptionText = \"\";\n @state() private _hasOtherError = false;\n @state() private _otherErrorCheckbox: NysCheckbox | null = null;\n\n private _internals: ElementInternals;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n */\n\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkboxgroup-${Date.now()}-${checkboxgroupIdCounter++}`;\n }\n this.addEventListener(\"nys-change\", this._handleCheckboxChange);\n this.addEventListener(\"nys-other-input\", this._handleOtherInput);\n this.addEventListener(\"invalid\", this._handleInvalid);\n this.addEventListener(\"nys-error\", this._handleChildError);\n this.addEventListener(\"nys-error-clear\", this._handleChildErrorClear);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"nys-change\", this._handleCheckboxChange);\n this.removeEventListener(\"nys-other-input\", this._handleOtherInput);\n this.removeEventListener(\"invalid\", this._handleInvalid);\n this.removeEventListener(\"nys-error\", this._handleChildError);\n this.removeEventListener(\"nys-error-clear\", this._handleChildErrorClear);\n }\n\n firstUpdated() {\n // This ensures our checkboxes sets the value only once for formData (not within the individual checkboxes)\n this._setGroupExist();\n this._updateCheckboxSize();\n this._updateCheckboxTile();\n this._updateCheckboxShowError();\n this._getSlotDescriptionForAria();\n }\n\n updated(changedProperties: Map<string | symbol, unknown>) {\n if (changedProperties.has(\"required\")) {\n if (this.required) {\n this._setupCheckboxRequired();\n }\n }\n if (changedProperties.has(\"size\")) {\n this._updateCheckboxSize();\n }\n if (changedProperties.has(\"tile\")) {\n this._updateCheckboxTile();\n }\n if (changedProperties.has(\"showError\")) {\n this._updateCheckboxShowError();\n }\n if (changedProperties.has(\"form\")) {\n this._updateCheckboxForm();\n }\n }\n\n /**\n * Functions\n * --------------------------------------------------------------------------\n */\n\n private _hasAtLeastOneChecked() {\n return Array.from(this.querySelectorAll(\"nys-checkbox\")).some(\n (checkbox: any) => checkbox.checked,\n );\n }\n\n private _setGroupExist() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox: any) => {\n checkbox.groupExist = true;\n });\n }\n\n // Initial update on checkbox required attribute\n private async _setupCheckboxRequired() {\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const message = this.errorMessage || \"This field is required\";\n\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ? firstCheckboxInput : this,\n );\n }\n\n // Updates the required attribute of each checkbox in the group\n private async _manageRequire() {\n if (!this.required) return;\n\n const message =\n this.errorMessage || \"You must make a selection to proceed.\";\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as any[];\n\n // Loop through each child checkbox to see if one is checked.\n const atLeastOneChecked = this._hasAtLeastOneChecked();\n\n const firstCheckboxInput = checkboxes\n ? await checkboxes[0].getInputElement().catch(() => null)\n : null;\n\n // Always clear validation first to prevent message lingering\n this._internals.setValidity({});\n this.showError = false;\n\n if (!atLeastOneChecked) {\n // Only set valueMissing if there's no active \"other\" error\n // If there IS an \"other\" error, keep that as the primary error\n if (!this._hasOtherError) {\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ?? this,\n );\n this.showError = true;\n } else {\n // Re-set the other error since we just cleared everything\n this._setCustomOtherError();\n this.showError = true;\n }\n } else {\n // At least one checkbox is checked\n // If there's an \"other\" error, reset it since we cleared everything above\n if (this._hasOtherError && this._otherErrorCheckbox) {\n this._setCustomOtherError();\n this.showError = true;\n }\n }\n }\n\n private _setCustomOtherError() {\n const textInput =\n this._otherErrorCheckbox?.shadowRoot?.querySelector(\"nys-textinput\");\n const targetElement = textInput || this._otherErrorCheckbox;\n this._internals.setValidity(\n { customError: true },\n \"Please complete this field.\",\n targetElement as HTMLElement,\n );\n }\n\n // Updates the size of each checkbox in the group\n private _updateCheckboxSize() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n checkbox.setAttribute(\"size\", this.size);\n });\n }\n\n private _updateCheckboxTile() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.tile) {\n checkbox.toggleAttribute(\"tile\", true);\n } else {\n checkbox.removeAttribute(\"tile\");\n }\n });\n }\n\n private _updateCheckboxShowError() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.showError) {\n checkbox.setAttribute(\"showError\", \"\");\n } else {\n checkbox.removeAttribute(\"showError\");\n }\n });\n }\n\n private _updateCheckboxForm() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.showError) {\n if (this.form !== null) {\n checkbox.setAttribute(\"form\", this.form);\n } else {\n checkbox.removeAttribute(\"form\");\n }\n } else {\n checkbox.removeAttribute(\"form\");\n }\n });\n }\n\n // Get the slotted text contents so native VO can attempt to announce it within the legend in the fieldset\n private _getSlotDescriptionForAria() {\n const slot = this.shadowRoot?.querySelector(\n 'slot[name=\"description\"]',\n ) as HTMLSlotElement;\n const nodes = slot?.assignedNodes({ flatten: true }) || [];\n\n this._slottedDescriptionText = nodes\n .map((node) => node.textContent?.trim())\n .filter(Boolean)\n .join(\", \");\n }\n\n // This callback is automatically called when the parent form is reset.\n public formResetCallback() {\n // Reset all child checkboxes\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox: any) => {\n checkbox.formResetCallback();\n });\n\n this._internals.setFormValue(\"\");\n\n // Reset validation UI\n this.showError = false;\n this._internals.setValidity({});\n\n // Re-render UI\n this.requestUpdate();\n }\n\n private async _handleInvalid(event: Event) {\n event.preventDefault();\n\n // Priority 1: Focus \"other\" text input when customError is set\n if (this._internals.validity.customError) {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n\n const otherCheckbox = checkboxes.find(\n (checkbox) => checkbox.other && checkbox.checked,\n );\n\n if (otherCheckbox) {\n const textInput =\n otherCheckbox.shadowRoot?.querySelector(\"nys-textinput\");\n\n if (textInput) {\n await (textInput as any).updateComplete;\n (textInput as HTMLElement).focus();\n return;\n }\n }\n }\n\n // Priority 2: Handle valueMissing (required validation)\n this.showError = true;\n await this._manageRequire(); // Refresh validation message\n\n // Fallback behavior\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n if (firstCheckboxInput) {\n // Focus only if this is the first invalid element (top-down approach)\n const form = this._internals.form;\n if (form) {\n const elements = Array.from(form.elements) as Array<\n HTMLElement & { checkValidity?: () => boolean }\n >;\n // Find the first element in the form that is invalid\n const firstInvalidElement = elements.find((element) => {\n // If element is <nys-checkboxgroup>, we see if anyone checkboxes within the group is checked to fulfill required constraint\n if (element.tagName.toLowerCase() === \"nys-checkboxgroup\") {\n const allCheckboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as any[];\n const hasCheckedCheckbox = allCheckboxes.filter(\n (checkbox) => checkbox.checked,\n );\n // Required constraint not met, continue logic to have this component be focused\n if (hasCheckedCheckbox.length === 0) {\n return element;\n }\n } else {\n return (\n typeof element.checkValidity === \"function\" &&\n !element.checkValidity()\n );\n }\n });\n\n if (firstInvalidElement === this) {\n firstCheckboxInput.focus();\n }\n } else {\n // If not part of a form, simply focus.\n firstCheckboxInput.focus();\n }\n }\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n // Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.\n private _handleCheckboxChange(event: Event) {\n const customEvent = event as CustomEvent;\n const { name } = customEvent.detail;\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n\n // Filter to only the checked ones and extract their values.\n const selectedValues = checkboxes\n .filter((checkbox: any) => checkbox.checked)\n .map((checkbox: any) => checkbox.value);\n\n this.name = name;\n this._internals.setFormValue(selectedValues.join(\", \"));\n\n // Check \"other\" inputs first (they take priority)\n this._checkOtherInputs(checkboxes);\n\n // Only run required validation if no \"other\" error is active\n if (!this._hasOtherError) {\n this._manageRequire();\n }\n }\n\n private async _handleChildError(event: Event) {\n event.stopPropagation();\n\n const { sourceCheckbox } = (event as CustomEvent).detail;\n if (!sourceCheckbox) return;\n\n // Track which checkbox has the error\n this._hasOtherError = true;\n this._otherErrorCheckbox = sourceCheckbox;\n this.showError = true;\n\n this._setCustomOtherError();\n }\n\n private _handleChildErrorClear(event: Event) {\n const customEvent = event as CustomEvent;\n const sourceCheckbox = customEvent.detail?.sourceCheckbox;\n\n if (\n this._otherErrorCheckbox &&\n sourceCheckbox !== this._otherErrorCheckbox\n ) {\n return;\n }\n\n // Clear the old validation state first so to prevent the old customError message from persisting\n this._hasOtherError = false;\n this._otherErrorCheckbox = null;\n this._internals.setValidity({});\n this.showError = false;\n\n // Then check if we need to set a new required error\n if (this.required && !this._hasAtLeastOneChecked()) {\n this._manageRequire();\n }\n }\n\n private _handleOtherInput() {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n const selectedValues = checkboxes\n .filter((checkbox: any) => checkbox.checked)\n .map((checkbox: any) => checkbox.value);\n this._internals.setFormValue(selectedValues.join(\", \"));\n }\n\n private async _checkOtherInputs(checkboxes: NysCheckbox[]) {\n for (const checkbox of checkboxes) {\n if (checkbox.checked && checkbox.other) {\n const value = checkbox.value.trim();\n\n const hasUserInteracted = (checkbox as any)._hasUserInteracted;\n\n if (!hasUserInteracted) {\n // User hasn't interacted yet, skip validation\n continue;\n }\n\n if (!value || value === \"\") {\n this._hasOtherError = true;\n this._otherErrorCheckbox = checkbox;\n this._setCustomOtherError();\n this.showError = true;\n return;\n }\n }\n }\n\n // If we reached here, no other invalid \"other\" was found.\n // Clear any previous \"other\" error\n if (this._hasOtherError) {\n this._hasOtherError = false;\n this._otherErrorCheckbox = null;\n\n // Re-check required constraint\n if (this.required) {\n this._manageRequire();\n } else {\n this._internals.setValidity({});\n this.showError = false;\n }\n }\n }\n\n render() {\n return html`\n <fieldset\n aria-label=\"${this.label}${this._slottedDescriptionText\n ? ` ${this._slottedDescriptionText}`\n : this.description\n ? ` ${this.description}`\n : \"\"}\"\n class=\"nys-checkboxgroup\"\n role=\"radiogroup\"\n >\n <nys-label\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this.tooltip}\n >\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n </nys-label>\n <div class=\"nys-checkboxgroup__content\">\n <slot></slot>\n </div>\n <nys-errormessage\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage || this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>\n </fieldset>\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkboxgroup\")) {\n customElements.define(\"nys-checkboxgroup\", NysCheckboxgroup);\n}\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport \"./nys-checkboxgroup\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\nlet checkboxIdCounter = 0;\n\n/**\n * A checkbox input for binary choices or multi-select lists. Can be used standalone or in a `nys-checkboxgroup`.\n * Form-associated with validation via ElementInternals.\n *\n * Use for binary decisions (agree/disagree) or selecting multiple options from a list.\n * For single selection from 2-6 options, use `nys-radiobutton`. For immediate state changes, use `nys-toggle`.\n *\n * @summary Checkbox for binary choices or multi-select options.\n * @element nys-checkbox\n *\n * @slot description - Custom HTML description content.\n *\n * @fires nys-change - Fired when checked state changes. Detail: `{id, checked, name, value}`.\n * @fires nys-focus - Fired when checkbox gains focus.\n * @fires nys-blur - Fired when checkbox loses focus.\n * @fires nys-other-input - Fired when \"other\" text input value changes. Detail: `{id, name, value}`.\n *\n * @example Single checkbox\n * ```html\n * <nys-checkbox label=\"I agree to the terms\" name=\"terms\" required></nys-checkbox>\n * ```\n *\n * @example Checkbox group\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\">\n * <nys-checkbox name=\"landmarks\" value=\"adirondacks\" label=\"Adirondacks\"></nys-checkbox>\n * <nys-checkbox name=\"landmarks\" value=\"niagara\" label=\"Niagara Falls\"></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n */\n\nexport class NysCheckbox extends LitElement {\n static styles = unsafeCSS(styles);\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /** Whether checkbox is checked. */\n @property({ type: Boolean, reflect: true }) checked = false;\n\n /** Prevents interaction. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Marks as required. Validates that checkbox is checked. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Visible label text. Required for accessibility. */\n @property({ type: String }) label = \"\";\n\n /** Helper text below label. Use slot for custom HTML. */\n @property({ type: String }) description = \"\";\n\n /** Unique identifier. Auto-generated if not provided. */\n @property({ type: String, reflect: true }) id = \"\";\n\n /** Name for form submission. Use same name for grouped checkboxes. */\n @property({ type: String, reflect: true }) name = \"\";\n\n /** Value submitted when checked. */\n @property({ type: String }) value = \"\";\n\n /** Form `id` to associate with when checkbox is outside form element. */\n @property({ type: String, reflect: true }) form: string | null = null;\n\n /** Shows error message when true. */\n @property({ type: Boolean, reflect: true }) showError = false;\n\n /** Error message text. Shown only when `showError` is true. */\n @property({ type: String }) errorMessage = \"\";\n\n /** Internal: Set by parent checkboxgroup. Do not set manually. */\n @property({ type: Boolean }) groupExist = false;\n\n /** Renders as tile with larger clickable area. Apply to group for consistency. */\n @property({ type: Boolean, reflect: true }) tile = false;\n\n /** Tooltip text shown on hover/focus of info icon. */\n @property({ type: String }) tooltip = \"\";\n\n /**\n * Checkbox size: `sm` (24px) or `md` (32px, default).\n * @default \"md\"\n */\n @property({ type: String, reflect: true }) size: \"sm\" | \"md\" = \"md\";\n @property({ type: Boolean, reflect: true }) other = false;\n @property({ type: Boolean }) showOtherError = false;\n\n private _mobileQuery = window.matchMedia(\"(max-width: 479px)\");\n @state() private isMobile = this._mobileQuery.matches;\n\n private _hasUserInteracted = false; // need this flag for \"eager mode\"\n\n public async getInputElement(): Promise<HTMLInputElement | null> {\n await this.updateComplete; // Wait for the component to finish rendering\n return this.shadowRoot?.querySelector(\"input\") || null;\n }\n\n private _internals: ElementInternals;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n */\n\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkbox-${Date.now()}-${checkboxIdCounter++}`;\n }\n this.addEventListener(\"invalid\", this._handleInvalid);\n this.addEventListener(\"blur\", this._handleBlur);\n this._mobileQuery.addEventListener(\"change\", this._handleMobileQuery);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"invalid\", this._handleInvalid);\n this.removeEventListener(\"blur\", this._handleBlur);\n this._mobileQuery.removeEventListener(\"change\", this._handleMobileQuery);\n }\n\n firstUpdated() {\n // This ensures our element always participates in the form\n this._setValue();\n this._manageRequire();\n this._manageLabelClick();\n }\n\n /**\n * Form Integration\n * --------------------------------------------------------------------------\n */\n\n private _setValue() {\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n }\n\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n const message = this.errorMessage || \"This field is required\";\n if (!input) return;\n\n if (this.required && !this.checked) {\n this._internals.ariaInvalid = \"true\";\n this._internals.setValidity({ valueMissing: true }, message, input);\n } else {\n this._internals.ariaInvalid = \"false\";\n this._internals.setValidity({});\n }\n }\n\n private _setValidityMessage(message: string = \"\") {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Toggle the HTML <div> tag error message\n this.showError = !!message;\n // If user sets errorMessage, this will always override the native validation message\n if (this.errorMessage?.trim() && message !== \"\") {\n message = this.errorMessage;\n }\n\n this._internals.setValidity(\n message ? { customError: true } : {},\n message,\n input,\n );\n }\n\n private _validate() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Get the native validation state\n const validity = input.validity;\n let message = \"\";\n\n if (validity.valueMissing) {\n message = \"This field is required\";\n }\n\n this._setValidityMessage(message);\n }\n\n // Called automatically when the parent form is reset\n public formResetCallback() {\n this.checked = false;\n\n this._internals.setFormValue(null);\n\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) {\n input.checked = false;\n }\n\n // Reset validation UI\n this.showError = false;\n this.errorMessage = \"\";\n this._internals.setValidity({});\n\n // Re-render UI\n this.requestUpdate();\n }\n\n /**\n * Functions\n * --------------------------------------------------------------------------\n */\n\n // This helper function is called to perform the element's native validation.\n checkValidity(): boolean {\n // If the radiogroup is required but no radio is selected, return false.\n if (this.required && !this.checked) {\n return false;\n }\n\n // Otherwise, optionally check the native input's validity if available.\n const input = this.shadowRoot?.querySelector(\"input\");\n return input ? input.checkValidity() : true;\n }\n\n private _handleInvalid(event: Event) {\n event.preventDefault();\n\n this.showError = true;\n this._validate(); // Make sure validation message appears\n\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) {\n // Focus only if this is the first invalid element (top-down approach)\n const form = this._internals.form;\n if (form) {\n const elements = Array.from(form.elements) as Array<\n HTMLElement & { checkValidity?: () => boolean }\n >;\n // Find the first element in the form that is invalid\n const firstInvalidElement = elements.find(\n (element) =>\n typeof element.checkValidity === \"function\" &&\n !element.checkValidity(),\n );\n if (firstInvalidElement === this) {\n input.focus();\n }\n } else {\n // If not part of a form, simply focus.\n input.focus();\n }\n }\n }\n\n private _manageLabelClick = () => {\n const main = this.shadowRoot?.querySelector(\n \".nys-checkbox__main-container\",\n );\n const inputEl = this.shadowRoot?.querySelector(\"input\");\n\n if (!main || !inputEl) return;\n\n main.addEventListener(\"click\", (e) => {\n const target = e.target as HTMLElement;\n\n // Let native input behavior work. Avoid double toggling the checkbox.\n if (target.tagName.toLowerCase() === \"input\") return;\n\n if (!this.disabled) {\n inputEl.click();\n inputEl.focus();\n }\n });\n };\n\n get _hasDescription() {\n // This accounts for both description prop or slotted content. Used for styling text alignment.\n const slot = this.querySelector('[slot=\"description\"]');\n return !!this.description || !!slot;\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n private _handleMobileQuery = () => {\n this.isMobile = this._mobileQuery.matches;\n };\n\n private _emitChangeEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-change\", {\n detail: {\n id: this.id,\n checked: this.checked,\n name: this.name,\n value: this.value,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _emitOtherInputEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-other-input\", {\n detail: {\n id: this.id,\n name: this.name,\n value: this.value,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n // Handle checkbox change event\n private async _handleChange(e: Event) {\n const { checked } = e.target as HTMLInputElement;\n const wasChecked = this.checked;\n\n this.checked = checked;\n\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n\n // If unchecking \"other\", clear error state\n if (this.other && wasChecked && !checked) {\n this.showOtherError = false;\n this._hasUserInteracted = false;\n this._dispatchClearError();\n }\n\n this._validate();\n this._emitChangeEvent();\n }\n\n private _handleFocus() {\n this.dispatchEvent(new Event(\"nys-focus\"));\n }\n\n private _handleBlur() {\n this.dispatchEvent(new Event(\"nys-blur\"));\n\n if (this.other && this.checked) {\n this._hasUserInteracted = true;\n this._validateOtherAndEmitError();\n }\n }\n\n private _handleTextInputBlur() {\n this._hasUserInteracted = true;\n this._validateOtherAndEmitError();\n }\n\n private async _handleKeydown(e: KeyboardEvent) {\n if (e.code === \"Space\") {\n e.preventDefault();\n if (!this.disabled) {\n this.checked = !this.checked;\n this._internals.setFormValue(this.checked ? this.value : null);\n\n // Wait for DOM updates before validating. This is necessary to ensure the native input validation state is updated before this.validate().\n await this.updateComplete;\n this._validate();\n\n this._emitChangeEvent();\n }\n }\n }\n\n private _handleTextInput(event: Event) {\n const input = event.target as HTMLInputElement;\n let newValue = input.value;\n this.value = newValue;\n\n if (this._hasUserInteracted) {\n this._validateOtherAndEmitError();\n }\n\n this._emitOtherInputEvent();\n }\n\n private _validateOtherAndEmitError() {\n if (!this.other) return;\n\n // Prevent early validation of the \"other\" input before the user interacts with it.\n // Additionally clear validation when \"other\" checkbox is unchecked\n if (!this.checked || !this._hasUserInteracted) {\n this.showOtherError = false;\n\n this._dispatchClearError();\n return;\n }\n\n const isInvalid = this.value.trim() === \"\";\n this.showOtherError = isInvalid;\n\n if (isInvalid) {\n this.dispatchEvent(\n new CustomEvent(\"nys-error\", {\n detail: {\n id: this.id,\n name: this.name,\n type: \"other\",\n message: \"Please enter a value for this option.\",\n sourceCheckbox: this,\n },\n bubbles: true,\n composed: true,\n }),\n );\n } else {\n this._dispatchClearError();\n }\n }\n\n private _dispatchClearError() {\n this.dispatchEvent(\n new CustomEvent(\"nys-error-clear\", {\n detail: { sourceCheckbox: this },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n render() {\n return html`\n <div class=\"nys-checkbox\">\n <div\n class=\"nys-checkbox__main-container ${this._hasDescription\n ? \"has-description\"\n : \"\"}\"\n >\n <div class=\"nys-checkbox__checkbox-wrapper\">\n <input\n id=${this.id + \"--native\"}\n class=\"nys-checkbox__checkbox\"\n type=\"checkbox\"\n name=\"${ifDefined(this.name ? this.name : undefined)}\"\n .checked=${this.checked}\n ?disabled=${this.disabled}\n .value=${this.value}\n ?required=\"${this.required}\"\n form=${ifDefined(this.form || undefined)}\n aria-checked=\"${this.checked}\"\n aria-disabled=\"${this.disabled ? \"true\" : \"false\"}\"\n aria-required=\"${this.required}\"\n aria-describedby=\"group-info\"\n @change=\"${this._handleChange}\"\n @focus=\"${this._handleFocus}\"\n @keydown=\"${this._handleKeydown}\"\n aria-label=${this.label ||\n ifDefined(this.other ? \"Other\" : undefined)}\n />\n ${this.checked\n ? html`<nys-icon\n name=\"check\"\n size=\"${this.size === \"md\"\n ? \"4xl\"\n : this.size === \"sm\"\n ? \"2xl\"\n : \"4xl\"}\"\n class=\"nys-checkbox__icon\"\n ></nys-icon>`\n : \"\"}\n </div>\n ${(this.label || this.other) &&\n html`\n <nys-label\n aria-hidden=\"true\"\n tooltip=${this.tooltip}\n label=\"${this.label || (this.other ? \"Other\" : \"\")}\"\n description=${ifDefined(this.description || undefined)}\n flag=${ifDefined(this.required ? \"required\" : undefined)}\n >\n <slot name=\"description\" slot=\"description\"\n >${this.description}</slot\n >\n </nys-label>\n `}\n </div>\n <div class=\"nys-checkbox__other-container\">\n ${this.other && this.checked\n ? html`\n <nys-textinput\n .value=${this.value}\n id=${\"radiobutton-other-\" + this.id}\n @nys-input=${this._handleTextInput}\n @nys-blur=${this._handleTextInputBlur}\n ariaLabel=\"Other\"\n aria-invalid=${this.showOtherError ? \"true\" : \"false\"}\n width=${this.isMobile ? \"full\" : \"md\"}\n ?disabled=${this.disabled}\n ></nys-textinput>\n `\n : \"\"}\n </div>\n </div>\n ${this.parentElement?.tagName.toLowerCase() !== \"nys-checkboxgroup\"\n ? html`<nys-errormessage\n id=\"single-error-message\"\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage ||\n this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>`\n : \"\"}\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkbox\")) {\n customElements.define(\"nys-checkbox\", NysCheckbox);\n}\n"],"names":["checkboxgroupIdCounter","_NysCheckboxgroup","LitElement","changedProperties","checkbox","firstCheckbox","message","firstCheckboxInput","checkboxes","atLeastOneChecked","targetElement","nodes","node","event","otherCheckbox","textInput","form","element","customEvent","name","selectedValues","sourceCheckbox","value","html","unsafeCSS","styles","NysCheckboxgroup","__decorateClass","property","state","checkboxIdCounter","_NysCheckbox","main","inputEl","e","input","validity","slot","checked","wasChecked","newValue","isInvalid","ifDefined","NysCheckbox"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,IAAIA,IAAyB;AAwBtB,MAAMC,IAAN,MAAMA,UAAyBC,EAAW;AAAA;AAAA,EA2D/C,cAAc;AACZ,UAAA,GApDyC,KAAA,KAAK,IAGL,KAAA,OAAO,IAGN,KAAA,WAAW,IAGX,KAAA,WAAW,IAGX,KAAA,YAAY,IAG5B,KAAA,eAAe,IAGf,KAAA,QAAQ,IAGR,KAAA,cAAc,IAGE,KAAA,OAAO,IAGvB,KAAA,UAAU,IAGK,KAAA,OAAsB,MAMtB,KAAA,OAAoB,MAEtD,KAAQ,0BAA0B,IAClC,KAAQ,iBAAiB,IACzB,KAAQ,sBAA0C,MAazD,KAAK,aAAa,KAAK,gBAAA;AAAA,EACzB;AAAA;AAAA,EAGA,oBAAoB;AAClB,UAAM,kBAAA,GACD,KAAK,OACR,KAAK,KAAK,qBAAqB,KAAK,KAAK,IAAIF,GAAwB,KAEvE,KAAK,iBAAiB,cAAc,KAAK,qBAAqB,GAC9D,KAAK,iBAAiB,mBAAmB,KAAK,iBAAiB,GAC/D,KAAK,iBAAiB,WAAW,KAAK,cAAc,GACpD,KAAK,iBAAiB,aAAa,KAAK,iBAAiB,GACzD,KAAK,iBAAiB,mBAAmB,KAAK,sBAAsB;AAAA,EACtE;AAAA,EA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AGehB,EAAA;AAAA,EAA1CC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAhC9Be,EAgCgC,WAAA,MAAA;AAGChB,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAnC/Be,EAmCiC,WAAA,WAAA;AAGhBhB,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAtCfe,EAsCiB,WAAA,cAAA;AAGChB,EAAA;AAAA,EAA5BC,EAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAzChBe,EAyCkB,WAAA,YAAA;AAGehB,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GA5C/Be,EA4CiC,WAAA,MAAA;AAGhBhB,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GA/Cfe,EA+CiB,WAAA,SAAA;AAMehB,EAAA;AAAA,EAA1CC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GArD9Be,EAqDgC,WAAA,MAAA;AACChB,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAtD/Be,EAsDiC,WAAA,OAAA;AACfhB,EAAA;AAAA,EAA5BC,EAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAvDhBe,EAuDkB,WAAA,gBAAA;AAGZhB,EAAA;AAAA,EAAhBE,EAAA;AAAM,GA1DIc,EA0DM,WAAA,UAAA;AAobd,eAAe,IAAI,cAAc,KACpC,eAAe,OAAO,gBAAgBA,CAAW;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/nys-checkbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "The Checkbox component from the NYS Design System.",
|
|
5
5
|
"module": "dist/nys-checkbox.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"lit-analyze": "lit-analyzer '**/*.ts'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nysds/nys-icon": "^1.
|
|
27
|
-
"@nysds/nys-label": "^1.
|
|
28
|
-
"@nysds/nys-errormessage": "^1.
|
|
26
|
+
"@nysds/nys-icon": "^1.19.0",
|
|
27
|
+
"@nysds/nys-label": "^1.19.0",
|
|
28
|
+
"@nysds/nys-errormessage": "^1.19.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"lit": "^3.3.1",
|