@justeattakeaway/pie-spinner 0.6.7 → 0.7.1
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 +7 -14
- package/dist/index.d.ts +5 -4
- package/dist/index.js +47 -38
- package/dist/react.d.ts +5 -4
- package/dist/react.js +10 -13
- package/package.json +4 -4
- package/src/defs-react.ts +1 -1
- package/src/defs.ts +1 -1
- package/src/index.ts +25 -12
- package/src/spinner.scss +8 -11
package/custom-elements.json
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"kind": "field",
|
|
78
78
|
"name": "aria",
|
|
79
79
|
"type": {
|
|
80
|
-
"text": "
|
|
80
|
+
"text": "SpinnerProps['aria']"
|
|
81
81
|
},
|
|
82
82
|
"privacy": "public",
|
|
83
83
|
"attribute": "aria"
|
|
@@ -85,42 +85,35 @@
|
|
|
85
85
|
{
|
|
86
86
|
"kind": "field",
|
|
87
87
|
"name": "size",
|
|
88
|
-
"type": {
|
|
89
|
-
"text": "SpinnerProps['size'] | undefined"
|
|
90
|
-
},
|
|
91
88
|
"privacy": "public",
|
|
92
89
|
"attribute": "size"
|
|
93
90
|
},
|
|
94
91
|
{
|
|
95
92
|
"kind": "field",
|
|
96
93
|
"name": "variant",
|
|
97
|
-
"type": {
|
|
98
|
-
"text": "SpinnerProps['variant'] | undefined"
|
|
99
|
-
},
|
|
100
94
|
"privacy": "public",
|
|
101
95
|
"attribute": "variant"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"kind": "method",
|
|
99
|
+
"name": "renderAriaLabel",
|
|
100
|
+
"privacy": "private"
|
|
102
101
|
}
|
|
103
102
|
],
|
|
104
103
|
"attributes": [
|
|
105
104
|
{
|
|
106
105
|
"name": "aria",
|
|
107
106
|
"type": {
|
|
108
|
-
"text": "
|
|
107
|
+
"text": "SpinnerProps['aria']"
|
|
109
108
|
},
|
|
110
109
|
"fieldName": "aria"
|
|
111
110
|
},
|
|
112
111
|
{
|
|
113
112
|
"name": "size",
|
|
114
|
-
"type": {
|
|
115
|
-
"text": "SpinnerProps['size'] | undefined"
|
|
116
|
-
},
|
|
117
113
|
"fieldName": "size"
|
|
118
114
|
},
|
|
119
115
|
{
|
|
120
116
|
"name": "variant",
|
|
121
|
-
"type": {
|
|
122
|
-
"text": "SpinnerProps['variant'] | undefined"
|
|
123
|
-
},
|
|
124
117
|
"fieldName": "variant"
|
|
125
118
|
}
|
|
126
119
|
],
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CSSResult } from 'lit';
|
|
|
3
3
|
import type { LitElement } from 'lit';
|
|
4
4
|
import type { TemplateResult } from 'lit-html';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
declare type AriaProps = {
|
|
7
7
|
label?: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -15,10 +15,11 @@ export declare const defaultProps: DefaultProps;
|
|
|
15
15
|
* @tagname pie-spinner
|
|
16
16
|
*/
|
|
17
17
|
export declare class PieSpinner extends LitElement implements SpinnerProps {
|
|
18
|
-
aria
|
|
19
|
-
size
|
|
20
|
-
variant
|
|
18
|
+
aria: SpinnerProps['aria'];
|
|
19
|
+
size: "xsmall" | "small" | "medium" | "large" | "xlarge";
|
|
20
|
+
variant: "brand" | "secondary" | "inverse";
|
|
21
21
|
render(): TemplateResult<1>;
|
|
22
|
+
private renderAriaLabel;
|
|
22
23
|
static styles: CSSResult;
|
|
23
24
|
}
|
|
24
25
|
|
package/dist/index.js
CHANGED
|
@@ -1,51 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { property as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { LitElement as m, html as b, nothing as f, unsafeCSS as u } from "lit";
|
|
2
|
+
import { property as a } from "lit/decorators.js";
|
|
3
|
+
import { classMap as z } from "lit/directives/class-map.js";
|
|
4
|
+
import { validPropertyValues as h, defineCustomElement as y } from "@justeattakeaway/pie-webc-core";
|
|
5
|
+
const x = "*,*:after,*:before{box-sizing:inherit}@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.c-spinner--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.c-spinner--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.c-spinner--xsmall{--spinner-size: 16px}.c-spinner.c-spinner--small{--spinner-size: 20px}.c-spinner.c-spinner--large{--spinner-size: 32px}.c-spinner.c-spinner--xlarge{--spinner-size: 48px}.c-spinner-label{position:absolute;display:block;height:1px;width:1px;overflow:hidden;padding:1px;white-space:nowrap}", g = ["xsmall", "small", "medium", "large", "xlarge"], w = ["brand", "secondary", "inverse"], i = {
|
|
6
6
|
size: "medium",
|
|
7
7
|
variant: "brand"
|
|
8
8
|
};
|
|
9
|
-
var
|
|
10
|
-
for (var
|
|
11
|
-
(
|
|
12
|
-
return e && r
|
|
9
|
+
var $ = Object.defineProperty, t = (p, r, s, d) => {
|
|
10
|
+
for (var e = void 0, o = p.length - 1, v; o >= 0; o--)
|
|
11
|
+
(v = p[o]) && (e = v(r, s, e) || e);
|
|
12
|
+
return e && $(r, s, e), e;
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
class i extends m {
|
|
14
|
+
const l = "pie-spinner", c = class c extends m {
|
|
16
15
|
constructor() {
|
|
17
|
-
super(...arguments), this.size =
|
|
16
|
+
super(...arguments), this.size = i.size, this.variant = i.variant;
|
|
18
17
|
}
|
|
19
18
|
render() {
|
|
20
|
-
const { variant:
|
|
21
|
-
|
|
19
|
+
const { variant: r, size: s } = this, d = {
|
|
20
|
+
"c-spinner": !0,
|
|
21
|
+
[`c-spinner--${s}`]: !0,
|
|
22
|
+
[`c-spinner--${r}`]: !0
|
|
23
|
+
};
|
|
24
|
+
return b`
|
|
22
25
|
<div
|
|
23
26
|
data-test-id="pie-spinner"
|
|
24
|
-
class="
|
|
27
|
+
class="${z(d)}"
|
|
25
28
|
role="status"
|
|
26
|
-
aria-live="polite"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
${e != null && e.label ? d`<span class="c-spinner-label">${e.label}</span>` : z}
|
|
30
|
-
</div>`;
|
|
29
|
+
aria-live="polite">
|
|
30
|
+
${this.renderAriaLabel()}
|
|
31
|
+
</div>`;
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
c
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
],
|
|
45
|
-
|
|
33
|
+
renderAriaLabel() {
|
|
34
|
+
var r;
|
|
35
|
+
return (r = this.aria) != null && r.label ? b`
|
|
36
|
+
<span class="c-spinner-label">
|
|
37
|
+
${this.aria.label}
|
|
38
|
+
</span>` : f;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
c.styles = u(x);
|
|
42
|
+
let n = c;
|
|
43
|
+
t([
|
|
44
|
+
a({ type: Object })
|
|
45
|
+
], n.prototype, "aria");
|
|
46
|
+
t([
|
|
47
|
+
a(),
|
|
48
|
+
h(l, g, i.size)
|
|
49
|
+
], n.prototype, "size");
|
|
50
|
+
t([
|
|
51
|
+
a(),
|
|
52
|
+
h(l, w, i.variant)
|
|
53
|
+
], n.prototype, "variant");
|
|
54
|
+
y(l, n);
|
|
46
55
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
n as PieSpinner,
|
|
57
|
+
i as defaultProps,
|
|
58
|
+
g as sizes,
|
|
59
|
+
w as variants
|
|
51
60
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { LitElement } from 'lit';
|
|
|
4
4
|
import * as React_2 from 'react';
|
|
5
5
|
import type { TemplateResult } from 'lit-html';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
declare type AriaProps = {
|
|
8
8
|
label?: string;
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -18,10 +18,11 @@ export declare const PieSpinner: React_2.ForwardRefExoticComponent<SpinnerProps
|
|
|
18
18
|
* @tagname pie-spinner
|
|
19
19
|
*/
|
|
20
20
|
declare class PieSpinner_2 extends LitElement implements SpinnerProps {
|
|
21
|
-
aria
|
|
22
|
-
size
|
|
23
|
-
variant
|
|
21
|
+
aria: SpinnerProps['aria'];
|
|
22
|
+
size: "xsmall" | "small" | "medium" | "large" | "xlarge";
|
|
23
|
+
variant: "brand" | "secondary" | "inverse";
|
|
24
24
|
render(): TemplateResult<1>;
|
|
25
|
+
private renderAriaLabel;
|
|
25
26
|
static styles: CSSResult;
|
|
26
27
|
}
|
|
27
28
|
|
package/dist/react.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import { createComponent as
|
|
3
|
-
import { PieSpinner as
|
|
4
|
-
import { defaultProps as
|
|
5
|
-
|
|
6
|
-
import "lit/decorators.js";
|
|
7
|
-
import "@justeattakeaway/pie-webc-core";
|
|
8
|
-
const t = r({
|
|
2
|
+
import { createComponent as n } from "@lit/react";
|
|
3
|
+
import { PieSpinner as r } from "./index.js";
|
|
4
|
+
import { defaultProps as m, sizes as c, variants as P } from "./index.js";
|
|
5
|
+
const i = n({
|
|
9
6
|
displayName: "PieSpinner",
|
|
10
|
-
elementClass:
|
|
7
|
+
elementClass: r,
|
|
11
8
|
react: e,
|
|
12
9
|
tagName: "pie-spinner",
|
|
13
10
|
events: {}
|
|
14
|
-
}),
|
|
11
|
+
}), a = i;
|
|
15
12
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
a as PieSpinner,
|
|
14
|
+
m as defaultProps,
|
|
15
|
+
c as sizes,
|
|
16
|
+
P as variants
|
|
20
17
|
};
|
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.7.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
40
|
-
"@justeattakeaway/pie-css": "0.
|
|
39
|
+
"@justeattakeaway/pie-components-config": "0.18.0",
|
|
40
|
+
"@justeattakeaway/pie-css": "0.13.0",
|
|
41
41
|
"@justeattakeaway/pie-wrapper-react": "0.14.1",
|
|
42
42
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@justeattakeaway/pie-webc-core": "0.24.
|
|
45
|
+
"@justeattakeaway/pie-webc-core": "0.24.1"
|
|
46
46
|
},
|
|
47
47
|
"volta": {
|
|
48
48
|
"extends": "../../../package.json"
|
package/src/defs-react.ts
CHANGED
package/src/defs.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
|
|
|
3
3
|
export const sizes = ['xsmall', 'small', 'medium', 'large', 'xlarge'] as const;
|
|
4
4
|
export const variants = ['brand', 'secondary', 'inverse'] as const;
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type AriaProps = {
|
|
7
7
|
label?: string;
|
|
8
8
|
};
|
|
9
9
|
|
package/src/index.ts
CHANGED
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
LitElement, html, nothing, unsafeCSS,
|
|
3
3
|
} from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
6
|
import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
6
7
|
import styles from './spinner.scss?inline';
|
|
7
8
|
import {
|
|
8
|
-
SpinnerProps,
|
|
9
|
+
type SpinnerProps,
|
|
9
10
|
sizes,
|
|
10
11
|
variants,
|
|
11
|
-
type AriaProps,
|
|
12
12
|
defaultProps,
|
|
13
13
|
} from './defs';
|
|
14
14
|
|
|
@@ -22,29 +22,42 @@ const componentSelector = 'pie-spinner';
|
|
|
22
22
|
*/
|
|
23
23
|
export class PieSpinner extends LitElement implements SpinnerProps {
|
|
24
24
|
@property({ type: Object })
|
|
25
|
-
public aria
|
|
25
|
+
public aria: SpinnerProps['aria'];
|
|
26
26
|
|
|
27
27
|
@property()
|
|
28
28
|
@validPropertyValues(componentSelector, sizes, defaultProps.size)
|
|
29
|
-
public size
|
|
29
|
+
public size = defaultProps.size;
|
|
30
30
|
|
|
31
31
|
@property()
|
|
32
32
|
@validPropertyValues(componentSelector, variants, defaultProps.variant)
|
|
33
|
-
public variant
|
|
33
|
+
public variant = defaultProps.variant;
|
|
34
34
|
|
|
35
35
|
render () {
|
|
36
|
-
const { variant, size
|
|
36
|
+
const { variant, size } = this;
|
|
37
|
+
|
|
38
|
+
const classes = {
|
|
39
|
+
'c-spinner': true,
|
|
40
|
+
[`c-spinner--${size}`]: true,
|
|
41
|
+
[`c-spinner--${variant}`]: true,
|
|
42
|
+
};
|
|
37
43
|
|
|
38
44
|
return html`
|
|
39
45
|
<div
|
|
40
46
|
data-test-id="pie-spinner"
|
|
41
|
-
class="
|
|
47
|
+
class="${classMap(classes)}"
|
|
42
48
|
role="status"
|
|
43
|
-
aria-live="polite"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
aria-live="polite">
|
|
50
|
+
${this.renderAriaLabel()}
|
|
51
|
+
</div>`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private renderAriaLabel () {
|
|
55
|
+
if (!this.aria?.label) return nothing;
|
|
56
|
+
|
|
57
|
+
return html`
|
|
58
|
+
<span class="c-spinner-label">
|
|
59
|
+
${this.aria.label}
|
|
60
|
+
</span>`;
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
// Renders a `CSSResult` generated from SCSS by Vite
|
package/src/spinner.scss
CHANGED
|
@@ -37,35 +37,32 @@
|
|
|
37
37
|
|
|
38
38
|
@include spinner-base-colors('--dt-color-content-brand');
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
&.c-spinner--medium,
|
|
41
|
+
&.c-spinner--brand {
|
|
41
42
|
/* Same as default styles */
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
&.c-spinner--secondary {
|
|
45
46
|
@include spinner-base-colors('--dt-color-content-interactive-secondary');
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
&.c-spinner--inverse {
|
|
49
50
|
@include spinner-base-colors('--dt-color-content-inverse');
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
&.c-spinner--xsmall {
|
|
53
54
|
--spinner-size: 16px;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
&.c-spinner--small {
|
|
57
58
|
--spinner-size: 20px;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
/* Same as default styles */
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&[size='large'] {
|
|
61
|
+
&.c-spinner--large {
|
|
65
62
|
--spinner-size: 32px;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
|
|
65
|
+
&.c-spinner--xlarge {
|
|
69
66
|
--spinner-size: 48px;
|
|
70
67
|
}
|
|
71
68
|
}
|