@justeattakeaway/pie-switch 2.3.23 → 2.3.25

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.
Files changed (2) hide show
  1. package/dist/index.js +476 -472
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,499 +1,503 @@
1
- import { LitElement as Ft, nothing as L, html as N, unsafeCSS as It } from "lit";
2
- import { property as E, query as dt, state as St } from "lit/decorators.js";
3
- import { classMap as Vt } from "lit/directives/class-map.js";
4
- import { ifDefined as Tt } from "lit/directives/if-defined.js";
5
- import { FormControlMixin as Lt, DelegatesFocusMixin as Nt, wrapNativeEvent as Ot, validPropertyValues as Pt, safeCustomElement as _t } from "@justeattakeaway/pie-webc-core";
1
+ import { LitElement as St, nothing as L, html as N, unsafeCSS as Vt } from "lit";
2
+ import { property as E, query as ut, state as Tt } from "lit/decorators.js";
3
+ import { classMap as Lt } from "lit/directives/class-map.js";
4
+ import { ifDefined as Nt } from "lit/directives/if-defined.js";
5
+ import { FormControlMixin as Ot, DelegatesFocusMixin as Pt, wrapNativeEvent as _t, validPropertyValues as Dt, safeCustomElement as Rt } from "@justeattakeaway/pie-webc-core";
6
6
  import "@justeattakeaway/pie-icons-webc/dist/IconCheck.js";
7
- const O = class O extends Ft {
7
+ const O = class O extends St {
8
8
  willUpdate() {
9
9
  this.getAttribute("v") || this.setAttribute("v", O.v);
10
10
  }
11
11
  };
12
- O.v = "2.3.23";
12
+ O.v = "2.3.25";
13
13
  let q = O;
14
- (function() {
15
- (function(l) {
16
- const n = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), F = {
17
- ariaAtomic: "aria-atomic",
18
- ariaAutoComplete: "aria-autocomplete",
19
- ariaBusy: "aria-busy",
20
- ariaChecked: "aria-checked",
21
- ariaColCount: "aria-colcount",
22
- ariaColIndex: "aria-colindex",
23
- ariaColIndexText: "aria-colindextext",
24
- ariaColSpan: "aria-colspan",
25
- ariaCurrent: "aria-current",
26
- ariaDescription: "aria-description",
27
- ariaDisabled: "aria-disabled",
28
- ariaExpanded: "aria-expanded",
29
- ariaHasPopup: "aria-haspopup",
30
- ariaHidden: "aria-hidden",
31
- ariaInvalid: "aria-invalid",
32
- ariaKeyShortcuts: "aria-keyshortcuts",
33
- ariaLabel: "aria-label",
34
- ariaLevel: "aria-level",
35
- ariaLive: "aria-live",
36
- ariaModal: "aria-modal",
37
- ariaMultiLine: "aria-multiline",
38
- ariaMultiSelectable: "aria-multiselectable",
39
- ariaOrientation: "aria-orientation",
40
- ariaPlaceholder: "aria-placeholder",
41
- ariaPosInSet: "aria-posinset",
42
- ariaPressed: "aria-pressed",
43
- ariaReadOnly: "aria-readonly",
44
- ariaRelevant: "aria-relevant",
45
- ariaRequired: "aria-required",
46
- ariaRoleDescription: "aria-roledescription",
47
- ariaRowCount: "aria-rowcount",
48
- ariaRowIndex: "aria-rowindex",
49
- ariaRowIndexText: "aria-rowindextext",
50
- ariaRowSpan: "aria-rowspan",
51
- ariaSelected: "aria-selected",
52
- ariaSetSize: "aria-setsize",
53
- ariaSort: "aria-sort",
54
- ariaValueMax: "aria-valuemax",
55
- ariaValueMin: "aria-valuemin",
56
- ariaValueNow: "aria-valuenow",
57
- ariaValueText: "aria-valuetext",
58
- role: "role"
59
- }, ht = (e, t) => {
60
- for (let i in F) {
61
- t[i] = null;
62
- let a = null;
63
- const r = F[i];
64
- Object.defineProperty(t, i, {
65
- get() {
66
- return a;
67
- },
68
- set(o) {
69
- a = o, e.isConnected ? e.setAttribute(r, o) : A.set(e, t);
14
+ var dt = {}, ht;
15
+ function $t() {
16
+ return ht || (ht = 1, function() {
17
+ (function(l) {
18
+ const n = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), F = {
19
+ ariaAtomic: "aria-atomic",
20
+ ariaAutoComplete: "aria-autocomplete",
21
+ ariaBusy: "aria-busy",
22
+ ariaChecked: "aria-checked",
23
+ ariaColCount: "aria-colcount",
24
+ ariaColIndex: "aria-colindex",
25
+ ariaColIndexText: "aria-colindextext",
26
+ ariaColSpan: "aria-colspan",
27
+ ariaCurrent: "aria-current",
28
+ ariaDescription: "aria-description",
29
+ ariaDisabled: "aria-disabled",
30
+ ariaExpanded: "aria-expanded",
31
+ ariaHasPopup: "aria-haspopup",
32
+ ariaHidden: "aria-hidden",
33
+ ariaInvalid: "aria-invalid",
34
+ ariaKeyShortcuts: "aria-keyshortcuts",
35
+ ariaLabel: "aria-label",
36
+ ariaLevel: "aria-level",
37
+ ariaLive: "aria-live",
38
+ ariaModal: "aria-modal",
39
+ ariaMultiLine: "aria-multiline",
40
+ ariaMultiSelectable: "aria-multiselectable",
41
+ ariaOrientation: "aria-orientation",
42
+ ariaPlaceholder: "aria-placeholder",
43
+ ariaPosInSet: "aria-posinset",
44
+ ariaPressed: "aria-pressed",
45
+ ariaReadOnly: "aria-readonly",
46
+ ariaRelevant: "aria-relevant",
47
+ ariaRequired: "aria-required",
48
+ ariaRoleDescription: "aria-roledescription",
49
+ ariaRowCount: "aria-rowcount",
50
+ ariaRowIndex: "aria-rowindex",
51
+ ariaRowIndexText: "aria-rowindextext",
52
+ ariaRowSpan: "aria-rowspan",
53
+ ariaSelected: "aria-selected",
54
+ ariaSetSize: "aria-setsize",
55
+ ariaSort: "aria-sort",
56
+ ariaValueMax: "aria-valuemax",
57
+ ariaValueMin: "aria-valuemin",
58
+ ariaValueNow: "aria-valuenow",
59
+ ariaValueText: "aria-valuetext",
60
+ role: "role"
61
+ }, pt = (e, t) => {
62
+ for (let i in F) {
63
+ t[i] = null;
64
+ let a = null;
65
+ const r = F[i];
66
+ Object.defineProperty(t, i, {
67
+ get() {
68
+ return a;
69
+ },
70
+ set(s) {
71
+ a = s, e.isConnected ? e.setAttribute(r, s) : A.set(e, t);
72
+ }
73
+ });
74
+ }
75
+ };
76
+ function Y(e) {
77
+ const t = c.get(e), { form: i } = t;
78
+ et(e, i, t), tt(e, t.labels);
79
+ }
80
+ const J = (e, t = !1) => {
81
+ const i = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
82
+ acceptNode(s) {
83
+ return c.has(s) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
70
84
  }
71
85
  });
72
- }
73
- };
74
- function Y(e) {
75
- const t = c.get(e), { form: i } = t;
76
- et(e, i, t), tt(e, t.labels);
77
- }
78
- const J = (e, t = !1) => {
79
- const i = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
80
- acceptNode(o) {
81
- return c.has(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
82
- }
83
- });
84
- let a = i.nextNode();
85
- const r = !t || e.disabled;
86
- for (; a; )
87
- a.formDisabledCallback && r && D(a, e.disabled), a = i.nextNode();
88
- }, Q = { attributes: !0, attributeFilter: ["disabled", "name"] }, I = T() ? new MutationObserver((e) => {
89
- for (const t of e) {
90
- const i = t.target;
91
- if (t.attributeName === "disabled" && (i.constructor.formAssociated ? D(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && J(i)), t.attributeName === "name" && i.constructor.formAssociated) {
92
- const a = c.get(i), r = B.get(i);
93
- a.setFormValue(r);
86
+ let a = i.nextNode();
87
+ const r = !t || e.disabled;
88
+ for (; a; )
89
+ a.formDisabledCallback && r && R(a, e.disabled), a = i.nextNode();
90
+ }, Q = { attributes: !0, attributeFilter: ["disabled", "name"] }, I = T() ? new MutationObserver((e) => {
91
+ for (const t of e) {
92
+ const i = t.target;
93
+ if (t.attributeName === "disabled" && (i.constructor.formAssociated ? R(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && J(i)), t.attributeName === "name" && i.constructor.formAssociated) {
94
+ const a = c.get(i), r = B.get(i);
95
+ a.setFormValue(r);
96
+ }
94
97
  }
98
+ }) : {};
99
+ function _(e) {
100
+ e.forEach((t) => {
101
+ const { addedNodes: i, removedNodes: a } = t, r = Array.from(i), s = Array.from(a);
102
+ r.forEach((o) => {
103
+ var u;
104
+ if (c.has(o) && o.constructor.formAssociated && Y(o), A.has(o)) {
105
+ const d = A.get(o);
106
+ Object.keys(F).filter((b) => d[b] !== null).forEach((b) => {
107
+ o.setAttribute(F[b], d[b]);
108
+ }), A.delete(o);
109
+ }
110
+ if (C.has(o)) {
111
+ const d = C.get(o);
112
+ o.setAttribute("internals-valid", d.validity.valid.toString()), o.setAttribute("internals-invalid", (!d.validity.valid).toString()), o.setAttribute("aria-invalid", (!d.validity.valid).toString()), C.delete(o);
113
+ }
114
+ if (o.localName === "form") {
115
+ const d = y.get(o), w = document.createTreeWalker(o, NodeFilter.SHOW_ELEMENT, {
116
+ acceptNode(z) {
117
+ return c.has(z) && z.constructor.formAssociated && !(d && d.has(z)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
118
+ }
119
+ });
120
+ let b = w.nextNode();
121
+ for (; b; )
122
+ Y(b), b = w.nextNode();
123
+ }
124
+ o.localName === "fieldset" && ((u = I.observe) === null || u === void 0 || u.call(I, o, Q), J(o, !0));
125
+ }), s.forEach((o) => {
126
+ const u = c.get(o);
127
+ u && m.get(u) && X(u), P.has(o) && P.get(o).disconnect();
128
+ });
129
+ });
95
130
  }
96
- }) : {};
97
- function _(e) {
98
- e.forEach((t) => {
99
- const { addedNodes: i, removedNodes: a } = t, r = Array.from(i), o = Array.from(a);
100
- r.forEach((s) => {
101
- var u;
102
- if (c.has(s) && s.constructor.formAssociated && Y(s), A.has(s)) {
103
- const d = A.get(s);
104
- Object.keys(F).filter((b) => d[b] !== null).forEach((b) => {
105
- s.setAttribute(F[b], d[b]);
106
- }), A.delete(s);
107
- }
108
- if (C.has(s)) {
109
- const d = C.get(s);
110
- s.setAttribute("internals-valid", d.validity.valid.toString()), s.setAttribute("internals-invalid", (!d.validity.valid).toString()), s.setAttribute("aria-invalid", (!d.validity.valid).toString()), C.delete(s);
111
- }
112
- if (s.localName === "form") {
113
- const d = y.get(s), w = document.createTreeWalker(s, NodeFilter.SHOW_ELEMENT, {
114
- acceptNode(z) {
115
- return c.has(z) && z.constructor.formAssociated && !(d && d.has(z)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
116
- }
117
- });
118
- let b = w.nextNode();
119
- for (; b; )
120
- Y(b), b = w.nextNode();
131
+ function mt(e) {
132
+ e.forEach((t) => {
133
+ const { removedNodes: i } = t;
134
+ i.forEach((a) => {
135
+ const r = K.get(t.target);
136
+ c.has(a) && at(a), r.disconnect();
137
+ });
138
+ });
139
+ }
140
+ const ft = (e) => {
141
+ var t, i;
142
+ const a = new MutationObserver(mt);
143
+ !((t = window == null ? void 0 : window.ShadyDOM) === null || t === void 0) && t.inUse && e.mode && e.host && (e = e.host), (i = a.observe) === null || i === void 0 || i.call(a, e, { childList: !0 }), K.set(e, a);
144
+ };
145
+ T() && new MutationObserver(_);
146
+ const D = {
147
+ childList: !0,
148
+ subtree: !0
149
+ }, R = (e, t) => {
150
+ e.toggleAttribute("internals-disabled", t), t ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.formDisabledCallback && e.formDisabledCallback.apply(e, [t]);
151
+ }, X = (e) => {
152
+ m.get(e).forEach((i) => {
153
+ i.remove();
154
+ }), m.set(e, []);
155
+ }, Z = (e, t) => {
156
+ const i = document.createElement("input");
157
+ return i.type = "hidden", i.name = e.getAttribute("name"), e.after(i), m.get(t).push(i), i;
158
+ }, bt = (e, t) => {
159
+ var i;
160
+ m.set(t, []), (i = I.observe) === null || i === void 0 || i.call(I, e, Q);
161
+ }, tt = (e, t) => {
162
+ if (t.length) {
163
+ Array.from(t).forEach((a) => a.addEventListener("click", e.click.bind(e)));
164
+ let i = t[0].id;
165
+ t[0].id || (i = `${t[0].htmlFor}_Label`, t[0].id = i), e.setAttribute("aria-labelledby", i);
166
+ }
167
+ }, S = (e) => {
168
+ const t = Array.from(e.elements).filter((s) => !s.tagName.includes("-") && s.validity).map((s) => s.validity.valid), i = y.get(e) || [], a = Array.from(i).filter((s) => s.isConnected).map((s) => c.get(s).validity.valid), r = [...t, ...a].includes(!1);
169
+ e.toggleAttribute("internals-invalid", r), e.toggleAttribute("internals-valid", !r);
170
+ }, vt = (e) => {
171
+ S(V(e.target));
172
+ }, wt = (e) => {
173
+ S(V(e.target));
174
+ }, gt = (e) => {
175
+ const t = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((i) => `${i}:not([disabled])`).map((i) => `${i}:not([form])${e.id ? `,${i}[form='${e.id}']` : ""}`).join(",");
176
+ e.addEventListener("click", (i) => {
177
+ if (i.target.closest(t)) {
178
+ const r = y.get(e);
179
+ if (e.noValidate)
180
+ return;
181
+ r.size && Array.from(r).reverse().map((u) => c.get(u).reportValidity()).includes(!1) && i.preventDefault();
121
182
  }
122
- s.localName === "fieldset" && ((u = I.observe) === null || u === void 0 || u.call(I, s, Q), J(s, !0));
123
- }), o.forEach((s) => {
124
- const u = c.get(s);
125
- u && m.get(u) && X(u), P.has(s) && P.get(s).disconnect();
126
183
  });
127
- });
128
- }
129
- function ut(e) {
130
- e.forEach((t) => {
131
- const { removedNodes: i } = t;
132
- i.forEach((a) => {
133
- const r = K.get(t.target);
134
- c.has(a) && at(a), r.disconnect();
184
+ }, yt = (e) => {
185
+ const t = y.get(e.target);
186
+ t && t.size && t.forEach((i) => {
187
+ i.constructor.formAssociated && i.formResetCallback && i.formResetCallback.apply(i);
135
188
  });
136
- });
137
- }
138
- const pt = (e) => {
139
- var t, i;
140
- const a = new MutationObserver(ut);
141
- !((t = window == null ? void 0 : window.ShadyDOM) === null || t === void 0) && t.inUse && e.mode && e.host && (e = e.host), (i = a.observe) === null || i === void 0 || i.call(a, e, { childList: !0 }), K.set(e, a);
142
- };
143
- T() && new MutationObserver(_);
144
- const $ = {
145
- childList: !0,
146
- subtree: !0
147
- }, D = (e, t) => {
148
- e.toggleAttribute("internals-disabled", t), t ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.formDisabledCallback && e.formDisabledCallback.apply(e, [t]);
149
- }, X = (e) => {
150
- m.get(e).forEach((i) => {
151
- i.remove();
152
- }), m.set(e, []);
153
- }, Z = (e, t) => {
154
- const i = document.createElement("input");
155
- return i.type = "hidden", i.name = e.getAttribute("name"), e.after(i), m.get(t).push(i), i;
156
- }, mt = (e, t) => {
157
- var i;
158
- m.set(t, []), (i = I.observe) === null || i === void 0 || i.call(I, e, Q);
159
- }, tt = (e, t) => {
160
- if (t.length) {
161
- Array.from(t).forEach((a) => a.addEventListener("click", e.click.bind(e)));
162
- let i = t[0].id;
163
- t[0].id || (i = `${t[0].htmlFor}_Label`, t[0].id = i), e.setAttribute("aria-labelledby", i);
164
- }
165
- }, S = (e) => {
166
- const t = Array.from(e.elements).filter((o) => !o.tagName.includes("-") && o.validity).map((o) => o.validity.valid), i = y.get(e) || [], a = Array.from(i).filter((o) => o.isConnected).map((o) => c.get(o).validity.valid), r = [...t, ...a].includes(!1);
167
- e.toggleAttribute("internals-invalid", r), e.toggleAttribute("internals-valid", !r);
168
- }, ft = (e) => {
169
- S(V(e.target));
170
- }, bt = (e) => {
171
- S(V(e.target));
172
- }, vt = (e) => {
173
- const t = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((i) => `${i}:not([disabled])`).map((i) => `${i}:not([form])${e.id ? `,${i}[form='${e.id}']` : ""}`).join(",");
174
- e.addEventListener("click", (i) => {
175
- if (i.target.closest(t)) {
176
- const r = y.get(e);
177
- if (e.noValidate)
178
- return;
179
- r.size && Array.from(r).reverse().map((u) => c.get(u).reportValidity()).includes(!1) && i.preventDefault();
180
- }
181
- });
182
- }, wt = (e) => {
183
- const t = y.get(e.target);
184
- t && t.size && t.forEach((i) => {
185
- i.constructor.formAssociated && i.formResetCallback && i.formResetCallback.apply(i);
186
- });
187
- }, et = (e, t, i) => {
188
- if (t) {
189
- const a = y.get(t);
190
- if (a)
191
- a.add(e);
192
- else {
193
- const r = /* @__PURE__ */ new Set();
194
- r.add(e), y.set(t, r), vt(t), t.addEventListener("reset", wt), t.addEventListener("input", ft), t.addEventListener("change", bt);
195
- }
196
- k.set(t, { ref: e, internals: i }), e.constructor.formAssociated && e.formAssociatedCallback && setTimeout(() => {
197
- e.formAssociatedCallback.apply(e, [t]);
198
- }, 0), S(t);
199
- }
200
- }, V = (e) => {
201
- let t = e.parentNode;
202
- return t && t.tagName !== "FORM" && (t = V(t)), t;
203
- }, v = (e, t, i = DOMException) => {
204
- if (!e.constructor.formAssociated)
205
- throw new i(t);
206
- }, it = (e, t, i) => {
207
- const a = y.get(e);
208
- return a && a.size && a.forEach((r) => {
209
- c.get(r)[i]() || (t = !1);
210
- }), t;
211
- }, at = (e) => {
212
- if (e.constructor.formAssociated) {
213
- const t = c.get(e), { labels: i, form: a } = t;
214
- tt(e, i), et(e, a, t);
215
- }
216
- };
217
- function T() {
218
- return typeof MutationObserver < "u";
219
- }
220
- class gt {
221
- constructor() {
222
- this.badInput = !1, this.customError = !1, this.patternMismatch = !1, this.rangeOverflow = !1, this.rangeUnderflow = !1, this.stepMismatch = !1, this.tooLong = !1, this.tooShort = !1, this.typeMismatch = !1, this.valid = !0, this.valueMissing = !1, Object.seal(this);
223
- }
224
- }
225
- const yt = (e) => (e.badInput = !1, e.customError = !1, e.patternMismatch = !1, e.rangeOverflow = !1, e.rangeUnderflow = !1, e.stepMismatch = !1, e.tooLong = !1, e.tooShort = !1, e.typeMismatch = !1, e.valid = !0, e.valueMissing = !1, e), Et = (e, t, i) => (e.valid = kt(t), Object.keys(t).forEach((a) => e[a] = t[a]), i && S(i), e), kt = (e) => {
226
- let t = !0;
227
- for (let i in e)
228
- i !== "valid" && e[i] !== !1 && (t = !1);
229
- return t;
230
- }, R = /* @__PURE__ */ new WeakMap();
231
- function rt(e, t) {
232
- e.toggleAttribute(t, !0), e.part && e.part.add(t);
233
- }
234
- class H extends Set {
235
- static get isPolyfilled() {
236
- return !0;
237
- }
238
- constructor(t) {
239
- if (super(), !t || !t.tagName || t.tagName.indexOf("-") === -1)
240
- throw new TypeError("Illegal constructor");
241
- R.set(this, t);
242
- }
243
- add(t) {
244
- if (!/^--/.test(t) || typeof t != "string")
245
- throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);
246
- const i = super.add(t), a = R.get(this), r = `state${t}`;
247
- return a.isConnected ? rt(a, r) : setTimeout(() => {
248
- rt(a, r);
249
- }), i;
250
- }
251
- clear() {
252
- for (let [t] of this.entries())
253
- this.delete(t);
254
- super.clear();
255
- }
256
- delete(t) {
257
- const i = super.delete(t), a = R.get(this);
258
- return a.isConnected ? (a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`)) : setTimeout(() => {
259
- a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`);
260
- }), i;
261
- }
262
- }
263
- function ot(e, t, i, a) {
264
- if (typeof t == "function" ? e !== t || !a : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
265
- return i === "m" ? a : i === "a" ? a.call(e) : a ? a.value : t.get(e);
266
- }
267
- function Mt(e, t, i, a, r) {
268
- if (typeof t == "function" ? e !== t || !0 : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
269
- return t.set(e, i), i;
270
- }
271
- var x;
272
- class xt {
273
- constructor(t) {
274
- x.set(this, void 0), Mt(this, x, t);
275
- for (let i = 0; i < t.length; i++) {
276
- let a = t[i];
277
- this[i] = a, a.hasAttribute("name") && (this[a.getAttribute("name")] = a);
278
- }
279
- Object.freeze(this);
280
- }
281
- get length() {
282
- return ot(this, x, "f").length;
283
- }
284
- [(x = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
285
- return ot(this, x, "f")[Symbol.iterator]();
286
- }
287
- item(t) {
288
- return this[t] == null ? null : this[t];
289
- }
290
- namedItem(t) {
291
- return this[t] == null ? null : this[t];
292
- }
293
- }
294
- function At() {
295
- const e = HTMLFormElement.prototype.checkValidity;
296
- HTMLFormElement.prototype.checkValidity = i;
297
- const t = HTMLFormElement.prototype.reportValidity;
298
- HTMLFormElement.prototype.reportValidity = a;
299
- function i(...o) {
300
- let s = e.apply(this, o);
301
- return it(this, s, "checkValidity");
302
- }
303
- function a(...o) {
304
- let s = t.apply(this, o);
305
- return it(this, s, "reportValidity");
306
- }
307
- const { get: r } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
308
- Object.defineProperty(HTMLFormElement.prototype, "elements", {
309
- get(...o) {
310
- const s = r.call(this, ...o), u = Array.from(y.get(this) || []);
311
- if (u.length === 0)
312
- return s;
313
- const d = Array.from(s).concat(u).sort((w, b) => w.compareDocumentPosition ? w.compareDocumentPosition(b) & 2 ? 1 : -1 : 0);
314
- return new xt(d);
315
- }
316
- });
317
- }
318
- class st {
319
- static get isPolyfilled() {
320
- return !0;
321
- }
322
- constructor(t) {
323
- if (!t || !t.tagName || t.tagName.indexOf("-") === -1)
324
- throw new TypeError("Illegal constructor");
325
- const i = t.getRootNode(), a = new gt();
326
- this.states = new H(t), n.set(this, t), h.set(this, a), c.set(t, this), ht(t, this), mt(t, this), Object.seal(this), i instanceof DocumentFragment && pt(i);
327
- }
328
- checkValidity() {
329
- const t = n.get(this);
330
- if (v(t, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
331
- return !0;
332
- const i = h.get(this);
333
- if (!i.valid) {
334
- const a = new Event("invalid", {
335
- bubbles: !1,
336
- cancelable: !0,
337
- composed: !1
338
- });
339
- t.dispatchEvent(a);
189
+ }, et = (e, t, i) => {
190
+ if (t) {
191
+ const a = y.get(t);
192
+ if (a)
193
+ a.add(e);
194
+ else {
195
+ const r = /* @__PURE__ */ new Set();
196
+ r.add(e), y.set(t, r), gt(t), t.addEventListener("reset", yt), t.addEventListener("input", vt), t.addEventListener("change", wt);
197
+ }
198
+ k.set(t, { ref: e, internals: i }), e.constructor.formAssociated && e.formAssociatedCallback && setTimeout(() => {
199
+ e.formAssociatedCallback.apply(e, [t]);
200
+ }, 0), S(t);
340
201
  }
341
- return i.valid;
342
- }
343
- get form() {
344
- const t = n.get(this);
345
- v(t, "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");
346
- let i;
347
- return t.constructor.formAssociated === !0 && (i = V(t)), i;
202
+ }, V = (e) => {
203
+ let t = e.parentNode;
204
+ return t && t.tagName !== "FORM" && (t = V(t)), t;
205
+ }, v = (e, t, i = DOMException) => {
206
+ if (!e.constructor.formAssociated)
207
+ throw new i(t);
208
+ }, it = (e, t, i) => {
209
+ const a = y.get(e);
210
+ return a && a.size && a.forEach((r) => {
211
+ c.get(r)[i]() || (t = !1);
212
+ }), t;
213
+ }, at = (e) => {
214
+ if (e.constructor.formAssociated) {
215
+ const t = c.get(e), { labels: i, form: a } = t;
216
+ tt(e, i), et(e, a, t);
217
+ }
218
+ };
219
+ function T() {
220
+ return typeof MutationObserver < "u";
348
221
  }
349
- get labels() {
350
- const t = n.get(this);
351
- v(t, "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");
352
- const i = t.getAttribute("id"), a = t.getRootNode();
353
- return a && i ? a.querySelectorAll(`[for="${i}"]`) : [];
222
+ class Et {
223
+ constructor() {
224
+ this.badInput = !1, this.customError = !1, this.patternMismatch = !1, this.rangeOverflow = !1, this.rangeUnderflow = !1, this.stepMismatch = !1, this.tooLong = !1, this.tooShort = !1, this.typeMismatch = !1, this.valid = !0, this.valueMissing = !1, Object.seal(this);
225
+ }
354
226
  }
355
- reportValidity() {
356
- const t = n.get(this);
357
- if (v(t, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
227
+ const kt = (e) => (e.badInput = !1, e.customError = !1, e.patternMismatch = !1, e.rangeOverflow = !1, e.rangeUnderflow = !1, e.stepMismatch = !1, e.tooLong = !1, e.tooShort = !1, e.typeMismatch = !1, e.valid = !0, e.valueMissing = !1, e), Mt = (e, t, i) => (e.valid = xt(t), Object.keys(t).forEach((a) => e[a] = t[a]), i && S(i), e), xt = (e) => {
228
+ let t = !0;
229
+ for (let i in e)
230
+ i !== "valid" && e[i] !== !1 && (t = !1);
231
+ return t;
232
+ }, $ = /* @__PURE__ */ new WeakMap();
233
+ function rt(e, t) {
234
+ e.toggleAttribute(t, !0), e.part && e.part.add(t);
235
+ }
236
+ class H extends Set {
237
+ static get isPolyfilled() {
358
238
  return !0;
359
- const i = this.checkValidity(), a = j.get(this);
360
- if (a && !t.constructor.formAssociated)
361
- throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
362
- return !i && a && (t.focus(), a.focus()), i;
239
+ }
240
+ constructor(t) {
241
+ if (super(), !t || !t.tagName || t.tagName.indexOf("-") === -1)
242
+ throw new TypeError("Illegal constructor");
243
+ $.set(this, t);
244
+ }
245
+ add(t) {
246
+ if (!/^--/.test(t) || typeof t != "string")
247
+ throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);
248
+ const i = super.add(t), a = $.get(this), r = `state${t}`;
249
+ return a.isConnected ? rt(a, r) : setTimeout(() => {
250
+ rt(a, r);
251
+ }), i;
252
+ }
253
+ clear() {
254
+ for (let [t] of this.entries())
255
+ this.delete(t);
256
+ super.clear();
257
+ }
258
+ delete(t) {
259
+ const i = super.delete(t), a = $.get(this);
260
+ return a.isConnected ? (a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`)) : setTimeout(() => {
261
+ a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`);
262
+ }), i;
263
+ }
363
264
  }
364
- setFormValue(t) {
365
- const i = n.get(this);
366
- if (v(i, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), X(this), t != null && !(t instanceof FormData)) {
367
- if (i.getAttribute("name")) {
368
- const a = Z(i, this);
369
- a.value = t;
265
+ function st(e, t, i, a) {
266
+ if (typeof t == "function" ? e !== t || !a : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
267
+ return i === "m" ? a : i === "a" ? a.call(e) : a ? a.value : t.get(e);
268
+ }
269
+ function At(e, t, i, a, r) {
270
+ if (typeof t == "function" ? e !== t || !0 : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
271
+ return t.set(e, i), i;
272
+ }
273
+ var x;
274
+ class Ct {
275
+ constructor(t) {
276
+ x.set(this, void 0), At(this, x, t);
277
+ for (let i = 0; i < t.length; i++) {
278
+ let a = t[i];
279
+ this[i] = a, a.hasAttribute("name") && (this[a.getAttribute("name")] = a);
370
280
  }
371
- } else t != null && t instanceof FormData && Array.from(t).reverse().forEach(([a, r]) => {
372
- if (typeof r == "string") {
373
- const o = Z(i, this);
374
- o.name = a, o.value = r;
281
+ Object.freeze(this);
282
+ }
283
+ get length() {
284
+ return st(this, x, "f").length;
285
+ }
286
+ [(x = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
287
+ return st(this, x, "f")[Symbol.iterator]();
288
+ }
289
+ item(t) {
290
+ return this[t] == null ? null : this[t];
291
+ }
292
+ namedItem(t) {
293
+ return this[t] == null ? null : this[t];
294
+ }
295
+ }
296
+ function Ft() {
297
+ const e = HTMLFormElement.prototype.checkValidity;
298
+ HTMLFormElement.prototype.checkValidity = i;
299
+ const t = HTMLFormElement.prototype.reportValidity;
300
+ HTMLFormElement.prototype.reportValidity = a;
301
+ function i(...s) {
302
+ let o = e.apply(this, s);
303
+ return it(this, o, "checkValidity");
304
+ }
305
+ function a(...s) {
306
+ let o = t.apply(this, s);
307
+ return it(this, o, "reportValidity");
308
+ }
309
+ const { get: r } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
310
+ Object.defineProperty(HTMLFormElement.prototype, "elements", {
311
+ get(...s) {
312
+ const o = r.call(this, ...s), u = Array.from(y.get(this) || []);
313
+ if (u.length === 0)
314
+ return o;
315
+ const d = Array.from(o).concat(u).sort((w, b) => w.compareDocumentPosition ? w.compareDocumentPosition(b) & 2 ? 1 : -1 : 0);
316
+ return new Ct(d);
375
317
  }
376
318
  });
377
- B.set(i, t);
378
- }
379
- setValidity(t, i, a) {
380
- const r = n.get(this);
381
- if (v(r, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
382
- throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
383
- j.set(this, a);
384
- const o = h.get(this), s = {};
385
- for (const w in t)
386
- s[w] = t[w];
387
- Object.keys(s).length === 0 && yt(o);
388
- const u = Object.assign(Object.assign({}, o), s);
389
- delete u.valid;
390
- const { valid: d } = Et(o, u, this.form);
391
- if (!d && !i)
392
- throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");
393
- g.set(this, d ? "" : i), r.isConnected ? (r.toggleAttribute("internals-invalid", !d), r.toggleAttribute("internals-valid", d), r.setAttribute("aria-invalid", `${!d}`)) : C.set(r, this);
394
- }
395
- get shadowRoot() {
396
- const t = n.get(this), i = U.get(t);
397
- return i || null;
398
- }
399
- get validationMessage() {
400
- const t = n.get(this);
401
- return v(t, "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."), g.get(this);
402
319
  }
403
- get validity() {
404
- const t = n.get(this);
405
- return v(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), h.get(this);
406
- }
407
- get willValidate() {
408
- const t = n.get(this);
409
- return v(t, "Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."), !(t.disabled || t.hasAttribute("disabled") || t.hasAttribute("readonly"));
410
- }
411
- }
412
- function Ct() {
413
- if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals)
414
- return !1;
415
- class e extends HTMLElement {
416
- constructor() {
417
- super(), this.internals = this.attachInternals();
320
+ class ot {
321
+ static get isPolyfilled() {
322
+ return !0;
418
323
  }
419
- }
420
- const t = `element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g, "")}`;
421
- customElements.define(t, e);
422
- const i = new e();
423
- return [
424
- "shadowRoot",
425
- "form",
426
- "willValidate",
427
- "validity",
428
- "validationMessage",
429
- "labels",
430
- "setFormValue",
431
- "setValidity",
432
- "checkValidity",
433
- "reportValidity"
434
- ].every((a) => a in i.internals);
435
- }
436
- let nt = !1, lt = !1;
437
- function W(e) {
438
- lt || (lt = !0, window.CustomStateSet = H, e && (HTMLElement.prototype.attachInternals = function(...t) {
439
- const i = e.call(this, t);
440
- return i.states = new H(this), i;
441
- }));
442
- }
443
- function ct(e = !0) {
444
- if (!nt) {
445
- if (nt = !0, typeof window < "u" && (window.ElementInternals = st), typeof CustomElementRegistry < "u") {
446
- const t = CustomElementRegistry.prototype.define;
447
- CustomElementRegistry.prototype.define = function(i, a, r) {
448
- if (a.formAssociated) {
449
- const o = a.prototype.connectedCallback;
450
- a.prototype.connectedCallback = function() {
451
- G.has(this) || (G.set(this, !0), this.hasAttribute("disabled") && D(this, !0)), o != null && o.apply(this), at(this);
452
- };
324
+ constructor(t) {
325
+ if (!t || !t.tagName || t.tagName.indexOf("-") === -1)
326
+ throw new TypeError("Illegal constructor");
327
+ const i = t.getRootNode(), a = new Et();
328
+ this.states = new H(t), n.set(this, t), h.set(this, a), c.set(t, this), pt(t, this), bt(t, this), Object.seal(this), i instanceof DocumentFragment && ft(i);
329
+ }
330
+ checkValidity() {
331
+ const t = n.get(this);
332
+ if (v(t, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
333
+ return !0;
334
+ const i = h.get(this);
335
+ if (!i.valid) {
336
+ const a = new Event("invalid", {
337
+ bubbles: !1,
338
+ cancelable: !0,
339
+ composed: !1
340
+ });
341
+ t.dispatchEvent(a);
342
+ }
343
+ return i.valid;
344
+ }
345
+ get form() {
346
+ const t = n.get(this);
347
+ v(t, "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");
348
+ let i;
349
+ return t.constructor.formAssociated === !0 && (i = V(t)), i;
350
+ }
351
+ get labels() {
352
+ const t = n.get(this);
353
+ v(t, "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");
354
+ const i = t.getAttribute("id"), a = t.getRootNode();
355
+ return a && i ? a.querySelectorAll(`[for="${i}"]`) : [];
356
+ }
357
+ reportValidity() {
358
+ const t = n.get(this);
359
+ if (v(t, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
360
+ return !0;
361
+ const i = this.checkValidity(), a = j.get(this);
362
+ if (a && !t.constructor.formAssociated)
363
+ throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
364
+ return !i && a && (t.focus(), a.focus()), i;
365
+ }
366
+ setFormValue(t) {
367
+ const i = n.get(this);
368
+ if (v(i, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), X(this), t != null && !(t instanceof FormData)) {
369
+ if (i.getAttribute("name")) {
370
+ const a = Z(i, this);
371
+ a.value = t;
453
372
  }
454
- t.call(this, i, a, r);
455
- };
456
- }
457
- if (typeof HTMLElement < "u" && (HTMLElement.prototype.attachInternals = function() {
458
- if (this.tagName) {
459
- if (this.tagName.indexOf("-") === -1)
460
- throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.");
461
- } else return {};
462
- if (c.has(this))
463
- throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
464
- return new st(this);
465
- }), typeof Element < "u") {
466
- let t = function(...a) {
467
- const r = i.apply(this, a);
468
- if (U.set(this, r), T()) {
469
- const o = new MutationObserver(_);
470
- window.ShadyDOM ? o.observe(this, $) : o.observe(r, $), P.set(this, o);
373
+ } else t != null && t instanceof FormData && Array.from(t).reverse().forEach(([a, r]) => {
374
+ if (typeof r == "string") {
375
+ const s = Z(i, this);
376
+ s.name = a, s.value = r;
471
377
  }
472
- return r;
473
- };
474
- const i = Element.prototype.attachShadow;
475
- Element.prototype.attachShadow = t;
378
+ });
379
+ B.set(i, t);
380
+ }
381
+ setValidity(t, i, a) {
382
+ const r = n.get(this);
383
+ if (v(r, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
384
+ throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
385
+ j.set(this, a);
386
+ const s = h.get(this), o = {};
387
+ for (const w in t)
388
+ o[w] = t[w];
389
+ Object.keys(o).length === 0 && kt(s);
390
+ const u = Object.assign(Object.assign({}, s), o);
391
+ delete u.valid;
392
+ const { valid: d } = Mt(s, u, this.form);
393
+ if (!d && !i)
394
+ throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");
395
+ g.set(this, d ? "" : i), r.isConnected ? (r.toggleAttribute("internals-invalid", !d), r.toggleAttribute("internals-valid", d), r.setAttribute("aria-invalid", `${!d}`)) : C.set(r, this);
396
+ }
397
+ get shadowRoot() {
398
+ const t = n.get(this), i = U.get(t);
399
+ return i || null;
400
+ }
401
+ get validationMessage() {
402
+ const t = n.get(this);
403
+ return v(t, "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."), g.get(this);
404
+ }
405
+ get validity() {
406
+ const t = n.get(this);
407
+ return v(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), h.get(this);
408
+ }
409
+ get willValidate() {
410
+ const t = n.get(this);
411
+ return v(t, "Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."), !(t.disabled || t.hasAttribute("disabled") || t.hasAttribute("readonly"));
412
+ }
413
+ }
414
+ function It() {
415
+ if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals)
416
+ return !1;
417
+ class e extends HTMLElement {
418
+ constructor() {
419
+ super(), this.internals = this.attachInternals();
420
+ }
421
+ }
422
+ const t = `element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g, "")}`;
423
+ customElements.define(t, e);
424
+ const i = new e();
425
+ return [
426
+ "shadowRoot",
427
+ "form",
428
+ "willValidate",
429
+ "validity",
430
+ "validationMessage",
431
+ "labels",
432
+ "setFormValue",
433
+ "setValidity",
434
+ "checkValidity",
435
+ "reportValidity"
436
+ ].every((a) => a in i.internals);
437
+ }
438
+ let nt = !1, lt = !1;
439
+ function W(e) {
440
+ lt || (lt = !0, window.CustomStateSet = H, e && (HTMLElement.prototype.attachInternals = function(...t) {
441
+ const i = e.call(this, t);
442
+ return i.states = new H(this), i;
443
+ }));
444
+ }
445
+ function ct(e = !0) {
446
+ if (!nt) {
447
+ if (nt = !0, typeof window < "u" && (window.ElementInternals = ot), typeof CustomElementRegistry < "u") {
448
+ const t = CustomElementRegistry.prototype.define;
449
+ CustomElementRegistry.prototype.define = function(i, a, r) {
450
+ if (a.formAssociated) {
451
+ const s = a.prototype.connectedCallback;
452
+ a.prototype.connectedCallback = function() {
453
+ G.has(this) || (G.set(this, !0), this.hasAttribute("disabled") && R(this, !0)), s != null && s.apply(this), at(this);
454
+ };
455
+ }
456
+ t.call(this, i, a, r);
457
+ };
458
+ }
459
+ if (typeof HTMLElement < "u" && (HTMLElement.prototype.attachInternals = function() {
460
+ if (this.tagName) {
461
+ if (this.tagName.indexOf("-") === -1)
462
+ throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.");
463
+ } else return {};
464
+ if (c.has(this))
465
+ throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
466
+ return new ot(this);
467
+ }), typeof Element < "u") {
468
+ let t = function(...a) {
469
+ const r = i.apply(this, a);
470
+ if (U.set(this, r), T()) {
471
+ const s = new MutationObserver(_);
472
+ window.ShadyDOM ? s.observe(this, D) : s.observe(r, D), P.set(this, s);
473
+ }
474
+ return r;
475
+ };
476
+ const i = Element.prototype.attachShadow;
477
+ Element.prototype.attachShadow = t;
478
+ }
479
+ T() && typeof document < "u" && new MutationObserver(_).observe(document.documentElement, D), typeof HTMLFormElement < "u" && Ft(), (e || typeof window < "u" && !window.CustomStateSet) && W();
476
480
  }
477
- T() && typeof document < "u" && new MutationObserver(_).observe(document.documentElement, $), typeof HTMLFormElement < "u" && At(), (e || typeof window < "u" && !window.CustomStateSet) && W();
478
481
  }
479
- }
480
- return !!customElements.polyfillWrapFlushCallback || (Ct() ? typeof window < "u" && !window.CustomStateSet && W(HTMLElement.prototype.attachInternals) : ct(!1)), l.forceCustomStateSetPolyfill = W, l.forceElementInternalsPolyfill = ct, Object.defineProperty(l, "__esModule", { value: !0 }), l;
481
- })({});
482
- })();
483
- const $t = "*,*:after,*:before{box-sizing:inherit}:host{display:block}*,*:before,*:after{cursor:inherit}.c-switch-wrapper{display:inline-flex;align-items:center;gap:var(--dt-spacing-b);vertical-align:top;font-family:var(--dt-font-body-l-family);cursor:pointer}.c-switch-wrapper[disabled]{cursor:not-allowed}.c-switch{--int-states-mixin-bg-color: var(--dt-color-interactive-form);--switch-bg-color--checked: var(--dt-color-interactive-brand);--switch-bg-color--disabled: var(--dt-color-disabled-01);--switch-width: 48px;--switch-height: 24px;--switch-control-size: 20px;--switch-padding: 2px;--switch-radius: var(--dt-radius-rounded-e);--switch-translation: calc(var(--switch-width) - var(--switch-control-size) - 2 * var(--switch-padding));position:relative;display:flex;width:var(--switch-width);height:var(--switch-height);flex-shrink:0;padding:var(--switch-padding);border-radius:var(--switch-radius);background-color:var(--int-states-mixin-bg-color)}.c-switch:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-form-h), var(--dt-color-interactive-form-s), calc(var(--dt-color-interactive-form-l) + var(--hover-modifier)))}.c-switch:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch.is-loading:not(:disabled,.is-disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-form-h), var(--dt-color-interactive-form-s), calc(var(--dt-color-interactive-form-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-switch:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-interactive-form))}.c-switch:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch.is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), var(--dt-color-interactive-form))}}.c-switch[checked]{--int-states-mixin-bg-color: var(--dt-color-interactive-brand)}.c-switch[checked]:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--hover-modifier)))}.c-switch[checked]:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch[checked].is-loading:not(:disabled,.is-disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-switch[checked]:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-interactive-brand))}.c-switch[checked]:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch[checked].is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), var(--dt-color-interactive-brand))}}[disabled] .c-switch{--int-states-mixin-bg-color: var(--switch-bg-color--disabled);pointer-events:none}.c-switch:has(.c-switch-input:focus-visible){box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-switch-input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0;left:50%;transform:translate(-50%) translateY(-50%);bottom:0}.c-switch-input:disabled{background-color:transparent}.c-switch-control{position:absolute;left:2px;width:var(--switch-control-size);height:var(--switch-control-size);border-radius:var(--switch-radius);background-color:var(--dt-color-interactive-light);padding:var(--switch-padding)}.c-switch-wrapper:dir(rtl) .c-switch-control{position:absolute;left:initial;right:2px}.c-switch-control .c-pieIcon--check{vertical-align:top}.c-switch-input:checked+.c-switch-control{transform:translate(var(--switch-translation))}.c-switch-input:checked+.c-switch-control .c-pieIcon--check{color:var(--dt-color-interactive-brand)}.c-switch-input:disabled~.c-switch-control{color:var(--switch-bg-color--disabled)}.c-switch-input:disabled~.c-switch-control .c-pieIcon--check{color:var(--switch-bg-color--disabled)}.c-switch-label{color:var(--dt-color-content-default-solid)}.c-switch-description{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--allow-animation .c-switch{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--allow-animation .c-switch[checked]{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--allow-animation .c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-wrapper--allow-animation .c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-wrapper--allow-animation .c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-input:disabled~.c-switch-wrapper--allow-animation .c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-wrapper:dir(rtl) .c-switch-input:checked+.c-switch-control{transform:translate(calc(-1 * var(--switch-translation)))}", Dt = ["leading", "trailing"], Yt = "change", M = {
482
+ return !!customElements.polyfillWrapFlushCallback || (It() ? typeof window < "u" && !window.CustomStateSet && W(HTMLElement.prototype.attachInternals) : ct(!1)), l.forceCustomStateSetPolyfill = W, l.forceElementInternalsPolyfill = ct, Object.defineProperty(l, "__esModule", { value: !0 }), l;
483
+ })({});
484
+ }()), dt;
485
+ }
486
+ $t();
487
+ const Ht = "*,*:after,*:before{box-sizing:inherit}:host{display:block}*,*:before,*:after{cursor:inherit}.c-switch-wrapper{display:inline-flex;align-items:center;gap:var(--dt-spacing-b);vertical-align:top;font-family:var(--dt-font-body-l-family);cursor:pointer}.c-switch-wrapper[disabled]{cursor:not-allowed}.c-switch{--int-states-mixin-bg-color: var(--dt-color-interactive-form);--switch-bg-color--checked: var(--dt-color-interactive-brand);--switch-bg-color--disabled: var(--dt-color-disabled-01);--switch-width: 48px;--switch-height: 24px;--switch-control-size: 20px;--switch-padding: 2px;--switch-radius: var(--dt-radius-rounded-e);--switch-translation: calc(var(--switch-width) - var(--switch-control-size) - 2 * var(--switch-padding));position:relative;display:flex;width:var(--switch-width);height:var(--switch-height);flex-shrink:0;padding:var(--switch-padding);border-radius:var(--switch-radius);background-color:var(--int-states-mixin-bg-color)}.c-switch:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-form-h), var(--dt-color-interactive-form-s), calc(var(--dt-color-interactive-form-l) + var(--hover-modifier)))}.c-switch:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch.is-loading:not(:disabled,.is-disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-form-h), var(--dt-color-interactive-form-s), calc(var(--dt-color-interactive-form-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-switch:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-interactive-form))}.c-switch:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch.is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), var(--dt-color-interactive-form))}}.c-switch[checked]{--int-states-mixin-bg-color: var(--dt-color-interactive-brand)}.c-switch[checked]:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--hover-modifier)))}.c-switch[checked]:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch[checked].is-loading:not(:disabled,.is-disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--int-states-mixin-bg-color: hsl(var(--dt-color-interactive-brand-h), var(--dt-color-interactive-brand-s), calc(var(--dt-color-interactive-brand-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-switch[checked]:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-interactive-brand))}.c-switch[checked]:active:not(:disabled,.is-disabled,.is-dismissible),.c-switch[checked].is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), var(--dt-color-interactive-brand))}}[disabled] .c-switch{--int-states-mixin-bg-color: var(--switch-bg-color--disabled);pointer-events:none}.c-switch:has(.c-switch-input:focus-visible){box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-switch-input{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0;left:50%;transform:translate(-50%) translateY(-50%);bottom:0}.c-switch-input:disabled{background-color:transparent}.c-switch-control{position:absolute;left:2px;width:var(--switch-control-size);height:var(--switch-control-size);border-radius:var(--switch-radius);background-color:var(--dt-color-interactive-light);padding:var(--switch-padding)}.c-switch-wrapper:dir(rtl) .c-switch-control{position:absolute;left:initial;right:2px}.c-switch-control .c-pieIcon--check{vertical-align:top}.c-switch-input:checked+.c-switch-control{transform:translate(var(--switch-translation))}.c-switch-input:checked+.c-switch-control .c-pieIcon--check{color:var(--dt-color-interactive-brand)}.c-switch-input:disabled~.c-switch-control{color:var(--switch-bg-color--disabled)}.c-switch-input:disabled~.c-switch-control .c-pieIcon--check{color:var(--switch-bg-color--disabled)}.c-switch-label{color:var(--dt-color-content-default-solid)}.c-switch-description{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--allow-animation .c-switch{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--allow-animation .c-switch[checked]{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--allow-animation .c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-wrapper--allow-animation .c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-wrapper--allow-animation .c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}@media (prefers-reduced-motion: no-preference){.c-switch-input:disabled~.c-switch-wrapper--allow-animation .c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-wrapper:dir(rtl) .c-switch-input:checked+.c-switch-control{transform:translate(calc(-1 * var(--switch-translation)))}", Wt = ["leading", "trailing"], Xt = "change", M = {
484
488
  checked: !1,
485
489
  disabled: !1,
486
490
  labelPlacement: "leading",
487
491
  required: !1,
488
492
  value: "on"
489
493
  };
490
- var Rt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, f = (l, n, h, m) => {
491
- for (var c = m > 1 ? void 0 : m ? Ht(n, h) : n, g = l.length - 1, k; g >= 0; g--)
494
+ var zt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, f = (l, n, h, m) => {
495
+ for (var c = m > 1 ? void 0 : m ? qt(n, h) : n, g = l.length - 1, k; g >= 0; g--)
492
496
  (k = l[g]) && (c = (m ? k(n, h, c) : k(c)) || c);
493
- return m && c && Rt(n, h, c), c;
497
+ return m && c && zt(n, h, c), c;
494
498
  };
495
- const Wt = "pie-switch";
496
- let p = class extends Lt(Nt(q)) {
499
+ const Bt = "pie-switch";
500
+ let p = class extends Ot(Pt(q)) {
497
501
  constructor() {
498
502
  super(...arguments), this.labelPlacement = M.labelPlacement, this.checked = M.checked, this.required = M.required, this.value = M.value, this.disabled = M.disabled, this._isAnimationAllowed = !1;
499
503
  }
@@ -518,7 +522,7 @@ let p = class extends Lt(Nt(q)) {
518
522
  handleChange(l) {
519
523
  const { checked: n } = l == null ? void 0 : l.currentTarget;
520
524
  this.checked = n;
521
- const h = Ot(l);
525
+ const h = _t(l);
522
526
  this._isAnimationAllowed || (this._isAnimationAllowed = !0), this.dispatchEvent(h), this.handleFormAssociation();
523
527
  }
524
528
  /**
@@ -597,7 +601,7 @@ let p = class extends Lt(Nt(q)) {
597
601
  } = this;
598
602
  return N`
599
603
  <label
600
- class="${Vt({
604
+ class="${Lt({
601
605
  "c-switch-wrapper": !0,
602
606
  "c-switch-wrapper--allow-animation": g
603
607
  })}"
@@ -616,7 +620,7 @@ let p = class extends Lt(Nt(q)) {
616
620
  .checked="${h}"
617
621
  .disabled="${m}"
618
622
  @change="${this.handleChange}"
619
- aria-label="${Tt((n == null ? void 0 : n.label) || l)}"
623
+ aria-label="${Nt((n == null ? void 0 : n.label) || l)}"
620
624
  aria-describedby="${n != null && n.describedBy ? "switch-description" : L}">
621
625
  <div class="c-switch-control">
622
626
  ${h ? N`<icon-check></icon-check>` : L}
@@ -627,13 +631,13 @@ let p = class extends Lt(Nt(q)) {
627
631
  </label>`;
628
632
  }
629
633
  };
630
- p.styles = It($t);
634
+ p.styles = Vt(Ht);
631
635
  f([
632
636
  E({ type: String })
633
637
  ], p.prototype, "label", 2);
634
638
  f([
635
639
  E({ type: String }),
636
- Pt(Wt, Dt, M.labelPlacement)
640
+ Dt(Bt, Wt, M.labelPlacement)
637
641
  ], p.prototype, "labelPlacement", 2);
638
642
  f([
639
643
  E({ type: Object })
@@ -654,20 +658,20 @@ f([
654
658
  E({ type: Boolean, reflect: !0 })
655
659
  ], p.prototype, "disabled", 2);
656
660
  f([
657
- dt('input[type="checkbox"]')
661
+ ut('input[type="checkbox"]')
658
662
  ], p.prototype, "input", 2);
659
663
  f([
660
- dt("label")
664
+ ut("label")
661
665
  ], p.prototype, "focusTarget", 2);
662
666
  f([
663
- St()
667
+ Tt()
664
668
  ], p.prototype, "_isAnimationAllowed", 2);
665
669
  p = f([
666
- _t("pie-switch")
670
+ Rt("pie-switch")
667
671
  ], p);
668
672
  export {
669
- Yt as ON_SWITCH_CHANGED_EVENT,
673
+ Xt as ON_SWITCH_CHANGED_EVENT,
670
674
  p as PieSwitch,
671
675
  M as defaultProps,
672
- Dt as labelPlacements
676
+ Wt as labelPlacements
673
677
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-switch",
3
3
  "description": "PIE Design System Switch built using Web Components",
4
- "version": "2.3.23",
4
+ "version": "2.3.25",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/justeattakeaway/pie",
@@ -45,14 +45,14 @@
45
45
  "devDependencies": {
46
46
  "@custom-elements-manifest/analyzer": "0.9.0",
47
47
  "@justeattakeaway/pie-components-config": "0.21.0",
48
- "@justeattakeaway/pie-css": "1.0.0",
49
- "@justeattakeaway/pie-monorepo-utils": "0.7.0",
48
+ "@justeattakeaway/pie-css": "1.1.0",
49
+ "@justeattakeaway/pie-monorepo-utils": "0.9.0",
50
50
  "@justeattakeaway/pie-wrapper-react": "0.14.4",
51
51
  "cem-plugin-module-file-extensions": "0.0.5"
52
52
  },
53
53
  "dependencies": {
54
- "@justeattakeaway/pie-icons-webc": "1.21.2",
55
- "@justeattakeaway/pie-webc-core": "13.0.0",
54
+ "@justeattakeaway/pie-icons-webc": "1.21.4",
55
+ "@justeattakeaway/pie-webc-core": "14.0.1",
56
56
  "element-internals-polyfill": "1.3.11"
57
57
  },
58
58
  "volta": {