@momentum-design/components 0.25.3 → 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 +215 -82
- package/dist/browser/index.js.map +4 -4
- package/dist/components/divider/divider.component.d.ts +7 -0
- package/dist/components/divider/divider.component.js +7 -0
- package/dist/components/divider/divider.styles.js +86 -19
- 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 +149 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/divider/index.d.ts +7 -0
- package/dist/react/divider/index.js +7 -0
- 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
@@ -40,6 +40,13 @@ import type { Directions, DividerOrientation, DividerVariant } from './divider.t
|
|
40
40
|
* @cssproperty --mdc-divider-text-color - font color of label in the text divider
|
41
41
|
* @cssproperty --mdc-divider-text-margin - left and right margin of label in the text divider
|
42
42
|
* @cssproperty --mdc-divider-text-line-height - line height of label in the text divider
|
43
|
+
* @cssproperty --mdc-divider-grabber-button-background-color-normal - background color of the grabber button
|
44
|
+
* in rest state
|
45
|
+
* @cssproperty --mdc-divider-grabber-button-background-color-hover - background color of the grabber button
|
46
|
+
* in hover state
|
47
|
+
* @cssproperty --mdc-divider-grabber-button-background-color-pressed - background color of the grabber button
|
48
|
+
* in pressed state
|
49
|
+
* @cssproperty --mdc-divider-grabber-button-border-color - border color of the grabber button
|
43
50
|
* @cssproperty --mdc-divider-grabber-button-border-radius - border radius of the grabber button
|
44
51
|
*/
|
45
52
|
declare class Divider extends Component {
|
@@ -50,6 +50,13 @@ import styles from './divider.styles';
|
|
50
50
|
* @cssproperty --mdc-divider-text-color - font color of label in the text divider
|
51
51
|
* @cssproperty --mdc-divider-text-margin - left and right margin of label in the text divider
|
52
52
|
* @cssproperty --mdc-divider-text-line-height - line height of label in the text divider
|
53
|
+
* @cssproperty --mdc-divider-grabber-button-background-color-normal - background color of the grabber button
|
54
|
+
* in rest state
|
55
|
+
* @cssproperty --mdc-divider-grabber-button-background-color-hover - background color of the grabber button
|
56
|
+
* in hover state
|
57
|
+
* @cssproperty --mdc-divider-grabber-button-background-color-pressed - background color of the grabber button
|
58
|
+
* in pressed state
|
59
|
+
* @cssproperty --mdc-divider-grabber-button-border-color - border color of the grabber button
|
53
60
|
* @cssproperty --mdc-divider-grabber-button-border-radius - border radius of the grabber button
|
54
61
|
*/
|
55
62
|
class Divider extends Component {
|
@@ -17,6 +17,10 @@ const styles = [
|
|
17
17
|
--mdc-divider-text-line-height: var(--mds-font-lineheight-body-midsize);
|
18
18
|
--mdc-divider-text-margin: 1.5rem;
|
19
19
|
--mdc-divider-grabber-button-border-radius: 0.5rem;
|
20
|
+
--mdc-divider-grabber-button-border-color: var(--mds-color-theme-outline-secondary-normal);
|
21
|
+
--mdc-divider-grabber-button-background-color-normal: var(--mds-color-theme-overlay-button-secondary-normal);
|
22
|
+
--mdc-divider-grabber-button-background-color-hover: var(--mds-color-theme-overlay-button-secondary-hover);
|
23
|
+
--mdc-divider-grabber-button-background-color-pressed: var(--mds-color-theme-overlay-button-secondary-pressed);
|
20
24
|
|
21
25
|
display: flex;
|
22
26
|
justify-content: center;
|
@@ -28,6 +32,37 @@ const styles = [
|
|
28
32
|
background-color: var(--mdc-divider-background-color);
|
29
33
|
}
|
30
34
|
|
35
|
+
@media (forced-colors: active) {
|
36
|
+
/* Primary and grabber divider styles */
|
37
|
+
:host([data-type='mdc-primary-divider'][button-position='positive']),
|
38
|
+
:host([data-type='mdc-grabber-divider'][button-position='positive']) {
|
39
|
+
border: 0;
|
40
|
+
border-top: var(--mdc-divider-width) solid var(--mdc-divider-background-color);
|
41
|
+
}
|
42
|
+
|
43
|
+
:host([data-type='mdc-primary-divider'][button-position='negative']),
|
44
|
+
:host([data-type='mdc-grabber-divider'][button-position='negative']) {
|
45
|
+
border: 0;
|
46
|
+
border-bottom: var(--mdc-divider-width) solid var(--mdc-divider-background-color);
|
47
|
+
}
|
48
|
+
|
49
|
+
:host([data-type='mdc-primary-divider'][orientation='vertical'][button-position='positive']),
|
50
|
+
:host([data-type='mdc-grabber-divider'][orientation='vertical'][button-position='positive']),
|
51
|
+
:host([data-type='mdc-primary-divider'][orientation='vertical'][button-position='negative']:dir(rtl)),
|
52
|
+
:host([data-type='mdc-grabber-divider'][orientation='vertical'][button-position='negative']:dir(rtl)) {
|
53
|
+
border: 0;
|
54
|
+
border-right: var(--mdc-divider-width) solid var(--mdc-divider-background-color);
|
55
|
+
}
|
56
|
+
|
57
|
+
:host([data-type='mdc-primary-divider'][orientation='vertical'][button-position='negative']),
|
58
|
+
:host([data-type='mdc-grabber-divider'][orientation='vertical'][button-position='negative']),
|
59
|
+
:host([data-type='mdc-primary-divider'][orientation='vertical'][button-position='positive']:dir(rtl)),
|
60
|
+
:host([data-type='mdc-grabber-divider'][orientation='vertical'][button-position='positive']:dir(rtl)) {
|
61
|
+
border: 0;
|
62
|
+
border-left: var(--mdc-divider-width) solid var(--mdc-divider-background-color);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
31
66
|
/* Orientation-specific styles */
|
32
67
|
:host([orientation='horizontal']) {
|
33
68
|
flex-direction: row;
|
@@ -58,21 +93,35 @@ const styles = [
|
|
58
93
|
}
|
59
94
|
|
60
95
|
/** Button divider styles */
|
96
|
+
|
97
|
+
::slotted(mdc-button) {
|
98
|
+
background-color: var(--mdc-divider-grabber-button-background-color-normal);
|
99
|
+
border-color: var(--mdc-divider-grabber-button-border-color);
|
100
|
+
}
|
101
|
+
|
102
|
+
::slotted(mdc-button:hover) {
|
103
|
+
background-color: var(--mdc-divider-grabber-button-background-color-hover);
|
104
|
+
}
|
105
|
+
|
106
|
+
::slotted(mdc-button:active) {
|
107
|
+
background-color: var(--mdc-divider-grabber-button-background-color-pressed);
|
108
|
+
}
|
109
|
+
|
61
110
|
:host([orientation='vertical']) ::slotted(mdc-button) {
|
62
111
|
width: 1.25rem;
|
63
112
|
height: 2.5rem;
|
64
|
-
border-radius: 0
|
65
|
-
var(--mdc-divider-grabber-button-border-radius)
|
66
|
-
var(--mdc-divider-grabber-button-border-radius)
|
113
|
+
border-radius: 0
|
114
|
+
var(--mdc-divider-grabber-button-border-radius)
|
115
|
+
var(--mdc-divider-grabber-button-border-radius)
|
67
116
|
0;
|
68
117
|
}
|
69
118
|
|
70
119
|
:host([orientation='horizontal']) ::slotted(mdc-button) {
|
71
120
|
height: 1.25rem;
|
72
121
|
width: 2.5rem;
|
73
|
-
border-radius: 0
|
74
|
-
0
|
75
|
-
var(--mdc-divider-grabber-button-border-radius)
|
122
|
+
border-radius: 0
|
123
|
+
0
|
124
|
+
var(--mdc-divider-grabber-button-border-radius)
|
76
125
|
var(--mdc-divider-grabber-button-border-radius);
|
77
126
|
}
|
78
127
|
|
@@ -87,41 +136,53 @@ const styles = [
|
|
87
136
|
}
|
88
137
|
|
89
138
|
:host([orientation='horizontal'][button-position='positive']) ::slotted(mdc-button) {
|
90
|
-
border-radius: var(--mdc-divider-grabber-button-border-radius)
|
91
|
-
var(--mdc-divider-grabber-button-border-radius)
|
92
|
-
0
|
139
|
+
border-radius: var(--mdc-divider-grabber-button-border-radius)
|
140
|
+
var(--mdc-divider-grabber-button-border-radius)
|
141
|
+
0
|
93
142
|
0;
|
94
|
-
|
143
|
+
margin: 0;
|
144
|
+
margin-bottom: var(--mdc-divider-width);
|
145
|
+
border-bottom: 0;
|
95
146
|
}
|
96
147
|
|
97
148
|
:host([orientation='horizontal'][button-position='negative']) ::slotted(mdc-button) {
|
98
|
-
|
149
|
+
margin: 0;
|
150
|
+
margin-top: var(--mdc-divider-width);
|
151
|
+
border-top: 0;
|
99
152
|
}
|
100
153
|
|
101
154
|
:host([orientation='vertical'][button-position='negative']:dir(ltr)) ::slotted(mdc-button),
|
102
155
|
:host([orientation='vertical'][button-position='negative']:dir(rtl)) ::slotted(mdc-button) {
|
103
|
-
border-radius: var(--mdc-divider-grabber-button-border-radius)
|
104
|
-
0
|
105
|
-
0
|
156
|
+
border-radius: var(--mdc-divider-grabber-button-border-radius)
|
157
|
+
0
|
158
|
+
0
|
106
159
|
var(--mdc-divider-grabber-button-border-radius);
|
107
|
-
|
160
|
+
margin: 0;
|
161
|
+
margin-right: var(--mdc-divider-width);
|
162
|
+
border-right: 0;
|
108
163
|
}
|
109
164
|
|
110
165
|
:host([orientation='vertical'][button-position='positive']:dir(ltr)) ::slotted(mdc-button),
|
111
166
|
:host([orientation='vertical'][button-position='positive']:dir(rtl)) ::slotted(mdc-button) {
|
112
|
-
|
167
|
+
margin: 0;
|
168
|
+
margin-left: var(--mdc-divider-width);
|
169
|
+
border-left: 0;
|
113
170
|
}
|
114
171
|
|
115
172
|
:host([orientation='vertical'][button-position='positive']:dir(rtl)) ::slotted(mdc-button) {
|
116
|
-
border-radius: 0
|
117
|
-
var(--mdc-divider-grabber-button-border-radius)
|
118
|
-
var(--mdc-divider-grabber-button-border-radius)
|
173
|
+
border-radius: 0
|
174
|
+
var(--mdc-divider-grabber-button-border-radius)
|
175
|
+
var(--mdc-divider-grabber-button-border-radius)
|
119
176
|
0;
|
120
177
|
transform: rotate(180deg);
|
178
|
+
margin: 0;
|
179
|
+
margin-right: var(--mdc-divider-width);
|
121
180
|
}
|
122
181
|
|
123
182
|
:host([orientation='vertical'][button-position='negative']:dir(rtl)) ::slotted(mdc-button) {
|
124
183
|
transform: rotate(180deg);
|
184
|
+
margin: 0;
|
185
|
+
margin-left: var(--mdc-divider-width);
|
125
186
|
}
|
126
187
|
|
127
188
|
/** Text divider styles */
|
@@ -136,6 +197,12 @@ const styles = [
|
|
136
197
|
background-color: var(--mdc-divider-background-color);
|
137
198
|
}
|
138
199
|
|
200
|
+
@media (forced-colors: active) {
|
201
|
+
:host([data-type='mdc-text-divider']) > div {
|
202
|
+
border-bottom: var(--mdc-divider-width) solid var(--mdc-divider-background-color);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
139
206
|
:host([orientation='horizontal'][variant='gradient'][data-type='mdc-text-divider']) > div:first-of-type {
|
140
207
|
background: linear-gradient(to right, transparent, 30%, var(--mdc-divider-background-color));
|
141
208
|
}
|
@@ -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 {};
|