@justeattakeaway/pie-button
Advanced tools
Comparing version 0.0.0-snapshot-release-20231218150157 to 0.0.0-snapshot-release-20231218154706
@@ -10,11 +10,11 @@ import type { CSSResult } from 'lit'; | ||
*/ | ||
size: typeof sizes[number]; | ||
size?: typeof sizes[number]; | ||
/** | ||
* What type attribute should be applied to the button. For example submit, button. | ||
*/ | ||
type: typeof types[number]; | ||
type?: typeof types[number]; | ||
/** | ||
* What style variant the button should be such as primary, outline or ghost. | ||
*/ | ||
variant: Variant; | ||
variant?: Variant; | ||
/** | ||
@@ -27,15 +27,15 @@ * The placement of the icon slot, if provided, such as leading or trailing | ||
*/ | ||
disabled: boolean; | ||
disabled?: boolean; | ||
/** | ||
* When true, the button element will occupy the full width of its container. | ||
*/ | ||
isFullWidth: boolean; | ||
isFullWidth?: boolean; | ||
/** | ||
* When true, displays a loading indicator inside the button. | ||
*/ | ||
isLoading: boolean; | ||
isLoading?: boolean; | ||
/** | ||
* When true, enables the responsive size feature. | ||
*/ | ||
isResponsive: boolean; | ||
isResponsive?: boolean; | ||
/** | ||
@@ -42,0 +42,0 @@ * The name of the button, submitted as a pair with the button's value as part of the form data, when that button is used to submit the form. |
@@ -1,5 +0,5 @@ | ||
import { unsafeCSS as wt, LitElement as xt, html as N, nothing as W } from "lit"; | ||
import { unsafeCSS as xt, LitElement as Et, html as N, nothing as H } from "lit"; | ||
import { property as h } from "lit/decorators.js"; | ||
import { ifDefined as Et } from "lit/directives/if-defined.js"; | ||
import { validPropertyValues as R, defineCustomElement as kt } from "@justeattakeaway/pie-webc-core"; | ||
import { ifDefined as R } from "lit/directives/if-defined.js"; | ||
import { validPropertyValues as _, defineCustomElement as kt } from "@justeattakeaway/pie-webc-core"; | ||
import "@justeattakeaway/pie-spinner"; | ||
@@ -19,3 +19,3 @@ const zt = ["xsmall", "small-productive", "small-expressive", "medium", "large"], _t = ["productive", "expressive"], Mt = ["submit", "button", "reset"], Ct = [ | ||
(function() { | ||
const p = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), S = { | ||
const p = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), S = { | ||
ariaAtomic: "aria-atomic", | ||
@@ -62,3 +62,3 @@ ariaAutoComplete: "aria-autocomplete", | ||
role: "role" | ||
}, ot = (i, t) => { | ||
}, at = (i, t) => { | ||
for (let e in S) { | ||
@@ -78,7 +78,7 @@ t[e] = null; | ||
}; | ||
function U(i) { | ||
function j(i) { | ||
const t = c.get(i), { form: e } = t; | ||
Y(i, e, t), X(i, t.labels); | ||
Z(i, e, t), Y(i, t.labels); | ||
} | ||
const j = (i, t = !1) => { | ||
const G = (i, t = !1) => { | ||
const e = document.createTreeWalker(i, NodeFilter.SHOW_ELEMENT, { | ||
@@ -92,7 +92,7 @@ acceptNode(l) { | ||
for (; r; ) | ||
r.formDisabledCallback && o && D(r, i.disabled), r = e.nextNode(); | ||
}, G = { attributes: !0, attributeFilter: ["disabled", "name"] }, z = T() ? new MutationObserver((i) => { | ||
r.formDisabledCallback && o && $(r, i.disabled), r = e.nextNode(); | ||
}, J = { attributes: !0, attributeFilter: ["disabled", "name"] }, z = T() ? new MutationObserver((i) => { | ||
for (const t of i) { | ||
const e = t.target; | ||
if (t.attributeName === "disabled" && (e.constructor.formAssociated ? D(e, e.hasAttribute("disabled")) : e.localName === "fieldset" && j(e)), t.attributeName === "name" && e.constructor.formAssociated) { | ||
if (t.attributeName === "disabled" && (e.constructor.formAssociated ? $(e, e.hasAttribute("disabled")) : e.localName === "fieldset" && G(e)), t.attributeName === "name" && e.constructor.formAssociated) { | ||
const r = c.get(e), o = M.get(e); | ||
@@ -103,3 +103,3 @@ r.setFormValue(o); | ||
}) : {}; | ||
function _(i) { | ||
function P(i) { | ||
i.forEach((t) => { | ||
@@ -109,3 +109,3 @@ const { addedNodes: e, removedNodes: r } = t, o = Array.from(e), l = Array.from(r); | ||
var u; | ||
if (c.has(n) && n.constructor.formAssociated && U(n), k.has(n)) { | ||
if (c.has(n) && n.constructor.formAssociated && j(n), k.has(n)) { | ||
const d = k.get(n); | ||
@@ -122,4 +122,4 @@ Object.keys(S).filter((w) => d[w] !== null).forEach((w) => { | ||
const d = y.get(n), E = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, { | ||
acceptNode(O) { | ||
return c.has(O) && O.constructor.formAssociated && !(d && d.has(O)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; | ||
acceptNode(W) { | ||
return c.has(W) && W.constructor.formAssociated && !(d && d.has(W)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; | ||
} | ||
@@ -129,42 +129,42 @@ }); | ||
for (; w; ) | ||
U(w), w = E.nextNode(); | ||
j(w), w = E.nextNode(); | ||
} | ||
n.localName === "fieldset" && ((u = z.observe) == null || u.call(z, n, G), j(n, !0)); | ||
n.localName === "fieldset" && ((u = z.observe) == null || u.call(z, n, J), G(n, !0)); | ||
}), l.forEach((n) => { | ||
const u = c.get(n); | ||
u && a.get(u) && J(u), g.has(n) && g.get(n).disconnect(); | ||
u && a.get(u) && Q(u), g.has(n) && g.get(n).disconnect(); | ||
}); | ||
}); | ||
} | ||
function at(i) { | ||
function nt(i) { | ||
i.forEach((t) => { | ||
const { removedNodes: e } = t; | ||
e.forEach((r) => { | ||
const o = K.get(t.target); | ||
c.has(r) && tt(r), o.disconnect(); | ||
const o = q.get(t.target); | ||
c.has(r) && et(r), o.disconnect(); | ||
}); | ||
}); | ||
} | ||
const nt = (i) => { | ||
const st = (i) => { | ||
var e; | ||
const t = new MutationObserver(at); | ||
(e = t.observe) == null || e.call(t, i, { childList: !0 }), K.set(i, t); | ||
const t = new MutationObserver(nt); | ||
(e = t.observe) == null || e.call(t, i, { childList: !0 }), q.set(i, t); | ||
}; | ||
T() && new MutationObserver(_); | ||
const P = { | ||
T() && new MutationObserver(P); | ||
const D = { | ||
childList: !0, | ||
subtree: !0 | ||
}, D = (i, t) => { | ||
}, $ = (i, t) => { | ||
i.toggleAttribute("internals-disabled", t), t ? i.setAttribute("aria-disabled", "true") : i.removeAttribute("aria-disabled"), i.formDisabledCallback && i.formDisabledCallback.apply(i, [t]); | ||
}, J = (i) => { | ||
}, Q = (i) => { | ||
a.get(i).forEach((e) => { | ||
e.remove(); | ||
}), a.set(i, []); | ||
}, Q = (i, t) => { | ||
}, X = (i, t) => { | ||
const e = document.createElement("input"); | ||
return e.type = "hidden", e.name = i.getAttribute("name"), i.after(e), a.get(t).push(e), e; | ||
}, st = (i, t) => { | ||
}, lt = (i, t) => { | ||
var e; | ||
a.set(t, []), (e = z.observe) == null || e.call(z, i, G); | ||
}, X = (i, t) => { | ||
a.set(t, []), (e = z.observe) == null || e.call(z, i, J); | ||
}, Y = (i, t) => { | ||
if (t.length) { | ||
@@ -178,7 +178,7 @@ Array.from(t).forEach((r) => r.addEventListener("click", i.click.bind(i))); | ||
i.toggleAttribute("internals-invalid", o), i.toggleAttribute("internals-valid", !o); | ||
}, lt = (i) => { | ||
A(I(i.target)); | ||
}, ct = (i) => { | ||
A(I(i.target)); | ||
}, dt = (i) => { | ||
A(I(i.target)); | ||
}, vt = (i) => { | ||
const t = ["button[type=submit]", "input[type=submit]", "button:not([type])"].map((e) => `${e}:not([disabled])`).map((e) => `${e}:not([form])${i.id ? `,${e}[form='${i.id}']` : ""}`).join(","); | ||
@@ -193,3 +193,3 @@ i.addEventListener("click", (e) => { | ||
}); | ||
}, vt = (i) => { | ||
}, ht = (i) => { | ||
const t = y.get(i.target); | ||
@@ -199,3 +199,3 @@ t && t.size && t.forEach((e) => { | ||
}); | ||
}, Y = (i, t, e) => { | ||
}, Z = (i, t, e) => { | ||
if (t) { | ||
@@ -207,3 +207,3 @@ const r = y.get(t); | ||
const o = /* @__PURE__ */ new Set(); | ||
o.add(i), y.set(t, o), dt(t), t.addEventListener("reset", vt), t.addEventListener("input", lt), t.addEventListener("change", ct); | ||
o.add(i), y.set(t, o), vt(t), t.addEventListener("reset", ht), t.addEventListener("input", ct), t.addEventListener("change", dt); | ||
} | ||
@@ -220,3 +220,3 @@ f.set(t, { ref: i, internals: e }), i.constructor.formAssociated && i.formAssociatedCallback && setTimeout(() => { | ||
throw new e(t); | ||
}, Z = (i, t, e) => { | ||
}, tt = (i, t, e) => { | ||
const r = y.get(i); | ||
@@ -226,6 +226,6 @@ return r && r.size && r.forEach((o) => { | ||
}), t; | ||
}, tt = (i) => { | ||
}, et = (i) => { | ||
if (i.constructor.formAssociated) { | ||
const t = c.get(i), { labels: e, form: r } = t; | ||
X(i, e), Y(i, r, t); | ||
Y(i, e), Z(i, r, t); | ||
} | ||
@@ -236,3 +236,3 @@ }; | ||
} | ||
class ht { | ||
class mt { | ||
constructor() { | ||
@@ -242,3 +242,3 @@ 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); | ||
} | ||
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 && A(e), i), bt = (i) => { | ||
const pt = (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), bt = (i, t, e) => (i.valid = ut(t), Object.keys(t).forEach((r) => i[r] = t[r]), e && A(e), i), ut = (i) => { | ||
let t = !0; | ||
@@ -248,4 +248,4 @@ for (let e in i) | ||
return t; | ||
}, $ = /* @__PURE__ */ new WeakMap(); | ||
function et(i, t) { | ||
}, O = /* @__PURE__ */ new WeakMap(); | ||
function it(i, t) { | ||
i.toggleAttribute(t, !0), i.part && i.part.add(t); | ||
@@ -260,3 +260,3 @@ } | ||
throw new TypeError("Illegal constructor"); | ||
$.set(this, t); | ||
O.set(this, t); | ||
} | ||
@@ -266,5 +266,5 @@ add(t) { | ||
throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`); | ||
const e = super.add(t), r = $.get(this), o = `state${t}`; | ||
return r.isConnected ? et(r, o) : setTimeout(() => { | ||
et(r, o); | ||
const e = super.add(t), r = O.get(this), o = `state${t}`; | ||
return r.isConnected ? it(r, o) : setTimeout(() => { | ||
it(r, o); | ||
}), e; | ||
@@ -278,3 +278,3 @@ } | ||
delete(t) { | ||
const e = super.delete(t), r = $.get(this); | ||
const e = super.delete(t), r = O.get(this); | ||
return r.isConnected ? (r.toggleAttribute(`state${t}`, !1), r.part && r.part.remove(`state${t}`)) : setTimeout(() => { | ||
@@ -285,3 +285,3 @@ r.toggleAttribute(`state${t}`, !1), r.part && r.part.remove(`state${t}`); | ||
} | ||
function it(i, t, e, r) { | ||
function rt(i, t, e, r) { | ||
if (e === "a" && !r) | ||
@@ -293,3 +293,3 @@ throw new TypeError("Private accessor was defined without a getter"); | ||
} | ||
function ut(i, t, e, r, o) { | ||
function ft(i, t, e, r, o) { | ||
if (r === "m") | ||
@@ -304,5 +304,5 @@ throw new TypeError("Private method is not writable"); | ||
var C; | ||
class ft { | ||
class gt { | ||
constructor(t) { | ||
C.set(this, void 0), ut(this, C, t, "f"); | ||
C.set(this, void 0), ft(this, C, t, "f"); | ||
for (let e = 0; e < t.length; e++) { | ||
@@ -315,6 +315,6 @@ let r = t[e]; | ||
get length() { | ||
return it(this, C, "f").length; | ||
return rt(this, C, "f").length; | ||
} | ||
[(C = /* @__PURE__ */ new WeakMap(), Symbol.iterator)]() { | ||
return it(this, C, "f")[Symbol.iterator](); | ||
return rt(this, C, "f")[Symbol.iterator](); | ||
} | ||
@@ -328,3 +328,3 @@ item(t) { | ||
} | ||
function gt() { | ||
function yt() { | ||
const i = HTMLFormElement.prototype.checkValidity; | ||
@@ -336,7 +336,7 @@ HTMLFormElement.prototype.checkValidity = e; | ||
let n = i.apply(this, l); | ||
return Z(this, n, "checkValidity"); | ||
return tt(this, n, "checkValidity"); | ||
} | ||
function r(...l) { | ||
let n = t.apply(this, l); | ||
return Z(this, n, "reportValidity"); | ||
return tt(this, n, "reportValidity"); | ||
} | ||
@@ -350,7 +350,7 @@ const { get: o } = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements"); | ||
const d = Array.from(n).concat(u).sort((E, w) => E.compareDocumentPosition ? E.compareDocumentPosition(w) & 2 ? 1 : -1 : 0); | ||
return new ft(d); | ||
return new gt(d); | ||
} | ||
}); | ||
} | ||
class rt { | ||
class ot { | ||
static get isPolyfilled() { | ||
@@ -362,4 +362,4 @@ return !0; | ||
throw new TypeError("Illegal constructor"); | ||
const e = t.getRootNode(), r = new ht(); | ||
this.states = new V(t), p.set(this, t), s.set(this, r), c.set(t, this), ot(t, this), st(t, this), Object.seal(this), e instanceof DocumentFragment && nt(e); | ||
const e = t.getRootNode(), r = new mt(); | ||
this.states = new V(t), p.set(this, t), s.set(this, r), c.set(t, this), at(t, this), lt(t, this), Object.seal(this), e instanceof DocumentFragment && st(e); | ||
} | ||
@@ -397,3 +397,3 @@ checkValidity() { | ||
return !0; | ||
const e = this.checkValidity(), r = B.get(this); | ||
const e = this.checkValidity(), r = K.get(this); | ||
if (r && !t.constructor.formAssociated) | ||
@@ -405,5 +405,5 @@ throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."); | ||
const e = p.get(this); | ||
if (x(e, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), J(this), t != null && !(t instanceof FormData)) { | ||
if (x(e, "Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."), Q(this), t != null && !(t instanceof FormData)) { | ||
if (e.getAttribute("name")) { | ||
const r = Q(e, this); | ||
const r = X(e, this); | ||
r.value = t; | ||
@@ -414,3 +414,3 @@ } | ||
if (typeof o == "string") { | ||
const l = Q(e, this); | ||
const l = X(e, this); | ||
l.name = r, l.value = o; | ||
@@ -425,10 +425,10 @@ } | ||
throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present."); | ||
B.set(this, r); | ||
K.set(this, r); | ||
const l = s.get(this), n = {}; | ||
for (const E in t) | ||
n[E] = t[E]; | ||
Object.keys(n).length === 0 && mt(l); | ||
Object.keys(n).length === 0 && pt(l); | ||
const u = { ...l, ...n }; | ||
delete u.valid; | ||
const { valid: d } = pt(l, u, this.form); | ||
const { valid: d } = bt(l, u, this.form); | ||
if (!d && !e) | ||
@@ -439,3 +439,3 @@ 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."); | ||
get shadowRoot() { | ||
const t = p.get(this), e = H.get(t); | ||
const t = p.get(this), e = B.get(t); | ||
return e || null; | ||
@@ -456,3 +456,3 @@ } | ||
} | ||
function yt() { | ||
function wt() { | ||
if (typeof window > "u" || !window.ElementInternals || !HTMLElement.prototype.attachInternals) | ||
@@ -481,3 +481,3 @@ return !1; | ||
} | ||
if (yt()) { | ||
if (wt()) { | ||
if (typeof window < "u" && !window.CustomStateSet) { | ||
@@ -492,3 +492,3 @@ window.CustomStateSet = V; | ||
} else { | ||
if (typeof window < "u" && (window.ElementInternals = rt), typeof CustomElementRegistry < "u") { | ||
if (typeof window < "u" && (window.ElementInternals = ot), typeof CustomElementRegistry < "u") { | ||
const i = CustomElementRegistry.prototype.define; | ||
@@ -499,3 +499,3 @@ CustomElementRegistry.prototype.define = function(t, e, r) { | ||
e.prototype.connectedCallback = function() { | ||
q.has(this) || (q.set(this, !0), this.hasAttribute("disabled") && D(this, !0)), o != null && o.apply(this), tt(this); | ||
U.has(this) || (U.set(this, !0), this.hasAttribute("disabled") && $(this, !0)), o != null && o.apply(this), et(this); | ||
}; | ||
@@ -514,9 +514,9 @@ } | ||
throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached."); | ||
return new rt(this); | ||
return new ot(this); | ||
}), typeof Element < "u") { | ||
let i = function(...e) { | ||
const r = t.apply(this, e); | ||
if (H.set(this, r), T()) { | ||
const o = new MutationObserver(_); | ||
window.ShadyDOM ? o.observe(this, P) : o.observe(r, P), g.set(this, o); | ||
if (B.set(this, r), T()) { | ||
const o = new MutationObserver(P); | ||
window.ShadyDOM ? o.observe(this, D) : o.observe(r, D), g.set(this, o); | ||
} | ||
@@ -528,3 +528,3 @@ return r; | ||
} | ||
T() && typeof document < "u" && new MutationObserver(_).observe(document.documentElement, P), typeof HTMLFormElement < "u" && gt(), typeof window < "u" && !window.CustomStateSet && (window.CustomStateSet = V); | ||
T() && typeof document < "u" && new MutationObserver(P).observe(document.documentElement, D), typeof HTMLFormElement < "u" && yt(), typeof window < "u" && !window.CustomStateSet && (window.CustomStateSet = V); | ||
} | ||
@@ -538,3 +538,3 @@ })(); | ||
const L = "pie-button"; | ||
class v extends xt { | ||
class v extends Et { | ||
constructor() { | ||
@@ -590,3 +590,3 @@ super(), this.size = "medium", this.type = "submit", this.variant = "primary", this.iconPlacement = "leading", this.disabled = !1, this.isLoading = !1, this.isFullWidth = !1, this.isResponsive = !1, this._handleFormKeyDown = (s) => { | ||
renderSpinner() { | ||
const { size: s, variant: a, disabled: c } = this, b = s.includes("small") ? "small" : "medium"; | ||
const { size: s, variant: a, disabled: c } = this, b = s && s.includes("small") ? "small" : "medium"; | ||
let f; | ||
@@ -615,6 +615,6 @@ return c ? f = a === "ghost-inverse" ? "inverse" : "secondary" : f = ["primary", "destructive", "outline-inverse", "ghost-inverse"].includes(this.variant) ? "inverse" : "secondary", N` | ||
class="o-btn" | ||
type=${s} | ||
variant=${b} | ||
size=${f} | ||
responsiveSize=${Et(k)} | ||
type=${R(s)} | ||
variant=${R(b)} | ||
size=${R(f)} | ||
responsiveSize=${R(k)} | ||
?disabled=${a} | ||
@@ -624,6 +624,6 @@ ?isFullWidth=${c} | ||
?isLoading=${g}> | ||
${g ? this.renderSpinner() : W} | ||
${M === "leading" ? N`<slot name="icon"></slot>` : W} | ||
${g ? this.renderSpinner() : H} | ||
${M === "leading" ? N`<slot name="icon"></slot>` : H} | ||
<slot></slot> | ||
${M === "trailing" ? N`<slot name="icon"></slot>` : W} | ||
${M === "trailing" ? N`<slot name="icon"></slot>` : H} | ||
</button>`; | ||
@@ -637,18 +637,18 @@ } | ||
v.formAssociated = !0; | ||
v.styles = wt(Ft); | ||
v.styles = xt(Ft); | ||
m([ | ||
h(), | ||
R(L, zt, "medium") | ||
_(L, zt, "medium") | ||
], v.prototype, "size", 2); | ||
m([ | ||
h(), | ||
R(L, Mt, "submit") | ||
_(L, Mt, "submit") | ||
], v.prototype, "type", 2); | ||
m([ | ||
h(), | ||
R(L, Ct, "primary") | ||
_(L, Ct, "primary") | ||
], v.prototype, "variant", 2); | ||
m([ | ||
h({ type: String }), | ||
R(L, Lt, "leading") | ||
_(L, Lt, "leading") | ||
], v.prototype, "iconPlacement", 2); | ||
@@ -655,0 +655,0 @@ m([ |
@@ -11,11 +11,11 @@ import type { CSSResult } from 'lit'; | ||
*/ | ||
size: typeof sizes[number]; | ||
size?: typeof sizes[number]; | ||
/** | ||
* What type attribute should be applied to the button. For example submit, button. | ||
*/ | ||
type: typeof types[number]; | ||
type?: typeof types[number]; | ||
/** | ||
* What style variant the button should be such as primary, outline or ghost. | ||
*/ | ||
variant: Variant; | ||
variant?: Variant; | ||
/** | ||
@@ -28,15 +28,15 @@ * The placement of the icon slot, if provided, such as leading or trailing | ||
*/ | ||
disabled: boolean; | ||
disabled?: boolean; | ||
/** | ||
* When true, the button element will occupy the full width of its container. | ||
*/ | ||
isFullWidth: boolean; | ||
isFullWidth?: boolean; | ||
/** | ||
* When true, displays a loading indicator inside the button. | ||
*/ | ||
isLoading: boolean; | ||
isLoading?: boolean; | ||
/** | ||
* When true, enables the responsive size feature. | ||
*/ | ||
isResponsive: boolean; | ||
isResponsive?: boolean; | ||
/** | ||
@@ -43,0 +43,0 @@ * The name of the button, submitted as a pair with the button's value as part of the form data, when that button is used to submit the form. |
{ | ||
"name": "@justeattakeaway/pie-button", | ||
"version": "0.0.0-snapshot-release-20231218150157", | ||
"version": "0.0.0-snapshot-release-20231218154706", | ||
"description": "PIE design system button built using web components", | ||
@@ -40,3 +40,3 @@ "type": "module", | ||
"dependencies": { | ||
"@justeattakeaway/pie-spinner": "0.0.0-snapshot-release-20231218150157", | ||
"@justeattakeaway/pie-spinner": "0.0.0-snapshot-release-20231218154706", | ||
"@justeattakeaway/pie-webc-core": "0.13.0", | ||
@@ -43,0 +43,0 @@ "element-internals-polyfill": "1.3.9" |
@@ -20,11 +20,11 @@ export const sizes = ['xsmall', 'small-productive', 'small-expressive', 'medium', 'large'] as const; | ||
*/ | ||
size: typeof sizes[number]; | ||
size?: typeof sizes[number]; | ||
/** | ||
* What type attribute should be applied to the button. For example submit, button. | ||
*/ | ||
type: typeof types[number]; | ||
type?: typeof types[number]; | ||
/** | ||
* What style variant the button should be such as primary, outline or ghost. | ||
*/ | ||
variant: Variant; | ||
variant?: Variant; | ||
/** | ||
@@ -37,11 +37,11 @@ * The placement of the icon slot, if provided, such as leading or trailing | ||
*/ | ||
disabled: boolean; | ||
disabled?: boolean; | ||
/** | ||
* When true, the button element will occupy the full width of its container. | ||
*/ | ||
isFullWidth: boolean; | ||
isFullWidth?: boolean; | ||
/** | ||
* When true, displays a loading indicator inside the button. | ||
*/ | ||
isLoading: boolean; | ||
isLoading?: boolean; | ||
@@ -51,3 +51,3 @@ /** | ||
*/ | ||
isResponsive: boolean; | ||
isResponsive?: boolean; | ||
@@ -54,0 +54,0 @@ /** |
@@ -214,3 +214,3 @@ import { | ||
const { size, variant, disabled } = this; | ||
const spinnerSize = size.includes('small') ? 'small' : 'medium'; // includes("small") matches for any small size value and xsmall | ||
const spinnerSize = size && size.includes('small') ? 'small' : 'medium'; // includes("small") matches for any small size value and xsmall | ||
let spinnerVariant; | ||
@@ -248,5 +248,5 @@ if (disabled) { | ||
class="o-btn" | ||
type=${type} | ||
variant=${variant} | ||
size=${size} | ||
type=${ifDefined(type)} | ||
variant=${ifDefined(variant)} | ||
size=${ifDefined(size)} | ||
responsiveSize=${ifDefined(responsiveSize)} | ||
@@ -253,0 +253,0 @@ ?disabled=${disabled} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85969