@justeattakeaway/pie-spinner 0.2.1 → 0.2.2-next.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 +21 -21
- package/dist/react.d.ts +1 -1
- package/dist/react.js +32 -55
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { unsafeCSS as f, LitElement as
|
|
1
|
+
import { unsafeCSS as f, LitElement as h, html as v, nothing as u } from "lit";
|
|
2
2
|
import { property as c } from "lit/decorators.js";
|
|
3
|
-
const b = (
|
|
3
|
+
const b = (n, e, o) => function(s, i) {
|
|
4
4
|
const t = `#${i}`;
|
|
5
5
|
Object.defineProperty(s, i, {
|
|
6
6
|
get() {
|
|
7
7
|
return this[t];
|
|
8
8
|
},
|
|
9
9
|
set(l) {
|
|
10
|
-
const h = this[t];
|
|
11
10
|
e.includes(l) ? this[t] = l : (console.error(
|
|
12
|
-
`<${
|
|
11
|
+
`<${n}> Invalid value "${l}" provided for property "${i}".`,
|
|
13
12
|
`Must be one of: ${e.join(" | ")}.`,
|
|
14
13
|
`Falling back to default value: "${o}"`
|
|
15
|
-
), this[t] = o)
|
|
16
|
-
}
|
|
14
|
+
), this[t] = o);
|
|
15
|
+
},
|
|
16
|
+
configurable: !0
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
customElements.get(
|
|
19
|
+
function m(n, e) {
|
|
20
|
+
customElements.get(n) ? console.warn(`PIE Web Component: "${n}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(n, e);
|
|
21
21
|
}
|
|
22
22
|
const y = `*,*:before,*:after{box-sizing:border-box}@keyframes rotate360{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.c-spinner{--spinner-size: 24px;--spinner-left-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), 1);--spinner-right-color: hsl(var(--spinner-base-color-h), var(--spinner-base-color-s), var(--spinner-base-color-l), .35);block-size:var(--spinner-size);inline-size:var(--spinner-size);border-radius:var(--dt-radius-rounded-e);border-width:calc(var(--spinner-size) / 8);border-style:solid;border-color:var(--spinner-left-color) var(--spinner-right-color) var(--spinner-right-color) var(--spinner-left-color);will-change:transform;animation:rotate360 1.15s linear infinite;--spinner-base-color-h: var(--dt-color-content-brand-h);--spinner-base-color-s: var(--dt-color-content-brand-s);--spinner-base-color-l: var(--dt-color-content-brand-l)}.c-spinner[variant=secondary]{--spinner-base-color-h: var(--dt-color-content-interactive-secondary-h);--spinner-base-color-s: var(--dt-color-content-interactive-secondary-s);--spinner-base-color-l: var(--dt-color-content-interactive-secondary-l)}.c-spinner[variant=inverse]{--spinner-base-color-h: var(--dt-color-content-inverse-h);--spinner-base-color-s: var(--dt-color-content-inverse-s);--spinner-base-color-l: var(--dt-color-content-inverse-l)}.c-spinner[size=xs]{--spinner-size: 16px}.c-spinner[size=s]{--spinner-size: 20px}.c-spinner[size=l]{--spinner-size: 32px}.c-spinner[size=xl]{--spinner-size: 48px}.c-spinner-label{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}
|
|
23
|
-
`,
|
|
24
|
-
var
|
|
25
|
-
for (var s =
|
|
26
|
-
(t =
|
|
27
|
-
return
|
|
23
|
+
`, z = ["xs", "s", "m", "l", "xl"], x = ["brand", "secondary", "inverse"];
|
|
24
|
+
var g = Object.defineProperty, P = Object.getOwnPropertyDescriptor, p = (n, e, o, r) => {
|
|
25
|
+
for (var s = r > 1 ? void 0 : r ? P(e, o) : e, i = n.length - 1, t; i >= 0; i--)
|
|
26
|
+
(t = n[i]) && (s = (r ? t(e, o, s) : t(s)) || s);
|
|
27
|
+
return r && s && g(e, o, s), s;
|
|
28
28
|
};
|
|
29
29
|
const d = "pie-spinner";
|
|
30
|
-
class a extends
|
|
30
|
+
class a extends h {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments), this.size = "m", this.variant = "brand";
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
|
-
const { variant: e, size: o, aria:
|
|
35
|
+
const { variant: e, size: o, aria: r } = this;
|
|
36
36
|
return v`
|
|
37
37
|
<div
|
|
38
38
|
data-test-id="pie-spinner"
|
|
@@ -41,7 +41,7 @@ class a extends u {
|
|
|
41
41
|
aria-live="polite"
|
|
42
42
|
size="${o}"
|
|
43
43
|
variant="${e}">
|
|
44
|
-
${
|
|
44
|
+
${r != null && r.label ? v`<span class="c-spinner-label">${r.label}</span>` : u}
|
|
45
45
|
</div>`;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -51,15 +51,15 @@ p([
|
|
|
51
51
|
], a.prototype, "aria", 2);
|
|
52
52
|
p([
|
|
53
53
|
c(),
|
|
54
|
-
b(d,
|
|
54
|
+
b(d, z, "m")
|
|
55
55
|
], a.prototype, "size", 2);
|
|
56
56
|
p([
|
|
57
57
|
c(),
|
|
58
|
-
b(d,
|
|
58
|
+
b(d, x, "brand")
|
|
59
59
|
], a.prototype, "variant", 2);
|
|
60
|
-
|
|
60
|
+
m(d, a);
|
|
61
61
|
export {
|
|
62
62
|
a as PieSpinner,
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
z as sizes,
|
|
64
|
+
x as variants
|
|
65
65
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSResult } from 'lit';
|
|
2
2
|
import type { LitElement } from 'lit';
|
|
3
|
-
import type { ReactWebComponent } from '@lit
|
|
3
|
+
import type { ReactWebComponent } from '@lit/react';
|
|
4
4
|
import type { TemplateResult } from 'lit-html';
|
|
5
5
|
|
|
6
6
|
export declare type AriaProps = {
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as y from "react";
|
|
2
2
|
import { PieSpinner as E } from "./index.js";
|
|
3
|
-
import { sizes as k, variants as
|
|
3
|
+
import { sizes as k, variants as C } from "./index.js";
|
|
4
4
|
import "lit";
|
|
5
5
|
import "lit/decorators.js";
|
|
6
6
|
/**
|
|
@@ -8,65 +8,42 @@ import "lit/decorators.js";
|
|
|
8
8
|
* Copyright 2018 Google LLC
|
|
9
9
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
let a =
|
|
15
|
-
a === void 0 &&
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
})(t,
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
constructor() {
|
|
32
|
-
super(...arguments), this.o = null;
|
|
33
|
-
}
|
|
34
|
-
t(e) {
|
|
35
|
-
if (this.o !== null)
|
|
36
|
-
for (const u in this.i)
|
|
37
|
-
b(this.o, u, this.props[u], e ? e[u] : void 0, d);
|
|
38
|
-
}
|
|
39
|
-
componentDidMount() {
|
|
11
|
+
const N = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), v = /* @__PURE__ */ new WeakMap(), h = (t, c, o, u, l) => {
|
|
12
|
+
const p = l == null ? void 0 : l[c];
|
|
13
|
+
p === void 0 || o === u ? (t[c] = o, o == null && c in HTMLElement.prototype && t.removeAttribute(c)) : ((i, n, s) => {
|
|
14
|
+
let a = v.get(i);
|
|
15
|
+
a === void 0 && v.set(i, a = /* @__PURE__ */ new Map());
|
|
16
|
+
let r = a.get(n);
|
|
17
|
+
s !== void 0 ? r === void 0 ? (a.set(n, r = { handleEvent: s }), i.addEventListener(n, r)) : r.handleEvent = s : r !== void 0 && (a.delete(n), i.removeEventListener(n, r));
|
|
18
|
+
})(t, p, o);
|
|
19
|
+
}, S = ({ react: t, tagName: c, elementClass: o, events: u, displayName: l }) => {
|
|
20
|
+
const p = new Set(Object.keys(u ?? {})), i = t.forwardRef((n, s) => {
|
|
21
|
+
const a = t.useRef(null), r = t.useRef(null), m = {}, d = {};
|
|
22
|
+
for (const [e, f] of Object.entries(n))
|
|
23
|
+
N.has(e) ? m[e === "className" ? "class" : e] = f : p.has(e) || e in o.prototype ? d[e] = f : m[e] = f;
|
|
24
|
+
return t.useLayoutEffect(() => {
|
|
25
|
+
if (r.current !== null) {
|
|
26
|
+
for (const e in d)
|
|
27
|
+
h(r.current, e, n[e], a.current ? a.current[e] : void 0, u);
|
|
28
|
+
a.current = n;
|
|
29
|
+
}
|
|
30
|
+
}), t.useLayoutEffect(() => {
|
|
40
31
|
var e;
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.h !== e && (this.u = (s) => {
|
|
49
|
-
e !== null && M(e, s), this.o = s, this.h = e;
|
|
50
|
-
}), this.i = {};
|
|
51
|
-
const v = { ref: this.u };
|
|
52
|
-
for (const [s, y] of Object.entries(u))
|
|
53
|
-
S.has(s) ? v[s === "className" ? "class" : s] = y : l.has(s) || s in i.prototype ? this.i[s] = y : v[s] = y;
|
|
54
|
-
return v.suppressHydrationWarning = !0, a(r, v);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
f.displayName = m ?? i.name;
|
|
58
|
-
const N = o.forwardRef((p, e) => a(f, { ...p, _$Gl: e }, p == null ? void 0 : p.children));
|
|
59
|
-
return N.displayName = f.displayName, N;
|
|
60
|
-
}
|
|
61
|
-
const R = P({
|
|
32
|
+
(e = r.current) == null || e.removeAttribute("defer-hydration");
|
|
33
|
+
}, []), m.suppressHydrationWarning = !0, t.createElement(c, { ...m, ref: t.useCallback((e) => {
|
|
34
|
+
r.current = e, typeof s == "function" ? s(e) : s !== null && (s.current = e);
|
|
35
|
+
}, [s]) });
|
|
36
|
+
});
|
|
37
|
+
return i.displayName = l ?? o.name, i;
|
|
38
|
+
}, L = S({
|
|
62
39
|
displayName: "PieSpinner",
|
|
63
40
|
elementClass: E,
|
|
64
|
-
react:
|
|
41
|
+
react: y,
|
|
65
42
|
tagName: "pie-spinner",
|
|
66
43
|
events: {}
|
|
67
44
|
});
|
|
68
45
|
export {
|
|
69
|
-
|
|
46
|
+
L as PieSpinner,
|
|
70
47
|
k as sizes,
|
|
71
|
-
|
|
48
|
+
C as variants
|
|
72
49
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-spinner",
|
|
3
3
|
"description": "PIE Design System Spinner built using Web Components",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-next.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"author": "Just Eat Takeaway.com - Design System Team",
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
31
|
+
"@justeattakeaway/pie-components-config": "0.6.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
34
|
+
"@justeattakeaway/pie-webc-core": "0.12.0-next.0"
|
|
35
35
|
},
|
|
36
36
|
"volta": {
|
|
37
37
|
"extends": "../../../package.json"
|