@justeattakeaway/pie-spinner 0.2.1 → 0.2.2
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/README.md +1 -1
- package/dist/index.js +21 -21
- package/dist/react.d.ts +1 -1
- package/dist/react.js +10 -64
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ import '@justeattakeaway/pie-spinner';
|
|
|
55
55
|
```js
|
|
56
56
|
// React
|
|
57
57
|
// For React, you will need to import our React-specific component build
|
|
58
|
-
// which wraps the web component using
|
|
58
|
+
// which wraps the web component using @lit/react
|
|
59
59
|
import { PieSpinner } from '@justeattakeaway/pie-spinner/dist/react';
|
|
60
60
|
```
|
|
61
61
|
|
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,72 +1,18 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { createComponent as r } from "@lit/react";
|
|
3
|
+
import { PieSpinner as i } from "./index.js";
|
|
4
|
+
import { sizes as c, variants as f } from "./index.js";
|
|
4
5
|
import "lit";
|
|
5
6
|
import "lit/decorators.js";
|
|
6
|
-
|
|
7
|
-
* @license
|
|
8
|
-
* Copyright 2018 Google LLC
|
|
9
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
10
|
-
*/
|
|
11
|
-
const S = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), w = /* @__PURE__ */ new WeakMap(), b = (t, n, c, d, m) => {
|
|
12
|
-
const o = m == null ? void 0 : m[n];
|
|
13
|
-
o === void 0 || c === d ? c == null && n in HTMLElement.prototype ? t.removeAttribute(n) : t[n] = c : ((r, i, h) => {
|
|
14
|
-
let a = w.get(r);
|
|
15
|
-
a === void 0 && w.set(r, a = /* @__PURE__ */ new Map());
|
|
16
|
-
let l = a.get(i);
|
|
17
|
-
h !== void 0 ? l === void 0 ? (a.set(i, l = { handleEvent: h }), r.addEventListener(i, l)) : l.handleEvent = h : l !== void 0 && (a.delete(i), r.removeEventListener(i, l));
|
|
18
|
-
})(t, o, c);
|
|
19
|
-
}, M = (t, n) => {
|
|
20
|
-
typeof t == "function" ? t(n) : t.current = n;
|
|
21
|
-
};
|
|
22
|
-
function P(t = window.React, n, c, d, m) {
|
|
23
|
-
let o, r, i;
|
|
24
|
-
if (n === void 0) {
|
|
25
|
-
const p = t;
|
|
26
|
-
({ tagName: r, elementClass: i, events: d, displayName: m } = p), o = p.react;
|
|
27
|
-
} else
|
|
28
|
-
o = t, i = c, r = n;
|
|
29
|
-
const h = o.Component, a = o.createElement, l = new Set(Object.keys(d ?? {}));
|
|
30
|
-
class f extends h {
|
|
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() {
|
|
40
|
-
var e;
|
|
41
|
-
this.t(), (e = this.o) === null || e === void 0 || e.removeAttribute("defer-hydration");
|
|
42
|
-
}
|
|
43
|
-
componentDidUpdate(e) {
|
|
44
|
-
this.t(e);
|
|
45
|
-
}
|
|
46
|
-
render() {
|
|
47
|
-
const { _$Gl: e, ...u } = this.props;
|
|
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({
|
|
7
|
+
const m = r({
|
|
62
8
|
displayName: "PieSpinner",
|
|
63
|
-
elementClass:
|
|
64
|
-
react:
|
|
9
|
+
elementClass: i,
|
|
10
|
+
react: e,
|
|
65
11
|
tagName: "pie-spinner",
|
|
66
12
|
events: {}
|
|
67
13
|
});
|
|
68
14
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
15
|
+
m as PieSpinner,
|
|
16
|
+
c as sizes,
|
|
17
|
+
f as variants
|
|
72
18
|
};
|
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",
|
|
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"
|
|
35
35
|
},
|
|
36
36
|
"volta": {
|
|
37
37
|
"extends": "../../../package.json"
|