@nysds/nys-checkbox 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nys-checkbox.d.ts +1 -0
- package/dist/nys-checkbox.js +276 -248
- package/dist/nys-checkbox.js.map +1 -1
- package/dist/nys-checkboxgroup.d.ts +4 -1
- package/package.json +7 -6
package/dist/nys-checkbox.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as ue, LitElement as ce, html as S } from "lit";
|
|
2
2
|
/*!
|
|
3
3
|
* ▒█▄░▒█ ▒█░░▒█ ▒█▀▀▀█ ▒█▀▀▄ ▒█▀▀▀█
|
|
4
4
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
@@ -14,10 +14,10 @@ import { css as be, LitElement as ie, html as S } from "lit";
|
|
|
14
14
|
* Copyright 2019 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const I = globalThis, W = I.ShadowRoot && (I.ShadyCSS === void 0 || I.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
17
|
+
const I = globalThis, W = I.ShadowRoot && (I.ShadyCSS === void 0 || I.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ne = Symbol(), K = /* @__PURE__ */ new WeakMap();
|
|
18
18
|
let pe = class {
|
|
19
19
|
constructor(e, t, s) {
|
|
20
|
-
if (this._$cssResult$ = !0, s !==
|
|
20
|
+
if (this._$cssResult$ = !0, s !== ne) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
21
21
|
this.cssText = e, this.t = t;
|
|
22
22
|
}
|
|
23
23
|
get styleSheet() {
|
|
@@ -33,7 +33,7 @@ let pe = class {
|
|
|
33
33
|
return this.cssText;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
const ye = (r) => new pe(typeof r == "string" ? r : r + "", void 0,
|
|
36
|
+
const ye = (r) => new pe(typeof r == "string" ? r : r + "", void 0, ne), _e = (r, e) => {
|
|
37
37
|
if (W) r.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
38
38
|
else for (const t of e) {
|
|
39
39
|
const s = document.createElement("style"), o = I.litNonce;
|
|
@@ -49,10 +49,10 @@ const ye = (r) => new pe(typeof r == "string" ? r : r + "", void 0, ce), ue = (r
|
|
|
49
49
|
* Copyright 2017 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
51
|
*/
|
|
52
|
-
const { is:
|
|
52
|
+
const { is: ke, defineProperty: fe, getOwnPropertyDescriptor: ve, getOwnPropertyNames: xe, getOwnPropertySymbols: ge, getPrototypeOf: me } = Object, $ = globalThis, Y = $.trustedTypes, $e = Y ? Y.emptyScript : "", B = $.reactiveElementPolyfillSupport, q = (r, e) => r, R = { toAttribute(r, e) {
|
|
53
53
|
switch (e) {
|
|
54
54
|
case Boolean:
|
|
55
|
-
r = r ?
|
|
55
|
+
r = r ? $e : null;
|
|
56
56
|
break;
|
|
57
57
|
case Object:
|
|
58
58
|
case Array:
|
|
@@ -77,7 +77,7 @@ const { is: _e, defineProperty: fe, getOwnPropertyDescriptor: ke, getOwnProperty
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
return t;
|
|
80
|
-
} }, Z = (r, e) => !
|
|
80
|
+
} }, Z = (r, e) => !ke(r, e), Q = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: Z };
|
|
81
81
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), $.litPropertyMetadata ?? ($.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
82
82
|
class P extends HTMLElement {
|
|
83
83
|
static addInitializer(e) {
|
|
@@ -93,7 +93,7 @@ class P extends HTMLElement {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
static getPropertyDescriptor(e, t, s) {
|
|
96
|
-
const { get: o, set: c } =
|
|
96
|
+
const { get: o, set: c } = ve(this.prototype, e) ?? { get() {
|
|
97
97
|
return this[t];
|
|
98
98
|
}, set(i) {
|
|
99
99
|
this[t] = i;
|
|
@@ -110,13 +110,13 @@ class P extends HTMLElement {
|
|
|
110
110
|
}
|
|
111
111
|
static _$Ei() {
|
|
112
112
|
if (this.hasOwnProperty(q("elementProperties"))) return;
|
|
113
|
-
const e =
|
|
113
|
+
const e = me(this);
|
|
114
114
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
115
115
|
}
|
|
116
116
|
static finalize() {
|
|
117
117
|
if (this.hasOwnProperty(q("finalized"))) return;
|
|
118
118
|
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(q("properties"))) {
|
|
119
|
-
const t = this.properties, s = [...xe(t), ...
|
|
119
|
+
const t = this.properties, s = [...xe(t), ...ge(t)];
|
|
120
120
|
for (const o of s) this.createProperty(o, t[o]);
|
|
121
121
|
}
|
|
122
122
|
const e = this[Symbol.metadata];
|
|
@@ -165,7 +165,7 @@ class P extends HTMLElement {
|
|
|
165
165
|
}
|
|
166
166
|
createRenderRoot() {
|
|
167
167
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
168
|
-
return
|
|
168
|
+
return _e(e, this.constructor.elementStyles), e;
|
|
169
169
|
}
|
|
170
170
|
connectedCallback() {
|
|
171
171
|
var e;
|
|
@@ -283,7 +283,7 @@ P.elementStyles = [], P.shadowRootOptions = { mode: "open" }, P[q("elementProper
|
|
|
283
283
|
* Copyright 2017 Google LLC
|
|
284
284
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
285
285
|
*/
|
|
286
|
-
const
|
|
286
|
+
const Ae = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged: Z }, Ee = (r = Ae, e, t) => {
|
|
287
287
|
const { kind: s, metadata: o } = t;
|
|
288
288
|
let c = globalThis.litPropertyMetadata.get(o);
|
|
289
289
|
if (c === void 0 && globalThis.litPropertyMetadata.set(o, c = /* @__PURE__ */ new Map()), c.set(t.name, r), s === "accessor") {
|
|
@@ -304,8 +304,8 @@ const $e = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged:
|
|
|
304
304
|
}
|
|
305
305
|
throw Error("Unsupported decorator location: " + s);
|
|
306
306
|
};
|
|
307
|
-
function
|
|
308
|
-
return (e, t) => typeof t == "object" ?
|
|
307
|
+
function a(r) {
|
|
308
|
+
return (e, t) => typeof t == "object" ? Ee(r, e, t) : ((s, o, c) => {
|
|
309
309
|
const i = o.hasOwnProperty(c);
|
|
310
310
|
return o.constructor.createProperty(c, i ? { ...s, wrapped: !0 } : s), i ? Object.getOwnPropertyDescriptor(o, c) : void 0;
|
|
311
311
|
})(r, e, t);
|
|
@@ -315,61 +315,61 @@ function l(r) {
|
|
|
315
315
|
* Copyright 2017 Google LLC
|
|
316
316
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
317
317
|
*/
|
|
318
|
-
function
|
|
319
|
-
return
|
|
318
|
+
function we(r) {
|
|
319
|
+
return a({ ...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 M = globalThis, D = M.trustedTypes, X = D ? D.createPolicy("lit-html", { createHTML: (r) => r }) : void 0,
|
|
326
|
+
const M = globalThis, D = M.trustedTypes, X = D ? D.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, he = "$lit$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, ae = "?" + m, Se = `<${ae}>`, w = document, N = () => w.createComment(""), U = (r) => r === null || typeof r != "object" && typeof r != "function", G = Array.isArray, Ce = (r) => G(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", j = `[
|
|
327
327
|
\f\r]`, z = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ee = /-->/g, te = />/g, A = RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
|
|
328
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), se = /'/g, oe = /"/g,
|
|
329
|
-
function
|
|
328
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), se = /'/g, oe = /"/g, le = /^(?:script|style|textarea|title)$/i, T = Symbol.for("lit-noChange"), b = Symbol.for("lit-nothing"), re = /* @__PURE__ */ new WeakMap(), E = w.createTreeWalker(w, 129);
|
|
329
|
+
function de(r, e) {
|
|
330
330
|
if (!G(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
331
331
|
return X !== void 0 ? X.createHTML(e) : e;
|
|
332
332
|
}
|
|
333
|
-
const
|
|
333
|
+
const Pe = (r, e) => {
|
|
334
334
|
const t = r.length - 1, s = [];
|
|
335
335
|
let o, c = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", i = z;
|
|
336
336
|
for (let h = 0; h < t; h++) {
|
|
337
337
|
const n = r[h];
|
|
338
|
-
let d,
|
|
339
|
-
for (;
|
|
338
|
+
let d, u, l = -1, f = 0;
|
|
339
|
+
for (; f < n.length && (i.lastIndex = f, u = i.exec(n), u !== null); ) f = i.lastIndex, i === z ? u[1] === "!--" ? i = ee : u[1] !== void 0 ? i = te : u[2] !== void 0 ? (le.test(u[2]) && (o = RegExp("</" + u[2], "g")), i = A) : u[3] !== void 0 && (i = A) : i === A ? u[0] === ">" ? (i = o ?? z, l = -1) : u[1] === void 0 ? l = -2 : (l = i.lastIndex - u[2].length, d = u[1], i = u[3] === void 0 ? A : u[3] === '"' ? oe : se) : i === oe || i === se ? i = A : i === ee || i === te ? i = z : (i = A, o = void 0);
|
|
340
340
|
const g = i === A && r[h + 1].startsWith("/>") ? " " : "";
|
|
341
|
-
c += i === z ? n +
|
|
341
|
+
c += i === z ? n + Se : l >= 0 ? (s.push(d), n.slice(0, l) + he + n.slice(l) + m + g) : n + m + (l === -2 ? h : g);
|
|
342
342
|
}
|
|
343
|
-
return [
|
|
343
|
+
return [de(r, c + (r[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
344
344
|
};
|
|
345
345
|
class O {
|
|
346
346
|
constructor({ strings: e, _$litType$: t }, s) {
|
|
347
347
|
let o;
|
|
348
348
|
this.parts = [];
|
|
349
349
|
let c = 0, i = 0;
|
|
350
|
-
const h = e.length - 1, n = this.parts, [d,
|
|
350
|
+
const h = e.length - 1, n = this.parts, [d, u] = Pe(e, t);
|
|
351
351
|
if (this.el = O.createElement(d, s), E.currentNode = this.el.content, t === 2 || t === 3) {
|
|
352
|
-
const
|
|
353
|
-
|
|
352
|
+
const l = this.el.content.firstChild;
|
|
353
|
+
l.replaceWith(...l.childNodes);
|
|
354
354
|
}
|
|
355
355
|
for (; (o = E.nextNode()) !== null && n.length < h; ) {
|
|
356
356
|
if (o.nodeType === 1) {
|
|
357
|
-
if (o.hasAttributes()) for (const
|
|
358
|
-
const
|
|
359
|
-
n.push({ type: 1, index: c, name: H[2], strings: g, ctor: H[1] === "." ?
|
|
360
|
-
} else
|
|
361
|
-
if (
|
|
362
|
-
const
|
|
363
|
-
if (
|
|
357
|
+
if (o.hasAttributes()) for (const l of o.getAttributeNames()) if (l.endsWith(he)) {
|
|
358
|
+
const f = u[i++], g = o.getAttribute(l).split(m), H = /([.?@])?(.*)/.exec(f);
|
|
359
|
+
n.push({ type: 1, index: c, name: H[2], strings: g, ctor: H[1] === "." ? qe : H[1] === "?" ? Me : H[1] === "@" ? Ue : L }), o.removeAttribute(l);
|
|
360
|
+
} else l.startsWith(m) && (n.push({ type: 6, index: c }), o.removeAttribute(l));
|
|
361
|
+
if (le.test(o.tagName)) {
|
|
362
|
+
const l = o.textContent.split(m), f = l.length - 1;
|
|
363
|
+
if (f > 0) {
|
|
364
364
|
o.textContent = D ? D.emptyScript : "";
|
|
365
|
-
for (let g = 0; g <
|
|
366
|
-
o.append(
|
|
365
|
+
for (let g = 0; g < f; g++) o.append(l[g], N()), E.nextNode(), n.push({ type: 2, index: ++c });
|
|
366
|
+
o.append(l[f], N());
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
} else if (o.nodeType === 8) if (o.data ===
|
|
369
|
+
} else if (o.nodeType === 8) if (o.data === ae) n.push({ type: 2, index: c });
|
|
370
370
|
else {
|
|
371
|
-
let
|
|
372
|
-
for (; (
|
|
371
|
+
let l = -1;
|
|
372
|
+
for (; (l = o.data.indexOf(m, l + 1)) !== -1; ) n.push({ type: 7, index: c }), l += m.length - 1;
|
|
373
373
|
}
|
|
374
374
|
c++;
|
|
375
375
|
}
|
|
@@ -386,7 +386,7 @@ function C(r, e, t = r, s) {
|
|
|
386
386
|
const c = U(e) ? void 0 : e._$litDirective$;
|
|
387
387
|
return (o == null ? void 0 : o.constructor) !== c && ((h = o == null ? void 0 : o._$AO) == null || h.call(o, !1), c === void 0 ? o = void 0 : (o = new c(r), o._$AT(r, t, s)), s !== void 0 ? (t._$Co ?? (t._$Co = []))[s] = o : t._$Cl = o), o !== void 0 && (e = C(r, o._$AS(r, e.values), o, s)), e;
|
|
388
388
|
}
|
|
389
|
-
class
|
|
389
|
+
class ze {
|
|
390
390
|
constructor(e, t) {
|
|
391
391
|
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
392
392
|
}
|
|
@@ -403,7 +403,7 @@ class Pe {
|
|
|
403
403
|
for (; n !== void 0; ) {
|
|
404
404
|
if (i === n.index) {
|
|
405
405
|
let d;
|
|
406
|
-
n.type === 2 ? d = new V(c, c.nextSibling, this, e) : n.type === 1 ? d = new n.ctor(c, n.name, n.strings, this, e) : n.type === 6 && (d = new
|
|
406
|
+
n.type === 2 ? d = new V(c, c.nextSibling, this, e) : n.type === 1 ? d = new n.ctor(c, n.name, n.strings, this, e) : n.type === 6 && (d = new Te(c, this, e)), this._$AV.push(d), n = s[++h];
|
|
407
407
|
}
|
|
408
408
|
i !== (n == null ? void 0 : n.index) && (c = E.nextNode(), i++);
|
|
409
409
|
}
|
|
@@ -434,7 +434,7 @@ class V {
|
|
|
434
434
|
return this._$AB;
|
|
435
435
|
}
|
|
436
436
|
_$AI(e, t = this) {
|
|
437
|
-
e = C(this, e, t), U(e) ? e === b || e == null || e === "" ? (this._$AH !== b && this._$AR(), this._$AH = b) : e !== this._$AH && e !== T && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) :
|
|
437
|
+
e = C(this, e, t), U(e) ? e === b || e == null || e === "" ? (this._$AH !== b && this._$AR(), this._$AH = b) : e !== this._$AH && e !== T && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ce(e) ? this.k(e) : this._(e);
|
|
438
438
|
}
|
|
439
439
|
O(e) {
|
|
440
440
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -447,10 +447,10 @@ class V {
|
|
|
447
447
|
}
|
|
448
448
|
$(e) {
|
|
449
449
|
var c;
|
|
450
|
-
const { values: t, _$litType$: s } = e, o = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = O.createElement(
|
|
450
|
+
const { values: t, _$litType$: s } = e, o = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = O.createElement(de(s.h, s.h[0]), this.options)), s);
|
|
451
451
|
if (((c = this._$AH) == null ? void 0 : c._$AD) === o) this._$AH.p(t);
|
|
452
452
|
else {
|
|
453
|
-
const i = new
|
|
453
|
+
const i = new ze(o, this), h = i.u(this.options);
|
|
454
454
|
i.p(t), this.T(h), this._$AH = i;
|
|
455
455
|
}
|
|
456
456
|
}
|
|
@@ -502,7 +502,7 @@ class L {
|
|
|
502
502
|
e === b ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
class
|
|
505
|
+
class qe extends L {
|
|
506
506
|
constructor() {
|
|
507
507
|
super(...arguments), this.type = 3;
|
|
508
508
|
}
|
|
@@ -510,7 +510,7 @@ class ze extends L {
|
|
|
510
510
|
this.element[this.name] = e === b ? void 0 : e;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
class
|
|
513
|
+
class Me extends L {
|
|
514
514
|
constructor() {
|
|
515
515
|
super(...arguments), this.type = 4;
|
|
516
516
|
}
|
|
@@ -518,7 +518,7 @@ class qe extends L {
|
|
|
518
518
|
this.element.toggleAttribute(this.name, !!e && e !== b);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
class
|
|
521
|
+
class Ue extends L {
|
|
522
522
|
constructor(e, t, s, o, c) {
|
|
523
523
|
super(e, t, s, o, c), this.type = 5;
|
|
524
524
|
}
|
|
@@ -532,7 +532,7 @@ class Me extends L {
|
|
|
532
532
|
typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
|
-
class
|
|
535
|
+
class Te {
|
|
536
536
|
constructor(e, t, s) {
|
|
537
537
|
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
538
538
|
}
|
|
@@ -550,16 +550,16 @@ F == null || F(O, V), (M.litHtmlVersions ?? (M.litHtmlVersions = [])).push("3.2.
|
|
|
550
550
|
* Copyright 2018 Google LLC
|
|
551
551
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
552
|
*/
|
|
553
|
-
const
|
|
553
|
+
const ie = (r) => r ?? b, be = ue`
|
|
554
554
|
:host {
|
|
555
555
|
/* Anything that can be overridden should be defined here */
|
|
556
556
|
|
|
557
557
|
/* Global Checkbox Styles */
|
|
558
558
|
--_nys-checkbox-size: var(--nys-size-400, 32px);
|
|
559
|
-
--_nys-checkbox-radius: var(--nys-radius-md, 4px);
|
|
560
|
-
--_nys-checkbox-width
|
|
561
|
-
--_nys-checkbox-color
|
|
562
|
-
--_nys-checkbox-width
|
|
559
|
+
--_nys-checkbox-border-radius: var(--nys-radius-md, 4px);
|
|
560
|
+
--_nys-checkbox-border-width: var(--nys-border-width-md, 2px);
|
|
561
|
+
--_nys-checkbox-outline-color: var(--nys-color-focus, #004dd1);
|
|
562
|
+
--_nys-checkbox-outline-width: var(--nys-border-width-md, 2px);
|
|
563
563
|
--_nys-checkbox-outline-offset: var(--nys-space-2px, 2px);
|
|
564
564
|
/* space between checkbox and it's label */
|
|
565
565
|
--_nys-checkbox-gap: var(--nys-space-150, 12px);
|
|
@@ -579,8 +579,7 @@ const Te = (r) => r ?? b, de = be`
|
|
|
579
579
|
)
|
|
580
580
|
);
|
|
581
581
|
--_nys-checkbox-font-size: var(--nys-font-size-ui-md, 16px);
|
|
582
|
-
--_nys-checkbox-font-weight
|
|
583
|
-
--_nys-checkbox-font-weight-600: var(--nys-font-weight-semibold, 600);
|
|
582
|
+
--_nys-checkbox-font-weight: var(--nys-font-weight-regular, 400);
|
|
584
583
|
--_nys-checkbox-line-height: var(--nys-font-lineheight-ui-md, 24px);
|
|
585
584
|
|
|
586
585
|
/* Global Checkbox Colors */
|
|
@@ -588,57 +587,59 @@ const Te = (r) => r ?? b, de = be`
|
|
|
588
587
|
--nys-color-ink,
|
|
589
588
|
var(--nys-color-neutral-900, #1b1b1b)
|
|
590
589
|
);
|
|
591
|
-
--_nys-checkbox-required-color: var(
|
|
592
|
-
--nys-color-danger,
|
|
593
|
-
var(--nys-color-red-600, #b52c2c)
|
|
594
|
-
);
|
|
595
590
|
|
|
596
591
|
/* Default (Empty) */
|
|
597
|
-
--_nys-checkbox-color
|
|
598
|
-
--_nys-checkbox-color
|
|
592
|
+
--_nys-checkbox-background-color: var(--nys-color-ink-reverse, #ffffff);
|
|
593
|
+
--_nys-checkbox-border-color: var(--nys-color-neutral-600, #62666a);
|
|
599
594
|
/* Empty + Hovered */
|
|
600
|
-
--_nys-checkbox-
|
|
601
|
-
|
|
595
|
+
--_nys-checkbox-background-color--hover: var(
|
|
596
|
+
--nys-color-neutral-50,
|
|
597
|
+
#ededed
|
|
598
|
+
);
|
|
599
|
+
--_nys-checkbox-border-color--hover: var(--nys-color-ink, #1b1b1b);
|
|
602
600
|
/* Empty + Pressed */
|
|
603
|
-
--_nys-checkbox-
|
|
604
|
-
|
|
601
|
+
--_nys-checkbox-background-color--active: var(
|
|
602
|
+
--nys-color-neutral-100,
|
|
603
|
+
#d0d0ce
|
|
604
|
+
);
|
|
605
|
+
--_nys-checkbox-border-color--active: var(--nys-color-ink, #1b1b1b);
|
|
605
606
|
/* Checked */
|
|
606
|
-
--_nys-checkbox-
|
|
607
|
-
--_nys-checkbox-
|
|
607
|
+
--_nys-checkbox-background-color--checked: var(--nys-color-theme, #154973);
|
|
608
|
+
--_nys-checkbox-border-color--checked: var(--nys-color-theme, #154973);
|
|
608
609
|
/* Checked + Hovered */
|
|
609
|
-
--_nys-checkbox-checked
|
|
610
|
+
--_nys-checkbox-background-color--checked--hover: var(
|
|
610
611
|
--nys-color-theme-strong,
|
|
611
612
|
#0e324f
|
|
612
613
|
);
|
|
613
|
-
--_nys-checkbox-checked
|
|
614
|
+
--_nys-checkbox-border-color--checked--hover: var(
|
|
614
615
|
--nys-color-theme-strong,
|
|
615
616
|
#0e324f
|
|
616
617
|
);
|
|
617
618
|
/* Checked + Pressed */
|
|
618
|
-
--_nys-checkbox-
|
|
619
|
+
--_nys-checkbox-background-color--checked--active: var(
|
|
619
620
|
--nys-color-theme-stronger,
|
|
620
621
|
#081b2b
|
|
621
622
|
);
|
|
622
|
-
--_nys-checkbox-
|
|
623
|
+
--_nys-checkbox-border-color--checked--active: var(
|
|
623
624
|
--nys-color-theme-stronger,
|
|
624
625
|
#081b2b
|
|
625
626
|
);
|
|
626
627
|
/* Disabled */
|
|
627
|
-
--_nys-checkbox-
|
|
628
|
-
|
|
628
|
+
--_nys-checkbox-background-color--disabled: var(
|
|
629
|
+
--nys-color-ink-reverse,
|
|
630
|
+
#f0f0f0
|
|
631
|
+
);
|
|
632
|
+
--_nys-checkbox-border-color--disabled: var(
|
|
629
633
|
--nys-color-neutral-400,
|
|
630
634
|
#757575
|
|
631
635
|
);
|
|
632
|
-
--_nys-checkbox-disabled-color-text
|
|
633
|
-
--nys-color-text-disabled,
|
|
634
|
-
#bec0c1
|
|
635
|
-
);
|
|
636
|
+
--_nys-checkbox-color--disabled: var(--nys-color-text-disabled, #bec0c1);
|
|
636
637
|
/* Disabled Checked */
|
|
637
|
-
--_nys-checkbox-
|
|
638
|
+
--_nys-checkbox-background-color--checked--disabled: var(
|
|
638
639
|
--nys-color-neutral-100,
|
|
639
640
|
#d0d0ce
|
|
640
641
|
);
|
|
641
|
-
--_nys-checkbox-
|
|
642
|
+
--_nys-checkbox-border-color--checked--disabled: var(
|
|
642
643
|
--nys-color-neutral-100,
|
|
643
644
|
#d0d0ce
|
|
644
645
|
);
|
|
@@ -647,70 +648,81 @@ const Te = (r) => r ?? b, de = be`
|
|
|
647
648
|
/* Small Variant */
|
|
648
649
|
:host([size="sm"]) {
|
|
649
650
|
--_nys-checkbox-size: var(--nys-size-300, 24px);
|
|
650
|
-
--_nys-checkbox-radius: var(--nys-radius-sm, 2px);
|
|
651
|
+
--_nys-checkbox-border-radius: var(--nys-radius-sm, 2px);
|
|
651
652
|
--_nys-checkboxgroup-gap: var(--nys-space-100, 8px);
|
|
652
653
|
--_nys-checkbox-gap: var(--nys-space-100, 8px);
|
|
653
654
|
}
|
|
654
655
|
/* Medium Variant */
|
|
655
656
|
:host([size="md"]) {
|
|
656
657
|
--_nys-checkbox-size: var(--nys-size-400, 32px);
|
|
657
|
-
--_nys-checkbox-radius: var(--nys-radius-md, 4px);
|
|
658
|
+
--_nys-checkbox-border-radius: var(--nys-radius-md, 4px);
|
|
658
659
|
}
|
|
659
660
|
|
|
660
661
|
/* Tile Variant */
|
|
661
662
|
:host([tile]) {
|
|
662
|
-
--_nys-checkbox-
|
|
663
|
-
--_nys-checkbox-
|
|
664
|
-
--_nys-checkbox-
|
|
665
|
-
--_nys-checkbox-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
663
|
+
--_nys-checkbox-border-width--tile: var(--nys-border-width-sm, 1px);
|
|
664
|
+
--_nys-checkbox-border-radius--tile: var(--nys-radius-md, 4px);
|
|
665
|
+
--_nys-checkbox-border-color--tile: var(--nys-color-neutral-100, #d0d0ce);
|
|
666
|
+
--_nys-checkbox-background-color--tile: var(
|
|
667
|
+
--nys-color-ink-reverse,
|
|
668
|
+
#ffffff
|
|
669
|
+
);
|
|
670
|
+
--_nys-checkbox-padding--x--tile: var(--nys-space-250, 20px);
|
|
671
|
+
--_nys-checkbox-padding--y--tile: var(--nys-space-200, 16px);
|
|
669
672
|
/* Hover */
|
|
670
|
-
--_nys-checkbox-
|
|
673
|
+
--_nys-checkbox-border-color--tile--hover: var(
|
|
671
674
|
--nys-color-neutral-700,
|
|
672
675
|
#4a4d4f
|
|
673
676
|
);
|
|
674
|
-
--_nys-checkbox-
|
|
677
|
+
--_nys-checkbox-background-color--tile--hover: var(
|
|
678
|
+
--nys-color-ink-reverse,
|
|
679
|
+
#ffffff
|
|
680
|
+
);
|
|
675
681
|
/* Pressed */
|
|
676
|
-
--_nys-checkbox-
|
|
682
|
+
--_nys-checkbox-border-color--tile--active: var(
|
|
677
683
|
--nys-color-neutral-900,
|
|
678
684
|
#1b1b1b
|
|
679
685
|
);
|
|
680
|
-
--_nys-checkbox-
|
|
686
|
+
--_nys-checkbox-background-color--tile--active: var(
|
|
681
687
|
--nys-color-ink-reverse,
|
|
682
688
|
#ffffff
|
|
683
689
|
);
|
|
684
690
|
/* Checked */
|
|
685
|
-
--_nys-checkbox-
|
|
691
|
+
--_nys-checkbox-border-color--tile--checked: var(
|
|
686
692
|
--nys-color-theme-mid,
|
|
687
693
|
#457aa5
|
|
688
694
|
);
|
|
689
|
-
--_nys-checkbox-
|
|
695
|
+
--_nys-checkbox-background-color--tile--checked: var(
|
|
690
696
|
--nys-color-theme-faint,
|
|
691
697
|
#f7fafd
|
|
692
698
|
);
|
|
693
699
|
/* Disabled */
|
|
694
|
-
--_nys-checkbox-
|
|
700
|
+
--_nys-checkbox-background-color--tile--disabled: var(
|
|
695
701
|
--nys-color-ink-reverse,
|
|
696
702
|
#f0f0f0
|
|
697
703
|
);
|
|
698
|
-
--_nys-checkbox-
|
|
704
|
+
--_nys-checkbox-border-color--tile--disabled: var(
|
|
699
705
|
--nys-color-neutral-100,
|
|
700
706
|
#d0d0ce
|
|
701
707
|
);
|
|
702
708
|
}
|
|
703
709
|
|
|
704
710
|
:host([tile][size="sm"]) {
|
|
705
|
-
--_nys-checkbox-
|
|
706
|
-
--_nys-checkbox-
|
|
711
|
+
--_nys-checkbox-padding--x--tile: var(--nys-space-200, 16px);
|
|
712
|
+
--_nys-checkbox-padding--y--tile: var(--nys-space-150, 12px);
|
|
707
713
|
}
|
|
708
714
|
|
|
709
715
|
:host([tile][showError]) {
|
|
710
|
-
--_nys-checkbox-
|
|
711
|
-
--_nys-checkbox-
|
|
712
|
-
--_nys-checkbox-
|
|
713
|
-
|
|
716
|
+
--_nys-checkbox-border-color--tile: var(--nys-color-danger, #b52c2c);
|
|
717
|
+
--_nys-checkbox-border-color--tile--hover: var(--nys-color-danger, #b52c2c);
|
|
718
|
+
--_nys-checkbox-border-color--tile--active: var(
|
|
719
|
+
--nys-color-danger,
|
|
720
|
+
#b52c2c
|
|
721
|
+
);
|
|
722
|
+
--_nys-checkbox-border-color--tile--checked: var(
|
|
723
|
+
--nys-color-danger,
|
|
724
|
+
#b52c2c
|
|
725
|
+
);
|
|
714
726
|
}
|
|
715
727
|
|
|
716
728
|
#single-error-message {
|
|
@@ -739,12 +751,12 @@ const Te = (r) => r ?? b, de = be`
|
|
|
739
751
|
line-height: var(--_nys-checkbox-line-height);
|
|
740
752
|
|
|
741
753
|
/* Tile */
|
|
742
|
-
border-radius: var(--_nys-checkbox-
|
|
743
|
-
border: var(--_nys-checkbox-
|
|
744
|
-
var(--_nys-checkbox-
|
|
745
|
-
background: var(--_nys-checkbox-
|
|
746
|
-
padding: var(--_nys-checkbox-
|
|
747
|
-
var(--_nys-checkbox-
|
|
754
|
+
border-radius: var(--_nys-checkbox-border-radius--tile);
|
|
755
|
+
border: var(--_nys-checkbox-border-width--tile) solid
|
|
756
|
+
var(--_nys-checkbox-border-color--tile);
|
|
757
|
+
background: var(--_nys-checkbox-background-color--tile);
|
|
758
|
+
padding: var(--_nys-checkbox-padding--y--tile)
|
|
759
|
+
var(--_nys-checkbox-padding--x--tile);
|
|
748
760
|
gap: var(--_nys-checkbox-gap);
|
|
749
761
|
}
|
|
750
762
|
|
|
@@ -776,10 +788,10 @@ const Te = (r) => r ?? b, de = be`
|
|
|
776
788
|
height: var(--_nys-checkbox-size);
|
|
777
789
|
max-width: var(--_nys-checkbox-size);
|
|
778
790
|
max-height: var(--_nys-checkbox-size);
|
|
779
|
-
border: solid var(--_nys-checkbox-width
|
|
780
|
-
var(--_nys-checkbox-color
|
|
781
|
-
background-color: var(--_nys-checkbox-color
|
|
782
|
-
border-radius: var(--_nys-checkbox-radius);
|
|
791
|
+
border: solid var(--_nys-checkbox-border-width)
|
|
792
|
+
var(--_nys-checkbox-border-color);
|
|
793
|
+
background-color: var(--_nys-checkbox-background-color);
|
|
794
|
+
border-radius: var(--_nys-checkbox-border-radius);
|
|
783
795
|
outline-offset: var(--_nys-checkbox-outline-offset);
|
|
784
796
|
outline: none;
|
|
785
797
|
}
|
|
@@ -792,99 +804,99 @@ const Te = (r) => r ?? b, de = be`
|
|
|
792
804
|
|
|
793
805
|
/* Checked */
|
|
794
806
|
.nys-checkbox__checkbox:not(:disabled):checked {
|
|
795
|
-
background-color: var(--_nys-checkbox-
|
|
796
|
-
border-color: var(--_nys-checkbox-
|
|
807
|
+
background-color: var(--_nys-checkbox-background-color--checked);
|
|
808
|
+
border-color: var(--_nys-checkbox-border-color--checked);
|
|
797
809
|
}
|
|
798
810
|
:host([tile])
|
|
799
811
|
.nys-checkbox:has(.nys-checkbox__checkbox:not(:disabled):checked) {
|
|
800
|
-
border-color: var(--_nys-checkbox-
|
|
801
|
-
background-color: var(--_nys-checkbox-
|
|
812
|
+
border-color: var(--_nys-checkbox-border-color--tile--checked);
|
|
813
|
+
background-color: var(--_nys-checkbox-background-color--tile--checked);
|
|
802
814
|
}
|
|
803
815
|
|
|
804
816
|
/* Checked + Disabled */
|
|
805
817
|
.nys-checkbox__checkbox:disabled:checked {
|
|
806
|
-
background-color: var(--_nys-checkbox-
|
|
807
|
-
border-color: var(--_nys-checkbox-
|
|
818
|
+
background-color: var(--_nys-checkbox-background-color--checked--disabled);
|
|
819
|
+
border-color: var(--_nys-checkbox-border-color--checked--disabled);
|
|
808
820
|
}
|
|
809
821
|
:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:disabled:checked) {
|
|
810
|
-
border-color: var(--_nys-checkbox-
|
|
811
|
-
background-color: var(--_nys-checkbox-
|
|
822
|
+
border-color: var(--_nys-checkbox-border-color--tile--disabled);
|
|
823
|
+
background-color: var(--_nys-checkbox-background-color--tile--disabled);
|
|
812
824
|
}
|
|
813
825
|
|
|
814
826
|
/* Disabled */
|
|
815
827
|
.nys-checkbox__checkbox:disabled {
|
|
816
|
-
background-color: var(--_nys-checkbox-
|
|
817
|
-
border-color: var(--_nys-checkbox-
|
|
828
|
+
background-color: var(--_nys-checkbox-background-color--disabled);
|
|
829
|
+
border-color: var(--_nys-checkbox-border-color--disabled);
|
|
818
830
|
cursor: not-allowed;
|
|
819
831
|
}
|
|
820
832
|
.nys-checkbox__content:has(.nys-checkbox__checkbox:disabled)
|
|
821
833
|
.nys-checkbox__text
|
|
822
834
|
* {
|
|
823
|
-
color: var(--_nys-checkbox-disabled
|
|
835
|
+
color: var(--_nys-checkbox-color--disabled);
|
|
824
836
|
cursor: not-allowed;
|
|
825
837
|
}
|
|
826
838
|
:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:disabled) {
|
|
827
|
-
background-color: var(--_nys-checkbox-
|
|
828
|
-
border-color: var(--_nys-checkbox-
|
|
839
|
+
background-color: var(--_nys-checkbox-background-color--disabled);
|
|
840
|
+
border-color: var(--_nys-checkbox-border-color--disabled);
|
|
829
841
|
cursor: not-allowed;
|
|
830
842
|
}
|
|
831
843
|
|
|
832
844
|
/* Hover - not checked */
|
|
833
845
|
.nys-checkbox__checkbox:hover:not(:disabled):not(:checked) {
|
|
834
|
-
background-color: var(--_nys-checkbox-
|
|
835
|
-
border-color: var(--_nys-checkbox-
|
|
846
|
+
background-color: var(--_nys-checkbox-background-color--hover);
|
|
847
|
+
border-color: var(--_nys-checkbox-border-color--hover);
|
|
836
848
|
}
|
|
837
849
|
:host([tile])
|
|
838
850
|
.nys-checkbox:hover:has(
|
|
839
851
|
.nys-checkbox__checkbox:not(:disabled):not(:checked)
|
|
840
852
|
) {
|
|
841
|
-
border-color: var(--_nys-checkbox-
|
|
842
|
-
background-color: var(--_nys-checkbox-
|
|
843
|
-
outline: solid var(--_nys-checkbox-
|
|
844
|
-
var(--_nys-checkbox-
|
|
853
|
+
border-color: var(--_nys-checkbox-border-color--tile--hover);
|
|
854
|
+
background-color: var(--_nys-checkbox-background-color--tile--hover);
|
|
855
|
+
outline: solid var(--_nys-checkbox-border-width--tile)
|
|
856
|
+
var(--_nys-checkbox-border-color--tile--hover);
|
|
845
857
|
}
|
|
846
858
|
|
|
847
859
|
/* Hover + Checked */
|
|
848
860
|
.nys-checkbox__checkbox:hover:not(:disabled):checked {
|
|
849
|
-
border-color: var(--_nys-checkbox-checked
|
|
850
|
-
background-color: var(--_nys-checkbox-checked
|
|
861
|
+
border-color: var(--_nys-checkbox-border-color--checked--hover);
|
|
862
|
+
background-color: var(--_nys-checkbox-background-color--checked--hover);
|
|
851
863
|
}
|
|
852
864
|
:host([tile])
|
|
853
865
|
.nys-checkbox:hover:has(.nys-checkbox__checkbox:not(:disabled):checked) {
|
|
854
|
-
outline: solid var(--_nys-checkbox-
|
|
855
|
-
var(--_nys-checkbox-
|
|
866
|
+
outline: solid var(--_nys-checkbox-border-width--tile)
|
|
867
|
+
var(--_nys-checkbox-border-color--tile--checked);
|
|
856
868
|
}
|
|
857
869
|
|
|
858
870
|
/* Pressed - not checked */
|
|
859
871
|
.nys-checkbox__checkbox:active:not(:disabled):not(:checked) {
|
|
860
|
-
background-color: var(--_nys-checkbox-
|
|
861
|
-
border-color: var(--_nys-checkbox-
|
|
872
|
+
background-color: var(--_nys-checkbox-background-color--active);
|
|
873
|
+
border-color: var(--_nys-checkbox-border-color--active);
|
|
862
874
|
}
|
|
863
875
|
:host([tile])
|
|
864
876
|
.nys-checkbox:has(
|
|
865
877
|
.nys-checkbox__checkbox:active:not(:disabled):not(:checked)
|
|
866
878
|
) {
|
|
867
|
-
border-color: var(--_nys-checkbox-
|
|
868
|
-
background-color: var(--_nys-checkbox-
|
|
869
|
-
outline: solid var(--_nys-checkbox-
|
|
870
|
-
var(--_nys-checkbox-
|
|
879
|
+
border-color: var(--_nys-checkbox-border-color--tile--active);
|
|
880
|
+
background-color: var(--_nys-checkbox-background-color--tile--active);
|
|
881
|
+
outline: solid var(--_nys-checkbox-border-width--tile)
|
|
882
|
+
var(--_nys-checkbox-border-color--tile--active);
|
|
871
883
|
}
|
|
872
884
|
|
|
873
885
|
/* Pressed + Checked */
|
|
874
886
|
.nys-checkbox__checkbox:active:not(:disabled):checked {
|
|
875
|
-
border-color: var(--_nys-checkbox-
|
|
876
|
-
background-color: var(--_nys-checkbox-
|
|
887
|
+
border-color: var(--_nys-checkbox-border-color--checked--active);
|
|
888
|
+
background-color: var(--_nys-checkbox-background-color--checked--active);
|
|
877
889
|
}
|
|
878
890
|
|
|
879
891
|
/* Focused */
|
|
880
892
|
:host(:not([tile])) .nys-checkbox__checkbox:focus {
|
|
881
|
-
outline: solid var(--_nys-checkbox-width
|
|
882
|
-
var(--_nys-checkbox-color
|
|
893
|
+
outline: solid var(--_nys-checkbox-outline-width)
|
|
894
|
+
var(--_nys-checkbox-outline-color);
|
|
883
895
|
}
|
|
884
896
|
:host([tile]) .nys-checkbox:has(*:focus) {
|
|
885
|
-
outline: solid var(--_nys-checkbox-
|
|
886
|
-
var(--_nys-checkbox-color
|
|
887
|
-
border-color: var(--_nys-checkbox-color
|
|
897
|
+
outline: solid var(--_nys-checkbox-border-width--tile)
|
|
898
|
+
var(--_nys-checkbox-outline-color) !important;
|
|
899
|
+
border-color: var(--_nys-checkbox-outline-color) !important;
|
|
888
900
|
}
|
|
889
901
|
|
|
890
902
|
/* Checkbox Label Holder */
|
|
@@ -897,20 +909,20 @@ const Te = (r) => r ?? b, de = be`
|
|
|
897
909
|
|
|
898
910
|
/* Label styling */
|
|
899
911
|
.nys-checkbox__label {
|
|
900
|
-
font-weight: var(--_nys-checkbox-font-weight
|
|
912
|
+
font-weight: var(--_nys-checkbox-font-weight);
|
|
901
913
|
color: var(--nys-color-text, #1b1b1b);
|
|
902
914
|
}
|
|
903
915
|
|
|
904
916
|
/* Description styling */
|
|
905
917
|
.nys-checkbox__description {
|
|
906
|
-
font-weight: var(--_nys-checkbox-font-weight
|
|
918
|
+
font-weight: var(--_nys-checkbox-font-weight);
|
|
907
919
|
font-style: italic;
|
|
908
920
|
text-align: left;
|
|
909
921
|
}
|
|
910
922
|
|
|
911
923
|
/* Required */
|
|
912
924
|
.nys-checkbox__required {
|
|
913
|
-
color: var(--
|
|
925
|
+
color: var(--nys-color-danger, #b52c2c);
|
|
914
926
|
}
|
|
915
927
|
|
|
916
928
|
.nys-checkbox__requiredwrapper {
|
|
@@ -934,23 +946,23 @@ const Te = (r) => r ?? b, de = be`
|
|
|
934
946
|
border: 0;
|
|
935
947
|
}
|
|
936
948
|
`;
|
|
937
|
-
var Oe = Object.defineProperty, He = Object.getOwnPropertyDescriptor,
|
|
949
|
+
var Oe = Object.defineProperty, He = Object.getOwnPropertyDescriptor, k = (r, e, t, s) => {
|
|
938
950
|
for (var o = s > 1 ? void 0 : s ? He(e, t) : e, c = r.length - 1, i; c >= 0; c--)
|
|
939
951
|
(i = r[c]) && (o = (s ? i(e, t, o) : i(o)) || o);
|
|
940
952
|
return s && o && Oe(e, t, o), o;
|
|
941
953
|
};
|
|
942
954
|
let Ie = 0;
|
|
943
|
-
var
|
|
944
|
-
const
|
|
955
|
+
var v;
|
|
956
|
+
const y = (v = class extends ce {
|
|
945
957
|
// allows use of elementInternals' API
|
|
946
958
|
constructor() {
|
|
947
|
-
super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this.tile = !1, this._slottedDescriptionText = "", this._size = "md", this._internals = this.attachInternals();
|
|
959
|
+
super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this.tile = !1, this._tooltip = "", this.form = null, this._slottedDescriptionText = "", this._size = "md", this._internals = this.attachInternals();
|
|
948
960
|
}
|
|
949
961
|
get size() {
|
|
950
962
|
return this._size;
|
|
951
963
|
}
|
|
952
964
|
set size(e) {
|
|
953
|
-
this._size =
|
|
965
|
+
this._size = v.VALID_SIZES.includes(
|
|
954
966
|
e
|
|
955
967
|
) ? e : "md";
|
|
956
968
|
}
|
|
@@ -965,7 +977,7 @@ const _ = (x = class extends ie {
|
|
|
965
977
|
this._setGroupExist(), this._updateCheckboxSize(), this._updateCheckboxTile(), this._updateCheckboxShowError(), this._getSlotDescriptionForAria();
|
|
966
978
|
}
|
|
967
979
|
updated(e) {
|
|
968
|
-
e.has("required") && this.required && this._setupCheckboxRequired(), e.has("size") && this._updateCheckboxSize(), e.has("tile") && this._updateCheckboxTile(), e.has("showError") && this._updateCheckboxShowError();
|
|
980
|
+
e.has("required") && this.required && this._setupCheckboxRequired(), e.has("size") && this._updateCheckboxSize(), e.has("tile") && this._updateCheckboxTile(), e.has("showError") && this._updateCheckboxShowError(), e.has("form") && this._updateCheckboxForm();
|
|
969
981
|
}
|
|
970
982
|
/********************** Functions **********************/
|
|
971
983
|
_setGroupExist() {
|
|
@@ -983,13 +995,12 @@ const _ = (x = class extends ie {
|
|
|
983
995
|
);
|
|
984
996
|
}
|
|
985
997
|
// Updates the required attribute of each checkbox in the group
|
|
986
|
-
async
|
|
998
|
+
async _manageRequire() {
|
|
987
999
|
if (this.required) {
|
|
988
|
-
const e = this.errorMessage || "Please select at least one option.", t = this.querySelector("nys-checkbox"), s = t ? await t.getInputElement() : null;
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}), o ? (this._internals.setValidity({}), this.showError = !1) : (this._internals.setValidity(
|
|
1000
|
+
const e = this.errorMessage || "Please select at least one option.", t = this.querySelector("nys-checkbox"), s = t ? await t.getInputElement().catch(() => null) : null, o = this.querySelectorAll("nys-checkbox");
|
|
1001
|
+
Array.from(o).some(
|
|
1002
|
+
(i) => i.checked
|
|
1003
|
+
) ? (this._internals.setValidity({}), this.showError = !1) : (this._internals.setValidity(
|
|
993
1004
|
{ valueMissing: !0 },
|
|
994
1005
|
e,
|
|
995
1006
|
s || this
|
|
@@ -1012,6 +1023,11 @@ const _ = (x = class extends ie {
|
|
|
1012
1023
|
this.showError ? t.setAttribute("showError", "") : t.removeAttribute("showError");
|
|
1013
1024
|
});
|
|
1014
1025
|
}
|
|
1026
|
+
_updateCheckboxForm() {
|
|
1027
|
+
this.querySelectorAll("nys-checkbox").forEach((t) => {
|
|
1028
|
+
this.showError && this.form !== null ? t.setAttribute("form", this.form) : t.removeAttribute("form");
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1015
1031
|
// Get the slotted text contents so native VO can attempt to announce it within the legend in the fieldset
|
|
1016
1032
|
_getSlotDescriptionForAria() {
|
|
1017
1033
|
var s;
|
|
@@ -1024,7 +1040,7 @@ const _ = (x = class extends ie {
|
|
|
1024
1040
|
}).filter(Boolean).join(", ");
|
|
1025
1041
|
}
|
|
1026
1042
|
async _handleInvalid(e) {
|
|
1027
|
-
e.preventDefault(), this.showError = !0, this.
|
|
1043
|
+
e.preventDefault(), this.showError = !0, this._manageRequire();
|
|
1028
1044
|
const t = this.querySelector("nys-checkbox"), s = t ? await t.getInputElement() : null;
|
|
1029
1045
|
if (s) {
|
|
1030
1046
|
const o = this._internals.form;
|
|
@@ -1033,7 +1049,7 @@ const _ = (x = class extends ie {
|
|
|
1033
1049
|
if (Array.from(
|
|
1034
1050
|
this.querySelectorAll("nys-checkbox")
|
|
1035
1051
|
).filter(
|
|
1036
|
-
(
|
|
1052
|
+
(u) => u.checked
|
|
1037
1053
|
).length === 0)
|
|
1038
1054
|
return h;
|
|
1039
1055
|
} else
|
|
@@ -1045,7 +1061,7 @@ const _ = (x = class extends ie {
|
|
|
1045
1061
|
// Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.
|
|
1046
1062
|
_handleCheckboxChange(e) {
|
|
1047
1063
|
const t = e, { name: s } = t.detail, c = Array.from(this.querySelectorAll("nys-checkbox")).filter((i) => i.checked).map((i) => i.value);
|
|
1048
|
-
this.name = s, this._internals.setFormValue(c.join(", ")), this.
|
|
1064
|
+
this.name = s, this._internals.setFormValue(c.join(", ")), this._manageRequire();
|
|
1049
1065
|
}
|
|
1050
1066
|
render() {
|
|
1051
1067
|
return S`
|
|
@@ -1055,6 +1071,7 @@ const _ = (x = class extends ie {
|
|
|
1055
1071
|
label=${this.label}
|
|
1056
1072
|
description=${this.description}
|
|
1057
1073
|
flag=${this.required ? "required" : this.optional ? "optional" : ""}
|
|
1074
|
+
tooltip=${this._tooltip}
|
|
1058
1075
|
>
|
|
1059
1076
|
<slot name="description" slot="description">${this.description}</slot>
|
|
1060
1077
|
</nys-label>
|
|
@@ -1074,59 +1091,65 @@ const _ = (x = class extends ie {
|
|
|
1074
1091
|
</div>
|
|
1075
1092
|
`;
|
|
1076
1093
|
}
|
|
1077
|
-
},
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
],
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
],
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
],
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
],
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
],
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
],
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
],
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
],
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
],
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
],
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
],
|
|
1111
|
-
|
|
1094
|
+
}, v.VALID_SIZES = ["sm", "md"], v.styles = be, v.formAssociated = !0, v);
|
|
1095
|
+
k([
|
|
1096
|
+
a({ type: String })
|
|
1097
|
+
], y.prototype, "id", 2);
|
|
1098
|
+
k([
|
|
1099
|
+
a({ type: String, reflect: !0 })
|
|
1100
|
+
], y.prototype, "name", 2);
|
|
1101
|
+
k([
|
|
1102
|
+
a({ type: Boolean, reflect: !0 })
|
|
1103
|
+
], y.prototype, "required", 2);
|
|
1104
|
+
k([
|
|
1105
|
+
a({ type: Boolean, reflect: !0 })
|
|
1106
|
+
], y.prototype, "optional", 2);
|
|
1107
|
+
k([
|
|
1108
|
+
a({ type: Boolean, reflect: !0 })
|
|
1109
|
+
], y.prototype, "showError", 2);
|
|
1110
|
+
k([
|
|
1111
|
+
a({ type: String })
|
|
1112
|
+
], y.prototype, "errorMessage", 2);
|
|
1113
|
+
k([
|
|
1114
|
+
a({ type: String })
|
|
1115
|
+
], y.prototype, "label", 2);
|
|
1116
|
+
k([
|
|
1117
|
+
a({ type: String })
|
|
1118
|
+
], y.prototype, "description", 2);
|
|
1119
|
+
k([
|
|
1120
|
+
a({ type: Boolean, reflect: !0 })
|
|
1121
|
+
], y.prototype, "tile", 2);
|
|
1122
|
+
k([
|
|
1123
|
+
a({ type: String })
|
|
1124
|
+
], y.prototype, "_tooltip", 2);
|
|
1125
|
+
k([
|
|
1126
|
+
a({ type: String, reflect: !0 })
|
|
1127
|
+
], y.prototype, "form", 2);
|
|
1128
|
+
k([
|
|
1129
|
+
we()
|
|
1130
|
+
], y.prototype, "_slottedDescriptionText", 2);
|
|
1131
|
+
k([
|
|
1132
|
+
a({ reflect: !0 })
|
|
1133
|
+
], y.prototype, "size", 1);
|
|
1134
|
+
let Re = y;
|
|
1112
1135
|
customElements.get("nys-checkboxgroup") || customElements.define("nys-checkboxgroup", Re);
|
|
1113
|
-
var De = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor,
|
|
1136
|
+
var De = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, _ = (r, e, t, s) => {
|
|
1114
1137
|
for (var o = s > 1 ? void 0 : s ? Ne(e, t) : e, c = r.length - 1, i; c >= 0; c--)
|
|
1115
1138
|
(i = r[c]) && (o = (s ? i(e, t, o) : i(o)) || o);
|
|
1116
1139
|
return s && o && De(e, t, o), o;
|
|
1117
1140
|
};
|
|
1118
1141
|
let Ve = 0;
|
|
1119
|
-
var
|
|
1120
|
-
const
|
|
1142
|
+
var x;
|
|
1143
|
+
const p = (x = class extends ce {
|
|
1121
1144
|
// allows use of elementInternals' API
|
|
1122
1145
|
constructor() {
|
|
1123
|
-
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.tile = !1, this._size = "md", this._internals = this.attachInternals();
|
|
1146
|
+
super(), this.checked = !1, this.disabled = !1, this.required = !1, this.label = "", this.description = "", this.id = "", this.name = "", this.value = "", this.form = null, this.showError = !1, this.errorMessage = "", this.groupExist = !1, this.tile = !1, this._size = "md", this._internals = this.attachInternals();
|
|
1124
1147
|
}
|
|
1125
1148
|
get size() {
|
|
1126
1149
|
return this._size;
|
|
1127
1150
|
}
|
|
1128
1151
|
set size(e) {
|
|
1129
|
-
this._size =
|
|
1152
|
+
this._size = x.VALID_SIZES.includes(
|
|
1130
1153
|
e
|
|
1131
1154
|
) ? e : "md";
|
|
1132
1155
|
}
|
|
@@ -1199,6 +1222,7 @@ const y = (v = class extends ie {
|
|
|
1199
1222
|
this.dispatchEvent(
|
|
1200
1223
|
new CustomEvent("nys-change", {
|
|
1201
1224
|
detail: {
|
|
1225
|
+
id: this.id,
|
|
1202
1226
|
checked: this.checked,
|
|
1203
1227
|
name: this.name,
|
|
1204
1228
|
value: this.value
|
|
@@ -1234,11 +1258,12 @@ const y = (v = class extends ie {
|
|
|
1234
1258
|
id="${this.id}"
|
|
1235
1259
|
class="nys-checkbox__checkbox"
|
|
1236
1260
|
type="checkbox"
|
|
1237
|
-
name="${
|
|
1261
|
+
name="${ie(this.name ? this.name : void 0)}"
|
|
1238
1262
|
.checked=${this.checked}
|
|
1239
1263
|
?disabled=${this.disabled}
|
|
1240
1264
|
.value=${this.value}
|
|
1241
1265
|
?required="${this.required}"
|
|
1266
|
+
form=${ie(this.form || void 0)}
|
|
1242
1267
|
aria-checked="${this.checked}"
|
|
1243
1268
|
aria-disabled="${this.disabled ? "true" : "false"}"
|
|
1244
1269
|
aria-required="${this.required}"
|
|
@@ -1273,47 +1298,50 @@ const y = (v = class extends ie {
|
|
|
1273
1298
|
></nys-errormessage>` : ""}
|
|
1274
1299
|
`;
|
|
1275
1300
|
}
|
|
1276
|
-
},
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
],
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
],
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
],
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
],
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
],
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
],
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
],
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
],
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
],
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
],
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
],
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
],
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
],
|
|
1316
|
-
|
|
1301
|
+
}, x.VALID_SIZES = ["sm", "md"], x.styles = be, x.formAssociated = !0, x);
|
|
1302
|
+
_([
|
|
1303
|
+
a({ type: Boolean, reflect: !0 })
|
|
1304
|
+
], p.prototype, "checked", 2);
|
|
1305
|
+
_([
|
|
1306
|
+
a({ type: Boolean, reflect: !0 })
|
|
1307
|
+
], p.prototype, "disabled", 2);
|
|
1308
|
+
_([
|
|
1309
|
+
a({ type: Boolean, reflect: !0 })
|
|
1310
|
+
], p.prototype, "required", 2);
|
|
1311
|
+
_([
|
|
1312
|
+
a({ type: String })
|
|
1313
|
+
], p.prototype, "label", 2);
|
|
1314
|
+
_([
|
|
1315
|
+
a({ type: String })
|
|
1316
|
+
], p.prototype, "description", 2);
|
|
1317
|
+
_([
|
|
1318
|
+
a({ type: String })
|
|
1319
|
+
], p.prototype, "id", 2);
|
|
1320
|
+
_([
|
|
1321
|
+
a({ type: String, reflect: !0 })
|
|
1322
|
+
], p.prototype, "name", 2);
|
|
1323
|
+
_([
|
|
1324
|
+
a({ type: String })
|
|
1325
|
+
], p.prototype, "value", 2);
|
|
1326
|
+
_([
|
|
1327
|
+
a({ type: String, reflect: !0 })
|
|
1328
|
+
], p.prototype, "form", 2);
|
|
1329
|
+
_([
|
|
1330
|
+
a({ type: Boolean, reflect: !0 })
|
|
1331
|
+
], p.prototype, "showError", 2);
|
|
1332
|
+
_([
|
|
1333
|
+
a({ type: String })
|
|
1334
|
+
], p.prototype, "errorMessage", 2);
|
|
1335
|
+
_([
|
|
1336
|
+
a({ type: Boolean })
|
|
1337
|
+
], p.prototype, "groupExist", 2);
|
|
1338
|
+
_([
|
|
1339
|
+
a({ type: Boolean, reflect: !0 })
|
|
1340
|
+
], p.prototype, "tile", 2);
|
|
1341
|
+
_([
|
|
1342
|
+
a({ reflect: !0 })
|
|
1343
|
+
], p.prototype, "size", 1);
|
|
1344
|
+
let Le = p;
|
|
1317
1345
|
customElements.get("nys-checkbox") || customElements.define("nys-checkbox", Le);
|
|
1318
1346
|
export {
|
|
1319
1347
|
Le as NysCheckbox,
|