@justeattakeaway/pie-spinner 0.2.2-next.0 → 0.3.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/README.md +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -12
- package/dist/react.d.ts +1 -1
- package/dist/react.js +10 -41
- package/package.json +2 -2
- package/src/defs.ts +1 -1
- package/src/index.ts +2 -2
- package/src/spinner.scss +5 -5
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
|
|
|
@@ -74,7 +74,7 @@ import { PieSpinner } from '@justeattakeaway/pie-spinner/dist/react';
|
|
|
74
74
|
|
|
75
75
|
| Property | Type | Default | Description |
|
|
76
76
|
|---|---|---|---|
|
|
77
|
-
| size | `String` | `
|
|
77
|
+
| size | `String` | `medium` | Size of the spinner, one of `sizes` – `xsmall`, `small`, `medium`, `large`, `xlarge` |
|
|
78
78
|
| variant | `String` | `brand` | Variant of the spinner, one of `variants` – `brand`, `secondary`, `inverse` |
|
|
79
79
|
| aria | `Object` | `undefined` | An object representing the aria attributes such as label;
|
|
80
80
|
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class PieSpinner extends LitElement implements SpinnerProps {
|
|
|
17
17
|
static styles: CSSResult;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export declare const sizes: readonly ["
|
|
20
|
+
export declare const sizes: readonly ["xsmall", "small", "medium", "large", "xlarge"];
|
|
21
21
|
|
|
22
22
|
export declare interface SpinnerProps {
|
|
23
23
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unsafeCSS as f, LitElement as h, html as v, nothing as
|
|
1
|
+
import { unsafeCSS as f, LitElement as h, html as v, nothing as m } from "lit";
|
|
2
2
|
import { property as c } from "lit/decorators.js";
|
|
3
3
|
const b = (n, e, o) => function(s, i) {
|
|
4
4
|
const t = `#${i}`;
|
|
@@ -16,20 +16,20 @@ const b = (n, e, o) => function(s, i) {
|
|
|
16
16
|
configurable: !0
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function u(n, e) {
|
|
20
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
|
-
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=
|
|
23
|
-
`, z = ["
|
|
24
|
-
var
|
|
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=xsmall]{--spinner-size: 16px}.c-spinner[size=small]{--spinner-size: 20px}.c-spinner[size=large]{--spinner-size: 32px}.c-spinner[size=xlarge]{--spinner-size: 48px}.c-spinner-label{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}
|
|
23
|
+
`, z = ["xsmall", "small", "medium", "large", "xlarge"], g = ["brand", "secondary", "inverse"];
|
|
24
|
+
var x = Object.defineProperty, P = Object.getOwnPropertyDescriptor, p = (n, e, o, r) => {
|
|
25
25
|
for (var s = r > 1 ? void 0 : r ? P(e, o) : e, i = n.length - 1, t; i >= 0; i--)
|
|
26
26
|
(t = n[i]) && (s = (r ? t(e, o, s) : t(s)) || s);
|
|
27
|
-
return r && s &&
|
|
27
|
+
return r && s && x(e, o, s), s;
|
|
28
28
|
};
|
|
29
29
|
const d = "pie-spinner";
|
|
30
30
|
class a extends h {
|
|
31
31
|
constructor() {
|
|
32
|
-
super(...arguments), this.size = "
|
|
32
|
+
super(...arguments), this.size = "medium", this.variant = "brand";
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
35
|
const { variant: e, size: o, aria: r } = this;
|
|
@@ -41,7 +41,7 @@ class a extends h {
|
|
|
41
41
|
aria-live="polite"
|
|
42
42
|
size="${o}"
|
|
43
43
|
variant="${e}">
|
|
44
|
-
${r != null && r.label ? v`<span class="c-spinner-label">${r.label}</span>` :
|
|
44
|
+
${r != null && r.label ? v`<span class="c-spinner-label">${r.label}</span>` : m}
|
|
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, z, "
|
|
54
|
+
b(d, z, "medium")
|
|
55
55
|
], a.prototype, "size", 2);
|
|
56
56
|
p([
|
|
57
57
|
c(),
|
|
58
|
-
b(d,
|
|
58
|
+
b(d, g, "brand")
|
|
59
59
|
], a.prototype, "variant", 2);
|
|
60
|
-
|
|
60
|
+
u(d, a);
|
|
61
61
|
export {
|
|
62
62
|
a as PieSpinner,
|
|
63
63
|
z as sizes,
|
|
64
|
-
|
|
64
|
+
g as variants
|
|
65
65
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ declare class PieSpinner_2 extends LitElement implements SpinnerProps {
|
|
|
20
20
|
static styles: CSSResult;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export declare const sizes: readonly ["
|
|
23
|
+
export declare const sizes: readonly ["xsmall", "small", "medium", "large", "xlarge"];
|
|
24
24
|
|
|
25
25
|
export declare interface SpinnerProps {
|
|
26
26
|
/**
|
package/dist/react.js
CHANGED
|
@@ -1,49 +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 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(() => {
|
|
31
|
-
var e;
|
|
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({
|
|
7
|
+
const m = r({
|
|
39
8
|
displayName: "PieSpinner",
|
|
40
|
-
elementClass:
|
|
41
|
-
react:
|
|
9
|
+
elementClass: i,
|
|
10
|
+
react: e,
|
|
42
11
|
tagName: "pie-spinner",
|
|
43
12
|
events: {}
|
|
44
13
|
});
|
|
45
14
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
15
|
+
m as PieSpinner,
|
|
16
|
+
c as sizes,
|
|
17
|
+
f as variants
|
|
49
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.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@justeattakeaway/pie-components-config": "0.6.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@justeattakeaway/pie-webc-core": "0.12.0
|
|
34
|
+
"@justeattakeaway/pie-webc-core": "0.12.0"
|
|
35
35
|
},
|
|
36
36
|
"volta": {
|
|
37
37
|
"extends": "../../../package.json"
|
package/src/defs.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -24,8 +24,8 @@ export class PieSpinner extends LitElement implements SpinnerProps {
|
|
|
24
24
|
public aria?: AriaProps;
|
|
25
25
|
|
|
26
26
|
@property()
|
|
27
|
-
@validPropertyValues(componentSelector, sizes, '
|
|
28
|
-
public size?: SpinnerProps['size'] = '
|
|
27
|
+
@validPropertyValues(componentSelector, sizes, 'medium')
|
|
28
|
+
public size?: SpinnerProps['size'] = 'medium';
|
|
29
29
|
|
|
30
30
|
@property()
|
|
31
31
|
@validPropertyValues(componentSelector, variants, 'brand')
|
package/src/spinner.scss
CHANGED
|
@@ -55,23 +55,23 @@
|
|
|
55
55
|
@include spinner-base-colors('--dt-color-content-inverse');
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
&[size='
|
|
58
|
+
&[size='xsmall'] {
|
|
59
59
|
--spinner-size: 16px;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
&[size='
|
|
62
|
+
&[size='small'] {
|
|
63
63
|
--spinner-size: 20px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
&[size='
|
|
66
|
+
&[size='medium'] {
|
|
67
67
|
/* Same as default styles */
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
&[size='
|
|
70
|
+
&[size='large'] {
|
|
71
71
|
--spinner-size: 32px;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
&[size='
|
|
74
|
+
&[size='xlarge'] {
|
|
75
75
|
--spinner-size: 48px;
|
|
76
76
|
}
|
|
77
77
|
}
|