@justeattakeaway/pie-switch 1.2.2 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -326,8 +326,8 @@
326
326
  }
327
327
  ],
328
328
  "superclass": {
329
- "name": "LitElement",
330
- "package": "lit"
329
+ "name": "PieElement",
330
+ "package": "@justeattakeaway/pie-webc-core/src/internals/PieElement"
331
331
  },
332
332
  "tagName": "pie-switch",
333
333
  "customElement": true
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
2
  import type { CSSResult } from 'lit';
3
3
  import type { FormControlInterface } from '@justeattakeaway/pie-webc-core';
4
4
  import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
5
- import type { LitElement } from 'lit';
5
+ import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
6
6
  import type { PIEInputElement } from '@justeattakeaway/pie-webc-core';
7
7
  import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
8
8
  import type { TemplateResult } from 'lit-html';
@@ -91,7 +91,7 @@ export declare class PieSwitch extends PieSwitch_base implements SwitchProps, PI
91
91
  render(): TemplateResult<1>;
92
92
  }
93
93
 
94
- declare const PieSwitch_base: GenericConstructor<FormControlInterface> & GenericConstructor<RTLInterface> & typeof LitElement;
94
+ declare const PieSwitch_base: GenericConstructor<FormControlInterface> & GenericConstructor<RTLInterface> & typeof PieElement;
95
95
 
96
96
  export declare interface SwitchProps {
97
97
  /**
package/dist/index.js CHANGED
@@ -1,12 +1,25 @@
1
- import { LitElement as Fe, unsafeCSS as Ie, nothing as L, html as N } from "lit";
2
- import { property as y, query as ce } from "lit/decorators.js";
3
- import { classMap as Ve } from "lit/directives/class-map.js";
4
- import { ifDefined as Se } from "lit/directives/if-defined.js";
5
- import { FormControlMixin as Te, RtlMixin as Le, wrapNativeEvent as Ne, validPropertyValues as Oe, defineCustomElement as Pe } from "@justeattakeaway/pie-webc-core";
1
+ import { LitElement as It, unsafeCSS as Vt, nothing as L, html as N } from "lit";
2
+ import { property as y, query as ct } from "lit/decorators.js";
3
+ import { classMap as St } from "lit/directives/class-map.js";
4
+ import { ifDefined as Tt } from "lit/directives/if-defined.js";
5
+ import { FormControlMixin as Lt, RtlMixin as Nt, wrapNativeEvent as Ot, validPropertyValues as Pt, defineCustomElement as _t } from "@justeattakeaway/pie-webc-core";
6
6
  import "@justeattakeaway/pie-icons-webc/dist/IconCheck.js";
7
+ var $t = Object.defineProperty, Rt = (f, s, c, h) => {
8
+ for (var l = void 0, m = f.length - 1, E; m >= 0; m--)
9
+ (E = f[m]) && (l = E(s, c, l) || l);
10
+ return l && $t(s, c, l), l;
11
+ };
12
+ class dt extends It {
13
+ constructor() {
14
+ super(...arguments), this.v = "1.3.1";
15
+ }
16
+ }
17
+ Rt([
18
+ y({ type: String, reflect: !0 })
19
+ ], dt.prototype, "v");
7
20
  (function() {
8
- (function(E) {
9
- const o = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), F = {
21
+ (function(f) {
22
+ const s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), F = {
10
23
  ariaAtomic: "aria-atomic",
11
24
  ariaAutoComplete: "aria-autocomplete",
12
25
  ariaBusy: "aria-busy",
@@ -49,371 +62,370 @@ import "@justeattakeaway/pie-icons-webc/dist/IconCheck.js";
49
62
  ariaValueNow: "aria-valuenow",
50
63
  ariaValueText: "aria-valuetext",
51
64
  role: "role"
52
- }, he = (t, e) => {
65
+ }, ut = (e, t) => {
53
66
  for (let i in F) {
54
- e[i] = null;
67
+ t[i] = null;
55
68
  let a = null;
56
69
  const r = F[i];
57
- Object.defineProperty(e, i, {
70
+ Object.defineProperty(t, i, {
58
71
  get() {
59
72
  return a;
60
73
  },
61
- set(s) {
62
- a = s, t.isConnected ? t.setAttribute(r, s) : C.set(t, e);
74
+ set(o) {
75
+ a = o, e.isConnected ? e.setAttribute(r, o) : C.set(e, t);
63
76
  }
64
77
  });
65
78
  }
66
79
  };
67
- function G(t) {
68
- const e = l.get(t), { form: i } = e;
69
- ee(t, i, e), Z(t, e.labels);
80
+ function G(e) {
81
+ const t = l.get(e), { form: i } = t;
82
+ tt(e, i, t), Z(e, t.labels);
70
83
  }
71
- const Y = (t, e = !1) => {
72
- const i = document.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, {
73
- acceptNode(s) {
74
- return l.has(s) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
84
+ const Y = (e, t = !1) => {
85
+ const i = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
86
+ acceptNode(o) {
87
+ return l.has(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
75
88
  }
76
89
  });
77
90
  let a = i.nextNode();
78
- const r = !e || t.disabled;
91
+ const r = !t || e.disabled;
79
92
  for (; a; )
80
- a.formDisabledCallback && r && $(a, t.disabled), a = i.nextNode();
81
- }, J = { attributes: !0, attributeFilter: ["disabled", "name"] }, I = T() ? new MutationObserver((t) => {
82
- for (const e of t) {
83
- const i = e.target;
84
- if (e.attributeName === "disabled" && (i.constructor.formAssociated ? $(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && Y(i)), e.attributeName === "name" && i.constructor.formAssociated) {
93
+ a.formDisabledCallback && r && $(a, e.disabled), a = i.nextNode();
94
+ }, J = { attributes: !0, attributeFilter: ["disabled", "name"] }, I = T() ? new MutationObserver((e) => {
95
+ for (const t of e) {
96
+ const i = t.target;
97
+ if (t.attributeName === "disabled" && (i.constructor.formAssociated ? $(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && Y(i)), t.attributeName === "name" && i.constructor.formAssociated) {
85
98
  const a = l.get(i), r = q.get(i);
86
99
  a.setFormValue(r);
87
100
  }
88
101
  }
89
102
  }) : {};
90
- function P(t) {
91
- t.forEach((e) => {
92
- const { addedNodes: i, removedNodes: a } = e, r = Array.from(i), s = Array.from(a);
103
+ function P(e) {
104
+ e.forEach((t) => {
105
+ const { addedNodes: i, removedNodes: a } = t, r = Array.from(i), o = Array.from(a);
93
106
  r.forEach((n) => {
94
- var h;
107
+ var u;
95
108
  if (l.has(n) && n.constructor.formAssociated && G(n), C.has(n)) {
96
- const c = C.get(n);
97
- Object.keys(F).filter((m) => c[m] !== null).forEach((m) => {
98
- n.setAttribute(F[m], c[m]);
109
+ const d = C.get(n);
110
+ Object.keys(F).filter((b) => d[b] !== null).forEach((b) => {
111
+ n.setAttribute(F[b], d[b]);
99
112
  }), C.delete(n);
100
113
  }
101
114
  if (A.has(n)) {
102
- const c = A.get(n);
103
- n.setAttribute("internals-valid", c.validity.valid.toString()), n.setAttribute("internals-invalid", (!c.validity.valid).toString()), n.setAttribute("aria-invalid", (!c.validity.valid).toString()), A.delete(n);
115
+ const d = A.get(n);
116
+ n.setAttribute("internals-valid", d.validity.valid.toString()), n.setAttribute("internals-invalid", (!d.validity.valid).toString()), n.setAttribute("aria-invalid", (!d.validity.valid).toString()), A.delete(n);
104
117
  }
105
118
  if (n.localName === "form") {
106
- const c = g.get(n), v = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, {
119
+ const d = k.get(n), g = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, {
107
120
  acceptNode(W) {
108
- return l.has(W) && W.constructor.formAssociated && !(c && c.has(W)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
121
+ return l.has(W) && W.constructor.formAssociated && !(d && d.has(W)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
109
122
  }
110
123
  });
111
- let m = v.nextNode();
112
- for (; m; )
113
- G(m), m = v.nextNode();
124
+ let b = g.nextNode();
125
+ for (; b; )
126
+ G(b), b = g.nextNode();
114
127
  }
115
- n.localName === "fieldset" && ((h = I.observe) === null || h === void 0 || h.call(I, n, J), Y(n, !0));
116
- }), s.forEach((n) => {
117
- const h = l.get(n);
118
- h && u.get(h) && Q(h), O.has(n) && O.get(n).disconnect();
128
+ n.localName === "fieldset" && ((u = I.observe) === null || u === void 0 || u.call(I, n, J), Y(n, !0));
129
+ }), o.forEach((n) => {
130
+ const u = l.get(n);
131
+ u && h.get(u) && Q(u), O.has(n) && O.get(n).disconnect();
119
132
  });
120
133
  });
121
134
  }
122
- function ue(t) {
123
- t.forEach((e) => {
124
- const { removedNodes: i } = e;
135
+ function pt(e) {
136
+ e.forEach((t) => {
137
+ const { removedNodes: i } = t;
125
138
  i.forEach((a) => {
126
- const r = j.get(e.target);
127
- l.has(a) && ie(a), r.disconnect();
139
+ const r = j.get(t.target);
140
+ l.has(a) && it(a), r.disconnect();
128
141
  });
129
142
  });
130
143
  }
131
- const pe = (t) => {
132
- var e, i;
133
- const a = new MutationObserver(ue);
134
- !((e = window == null ? void 0 : window.ShadyDOM) === null || e === void 0) && e.inUse && t.mode && t.host && (t = t.host), (i = a.observe) === null || i === void 0 || i.call(a, t, { childList: !0 }), j.set(t, a);
144
+ const mt = (e) => {
145
+ var t, i;
146
+ const a = new MutationObserver(pt);
147
+ !((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 }), j.set(e, a);
135
148
  };
136
149
  T() && new MutationObserver(P);
137
150
  const _ = {
138
151
  childList: !0,
139
152
  subtree: !0
140
- }, $ = (t, e) => {
141
- t.toggleAttribute("internals-disabled", e), e ? t.setAttribute("aria-disabled", "true") : t.removeAttribute("aria-disabled"), t.formDisabledCallback && t.formDisabledCallback.apply(t, [e]);
142
- }, Q = (t) => {
143
- u.get(t).forEach((i) => {
153
+ }, $ = (e, t) => {
154
+ e.toggleAttribute("internals-disabled", t), t ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.formDisabledCallback && e.formDisabledCallback.apply(e, [t]);
155
+ }, Q = (e) => {
156
+ h.get(e).forEach((i) => {
144
157
  i.remove();
145
- }), u.set(t, []);
146
- }, X = (t, e) => {
158
+ }), h.set(e, []);
159
+ }, X = (e, t) => {
147
160
  const i = document.createElement("input");
148
- return i.type = "hidden", i.name = t.getAttribute("name"), t.after(i), u.get(e).push(i), i;
149
- }, me = (t, e) => {
161
+ return i.type = "hidden", i.name = e.getAttribute("name"), e.after(i), h.get(t).push(i), i;
162
+ }, ft = (e, t) => {
150
163
  var i;
151
- u.set(e, []), (i = I.observe) === null || i === void 0 || i.call(I, t, J);
152
- }, Z = (t, e) => {
153
- if (e.length) {
154
- Array.from(e).forEach((a) => a.addEventListener("click", t.click.bind(t)));
155
- let i = e[0].id;
156
- e[0].id || (i = `${e[0].htmlFor}_Label`, e[0].id = i), t.setAttribute("aria-labelledby", i);
157
- }
158
- }, V = (t) => {
159
- const e = Array.from(t.elements).filter((s) => !s.tagName.includes("-") && s.validity).map((s) => s.validity.valid), i = g.get(t) || [], a = Array.from(i).filter((s) => s.isConnected).map((s) => l.get(s).validity.valid), r = [...e, ...a].includes(!1);
160
- t.toggleAttribute("internals-invalid", r), t.toggleAttribute("internals-valid", !r);
161
- }, fe = (t) => {
162
- V(S(t.target));
163
- }, be = (t) => {
164
- V(S(t.target));
165
- }, ve = (t) => {
166
- const e = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((i) => `${i}:not([disabled])`).map((i) => `${i}:not([form])${t.id ? `,${i}[form='${t.id}']` : ""}`).join(",");
167
- t.addEventListener("click", (i) => {
168
- if (i.target.closest(e)) {
169
- const r = g.get(t);
170
- if (t.noValidate)
164
+ h.set(t, []), (i = I.observe) === null || i === void 0 || i.call(I, e, J);
165
+ }, Z = (e, t) => {
166
+ if (t.length) {
167
+ Array.from(t).forEach((a) => a.addEventListener("click", e.click.bind(e)));
168
+ let i = t[0].id;
169
+ t[0].id || (i = `${t[0].htmlFor}_Label`, t[0].id = i), e.setAttribute("aria-labelledby", i);
170
+ }
171
+ }, V = (e) => {
172
+ const t = Array.from(e.elements).filter((o) => !o.tagName.includes("-") && o.validity).map((o) => o.validity.valid), i = k.get(e) || [], a = Array.from(i).filter((o) => o.isConnected).map((o) => l.get(o).validity.valid), r = [...t, ...a].includes(!1);
173
+ e.toggleAttribute("internals-invalid", r), e.toggleAttribute("internals-valid", !r);
174
+ }, bt = (e) => {
175
+ V(S(e.target));
176
+ }, vt = (e) => {
177
+ V(S(e.target));
178
+ }, wt = (e) => {
179
+ 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(",");
180
+ e.addEventListener("click", (i) => {
181
+ if (i.target.closest(t)) {
182
+ const r = k.get(e);
183
+ if (e.noValidate)
171
184
  return;
172
- r.size && Array.from(r).reverse().map((h) => l.get(h).reportValidity()).includes(!1) && i.preventDefault();
185
+ r.size && Array.from(r).reverse().map((u) => l.get(u).reportValidity()).includes(!1) && i.preventDefault();
173
186
  }
174
187
  });
175
- }, we = (t) => {
176
- const e = g.get(t.target);
177
- e && e.size && e.forEach((i) => {
188
+ }, gt = (e) => {
189
+ const t = k.get(e.target);
190
+ t && t.size && t.forEach((i) => {
178
191
  i.constructor.formAssociated && i.formResetCallback && i.formResetCallback.apply(i);
179
192
  });
180
- }, ee = (t, e, i) => {
181
- if (e) {
182
- const a = g.get(e);
193
+ }, tt = (e, t, i) => {
194
+ if (t) {
195
+ const a = k.get(t);
183
196
  if (a)
184
- a.add(t);
197
+ a.add(e);
185
198
  else {
186
199
  const r = /* @__PURE__ */ new Set();
187
- r.add(t), g.set(e, r), ve(e), e.addEventListener("reset", we), e.addEventListener("input", fe), e.addEventListener("change", be);
200
+ r.add(e), k.set(t, r), wt(t), t.addEventListener("reset", gt), t.addEventListener("input", bt), t.addEventListener("change", vt);
188
201
  }
189
- M.set(e, { ref: t, internals: i }), t.constructor.formAssociated && t.formAssociatedCallback && setTimeout(() => {
190
- t.formAssociatedCallback.apply(t, [e]);
191
- }, 0), V(e);
192
- }
193
- }, S = (t) => {
194
- let e = t.parentNode;
195
- return e && e.tagName !== "FORM" && (e = S(e)), e;
196
- }, b = (t, e, i = DOMException) => {
197
- if (!t.constructor.formAssociated)
198
- throw new i(e);
199
- }, te = (t, e, i) => {
200
- const a = g.get(t);
202
+ E.set(t, { ref: e, internals: i }), e.constructor.formAssociated && e.formAssociatedCallback && setTimeout(() => {
203
+ e.formAssociatedCallback.apply(e, [t]);
204
+ }, 0), V(t);
205
+ }
206
+ }, S = (e) => {
207
+ let t = e.parentNode;
208
+ return t && t.tagName !== "FORM" && (t = S(t)), t;
209
+ }, w = (e, t, i = DOMException) => {
210
+ if (!e.constructor.formAssociated)
211
+ throw new i(t);
212
+ }, et = (e, t, i) => {
213
+ const a = k.get(e);
201
214
  return a && a.size && a.forEach((r) => {
202
- l.get(r)[i]() || (e = !1);
203
- }), e;
204
- }, ie = (t) => {
205
- if (t.constructor.formAssociated) {
206
- const e = l.get(t), { labels: i, form: a } = e;
207
- Z(t, i), ee(t, a, e);
215
+ l.get(r)[i]() || (t = !1);
216
+ }), t;
217
+ }, it = (e) => {
218
+ if (e.constructor.formAssociated) {
219
+ const t = l.get(e), { labels: i, form: a } = t;
220
+ Z(e, i), tt(e, a, t);
208
221
  }
209
222
  };
210
223
  function T() {
211
224
  return typeof MutationObserver < "u";
212
225
  }
213
- class ge {
226
+ class yt {
214
227
  constructor() {
215
228
  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);
216
229
  }
217
230
  }
218
- const ye = (t) => (t.badInput = !1, t.customError = !1, t.patternMismatch = !1, t.rangeOverflow = !1, t.rangeUnderflow = !1, t.stepMismatch = !1, t.tooLong = !1, t.tooShort = !1, t.typeMismatch = !1, t.valid = !0, t.valueMissing = !1, t), Ee = (t, e, i) => (t.valid = ke(e), Object.keys(e).forEach((a) => t[a] = e[a]), i && V(i), t), ke = (t) => {
219
- let e = !0;
220
- for (let i in t)
221
- i !== "valid" && t[i] !== !1 && (e = !1);
222
- return e;
231
+ const Et = (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), kt = (e, t, i) => (e.valid = Mt(t), Object.keys(t).forEach((a) => e[a] = t[a]), i && V(i), e), Mt = (e) => {
232
+ let t = !0;
233
+ for (let i in e)
234
+ i !== "valid" && e[i] !== !1 && (t = !1);
235
+ return t;
223
236
  }, R = /* @__PURE__ */ new WeakMap();
224
- function ae(t, e) {
225
- t.toggleAttribute(e, !0), t.part && t.part.add(e);
237
+ function at(e, t) {
238
+ e.toggleAttribute(t, !0), e.part && e.part.add(t);
226
239
  }
227
240
  class D extends Set {
228
241
  static get isPolyfilled() {
229
242
  return !0;
230
243
  }
231
- constructor(e) {
232
- if (super(), !e || !e.tagName || e.tagName.indexOf("-") === -1)
244
+ constructor(t) {
245
+ if (super(), !t || !t.tagName || t.tagName.indexOf("-") === -1)
233
246
  throw new TypeError("Illegal constructor");
234
- R.set(this, e);
235
- }
236
- add(e) {
237
- if (!/^--/.test(e) || typeof e != "string")
238
- throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);
239
- const i = super.add(e), a = R.get(this), r = `state${e}`;
240
- return a.isConnected ? ae(a, r) : setTimeout(() => {
241
- ae(a, r);
247
+ R.set(this, t);
248
+ }
249
+ add(t) {
250
+ if (!/^--/.test(t) || typeof t != "string")
251
+ throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);
252
+ const i = super.add(t), a = R.get(this), r = `state${t}`;
253
+ return a.isConnected ? at(a, r) : setTimeout(() => {
254
+ at(a, r);
242
255
  }), i;
243
256
  }
244
257
  clear() {
245
- for (let [e] of this.entries())
246
- this.delete(e);
258
+ for (let [t] of this.entries())
259
+ this.delete(t);
247
260
  super.clear();
248
261
  }
249
- delete(e) {
250
- const i = super.delete(e), a = R.get(this);
251
- return a.isConnected ? (a.toggleAttribute(`state${e}`, !1), a.part && a.part.remove(`state${e}`)) : setTimeout(() => {
252
- a.toggleAttribute(`state${e}`, !1), a.part && a.part.remove(`state${e}`);
262
+ delete(t) {
263
+ const i = super.delete(t), a = R.get(this);
264
+ return a.isConnected ? (a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`)) : setTimeout(() => {
265
+ a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`);
253
266
  }), i;
254
267
  }
255
268
  }
256
- function re(t, e, i, a) {
257
- if (i === "a" && !a) throw new TypeError("Private accessor was defined without a getter");
258
- if (typeof e == "function" ? t !== e || !a : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
259
- return i === "m" ? a : i === "a" ? a.call(t) : a ? a.value : e.get(t);
269
+ function rt(e, t, i, a) {
270
+ if (typeof t == "function" ? e !== t || !0 : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
271
+ return i === "m" ? a : i === "a" ? a.call(e) : a ? a.value : t.get(e);
260
272
  }
261
- function Me(t, e, i, a, r) {
262
- if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
263
- return e.set(t, i), i;
273
+ function xt(e, t, i, a, r) {
274
+ 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");
275
+ return t.set(e, i), i;
264
276
  }
265
277
  var x;
266
- class xe {
267
- constructor(e) {
268
- x.set(this, void 0), Me(this, x, e);
269
- for (let i = 0; i < e.length; i++) {
270
- let a = e[i];
278
+ class Ct {
279
+ constructor(t) {
280
+ x.set(this, void 0), xt(this, x, t);
281
+ for (let i = 0; i < t.length; i++) {
282
+ let a = t[i];
271
283
  this[i] = a, a.hasAttribute("name") && (this[a.getAttribute("name")] = a);
272
284
  }
273
285
  Object.freeze(this);
274
286
  }
275
287
  get length() {
276
- return re(this, x, "f").length;
288
+ return rt(this, x, "f").length;
277
289
  }
278
290
  [(x = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
279
- return re(this, x, "f")[Symbol.iterator]();
291
+ return rt(this, x, "f")[Symbol.iterator]();
280
292
  }
281
- item(e) {
282
- return this[e] == null ? null : this[e];
293
+ item(t) {
294
+ return this[t] == null ? null : this[t];
283
295
  }
284
- namedItem(e) {
285
- return this[e] == null ? null : this[e];
296
+ namedItem(t) {
297
+ return this[t] == null ? null : this[t];
286
298
  }
287
299
  }
288
- function Ce() {
289
- const t = HTMLFormElement.prototype.checkValidity;
300
+ function At() {
301
+ const e = HTMLFormElement.prototype.checkValidity;
290
302
  HTMLFormElement.prototype.checkValidity = i;
291
- const e = HTMLFormElement.prototype.reportValidity;
303
+ const t = HTMLFormElement.prototype.reportValidity;
292
304
  HTMLFormElement.prototype.reportValidity = a;
293
- function i(...s) {
294
- let n = t.apply(this, s);
295
- return te(this, n, "checkValidity");
305
+ function i(...o) {
306
+ let n = e.apply(this, o);
307
+ return et(this, n, "checkValidity");
296
308
  }
297
- function a(...s) {
298
- let n = e.apply(this, s);
299
- return te(this, n, "reportValidity");
309
+ function a(...o) {
310
+ let n = t.apply(this, o);
311
+ return et(this, n, "reportValidity");
300
312
  }
301
313
  const { get: r } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
302
314
  Object.defineProperty(HTMLFormElement.prototype, "elements", {
303
- get(...s) {
304
- const n = r.call(this, ...s), h = Array.from(g.get(this) || []);
305
- if (h.length === 0)
315
+ get(...o) {
316
+ const n = r.call(this, ...o), u = Array.from(k.get(this) || []);
317
+ if (u.length === 0)
306
318
  return n;
307
- const c = Array.from(n).concat(h).sort((v, m) => v.compareDocumentPosition ? v.compareDocumentPosition(m) & 2 ? 1 : -1 : 0);
308
- return new xe(c);
319
+ const d = Array.from(n).concat(u).sort((g, b) => g.compareDocumentPosition ? g.compareDocumentPosition(b) & 2 ? 1 : -1 : 0);
320
+ return new Ct(d);
309
321
  }
310
322
  });
311
323
  }
312
- class se {
324
+ class st {
313
325
  static get isPolyfilled() {
314
326
  return !0;
315
327
  }
316
- constructor(e) {
317
- if (!e || !e.tagName || e.tagName.indexOf("-") === -1)
328
+ constructor(t) {
329
+ if (!t || !t.tagName || t.tagName.indexOf("-") === -1)
318
330
  throw new TypeError("Illegal constructor");
319
- const i = e.getRootNode(), a = new ge();
320
- this.states = new D(e), o.set(this, e), d.set(this, a), l.set(e, this), he(e, this), me(e, this), Object.seal(this), i instanceof DocumentFragment && pe(i);
331
+ const i = t.getRootNode(), a = new yt();
332
+ this.states = new D(t), s.set(this, t), c.set(this, a), l.set(t, this), ut(t, this), ft(t, this), Object.seal(this), i instanceof DocumentFragment && mt(i);
321
333
  }
322
334
  checkValidity() {
323
- const e = o.get(this);
324
- if (b(e, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
335
+ const t = s.get(this);
336
+ if (w(t, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
325
337
  return !0;
326
- const i = d.get(this);
338
+ const i = c.get(this);
327
339
  if (!i.valid) {
328
340
  const a = new Event("invalid", {
329
341
  bubbles: !1,
330
342
  cancelable: !0,
331
343
  composed: !1
332
344
  });
333
- e.dispatchEvent(a);
345
+ t.dispatchEvent(a);
334
346
  }
335
347
  return i.valid;
336
348
  }
337
349
  get form() {
338
- const e = o.get(this);
339
- b(e, "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");
350
+ const t = s.get(this);
351
+ w(t, "Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");
340
352
  let i;
341
- return e.constructor.formAssociated === !0 && (i = S(e)), i;
353
+ return t.constructor.formAssociated === !0 && (i = S(t)), i;
342
354
  }
343
355
  get labels() {
344
- const e = o.get(this);
345
- b(e, "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");
346
- const i = e.getAttribute("id"), a = e.getRootNode();
356
+ const t = s.get(this);
357
+ w(t, "Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");
358
+ const i = t.getAttribute("id"), a = t.getRootNode();
347
359
  return a && i ? a.querySelectorAll(`[for="${i}"]`) : [];
348
360
  }
349
361
  reportValidity() {
350
- const e = o.get(this);
351
- if (b(e, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
362
+ const t = s.get(this);
363
+ if (w(t, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
352
364
  return !0;
353
365
  const i = this.checkValidity(), a = U.get(this);
354
- if (a && !e.constructor.formAssociated)
366
+ if (a && !t.constructor.formAssociated)
355
367
  throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
356
- return !i && a && (e.focus(), a.focus()), i;
368
+ return !i && a && (t.focus(), a.focus()), i;
357
369
  }
358
- setFormValue(e) {
359
- const i = o.get(this);
360
- if (b(i, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), Q(this), e != null && !(e instanceof FormData)) {
370
+ setFormValue(t) {
371
+ const i = s.get(this);
372
+ if (w(i, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), Q(this), t != null && !(t instanceof FormData)) {
361
373
  if (i.getAttribute("name")) {
362
374
  const a = X(i, this);
363
- a.value = e;
375
+ a.value = t;
364
376
  }
365
- } else e != null && e instanceof FormData && Array.from(e).reverse().forEach(([a, r]) => {
377
+ } else t != null && t instanceof FormData && Array.from(t).reverse().forEach(([a, r]) => {
366
378
  if (typeof r == "string") {
367
- const s = X(i, this);
368
- s.name = a, s.value = r;
379
+ const o = X(i, this);
380
+ o.name = a, o.value = r;
369
381
  }
370
382
  });
371
- q.set(i, e);
383
+ q.set(i, t);
372
384
  }
373
- setValidity(e, i, a) {
374
- const r = o.get(this);
375
- if (b(r, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !e)
385
+ setValidity(t, i, a) {
386
+ const r = s.get(this);
387
+ if (w(r, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
376
388
  throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
377
389
  U.set(this, a);
378
- const s = d.get(this), n = {};
379
- for (const v in e)
380
- n[v] = e[v];
381
- Object.keys(n).length === 0 && ye(s);
382
- const h = Object.assign(Object.assign({}, s), n);
383
- delete h.valid;
384
- const { valid: c } = Ee(s, h, this.form);
385
- if (!c && !i)
390
+ const o = c.get(this), n = {};
391
+ for (const g in t)
392
+ n[g] = t[g];
393
+ Object.keys(n).length === 0 && Et(o);
394
+ const u = Object.assign(Object.assign({}, o), n);
395
+ delete u.valid;
396
+ const { valid: d } = kt(o, u, this.form);
397
+ if (!d && !i)
386
398
  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.");
387
- w.set(this, c ? "" : i), r.isConnected ? (r.toggleAttribute("internals-invalid", !c), r.toggleAttribute("internals-valid", c), r.setAttribute("aria-invalid", `${!c}`)) : A.set(r, this);
399
+ m.set(this, d ? "" : i), r.isConnected ? (r.toggleAttribute("internals-invalid", !d), r.toggleAttribute("internals-valid", d), r.setAttribute("aria-invalid", `${!d}`)) : A.set(r, this);
388
400
  }
389
401
  get shadowRoot() {
390
- const e = o.get(this), i = B.get(e);
402
+ const t = s.get(this), i = B.get(t);
391
403
  return i || null;
392
404
  }
393
405
  get validationMessage() {
394
- const e = o.get(this);
395
- return b(e, "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."), w.get(this);
406
+ const t = s.get(this);
407
+ return w(t, "Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."), m.get(this);
396
408
  }
397
409
  get validity() {
398
- const e = o.get(this);
399
- return b(e, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), d.get(this);
410
+ const t = s.get(this);
411
+ return w(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), c.get(this);
400
412
  }
401
413
  get willValidate() {
402
- const e = o.get(this);
403
- return b(e, "Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."), !(e.disabled || e.hasAttribute("disabled") || e.hasAttribute("readonly"));
414
+ const t = s.get(this);
415
+ return w(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"));
404
416
  }
405
417
  }
406
- function Ae() {
418
+ function Ft() {
407
419
  if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals)
408
420
  return !1;
409
- class t extends HTMLElement {
421
+ class e extends HTMLElement {
410
422
  constructor() {
411
423
  super(), this.internals = this.attachInternals();
412
424
  }
413
425
  }
414
- const e = `element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g, "")}`;
415
- customElements.define(e, t);
416
- const i = new t();
426
+ const t = `element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g, "")}`;
427
+ customElements.define(t, e);
428
+ const i = new e();
417
429
  return [
418
430
  "shadowRoot",
419
431
  "form",
@@ -427,25 +439,25 @@ import "@justeattakeaway/pie-icons-webc/dist/IconCheck.js";
427
439
  "reportValidity"
428
440
  ].every((a) => a in i.internals);
429
441
  }
430
- let oe = !1, ne = !1;
431
- function H(t) {
432
- ne || (ne = !0, window.CustomStateSet = D, t && (HTMLElement.prototype.attachInternals = function(...e) {
433
- const i = t.call(this, e);
442
+ let ot = !1, nt = !1;
443
+ function H(e) {
444
+ nt || (nt = !0, window.CustomStateSet = D, e && (HTMLElement.prototype.attachInternals = function(...t) {
445
+ const i = e.call(this, t);
434
446
  return i.states = new D(this), i;
435
447
  }));
436
448
  }
437
- function le(t = !0) {
438
- if (!oe) {
439
- if (oe = !0, typeof window < "u" && (window.ElementInternals = se), typeof CustomElementRegistry < "u") {
440
- const e = CustomElementRegistry.prototype.define;
449
+ function lt(e = !0) {
450
+ if (!ot) {
451
+ if (ot = !0, typeof window < "u" && (window.ElementInternals = st), typeof CustomElementRegistry < "u") {
452
+ const t = CustomElementRegistry.prototype.define;
441
453
  CustomElementRegistry.prototype.define = function(i, a, r) {
442
454
  if (a.formAssociated) {
443
- const s = a.prototype.connectedCallback;
455
+ const o = a.prototype.connectedCallback;
444
456
  a.prototype.connectedCallback = function() {
445
- K.has(this) || (K.set(this, !0), this.hasAttribute("disabled") && $(this, !0)), s != null && s.apply(this), ie(this);
457
+ K.has(this) || (K.set(this, !0), this.hasAttribute("disabled") && $(this, !0)), o != null && o.apply(this), it(this);
446
458
  };
447
459
  }
448
- e.call(this, i, a, r);
460
+ t.call(this, i, a, r);
449
461
  };
450
462
  }
451
463
  if (typeof HTMLElement < "u" && (HTMLElement.prototype.attachInternals = function() {
@@ -455,44 +467,44 @@ import "@justeattakeaway/pie-icons-webc/dist/IconCheck.js";
455
467
  } else return {};
456
468
  if (l.has(this))
457
469
  throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
458
- return new se(this);
470
+ return new st(this);
459
471
  }), typeof Element < "u") {
460
- let e = function(...a) {
472
+ let t = function(...a) {
461
473
  const r = i.apply(this, a);
462
474
  if (B.set(this, r), T()) {
463
- const s = new MutationObserver(P);
464
- window.ShadyDOM ? s.observe(this, _) : s.observe(r, _), O.set(this, s);
475
+ const o = new MutationObserver(P);
476
+ window.ShadyDOM ? o.observe(this, _) : o.observe(r, _), O.set(this, o);
465
477
  }
466
478
  return r;
467
479
  };
468
480
  const i = Element.prototype.attachShadow;
469
- Element.prototype.attachShadow = e;
481
+ Element.prototype.attachShadow = t;
470
482
  }
471
- T() && typeof document < "u" && new MutationObserver(P).observe(document.documentElement, _), typeof HTMLFormElement < "u" && Ce(), (t || typeof window < "u" && !window.CustomStateSet) && H();
483
+ T() && typeof document < "u" && new MutationObserver(P).observe(document.documentElement, _), typeof HTMLFormElement < "u" && At(), (e || typeof window < "u" && !window.CustomStateSet) && H();
472
484
  }
473
485
  }
474
- return !!customElements.polyfillWrapFlushCallback || (Ae() ? typeof window < "u" && !window.CustomStateSet && H(HTMLElement.prototype.attachInternals) : le(!1)), E.forceCustomStateSetPolyfill = H, E.forceElementInternalsPolyfill = le, Object.defineProperty(E, "__esModule", { value: !0 }), E;
486
+ return !!customElements.polyfillWrapFlushCallback || (Ft() ? typeof window < "u" && !window.CustomStateSet && H(HTMLElement.prototype.attachInternals) : lt(!1)), f.forceCustomStateSetPolyfill = H, f.forceElementInternalsPolyfill = lt, Object.defineProperty(f, "__esModule", { value: !0 }), f;
475
487
  })({});
476
488
  })();
477
- const _e = "*,*:after,*:before{box-sizing:inherit}*,*:before,*:after{cursor:inherit}.c-switch-wrapper{display:inline-flex;align-items:center;gap:var(--dt-spacing-b);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)}@media (prefers-reduced-motion: no-preference){.c-switch{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}.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:focus,.c-switch:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-switch[checked]{--int-states-mixin-bg-color: var(--dt-color-interactive-brand)}@media (prefers-reduced-motion: no-preference){.c-switch[checked]{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}.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-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)}@media (prefers-reduced-motion: no-preference){.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-wrapper--rtl .c-switch-control{position:absolute;left:initial;right:2px}.c-switch-input:checked+.c-switch-control{transform:translate(var(--switch-translation))}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-input:checked+.c-switch-control .c-pieIcon--check{color:var(--dt-color-interactive-brand)}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.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)}@media (prefers-reduced-motion: no-preference){.c-switch-input:disabled~.c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-label{color:var(--dt-color-content-default)}.c-switch-description{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}.c-switch-wrapper--rtl .c-switch-input:checked+.c-switch-control{transform:translate(calc(-1 * var(--switch-translation)))}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--rtl .c-switch-input:checked+.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}", $e = ["leading", "trailing"], je = "change", k = {
489
+ const Dt = "*,*:after,*:before{box-sizing:inherit}*,*:before,*:after{cursor:inherit}.c-switch-wrapper{display:inline-flex;align-items:center;gap:var(--dt-spacing-b);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)}@media (prefers-reduced-motion: no-preference){.c-switch{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}.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:focus,.c-switch:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-switch[checked]{--int-states-mixin-bg-color: var(--dt-color-interactive-brand)}@media (prefers-reduced-motion: no-preference){.c-switch[checked]{transition:background-color .15s cubic-bezier(.4,0,.9,1) 0s}}.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-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)}@media (prefers-reduced-motion: no-preference){.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-wrapper--rtl .c-switch-control{position:absolute;left:initial;right:2px}.c-switch-input:checked+.c-switch-control{transform:translate(var(--switch-translation))}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-input:checked+.c-switch-control .c-pieIcon--check{color:var(--dt-color-interactive-brand)}@media (prefers-reduced-motion: no-preference){.c-switch-input:checked+.c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.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)}@media (prefers-reduced-motion: no-preference){.c-switch-input:disabled~.c-switch-control .c-pieIcon--check{transition:color .15s cubic-bezier(.4,0,.9,1) 0s}}.c-switch-label{color:var(--dt-color-content-default)}.c-switch-description{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}.c-switch-wrapper--rtl .c-switch-input:checked+.c-switch-control{transform:translate(calc(-1 * var(--switch-translation)))}@media (prefers-reduced-motion: no-preference){.c-switch-wrapper--rtl .c-switch-input:checked+.c-switch-control{transition:transform .15s cubic-bezier(.4,0,.9,1) 0s}}", Ht = ["leading", "trailing"], Yt = "change", M = {
478
490
  checked: !1,
479
491
  disabled: !1,
480
492
  labelPlacement: "leading",
481
493
  required: !1,
482
494
  value: "on"
483
495
  };
484
- var Re = Object.defineProperty, f = (E, o, d, u) => {
485
- for (var l = void 0, w = E.length - 1, M; w >= 0; w--)
486
- (M = E[w]) && (l = M(o, d, l) || l);
487
- return l && Re(o, d, l), l;
496
+ var Wt = Object.defineProperty, v = (f, s, c, h) => {
497
+ for (var l = void 0, m = f.length - 1, E; m >= 0; m--)
498
+ (E = f[m]) && (l = E(s, c, l) || l);
499
+ return l && Wt(s, c, l), l;
488
500
  };
489
- const de = "pie-switch", z = class z extends Te(Le(Fe)) {
501
+ const ht = "pie-switch", z = class z extends Lt(Nt(dt)) {
490
502
  constructor() {
491
- super(...arguments), this.labelPlacement = k.labelPlacement, this.checked = k.checked, this.required = k.required, this.value = k.value, this.disabled = k.disabled;
503
+ super(...arguments), this.labelPlacement = M.labelPlacement, this.checked = M.checked, this.required = M.required, this.value = M.value, this.disabled = M.disabled;
492
504
  }
493
505
  firstUpdated() {
494
- this.handleFormAssociation(), this.input.addEventListener("invalid", (o) => {
495
- this.dispatchEvent(new Event("invalid", o));
506
+ this.handleFormAssociation(), this.input.addEventListener("invalid", (s) => {
507
+ this.dispatchEvent(new Event("invalid", s));
496
508
  });
497
509
  }
498
510
  updated() {
@@ -508,11 +520,11 @@ const de = "pie-switch", z = class z extends Te(Le(Fe)) {
508
520
  * The handleChange function updates the checkbox state and emits an event for consumers.
509
521
  * @param {Event} event - This should be the change event that was listened for on an input element with `type="checkbox"`.
510
522
  */
511
- handleChange(o) {
512
- const { checked: d } = o == null ? void 0 : o.currentTarget;
513
- this.checked = d;
514
- const u = Ne(o);
515
- this.dispatchEvent(u), this.handleFormAssociation();
523
+ handleChange(s) {
524
+ const { checked: c } = s == null ? void 0 : s.currentTarget;
525
+ this.checked = c;
526
+ const h = Ot(s);
527
+ this.dispatchEvent(h), this.handleFormAssociation();
516
528
  }
517
529
  /**
518
530
  * Returns a boolean value which indicates validity of the value of the component. If the value is invalid, this method also fires the invalid event on the component.
@@ -534,8 +546,8 @@ const de = "pie-switch", z = class z extends Te(Le(Fe)) {
534
546
  * Allows a consumer to set a custom validation message on the switch. An empty string counts as valid.
535
547
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setCustomValidity
536
548
  */
537
- setCustomValidity(o) {
538
- this.input.setCustomValidity(o), this._internals.setValidity(this.validity, this.validationMessage, this.input);
549
+ setCustomValidity(s) {
550
+ this.input.setCustomValidity(s), this._internals.setValidity(this.validity, this.validationMessage, this.input);
539
551
  }
540
552
  /**
541
553
  * (Read-only) returns a ValidityState with the validity states that this element is in.
@@ -558,18 +570,18 @@ const de = "pie-switch", z = class z extends Te(Le(Fe)) {
558
570
  *
559
571
  * @private
560
572
  */
561
- renderSwitchLabel(o) {
562
- const { label: d, labelPlacement: u } = this;
563
- return !d || u !== o ? L : N`
573
+ renderSwitchLabel(s) {
574
+ const { label: c, labelPlacement: h } = this;
575
+ return !c || h !== s ? L : N`
564
576
  <span
565
- data-test-id="switch-label-${u}"
577
+ data-test-id="switch-label-${h}"
566
578
  class="c-switch-label">
567
- ${d}
579
+ ${c}
568
580
  </span>`;
569
581
  }
570
582
  renderAriaDescription() {
571
- var o;
572
- return (o = this.aria) != null && o.describedBy ? N`
583
+ var s;
584
+ return (s = this.aria) != null && s.describedBy ? N`
573
585
  <div
574
586
  id="switch-description"
575
587
  data-test-id="switch-description"
@@ -579,37 +591,37 @@ const de = "pie-switch", z = class z extends Te(Le(Fe)) {
579
591
  }
580
592
  render() {
581
593
  const {
582
- aria: o,
583
- checked: d,
584
- disabled: u,
594
+ aria: s,
595
+ checked: c,
596
+ disabled: h,
585
597
  isRTL: l,
586
- required: w
598
+ required: m
587
599
  } = this;
588
600
  return N`
589
601
  <label
590
- class="${Ve({
602
+ class="${St({
591
603
  "c-switch-wrapper": !0,
592
604
  "c-switch-wrapper--rtl": l
593
605
  })}"
594
- ?disabled=${u}>
606
+ ?disabled=${h}>
595
607
  ${this.renderSwitchLabel("leading")}
596
608
  <div
597
609
  data-test-id="switch-component"
598
610
  class="c-switch"
599
- ?checked=${d}>
611
+ ?checked=${c}>
600
612
  <input
601
613
  data-test-id="switch-input"
602
614
  role="switch"
603
615
  type="checkbox"
604
616
  class="c-switch-input"
605
- .required=${w}
606
- .checked="${d}"
607
- .disabled="${u}"
617
+ .required=${m}
618
+ .checked="${c}"
619
+ .disabled="${h}"
608
620
  @change="${this.handleChange}"
609
- aria-label="${Se(o == null ? void 0 : o.label)}"
610
- aria-describedby="${o != null && o.describedBy ? "switch-description" : L}">
621
+ aria-label="${Tt(s == null ? void 0 : s.label)}"
622
+ aria-describedby="${s != null && s.describedBy ? "switch-description" : L}">
611
623
  <div class="c-switch-control">
612
- ${d ? N`<icon-check></icon-check>` : L}
624
+ ${c ? N`<icon-check></icon-check>` : L}
613
625
  </div>
614
626
  </div>
615
627
  ${this.renderSwitchLabel("trailing")}
@@ -617,43 +629,43 @@ const de = "pie-switch", z = class z extends Te(Le(Fe)) {
617
629
  </label>`;
618
630
  }
619
631
  };
620
- z.styles = Ie(_e);
632
+ z.styles = Vt(Dt);
621
633
  let p = z;
622
- f([
634
+ v([
623
635
  y({ type: String })
624
636
  ], p.prototype, "label");
625
- f([
637
+ v([
626
638
  y({ type: String }),
627
- Oe(de, $e, k.labelPlacement)
639
+ Pt(ht, Ht, M.labelPlacement)
628
640
  ], p.prototype, "labelPlacement");
629
- f([
641
+ v([
630
642
  y({ type: Object })
631
643
  ], p.prototype, "aria");
632
- f([
644
+ v([
633
645
  y({ type: Boolean, reflect: !0 })
634
646
  ], p.prototype, "checked");
635
- f([
647
+ v([
636
648
  y({ type: Boolean, reflect: !0 })
637
649
  ], p.prototype, "required");
638
- f([
650
+ v([
639
651
  y({ type: String })
640
652
  ], p.prototype, "value");
641
- f([
653
+ v([
642
654
  y({ type: String })
643
655
  ], p.prototype, "name");
644
- f([
656
+ v([
645
657
  y({ type: Boolean, reflect: !0 })
646
658
  ], p.prototype, "disabled");
647
- f([
648
- ce('input[type="checkbox"]')
659
+ v([
660
+ ct('input[type="checkbox"]')
649
661
  ], p.prototype, "input");
650
- f([
651
- ce("label")
662
+ v([
663
+ ct("label")
652
664
  ], p.prototype, "focusTarget");
653
- Pe(de, p);
665
+ _t(ht, p);
654
666
  export {
655
- je as ON_SWITCH_CHANGED_EVENT,
667
+ Yt as ON_SWITCH_CHANGED_EVENT,
656
668
  p as PieSwitch,
657
- k as defaultProps,
658
- $e as labelPlacements
669
+ M as defaultProps,
670
+ Ht as labelPlacements
659
671
  };
package/dist/react.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
2
2
  import type { CSSResult } from 'lit';
3
3
  import type { FormControlInterface } from '@justeattakeaway/pie-webc-core';
4
4
  import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
5
- import type { LitElement } from 'lit';
5
+ import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
6
6
  import type { PIEInputElement } from '@justeattakeaway/pie-webc-core';
7
7
  import * as React_2 from 'react';
8
8
  import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
@@ -94,7 +94,7 @@ declare class PieSwitch_2 extends PieSwitch_base implements SwitchProps, PIEInpu
94
94
  render(): TemplateResult<1>;
95
95
  }
96
96
 
97
- declare const PieSwitch_base: GenericConstructor<FormControlInterface> & GenericConstructor<RTLInterface> & typeof LitElement;
97
+ declare const PieSwitch_base: GenericConstructor<FormControlInterface> & GenericConstructor<RTLInterface> & typeof PieElement;
98
98
 
99
99
  declare type PieSwitchEvents = {
100
100
  onInvalid?: (event: Event) => void;
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": "1.2.2",
4
+ "version": "1.3.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/justeattakeaway/pie",
@@ -39,13 +39,14 @@
39
39
  "license": "Apache-2.0",
40
40
  "devDependencies": {
41
41
  "@custom-elements-manifest/analyzer": "0.9.0",
42
- "@justeattakeaway/pie-components-config": "0.18.0",
43
- "@justeattakeaway/pie-css": "0.15.1",
42
+ "@justeattakeaway/pie-components-config": "0.19.1",
43
+ "@justeattakeaway/pie-css": "0.16.0",
44
+ "@justeattakeaway/pie-monorepo-utils": "0.5.0",
44
45
  "cem-plugin-module-file-extensions": "0.0.5"
45
46
  },
46
47
  "dependencies": {
47
- "@justeattakeaway/pie-icons-webc": "1.6.0",
48
- "@justeattakeaway/pie-webc-core": "0.24.2",
48
+ "@justeattakeaway/pie-icons-webc": "1.6.2",
49
+ "@justeattakeaway/pie-webc-core": "0.25.1",
49
50
  "@justeattakeaway/pie-wrapper-react": "0.14.3",
50
51
  "element-internals-polyfill": "1.3.11"
51
52
  },
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
- LitElement, html, unsafeCSS, nothing,
2
+ html, unsafeCSS, nothing,
3
3
  } from 'lit';
4
+ import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
4
5
  import { property, query } from 'lit/decorators.js';
5
6
  import { classMap } from 'lit/directives/class-map.js';
6
7
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -23,7 +24,7 @@ const componentSelector = 'pie-switch';
23
24
  * @tagname pie-switch
24
25
  * @event {CustomEvent} change - when the switch checked state is changed.
25
26
  */
26
- export class PieSwitch extends FormControlMixin(RtlMixin(LitElement)) implements SwitchProps, PIEInputElement {
27
+ export class PieSwitch extends FormControlMixin(RtlMixin(PieElement)) implements SwitchProps, PIEInputElement {
27
28
  @property({ type: String })
28
29
  public label: SwitchProps['label'];
29
30
 
package/declaration.d.ts DELETED
@@ -1,9 +0,0 @@
1
- declare module '*.scss' {
2
- const content: Record<string, string>;
3
- export default content;
4
- }
5
-
6
- declare module '*.scss?inline' {
7
- const content: Record<string, string>;
8
- export default content;
9
- }