@justeattakeaway/pie-button 0.39.1-next.0 → 0.40.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/dist/index.js +38 -38
- package/package.json +3 -3
- package/src/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unsafeCSS as wt, LitElement as xt, html as N, nothing as O } from "lit";
|
|
2
|
-
import { property as
|
|
2
|
+
import { property as m } from "lit/decorators.js";
|
|
3
3
|
import { ifDefined as Et } from "lit/directives/if-defined.js";
|
|
4
4
|
import "@justeattakeaway/pie-spinner";
|
|
5
5
|
const R = (d, n, a) => function(b, y) {
|
|
@@ -242,7 +242,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
242
242
|
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);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const mt = (i) => (i.badInput = !1, i.customError = !1, i.patternMismatch = !1, i.rangeOverflow = !1, i.rangeUnderflow = !1, i.stepMismatch = !1, i.tooLong = !1, i.tooShort = !1, i.typeMismatch = !1, i.valid = !0, i.valueMissing = !1, i), pt = (i, t, e) => (i.valid = bt(t), Object.keys(t).forEach((r) => i[r] = t[r]), e && S(e), i), bt = (i) => {
|
|
246
246
|
let t = !0;
|
|
247
247
|
for (let e in i)
|
|
248
248
|
e !== "valid" && i[e] !== !1 && (t = !1);
|
|
@@ -413,10 +413,10 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
413
413
|
const l = n.get(this), s = {};
|
|
414
414
|
for (const E in t)
|
|
415
415
|
s[E] = t[E];
|
|
416
|
-
Object.keys(s).length === 0 &&
|
|
416
|
+
Object.keys(s).length === 0 && mt(l);
|
|
417
417
|
const g = { ...l, ...s };
|
|
418
418
|
delete g.valid;
|
|
419
|
-
const { valid: v } =
|
|
419
|
+
const { valid: v } = pt(l, g, this.form);
|
|
420
420
|
if (!v && !e)
|
|
421
421
|
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.");
|
|
422
422
|
b.set(this, v ? "" : e), o.isConnected ? (o.toggleAttribute("internals-invalid", !v), o.toggleAttribute("internals-valid", v), o.setAttribute("aria-invalid", `${!v}`)) : F.set(o, this);
|
|
@@ -508,7 +508,7 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"]
|
|
|
508
508
|
T() && typeof document < "u" && new MutationObserver(P).observe(document.documentElement, _), typeof HTMLFormElement < "u" && gt(), typeof window < "u" && !window.CustomStateSet && (window.CustomStateSet = V);
|
|
509
509
|
}
|
|
510
510
|
})();
|
|
511
|
-
var At = Object.defineProperty, St = Object.getOwnPropertyDescriptor,
|
|
511
|
+
var At = Object.defineProperty, St = Object.getOwnPropertyDescriptor, p = (d, n, a, c) => {
|
|
512
512
|
for (var b = c > 1 ? void 0 : c ? St(n, a) : n, y = d.length - 1, u; y >= 0; y--)
|
|
513
513
|
(u = d[y]) && (b = (c ? u(n, a, b) : u(b)) || b);
|
|
514
514
|
return c && b && At(n, a, b), b;
|
|
@@ -565,7 +565,7 @@ class h extends xt {
|
|
|
565
565
|
* @private
|
|
566
566
|
*/
|
|
567
567
|
renderSpinner() {
|
|
568
|
-
const n = this.size.includes("small") ? "
|
|
568
|
+
const n = this.size.includes("small") ? "small" : "medium", c = ["primary", "destructive", "outline-inverse", "ghost-inverse"].includes(this.variant) ? "inverse" : "secondary";
|
|
569
569
|
return N`
|
|
570
570
|
<pie-spinner
|
|
571
571
|
size="${n}"
|
|
@@ -609,57 +609,57 @@ class h extends xt {
|
|
|
609
609
|
}
|
|
610
610
|
h.formAssociated = !0;
|
|
611
611
|
h.styles = wt(Ft);
|
|
612
|
-
|
|
613
|
-
|
|
612
|
+
p([
|
|
613
|
+
m(),
|
|
614
614
|
R(L, zt, "medium")
|
|
615
615
|
], h.prototype, "size", 2);
|
|
616
|
-
|
|
617
|
-
|
|
616
|
+
p([
|
|
617
|
+
m(),
|
|
618
618
|
R(L, Mt, "submit")
|
|
619
619
|
], h.prototype, "type", 2);
|
|
620
|
-
|
|
621
|
-
|
|
620
|
+
p([
|
|
621
|
+
m(),
|
|
622
622
|
R(L, Ct, "primary")
|
|
623
623
|
], h.prototype, "variant", 2);
|
|
624
|
-
|
|
625
|
-
|
|
624
|
+
p([
|
|
625
|
+
m({ type: String }),
|
|
626
626
|
R(L, Lt, "leading")
|
|
627
627
|
], h.prototype, "iconPlacement", 2);
|
|
628
|
-
|
|
629
|
-
|
|
628
|
+
p([
|
|
629
|
+
m({ type: Boolean })
|
|
630
630
|
], h.prototype, "disabled", 2);
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
p([
|
|
632
|
+
m({ type: Boolean, reflect: !0 })
|
|
633
633
|
], h.prototype, "isLoading", 2);
|
|
634
|
-
|
|
635
|
-
|
|
634
|
+
p([
|
|
635
|
+
m({ type: Boolean })
|
|
636
636
|
], h.prototype, "isFullWidth", 2);
|
|
637
|
-
|
|
638
|
-
|
|
637
|
+
p([
|
|
638
|
+
m({ type: Boolean })
|
|
639
639
|
], h.prototype, "isResponsive", 2);
|
|
640
|
-
|
|
641
|
-
|
|
640
|
+
p([
|
|
641
|
+
m({ type: String })
|
|
642
642
|
], h.prototype, "name", 2);
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
p([
|
|
644
|
+
m({ type: String })
|
|
645
645
|
], h.prototype, "value", 2);
|
|
646
|
-
|
|
647
|
-
|
|
646
|
+
p([
|
|
647
|
+
m()
|
|
648
648
|
], h.prototype, "formaction", 2);
|
|
649
|
-
|
|
650
|
-
|
|
649
|
+
p([
|
|
650
|
+
m()
|
|
651
651
|
], h.prototype, "formenctype", 2);
|
|
652
|
-
|
|
653
|
-
|
|
652
|
+
p([
|
|
653
|
+
m()
|
|
654
654
|
], h.prototype, "formmethod", 2);
|
|
655
|
-
|
|
656
|
-
|
|
655
|
+
p([
|
|
656
|
+
m({ type: Boolean })
|
|
657
657
|
], h.prototype, "formnovalidate", 2);
|
|
658
|
-
|
|
659
|
-
|
|
658
|
+
p([
|
|
659
|
+
m()
|
|
660
660
|
], h.prototype, "formtarget", 2);
|
|
661
|
-
|
|
662
|
-
|
|
661
|
+
p([
|
|
662
|
+
m({ type: String })
|
|
663
663
|
], h.prototype, "responsiveSize", 2);
|
|
664
664
|
kt(L, h);
|
|
665
665
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"dist/*.js"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@justeattakeaway/pie-spinner": "0.
|
|
41
|
-
"@justeattakeaway/pie-webc-core": "0.12.0
|
|
40
|
+
"@justeattakeaway/pie-spinner": "0.3.0",
|
|
41
|
+
"@justeattakeaway/pie-webc-core": "0.12.0",
|
|
42
42
|
"element-internals-polyfill": "1.3.8"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/src/index.ts
CHANGED
|
@@ -210,7 +210,7 @@ export class PieButton extends LitElement implements ButtonProps {
|
|
|
210
210
|
* @private
|
|
211
211
|
*/
|
|
212
212
|
private renderSpinner (): TemplateResult {
|
|
213
|
-
const spinnerSize = this.size.includes('small') ? '
|
|
213
|
+
const spinnerSize = this.size.includes('small') ? 'small' : 'medium'; // includes("small") matches for any small size value and xsmall
|
|
214
214
|
const inverseVariants: Array<ButtonProps['variant']> = ['primary', 'destructive', 'outline-inverse', 'ghost-inverse'];
|
|
215
215
|
const spinnerVariant = inverseVariants.includes(this.variant) ? 'inverse' : 'secondary';
|
|
216
216
|
|