@nysds/nys-checkbox 1.1.7 → 1.1.9
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 +384 -256
- package/dist/nys-checkbox.js.map +1 -1
- package/dist/nys-checkboxgroup.d.ts +3 -0
- package/package.json +12 -9
package/dist/nys-checkbox.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as be, LitElement as ie, html as S } from "lit";
|
|
2
2
|
import "@nysds/nys-icon";
|
|
3
3
|
import "@nysds/nys-label";
|
|
4
4
|
import "@nysds/nys-errormessage";
|
|
@@ -17,10 +17,10 @@ import "@nysds/nys-errormessage";
|
|
|
17
17
|
* Copyright 2019 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
19
|
*/
|
|
20
|
-
const R = globalThis, W = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
|
|
20
|
+
const R = globalThis, W = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ce = Symbol(), K = /* @__PURE__ */ new WeakMap();
|
|
21
21
|
let pe = class {
|
|
22
22
|
constructor(e, t, s) {
|
|
23
|
-
if (this._$cssResult$ = !0, s !==
|
|
23
|
+
if (this._$cssResult$ = !0, s !== ce) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
24
24
|
this.cssText = e, this.t = t;
|
|
25
25
|
}
|
|
26
26
|
get styleSheet() {
|
|
@@ -36,53 +36,53 @@ let pe = class {
|
|
|
36
36
|
return this.cssText;
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
const
|
|
40
|
-
if (W)
|
|
39
|
+
const ue = (i) => new pe(typeof i == "string" ? i : i + "", void 0, ce), ye = (i, e) => {
|
|
40
|
+
if (W) i.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
41
41
|
else for (const t of e) {
|
|
42
|
-
const s = document.createElement("style"),
|
|
43
|
-
|
|
42
|
+
const s = document.createElement("style"), o = R.litNonce;
|
|
43
|
+
o !== void 0 && s.setAttribute("nonce", o), s.textContent = t.cssText, i.appendChild(s);
|
|
44
44
|
}
|
|
45
|
-
}, J = W ? (
|
|
45
|
+
}, J = W ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((e) => {
|
|
46
46
|
let t = "";
|
|
47
47
|
for (const s of e.cssRules) t += s.cssText;
|
|
48
|
-
return
|
|
49
|
-
})(
|
|
48
|
+
return ue(t);
|
|
49
|
+
})(i) : i;
|
|
50
50
|
/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright 2017 Google LLC
|
|
53
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
54
|
*/
|
|
55
|
-
const { is: _e, defineProperty: fe, getOwnPropertyDescriptor:
|
|
55
|
+
const { is: _e, defineProperty: fe, getOwnPropertyDescriptor: ke, getOwnPropertyNames: xe, getOwnPropertySymbols: ve, getPrototypeOf: ge } = Object, $ = globalThis, Q = $.trustedTypes, me = Q ? Q.emptyScript : "", B = $.reactiveElementPolyfillSupport, q = (i, e) => i, T = { toAttribute(i, e) {
|
|
56
56
|
switch (e) {
|
|
57
57
|
case Boolean:
|
|
58
|
-
|
|
58
|
+
i = i ? me : null;
|
|
59
59
|
break;
|
|
60
60
|
case Object:
|
|
61
61
|
case Array:
|
|
62
|
-
|
|
62
|
+
i = i == null ? i : JSON.stringify(i);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
65
|
-
}, fromAttribute(
|
|
66
|
-
let t =
|
|
64
|
+
return i;
|
|
65
|
+
}, fromAttribute(i, e) {
|
|
66
|
+
let t = i;
|
|
67
67
|
switch (e) {
|
|
68
68
|
case Boolean:
|
|
69
|
-
t =
|
|
69
|
+
t = i !== null;
|
|
70
70
|
break;
|
|
71
71
|
case Number:
|
|
72
|
-
t =
|
|
72
|
+
t = i === null ? null : Number(i);
|
|
73
73
|
break;
|
|
74
74
|
case Object:
|
|
75
75
|
case Array:
|
|
76
76
|
try {
|
|
77
|
-
t = JSON.parse(
|
|
77
|
+
t = JSON.parse(i);
|
|
78
78
|
} catch {
|
|
79
79
|
t = null;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
return t;
|
|
83
|
-
} }, Z = (
|
|
83
|
+
} }, Z = (i, e) => !_e(i, e), X = { attribute: !0, type: String, converter: T, reflect: !1, hasChanged: Z };
|
|
84
84
|
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), $.litPropertyMetadata ?? ($.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
85
|
-
class
|
|
85
|
+
class P extends HTMLElement {
|
|
86
86
|
static addInitializer(e) {
|
|
87
87
|
this._$Ei(), (this.l ?? (this.l = [])).push(e);
|
|
88
88
|
}
|
|
@@ -91,46 +91,46 @@ class C extends HTMLElement {
|
|
|
91
91
|
}
|
|
92
92
|
static createProperty(e, t = X) {
|
|
93
93
|
if (t.state && (t.attribute = !1), this._$Ei(), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
94
|
-
const s = Symbol(),
|
|
95
|
-
|
|
94
|
+
const s = Symbol(), o = this.getPropertyDescriptor(e, s, t);
|
|
95
|
+
o !== void 0 && fe(this.prototype, e, o);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
static getPropertyDescriptor(e, t, s) {
|
|
99
|
-
const { get:
|
|
99
|
+
const { get: o, set: c } = ke(this.prototype, e) ?? { get() {
|
|
100
100
|
return this[t];
|
|
101
|
-
}, set(
|
|
102
|
-
this[t] =
|
|
101
|
+
}, set(r) {
|
|
102
|
+
this[t] = r;
|
|
103
103
|
} };
|
|
104
104
|
return { get() {
|
|
105
|
-
return
|
|
106
|
-
}, set(
|
|
107
|
-
const h =
|
|
108
|
-
|
|
105
|
+
return o == null ? void 0 : o.call(this);
|
|
106
|
+
}, set(r) {
|
|
107
|
+
const h = o == null ? void 0 : o.call(this);
|
|
108
|
+
c.call(this, r), this.requestUpdate(e, h, s);
|
|
109
109
|
}, configurable: !0, enumerable: !0 };
|
|
110
110
|
}
|
|
111
111
|
static getPropertyOptions(e) {
|
|
112
112
|
return this.elementProperties.get(e) ?? X;
|
|
113
113
|
}
|
|
114
114
|
static _$Ei() {
|
|
115
|
-
if (this.hasOwnProperty(
|
|
116
|
-
const e =
|
|
115
|
+
if (this.hasOwnProperty(q("elementProperties"))) return;
|
|
116
|
+
const e = ge(this);
|
|
117
117
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
118
118
|
}
|
|
119
119
|
static finalize() {
|
|
120
|
-
if (this.hasOwnProperty(
|
|
121
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
122
|
-
const t = this.properties, s = [...xe(t), ...
|
|
123
|
-
for (const
|
|
120
|
+
if (this.hasOwnProperty(q("finalized"))) return;
|
|
121
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(q("properties"))) {
|
|
122
|
+
const t = this.properties, s = [...xe(t), ...ve(t)];
|
|
123
|
+
for (const o of s) this.createProperty(o, t[o]);
|
|
124
124
|
}
|
|
125
125
|
const e = this[Symbol.metadata];
|
|
126
126
|
if (e !== null) {
|
|
127
127
|
const t = litPropertyMetadata.get(e);
|
|
128
|
-
if (t !== void 0) for (const [s,
|
|
128
|
+
if (t !== void 0) for (const [s, o] of t) this.elementProperties.set(s, o);
|
|
129
129
|
}
|
|
130
130
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
131
131
|
for (const [t, s] of this.elementProperties) {
|
|
132
|
-
const
|
|
133
|
-
|
|
132
|
+
const o = this._$Eu(t, s);
|
|
133
|
+
o !== void 0 && this._$Eh.set(o, t);
|
|
134
134
|
}
|
|
135
135
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
136
136
|
}
|
|
@@ -138,7 +138,7 @@ class C extends HTMLElement {
|
|
|
138
138
|
const t = [];
|
|
139
139
|
if (Array.isArray(e)) {
|
|
140
140
|
const s = new Set(e.flat(1 / 0).reverse());
|
|
141
|
-
for (const
|
|
141
|
+
for (const o of s) t.unshift(J(o));
|
|
142
142
|
} else e !== void 0 && t.push(J(e));
|
|
143
143
|
return t;
|
|
144
144
|
}
|
|
@@ -168,7 +168,7 @@ class C extends HTMLElement {
|
|
|
168
168
|
}
|
|
169
169
|
createRenderRoot() {
|
|
170
170
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
171
|
-
return
|
|
171
|
+
return ye(e, this.constructor.elementStyles), e;
|
|
172
172
|
}
|
|
173
173
|
connectedCallback() {
|
|
174
174
|
var e;
|
|
@@ -190,19 +190,19 @@ class C extends HTMLElement {
|
|
|
190
190
|
this._$AK(e, s);
|
|
191
191
|
}
|
|
192
192
|
_$EC(e, t) {
|
|
193
|
-
var
|
|
194
|
-
const s = this.constructor.elementProperties.get(e),
|
|
195
|
-
if (
|
|
196
|
-
const
|
|
197
|
-
this._$Em = e,
|
|
193
|
+
var c;
|
|
194
|
+
const s = this.constructor.elementProperties.get(e), o = this.constructor._$Eu(e, s);
|
|
195
|
+
if (o !== void 0 && s.reflect === !0) {
|
|
196
|
+
const r = (((c = s.converter) == null ? void 0 : c.toAttribute) !== void 0 ? s.converter : T).toAttribute(t, s.type);
|
|
197
|
+
this._$Em = e, r == null ? this.removeAttribute(o) : this.setAttribute(o, r), this._$Em = null;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
_$AK(e, t) {
|
|
201
|
-
var
|
|
202
|
-
const s = this.constructor,
|
|
203
|
-
if (
|
|
204
|
-
const
|
|
205
|
-
this._$Em =
|
|
201
|
+
var c;
|
|
202
|
+
const s = this.constructor, o = s._$Eh.get(e);
|
|
203
|
+
if (o !== void 0 && this._$Em !== o) {
|
|
204
|
+
const r = s.getPropertyOptions(o), h = typeof r.converter == "function" ? { fromAttribute: r.converter } : ((c = r.converter) == null ? void 0 : c.fromAttribute) !== void 0 ? r.converter : T;
|
|
205
|
+
this._$Em = o, this[o] = h.fromAttribute(t, r.type), this._$Em = null;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
requestUpdate(e, t, s) {
|
|
@@ -233,21 +233,21 @@ class C extends HTMLElement {
|
|
|
233
233
|
if (!this.isUpdatePending) return;
|
|
234
234
|
if (!this.hasUpdated) {
|
|
235
235
|
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
236
|
-
for (const [
|
|
236
|
+
for (const [c, r] of this._$Ep) this[c] = r;
|
|
237
237
|
this._$Ep = void 0;
|
|
238
238
|
}
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
239
|
+
const o = this.constructor.elementProperties;
|
|
240
|
+
if (o.size > 0) for (const [c, r] of o) r.wrapped !== !0 || this._$AL.has(c) || this[c] === void 0 || this.P(c, this[c], r);
|
|
241
241
|
}
|
|
242
242
|
let e = !1;
|
|
243
243
|
const t = this._$AL;
|
|
244
244
|
try {
|
|
245
|
-
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (s = this._$EO) == null || s.forEach((
|
|
246
|
-
var
|
|
247
|
-
return (
|
|
245
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (s = this._$EO) == null || s.forEach((o) => {
|
|
246
|
+
var c;
|
|
247
|
+
return (c = o.hostUpdate) == null ? void 0 : c.call(o);
|
|
248
248
|
}), this.update(t)) : this._$EU();
|
|
249
|
-
} catch (
|
|
250
|
-
throw e = !1, this._$EU(),
|
|
249
|
+
} catch (o) {
|
|
250
|
+
throw e = !1, this._$EU(), o;
|
|
251
251
|
}
|
|
252
252
|
e && this._$AE(t);
|
|
253
253
|
}
|
|
@@ -256,8 +256,8 @@ class C extends HTMLElement {
|
|
|
256
256
|
_$AE(e) {
|
|
257
257
|
var t;
|
|
258
258
|
(t = this._$EO) == null || t.forEach((s) => {
|
|
259
|
-
var
|
|
260
|
-
return (
|
|
259
|
+
var o;
|
|
260
|
+
return (o = s.hostUpdated) == null ? void 0 : o.call(s);
|
|
261
261
|
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
262
262
|
}
|
|
263
263
|
_$EU() {
|
|
@@ -280,93 +280,93 @@ class C extends HTMLElement {
|
|
|
280
280
|
firstUpdated(e) {
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
P.elementStyles = [], P.shadowRootOptions = { mode: "open" }, P[q("elementProperties")] = /* @__PURE__ */ new Map(), P[q("finalized")] = /* @__PURE__ */ new Map(), B == null || B({ ReactiveElement: P }), ($.reactiveElementVersions ?? ($.reactiveElementVersions = [])).push("2.0.4");
|
|
284
284
|
/**
|
|
285
285
|
* @license
|
|
286
286
|
* Copyright 2017 Google LLC
|
|
287
287
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
288
288
|
*/
|
|
289
|
-
const $e = { attribute: !0, type: String, converter: T, reflect: !1, hasChanged: Z }, Ae = (
|
|
290
|
-
const { kind: s, metadata:
|
|
291
|
-
let
|
|
292
|
-
if (
|
|
293
|
-
const { name:
|
|
289
|
+
const $e = { attribute: !0, type: String, converter: T, reflect: !1, hasChanged: Z }, Ae = (i = $e, e, t) => {
|
|
290
|
+
const { kind: s, metadata: o } = t;
|
|
291
|
+
let c = globalThis.litPropertyMetadata.get(o);
|
|
292
|
+
if (c === void 0 && globalThis.litPropertyMetadata.set(o, c = /* @__PURE__ */ new Map()), c.set(t.name, i), s === "accessor") {
|
|
293
|
+
const { name: r } = t;
|
|
294
294
|
return { set(h) {
|
|
295
|
-
const
|
|
296
|
-
e.set.call(this, h), this.requestUpdate(
|
|
295
|
+
const n = e.get.call(this);
|
|
296
|
+
e.set.call(this, h), this.requestUpdate(r, n, i);
|
|
297
297
|
}, init(h) {
|
|
298
|
-
return h !== void 0 && this.P(
|
|
298
|
+
return h !== void 0 && this.P(r, void 0, i), h;
|
|
299
299
|
} };
|
|
300
300
|
}
|
|
301
301
|
if (s === "setter") {
|
|
302
|
-
const { name:
|
|
302
|
+
const { name: r } = t;
|
|
303
303
|
return function(h) {
|
|
304
|
-
const
|
|
305
|
-
e.call(this, h), this.requestUpdate(
|
|
304
|
+
const n = this[r];
|
|
305
|
+
e.call(this, h), this.requestUpdate(r, n, i);
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
308
|
throw Error("Unsupported decorator location: " + s);
|
|
309
309
|
};
|
|
310
|
-
function l(
|
|
311
|
-
return (e, t) => typeof t == "object" ? Ae(
|
|
312
|
-
const
|
|
313
|
-
return
|
|
314
|
-
})(
|
|
310
|
+
function l(i) {
|
|
311
|
+
return (e, t) => typeof t == "object" ? Ae(i, e, t) : ((s, o, c) => {
|
|
312
|
+
const r = o.hasOwnProperty(c);
|
|
313
|
+
return o.constructor.createProperty(c, r ? { ...s, wrapped: !0 } : s), r ? Object.getOwnPropertyDescriptor(o, c) : void 0;
|
|
314
|
+
})(i, e, t);
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
317
317
|
* @license
|
|
318
318
|
* Copyright 2017 Google LLC
|
|
319
319
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
320
320
|
*/
|
|
321
|
-
const M = globalThis, N = M.trustedTypes, Y = N ? N.createPolicy("lit-html", { createHTML: (
|
|
322
|
-
\f\r]`,
|
|
323
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), se = /'/g,
|
|
324
|
-
function le(
|
|
325
|
-
if (!G(
|
|
321
|
+
const M = globalThis, N = M.trustedTypes, Y = N ? N.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, ne = "$lit$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, he = "?" + m, Ee = `<${he}>`, w = document, V = () => w.createComment(""), U = (i) => i === null || typeof i != "object" && typeof i != "function", G = Array.isArray, we = (i) => G(i) || typeof (i == null ? void 0 : i[Symbol.iterator]) == "function", j = `[
|
|
322
|
+
\f\r]`, z = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ee = /-->/g, te = />/g, A = RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
|
|
323
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), se = /'/g, oe = /"/g, ae = /^(?:script|style|textarea|title)$/i, H = Symbol.for("lit-noChange"), b = Symbol.for("lit-nothing"), re = /* @__PURE__ */ new WeakMap(), E = w.createTreeWalker(w, 129);
|
|
324
|
+
function le(i, e) {
|
|
325
|
+
if (!G(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
326
326
|
return Y !== void 0 ? Y.createHTML(e) : e;
|
|
327
327
|
}
|
|
328
|
-
const Se = (
|
|
329
|
-
const t =
|
|
330
|
-
let
|
|
328
|
+
const Se = (i, e) => {
|
|
329
|
+
const t = i.length - 1, s = [];
|
|
330
|
+
let o, c = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = z;
|
|
331
331
|
for (let h = 0; h < t; h++) {
|
|
332
|
-
const
|
|
333
|
-
let d, p, a = -1,
|
|
334
|
-
for (;
|
|
335
|
-
const
|
|
336
|
-
|
|
332
|
+
const n = i[h];
|
|
333
|
+
let d, p, a = -1, k = 0;
|
|
334
|
+
for (; k < n.length && (r.lastIndex = k, p = r.exec(n), p !== null); ) k = r.lastIndex, r === z ? p[1] === "!--" ? r = ee : p[1] !== void 0 ? r = te : p[2] !== void 0 ? (ae.test(p[2]) && (o = RegExp("</" + p[2], "g")), r = A) : p[3] !== void 0 && (r = A) : r === A ? p[0] === ">" ? (r = o ?? z, a = -1) : p[1] === void 0 ? a = -2 : (a = r.lastIndex - p[2].length, d = p[1], r = p[3] === void 0 ? A : p[3] === '"' ? oe : se) : r === oe || r === se ? r = A : r === ee || r === te ? r = z : (r = A, o = void 0);
|
|
335
|
+
const g = r === A && i[h + 1].startsWith("/>") ? " " : "";
|
|
336
|
+
c += r === z ? n + Ee : a >= 0 ? (s.push(d), n.slice(0, a) + ne + n.slice(a) + m + g) : n + m + (a === -2 ? h : g);
|
|
337
337
|
}
|
|
338
|
-
return [le(
|
|
338
|
+
return [le(i, c + (i[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
339
339
|
};
|
|
340
|
-
class
|
|
340
|
+
class O {
|
|
341
341
|
constructor({ strings: e, _$litType$: t }, s) {
|
|
342
|
-
let
|
|
342
|
+
let o;
|
|
343
343
|
this.parts = [];
|
|
344
|
-
let
|
|
345
|
-
const h = e.length - 1,
|
|
346
|
-
if (this.el =
|
|
344
|
+
let c = 0, r = 0;
|
|
345
|
+
const h = e.length - 1, n = this.parts, [d, p] = Se(e, t);
|
|
346
|
+
if (this.el = O.createElement(d, s), E.currentNode = this.el.content, t === 2 || t === 3) {
|
|
347
347
|
const a = this.el.content.firstChild;
|
|
348
348
|
a.replaceWith(...a.childNodes);
|
|
349
349
|
}
|
|
350
|
-
for (; (
|
|
351
|
-
if (
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
} else a.startsWith(m) && (
|
|
356
|
-
if (ae.test(
|
|
357
|
-
const a =
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
for (let
|
|
361
|
-
|
|
350
|
+
for (; (o = E.nextNode()) !== null && n.length < h; ) {
|
|
351
|
+
if (o.nodeType === 1) {
|
|
352
|
+
if (o.hasAttributes()) for (const a of o.getAttributeNames()) if (a.endsWith(ne)) {
|
|
353
|
+
const k = p[r++], g = o.getAttribute(a).split(m), I = /([.?@])?(.*)/.exec(k);
|
|
354
|
+
n.push({ type: 1, index: c, name: I[2], strings: g, ctor: I[1] === "." ? Pe : I[1] === "?" ? ze : I[1] === "@" ? qe : L }), o.removeAttribute(a);
|
|
355
|
+
} else a.startsWith(m) && (n.push({ type: 6, index: c }), o.removeAttribute(a));
|
|
356
|
+
if (ae.test(o.tagName)) {
|
|
357
|
+
const a = o.textContent.split(m), k = a.length - 1;
|
|
358
|
+
if (k > 0) {
|
|
359
|
+
o.textContent = N ? N.emptyScript : "";
|
|
360
|
+
for (let g = 0; g < k; g++) o.append(a[g], V()), E.nextNode(), n.push({ type: 2, index: ++c });
|
|
361
|
+
o.append(a[k], V());
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
} else if (
|
|
364
|
+
} else if (o.nodeType === 8) if (o.data === he) n.push({ type: 2, index: c });
|
|
365
365
|
else {
|
|
366
366
|
let a = -1;
|
|
367
|
-
for (; (a =
|
|
367
|
+
for (; (a = o.data.indexOf(m, a + 1)) !== -1; ) n.push({ type: 7, index: c }), a += m.length - 1;
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
c++;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
static createElement(e, t) {
|
|
@@ -374,12 +374,12 @@ class H {
|
|
|
374
374
|
return s.innerHTML = e, s;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
function
|
|
378
|
-
var
|
|
379
|
-
if (e ===
|
|
380
|
-
let
|
|
381
|
-
const
|
|
382
|
-
return (
|
|
377
|
+
function C(i, e, t = i, s) {
|
|
378
|
+
var r, h;
|
|
379
|
+
if (e === H) return e;
|
|
380
|
+
let o = s !== void 0 ? (r = t._$Co) == null ? void 0 : r[s] : t._$Cl;
|
|
381
|
+
const c = U(e) ? void 0 : e._$litDirective$;
|
|
382
|
+
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(i), o._$AT(i, t, s)), s !== void 0 ? (t._$Co ?? (t._$Co = []))[s] = o : t._$Cl = o), o !== void 0 && (e = C(i, o._$AS(i, e.values), o, s)), e;
|
|
383
383
|
}
|
|
384
384
|
class Ce {
|
|
385
385
|
constructor(e, t) {
|
|
@@ -392,17 +392,17 @@ class Ce {
|
|
|
392
392
|
return this._$AM._$AU;
|
|
393
393
|
}
|
|
394
394
|
u(e) {
|
|
395
|
-
const { el: { content: t }, parts: s } = this._$AD,
|
|
396
|
-
E.currentNode =
|
|
397
|
-
let
|
|
398
|
-
for (;
|
|
399
|
-
if (
|
|
395
|
+
const { el: { content: t }, parts: s } = this._$AD, o = ((e == null ? void 0 : e.creationScope) ?? w).importNode(t, !0);
|
|
396
|
+
E.currentNode = o;
|
|
397
|
+
let c = E.nextNode(), r = 0, h = 0, n = s[0];
|
|
398
|
+
for (; n !== void 0; ) {
|
|
399
|
+
if (r === n.index) {
|
|
400
400
|
let d;
|
|
401
|
-
|
|
401
|
+
n.type === 2 ? d = new D(c, c.nextSibling, this, e) : n.type === 1 ? d = new n.ctor(c, n.name, n.strings, this, e) : n.type === 6 && (d = new Me(c, this, e)), this._$AV.push(d), n = s[++h];
|
|
402
402
|
}
|
|
403
|
-
|
|
403
|
+
r !== (n == null ? void 0 : n.index) && (c = E.nextNode(), r++);
|
|
404
404
|
}
|
|
405
|
-
return E.currentNode = w,
|
|
405
|
+
return E.currentNode = w, o;
|
|
406
406
|
}
|
|
407
407
|
p(e) {
|
|
408
408
|
let t = 0;
|
|
@@ -414,8 +414,8 @@ class D {
|
|
|
414
414
|
var e;
|
|
415
415
|
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
|
416
416
|
}
|
|
417
|
-
constructor(e, t, s,
|
|
418
|
-
this.type = 2, this._$AH =
|
|
417
|
+
constructor(e, t, s, o) {
|
|
418
|
+
this.type = 2, this._$AH = b, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0;
|
|
419
419
|
}
|
|
420
420
|
get parentNode() {
|
|
421
421
|
let e = this._$AA.parentNode;
|
|
@@ -429,7 +429,7 @@ class D {
|
|
|
429
429
|
return this._$AB;
|
|
430
430
|
}
|
|
431
431
|
_$AI(e, t = this) {
|
|
432
|
-
e =
|
|
432
|
+
e = C(this, e, t), U(e) ? e === b || e == null || e === "" ? (this._$AH !== b && this._$AR(), this._$AH = b) : e !== this._$AH && e !== H && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : we(e) ? this.k(e) : this._(e);
|
|
433
433
|
}
|
|
434
434
|
O(e) {
|
|
435
435
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -438,33 +438,33 @@ class D {
|
|
|
438
438
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
439
439
|
}
|
|
440
440
|
_(e) {
|
|
441
|
-
this._$AH !==
|
|
441
|
+
this._$AH !== b && U(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
|
|
442
442
|
}
|
|
443
443
|
$(e) {
|
|
444
|
-
var
|
|
445
|
-
const { values: t, _$litType$: s } = e,
|
|
446
|
-
if (((
|
|
444
|
+
var c;
|
|
445
|
+
const { values: t, _$litType$: s } = e, o = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = O.createElement(le(s.h, s.h[0]), this.options)), s);
|
|
446
|
+
if (((c = this._$AH) == null ? void 0 : c._$AD) === o) this._$AH.p(t);
|
|
447
447
|
else {
|
|
448
|
-
const
|
|
449
|
-
|
|
448
|
+
const r = new Ce(o, this), h = r.u(this.options);
|
|
449
|
+
r.p(t), this.T(h), this._$AH = r;
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
_$AC(e) {
|
|
453
|
-
let t =
|
|
454
|
-
return t === void 0 &&
|
|
453
|
+
let t = re.get(e.strings);
|
|
454
|
+
return t === void 0 && re.set(e.strings, t = new O(e)), t;
|
|
455
455
|
}
|
|
456
456
|
k(e) {
|
|
457
457
|
G(this._$AH) || (this._$AH = [], this._$AR());
|
|
458
458
|
const t = this._$AH;
|
|
459
|
-
let s,
|
|
460
|
-
for (const
|
|
461
|
-
|
|
459
|
+
let s, o = 0;
|
|
460
|
+
for (const c of e) o === t.length ? t.push(s = new D(this.O(V()), this.O(V()), this, this.options)) : s = t[o], s._$AI(c), o++;
|
|
461
|
+
o < t.length && (this._$AR(s && s._$AB.nextSibling, o), t.length = o);
|
|
462
462
|
}
|
|
463
463
|
_$AR(e = this._$AA.nextSibling, t) {
|
|
464
464
|
var s;
|
|
465
465
|
for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, t); e && e !== this._$AB; ) {
|
|
466
|
-
const
|
|
467
|
-
e.remove(), e =
|
|
466
|
+
const o = e.nextSibling;
|
|
467
|
+
e.remove(), e = o;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
setConnected(e) {
|
|
@@ -479,22 +479,22 @@ class L {
|
|
|
479
479
|
get _$AU() {
|
|
480
480
|
return this._$AM._$AU;
|
|
481
481
|
}
|
|
482
|
-
constructor(e, t, s,
|
|
483
|
-
this.type = 1, this._$AH =
|
|
482
|
+
constructor(e, t, s, o, c) {
|
|
483
|
+
this.type = 1, this._$AH = b, this._$AN = void 0, this.element = e, this.name = t, this._$AM = o, this.options = c, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = b;
|
|
484
484
|
}
|
|
485
|
-
_$AI(e, t = this, s,
|
|
486
|
-
const
|
|
487
|
-
let
|
|
488
|
-
if (
|
|
485
|
+
_$AI(e, t = this, s, o) {
|
|
486
|
+
const c = this.strings;
|
|
487
|
+
let r = !1;
|
|
488
|
+
if (c === void 0) e = C(this, e, t, 0), r = !U(e) || e !== this._$AH && e !== H, r && (this._$AH = e);
|
|
489
489
|
else {
|
|
490
490
|
const h = e;
|
|
491
|
-
let
|
|
492
|
-
for (e =
|
|
491
|
+
let n, d;
|
|
492
|
+
for (e = c[0], n = 0; n < c.length - 1; n++) d = C(this, h[s + n], t, n), d === H && (d = this._$AH[n]), r || (r = !U(d) || d !== this._$AH[n]), d === b ? e = b : e !== b && (e += (d ?? "") + c[n + 1]), this._$AH[n] = d;
|
|
493
493
|
}
|
|
494
|
-
|
|
494
|
+
r && !o && this.j(e);
|
|
495
495
|
}
|
|
496
496
|
j(e) {
|
|
497
|
-
e ===
|
|
497
|
+
e === b ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
class Pe extends L {
|
|
@@ -502,25 +502,25 @@ class Pe extends L {
|
|
|
502
502
|
super(...arguments), this.type = 3;
|
|
503
503
|
}
|
|
504
504
|
j(e) {
|
|
505
|
-
this.element[this.name] = e ===
|
|
505
|
+
this.element[this.name] = e === b ? void 0 : e;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
class
|
|
508
|
+
class ze extends L {
|
|
509
509
|
constructor() {
|
|
510
510
|
super(...arguments), this.type = 4;
|
|
511
511
|
}
|
|
512
512
|
j(e) {
|
|
513
|
-
this.element.toggleAttribute(this.name, !!e && e !==
|
|
513
|
+
this.element.toggleAttribute(this.name, !!e && e !== b);
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
class
|
|
517
|
-
constructor(e, t, s,
|
|
518
|
-
super(e, t, s,
|
|
516
|
+
class qe extends L {
|
|
517
|
+
constructor(e, t, s, o, c) {
|
|
518
|
+
super(e, t, s, o, c), this.type = 5;
|
|
519
519
|
}
|
|
520
520
|
_$AI(e, t = this) {
|
|
521
|
-
if ((e =
|
|
522
|
-
const s = this._$AH,
|
|
523
|
-
|
|
521
|
+
if ((e = C(this, e, t, 0) ?? b) === H) return;
|
|
522
|
+
const s = this._$AH, o = e === b && s !== b || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, c = e !== b && (s === b || o);
|
|
523
|
+
o && this.element.removeEventListener(this.name, this, s), c && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
524
524
|
}
|
|
525
525
|
handleEvent(e) {
|
|
526
526
|
var t;
|
|
@@ -535,27 +535,27 @@ class Me {
|
|
|
535
535
|
return this._$AM._$AU;
|
|
536
536
|
}
|
|
537
537
|
_$AI(e) {
|
|
538
|
-
|
|
538
|
+
C(this, e);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
const F = M.litHtmlPolyfillSupport;
|
|
542
|
-
F == null || F(
|
|
542
|
+
F == null || F(O, D), (M.litHtmlVersions ?? (M.litHtmlVersions = [])).push("3.2.1");
|
|
543
543
|
/**
|
|
544
544
|
* @license
|
|
545
545
|
* Copyright 2018 Google LLC
|
|
546
546
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
547
547
|
*/
|
|
548
|
-
const Ue = (
|
|
548
|
+
const Ue = (i) => i ?? b, de = be`
|
|
549
549
|
:host {
|
|
550
550
|
/* Anything that can be overridden should be defined here */
|
|
551
551
|
|
|
552
552
|
/* Global Checkbox Styles */
|
|
553
553
|
--_nys-checkbox-size: var(--nys-size-400, 32px);
|
|
554
|
-
--_nys-checkbox-radius: var(--nys-
|
|
554
|
+
--_nys-checkbox-radius: var(--nys-radius-md, 4px);
|
|
555
555
|
--_nys-checkbox-width-border: var(--nys-border-width-md, 2px);
|
|
556
556
|
--_nys-checkbox-color-focus: var(--nys-color-focus, #004dd1);
|
|
557
557
|
--_nys-checkbox-width-focus: var(--nys-border-width-md, 2px);
|
|
558
|
-
--_nys-checkbox-offset
|
|
558
|
+
--_nys-checkbox-outline-offset: var(--nys-space-2px, 2px);
|
|
559
559
|
/* space between checkbox and it's label */
|
|
560
560
|
--_nys-checkbox-gap: var(--nys-space-150, 12px);
|
|
561
561
|
/* space between checkboxes */
|
|
@@ -592,11 +592,11 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
592
592
|
--_nys-checkbox-color-bg: var(--nys-color-ink-reverse, #ffffff);
|
|
593
593
|
--_nys-checkbox-color-border: var(--nys-color-neutral-600, #62666a);
|
|
594
594
|
/* Empty + Hovered */
|
|
595
|
-
--_nys-checkbox-hover-color-bg: var(--nys-color-neutral-
|
|
596
|
-
--_nys-checkbox-hover-color-border: var(--nys-color-
|
|
595
|
+
--_nys-checkbox-hover-color-bg: var(--nys-color-neutral-50, #ededed);
|
|
596
|
+
--_nys-checkbox-hover-color-border: var(--nys-color-ink, #1b1b1b);
|
|
597
597
|
/* Empty + Pressed */
|
|
598
|
-
--_nys-checkbox-pressed-color-bg: var(--nys-color-neutral-
|
|
599
|
-
--_nys-checkbox-pressed-color-border: var(--nys-color-
|
|
598
|
+
--_nys-checkbox-pressed-color-bg: var(--nys-color-neutral-100, #d0d0ce);
|
|
599
|
+
--_nys-checkbox-pressed-color-border: var(--nys-color-ink, #1b1b1b);
|
|
600
600
|
/* Checked */
|
|
601
601
|
--_nys-checkbox-checked-color-bg: var(--nys-color-theme, #154973);
|
|
602
602
|
--_nys-checkbox-checked-color-border: var(--nys-color-theme, #154973);
|
|
@@ -642,14 +642,74 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
642
642
|
/* Small Variant */
|
|
643
643
|
:host([size="sm"]) {
|
|
644
644
|
--_nys-checkbox-size: var(--nys-size-300, 24px);
|
|
645
|
-
--_nys-checkbox-radius: var(--nys-
|
|
645
|
+
--_nys-checkbox-radius: var(--nys-radius-sm, 2px);
|
|
646
646
|
--_nys-checkboxgroup-gap: var(--nys-space-100, 8px);
|
|
647
647
|
--_nys-checkbox-gap: var(--nys-space-100, 8px);
|
|
648
648
|
}
|
|
649
649
|
/* Medium Variant */
|
|
650
650
|
:host([size="md"]) {
|
|
651
651
|
--_nys-checkbox-size: var(--nys-size-400, 32px);
|
|
652
|
-
--_nys-checkbox-radius: var(--nys-
|
|
652
|
+
--_nys-checkbox-radius: var(--nys-radius-md, 4px);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/* Tile Variant */
|
|
656
|
+
:host([tile]) {
|
|
657
|
+
--_nys-checkbox-font-weight-label: var(--nys-font-weight-semibold, 600);
|
|
658
|
+
--_nys-checkbox-tile-border-width: var(--nys-border-width-sm, 1px);
|
|
659
|
+
--_nys-checkbox-tile-border-radius: var(--nys-radius-md, 4px);
|
|
660
|
+
--_nys-checkbox-tile-border-color: var(--nys-color-neutral-100, #d0d0ce);
|
|
661
|
+
--_nys-checkbox-tile-bg-color: var(--nys-color-ink-reverse, #ffffff);
|
|
662
|
+
--_nys-checkbox-tile-padding-x: var(--nys-space-250, 20px);
|
|
663
|
+
--_nys-checkbox-tile-padding-y: var(--nys-space-200, 16px);
|
|
664
|
+
/* Hover */
|
|
665
|
+
--_nys-checkbox-hover-tile-border-color: var(
|
|
666
|
+
--nys-color-neutral-700,
|
|
667
|
+
#4a4d4f
|
|
668
|
+
);
|
|
669
|
+
--_nys-checkbox-hover-tile-bg-color: var(--nys-color-ink-reverse, #ffffff);
|
|
670
|
+
/* Pressed */
|
|
671
|
+
--_nys-checkbox-pressed-tile-border-color: var(
|
|
672
|
+
--nys-color-neutral-900,
|
|
673
|
+
#1b1b1b
|
|
674
|
+
);
|
|
675
|
+
--_nys-checkbox-pressed-tile-bg-color: var(
|
|
676
|
+
--nys-color-ink-reverse,
|
|
677
|
+
#ffffff
|
|
678
|
+
);
|
|
679
|
+
/* Checked */
|
|
680
|
+
--_nys-checkbox-checked-tile-border-color: var(
|
|
681
|
+
--nys-color-theme-mid,
|
|
682
|
+
#457aa5
|
|
683
|
+
);
|
|
684
|
+
--_nys-checkbox-checked-tile-bg-color: var(
|
|
685
|
+
--nys-color-theme-faint,
|
|
686
|
+
#f7fafd
|
|
687
|
+
);
|
|
688
|
+
/* Disabled */
|
|
689
|
+
--_nys-checkbox-disabled-tile-bg-color: var(
|
|
690
|
+
--nys-color-ink-reverse,
|
|
691
|
+
#f0f0f0
|
|
692
|
+
);
|
|
693
|
+
--_nys-checkbox-disabled-tile-border-color: var(
|
|
694
|
+
--nys-color-neutral-100,
|
|
695
|
+
#d0d0ce
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
:host([tile][size="sm"]) {
|
|
700
|
+
--_nys-checkbox-tile-padding-x: var(--nys-space-200, 16px);
|
|
701
|
+
--_nys-checkbox-tile-padding-y: var(--nys-space-150, 12px);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
:host([tile][showError]) {
|
|
705
|
+
--_nys-checkbox-tile-border-color: var(--nys-color-danger, #b52c2c);
|
|
706
|
+
--_nys-checkbox-hover-tile-border-color: var(--nys-color-danger, #b52c2c);
|
|
707
|
+
--_nys-checkbox-pressed-tile-border-color: var(--nys-color-danger, #b52c2c);
|
|
708
|
+
--_nys-checkbox-checked-tile-border-color: var(--nys-color-danger, #b52c2c);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
#single-error-message {
|
|
712
|
+
--_nys-errormessage-margin-top: var(--nys-space-50, 4px);
|
|
653
713
|
}
|
|
654
714
|
|
|
655
715
|
.nys-checkboxgroup {
|
|
@@ -673,6 +733,14 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
673
733
|
font-family: var(--_nys-checkbox-font-family);
|
|
674
734
|
font-size: var(--_nys-checkbox-font-size);
|
|
675
735
|
line-height: var(--_nys-checkbox-line-height);
|
|
736
|
+
|
|
737
|
+
/* Tile */
|
|
738
|
+
border-radius: var(--_nys-checkbox-tile-border-radius);
|
|
739
|
+
border: var(--_nys-checkbox-tile-border-width) solid
|
|
740
|
+
var(--_nys-checkbox-tile-border-color);
|
|
741
|
+
background: var(--_nys-checkbox-tile-bg-color);
|
|
742
|
+
padding: var(--_nys-checkbox-tile-padding-y)
|
|
743
|
+
var(--_nys-checkbox-tile-padding-x);
|
|
676
744
|
}
|
|
677
745
|
|
|
678
746
|
/* wraps the single checkbox */
|
|
@@ -703,7 +771,6 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
703
771
|
appearance: none;
|
|
704
772
|
background-repeat: no-repeat;
|
|
705
773
|
background-position: center;
|
|
706
|
-
outline-offset: var(--_nys-checkbox-offset-focus);
|
|
707
774
|
width: var(--_nys-checkbox-size);
|
|
708
775
|
min-width: var(--_nys-checkbox-size);
|
|
709
776
|
min-height: var(--_nys-checkbox-size);
|
|
@@ -714,9 +781,12 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
714
781
|
var(--_nys-checkbox-color-border);
|
|
715
782
|
background-color: var(--_nys-checkbox-color-bg);
|
|
716
783
|
border-radius: var(--_nys-checkbox-radius);
|
|
784
|
+
outline-offset: var(--_nys-checkbox-outline-offset);
|
|
785
|
+
outline: none;
|
|
717
786
|
}
|
|
718
787
|
|
|
719
788
|
/* Pointer cursor for unchecked checkbox */
|
|
789
|
+
.nys-checkbox:hover,
|
|
720
790
|
.nys-checkbox:hover * {
|
|
721
791
|
cursor: pointer;
|
|
722
792
|
}
|
|
@@ -726,12 +796,21 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
726
796
|
background-color: var(--_nys-checkbox-checked-color-bg);
|
|
727
797
|
border-color: var(--_nys-checkbox-checked-color-border);
|
|
728
798
|
}
|
|
799
|
+
:host([tile])
|
|
800
|
+
.nys-checkbox:has(.nys-checkbox__checkbox:not(:disabled):checked) {
|
|
801
|
+
border-color: var(--_nys-checkbox-checked-tile-border-color);
|
|
802
|
+
background-color: var(--_nys-checkbox-checked-tile-bg-color);
|
|
803
|
+
}
|
|
729
804
|
|
|
730
805
|
/* Checked + Disabled */
|
|
731
806
|
.nys-checkbox__checkbox:disabled:checked {
|
|
732
807
|
background-color: var(--_nys-checkbox-disabled-checked-color-bg);
|
|
733
808
|
border-color: var(--_nys-checkbox-disabled-checked-color-border);
|
|
734
809
|
}
|
|
810
|
+
:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:disabled:checked) {
|
|
811
|
+
border-color: var(--_nys-checkbox-disabled-tile-border-color);
|
|
812
|
+
background-color: var(--_nys-checkbox-disabled-tile-bg-color);
|
|
813
|
+
}
|
|
735
814
|
|
|
736
815
|
/* Disabled */
|
|
737
816
|
.nys-checkbox__checkbox:disabled {
|
|
@@ -745,24 +824,59 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
745
824
|
color: var(--_nys-checkbox-disabled-color-text);
|
|
746
825
|
cursor: not-allowed;
|
|
747
826
|
}
|
|
827
|
+
:host([tile]) .nys-checkbox:has(.nys-checkbox__checkbox:disabled) {
|
|
828
|
+
background-color: var(--_nys-checkbox-disabled-color-bg);
|
|
829
|
+
border-color: var(--_nys-checkbox-disabled-color-border);
|
|
830
|
+
cursor: not-allowed;
|
|
831
|
+
}
|
|
748
832
|
|
|
749
|
-
/* Hover -
|
|
833
|
+
/* Hover - not checked */
|
|
750
834
|
.nys-checkbox__checkbox:hover:not(:disabled):not(:checked) {
|
|
751
835
|
background-color: var(--_nys-checkbox-hover-color-bg);
|
|
752
836
|
border-color: var(--_nys-checkbox-hover-color-border);
|
|
753
837
|
}
|
|
838
|
+
:host([tile])
|
|
839
|
+
.nys-checkbox:hover:has(
|
|
840
|
+
.nys-checkbox__checkbox:not(:disabled):not(:checked)
|
|
841
|
+
) {
|
|
842
|
+
border-color: var(--_nys-checkbox-hover-tile-border-color);
|
|
843
|
+
background-color: var(--_nys-checkbox-hover-tile-bg-color);
|
|
844
|
+
outline: solid var(--_nys-checkbox-tile-border-width)
|
|
845
|
+
var(--_nys-checkbox-hover-tile-border-color);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/* Hover + Checked */
|
|
849
|
+
:host([tile])
|
|
850
|
+
.nys-checkbox:hover:has(.nys-checkbox__checkbox:not(:disabled):checked) {
|
|
851
|
+
outline: solid var(--_nys-checkbox-tile-border-width)
|
|
852
|
+
var(--_nys-checkbox-checked-tile-border-color);
|
|
853
|
+
}
|
|
754
854
|
|
|
755
855
|
/* Pressed - only allow pressed on unchecked */
|
|
756
856
|
.nys-checkbox__checkbox:active:not(:disabled):not(:checked) {
|
|
757
857
|
background-color: var(--_nys-checkbox-pressed-color-bg);
|
|
758
858
|
border-color: var(--_nys-checkbox-pressed-color-border);
|
|
759
859
|
}
|
|
860
|
+
:host([tile])
|
|
861
|
+
.nys-checkbox:has(
|
|
862
|
+
.nys-checkbox__checkbox:active:not(:disabled):not(:checked)
|
|
863
|
+
) {
|
|
864
|
+
border-color: var(--_nys-checkbox-pressed-tile-border-color);
|
|
865
|
+
background-color: var(--_nys-checkbox-pressed-tile-bg-color);
|
|
866
|
+
outline: solid var(--_nys-checkbox-tile-border-width)
|
|
867
|
+
var(--_nys-checkbox-pressed-tile-border-color);
|
|
868
|
+
}
|
|
760
869
|
|
|
761
870
|
/* Focused */
|
|
762
|
-
.nys-checkbox__checkbox:focus {
|
|
871
|
+
:host(:not([tile])) .nys-checkbox__checkbox:focus-visible {
|
|
763
872
|
outline: solid var(--_nys-checkbox-width-focus)
|
|
764
873
|
var(--_nys-checkbox-color-focus);
|
|
765
874
|
}
|
|
875
|
+
:host([tile]) .nys-checkbox:has(*:focus-visible) {
|
|
876
|
+
outline: solid var(--_nys-checkbox-tile-border-width)
|
|
877
|
+
var(--_nys-checkbox-color-focus) !important;
|
|
878
|
+
border-color: var(--_nys-checkbox-color-focus) !important;
|
|
879
|
+
}
|
|
766
880
|
|
|
767
881
|
/* Checkbox Label Holder */
|
|
768
882
|
.nys-checkbox__text {
|
|
@@ -794,23 +908,23 @@ const Ue = (r) => r ?? u, de = ue`
|
|
|
794
908
|
display: inline;
|
|
795
909
|
}
|
|
796
910
|
`;
|
|
797
|
-
var
|
|
798
|
-
for (var
|
|
799
|
-
(
|
|
800
|
-
return s &&
|
|
911
|
+
var He = Object.defineProperty, Oe = Object.getOwnPropertyDescriptor, f = (i, e, t, s) => {
|
|
912
|
+
for (var o = s > 1 ? void 0 : s ? Oe(e, t) : e, c = i.length - 1, r; c >= 0; c--)
|
|
913
|
+
(r = i[c]) && (o = (s ? r(e, t, o) : r(o)) || o);
|
|
914
|
+
return s && o && He(e, t, o), o;
|
|
801
915
|
};
|
|
802
916
|
let Ie = 0;
|
|
803
|
-
var
|
|
804
|
-
const _ = (
|
|
917
|
+
var x;
|
|
918
|
+
const _ = (x = class extends ie {
|
|
805
919
|
// allows use of elementInternals' API
|
|
806
920
|
constructor() {
|
|
807
|
-
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();
|
|
921
|
+
super(), this.id = "", this.name = "", this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.label = "", this.description = "", this.tile = !1, this._size = "md", this._internals = this.attachInternals();
|
|
808
922
|
}
|
|
809
923
|
get size() {
|
|
810
924
|
return this._size;
|
|
811
925
|
}
|
|
812
926
|
set size(e) {
|
|
813
|
-
this._size =
|
|
927
|
+
this._size = x.VALID_SIZES.includes(
|
|
814
928
|
e
|
|
815
929
|
) ? e : "md";
|
|
816
930
|
}
|
|
@@ -822,10 +936,10 @@ const _ = (v = class extends re {
|
|
|
822
936
|
super.disconnectedCallback(), this.removeEventListener("change", this._handleCheckboxChange), this.removeEventListener("invalid", this._handleInvalid);
|
|
823
937
|
}
|
|
824
938
|
firstUpdated() {
|
|
825
|
-
this._setGroupExist();
|
|
939
|
+
this._setGroupExist(), this.updateCheckboxSize(), this.updateCheckboxTile(), this.updateCheckboxShowError();
|
|
826
940
|
}
|
|
827
941
|
updated(e) {
|
|
828
|
-
e.has("required") && this.required && this._setupCheckboxRequired(), e.has("size") && this.updateCheckboxSize();
|
|
942
|
+
e.has("required") && this.required && this._setupCheckboxRequired(), e.has("size") && this.updateCheckboxSize(), e.has("tile") && this.updateCheckboxTile(), e.has("showError") && this.updateCheckboxShowError();
|
|
829
943
|
}
|
|
830
944
|
/********************** Functions **********************/
|
|
831
945
|
_setGroupExist() {
|
|
@@ -837,8 +951,8 @@ const _ = (v = class extends re {
|
|
|
837
951
|
e.preventDefault(), this.showError = !0, this._manageCheckboxRequired();
|
|
838
952
|
const t = this.querySelector("nys-checkbox"), s = t ? await t.getInputElement() : null;
|
|
839
953
|
if (s) {
|
|
840
|
-
const
|
|
841
|
-
|
|
954
|
+
const o = this._internals.form;
|
|
955
|
+
o ? Array.from(o.elements).find((h) => {
|
|
842
956
|
if (h.tagName.toLowerCase() === "nys-checkboxgroup") {
|
|
843
957
|
if (Array.from(
|
|
844
958
|
this.querySelectorAll("nys-checkbox")
|
|
@@ -862,17 +976,17 @@ const _ = (v = class extends re {
|
|
|
862
976
|
}
|
|
863
977
|
// Similar to how native forms handle multiple same-name fields, we group the selected values into a list for FormData.
|
|
864
978
|
_handleCheckboxChange(e) {
|
|
865
|
-
const t = e, { name: s } = t.detail,
|
|
866
|
-
this.name = s, this._internals.setFormValue(
|
|
979
|
+
const t = e, { name: s } = t.detail, c = Array.from(this.querySelectorAll("nys-checkbox")).filter((r) => r.checked).map((r) => r.value);
|
|
980
|
+
this.name = s, this._internals.setFormValue(c.join(", ")), this._manageCheckboxRequired();
|
|
867
981
|
}
|
|
868
982
|
// Updates the required attribute of each checkbox in the group
|
|
869
983
|
async _manageCheckboxRequired() {
|
|
870
984
|
if (this.required) {
|
|
871
985
|
const e = this.errorMessage || "Please select at least one option.", t = this.querySelector("nys-checkbox"), s = t ? await t.getInputElement() : null;
|
|
872
|
-
let
|
|
873
|
-
this.querySelectorAll("nys-checkbox").forEach((
|
|
874
|
-
|
|
875
|
-
}),
|
|
986
|
+
let o = !1;
|
|
987
|
+
this.querySelectorAll("nys-checkbox").forEach((r) => {
|
|
988
|
+
r.checked && (o = !0);
|
|
989
|
+
}), o ? (this._internals.setValidity({}), this.showError = !1) : (this._internals.setValidity(
|
|
876
990
|
{ valueMissing: !0 },
|
|
877
991
|
e,
|
|
878
992
|
s || this
|
|
@@ -885,12 +999,18 @@ const _ = (v = class extends re {
|
|
|
885
999
|
t.setAttribute("size", this.size);
|
|
886
1000
|
});
|
|
887
1001
|
}
|
|
1002
|
+
updateCheckboxTile() {
|
|
1003
|
+
this.querySelectorAll("nys-checkbox").forEach((t) => {
|
|
1004
|
+
this.tile ? t.toggleAttribute("tile", !0) : t.removeAttribute("tile");
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
updateCheckboxShowError() {
|
|
1008
|
+
this.querySelectorAll("nys-checkbox").forEach((t) => {
|
|
1009
|
+
this.showError ? t.setAttribute("showError", "") : t.removeAttribute("showError");
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
888
1012
|
render() {
|
|
889
|
-
return
|
|
890
|
-
class="nys-checkboxgroup"
|
|
891
|
-
aria-required="${this.required ? "true" : "false"}"
|
|
892
|
-
role="group"
|
|
893
|
-
>
|
|
1013
|
+
return S` <div class="nys-checkboxgroup" role="group">
|
|
894
1014
|
<nys-label
|
|
895
1015
|
id=${this.id}
|
|
896
1016
|
label=${this.label}
|
|
@@ -905,57 +1025,60 @@ const _ = (v = class extends re {
|
|
|
905
1025
|
<nys-errormessage
|
|
906
1026
|
?showError=${this.showError}
|
|
907
1027
|
errorMessage=${this._internals.validationMessage || this.errorMessage}
|
|
908
|
-
showDivider
|
|
1028
|
+
.showDivider=${!this.tile}
|
|
909
1029
|
></nys-errormessage>
|
|
910
1030
|
</div>`;
|
|
911
1031
|
}
|
|
912
|
-
},
|
|
913
|
-
|
|
1032
|
+
}, x.VALID_SIZES = ["sm", "md"], x.styles = de, x.formAssociated = !0, x);
|
|
1033
|
+
f([
|
|
914
1034
|
l({ type: String })
|
|
915
1035
|
], _.prototype, "id", 2);
|
|
916
|
-
|
|
1036
|
+
f([
|
|
917
1037
|
l({ type: String, reflect: !0 })
|
|
918
1038
|
], _.prototype, "name", 2);
|
|
919
|
-
|
|
1039
|
+
f([
|
|
920
1040
|
l({ type: Boolean, reflect: !0 })
|
|
921
1041
|
], _.prototype, "required", 2);
|
|
922
|
-
|
|
1042
|
+
f([
|
|
923
1043
|
l({ type: Boolean, reflect: !0 })
|
|
924
1044
|
], _.prototype, "optional", 2);
|
|
925
|
-
|
|
1045
|
+
f([
|
|
926
1046
|
l({ type: Boolean, reflect: !0 })
|
|
927
1047
|
], _.prototype, "showError", 2);
|
|
928
|
-
|
|
1048
|
+
f([
|
|
929
1049
|
l({ type: String })
|
|
930
1050
|
], _.prototype, "errorMessage", 2);
|
|
931
|
-
|
|
1051
|
+
f([
|
|
932
1052
|
l({ type: String })
|
|
933
1053
|
], _.prototype, "label", 2);
|
|
934
|
-
|
|
1054
|
+
f([
|
|
935
1055
|
l({ type: String })
|
|
936
1056
|
], _.prototype, "description", 2);
|
|
937
|
-
|
|
1057
|
+
f([
|
|
1058
|
+
l({ type: Boolean, reflect: !0 })
|
|
1059
|
+
], _.prototype, "tile", 2);
|
|
1060
|
+
f([
|
|
938
1061
|
l({ reflect: !0 })
|
|
939
1062
|
], _.prototype, "size", 1);
|
|
940
1063
|
let Re = _;
|
|
941
1064
|
customElements.get("nys-checkboxgroup") || customElements.define("nys-checkboxgroup", Re);
|
|
942
|
-
var Te = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor,
|
|
943
|
-
for (var
|
|
944
|
-
(
|
|
945
|
-
return s &&
|
|
1065
|
+
var Te = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, y = (i, e, t, s) => {
|
|
1066
|
+
for (var o = s > 1 ? void 0 : s ? Ne(e, t) : e, c = i.length - 1, r; c >= 0; c--)
|
|
1067
|
+
(r = i[c]) && (o = (s ? r(e, t, o) : r(o)) || o);
|
|
1068
|
+
return s && o && Te(e, t, o), o;
|
|
946
1069
|
};
|
|
947
1070
|
let Ve = 0;
|
|
948
|
-
var
|
|
949
|
-
const
|
|
1071
|
+
var v;
|
|
1072
|
+
const u = (v = class extends ie {
|
|
950
1073
|
// allows use of elementInternals' API
|
|
951
1074
|
constructor() {
|
|
952
|
-
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();
|
|
1075
|
+
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();
|
|
953
1076
|
}
|
|
954
1077
|
get size() {
|
|
955
1078
|
return this._size;
|
|
956
1079
|
}
|
|
957
1080
|
set size(e) {
|
|
958
|
-
this._size =
|
|
1081
|
+
this._size = v.VALID_SIZES.includes(
|
|
959
1082
|
e
|
|
960
1083
|
) ? e : "md";
|
|
961
1084
|
}
|
|
@@ -987,9 +1110,9 @@ const y = (x = class extends re {
|
|
|
987
1110
|
e && (this.required && !this.checked ? (this._internals.ariaRequired = "true", this._internals.setValidity({ valueMissing: !0 }, t, e)) : this._internals.setValidity({}));
|
|
988
1111
|
}
|
|
989
1112
|
_setValidityMessage(e = "") {
|
|
990
|
-
var s;
|
|
1113
|
+
var s, o;
|
|
991
1114
|
const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
|
|
992
|
-
t && (this.showError = !!e, this.errorMessage.trim() && e !== "" && (e = this.errorMessage), this._internals.setValidity(
|
|
1115
|
+
t && (this.showError = !!e, (o = this.errorMessage) != null && o.trim() && e !== "" && (e = this.errorMessage), this._internals.setValidity(
|
|
993
1116
|
e ? { customError: !0 } : {},
|
|
994
1117
|
e,
|
|
995
1118
|
t
|
|
@@ -1016,8 +1139,8 @@ const y = (x = class extends re {
|
|
|
1016
1139
|
e.preventDefault(), this.showError = !0, this._validate();
|
|
1017
1140
|
const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
|
|
1018
1141
|
if (t) {
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1142
|
+
const o = this._internals.form;
|
|
1143
|
+
o ? Array.from(o.elements).find(
|
|
1021
1144
|
(h) => typeof h.checkValidity == "function" && !h.checkValidity()
|
|
1022
1145
|
) === this && t.focus() : t.focus();
|
|
1023
1146
|
}
|
|
@@ -1061,7 +1184,8 @@ const y = (x = class extends re {
|
|
|
1061
1184
|
)));
|
|
1062
1185
|
}
|
|
1063
1186
|
render() {
|
|
1064
|
-
|
|
1187
|
+
var e;
|
|
1188
|
+
return S`
|
|
1065
1189
|
<div class="nys-checkbox">
|
|
1066
1190
|
<label class="nys-checkbox__content">
|
|
1067
1191
|
<div class="nys-checkbox__checkboxwrapper">
|
|
@@ -1082,71 +1206,75 @@ const y = (x = class extends re {
|
|
|
1082
1206
|
@blur="${this._handleBlur}"
|
|
1083
1207
|
@keydown="${this._handleKeydown}"
|
|
1084
1208
|
/>
|
|
1085
|
-
${this.checked ?
|
|
1209
|
+
${this.checked ? S`<nys-icon
|
|
1086
1210
|
for="${this.id}"
|
|
1087
1211
|
name="check"
|
|
1088
1212
|
size="${this.size === "md" ? "4xl" : this.size === "sm" ? "2xl" : "xl"}"
|
|
1089
1213
|
class="nys-checkbox__icon"
|
|
1090
1214
|
></nys-icon>` : ""}
|
|
1091
1215
|
</div>
|
|
1092
|
-
${this.label &&
|
|
1216
|
+
${this.label && S` <div class="nys-checkbox__text">
|
|
1093
1217
|
<div class="nys-checkbox__requiredwrapper">
|
|
1094
1218
|
<label for=${this.id} class="nys-checkbox__label"
|
|
1095
1219
|
>${this.label}</label
|
|
1096
1220
|
>
|
|
1097
|
-
${this.required ?
|
|
1221
|
+
${this.required ? S`<label class="nys-checkbox__required">*</label>` : ""}
|
|
1098
1222
|
</div>
|
|
1099
1223
|
<label for=${this.id} class="nys-checkbox__description">
|
|
1100
1224
|
<slot name="description">${this.description}</slot>
|
|
1101
1225
|
</label>
|
|
1102
1226
|
</div>`}
|
|
1103
1227
|
</label>
|
|
1104
|
-
<nys-errormessage
|
|
1105
|
-
?showError=${this.showError}
|
|
1106
|
-
errorMessage=${this._internals.validationMessage || this.errorMessage}
|
|
1107
|
-
showDivider
|
|
1108
|
-
></nys-errormessage>
|
|
1109
1228
|
</div>
|
|
1229
|
+
${((e = this.parentElement) == null ? void 0 : e.tagName.toLowerCase()) !== "nys-checkboxgroup" ? S`<nys-errormessage
|
|
1230
|
+
id="single-error-message"
|
|
1231
|
+
?showError=${this.showError}
|
|
1232
|
+
errorMessage=${this._internals.validationMessage || this.errorMessage}
|
|
1233
|
+
.showDivider=${!this.tile}
|
|
1234
|
+
></nys-errormessage>` : ""}
|
|
1110
1235
|
`;
|
|
1111
1236
|
}
|
|
1112
|
-
},
|
|
1113
|
-
|
|
1237
|
+
}, v.VALID_SIZES = ["sm", "md"], v.styles = de, v.formAssociated = !0, v);
|
|
1238
|
+
y([
|
|
1114
1239
|
l({ type: Boolean, reflect: !0 })
|
|
1115
|
-
],
|
|
1116
|
-
|
|
1240
|
+
], u.prototype, "checked", 2);
|
|
1241
|
+
y([
|
|
1117
1242
|
l({ type: Boolean, reflect: !0 })
|
|
1118
|
-
],
|
|
1119
|
-
|
|
1243
|
+
], u.prototype, "disabled", 2);
|
|
1244
|
+
y([
|
|
1120
1245
|
l({ type: Boolean, reflect: !0 })
|
|
1121
|
-
],
|
|
1122
|
-
|
|
1246
|
+
], u.prototype, "required", 2);
|
|
1247
|
+
y([
|
|
1123
1248
|
l({ type: String })
|
|
1124
|
-
],
|
|
1125
|
-
|
|
1249
|
+
], u.prototype, "label", 2);
|
|
1250
|
+
y([
|
|
1126
1251
|
l({ type: String })
|
|
1127
|
-
],
|
|
1128
|
-
|
|
1252
|
+
], u.prototype, "description", 2);
|
|
1253
|
+
y([
|
|
1129
1254
|
l({ type: String })
|
|
1130
|
-
],
|
|
1131
|
-
|
|
1255
|
+
], u.prototype, "id", 2);
|
|
1256
|
+
y([
|
|
1132
1257
|
l({ type: String, reflect: !0 })
|
|
1133
|
-
],
|
|
1134
|
-
|
|
1258
|
+
], u.prototype, "name", 2);
|
|
1259
|
+
y([
|
|
1135
1260
|
l({ type: String })
|
|
1136
|
-
],
|
|
1137
|
-
|
|
1261
|
+
], u.prototype, "value", 2);
|
|
1262
|
+
y([
|
|
1138
1263
|
l({ type: Boolean, reflect: !0 })
|
|
1139
|
-
],
|
|
1140
|
-
|
|
1264
|
+
], u.prototype, "showError", 2);
|
|
1265
|
+
y([
|
|
1141
1266
|
l({ type: String })
|
|
1142
|
-
],
|
|
1143
|
-
|
|
1267
|
+
], u.prototype, "errorMessage", 2);
|
|
1268
|
+
y([
|
|
1144
1269
|
l({ type: Boolean })
|
|
1145
|
-
],
|
|
1146
|
-
|
|
1270
|
+
], u.prototype, "groupExist", 2);
|
|
1271
|
+
y([
|
|
1272
|
+
l({ type: Boolean, reflect: !0 })
|
|
1273
|
+
], u.prototype, "tile", 2);
|
|
1274
|
+
y([
|
|
1147
1275
|
l({ reflect: !0 })
|
|
1148
|
-
],
|
|
1149
|
-
let De =
|
|
1276
|
+
], u.prototype, "size", 1);
|
|
1277
|
+
let De = u;
|
|
1150
1278
|
customElements.get("nys-checkbox") || customElements.define("nys-checkbox", De);
|
|
1151
1279
|
export {
|
|
1152
1280
|
De as NysCheckbox,
|