@nysds/nys-checkbox 1.22.1 → 1.22.3

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.
@@ -10,13 +10,13 @@ import "@nysds/nys-textinput";
10
10
  * █ █ █ █▄▄▄█ ▀▀▀▄▄ █ █ ▀▀▀▄▄
11
11
  * █ ▀█ █ █▄▄▄█ █▄▄▀ █▄▄▄█
12
12
  *
13
- * Checkbox Component v1.22.1
13
+ * Checkbox Component v1.22.3
14
14
  * Part of the New York State Design System
15
15
  * Repository: https://github.com/its-hcd/nysds
16
16
  * License: MIT
17
17
  */
18
18
  /*!
19
- * New York State Design System v1.22.1
19
+ * New York State Design System v1.22.3
20
20
  * Description: A design system for New York State's digital products.
21
21
  * Repository: https://github.com/its-hcd/nysds
22
22
  * License: MIT
@@ -1 +1 @@
1
- {"version":3,"file":"nys-checkbox.js","sources":["../../internals/dist/index.js","../src/nys-checkboxgroup.ts","../src/nys-checkbox.ts"],"sourcesContent":["import { LitElement as u } from \"lit\";\n/*!\n * New York State Design System v1.22.1\n * Description: A design system for New York State's digital products.\n * Repository: https://github.com/its-hcd/nysds\n * License: MIT\n */\nlet y = 0;\nfunction f(e) {\n return `${e}-${Date.now()}-${y++}`;\n}\nfunction N(e, t, s) {\n e.dispatchEvent(\n new CustomEvent(t, { detail: s, bubbles: !0, composed: !0 })\n );\n}\nfunction I(e, t) {\n e.dispatchEvent(\n new Event(`nys-${t}`, { bubbles: !0, composed: !0 })\n );\n}\nconst p = {\n labelledby: \"ariaLabelledByElements\",\n describedby: \"ariaDescribedByElements\"\n}, g = {\n labelledby: \"ariaLabel\",\n describedby: \"ariaDescription\"\n};\nfunction _(e) {\n return \"ariaDescribedByElements\" in e;\n}\nfunction E(e) {\n return e === \"errormessage\" ? \"aria-errormessage\" : `aria-${e}`;\n}\nfunction d(e) {\n return e.filter((t) => !!t);\n}\nfunction A(e) {\n return e.map((t) => (t.id || (t.id = f(\"nys-ref\")), t.id));\n}\nfunction w(e, t, s) {\n const n = d(s), i = E(t);\n n.length ? e.setAttribute(i, A(n).join(\" \")) : e.removeAttribute(i);\n}\nfunction x(e, t, s, n, i) {\n const r = d(n), a = p[s], l = t;\n if (a && _(t)) {\n l[a] = r.length ? r : null;\n return;\n }\n const o = g[s];\n if (!o) return;\n const c = i ?? (r.length ? r.map((m) => m.textContent?.trim() ?? \"\").filter(Boolean).join(\" \") : \"\");\n o in l ? l[o] = c || null : c ? e.setAttribute(\n s === \"labelledby\" ? \"aria-label\" : \"aria-description\",\n c\n ) : e.removeAttribute(\n s === \"labelledby\" ? \"aria-label\" : \"aria-description\"\n );\n}\nconst R = {\n labelledby: \"ariaLabelledByElements\",\n describedby: \"ariaDescribedByElements\"\n}, V = {\n labelledby: \"aria-label\",\n describedby: \"aria-description\"\n};\nfunction L(e, t, s) {\n const n = d(s), i = R[t], r = V[t], a = e;\n if (i && i in e && (a[i] = n.length ? n : null), !r) return;\n const l = n.map((o) => o.textContent?.trim() ?? \"\").filter(Boolean).join(\" \");\n l ? e.setAttribute(r, l) : e.removeAttribute(r);\n}\nconst h = (e) => {\n class t extends e {\n get idPrefix() {\n return this.localName || \"nys-element\";\n }\n ensureId() {\n this.id || (this.id = f(this.idPrefix));\n }\n connectedCallback() {\n super.connectedCallback(), this.ensureId();\n }\n }\n return t;\n}, P = /* @__PURE__ */ h(u), b = (e) => {\n class t extends h(e) {\n constructor() {\n super(...arguments), this.__internals = null;\n }\n get internals() {\n if (this.__internals) return this.__internals;\n if (typeof this.attachInternals == \"function\")\n try {\n this.__internals = this.attachInternals();\n } catch {\n this.__internals = null;\n }\n return this.__internals;\n }\n get defaultRole() {\n return null;\n }\n setHostAria(n, i) {\n const r = this.internals;\n if (r && n in r) {\n r[n] = i;\n return;\n }\n const a = v(n);\n i === null ? this.removeAttribute(a) : this.setAttribute(a, i);\n }\n reflectDefaultSemantics() {\n const n = this.defaultRole;\n n && this.setHostAria(\"role\", n);\n }\n connectedCallback() {\n super.connectedCallback(), this.reflectDefaultSemantics();\n }\n }\n return t;\n};\nfunction v(e) {\n if (e === \"role\") return \"role\";\n const t = e.replace(/^aria/, \"\");\n return \"aria-\" + t.charAt(0).toLowerCase() + t.slice(1);\n}\nconst T = /* @__PURE__ */ b(u), C = (e) => {\n const s = class s extends b(e) {\n constructor() {\n super(...arguments), this.__internalValidationMessage = \"\";\n }\n get internalValidationMessage() {\n return this.__internalValidationMessage;\n }\n set internalValidationMessage(i) {\n i !== this.__internalValidationMessage && (this.__internalValidationMessage = i, this.requestUpdate(\"internalValidationMessage\"));\n }\n resolvedErrorMessage() {\n return this.errorMessage || this.internalValidationMessage;\n }\n setFormValue(i) {\n this.internals?.setFormValue(i ?? null);\n }\n setValidityFromState(i, r, a) {\n const l = this.internals;\n if (!l) return;\n const o = Object.values(i).some(Boolean);\n o ? l.setValidity(i, r ?? \"Invalid value\", a) : l.setValidity({}), this.setHostAria(\"ariaInvalid\", o ? \"true\" : \"false\");\n }\n clearValidity() {\n this.internals?.setValidity({}), this.setHostAria(\"ariaInvalid\", \"false\");\n }\n checkValidity() {\n return this.internals?.checkValidity() ?? !0;\n }\n reportValidity() {\n return this.internals?.reportValidity() ?? !0;\n }\n formResetCallback() {\n this.internalValidationMessage = \"\", this.clearValidity();\n }\n };\n s.formAssociated = !0;\n let t = s;\n return t;\n}, O = /* @__PURE__ */ C(u);\nfunction B(e) {\n const t = e.tagName.toLowerCase(), s = /* @__PURE__ */ new Set(), n = (i) => {\n i.querySelectorAll(\"*\").forEach((r) => {\n const a = r.tagName.toLowerCase();\n a.startsWith(\"nys-\") && a !== t && !customElements.get(a) && s.add(a), r.shadowRoot && n(r.shadowRoot);\n });\n };\n return e.shadowRoot && n(e.shadowRoot), n(e), [...s].sort();\n}\nexport {\n C as FormControlMixin,\n h as IdentifiedMixin,\n P as NysElement,\n O as NysFormControlElement,\n T as NysReflectsAriaElement,\n b as ReflectsAriaMixin,\n w as associateControl,\n L as associateControlRefs,\n x as associateHost,\n N as dispatchNysEvent,\n I as dispatchNysFocusBlur,\n B as findUnregisteredChildren,\n f as generateId,\n _ as supportsElementRefs\n};\n//# sourceMappingURL=index.js.map\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport {\n NysFormControlElement,\n dispatchNysEvent,\n dispatchNysFocusBlur,\n} from \"@nysds/internals\";\n// These internal elements are rendered inside this component's shadow DOM, so\n// they must be registered whenever nys-checkboxgroup is used. Importing them\n// here (intentional side effect) guarantees the visible label and error message —\n// which the accessible name/error association depends on — always render.\nimport \"@nysds/nys-label\";\nimport \"@nysds/nys-errormessage\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\nimport type { NysCheckbox } from \"./nys-checkbox\";\n\n/** Detail payload for the `nys-change` event fired by `nys-checkboxgroup`. */\nexport interface NysCheckboxgroupChangeDetail {\n id: string;\n name: string;\n value: string[];\n}\n\n/** The `nys-change` event fired by `nys-checkboxgroup`. */\nexport type NysCheckboxgroupChangeEvent =\n CustomEvent<NysCheckboxgroupChangeDetail>;\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 * @formControl value nys-change\n *\n * @slot - Default slot for `nys-checkbox` elements.\n * @slot description - Custom HTML description content.\n *\n * @fires {NysCheckboxgroupChangeEvent} nys-change - Fired when any child checkbox changes. Detail: `{id, name, value}` where `value` is the checked values as a string array. Bubbles and composed. The child's own `nys-change` keeps bubbling alongside it.\n * @fires {Event} nys-focus - Fired when focus enters the group from outside. Bubbles and composed.\n * @fires {Event} nys-blur - Fired when focus leaves the group. Bubbles and composed.\n *\n * @example Basic\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 * @example Tile\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" tile>\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 * @example Required\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 * @example Optional\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" optional>\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 * @example Disabled\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\">\n * <nys-checkbox name=\"landmarks\" value=\"adirondacks\" label=\"Adirondacks\" disabled></nys-checkbox>\n * <nys-checkbox name=\"landmarks\" value=\"niagara\" label=\"Niagara Falls\" disabled></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n *\n * @example Size Small\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" size=\"sm\">\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 * @example Other Option\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-checkbox name=\"landmarks\" value=\"\" label=\"Other\" other></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n *\n * @example Error Message\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" showError errorMessage=\"Please select at least one landmark\">\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 * @example Description\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" description=\"Choose wisely, you can only pick one.\">\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 * @example Description Slot\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\">\n * <div slot=\"description\">Your <strong>ABSOLUTE</strong> favorite one.</div>\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 NysFormControlElement {\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 private _value: string[] = [];\n\n // Guards the value accessor: true while the group syncs `value` from its\n // children, so the setter doesn't push the same state back down.\n private _syncingValueFromChildren = false;\n\n /**\n * Values of the checked child checkboxes, in DOM order. Setting it\n * programmatically checks the matching children and updates the form value\n * without firing `nys-change`.\n */\n @property({ attribute: false })\n get value(): string[] {\n return this._value;\n }\n\n set value(next: string[]) {\n const old = this._value;\n this._value = Array.isArray(next) ? [...next] : [];\n if (!this._syncingValueFromChildren) {\n this._applyValueToChildren();\n }\n this.requestUpdate(\"value\", old);\n }\n\n @state() private _slottedDescriptionText = \"\";\n @state() private _hasOtherError = false;\n @state() private _otherErrorCheckbox: NysCheckbox | null = null;\n\n // Not reactive: only read by event handlers, never by render.\n private _hasSharedNames = false;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n * Form association, ElementInternals, and id generation are provided by\n * NysFormControlElement (@nysds/internals).\n */\n\n connectedCallback() {\n // super.connectedCallback() (NysFormControlElement) assigns an id when one\n // is not provided and reflects default semantics.\n super.connectedCallback();\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 this.addEventListener(\"focusin\", this._handleFocusIn);\n this.addEventListener(\"focusout\", this._handleFocusOut);\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 this.removeEventListener(\"focusin\", this._handleFocusIn);\n this.removeEventListener(\"focusout\", this._handleFocusOut);\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 // `_getSlotDescriptionForAria` runs off the description slot's `slotchange`\n // instead: setting state here would land after the update completed and\n // force a second render (see lit.dev/msg/change-in-update).\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 = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n\n this._hasSharedNames = this._checkSharedNames(checkboxes);\n\n checkboxes.forEach((checkbox: any) => {\n checkbox.groupExist = this._hasSharedNames;\n });\n }\n\n // Initial update on checkbox required attribute\n private async _setupCheckboxRequired() {\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n this.internalValidationMessage = \"This field is required\";\n this.setValidityFromState(\n { valueMissing: true },\n this.resolvedErrorMessage(),\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) {\n this.clearValidity();\n this.internalValidationMessage = \"\";\n this.showError = false;\n return;\n }\n\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.clearValidity();\n this.internalValidationMessage = \"\";\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.internalValidationMessage =\n \"You must make a selection to proceed.\";\n this.setValidityFromState(\n { valueMissing: true },\n this.resolvedErrorMessage(),\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.internalValidationMessage = \"Please complete this field.\";\n this.setValidityFromState(\n { customError: true },\n this.resolvedErrorMessage(),\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.setFormValue(\"\");\n this._setValueFromChildren([]);\n\n // Reset validation UI. Clears only the component-owned validation text; a\n // consumer-supplied errorMessage is never overwritten.\n this.showError = false;\n this.internalValidationMessage = \"\";\n this.clearValidity();\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 // The group dispatches its own nys-change from this handler; ignore that\n // echo so it isn't handled as another child change.\n if (event.target === this) return;\n\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) => checkbox.checked)\n .map((checkbox) => checkbox.value);\n\n if (this._hasSharedNames) {\n const customEvent = event as CustomEvent;\n const { name } = customEvent.detail;\n\n this.name = name;\n this.setFormValue(selectedValues.join(\", \"));\n }\n this._setValueFromChildren(selectedValues);\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 dispatchNysEvent<NysCheckboxgroupChangeDetail>(this, \"nys-change\", {\n id: this.id,\n name: this.name,\n value: [...selectedValues],\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.clearValidity();\n this.internalValidationMessage = \"\";\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._setValueFromChildren(selectedValues);\n this.setFormValue(selectedValues.join(\", \"));\n }\n\n /**\n * Group-level focus: fired only when focus enters from outside the group,\n * so moving between child checkboxes stays silent.\n */\n private _handleFocusIn = (event: FocusEvent) => {\n const related = event.relatedTarget as Node | null;\n if (!related || !this.contains(related)) {\n dispatchNysFocusBlur(this, \"focus\");\n }\n };\n\n /** Group-level blur: fired only when focus leaves the group entirely. */\n private _handleFocusOut = (event: FocusEvent) => {\n const related = event.relatedTarget as Node | null;\n if (!related || !this.contains(related)) {\n dispatchNysFocusBlur(this, \"blur\");\n }\n };\n\n /**\n * Set `value` from the children's checked state without pushing the same\n * state back down (and without firing `nys-change`).\n */\n private _setValueFromChildren(values: string[]) {\n this._syncingValueFromChildren = true;\n this.value = values;\n this._syncingValueFromChildren = false;\n }\n\n /**\n * Apply a programmatically set `value` to the child checkboxes and the form\n * value. Setting `checked` on a child never fires its `nys-change` (only\n * user interaction does), so no change events echo back.\n */\n private _applyValueToChildren() {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n if (checkboxes.length === 0) return;\n\n checkboxes.forEach((checkbox) => {\n checkbox.checked = this._value.includes(checkbox.value);\n });\n\n if (this._hasSharedNames) {\n this.setFormValue(this._value.join(\", \"));\n }\n }\n\n /**\n * Derive `value` from the checked children. Runs off the default slot's\n * `slotchange`, so it covers first render and dynamically added checkboxes\n * without scheduling a second update cycle.\n */\n private _handleDefaultSlotChange() {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n this._setValueFromChildren(\n checkboxes\n .filter((checkbox) => checkbox.checked)\n .map((checkbox) => checkbox.value),\n );\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.clearValidity();\n this.internalValidationMessage = \"\";\n this.showError = false;\n }\n }\n }\n\n /** Drupal-like naming support **/\n\n private _checkSharedNames(checkboxes: NysCheckbox[]): boolean {\n if (checkboxes.length === 0) return false;\n const firstName = checkboxes[0].name;\n return checkboxes.every((checkbox) => checkbox.name === firstName);\n }\n\n render() {\n return html`\n <fieldset\n aria-labelledby=${ifDefined(\n this.label ? this.id + \"--label\" : undefined,\n )}\n aria-label=${ifDefined(\n !this.label\n ? `${this._slottedDescriptionText || this.description || \"\"}`.trim() ||\n undefined\n : undefined,\n )}\n class=\"nys-checkboxgroup\"\n role=\"radiogroup\"\n >\n <nys-label\n id=\"${this.id}--label\"\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this.tooltip}\n >\n <slot\n name=\"description\"\n slot=\"description\"\n @slotchange=${this._getSlotDescriptionForAria}\n >${this.description}</slot\n >\n </nys-label>\n <div class=\"nys-checkboxgroup__content\">\n <slot @slotchange=${this._handleDefaultSlotChange}></slot>\n </div>\n <nys-errormessage\n id=${this.id + \"--error\"}\n ?showError=${this.showError}\n errorMessage=${this.resolvedErrorMessage()}\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, nothing, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport {\n NysFormControlElement,\n associateControlRefs,\n dispatchNysEvent,\n dispatchNysFocusBlur,\n} from \"@nysds/internals\";\nimport \"./nys-checkboxgroup\";\n// These internal elements are rendered inside this component's shadow DOM, so\n// they must be registered whenever nys-checkbox is used. Importing them here\n// (intentional side effect) guarantees the visible label and error message —\n// which the accessible name/error association depends on — always render.\n// nys-icon renders the checked-state checkmark; nys-textinput renders the\n// \"other\" free-text field.\nimport \"@nysds/nys-label\";\nimport \"@nysds/nys-errormessage\";\nimport \"@nysds/nys-icon\";\nimport \"@nysds/nys-textinput\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\n/** Detail payload for the `nys-change` event fired by `nys-checkbox`. */\nexport interface NysCheckboxChangeDetail {\n id: string;\n checked: boolean;\n name: string;\n value: string;\n}\n\n/** The `nys-change` event fired by `nys-checkbox`. */\nexport type NysCheckboxChangeEvent = CustomEvent<NysCheckboxChangeDetail>;\n\n/** Detail payload for the `nys-other-input` event fired by `nys-checkbox`. */\nexport interface NysCheckboxOtherInputDetail {\n id: string;\n name: string;\n value: string;\n}\n\n/** The `nys-other-input` event fired by `nys-checkbox`. */\nexport type NysCheckboxOtherInputEvent =\n CustomEvent<NysCheckboxOtherInputDetail>;\n\n/**\n * Detail payload for the `nys-error` group-coordination event.\n * @internal\n */\nexport interface NysCheckboxErrorDetail {\n id: string;\n name: string;\n type: \"other\";\n message: string;\n sourceCheckbox: NysCheckbox;\n}\n\n/**\n * The `nys-error` group-coordination event.\n * @internal\n */\nexport type NysCheckboxErrorEvent = CustomEvent<NysCheckboxErrorDetail>;\n\n/**\n * Detail payload for the `nys-error-clear` group-coordination event.\n * @internal\n */\nexport interface NysCheckboxErrorClearDetail {\n sourceCheckbox: NysCheckbox;\n}\n\n/**\n * The `nys-error-clear` group-coordination event.\n * @internal\n */\nexport type NysCheckboxErrorClearEvent =\n CustomEvent<NysCheckboxErrorClearDetail>;\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 * @formControl checked nys-change\n *\n * @slot description - Custom HTML description content.\n *\n * @fires {NysCheckboxChangeEvent} nys-change - Fired when checked state changes. Detail: `{id, checked, name, value}`. Bubbles and composed.\n * @fires {Event} nys-focus - Fired when checkbox gains focus. Bubbles and composed.\n * @fires {Event} nys-blur - Fired when checkbox loses focus. Bubbles and composed.\n * @fires {NysCheckboxOtherInputEvent} nys-other-input - Fired when \"other\" text input value changes. Detail: `{id, name, value}`.\n * @fires {NysCheckboxErrorEvent} nys-error - Internal group coordination: reports an empty \"other\" field to the parent `nys-checkboxgroup`. Not part of the public API.\n * @fires {NysCheckboxErrorClearEvent} nys-error-clear - Internal group coordination: clears a previously reported \"other\" field error. Not part of the public API.\n *\n * @usagedos\n * - Use for binary decisions (agree/disagree), confirmation, or multi-select lists.\n * - Use for selecting multiple options from a list of up to 10 choices.\n * - Use `nys-checkboxgroup` to group checkboxes with a shared label and description.\n *\n * @usagedonts\n * - Use when users need to select only one option. Use a `<nys-radiobutton>` for 1–6 choices or a <nys-select> for 7 or more.\n * - Use a checkbox when changing its state immediately affects the system. Use a `<nys-toggle>` instead (e.g., enabling Dark Mode).\n * - Use when you have more than 10 options to choose from.\n * - Change the state of one checkbox based on another being clicked.\n *\n * @example Single\n * ```html\n * <nys-checkbox label=\"I agree to the terms\" name=\"terms\"></nys-checkbox>\n * ```\n *\n * @example Preselected\n * ```html\n * <nys-checkbox label=\"I agree to the terms\" name=\"terms\" checked></nys-checkbox>\n * ```\n */\n\nexport class NysCheckbox extends NysFormControlElement {\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 /**\n * Set by the parent `nys-checkboxgroup` (via property) when all checkboxes\n * in the group share a name, so the group owns the combined form value.\n * Internal coordination state. Do not set manually.\n * @internal\n */\n @state() 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 /** Renders an additional free-text input when checked (\"Other\" option). */\n @property({ type: Boolean, reflect: true }) other = false;\n\n /**\n * Whether the \"other\" free-text field is in an error state. Managed by the\n * component during validation; treat as read-only.\n * @internal\n */\n @property({ type: Boolean }) showOtherError = false;\n\n /**\n * Id of an element in the host's light-DOM tree to borrow the accessible name\n * from (e.g. a table column `<th>`). Enables labelling a checkbox that has no\n * visible label of its own.\n */\n @property({ type: String }) labelledby = \"\";\n\n /**\n * Suppress the internal visible `<nys-label>` (use with `labelledby` for\n * table cells).\n */\n @property({ type: Boolean }) hideLabel = 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 /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n * Form association, ElementInternals, and id generation are provided by\n * NysFormControlElement (@nysds/internals).\n */\n\n connectedCallback() {\n // super.connectedCallback() (NysFormControlElement) assigns an id when one\n // is not provided and reflects default semantics.\n super.connectedCallback();\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 if (this.labelledby) this._syncExternalLabel();\n }\n\n willUpdate(changed: Map<string, unknown>) {\n // Dropping an external label must happen BEFORE render. Clearing the control's\n // element references also removes its aria-labelledby content attribute, so the\n // clear has to precede the render that restores the internal IDREF — otherwise\n // it would delete the very attribute that render just wrote.\n if (changed.has(\"labelledby\") && !this.labelledby) {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) associateControlRefs(input, \"labelledby\", []);\n }\n\n // Keep the form value in sync when `checked` or `value` is set\n // programmatically (for example by a framework binding). User interaction\n // paths also call setFormValue; the duplicate write is harmless. Groups\n // with shared names own the combined form value instead.\n if ((changed.has(\"checked\") || changed.has(\"value\")) && !this.groupExist) {\n this.setFormValue(this.checked ? this.value : null);\n }\n }\n\n updated(changed: Map<string, unknown>) {\n // Applying an external label must happen AFTER render, once the input exists.\n if (changed.has(\"labelledby\") && this.labelledby) this._syncExternalLabel();\n\n // Re-sync ElementInternals: `required` can arrive as a late property\n // write (e.g. a framework wrapper setting it post-hydration, after\n // firstUpdated already ran _manageRequire() once against the old\n // value). The `?required=\"${this.required}\"` template binding already\n // keeps the native <input>'s attribute in sync declaratively; without\n // this, ElementInternals would still report valid, the native `invalid`\n // event would never fire on submit, and showError would never flip even\n // though the checkbox is genuinely required and unchecked.\n if (changed.has(\"required\")) this._manageRequire();\n }\n\n /**\n * Point the native <input> at a light-DOM element that IDREF attributes cannot\n * reach across the shadow boundary. associateControlRefs sets the control's own\n * ariaLabelledByElements (honored in Chromium) plus a string aria-label fallback\n * for engines that do not yet resolve element references.\n *\n * Only ever called with an external labelledby set: with no external target the\n * native input keeps the internal same-root aria-labelledby IDREF that render()\n * emits, and must not be touched.\n */\n private _syncExternalLabel() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n const target = (this.getRootNode() as Document | ShadowRoot).getElementById(\n this.labelledby,\n );\n associateControlRefs(input, \"labelledby\", [target]);\n }\n\n /**\n * Form Integration\n * --------------------------------------------------------------------------\n */\n\n private _setValue() {\n if (!this.groupExist) {\n this.setFormValue(this.checked ? this.value : null);\n }\n }\n\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n if (this.required && !this.checked) {\n this.internalValidationMessage = \"This field is required\";\n this.setValidityFromState(\n { valueMissing: true },\n this.resolvedErrorMessage(),\n input,\n );\n } else {\n this.clearValidity();\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 // Store component-owned validation text separately; a consumer-supplied\n // errorMessage always wins via resolvedErrorMessage() and is never\n // overwritten.\n this.internalValidationMessage = message;\n\n if (message) {\n this.setValidityFromState(\n { customError: true },\n this.resolvedErrorMessage(),\n input,\n );\n } else {\n this.clearValidity();\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.setFormValue(null);\n\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) {\n input.checked = false;\n }\n\n // Reset validation UI. Clears only the component-owned validation text; a\n // consumer-supplied errorMessage is never overwritten.\n this.showError = false;\n this.internalValidationMessage = \"\";\n this.clearValidity();\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 private 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 get _isStandalone() {\n return this.parentElement?.tagName.toLowerCase() !== \"nys-checkboxgroup\";\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n private _handleMobileQuery = () => {\n this.isMobile = this._mobileQuery.matches;\n };\n\n private _emitChangeEvent() {\n dispatchNysEvent<NysCheckboxChangeDetail>(this, \"nys-change\", {\n id: this.id,\n checked: this.checked,\n name: this.name,\n value: this.value,\n });\n }\n\n private _emitOtherInputEvent() {\n dispatchNysEvent<NysCheckboxOtherInputDetail>(this, \"nys-other-input\", {\n id: this.id,\n name: this.name,\n value: this.value,\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.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 dispatchNysFocusBlur(this, \"focus\");\n }\n\n private _handleBlur() {\n dispatchNysFocusBlur(this, \"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.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 dispatchNysEvent<NysCheckboxErrorDetail>(this, \"nys-error\", {\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 } else {\n this._dispatchClearError();\n }\n }\n\n private _dispatchClearError() {\n dispatchNysEvent<NysCheckboxErrorClearDetail>(this, \"nys-error-clear\", {\n sourceCheckbox: this,\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-invalid=${this.showError ? \"true\" : \"false\"}\n aria-errormessage=${this.id + \"--error\"}\n aria-describedby=${ifDefined(\n this.showError ? this.id + \"--error\" : undefined,\n )}\n @change=\"${this._handleChange}\"\n @focus=\"${this._handleFocus}\"\n @keydown=\"${this._handleKeydown}\"\n aria-labelledby=${ifDefined(\n !this.labelledby && (this.label || this.other)\n ? this.id + \"--label\"\n : undefined,\n )}\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.hideLabel || this.labelledby || !(this.label || this.other)\n ? nothing\n : html`<nys-label\n id=\"${this.id}--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 class=${this._isStandalone ? \"standalone\" : \"\"}\n >\n <slot name=\"description\" slot=\"description\"\n >${this.description}</slot\n >\n </nys-label>`}\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=${this.id + \"--error\"}\n class=\"single-error-message\"\n ?showError=${this.showError}\n errorMessage=${this.resolvedErrorMessage()}\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":["LitElement","unsafeCSS","html","nothing","property","state","ifDefined","y","f","e","N","t","s","I","d","R","V","L","n","i","r","a","l","o","h","b","v","C","O","u","_NysCheckboxgroup","NysFormControlElement","event","related","dispatchNysFocusBlur","next","old","changedProperties","checkbox","checkboxes","firstCheckbox","firstCheckboxInput","atLeastOneChecked","targetElement","nodes","node","otherCheckbox","textInput","form","element","selectedValues","customEvent","name","dispatchNysEvent","sourceCheckbox","values","value","firstName","styles","NysCheckboxgroup","__decorateClass","_NysCheckbox","main","inputEl","changed","input","associateControlRefs","target","message","validity","slot","checked","wasChecked","newValue","isInvalid","NysCheckbox"],"mappings":"AACA,SAAA,cAAAA,GAAA,aAAAC,GAAA,QAAAC,GAAA,WAAAC,SAAA;AAAA,SAAA,YAAAC,GAAA,SAAAC,SAAA;AAAA,SAAA,aAAAC,SAAA;AAAA,OAAA;AAAA,OAAA;AAAA,OAAA;AAAA,OAAA;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,IAAIC,IAAI;AACR,SAASC,EAAEC,GAAG;AACZ,SAAO,GAAGA,CAAC,IAAI,KAAK,KAAK,IAAIF,GAAG;AAClC;AACA,SAASG,EAAED,GAAGE,GAAGC,GAAG;AAClB,EAAAH,EAAE;AAAA,IACA,IAAI,YAAYE,GAAG,EAAE,QAAQC,GAAG,SAAS,IAAI,UAAU,GAAE,CAAE;AAAA,EAC/D;AACA;AACA,SAASC,EAAEJ,GAAGE,GAAG;AACf,EAAAF,EAAE;AAAA,IACA,IAAI,MAAM,OAAOE,CAAC,IAAI,EAAE,SAAS,IAAI,UAAU,GAAE,CAAE;AAAA,EACvD;AACA;AAcA,SAASG,EAAEL,GAAG;AACZ,SAAOA,EAAE,OAAO,CAACE,MAAM,CAAC,CAACA,CAAC;AAC5B;AAwBA,MAAMI,IAAI;AAAA,EACR,YAAY;AAAA,EACZ,aAAa;AACf,GAAGC,IAAI;AAAA,EACL,YAAY;AAAA,EACZ,aAAa;AACf;AACA,SAASC,EAAER,GAAGE,GAAGC,GAAG;AAClB,QAAMM,IAAIJ,EAAEF,CAAC,GAAGO,IAAIJ,EAAEJ,CAAC,GAAGS,IAAIJ,EAAEL,CAAC,GAAGU,IAAIZ;AACxC,EAASU,KAAKV,MAAMY,EAAEF,CAAC,IAAID,EAAE,SAASA,IAAI;AAC1C,QAAMI,IAAIJ,EAAE,IAAI,CAACK,MAAMA,EAAE,aAAa,KAAI,KAAM,EAAE,EAAE,OAAO,OAAO,EAAE,KAAK,GAA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AA,YAAA;AAMCf,EAAA;AAAA,EAA5BxD,EAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAhFhBuE,EAgFkB,WAAA,WAAA;AAGZf,EAAA;AAAA,EAAhBvD,EAAA;AAAM,GAnFIsE,EAmFM,WAAA,UAAA;AA6dd,eAAe,IAAI,cAAc,KACpC,eAAe,OAAO,gBAAgBA,CAAW;"}
1
+ {"version":3,"file":"nys-checkbox.js","sources":["../../internals/dist/index.js","../src/nys-checkboxgroup.ts","../src/nys-checkbox.ts"],"sourcesContent":["import { LitElement as u } from \"lit\";\n/*!\n * New York State Design System v1.22.3\n * Description: A design system for New York State's digital products.\n * Repository: https://github.com/its-hcd/nysds\n * License: MIT\n */\nlet y = 0;\nfunction f(e) {\n return `${e}-${Date.now()}-${y++}`;\n}\nfunction N(e, t, s) {\n e.dispatchEvent(\n new CustomEvent(t, { detail: s, bubbles: !0, composed: !0 })\n );\n}\nfunction I(e, t) {\n e.dispatchEvent(\n new Event(`nys-${t}`, { bubbles: !0, composed: !0 })\n );\n}\nconst p = {\n labelledby: \"ariaLabelledByElements\",\n describedby: \"ariaDescribedByElements\"\n}, g = {\n labelledby: \"ariaLabel\",\n describedby: \"ariaDescription\"\n};\nfunction _(e) {\n return \"ariaDescribedByElements\" in e;\n}\nfunction E(e) {\n return e === \"errormessage\" ? \"aria-errormessage\" : `aria-${e}`;\n}\nfunction d(e) {\n return e.filter((t) => !!t);\n}\nfunction A(e) {\n return e.map((t) => (t.id || (t.id = f(\"nys-ref\")), t.id));\n}\nfunction w(e, t, s) {\n const n = d(s), i = E(t);\n n.length ? e.setAttribute(i, A(n).join(\" \")) : e.removeAttribute(i);\n}\nfunction x(e, t, s, n, i) {\n const r = d(n), a = p[s], l = t;\n if (a && _(t)) {\n l[a] = r.length ? r : null;\n return;\n }\n const o = g[s];\n if (!o) return;\n const c = i ?? (r.length ? r.map((m) => m.textContent?.trim() ?? \"\").filter(Boolean).join(\" \") : \"\");\n o in l ? l[o] = c || null : c ? e.setAttribute(\n s === \"labelledby\" ? \"aria-label\" : \"aria-description\",\n c\n ) : e.removeAttribute(\n s === \"labelledby\" ? \"aria-label\" : \"aria-description\"\n );\n}\nconst R = {\n labelledby: \"ariaLabelledByElements\",\n describedby: \"ariaDescribedByElements\"\n}, V = {\n labelledby: \"aria-label\",\n describedby: \"aria-description\"\n};\nfunction L(e, t, s) {\n const n = d(s), i = R[t], r = V[t], a = e;\n if (i && i in e && (a[i] = n.length ? n : null), !r) return;\n const l = n.map((o) => o.textContent?.trim() ?? \"\").filter(Boolean).join(\" \");\n l ? e.setAttribute(r, l) : e.removeAttribute(r);\n}\nconst h = (e) => {\n class t extends e {\n get idPrefix() {\n return this.localName || \"nys-element\";\n }\n ensureId() {\n this.id || (this.id = f(this.idPrefix));\n }\n connectedCallback() {\n super.connectedCallback(), this.ensureId();\n }\n }\n return t;\n}, P = /* @__PURE__ */ h(u), b = (e) => {\n class t extends h(e) {\n constructor() {\n super(...arguments), this.__internals = null;\n }\n get internals() {\n if (this.__internals) return this.__internals;\n if (typeof this.attachInternals == \"function\")\n try {\n this.__internals = this.attachInternals();\n } catch {\n this.__internals = null;\n }\n return this.__internals;\n }\n get defaultRole() {\n return null;\n }\n setHostAria(n, i) {\n const r = this.internals;\n if (r && n in r) {\n r[n] = i;\n return;\n }\n const a = v(n);\n i === null ? this.removeAttribute(a) : this.setAttribute(a, i);\n }\n reflectDefaultSemantics() {\n const n = this.defaultRole;\n n && this.setHostAria(\"role\", n);\n }\n connectedCallback() {\n super.connectedCallback(), this.reflectDefaultSemantics();\n }\n }\n return t;\n};\nfunction v(e) {\n if (e === \"role\") return \"role\";\n const t = e.replace(/^aria/, \"\");\n return \"aria-\" + t.charAt(0).toLowerCase() + t.slice(1);\n}\nconst T = /* @__PURE__ */ b(u), C = (e) => {\n const s = class s extends b(e) {\n constructor() {\n super(...arguments), this.__internalValidationMessage = \"\";\n }\n get internalValidationMessage() {\n return this.__internalValidationMessage;\n }\n set internalValidationMessage(i) {\n i !== this.__internalValidationMessage && (this.__internalValidationMessage = i, this.requestUpdate(\"internalValidationMessage\"));\n }\n resolvedErrorMessage() {\n return this.errorMessage || this.internalValidationMessage;\n }\n setFormValue(i) {\n this.internals?.setFormValue(i ?? null);\n }\n setValidityFromState(i, r, a) {\n const l = this.internals;\n if (!l) return;\n const o = Object.values(i).some(Boolean);\n o ? l.setValidity(i, r ?? \"Invalid value\", a) : l.setValidity({}), this.setHostAria(\"ariaInvalid\", o ? \"true\" : \"false\");\n }\n clearValidity() {\n this.internals?.setValidity({}), this.setHostAria(\"ariaInvalid\", \"false\");\n }\n checkValidity() {\n return this.internals?.checkValidity() ?? !0;\n }\n reportValidity() {\n return this.internals?.reportValidity() ?? !0;\n }\n formResetCallback() {\n this.internalValidationMessage = \"\", this.clearValidity();\n }\n };\n s.formAssociated = !0;\n let t = s;\n return t;\n}, O = /* @__PURE__ */ C(u);\nfunction B(e) {\n const t = e.tagName.toLowerCase(), s = /* @__PURE__ */ new Set(), n = (i) => {\n i.querySelectorAll(\"*\").forEach((r) => {\n const a = r.tagName.toLowerCase();\n a.startsWith(\"nys-\") && a !== t && !customElements.get(a) && s.add(a), r.shadowRoot && n(r.shadowRoot);\n });\n };\n return e.shadowRoot && n(e.shadowRoot), n(e), [...s].sort();\n}\nexport {\n C as FormControlMixin,\n h as IdentifiedMixin,\n P as NysElement,\n O as NysFormControlElement,\n T as NysReflectsAriaElement,\n b as ReflectsAriaMixin,\n w as associateControl,\n L as associateControlRefs,\n x as associateHost,\n N as dispatchNysEvent,\n I as dispatchNysFocusBlur,\n B as findUnregisteredChildren,\n f as generateId,\n _ as supportsElementRefs\n};\n//# sourceMappingURL=index.js.map\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport {\n NysFormControlElement,\n dispatchNysEvent,\n dispatchNysFocusBlur,\n} from \"@nysds/internals\";\n// These internal elements are rendered inside this component's shadow DOM, so\n// they must be registered whenever nys-checkboxgroup is used. Importing them\n// here (intentional side effect) guarantees the visible label and error message —\n// which the accessible name/error association depends on — always render.\nimport \"@nysds/nys-label\";\nimport \"@nysds/nys-errormessage\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\nimport type { NysCheckbox } from \"./nys-checkbox\";\n\n/** Detail payload for the `nys-change` event fired by `nys-checkboxgroup`. */\nexport interface NysCheckboxgroupChangeDetail {\n id: string;\n name: string;\n value: string[];\n}\n\n/** The `nys-change` event fired by `nys-checkboxgroup`. */\nexport type NysCheckboxgroupChangeEvent =\n CustomEvent<NysCheckboxgroupChangeDetail>;\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 * @formControl value nys-change\n *\n * @slot - Default slot for `nys-checkbox` elements.\n * @slot description - Custom HTML description content.\n *\n * @fires {NysCheckboxgroupChangeEvent} nys-change - Fired when any child checkbox changes. Detail: `{id, name, value}` where `value` is the checked values as a string array. Bubbles and composed. The child's own `nys-change` keeps bubbling alongside it.\n * @fires {Event} nys-focus - Fired when focus enters the group from outside. Bubbles and composed.\n * @fires {Event} nys-blur - Fired when focus leaves the group. Bubbles and composed.\n *\n * @example Basic\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 * @example Tile\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" tile>\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 * @example Required\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 * @example Optional\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" optional>\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 * @example Disabled\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\">\n * <nys-checkbox name=\"landmarks\" value=\"adirondacks\" label=\"Adirondacks\" disabled></nys-checkbox>\n * <nys-checkbox name=\"landmarks\" value=\"niagara\" label=\"Niagara Falls\" disabled></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n *\n * @example Size Small\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" size=\"sm\">\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 * @example Other Option\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-checkbox name=\"landmarks\" value=\"\" label=\"Other\" other></nys-checkbox>\n * </nys-checkboxgroup>\n * ```\n *\n * @example Error Message\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" showError errorMessage=\"Please select at least one landmark\">\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 * @example Description\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\" description=\"Choose wisely, you can only pick one.\">\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 * @example Description Slot\n * ```html\n * <nys-checkboxgroup label=\"Select landmarks\">\n * <div slot=\"description\">Your <strong>ABSOLUTE</strong> favorite one.</div>\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 NysFormControlElement {\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 private _value: string[] = [];\n\n // Guards the value accessor: true while the group syncs `value` from its\n // children, so the setter doesn't push the same state back down.\n private _syncingValueFromChildren = false;\n\n /**\n * Values of the checked child checkboxes, in DOM order. Setting it\n * programmatically checks the matching children and updates the form value\n * without firing `nys-change`.\n */\n @property({ attribute: false })\n get value(): string[] {\n return this._value;\n }\n\n set value(next: string[]) {\n const old = this._value;\n this._value = Array.isArray(next) ? [...next] : [];\n if (!this._syncingValueFromChildren) {\n this._applyValueToChildren();\n }\n this.requestUpdate(\"value\", old);\n }\n\n @state() private _slottedDescriptionText = \"\";\n @state() private _hasOtherError = false;\n @state() private _otherErrorCheckbox: NysCheckbox | null = null;\n\n // Not reactive: only read by event handlers, never by render.\n private _hasSharedNames = false;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n * Form association, ElementInternals, and id generation are provided by\n * NysFormControlElement (@nysds/internals).\n */\n\n connectedCallback() {\n // super.connectedCallback() (NysFormControlElement) assigns an id when one\n // is not provided and reflects default semantics.\n super.connectedCallback();\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 this.addEventListener(\"focusin\", this._handleFocusIn);\n this.addEventListener(\"focusout\", this._handleFocusOut);\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 this.removeEventListener(\"focusin\", this._handleFocusIn);\n this.removeEventListener(\"focusout\", this._handleFocusOut);\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 // `_getSlotDescriptionForAria` runs off the description slot's `slotchange`\n // instead: setting state here would land after the update completed and\n // force a second render (see lit.dev/msg/change-in-update).\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 = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n\n this._hasSharedNames = this._checkSharedNames(checkboxes);\n\n checkboxes.forEach((checkbox: any) => {\n checkbox.groupExist = this._hasSharedNames;\n });\n }\n\n // Initial update on checkbox required attribute\n private async _setupCheckboxRequired() {\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n this.internalValidationMessage = \"This field is required\";\n this.setValidityFromState(\n { valueMissing: true },\n this.resolvedErrorMessage(),\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) {\n this.clearValidity();\n this.internalValidationMessage = \"\";\n this.showError = false;\n return;\n }\n\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.clearValidity();\n this.internalValidationMessage = \"\";\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.internalValidationMessage =\n \"You must make a selection to proceed.\";\n this.setValidityFromState(\n { valueMissing: true },\n this.resolvedErrorMessage(),\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.internalValidationMessage = \"Please complete this field.\";\n this.setValidityFromState(\n { customError: true },\n this.resolvedErrorMessage(),\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.setFormValue(\"\");\n this._setValueFromChildren([]);\n\n // Reset validation UI. Clears only the component-owned validation text; a\n // consumer-supplied errorMessage is never overwritten.\n this.showError = false;\n this.internalValidationMessage = \"\";\n this.clearValidity();\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 // The group dispatches its own nys-change from this handler; ignore that\n // echo so it isn't handled as another child change.\n if (event.target === this) return;\n\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) => checkbox.checked)\n .map((checkbox) => checkbox.value);\n\n if (this._hasSharedNames) {\n const customEvent = event as CustomEvent;\n const { name } = customEvent.detail;\n\n this.name = name;\n this.setFormValue(selectedValues.join(\", \"));\n }\n this._setValueFromChildren(selectedValues);\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 dispatchNysEvent<NysCheckboxgroupChangeDetail>(this, \"nys-change\", {\n id: this.id,\n name: this.name,\n value: [...selectedValues],\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.clearValidity();\n this.internalValidationMessage = \"\";\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._setValueFromChildren(selectedValues);\n this.setFormValue(selectedValues.join(\", \"));\n }\n\n /**\n * Group-level focus: fired only when focus enters from outside the group,\n * so moving between child checkboxes stays silent.\n */\n private _handleFocusIn = (event: FocusEvent) => {\n const related = event.relatedTarget as Node | null;\n if (!related || !this.contains(related)) {\n dispatchNysFocusBlur(this, \"focus\");\n }\n };\n\n /** Group-level blur: fired only when focus leaves the group entirely. */\n private _handleFocusOut = (event: FocusEvent) => {\n const related = event.relatedTarget as Node | null;\n if (!related || !this.contains(related)) {\n dispatchNysFocusBlur(this, \"blur\");\n }\n };\n\n /**\n * Set `value` from the children's checked state without pushing the same\n * state back down (and without firing `nys-change`).\n */\n private _setValueFromChildren(values: string[]) {\n this._syncingValueFromChildren = true;\n this.value = values;\n this._syncingValueFromChildren = false;\n }\n\n /**\n * Apply a programmatically set `value` to the child checkboxes and the form\n * value. Setting `checked` on a child never fires its `nys-change` (only\n * user interaction does), so no change events echo back.\n */\n private _applyValueToChildren() {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n if (checkboxes.length === 0) return;\n\n checkboxes.forEach((checkbox) => {\n checkbox.checked = this._value.includes(checkbox.value);\n });\n\n if (this._hasSharedNames) {\n this.setFormValue(this._value.join(\", \"));\n }\n }\n\n /**\n * Derive `value` from the checked children. Runs off the default slot's\n * `slotchange`, so it covers first render and dynamically added checkboxes\n * without scheduling a second update cycle.\n */\n private _handleDefaultSlotChange() {\n const checkboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as NysCheckbox[];\n this._setValueFromChildren(\n checkboxes\n .filter((checkbox) => checkbox.checked)\n .map((checkbox) => checkbox.value),\n );\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.clearValidity();\n this.internalValidationMessage = \"\";\n this.showError = false;\n }\n }\n }\n\n /** Drupal-like naming support **/\n\n private _checkSharedNames(checkboxes: NysCheckbox[]): boolean {\n if (checkboxes.length === 0) return false;\n const firstName = checkboxes[0].name;\n return checkboxes.every((checkbox) => checkbox.name === firstName);\n }\n\n render() {\n return html`\n <fieldset\n aria-labelledby=${ifDefined(\n this.label ? this.id + \"--label\" : undefined,\n )}\n aria-label=${ifDefined(\n !this.label\n ? `${this._slottedDescriptionText || this.description || \"\"}`.trim() ||\n undefined\n : undefined,\n )}\n class=\"nys-checkboxgroup\"\n role=\"radiogroup\"\n >\n <nys-label\n id=\"${this.id}--label\"\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this.tooltip}\n >\n <slot\n name=\"description\"\n slot=\"description\"\n @slotchange=${this._getSlotDescriptionForAria}\n >${this.description}</slot\n >\n </nys-label>\n <div class=\"nys-checkboxgroup__content\">\n <slot @slotchange=${this._handleDefaultSlotChange}></slot>\n </div>\n <nys-errormessage\n id=${this.id + \"--error\"}\n ?showError=${this.showError}\n errorMessage=${this.resolvedErrorMessage()}\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, nothing, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport {\n NysFormControlElement,\n associateControlRefs,\n dispatchNysEvent,\n dispatchNysFocusBlur,\n} from \"@nysds/internals\";\nimport \"./nys-checkboxgroup\";\n// These internal elements are rendered inside this component's shadow DOM, so\n// they must be registered whenever nys-checkbox is used. Importing them here\n// (intentional side effect) guarantees the visible label and error message —\n// which the accessible name/error association depends on — always render.\n// nys-icon renders the checked-state checkmark; nys-textinput renders the\n// \"other\" free-text field.\nimport \"@nysds/nys-label\";\nimport \"@nysds/nys-errormessage\";\nimport \"@nysds/nys-icon\";\nimport \"@nysds/nys-textinput\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\n/** Detail payload for the `nys-change` event fired by `nys-checkbox`. */\nexport interface NysCheckboxChangeDetail {\n id: string;\n checked: boolean;\n name: string;\n value: string;\n}\n\n/** The `nys-change` event fired by `nys-checkbox`. */\nexport type NysCheckboxChangeEvent = CustomEvent<NysCheckboxChangeDetail>;\n\n/** Detail payload for the `nys-other-input` event fired by `nys-checkbox`. */\nexport interface NysCheckboxOtherInputDetail {\n id: string;\n name: string;\n value: string;\n}\n\n/** The `nys-other-input` event fired by `nys-checkbox`. */\nexport type NysCheckboxOtherInputEvent =\n CustomEvent<NysCheckboxOtherInputDetail>;\n\n/**\n * Detail payload for the `nys-error` group-coordination event.\n * @internal\n */\nexport interface NysCheckboxErrorDetail {\n id: string;\n name: string;\n type: \"other\";\n message: string;\n sourceCheckbox: NysCheckbox;\n}\n\n/**\n * The `nys-error` group-coordination event.\n * @internal\n */\nexport type NysCheckboxErrorEvent = CustomEvent<NysCheckboxErrorDetail>;\n\n/**\n * Detail payload for the `nys-error-clear` group-coordination event.\n * @internal\n */\nexport interface NysCheckboxErrorClearDetail {\n sourceCheckbox: NysCheckbox;\n}\n\n/**\n * The `nys-error-clear` group-coordination event.\n * @internal\n */\nexport type NysCheckboxErrorClearEvent =\n CustomEvent<NysCheckboxErrorClearDetail>;\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 * @formControl checked nys-change\n *\n * @slot description - Custom HTML description content.\n *\n * @fires {NysCheckboxChangeEvent} nys-change - Fired when checked state changes. Detail: `{id, checked, name, value}`. Bubbles and composed.\n * @fires {Event} nys-focus - Fired when checkbox gains focus. Bubbles and composed.\n * @fires {Event} nys-blur - Fired when checkbox loses focus. Bubbles and composed.\n * @fires {NysCheckboxOtherInputEvent} nys-other-input - Fired when \"other\" text input value changes. Detail: `{id, name, value}`.\n * @fires {NysCheckboxErrorEvent} nys-error - Internal group coordination: reports an empty \"other\" field to the parent `nys-checkboxgroup`. Not part of the public API.\n * @fires {NysCheckboxErrorClearEvent} nys-error-clear - Internal group coordination: clears a previously reported \"other\" field error. Not part of the public API.\n *\n * @usagedos\n * - Use for binary decisions (agree/disagree), confirmation, or multi-select lists.\n * - Use for selecting multiple options from a list of up to 10 choices.\n * - Use `nys-checkboxgroup` to group checkboxes with a shared label and description.\n *\n * @usagedonts\n * - Use when users need to select only one option. Use a `<nys-radiobutton>` for 1–6 choices or a <nys-select> for 7 or more.\n * - Use a checkbox when changing its state immediately affects the system. Use a `<nys-toggle>` instead (e.g., enabling Dark Mode).\n * - Use when you have more than 10 options to choose from.\n * - Change the state of one checkbox based on another being clicked.\n *\n * @example Single\n * ```html\n * <nys-checkbox label=\"I agree to the terms\" name=\"terms\"></nys-checkbox>\n * ```\n *\n * @example Preselected\n * ```html\n * <nys-checkbox label=\"I agree to the terms\" name=\"terms\" checked></nys-checkbox>\n * ```\n */\n\nexport class NysCheckbox extends NysFormControlElement {\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 /**\n * Set by the parent `nys-checkboxgroup` (via property) when all checkboxes\n * in the group share a name, so the group owns the combined form value.\n * Internal coordination state. Do not set manually.\n * @internal\n */\n @state() 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 /** Renders an additional free-text input when checked (\"Other\" option). */\n @property({ type: Boolean, reflect: true }) other = false;\n\n /**\n * Whether the \"other\" free-text field is in an error state. Managed by the\n * component during validation; treat as read-only.\n * @internal\n */\n @property({ type: Boolean }) showOtherError = false;\n\n /**\n * Id of an element in the host's light-DOM tree to borrow the accessible name\n * from (e.g. a table column `<th>`). Enables labelling a checkbox that has no\n * visible label of its own.\n */\n @property({ type: String }) labelledby = \"\";\n\n /**\n * Suppress the internal visible `<nys-label>` (use with `labelledby` for\n * table cells).\n */\n @property({ type: Boolean }) hideLabel = 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 /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n * Form association, ElementInternals, and id generation are provided by\n * NysFormControlElement (@nysds/internals).\n */\n\n connectedCallback() {\n // super.connectedCallback() (NysFormControlElement) assigns an id when one\n // is not provided and reflects default semantics.\n super.connectedCallback();\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 if (this.labelledby) this._syncExternalLabel();\n }\n\n willUpdate(changed: Map<string, unknown>) {\n // Dropping an external label must happen BEFORE render. Clearing the control's\n // element references also removes its aria-labelledby content attribute, so the\n // clear has to precede the render that restores the internal IDREF — otherwise\n // it would delete the very attribute that render just wrote.\n if (changed.has(\"labelledby\") && !this.labelledby) {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) associateControlRefs(input, \"labelledby\", []);\n }\n\n // Keep the form value in sync when `checked` or `value` is set\n // programmatically (for example by a framework binding). User interaction\n // paths also call setFormValue; the duplicate write is harmless. Groups\n // with shared names own the combined form value instead.\n if ((changed.has(\"checked\") || changed.has(\"value\")) && !this.groupExist) {\n this.setFormValue(this.checked ? this.value : null);\n }\n }\n\n updated(changed: Map<string, unknown>) {\n // Applying an external label must happen AFTER render, once the input exists.\n if (changed.has(\"labelledby\") && this.labelledby) this._syncExternalLabel();\n\n // Re-sync ElementInternals: `required` can arrive as a late property\n // write (e.g. a framework wrapper setting it post-hydration, after\n // firstUpdated already ran _manageRequire() once against the old\n // value). The `?required=\"${this.required}\"` template binding already\n // keeps the native <input>'s attribute in sync declaratively; without\n // this, ElementInternals would still report valid, the native `invalid`\n // event would never fire on submit, and showError would never flip even\n // though the checkbox is genuinely required and unchecked.\n if (changed.has(\"required\")) this._manageRequire();\n }\n\n /**\n * Point the native <input> at a light-DOM element that IDREF attributes cannot\n * reach across the shadow boundary. associateControlRefs sets the control's own\n * ariaLabelledByElements (honored in Chromium) plus a string aria-label fallback\n * for engines that do not yet resolve element references.\n *\n * Only ever called with an external labelledby set: with no external target the\n * native input keeps the internal same-root aria-labelledby IDREF that render()\n * emits, and must not be touched.\n */\n private _syncExternalLabel() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n const target = (this.getRootNode() as Document | ShadowRoot).getElementById(\n this.labelledby,\n );\n associateControlRefs(input, \"labelledby\", [target]);\n }\n\n /**\n * Form Integration\n * --------------------------------------------------------------------------\n */\n\n private _setValue() {\n if (!this.groupExist) {\n this.setFormValue(this.checked ? this.value : null);\n }\n }\n\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n if (this.required && !this.checked) {\n this.internalValidationMessage = \"This field is required\";\n this.setValidityFromState(\n { valueMissing: true },\n this.resolvedErrorMessage(),\n input,\n );\n } else {\n this.clearValidity();\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 // Store component-owned validation text separately; a consumer-supplied\n // errorMessage always wins via resolvedErrorMessage() and is never\n // overwritten.\n this.internalValidationMessage = message;\n\n if (message) {\n this.setValidityFromState(\n { customError: true },\n this.resolvedErrorMessage(),\n input,\n );\n } else {\n this.clearValidity();\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.setFormValue(null);\n\n const input = this.shadowRoot?.querySelector(\"input\");\n if (input) {\n input.checked = false;\n }\n\n // Reset validation UI. Clears only the component-owned validation text; a\n // consumer-supplied errorMessage is never overwritten.\n this.showError = false;\n this.internalValidationMessage = \"\";\n this.clearValidity();\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 private 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 get _isStandalone() {\n return this.parentElement?.tagName.toLowerCase() !== \"nys-checkboxgroup\";\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n private _handleMobileQuery = () => {\n this.isMobile = this._mobileQuery.matches;\n };\n\n private _emitChangeEvent() {\n dispatchNysEvent<NysCheckboxChangeDetail>(this, \"nys-change\", {\n id: this.id,\n checked: this.checked,\n name: this.name,\n value: this.value,\n });\n }\n\n private _emitOtherInputEvent() {\n dispatchNysEvent<NysCheckboxOtherInputDetail>(this, \"nys-other-input\", {\n id: this.id,\n name: this.name,\n value: this.value,\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.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 dispatchNysFocusBlur(this, \"focus\");\n }\n\n private _handleBlur() {\n dispatchNysFocusBlur(this, \"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.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 dispatchNysEvent<NysCheckboxErrorDetail>(this, \"nys-error\", {\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 } else {\n this._dispatchClearError();\n }\n }\n\n private _dispatchClearError() {\n dispatchNysEvent<NysCheckboxErrorClearDetail>(this, \"nys-error-clear\", {\n sourceCheckbox: this,\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-invalid=${this.showError ? \"true\" : \"false\"}\n aria-errormessage=${this.id + \"--error\"}\n aria-describedby=${ifDefined(\n this.showError ? this.id + \"--error\" : undefined,\n )}\n @change=\"${this._handleChange}\"\n @focus=\"${this._handleFocus}\"\n @keydown=\"${this._handleKeydown}\"\n aria-labelledby=${ifDefined(\n !this.labelledby && (this.label || this.other)\n ? this.id + \"--label\"\n : undefined,\n )}\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.hideLabel || this.labelledby || !(this.label || this.other)\n ? nothing\n : html`<nys-label\n id=\"${this.id}--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 class=${this._isStandalone ? \"standalone\" : \"\"}\n >\n <slot name=\"description\" slot=\"description\"\n >${this.description}</slot\n >\n </nys-label>`}\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=${this.id + \"--error\"}\n class=\"single-error-message\"\n ?showError=${this.showError}\n errorMessage=${this.resolvedErrorMessage()}\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":["LitElement","unsafeCSS","html","nothing","property","state","ifDefined","y","f","e","N","t","s","I","d","R","V","L","n","i","r","a","l","o","h","b","v","C","O","u","_NysCheckboxgroup","NysFormControlElement","event","related","dispatchNysFocusBlur","next","old","changedProperties","checkbox","checkboxes","firstCheckbox","firstCheckboxInput","atLeastOneChecked","targetElement","nodes","node","otherCheckbox","textInput","form","element","selectedValues","customEvent","name","dispatchNysEvent","sourceCheckbox","values","value","firstName","styles","NysCheckboxgroup","__decorateClass","_NysCheckbox","main","inputEl","changed","input","associateControlRefs","target","message","validity","slot","checked","wasChecked","newValue","isInvalid","NysCheckbox"],"mappings":"AACA,SAAA,cAAAA,GAAA,aAAAC,GAAA,QAAAC,GAAA,WAAAC,SAAA;AAAA,SAAA,YAAAC,GAAA,SAAAC,SAAA;AAAA,SAAA,aAAAC,SAAA;AAAA,OAAA;AAAA,OAAA;AAAA,OAAA;AAAA,OAAA;;;;;;;;;;;AAAA;AAAA;AAAA;AAA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"@nysds/nys-checkbox",
3
- "version": "1.22.1",
3
+ "version": "1.22.3",
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,13 +23,13 @@
23
23
  "lit-analyze": "lit-analyzer '**/*.ts'"
24
24
  },
25
25
  "dependencies": {
26
- "@nysds/nys-icon": "^1.22.1",
27
- "@nysds/nys-label": "^1.22.1",
28
- "@nysds/nys-errormessage": "^1.22.1",
29
- "@nysds/nys-textinput": "^1.22.1"
26
+ "@nysds/nys-icon": "^1.22.3",
27
+ "@nysds/nys-label": "^1.22.3",
28
+ "@nysds/nys-errormessage": "^1.22.3",
29
+ "@nysds/nys-textinput": "^1.22.3"
30
30
  },
31
31
  "devDependencies": {
32
- "@nysds/internals": "^1.22.1",
32
+ "@nysds/internals": "^1.22.3",
33
33
  "lit": "^3.3.1",
34
34
  "typescript": "^5.9.3",
35
35
  "vite": "^7.3.1"