@nysds/nys-checkbox 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/nys-checkbox.d.ts +3 -1
- package/dist/nys-checkbox.js +239 -174
- package/dist/nys-checkbox.js.map +1 -1
- package/dist/nys-checkboxgroup.d.ts +5 -1
- package/package.json +5 -5
package/dist/nys-checkbox.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { css as s1, LitElement as U, html as
|
|
1
|
+
import { css as s1, LitElement as U, html as u } from "lit";
|
|
2
2
|
/*!
|
|
3
3
|
* ▒█▄░▒█ ▒█░░▒█ ▒█▀▀▀█ ▒█▀▀▄ ▒█▀▀▀█
|
|
4
4
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
5
5
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
6
6
|
*
|
|
7
|
-
* Checkbox v1.1.
|
|
7
|
+
* Checkbox v1.1.1
|
|
8
8
|
* Part of the New York State Design System
|
|
9
9
|
* Repository: https://github.com/its-hcd/nysds
|
|
10
10
|
* License: MIT
|
|
@@ -49,7 +49,7 @@ const H5 = (i) => new S5(typeof i == "string" ? i : i + "", void 0, u5), V5 = (i
|
|
|
49
49
|
* Copyright 2017 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
51
|
*/
|
|
52
|
-
const { is: k5, defineProperty: P5, getOwnPropertyDescriptor: A5, getOwnPropertyNames: U5, getOwnPropertySymbols: z5, getPrototypeOf: O5 } = Object,
|
|
52
|
+
const { is: k5, defineProperty: P5, getOwnPropertyDescriptor: A5, getOwnPropertyNames: U5, getOwnPropertySymbols: z5, getPrototypeOf: O5 } = Object, x = globalThis, q1 = x.trustedTypes, B5 = q1 ? q1.emptyScript : "", m1 = x.reactiveElementPolyfillSupport, K = (i, t) => i, a1 = { toAttribute(i, t) {
|
|
53
53
|
switch (t) {
|
|
54
54
|
case Boolean:
|
|
55
55
|
i = i ? B5 : null;
|
|
@@ -78,7 +78,7 @@ const { is: k5, defineProperty: P5, getOwnPropertyDescriptor: A5, getOwnProperty
|
|
|
78
78
|
}
|
|
79
79
|
return e;
|
|
80
80
|
} }, E1 = (i, t) => !k5(i, t), j1 = { attribute: !0, type: String, converter: a1, reflect: !1, hasChanged: E1 };
|
|
81
|
-
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")),
|
|
81
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), x.litPropertyMetadata ?? (x.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
82
82
|
let T = class extends HTMLElement {
|
|
83
83
|
static addInitializer(t) {
|
|
84
84
|
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
@@ -277,7 +277,7 @@ let T = class extends HTMLElement {
|
|
|
277
277
|
firstUpdated(t) {
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
|
-
T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[K("elementProperties")] = /* @__PURE__ */ new Map(), T[K("finalized")] = /* @__PURE__ */ new Map(), m1 == null || m1({ ReactiveElement: T }), (
|
|
280
|
+
T.elementStyles = [], T.shadowRootOptions = { mode: "open" }, T[K("elementProperties")] = /* @__PURE__ */ new Map(), T[K("finalized")] = /* @__PURE__ */ new Map(), m1 == null || m1({ ReactiveElement: T }), (x.reactiveElementVersions ?? (x.reactiveElementVersions = [])).push("2.0.4");
|
|
281
281
|
/**
|
|
282
282
|
* @license
|
|
283
283
|
* Copyright 2017 Google LLC
|
|
@@ -304,7 +304,7 @@ const R5 = { attribute: !0, type: String, converter: a1, reflect: !1, hasChanged
|
|
|
304
304
|
}
|
|
305
305
|
throw Error("Unsupported decorator location: " + s);
|
|
306
306
|
};
|
|
307
|
-
function
|
|
307
|
+
function a(i) {
|
|
308
308
|
return (t, e) => typeof e == "object" ? T5(i, t, e) : ((s, o, r) => {
|
|
309
309
|
const C = o.hasOwnProperty(r);
|
|
310
310
|
return o.constructor.createProperty(r, C ? { ...s, wrapped: !0 } : s), C ? Object.getOwnPropertyDescriptor(o, r) : void 0;
|
|
@@ -315,9 +315,9 @@ function h(i) {
|
|
|
315
315
|
* Copyright 2017 Google LLC
|
|
316
316
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
317
317
|
*/
|
|
318
|
-
const J = globalThis, h1 = J.trustedTypes, D1 = h1 ? h1.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, g5 = "$lit$",
|
|
319
|
-
\f\r]`, q = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, N1 = /-->/g, I1 = />/g,
|
|
320
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), W1 = /'/g, F1 = /"/g,
|
|
318
|
+
const J = globalThis, h1 = J.trustedTypes, D1 = h1 ? h1.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, g5 = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, f5 = "?" + $, q5 = `<${f5}>`, E = document, d1 = () => E.createComment(""), t1 = (i) => i === null || typeof i != "object" && typeof i != "function", Z1 = Array.isArray, j5 = (i) => Z1(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", b1 = `[
|
|
319
|
+
\f\r]`, q = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, N1 = /-->/g, I1 = />/g, L = RegExp(`>|${b1}(?:([^\\s"'>=/]+)(${b1}*=${b1}*(?:[^
|
|
320
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), W1 = /'/g, F1 = /"/g, y5 = /^(?:script|style|textarea|title)$/i, e1 = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), K1 = /* @__PURE__ */ new WeakMap(), M = E.createTreeWalker(E, 129);
|
|
321
321
|
function w5(i, t) {
|
|
322
322
|
if (!Z1(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
323
323
|
return D1 !== void 0 ? D1.createHTML(t) : t;
|
|
@@ -327,41 +327,41 @@ const D5 = (i, t) => {
|
|
|
327
327
|
let o, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", C = q;
|
|
328
328
|
for (let n = 0; n < e; n++) {
|
|
329
329
|
const l = i[n];
|
|
330
|
-
let
|
|
331
|
-
for (; y < l.length && (C.lastIndex = y, p = C.exec(l), p !== null); ) y = C.lastIndex, C === q ? p[1] === "!--" ? C = N1 : p[1] !== void 0 ? C = I1 : p[2] !== void 0 ? (
|
|
332
|
-
const
|
|
333
|
-
r += C === q ? l + q5 : c >= 0 ? (s.push(
|
|
330
|
+
let h, p, c = -1, y = 0;
|
|
331
|
+
for (; y < l.length && (C.lastIndex = y, p = C.exec(l), p !== null); ) y = C.lastIndex, C === q ? p[1] === "!--" ? C = N1 : p[1] !== void 0 ? C = I1 : p[2] !== void 0 ? (y5.test(p[2]) && (o = RegExp("</" + p[2], "g")), C = L) : p[3] !== void 0 && (C = L) : C === L ? p[0] === ">" ? (C = o ?? q, c = -1) : p[1] === void 0 ? c = -2 : (c = C.lastIndex - p[2].length, h = p[1], C = p[3] === void 0 ? L : p[3] === '"' ? F1 : W1) : C === F1 || C === W1 ? C = L : C === N1 || C === I1 ? C = q : (C = L, o = void 0);
|
|
332
|
+
const b = C === L && i[n + 1].startsWith("/>") ? " " : "";
|
|
333
|
+
r += C === q ? l + q5 : c >= 0 ? (s.push(h), l.slice(0, c) + g5 + l.slice(c) + $ + b) : l + $ + (c === -2 ? n : b);
|
|
334
334
|
}
|
|
335
335
|
return [w5(i, r + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
|
|
336
336
|
};
|
|
337
|
-
let
|
|
337
|
+
let x1 = class _5 {
|
|
338
338
|
constructor({ strings: t, _$litType$: e }, s) {
|
|
339
339
|
let o;
|
|
340
340
|
this.parts = [];
|
|
341
341
|
let r = 0, C = 0;
|
|
342
|
-
const n = t.length - 1, l = this.parts, [
|
|
343
|
-
if (this.el = _5.createElement(
|
|
342
|
+
const n = t.length - 1, l = this.parts, [h, p] = D5(t, e);
|
|
343
|
+
if (this.el = _5.createElement(h, s), M.currentNode = this.el.content, e === 2 || e === 3) {
|
|
344
344
|
const c = this.el.content.firstChild;
|
|
345
345
|
c.replaceWith(...c.childNodes);
|
|
346
346
|
}
|
|
347
347
|
for (; (o = M.nextNode()) !== null && l.length < n; ) {
|
|
348
348
|
if (o.nodeType === 1) {
|
|
349
349
|
if (o.hasAttributes()) for (const c of o.getAttributeNames()) if (c.endsWith(g5)) {
|
|
350
|
-
const y = p[C++],
|
|
351
|
-
l.push({ type: 1, index: r, name: i1[2], strings:
|
|
352
|
-
} else c.startsWith(
|
|
353
|
-
if (
|
|
354
|
-
const c = o.textContent.split(
|
|
350
|
+
const y = p[C++], b = o.getAttribute(c).split($), i1 = /([.?@])?(.*)/.exec(y);
|
|
351
|
+
l.push({ type: 1, index: r, name: i1[2], strings: b, ctor: i1[1] === "." ? I5 : i1[1] === "?" ? W5 : i1[1] === "@" ? F5 : f1 }), o.removeAttribute(c);
|
|
352
|
+
} else c.startsWith($) && (l.push({ type: 6, index: r }), o.removeAttribute(c));
|
|
353
|
+
if (y5.test(o.tagName)) {
|
|
354
|
+
const c = o.textContent.split($), y = c.length - 1;
|
|
355
355
|
if (y > 0) {
|
|
356
356
|
o.textContent = h1 ? h1.emptyScript : "";
|
|
357
|
-
for (let
|
|
357
|
+
for (let b = 0; b < y; b++) o.append(c[b], d1()), M.nextNode(), l.push({ type: 2, index: ++r });
|
|
358
358
|
o.append(c[y], d1());
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
} else if (o.nodeType === 8) if (o.data ===
|
|
361
|
+
} else if (o.nodeType === 8) if (o.data === f5) l.push({ type: 2, index: r });
|
|
362
362
|
else {
|
|
363
363
|
let c = -1;
|
|
364
|
-
for (; (c = o.data.indexOf(
|
|
364
|
+
for (; (c = o.data.indexOf($, c + 1)) !== -1; ) l.push({ type: 7, index: r }), c += $.length - 1;
|
|
365
365
|
}
|
|
366
366
|
r++;
|
|
367
367
|
}
|
|
@@ -394,8 +394,8 @@ let N5 = class {
|
|
|
394
394
|
let r = M.nextNode(), C = 0, n = 0, l = s[0];
|
|
395
395
|
for (; l !== void 0; ) {
|
|
396
396
|
if (C === l.index) {
|
|
397
|
-
let
|
|
398
|
-
l.type === 2 ?
|
|
397
|
+
let h;
|
|
398
|
+
l.type === 2 ? h = new m5(r, r.nextSibling, this, t) : l.type === 1 ? h = new l.ctor(r, l.name, l.strings, this, t) : l.type === 6 && (h = new K5(r, this, t)), this._$AV.push(h), l = s[++n];
|
|
399
399
|
}
|
|
400
400
|
C !== (l == null ? void 0 : l.index) && (r = M.nextNode(), C++);
|
|
401
401
|
}
|
|
@@ -411,7 +411,7 @@ let N5 = class {
|
|
|
411
411
|
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
412
412
|
}
|
|
413
413
|
constructor(t, e, s, o) {
|
|
414
|
-
this.type = 2, this._$AH =
|
|
414
|
+
this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0;
|
|
415
415
|
}
|
|
416
416
|
get parentNode() {
|
|
417
417
|
let t = this._$AA.parentNode;
|
|
@@ -425,7 +425,7 @@ let N5 = class {
|
|
|
425
425
|
return this._$AB;
|
|
426
426
|
}
|
|
427
427
|
_$AI(t, e = this) {
|
|
428
|
-
t = H(this, t, e), t1(t) ? t ===
|
|
428
|
+
t = H(this, t, e), t1(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== e1 && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : j5(t) ? this.k(t) : this._(t);
|
|
429
429
|
}
|
|
430
430
|
O(t) {
|
|
431
431
|
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
@@ -434,11 +434,11 @@ let N5 = class {
|
|
|
434
434
|
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
435
435
|
}
|
|
436
436
|
_(t) {
|
|
437
|
-
this._$AH !==
|
|
437
|
+
this._$AH !== d && t1(this._$AH) ? this._$AA.nextSibling.data = t : this.T(E.createTextNode(t)), this._$AH = t;
|
|
438
438
|
}
|
|
439
439
|
$(t) {
|
|
440
440
|
var r;
|
|
441
|
-
const { values: e, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el =
|
|
441
|
+
const { values: e, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = x1.createElement(w5(s.h, s.h[0]), this.options)), s);
|
|
442
442
|
if (((r = this._$AH) == null ? void 0 : r._$AD) === o) this._$AH.p(e);
|
|
443
443
|
else {
|
|
444
444
|
const C = new N5(o, this), n = C.u(this.options);
|
|
@@ -447,7 +447,7 @@ let N5 = class {
|
|
|
447
447
|
}
|
|
448
448
|
_$AC(t) {
|
|
449
449
|
let e = K1.get(t.strings);
|
|
450
|
-
return e === void 0 && K1.set(t.strings, e = new
|
|
450
|
+
return e === void 0 && K1.set(t.strings, e = new x1(t)), e;
|
|
451
451
|
}
|
|
452
452
|
k(t) {
|
|
453
453
|
Z1(this._$AH) || (this._$AH = [], this._$AR());
|
|
@@ -467,7 +467,7 @@ let N5 = class {
|
|
|
467
467
|
var e;
|
|
468
468
|
this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
|
|
469
469
|
}
|
|
470
|
-
},
|
|
470
|
+
}, f1 = class {
|
|
471
471
|
get tagName() {
|
|
472
472
|
return this.element.tagName;
|
|
473
473
|
}
|
|
@@ -475,7 +475,7 @@ let N5 = class {
|
|
|
475
475
|
return this._$AM._$AU;
|
|
476
476
|
}
|
|
477
477
|
constructor(t, e, s, o, r) {
|
|
478
|
-
this.type = 1, this._$AH =
|
|
478
|
+
this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = o, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = d;
|
|
479
479
|
}
|
|
480
480
|
_$AI(t, e = this, s, o) {
|
|
481
481
|
const r = this.strings;
|
|
@@ -483,35 +483,35 @@ let N5 = class {
|
|
|
483
483
|
if (r === void 0) t = H(this, t, e, 0), C = !t1(t) || t !== this._$AH && t !== e1, C && (this._$AH = t);
|
|
484
484
|
else {
|
|
485
485
|
const n = t;
|
|
486
|
-
let l,
|
|
487
|
-
for (t = r[0], l = 0; l < r.length - 1; l++)
|
|
486
|
+
let l, h;
|
|
487
|
+
for (t = r[0], l = 0; l < r.length - 1; l++) h = H(this, n[s + l], e, l), h === e1 && (h = this._$AH[l]), C || (C = !t1(h) || h !== this._$AH[l]), h === d ? t = d : t !== d && (t += (h ?? "") + r[l + 1]), this._$AH[l] = h;
|
|
488
488
|
}
|
|
489
489
|
C && !o && this.j(t);
|
|
490
490
|
}
|
|
491
491
|
j(t) {
|
|
492
|
-
t ===
|
|
492
|
+
t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
493
493
|
}
|
|
494
|
-
}, I5 = class extends
|
|
494
|
+
}, I5 = class extends f1 {
|
|
495
495
|
constructor() {
|
|
496
496
|
super(...arguments), this.type = 3;
|
|
497
497
|
}
|
|
498
498
|
j(t) {
|
|
499
|
-
this.element[this.name] = t ===
|
|
499
|
+
this.element[this.name] = t === d ? void 0 : t;
|
|
500
500
|
}
|
|
501
|
-
}, W5 = class extends
|
|
501
|
+
}, W5 = class extends f1 {
|
|
502
502
|
constructor() {
|
|
503
503
|
super(...arguments), this.type = 4;
|
|
504
504
|
}
|
|
505
505
|
j(t) {
|
|
506
|
-
this.element.toggleAttribute(this.name, !!t && t !==
|
|
506
|
+
this.element.toggleAttribute(this.name, !!t && t !== d);
|
|
507
507
|
}
|
|
508
|
-
}, F5 = class extends
|
|
508
|
+
}, F5 = class extends f1 {
|
|
509
509
|
constructor(t, e, s, o, r) {
|
|
510
510
|
super(t, e, s, o, r), this.type = 5;
|
|
511
511
|
}
|
|
512
512
|
_$AI(t, e = this) {
|
|
513
|
-
if ((t = H(this, t, e, 0) ??
|
|
514
|
-
const s = this._$AH, o = t ===
|
|
513
|
+
if ((t = H(this, t, e, 0) ?? d) === e1) return;
|
|
514
|
+
const s = this._$AH, o = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, r = t !== d && (s === d || o);
|
|
515
515
|
o && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
516
516
|
}
|
|
517
517
|
handleEvent(t) {
|
|
@@ -530,13 +530,13 @@ let N5 = class {
|
|
|
530
530
|
}
|
|
531
531
|
};
|
|
532
532
|
const $1 = J.litHtmlPolyfillSupport;
|
|
533
|
-
$1 == null || $1(
|
|
533
|
+
$1 == null || $1(x1, m5), (J.litHtmlVersions ?? (J.litHtmlVersions = [])).push("3.2.1");
|
|
534
534
|
/**
|
|
535
535
|
* @license
|
|
536
536
|
* Copyright 2018 Google LLC
|
|
537
537
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
538
538
|
*/
|
|
539
|
-
const J5 = (i) => i ??
|
|
539
|
+
const J5 = (i) => i ?? d, $5 = s1`
|
|
540
540
|
:host {
|
|
541
541
|
/* Anything that can be overridden should be defined here */
|
|
542
542
|
|
|
@@ -615,7 +615,10 @@ const J5 = (i) => i ?? a, $5 = s1`
|
|
|
615
615
|
--nys-color-neutral-400,
|
|
616
616
|
#757575
|
|
617
617
|
);
|
|
618
|
-
--_nys-checkbox-disabled-color-text: var(
|
|
618
|
+
--_nys-checkbox-disabled-color-text: var(
|
|
619
|
+
--nys-color-text-disabled,
|
|
620
|
+
#bec0c1
|
|
621
|
+
);
|
|
619
622
|
/* Disabled Checked */
|
|
620
623
|
--_nys-checkbox-disabled-checked-color-bg: var(
|
|
621
624
|
--nys-color-neutral-100,
|
|
@@ -643,7 +646,7 @@ const J5 = (i) => i ?? a, $5 = s1`
|
|
|
643
646
|
.nys-checkboxgroup {
|
|
644
647
|
display: flex;
|
|
645
648
|
flex-direction: column;
|
|
646
|
-
gap: var(--nys-
|
|
649
|
+
gap: var(--nys-space-200, 16px);
|
|
647
650
|
font-family: var(--_nys-checkbox-font-family);
|
|
648
651
|
font-size: var(--_nys-checkbox-font-size);
|
|
649
652
|
line-height: var(--_nys-checkbox-line-height);
|
|
@@ -755,18 +758,20 @@ const J5 = (i) => i ?? a, $5 = s1`
|
|
|
755
758
|
display: flex;
|
|
756
759
|
flex-direction: column;
|
|
757
760
|
margin: auto 0; /* Center text if single line label */
|
|
761
|
+
align-items: flex-start;
|
|
758
762
|
}
|
|
759
763
|
|
|
760
764
|
/* Label styling */
|
|
761
765
|
.nys-checkbox__label {
|
|
762
766
|
font-weight: var(--_nys-checkbox-font-weight-400);
|
|
763
|
-
color: var(--
|
|
767
|
+
color: var(--nys-color-text, #1b1b1b);
|
|
764
768
|
}
|
|
765
769
|
|
|
766
770
|
/* Description styling */
|
|
767
771
|
.nys-checkbox__description {
|
|
768
772
|
font-weight: var(--_nys-checkbox-font-weight-400);
|
|
769
773
|
font-style: italic;
|
|
774
|
+
text-align: left;
|
|
770
775
|
}
|
|
771
776
|
|
|
772
777
|
/* Required */
|
|
@@ -783,7 +788,7 @@ const J5 = (i) => i ?? a, $5 = s1`
|
|
|
783
788
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
784
789
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
785
790
|
*
|
|
786
|
-
* Icon Component v1.1.
|
|
791
|
+
* Icon Component v1.1.1
|
|
787
792
|
* Part of the New York State Design System
|
|
788
793
|
* Repository: https://github.com/its-hcd/nysds
|
|
789
794
|
* License: MIT
|
|
@@ -793,10 +798,10 @@ const J5 = (i) => i ?? a, $5 = s1`
|
|
|
793
798
|
* Copyright 2019 Google LLC
|
|
794
799
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
795
800
|
*/
|
|
796
|
-
const C1 = globalThis, S1 = C1.ShadowRoot && (C1.ShadyCSS === void 0 || C1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
801
|
+
const C1 = globalThis, S1 = C1.ShadowRoot && (C1.ShadyCSS === void 0 || C1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, x5 = Symbol(), J1 = /* @__PURE__ */ new WeakMap();
|
|
797
802
|
let G5 = class {
|
|
798
803
|
constructor(t, e, s) {
|
|
799
|
-
if (this._$cssResult$ = !0, s !==
|
|
804
|
+
if (this._$cssResult$ = !0, s !== x5) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
800
805
|
this.cssText = t, this.t = e;
|
|
801
806
|
}
|
|
802
807
|
get styleSheet() {
|
|
@@ -812,7 +817,7 @@ let G5 = class {
|
|
|
812
817
|
return this.cssText;
|
|
813
818
|
}
|
|
814
819
|
};
|
|
815
|
-
const Y5 = (i) => new G5(typeof i == "string" ? i : i + "", void 0,
|
|
820
|
+
const Y5 = (i) => new G5(typeof i == "string" ? i : i + "", void 0, x5), X5 = (i, t) => {
|
|
816
821
|
if (S1) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
817
822
|
else for (const e of t) {
|
|
818
823
|
const s = document.createElement("style"), o = C1.litNonce;
|
|
@@ -1410,7 +1415,7 @@ const Z = (D = class extends U {
|
|
|
1410
1415
|
}
|
|
1411
1416
|
render() {
|
|
1412
1417
|
const i = this.getIcon();
|
|
1413
|
-
return i ?
|
|
1418
|
+
return i ? u`${i}` : null;
|
|
1414
1419
|
}
|
|
1415
1420
|
}, D.styles = c2, D.VALID_TYPES = [
|
|
1416
1421
|
"2xs",
|
|
@@ -1430,7 +1435,7 @@ const Z = (D = class extends U {
|
|
|
1430
1435
|
"64"
|
|
1431
1436
|
], D);
|
|
1432
1437
|
O([
|
|
1433
|
-
z({ type: String })
|
|
1438
|
+
z({ type: String, reflect: !0 })
|
|
1434
1439
|
], Z.prototype, "name", 2);
|
|
1435
1440
|
O([
|
|
1436
1441
|
z({ type: String })
|
|
@@ -1450,7 +1455,7 @@ O([
|
|
|
1450
1455
|
let d2 = Z;
|
|
1451
1456
|
customElements.get("nys-icon") || customElements.define("nys-icon", d2);
|
|
1452
1457
|
/*!
|
|
1453
|
-
* Label v1.1.
|
|
1458
|
+
* Label v1.1.1
|
|
1454
1459
|
* Part of the New York State Design System
|
|
1455
1460
|
* A design system for New York State's digital products.
|
|
1456
1461
|
* Repository: https://github.com/its-hcd/nysds
|
|
@@ -1461,10 +1466,10 @@ customElements.get("nys-icon") || customElements.define("nys-icon", d2);
|
|
|
1461
1466
|
* Copyright 2019 Google LLC
|
|
1462
1467
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1463
1468
|
*/
|
|
1464
|
-
const n1 = globalThis, V1 = n1.ShadowRoot && (n1.ShadyCSS === void 0 || n1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
1469
|
+
const n1 = globalThis, V1 = n1.ShadowRoot && (n1.ShadyCSS === void 0 || n1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, L5 = Symbol(), t5 = /* @__PURE__ */ new WeakMap();
|
|
1465
1470
|
let p2 = class {
|
|
1466
1471
|
constructor(t, e, s) {
|
|
1467
|
-
if (this._$cssResult$ = !0, s !==
|
|
1472
|
+
if (this._$cssResult$ = !0, s !== L5) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
1468
1473
|
this.cssText = t, this.t = e;
|
|
1469
1474
|
}
|
|
1470
1475
|
get styleSheet() {
|
|
@@ -1480,7 +1485,7 @@ let p2 = class {
|
|
|
1480
1485
|
return this.cssText;
|
|
1481
1486
|
}
|
|
1482
1487
|
};
|
|
1483
|
-
const v2 = (i) => new p2(typeof i == "string" ? i : i + "", void 0,
|
|
1488
|
+
const v2 = (i) => new p2(typeof i == "string" ? i : i + "", void 0, L5), u2 = (i, t) => {
|
|
1484
1489
|
if (V1) i.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
1485
1490
|
else for (const e of t) {
|
|
1486
1491
|
const s = document.createElement("style"), o = n1.litNonce;
|
|
@@ -1496,7 +1501,7 @@ const v2 = (i) => new p2(typeof i == "string" ? i : i + "", void 0, x5), u2 = (i
|
|
|
1496
1501
|
* Copyright 2017 Google LLC
|
|
1497
1502
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1498
1503
|
*/
|
|
1499
|
-
const { is: g2, defineProperty:
|
|
1504
|
+
const { is: g2, defineProperty: f2, getOwnPropertyDescriptor: y2, getOwnPropertyNames: w2, getOwnPropertySymbols: _2, getPrototypeOf: m2 } = Object, k = globalThis, s5 = k.trustedTypes, b2 = s5 ? s5.emptyScript : "", o5 = k.reactiveElementPolyfillSupport, Y = (i, t) => i, v1 = { toAttribute(i, t) {
|
|
1500
1505
|
switch (t) {
|
|
1501
1506
|
case Boolean:
|
|
1502
1507
|
i = i ? b2 : null;
|
|
@@ -1536,11 +1541,11 @@ let N = class extends HTMLElement {
|
|
|
1536
1541
|
static createProperty(t, e = i5) {
|
|
1537
1542
|
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
1538
1543
|
const s = Symbol(), o = this.getPropertyDescriptor(t, s, e);
|
|
1539
|
-
o !== void 0 &&
|
|
1544
|
+
o !== void 0 && f2(this.prototype, t, o);
|
|
1540
1545
|
}
|
|
1541
1546
|
}
|
|
1542
1547
|
static getPropertyDescriptor(t, e, s) {
|
|
1543
|
-
const { get: o, set: r } =
|
|
1548
|
+
const { get: o, set: r } = y2(this.prototype, t) ?? { get() {
|
|
1544
1549
|
return this[e];
|
|
1545
1550
|
}, set(C) {
|
|
1546
1551
|
this[e] = C;
|
|
@@ -1730,7 +1735,7 @@ N.elementStyles = [], N.shadowRootOptions = { mode: "open" }, N[Y("elementProper
|
|
|
1730
1735
|
* Copyright 2017 Google LLC
|
|
1731
1736
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1732
1737
|
*/
|
|
1733
|
-
const $2 = { attribute: !0, type: String, converter: v1, reflect: !1, hasChanged: k1 },
|
|
1738
|
+
const $2 = { attribute: !0, type: String, converter: v1, reflect: !1, hasChanged: k1 }, x2 = (i = $2, t, e) => {
|
|
1734
1739
|
const { kind: s, metadata: o } = e;
|
|
1735
1740
|
let r = globalThis.litPropertyMetadata.get(o);
|
|
1736
1741
|
if (r === void 0 && globalThis.litPropertyMetadata.set(o, r = /* @__PURE__ */ new Map()), r.set(e.name, i), s === "accessor") {
|
|
@@ -1751,13 +1756,13 @@ const $2 = { attribute: !0, type: String, converter: v1, reflect: !1, hasChanged
|
|
|
1751
1756
|
}
|
|
1752
1757
|
throw Error("Unsupported decorator location: " + s);
|
|
1753
1758
|
};
|
|
1754
|
-
function
|
|
1755
|
-
return (t, e) => typeof e == "object" ?
|
|
1759
|
+
function y1(i) {
|
|
1760
|
+
return (t, e) => typeof e == "object" ? x2(i, t, e) : ((s, o, r) => {
|
|
1756
1761
|
const C = o.hasOwnProperty(r);
|
|
1757
1762
|
return o.constructor.createProperty(r, C ? { ...s, wrapped: !0 } : s), C ? Object.getOwnPropertyDescriptor(o, r) : void 0;
|
|
1758
1763
|
})(i, t, e);
|
|
1759
1764
|
}
|
|
1760
|
-
const
|
|
1765
|
+
const L2 = s1`
|
|
1761
1766
|
:host {
|
|
1762
1767
|
/* Label Typography */
|
|
1763
1768
|
--_nys-label-font-family: var(
|
|
@@ -1775,19 +1780,19 @@ const x2 = s1`
|
|
|
1775
1780
|
--_nys-label-font-size: var(--nys-font-size-ui-md, 16px);
|
|
1776
1781
|
--_nys-label-line-height: var(--nys-font-lineheight-ui-md, 24px);
|
|
1777
1782
|
--_nys-label-letter-spacing: var(--nys-font-letterspacing-ui-md, 0.044px);
|
|
1778
|
-
--_nys-label-font-color: var(--nys-color-
|
|
1783
|
+
--_nys-label-font-color: var(--nys-color-text, #1b1b1b);
|
|
1779
1784
|
|
|
1780
1785
|
/* Description */
|
|
1781
1786
|
--nys-description-font-weight: var(--nys-font-weight-regular, 400);
|
|
1782
1787
|
--nys-description-font-style: italic;
|
|
1783
|
-
--nys-description-font-color: var(--nys-
|
|
1788
|
+
--nys-description-font-color: var(--nys-color-text, #1b1b1b);
|
|
1784
1789
|
|
|
1785
1790
|
/* Required Flag */
|
|
1786
1791
|
--nys-required-font-color: var(--nys-color-danger, #b52c2c);
|
|
1787
1792
|
|
|
1788
1793
|
/* Optional Flag */
|
|
1789
1794
|
--nys-optional-font-weight: var(--nys-font-weight-regular, 400);
|
|
1790
|
-
--nys-optional-font-color: var(--nys-color-
|
|
1795
|
+
--nys-optional-font-color: var(--nys-color-text-weak, #4a4d4f);
|
|
1791
1796
|
|
|
1792
1797
|
/* Spacing */
|
|
1793
1798
|
--_nys-label-flag-gap: var(--nys-space-2px, 2px);
|
|
@@ -1839,12 +1844,12 @@ const M5 = class extends U {
|
|
|
1839
1844
|
super(...arguments), this.id = "", this.label = "", this.description = "", this.flag = "";
|
|
1840
1845
|
}
|
|
1841
1846
|
render() {
|
|
1842
|
-
return
|
|
1847
|
+
return u`
|
|
1843
1848
|
<div class="nys-label">
|
|
1844
1849
|
<label for=${this.id} class="nys-label__label"
|
|
1845
1850
|
>${this.label}
|
|
1846
|
-
${this.flag === "required" ?
|
|
1847
|
-
${this.flag === "optional" ?
|
|
1851
|
+
${this.flag === "required" ? u`<label class="nys-label__required">*</label>` : ""}
|
|
1852
|
+
${this.flag === "optional" ? u`<label class="nys-label__optional">(Optional)</label>` : ""}</label
|
|
1848
1853
|
>
|
|
1849
1854
|
<label for=${this.id} class="nys-label__description">
|
|
1850
1855
|
<slot name="description">${this.description}</slot>
|
|
@@ -1853,23 +1858,23 @@ const M5 = class extends U {
|
|
|
1853
1858
|
`;
|
|
1854
1859
|
}
|
|
1855
1860
|
};
|
|
1856
|
-
M5.styles =
|
|
1861
|
+
M5.styles = L2;
|
|
1857
1862
|
let o1 = M5;
|
|
1858
1863
|
w1([
|
|
1859
|
-
|
|
1864
|
+
y1({ type: String })
|
|
1860
1865
|
], o1.prototype, "id");
|
|
1861
1866
|
w1([
|
|
1862
|
-
|
|
1867
|
+
y1({ type: String })
|
|
1863
1868
|
], o1.prototype, "label");
|
|
1864
1869
|
w1([
|
|
1865
|
-
|
|
1870
|
+
y1({ type: String })
|
|
1866
1871
|
], o1.prototype, "description");
|
|
1867
1872
|
w1([
|
|
1868
|
-
|
|
1873
|
+
y1({ type: String })
|
|
1869
1874
|
], o1.prototype, "flag");
|
|
1870
1875
|
customElements.get("nys-label") || customElements.define("nys-label", o1);
|
|
1871
1876
|
/*!
|
|
1872
|
-
* Error Message v1.1.
|
|
1877
|
+
* Error Message v1.1.1
|
|
1873
1878
|
* Part of the New York State Design System
|
|
1874
1879
|
* A design system for New York State's digital products.
|
|
1875
1880
|
* Repository: https://github.com/its-hcd/nysds
|
|
@@ -2231,7 +2236,7 @@ const R2 = s1`
|
|
|
2231
2236
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
2232
2237
|
* ▒█░░▀█ ░░▒█░░ ▒█▄▄▄█ ▒█▄▄▀ ▒█▄▄▄█
|
|
2233
2238
|
*
|
|
2234
|
-
* Icon Component v1.1.
|
|
2239
|
+
* Icon Component v1.1.1
|
|
2235
2240
|
* Part of the New York State Design System
|
|
2236
2241
|
* Repository: https://github.com/its-hcd/nysds
|
|
2237
2242
|
* License: MIT
|
|
@@ -2858,7 +2863,7 @@ const S = (F = class extends U {
|
|
|
2858
2863
|
}
|
|
2859
2864
|
render() {
|
|
2860
2865
|
const i = this.getIcon();
|
|
2861
|
-
return i ?
|
|
2866
|
+
return i ? u`${i}` : null;
|
|
2862
2867
|
}
|
|
2863
2868
|
}, F.styles = Q2, F.VALID_TYPES = [
|
|
2864
2869
|
"2xs",
|
|
@@ -2878,7 +2883,7 @@ const S = (F = class extends U {
|
|
|
2878
2883
|
"64"
|
|
2879
2884
|
], F);
|
|
2880
2885
|
R([
|
|
2881
|
-
B({ type: String })
|
|
2886
|
+
B({ type: String, reflect: !0 })
|
|
2882
2887
|
], S.prototype, "name", 2);
|
|
2883
2888
|
R([
|
|
2884
2889
|
B({ type: String })
|
|
@@ -2902,20 +2907,20 @@ var o7 = Object.defineProperty, B1 = (i, t, e, s) => {
|
|
|
2902
2907
|
(C = i[r]) && (o = C(t, e, o) || o);
|
|
2903
2908
|
return o && o7(t, e, o), o;
|
|
2904
2909
|
};
|
|
2905
|
-
const
|
|
2910
|
+
const L1 = class extends U {
|
|
2906
2911
|
// allows use of elementInternals' API
|
|
2907
2912
|
constructor() {
|
|
2908
2913
|
super(), this.showError = !1, this.errorMessage = "", this.showDivider = !1, this._internals = this.attachInternals();
|
|
2909
2914
|
}
|
|
2910
2915
|
render() {
|
|
2911
|
-
return
|
|
2916
|
+
return u`${this.showError ? u`<div class="nys-errormessage" ?showDivider=${this.showDivider}>
|
|
2912
2917
|
<nys-icon name="error" size="xl"></nys-icon>
|
|
2913
2918
|
${this._internals.validationMessage || this.errorMessage}
|
|
2914
2919
|
</div>` : ""}`;
|
|
2915
2920
|
}
|
|
2916
2921
|
};
|
|
2917
|
-
|
|
2918
|
-
let _1 =
|
|
2922
|
+
L1.styles = R2, L1.formAssociated = !0;
|
|
2923
|
+
let _1 = L1;
|
|
2919
2924
|
B1([
|
|
2920
2925
|
U1({ type: Boolean })
|
|
2921
2926
|
], _1.prototype, "showError");
|
|
@@ -2926,42 +2931,65 @@ B1([
|
|
|
2926
2931
|
U1({ type: Boolean, reflect: !0 })
|
|
2927
2932
|
], _1.prototype, "showDivider");
|
|
2928
2933
|
customElements.get("nys-errormessage") || customElements.define("nys-errormessage", _1);
|
|
2929
|
-
var i7 = Object.defineProperty, r7 = Object.getOwnPropertyDescriptor,
|
|
2934
|
+
var i7 = Object.defineProperty, r7 = Object.getOwnPropertyDescriptor, m = (i, t, e, s) => {
|
|
2930
2935
|
for (var o = s > 1 ? void 0 : s ? r7(t, e) : t, r = i.length - 1, C; r >= 0; r--)
|
|
2931
2936
|
(C = i[r]) && (o = (s ? C(t, e, o) : C(o)) || o);
|
|
2932
2937
|
return s && o && i7(t, e, o), o;
|
|
2933
2938
|
};
|
|
2934
2939
|
let C7 = 0;
|
|
2935
|
-
var
|
|
2936
|
-
const
|
|
2940
|
+
var w;
|
|
2941
|
+
const f = (w = class extends U {
|
|
2937
2942
|
// allows use of elementInternals' API
|
|
2938
2943
|
constructor() {
|
|
2939
|
-
super(), this.id = "", this.name = "", this.required = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this._size = "md", this._internals = this.attachInternals();
|
|
2944
|
+
super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this._size = "md", this._internals = this.attachInternals();
|
|
2940
2945
|
}
|
|
2941
2946
|
get size() {
|
|
2942
2947
|
return this._size;
|
|
2943
2948
|
}
|
|
2944
2949
|
set size(t) {
|
|
2945
|
-
this._size =
|
|
2950
|
+
this._size = w.VALID_SIZES.includes(
|
|
2946
2951
|
t
|
|
2947
2952
|
) ? t : "md";
|
|
2948
2953
|
}
|
|
2949
2954
|
// Generate a unique ID if one is not provided
|
|
2950
2955
|
connectedCallback() {
|
|
2951
|
-
super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${C7++}`), this.addEventListener("change", this.
|
|
2956
|
+
super.connectedCallback(), this.id || (this.id = `nys-checkbox-${Date.now()}-${C7++}`), this.addEventListener("change", this._handleCheckboxChange), this.addEventListener("invalid", this._handleInvalid);
|
|
2952
2957
|
}
|
|
2953
2958
|
disconnectedCallback() {
|
|
2954
|
-
super.disconnectedCallback(), this.removeEventListener("change", this.
|
|
2959
|
+
super.disconnectedCallback(), this.removeEventListener("change", this._handleCheckboxChange), this.removeEventListener("invalid", this._handleInvalid);
|
|
2960
|
+
}
|
|
2961
|
+
firstUpdated() {
|
|
2962
|
+
this._setGroupExist();
|
|
2955
2963
|
}
|
|
2956
2964
|
updated(t) {
|
|
2957
|
-
t.has("required") && this.required && this.
|
|
2965
|
+
t.has("required") && this.required && this._setupCheckboxRequired(), t.has("size") && this.updateCheckboxSize();
|
|
2958
2966
|
}
|
|
2959
2967
|
/********************** Functions **********************/
|
|
2960
|
-
|
|
2961
|
-
this.
|
|
2968
|
+
_setGroupExist() {
|
|
2969
|
+
this.querySelectorAll("nys-checkbox").forEach((e) => {
|
|
2970
|
+
e.groupExist = !0;
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
async _handleInvalid(t) {
|
|
2974
|
+
t.preventDefault(), this.showError = !0, this._manageCheckboxRequired();
|
|
2975
|
+
const e = this.querySelector("nys-checkbox"), s = e ? await e.getInputElement() : null;
|
|
2976
|
+
if (s) {
|
|
2977
|
+
const o = this._internals.form;
|
|
2978
|
+
o ? Array.from(o.elements).find((n) => {
|
|
2979
|
+
if (n.tagName.toLowerCase() === "nys-checkboxgroup") {
|
|
2980
|
+
if (Array.from(
|
|
2981
|
+
this.querySelectorAll("nys-checkbox")
|
|
2982
|
+
).filter(
|
|
2983
|
+
(p) => p.checked
|
|
2984
|
+
).length === 0)
|
|
2985
|
+
return n;
|
|
2986
|
+
} else
|
|
2987
|
+
return typeof n.checkValidity == "function" && !n.checkValidity();
|
|
2988
|
+
}) === this && s.focus() : s.focus();
|
|
2989
|
+
}
|
|
2962
2990
|
}
|
|
2963
2991
|
// Initial update on checkbox required attribute
|
|
2964
|
-
async
|
|
2992
|
+
async _setupCheckboxRequired() {
|
|
2965
2993
|
const t = this.querySelector("nys-checkbox"), e = this.errorMessage || "This field is required", s = t ? await t.getInputElement() : null;
|
|
2966
2994
|
this._internals.setValidity(
|
|
2967
2995
|
{ valueMissing: !0 },
|
|
@@ -2969,17 +2997,24 @@ const _ = (f = class extends U {
|
|
|
2969
2997
|
s || this
|
|
2970
2998
|
);
|
|
2971
2999
|
}
|
|
3000
|
+
// Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.
|
|
3001
|
+
_handleCheckboxChange(t) {
|
|
3002
|
+
const e = t, { name: s } = e.detail, r = Array.from(this.querySelectorAll("nys-checkbox")).filter((C) => C.checked).map((C) => C.value);
|
|
3003
|
+
this.name = s, this._internals.setFormValue(r.join(", ")), this._manageCheckboxRequired();
|
|
3004
|
+
}
|
|
2972
3005
|
// Updates the required attribute of each checkbox in the group
|
|
2973
3006
|
async _manageCheckboxRequired() {
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
{
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
3007
|
+
if (this.required) {
|
|
3008
|
+
const t = this.errorMessage || "Please select at least one option.", e = this.querySelector("nys-checkbox"), s = e ? await e.getInputElement() : null;
|
|
3009
|
+
let o = !1;
|
|
3010
|
+
this.querySelectorAll("nys-checkbox").forEach((C) => {
|
|
3011
|
+
C.checked && (o = !0);
|
|
3012
|
+
}), o ? (this._internals.setValidity({}), this.showError = !1) : (this._internals.setValidity(
|
|
3013
|
+
{ valueMissing: !0 },
|
|
3014
|
+
t,
|
|
3015
|
+
s || this
|
|
3016
|
+
), this.showError = !0);
|
|
3017
|
+
}
|
|
2983
3018
|
}
|
|
2984
3019
|
// Updates the size of each checkbox in the group
|
|
2985
3020
|
updateCheckboxSize() {
|
|
@@ -2988,7 +3023,7 @@ const _ = (f = class extends U {
|
|
|
2988
3023
|
});
|
|
2989
3024
|
}
|
|
2990
3025
|
render() {
|
|
2991
|
-
return
|
|
3026
|
+
return u` <div
|
|
2992
3027
|
class="nys-checkboxgroup"
|
|
2993
3028
|
aria-required="${this.required ? "true" : "false"}"
|
|
2994
3029
|
role="group"
|
|
@@ -2996,7 +3031,7 @@ const _ = (f = class extends U {
|
|
|
2996
3031
|
<nys-label
|
|
2997
3032
|
label=${this.label}
|
|
2998
3033
|
description=${this.description}
|
|
2999
|
-
flag=${this.required ? "required" : ""}
|
|
3034
|
+
flag=${this.required ? "required" : this.optional ? "optional" : ""}
|
|
3000
3035
|
>
|
|
3001
3036
|
<slot name="description" slot="description">${this.description}</slot>
|
|
3002
3037
|
</nys-label>
|
|
@@ -3010,32 +3045,35 @@ const _ = (f = class extends U {
|
|
|
3010
3045
|
></nys-errormessage>
|
|
3011
3046
|
</div>`;
|
|
3012
3047
|
}
|
|
3013
|
-
},
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
],
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
],
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
],
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
],
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
],
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
],
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
],
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
],
|
|
3038
|
-
|
|
3048
|
+
}, w.VALID_SIZES = ["sm", "md"], w.styles = $5, w.formAssociated = !0, w);
|
|
3049
|
+
m([
|
|
3050
|
+
a({ type: String })
|
|
3051
|
+
], f.prototype, "id", 2);
|
|
3052
|
+
m([
|
|
3053
|
+
a({ type: String, reflect: !0 })
|
|
3054
|
+
], f.prototype, "name", 2);
|
|
3055
|
+
m([
|
|
3056
|
+
a({ type: Boolean, reflect: !0 })
|
|
3057
|
+
], f.prototype, "required", 2);
|
|
3058
|
+
m([
|
|
3059
|
+
a({ type: Boolean, reflect: !0 })
|
|
3060
|
+
], f.prototype, "optional", 2);
|
|
3061
|
+
m([
|
|
3062
|
+
a({ type: Boolean, reflect: !0 })
|
|
3063
|
+
], f.prototype, "showError", 2);
|
|
3064
|
+
m([
|
|
3065
|
+
a({ type: String })
|
|
3066
|
+
], f.prototype, "errorMessage", 2);
|
|
3067
|
+
m([
|
|
3068
|
+
a({ type: String })
|
|
3069
|
+
], f.prototype, "label", 2);
|
|
3070
|
+
m([
|
|
3071
|
+
a({ type: String })
|
|
3072
|
+
], f.prototype, "description", 2);
|
|
3073
|
+
m([
|
|
3074
|
+
a({ reflect: !0 })
|
|
3075
|
+
], f.prototype, "size", 1);
|
|
3076
|
+
let n7 = f;
|
|
3039
3077
|
customElements.get("nys-checkboxgroup") || customElements.define("nys-checkboxgroup", n7);
|
|
3040
3078
|
var l7 = Object.defineProperty, c7 = Object.getOwnPropertyDescriptor, g = (i, t, e, s) => {
|
|
3041
3079
|
for (var o = s > 1 ? void 0 : s ? c7(t, e) : t, r = i.length - 1, C; r >= 0; r--)
|
|
@@ -3043,23 +3081,23 @@ var l7 = Object.defineProperty, c7 = Object.getOwnPropertyDescriptor, g = (i, t,
|
|
|
3043
3081
|
return s && o && l7(t, e, o), o;
|
|
3044
3082
|
};
|
|
3045
3083
|
let a7 = 0;
|
|
3046
|
-
var
|
|
3047
|
-
const
|
|
3084
|
+
var _;
|
|
3085
|
+
const v = (_ = class extends U {
|
|
3048
3086
|
// allows use of elementInternals' API
|
|
3049
3087
|
constructor() {
|
|
3050
|
-
super(), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this.showError = !1, this.errorMessage = "", this._size = "md", this._internals = this.attachInternals();
|
|
3088
|
+
super(), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this.showError = !1, this.errorMessage = "", this.groupExist = !1, this._size = "md", this._internals = this.attachInternals();
|
|
3051
3089
|
}
|
|
3052
3090
|
get size() {
|
|
3053
3091
|
return this._size;
|
|
3054
3092
|
}
|
|
3055
3093
|
set size(t) {
|
|
3056
|
-
this._size =
|
|
3094
|
+
this._size = _.VALID_SIZES.includes(
|
|
3057
3095
|
t
|
|
3058
3096
|
) ? t : "md";
|
|
3059
3097
|
}
|
|
3060
3098
|
async getInputElement() {
|
|
3061
3099
|
var t;
|
|
3062
|
-
return await this.updateComplete, (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
3100
|
+
return await this.updateComplete, ((t = this.shadowRoot) == null ? void 0 : t.querySelector("input")) || null;
|
|
3063
3101
|
}
|
|
3064
3102
|
// Generate a unique ID if one is not provided
|
|
3065
3103
|
connectedCallback() {
|
|
@@ -3077,7 +3115,7 @@ const u = (w = class extends U {
|
|
|
3077
3115
|
}
|
|
3078
3116
|
/********************** Form Integration **********************/
|
|
3079
3117
|
_setValue() {
|
|
3080
|
-
this._internals.setFormValue(this.checked ? this.value : null);
|
|
3118
|
+
this.groupExist || this._internals.setFormValue(this.checked ? this.value : null);
|
|
3081
3119
|
}
|
|
3082
3120
|
_manageRequire() {
|
|
3083
3121
|
var s;
|
|
@@ -3101,16 +3139,36 @@ const u = (w = class extends U {
|
|
|
3101
3139
|
this._setValidityMessage(e);
|
|
3102
3140
|
}
|
|
3103
3141
|
/********************** Functions **********************/
|
|
3104
|
-
|
|
3105
|
-
|
|
3142
|
+
// This helper function is called to perform the element's native validation.
|
|
3143
|
+
checkValidity() {
|
|
3144
|
+
var e;
|
|
3145
|
+
if (this.required && !this.checked)
|
|
3146
|
+
return !1;
|
|
3147
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("input");
|
|
3148
|
+
return t ? t.checkValidity() : !0;
|
|
3149
|
+
}
|
|
3150
|
+
_handleInvalid(t) {
|
|
3151
|
+
var s;
|
|
3152
|
+
t.preventDefault(), this.showError = !0, this._validate();
|
|
3153
|
+
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
|
|
3154
|
+
if (e) {
|
|
3155
|
+
const o = this._internals.form;
|
|
3156
|
+
o ? Array.from(o.elements).find(
|
|
3157
|
+
(n) => typeof n.checkValidity == "function" && !n.checkValidity()
|
|
3158
|
+
) === this && e.focus() : e.focus();
|
|
3159
|
+
}
|
|
3106
3160
|
}
|
|
3107
3161
|
/******************** Event Handlers ********************/
|
|
3108
3162
|
// Handle checkbox change event
|
|
3109
3163
|
_handleChange(t) {
|
|
3110
3164
|
const { checked: e } = t.target;
|
|
3111
|
-
this.checked = e, this._internals.setFormValue(this.checked ? this.value : null), this._validate(), this.dispatchEvent(
|
|
3165
|
+
this.checked = e, this.groupExist || this._internals.setFormValue(this.checked ? this.value : null), this._validate(), this.dispatchEvent(
|
|
3112
3166
|
new CustomEvent("change", {
|
|
3113
|
-
detail: {
|
|
3167
|
+
detail: {
|
|
3168
|
+
checked: this.checked,
|
|
3169
|
+
name: this.name,
|
|
3170
|
+
value: this.value
|
|
3171
|
+
},
|
|
3114
3172
|
bubbles: !0,
|
|
3115
3173
|
composed: !0
|
|
3116
3174
|
})
|
|
@@ -3128,14 +3186,18 @@ const u = (w = class extends U {
|
|
|
3128
3186
|
_handleKeydown(t) {
|
|
3129
3187
|
t.code === "Space" && (t.preventDefault(), this.disabled || (this.checked = !this.checked, this._internals.setFormValue(this.checked ? this.value : null), this._manageRequire(), this.dispatchEvent(
|
|
3130
3188
|
new CustomEvent("change", {
|
|
3131
|
-
detail: {
|
|
3189
|
+
detail: {
|
|
3190
|
+
checked: this.checked,
|
|
3191
|
+
name: this.name,
|
|
3192
|
+
value: this.value
|
|
3193
|
+
},
|
|
3132
3194
|
bubbles: !0,
|
|
3133
3195
|
composed: !0
|
|
3134
3196
|
})
|
|
3135
3197
|
)));
|
|
3136
3198
|
}
|
|
3137
3199
|
render() {
|
|
3138
|
-
return
|
|
3200
|
+
return u`
|
|
3139
3201
|
<div class="nys-checkbox">
|
|
3140
3202
|
<label class="nys-checkbox__content">
|
|
3141
3203
|
<div class="nys-checkbox__checkboxwrapper">
|
|
@@ -3156,23 +3218,22 @@ const u = (w = class extends U {
|
|
|
3156
3218
|
@blur="${this._handleBlur}"
|
|
3157
3219
|
@keydown="${this._handleKeydown}"
|
|
3158
3220
|
/>
|
|
3159
|
-
${this.checked ?
|
|
3221
|
+
${this.checked ? u`<nys-icon
|
|
3160
3222
|
for="${this.id}"
|
|
3161
3223
|
name="check"
|
|
3162
3224
|
size="${this.size === "md" ? "2xl" : this.size === "sm" ? "sm" : "md"}"
|
|
3163
3225
|
class="nys-checkbox__icon"
|
|
3164
3226
|
></nys-icon>` : ""}
|
|
3165
3227
|
</div>
|
|
3166
|
-
${this.label &&
|
|
3228
|
+
${this.label && u` <div class="nys-checkbox__text">
|
|
3167
3229
|
<div class="nys-checkbox__requiredwrapper">
|
|
3168
3230
|
<label for=${this.id} class="nys-checkbox__label"
|
|
3169
3231
|
>${this.label}</label
|
|
3170
3232
|
>
|
|
3171
|
-
${this.required ?
|
|
3233
|
+
${this.required ? u`<label class="nys-checkbox__required">*</label>` : ""}
|
|
3172
3234
|
</div>
|
|
3173
3235
|
<label for=${this.id} class="nys-checkbox__description">
|
|
3174
|
-
|
|
3175
|
-
<slot></slot>
|
|
3236
|
+
<slot name="description">${this.description}</slot>
|
|
3176
3237
|
</label>
|
|
3177
3238
|
</div>`}
|
|
3178
3239
|
</label>
|
|
@@ -3184,43 +3245,47 @@ const u = (w = class extends U {
|
|
|
3184
3245
|
</div>
|
|
3185
3246
|
`;
|
|
3186
3247
|
}
|
|
3187
|
-
},
|
|
3248
|
+
}, _.VALID_SIZES = ["sm", "md"], _.styles = $5, _.formAssociated = !0, _);
|
|
3249
|
+
g([
|
|
3250
|
+
a({ type: Boolean, reflect: !0 })
|
|
3251
|
+
], v.prototype, "checked", 2);
|
|
3188
3252
|
g([
|
|
3189
|
-
|
|
3190
|
-
],
|
|
3253
|
+
a({ type: Boolean, reflect: !0 })
|
|
3254
|
+
], v.prototype, "disabled", 2);
|
|
3191
3255
|
g([
|
|
3192
|
-
|
|
3193
|
-
],
|
|
3256
|
+
a({ type: Boolean, reflect: !0 })
|
|
3257
|
+
], v.prototype, "required", 2);
|
|
3194
3258
|
g([
|
|
3195
|
-
|
|
3196
|
-
],
|
|
3259
|
+
a({ type: String })
|
|
3260
|
+
], v.prototype, "label", 2);
|
|
3197
3261
|
g([
|
|
3198
|
-
|
|
3199
|
-
],
|
|
3262
|
+
a({ type: String })
|
|
3263
|
+
], v.prototype, "description", 2);
|
|
3200
3264
|
g([
|
|
3201
|
-
|
|
3202
|
-
],
|
|
3265
|
+
a({ type: String })
|
|
3266
|
+
], v.prototype, "id", 2);
|
|
3203
3267
|
g([
|
|
3204
|
-
|
|
3205
|
-
],
|
|
3268
|
+
a({ type: String, reflect: !0 })
|
|
3269
|
+
], v.prototype, "name", 2);
|
|
3206
3270
|
g([
|
|
3207
|
-
|
|
3208
|
-
],
|
|
3271
|
+
a({ type: String })
|
|
3272
|
+
], v.prototype, "value", 2);
|
|
3209
3273
|
g([
|
|
3210
|
-
|
|
3211
|
-
],
|
|
3274
|
+
a({ type: Boolean, reflect: !0 })
|
|
3275
|
+
], v.prototype, "showError", 2);
|
|
3212
3276
|
g([
|
|
3213
|
-
|
|
3214
|
-
],
|
|
3277
|
+
a({ type: String })
|
|
3278
|
+
], v.prototype, "errorMessage", 2);
|
|
3215
3279
|
g([
|
|
3216
|
-
|
|
3217
|
-
],
|
|
3280
|
+
a({ type: Boolean })
|
|
3281
|
+
], v.prototype, "groupExist", 2);
|
|
3218
3282
|
g([
|
|
3219
|
-
|
|
3220
|
-
],
|
|
3221
|
-
let h7 =
|
|
3283
|
+
a({ reflect: !0 })
|
|
3284
|
+
], v.prototype, "size", 1);
|
|
3285
|
+
let h7 = v;
|
|
3222
3286
|
customElements.get("nys-checkbox") || customElements.define("nys-checkbox", h7);
|
|
3223
3287
|
export {
|
|
3224
|
-
h7 as NysCheckbox
|
|
3288
|
+
h7 as NysCheckbox,
|
|
3289
|
+
n7 as NysCheckboxgroup
|
|
3225
3290
|
};
|
|
3226
3291
|
//# sourceMappingURL=nys-checkbox.js.map
|