@justeattakeaway/pie-button 0.40.1 → 0.40.2
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 +46 -46
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unsafeCSS as wt, LitElement as xt, html as N, nothing as
|
|
1
|
+
import { unsafeCSS as wt, LitElement as xt, html as N, nothing as W } from "lit";
|
|
2
2
|
import { property as h } from "lit/decorators.js";
|
|
3
3
|
import { ifDefined as Et } from "lit/directives/if-defined.js";
|
|
4
4
|
import { validPropertyValues as R, defineCustomElement as kt } from "@justeattakeaway/pie-webc-core";
|
|
@@ -16,7 +16,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
16
16
|
], Lt = ["leading", "trailing"], Pt = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], Dt = ["post", "get", "dialog"], $t = ["_self", "_blank", "_parent", "_top"], Ft = `*,*:before,*:after{box-sizing:border-box}.o-btn{--btn-border-radius: var(--dt-radius-rounded-e);--btn-font-family: var(--dt-font-interactive-m-family);--btn-font-weight: var(--dt-font-interactive-m-weight);--btn-bg-color: var(--dt-color-interactive-brand);--btn-text-color: var(--dt-color-content-interactive-primary);--btn-height--xsmall: 32px;--btn-height--small: 40px;--btn-height--medium: 48px;--btn-height--large: 56px;position:relative;display:flex;gap:var(--dt-spacing-b);align-items:center;justify-content:center;box-sizing:border-box;height:var(--btn-height);padding:var(--btn-padding);border:none;border-radius:var(--btn-border-radius);outline:none;background-color:var(--btn-bg-color);font-family:var(--btn-font-family);font-size:var(--btn-font-size);font-weight:var(--btn-font-weight);color:var(--btn-text-color);line-height:var(--btn-line-height);cursor:pointer;user-select:none;inline-size:var(--btn-inline-size)}.o-btn[variant=primary]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-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)))}.o-btn[variant=primary]:active:not(:disabled),.o-btn[variant=primary][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-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)))}.o-btn[variant=primary][size=xsmall],.o-btn[variant=primary][size=small-productive]{--btn-bg-color: var(--dt-color-interactive-primary)}.o-btn[variant=primary][size=xsmall]:hover:not(:disabled),.o-btn[variant=primary][size=small-productive]:hover:not(:disabled){--hover-modifier: var(--dt-color-hover-02);--btn-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--hover-modifier)))}.o-btn[variant=primary][size=xsmall]:active:not(:disabled),.o-btn[variant=primary][size=xsmall][isLoading]:not(:disabled),.o-btn[variant=primary][size=small-productive]:active:not(:disabled),.o-btn[variant=primary][size=small-productive][isLoading]:not(:disabled){--active-modifier: var(--dt-color-active-02);--btn-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--active-modifier)))}.o-btn[variant=secondary]{--btn-bg-color: var(--dt-color-interactive-secondary);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn[variant=secondary]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--hover-modifier)))}.o-btn[variant=secondary]:active:not(:disabled),.o-btn[variant=secondary][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--active-modifier)))}.o-btn[variant=outline]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-secondary);border:1px solid var(--dt-color-border-strong)}.o-btn[variant=outline]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=outline]:active:not(:disabled),.o-btn[variant=outline][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[variant=ghost]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-link)}.o-btn[variant=ghost]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=ghost]:active:not(:disabled),.o-btn[variant=ghost][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[variant=inverse]{--btn-bg-color: var(--dt-color-interactive-inverse);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn[variant=inverse]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-interactive-inverse-h), var(--dt-color-interactive-inverse-s), calc(var(--dt-color-interactive-inverse-l) + var(--hover-modifier)))}.o-btn[variant=inverse]:active:not(:disabled),.o-btn[variant=inverse][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-interactive-inverse-h), var(--dt-color-interactive-inverse-s), calc(var(--dt-color-interactive-inverse-l) + var(--active-modifier)))}.o-btn[variant=ghost-inverse],.o-btn[variant=outline-inverse]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-primary)}.o-btn[variant=ghost-inverse]:hover:not(:disabled),.o-btn[variant=outline-inverse]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), var(--dt-color-container-default-l), var(--hover-modifier))}.o-btn[variant=ghost-inverse]:active:not(:disabled),.o-btn[variant=ghost-inverse][isLoading]:not(:disabled),.o-btn[variant=outline-inverse]:active:not(:disabled),.o-btn[variant=outline-inverse][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), var(--dt-color-container-default-l), var(--active-modifier))}.o-btn[variant=outline-inverse]{border:1px solid var(--dt-color-border-strong)}.o-btn[variant=destructive]{--btn-bg-color: var(--dt-color-support-error)}.o-btn[variant=destructive]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--btn-bg-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) + var(--hover-modifier)))}.o-btn[variant=destructive]:active:not(:disabled),.o-btn[variant=destructive][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--btn-bg-color: hsl(var(--dt-color-support-error-h), var(--dt-color-support-error-s), calc(var(--dt-color-support-error-l) + var(--active-modifier)))}.o-btn[variant=destructive-ghost]{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-error)}.o-btn[variant=destructive-ghost]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.o-btn[variant=destructive-ghost]:active:not(:disabled),.o-btn[variant=destructive-ghost][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--btn-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.o-btn[isFullWidth]{--btn-inline-size: 100%}.o-btn[disabled]{--btn-text-color: var(--dt-color-content-disabled) !important;cursor:not-allowed}.o-btn[disabled]:not([variant=ghost],[variant=ghost-inverse],[variant=destructive-ghost]){--btn-bg-color: var(--dt-color-disabled-01) !important}.o-btn[disabled][variant=outline]{border-color:var(--dt-color-disabled-01)!important}.o-btn[size=xsmall]{--btn-height: var(--btn-height--xsmall);--btn-padding: 6px var(--dt-spacing-b);--btn-font-size: calc(var(--dt-font-size-14) * 1px);--btn-line-height: calc(var(--dt-font-size-14-line-height) * 1px);--btn-icon-size: 16px}@media (min-width: 768px){.o-btn[size=xsmall][isResponsive]{--btn-height: var(--btn-height--small);--btn-padding: 8px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-16) * 1px);--btn-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--btn-icon-size: 20px}.o-btn[size=xsmall][isResponsive][responsiveSize=expressive]{--btn-height: var(--btn-height--small);--btn-padding: 6px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-icon-size: 20px}}.o-btn[size=small-expressive]{--btn-height: var(--btn-height--small);--btn-padding: 6px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-icon-size: 20px}@media (min-width: 768px){.o-btn[size=small-expressive][isResponsive]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-icon-size: 24px}}.o-btn[size=small-productive]{--btn-height: var(--btn-height--small);--btn-padding: 8px var(--dt-spacing-d);--btn-font-size: calc(var(--dt-font-size-16) * 1px);--btn-line-height: calc(var(--dt-font-size-16-line-height) * 1px);--btn-icon-size: 20px}@media (min-width: 768px){.o-btn[size=small-productive][isResponsive]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-icon-size: 24px}}.o-btn[size=medium]{--btn-height: var(--btn-height--medium);--btn-padding: 10px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-icon-size: 24px}@media (min-width: 768px){.o-btn[size=medium][isResponsive]{--btn-height: var(--btn-height--large);--btn-padding: 14px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-icon-size: 24px}}.o-btn[size=large]{--btn-height: var(--btn-height--large);--btn-padding: 14px var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-size-20) * 1px);--btn-line-height: calc(var(--dt-font-size-20-line-height) * 1px);--btn-icon-size: 24px}.o-btn[isLoading]>*:not(pie-spinner){visibility:hidden}.o-btn[isLoading] pie-spinner{position:absolute}.o-btn:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}::slotted(svg){height:var(--btn-icon-size);width:var(--btn-icon-size)}
|
|
17
17
|
`;
|
|
18
18
|
(function() {
|
|
19
|
-
const p = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(),
|
|
19
|
+
const p = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), S = {
|
|
20
20
|
ariaAtomic: "aria-atomic",
|
|
21
21
|
ariaAutoComplete: "aria-autocomplete",
|
|
22
22
|
ariaBusy: "aria-busy",
|
|
@@ -73,11 +73,11 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
function
|
|
76
|
+
function U(i) {
|
|
77
77
|
const t = c.get(i), { form: e } = t;
|
|
78
|
-
|
|
78
|
+
Y(i, e, t), X(i, t.labels);
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const j = (i, t = !1) => {
|
|
81
81
|
const e = document.createTreeWalker(i, NodeFilter.SHOW_ELEMENT, {
|
|
82
82
|
acceptNode(l) {
|
|
83
83
|
return c.has(l) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
@@ -87,10 +87,10 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
87
87
|
const o = !t || i.disabled;
|
|
88
88
|
for (; r; )
|
|
89
89
|
r.formDisabledCallback && o && D(r, i.disabled), r = e.nextNode();
|
|
90
|
-
},
|
|
90
|
+
}, G = { attributes: !0, attributeFilter: ["disabled", "name"] }, z = T() ? new MutationObserver((i) => {
|
|
91
91
|
for (const t of i) {
|
|
92
92
|
const e = t.target;
|
|
93
|
-
if (t.attributeName === "disabled" && (e.constructor.formAssociated ? D(e, e.hasAttribute("disabled")) : e.localName === "fieldset" &&
|
|
93
|
+
if (t.attributeName === "disabled" && (e.constructor.formAssociated ? D(e, e.hasAttribute("disabled")) : e.localName === "fieldset" && j(e)), t.attributeName === "name" && e.constructor.formAssociated) {
|
|
94
94
|
const r = c.get(e), o = M.get(e);
|
|
95
95
|
r.setFormValue(o);
|
|
96
96
|
}
|
|
@@ -101,7 +101,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
101
101
|
const { addedNodes: e, removedNodes: r } = t, o = Array.from(e), l = Array.from(r);
|
|
102
102
|
o.forEach((n) => {
|
|
103
103
|
var b;
|
|
104
|
-
if (c.has(n) && n.constructor.formAssociated &&
|
|
104
|
+
if (c.has(n) && n.constructor.formAssociated && U(n), k.has(n)) {
|
|
105
105
|
const d = k.get(n);
|
|
106
106
|
Object.keys(S).filter((y) => d[y] !== null).forEach((y) => {
|
|
107
107
|
n.setAttribute(S[y], d[y]);
|
|
@@ -113,18 +113,18 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
113
113
|
}
|
|
114
114
|
if (n.localName === "form") {
|
|
115
115
|
const d = g.get(n), x = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, {
|
|
116
|
-
acceptNode(
|
|
117
|
-
return c.has(
|
|
116
|
+
acceptNode(O) {
|
|
117
|
+
return c.has(O) && O.constructor.formAssociated && !(d && d.has(O)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
let y = x.nextNode();
|
|
121
121
|
for (; y; )
|
|
122
|
-
|
|
122
|
+
U(y), y = x.nextNode();
|
|
123
123
|
}
|
|
124
|
-
n.localName === "fieldset" && ((b = z.observe) == null || b.call(z, n,
|
|
124
|
+
n.localName === "fieldset" && ((b = z.observe) == null || b.call(z, n, G), j(n, !0));
|
|
125
125
|
}), l.forEach((n) => {
|
|
126
126
|
const b = c.get(n);
|
|
127
|
-
b && a.get(b) &&
|
|
127
|
+
b && a.get(b) && J(b), f.has(n) && f.get(n).disconnect();
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
}
|
|
@@ -132,15 +132,15 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
132
132
|
i.forEach((t) => {
|
|
133
133
|
const { removedNodes: e } = t;
|
|
134
134
|
e.forEach((r) => {
|
|
135
|
-
const o =
|
|
136
|
-
c.has(r) &&
|
|
135
|
+
const o = K.get(t.target);
|
|
136
|
+
c.has(r) && tt(r), o.disconnect();
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
const nt = (i) => {
|
|
141
141
|
var e;
|
|
142
142
|
const t = new MutationObserver(at);
|
|
143
|
-
(e = t.observe) == null || e.call(t, i, { childList: !0 }),
|
|
143
|
+
(e = t.observe) == null || e.call(t, i, { childList: !0 }), K.set(i, t);
|
|
144
144
|
};
|
|
145
145
|
T() && new MutationObserver(_);
|
|
146
146
|
const P = {
|
|
@@ -148,17 +148,17 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
148
148
|
subtree: !0
|
|
149
149
|
}, D = (i, t) => {
|
|
150
150
|
i.toggleAttribute("internals-disabled", t), t ? i.setAttribute("aria-disabled", "true") : i.removeAttribute("aria-disabled"), i.formDisabledCallback && i.formDisabledCallback.apply(i, [t]);
|
|
151
|
-
},
|
|
151
|
+
}, J = (i) => {
|
|
152
152
|
a.get(i).forEach((e) => {
|
|
153
153
|
e.remove();
|
|
154
154
|
}), a.set(i, []);
|
|
155
|
-
},
|
|
155
|
+
}, Q = (i, t) => {
|
|
156
156
|
const e = document.createElement("input");
|
|
157
157
|
return e.type = "hidden", e.name = i.getAttribute("name"), i.after(e), a.get(t).push(e), e;
|
|
158
158
|
}, st = (i, t) => {
|
|
159
159
|
var e;
|
|
160
|
-
a.set(t, []), (e = z.observe) == null || e.call(z, i,
|
|
161
|
-
},
|
|
160
|
+
a.set(t, []), (e = z.observe) == null || e.call(z, i, G);
|
|
161
|
+
}, X = (i, t) => {
|
|
162
162
|
if (t.length) {
|
|
163
163
|
Array.from(t).forEach((r) => r.addEventListener("click", i.click.bind(i)));
|
|
164
164
|
let e = t[0].id;
|
|
@@ -186,7 +186,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
186
186
|
t && t.size && t.forEach((e) => {
|
|
187
187
|
e.constructor.formAssociated && e.formResetCallback && e.formResetCallback.apply(e);
|
|
188
188
|
});
|
|
189
|
-
},
|
|
189
|
+
}, Y = (i, t, e) => {
|
|
190
190
|
if (t) {
|
|
191
191
|
const r = g.get(t);
|
|
192
192
|
if (r)
|
|
@@ -205,15 +205,15 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
205
205
|
}, w = (i, t, e = DOMException) => {
|
|
206
206
|
if (!i.constructor.formAssociated)
|
|
207
207
|
throw new e(t);
|
|
208
|
-
},
|
|
208
|
+
}, Z = (i, t, e) => {
|
|
209
209
|
const r = g.get(i);
|
|
210
210
|
return r && r.size && r.forEach((o) => {
|
|
211
211
|
c.get(o)[e]() || (t = !1);
|
|
212
212
|
}), t;
|
|
213
|
-
},
|
|
213
|
+
}, tt = (i) => {
|
|
214
214
|
if (i.constructor.formAssociated) {
|
|
215
215
|
const t = c.get(i), { labels: e, form: r } = t;
|
|
216
|
-
|
|
216
|
+
X(i, e), Y(i, r, t);
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
219
|
function T() {
|
|
@@ -230,7 +230,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
230
230
|
e !== "valid" && i[e] !== !1 && (t = !1);
|
|
231
231
|
return t;
|
|
232
232
|
}, $ = /* @__PURE__ */ new WeakMap();
|
|
233
|
-
function
|
|
233
|
+
function et(i, t) {
|
|
234
234
|
i.toggleAttribute(t, !0), i.part && i.part.add(t);
|
|
235
235
|
}
|
|
236
236
|
class V extends Set {
|
|
@@ -246,8 +246,8 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
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
248
|
const e = super.add(t), r = $.get(this), o = `state${t}`;
|
|
249
|
-
return r.isConnected ?
|
|
250
|
-
|
|
249
|
+
return r.isConnected ? et(r, o) : setTimeout(() => {
|
|
250
|
+
et(r, o);
|
|
251
251
|
}), e;
|
|
252
252
|
}
|
|
253
253
|
clear() {
|
|
@@ -262,7 +262,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
262
262
|
}), e;
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function it(i, t, e, r) {
|
|
266
266
|
if (e === "a" && !r)
|
|
267
267
|
throw new TypeError("Private accessor was defined without a getter");
|
|
268
268
|
if (typeof t == "function" ? i !== t || !r : !t.has(i))
|
|
@@ -289,10 +289,10 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
289
289
|
Object.freeze(this);
|
|
290
290
|
}
|
|
291
291
|
get length() {
|
|
292
|
-
return
|
|
292
|
+
return it(this, C, "f").length;
|
|
293
293
|
}
|
|
294
294
|
[(C = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
|
|
295
|
-
return
|
|
295
|
+
return it(this, C, "f")[Symbol.iterator]();
|
|
296
296
|
}
|
|
297
297
|
item(t) {
|
|
298
298
|
return this[t] == null ? null : this[t];
|
|
@@ -308,11 +308,11 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
308
308
|
HTMLFormElement.prototype.reportValidity = r;
|
|
309
309
|
function e(...l) {
|
|
310
310
|
let n = i.apply(this, l);
|
|
311
|
-
return
|
|
311
|
+
return Z(this, n, "checkValidity");
|
|
312
312
|
}
|
|
313
313
|
function r(...l) {
|
|
314
314
|
let n = t.apply(this, l);
|
|
315
|
-
return
|
|
315
|
+
return Z(this, n, "reportValidity");
|
|
316
316
|
}
|
|
317
317
|
const { get: o } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
|
|
318
318
|
Object.defineProperty(HTMLFormElement.prototype, "elements", {
|
|
@@ -325,7 +325,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
-
class
|
|
328
|
+
class rt {
|
|
329
329
|
static get isPolyfilled() {
|
|
330
330
|
return !0;
|
|
331
331
|
}
|
|
@@ -366,22 +366,22 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
366
366
|
const t = p.get(this);
|
|
367
367
|
if (w(t, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
|
|
368
368
|
return !0;
|
|
369
|
-
const e = this.checkValidity(), r =
|
|
369
|
+
const e = this.checkValidity(), r = B.get(this);
|
|
370
370
|
if (r && !t.constructor.formAssociated)
|
|
371
371
|
throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
|
|
372
372
|
return !e && r && (t.focus(), r.focus()), e;
|
|
373
373
|
}
|
|
374
374
|
setFormValue(t) {
|
|
375
375
|
const e = p.get(this);
|
|
376
|
-
if (w(e, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),
|
|
376
|
+
if (w(e, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), J(this), t != null && !(t instanceof FormData)) {
|
|
377
377
|
if (e.getAttribute("name")) {
|
|
378
|
-
const r =
|
|
378
|
+
const r = Q(e, this);
|
|
379
379
|
r.value = t;
|
|
380
380
|
}
|
|
381
381
|
} else
|
|
382
382
|
t != null && t instanceof FormData && Array.from(t).reverse().forEach(([r, o]) => {
|
|
383
383
|
if (typeof o == "string") {
|
|
384
|
-
const l =
|
|
384
|
+
const l = Q(e, this);
|
|
385
385
|
l.name = r, l.value = o;
|
|
386
386
|
}
|
|
387
387
|
});
|
|
@@ -391,7 +391,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
391
391
|
const o = p.get(this);
|
|
392
392
|
if (w(o, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
|
|
393
393
|
throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
|
|
394
|
-
|
|
394
|
+
B.set(this, r);
|
|
395
395
|
const l = s.get(this), n = {};
|
|
396
396
|
for (const x in t)
|
|
397
397
|
n[x] = t[x];
|
|
@@ -404,7 +404,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
404
404
|
u.set(this, d ? "" : e), o.isConnected ? (o.toggleAttribute("internals-invalid", !d), o.toggleAttribute("internals-valid", d), o.setAttribute("aria-invalid", `${!d}`)) : F.set(o, this);
|
|
405
405
|
}
|
|
406
406
|
get shadowRoot() {
|
|
407
|
-
const t = p.get(this), e =
|
|
407
|
+
const t = p.get(this), e = H.get(t);
|
|
408
408
|
return e || null;
|
|
409
409
|
}
|
|
410
410
|
get validationMessage() {
|
|
@@ -454,13 +454,13 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
456
|
} else {
|
|
457
|
-
if (typeof window < "u" && (window.ElementInternals =
|
|
457
|
+
if (typeof window < "u" && (window.ElementInternals = rt), typeof CustomElementRegistry < "u") {
|
|
458
458
|
const i = CustomElementRegistry.prototype.define;
|
|
459
459
|
CustomElementRegistry.prototype.define = function(t, e, r) {
|
|
460
460
|
if (e.formAssociated) {
|
|
461
461
|
const o = e.prototype.connectedCallback;
|
|
462
462
|
e.prototype.connectedCallback = function() {
|
|
463
|
-
|
|
463
|
+
q.has(this) || (q.set(this, !0), this.hasAttribute("disabled") && D(this, !0)), o != null && o.apply(this), tt(this);
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
466
|
i.call(this, t, e, r);
|
|
@@ -474,11 +474,11 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
474
474
|
return {};
|
|
475
475
|
if (c.has(this))
|
|
476
476
|
throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
|
|
477
|
-
return new
|
|
477
|
+
return new rt(this);
|
|
478
478
|
}), typeof Element < "u") {
|
|
479
479
|
let i = function(...e) {
|
|
480
480
|
const r = t.apply(this, e);
|
|
481
|
-
if (
|
|
481
|
+
if (H.set(this, r), T()) {
|
|
482
482
|
const o = new MutationObserver(_);
|
|
483
483
|
window.ShadyDOM ? o.observe(this, P) : o.observe(r, P), f.set(this, o);
|
|
484
484
|
}
|
|
@@ -578,10 +578,10 @@ class v extends xt {
|
|
|
578
578
|
?isFullWidth=${c}
|
|
579
579
|
?isResponsive=${g}
|
|
580
580
|
?isLoading=${f}>
|
|
581
|
-
${f ? this.renderSpinner() :
|
|
582
|
-
${M === "leading" ? N`<slot name="icon"></slot>` :
|
|
581
|
+
${f ? this.renderSpinner() : W}
|
|
582
|
+
${M === "leading" ? N`<slot name="icon"></slot>` : W}
|
|
583
583
|
<slot></slot>
|
|
584
|
-
${M === "trailing" ? N`<slot name="icon"></slot>` :
|
|
584
|
+
${M === "trailing" ? N`<slot name="icon"></slot>` : W}
|
|
585
585
|
</button>`;
|
|
586
586
|
}
|
|
587
587
|
focus() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.2",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@justeattakeaway/pie-spinner": "0.3.1",
|
|
41
41
|
"@justeattakeaway/pie-webc-core": "0.13.0",
|
|
42
|
-
"element-internals-polyfill": "1.3.
|
|
42
|
+
"element-internals-polyfill": "1.3.9"
|
|
43
43
|
}
|
|
44
44
|
}
|