@justeattakeaway/pie-button 0.49.1 → 0.49.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 +200 -211
- package/dist/react.js +14 -20
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { classMap as
|
|
1
|
+
import { LitElement as At, html as M, nothing as F, unsafeCSS as It } from "lit";
|
|
2
|
+
import { classMap as vt } from "lit/directives/class-map.js";
|
|
3
3
|
import { ifDefined as K } from "lit/directives/if-defined.js";
|
|
4
4
|
import { property as v } from "lit/decorators.js";
|
|
5
|
-
import { FormControlMixin as
|
|
5
|
+
import { FormControlMixin as Lt, validPropertyValues as A, defineCustomElement as Tt } from "@justeattakeaway/pie-webc-core";
|
|
6
6
|
import "@justeattakeaway/pie-spinner";
|
|
7
7
|
(function() {
|
|
8
|
-
(function(
|
|
9
|
-
const a = /* @__PURE__ */ new WeakMap(),
|
|
8
|
+
(function(k) {
|
|
9
|
+
const a = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), T = {
|
|
10
10
|
ariaAtomic: "aria-atomic",
|
|
11
11
|
ariaAutoComplete: "aria-autocomplete",
|
|
12
12
|
ariaBusy: "aria-busy",
|
|
@@ -49,89 +49,89 @@ import "@justeattakeaway/pie-spinner";
|
|
|
49
49
|
ariaValueNow: "aria-valuenow",
|
|
50
50
|
ariaValueText: "aria-valuetext",
|
|
51
51
|
role: "role"
|
|
52
|
-
},
|
|
53
|
-
for (let o in
|
|
52
|
+
}, ht = (e, t) => {
|
|
53
|
+
for (let o in T) {
|
|
54
54
|
t[o] = null;
|
|
55
55
|
let i = null;
|
|
56
|
-
const
|
|
56
|
+
const n = T[o];
|
|
57
57
|
Object.defineProperty(t, o, {
|
|
58
58
|
get() {
|
|
59
59
|
return i;
|
|
60
60
|
},
|
|
61
61
|
set(s) {
|
|
62
|
-
i = s, e.isConnected ? e.setAttribute(
|
|
62
|
+
i = s, e.isConnected ? e.setAttribute(n, s) : I.set(e, t);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
function
|
|
67
|
+
function X(e) {
|
|
68
68
|
const t = c.get(e), { form: o } = t;
|
|
69
|
-
|
|
69
|
+
it(e, o, t), ot(e, t.labels);
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const Y = (e, t = !1) => {
|
|
72
72
|
const o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
73
73
|
acceptNode(s) {
|
|
74
74
|
return c.has(s) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
let i = o.nextNode();
|
|
78
|
-
const
|
|
78
|
+
const n = !t || e.disabled;
|
|
79
79
|
for (; i; )
|
|
80
|
-
i.formDisabledCallback &&
|
|
81
|
-
},
|
|
80
|
+
i.formDisabledCallback && n && $(i, e.disabled), i = o.nextNode();
|
|
81
|
+
}, Z = { attributes: !0, attributeFilter: ["disabled", "name"] }, V = O() ? new MutationObserver((e) => {
|
|
82
82
|
for (const t of e) {
|
|
83
83
|
const o = t.target;
|
|
84
|
-
if (t.attributeName === "disabled" && (o.constructor.formAssociated ? $(o, o.hasAttribute("disabled")) : o.localName === "fieldset" &&
|
|
85
|
-
const i = c.get(o),
|
|
86
|
-
i.setFormValue(
|
|
84
|
+
if (t.attributeName === "disabled" && (o.constructor.formAssociated ? $(o, o.hasAttribute("disabled")) : o.localName === "fieldset" && Y(o)), t.attributeName === "name" && o.constructor.formAssociated) {
|
|
85
|
+
const i = c.get(o), n = j.get(o);
|
|
86
|
+
i.setFormValue(n);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}) : {};
|
|
90
90
|
function _(e) {
|
|
91
91
|
e.forEach((t) => {
|
|
92
|
-
const { addedNodes: o, removedNodes: i } = t,
|
|
93
|
-
|
|
92
|
+
const { addedNodes: o, removedNodes: i } = t, n = Array.from(o), s = Array.from(i);
|
|
93
|
+
n.forEach((l) => {
|
|
94
94
|
var u;
|
|
95
|
-
if (c.has(l) && l.constructor.formAssociated &&
|
|
95
|
+
if (c.has(l) && l.constructor.formAssociated && X(l), I.has(l)) {
|
|
96
96
|
const p = I.get(l);
|
|
97
|
-
Object.keys(
|
|
98
|
-
l.setAttribute(
|
|
97
|
+
Object.keys(T).filter((g) => p[g] !== null).forEach((g) => {
|
|
98
|
+
l.setAttribute(T[g], p[g]);
|
|
99
99
|
}), I.delete(l);
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
102
|
-
const p =
|
|
103
|
-
l.setAttribute("internals-valid", p.validity.valid.toString()), l.setAttribute("internals-invalid", (!p.validity.valid).toString()), l.setAttribute("aria-invalid", (!p.validity.valid).toString()),
|
|
101
|
+
if (L.has(l)) {
|
|
102
|
+
const p = L.get(l);
|
|
103
|
+
l.setAttribute("internals-valid", p.validity.valid.toString()), l.setAttribute("internals-invalid", (!p.validity.valid).toString()), l.setAttribute("aria-invalid", (!p.validity.valid).toString()), L.delete(l);
|
|
104
104
|
}
|
|
105
105
|
if (l.localName === "form") {
|
|
106
|
-
const p =
|
|
106
|
+
const p = E.get(l), x = document.createTreeWalker(l, NodeFilter.SHOW_ELEMENT, {
|
|
107
107
|
acceptNode(B) {
|
|
108
108
|
return c.has(B) && B.constructor.formAssociated && !(p && p.has(B)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
|
-
let
|
|
112
|
-
for (;
|
|
113
|
-
|
|
111
|
+
let g = x.nextNode();
|
|
112
|
+
for (; g; )
|
|
113
|
+
X(g), g = x.nextNode();
|
|
114
114
|
}
|
|
115
|
-
l.localName === "fieldset" && ((u = V.observe) === null || u === void 0 || u.call(V, l,
|
|
115
|
+
l.localName === "fieldset" && ((u = V.observe) === null || u === void 0 || u.call(V, l, Z), Y(l, !0));
|
|
116
116
|
}), s.forEach((l) => {
|
|
117
117
|
const u = c.get(l);
|
|
118
|
-
u &&
|
|
118
|
+
u && b.get(u) && tt(u), S.has(l) && S.get(l).disconnect();
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function pt(e) {
|
|
123
123
|
e.forEach((t) => {
|
|
124
124
|
const { removedNodes: o } = t;
|
|
125
125
|
o.forEach((i) => {
|
|
126
|
-
const
|
|
127
|
-
c.has(i) &&
|
|
126
|
+
const n = J.get(t.target);
|
|
127
|
+
c.has(i) && nt(i), n.disconnect();
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
const
|
|
131
|
+
const mt = (e) => {
|
|
132
132
|
var t, o;
|
|
133
|
-
const i = new MutationObserver(
|
|
134
|
-
!((t = window == null ? void 0 : window.ShadyDOM) === null || t === void 0) && t.inUse && e.mode && e.host && (e = e.host), (o = i.observe) === null || o === void 0 || o.call(i, e, { childList: !0 }),
|
|
133
|
+
const i = new MutationObserver(pt);
|
|
134
|
+
!((t = window == null ? void 0 : window.ShadyDOM) === null || t === void 0) && t.inUse && e.mode && e.host && (e = e.host), (o = i.observe) === null || o === void 0 || o.call(i, e, { childList: !0 }), J.set(e, i);
|
|
135
135
|
};
|
|
136
136
|
O() && new MutationObserver(_);
|
|
137
137
|
const R = {
|
|
@@ -139,54 +139,54 @@ import "@justeattakeaway/pie-spinner";
|
|
|
139
139
|
subtree: !0
|
|
140
140
|
}, $ = (e, t) => {
|
|
141
141
|
e.toggleAttribute("internals-disabled", t), t ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled"), e.formDisabledCallback && e.formDisabledCallback.apply(e, [t]);
|
|
142
|
-
},
|
|
143
|
-
|
|
142
|
+
}, tt = (e) => {
|
|
143
|
+
b.get(e).forEach((o) => {
|
|
144
144
|
o.remove();
|
|
145
|
-
}),
|
|
146
|
-
},
|
|
145
|
+
}), b.set(e, []);
|
|
146
|
+
}, et = (e, t) => {
|
|
147
147
|
const o = document.createElement("input");
|
|
148
|
-
return o.type = "hidden", o.name = e.getAttribute("name"), e.after(o),
|
|
149
|
-
},
|
|
148
|
+
return o.type = "hidden", o.name = e.getAttribute("name"), e.after(o), b.get(t).push(o), o;
|
|
149
|
+
}, ut = (e, t) => {
|
|
150
150
|
var o;
|
|
151
|
-
|
|
152
|
-
},
|
|
151
|
+
b.set(t, []), (o = V.observe) === null || o === void 0 || o.call(V, e, Z);
|
|
152
|
+
}, ot = (e, t) => {
|
|
153
153
|
if (t.length) {
|
|
154
154
|
Array.from(t).forEach((i) => i.addEventListener("click", e.click.bind(e)));
|
|
155
155
|
let o = t[0].id;
|
|
156
156
|
t[0].id || (o = `${t[0].htmlFor}_Label`, t[0].id = o), e.setAttribute("aria-labelledby", o);
|
|
157
157
|
}
|
|
158
158
|
}, N = (e) => {
|
|
159
|
-
const t = Array.from(e.elements).filter((s) => !s.tagName.includes("-") && s.validity).map((s) => s.validity.valid), o =
|
|
160
|
-
e.toggleAttribute("internals-invalid",
|
|
161
|
-
}, ut = (e) => {
|
|
162
|
-
N(P(e.target));
|
|
159
|
+
const t = Array.from(e.elements).filter((s) => !s.tagName.includes("-") && s.validity).map((s) => s.validity.valid), o = E.get(e) || [], i = Array.from(o).filter((s) => s.isConnected).map((s) => c.get(s).validity.valid), n = [...t, ...i].includes(!1);
|
|
160
|
+
e.toggleAttribute("internals-invalid", n), e.toggleAttribute("internals-valid", !n);
|
|
163
161
|
}, ft = (e) => {
|
|
164
162
|
N(P(e.target));
|
|
165
163
|
}, gt = (e) => {
|
|
164
|
+
N(P(e.target));
|
|
165
|
+
}, yt = (e) => {
|
|
166
166
|
const t = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((o) => `${o}:not([disabled])`).map((o) => `${o}:not([form])${e.id ? `,${o}[form='${e.id}']` : ""}`).join(",");
|
|
167
167
|
e.addEventListener("click", (o) => {
|
|
168
168
|
if (o.target.closest(t)) {
|
|
169
|
-
const
|
|
169
|
+
const n = E.get(e);
|
|
170
170
|
if (e.noValidate)
|
|
171
171
|
return;
|
|
172
|
-
|
|
172
|
+
n.size && Array.from(n).reverse().map((u) => c.get(u).reportValidity()).includes(!1) && o.preventDefault();
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
|
-
},
|
|
176
|
-
const t =
|
|
175
|
+
}, wt = (e) => {
|
|
176
|
+
const t = E.get(e.target);
|
|
177
177
|
t && t.size && t.forEach((o) => {
|
|
178
178
|
o.constructor.formAssociated && o.formResetCallback && o.formResetCallback.apply(o);
|
|
179
179
|
});
|
|
180
|
-
},
|
|
180
|
+
}, it = (e, t, o) => {
|
|
181
181
|
if (t) {
|
|
182
|
-
const i =
|
|
182
|
+
const i = E.get(t);
|
|
183
183
|
if (i)
|
|
184
184
|
i.add(e);
|
|
185
185
|
else {
|
|
186
|
-
const
|
|
187
|
-
|
|
186
|
+
const n = /* @__PURE__ */ new Set();
|
|
187
|
+
n.add(e), E.set(t, n), yt(t), t.addEventListener("reset", wt), t.addEventListener("input", ft), t.addEventListener("change", gt);
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
y.set(t, { ref: e, internals: o }), e.constructor.formAssociated && e.formAssociatedCallback && setTimeout(() => {
|
|
190
190
|
e.formAssociatedCallback.apply(e, [t]);
|
|
191
191
|
}, 0), N(t);
|
|
192
192
|
}
|
|
@@ -196,32 +196,32 @@ import "@justeattakeaway/pie-spinner";
|
|
|
196
196
|
}, w = (e, t, o = DOMException) => {
|
|
197
197
|
if (!e.constructor.formAssociated)
|
|
198
198
|
throw new o(t);
|
|
199
|
-
},
|
|
200
|
-
const i =
|
|
201
|
-
return i && i.size && i.forEach((
|
|
202
|
-
c.get(
|
|
199
|
+
}, rt = (e, t, o) => {
|
|
200
|
+
const i = E.get(e);
|
|
201
|
+
return i && i.size && i.forEach((n) => {
|
|
202
|
+
c.get(n)[o]() || (t = !1);
|
|
203
203
|
}), t;
|
|
204
|
-
},
|
|
204
|
+
}, nt = (e) => {
|
|
205
205
|
if (e.constructor.formAssociated) {
|
|
206
206
|
const t = c.get(e), { labels: o, form: i } = t;
|
|
207
|
-
|
|
207
|
+
ot(e, o), it(e, i, t);
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
function O() {
|
|
211
211
|
return typeof MutationObserver < "u";
|
|
212
212
|
}
|
|
213
|
-
class
|
|
213
|
+
class xt {
|
|
214
214
|
constructor() {
|
|
215
215
|
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
216
|
}
|
|
217
217
|
}
|
|
218
|
-
const
|
|
218
|
+
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, o) => (e.valid = Mt(t), Object.keys(t).forEach((i) => e[i] = t[i]), o && N(o), e), Mt = (e) => {
|
|
219
219
|
let t = !0;
|
|
220
220
|
for (let o in e)
|
|
221
221
|
o !== "valid" && e[o] !== !1 && (t = !1);
|
|
222
222
|
return t;
|
|
223
223
|
}, D = /* @__PURE__ */ new WeakMap();
|
|
224
|
-
function
|
|
224
|
+
function at(e, t) {
|
|
225
225
|
e.toggleAttribute(t, !0), e.part && e.part.add(t);
|
|
226
226
|
}
|
|
227
227
|
class W extends Set {
|
|
@@ -236,9 +236,9 @@ import "@justeattakeaway/pie-spinner";
|
|
|
236
236
|
add(t) {
|
|
237
237
|
if (!/^--/.test(t) || typeof t != "string")
|
|
238
238
|
throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);
|
|
239
|
-
const o = super.add(t), i = D.get(this),
|
|
240
|
-
return i.isConnected ?
|
|
241
|
-
|
|
239
|
+
const o = super.add(t), i = D.get(this), n = `state${t}`;
|
|
240
|
+
return i.isConnected ? at(i, n) : setTimeout(() => {
|
|
241
|
+
at(i, n);
|
|
242
242
|
}), o;
|
|
243
243
|
}
|
|
244
244
|
clear() {
|
|
@@ -253,26 +253,19 @@ import "@justeattakeaway/pie-spinner";
|
|
|
253
253
|
}), o;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
if (o === "a" && !i)
|
|
258
|
-
|
|
259
|
-
if (typeof t == "function" ? e !== t || !i : !t.has(e))
|
|
260
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
256
|
+
function st(e, t, o, i) {
|
|
257
|
+
if (o === "a" && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
258
|
+
if (typeof t == "function" ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
261
259
|
return o === "m" ? i : o === "a" ? i.call(e) : i ? i.value : t.get(e);
|
|
262
260
|
}
|
|
263
|
-
function
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
if (i === "a" && !r)
|
|
267
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
268
|
-
if (typeof t == "function" ? e !== t || !r : !t.has(e))
|
|
269
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
270
|
-
return i === "a" ? r.call(e, o) : r ? r.value = o : t.set(e, o), o;
|
|
261
|
+
function St(e, t, o, i, n) {
|
|
262
|
+
if (typeof t == "function" ? e !== t || !n : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
263
|
+
return t.set(e, o), o;
|
|
271
264
|
}
|
|
272
265
|
var z;
|
|
273
|
-
class
|
|
266
|
+
class Ct {
|
|
274
267
|
constructor(t) {
|
|
275
|
-
z.set(this, void 0),
|
|
268
|
+
z.set(this, void 0), St(this, z, t);
|
|
276
269
|
for (let o = 0; o < t.length; o++) {
|
|
277
270
|
let i = t[o];
|
|
278
271
|
this[o] = i, i.hasAttribute("name") && (this[i.getAttribute("name")] = i);
|
|
@@ -280,10 +273,10 @@ import "@justeattakeaway/pie-spinner";
|
|
|
280
273
|
Object.freeze(this);
|
|
281
274
|
}
|
|
282
275
|
get length() {
|
|
283
|
-
return
|
|
276
|
+
return st(this, z, "f").length;
|
|
284
277
|
}
|
|
285
278
|
[(z = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() {
|
|
286
|
-
return
|
|
279
|
+
return st(this, z, "f")[Symbol.iterator]();
|
|
287
280
|
}
|
|
288
281
|
item(t) {
|
|
289
282
|
return this[t] == null ? null : this[t];
|
|
@@ -292,45 +285,45 @@ import "@justeattakeaway/pie-spinner";
|
|
|
292
285
|
return this[t] == null ? null : this[t];
|
|
293
286
|
}
|
|
294
287
|
}
|
|
295
|
-
function
|
|
288
|
+
function zt() {
|
|
296
289
|
const e = HTMLFormElement.prototype.checkValidity;
|
|
297
290
|
HTMLFormElement.prototype.checkValidity = o;
|
|
298
291
|
const t = HTMLFormElement.prototype.reportValidity;
|
|
299
292
|
HTMLFormElement.prototype.reportValidity = i;
|
|
300
293
|
function o(...s) {
|
|
301
294
|
let l = e.apply(this, s);
|
|
302
|
-
return
|
|
295
|
+
return rt(this, l, "checkValidity");
|
|
303
296
|
}
|
|
304
297
|
function i(...s) {
|
|
305
298
|
let l = t.apply(this, s);
|
|
306
|
-
return
|
|
299
|
+
return rt(this, l, "reportValidity");
|
|
307
300
|
}
|
|
308
|
-
const { get:
|
|
301
|
+
const { get: n } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
|
|
309
302
|
Object.defineProperty(HTMLFormElement.prototype, "elements", {
|
|
310
303
|
get(...s) {
|
|
311
|
-
const l =
|
|
304
|
+
const l = n.call(this, ...s), u = Array.from(E.get(this) || []);
|
|
312
305
|
if (u.length === 0)
|
|
313
306
|
return l;
|
|
314
|
-
const p = Array.from(l).concat(u).sort((x,
|
|
315
|
-
return new
|
|
307
|
+
const p = Array.from(l).concat(u).sort((x, g) => x.compareDocumentPosition ? x.compareDocumentPosition(g) & 2 ? 1 : -1 : 0);
|
|
308
|
+
return new Ct(p);
|
|
316
309
|
}
|
|
317
310
|
});
|
|
318
311
|
}
|
|
319
|
-
class
|
|
312
|
+
class lt {
|
|
320
313
|
static get isPolyfilled() {
|
|
321
314
|
return !0;
|
|
322
315
|
}
|
|
323
316
|
constructor(t) {
|
|
324
317
|
if (!t || !t.tagName || t.tagName.indexOf("-") === -1)
|
|
325
318
|
throw new TypeError("Illegal constructor");
|
|
326
|
-
const o = t.getRootNode(), i = new
|
|
327
|
-
this.states = new W(t), a.set(this, t),
|
|
319
|
+
const o = t.getRootNode(), i = new xt();
|
|
320
|
+
this.states = new W(t), a.set(this, t), r.set(this, i), c.set(t, this), ht(t, this), ut(t, this), Object.seal(this), o instanceof DocumentFragment && mt(o);
|
|
328
321
|
}
|
|
329
322
|
checkValidity() {
|
|
330
323
|
const t = a.get(this);
|
|
331
324
|
if (w(t, "Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
|
|
332
325
|
return !0;
|
|
333
|
-
const o =
|
|
326
|
+
const o = r.get(this);
|
|
334
327
|
if (!o.valid) {
|
|
335
328
|
const i = new Event("invalid", {
|
|
336
329
|
bubbles: !1,
|
|
@@ -357,45 +350,44 @@ import "@justeattakeaway/pie-spinner";
|
|
|
357
350
|
const t = a.get(this);
|
|
358
351
|
if (w(t, "Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !this.willValidate)
|
|
359
352
|
return !0;
|
|
360
|
-
const o = this.checkValidity(), i =
|
|
353
|
+
const o = this.checkValidity(), i = G.get(this);
|
|
361
354
|
if (i && !t.constructor.formAssociated)
|
|
362
355
|
throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");
|
|
363
356
|
return !o && i && (t.focus(), i.focus()), o;
|
|
364
357
|
}
|
|
365
358
|
setFormValue(t) {
|
|
366
359
|
const o = a.get(this);
|
|
367
|
-
if (w(o, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),
|
|
360
|
+
if (w(o, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), tt(this), t != null && !(t instanceof FormData)) {
|
|
368
361
|
if (o.getAttribute("name")) {
|
|
369
|
-
const i =
|
|
362
|
+
const i = et(o, this);
|
|
370
363
|
i.value = t;
|
|
371
364
|
}
|
|
372
|
-
} else
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
});
|
|
365
|
+
} else t != null && t instanceof FormData && Array.from(t).reverse().forEach(([i, n]) => {
|
|
366
|
+
if (typeof n == "string") {
|
|
367
|
+
const s = et(o, this);
|
|
368
|
+
s.name = i, s.value = n;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
379
371
|
j.set(o, t);
|
|
380
372
|
}
|
|
381
373
|
setValidity(t, o, i) {
|
|
382
|
-
const
|
|
383
|
-
if (w(
|
|
374
|
+
const n = a.get(this);
|
|
375
|
+
if (w(n, "Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."), !t)
|
|
384
376
|
throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");
|
|
385
|
-
|
|
386
|
-
const s =
|
|
377
|
+
G.set(this, i);
|
|
378
|
+
const s = r.get(this), l = {};
|
|
387
379
|
for (const x in t)
|
|
388
380
|
l[x] = t[x];
|
|
389
|
-
Object.keys(l).length === 0 &&
|
|
381
|
+
Object.keys(l).length === 0 && Et(s);
|
|
390
382
|
const u = Object.assign(Object.assign({}, s), l);
|
|
391
383
|
delete u.valid;
|
|
392
|
-
const { valid: p } =
|
|
384
|
+
const { valid: p } = kt(s, u, this.form);
|
|
393
385
|
if (!p && !o)
|
|
394
386
|
throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");
|
|
395
|
-
m.set(this, p ? "" : o),
|
|
387
|
+
m.set(this, p ? "" : o), n.isConnected ? (n.toggleAttribute("internals-invalid", !p), n.toggleAttribute("internals-valid", p), n.setAttribute("aria-invalid", `${!p}`)) : L.set(n, this);
|
|
396
388
|
}
|
|
397
389
|
get shadowRoot() {
|
|
398
|
-
const t = a.get(this), o =
|
|
390
|
+
const t = a.get(this), o = q.get(t);
|
|
399
391
|
return o || null;
|
|
400
392
|
}
|
|
401
393
|
get validationMessage() {
|
|
@@ -404,14 +396,14 @@ import "@justeattakeaway/pie-spinner";
|
|
|
404
396
|
}
|
|
405
397
|
get validity() {
|
|
406
398
|
const t = a.get(this);
|
|
407
|
-
return w(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),
|
|
399
|
+
return w(t, "Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."), r.get(this);
|
|
408
400
|
}
|
|
409
401
|
get willValidate() {
|
|
410
402
|
const t = a.get(this);
|
|
411
403
|
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"));
|
|
412
404
|
}
|
|
413
405
|
}
|
|
414
|
-
function
|
|
406
|
+
function Ft() {
|
|
415
407
|
if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals)
|
|
416
408
|
return !1;
|
|
417
409
|
class e extends HTMLElement {
|
|
@@ -435,55 +427,54 @@ import "@justeattakeaway/pie-spinner";
|
|
|
435
427
|
"reportValidity"
|
|
436
428
|
].every((i) => i in o.internals);
|
|
437
429
|
}
|
|
438
|
-
let
|
|
430
|
+
let ct = !1, dt = !1;
|
|
439
431
|
function H(e) {
|
|
440
|
-
|
|
432
|
+
dt || (dt = !0, window.CustomStateSet = W, e && (HTMLElement.prototype.attachInternals = function(...t) {
|
|
441
433
|
const o = e.call(this, t);
|
|
442
434
|
return o.states = new W(this), o;
|
|
443
435
|
}));
|
|
444
436
|
}
|
|
445
|
-
function
|
|
446
|
-
if (!
|
|
447
|
-
if (
|
|
437
|
+
function bt(e = !0) {
|
|
438
|
+
if (!ct) {
|
|
439
|
+
if (ct = !0, typeof window < "u" && (window.ElementInternals = lt), typeof CustomElementRegistry < "u") {
|
|
448
440
|
const t = CustomElementRegistry.prototype.define;
|
|
449
|
-
CustomElementRegistry.prototype.define = function(o, i,
|
|
441
|
+
CustomElementRegistry.prototype.define = function(o, i, n) {
|
|
450
442
|
if (i.formAssociated) {
|
|
451
443
|
const s = i.prototype.connectedCallback;
|
|
452
444
|
i.prototype.connectedCallback = function() {
|
|
453
|
-
|
|
445
|
+
Q.has(this) || (Q.set(this, !0), this.hasAttribute("disabled") && $(this, !0)), s != null && s.apply(this), nt(this);
|
|
454
446
|
};
|
|
455
447
|
}
|
|
456
|
-
t.call(this, o, i,
|
|
448
|
+
t.call(this, o, i, n);
|
|
457
449
|
};
|
|
458
450
|
}
|
|
459
451
|
if (typeof HTMLElement < "u" && (HTMLElement.prototype.attachInternals = function() {
|
|
460
452
|
if (this.tagName) {
|
|
461
453
|
if (this.tagName.indexOf("-") === -1)
|
|
462
454
|
throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.");
|
|
463
|
-
} else
|
|
464
|
-
return {};
|
|
455
|
+
} else return {};
|
|
465
456
|
if (c.has(this))
|
|
466
457
|
throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
|
|
467
|
-
return new
|
|
458
|
+
return new lt(this);
|
|
468
459
|
}), typeof Element < "u") {
|
|
469
460
|
let t = function(...i) {
|
|
470
|
-
const
|
|
471
|
-
if (
|
|
461
|
+
const n = o.apply(this, i);
|
|
462
|
+
if (q.set(this, n), O()) {
|
|
472
463
|
const s = new MutationObserver(_);
|
|
473
|
-
window.ShadyDOM ? s.observe(this, R) : s.observe(
|
|
464
|
+
window.ShadyDOM ? s.observe(this, R) : s.observe(n, R), S.set(this, s);
|
|
474
465
|
}
|
|
475
|
-
return
|
|
466
|
+
return n;
|
|
476
467
|
};
|
|
477
468
|
const o = Element.prototype.attachShadow;
|
|
478
469
|
Element.prototype.attachShadow = t;
|
|
479
470
|
}
|
|
480
|
-
O() && typeof document < "u" && new MutationObserver(_).observe(document.documentElement, R), typeof HTMLFormElement < "u" &&
|
|
471
|
+
O() && typeof document < "u" && new MutationObserver(_).observe(document.documentElement, R), typeof HTMLFormElement < "u" && zt(), (e || typeof window < "u" && !window.CustomStateSet) && H();
|
|
481
472
|
}
|
|
482
473
|
}
|
|
483
|
-
return !!customElements.polyfillWrapFlushCallback || (
|
|
474
|
+
return !!customElements.polyfillWrapFlushCallback || (Ft() ? typeof window < "u" && !window.CustomStateSet && H(HTMLElement.prototype.attachInternals) : bt(!1)), k.forceCustomStateSetPolyfill = H, k.forceElementInternalsPolyfill = bt, Object.defineProperty(k, "__esModule", { value: !0 }), k;
|
|
484
475
|
})({});
|
|
485
476
|
})();
|
|
486
|
-
const
|
|
477
|
+
const Vt = ["button", "a"], Nt = ["xsmall", "small-productive", "small-expressive", "medium", "large"], qt = ["productive", "expressive"], Pt = ["submit", "button", "reset"], Ot = [
|
|
487
478
|
"primary",
|
|
488
479
|
"secondary",
|
|
489
480
|
"outline",
|
|
@@ -493,7 +484,7 @@ const Lt = ["button", "a"], Vt = ["xsmall", "small-productive", "small-expressiv
|
|
|
493
484
|
"ghost-inverse",
|
|
494
485
|
"destructive",
|
|
495
486
|
"destructive-ghost"
|
|
496
|
-
],
|
|
487
|
+
], _t = ["leading", "trailing"], Gt = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], Jt = ["post", "get", "dialog"], Qt = ["_self", "_blank", "_parent", "_top"], f = {
|
|
497
488
|
tag: "button",
|
|
498
489
|
size: "medium",
|
|
499
490
|
type: "submit",
|
|
@@ -503,21 +494,19 @@ const Lt = ["button", "a"], Vt = ["xsmall", "small-productive", "small-expressiv
|
|
|
503
494
|
isLoading: !1,
|
|
504
495
|
isFullWidth: !1,
|
|
505
496
|
isResponsive: !1
|
|
506
|
-
}, _t = `*,*:after,*:before{box-sizing:inherit}.o-btn{--btn-border-radius: var(--dt-radius-rounded-e);--btn-font-family: var(--dt-font-interactive-l-family);--btn-font-weight: var(--dt-font-interactive-l-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;--icon-display-override: block;position:relative;display:inline-flex;gap:var(--dt-spacing-b);align-items:center;justify-content:center;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;-webkit-user-select:none;user-select:none;text-decoration:none;inline-size:var(--btn-inline-size)}.o-btn.o-btn--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.o-btn--primary:active:not(:disabled),.o-btn.o-btn--primary.is-loading: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.o-btn--primary.o-btn--xsmall,.o-btn.o-btn--primary.o-btn--small-productive{--btn-bg-color: var(--dt-color-interactive-primary)}.o-btn.o-btn--primary.o-btn--xsmall:hover:not(:disabled),.o-btn.o-btn--primary.o-btn--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.o-btn--primary.o-btn--xsmall:active:not(:disabled),.o-btn.o-btn--primary.o-btn--xsmall.is-loading:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive:active:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.is-loading: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)))}@media (min-width: 769px){.o-btn.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive,.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive{--btn-bg-color: var(--dt-color-interactive-brand)}.o-btn.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive:hover:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive: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.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive:active:not(:disabled),.o-btn.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive.is-loading:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive:active:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive.is-loading: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.o-btn--secondary{--btn-bg-color: var(--dt-color-interactive-secondary);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn.o-btn--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.o-btn--secondary:active:not(:disabled),.o-btn.o-btn--secondary.is-loading: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.o-btn--outline{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-secondary);border:1px solid var(--dt-color-border-strong)}.o-btn.o-btn--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.o-btn--outline:active:not(:disabled),.o-btn.o-btn--outline.is-loading: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.o-btn--ghost{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-link)}.o-btn.o-btn--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.o-btn--ghost:active:not(:disabled),.o-btn.o-btn--ghost.is-loading: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.o-btn--inverse{--btn-bg-color: var(--dt-color-interactive-inverse);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn.o-btn--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.o-btn--inverse:active:not(:disabled),.o-btn.o-btn--inverse.is-loading: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.o-btn--ghost-inverse,.o-btn.o-btn--outline-inverse{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-primary)}.o-btn.o-btn--ghost-inverse:hover:not(:disabled),.o-btn.o-btn--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.o-btn--ghost-inverse:active:not(:disabled),.o-btn.o-btn--ghost-inverse.is-loading:not(:disabled),.o-btn.o-btn--outline-inverse:active:not(:disabled),.o-btn.o-btn--outline-inverse.is-loading: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.o-btn--outline-inverse:not([disabled]){border:1px solid var(--dt-color-border-strong)}.o-btn.o-btn--destructive{--btn-bg-color: var(--dt-color-support-error)}.o-btn.o-btn--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.o-btn--destructive:active:not(:disabled),.o-btn.o-btn--destructive.is-loading: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.o-btn--destructive-ghost{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-error)}.o-btn.o-btn--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.o-btn--destructive-ghost:active:not(:disabled),.o-btn.o-btn--destructive-ghost.is-loading: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.o-btn--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);--icon-size-override: 16px}@media (min-width: 769px){.o-btn.o-btn--xsmall.o-btn--responsive{--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);--icon-size-override: 20px}.o-btn.o-btn--xsmall.o-btn--responsive.o-btn--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);--icon-size-override: 20px}}.o-btn.o-btn--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);--icon-size-override: 20px}@media (min-width: 769px){.o-btn.o-btn--small-expressive.o-btn--responsive{--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);--icon-size-override: 24px}}.o-btn.o-btn--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);--icon-size-override: 20px}@media (min-width: 769px){.o-btn.o-btn--small-productive.o-btn--responsive{--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);--icon-size-override: 24px}}.o-btn.o-btn--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);--icon-size-override: 24px}@media (min-width: 769px){.o-btn.o-btn--medium.o-btn--responsive{--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);--icon-size-override: 24px}}.o-btn.o-btn--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);--icon-size-override: 24px}.o-btn.o-btn--fullWidth{--btn-inline-size: 100%}.o-btn[disabled]{--btn-text-color: var(--dt-color-content-disabled) !important;cursor:not-allowed}.o-btn[disabled]:not(.o-btn--ghost,.o-btn--ghost-inverse,.o-btn--destructive-ghost){--btn-bg-color: var(--dt-color-disabled-01) !important}.o-btn[disabled].o-btn--outline{border-color:var(--dt-color-disabled-01)!important}.o-btn.is-loading>*:not(pie-spinner){visibility:hidden}.o-btn.is-loading 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(--icon-size-override);width:var(--icon-size-override)}
|
|
507
|
-
|
|
508
|
-
var
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return d && c && Rt(a, n, c), c;
|
|
497
|
+
}, Rt = "*,*:after,*:before{box-sizing:inherit}.o-btn{--btn-border-radius: var(--dt-radius-rounded-e);--btn-font-family: var(--dt-font-interactive-l-family);--btn-font-weight: var(--dt-font-interactive-l-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;--icon-display-override: block;position:relative;display:inline-flex;gap:var(--dt-spacing-b);align-items:center;justify-content:center;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;-webkit-user-select:none;user-select:none;text-decoration:none;inline-size:var(--btn-inline-size)}.o-btn.o-btn--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.o-btn--primary:active:not(:disabled),.o-btn.o-btn--primary.is-loading: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.o-btn--primary.o-btn--xsmall,.o-btn.o-btn--primary.o-btn--small-productive{--btn-bg-color: var(--dt-color-interactive-primary)}.o-btn.o-btn--primary.o-btn--xsmall:hover:not(:disabled),.o-btn.o-btn--primary.o-btn--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.o-btn--primary.o-btn--xsmall:active:not(:disabled),.o-btn.o-btn--primary.o-btn--xsmall.is-loading:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive:active:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.is-loading: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)))}@media (min-width: 769px){.o-btn.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive,.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive{--btn-bg-color: var(--dt-color-interactive-brand)}.o-btn.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive:hover:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive: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.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive:active:not(:disabled),.o-btn.o-btn--primary.o-btn--xsmall.o-btn--expressive.o-btn--responsive.is-loading:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive:active:not(:disabled),.o-btn.o-btn--primary.o-btn--small-productive.o-btn--responsive.is-loading: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.o-btn--secondary{--btn-bg-color: var(--dt-color-interactive-secondary);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn.o-btn--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.o-btn--secondary:active:not(:disabled),.o-btn.o-btn--secondary.is-loading: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.o-btn--outline{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-secondary);border:1px solid var(--dt-color-border-strong)}.o-btn.o-btn--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.o-btn--outline:active:not(:disabled),.o-btn.o-btn--outline.is-loading: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.o-btn--ghost{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-link)}.o-btn.o-btn--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.o-btn--ghost:active:not(:disabled),.o-btn.o-btn--ghost.is-loading: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.o-btn--inverse{--btn-bg-color: var(--dt-color-interactive-inverse);--btn-text-color: var(--dt-color-content-interactive-secondary)}.o-btn.o-btn--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.o-btn--inverse:active:not(:disabled),.o-btn.o-btn--inverse.is-loading: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.o-btn--ghost-inverse,.o-btn.o-btn--outline-inverse{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-primary)}.o-btn.o-btn--ghost-inverse:hover:not(:disabled),.o-btn.o-btn--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.o-btn--ghost-inverse:active:not(:disabled),.o-btn.o-btn--ghost-inverse.is-loading:not(:disabled),.o-btn.o-btn--outline-inverse:active:not(:disabled),.o-btn.o-btn--outline-inverse.is-loading: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.o-btn--outline-inverse:not([disabled]){border:1px solid var(--dt-color-border-strong)}.o-btn.o-btn--destructive{--btn-bg-color: var(--dt-color-support-error)}.o-btn.o-btn--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.o-btn--destructive:active:not(:disabled),.o-btn.o-btn--destructive.is-loading: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.o-btn--destructive-ghost{--btn-bg-color: transparent;--btn-text-color: var(--dt-color-content-interactive-error)}.o-btn.o-btn--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.o-btn--destructive-ghost:active:not(:disabled),.o-btn.o-btn--destructive-ghost.is-loading: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.o-btn--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);--icon-size-override: 16px}@media (min-width: 769px){.o-btn.o-btn--xsmall.o-btn--responsive{--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);--icon-size-override: 20px}.o-btn.o-btn--xsmall.o-btn--responsive.o-btn--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);--icon-size-override: 20px}}.o-btn.o-btn--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);--icon-size-override: 20px}@media (min-width: 769px){.o-btn.o-btn--small-expressive.o-btn--responsive{--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);--icon-size-override: 24px}}.o-btn.o-btn--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);--icon-size-override: 20px}@media (min-width: 769px){.o-btn.o-btn--small-productive.o-btn--responsive{--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);--icon-size-override: 24px}}.o-btn.o-btn--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);--icon-size-override: 24px}@media (min-width: 769px){.o-btn.o-btn--medium.o-btn--responsive{--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);--icon-size-override: 24px}}.o-btn.o-btn--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);--icon-size-override: 24px}.o-btn.o-btn--fullWidth{--btn-inline-size: 100%}.o-btn[disabled]{--btn-text-color: var(--dt-color-content-disabled) !important;cursor:not-allowed}.o-btn[disabled]:not(.o-btn--ghost,.o-btn--ghost-inverse,.o-btn--destructive-ghost){--btn-bg-color: var(--dt-color-disabled-01) !important}.o-btn[disabled].o-btn--outline{border-color:var(--dt-color-disabled-01)!important}.o-btn.is-loading>*:not(pie-spinner){visibility:hidden}.o-btn.is-loading 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(--icon-size-override);width:var(--icon-size-override)}";
|
|
498
|
+
var $t = Object.defineProperty, h = (k, a, r, b) => {
|
|
499
|
+
for (var c = void 0, m = k.length - 1, y; m >= 0; m--)
|
|
500
|
+
(y = k[m]) && (c = y(a, r, c) || c);
|
|
501
|
+
return c && $t(a, r, c), c;
|
|
512
502
|
};
|
|
513
|
-
const C = "pie-button"
|
|
514
|
-
class b extends It(Ft) {
|
|
503
|
+
const C = "pie-button", U = class U extends Lt(At) {
|
|
515
504
|
constructor() {
|
|
516
505
|
super(...arguments), this.tag = f.tag, this.size = f.size, this.type = f.type, this.variant = f.variant, this.iconPlacement = f.iconPlacement, this.disabled = f.disabled, this.isLoading = f.isLoading, this.isFullWidth = f.isFullWidth, this.isResponsive = f.isResponsive, this._handleFormKeyDown = (a) => {
|
|
517
506
|
if (!(a.key !== "Enter" || this.type !== "submit" || this.disabled)) {
|
|
518
507
|
if (a.target instanceof HTMLElement) {
|
|
519
|
-
const
|
|
520
|
-
if (
|
|
508
|
+
const r = a.target.tagName.toLowerCase();
|
|
509
|
+
if (r === "button" || r === "pie-button")
|
|
521
510
|
return;
|
|
522
511
|
}
|
|
523
512
|
a.preventDefault(), this._handleClick();
|
|
@@ -533,8 +522,8 @@ class b extends It(Ft) {
|
|
|
533
522
|
super.disconnectedCallback(), this.type === "submit" && ((a = this.form) == null || a.removeEventListener("keydown", this._handleFormKeyDown));
|
|
534
523
|
}
|
|
535
524
|
updated(a) {
|
|
536
|
-
var
|
|
537
|
-
a.has("type") && (this.type === "submit" ? (
|
|
525
|
+
var r, b;
|
|
526
|
+
a.has("type") && (this.type === "submit" ? (r = this.form) == null || r.addEventListener("keydown", this._handleFormKeyDown) : (b = this.form) == null || b.removeEventListener("keydown", this._handleFormKeyDown));
|
|
538
527
|
}
|
|
539
528
|
/**
|
|
540
529
|
* This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM.
|
|
@@ -545,10 +534,9 @@ class b extends It(Ft) {
|
|
|
545
534
|
* TODO: if we need to repeat this logic elsewhere, then we should consider moving this code to a shared class or mixin.
|
|
546
535
|
*/
|
|
547
536
|
_simulateNativeButtonClick(a) {
|
|
548
|
-
if (!this.form)
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
n.type = a, n.style.position = "absolute", n.style.width = "1px", n.style.height = "1px", n.style.padding = "0", n.style.margin = "-1px", n.style.overflow = "hidden", n.style.border = "0", n.style.whiteSpace = "nowrap", a === "submit" && (this.name && (n.name = this.name), this.value && (n.value = this.value), this.formaction && n.setAttribute("formaction", this.formaction), this.formenctype && n.setAttribute("formenctype", this.formenctype), this.formmethod && n.setAttribute("formmethod", this.formmethod), this.formnovalidate && n.setAttribute("formnovalidate", "formnovalidate"), this.formtarget && n.setAttribute("formtarget", this.formtarget)), this.form.append(n), n.click(), n.remove();
|
|
537
|
+
if (!this.form) return;
|
|
538
|
+
const r = document.createElement("button");
|
|
539
|
+
r.type = a, r.style.position = "absolute", r.style.width = "1px", r.style.height = "1px", r.style.padding = "0", r.style.margin = "-1px", r.style.overflow = "hidden", r.style.border = "0", r.style.whiteSpace = "nowrap", a === "submit" && (this.name && (r.name = this.name), this.value && (r.value = this.value), this.formaction && r.setAttribute("formaction", this.formaction), this.formenctype && r.setAttribute("formenctype", this.formenctype), this.formmethod && r.setAttribute("formmethod", this.formmethod), this.formnovalidate && r.setAttribute("formnovalidate", "formnovalidate"), this.formtarget && r.setAttribute("formtarget", this.formtarget)), this.form.append(r), r.click(), r.remove();
|
|
552
540
|
}
|
|
553
541
|
_handleClick() {
|
|
554
542
|
this.form && (this.isLoading || this.tag === "button" && (this.type === "submit" ? (this.formnovalidate || this.form.reportValidity()) && this._simulateNativeButtonClick("submit") : this.type === "reset" && this._simulateNativeButtonClick("reset")));
|
|
@@ -559,9 +547,9 @@ class b extends It(Ft) {
|
|
|
559
547
|
* @private
|
|
560
548
|
*/
|
|
561
549
|
renderSpinner() {
|
|
562
|
-
const { size: a, variant:
|
|
550
|
+
const { size: a, variant: r, disabled: b } = this, c = a && a.includes("small") ? "small" : "medium";
|
|
563
551
|
let m;
|
|
564
|
-
return
|
|
552
|
+
return b ? m = r === "ghost-inverse" ? "inverse" : "secondary" : m = ["primary", "destructive", "outline-inverse", "ghost-inverse"].includes(this.variant) ? "inverse" : "secondary", M`
|
|
565
553
|
<pie-spinner
|
|
566
554
|
size="${c}"
|
|
567
555
|
variant="${m}">
|
|
@@ -569,144 +557,145 @@ class b extends It(Ft) {
|
|
|
569
557
|
}
|
|
570
558
|
renderAnchor(a) {
|
|
571
559
|
const {
|
|
572
|
-
href:
|
|
573
|
-
iconPlacement:
|
|
560
|
+
href: r,
|
|
561
|
+
iconPlacement: b,
|
|
574
562
|
rel: c,
|
|
575
563
|
target: m
|
|
576
564
|
} = this;
|
|
577
565
|
return M`
|
|
578
566
|
<a
|
|
579
|
-
href="${K(
|
|
567
|
+
href="${K(r)}"
|
|
580
568
|
rel="${K(c)}"
|
|
581
569
|
target="${K(m)}"
|
|
582
|
-
class="${
|
|
583
|
-
${
|
|
570
|
+
class="${vt(a)}">
|
|
571
|
+
${b === "leading" ? M`<slot name="icon"></slot>` : F}
|
|
584
572
|
<slot></slot>
|
|
585
|
-
${
|
|
573
|
+
${b === "trailing" ? M`<slot name="icon"></slot>` : F}
|
|
586
574
|
</a>`;
|
|
587
575
|
}
|
|
588
576
|
renderButton(a) {
|
|
589
577
|
const {
|
|
590
|
-
disabled:
|
|
591
|
-
iconPlacement:
|
|
578
|
+
disabled: r,
|
|
579
|
+
iconPlacement: b,
|
|
592
580
|
isLoading: c,
|
|
593
581
|
type: m
|
|
594
|
-
} = this,
|
|
582
|
+
} = this, y = {
|
|
595
583
|
...a,
|
|
596
584
|
"is-loading": c
|
|
597
585
|
};
|
|
598
586
|
return M`
|
|
599
587
|
<button
|
|
600
588
|
@click=${this._handleClick}
|
|
601
|
-
class=${
|
|
589
|
+
class=${vt(y)}
|
|
602
590
|
type=${m}
|
|
603
|
-
?disabled=${
|
|
591
|
+
?disabled=${r}>
|
|
604
592
|
${c ? this.renderSpinner() : F}
|
|
605
|
-
${
|
|
593
|
+
${b === "leading" ? M`<slot name="icon"></slot>` : F}
|
|
606
594
|
<slot></slot>
|
|
607
|
-
${
|
|
595
|
+
${b === "trailing" ? M`<slot name="icon"></slot>` : F}
|
|
608
596
|
</button>`;
|
|
609
597
|
}
|
|
610
598
|
render() {
|
|
611
599
|
const {
|
|
612
600
|
isFullWidth: a,
|
|
613
|
-
isResponsive:
|
|
614
|
-
responsiveSize:
|
|
601
|
+
isResponsive: r,
|
|
602
|
+
responsiveSize: b,
|
|
615
603
|
size: c,
|
|
616
604
|
tag: m,
|
|
617
|
-
variant:
|
|
605
|
+
variant: y
|
|
618
606
|
} = this, S = {
|
|
619
607
|
"o-btn": !0,
|
|
620
608
|
"o-btn--fullWidth": a,
|
|
621
|
-
"o-btn--responsive":
|
|
622
|
-
[`o-btn--${
|
|
623
|
-
[`o-btn--${
|
|
609
|
+
"o-btn--responsive": r,
|
|
610
|
+
[`o-btn--${b}`]: !!(r && b),
|
|
611
|
+
[`o-btn--${y}`]: !0,
|
|
624
612
|
[`o-btn--${c}`]: !0
|
|
625
613
|
};
|
|
626
614
|
return m === "a" ? this.renderAnchor(S) : this.renderButton(S);
|
|
627
615
|
}
|
|
628
616
|
focus() {
|
|
629
|
-
var a,
|
|
630
|
-
(
|
|
617
|
+
var a, r;
|
|
618
|
+
(r = (a = this.shadowRoot) == null ? void 0 : a.querySelector("button")) == null || r.focus();
|
|
631
619
|
}
|
|
632
|
-
}
|
|
633
|
-
|
|
620
|
+
};
|
|
621
|
+
U.styles = It(Rt);
|
|
622
|
+
let d = U;
|
|
634
623
|
h([
|
|
635
624
|
v({ type: String }),
|
|
636
|
-
A(C,
|
|
637
|
-
],
|
|
625
|
+
A(C, Vt, f.tag)
|
|
626
|
+
], d.prototype, "tag");
|
|
638
627
|
h([
|
|
639
628
|
v({ type: String }),
|
|
640
|
-
A(C,
|
|
641
|
-
],
|
|
629
|
+
A(C, Nt, f.size)
|
|
630
|
+
], d.prototype, "size");
|
|
642
631
|
h([
|
|
643
632
|
v({ type: String }),
|
|
644
|
-
A(C,
|
|
645
|
-
],
|
|
633
|
+
A(C, Pt, f.type)
|
|
634
|
+
], d.prototype, "type");
|
|
646
635
|
h([
|
|
647
636
|
v({ type: String }),
|
|
648
|
-
A(C,
|
|
649
|
-
],
|
|
637
|
+
A(C, Ot, f.variant)
|
|
638
|
+
], d.prototype, "variant");
|
|
650
639
|
h([
|
|
651
640
|
v({ type: String }),
|
|
652
|
-
A(C,
|
|
653
|
-
],
|
|
641
|
+
A(C, _t, f.iconPlacement)
|
|
642
|
+
], d.prototype, "iconPlacement");
|
|
654
643
|
h([
|
|
655
644
|
v({ type: Boolean })
|
|
656
|
-
],
|
|
645
|
+
], d.prototype, "disabled");
|
|
657
646
|
h([
|
|
658
647
|
v({ type: Boolean, reflect: !0 })
|
|
659
|
-
],
|
|
648
|
+
], d.prototype, "isLoading");
|
|
660
649
|
h([
|
|
661
650
|
v({ type: Boolean })
|
|
662
|
-
],
|
|
651
|
+
], d.prototype, "isFullWidth");
|
|
663
652
|
h([
|
|
664
653
|
v({ type: Boolean })
|
|
665
|
-
],
|
|
654
|
+
], d.prototype, "isResponsive");
|
|
666
655
|
h([
|
|
667
656
|
v({ type: String })
|
|
668
|
-
],
|
|
657
|
+
], d.prototype, "name");
|
|
669
658
|
h([
|
|
670
659
|
v({ type: String })
|
|
671
|
-
],
|
|
660
|
+
], d.prototype, "value");
|
|
672
661
|
h([
|
|
673
662
|
v({ type: String })
|
|
674
|
-
],
|
|
663
|
+
], d.prototype, "formaction");
|
|
675
664
|
h([
|
|
676
665
|
v({ type: String })
|
|
677
|
-
],
|
|
666
|
+
], d.prototype, "formenctype");
|
|
678
667
|
h([
|
|
679
668
|
v({ type: String })
|
|
680
|
-
],
|
|
669
|
+
], d.prototype, "formmethod");
|
|
681
670
|
h([
|
|
682
671
|
v({ type: Boolean })
|
|
683
|
-
],
|
|
672
|
+
], d.prototype, "formnovalidate");
|
|
684
673
|
h([
|
|
685
674
|
v({ type: String })
|
|
686
|
-
],
|
|
675
|
+
], d.prototype, "formtarget");
|
|
687
676
|
h([
|
|
688
677
|
v({ type: String })
|
|
689
|
-
],
|
|
678
|
+
], d.prototype, "responsiveSize");
|
|
690
679
|
h([
|
|
691
680
|
v({ type: String })
|
|
692
|
-
],
|
|
681
|
+
], d.prototype, "href");
|
|
693
682
|
h([
|
|
694
683
|
v({ type: String })
|
|
695
|
-
],
|
|
684
|
+
], d.prototype, "rel");
|
|
696
685
|
h([
|
|
697
686
|
v({ type: String })
|
|
698
|
-
],
|
|
699
|
-
Tt(C,
|
|
687
|
+
], d.prototype, "target");
|
|
688
|
+
Tt(C, d);
|
|
700
689
|
export {
|
|
701
|
-
|
|
690
|
+
d as PieButton,
|
|
702
691
|
f as defaultProps,
|
|
703
692
|
Gt as formEncodingtypes,
|
|
704
693
|
Jt as formMethodTypes,
|
|
705
694
|
Qt as formTargetTypes,
|
|
706
|
-
|
|
695
|
+
_t as iconPlacements,
|
|
707
696
|
qt as responsiveSizes,
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
697
|
+
Nt as sizes,
|
|
698
|
+
Vt as tags,
|
|
699
|
+
Pt as types,
|
|
700
|
+
Ot as variants
|
|
712
701
|
};
|
package/dist/react.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
import * as t from "react";
|
|
2
2
|
import { createComponent as e } from "@lit/react";
|
|
3
3
|
import { PieButton as o } from "./index.js";
|
|
4
|
-
import { defaultProps as
|
|
5
|
-
|
|
6
|
-
import "lit/directives/class-map.js";
|
|
7
|
-
import "lit/directives/if-defined.js";
|
|
8
|
-
import "lit/decorators.js";
|
|
9
|
-
import "@justeattakeaway/pie-webc-core";
|
|
10
|
-
import "@justeattakeaway/pie-spinner";
|
|
11
|
-
const r = e({
|
|
4
|
+
import { defaultProps as p, formEncodingtypes as c, formMethodTypes as f, formTargetTypes as u, iconPlacements as P, responsiveSizes as l, sizes as y, tags as B, types as d, variants as g } from "./index.js";
|
|
5
|
+
const s = e({
|
|
12
6
|
displayName: "PieButton",
|
|
13
7
|
elementClass: o,
|
|
14
8
|
react: t,
|
|
15
9
|
tagName: "pie-button",
|
|
16
10
|
events: {}
|
|
17
|
-
}),
|
|
11
|
+
}), a = s;
|
|
18
12
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
a as PieButton,
|
|
14
|
+
p as defaultProps,
|
|
15
|
+
c as formEncodingtypes,
|
|
16
|
+
f as formMethodTypes,
|
|
17
|
+
u as formTargetTypes,
|
|
18
|
+
P as iconPlacements,
|
|
19
|
+
l as responsiveSizes,
|
|
20
|
+
y as sizes,
|
|
21
|
+
B as tags,
|
|
22
|
+
d as types,
|
|
23
|
+
g as variants
|
|
30
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.2",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
39
|
"@justeattakeaway/pie-components-config": "0.18.0",
|
|
40
|
-
"@justeattakeaway/pie-css": "0.
|
|
40
|
+
"@justeattakeaway/pie-css": "0.13.0",
|
|
41
41
|
"@justeattakeaway/pie-wrapper-react": "0.14.1",
|
|
42
42
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
43
43
|
},
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"dist/*.js"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@justeattakeaway/pie-spinner": "0.7.
|
|
53
|
-
"@justeattakeaway/pie-webc-core": "0.24.
|
|
52
|
+
"@justeattakeaway/pie-spinner": "0.7.1",
|
|
53
|
+
"@justeattakeaway/pie-webc-core": "0.24.1",
|
|
54
54
|
"element-internals-polyfill": "1.3.11"
|
|
55
55
|
}
|
|
56
56
|
}
|