@justeattakeaway/pie-switch 2.3.32 → 2.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -16
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -2,18 +2,18 @@ import { LitElement as St, nothing as L, html as N, unsafeCSS as Vt } from "lit"
|
|
|
2
2
|
import { property as E, query as ut, state as Tt } from "lit/decorators.js";
|
|
3
3
|
import { classMap as Lt } from "lit/directives/class-map.js";
|
|
4
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
|
|
5
|
+
import { FormControlMixin as Ot, DelegatesFocusMixin as Pt, wrapNativeEvent as _t, validPropertyValues as Dt, safeCustomElement as $t } from "@justeattakeaway/pie-webc-core";
|
|
6
6
|
import "@justeattakeaway/pie-icons-webc/dist/IconCheck.js";
|
|
7
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.
|
|
12
|
+
O.v = "2.3.34";
|
|
13
13
|
let q = O;
|
|
14
14
|
var dt = {}, ht;
|
|
15
|
-
function
|
|
16
|
-
return ht || (ht = 1, function() {
|
|
15
|
+
function Rt() {
|
|
16
|
+
return ht || (ht = 1, (function() {
|
|
17
17
|
(function(l) {
|
|
18
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
19
|
ariaAtomic: "aria-atomic",
|
|
@@ -86,11 +86,11 @@ function $t() {
|
|
|
86
86
|
let a = i.nextNode();
|
|
87
87
|
const r = !t || e.disabled;
|
|
88
88
|
for (; a; )
|
|
89
|
-
a.formDisabledCallback && r &&
|
|
89
|
+
a.formDisabledCallback && r && $(a, e.disabled), a = i.nextNode();
|
|
90
90
|
}, Q = { attributes: !0, attributeFilter: ["disabled", "name"] }, I = T() ? new MutationObserver((e) => {
|
|
91
91
|
for (const t of e) {
|
|
92
92
|
const i = t.target;
|
|
93
|
-
if (t.attributeName === "disabled" && (i.constructor.formAssociated ?
|
|
93
|
+
if (t.attributeName === "disabled" && (i.constructor.formAssociated ? $(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && J(i)), t.attributeName === "name" && i.constructor.formAssociated) {
|
|
94
94
|
const a = c.get(i), r = B.get(i);
|
|
95
95
|
a.setFormValue(r);
|
|
96
96
|
}
|
|
@@ -146,7 +146,7 @@ function $t() {
|
|
|
146
146
|
const D = {
|
|
147
147
|
childList: !0,
|
|
148
148
|
subtree: !0
|
|
149
|
-
},
|
|
149
|
+
}, $ = (e, t) => {
|
|
150
150
|
e.toggleAttribute("internals-disabled", t), t ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.formDisabledCallback && e.formDisabledCallback.apply(e, [t]);
|
|
151
151
|
}, X = (e) => {
|
|
152
152
|
m.get(e).forEach((i) => {
|
|
@@ -229,7 +229,7 @@ function $t() {
|
|
|
229
229
|
for (let i in e)
|
|
230
230
|
i !== "valid" && e[i] !== !1 && (t = !1);
|
|
231
231
|
return t;
|
|
232
|
-
},
|
|
232
|
+
}, R = /* @__PURE__ */ new WeakMap();
|
|
233
233
|
function rt(e, t) {
|
|
234
234
|
e.toggleAttribute(t, !0), e.part && e.part.add(t);
|
|
235
235
|
}
|
|
@@ -240,12 +240,12 @@ function $t() {
|
|
|
240
240
|
constructor(t) {
|
|
241
241
|
if (super(), !t || !t.tagName || t.tagName.indexOf("-") === -1)
|
|
242
242
|
throw new TypeError("Illegal constructor");
|
|
243
|
-
|
|
243
|
+
R.set(this, t);
|
|
244
244
|
}
|
|
245
245
|
add(t) {
|
|
246
246
|
if (!/^--/.test(t) || typeof t != "string")
|
|
247
247
|
throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);
|
|
248
|
-
const i = super.add(t), a =
|
|
248
|
+
const i = super.add(t), a = R.get(this), r = `state${t}`;
|
|
249
249
|
return a.isConnected ? rt(a, r) : setTimeout(() => {
|
|
250
250
|
rt(a, r);
|
|
251
251
|
}), i;
|
|
@@ -256,7 +256,7 @@ function $t() {
|
|
|
256
256
|
super.clear();
|
|
257
257
|
}
|
|
258
258
|
delete(t) {
|
|
259
|
-
const i = super.delete(t), a =
|
|
259
|
+
const i = super.delete(t), a = R.get(this);
|
|
260
260
|
return a.isConnected ? (a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`)) : setTimeout(() => {
|
|
261
261
|
a.toggleAttribute(`state${t}`, !1), a.part && a.part.remove(`state${t}`);
|
|
262
262
|
}), i;
|
|
@@ -450,7 +450,7 @@ function $t() {
|
|
|
450
450
|
if (a.formAssociated) {
|
|
451
451
|
const s = a.prototype.connectedCallback;
|
|
452
452
|
a.prototype.connectedCallback = function() {
|
|
453
|
-
G.has(this) || (G.set(this, !0), this.hasAttribute("disabled") &&
|
|
453
|
+
G.has(this) || (G.set(this, !0), this.hasAttribute("disabled") && $(this, !0)), s != null && s.apply(this), at(this);
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
456
|
t.call(this, i, a, r);
|
|
@@ -481,10 +481,10 @@ function $t() {
|
|
|
481
481
|
}
|
|
482
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
483
|
})({});
|
|
484
|
-
}()), dt;
|
|
484
|
+
})()), dt;
|
|
485
485
|
}
|
|
486
|
-
|
|
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
|
|
486
|
+
Rt();
|
|
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 = {
|
|
488
488
|
checked: !1,
|
|
489
489
|
disabled: !1,
|
|
490
490
|
labelPlacement: "leading",
|
|
@@ -667,7 +667,7 @@ f([
|
|
|
667
667
|
Tt()
|
|
668
668
|
], p.prototype, "_isAnimationAllowed", 2);
|
|
669
669
|
p = f([
|
|
670
|
-
|
|
670
|
+
$t("pie-switch")
|
|
671
671
|
], p);
|
|
672
672
|
export {
|
|
673
673
|
Xt as ON_SWITCH_CHANGED_EVENT,
|
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.
|
|
4
|
+
"version": "2.3.34",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/justeattakeaway/pie",
|
|
@@ -28,29 +28,29 @@
|
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "run -T vite build",
|
|
31
|
-
"build:react-wrapper": "
|
|
31
|
+
"build:react-wrapper": "run -T build-react-wrapper",
|
|
32
32
|
"create:manifest": "run -T cem analyze --litelement",
|
|
33
33
|
"lint:scripts": "run -T eslint .",
|
|
34
34
|
"lint:scripts:fix": "yarn lint:scripts --fix",
|
|
35
35
|
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
36
36
|
"lint:style:fix": "yarn lint:style --fix",
|
|
37
37
|
"watch": "run -T vite build --watch",
|
|
38
|
-
"test:browsers": "
|
|
38
|
+
"test:browsers": "run -T playwright test -c ./playwright-lit.config.ts",
|
|
39
39
|
"test:browsers:ci": "yarn test:browsers",
|
|
40
|
-
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_SWITCH} percy exec --allowed-hostname cloudfront.net --
|
|
40
|
+
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_SWITCH} percy exec --allowed-hostname cloudfront.net -- run -T playwright test -c ./playwright-lit-visual.config.ts",
|
|
41
41
|
"test:visual:ci": "yarn test:visual"
|
|
42
42
|
},
|
|
43
43
|
"author": "Just Eat Takeaway.com - Design System Team",
|
|
44
44
|
"license": "Apache-2.0",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@justeattakeaway/pie-components-config": "0.21.
|
|
47
|
-
"@justeattakeaway/pie-css": "1.1.
|
|
48
|
-
"@justeattakeaway/pie-monorepo-utils": "0.9.
|
|
49
|
-
"@justeattakeaway/pie-wrapper-react": "0.14.
|
|
46
|
+
"@justeattakeaway/pie-components-config": "0.21.3",
|
|
47
|
+
"@justeattakeaway/pie-css": "1.1.2",
|
|
48
|
+
"@justeattakeaway/pie-monorepo-utils": "0.9.3",
|
|
49
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.5"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@justeattakeaway/pie-icons-webc": "1.24.
|
|
53
|
-
"@justeattakeaway/pie-webc-core": "14.0.
|
|
52
|
+
"@justeattakeaway/pie-icons-webc": "1.24.3",
|
|
53
|
+
"@justeattakeaway/pie-webc-core": "14.0.2",
|
|
54
54
|
"element-internals-polyfill": "1.3.11"
|
|
55
55
|
},
|
|
56
56
|
"customElements": "custom-elements.json",
|