@momentum-design/components 0.25.4 → 0.26.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/browser/index.js +129 -63
- package/dist/browser/index.js.map +4 -4
- package/dist/components/spinner/index.d.ts +7 -0
- package/dist/components/spinner/index.js +4 -0
- package/dist/components/spinner/spinner.component.d.ts +75 -0
- package/dist/components/spinner/spinner.component.js +117 -0
- package/dist/components/spinner/spinner.constants.d.ts +16 -0
- package/dist/components/spinner/spinner.constants.js +17 -0
- package/dist/components/spinner/spinner.styles.d.ts +2 -0
- package/dist/components/spinner/spinner.styles.js +66 -0
- package/dist/components/spinner/spinner.types.d.ts +5 -0
- package/dist/components/spinner/spinner.types.js +1 -0
- package/dist/custom-elements.json +132 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/spinner/index.d.ts +39 -0
- package/dist/react/spinner/index.js +48 -0
- package/package.json +1 -1
@@ -0,0 +1,75 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
import { SpinnerSize, SpinnerVariant } from './spinner.types';
|
4
|
+
/**
|
5
|
+
* `mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning
|
6
|
+
* it's best for cases where the progress or duration of a process is variable or unknown.
|
7
|
+
*
|
8
|
+
* Spinner Variants:
|
9
|
+
* - **Standalone (Default)**: Track has a blue color.
|
10
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
11
|
+
* To ensure a minimum 3:1 contrast ratio, the color is changed internally to be the same color as the button’s
|
12
|
+
* icon or label text.
|
13
|
+
*
|
14
|
+
* Spinner Sizes:
|
15
|
+
* - **Large (96px)**: Use when replacing entire regions or pages that are still loading
|
16
|
+
* - **MidSize (48px) (Default)**: Use for most use cases.
|
17
|
+
* - **Small (24px)**: Use for inline with loading text.
|
18
|
+
*
|
19
|
+
* Customisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size
|
20
|
+
* CSS property.
|
21
|
+
*
|
22
|
+
* Spinner Colors:
|
23
|
+
* - **Default**: Use for most use cases.
|
24
|
+
* - **Inverted**: Only to be used within inverted components, such as coachmarks.
|
25
|
+
*
|
26
|
+
* Regarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role
|
27
|
+
* will be unset
|
28
|
+
* and aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.
|
29
|
+
*
|
30
|
+
* @tagname mdc-spinner
|
31
|
+
*
|
32
|
+
* @cssproperty --mdc-spinner-default-color - Allows customization of the default spinner color.
|
33
|
+
* @cssproperty --mdc-spinner-inverted-color - Allows customization of the inverted spinner color.
|
34
|
+
* @cssproperty --mdc-spinner-button-variant-color - Allows customization of the spinner Button variant color.
|
35
|
+
* @cssproperty --mdc-spinner-size - Allows customization of the spinner size.
|
36
|
+
*
|
37
|
+
* @csspart container - The svg which contains the circle spinner.
|
38
|
+
* @csspart circle - The circle of the spinner.
|
39
|
+
*/
|
40
|
+
declare class Spinner extends Component {
|
41
|
+
/**
|
42
|
+
* The spinner color can be inverted by setting the inverted attribute to true.
|
43
|
+
* @default false
|
44
|
+
*/
|
45
|
+
inverted: boolean;
|
46
|
+
/**
|
47
|
+
* Size of the spinner.
|
48
|
+
* Acceptable values include:
|
49
|
+
*
|
50
|
+
* - 'small'
|
51
|
+
* - 'midsize'
|
52
|
+
* - 'large'
|
53
|
+
* - 'undefined'
|
54
|
+
*
|
55
|
+
* @default midsize
|
56
|
+
*/
|
57
|
+
size?: SpinnerSize;
|
58
|
+
/**
|
59
|
+
* Aria-label attribute to be set for accessibility
|
60
|
+
*/
|
61
|
+
ariaLabel: string | null;
|
62
|
+
/**
|
63
|
+
* There are 2 variants of spinner: default and button. Their coloring is different.
|
64
|
+
* - **Standalone (Default)**: Track has a blue color.
|
65
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
66
|
+
* To ensure a minimum 3:1 contrast ratio, change the active indicator color to be the same color as the button’s
|
67
|
+
* icon or label text.
|
68
|
+
* @default standalone
|
69
|
+
*/
|
70
|
+
variant: SpinnerVariant;
|
71
|
+
updated(changedProperties: Map<string, any>): void;
|
72
|
+
render(): import("lit-html").TemplateResult<1>;
|
73
|
+
static styles: Array<CSSResult>;
|
74
|
+
}
|
75
|
+
export default Spinner;
|
@@ -0,0 +1,117 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { html } from 'lit';
|
11
|
+
import { property } from 'lit/decorators.js';
|
12
|
+
import styles from './spinner.styles';
|
13
|
+
import { Component } from '../../models';
|
14
|
+
import { DEFAULTS } from './spinner.constants';
|
15
|
+
/**
|
16
|
+
* `mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning
|
17
|
+
* it's best for cases where the progress or duration of a process is variable or unknown.
|
18
|
+
*
|
19
|
+
* Spinner Variants:
|
20
|
+
* - **Standalone (Default)**: Track has a blue color.
|
21
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
22
|
+
* To ensure a minimum 3:1 contrast ratio, the color is changed internally to be the same color as the button’s
|
23
|
+
* icon or label text.
|
24
|
+
*
|
25
|
+
* Spinner Sizes:
|
26
|
+
* - **Large (96px)**: Use when replacing entire regions or pages that are still loading
|
27
|
+
* - **MidSize (48px) (Default)**: Use for most use cases.
|
28
|
+
* - **Small (24px)**: Use for inline with loading text.
|
29
|
+
*
|
30
|
+
* Customisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size
|
31
|
+
* CSS property.
|
32
|
+
*
|
33
|
+
* Spinner Colors:
|
34
|
+
* - **Default**: Use for most use cases.
|
35
|
+
* - **Inverted**: Only to be used within inverted components, such as coachmarks.
|
36
|
+
*
|
37
|
+
* Regarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role
|
38
|
+
* will be unset
|
39
|
+
* and aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.
|
40
|
+
*
|
41
|
+
* @tagname mdc-spinner
|
42
|
+
*
|
43
|
+
* @cssproperty --mdc-spinner-default-color - Allows customization of the default spinner color.
|
44
|
+
* @cssproperty --mdc-spinner-inverted-color - Allows customization of the inverted spinner color.
|
45
|
+
* @cssproperty --mdc-spinner-button-variant-color - Allows customization of the spinner Button variant color.
|
46
|
+
* @cssproperty --mdc-spinner-size - Allows customization of the spinner size.
|
47
|
+
*
|
48
|
+
* @csspart container - The svg which contains the circle spinner.
|
49
|
+
* @csspart circle - The circle of the spinner.
|
50
|
+
*/
|
51
|
+
class Spinner extends Component {
|
52
|
+
constructor() {
|
53
|
+
super(...arguments);
|
54
|
+
/**
|
55
|
+
* The spinner color can be inverted by setting the inverted attribute to true.
|
56
|
+
* @default false
|
57
|
+
*/
|
58
|
+
this.inverted = DEFAULTS.INVERTED;
|
59
|
+
/**
|
60
|
+
* Size of the spinner.
|
61
|
+
* Acceptable values include:
|
62
|
+
*
|
63
|
+
* - 'small'
|
64
|
+
* - 'midsize'
|
65
|
+
* - 'large'
|
66
|
+
* - 'undefined'
|
67
|
+
*
|
68
|
+
* @default midsize
|
69
|
+
*/
|
70
|
+
this.size = DEFAULTS.SIZE;
|
71
|
+
/**
|
72
|
+
* Aria-label attribute to be set for accessibility
|
73
|
+
*/
|
74
|
+
this.ariaLabel = null;
|
75
|
+
/**
|
76
|
+
* There are 2 variants of spinner: default and button. Their coloring is different.
|
77
|
+
* - **Standalone (Default)**: Track has a blue color.
|
78
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
79
|
+
* To ensure a minimum 3:1 contrast ratio, change the active indicator color to be the same color as the button’s
|
80
|
+
* icon or label text.
|
81
|
+
* @default standalone
|
82
|
+
*/
|
83
|
+
this.variant = DEFAULTS.VARIANT;
|
84
|
+
}
|
85
|
+
updated(changedProperties) {
|
86
|
+
super.updated(changedProperties);
|
87
|
+
if (changedProperties.has('ariaLabel')) {
|
88
|
+
this.role = this.ariaLabel ? 'img' : null;
|
89
|
+
this.ariaHidden = this.ariaLabel ? 'false' : 'true';
|
90
|
+
}
|
91
|
+
}
|
92
|
+
render() {
|
93
|
+
return html `
|
94
|
+
<svg part="container" viewBox="0 0 100 100">
|
95
|
+
<circle part="circle" cx="50" cy="50" r="46"></circle>
|
96
|
+
</svg>
|
97
|
+
`;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
Spinner.styles = [...Component.styles, ...styles];
|
101
|
+
__decorate([
|
102
|
+
property({ type: Boolean, reflect: true }),
|
103
|
+
__metadata("design:type", Object)
|
104
|
+
], Spinner.prototype, "inverted", void 0);
|
105
|
+
__decorate([
|
106
|
+
property({ type: String, reflect: true }),
|
107
|
+
__metadata("design:type", String)
|
108
|
+
], Spinner.prototype, "size", void 0);
|
109
|
+
__decorate([
|
110
|
+
property({ type: String, attribute: 'aria-label' }),
|
111
|
+
__metadata("design:type", Object)
|
112
|
+
], Spinner.prototype, "ariaLabel", void 0);
|
113
|
+
__decorate([
|
114
|
+
property({ type: String }),
|
115
|
+
__metadata("design:type", String)
|
116
|
+
], Spinner.prototype, "variant", void 0);
|
117
|
+
export default Spinner;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
declare const TAG_NAME: "mdc-spinner";
|
2
|
+
declare const SPINNER_SIZES: {
|
3
|
+
readonly LARGE: "large";
|
4
|
+
readonly MIDSIZE: "midsize";
|
5
|
+
readonly SMALL: "small";
|
6
|
+
};
|
7
|
+
declare const SPINNER_VARIANT: {
|
8
|
+
readonly STANDALONE: "standalone";
|
9
|
+
readonly BUTTON: "button";
|
10
|
+
};
|
11
|
+
declare const DEFAULTS: {
|
12
|
+
VARIANT: "standalone";
|
13
|
+
SIZE: "midsize";
|
14
|
+
INVERTED: boolean;
|
15
|
+
};
|
16
|
+
export { TAG_NAME, SPINNER_SIZES, SPINNER_VARIANT, DEFAULTS };
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
const TAG_NAME = utils.constructTagName('spinner');
|
3
|
+
const SPINNER_SIZES = {
|
4
|
+
LARGE: 'large',
|
5
|
+
MIDSIZE: 'midsize',
|
6
|
+
SMALL: 'small',
|
7
|
+
};
|
8
|
+
const SPINNER_VARIANT = {
|
9
|
+
STANDALONE: 'standalone',
|
10
|
+
BUTTON: 'button',
|
11
|
+
};
|
12
|
+
const DEFAULTS = {
|
13
|
+
VARIANT: SPINNER_VARIANT.STANDALONE,
|
14
|
+
SIZE: SPINNER_SIZES.MIDSIZE,
|
15
|
+
INVERTED: false,
|
16
|
+
};
|
17
|
+
export { TAG_NAME, SPINNER_SIZES, SPINNER_VARIANT, DEFAULTS };
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
import { hostFitContentStyles } from '../../utils/styles';
|
3
|
+
const styles = [hostFitContentStyles, css `
|
4
|
+
:host {
|
5
|
+
--mdc-spinner-default-color: var(--mds-color-theme-control-active-normal);
|
6
|
+
--mdc-spinner-inverted-color: var(--mds-color-theme-inverted-control-active-normal);
|
7
|
+
--mdc-spinner-button-variant-color: currentColor;
|
8
|
+
--mdc-spinner-color: var(--mdc-spinner-default-color);
|
9
|
+
--mdc-spinner-size: 100%;
|
10
|
+
}
|
11
|
+
|
12
|
+
:host([inverted]) {
|
13
|
+
--mdc-spinner-color: var(--mdc-spinner-inverted-color);
|
14
|
+
}
|
15
|
+
|
16
|
+
:host([size="large"]) {
|
17
|
+
--mdc-spinner-size: 6rem;
|
18
|
+
}
|
19
|
+
|
20
|
+
:host([size="midsize"]) {
|
21
|
+
--mdc-spinner-size: 3rem;
|
22
|
+
}
|
23
|
+
|
24
|
+
:host([size="small"]) {
|
25
|
+
--mdc-spinner-size: 1.5rem;
|
26
|
+
}
|
27
|
+
|
28
|
+
:host([variant="button"]) {
|
29
|
+
--mdc-spinner-color: var(--mdc-spinner-button-variant-color);
|
30
|
+
}
|
31
|
+
|
32
|
+
:host::part(container) {
|
33
|
+
width: var(--mdc-spinner-size);
|
34
|
+
height: var(--mdc-spinner-size);
|
35
|
+
animation: rotate 1.5s linear infinite;
|
36
|
+
}
|
37
|
+
|
38
|
+
:host::part(circle) {
|
39
|
+
fill: none;
|
40
|
+
stroke: var(--mdc-spinner-color);
|
41
|
+
stroke-width: 8%;
|
42
|
+
stroke-linecap: round;
|
43
|
+
animation: dash 1.5s ease-in-out infinite;
|
44
|
+
transform: rotate(-90deg);
|
45
|
+
transform-origin: center;
|
46
|
+
}
|
47
|
+
|
48
|
+
@keyframes rotate {
|
49
|
+
100% { transform: rotate(360deg); }
|
50
|
+
}
|
51
|
+
|
52
|
+
@keyframes dash {
|
53
|
+
0% {
|
54
|
+
stroke-dasharray: 1, 470;
|
55
|
+
}
|
56
|
+
50% {
|
57
|
+
stroke-dasharray: 209, 470;
|
58
|
+
stroke-dashoffset: -83;
|
59
|
+
}
|
60
|
+
100% {
|
61
|
+
stroke-dasharray: 209, 470;
|
62
|
+
stroke-dashoffset: -292;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
`];
|
66
|
+
export default styles;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { ValueOf } from '../../utils/types';
|
2
|
+
import { SPINNER_SIZES, SPINNER_VARIANT } from './spinner.constants';
|
3
|
+
type SpinnerSize = ValueOf<typeof SPINNER_SIZES>;
|
4
|
+
type SpinnerVariant = ValueOf<typeof SPINNER_VARIANT>;
|
5
|
+
export { SpinnerSize, SpinnerVariant, };
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -5749,6 +5749,138 @@
|
|
5749
5749
|
}
|
5750
5750
|
]
|
5751
5751
|
},
|
5752
|
+
{
|
5753
|
+
"kind": "javascript-module",
|
5754
|
+
"path": "components/spinner/spinner.component.js",
|
5755
|
+
"declarations": [
|
5756
|
+
{
|
5757
|
+
"kind": "class",
|
5758
|
+
"description": "`mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning\nit's best for cases where the progress or duration of a process is variable or unknown.\n\nSpinner Variants:\n- **Standalone (Default)**: Track has a blue color.\n- **Button**: To be used when placed in a button to show that the button’s action is currently in progress.\nTo ensure a minimum 3:1 contrast ratio, the color is changed internally to be the same color as the button’s\nicon or label text.\n\nSpinner Sizes:\n- **Large (96px)**: Use when replacing entire regions or pages that are still loading\n- **MidSize (48px) (Default)**: Use for most use cases.\n- **Small (24px)**: Use for inline with loading text.\n\nCustomisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size\nCSS property.\n\nSpinner Colors:\n- **Default**: Use for most use cases.\n- **Inverted**: Only to be used within inverted components, such as coachmarks.\n\nRegarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role\nwill be unset\nand aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.",
|
5759
|
+
"name": "Spinner",
|
5760
|
+
"cssProperties": [
|
5761
|
+
{
|
5762
|
+
"description": "Allows customization of the default spinner color.",
|
5763
|
+
"name": "--mdc-spinner-default-color"
|
5764
|
+
},
|
5765
|
+
{
|
5766
|
+
"description": "Allows customization of the inverted spinner color.",
|
5767
|
+
"name": "--mdc-spinner-inverted-color"
|
5768
|
+
},
|
5769
|
+
{
|
5770
|
+
"description": "Allows customization of the spinner Button variant color.",
|
5771
|
+
"name": "--mdc-spinner-button-variant-color"
|
5772
|
+
},
|
5773
|
+
{
|
5774
|
+
"description": "Allows customization of the spinner size.",
|
5775
|
+
"name": "--mdc-spinner-size"
|
5776
|
+
}
|
5777
|
+
],
|
5778
|
+
"cssParts": [
|
5779
|
+
{
|
5780
|
+
"description": "The svg which contains the circle spinner.",
|
5781
|
+
"name": "container"
|
5782
|
+
},
|
5783
|
+
{
|
5784
|
+
"description": "The circle of the spinner.",
|
5785
|
+
"name": "circle"
|
5786
|
+
}
|
5787
|
+
],
|
5788
|
+
"members": [
|
5789
|
+
{
|
5790
|
+
"kind": "field",
|
5791
|
+
"name": "inverted",
|
5792
|
+
"description": "The spinner color can be inverted by setting the inverted attribute to true.",
|
5793
|
+
"default": "false",
|
5794
|
+
"attribute": "inverted",
|
5795
|
+
"reflects": true
|
5796
|
+
},
|
5797
|
+
{
|
5798
|
+
"kind": "field",
|
5799
|
+
"name": "size",
|
5800
|
+
"type": {
|
5801
|
+
"text": "SpinnerSize | undefined"
|
5802
|
+
},
|
5803
|
+
"description": "Size of the spinner.\nAcceptable values include:\n\n- 'small'\n- 'midsize'\n- 'large'\n- 'undefined'",
|
5804
|
+
"default": "midsize",
|
5805
|
+
"attribute": "size",
|
5806
|
+
"reflects": true
|
5807
|
+
},
|
5808
|
+
{
|
5809
|
+
"kind": "field",
|
5810
|
+
"name": "ariaLabel",
|
5811
|
+
"type": {
|
5812
|
+
"text": "string | null"
|
5813
|
+
},
|
5814
|
+
"default": "null",
|
5815
|
+
"description": "Aria-label attribute to be set for accessibility",
|
5816
|
+
"attribute": "aria-label"
|
5817
|
+
},
|
5818
|
+
{
|
5819
|
+
"kind": "field",
|
5820
|
+
"name": "variant",
|
5821
|
+
"type": {
|
5822
|
+
"text": "SpinnerVariant"
|
5823
|
+
},
|
5824
|
+
"description": "There are 2 variants of spinner: default and button. Their coloring is different.\n- **Standalone (Default)**: Track has a blue color.\n- **Button**: To be used when placed in a button to show that the button’s action is currently in progress.\nTo ensure a minimum 3:1 contrast ratio, change the active indicator color to be the same color as the button’s\nicon or label text.",
|
5825
|
+
"default": "standalone",
|
5826
|
+
"attribute": "variant"
|
5827
|
+
}
|
5828
|
+
],
|
5829
|
+
"attributes": [
|
5830
|
+
{
|
5831
|
+
"name": "inverted",
|
5832
|
+
"description": "The spinner color can be inverted by setting the inverted attribute to true.",
|
5833
|
+
"default": "false",
|
5834
|
+
"fieldName": "inverted"
|
5835
|
+
},
|
5836
|
+
{
|
5837
|
+
"name": "size",
|
5838
|
+
"type": {
|
5839
|
+
"text": "SpinnerSize | undefined"
|
5840
|
+
},
|
5841
|
+
"description": "Size of the spinner.\nAcceptable values include:\n\n- 'small'\n- 'midsize'\n- 'large'\n- 'undefined'",
|
5842
|
+
"default": "midsize",
|
5843
|
+
"fieldName": "size"
|
5844
|
+
},
|
5845
|
+
{
|
5846
|
+
"name": "aria-label",
|
5847
|
+
"type": {
|
5848
|
+
"text": "string | null"
|
5849
|
+
},
|
5850
|
+
"default": "null",
|
5851
|
+
"description": "Aria-label attribute to be set for accessibility",
|
5852
|
+
"fieldName": "ariaLabel"
|
5853
|
+
},
|
5854
|
+
{
|
5855
|
+
"name": "variant",
|
5856
|
+
"type": {
|
5857
|
+
"text": "SpinnerVariant"
|
5858
|
+
},
|
5859
|
+
"description": "There are 2 variants of spinner: default and button. Their coloring is different.\n- **Standalone (Default)**: Track has a blue color.\n- **Button**: To be used when placed in a button to show that the button’s action is currently in progress.\nTo ensure a minimum 3:1 contrast ratio, change the active indicator color to be the same color as the button’s\nicon or label text.",
|
5860
|
+
"default": "standalone",
|
5861
|
+
"fieldName": "variant"
|
5862
|
+
}
|
5863
|
+
],
|
5864
|
+
"superclass": {
|
5865
|
+
"name": "Component",
|
5866
|
+
"module": "/src/models"
|
5867
|
+
},
|
5868
|
+
"tagName": "mdc-spinner",
|
5869
|
+
"jsDoc": "/**\n * `mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning\n * it's best for cases where the progress or duration of a process is variable or unknown.\n *\n * Spinner Variants:\n * - **Standalone (Default)**: Track has a blue color.\n * - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.\n * To ensure a minimum 3:1 contrast ratio, the color is changed internally to be the same color as the button’s\n * icon or label text.\n *\n * Spinner Sizes:\n * - **Large (96px)**: Use when replacing entire regions or pages that are still loading\n * - **MidSize (48px) (Default)**: Use for most use cases.\n * - **Small (24px)**: Use for inline with loading text.\n *\n * Customisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size\n * CSS property.\n *\n * Spinner Colors:\n * - **Default**: Use for most use cases.\n * - **Inverted**: Only to be used within inverted components, such as coachmarks.\n *\n * Regarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role\n * will be unset\n * and aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.\n *\n * @tagname mdc-spinner\n *\n * @cssproperty --mdc-spinner-default-color - Allows customization of the default spinner color.\n * @cssproperty --mdc-spinner-inverted-color - Allows customization of the inverted spinner color.\n * @cssproperty --mdc-spinner-button-variant-color - Allows customization of the spinner Button variant color.\n * @cssproperty --mdc-spinner-size - Allows customization of the spinner size.\n *\n * @csspart container - The svg which contains the circle spinner.\n * @csspart circle - The circle of the spinner.\n */",
|
5870
|
+
"customElement": true
|
5871
|
+
}
|
5872
|
+
],
|
5873
|
+
"exports": [
|
5874
|
+
{
|
5875
|
+
"kind": "js",
|
5876
|
+
"name": "default",
|
5877
|
+
"declaration": {
|
5878
|
+
"name": "Spinner",
|
5879
|
+
"module": "components/spinner/spinner.component.js"
|
5880
|
+
}
|
5881
|
+
}
|
5882
|
+
]
|
5883
|
+
},
|
5752
5884
|
{
|
5753
5885
|
"kind": "javascript-module",
|
5754
5886
|
"path": "components/tab/tab.component.js",
|
package/dist/index.d.ts
CHANGED
@@ -19,7 +19,8 @@ import VirtualizedList from './components/virtualizedlist';
|
|
19
19
|
import Tab from './components/tab';
|
20
20
|
import FormfieldGroup from './components/formfieldgroup';
|
21
21
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
22
|
+
import Spinner from './components/spinner';
|
22
23
|
import type { TextType } from './components/text/text.types';
|
23
|
-
export { ThemeProvider, Icon, IconProvider, Avatar, Badge, Presence, Text, Button, Bullet, Marker, Divider, AvatarButton, Input, Link, Toggle, Checkbox, Radio, VirtualizedList, Tab, FormfieldGroup, };
|
24
|
+
export { ThemeProvider, Icon, IconProvider, Avatar, Badge, Presence, Text, Button, Bullet, Marker, Divider, AvatarButton, Input, Link, Toggle, Checkbox, Radio, VirtualizedList, Tab, FormfieldGroup, Spinner, };
|
24
25
|
export type { TextType, };
|
25
26
|
export { inMemoryCache, webAPIIconsCache };
|
package/dist/index.js
CHANGED
@@ -19,5 +19,6 @@ import VirtualizedList from './components/virtualizedlist';
|
|
19
19
|
import Tab from './components/tab';
|
20
20
|
import FormfieldGroup from './components/formfieldgroup';
|
21
21
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
22
|
-
|
22
|
+
import Spinner from './components/spinner';
|
23
|
+
export { ThemeProvider, Icon, IconProvider, Avatar, Badge, Presence, Text, Button, Bullet, Marker, Divider, AvatarButton, Input, Link, Toggle, Checkbox, Radio, VirtualizedList, Tab, FormfieldGroup, Spinner, };
|
23
24
|
export { inMemoryCache, webAPIIconsCache };
|
package/dist/react/index.d.ts
CHANGED
@@ -16,6 +16,7 @@ export { default as Marker } from './marker';
|
|
16
16
|
export { default as Modalcontainer } from './modalcontainer';
|
17
17
|
export { default as Presence } from './presence';
|
18
18
|
export { default as Radio } from './radio';
|
19
|
+
export { default as Spinner } from './spinner';
|
19
20
|
export { default as Tab } from './tab';
|
20
21
|
export { default as Text } from './text';
|
21
22
|
export { default as ThemeProvider } from './themeprovider';
|
package/dist/react/index.js
CHANGED
@@ -16,6 +16,7 @@ export { default as Marker } from './marker';
|
|
16
16
|
export { default as Modalcontainer } from './modalcontainer';
|
17
17
|
export { default as Presence } from './presence';
|
18
18
|
export { default as Radio } from './radio';
|
19
|
+
export { default as Spinner } from './spinner';
|
19
20
|
export { default as Tab } from './tab';
|
20
21
|
export { default as Text } from './text';
|
21
22
|
export { default as ThemeProvider } from './themeprovider';
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import Component from '../../components/spinner';
|
2
|
+
/**
|
3
|
+
* `mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning
|
4
|
+
* it's best for cases where the progress or duration of a process is variable or unknown.
|
5
|
+
*
|
6
|
+
* Spinner Variants:
|
7
|
+
* - **Standalone (Default)**: Track has a blue color.
|
8
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
9
|
+
* To ensure a minimum 3:1 contrast ratio, the color is changed internally to be the same color as the button’s
|
10
|
+
* icon or label text.
|
11
|
+
*
|
12
|
+
* Spinner Sizes:
|
13
|
+
* - **Large (96px)**: Use when replacing entire regions or pages that are still loading
|
14
|
+
* - **MidSize (48px) (Default)**: Use for most use cases.
|
15
|
+
* - **Small (24px)**: Use for inline with loading text.
|
16
|
+
*
|
17
|
+
* Customisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size
|
18
|
+
* CSS property.
|
19
|
+
*
|
20
|
+
* Spinner Colors:
|
21
|
+
* - **Default**: Use for most use cases.
|
22
|
+
* - **Inverted**: Only to be used within inverted components, such as coachmarks.
|
23
|
+
*
|
24
|
+
* Regarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role
|
25
|
+
* will be unset
|
26
|
+
* and aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.
|
27
|
+
*
|
28
|
+
* @tagname mdc-spinner
|
29
|
+
*
|
30
|
+
* @cssproperty --mdc-spinner-default-color - Allows customization of the default spinner color.
|
31
|
+
* @cssproperty --mdc-spinner-inverted-color - Allows customization of the inverted spinner color.
|
32
|
+
* @cssproperty --mdc-spinner-button-variant-color - Allows customization of the spinner Button variant color.
|
33
|
+
* @cssproperty --mdc-spinner-size - Allows customization of the spinner size.
|
34
|
+
*
|
35
|
+
* @csspart container - The svg which contains the circle spinner.
|
36
|
+
* @csspart circle - The circle of the spinner.
|
37
|
+
*/
|
38
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
39
|
+
export default reactWrapper;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createComponent } from '@lit/react';
|
3
|
+
import Component from '../../components/spinner';
|
4
|
+
import { TAG_NAME } from '../../components/spinner/spinner.constants';
|
5
|
+
/**
|
6
|
+
* `mdc-spinner` is loading spinner which is an indeterminate progress indicator, meaning
|
7
|
+
* it's best for cases where the progress or duration of a process is variable or unknown.
|
8
|
+
*
|
9
|
+
* Spinner Variants:
|
10
|
+
* - **Standalone (Default)**: Track has a blue color.
|
11
|
+
* - **Button**: To be used when placed in a button to show that the button’s action is currently in progress.
|
12
|
+
* To ensure a minimum 3:1 contrast ratio, the color is changed internally to be the same color as the button’s
|
13
|
+
* icon or label text.
|
14
|
+
*
|
15
|
+
* Spinner Sizes:
|
16
|
+
* - **Large (96px)**: Use when replacing entire regions or pages that are still loading
|
17
|
+
* - **MidSize (48px) (Default)**: Use for most use cases.
|
18
|
+
* - **Small (24px)**: Use for inline with loading text.
|
19
|
+
*
|
20
|
+
* Customisation of the spinner size is allowed by setting the size to undefined and using the --mdc-spinner-size
|
21
|
+
* CSS property.
|
22
|
+
*
|
23
|
+
* Spinner Colors:
|
24
|
+
* - **Default**: Use for most use cases.
|
25
|
+
* - **Inverted**: Only to be used within inverted components, such as coachmarks.
|
26
|
+
*
|
27
|
+
* Regarding accessibility, if an aria-label is provided, the role will be set to 'img'; if it is absent, the role
|
28
|
+
* will be unset
|
29
|
+
* and aria-hidden will be set to 'true' so the spinner will be ignored by screen readers.
|
30
|
+
*
|
31
|
+
* @tagname mdc-spinner
|
32
|
+
*
|
33
|
+
* @cssproperty --mdc-spinner-default-color - Allows customization of the default spinner color.
|
34
|
+
* @cssproperty --mdc-spinner-inverted-color - Allows customization of the inverted spinner color.
|
35
|
+
* @cssproperty --mdc-spinner-button-variant-color - Allows customization of the spinner Button variant color.
|
36
|
+
* @cssproperty --mdc-spinner-size - Allows customization of the spinner size.
|
37
|
+
*
|
38
|
+
* @csspart container - The svg which contains the circle spinner.
|
39
|
+
* @csspart circle - The circle of the spinner.
|
40
|
+
*/
|
41
|
+
const reactWrapper = createComponent({
|
42
|
+
tagName: TAG_NAME,
|
43
|
+
elementClass: Component,
|
44
|
+
react: React,
|
45
|
+
events: {},
|
46
|
+
displayName: 'Spinner',
|
47
|
+
});
|
48
|
+
export default reactWrapper;
|
package/package.json
CHANGED