@justeattakeaway/pie-button 1.6.7 → 1.7.0
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/custom-elements.json +9 -4
- package/dist/index.d.ts +6 -1
- package/dist/index.js +46 -49
- package/dist/react.d.ts +6 -1
- package/package.json +2 -2
- package/src/index.ts +3 -4
package/custom-elements.json
CHANGED
|
@@ -328,6 +328,15 @@
|
|
|
328
328
|
},
|
|
329
329
|
"privacy": "public"
|
|
330
330
|
},
|
|
331
|
+
{
|
|
332
|
+
"kind": "field",
|
|
333
|
+
"name": "shadowRootOptions",
|
|
334
|
+
"type": {
|
|
335
|
+
"text": "object"
|
|
336
|
+
},
|
|
337
|
+
"static": true,
|
|
338
|
+
"default": "{ ...LitElement.shadowRootOptions, delegatesFocus: true }"
|
|
339
|
+
},
|
|
331
340
|
{
|
|
332
341
|
"kind": "method",
|
|
333
342
|
"name": "_simulateNativeButtonClick",
|
|
@@ -386,10 +395,6 @@
|
|
|
386
395
|
}
|
|
387
396
|
}
|
|
388
397
|
]
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
"kind": "method",
|
|
392
|
-
"name": "focus"
|
|
393
398
|
}
|
|
394
399
|
],
|
|
395
400
|
"mixins": [
|
package/dist/index.d.ts
CHANGED
|
@@ -144,6 +144,12 @@ export declare class PieButton extends PieButton_base implements ButtonProps {
|
|
|
144
144
|
href: ButtonProps['href'];
|
|
145
145
|
rel: ButtonProps['rel'];
|
|
146
146
|
target: ButtonProps['target'];
|
|
147
|
+
static shadowRootOptions: {
|
|
148
|
+
delegatesFocus: boolean;
|
|
149
|
+
mode: ShadowRootMode;
|
|
150
|
+
serializable?: boolean;
|
|
151
|
+
slotAssignment?: SlotAssignmentMode;
|
|
152
|
+
};
|
|
147
153
|
/**
|
|
148
154
|
* This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM.
|
|
149
155
|
* This is done so that we trigger native form actions, such as submit and reset in the browser. The performance impact of adding and removing a single button to the DOM
|
|
@@ -164,7 +170,6 @@ export declare class PieButton extends PieButton_base implements ButtonProps {
|
|
|
164
170
|
renderAnchor(classes: ClassInfo): TemplateResult<1>;
|
|
165
171
|
renderButton(classes: ClassInfo): TemplateResult<1>;
|
|
166
172
|
render(): TemplateResult<1>;
|
|
167
|
-
focus(): void;
|
|
168
173
|
static styles: CSSResult;
|
|
169
174
|
}
|
|
170
175
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement as
|
|
1
|
+
import { LitElement as pt, html as z, nothing as S, unsafeCSS as Lt } from "lit";
|
|
2
2
|
import { classMap as mt } from "lit/directives/class-map.js";
|
|
3
3
|
import { ifDefined as U } from "lit/directives/if-defined.js";
|
|
4
4
|
import { property as m } from "lit/decorators.js";
|
|
@@ -6,7 +6,7 @@ import { FormControlMixin as Tt, validPropertyValues as C, safeCustomElement as
|
|
|
6
6
|
import "@justeattakeaway/pie-spinner";
|
|
7
7
|
(function() {
|
|
8
8
|
(function(l) {
|
|
9
|
-
const r = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(),
|
|
9
|
+
const r = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), L = {
|
|
10
10
|
ariaAtomic: "aria-atomic",
|
|
11
11
|
ariaAutoComplete: "aria-autocomplete",
|
|
12
12
|
ariaBusy: "aria-busy",
|
|
@@ -49,7 +49,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
49
49
|
ariaValueNow: "aria-valuenow",
|
|
50
50
|
ariaValueText: "aria-valuetext",
|
|
51
51
|
role: "role"
|
|
52
|
-
},
|
|
52
|
+
}, ht = (e, t) => {
|
|
53
53
|
for (let i in L) {
|
|
54
54
|
t[i] = null;
|
|
55
55
|
let o = null;
|
|
@@ -59,7 +59,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
59
59
|
return o;
|
|
60
60
|
},
|
|
61
61
|
set(n) {
|
|
62
|
-
o = n, e.isConnected ? e.setAttribute(a, n) :
|
|
62
|
+
o = n, e.isConnected ? e.setAttribute(a, n) : A.set(e, t);
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -78,7 +78,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
78
78
|
const a = !t || e.disabled;
|
|
79
79
|
for (; o; )
|
|
80
80
|
o.formDisabledCallback && a && D(o, e.disabled), o = i.nextNode();
|
|
81
|
-
}, tt = { attributes: !0, attributeFilter: ["disabled", "name"] }, T =
|
|
81
|
+
}, tt = { attributes: !0, attributeFilter: ["disabled", "name"] }, T = O() ? new MutationObserver((e) => {
|
|
82
82
|
for (const t of e) {
|
|
83
83
|
const i = t.target;
|
|
84
84
|
if (t.attributeName === "disabled" && (i.constructor.formAssociated ? D(i, i.hasAttribute("disabled")) : i.localName === "fieldset" && Z(i)), t.attributeName === "name" && i.constructor.formAssociated) {
|
|
@@ -92,11 +92,11 @@ import "@justeattakeaway/pie-spinner";
|
|
|
92
92
|
const { addedNodes: i, removedNodes: o } = t, a = Array.from(i), n = Array.from(o);
|
|
93
93
|
a.forEach((s) => {
|
|
94
94
|
var u;
|
|
95
|
-
if (d.has(s) && s.constructor.formAssociated && Y(s),
|
|
96
|
-
const h =
|
|
95
|
+
if (d.has(s) && s.constructor.formAssociated && Y(s), A.has(s)) {
|
|
96
|
+
const h = A.get(s);
|
|
97
97
|
Object.keys(L).filter((y) => h[y] !== null).forEach((y) => {
|
|
98
98
|
s.setAttribute(L[y], h[y]);
|
|
99
|
-
}),
|
|
99
|
+
}), A.delete(s);
|
|
100
100
|
}
|
|
101
101
|
if (I.has(s)) {
|
|
102
102
|
const h = I.get(s);
|
|
@@ -119,7 +119,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function ut(e) {
|
|
123
123
|
e.forEach((t) => {
|
|
124
124
|
const { removedNodes: i } = t;
|
|
125
125
|
i.forEach((o) => {
|
|
@@ -128,12 +128,12 @@ import "@justeattakeaway/pie-spinner";
|
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
const
|
|
131
|
+
const gt = (e) => {
|
|
132
132
|
var t, i;
|
|
133
|
-
const o = new MutationObserver(
|
|
133
|
+
const o = new MutationObserver(ut);
|
|
134
134
|
!((t = window == null ? void 0 : window.ShadyDOM) === null || t === void 0) && t.inUse && e.mode && e.host && (e = e.host), (i = o.observe) === null || i === void 0 || i.call(o, e, { childList: !0 }), Q.set(e, o);
|
|
135
135
|
};
|
|
136
|
-
|
|
136
|
+
O() && new MutationObserver(R);
|
|
137
137
|
const $ = {
|
|
138
138
|
childList: !0,
|
|
139
139
|
subtree: !0
|
|
@@ -146,7 +146,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
146
146
|
}, it = (e, t) => {
|
|
147
147
|
const i = document.createElement("input");
|
|
148
148
|
return i.type = "hidden", i.name = e.getAttribute("name"), e.after(i), p.get(t).push(i), i;
|
|
149
|
-
},
|
|
149
|
+
}, ft = (e, t) => {
|
|
150
150
|
var i;
|
|
151
151
|
p.set(t, []), (i = T.observe) === null || i === void 0 || i.call(T, e, tt);
|
|
152
152
|
}, ot = (e, t) => {
|
|
@@ -158,11 +158,11 @@ import "@justeattakeaway/pie-spinner";
|
|
|
158
158
|
}, V = (e) => {
|
|
159
159
|
const t = Array.from(e.elements).filter((n) => !n.tagName.includes("-") && n.validity).map((n) => n.validity.valid), i = E.get(e) || [], o = Array.from(i).filter((n) => n.isConnected).map((n) => d.get(n).validity.valid), a = [...t, ...o].includes(!1);
|
|
160
160
|
e.toggleAttribute("internals-invalid", a), e.toggleAttribute("internals-valid", !a);
|
|
161
|
-
}, ft = (e) => {
|
|
162
|
-
V(N(e.target));
|
|
163
161
|
}, yt = (e) => {
|
|
164
162
|
V(N(e.target));
|
|
165
163
|
}, xt = (e) => {
|
|
164
|
+
V(N(e.target));
|
|
165
|
+
}, wt = (e) => {
|
|
166
166
|
const t = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((i) => `${i}:not([disabled])`).map((i) => `${i}:not([form])${e.id ? `,${i}[form='${e.id}']` : ""}`).join(",");
|
|
167
167
|
e.addEventListener("click", (i) => {
|
|
168
168
|
if (i.target.closest(t)) {
|
|
@@ -172,7 +172,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
172
172
|
a.size && Array.from(a).reverse().map((u) => d.get(u).reportValidity()).includes(!1) && i.preventDefault();
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
|
-
},
|
|
175
|
+
}, kt = (e) => {
|
|
176
176
|
const t = E.get(e.target);
|
|
177
177
|
t && t.size && t.forEach((i) => {
|
|
178
178
|
i.constructor.formAssociated && i.formResetCallback && i.formResetCallback.apply(i);
|
|
@@ -184,7 +184,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
184
184
|
o.add(e);
|
|
185
185
|
else {
|
|
186
186
|
const a = /* @__PURE__ */ new Set();
|
|
187
|
-
a.add(e), E.set(t, a),
|
|
187
|
+
a.add(e), E.set(t, a), wt(t), t.addEventListener("reset", kt), t.addEventListener("input", yt), t.addEventListener("change", xt);
|
|
188
188
|
}
|
|
189
189
|
k.set(t, { ref: e, internals: i }), e.constructor.formAssociated && e.formAssociatedCallback && setTimeout(() => {
|
|
190
190
|
e.formAssociatedCallback.apply(e, [t]);
|
|
@@ -207,15 +207,15 @@ import "@justeattakeaway/pie-spinner";
|
|
|
207
207
|
ot(e, i), rt(e, o, t);
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
|
-
function
|
|
210
|
+
function O() {
|
|
211
211
|
return typeof MutationObserver < "u";
|
|
212
212
|
}
|
|
213
|
-
class
|
|
213
|
+
class Et {
|
|
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 zt = (e) => (e.badInput = !1, e.customError = !1, e.patternMismatch = !1, e.rangeOverflow = !1, e.rangeUnderflow = !1, e.stepMismatch = !1, e.tooLong = !1, e.tooShort = !1, e.typeMismatch = !1, e.valid = !0, e.valueMissing = !1, e), Mt = (e, t, i) => (e.valid = St(t), Object.keys(t).forEach((o) => e[o] = t[o]), i && V(i), e), St = (e) => {
|
|
219
219
|
let t = !0;
|
|
220
220
|
for (let i in e)
|
|
221
221
|
i !== "valid" && e[i] !== !1 && (t = !1);
|
|
@@ -257,14 +257,14 @@ import "@justeattakeaway/pie-spinner";
|
|
|
257
257
|
if (typeof t == "function" ? e !== t || !o : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
258
258
|
return i === "m" ? o : i === "a" ? o.call(e) : o ? o.value : t.get(e);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Ct(e, t, i, o, a) {
|
|
261
261
|
if (typeof t == "function" ? e !== t || !0 : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
262
262
|
return t.set(e, i), i;
|
|
263
263
|
}
|
|
264
264
|
var M;
|
|
265
|
-
class
|
|
265
|
+
class Ft {
|
|
266
266
|
constructor(t) {
|
|
267
|
-
M.set(this, void 0),
|
|
267
|
+
M.set(this, void 0), Ct(this, M, t);
|
|
268
268
|
for (let i = 0; i < t.length; i++) {
|
|
269
269
|
let o = t[i];
|
|
270
270
|
this[i] = o, o.hasAttribute("name") && (this[o.getAttribute("name")] = o);
|
|
@@ -304,7 +304,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
304
304
|
if (u.length === 0)
|
|
305
305
|
return s;
|
|
306
306
|
const h = Array.from(s).concat(u).sort((w, y) => w.compareDocumentPosition ? w.compareDocumentPosition(y) & 2 ? 1 : -1 : 0);
|
|
307
|
-
return new
|
|
307
|
+
return new Ft(h);
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
}
|
|
@@ -315,8 +315,8 @@ import "@justeattakeaway/pie-spinner";
|
|
|
315
315
|
constructor(t) {
|
|
316
316
|
if (!t || !t.tagName || t.tagName.indexOf("-") === -1)
|
|
317
317
|
throw new TypeError("Illegal constructor");
|
|
318
|
-
const i = t.getRootNode(), o = new
|
|
319
|
-
this.states = new H(t), r.set(this, t), b.set(this, o), d.set(t, this),
|
|
318
|
+
const i = t.getRootNode(), o = new Et();
|
|
319
|
+
this.states = new H(t), r.set(this, t), b.set(this, o), d.set(t, this), ht(t, this), ft(t, this), Object.seal(this), i instanceof DocumentFragment && gt(i);
|
|
320
320
|
}
|
|
321
321
|
checkValidity() {
|
|
322
322
|
const t = r.get(this);
|
|
@@ -377,10 +377,10 @@ import "@justeattakeaway/pie-spinner";
|
|
|
377
377
|
const n = b.get(this), s = {};
|
|
378
378
|
for (const w in t)
|
|
379
379
|
s[w] = t[w];
|
|
380
|
-
Object.keys(s).length === 0 &&
|
|
380
|
+
Object.keys(s).length === 0 && zt(n);
|
|
381
381
|
const u = Object.assign(Object.assign({}, n), s);
|
|
382
382
|
delete u.valid;
|
|
383
|
-
const { valid: h } =
|
|
383
|
+
const { valid: h } = Mt(n, u, this.form);
|
|
384
384
|
if (!h && !i)
|
|
385
385
|
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.");
|
|
386
386
|
f.set(this, h ? "" : i), a.isConnected ? (a.toggleAttribute("internals-invalid", !h), a.toggleAttribute("internals-valid", h), a.setAttribute("aria-invalid", `${!h}`)) : I.set(a, this);
|
|
@@ -402,7 +402,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
402
402
|
return x(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"));
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function It() {
|
|
406
406
|
if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals)
|
|
407
407
|
return !1;
|
|
408
408
|
class e extends HTMLElement {
|
|
@@ -458,7 +458,7 @@ import "@justeattakeaway/pie-spinner";
|
|
|
458
458
|
}), typeof Element < "u") {
|
|
459
459
|
let t = function(...o) {
|
|
460
460
|
const a = i.apply(this, o);
|
|
461
|
-
if (G.set(this, a),
|
|
461
|
+
if (G.set(this, a), O()) {
|
|
462
462
|
const n = new MutationObserver(R);
|
|
463
463
|
window.ShadyDOM ? n.observe(this, $) : n.observe(a, $), _.set(this, n);
|
|
464
464
|
}
|
|
@@ -467,20 +467,20 @@ import "@justeattakeaway/pie-spinner";
|
|
|
467
467
|
const i = Element.prototype.attachShadow;
|
|
468
468
|
Element.prototype.attachShadow = t;
|
|
469
469
|
}
|
|
470
|
-
|
|
470
|
+
O() && typeof document < "u" && new MutationObserver(R).observe(document.documentElement, $), typeof HTMLFormElement < "u" && At(), (e || typeof window < "u" && !window.CustomStateSet) && B();
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
-
return !!customElements.polyfillWrapFlushCallback || (
|
|
473
|
+
return !!customElements.polyfillWrapFlushCallback || (It() ? typeof window < "u" && !window.CustomStateSet && B(HTMLElement.prototype.attachInternals) : vt(!1)), l.forceCustomStateSetPolyfill = B, l.forceElementInternalsPolyfill = vt, Object.defineProperty(l, "__esModule", { value: !0 }), l;
|
|
474
474
|
})({});
|
|
475
475
|
})();
|
|
476
|
-
const
|
|
476
|
+
const P = class P extends pt {
|
|
477
477
|
willUpdate() {
|
|
478
|
-
this.getAttribute("v") || this.setAttribute("v",
|
|
478
|
+
this.getAttribute("v") || this.setAttribute("v", P.v);
|
|
479
479
|
}
|
|
480
480
|
};
|
|
481
|
-
|
|
482
|
-
let j =
|
|
483
|
-
const Nt = ["button", "a"],
|
|
481
|
+
P.v = "1.7.0";
|
|
482
|
+
let j = P;
|
|
483
|
+
const Nt = ["button", "a"], Ot = ["xsmall", "small-productive", "small-expressive", "medium", "large"], Jt = ["productive", "expressive"], Pt = ["submit", "button", "reset"], _t = [
|
|
484
484
|
"primary",
|
|
485
485
|
"primary-alternative",
|
|
486
486
|
"secondary",
|
|
@@ -507,7 +507,7 @@ var Dt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, v = (l, r,
|
|
|
507
507
|
(k = l[f]) && (d = (p ? k(r, b, d) : k(d)) || d);
|
|
508
508
|
return p && d && Dt(r, b, d), d;
|
|
509
509
|
};
|
|
510
|
-
const
|
|
510
|
+
const F = "pie-button";
|
|
511
511
|
let c = class extends Tt(j) {
|
|
512
512
|
constructor() {
|
|
513
513
|
super(...arguments), this.tag = g.tag, this.size = g.size, this.type = g.type, this.variant = g.variant, this.iconPlacement = g.iconPlacement, this.disabled = g.disabled, this.isLoading = g.isLoading, this.isFullWidth = g.isFullWidth, this.isResponsive = g.isResponsive, this._handleFormKeyDown = (l) => {
|
|
@@ -621,31 +621,28 @@ let c = class extends Tt(j) {
|
|
|
621
621
|
};
|
|
622
622
|
return d === "a" ? this.renderAnchor(k) : this.renderButton(k);
|
|
623
623
|
}
|
|
624
|
-
focus() {
|
|
625
|
-
var l, r;
|
|
626
|
-
(r = (l = this.shadowRoot) == null ? void 0 : l.querySelector("button")) == null || r.focus();
|
|
627
|
-
}
|
|
628
624
|
};
|
|
625
|
+
c.shadowRootOptions = { ...pt.shadowRootOptions, delegatesFocus: !0 };
|
|
629
626
|
c.styles = Lt($t);
|
|
630
627
|
v([
|
|
631
628
|
m({ type: String }),
|
|
632
|
-
C(
|
|
629
|
+
C(F, Nt, g.tag)
|
|
633
630
|
], c.prototype, "tag", 2);
|
|
634
631
|
v([
|
|
635
632
|
m({ type: String }),
|
|
636
|
-
C(
|
|
633
|
+
C(F, Ot, g.size)
|
|
637
634
|
], c.prototype, "size", 2);
|
|
638
635
|
v([
|
|
639
636
|
m({ type: String }),
|
|
640
|
-
C(
|
|
637
|
+
C(F, Pt, g.type)
|
|
641
638
|
], c.prototype, "type", 2);
|
|
642
639
|
v([
|
|
643
640
|
m({ type: String }),
|
|
644
|
-
C(
|
|
641
|
+
C(F, _t, g.variant)
|
|
645
642
|
], c.prototype, "variant", 2);
|
|
646
643
|
v([
|
|
647
644
|
m({ type: String }),
|
|
648
|
-
C(
|
|
645
|
+
C(F, Rt, g.iconPlacement)
|
|
649
646
|
], c.prototype, "iconPlacement", 2);
|
|
650
647
|
v([
|
|
651
648
|
m({ type: Boolean })
|
|
@@ -703,8 +700,8 @@ export {
|
|
|
703
700
|
Yt as formTargetTypes,
|
|
704
701
|
Rt as iconPlacements,
|
|
705
702
|
Jt as responsiveSizes,
|
|
706
|
-
|
|
703
|
+
Ot as sizes,
|
|
707
704
|
Nt as tags,
|
|
708
|
-
|
|
705
|
+
Pt as types,
|
|
709
706
|
_t as variants
|
|
710
707
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -147,6 +147,12 @@ declare class PieButton_2 extends PieButton_base implements ButtonProps {
|
|
|
147
147
|
href: ButtonProps['href'];
|
|
148
148
|
rel: ButtonProps['rel'];
|
|
149
149
|
target: ButtonProps['target'];
|
|
150
|
+
static shadowRootOptions: {
|
|
151
|
+
delegatesFocus: boolean;
|
|
152
|
+
mode: ShadowRootMode;
|
|
153
|
+
serializable?: boolean;
|
|
154
|
+
slotAssignment?: SlotAssignmentMode;
|
|
155
|
+
};
|
|
150
156
|
/**
|
|
151
157
|
* This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM.
|
|
152
158
|
* This is done so that we trigger native form actions, such as submit and reset in the browser. The performance impact of adding and removing a single button to the DOM
|
|
@@ -167,7 +173,6 @@ declare class PieButton_2 extends PieButton_base implements ButtonProps {
|
|
|
167
173
|
renderAnchor(classes: ClassInfo): TemplateResult<1>;
|
|
168
174
|
renderButton(classes: ClassInfo): TemplateResult<1>;
|
|
169
175
|
render(): TemplateResult<1>;
|
|
170
|
-
focus(): void;
|
|
171
176
|
static styles: CSSResult;
|
|
172
177
|
}
|
|
173
178
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
42
42
|
"@justeattakeaway/pie-components-config": "0.21.0",
|
|
43
|
-
"@justeattakeaway/pie-css": "0.
|
|
43
|
+
"@justeattakeaway/pie-css": "0.21.0",
|
|
44
44
|
"@justeattakeaway/pie-monorepo-utils": "0.7.0",
|
|
45
45
|
"@justeattakeaway/pie-wrapper-react": "0.14.3",
|
|
46
46
|
"cem-plugin-module-file-extensions": "0.0.5"
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
html, unsafeCSS, nothing, type PropertyValues, type TemplateResult,
|
|
3
|
+
LitElement,
|
|
3
4
|
} from 'lit';
|
|
4
5
|
import { classMap, type ClassInfo } from 'lit/directives/class-map.js';
|
|
5
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
@@ -121,6 +122,8 @@ export class PieButton extends FormControlMixin(PieElement) implements ButtonPro
|
|
|
121
122
|
@property({ type: String })
|
|
122
123
|
public target: ButtonProps['target'];
|
|
123
124
|
|
|
125
|
+
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
126
|
+
|
|
124
127
|
/**
|
|
125
128
|
* This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM.
|
|
126
129
|
* This is done so that we trigger native form actions, such as submit and reset in the browser. The performance impact of adding and removing a single button to the DOM
|
|
@@ -298,10 +301,6 @@ export class PieButton extends FormControlMixin(PieElement) implements ButtonPro
|
|
|
298
301
|
return this.renderButton(classes);
|
|
299
302
|
}
|
|
300
303
|
|
|
301
|
-
focus () {
|
|
302
|
-
this.shadowRoot?.querySelector('button')?.focus();
|
|
303
|
-
}
|
|
304
|
-
|
|
305
304
|
// Renders a `CSSResult` generated from SCSS by Vite
|
|
306
305
|
static styles = unsafeCSS(styles);
|
|
307
306
|
}
|