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