@fluentui/react-progress 9.0.0-alpha.9 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +266 -1
- package/CHANGELOG.md +114 -2
- package/README.md +9 -17
- package/dist/index.d.ts +20 -11
- package/lib/components/ProgressBar/ProgressBar.js +0 -1
- package/lib/components/ProgressBar/ProgressBar.js.map +1 -1
- package/lib/components/ProgressBar/ProgressBar.types.js.map +1 -1
- package/lib/components/ProgressBar/renderProgressBar.js +4 -3
- package/lib/components/ProgressBar/renderProgressBar.js.map +1 -1
- package/lib/components/ProgressBar/useProgressBar.js +2 -3
- package/lib/components/ProgressBar/useProgressBar.js.map +1 -1
- package/lib/components/ProgressBar/useProgressBarStyles.js +75 -81
- package/lib/components/ProgressBar/useProgressBarStyles.js.map +1 -1
- package/lib/components/ProgressField/ProgressField.js +15 -15
- package/lib/components/ProgressField/ProgressField.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-amd/ProgressBar.js +6 -0
- package/lib-amd/ProgressBar.js.map +1 -0
- package/lib-amd/ProgressField.js +6 -0
- package/lib-amd/ProgressField.js.map +1 -0
- package/lib-amd/components/ProgressBar/ProgressBar.js +15 -0
- package/lib-amd/components/ProgressBar/ProgressBar.js.map +1 -0
- package/lib-amd/components/ProgressBar/ProgressBar.types.js +5 -0
- package/lib-amd/components/ProgressBar/ProgressBar.types.js.map +1 -0
- package/lib-amd/components/ProgressBar/index.js +10 -0
- package/lib-amd/components/ProgressBar/index.js.map +1 -0
- package/lib-amd/components/ProgressBar/renderProgressBar.js +14 -0
- package/lib-amd/components/ProgressBar/renderProgressBar.js.map +1 -0
- package/lib-amd/components/ProgressBar/useProgressBar.js +38 -0
- package/lib-amd/components/ProgressBar/useProgressBar.js.map +1 -0
- package/lib-amd/components/ProgressBar/useProgressBarStyles.js +112 -0
- package/lib-amd/components/ProgressBar/useProgressBarStyles.js.map +1 -0
- package/lib-amd/components/ProgressField/ProgressField.js +13 -0
- package/lib-amd/components/ProgressField/ProgressField.js.map +1 -0
- package/lib-amd/components/ProgressField/index.js +6 -0
- package/lib-amd/components/ProgressField/index.js.map +1 -0
- package/lib-amd/index.js +13 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-commonjs/ProgressBar.js +0 -2
- package/lib-commonjs/ProgressBar.js.map +1 -1
- package/lib-commonjs/ProgressField.js +0 -2
- package/lib-commonjs/ProgressField.js.map +1 -1
- package/lib-commonjs/components/ProgressBar/ProgressBar.js +0 -6
- package/lib-commonjs/components/ProgressBar/ProgressBar.js.map +1 -1
- package/lib-commonjs/components/ProgressBar/ProgressBar.types.js.map +1 -1
- package/lib-commonjs/components/ProgressBar/index.js +0 -6
- package/lib-commonjs/components/ProgressBar/index.js.map +1 -1
- package/lib-commonjs/components/ProgressBar/renderProgressBar.js +4 -7
- package/lib-commonjs/components/ProgressBar/renderProgressBar.js.map +1 -1
- package/lib-commonjs/components/ProgressBar/useProgressBar.js +2 -6
- package/lib-commonjs/components/ProgressBar/useProgressBar.js.map +1 -1
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.js +75 -86
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.js.map +1 -1
- package/lib-commonjs/components/ProgressField/ProgressField.js +13 -17
- package/lib-commonjs/components/ProgressField/ProgressField.js.map +1 -1
- package/lib-commonjs/components/ProgressField/index.js +0 -2
- package/lib-commonjs/components/ProgressField/index.js.map +1 -1
- package/lib-commonjs/index.js +1 -4
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
@@ -4,9 +4,9 @@ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts
|
|
4
4
|
export const progressBarClassNames = {
|
5
5
|
root: 'fui-ProgressBar',
|
6
6
|
bar: 'fui-ProgressBar__bar'
|
7
|
-
};
|
7
|
+
};
|
8
|
+
// If the percentComplete is near 0, don't animate it.
|
8
9
|
// This prevents animations on reset to 0 scenarios.
|
9
|
-
|
10
10
|
const ZERO_THRESHOLD = 0.01;
|
11
11
|
const barThicknessValues = {
|
12
12
|
medium: '2px',
|
@@ -14,7 +14,7 @@ const barThicknessValues = {
|
|
14
14
|
};
|
15
15
|
const indeterminateProgressBar = {
|
16
16
|
'0%': {
|
17
|
-
left: '
|
17
|
+
left: '-100% /* @noflip */'
|
18
18
|
},
|
19
19
|
'100%': {
|
20
20
|
left: '100% /* @noflip */'
|
@@ -31,115 +31,112 @@ const indeterminateProgressBarRTL = {
|
|
31
31
|
/**
|
32
32
|
* Styles for the root slot
|
33
33
|
*/
|
34
|
-
|
35
34
|
const useRootStyles = /*#__PURE__*/__styles({
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
35
|
+
root: {
|
36
|
+
mc9l5x: "ftgm304",
|
37
|
+
De3pzq: "f18f03hv",
|
38
|
+
Bdqf98w: "fhb5wj7",
|
39
|
+
B68tc82: "f1p9o1ba",
|
40
|
+
Bmxbyg5: "f1sil6mw",
|
41
|
+
I5kgcl: "fs8b23g",
|
42
|
+
tu2nte: "f1mcb20s",
|
43
|
+
y0r1ed: "fek7wd8"
|
45
44
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
rounded: {
|
46
|
+
Bbmb7ep: ["f1aa9q02", "f16jpd5f"],
|
47
|
+
Beyfa6y: ["f16jpd5f", "f1aa9q02"],
|
48
|
+
B7oj6ja: ["f1jar5jt", "fyu767a"],
|
49
|
+
Btl43ni: ["fyu767a", "f1jar5jt"]
|
51
50
|
},
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
square: {
|
52
|
+
Bbmb7ep: ["fzi6hpg", "fyowgf4"],
|
53
|
+
Beyfa6y: ["fyowgf4", "fzi6hpg"],
|
54
|
+
B7oj6ja: ["f3fg2lr", "f13av6d4"],
|
55
|
+
Btl43ni: ["f13av6d4", "f3fg2lr"]
|
57
56
|
},
|
58
|
-
|
59
|
-
|
57
|
+
medium: {
|
58
|
+
Bqenvij: "f4t8t6x"
|
60
59
|
},
|
61
|
-
|
62
|
-
|
60
|
+
large: {
|
61
|
+
Bqenvij: "f6ywr7j"
|
63
62
|
}
|
64
63
|
}, {
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
d: [".ftgm304{display:block;}", ".f18f03hv{background-color:var(--colorNeutralBackground6);}", ".fhb5wj7{justify-self:stretch;}", ".f1p9o1ba{overflow-x:hidden;}", ".f1sil6mw{overflow-y:hidden;}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".fzi6hpg{border-bottom-right-radius:var(--borderRadiusNone);}", ".fyowgf4{border-bottom-left-radius:var(--borderRadiusNone);}", ".f3fg2lr{border-top-right-radius:var(--borderRadiusNone);}", ".f13av6d4{border-top-left-radius:var(--borderRadiusNone);}", ".f4t8t6x{height:2px;}", ".f6ywr7j{height:4px;}"],
|
65
|
+
m: [["@media screen and (forced-colors: active){.fs8b23g{border-bottom-width:1px;}}", {
|
66
|
+
m: "screen and (forced-colors: active)"
|
68
67
|
}], ["@media screen and (forced-colors: active){.f1mcb20s{border-bottom-style:solid;}}", {
|
69
|
-
|
68
|
+
m: "screen and (forced-colors: active)"
|
70
69
|
}], ["@media screen and (forced-colors: active){.fek7wd8{border-bottom-color:CanvasText;}}", {
|
71
|
-
|
70
|
+
m: "screen and (forced-colors: active)"
|
72
71
|
}]]
|
73
72
|
});
|
74
73
|
/**
|
75
74
|
* Styles for the ProgressBar bar
|
76
75
|
*/
|
77
|
-
|
78
|
-
|
79
76
|
const useBarStyles = /*#__PURE__*/__styles({
|
80
|
-
|
81
|
-
"
|
82
|
-
"
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
77
|
+
base: {
|
78
|
+
Bbmb7ep: ["f1d9uwra", "fzibvwi"],
|
79
|
+
Beyfa6y: ["fzibvwi", "f1d9uwra"],
|
80
|
+
B7oj6ja: ["fuoumxm", "f1vtqnvc"],
|
81
|
+
Btl43ni: ["f1vtqnvc", "fuoumxm"]
|
82
|
+
},
|
83
|
+
medium: {
|
84
|
+
Bqenvij: "f4t8t6x"
|
87
85
|
},
|
88
|
-
|
89
|
-
|
86
|
+
large: {
|
87
|
+
Bqenvij: "f6ywr7j"
|
90
88
|
},
|
91
|
-
|
92
|
-
|
89
|
+
nonZeroDeterminate: {
|
90
|
+
Bmy1vo4: "fjt6zfz",
|
91
|
+
B3o57yi: "f1wofebd",
|
92
|
+
Bkqvd7p: "fv71qf3"
|
93
93
|
},
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
"
|
94
|
+
indeterminate: {
|
95
|
+
B2u0y6b: "fa0wk36",
|
96
|
+
qhf8xq: "f10pi13n",
|
97
|
+
Bcmaq0h: ["fpo0yib", "f1u5hf6c"],
|
98
|
+
Bv12yb3: "f1jk3tlg",
|
99
|
+
vin17d: "f1a27w2r",
|
100
|
+
w3vfg9: "f1cpbl36",
|
101
|
+
Gqtpxc: "f4akx1t",
|
102
|
+
B3vm3ge: "f18p5put"
|
98
103
|
},
|
99
|
-
|
100
|
-
|
101
|
-
"qhf8xq": "f10pi13n",
|
102
|
-
"Bcmaq0h": ["fpo0yib", "f1u5hf6c"],
|
103
|
-
"Bv12yb3": "f1h4fm7e",
|
104
|
-
"vin17d": "f1a27w2r",
|
105
|
-
"w3vfg9": "f1cpbl36",
|
106
|
-
"Gqtpxc": "f4akx1t",
|
107
|
-
"B3vm3ge": "f18p5put"
|
104
|
+
rtl: {
|
105
|
+
Bv12yb3: "fjhwsai"
|
108
106
|
},
|
109
|
-
|
110
|
-
|
107
|
+
brand: {
|
108
|
+
De3pzq: "ftywsgz",
|
109
|
+
Bpep1pd: "f1neahkh"
|
111
110
|
},
|
112
|
-
|
113
|
-
|
111
|
+
error: {
|
112
|
+
De3pzq: "fdl5y0r"
|
114
113
|
},
|
115
|
-
|
116
|
-
|
114
|
+
warning: {
|
115
|
+
De3pzq: "f1s438gw"
|
117
116
|
},
|
118
|
-
|
119
|
-
|
117
|
+
success: {
|
118
|
+
De3pzq: "flxk52p"
|
120
119
|
}
|
121
120
|
}, {
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
"m": "screen and (prefers-reduced-motion: reduce)"
|
121
|
+
d: [".f1d9uwra{border-bottom-right-radius:inherit;}", ".fzibvwi{border-bottom-left-radius:inherit;}", ".fuoumxm{border-top-right-radius:inherit;}", ".f1vtqnvc{border-top-left-radius:inherit;}", ".f4t8t6x{height:2px;}", ".f6ywr7j{height:4px;}", ".fjt6zfz{transition-property:width;}", ".f1wofebd{transition-duration:0.3s;}", ".fv71qf3{transition-timing-function:ease;}", ".fa0wk36{max-width:33%;}", ".f10pi13n{position:relative;}", ".fpo0yib{background-image:linear-gradient(\n to right,\n var(--colorNeutralBackground6) 0%,\n var(--colorTransparentBackground) 50%,\n var(--colorNeutralBackground6) 100%\n );}", ".f1u5hf6c{background-image:linear-gradient(\n to left,\n var(--colorNeutralBackground6) 0%,\n var(--colorTransparentBackground) 50%,\n var(--colorNeutralBackground6) 100%\n );}", ".f1jk3tlg{-webkit-animation-name:fzkbrka;animation-name:fzkbrka;}", ".f1a27w2r{-webkit-animation-duration:3s;animation-duration:3s;}", ".f1cpbl36{-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;}", ".fjhwsai{-webkit-animation-name:f1kx06uz;animation-name:f1kx06uz;}", ".ftywsgz{background-color:var(--colorCompoundBrandBackground);}", ".fdl5y0r{background-color:var(--colorPaletteRedBackground3);}", ".f1s438gw{background-color:var(--colorPaletteDarkOrangeBackground3);}", ".flxk52p{background-color:var(--colorPaletteGreenBackground3);}"],
|
122
|
+
k: ["@-webkit-keyframes fzkbrka{0%{left:-100%;}100%{left:100%;}}", "@keyframes fzkbrka{0%{left:-100%;}100%{left:100%;}}", "@-webkit-keyframes f1kx06uz{100%{right:-100%;}0%{right:100%;}}", "@keyframes f1kx06uz{100%{right:-100%;}0%{right:100%;}}"],
|
123
|
+
m: [["@media screen and (prefers-reduced-motion: reduce){.f4akx1t{-webkit-animation-duration:0.01ms;animation-duration:0.01ms;}}", {
|
124
|
+
m: "screen and (prefers-reduced-motion: reduce)"
|
127
125
|
}], ["@media screen and (prefers-reduced-motion: reduce){.f18p5put{-webkit-animation-iteration-count:1;animation-iteration-count:1;}}", {
|
128
|
-
|
129
|
-
}]
|
130
|
-
|
126
|
+
m: "screen and (prefers-reduced-motion: reduce)"
|
127
|
+
}], ["@media screen and (forced-colors: active){.f1neahkh{background-color:Highlight;}}", {
|
128
|
+
m: "screen and (forced-colors: active)"
|
129
|
+
}]]
|
131
130
|
});
|
132
131
|
/**
|
133
132
|
* Apply styling to the ProgressBar slots based on the state
|
134
133
|
*/
|
135
|
-
|
136
|
-
|
137
134
|
export const useProgressBarStyles_unstable = state => {
|
138
135
|
const {
|
136
|
+
color,
|
139
137
|
max,
|
140
138
|
shape,
|
141
139
|
thickness,
|
142
|
-
validationState,
|
143
140
|
value
|
144
141
|
} = state;
|
145
142
|
const rootStyles = useRootStyles();
|
@@ -148,18 +145,15 @@ export const useProgressBarStyles_unstable = state => {
|
|
148
145
|
dir
|
149
146
|
} = useFluent();
|
150
147
|
state.root.className = mergeClasses(progressBarClassNames.root, rootStyles.root, rootStyles[shape], rootStyles[thickness], state.root.className);
|
151
|
-
|
152
148
|
if (state.bar) {
|
153
|
-
state.bar.className = mergeClasses(progressBarClassNames.bar, barStyles.base, value === undefined && barStyles.indeterminate, value === undefined && dir === 'rtl' && barStyles.rtl, barStyles[thickness], value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate,
|
149
|
+
state.bar.className = mergeClasses(progressBarClassNames.bar, barStyles.base, barStyles.brand, value === undefined && barStyles.indeterminate, value === undefined && dir === 'rtl' && barStyles.rtl, barStyles[thickness], value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate, color && value !== undefined && barStyles[color], state.bar.className);
|
154
150
|
}
|
155
|
-
|
156
151
|
if (state.bar && value !== undefined) {
|
157
152
|
state.bar.style = {
|
158
153
|
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
|
159
154
|
...state.bar.style
|
160
155
|
};
|
161
156
|
}
|
162
|
-
|
163
157
|
return state;
|
164
158
|
};
|
165
159
|
//# sourceMappingURL=useProgressBarStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":"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","names":["mergeClasses","shorthands","tokens","useFluent_unstable","useFluent","progressBarClassNames","root","bar","ZERO_THRESHOLD","barThicknessValues","medium","large","indeterminateProgressBar","left","indeterminateProgressBarRTL","right","useRootStyles","useBarStyles","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","rootStyles","barStyles","dir","className","base","brand","undefined","indeterminate","rtl","nonZeroDeterminate","style","width","Math","min"],"sourceRoot":"../src/","sources":["packages/react-components/react-progress/src/components/ProgressBar/useProgressBarStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const progressBarClassNames: SlotClassNames<ProgressBarSlots> = {\n root: 'fui-ProgressBar',\n bar: 'fui-ProgressBar__bar',\n};\n\n// If the percentComplete is near 0, don't animate it.\n// This prevents animations on reset to 0 scenarios.\nconst ZERO_THRESHOLD = 0.01;\n\nconst barThicknessValues = {\n medium: '2px',\n large: '4px',\n};\n\nconst indeterminateProgressBar = {\n '0%': {\n left: '-100% /* @noflip */',\n },\n '100%': {\n left: '100% /* @noflip */',\n },\n};\nconst indeterminateProgressBarRTL = {\n '100%': {\n right: '-100% /* @noflip */',\n },\n '0%': {\n right: '100% /* @noflip */',\n },\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n display: 'block',\n backgroundColor: tokens.colorNeutralBackground6,\n justifySelf: 'stretch',\n ...shorthands.overflow('hidden'),\n\n '@media screen and (forced-colors: active)': {\n ...shorthands.borderBottom('1px', 'solid', 'CanvasText'),\n },\n },\n rounded: {\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n square: {\n ...shorthands.borderRadius(tokens.borderRadiusNone),\n },\n medium: {\n height: barThicknessValues.medium,\n },\n large: {\n height: barThicknessValues.large,\n },\n});\n\n/**\n * Styles for the ProgressBar bar\n */\nconst useBarStyles = makeStyles({\n base: {\n ...shorthands.borderRadius('inherit'),\n },\n medium: {\n height: barThicknessValues.medium,\n },\n large: {\n height: barThicknessValues.large,\n },\n nonZeroDeterminate: {\n transitionProperty: 'width',\n transitionDuration: '0.3s',\n transitionTimingFunction: 'ease',\n },\n indeterminate: {\n maxWidth: '33%',\n position: 'relative',\n backgroundImage: `linear-gradient(\n to right,\n ${tokens.colorNeutralBackground6} 0%,\n ${tokens.colorTransparentBackground} 50%,\n ${tokens.colorNeutralBackground6} 100%\n )`,\n animationName: indeterminateProgressBar,\n animationDuration: '3s',\n animationIterationCount: 'infinite',\n '@media screen and (prefers-reduced-motion: reduce)': {\n animationDuration: '0.01ms',\n animationIterationCount: '1',\n },\n },\n\n rtl: {\n animationName: indeterminateProgressBarRTL,\n },\n\n brand: {\n backgroundColor: tokens.colorCompoundBrandBackground,\n '@media screen and (forced-colors: active)': {\n backgroundColor: 'Highlight',\n },\n },\n\n error: {\n backgroundColor: tokens.colorPaletteRedBackground3,\n },\n warning: {\n backgroundColor: tokens.colorPaletteDarkOrangeBackground3,\n },\n success: {\n backgroundColor: tokens.colorPaletteGreenBackground3,\n },\n});\n\n/**\n * Apply styling to the ProgressBar slots based on the state\n */\nexport const useProgressBarStyles_unstable = (state: ProgressBarState): ProgressBarState => {\n const { color, max, shape, thickness, value } = state;\n const rootStyles = useRootStyles();\n const barStyles = useBarStyles();\n const { dir } = useFluent();\n\n state.root.className = mergeClasses(\n progressBarClassNames.root,\n rootStyles.root,\n rootStyles[shape],\n rootStyles[thickness],\n state.root.className,\n );\n\n if (state.bar) {\n state.bar.className = mergeClasses(\n progressBarClassNames.bar,\n barStyles.base,\n barStyles.brand,\n value === undefined && barStyles.indeterminate,\n value === undefined && dir === 'rtl' && barStyles.rtl,\n barStyles[thickness],\n value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate,\n color && value !== undefined && barStyles[color],\n state.bar.className,\n );\n }\n\n if (state.bar && value !== undefined) {\n state.bar.style = {\n width: Math.min(100, Math.max(0, (value / max) * 100)) + '%',\n ...state.bar.style,\n };\n }\n\n return state;\n};\n"]}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
import { ProgressBar } from '../../ProgressBar';
|
4
|
-
|
5
|
-
export const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
/* eslint-disable deprecation/deprecation */
|
2
|
+
import { getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';
|
3
|
+
import { ProgressBar, progressBarClassNames } from '../../ProgressBar';
|
4
|
+
/** @deprecated Use Field with ProgressBar: `<Field><ProgressBar /></Field>` */
|
5
|
+
export const progressFieldClassNames = /*#__PURE__*/getDeprecatedFieldClassNames(progressBarClassNames.root);
|
6
|
+
/** @deprecated Use Field with ProgressBar: `<Field><ProgressBar /></Field>` */
|
7
|
+
export const ProgressField = /*#__PURE__*/makeDeprecatedField(ProgressBar, {
|
8
|
+
displayName: 'ProgressField',
|
9
|
+
mapProps: props => ({
|
10
|
+
...props,
|
11
|
+
control: {
|
12
|
+
...props.control,
|
13
|
+
validationState: props.validationState
|
14
|
+
}
|
15
|
+
})
|
15
16
|
});
|
16
|
-
ProgressField.displayName = 'ProgressField';
|
17
17
|
//# sourceMappingURL=ProgressField.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":"AAAA;AACA,SAA+BA,4BAA4B,EAAEC,mBAAmB,QAAQ,uBAAuB;AAE/G,SAASC,WAAW,EAAEC,qBAAqB,QAA0B,mBAAmB;AAIxF;AACA,OAAO,MAAMC,uBAAuB,gBAAGJ,4BAA4B,CAACG,qBAAqB,CAACE,IAAI,CAAC;AAC/F;AACA,OAAO,MAAMC,aAAa,gBAA4CL,mBAAmB,CAACC,WAAW,EAAE;EACrGK,WAAW,EAAE,eAAe;EAC5BC,QAAQ,EAAGC,KAAyB,KAAM;IACxC,GAAGA,KAAK;IACRC,OAAO,EAAE;MAAE,GAAGD,KAAK,CAACC,OAAO;MAAEC,eAAe,EAAEF,KAAK,CAACE;IAAe;GACpE;CACF,CAAC","names":["getDeprecatedFieldClassNames","makeDeprecatedField","ProgressBar","progressBarClassNames","progressFieldClassNames","root","ProgressField","displayName","mapProps","props","control","validationState"],"sourceRoot":"../src/","sources":["packages/react-components/react-progress/src/components/ProgressField/ProgressField.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport { DeprecatedFieldProps, getDeprecatedFieldClassNames, makeDeprecatedField } from '@fluentui/react-field';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { ProgressBar, progressBarClassNames, ProgressBarProps } from '../../ProgressBar';\n\n/** @deprecated Use Field with ProgressBar: `<Field><ProgressBar /></Field>` */\nexport type ProgressFieldProps = DeprecatedFieldProps<ProgressBarProps>;\n/** @deprecated Use Field with ProgressBar: `<Field><ProgressBar /></Field>` */\nexport const progressFieldClassNames = getDeprecatedFieldClassNames(progressBarClassNames.root);\n/** @deprecated Use Field with ProgressBar: `<Field><ProgressBar /></Field>` */\nexport const ProgressField: ForwardRefComponent<ProgressFieldProps> = makeDeprecatedField(ProgressBar, {\n displayName: 'ProgressField',\n mapProps: (props: ProgressFieldProps) => ({\n ...props,\n control: { ...props.control, validationState: props.validationState },\n }),\n});\n"]}
|
package/lib/index.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
1
|
export { ProgressBar, progressBarClassNames, renderProgressBar_unstable, useProgressBar_unstable, useProgressBarStyles_unstable } from './ProgressBar';
|
2
|
+
// eslint-disable-next-line deprecation/deprecation
|
2
3
|
export { ProgressField as ProgressField_unstable, progressFieldClassNames } from './ProgressField';
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"mappings":"AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,uBAAuB,EACvBC,6BAA6B,QACxB,eAAe;AAGtB;AACA,SAASC,aAAa,IAAIC,sBAAsB,EAAEC,uBAAuB,QAAQ,iBAAiB","names":["ProgressBar","progressBarClassNames","renderProgressBar_unstable","useProgressBar_unstable","useProgressBarStyles_unstable","ProgressField","ProgressField_unstable","progressFieldClassNames"],"sourceRoot":"../src/","sources":["packages/react-components/react-progress/src/index.ts"],"sourcesContent":["export {\n ProgressBar,\n progressBarClassNames,\n renderProgressBar_unstable,\n useProgressBar_unstable,\n useProgressBarStyles_unstable,\n} from './ProgressBar';\nexport type { ProgressBarProps, ProgressBarSlots, ProgressBarState } from './ProgressBar';\n\n// eslint-disable-next-line deprecation/deprecation\nexport { ProgressField as ProgressField_unstable, progressFieldClassNames } from './ProgressField';\n// eslint-disable-next-line deprecation/deprecation\nexport type { ProgressFieldProps as ProgressFieldProps_unstable } from './ProgressField';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/ProgressBar/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=ProgressBar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-progress/src/ProgressBar.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/ProgressBar/index';\n"]}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./components/ProgressField/index"], function (require, exports, tslib_1, index_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(index_1, exports);
|
5
|
+
});
|
6
|
+
//# sourceMappingURL=ProgressField.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ProgressField.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-progress/src/ProgressField.ts"],"names":[],"mappings":";;;IAAA,uCAAiD","sourcesContent":["export * from './components/ProgressField/index';\n"]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
define(["require", "exports", "react", "./useProgressBar", "./renderProgressBar", "./useProgressBarStyles"], function (require, exports, React, useProgressBar_1, renderProgressBar_1, useProgressBarStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.ProgressBar = void 0;
|
5
|
+
/**
|
6
|
+
* A ProgressBar bar shows the progression of a task.
|
7
|
+
*/
|
8
|
+
exports.ProgressBar = React.forwardRef(function (props, ref) {
|
9
|
+
var state = useProgressBar_1.useProgressBar_unstable(props, ref);
|
10
|
+
useProgressBarStyles_1.useProgressBarStyles_unstable(state);
|
11
|
+
return renderProgressBar_1.renderProgressBar_unstable(state);
|
12
|
+
});
|
13
|
+
exports.ProgressBar.displayName = 'ProgressBar';
|
14
|
+
});
|
15
|
+
//# sourceMappingURL=ProgressBar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-progress/src/components/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":";;;;IAOA;;OAEG;IACU,QAAA,WAAW,GAA0C,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAC5F,IAAM,KAAK,GAAG,wCAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAElD,oDAA6B,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,8CAA0B,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { useProgressBar_unstable } from './useProgressBar';\nimport { renderProgressBar_unstable } from './renderProgressBar';\nimport { useProgressBarStyles_unstable } from './useProgressBarStyles';\nimport type { ProgressBarProps } from './ProgressBar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * A ProgressBar bar shows the progression of a task.\n */\nexport const ProgressBar: ForwardRefComponent<ProgressBarProps> = React.forwardRef((props, ref) => {\n const state = useProgressBar_unstable(props, ref);\n\n useProgressBarStyles_unstable(state);\n return renderProgressBar_unstable(state);\n});\n\nProgressBar.displayName = 'ProgressBar';\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ProgressBar.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-progress/src/components/ProgressBar/ProgressBar.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ProgressBarSlots = {\n /**\n * The track behind the ProgressBar bar\n */\n root: NonNullable<Slot<'div'>>;\n /**\n * The filled portion of the ProgressBar bar. Animated in the indeterminate state, when no value is provided.\n */\n bar?: NonNullable<Slot<'div'>>;\n};\n\n/**\n * ProgressBar Props\n */\nexport type ProgressBarProps = Omit<ComponentProps<ProgressBarSlots>, 'size'> & {\n /**\n * The shape of the bar and track.\n * @default rounded\n */\n shape?: 'rounded' | 'square';\n /**\n * A decimal number between `0` and `1` (or between `0` and `max` if given),\n * which specifies how much of the task has been completed.\n *\n * If `undefined` (default), the ProgressBar will display an **indeterminate** state.\n */\n value?: number;\n /**\n * The maximum value, which indicates the task is complete.\n * The ProgressBar bar will be full when `value` equals `max`.\n * @default 1\n */\n max?: number;\n /**\n * The thickness of the ProgressBar bar\n * @default medium\n */\n thickness?: 'medium' | 'large';\n\n /**\n * The status of the ProgressBar bar. Changes the color of the bar.\n * @default brand\n */\n color?: 'brand' | 'success' | 'warning' | 'error';\n};\n\n/**\n * State used in rendering ProgressBar\n */\nexport type ProgressBarState = ComponentState<ProgressBarSlots> &\n Required<Pick<ProgressBarProps, 'max' | 'shape' | 'thickness'>> &\n Pick<ProgressBarProps, 'value' | 'color'>;\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
define(["require", "exports", "tslib", "./ProgressBar", "./ProgressBar.types", "./renderProgressBar", "./useProgressBar", "./useProgressBarStyles"], function (require, exports, tslib_1, ProgressBar_1, ProgressBar_types_1, renderProgressBar_1, useProgressBar_1, useProgressBarStyles_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
tslib_1.__exportStar(ProgressBar_1, exports);
|
5
|
+
tslib_1.__exportStar(ProgressBar_types_1, exports);
|
6
|
+
tslib_1.__exportStar(renderProgressBar_1, exports);
|
7
|
+
tslib_1.__exportStar(useProgressBar_1, exports);
|
8
|
+
tslib_1.__exportStar(useProgressBarStyles_1, exports);
|
9
|
+
});
|
10
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-progress/src/components/ProgressBar/index.ts"],"names":[],"mappings":";;;IAAA,6CAA8B;IAC9B,mDAAoC;IACpC,mDAAoC;IACpC,gDAAiC;IACjC,sDAAuC","sourcesContent":["export * from './ProgressBar';\nexport * from './ProgressBar.types';\nexport * from './renderProgressBar';\nexport * from './useProgressBar';\nexport * from './useProgressBarStyles';\n"]}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.renderProgressBar_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Render the final JSX of ProgressBar
|
7
|
+
*/
|
8
|
+
var renderProgressBar_unstable = function (state) {
|
9
|
+
var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
|
10
|
+
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), slots.bar && React.createElement(slots.bar, tslib_1.__assign({}, slotProps.bar)));
|
11
|
+
};
|
12
|
+
exports.renderProgressBar_unstable = renderProgressBar_unstable;
|
13
|
+
});
|
14
|
+
//# sourceMappingURL=renderProgressBar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderProgressBar.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-progress/src/components/ProgressBar/renderProgressBar.tsx"],"names":[],"mappings":";;;;IAIA;;OAEG;IACI,IAAM,0BAA0B,GAAG,UAAC,KAAuB;QAC1D,IAAA,KAAuB,0BAAQ,CAAmB,KAAK,CAAC,EAAtD,KAAK,WAAA,EAAE,SAAS,eAAsC,CAAC;QAC/D,OAAO,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,oBAAC,KAAK,CAAC,GAAG,uBAAK,SAAS,CAAC,GAAG,EAAI,CAAc,CAAC;IACtG,CAAC,CAAC;IAHW,QAAA,0BAA0B,8BAGrC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\n\n/**\n * Render the final JSX of ProgressBar\n */\nexport const renderProgressBar_unstable = (state: ProgressBarState) => {\n const { slots, slotProps } = getSlots<ProgressBarSlots>(state);\n return <slots.root {...slotProps.root}>{slots.bar && <slots.bar {...slotProps.bar} />}</slots.root>;\n};\n"]}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react-utilities"], function (require, exports, tslib_1, react_utilities_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useProgressBar_unstable = void 0;
|
5
|
+
/**
|
6
|
+
* Create the state required to render ProgressBar.
|
7
|
+
*
|
8
|
+
* The returned state can be modified with hooks such as useProgressBarStyles_unstable,
|
9
|
+
* before being passed to renderProgressBar_unstable.
|
10
|
+
*
|
11
|
+
* @param props - props from this instance of ProgressBar
|
12
|
+
* @param ref - reference to root HTMLElement of ProgressBar
|
13
|
+
*/
|
14
|
+
var useProgressBar_unstable = function (props, ref) {
|
15
|
+
// Props
|
16
|
+
var _a = props.color, color = _a === void 0 ? 'brand' : _a, _b = props.max, max = _b === void 0 ? 1.0 : _b, _c = props.shape, shape = _c === void 0 ? 'rounded' : _c, _d = props.thickness, thickness = _d === void 0 ? 'medium' : _d, value = props.value;
|
17
|
+
var root = react_utilities_1.getNativeElementProps('div', tslib_1.__assign({ ref: ref, role: 'progressbar', 'aria-valuemin': value !== undefined ? 0 : undefined, 'aria-valuemax': value !== undefined ? max : undefined, 'aria-valuenow': value }, props));
|
18
|
+
var bar = react_utilities_1.resolveShorthand(props.bar, {
|
19
|
+
required: true,
|
20
|
+
});
|
21
|
+
var state = {
|
22
|
+
color: color,
|
23
|
+
max: max,
|
24
|
+
shape: shape,
|
25
|
+
thickness: thickness,
|
26
|
+
value: value,
|
27
|
+
components: {
|
28
|
+
root: 'div',
|
29
|
+
bar: 'div',
|
30
|
+
},
|
31
|
+
root: root,
|
32
|
+
bar: bar,
|
33
|
+
};
|
34
|
+
return state;
|
35
|
+
};
|
36
|
+
exports.useProgressBar_unstable = useProgressBar_unstable;
|
37
|
+
});
|
38
|
+
//# sourceMappingURL=useProgressBar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useProgressBar.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-progress/src/components/ProgressBar/useProgressBar.tsx"],"names":[],"mappings":";;;;IAIA;;;;;;;;OAQG;IACI,IAAM,uBAAuB,GAAG,UAAC,KAAuB,EAAE,GAA2B;QAC1F,QAAQ;QACA,IAAA,KAA+E,KAAK,MAArE,EAAf,KAAK,mBAAG,OAAO,KAAA,EAAE,KAA8D,KAAK,IAA1D,EAAT,GAAG,mBAAG,GAAG,KAAA,EAAE,KAAmD,KAAK,MAAvC,EAAjB,KAAK,mBAAG,SAAS,KAAA,EAAE,KAAgC,KAAK,UAAjB,EAApB,SAAS,mBAAG,QAAQ,KAAA,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;QAE7F,IAAM,IAAI,GAAG,uCAAqB,CAAC,KAAK,qBACtC,GAAG,KAAA,EACH,IAAI,EAAE,aAAa,EACnB,eAAe,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EACpD,eAAe,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EACtD,eAAe,EAAE,KAAK,IACnB,KAAK,EACR,CAAC;QAEH,IAAM,GAAG,GAAG,kCAAgB,CAAC,KAAK,CAAC,GAAG,EAAE;YACtC,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,IAAM,KAAK,GAAqB;YAC9B,KAAK,OAAA;YACL,GAAG,KAAA;YACH,KAAK,OAAA;YACL,SAAS,WAAA;YACT,KAAK,OAAA;YACL,UAAU,EAAE;gBACV,IAAI,EAAE,KAAK;gBACX,GAAG,EAAE,KAAK;aACX;YACD,IAAI,MAAA;YACJ,GAAG,KAAA;SACJ,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAhCW,QAAA,uBAAuB,2BAgClC","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { ProgressBarProps, ProgressBarState } from './ProgressBar.types';\n\n/**\n * Create the state required to render ProgressBar.\n *\n * The returned state can be modified with hooks such as useProgressBarStyles_unstable,\n * before being passed to renderProgressBar_unstable.\n *\n * @param props - props from this instance of ProgressBar\n * @param ref - reference to root HTMLElement of ProgressBar\n */\nexport const useProgressBar_unstable = (props: ProgressBarProps, ref: React.Ref<HTMLElement>): ProgressBarState => {\n // Props\n const { color = 'brand', max = 1.0, shape = 'rounded', thickness = 'medium', value } = props;\n\n const root = getNativeElementProps('div', {\n ref,\n role: 'progressbar',\n 'aria-valuemin': value !== undefined ? 0 : undefined,\n 'aria-valuemax': value !== undefined ? max : undefined,\n 'aria-valuenow': value,\n ...props,\n });\n\n const bar = resolveShorthand(props.bar, {\n required: true,\n });\n\n const state: ProgressBarState = {\n color,\n max,\n shape,\n thickness,\n value,\n components: {\n root: 'div',\n bar: 'div',\n },\n root,\n bar,\n };\n\n return state;\n};\n"]}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@griffel/react", "@fluentui/react-theme", "@fluentui/react-shared-contexts"], function (require, exports, tslib_1, react_1, react_theme_1, react_shared_contexts_1) {
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.useProgressBarStyles_unstable = exports.progressBarClassNames = void 0;
|
5
|
+
exports.progressBarClassNames = {
|
6
|
+
root: 'fui-ProgressBar',
|
7
|
+
bar: 'fui-ProgressBar__bar',
|
8
|
+
};
|
9
|
+
// If the percentComplete is near 0, don't animate it.
|
10
|
+
// This prevents animations on reset to 0 scenarios.
|
11
|
+
var ZERO_THRESHOLD = 0.01;
|
12
|
+
var barThicknessValues = {
|
13
|
+
medium: '2px',
|
14
|
+
large: '4px',
|
15
|
+
};
|
16
|
+
var indeterminateProgressBar = {
|
17
|
+
'0%': {
|
18
|
+
left: '-100% /* @noflip */',
|
19
|
+
},
|
20
|
+
'100%': {
|
21
|
+
left: '100% /* @noflip */',
|
22
|
+
},
|
23
|
+
};
|
24
|
+
var indeterminateProgressBarRTL = {
|
25
|
+
'100%': {
|
26
|
+
right: '-100% /* @noflip */',
|
27
|
+
},
|
28
|
+
'0%': {
|
29
|
+
right: '100% /* @noflip */',
|
30
|
+
},
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* Styles for the root slot
|
34
|
+
*/
|
35
|
+
var useRootStyles = react_1.makeStyles({
|
36
|
+
root: tslib_1.__assign(tslib_1.__assign({ display: 'block', backgroundColor: react_theme_1.tokens.colorNeutralBackground6, justifySelf: 'stretch' }, react_1.shorthands.overflow('hidden')), { '@media screen and (forced-colors: active)': tslib_1.__assign({}, react_1.shorthands.borderBottom('1px', 'solid', 'CanvasText')) }),
|
37
|
+
rounded: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusMedium)),
|
38
|
+
square: tslib_1.__assign({}, react_1.shorthands.borderRadius(react_theme_1.tokens.borderRadiusNone)),
|
39
|
+
medium: {
|
40
|
+
height: barThicknessValues.medium,
|
41
|
+
},
|
42
|
+
large: {
|
43
|
+
height: barThicknessValues.large,
|
44
|
+
},
|
45
|
+
});
|
46
|
+
/**
|
47
|
+
* Styles for the ProgressBar bar
|
48
|
+
*/
|
49
|
+
var useBarStyles = react_1.makeStyles({
|
50
|
+
base: tslib_1.__assign({}, react_1.shorthands.borderRadius('inherit')),
|
51
|
+
medium: {
|
52
|
+
height: barThicknessValues.medium,
|
53
|
+
},
|
54
|
+
large: {
|
55
|
+
height: barThicknessValues.large,
|
56
|
+
},
|
57
|
+
nonZeroDeterminate: {
|
58
|
+
transitionProperty: 'width',
|
59
|
+
transitionDuration: '0.3s',
|
60
|
+
transitionTimingFunction: 'ease',
|
61
|
+
},
|
62
|
+
indeterminate: {
|
63
|
+
maxWidth: '33%',
|
64
|
+
position: 'relative',
|
65
|
+
backgroundImage: "linear-gradient(\n to right,\n " + react_theme_1.tokens.colorNeutralBackground6 + " 0%,\n " + react_theme_1.tokens.colorTransparentBackground + " 50%,\n " + react_theme_1.tokens.colorNeutralBackground6 + " 100%\n )",
|
66
|
+
animationName: indeterminateProgressBar,
|
67
|
+
animationDuration: '3s',
|
68
|
+
animationIterationCount: 'infinite',
|
69
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
70
|
+
animationDuration: '0.01ms',
|
71
|
+
animationIterationCount: '1',
|
72
|
+
},
|
73
|
+
},
|
74
|
+
rtl: {
|
75
|
+
animationName: indeterminateProgressBarRTL,
|
76
|
+
},
|
77
|
+
brand: {
|
78
|
+
backgroundColor: react_theme_1.tokens.colorCompoundBrandBackground,
|
79
|
+
'@media screen and (forced-colors: active)': {
|
80
|
+
backgroundColor: 'Highlight',
|
81
|
+
},
|
82
|
+
},
|
83
|
+
error: {
|
84
|
+
backgroundColor: react_theme_1.tokens.colorPaletteRedBackground3,
|
85
|
+
},
|
86
|
+
warning: {
|
87
|
+
backgroundColor: react_theme_1.tokens.colorPaletteDarkOrangeBackground3,
|
88
|
+
},
|
89
|
+
success: {
|
90
|
+
backgroundColor: react_theme_1.tokens.colorPaletteGreenBackground3,
|
91
|
+
},
|
92
|
+
});
|
93
|
+
/**
|
94
|
+
* Apply styling to the ProgressBar slots based on the state
|
95
|
+
*/
|
96
|
+
var useProgressBarStyles_unstable = function (state) {
|
97
|
+
var color = state.color, max = state.max, shape = state.shape, thickness = state.thickness, value = state.value;
|
98
|
+
var rootStyles = useRootStyles();
|
99
|
+
var barStyles = useBarStyles();
|
100
|
+
var dir = react_shared_contexts_1.useFluent_unstable().dir;
|
101
|
+
state.root.className = react_1.mergeClasses(exports.progressBarClassNames.root, rootStyles.root, rootStyles[shape], rootStyles[thickness], state.root.className);
|
102
|
+
if (state.bar) {
|
103
|
+
state.bar.className = react_1.mergeClasses(exports.progressBarClassNames.bar, barStyles.base, barStyles.brand, value === undefined && barStyles.indeterminate, value === undefined && dir === 'rtl' && barStyles.rtl, barStyles[thickness], value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate, color && value !== undefined && barStyles[color], state.bar.className);
|
104
|
+
}
|
105
|
+
if (state.bar && value !== undefined) {
|
106
|
+
state.bar.style = tslib_1.__assign({ width: Math.min(100, Math.max(0, (value / max) * 100)) + '%' }, state.bar.style);
|
107
|
+
}
|
108
|
+
return state;
|
109
|
+
};
|
110
|
+
exports.useProgressBarStyles_unstable = useProgressBarStyles_unstable;
|
111
|
+
});
|
112
|
+
//# sourceMappingURL=useProgressBarStyles.js.map
|