@fluentui/web-components 3.0.0-alpha.1 → 3.0.0-alpha.3
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/.eslintrc.json +62 -0
- package/CHANGELOG.json +208 -8
- package/CHANGELOG.md +155 -97
- package/build/{clean.js → clean.cjs} +0 -0
- package/dist/dts/badge/badge.d.ts +49 -0
- package/dist/dts/badge/badge.definition.d.ts +11 -0
- package/dist/dts/badge/badge.options.d.ts +73 -0
- package/dist/dts/badge/badge.stories.d.ts +12 -0
- package/dist/dts/badge/badge.styles.d.ts +4 -0
- package/dist/dts/badge/badge.template.d.ts +9 -0
- package/dist/dts/badge/define.d.ts +1 -0
- package/dist/dts/badge/index.d.ts +5 -0
- package/dist/dts/counter-badge/counter-badge.d.ts +90 -0
- package/dist/dts/counter-badge/counter-badge.definition.d.ts +11 -0
- package/dist/dts/counter-badge/counter-badge.options.d.ts +69 -0
- package/dist/dts/counter-badge/counter-badge.stories.d.ts +14 -0
- package/dist/dts/counter-badge/counter-badge.styles.d.ts +4 -0
- package/dist/dts/counter-badge/counter-badge.template.d.ts +7 -0
- package/dist/dts/counter-badge/define.d.ts +1 -0
- package/dist/dts/counter-badge/index.d.ts +5 -0
- package/dist/dts/fluent-design-system.d.ts +5 -0
- package/dist/dts/index-rollup.d.ts +1 -1
- package/dist/dts/index.d.ts +6 -1
- package/dist/dts/progress-bar/define.d.ts +1 -0
- package/dist/dts/progress-bar/index.d.ts +5 -0
- package/dist/dts/progress-bar/progress-bar.d.ts +30 -0
- package/dist/dts/progress-bar/progress-bar.definition.d.ts +10 -0
- package/dist/dts/progress-bar/progress-bar.options.d.ts +41 -0
- package/dist/dts/progress-bar/progress-bar.stories.d.ts +9 -0
- package/dist/dts/progress-bar/progress-bar.styles.d.ts +4 -0
- package/dist/dts/progress-bar/progress-bar.template.d.ts +3 -0
- package/dist/dts/spinner/define.d.ts +1 -0
- package/dist/dts/spinner/index.d.ts +5 -0
- package/dist/dts/spinner/spinner.d.ts +25 -0
- package/dist/dts/spinner/spinner.definition.d.ts +11 -0
- package/dist/dts/spinner/spinner.options.d.ts +32 -0
- package/dist/dts/spinner/spinner.stories.d.ts +8 -0
- package/dist/dts/spinner/spinner.styles.d.ts +1 -0
- package/dist/dts/spinner/spinner.template.d.ts +3 -0
- package/dist/dts/styles/index.d.ts +1 -0
- package/dist/dts/styles/partials/badge.partials.d.ts +28 -0
- package/dist/dts/styles/partials/index.d.ts +1 -0
- package/dist/dts/text/define.d.ts +1 -0
- package/dist/dts/text/index.d.ts +5 -0
- package/dist/dts/text/text.d.ts +91 -0
- package/dist/dts/text/text.definition.d.ts +10 -0
- package/dist/dts/text/text.options.d.ts +67 -0
- package/dist/dts/text/text.stories.d.ts +8 -0
- package/dist/dts/text/text.styles.d.ts +4 -0
- package/dist/dts/text/text.template.d.ts +6 -0
- package/dist/dts/theme/index.d.ts +2 -2
- package/dist/esm/badge/badge.definition.js +18 -0
- package/dist/esm/badge/badge.js +42 -0
- package/dist/esm/badge/badge.options.js +45 -0
- package/dist/esm/badge/badge.stories.js +108 -0
- package/dist/esm/badge/badge.styles.js +29 -0
- package/dist/esm/badge/badge.template.js +14 -0
- package/dist/esm/badge/define.js +3 -0
- package/dist/esm/badge/index.js +5 -0
- package/dist/esm/counter-badge/counter-badge.definition.js +18 -0
- package/dist/esm/counter-badge/counter-badge.js +89 -0
- package/dist/esm/counter-badge/counter-badge.options.js +42 -0
- package/dist/esm/counter-badge/counter-badge.stories.js +102 -0
- package/dist/esm/counter-badge/counter-badge.styles.js +30 -0
- package/dist/esm/counter-badge/counter-badge.template.js +12 -0
- package/dist/esm/counter-badge/define.js +3 -0
- package/dist/esm/counter-badge/index.js +5 -0
- package/dist/esm/fluent-design-system.js +5 -0
- package/dist/esm/index-rollup.js +1 -1
- package/dist/esm/index.js +6 -1
- package/dist/esm/progress-bar/define.js +3 -0
- package/dist/esm/progress-bar/index.js +5 -0
- package/dist/esm/progress-bar/progress-bar.definition.js +17 -0
- package/dist/esm/progress-bar/progress-bar.js +18 -0
- package/dist/esm/progress-bar/progress-bar.options.js +25 -0
- package/dist/esm/progress-bar/progress-bar.stories.js +60 -0
- package/dist/esm/progress-bar/progress-bar.styles.js +155 -0
- package/dist/esm/progress-bar/progress-bar.template.js +5 -0
- package/dist/esm/spinner/define.js +3 -0
- package/dist/esm/spinner/index.js +5 -0
- package/dist/esm/spinner/spinner.definition.js +18 -0
- package/dist/esm/spinner/spinner.js +15 -0
- package/dist/esm/spinner/spinner.options.js +21 -0
- package/dist/esm/spinner/spinner.stories.js +45 -0
- package/dist/esm/spinner/spinner.styles.js +95 -0
- package/dist/esm/spinner/spinner.template.js +21 -0
- package/dist/esm/styles/index.js +1 -0
- package/dist/esm/styles/partials/badge.partials.js +272 -0
- package/dist/esm/styles/partials/index.js +1 -0
- package/dist/esm/text/define.js +3 -0
- package/dist/esm/text/index.js +5 -0
- package/dist/esm/text/text.definition.js +17 -0
- package/dist/esm/text/text.js +91 -0
- package/dist/esm/text/text.options.js +45 -0
- package/dist/esm/text/text.stories.js +111 -0
- package/dist/esm/text/text.styles.js +104 -0
- package/dist/esm/text/text.template.js +5 -0
- package/dist/esm/theme/index.js +2 -2
- package/dist/esm/theme/set-theme.js +1 -1
- package/dist/esm/theme/theme.stories.js +1 -1
- package/dist/fluent-web-components.api.json +14330 -8
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/web-components.d.ts +1460 -1
- package/dist/web-components.js +5713 -2
- package/dist/web-components.min.js +273 -1
- package/docs/api-report.md +1471 -1
- package/package.json +48 -16
- package/rollup.config.js +5 -0
- package/karma.conf.js +0 -147
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { html } from '@microsoft/fast-element';
|
|
2
|
+
import { renderComponent } from '../__test__/helpers.js';
|
|
3
|
+
import { CounterBadgeAppearance, CounterBadgeColor, CounterBadgeShape, CounterBadgeSize, } from './counter-badge.options.js';
|
|
4
|
+
import './define.js';
|
|
5
|
+
// TODO: Currently cannot show icon or content
|
|
6
|
+
// in the counter badge stories because it projects as slotted content
|
|
7
|
+
const storyTemplate = html `
|
|
8
|
+
<fluent-counter-badge
|
|
9
|
+
appearance="${x => x.appearance}"
|
|
10
|
+
color="${x => x.color}"
|
|
11
|
+
shape="${x => x.shape}"
|
|
12
|
+
size="${x => x.size}"
|
|
13
|
+
count="${x => x.count}"
|
|
14
|
+
overflow-count="${x => x.overflowCount}"
|
|
15
|
+
?show-zero="${x => x.showZero}"
|
|
16
|
+
?dot="${x => x.dot}"
|
|
17
|
+
></fluent-counter-badge>
|
|
18
|
+
`;
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Components/Badge/Counter Badge',
|
|
21
|
+
args: {
|
|
22
|
+
dot: false,
|
|
23
|
+
showZero: false,
|
|
24
|
+
appearance: CounterBadgeAppearance.filled,
|
|
25
|
+
color: CounterBadgeColor.brand,
|
|
26
|
+
shape: CounterBadgeShape.circular,
|
|
27
|
+
count: 5,
|
|
28
|
+
},
|
|
29
|
+
argTypes: {
|
|
30
|
+
appearance: {
|
|
31
|
+
options: Object.values(CounterBadgeAppearance),
|
|
32
|
+
control: {
|
|
33
|
+
type: 'select',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
color: {
|
|
37
|
+
options: Object.values(CounterBadgeColor),
|
|
38
|
+
control: {
|
|
39
|
+
type: 'select',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
shape: {
|
|
43
|
+
options: Object.values(CounterBadgeShape),
|
|
44
|
+
control: {
|
|
45
|
+
type: 'select',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
size: {
|
|
49
|
+
options: Object.values(CounterBadgeSize),
|
|
50
|
+
control: {
|
|
51
|
+
type: 'select',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
iconPosition: {
|
|
55
|
+
options: ['none', 'start', 'end'],
|
|
56
|
+
control: {
|
|
57
|
+
type: 'select',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
dot: {
|
|
61
|
+
control: 'boolean',
|
|
62
|
+
},
|
|
63
|
+
showZero: {
|
|
64
|
+
control: 'boolean',
|
|
65
|
+
},
|
|
66
|
+
count: {
|
|
67
|
+
control: 'number',
|
|
68
|
+
},
|
|
69
|
+
overflowCount: {
|
|
70
|
+
control: 'text',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
export const CounterBadge = renderComponent(storyTemplate).bind({});
|
|
75
|
+
export const Appearance = renderComponent(html `
|
|
76
|
+
<fluent-counter-badge count="5" appearance="filled"></fluent-counter-badge>
|
|
77
|
+
<fluent-counter-badge count="5" appearance="ghost"></fluent-counter-badge>
|
|
78
|
+
`);
|
|
79
|
+
export const Color = renderComponent(html `
|
|
80
|
+
<fluent-counter-badge count="5" color="brand"></fluent-counter-badge>
|
|
81
|
+
<fluent-counter-badge count="5" color="danger"></fluent-counter-badge>
|
|
82
|
+
<fluent-counter-badge count="5" color="important"></fluent-counter-badge>
|
|
83
|
+
<fluent-counter-badge count="5" color="informative"></fluent-counter-badge>
|
|
84
|
+
<fluent-counter-badge count="5" color="severe"></fluent-counter-badge>
|
|
85
|
+
<fluent-counter-badge count="5" color="subtle"></fluent-counter-badge>
|
|
86
|
+
<fluent-counter-badge count="5" color="success"></fluent-counter-badge>
|
|
87
|
+
<fluent-counter-badge count="5" color="warning"></fluent-counter-badge>
|
|
88
|
+
`);
|
|
89
|
+
export const Shape = renderComponent(html `
|
|
90
|
+
<fluent-counter-badge count="5" shape="circular"></fluent-counter-badge>
|
|
91
|
+
<fluent-counter-badge count="5" shape="rounded"></fluent-counter-badge>
|
|
92
|
+
`);
|
|
93
|
+
export const Size = renderComponent(html `
|
|
94
|
+
<fluent-counter-badge size="tiny"></fluent-counter-badge>
|
|
95
|
+
<fluent-counter-badge size="extra-small"></fluent-counter-badge>
|
|
96
|
+
<fluent-counter-badge size="small"></fluent-counter-badge>
|
|
97
|
+
<fluent-counter-badge size="medium"></fluent-counter-badge>
|
|
98
|
+
<fluent-counter-badge size="large"></fluent-counter-badge>
|
|
99
|
+
<fluent-counter-badge size="extra-large"></fluent-counter-badge>
|
|
100
|
+
`);
|
|
101
|
+
export const Dot = renderComponent(html `<fluent-counter-badge dot></fluent-counter-badge>`);
|
|
102
|
+
export const ShowZero = renderComponent(html `<fluent-counter-badge show-zero></fluent-counter-badge>`);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { css } from '@microsoft/fast-element';
|
|
2
|
+
import { badgeBaseStyles, badgeFilledStyles, badgeGhostStyles, badgeSizeStyles } from '../styles/index.js';
|
|
3
|
+
import { borderRadiusMedium, borderRadiusSmall } from '../theme/design-tokens.js';
|
|
4
|
+
/** Badge styles
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const styles = css `
|
|
8
|
+
:host([shape='rounded']) {
|
|
9
|
+
border-radius: ${borderRadiusMedium};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host([shape='rounded'][size='tiny']),
|
|
13
|
+
:host([shape='rounded'][size='extra-small']),
|
|
14
|
+
:host([shape='rounded'][size='small']) {
|
|
15
|
+
border-radius: ${borderRadiusSmall};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
${badgeSizeStyles}
|
|
19
|
+
${badgeFilledStyles}
|
|
20
|
+
${badgeGhostStyles}
|
|
21
|
+
${badgeBaseStyles}
|
|
22
|
+
|
|
23
|
+
:host([dot]),
|
|
24
|
+
:host([dot][appearance][size]) {
|
|
25
|
+
min-width: auto;
|
|
26
|
+
width: 6px;
|
|
27
|
+
height: 6px;
|
|
28
|
+
padding: 0;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { html } from '@microsoft/fast-element';
|
|
2
|
+
import { badgeTemplate } from '../badge/badge.template.js';
|
|
3
|
+
function composeTemplate(options = {}) {
|
|
4
|
+
return badgeTemplate({
|
|
5
|
+
defaultContent: html `${x => x.setCount()}`,
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The template for the Counter Badge component.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export const template = composeTemplate();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './counter-badge.js';
|
|
2
|
+
export * from './counter-badge.options.js';
|
|
3
|
+
export { template as CounterBadgeTemplate } from './counter-badge.template.js';
|
|
4
|
+
export { styles as CounterBadgeStyles } from './counter-badge.styles.js';
|
|
5
|
+
export { definition as CounterBadgeDefinition } from './counter-badge.definition.js';
|
package/dist/esm/index-rollup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './index';
|
|
1
|
+
export * from './index.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './progress-bar.js';
|
|
2
|
+
export * from './progress-bar.options.js';
|
|
3
|
+
export { definition as ProgressBarDefinition } from './progress-bar.definition.js';
|
|
4
|
+
export { styles as ProgressBarStyles } from './progress-bar.styles.js';
|
|
5
|
+
export { template as ProgressBarTemplate } from './progress-bar.template.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FluentDesignSystem } from '../fluent-design-system.js';
|
|
2
|
+
import { ProgressBar } from './progress-bar.js';
|
|
3
|
+
import { styles } from './progress-bar.styles.js';
|
|
4
|
+
import { template } from './progress-bar.template.js';
|
|
5
|
+
/**
|
|
6
|
+
* The Fluent ProgressBar Element.
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @remarks
|
|
11
|
+
* HTML Element: \<fluent-progress-bar\>
|
|
12
|
+
*/
|
|
13
|
+
export const definition = ProgressBar.compose({
|
|
14
|
+
name: `${FluentDesignSystem.prefix}-progress-bar`,
|
|
15
|
+
template,
|
|
16
|
+
styles,
|
|
17
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr } from '@microsoft/fast-element';
|
|
3
|
+
import { FASTProgress } from '@microsoft/fast-foundation';
|
|
4
|
+
/**
|
|
5
|
+
* The base class used for constructing a fluent-progress-bar custom element
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class ProgressBar extends FASTProgress {
|
|
9
|
+
}
|
|
10
|
+
__decorate([
|
|
11
|
+
attr
|
|
12
|
+
], ProgressBar.prototype, "thickness", void 0);
|
|
13
|
+
__decorate([
|
|
14
|
+
attr
|
|
15
|
+
], ProgressBar.prototype, "shape", void 0);
|
|
16
|
+
__decorate([
|
|
17
|
+
attr({ attribute: 'validation-state' })
|
|
18
|
+
], ProgressBar.prototype, "validationState", void 0);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProgressBarThickness Constants
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export const ProgressBarThickness = {
|
|
6
|
+
medium: 'medium',
|
|
7
|
+
large: 'large',
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* ProgressBarShape Constants
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export const ProgressBarShape = {
|
|
14
|
+
rounded: 'rounded',
|
|
15
|
+
square: 'square',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* ProgressBarValidationState Constants
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export const ProgressBarValidationState = {
|
|
22
|
+
success: 'success',
|
|
23
|
+
warning: 'warning',
|
|
24
|
+
error: 'error',
|
|
25
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { html } from '@microsoft/fast-element';
|
|
2
|
+
import { renderComponent } from '../__test__/helpers.js';
|
|
3
|
+
import { ProgressBarShape, ProgressBarThickness, ProgressBarValidationState } from './progress-bar.options.js';
|
|
4
|
+
import './define.js';
|
|
5
|
+
const storyTemplate = html `
|
|
6
|
+
<fluent-progress-bar
|
|
7
|
+
thickness=${x => x.thickness}
|
|
8
|
+
shape=${x => x.shape}
|
|
9
|
+
max=${x => x.max}
|
|
10
|
+
aria-valuemax=${x => x.max}
|
|
11
|
+
aria-valuenow=${x => x.value}
|
|
12
|
+
value=${x => x.value}
|
|
13
|
+
validation-state=${x => x.validationState}
|
|
14
|
+
></fluent-progress-bar>
|
|
15
|
+
`;
|
|
16
|
+
export default {
|
|
17
|
+
title: 'Components/ProgressBar',
|
|
18
|
+
args: {
|
|
19
|
+
max: 100,
|
|
20
|
+
value: 15,
|
|
21
|
+
thickness: 'medium',
|
|
22
|
+
shape: 'rounded',
|
|
23
|
+
validationState: null,
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
max: {
|
|
27
|
+
control: 'number',
|
|
28
|
+
defaultValue: 100,
|
|
29
|
+
},
|
|
30
|
+
value: {
|
|
31
|
+
control: 'number',
|
|
32
|
+
defaultValue: 15,
|
|
33
|
+
},
|
|
34
|
+
thickness: {
|
|
35
|
+
control: {
|
|
36
|
+
type: 'select',
|
|
37
|
+
},
|
|
38
|
+
options: Object.values(ProgressBarThickness),
|
|
39
|
+
defaultValue: 'medium',
|
|
40
|
+
},
|
|
41
|
+
shape: {
|
|
42
|
+
options: Object.values(ProgressBarShape),
|
|
43
|
+
control: {
|
|
44
|
+
type: 'select',
|
|
45
|
+
},
|
|
46
|
+
defaultValue: 'rounded',
|
|
47
|
+
},
|
|
48
|
+
validationState: {
|
|
49
|
+
options: Object.values(ProgressBarValidationState),
|
|
50
|
+
control: {
|
|
51
|
+
type: 'select',
|
|
52
|
+
},
|
|
53
|
+
defaultValue: null,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export const Progress = renderComponent(storyTemplate).bind({});
|
|
58
|
+
export const ProgressIndeterminate = renderComponent(html `
|
|
59
|
+
<fluent-progress-bar title="Indeterminate Bar" aria-label="Indeterminate progress bar"></fluent-progress-bar>
|
|
60
|
+
`);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { css } from '@microsoft/fast-element';
|
|
2
|
+
import { display } from '@microsoft/fast-foundation';
|
|
3
|
+
import { borderRadiusMedium, colorBrandBackground2, colorCompoundBrandBackground, colorNeutralBackground6, colorPaletteDarkOrangeBackground2, colorPaletteDarkOrangeBackground3, colorPaletteGreenBackground2, colorPaletteGreenBackground3, colorPaletteRedBackground2, colorPaletteRedBackground3, } from '../theme/design-tokens.js';
|
|
4
|
+
/** Text styles
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const styles = css `
|
|
8
|
+
${display('flex')}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
align-items: center;
|
|
12
|
+
height: 2px;
|
|
13
|
+
overflow-x: hidden;
|
|
14
|
+
border-radius: ${borderRadiusMedium};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([thickness='large']),
|
|
18
|
+
:host([thickness='large']) .progress,
|
|
19
|
+
:host([thickness='large']) .determinate {
|
|
20
|
+
height: 4px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([shape='square']),
|
|
24
|
+
:host([shape='square']) .progress,
|
|
25
|
+
:host([shape='square']) .determinate {
|
|
26
|
+
border-radius: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host([validation-state='error']) .determinate {
|
|
30
|
+
background-color: ${colorPaletteRedBackground3};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([validation-state='error']) .indeterminate-indicator-1,
|
|
34
|
+
:host([validation-state='error']) .indeterminate-indicator-2 {
|
|
35
|
+
background: linear-gradient(
|
|
36
|
+
to right,
|
|
37
|
+
${colorPaletteRedBackground2} 0%,
|
|
38
|
+
${colorPaletteRedBackground3} 50%,
|
|
39
|
+
${colorPaletteRedBackground2}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([validation-state='warning']) .determinate {
|
|
44
|
+
background-color: ${colorPaletteDarkOrangeBackground3};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([validation-state='warning']) .indeterminate-indicator-1,
|
|
48
|
+
:host([validation-state='warning']) .indeterminate-indicator-2 {
|
|
49
|
+
background: linear-gradient(
|
|
50
|
+
to right,
|
|
51
|
+
${colorPaletteDarkOrangeBackground2} 0%,
|
|
52
|
+
${colorPaletteDarkOrangeBackground3} 50%,
|
|
53
|
+
${colorPaletteDarkOrangeBackground2}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([validation-state='success']) .determinate {
|
|
58
|
+
background-color: ${colorPaletteGreenBackground3};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([validation-state='success']) .indeterminate-indicator-1,
|
|
62
|
+
:host([validation-state='success']) .indeterminate-indicator-2 {
|
|
63
|
+
background: linear-gradient(
|
|
64
|
+
to right,
|
|
65
|
+
${colorPaletteGreenBackground2} 0%,
|
|
66
|
+
${colorPaletteGreenBackground3} 50%,
|
|
67
|
+
${colorPaletteGreenBackground2}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.progress {
|
|
72
|
+
background-color: ${colorNeutralBackground6};
|
|
73
|
+
border-radius: ${borderRadiusMedium};
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 2px;
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
position: relative;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.determinate {
|
|
82
|
+
background-color: ${colorCompoundBrandBackground};
|
|
83
|
+
border-radius: ${borderRadiusMedium};
|
|
84
|
+
height: 2px;
|
|
85
|
+
transition: all 0.2s ease-in-out;
|
|
86
|
+
display: flex;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.indeterminate-indicator-1 {
|
|
90
|
+
position: absolute;
|
|
91
|
+
opacity: 0;
|
|
92
|
+
height: 100%;
|
|
93
|
+
background: linear-gradient(
|
|
94
|
+
to right,
|
|
95
|
+
${colorBrandBackground2} 0%,
|
|
96
|
+
${colorCompoundBrandBackground} 50%,
|
|
97
|
+
${colorBrandBackground2}
|
|
98
|
+
);
|
|
99
|
+
border-radius: ${borderRadiusMedium};
|
|
100
|
+
animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
|
|
101
|
+
width: 40%;
|
|
102
|
+
animation: indeterminate-1 3s infinite;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.indeterminate-indicator-2 {
|
|
106
|
+
position: absolute;
|
|
107
|
+
opacity: 0;
|
|
108
|
+
height: 100%;
|
|
109
|
+
background: linear-gradient(
|
|
110
|
+
to right,
|
|
111
|
+
${colorBrandBackground2} 0%,
|
|
112
|
+
${colorCompoundBrandBackground} 50%,
|
|
113
|
+
${colorBrandBackground2}
|
|
114
|
+
);
|
|
115
|
+
border-radius: ${borderRadiusMedium};
|
|
116
|
+
animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
|
|
117
|
+
width: 60%;
|
|
118
|
+
animation: indeterminate-2 3s infinite;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@keyframes indeterminate-1 {
|
|
122
|
+
0% {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
transform: translateX(-100%);
|
|
125
|
+
}
|
|
126
|
+
70% {
|
|
127
|
+
opacity: 1;
|
|
128
|
+
transform: translateX(300%);
|
|
129
|
+
}
|
|
130
|
+
70.01% {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
}
|
|
133
|
+
100% {
|
|
134
|
+
opacity: 0;
|
|
135
|
+
transform: translateX(300%);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
@keyframes indeterminate-2 {
|
|
139
|
+
0% {
|
|
140
|
+
opacity: 0;
|
|
141
|
+
transform: translateX(-150%);
|
|
142
|
+
}
|
|
143
|
+
29.99% {
|
|
144
|
+
opacity: 0;
|
|
145
|
+
}
|
|
146
|
+
30% {
|
|
147
|
+
opacity: 1;
|
|
148
|
+
transform: translateX(-150%);
|
|
149
|
+
}
|
|
150
|
+
100% {
|
|
151
|
+
transform: translateX(166.66%);
|
|
152
|
+
opacity: 1;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { progressTemplate } from '@microsoft/fast-foundation';
|
|
2
|
+
export const template = progressTemplate({
|
|
3
|
+
indeterminateIndicator1: `<span class="indeterminate-indicator-1" part="indeterminate-indicator-1></span>`,
|
|
4
|
+
indeterminateIndicator2: `<span class="indeterminate-indicator-2" part="indeterminate-indicator-2"></span>`,
|
|
5
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './spinner.js';
|
|
2
|
+
export * from './spinner.options.js';
|
|
3
|
+
export { template as SpinnerTemplate } from './spinner.template.js';
|
|
4
|
+
export { styles as SpinnerStyles } from './spinner.styles.js';
|
|
5
|
+
export { definition as SpinnerDefinition } from './spinner.definition.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FluentDesignSystem } from '../fluent-design-system.js';
|
|
2
|
+
import { Spinner } from './spinner.js';
|
|
3
|
+
import { styles } from './spinner.styles.js';
|
|
4
|
+
import { template } from './spinner.template.js';
|
|
5
|
+
/**
|
|
6
|
+
* The Fluent Spinner Element. Implements {@link @microsoft/fast-foundation#ProgressRing },
|
|
7
|
+
* {@link @microsoft/fast-foundation#progress-ringTemplate}
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @remarks
|
|
12
|
+
* HTML Element: \<fluent-spinner\>
|
|
13
|
+
*/
|
|
14
|
+
export const definition = Spinner.compose({
|
|
15
|
+
name: `${FluentDesignSystem.prefix}-spinner`,
|
|
16
|
+
template,
|
|
17
|
+
styles,
|
|
18
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr } from '@microsoft/fast-element';
|
|
3
|
+
import { FASTProgressRing } from '@microsoft/fast-foundation';
|
|
4
|
+
/**
|
|
5
|
+
* The base class used for constructing a fluent-spinner custom element
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export class Spinner extends FASTProgressRing {
|
|
9
|
+
}
|
|
10
|
+
__decorate([
|
|
11
|
+
attr
|
|
12
|
+
], Spinner.prototype, "size", void 0);
|
|
13
|
+
__decorate([
|
|
14
|
+
attr
|
|
15
|
+
], Spinner.prototype, "appearance", void 0);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpinnerAppearance constants
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export const SpinnerAppearance = {
|
|
6
|
+
primary: 'primary',
|
|
7
|
+
inverted: 'inverted',
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* SpinnerSize constants
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export const SpinnerSize = {
|
|
14
|
+
tiny: 'tiny',
|
|
15
|
+
extraSmall: 'extra-small',
|
|
16
|
+
small: 'small',
|
|
17
|
+
medium: 'medium',
|
|
18
|
+
large: 'large',
|
|
19
|
+
extraLarge: 'extra-large',
|
|
20
|
+
huge: 'huge',
|
|
21
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { html } from '@microsoft/fast-element';
|
|
2
|
+
import { renderComponent } from '../__test__/helpers.js';
|
|
3
|
+
import { SpinnerAppearance, SpinnerSize } from './spinner.options.js';
|
|
4
|
+
import './define.js';
|
|
5
|
+
const storyTemplate = html `
|
|
6
|
+
<fluent-spinner appearance=${x => x.appearance} size=${x => x.size}></fluent-spinner>
|
|
7
|
+
`;
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Spinner',
|
|
10
|
+
argTypes: {
|
|
11
|
+
appearance: {
|
|
12
|
+
description: 'The appearance of the spinner',
|
|
13
|
+
table: {
|
|
14
|
+
defaultValue: { summary: 'primary' },
|
|
15
|
+
},
|
|
16
|
+
control: {
|
|
17
|
+
type: 'select',
|
|
18
|
+
options: Object.values(SpinnerAppearance),
|
|
19
|
+
},
|
|
20
|
+
defaultValue: 'primary',
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
description: 'The size of the spinner',
|
|
24
|
+
table: {
|
|
25
|
+
defaultValue: { summary: 'medium' },
|
|
26
|
+
},
|
|
27
|
+
control: {
|
|
28
|
+
type: 'select',
|
|
29
|
+
options: Object.values(SpinnerSize),
|
|
30
|
+
},
|
|
31
|
+
defaultValue: 'medium',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
parameters: {
|
|
35
|
+
status: {
|
|
36
|
+
type: 'experimental',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const Spinner = renderComponent(storyTemplate).bind({});
|
|
41
|
+
export const SpinnerInverted = renderComponent(html `
|
|
42
|
+
<div style="background-color: #0f6cbd; padding: 20px;">
|
|
43
|
+
<fluent-spinner appearance="inverted" size="medium"></fluent-spinner>
|
|
44
|
+
</div>
|
|
45
|
+
`);
|