@nysds/nys-radiobutton 1.6.0 → 1.7.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,4 +1,4 @@
1
- import { css as ut, LitElement as it, html as j } from "lit";
1
+ import { css as pt, LitElement as rt, html as j } from "lit";
2
2
  /*!
3
3
  * ▒█▄░▒█ ▒█░░▒█ ▒█▀▀▀█ ▒█▀▀▄ ▒█▀▀▀█
4
4
  * ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
@@ -14,7 +14,7 @@ import { css as ut, LitElement as it, html as j } from "lit";
14
14
  * Copyright 2019 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const O = globalThis, W = O.ShadowRoot && (O.ShadyCSS === void 0 || O.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, nt = Symbol(), K = /* @__PURE__ */ new WeakMap();
17
+ const H = globalThis, F = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, nt = Symbol(), K = /* @__PURE__ */ new WeakMap();
18
18
  let bt = class {
19
19
  constructor(t, e, o) {
20
20
  if (this._$cssResult$ = !0, o !== nt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
@@ -23,7 +23,7 @@ let bt = class {
23
23
  get styleSheet() {
24
24
  let t = this.o;
25
25
  const e = this.t;
26
- if (W && t === void 0) {
26
+ if (F && t === void 0) {
27
27
  const o = e !== void 0 && e.length === 1;
28
28
  o && (t = K.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), o && K.set(e, t));
29
29
  }
@@ -33,26 +33,26 @@ let bt = class {
33
33
  return this.cssText;
34
34
  }
35
35
  };
36
- const pt = (r) => new bt(typeof r == "string" ? r : r + "", void 0, nt), yt = (r, t) => {
37
- if (W) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
36
+ const yt = (r) => new bt(typeof r == "string" ? r : r + "", void 0, nt), _t = (r, t) => {
37
+ if (F) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
38
38
  else for (const e of t) {
39
- const o = document.createElement("style"), s = O.litNonce;
39
+ const o = document.createElement("style"), s = H.litNonce;
40
40
  s !== void 0 && o.setAttribute("nonce", s), o.textContent = e.cssText, r.appendChild(o);
41
41
  }
42
- }, J = W ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
42
+ }, J = F ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
43
43
  let e = "";
44
44
  for (const o of t.cssRules) e += o.cssText;
45
- return pt(e);
45
+ return yt(e);
46
46
  })(r) : r;
47
47
  /**
48
48
  * @license
49
49
  * Copyright 2017 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
51
  */
52
- const { is: _t, defineProperty: ft, getOwnPropertyDescriptor: vt, getOwnPropertyNames: gt, getOwnPropertySymbols: mt, getPrototypeOf: $t } = Object, w = globalThis, Q = w.trustedTypes, At = Q ? Q.emptyScript : "", D = w.reactiveElementPolyfillSupport, R = (r, t) => r, M = { toAttribute(r, t) {
52
+ const { is: ft, defineProperty: vt, getOwnPropertyDescriptor: gt, getOwnPropertyNames: mt, getOwnPropertySymbols: $t, getPrototypeOf: At } = Object, w = globalThis, Y = w.trustedTypes, wt = Y ? Y.emptyScript : "", N = w.reactiveElementPolyfillSupport, P = (r, t) => r, O = { toAttribute(r, t) {
53
53
  switch (t) {
54
54
  case Boolean:
55
- r = r ? At : null;
55
+ r = r ? wt : null;
56
56
  break;
57
57
  case Object:
58
58
  case Array:
@@ -77,7 +77,7 @@ const { is: _t, defineProperty: ft, getOwnPropertyDescriptor: vt, getOwnProperty
77
77
  }
78
78
  }
79
79
  return e;
80
- } }, F = (r, t) => !_t(r, t), X = { attribute: !0, type: String, converter: M, reflect: !1, hasChanged: F };
80
+ } }, W = (r, t) => !ft(r, t), Q = { attribute: !0, type: String, converter: O, reflect: !1, hasChanged: W };
81
81
  Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), w.litPropertyMetadata ?? (w.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
82
82
  class C extends HTMLElement {
83
83
  static addInitializer(t) {
@@ -86,14 +86,14 @@ class C extends HTMLElement {
86
86
  static get observedAttributes() {
87
87
  return this.finalize(), this._$Eh && [...this._$Eh.keys()];
88
88
  }
89
- static createProperty(t, e = X) {
89
+ static createProperty(t, e = Q) {
90
90
  if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
91
91
  const o = Symbol(), s = this.getPropertyDescriptor(t, o, e);
92
- s !== void 0 && ft(this.prototype, t, s);
92
+ s !== void 0 && vt(this.prototype, t, s);
93
93
  }
94
94
  }
95
95
  static getPropertyDescriptor(t, e, o) {
96
- const { get: s, set: n } = vt(this.prototype, t) ?? { get() {
96
+ const { get: s, set: n } = gt(this.prototype, t) ?? { get() {
97
97
  return this[e];
98
98
  }, set(i) {
99
99
  this[e] = i;
@@ -106,17 +106,17 @@ class C extends HTMLElement {
106
106
  }, configurable: !0, enumerable: !0 };
107
107
  }
108
108
  static getPropertyOptions(t) {
109
- return this.elementProperties.get(t) ?? X;
109
+ return this.elementProperties.get(t) ?? Q;
110
110
  }
111
111
  static _$Ei() {
112
- if (this.hasOwnProperty(R("elementProperties"))) return;
113
- const t = $t(this);
112
+ if (this.hasOwnProperty(P("elementProperties"))) return;
113
+ const t = At(this);
114
114
  t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
115
115
  }
116
116
  static finalize() {
117
- if (this.hasOwnProperty(R("finalized"))) return;
118
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(R("properties"))) {
119
- const e = this.properties, o = [...gt(e), ...mt(e)];
117
+ if (this.hasOwnProperty(P("finalized"))) return;
118
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(P("properties"))) {
119
+ const e = this.properties, o = [...mt(e), ...$t(e)];
120
120
  for (const s of o) this.createProperty(s, e[s]);
121
121
  }
122
122
  const t = this[Symbol.metadata];
@@ -165,7 +165,7 @@ class C extends HTMLElement {
165
165
  }
166
166
  createRenderRoot() {
167
167
  const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
168
- return yt(t, this.constructor.elementStyles), t;
168
+ return _t(t, this.constructor.elementStyles), t;
169
169
  }
170
170
  connectedCallback() {
171
171
  var t;
@@ -190,7 +190,7 @@ class C extends HTMLElement {
190
190
  var n;
191
191
  const o = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, o);
192
192
  if (s !== void 0 && o.reflect === !0) {
193
- const i = (((n = o.converter) == null ? void 0 : n.toAttribute) !== void 0 ? o.converter : M).toAttribute(e, o.type);
193
+ const i = (((n = o.converter) == null ? void 0 : n.toAttribute) !== void 0 ? o.converter : O).toAttribute(e, o.type);
194
194
  this._$Em = t, i == null ? this.removeAttribute(s) : this.setAttribute(s, i), this._$Em = null;
195
195
  }
196
196
  }
@@ -198,13 +198,13 @@ class C extends HTMLElement {
198
198
  var n;
199
199
  const o = this.constructor, s = o._$Eh.get(t);
200
200
  if (s !== void 0 && this._$Em !== s) {
201
- const i = o.getPropertyOptions(s), d = typeof i.converter == "function" ? { fromAttribute: i.converter } : ((n = i.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? i.converter : M;
201
+ const i = o.getPropertyOptions(s), d = typeof i.converter == "function" ? { fromAttribute: i.converter } : ((n = i.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? i.converter : O;
202
202
  this._$Em = s, this[s] = d.fromAttribute(e, i.type), this._$Em = null;
203
203
  }
204
204
  }
205
205
  requestUpdate(t, e, o) {
206
206
  if (t !== void 0) {
207
- if (o ?? (o = this.constructor.getPropertyOptions(t)), !(o.hasChanged ?? F)(this[t], e)) return;
207
+ if (o ?? (o = this.constructor.getPropertyOptions(t)), !(o.hasChanged ?? W)(this[t], e)) return;
208
208
  this.P(t, e, o);
209
209
  }
210
210
  this.isUpdatePending === !1 && (this._$ES = this._$ET());
@@ -277,13 +277,13 @@ class C extends HTMLElement {
277
277
  firstUpdated(t) {
278
278
  }
279
279
  }
280
- C.elementStyles = [], C.shadowRootOptions = { mode: "open" }, C[R("elementProperties")] = /* @__PURE__ */ new Map(), C[R("finalized")] = /* @__PURE__ */ new Map(), D == null || D({ ReactiveElement: C }), (w.reactiveElementVersions ?? (w.reactiveElementVersions = [])).push("2.0.4");
280
+ C.elementStyles = [], C.shadowRootOptions = { mode: "open" }, C[P("elementProperties")] = /* @__PURE__ */ new Map(), C[P("finalized")] = /* @__PURE__ */ new Map(), N == null || N({ ReactiveElement: C }), (w.reactiveElementVersions ?? (w.reactiveElementVersions = [])).push("2.0.4");
281
281
  /**
282
282
  * @license
283
283
  * Copyright 2017 Google LLC
284
284
  * SPDX-License-Identifier: BSD-3-Clause
285
285
  */
286
- const wt = { attribute: !0, type: String, converter: M, reflect: !1, hasChanged: F }, Et = (r = wt, t, e) => {
286
+ const Et = { attribute: !0, type: String, converter: O, reflect: !1, hasChanged: W }, kt = (r = Et, t, e) => {
287
287
  const { kind: o, metadata: s } = e;
288
288
  let n = globalThis.litPropertyMetadata.get(s);
289
289
  if (n === void 0 && globalThis.litPropertyMetadata.set(s, n = /* @__PURE__ */ new Map()), n.set(e.name, r), o === "accessor") {
@@ -304,8 +304,8 @@ const wt = { attribute: !0, type: String, converter: M, reflect: !1, hasChanged:
304
304
  }
305
305
  throw Error("Unsupported decorator location: " + o);
306
306
  };
307
- function c(r) {
308
- return (t, e) => typeof e == "object" ? Et(r, t, e) : ((o, s, n) => {
307
+ function u(r) {
308
+ return (t, e) => typeof e == "object" ? kt(r, t, e) : ((o, s, n) => {
309
309
  const i = s.hasOwnProperty(n);
310
310
  return s.constructor.createProperty(n, i ? { ...o, wrapped: !0 } : o), i ? Object.getOwnPropertyDescriptor(s, n) : void 0;
311
311
  })(r, t, e);
@@ -315,30 +315,30 @@ function c(r) {
315
315
  * Copyright 2017 Google LLC
316
316
  * SPDX-License-Identifier: BSD-3-Clause
317
317
  */
318
- function St(r) {
319
- return c({ ...r, state: !0, attribute: !1 });
318
+ function at(r) {
319
+ return u({ ...r, state: !0, attribute: !1 });
320
320
  }
321
321
  /**
322
322
  * @license
323
323
  * Copyright 2017 Google LLC
324
324
  * SPDX-License-Identifier: BSD-3-Clause
325
325
  */
326
- const z = globalThis, T = z.trustedTypes, Y = T ? T.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, at = "$lit$", A = `lit$${Math.random().toFixed(9).slice(2)}$`, dt = "?" + A, kt = `<${dt}>`, k = document, V = () => k.createComment(""), U = (r) => r === null || typeof r != "object" && typeof r != "function", Z = Array.isArray, xt = (r) => Z(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", L = `[
327
- \f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, E = RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^
328
- \f\r"'\`<>=]|("|')|))|$)`, "g"), ot = /'/g, st = /"/g, lt = /^(?:script|style|textarea|title)$/i, q = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), rt = /* @__PURE__ */ new WeakMap(), S = k.createTreeWalker(k, 129);
326
+ const z = globalThis, D = z.trustedTypes, X = D ? D.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, dt = "$lit$", A = `lit$${Math.random().toFixed(9).slice(2)}$`, lt = "?" + A, St = `<${lt}>`, S = document, M = () => S.createComment(""), U = (r) => r === null || typeof r != "object" && typeof r != "function", Z = Array.isArray, xt = (r) => Z(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", V = `[
327
+ \f\r]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, tt = /-->/g, et = />/g, E = RegExp(`>|${V}(?:([^\\s"'>=/]+)(${V}*=${V}*(?:[^
328
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), ot = /'/g, st = /"/g, ct = /^(?:script|style|textarea|title)$/i, T = Symbol.for("lit-noChange"), p = Symbol.for("lit-nothing"), it = /* @__PURE__ */ new WeakMap(), k = S.createTreeWalker(S, 129);
329
329
  function ht(r, t) {
330
330
  if (!Z(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
331
- return Y !== void 0 ? Y.createHTML(t) : t;
331
+ return X !== void 0 ? X.createHTML(t) : t;
332
332
  }
333
333
  const Ct = (r, t) => {
334
334
  const e = r.length - 1, o = [];
335
- let s, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", i = P;
335
+ let s, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", i = R;
336
336
  for (let d = 0; d < e; d++) {
337
337
  const a = r[d];
338
- let b, p, h = -1, g = 0;
339
- for (; g < a.length && (i.lastIndex = g, p = i.exec(a), p !== null); ) g = i.lastIndex, i === P ? p[1] === "!--" ? i = tt : p[1] !== void 0 ? i = et : p[2] !== void 0 ? (lt.test(p[2]) && (s = RegExp("</" + p[2], "g")), i = E) : p[3] !== void 0 && (i = E) : i === E ? p[0] === ">" ? (i = s ?? P, h = -1) : p[1] === void 0 ? h = -2 : (h = i.lastIndex - p[2].length, b = p[1], i = p[3] === void 0 ? E : p[3] === '"' ? st : ot) : i === st || i === ot ? i = E : i === tt || i === et ? i = P : (i = E, s = void 0);
338
+ let c, b, l = -1, g = 0;
339
+ for (; g < a.length && (i.lastIndex = g, b = i.exec(a), b !== null); ) g = i.lastIndex, i === R ? b[1] === "!--" ? i = tt : b[1] !== void 0 ? i = et : b[2] !== void 0 ? (ct.test(b[2]) && (s = RegExp("</" + b[2], "g")), i = E) : b[3] !== void 0 && (i = E) : i === E ? b[0] === ">" ? (i = s ?? R, l = -1) : b[1] === void 0 ? l = -2 : (l = i.lastIndex - b[2].length, c = b[1], i = b[3] === void 0 ? E : b[3] === '"' ? st : ot) : i === st || i === ot ? i = E : i === tt || i === et ? i = R : (i = E, s = void 0);
340
340
  const $ = i === E && r[d + 1].startsWith("/>") ? " " : "";
341
- n += i === P ? a + kt : h >= 0 ? (o.push(b), a.slice(0, h) + at + a.slice(h) + A + $) : a + A + (h === -2 ? d : $);
341
+ n += i === R ? a + St : l >= 0 ? (o.push(c), a.slice(0, l) + dt + a.slice(l) + A + $) : a + A + (l === -2 ? d : $);
342
342
  }
343
343
  return [ht(r, n + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), o];
344
344
  };
@@ -347,46 +347,46 @@ class B {
347
347
  let s;
348
348
  this.parts = [];
349
349
  let n = 0, i = 0;
350
- const d = t.length - 1, a = this.parts, [b, p] = Ct(t, e);
351
- if (this.el = B.createElement(b, o), S.currentNode = this.el.content, e === 2 || e === 3) {
352
- const h = this.el.content.firstChild;
353
- h.replaceWith(...h.childNodes);
350
+ const d = t.length - 1, a = this.parts, [c, b] = Ct(t, e);
351
+ if (this.el = B.createElement(c, o), k.currentNode = this.el.content, e === 2 || e === 3) {
352
+ const l = this.el.content.firstChild;
353
+ l.replaceWith(...l.childNodes);
354
354
  }
355
- for (; (s = S.nextNode()) !== null && a.length < d; ) {
355
+ for (; (s = k.nextNode()) !== null && a.length < d; ) {
356
356
  if (s.nodeType === 1) {
357
- if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(at)) {
358
- const g = p[i++], $ = s.getAttribute(h).split(A), H = /([.?@])?(.*)/.exec(g);
359
- a.push({ type: 1, index: n, name: H[2], strings: $, ctor: H[1] === "." ? Rt : H[1] === "?" ? zt : H[1] === "@" ? Ut : I }), s.removeAttribute(h);
360
- } else h.startsWith(A) && (a.push({ type: 6, index: n }), s.removeAttribute(h));
361
- if (lt.test(s.tagName)) {
362
- const h = s.textContent.split(A), g = h.length - 1;
357
+ if (s.hasAttributes()) for (const l of s.getAttributeNames()) if (l.endsWith(dt)) {
358
+ const g = b[i++], $ = s.getAttribute(l).split(A), q = /([.?@])?(.*)/.exec(g);
359
+ a.push({ type: 1, index: n, name: q[2], strings: $, ctor: q[1] === "." ? Pt : q[1] === "?" ? zt : q[1] === "@" ? Ut : L }), s.removeAttribute(l);
360
+ } else l.startsWith(A) && (a.push({ type: 6, index: n }), s.removeAttribute(l));
361
+ if (ct.test(s.tagName)) {
362
+ const l = s.textContent.split(A), g = l.length - 1;
363
363
  if (g > 0) {
364
- s.textContent = T ? T.emptyScript : "";
365
- for (let $ = 0; $ < g; $++) s.append(h[$], V()), S.nextNode(), a.push({ type: 2, index: ++n });
366
- s.append(h[g], V());
364
+ s.textContent = D ? D.emptyScript : "";
365
+ for (let $ = 0; $ < g; $++) s.append(l[$], M()), k.nextNode(), a.push({ type: 2, index: ++n });
366
+ s.append(l[g], M());
367
367
  }
368
368
  }
369
- } else if (s.nodeType === 8) if (s.data === dt) a.push({ type: 2, index: n });
369
+ } else if (s.nodeType === 8) if (s.data === lt) a.push({ type: 2, index: n });
370
370
  else {
371
- let h = -1;
372
- for (; (h = s.data.indexOf(A, h + 1)) !== -1; ) a.push({ type: 7, index: n }), h += A.length - 1;
371
+ let l = -1;
372
+ for (; (l = s.data.indexOf(A, l + 1)) !== -1; ) a.push({ type: 7, index: n }), l += A.length - 1;
373
373
  }
374
374
  n++;
375
375
  }
376
376
  }
377
377
  static createElement(t, e) {
378
- const o = k.createElement("template");
378
+ const o = S.createElement("template");
379
379
  return o.innerHTML = t, o;
380
380
  }
381
381
  }
382
382
  function x(r, t, e = r, o) {
383
383
  var i, d;
384
- if (t === q) return t;
384
+ if (t === T) return t;
385
385
  let s = o !== void 0 ? (i = e._$Co) == null ? void 0 : i[o] : e._$Cl;
386
386
  const n = U(t) ? void 0 : t._$litDirective$;
387
387
  return (s == null ? void 0 : s.constructor) !== n && ((d = s == null ? void 0 : s._$AO) == null || d.call(s, !1), n === void 0 ? s = void 0 : (s = new n(r), s._$AT(r, e, o)), o !== void 0 ? (e._$Co ?? (e._$Co = []))[o] = s : e._$Cl = s), s !== void 0 && (t = x(r, s._$AS(r, t.values), s, o)), t;
388
388
  }
389
- class Pt {
389
+ class Rt {
390
390
  constructor(t, e) {
391
391
  this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
392
392
  }
@@ -397,30 +397,30 @@ class Pt {
397
397
  return this._$AM._$AU;
398
398
  }
399
399
  u(t) {
400
- const { el: { content: e }, parts: o } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? k).importNode(e, !0);
401
- S.currentNode = s;
402
- let n = S.nextNode(), i = 0, d = 0, a = o[0];
400
+ const { el: { content: e }, parts: o } = this._$AD, s = ((t == null ? void 0 : t.creationScope) ?? S).importNode(e, !0);
401
+ k.currentNode = s;
402
+ let n = k.nextNode(), i = 0, d = 0, a = o[0];
403
403
  for (; a !== void 0; ) {
404
404
  if (i === a.index) {
405
- let b;
406
- a.type === 2 ? b = new N(n, n.nextSibling, this, t) : a.type === 1 ? b = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (b = new qt(n, this, t)), this._$AV.push(b), a = o[++d];
405
+ let c;
406
+ a.type === 2 ? c = new I(n, n.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (c = new Tt(n, this, t)), this._$AV.push(c), a = o[++d];
407
407
  }
408
- i !== (a == null ? void 0 : a.index) && (n = S.nextNode(), i++);
408
+ i !== (a == null ? void 0 : a.index) && (n = k.nextNode(), i++);
409
409
  }
410
- return S.currentNode = k, s;
410
+ return k.currentNode = S, s;
411
411
  }
412
412
  p(t) {
413
413
  let e = 0;
414
414
  for (const o of this._$AV) o !== void 0 && (o.strings !== void 0 ? (o._$AI(t, o, e), e += o.strings.length - 2) : o._$AI(t[e])), e++;
415
415
  }
416
416
  }
417
- class N {
417
+ class I {
418
418
  get _$AU() {
419
419
  var t;
420
420
  return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
421
421
  }
422
422
  constructor(t, e, o, s) {
423
- this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = o, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
423
+ this.type = 2, this._$AH = p, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = o, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
424
424
  }
425
425
  get parentNode() {
426
426
  let t = this._$AA.parentNode;
@@ -434,7 +434,7 @@ class N {
434
434
  return this._$AB;
435
435
  }
436
436
  _$AI(t, e = this) {
437
- t = x(this, t, e), U(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== q && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : xt(t) ? this.k(t) : this._(t);
437
+ t = x(this, t, e), U(t) ? t === p || t == null || t === "" ? (this._$AH !== p && this._$AR(), this._$AH = p) : t !== this._$AH && t !== T && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : xt(t) ? this.k(t) : this._(t);
438
438
  }
439
439
  O(t) {
440
440
  return this._$AA.parentNode.insertBefore(t, this._$AB);
@@ -443,26 +443,26 @@ class N {
443
443
  this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
444
444
  }
445
445
  _(t) {
446
- this._$AH !== u && U(this._$AH) ? this._$AA.nextSibling.data = t : this.T(k.createTextNode(t)), this._$AH = t;
446
+ this._$AH !== p && U(this._$AH) ? this._$AA.nextSibling.data = t : this.T(S.createTextNode(t)), this._$AH = t;
447
447
  }
448
448
  $(t) {
449
449
  var n;
450
450
  const { values: e, _$litType$: o } = t, s = typeof o == "number" ? this._$AC(t) : (o.el === void 0 && (o.el = B.createElement(ht(o.h, o.h[0]), this.options)), o);
451
451
  if (((n = this._$AH) == null ? void 0 : n._$AD) === s) this._$AH.p(e);
452
452
  else {
453
- const i = new Pt(s, this), d = i.u(this.options);
453
+ const i = new Rt(s, this), d = i.u(this.options);
454
454
  i.p(e), this.T(d), this._$AH = i;
455
455
  }
456
456
  }
457
457
  _$AC(t) {
458
- let e = rt.get(t.strings);
459
- return e === void 0 && rt.set(t.strings, e = new B(t)), e;
458
+ let e = it.get(t.strings);
459
+ return e === void 0 && it.set(t.strings, e = new B(t)), e;
460
460
  }
461
461
  k(t) {
462
462
  Z(this._$AH) || (this._$AH = [], this._$AR());
463
463
  const e = this._$AH;
464
464
  let o, s = 0;
465
- for (const n of t) s === e.length ? e.push(o = new N(this.O(V()), this.O(V()), this, this.options)) : o = e[s], o._$AI(n), s++;
465
+ for (const n of t) s === e.length ? e.push(o = new I(this.O(M()), this.O(M()), this, this.options)) : o = e[s], o._$AI(n), s++;
466
466
  s < e.length && (this._$AR(o && o._$AB.nextSibling, s), e.length = s);
467
467
  }
468
468
  _$AR(t = this._$AA.nextSibling, e) {
@@ -477,7 +477,7 @@ class N {
477
477
  this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
478
478
  }
479
479
  }
480
- class I {
480
+ class L {
481
481
  get tagName() {
482
482
  return this.element.tagName;
483
483
  }
@@ -485,46 +485,46 @@ class I {
485
485
  return this._$AM._$AU;
486
486
  }
487
487
  constructor(t, e, o, s, n) {
488
- this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = n, o.length > 2 || o[0] !== "" || o[1] !== "" ? (this._$AH = Array(o.length - 1).fill(new String()), this.strings = o) : this._$AH = u;
488
+ this.type = 1, this._$AH = p, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = n, o.length > 2 || o[0] !== "" || o[1] !== "" ? (this._$AH = Array(o.length - 1).fill(new String()), this.strings = o) : this._$AH = p;
489
489
  }
490
490
  _$AI(t, e = this, o, s) {
491
491
  const n = this.strings;
492
492
  let i = !1;
493
- if (n === void 0) t = x(this, t, e, 0), i = !U(t) || t !== this._$AH && t !== q, i && (this._$AH = t);
493
+ if (n === void 0) t = x(this, t, e, 0), i = !U(t) || t !== this._$AH && t !== T, i && (this._$AH = t);
494
494
  else {
495
495
  const d = t;
496
- let a, b;
497
- for (t = n[0], a = 0; a < n.length - 1; a++) b = x(this, d[o + a], e, a), b === q && (b = this._$AH[a]), i || (i = !U(b) || b !== this._$AH[a]), b === u ? t = u : t !== u && (t += (b ?? "") + n[a + 1]), this._$AH[a] = b;
496
+ let a, c;
497
+ for (t = n[0], a = 0; a < n.length - 1; a++) c = x(this, d[o + a], e, a), c === T && (c = this._$AH[a]), i || (i = !U(c) || c !== this._$AH[a]), c === p ? t = p : t !== p && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c;
498
498
  }
499
499
  i && !s && this.j(t);
500
500
  }
501
501
  j(t) {
502
- t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
502
+ t === p ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
503
503
  }
504
504
  }
505
- class Rt extends I {
505
+ class Pt extends L {
506
506
  constructor() {
507
507
  super(...arguments), this.type = 3;
508
508
  }
509
509
  j(t) {
510
- this.element[this.name] = t === u ? void 0 : t;
510
+ this.element[this.name] = t === p ? void 0 : t;
511
511
  }
512
512
  }
513
- class zt extends I {
513
+ class zt extends L {
514
514
  constructor() {
515
515
  super(...arguments), this.type = 4;
516
516
  }
517
517
  j(t) {
518
- this.element.toggleAttribute(this.name, !!t && t !== u);
518
+ this.element.toggleAttribute(this.name, !!t && t !== p);
519
519
  }
520
520
  }
521
- class Ut extends I {
521
+ class Ut extends L {
522
522
  constructor(t, e, o, s, n) {
523
523
  super(t, e, o, s, n), this.type = 5;
524
524
  }
525
525
  _$AI(t, e = this) {
526
- if ((t = x(this, t, e, 0) ?? u) === q) return;
527
- const o = this._$AH, s = t === u && o !== u || t.capture !== o.capture || t.once !== o.once || t.passive !== o.passive, n = t !== u && (o === u || s);
526
+ if ((t = x(this, t, e, 0) ?? p) === T) return;
527
+ const o = this._$AH, s = t === p && o !== p || t.capture !== o.capture || t.once !== o.once || t.passive !== o.passive, n = t !== p && (o === p || s);
528
528
  s && this.element.removeEventListener(this.name, this, o), n && this.element.addEventListener(this.name, this, t), this._$AH = t;
529
529
  }
530
530
  handleEvent(t) {
@@ -532,7 +532,7 @@ class Ut extends I {
532
532
  typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
533
533
  }
534
534
  }
535
- class qt {
535
+ class Tt {
536
536
  constructor(t, e, o) {
537
537
  this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = o;
538
538
  }
@@ -544,13 +544,13 @@ class qt {
544
544
  }
545
545
  }
546
546
  const G = z.litHtmlPolyfillSupport;
547
- G == null || G(B, N), (z.litHtmlVersions ?? (z.litHtmlVersions = [])).push("3.2.1");
547
+ G == null || G(B, I), (z.litHtmlVersions ?? (z.litHtmlVersions = [])).push("3.2.1");
548
548
  /**
549
549
  * @license
550
550
  * Copyright 2018 Google LLC
551
551
  * SPDX-License-Identifier: BSD-3-Clause
552
552
  */
553
- const Bt = (r) => r ?? u, ct = ut`
553
+ const Bt = (r) => r ?? p, ut = pt`
554
554
  :host {
555
555
  /* Global Radiobutton Styles */
556
556
  --_nys-radiobutton-size: var(--nys-size-400, 32px);
@@ -776,6 +776,7 @@ const Bt = (r) => r ?? u, ct = ut`
776
776
  outline-offset: var(--_nys-radiobutton-outline-offset);
777
777
  outline: none;
778
778
  margin: 0 0 auto 0; /* Causes centered radio button if single line of label but top aligned if multiline */
779
+ box-sizing: border-box;
779
780
  }
780
781
 
781
782
  /* Pointer cursor for unchecked radio button */
@@ -785,51 +786,65 @@ const Bt = (r) => r ?? u, ct = ut`
785
786
  }
786
787
 
787
788
  /* Checked */
788
- .nys-radiobutton__radio:not(:disabled):checked {
789
+ input:not(:disabled):checked + .nys-radiobutton .nys-radiobutton__radio {
789
790
  background-image: url('data:image/svg+xml;utf8,<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="11" cy="11" r="11" stroke="white" stroke-width="6"/></svg>');
790
791
  background-color: var(--_nys-radiobutton-checked-color-bg);
791
792
  }
792
793
  :host([tile])
793
- .nys-radiobutton:has(.nys-radiobutton__radio:not(:disabled):checked) {
794
+ .nys-radiobutton:has(input:not(:disabled):checked)
795
+ + .nys-radiobutton
796
+ .nys-radiobutton__radio {
794
797
  border-color: var(--_nys-radiobutton-checked-tile-border-color);
795
798
  background-color: var(--_nys-radiobutton-checked-tile-bg-color);
796
799
  }
797
800
  :host([tile])
798
- .nys-radiobutton:has(.nys-radiobutton__radio:not(:disabled):checked:hover) {
801
+ .nys-radiobutton:has(input:not(:disabled):checked:hover)
802
+ + .nys-radiobutton
803
+ .nys-radiobutton__radio {
799
804
  cursor: default;
800
805
  }
801
806
 
802
807
  /* Checked + Disabled */
803
- .nys-radiobutton__radio:disabled:checked {
808
+ input:disabled:checked + .nys-radiobutton .nys-radiobutton__radio {
804
809
  background-image: url('data:image/svg+xml;utf8,<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="11" cy="11" r="11" stroke="white" stroke-width="6"/></svg>');
805
810
  border-color: var(--_nys-radiobutton-disabled-checked-color-border);
806
811
  background-color: var(--_nys-radiobutton-disabled-checked-color-bg);
807
812
  }
808
- :host([tile]) .nys-radiobutton:has(.nys-radiobutton__radio:disabled:checked) {
813
+ :host([tile])
814
+ .nys-radiobutton:has(input:disabled:checked)
815
+ + .nys-radiobutton
816
+ .nys-radiobutton__radio {
809
817
  border-color: var(--_nys-radiobutton-disabled-tile-border-color);
810
818
  background-color: var(--_nys-radiobutton-disabled-tile-bg-color);
811
819
  }
812
820
 
813
821
  /* Disabled */
814
- .nys-radiobutton__radio:disabled {
822
+ input:disabled + .nys-radiobutton .nys-radiobutton__radio {
815
823
  background-color: var(--_nys-radiobutton-disabled-color-bg);
816
824
  border-color: var(--_nys-radiobutton-disabled-color-border);
817
825
  cursor: not-allowed;
818
826
  }
819
- :host([tile]) .nys-radiobutton:has(.nys-radiobutton__radio:disabled) {
827
+ :host([tile])
828
+ .nys-radiobutton:has(input:disabled)
829
+ + .nys-radiobutton
830
+ .nys-radiobutton__radio {
820
831
  background-color: var(--_nys-radiobutton-disabled-color-bg);
821
832
  border-color: var(--_nys-radiobutton-disabled-color-border);
822
833
  cursor: not-allowed;
823
834
  }
824
835
 
825
836
  /* Hover - only allow hover on unchecked */
826
- .nys-radiobutton__radio:hover:not(:disabled):not(:checked) {
837
+ input:hover:not(:disabled):not(:checked)
838
+ + .nys-radiobutton
839
+ .nys-radiobutton__radio {
827
840
  border-color: var(--_nys-radiobutton-hover-color-border);
828
841
  background-color: var(--_nys-radiobutton-hover-color-bg);
829
842
  }
830
843
  :host([tile])
831
844
  .nys-radiobutton:has(
832
- .nys-radiobutton__radio:hover:not(:disabled):not(:checked)
845
+ input:hover:not(:disabled):not(:checked)
846
+ + .nys-radiobutton
847
+ .nys-radiobutton__radio
833
848
  ) {
834
849
  border-color: var(--_nys-radiobutton-hover-tile-border-color);
835
850
  background-color: var(--_nys-radiobutton-hover-tile-bg-color);
@@ -838,13 +853,17 @@ const Bt = (r) => r ?? u, ct = ut`
838
853
  }
839
854
 
840
855
  /* Pressed - only allow pressed on unchecked */
841
- .nys-radiobutton__radio:active:not(:disabled):not(:checked) {
856
+ input:active:not(:disabled):not(:checked)
857
+ + .nys-radiobutton
858
+ .nys-radiobutton__radio {
842
859
  border-color: var(--_nys-radiobutton-pressed-color-border);
843
860
  background-color: var(--_nys-radiobutton-pressed-color-bg);
844
861
  }
845
862
  :host([tile])
846
863
  .nys-radiobutton:has(
847
- .nys-radiobutton__radio:active:not(:disabled):not(:checked)
864
+ input:active:not(:disabled):not(:checked)
865
+ + .nys-radiobutton
866
+ .nys-radiobutton__radio
848
867
  ) {
849
868
  border-color: var(--_nys-radiobutton-pressed-tile-border-color);
850
869
  background-color: var(--_nys-radiobutton-pressed-tile-bg-color);
@@ -853,16 +872,11 @@ const Bt = (r) => r ?? u, ct = ut`
853
872
  }
854
873
 
855
874
  /* Focused */
856
- :host(:not([tile])) .nys-radiobutton__radio:focus-visible {
875
+ :host:focus-visible,
876
+ :host(.active-focus) {
857
877
  outline: solid var(--_nys-radiobutton-width-focus)
858
878
  var(--_nys-radiobutton-color-focus);
859
879
  }
860
- :host([tile]) .nys-radiobutton:has(*:focus-visible) {
861
- outline: solid var(--_nys-radiobutton-tile-border-width)
862
- var(--_nys-radiobutton-color-focus) !important;
863
- border-color: var(--_nys-radiobutton-color-focus) !important;
864
- }
865
-
866
880
  /* Radiobutton Label Holder */
867
881
  .nys-radiobutton__text {
868
882
  line-height: var(--_nys-radiobutton-line-height);
@@ -893,27 +907,39 @@ const Bt = (r) => r ?? u, ct = ut`
893
907
  }
894
908
 
895
909
  /* Disabled label */
896
- .nys-radiobutton__radio:disabled
897
- + .nys-radiobutton__text
898
- .nys-radiobutton__label,
899
- .nys-radiobutton__radio:disabled
900
- + .nys-radiobutton__text
901
- .nys-radiobutton__description {
910
+ input:disabled + span + .nys-radiobutton__text .nys-radiobutton__label,
911
+ input:disabled + span + .nys-radiobutton__text .nys-radiobutton__description {
902
912
  color: var(--_nys-radiobutton-disabled-color-text);
903
913
  cursor: not-allowed;
904
914
  }
915
+
916
+ /* Screen readers ONLY */
917
+ fieldset {
918
+ all: unset;
919
+ display: contents;
920
+ }
921
+
922
+ .sr-only {
923
+ position: absolute;
924
+ width: 1px;
925
+ height: 1px;
926
+ padding: 0;
927
+ margin: -1px;
928
+ overflow: hidden;
929
+ border: 0;
930
+ }
905
931
  `;
906
- var Ht = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, _ = (r, t, e, o) => {
907
- for (var s = o > 1 ? void 0 : o ? Ot(t, e) : t, n = r.length - 1, i; n >= 0; n--)
932
+ var qt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, _ = (r, t, e, o) => {
933
+ for (var s = o > 1 ? void 0 : o ? Ht(t, e) : t, n = r.length - 1, i; n >= 0; n--)
908
934
  (i = r[n]) && (s = (o ? i(t, e, s) : i(s)) || s);
909
- return o && s && Ht(t, e, s), s;
935
+ return o && s && qt(t, e, s), s;
910
936
  };
911
- let Mt = 0;
937
+ let Ot = 0;
912
938
  var m;
913
- const y = (m = class extends it {
939
+ const y = (m = class extends rt {
914
940
  // allows use of elementInternals' API
915
941
  constructor() {
916
- super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this.selectedValue = null, this._size = "md", this.tile = !1, this._internals = this.attachInternals();
942
+ super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this.tile = !1, this.selectedValue = null, this._slottedDescriptionText = "", this._size = "md", this._internals = this.attachInternals();
917
943
  }
918
944
  get size() {
919
945
  return this._size;
@@ -925,13 +951,13 @@ const y = (m = class extends it {
925
951
  }
926
952
  // Generate a unique ID if one is not provided
927
953
  connectedCallback() {
928
- super.connectedCallback(), this.id || (this.id = `nys-radiogroup-${Date.now()}-${Mt++}`), this.addEventListener("nys-change", this._handleRadioButtonChange), this.addEventListener("invalid", this._handleInvalid);
954
+ super.connectedCallback(), this.id || (this.id = `nys-radiogroup-${Date.now()}-${Ot++}`), this.addEventListener("nys-change", this._handleRadioButtonChange), this.addEventListener("invalid", this._handleInvalid);
929
955
  }
930
956
  disconnectedCallback() {
931
957
  super.disconnectedCallback(), this.removeEventListener("nys-change", this._handleRadioButtonChange), this.removeEventListener("invalid", this._handleInvalid);
932
958
  }
933
- firstUpdated() {
934
- this._initializeCheckedRadioValue(), this._setValue(), this.setRadioButtonRequire(), this._updateRadioButtonsSize(), this._updateRadioButtonsTile(), this._updateRadioButtonsShowError();
959
+ async firstUpdated() {
960
+ this._initializeCheckedRadioValue(), this._setValue(), this._setRadioButtonRequire(), this._updateRadioButtonsSize(), this._updateRadioButtonsTile(), this._updateRadioButtonsShowError(), this._getSlotDescriptionForAria(), await this.updateComplete, this._initializeChildAttributes(), this._updateGroupTabIndex();
935
961
  }
936
962
  updated(t) {
937
963
  (t.has("required") || t.has("selectedValue")) && this._manageRequire(), t.has("size") && this._updateRadioButtonsSize(), t.has("tile") && this._updateRadioButtonsTile(), t.has("showError") && this._updateRadioButtonsShowError();
@@ -946,8 +972,9 @@ const y = (m = class extends it {
946
972
  _setValue() {
947
973
  this._internals.setFormValue(this.selectedValue);
948
974
  }
949
- // Updates the "require" attribute of the first radiobutton underneath a radiogroup to ensure requirement for all radiobutton under the same name/group
950
- setRadioButtonRequire() {
975
+ // Updates the "require" attribute of the first radiobutton underneath a radiogroup.
976
+ // This will make sure there's a requirement for all radiobutton under the same name/group
977
+ _setRadioButtonRequire() {
951
978
  this.querySelectorAll("nys-radiobutton").forEach((e, o) => {
952
979
  this.required && o === 0 && e.setAttribute("required", "required");
953
980
  });
@@ -960,12 +987,49 @@ const y = (m = class extends it {
960
987
  o
961
988
  ) : (this.showError = !1, this._internals.setValidity({}, "", o)));
962
989
  }
990
+ checkValidity() {
991
+ const t = Array.from(this.querySelectorAll("nys-radiobutton"));
992
+ return !this.required || t.some((o) => o.checked);
993
+ }
963
994
  // Need to account for if radiogroup already have a radiobutton checked at initialization
964
995
  _initializeCheckedRadioValue() {
965
996
  const t = this.querySelector("nys-radiobutton[checked]");
966
997
  t && (this.selectedValue = t.getAttribute("value"), this._internals.setFormValue(this.selectedValue));
967
998
  }
999
+ /********************** Core Keyboard & Click Logic **********************/
1000
+ _getAllRadios() {
1001
+ return Array.from(this.querySelectorAll("nys-radiobutton"));
1002
+ }
1003
+ // Arrow / Space / Enter navigation at group level
1004
+ async _handleKeyDown(t) {
1005
+ if (![
1006
+ "ArrowUp",
1007
+ "ArrowDown",
1008
+ "ArrowLeft",
1009
+ "ArrowRight",
1010
+ " ",
1011
+ "Enter"
1012
+ ].includes(t.key)) return;
1013
+ t.preventDefault();
1014
+ const o = this._getAllRadios().filter((c) => !c.disabled), s = o.find((c) => c.checked) || o[0], n = t.key === " " || t.key === "Enter" ? 0 : ["ArrowUp", "ArrowLeft"].includes(t.key) ? -1 : 1;
1015
+ let i = o.indexOf(s) + n;
1016
+ i < 0 && (i = o.length - 1), i >= o.length && (i = 0);
1017
+ const d = o[i], a = await d.getInputElement();
1018
+ a == null || a.click(), this._updateGroupTabIndex(), d.focus();
1019
+ }
1020
+ _updateGroupTabIndex() {
1021
+ const t = this._getAllRadios(), e = t.find((o) => o.checked) || t[0];
1022
+ t.forEach((o) => {
1023
+ o.disabled ? o.tabIndex = -1 : o.tabIndex = o === e ? 0 : -1, o.setAttribute("aria-checked", o.checked ? "true" : "false"), o.setAttribute("aria-disabled", o.disabled ? "true" : "false"), o.setAttribute("aria-required", this.required ? "true" : "false");
1024
+ });
1025
+ }
968
1026
  /********************** Functions **********************/
1027
+ // Apply ARIA & initial tabindex to each child radio
1028
+ _initializeChildAttributes() {
1029
+ this._getAllRadios().forEach((e) => {
1030
+ e.setAttribute("role", "radio"), e.setAttribute("aria-checked", String(e.checked)), e.setAttribute("aria-required", String(e.required)), e.setAttribute("aria-disabled", String(e.disabled)), e.setAttribute("tabindex", "-1");
1031
+ });
1032
+ }
969
1033
  // Updates the size of each radiobutton underneath a radiogroup to ensure size standardization
970
1034
  _updateRadioButtonsSize() {
971
1035
  this.querySelectorAll("nys-radiobutton").forEach((e) => {
@@ -982,36 +1046,39 @@ const y = (m = class extends it {
982
1046
  this.showError ? e.setAttribute("showError", "") : e.removeAttribute("showError");
983
1047
  });
984
1048
  }
1049
+ // Get the slotted text contents so native VO can attempt to announce it within the legend in the fieldset
1050
+ _getSlotDescriptionForAria() {
1051
+ var o;
1052
+ const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector(
1053
+ 'slot[name="description"]'
1054
+ ), e = (t == null ? void 0 : t.assignedNodes({ flatten: !0 })) || [];
1055
+ this._slottedDescriptionText = e.map((s) => {
1056
+ var n;
1057
+ return (n = s.textContent) == null ? void 0 : n.trim();
1058
+ }).filter(Boolean).join(", ");
1059
+ }
1060
+ /******************** Event Handlers ********************/
985
1061
  // Keeps radiogroup informed of the name and value of its current selected radiobutton at each change
986
1062
  _handleRadioButtonChange(t) {
987
1063
  const e = t, { name: o, value: s } = e.detail;
988
- this.name = o, this.selectedValue = s, this._internals.setFormValue(this.selectedValue);
1064
+ this.name = o, this.selectedValue = s, this._internals.setFormValue(this.selectedValue), this._updateGroupTabIndex();
989
1065
  }
990
1066
  async _handleInvalid(t) {
991
1067
  if (t.preventDefault(), this._internals.validity.valueMissing) {
992
1068
  this.showError = !0, this._manageRequire();
993
- const e = this.querySelector("nys-radiobutton"), o = e ? await e.getInputElement() : null;
994
- if (o) {
995
- const s = this._internals.form;
996
- s ? Array.from(s.elements).find((d) => {
997
- if (d.tagName.toLowerCase() === "nys-radiogroup") {
998
- if (!d.querySelector("nys-radiobutton").checkValidity())
999
- return d;
1000
- } else
1001
- return typeof d.checkValidity == "function" && !d.checkValidity();
1002
- }) === this && o.focus() : o.focus();
1069
+ const e = this.querySelector("nys-radiobutton");
1070
+ if (e) {
1071
+ const o = this._internals.form;
1072
+ o ? Array.from(o.elements).find(
1073
+ (i) => typeof i.checkValidity == "function" && !i.checkValidity()
1074
+ ) === this && (e.focus(), e.classList.add("active-focus")) : (e.focus(), e.classList.add("active-focus"));
1003
1075
  }
1004
1076
  }
1005
1077
  }
1006
1078
  render() {
1007
- return j` <div
1008
- role="radiogroup"
1009
- class="nys-radiogroup"
1010
- aria-required="${this.required ? "true" : "false"}"
1011
- aria-invalid="${this.showError ? "true" : "false"}"
1012
- >
1079
+ return j`<div class="nys-radiogroup">
1013
1080
  <nys-label
1014
- id=${this.id}
1081
+ for=${this.id}
1015
1082
  label=${this.label}
1016
1083
  description=${this.description}
1017
1084
  flag=${this.required ? "required" : this.optional ? "optional" : ""}
@@ -1019,7 +1086,12 @@ const y = (m = class extends it {
1019
1086
  <slot name="description" slot="description">${this.description}</slot>
1020
1087
  </nys-label>
1021
1088
  <div class="nys-radiogroup__content">
1022
- <slot></slot>
1089
+ <fieldset role="radiogroup" @keydown=${this._handleKeyDown}>
1090
+ <legend class="sr-only">
1091
+ ${this.label}${this._slottedDescriptionText ? ` ${this._slottedDescriptionText}` : this.description ? ` ${this.description}` : ""}
1092
+ </legend>
1093
+ <slot></slot>
1094
+ </fieldset>
1023
1095
  </div>
1024
1096
  <nys-errormessage
1025
1097
  ?showError=${this.showError}
@@ -1028,50 +1100,53 @@ const y = (m = class extends it {
1028
1100
  ></nys-errormessage>
1029
1101
  </div>`;
1030
1102
  }
1031
- }, m.VALID_SIZES = ["sm", "md"], m.styles = ct, m.formAssociated = !0, m);
1103
+ }, m.VALID_SIZES = ["sm", "md"], m.styles = ut, m.formAssociated = !0, m);
1032
1104
  _([
1033
- c({ type: String })
1105
+ u({ type: String })
1034
1106
  ], y.prototype, "id", 2);
1035
1107
  _([
1036
- c({ type: String, reflect: !0 })
1108
+ u({ type: String, reflect: !0 })
1037
1109
  ], y.prototype, "name", 2);
1038
1110
  _([
1039
- c({ type: Boolean, reflect: !0 })
1111
+ u({ type: Boolean, reflect: !0 })
1040
1112
  ], y.prototype, "required", 2);
1041
1113
  _([
1042
- c({ type: Boolean, reflect: !0 })
1114
+ u({ type: Boolean, reflect: !0 })
1043
1115
  ], y.prototype, "optional", 2);
1044
1116
  _([
1045
- c({ type: Boolean, reflect: !0 })
1117
+ u({ type: Boolean, reflect: !0 })
1046
1118
  ], y.prototype, "showError", 2);
1047
1119
  _([
1048
- c({ type: String })
1120
+ u({ type: String })
1049
1121
  ], y.prototype, "errorMessage", 2);
1050
1122
  _([
1051
- c({ type: String })
1123
+ u({ type: String })
1052
1124
  ], y.prototype, "label", 2);
1053
1125
  _([
1054
- c({ type: String })
1126
+ u({ type: String })
1055
1127
  ], y.prototype, "description", 2);
1056
1128
  _([
1057
- St()
1129
+ u({ type: Boolean, reflect: !0 })
1130
+ ], y.prototype, "tile", 2);
1131
+ _([
1132
+ at()
1058
1133
  ], y.prototype, "selectedValue", 2);
1059
1134
  _([
1060
- c({ reflect: !0 })
1061
- ], y.prototype, "size", 1);
1135
+ at()
1136
+ ], y.prototype, "_slottedDescriptionText", 2);
1062
1137
  _([
1063
- c({ type: Boolean, reflect: !0 })
1064
- ], y.prototype, "tile", 2);
1065
- let Tt = y;
1066
- customElements.get("nys-radiogroup") || customElements.define("nys-radiogroup", Tt);
1067
- var Vt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, v = (r, t, e, o) => {
1068
- for (var s = o > 1 ? void 0 : o ? Nt(t, e) : t, n = r.length - 1, i; n >= 0; n--)
1138
+ u({ reflect: !0 })
1139
+ ], y.prototype, "size", 1);
1140
+ let Dt = y;
1141
+ customElements.get("nys-radiogroup") || customElements.define("nys-radiogroup", Dt);
1142
+ var Mt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, v = (r, t, e, o) => {
1143
+ for (var s = o > 1 ? void 0 : o ? It(t, e) : t, n = r.length - 1, i; n >= 0; n--)
1069
1144
  (i = r[n]) && (s = (o ? i(t, e, s) : i(s)) || s);
1070
- return o && s && Vt(t, e, s), s;
1145
+ return o && s && Mt(t, e, s), s;
1071
1146
  };
1072
- let It = 0;
1073
- var l;
1074
- const f = (l = class extends it {
1147
+ let Lt = 0;
1148
+ var h;
1149
+ const f = (h = class extends rt {
1075
1150
  constructor() {
1076
1151
  super(...arguments), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this._size = "md", this.tile = !1;
1077
1152
  }
@@ -1079,7 +1154,7 @@ const f = (l = class extends it {
1079
1154
  return this._size;
1080
1155
  }
1081
1156
  set size(t) {
1082
- this._size = l.VALID_SIZES.includes(
1157
+ this._size = h.VALID_SIZES.includes(
1083
1158
  t
1084
1159
  ) ? t : "md";
1085
1160
  }
@@ -1094,12 +1169,15 @@ const f = (l = class extends it {
1094
1169
  /********************** Lifecycle updates **********************/
1095
1170
  // Generate a unique ID if one is not provided
1096
1171
  connectedCallback() {
1097
- super.connectedCallback(), this.id || (this.id = `nys-radiobutton-${Date.now()}-${It++}`), this.checked && (l.buttonGroup[this.name] && (l.buttonGroup[this.name].checked = !1, l.buttonGroup[this.name].requestUpdate()), l.buttonGroup[this.name] = this);
1172
+ super.connectedCallback(), this.id || (this.id = `nys-radiobutton-${Date.now()}-${Lt++}`), this.checked && (h.buttonGroup[this.name] && (h.buttonGroup[this.name].checked = !1, h.buttonGroup[this.name].requestUpdate()), h.buttonGroup[this.name] = this), this.addEventListener("focus", this._handleFocus), this.addEventListener("blur", this._handleBlur), this.addEventListener("click", this._handleChange);
1173
+ }
1174
+ disconnectedCallback() {
1175
+ super.disconnectedCallback(), this.removeEventListener("focus", this._handleFocus), this.removeEventListener("blur", this._handleBlur);
1098
1176
  }
1099
1177
  updated(t) {
1100
- t.has("checked") && this.checked && l.buttonGroup[this.name] !== this && (l.buttonGroup[this.name] && (l.buttonGroup[this.name].checked = !1, l.buttonGroup[this.name].requestUpdate()), l.buttonGroup[this.name] = this);
1178
+ t.has("checked") && this.checked && h.buttonGroup[this.name] !== this && (h.buttonGroup[this.name] && (h.buttonGroup[this.name].checked = !1, h.buttonGroup[this.name].requestUpdate()), h.buttonGroup[this.name] = this);
1101
1179
  }
1102
- /******************** Function ********************/
1180
+ /********************** Functions **********************/
1103
1181
  // This helper function is called to perform the element's native validation.
1104
1182
  checkValidity() {
1105
1183
  var e;
@@ -1124,7 +1202,7 @@ const f = (l = class extends it {
1124
1202
  }
1125
1203
  // Handle radiobutton change event & unselection of other options in group
1126
1204
  _handleChange() {
1127
- this.checked || (l.buttonGroup[this.name] && (l.buttonGroup[this.name].checked = !1, l.buttonGroup[this.name].requestUpdate()), l.buttonGroup[this.name] = this, this.checked = !0, this._emitChangeEvent());
1205
+ this.classList.remove("active-focus"), this.checked || (h.buttonGroup[this.name] && (h.buttonGroup[this.name].checked = !1, h.buttonGroup[this.name].requestUpdate()), h.buttonGroup[this.name] = this, this.checked = !0, this._emitChangeEvent());
1128
1206
  }
1129
1207
  // Handle focus event
1130
1208
  _handleFocus() {
@@ -1132,78 +1210,82 @@ const f = (l = class extends it {
1132
1210
  }
1133
1211
  // Handle blur event
1134
1212
  _handleBlur() {
1135
- this.dispatchEvent(new Event("nys-blur"));
1213
+ this.classList.remove("active-focus"), this.dispatchEvent(new Event("nys-blur"));
1136
1214
  }
1137
- // Handle keydown for keyboard accessibility
1138
- _handleKeydown(t) {
1139
- t.code === "Space" && (t.preventDefault(), !this.disabled && !this.checked && (l.buttonGroup[this.name] && (l.buttonGroup[this.name].checked = !1, l.buttonGroup[this.name].requestUpdate()), l.buttonGroup[this.name] = this, this.checked = !0, this._emitChangeEvent()));
1215
+ _callInputHandling() {
1216
+ var e;
1217
+ if (this.disabled) return;
1218
+ const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(
1219
+ 'input[type="radio"]'
1220
+ );
1221
+ t && (t.focus(), t.click());
1140
1222
  }
1141
1223
  render() {
1142
1224
  return j`
1143
- <label class="nys-radiobutton">
1144
- <input
1145
- id="${this.id}"
1146
- class="nys-radiobutton__radio"
1147
- type="radio"
1148
- name="${Bt(this.name ? this.name : void 0)}"
1149
- .checked=${this.checked}
1150
- ?disabled=${this.disabled}
1151
- .value=${this.value}
1152
- ?required="${this.required}"
1153
- aria-checked="${this.checked ? "true" : "false"}"
1154
- aria-disabled="${this.disabled ? "true" : "false"}"
1155
- aria-required="${this.required ? "true" : "false"}"
1156
- @change="${this._handleChange}"
1157
- @focus="${this._handleFocus}"
1158
- @blur="${this._handleBlur}"
1159
- @keydown="${this._handleKeydown}"
1160
- />
1225
+ <input
1226
+ id="${this.id}"
1227
+ type="radio"
1228
+ name="${Bt(this.name ? this.name : void 0)}"
1229
+ .checked=${this.checked}
1230
+ ?disabled=${this.disabled}
1231
+ .value=${this.value}
1232
+ ?required="${this.required}"
1233
+ @change="${this._handleChange}"
1234
+ hidden
1235
+ aria-hidden="true"
1236
+ />
1237
+
1238
+ <label
1239
+ class="nys-radiobutton"
1240
+ for="${this.id}"
1241
+ @click="${this._callInputHandling}"
1242
+ >
1243
+ <span class="nys-radiobutton__radio"></span>
1244
+
1161
1245
  ${this.label && j` <div class="nys-radiobutton__text">
1162
- <label for=${this.id} class="nys-radiobutton__label"
1163
- >${this.label}</label
1164
- >
1165
- <label for=${this.id} class="nys-radiobutton__description">
1246
+ <div class="nys-radiobutton__label">${this.label}</div>
1247
+ <div class="nys-radiobutton__description">
1166
1248
  <slot name="description">${this.description}</slot>
1167
- </label>
1249
+ </div>
1168
1250
  </div>`}
1169
1251
  </label>
1170
1252
  `;
1171
1253
  }
1172
- }, l.VALID_SIZES = ["sm", "md"], l.buttonGroup = {}, l.styles = ct, l);
1254
+ }, h.VALID_SIZES = ["sm", "md"], h.buttonGroup = {}, h.styles = ut, h);
1173
1255
  v([
1174
- c({ type: Boolean, reflect: !0 })
1256
+ u({ type: Boolean, reflect: !0 })
1175
1257
  ], f.prototype, "checked", 2);
1176
1258
  v([
1177
- c({ type: Boolean, reflect: !0 })
1259
+ u({ type: Boolean, reflect: !0 })
1178
1260
  ], f.prototype, "disabled", 2);
1179
1261
  v([
1180
- c({ type: Boolean, reflect: !0 })
1262
+ u({ type: Boolean, reflect: !0 })
1181
1263
  ], f.prototype, "required", 2);
1182
1264
  v([
1183
- c({ type: String })
1265
+ u({ type: String })
1184
1266
  ], f.prototype, "label", 2);
1185
1267
  v([
1186
- c({ type: String })
1268
+ u({ type: String })
1187
1269
  ], f.prototype, "description", 2);
1188
1270
  v([
1189
- c({ type: String })
1271
+ u({ type: String })
1190
1272
  ], f.prototype, "id", 2);
1191
1273
  v([
1192
- c({ type: String, reflect: !0 })
1274
+ u({ type: String, reflect: !0 })
1193
1275
  ], f.prototype, "name", 2);
1194
1276
  v([
1195
- c({ type: String })
1277
+ u({ type: String })
1196
1278
  ], f.prototype, "value", 2);
1197
1279
  v([
1198
- c({ reflect: !0 })
1280
+ u({ reflect: !0 })
1199
1281
  ], f.prototype, "size", 1);
1200
1282
  v([
1201
- c({ type: Boolean, reflect: !0 })
1283
+ u({ type: Boolean, reflect: !0 })
1202
1284
  ], f.prototype, "tile", 2);
1203
- let Dt = f;
1204
- customElements.get("nys-radiobutton") || customElements.define("nys-radiobutton", Dt);
1285
+ let Nt = f;
1286
+ customElements.get("nys-radiobutton") || customElements.define("nys-radiobutton", Nt);
1205
1287
  export {
1206
- Dt as NysRadiobutton,
1207
- Tt as NysRadiogroup
1288
+ Nt as NysRadiobutton,
1289
+ Dt as NysRadiogroup
1208
1290
  };
1209
1291
  //# sourceMappingURL=nys-radiobutton.js.map