@nysds/nys-checkbox 1.11.4 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,21 @@
1
- import { LitElement as p, unsafeCSS as v, html as k } from "lit";
2
- import { property as t, state as g } from "lit/decorators.js";
3
- import { ifDefined as x } from "lit/directives/if-defined.js";
1
+ import { LitElement as x, unsafeCSS as v, html as b } from "lit";
2
+ import { property as r, state as g } from "lit/decorators.js";
3
+ import { ifDefined as k } from "lit/directives/if-defined.js";
4
4
  const _ = ':host{--_nys-checkbox-size: var(--nys-size-400, 32px);--_nys-checkbox-border-radius: var(--nys-radius-md, 4px);--_nys-checkbox-border-width: var(--nys-border-width-md, 2px);--_nys-checkbox-outline-color: var(--nys-color-focus, #004dd1);--_nys-checkbox-outline-width: var(--nys-border-width-md, 2px);--_nys-checkbox-outline-offset: var(--nys-space-2px, 2px);--_nys-checkbox-gap: var(--nys-space-150, 12px);--_nys-checkboxgroup-gap: var(--nys-space-200, 16px);--_nys-checkbox-font-family: var( --nys-font-family-ui, var( --nys-font-family-sans, "Proxima Nova", "Helvetica Neue", "Helvetica", "Arial", sans-serif ) );--_nys-checkbox-font-size: var(--nys-font-size-ui-md, 16px);--_nys-checkbox-font-weight: var(--nys-font-weight-regular, 400);--_nys-checkbox-line-height: var(--nys-font-lineheight-ui-md, 24px);--_nys-checkbox-color: var( --nys-color-ink, var(--nys-color-neutral-900, #1b1b1b) );--_nys-checkbox-background-color: var(--nys-color-ink-reverse, #ffffff);--_nys-checkbox-border-color: var(--nys-color-neutral-600, #62666a);--_nys-checkbox-background-color--hover: var( --nys-color-neutral-50, #ededed );--_nys-checkbox-border-color--hover: var(--nys-color-ink, #1b1b1b);--_nys-checkbox-background-color--active: var( --nys-color-neutral-100, #d0d0ce );--_nys-checkbox-border-color--active: var(--nys-color-ink, #1b1b1b);--_nys-checkbox-background-color--checked: var(--nys-color-theme, #154973);--_nys-checkbox-border-color--checked: var(--nys-color-theme, #154973);--_nys-checkbox-background-color--checked--hover: var( --nys-color-theme-strong, #0e324f );--_nys-checkbox-border-color--checked--hover: var( --nys-color-theme-strong, #0e324f );--_nys-checkbox-background-color--checked--active: var( --nys-color-theme-stronger, #081b2b );--_nys-checkbox-border-color--checked--active: var( --nys-color-theme-stronger, #081b2b );--_nys-checkbox-background-color--disabled: var( --nys-color-ink-reverse, #f0f0f0 );--_nys-checkbox-border-color--disabled: var( --nys-color-neutral-400, #757575 );--_nys-checkbox-color--disabled: var(--nys-color-text-disabled, #bec0c1);--_nys-checkbox-background-color--checked--disabled: var( --nys-color-neutral-100, #d0d0ce );--_nys-checkbox-border-color--checked--disabled: var( --nys-color-neutral-100, #d0d0ce )}:host([size=sm]){--_nys-checkbox-size: var(--nys-size-300, 24px);--_nys-checkbox-border-radius: var(--nys-radius-sm, 2px);--_nys-checkboxgroup-gap: var(--nys-space-100, 8px);--_nys-checkbox-gap: var(--nys-space-100, 8px)}:host([size=md]){--_nys-checkbox-size: var(--nys-size-400, 32px);--_nys-checkbox-border-radius: var(--nys-radius-md, 4px)}:host([tile]){--_nys-checkbox-border-width--tile: var(--nys-border-width-sm, 1px);--_nys-checkbox-border-radius--tile: var(--nys-radius-md, 4px);--_nys-checkbox-border-color--tile: var(--nys-color-neutral-100, #d0d0ce);--_nys-checkbox-background-color--tile: var( --nys-color-ink-reverse, #ffffff );--_nys-checkbox-padding--x--tile: var(--nys-space-250, 20px);--_nys-checkbox-padding--y--tile: var(--nys-space-200, 16px);--_nys-checkbox-border-color--tile--hover: var( --nys-color-neutral-700, #4a4d4f );--_nys-checkbox-background-color--tile--hover: var( --nys-color-ink-reverse, #ffffff );--_nys-checkbox-border-color--tile--active: var( --nys-color-neutral-900, #1b1b1b );--_nys-checkbox-background-color--tile--active: var( --nys-color-ink-reverse, #ffffff );--_nys-checkbox-border-color--tile--checked: var( --nys-color-theme-mid, #457aa5 );--_nys-checkbox-background-color--tile--checked: var( --nys-color-theme-faint, #f7fafd );--_nys-checkbox-background-color--tile--disabled: var( --nys-color-ink-reverse, #f0f0f0 );--_nys-checkbox-border-color--tile--disabled: var( --nys-color-neutral-100, #d0d0ce )}:host([tile][size=sm]){--_nys-checkbox-padding--x--tile: var(--nys-space-200, 16px);--_nys-checkbox-padding--y--tile: var(--nys-space-150, 12px)}:host([tile][showError]){--_nys-checkbox-border-color--tile: var(--nys-color-danger, #b52c2c);--_nys-checkbox-border-color--tile--hover: var(--nys-color-danger, #b52c2c);--_nys-checkbox-border-color--tile--active: var( --nys-color-danger, #b52c2c );--_nys-checkbox-border-color--tile--checked: var( --nys-color-danger, #b52c2c )}#single-error-message{--_nys-errormessage-margin-top: var(--nys-space-50, 4px)}.nys-checkboxgroup{display:flex;flex-direction:column;gap:var(--nys-space-200, 16px);font-family:var(--_nys-checkbox-font-family);font-size:var(--_nys-checkbox-font-size);line-height:var(--_nys-checkbox-line-height)}.nys-checkboxgroup__content{display:flex;flex-direction:column;gap:var(--_nys-checkboxgroup-gap)}.nys-checkbox{display:flex;font-family:var(--_nys-checkbox-font-family);font-size:var(--_nys-checkbox-font-size);line-height:var(--_nys-checkbox-line-height);border-radius:var(--_nys-checkbox-border-radius--tile);border:var(--_nys-checkbox-border-width--tile) solid var(--_nys-checkbox-border-color--tile);background:var(--_nys-checkbox-background-color--tile);padding:var(--_nys-checkbox-padding--y--tile) var(--_nys-checkbox-padding--x--tile);gap:var(--_nys-checkbox-gap)}.nys-checkbox__checkboxwrapper{position:relative;display:flex;justify-content:center;align-items:center;max-height:var(--_nys-checkbox-size)}.nys-checkbox__icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);pointer-events:none;color:#fff}.nys-checkbox__checkbox{appearance:none;background-repeat:no-repeat;background-position:center;width:var(--_nys-checkbox-size);min-width:var(--_nys-checkbox-size);min-height:var(--_nys-checkbox-size);height:var(--_nys-checkbox-size);max-width:var(--_nys-checkbox-size);max-height:var(--_nys-checkbox-size);border:solid var(--_nys-checkbox-border-width) var(--_nys-checkbox-border-color);background-color:var(--_nys-checkbox-background-color);border-radius:var(--_nys-checkbox-border-radius);outline-offset:var(--_nys-checkbox-outline-offset);outline:none}.nys-checkbox:hover,.nys-checkbox:hover *{cursor:pointer}.nys-checkbox__checkbox:not(:disabled):checked{background-color:var(--_nys-checkbox-background-color--checked);border-color:var(--_nys-checkbox-border-color--checked)}:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:not(:disabled):checked){border-color:var(--_nys-checkbox-border-color--tile--checked);background-color:var(--_nys-checkbox-background-color--tile--checked)}.nys-checkbox__checkbox:disabled:checked{background-color:var(--_nys-checkbox-background-color--checked--disabled);border-color:var(--_nys-checkbox-border-color--checked--disabled)}:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:disabled:checked){border-color:var(--_nys-checkbox-border-color--tile--disabled);background-color:var(--_nys-checkbox-background-color--tile--disabled)}.nys-checkbox__checkbox:disabled{background-color:var(--_nys-checkbox-background-color--disabled);border-color:var(--_nys-checkbox-border-color--disabled);cursor:not-allowed}.nys-checkbox:has(.nys-checkbox__checkbox:disabled) *{color:var(--_nys-checkbox-color--disabled);cursor:not-allowed;--_nys-label-cursor: not-allowed;--_nys-label-color: var(--_nys-checkbox-color--disabled)}:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:disabled){background-color:var(--_nys-checkbox-background-color--disabled);border-color:var(--_nys-checkbox-border-color--disabled);cursor:not-allowed}.nys-checkbox__checkbox:hover:not(:disabled):not(:checked){background-color:var(--_nys-checkbox-background-color--hover);border-color:var(--_nys-checkbox-border-color--hover)}:host([tile]) .nys-checkbox:hover:has(.nys-checkbox__checkbox:not(:disabled):not(:checked)){border-color:var(--_nys-checkbox-border-color--tile--hover);background-color:var(--_nys-checkbox-background-color--tile--hover);outline:solid var(--_nys-checkbox-border-width--tile) var(--_nys-checkbox-border-color--tile--hover)}.nys-checkbox__checkbox:hover:not(:disabled):checked{border-color:var(--_nys-checkbox-border-color--checked--hover);background-color:var(--_nys-checkbox-background-color--checked--hover)}:host([tile]) .nys-checkbox:hover:has(.nys-checkbox__checkbox:not(:disabled):checked){outline:solid var(--_nys-checkbox-border-width--tile) var(--_nys-checkbox-border-color--tile--checked)}.nys-checkbox__checkbox:active:not(:disabled):not(:checked){background-color:var(--_nys-checkbox-background-color--active);border-color:var(--_nys-checkbox-border-color--active)}:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:active:not(:disabled):not(:checked)){border-color:var(--_nys-checkbox-border-color--tile--active);background-color:var(--_nys-checkbox-background-color--tile--active);outline:solid var(--_nys-checkbox-border-width--tile) var(--_nys-checkbox-border-color--tile--active)}.nys-checkbox__checkbox:active:not(:disabled):checked{border-color:var(--_nys-checkbox-border-color--checked--active);background-color:var(--_nys-checkbox-background-color--checked--active)}:host(:not([tile])) .nys-checkbox__checkbox:focus{outline:solid var(--_nys-checkbox-outline-width) var(--_nys-checkbox-outline-color)}:host([tile]) .nys-checkbox:has(*:focus){outline:solid var(--_nys-checkbox-border-width--tile) var(--_nys-checkbox-outline-color)!important;border-color:var(--_nys-checkbox-outline-color)!important}:host(:not([tile])) .nys-checkbox>nys-label{--_nys-label-font-weight: var(--_nys-checkbox-font-weight)}:host([tile]) .nys-checkbox>nys-label{--_nys-description-font-style: normal}.nys-checkbox__required{color:var(--nys-color-danger, #b52c2c)}.nys-checkbox__requiredwrapper{display:flex;gap:3px}fieldset{all:unset;display:contents}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;border:0}';
5
- var m = Object.defineProperty, w = Object.getOwnPropertyDescriptor, a = (y, e, o, r) => {
6
- for (var s = r > 1 ? void 0 : r ? w(e, o) : e, h = y.length - 1, c; h >= 0; h--)
7
- (c = y[h]) && (s = (r ? c(e, o, s) : c(s)) || s);
8
- return r && s && m(e, o, s), s;
5
+ var m = Object.defineProperty, l = (d, e, o, t) => {
6
+ for (var s = void 0, h = d.length - 1, a; h >= 0; h--)
7
+ (a = d[h]) && (s = a(e, o, s) || s);
8
+ return s && m(e, o, s), s;
9
9
  };
10
- let E = 0;
11
- var d;
12
- const n = (d = class extends p {
10
+ let w = 0;
11
+ const u = class u extends x {
13
12
  // allows use of elementInternals' API
14
13
  constructor() {
15
- super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this.tile = !1, this._tooltip = "", this.inverted = !1, this.form = null, this._slottedDescriptionText = "", this._size = "md", this._internals = this.attachInternals();
16
- }
17
- get size() {
18
- return this._size;
19
- }
20
- set size(e) {
21
- this._size = d.VALID_SIZES.includes(
22
- e
23
- ) ? e : "md";
14
+ super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this.tile = !1, this.tooltip = "", this.inverted = !1, this.form = null, this.size = "md", this._slottedDescriptionText = "", this._internals = this.attachInternals();
24
15
  }
25
16
  // Generate a unique ID if one is not provided
26
17
  connectedCallback() {
27
- super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${E++}`), this.addEventListener("nys-change", this._handleCheckboxChange), this.addEventListener("invalid", this._handleInvalid);
18
+ super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${w++}`), this.addEventListener("nys-change", this._handleCheckboxChange), this.addEventListener("invalid", this._handleInvalid);
28
19
  }
29
20
  disconnectedCallback() {
30
21
  super.disconnectedCallback(), this.removeEventListener("nys-change", this._handleCheckboxChange), this.removeEventListener("invalid", this._handleInvalid);
@@ -35,7 +26,10 @@ const n = (d = class extends p {
35
26
  updated(e) {
36
27
  e.has("required") && this.required && this._setupCheckboxRequired(), e.has("size") && this._updateCheckboxSize(), e.has("tile") && this._updateCheckboxTile(), e.has("inverted") && this._updateCheckboxInvert(), e.has("showError") && this._updateCheckboxShowError(), e.has("form") && this._updateCheckboxForm();
37
28
  }
38
- /********************** Functions **********************/
29
+ /**
30
+ * Functions
31
+ * --------------------------------------------------------------------------
32
+ */
39
33
  _setGroupExist() {
40
34
  this.querySelectorAll("nys-checkbox").forEach((o) => {
41
35
  o.groupExist = !0;
@@ -43,23 +37,23 @@ const n = (d = class extends p {
43
37
  }
44
38
  // Initial update on checkbox required attribute
45
39
  async _setupCheckboxRequired() {
46
- const e = this.querySelector("nys-checkbox"), o = this.errorMessage || "This field is required", r = e ? await e.getInputElement() : null;
40
+ const e = this.querySelector("nys-checkbox"), o = this.errorMessage || "This field is required", t = e ? await e.getInputElement() : null;
47
41
  this._internals.setValidity(
48
42
  { valueMissing: !0 },
49
43
  o,
50
- r || this
44
+ t || this
51
45
  );
52
46
  }
53
47
  // Updates the required attribute of each checkbox in the group
54
48
  async _manageRequire() {
55
49
  if (this.required) {
56
- const e = this.errorMessage || "Please select at least one option.", o = this.querySelector("nys-checkbox"), r = o ? await o.getInputElement().catch(() => null) : null, s = this.querySelectorAll("nys-checkbox");
50
+ const e = this.errorMessage || "Please select at least one option.", o = this.querySelector("nys-checkbox"), t = o ? await o.getInputElement().catch(() => null) : null, s = this.querySelectorAll("nys-checkbox");
57
51
  Array.from(s).some(
58
- (c) => c.checked
52
+ (a) => a.checked
59
53
  ) ? (this._internals.setValidity({}), this.showError = !1) : (this._internals.setValidity(
60
54
  { valueMissing: !0 },
61
55
  e,
62
- r || this
56
+ t || this
63
57
  ), this.showError = !0);
64
58
  }
65
59
  }
@@ -94,41 +88,44 @@ const n = (d = class extends p {
94
88
  const o = this.shadowRoot?.querySelector(
95
89
  'slot[name="description"]'
96
90
  )?.assignedNodes({ flatten: !0 }) || [];
97
- this._slottedDescriptionText = o.map((r) => r.textContent?.trim()).filter(Boolean).join(", ");
91
+ this._slottedDescriptionText = o.map((t) => t.textContent?.trim()).filter(Boolean).join(", ");
98
92
  }
99
93
  async _handleInvalid(e) {
100
94
  e.preventDefault(), this.showError = !0, this._manageRequire();
101
- const o = this.querySelector("nys-checkbox"), r = o ? await o.getInputElement() : null;
102
- if (r) {
95
+ const o = this.querySelector("nys-checkbox"), t = o ? await o.getInputElement() : null;
96
+ if (t) {
103
97
  const s = this._internals.form;
104
- s ? Array.from(s.elements).find((u) => {
105
- if (u.tagName.toLowerCase() === "nys-checkboxgroup") {
98
+ s ? Array.from(s.elements).find((y) => {
99
+ if (y.tagName.toLowerCase() === "nys-checkboxgroup") {
106
100
  if (Array.from(
107
101
  this.querySelectorAll("nys-checkbox")
108
102
  ).filter(
109
103
  (f) => f.checked
110
104
  ).length === 0)
111
- return u;
105
+ return y;
112
106
  } else
113
- return typeof u.checkValidity == "function" && !u.checkValidity();
114
- }) === this && r.focus() : r.focus();
107
+ return typeof y.checkValidity == "function" && !y.checkValidity();
108
+ }) === this && t.focus() : t.focus();
115
109
  }
116
110
  }
117
- /******************** Event Handlers ********************/
111
+ /**
112
+ * Event Handlers
113
+ * --------------------------------------------------------------------------
114
+ */
118
115
  // Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.
119
116
  _handleCheckboxChange(e) {
120
- const o = e, { name: r } = o.detail, h = Array.from(this.querySelectorAll("nys-checkbox")).filter((c) => c.checked).map((c) => c.value);
121
- this.name = r, this._internals.setFormValue(h.join(", ")), this._manageRequire();
117
+ const o = e, { name: t } = o.detail, h = Array.from(this.querySelectorAll("nys-checkbox")).filter((a) => a.checked).map((a) => a.value);
118
+ this.name = t, this._internals.setFormValue(h.join(", ")), this._manageRequire();
122
119
  }
123
120
  render() {
124
- return k`
121
+ return b`
125
122
  <div class="nys-checkboxgroup">
126
123
  <nys-label
127
124
  for=${this.id + "--native"}
128
125
  label=${this.label}
129
126
  description=${this.description}
130
127
  flag=${this.required ? "required" : this.optional ? "optional" : ""}
131
- tooltip=${this._tooltip}
128
+ tooltip=${this.tooltip}
132
129
  ?inverted=${this.inverted}
133
130
  >
134
131
  <slot name="description" slot="description">${this.description}</slot>
@@ -149,80 +146,74 @@ const n = (d = class extends p {
149
146
  </div>
150
147
  `;
151
148
  }
152
- }, d.styles = v(_), d.VALID_SIZES = ["sm", "md"], d.formAssociated = !0, d);
153
- a([
154
- t({ type: String, reflect: !0 })
155
- ], n.prototype, "id", 2);
156
- a([
157
- t({ type: String, reflect: !0 })
158
- ], n.prototype, "name", 2);
159
- a([
160
- t({ type: Boolean, reflect: !0 })
161
- ], n.prototype, "required", 2);
162
- a([
163
- t({ type: Boolean, reflect: !0 })
164
- ], n.prototype, "optional", 2);
165
- a([
166
- t({ type: Boolean, reflect: !0 })
167
- ], n.prototype, "showError", 2);
168
- a([
169
- t({ type: String })
170
- ], n.prototype, "errorMessage", 2);
171
- a([
172
- t({ type: String })
173
- ], n.prototype, "label", 2);
174
- a([
175
- t({ type: String })
176
- ], n.prototype, "description", 2);
177
- a([
178
- t({ type: Boolean, reflect: !0 })
179
- ], n.prototype, "tile", 2);
180
- a([
181
- t({ type: String })
182
- ], n.prototype, "_tooltip", 2);
183
- a([
184
- t({ type: Boolean, reflect: !0 })
185
- ], n.prototype, "inverted", 2);
186
- a([
187
- t({ type: String, reflect: !0 })
188
- ], n.prototype, "form", 2);
189
- a([
149
+ };
150
+ u.styles = v(_), u.formAssociated = !0;
151
+ let i = u;
152
+ l([
153
+ r({ type: String, reflect: !0 })
154
+ ], i.prototype, "id");
155
+ l([
156
+ r({ type: String, reflect: !0 })
157
+ ], i.prototype, "name");
158
+ l([
159
+ r({ type: Boolean, reflect: !0 })
160
+ ], i.prototype, "required");
161
+ l([
162
+ r({ type: Boolean, reflect: !0 })
163
+ ], i.prototype, "optional");
164
+ l([
165
+ r({ type: Boolean, reflect: !0 })
166
+ ], i.prototype, "showError");
167
+ l([
168
+ r({ type: String })
169
+ ], i.prototype, "errorMessage");
170
+ l([
171
+ r({ type: String })
172
+ ], i.prototype, "label");
173
+ l([
174
+ r({ type: String })
175
+ ], i.prototype, "description");
176
+ l([
177
+ r({ type: Boolean, reflect: !0 })
178
+ ], i.prototype, "tile");
179
+ l([
180
+ r({ type: String })
181
+ ], i.prototype, "tooltip");
182
+ l([
183
+ r({ type: Boolean, reflect: !0 })
184
+ ], i.prototype, "inverted");
185
+ l([
186
+ r({ type: String, reflect: !0 })
187
+ ], i.prototype, "form");
188
+ l([
189
+ r({ type: String, reflect: !0 })
190
+ ], i.prototype, "size");
191
+ l([
190
192
  g()
191
- ], n.prototype, "_slottedDescriptionText", 2);
192
- a([
193
- t({ reflect: !0 })
194
- ], n.prototype, "size", 1);
195
- let C = n;
196
- customElements.get("nys-checkboxgroup") || customElements.define("nys-checkboxgroup", C);
197
- var S = Object.defineProperty, q = Object.getOwnPropertyDescriptor, l = (y, e, o, r) => {
198
- for (var s = r > 1 ? void 0 : r ? q(e, o) : e, h = y.length - 1, c; h >= 0; h--)
199
- (c = y[h]) && (s = (r ? c(e, o, s) : c(s)) || s);
200
- return r && s && S(e, o, s), s;
193
+ ], i.prototype, "_slottedDescriptionText");
194
+ customElements.get("nys-checkboxgroup") || customElements.define("nys-checkboxgroup", i);
195
+ var E = Object.defineProperty, n = (d, e, o, t) => {
196
+ for (var s = void 0, h = d.length - 1, a; h >= 0; h--)
197
+ (a = d[h]) && (s = a(e, o, s) || s);
198
+ return s && E(e, o, s), s;
201
199
  };
202
- let $ = 0;
203
- var b;
204
- const i = (b = class extends p {
200
+ let C = 0;
201
+ const p = class p extends x {
205
202
  // allows use of elementInternals' API
206
203
  constructor() {
207
- super(), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this.form = null, this.showError = !1, this.errorMessage = "", this.groupExist = !1, this.tile = !1, this.inverted = !1, this._size = "md", this._manageLabelClick = () => {
208
- const e = this.shadowRoot?.querySelector("nys-label"), o = this.shadowRoot?.querySelector("input");
209
- e && o && e.addEventListener("click", () => o.click());
204
+ super(), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this.form = null, this.showError = !1, this.errorMessage = "", this.groupExist = !1, this.tile = !1, this.inverted = !1, this.tooltip = "", this.size = "md", this._manageLabelClick = () => {
205
+ const e = this.shadowRoot?.querySelector(".nys-checkbox"), o = this.shadowRoot?.querySelector("input");
206
+ !e || !o || e.addEventListener("click", (t) => {
207
+ t.target.tagName.toLowerCase() !== "input" && (this.disabled || o.click());
208
+ });
210
209
  }, this._internals = this.attachInternals();
211
210
  }
212
- get size() {
213
- return this._size;
214
- }
215
- set size(e) {
216
- this._size = b.VALID_SIZES.includes(
217
- e
218
- ) ? e : "md";
219
- }
220
211
  async getInputElement() {
221
212
  return await this.updateComplete, this.shadowRoot?.querySelector("input") || null;
222
213
  }
223
214
  // Generate a unique ID if one is not provided
224
215
  connectedCallback() {
225
- super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${$++}`), this.addEventListener("invalid", this._handleInvalid);
216
+ super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${C++}`), this.addEventListener("invalid", this._handleInvalid);
226
217
  }
227
218
  disconnectedCallback() {
228
219
  super.disconnectedCallback(), this.removeEventListener("invalid", this._handleInvalid);
@@ -230,11 +221,10 @@ const i = (b = class extends p {
230
221
  firstUpdated() {
231
222
  this._setValue(), this._manageRequire(), this._manageLabelClick();
232
223
  }
233
- // This callback is automatically called when the parent form is reset.
234
- formResetCallback() {
235
- this.checked = !1;
236
- }
237
- /********************** Form Integration **********************/
224
+ /**
225
+ * Form Integration
226
+ * --------------------------------------------------------------------------
227
+ */
238
228
  _setValue() {
239
229
  this.groupExist || this._internals.setFormValue(this.checked ? this.value : null);
240
230
  }
@@ -254,10 +244,17 @@ const i = (b = class extends p {
254
244
  const e = this.shadowRoot?.querySelector("input");
255
245
  if (!e) return;
256
246
  const o = e.validity;
257
- let r = "";
258
- o.valueMissing && (r = "This field is required"), this._setValidityMessage(r);
247
+ let t = "";
248
+ o.valueMissing && (t = "This field is required"), this._setValidityMessage(t);
249
+ }
250
+ // Called automatically when the parent form is reset
251
+ formResetCallback() {
252
+ this.checked = !1;
259
253
  }
260
- /********************** Functions **********************/
254
+ /**
255
+ * Functions
256
+ * --------------------------------------------------------------------------
257
+ */
261
258
  // This helper function is called to perform the element's native validation.
262
259
  checkValidity() {
263
260
  if (this.required && !this.checked)
@@ -269,13 +266,16 @@ const i = (b = class extends p {
269
266
  e.preventDefault(), this.showError = !0, this._validate();
270
267
  const o = this.shadowRoot?.querySelector("input");
271
268
  if (o) {
272
- const r = this._internals.form;
273
- r ? Array.from(r.elements).find(
274
- (c) => typeof c.checkValidity == "function" && !c.checkValidity()
269
+ const t = this._internals.form;
270
+ t ? Array.from(t.elements).find(
271
+ (a) => typeof a.checkValidity == "function" && !a.checkValidity()
275
272
  ) === this && o.focus() : o.focus();
276
273
  }
277
274
  }
278
- /******************** Event Handlers ********************/
275
+ /**
276
+ * Event Handlers
277
+ * --------------------------------------------------------------------------
278
+ */
279
279
  _emitChangeEvent() {
280
280
  this.dispatchEvent(
281
281
  new CustomEvent("nys-change", {
@@ -295,32 +295,29 @@ const i = (b = class extends p {
295
295
  const { checked: o } = e.target;
296
296
  this.checked = o, this.groupExist || this._internals.setFormValue(this.checked ? this.value : null), this._validate(), this._emitChangeEvent();
297
297
  }
298
- // Handle focus event
299
298
  _handleFocus() {
300
299
  this.dispatchEvent(new Event("nys-focus"));
301
300
  }
302
- // Handle blur event
303
301
  _handleBlur() {
304
302
  this.dispatchEvent(new Event("nys-blur"));
305
303
  }
306
- // Handle keydown for keyboard accessibility
307
304
  async _handleKeydown(e) {
308
305
  e.code === "Space" && (e.preventDefault(), this.disabled || (this.checked = !this.checked, this._internals.setFormValue(this.checked ? this.value : null), await this.updateComplete, this._validate(), this._emitChangeEvent()));
309
306
  }
310
307
  render() {
311
- return k`
312
- <label class="nys-checkbox">
308
+ return b`
309
+ <div class="nys-checkbox">
313
310
  <div class="nys-checkbox__checkboxwrapper">
314
311
  <input
315
312
  id=${this.id + "--native"}
316
313
  class="nys-checkbox__checkbox"
317
314
  type="checkbox"
318
- name="${x(this.name ? this.name : void 0)}"
315
+ name="${k(this.name ? this.name : void 0)}"
319
316
  .checked=${this.checked}
320
317
  ?disabled=${this.disabled}
321
318
  .value=${this.value}
322
319
  ?required="${this.required}"
323
- form=${x(this.form || void 0)}
320
+ form=${k(this.form || void 0)}
324
321
  aria-checked="${this.checked}"
325
322
  aria-disabled="${this.disabled ? "true" : "false"}"
326
323
  aria-required="${this.required}"
@@ -331,18 +328,19 @@ const i = (b = class extends p {
331
328
  @keydown="${this._handleKeydown}"
332
329
  aria-label="${this.label}"
333
330
  />
334
- ${this.checked ? k`<nys-icon
331
+ ${this.checked ? b`<nys-icon
335
332
  name="check"
336
- size="${this.size === "md" ? "4xl" : this.size === "sm" ? "2xl" : "xl"}"
333
+ size="${this.size === "md" ? "4xl" : this.size === "sm" ? "2xl" : "4xl"}"
337
334
  class="nys-checkbox__icon"
338
335
  ></nys-icon>` : ""}
339
336
  </div>
340
- ${this.label && k`
337
+ ${this.label && b`
341
338
  <nys-label
339
+ tooltip=${this.tooltip}
342
340
  for=${this.id + "--native"}
343
341
  label=${this.label}
344
- description=${x(this.description ?? void 0)}
345
- flag=${x(this.required ? "required" : void 0)}
342
+ description=${k(this.description ?? void 0)}
343
+ flag=${k(this.required ? "required" : void 0)}
346
344
  ?inverted=${this.inverted}
347
345
  >
348
346
  <slot name="description" slot="description"
@@ -350,8 +348,8 @@ const i = (b = class extends p {
350
348
  >
351
349
  </nys-label>
352
350
  `}
353
- </label>
354
- ${this.parentElement?.tagName.toLowerCase() !== "nys-checkboxgroup" ? k`<nys-errormessage
351
+ </div>
352
+ ${this.parentElement?.tagName.toLowerCase() !== "nys-checkboxgroup" ? b`<nys-errormessage
355
353
  id="single-error-message"
356
354
  ?showError=${this.showError}
357
355
  errorMessage=${this._internals.validationMessage || this.errorMessage}
@@ -359,56 +357,60 @@ const i = (b = class extends p {
359
357
  ></nys-errormessage>` : ""}
360
358
  `;
361
359
  }
362
- }, b.styles = v(_), b.VALID_SIZES = ["sm", "md"], b.formAssociated = !0, b);
363
- l([
364
- t({ type: Boolean, reflect: !0 })
365
- ], i.prototype, "checked", 2);
366
- l([
367
- t({ type: Boolean, reflect: !0 })
368
- ], i.prototype, "disabled", 2);
369
- l([
370
- t({ type: Boolean, reflect: !0 })
371
- ], i.prototype, "required", 2);
372
- l([
373
- t({ type: String })
374
- ], i.prototype, "label", 2);
375
- l([
376
- t({ type: String })
377
- ], i.prototype, "description", 2);
378
- l([
379
- t({ type: String, reflect: !0 })
380
- ], i.prototype, "id", 2);
381
- l([
382
- t({ type: String, reflect: !0 })
383
- ], i.prototype, "name", 2);
384
- l([
385
- t({ type: String })
386
- ], i.prototype, "value", 2);
387
- l([
388
- t({ type: String, reflect: !0 })
389
- ], i.prototype, "form", 2);
390
- l([
391
- t({ type: Boolean, reflect: !0 })
392
- ], i.prototype, "showError", 2);
393
- l([
394
- t({ type: String })
395
- ], i.prototype, "errorMessage", 2);
396
- l([
397
- t({ type: Boolean })
398
- ], i.prototype, "groupExist", 2);
399
- l([
400
- t({ type: Boolean, reflect: !0 })
401
- ], i.prototype, "tile", 2);
402
- l([
403
- t({ type: Boolean, reflect: !0 })
404
- ], i.prototype, "inverted", 2);
405
- l([
406
- t({ reflect: !0 })
407
- ], i.prototype, "size", 1);
408
- let z = i;
409
- customElements.get("nys-checkbox") || customElements.define("nys-checkbox", z);
360
+ };
361
+ p.styles = v(_), p.formAssociated = !0;
362
+ let c = p;
363
+ n([
364
+ r({ type: Boolean, reflect: !0 })
365
+ ], c.prototype, "checked");
366
+ n([
367
+ r({ type: Boolean, reflect: !0 })
368
+ ], c.prototype, "disabled");
369
+ n([
370
+ r({ type: Boolean, reflect: !0 })
371
+ ], c.prototype, "required");
372
+ n([
373
+ r({ type: String })
374
+ ], c.prototype, "label");
375
+ n([
376
+ r({ type: String })
377
+ ], c.prototype, "description");
378
+ n([
379
+ r({ type: String, reflect: !0 })
380
+ ], c.prototype, "id");
381
+ n([
382
+ r({ type: String, reflect: !0 })
383
+ ], c.prototype, "name");
384
+ n([
385
+ r({ type: String })
386
+ ], c.prototype, "value");
387
+ n([
388
+ r({ type: String, reflect: !0 })
389
+ ], c.prototype, "form");
390
+ n([
391
+ r({ type: Boolean, reflect: !0 })
392
+ ], c.prototype, "showError");
393
+ n([
394
+ r({ type: String })
395
+ ], c.prototype, "errorMessage");
396
+ n([
397
+ r({ type: Boolean })
398
+ ], c.prototype, "groupExist");
399
+ n([
400
+ r({ type: Boolean, reflect: !0 })
401
+ ], c.prototype, "tile");
402
+ n([
403
+ r({ type: Boolean, reflect: !0 })
404
+ ], c.prototype, "inverted");
405
+ n([
406
+ r({ type: String })
407
+ ], c.prototype, "tooltip");
408
+ n([
409
+ r({ type: String, reflect: !0 })
410
+ ], c.prototype, "size");
411
+ customElements.get("nys-checkbox") || customElements.define("nys-checkbox", c);
410
412
  export {
411
- z as NysCheckbox,
412
- C as NysCheckboxgroup
413
+ c as NysCheckbox,
414
+ i as NysCheckboxgroup
413
415
  };
414
416
  //# sourceMappingURL=nys-checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nys-checkbox.js","sources":["../src/nys-checkboxgroup.ts","../src/nys-checkbox.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\nlet checkboxgroupIdCounter = 0; // Counter for generating unique IDs\n\nexport class NysCheckboxgroup extends LitElement {\n static styles = unsafeCSS(styles);\n\n @property({ type: String, reflect: true }) id = \"\";\n @property({ type: String, reflect: true }) name = \"\";\n @property({ type: Boolean, reflect: true }) required = false;\n @property({ type: Boolean, reflect: true }) optional = false;\n @property({ type: Boolean, reflect: true }) showError = false;\n @property({ type: String }) errorMessage = \"\";\n @property({ type: String }) label = \"\";\n @property({ type: String }) description = \"\";\n @property({ type: Boolean, reflect: true }) tile = false;\n @property({ type: String }) _tooltip = \"\";\n @property({ type: Boolean, reflect: true }) inverted = false;\n @property({ type: String, reflect: true }) form: string | null = null;\n\n @state() private _slottedDescriptionText = \"\";\n private static readonly VALID_SIZES = [\"sm\", \"md\"] as const;\n private _size: (typeof NysCheckboxgroup.VALID_SIZES)[number] = \"md\";\n\n // Getter and setter for the `size` property.\n @property({ reflect: true })\n get size(): (typeof NysCheckboxgroup.VALID_SIZES)[number] {\n return this._size;\n }\n\n set size(value: string) {\n // Check if the provided value is in VALID_WIDTHS. If not, default to \"md\".\n this._size = NysCheckboxgroup.VALID_SIZES.includes(\n value as (typeof NysCheckboxgroup.VALID_SIZES)[number],\n )\n ? (value as (typeof NysCheckboxgroup.VALID_SIZES)[number])\n : \"md\";\n }\n\n private _internals: ElementInternals;\n\n /********************** Lifecycle updates **********************/\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkbox-${Date.now()}-${checkboxgroupIdCounter++}`;\n }\n this.addEventListener(\"nys-change\", this._handleCheckboxChange);\n this.addEventListener(\"invalid\", this._handleInvalid);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"nys-change\", this._handleCheckboxChange);\n this.removeEventListener(\"invalid\", this._handleInvalid);\n }\n\n firstUpdated() {\n // This ensures our checkboxes sets the value only once for formData (not within the individual checkboxes)\n this._setGroupExist();\n this._updateCheckboxSize();\n this._updateCheckboxTile();\n this._updateCheckboxShowError();\n this._getSlotDescriptionForAria();\n }\n\n updated(changedProperties: Map<string | symbol, unknown>) {\n if (changedProperties.has(\"required\")) {\n if (this.required) {\n this._setupCheckboxRequired();\n }\n }\n if (changedProperties.has(\"size\")) {\n this._updateCheckboxSize();\n }\n if (changedProperties.has(\"tile\")) {\n this._updateCheckboxTile();\n }\n if (changedProperties.has(\"inverted\")) {\n this._updateCheckboxInvert();\n }\n if (changedProperties.has(\"showError\")) {\n this._updateCheckboxShowError();\n }\n if (changedProperties.has(\"form\")) {\n this._updateCheckboxForm();\n }\n }\n\n /********************** Functions **********************/\n private _setGroupExist() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox: any) => {\n checkbox.groupExist = true;\n });\n }\n\n // Initial update on checkbox required attribute\n private async _setupCheckboxRequired() {\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const message = this.errorMessage || \"This field is required\";\n\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ? firstCheckboxInput : this,\n );\n }\n\n // Updates the required attribute of each checkbox in the group\n private async _manageRequire() {\n if (this.required) {\n const message = this.errorMessage || \"Please select at least one option.\";\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement().catch(() => null)\n : null;\n\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n // Loop through each child checkbox to see if one is checked.\n const atLeastOneChecked = Array.from(checkboxes).some(\n (checkbox: any) => checkbox.checked,\n );\n\n if (atLeastOneChecked) {\n this._internals.setValidity({});\n this.showError = false;\n } else {\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ? firstCheckboxInput : this,\n );\n this.showError = true;\n }\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 _updateCheckboxInvert() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.inverted) {\n checkbox.toggleAttribute(\"inverted\", true);\n } else {\n checkbox.removeAttribute(\"inverted\");\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 private async _handleInvalid(event: Event) {\n event.preventDefault();\n\n this.showError = true;\n this._manageRequire(); // Refresh validation message\n\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 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 /******************** Event Handlers ********************/\n // Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.\n private _handleCheckboxChange(event: Event) {\n const customEvent = event as CustomEvent;\n const { name } = customEvent.detail;\n const checkboxes = Array.from(this.querySelectorAll(\"nys-checkbox\"));\n\n // Filter to only the checked ones and extract their values.\n const selectedValues = checkboxes\n .filter((checkbox: any) => checkbox.checked)\n .map((checkbox: any) => checkbox.value);\n\n this.name = name;\n\n this._internals.setFormValue(selectedValues.join(\", \"));\n\n this._manageRequire();\n }\n\n render() {\n return html`\n <div class=\"nys-checkboxgroup\">\n <nys-label\n for=${this.id + \"--native\"}\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this._tooltip}\n ?inverted=${this.inverted}\n >\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n </nys-label>\n <div class=\"nys-checkboxgroup__content\">\n <fieldset>\n <legend class=\"sr-only\">\n ${this.label}${this._slottedDescriptionText\n ? ` ${this._slottedDescriptionText}`\n : this.description\n ? ` ${this.description}`\n : \"\"}\n </legend>\n <slot></slot>\n </fieldset>\n </div>\n <nys-errormessage\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage || this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>\n </div>\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkboxgroup\")) {\n customElements.define(\"nys-checkboxgroup\", NysCheckboxgroup);\n}\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport \"./nys-checkboxgroup\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\nlet checkboxIdCounter = 0; // Counter for generating unique IDs\n\nexport class NysCheckbox extends LitElement {\n static styles = unsafeCSS(styles);\n\n @property({ type: Boolean, reflect: true }) checked = false;\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property({ type: Boolean, reflect: true }) required = false;\n @property({ type: String }) label = \"\";\n @property({ type: String }) description = \"\";\n @property({ type: String, reflect: true }) id = \"\";\n @property({ type: String, reflect: true }) name = \"\";\n @property({ type: String }) value = \"\";\n @property({ type: String, reflect: true }) form: string | null = null;\n @property({ type: Boolean, reflect: true }) showError = false;\n @property({ type: String }) errorMessage = \"\";\n @property({ type: Boolean }) groupExist = false;\n @property({ type: Boolean, reflect: true }) tile = false;\n @property({ type: Boolean, reflect: true }) inverted = false;\n private static readonly VALID_SIZES = [\"sm\", \"md\"] as const;\n private _size: (typeof NysCheckbox.VALID_SIZES)[number] = \"md\";\n\n // Getter and setter for the `size` property.\n @property({ reflect: true })\n get size(): (typeof NysCheckbox.VALID_SIZES)[number] {\n return this._size;\n }\n\n set size(value: string) {\n // Check if the provided value is in VALID_SIZES. If not, default to \"md\".\n this._size = NysCheckbox.VALID_SIZES.includes(\n value as (typeof NysCheckbox.VALID_SIZES)[number],\n )\n ? (value as (typeof NysCheckbox.VALID_SIZES)[number])\n : \"md\";\n }\n\n public async getInputElement(): Promise<HTMLInputElement | null> {\n await this.updateComplete; // Wait for the component to finish rendering\n return this.shadowRoot?.querySelector(\"input\") || null;\n }\n\n private _internals: ElementInternals;\n\n /********************** Lifecycle updates **********************/\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkbox-${Date.now()}-${checkboxIdCounter++}`;\n }\n this.addEventListener(\"invalid\", this._handleInvalid);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"invalid\", this._handleInvalid);\n }\n\n firstUpdated() {\n // This ensures our element always participates in the form\n this._setValue();\n this._manageRequire();\n this._manageLabelClick();\n }\n\n // This callback is automatically called when the parent form is reset.\n formResetCallback() {\n this.checked = false;\n }\n\n /********************** Form Integration **********************/\n private _setValue() {\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n }\n\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n const message = this.errorMessage || \"This field is required\";\n if (!input) return;\n\n if (this.required && !this.checked) {\n this._internals.ariaRequired = \"true\";\n this._internals.setValidity({ valueMissing: true }, message, input);\n } else {\n this._internals.setValidity({});\n }\n }\n\n private _setValidityMessage(message: string = \"\") {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Toggle the HTML <div> tag error message\n this.showError = !!message;\n // If user sets errorMessage, this will always override the native validation message\n if (this.errorMessage?.trim() && message !== \"\") {\n message = this.errorMessage;\n }\n\n this._internals.setValidity(\n message ? { customError: true } : {},\n message,\n input,\n );\n }\n\n private _validate() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Get the native validation state\n const validity = input.validity;\n let message = \"\";\n\n if (validity.valueMissing) {\n message = \"This field is required\";\n }\n\n this._setValidityMessage(message);\n }\n\n /********************** Functions **********************/\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 labelEl = this.shadowRoot?.querySelector(\"nys-label\");\n const inputEl = this.shadowRoot?.querySelector(\"input\");\n\n if (labelEl && inputEl) {\n labelEl.addEventListener(\"click\", () => inputEl.click());\n }\n };\n\n /******************** Event Handlers ********************/\n private _emitChangeEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-change\", {\n detail: {\n id: this.id,\n checked: this.checked,\n name: this.name,\n value: this.value,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n // Handle checkbox change event\n private _handleChange(e: Event) {\n const { checked } = e.target as HTMLInputElement;\n this.checked = checked;\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n this._validate();\n this._emitChangeEvent();\n }\n\n // Handle focus event\n private _handleFocus() {\n this.dispatchEvent(new Event(\"nys-focus\"));\n }\n\n // Handle blur event\n private _handleBlur() {\n this.dispatchEvent(new Event(\"nys-blur\"));\n }\n\n // Handle keydown for keyboard accessibility\n private async _handleKeydown(e: KeyboardEvent) {\n if (e.code === \"Space\") {\n e.preventDefault();\n if (!this.disabled) {\n this.checked = !this.checked;\n this._internals.setFormValue(this.checked ? this.value : null);\n\n // Wait for DOM updates before validating. This is necessary to ensure the native input validation state is updated before this.validate().\n await this.updateComplete;\n this._validate();\n\n this._emitChangeEvent();\n }\n }\n }\n\n render() {\n return html`\n <label class=\"nys-checkbox\">\n <div class=\"nys-checkbox__checkboxwrapper\">\n <input\n id=${this.id + \"--native\"}\n class=\"nys-checkbox__checkbox\"\n type=\"checkbox\"\n name=\"${ifDefined(this.name ? this.name : undefined)}\"\n .checked=${this.checked}\n ?disabled=${this.disabled}\n .value=${this.value}\n ?required=\"${this.required}\"\n form=${ifDefined(this.form || undefined)}\n aria-checked=\"${this.checked}\"\n aria-disabled=\"${this.disabled ? \"true\" : \"false\"}\"\n aria-required=\"${this.required}\"\n aria-describedby=\"group-info\"\n @change=\"${this._handleChange}\"\n @focus=\"${this._handleFocus}\"\n @blur=\"${this._handleBlur}\"\n @keydown=\"${this._handleKeydown}\"\n aria-label=\"${this.label}\"\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 : \"xl\"}\"\n class=\"nys-checkbox__icon\"\n ></nys-icon>`\n : \"\"}\n </div>\n ${this.label &&\n html`\n <nys-label\n for=${this.id + \"--native\"}\n label=${this.label}\n description=${ifDefined(this.description ?? undefined)}\n flag=${ifDefined(this.required ? \"required\" : undefined)}\n ?inverted=${this.inverted}\n >\n <slot name=\"description\" slot=\"description\"\n >${this.description}</slot\n >\n </nys-label>\n `}\n </label>\n ${this.parentElement?.tagName.toLowerCase() !== \"nys-checkboxgroup\"\n ? html`<nys-errormessage\n id=\"single-error-message\"\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage ||\n this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>`\n : \"\"}\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkbox\")) {\n customElements.define(\"nys-checkbox\", NysCheckbox);\n}\n"],"names":["checkboxgroupIdCounter","_NysCheckboxgroup","_a","LitElement","value","changedProperties","checkbox","firstCheckbox","message","firstCheckboxInput","checkboxes","nodes","node","event","form","element","customEvent","name","selectedValues","html","unsafeCSS","styles","__decorateClass","property","state","NysCheckboxgroup","checkboxIdCounter","_NysCheckbox","labelEl","inputEl","input","validity","checked","ifDefined","NysCheckbox"],"mappings":";;;;;;;;;AAKA,IAAIA,IAAyB;;AAEtB,MAAMC,KAANC,IAAA,cAA+BC,EAAW;AAAA;AAAA,EAwC/C,cAAc;AACZ,UAAA,GAtCyC,KAAA,KAAK,IACL,KAAA,OAAO,IACN,KAAA,WAAW,IACX,KAAA,WAAW,IACX,KAAA,YAAY,IAC5B,KAAA,eAAe,IACf,KAAA,QAAQ,IACR,KAAA,cAAc,IACE,KAAA,OAAO,IACvB,KAAA,WAAW,IACK,KAAA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,MAAM,QAAA,CAAS;AAAA,GAdhBI,EAckB,WAAA,cAAA,CAAA;AACeL,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAf/BI,EAeiC,WAAA,QAAA,CAAA;AACAL,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAhB/BI,EAgBiC,WAAA,YAAA,CAAA;AAMxCL,EAAA;AAAA,EADHC,EAAS,EAAE,SAAS,GAAA,CAAM;AAAA,GArBhBI,EAsBP,WAAA,QAAA,CAAA;AAtBC,IAAMO,IAANP;AA2SF,eAAe,IAAI,cAAc,KACpC,eAAe,OAAO,gBAAgBO,CAAW;"}
1
+ {"version":3,"file":"nys-checkbox.js","sources":["../src/nys-checkboxgroup.ts","../src/nys-checkbox.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\nlet checkboxgroupIdCounter = 0;\n\n/**\n * `<nys-checkboxgroup>` is a form-associated container for multiple `<nys-checkbox>` components.\n * Handles grouping, validation, required constraints, form submission, and accessibility.\n *\n * Features:\n * - Manages multiple checkboxes as a single form field\n * - Supports required/optional flags and error messages\n * - Propagates size, tile, and inverted styling to child checkboxes\n * - Keyboard and screen reader accessible via fieldset/legend\n *\n * @slot default - Slot for child `<nys-checkbox>` elements\n * @slot description - Slot for custom description content\n *\n * @fires nys-change - Fired when any child checkbox changes\n * @fires nys-focus - Fired when any child checkbox gains focus\n * @fires nys-blur - Fired when any child checkbox loses focus\n */\n\nexport class NysCheckboxgroup extends LitElement {\n static styles = unsafeCSS(styles);\n\n @property({ type: String, reflect: true }) id = \"\";\n @property({ type: String, reflect: true }) name = \"\";\n @property({ type: Boolean, reflect: true }) required = false;\n @property({ type: Boolean, reflect: true }) optional = false;\n @property({ type: Boolean, reflect: true }) showError = false;\n @property({ type: String }) errorMessage = \"\";\n @property({ type: String }) label = \"\";\n @property({ type: String }) description = \"\";\n @property({ type: Boolean, reflect: true }) tile = false;\n @property({ type: String }) tooltip = \"\";\n @property({ type: Boolean, reflect: true }) inverted = false;\n @property({ type: String, reflect: true }) form: string | null = null;\n @property({ type: String, reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n @state() private _slottedDescriptionText = \"\";\n\n private _internals: ElementInternals;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n */\n\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkbox-${Date.now()}-${checkboxgroupIdCounter++}`;\n }\n this.addEventListener(\"nys-change\", this._handleCheckboxChange);\n this.addEventListener(\"invalid\", this._handleInvalid);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"nys-change\", this._handleCheckboxChange);\n this.removeEventListener(\"invalid\", this._handleInvalid);\n }\n\n firstUpdated() {\n // This ensures our checkboxes sets the value only once for formData (not within the individual checkboxes)\n this._setGroupExist();\n this._updateCheckboxSize();\n this._updateCheckboxTile();\n this._updateCheckboxShowError();\n this._getSlotDescriptionForAria();\n }\n\n updated(changedProperties: Map<string | symbol, unknown>) {\n if (changedProperties.has(\"required\")) {\n if (this.required) {\n this._setupCheckboxRequired();\n }\n }\n if (changedProperties.has(\"size\")) {\n this._updateCheckboxSize();\n }\n if (changedProperties.has(\"tile\")) {\n this._updateCheckboxTile();\n }\n if (changedProperties.has(\"inverted\")) {\n this._updateCheckboxInvert();\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 _setGroupExist() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox: any) => {\n checkbox.groupExist = true;\n });\n }\n\n // Initial update on checkbox required attribute\n private async _setupCheckboxRequired() {\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const message = this.errorMessage || \"This field is required\";\n\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement()\n : null;\n\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ? firstCheckboxInput : this,\n );\n }\n\n // Updates the required attribute of each checkbox in the group\n private async _manageRequire() {\n if (this.required) {\n const message = this.errorMessage || \"Please select at least one option.\";\n const firstCheckbox = this.querySelector(\"nys-checkbox\");\n const firstCheckboxInput = firstCheckbox\n ? await (firstCheckbox as any).getInputElement().catch(() => null)\n : null;\n\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n // Loop through each child checkbox to see if one is checked.\n const atLeastOneChecked = Array.from(checkboxes).some(\n (checkbox: any) => checkbox.checked,\n );\n\n if (atLeastOneChecked) {\n this._internals.setValidity({});\n this.showError = false;\n } else {\n this._internals.setValidity(\n { valueMissing: true },\n message,\n firstCheckboxInput ? firstCheckboxInput : this,\n );\n this.showError = true;\n }\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 _updateCheckboxInvert() {\n const checkboxes = this.querySelectorAll(\"nys-checkbox\");\n checkboxes.forEach((checkbox) => {\n if (this.inverted) {\n checkbox.toggleAttribute(\"inverted\", true);\n } else {\n checkbox.removeAttribute(\"inverted\");\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 private async _handleInvalid(event: Event) {\n event.preventDefault();\n\n this.showError = true;\n this._manageRequire(); // Refresh validation message\n\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 checkboxgroup, we see if anyone checkboxes within the group is checked to fulfill required constraint\n if (element.tagName.toLowerCase() === \"nys-checkboxgroup\") {\n const allCheckboxes = Array.from(\n this.querySelectorAll(\"nys-checkbox\"),\n ) as any[];\n const hasCheckedCheckbox = allCheckboxes.filter(\n (checkbox) => checkbox.checked,\n );\n // Required constraint not met, continue logic to have this component be focused\n if (hasCheckedCheckbox.length === 0) {\n return element;\n }\n } else {\n return (\n typeof element.checkValidity === \"function\" &&\n !element.checkValidity()\n );\n }\n });\n\n if (firstInvalidElement === this) {\n firstCheckboxInput.focus();\n }\n } else {\n // If not part of a form, simply focus.\n firstCheckboxInput.focus();\n }\n }\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n // Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.\n private _handleCheckboxChange(event: Event) {\n const customEvent = event as CustomEvent;\n const { name } = customEvent.detail;\n const checkboxes = Array.from(this.querySelectorAll(\"nys-checkbox\"));\n\n // Filter to only the checked ones and extract their values.\n const selectedValues = checkboxes\n .filter((checkbox: any) => checkbox.checked)\n .map((checkbox: any) => checkbox.value);\n\n this.name = name;\n\n this._internals.setFormValue(selectedValues.join(\", \"));\n\n this._manageRequire();\n }\n\n render() {\n return html`\n <div class=\"nys-checkboxgroup\">\n <nys-label\n for=${this.id + \"--native\"}\n label=${this.label}\n description=${this.description}\n flag=${this.required ? \"required\" : this.optional ? \"optional\" : \"\"}\n tooltip=${this.tooltip}\n ?inverted=${this.inverted}\n >\n <slot name=\"description\" slot=\"description\">${this.description}</slot>\n </nys-label>\n <div class=\"nys-checkboxgroup__content\">\n <fieldset>\n <legend class=\"sr-only\">\n ${this.label}${this._slottedDescriptionText\n ? ` ${this._slottedDescriptionText}`\n : this.description\n ? ` ${this.description}`\n : \"\"}\n </legend>\n <slot></slot>\n </fieldset>\n </div>\n <nys-errormessage\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage || this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>\n </div>\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkboxgroup\")) {\n customElements.define(\"nys-checkboxgroup\", NysCheckboxgroup);\n}\n","import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport \"./nys-checkboxgroup\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-checkbox.scss?inline\";\n\nlet checkboxIdCounter = 0;\n\n/**\n * `<nys-checkbox>` is an accessible, form-associated checkbox component.\n * Can be used standalone or within a `<nys-checkboxgroup>`.\n *\n * Features:\n * - Supports labels, descriptions, and tooltips\n * - Displays error messages with `showError` and `errorMessage`\n * - Keyboard interaction with spacebar toggle\n * - Form integration via ElementInternals (`checked` value submitted)\n *\n * @fires nys-change - Fired when checkbox value changes\n * @fires nys-focus - Fired on focus\n * @fires nys-blur - Fired on blur\n *\n * @slot description - Slot to provide a custom description element\n */\n\nexport class NysCheckbox extends LitElement {\n static styles = unsafeCSS(styles);\n\n @property({ type: Boolean, reflect: true }) checked = false;\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property({ type: Boolean, reflect: true }) required = false;\n @property({ type: String }) label = \"\";\n @property({ type: String }) description = \"\";\n @property({ type: String, reflect: true }) id = \"\";\n @property({ type: String, reflect: true }) name = \"\";\n @property({ type: String }) value = \"\";\n @property({ type: String, reflect: true }) form: string | null = null;\n @property({ type: Boolean, reflect: true }) showError = false;\n @property({ type: String }) errorMessage = \"\";\n @property({ type: Boolean }) groupExist = false;\n @property({ type: Boolean, reflect: true }) tile = false;\n @property({ type: Boolean, reflect: true }) inverted = false;\n @property({ type: String }) tooltip = \"\";\n @property({ type: String, reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n public async getInputElement(): Promise<HTMLInputElement | null> {\n await this.updateComplete; // Wait for the component to finish rendering\n return this.shadowRoot?.querySelector(\"input\") || null;\n }\n\n private _internals: ElementInternals;\n\n /**\n * Lifecycle methods\n * --------------------------------------------------------------------------\n */\n\n static formAssociated = true; // allows use of elementInternals' API\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n // Generate a unique ID if one is not provided\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-checkbox-${Date.now()}-${checkboxIdCounter++}`;\n }\n this.addEventListener(\"invalid\", this._handleInvalid);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener(\"invalid\", this._handleInvalid);\n }\n\n firstUpdated() {\n // This ensures our element always participates in the form\n this._setValue();\n this._manageRequire();\n this._manageLabelClick();\n }\n\n /**\n * Form Integration\n * --------------------------------------------------------------------------\n */\n\n private _setValue() {\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n }\n\n private _manageRequire() {\n const input = this.shadowRoot?.querySelector(\"input\");\n const message = this.errorMessage || \"This field is required\";\n if (!input) return;\n\n if (this.required && !this.checked) {\n this._internals.ariaRequired = \"true\";\n this._internals.setValidity({ valueMissing: true }, message, input);\n } else {\n this._internals.setValidity({});\n }\n }\n\n private _setValidityMessage(message: string = \"\") {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Toggle the HTML <div> tag error message\n this.showError = !!message;\n // If user sets errorMessage, this will always override the native validation message\n if (this.errorMessage?.trim() && message !== \"\") {\n message = this.errorMessage;\n }\n\n this._internals.setValidity(\n message ? { customError: true } : {},\n message,\n input,\n );\n }\n\n private _validate() {\n const input = this.shadowRoot?.querySelector(\"input\");\n if (!input) return;\n\n // Get the native validation state\n const validity = input.validity;\n let message = \"\";\n\n if (validity.valueMissing) {\n message = \"This field is required\";\n }\n\n this._setValidityMessage(message);\n }\n\n // Called automatically when the parent form is reset\n formResetCallback() {\n this.checked = false;\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 wrapper = this.shadowRoot?.querySelector(\".nys-checkbox\");\n const inputEl = this.shadowRoot?.querySelector(\"input\");\n\n if (!wrapper || !inputEl) return;\n\n wrapper.addEventListener(\"click\", (e) => {\n // Avoid double toggling the checkbox. Already handled by input\n if ((e.target as HTMLElement).tagName.toLowerCase() === \"input\") return;\n\n if (!this.disabled) {\n inputEl.click();\n }\n });\n };\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n private _emitChangeEvent() {\n this.dispatchEvent(\n new CustomEvent(\"nys-change\", {\n detail: {\n id: this.id,\n checked: this.checked,\n name: this.name,\n value: this.value,\n },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n // Handle checkbox change event\n private _handleChange(e: Event) {\n const { checked } = e.target as HTMLInputElement;\n this.checked = checked;\n if (!this.groupExist) {\n this._internals.setFormValue(this.checked ? this.value : null);\n }\n this._validate();\n this._emitChangeEvent();\n }\n\n private _handleFocus() {\n this.dispatchEvent(new Event(\"nys-focus\"));\n }\n\n private _handleBlur() {\n this.dispatchEvent(new Event(\"nys-blur\"));\n }\n\n private async _handleKeydown(e: KeyboardEvent) {\n if (e.code === \"Space\") {\n e.preventDefault();\n if (!this.disabled) {\n this.checked = !this.checked;\n this._internals.setFormValue(this.checked ? this.value : null);\n\n // Wait for DOM updates before validating. This is necessary to ensure the native input validation state is updated before this.validate().\n await this.updateComplete;\n this._validate();\n\n this._emitChangeEvent();\n }\n }\n }\n\n render() {\n return html`\n <div class=\"nys-checkbox\">\n <div class=\"nys-checkbox__checkboxwrapper\">\n <input\n id=${this.id + \"--native\"}\n class=\"nys-checkbox__checkbox\"\n type=\"checkbox\"\n name=\"${ifDefined(this.name ? this.name : undefined)}\"\n .checked=${this.checked}\n ?disabled=${this.disabled}\n .value=${this.value}\n ?required=\"${this.required}\"\n form=${ifDefined(this.form || undefined)}\n aria-checked=\"${this.checked}\"\n aria-disabled=\"${this.disabled ? \"true\" : \"false\"}\"\n aria-required=\"${this.required}\"\n aria-describedby=\"group-info\"\n @change=\"${this._handleChange}\"\n @focus=\"${this._handleFocus}\"\n @blur=\"${this._handleBlur}\"\n @keydown=\"${this._handleKeydown}\"\n aria-label=\"${this.label}\"\n />\n ${this.checked\n ? html`<nys-icon\n name=\"check\"\n size=\"${this.size === \"md\"\n ? \"4xl\"\n : this.size === \"sm\"\n ? \"2xl\"\n : \"4xl\"}\"\n class=\"nys-checkbox__icon\"\n ></nys-icon>`\n : \"\"}\n </div>\n ${this.label &&\n html`\n <nys-label\n tooltip=${this.tooltip}\n for=${this.id + \"--native\"}\n label=${this.label}\n description=${ifDefined(this.description ?? undefined)}\n flag=${ifDefined(this.required ? \"required\" : undefined)}\n ?inverted=${this.inverted}\n >\n <slot name=\"description\" slot=\"description\"\n >${this.description}</slot\n >\n </nys-label>\n `}\n </div>\n ${this.parentElement?.tagName.toLowerCase() !== \"nys-checkboxgroup\"\n ? html`<nys-errormessage\n id=\"single-error-message\"\n ?showError=${this.showError}\n errorMessage=${this._internals.validationMessage ||\n this.errorMessage}\n .showDivider=${!this.tile}\n ></nys-errormessage>`\n : \"\"}\n `;\n }\n}\n\nif (!customElements.get(\"nys-checkbox\")) {\n customElements.define(\"nys-checkbox\", NysCheckbox);\n}\n"],"names":["checkboxgroupIdCounter","_NysCheckboxgroup","LitElement","changedProperties","checkbox","firstCheckbox","message","firstCheckboxInput","checkboxes","nodes","node","event","form","element","customEvent","name","selectedValues","html","unsafeCSS","styles","NysCheckboxgroup","__decorateClass","property","state","checkboxIdCounter","_NysCheckbox","wrapper","inputEl","e","input","validity","checked","ifDefined","NysCheckbox"],"mappings":";;;;;;;;;AAKA,IAAIA,IAAyB;AAoBtB,MAAMC,IAAN,MAAMA,UAAyBC,EAAW;AAAA;AAAA,EA4B/C,cAAc;AACZ,U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EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAhB/BW,EAgBiC,WAAA,UAAA;AAChBZ,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAjBfW,EAiBiB,WAAA,SAAA;AACeZ,EAAA;AAAA,EAA1CC,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAlB9BW,EAkBgC,WAAA,MAAA;AA+RxC,eAAe,IAAI,cAAc,KACpC,eAAe,OAAO,gBAAgBA,CAAW;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nysds/nys-checkbox",
3
- "version": "1.11.4",
3
+ "version": "1.13.0",
4
4
  "description": "The Checkbox component from the NYS Design System.",
5
5
  "module": "dist/nys-checkbox.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,9 +23,9 @@
23
23
  "lit-analyze": "lit-analyzer '**/*.ts'"
24
24
  },
25
25
  "dependencies": {
26
- "@nysds/nys-icon": "^1.11.4",
27
- "@nysds/nys-label": "^1.11.4",
28
- "@nysds/nys-errormessage": "^1.11.4"
26
+ "@nysds/nys-icon": "^1.13.0",
27
+ "@nysds/nys-label": "^1.13.0",
28
+ "@nysds/nys-errormessage": "^1.13.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "lit": "^3.3.1",