@fluentui/react-progress 9.0.0-alpha.9 → 9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +319 -1
- package/CHANGELOG.md +132 -2
- package/README.md +9 -17
- package/dist/index.d.ts +20 -11
- package/lib/components/ProgressBar/ProgressBar.js +5 -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 +7 -6
- package/lib/components/ProgressBar/useProgressBar.js.map +1 -1
- package/lib/components/ProgressBar/useProgressBarStyles.js +65 -82
- 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/utils/clampMax.js +11 -0
- package/lib/utils/clampMax.js.map +1 -0
- package/lib/utils/clampValue.js +18 -0
- package/lib/utils/clampValue.js.map +1 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/index.js.map +1 -0
- 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 +17 -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 +41 -0
- package/lib-amd/components/ProgressBar/useProgressBar.js.map +1 -0
- package/lib-amd/components/ProgressBar/useProgressBarStyles.js +107 -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-amd/utils/clampMax.js +17 -0
- package/lib-amd/utils/clampMax.js.map +1 -0
- package/lib-amd/utils/clampValue.js +24 -0
- package/lib-amd/utils/clampValue.js.map +1 -0
- package/lib-amd/utils/index.js +7 -0
- package/lib-amd/utils/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 +5 -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 +7 -9
- package/lib-commonjs/components/ProgressBar/useProgressBar.js.map +1 -1
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.js +65 -87
- 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/lib-commonjs/utils/clampMax.js +18 -0
- package/lib-commonjs/utils/clampMax.js.map +1 -0
- package/lib-commonjs/utils/clampValue.js +25 -0
- package/lib-commonjs/utils/clampValue.js.map +1 -0
- package/lib-commonjs/utils/index.js +9 -0
- package/lib-commonjs/utils/index.js.map +1 -0
- package/package.json +9 -9
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-progress/src/components/ProgressBar/renderProgressBar.tsx"],"
|
1
|
+
{"version":3,"names":["React","getSlots","renderProgressBar_unstable","state","slots","slotProps","createElement","root","bar"],"sources":["../src/packages/react-components/react-progress/src/components/ProgressBar/renderProgressBar.tsx"],"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"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAGpD;;;AAGA,OAAO,MAAMC,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,QAAQ,CAAmBE,KAAK,CAAC;EAC9D,oBAAOH,KAAA,CAAAM,aAAA,CAACF,KAAK,CAACG,IAAI;IAAA,GAAKF,SAAS,CAACE;EAAI,GAAGH,KAAK,CAACI,GAAG,iBAAIR,KAAA,CAAAM,aAAA,CAACF,KAAK,CAACI,GAAG;IAAA,GAAKH,SAAS,CAACG;EAAG,EAAI,CAAc;AACrG,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
|
2
|
+
import { clampValue, clampMax } from '../../utils/index';
|
2
3
|
/**
|
3
4
|
* Create the state required to render ProgressBar.
|
4
5
|
*
|
@@ -8,16 +9,16 @@ import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utiliti
|
|
8
9
|
* @param props - props from this instance of ProgressBar
|
9
10
|
* @param ref - reference to root HTMLElement of ProgressBar
|
10
11
|
*/
|
11
|
-
|
12
12
|
export const useProgressBar_unstable = (props, ref) => {
|
13
|
+
var _a;
|
13
14
|
// Props
|
14
15
|
const {
|
15
|
-
|
16
|
+
color = 'brand',
|
16
17
|
shape = 'rounded',
|
17
|
-
thickness = 'medium'
|
18
|
-
validationState,
|
19
|
-
value
|
18
|
+
thickness = 'medium'
|
20
19
|
} = props;
|
20
|
+
const max = clampMax((_a = props.max) !== null && _a !== void 0 ? _a : 1);
|
21
|
+
const value = clampValue(props.value, max);
|
21
22
|
const root = getNativeElementProps('div', {
|
22
23
|
ref,
|
23
24
|
role: 'progressbar',
|
@@ -30,11 +31,11 @@ export const useProgressBar_unstable = (props, ref) => {
|
|
30
31
|
required: true
|
31
32
|
});
|
32
33
|
const state = {
|
34
|
+
color,
|
33
35
|
max,
|
34
36
|
shape,
|
35
37
|
thickness,
|
36
38
|
value,
|
37
|
-
validationState,
|
38
39
|
components: {
|
39
40
|
root: 'div',
|
40
41
|
bar: 'div'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["getNativeElementProps","resolveShorthand","clampValue","clampMax","useProgressBar_unstable","props","ref","color","shape","thickness","max","_a","value","root","role","undefined","bar","required","state","components"],"sources":["../src/packages/react-components/react-progress/src/components/ProgressBar/useProgressBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport { clampValue, clampMax } from '../../utils/index';\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', shape = 'rounded', thickness = 'medium' } = props;\n const max = clampMax(props.max ?? 1);\n const value = clampValue(props.value, max);\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"],"mappings":"AACA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,2BAA2B;AACnF,SAASC,UAAU,EAAEC,QAAQ,QAAQ,mBAAmB;AAGxD;;;;;;;;;AASA,OAAO,MAAMC,uBAAuB,GAAGA,CAACC,KAAuB,EAAEC,GAA2B,KAAsB;;EAChH;EACA,MAAM;IAAEC,KAAK,GAAG,OAAO;IAAEC,KAAK,GAAG,SAAS;IAAEC,SAAS,GAAG;EAAQ,CAAE,GAAGJ,KAAK;EAC1E,MAAMK,GAAG,GAAGP,QAAQ,CAAC,CAAAQ,EAAA,GAAAN,KAAK,CAACK,GAAG,cAAAC,EAAA,cAAAA,EAAA,GAAI,CAAC,CAAC;EACpC,MAAMC,KAAK,GAAGV,UAAU,CAACG,KAAK,CAACO,KAAK,EAAEF,GAAG,CAAC;EAE1C,MAAMG,IAAI,GAAGb,qBAAqB,CAAC,KAAK,EAAE;IACxCM,GAAG;IACHQ,IAAI,EAAE,aAAa;IACnB,eAAe,EAAEF,KAAK,KAAKG,SAAS,GAAG,CAAC,GAAGA,SAAS;IACpD,eAAe,EAAEH,KAAK,KAAKG,SAAS,GAAGL,GAAG,GAAGK,SAAS;IACtD,eAAe,EAAEH,KAAK;IACtB,GAAGP;GACJ,CAAC;EAEF,MAAMW,GAAG,GAAGf,gBAAgB,CAACI,KAAK,CAACW,GAAG,EAAE;IACtCC,QAAQ,EAAE;GACX,CAAC;EAEF,MAAMC,KAAK,GAAqB;IAC9BX,KAAK;IACLG,GAAG;IACHF,KAAK;IACLC,SAAS;IACTG,KAAK;IACLO,UAAU,EAAE;MACVN,IAAI,EAAE,KAAK;MACXG,GAAG,EAAE;KACN;IACDH,IAAI;IACJG;GACD;EAED,OAAOE,KAAK;AACd,CAAC"}
|
@@ -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,101 @@ 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
|
-
"tu2nte": "f1mcb20s",
|
44
|
-
"y0r1ed": "fek7wd8"
|
35
|
+
root: {
|
36
|
+
mc9l5x: "ftgm304",
|
37
|
+
De3pzq: "f18f03hv",
|
38
|
+
a9b677: "fly5x3f",
|
39
|
+
B68tc82: "f1p9o1ba",
|
40
|
+
Bmxbyg5: "f1sil6mw",
|
41
|
+
Bpep1pd: "fu42dvn"
|
45
42
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
rounded: {
|
44
|
+
Bbmb7ep: ["f1aa9q02", "f16jpd5f"],
|
45
|
+
Beyfa6y: ["f16jpd5f", "f1aa9q02"],
|
46
|
+
B7oj6ja: ["f1jar5jt", "fyu767a"],
|
47
|
+
Btl43ni: ["fyu767a", "f1jar5jt"]
|
51
48
|
},
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
square: {
|
50
|
+
Bbmb7ep: ["fzi6hpg", "fyowgf4"],
|
51
|
+
Beyfa6y: ["fyowgf4", "fzi6hpg"],
|
52
|
+
B7oj6ja: ["f3fg2lr", "f13av6d4"],
|
53
|
+
Btl43ni: ["f13av6d4", "f3fg2lr"]
|
57
54
|
},
|
58
|
-
|
59
|
-
|
55
|
+
medium: {
|
56
|
+
Bqenvij: "f4t8t6x"
|
60
57
|
},
|
61
|
-
|
62
|
-
|
58
|
+
large: {
|
59
|
+
Bqenvij: "f6ywr7j"
|
63
60
|
}
|
64
61
|
}, {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
}], ["@media screen and (forced-colors: active){.f1mcb20s{border-bottom-style:solid;}}", {
|
69
|
-
"m": "screen and (forced-colors: active)"
|
70
|
-
}], ["@media screen and (forced-colors: active){.fek7wd8{border-bottom-color:CanvasText;}}", {
|
71
|
-
"m": "screen and (forced-colors: active)"
|
62
|
+
d: [".ftgm304{display:block;}", ".f18f03hv{background-color:var(--colorNeutralBackground6);}", ".fly5x3f{width:100%;}", ".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;}"],
|
63
|
+
m: [["@media screen and (forced-colors: active){.fu42dvn{background-color:CanvasText;}}", {
|
64
|
+
m: "screen and (forced-colors: active)"
|
72
65
|
}]]
|
73
66
|
});
|
74
67
|
/**
|
75
68
|
* Styles for the ProgressBar bar
|
76
69
|
*/
|
77
|
-
|
78
|
-
|
79
70
|
const useBarStyles = /*#__PURE__*/__styles({
|
80
|
-
|
81
|
-
|
82
|
-
"
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
},
|
88
|
-
"medium": {
|
89
|
-
"Bqenvij": "f4t8t6x"
|
71
|
+
base: {
|
72
|
+
Bpep1pd: "f1neahkh",
|
73
|
+
Bbmb7ep: ["f1d9uwra", "fzibvwi"],
|
74
|
+
Beyfa6y: ["fzibvwi", "f1d9uwra"],
|
75
|
+
B7oj6ja: ["fuoumxm", "f1vtqnvc"],
|
76
|
+
Btl43ni: ["f1vtqnvc", "fuoumxm"],
|
77
|
+
Bqenvij: "f1l02sjl"
|
90
78
|
},
|
91
|
-
|
92
|
-
|
79
|
+
nonZeroDeterminate: {
|
80
|
+
Bmy1vo4: "fjt6zfz",
|
81
|
+
B3o57yi: "f1wofebd",
|
82
|
+
Bkqvd7p: "fv71qf3"
|
93
83
|
},
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
"
|
84
|
+
indeterminate: {
|
85
|
+
B2u0y6b: "fa0wk36",
|
86
|
+
qhf8xq: "f10pi13n",
|
87
|
+
Bcmaq0h: ["fpo0yib", "f1u5hf6c"],
|
88
|
+
Bv12yb3: "f1jk3tlg",
|
89
|
+
vin17d: "f1a27w2r",
|
90
|
+
w3vfg9: "f1cpbl36",
|
91
|
+
Gqtpxc: "f4akx1t",
|
92
|
+
B3vm3ge: "f18p5put"
|
98
93
|
},
|
99
|
-
|
100
|
-
|
101
|
-
"qhf8xq": "f10pi13n",
|
102
|
-
"Bcmaq0h": ["fpo0yib", "f1u5hf6c"],
|
103
|
-
"Bv12yb3": "f1h4fm7e",
|
104
|
-
"vin17d": "f1a27w2r",
|
105
|
-
"w3vfg9": "f1cpbl36",
|
106
|
-
"Gqtpxc": "f4akx1t",
|
107
|
-
"B3vm3ge": "f18p5put"
|
94
|
+
rtl: {
|
95
|
+
Bv12yb3: "fjhwsai"
|
108
96
|
},
|
109
|
-
|
110
|
-
|
97
|
+
brand: {
|
98
|
+
De3pzq: "ftywsgz"
|
111
99
|
},
|
112
|
-
|
113
|
-
|
100
|
+
error: {
|
101
|
+
De3pzq: "fdl5y0r"
|
114
102
|
},
|
115
|
-
|
116
|
-
|
103
|
+
warning: {
|
104
|
+
De3pzq: "f1s438gw"
|
117
105
|
},
|
118
|
-
|
119
|
-
|
106
|
+
success: {
|
107
|
+
De3pzq: "flxk52p"
|
120
108
|
}
|
121
109
|
}, {
|
122
|
-
|
123
|
-
|
124
|
-
"m": "screen and (forced-colors: active)"
|
110
|
+
m: [["@media screen and (forced-colors: active){.f1neahkh{background-color:Highlight;}}", {
|
111
|
+
m: "screen and (forced-colors: active)"
|
125
112
|
}], ["@media screen and (prefers-reduced-motion: reduce){.f4akx1t{-webkit-animation-duration:0.01ms;animation-duration:0.01ms;}}", {
|
126
|
-
|
113
|
+
m: "screen and (prefers-reduced-motion: reduce)"
|
127
114
|
}], ["@media screen and (prefers-reduced-motion: reduce){.f18p5put{-webkit-animation-iteration-count:1;animation-iteration-count:1;}}", {
|
128
|
-
|
115
|
+
m: "screen and (prefers-reduced-motion: reduce)"
|
129
116
|
}]],
|
130
|
-
|
117
|
+
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;}", ".f1l02sjl{height:100%;}", ".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);}"],
|
118
|
+
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%;}}"]
|
131
119
|
});
|
132
120
|
/**
|
133
121
|
* Apply styling to the ProgressBar slots based on the state
|
134
122
|
*/
|
135
|
-
|
136
|
-
|
137
123
|
export const useProgressBarStyles_unstable = state => {
|
138
124
|
const {
|
125
|
+
color,
|
139
126
|
max,
|
140
127
|
shape,
|
141
128
|
thickness,
|
142
|
-
validationState,
|
143
129
|
value
|
144
130
|
} = state;
|
145
131
|
const rootStyles = useRootStyles();
|
@@ -148,18 +134,15 @@ export const useProgressBarStyles_unstable = state => {
|
|
148
134
|
dir
|
149
135
|
} = useFluent();
|
150
136
|
state.root.className = mergeClasses(progressBarClassNames.root, rootStyles.root, rootStyles[shape], rootStyles[thickness], state.root.className);
|
151
|
-
|
152
137
|
if (state.bar) {
|
153
|
-
state.bar.className = mergeClasses(progressBarClassNames.bar, barStyles.base, value === undefined && barStyles.indeterminate, value === undefined && dir === 'rtl' && barStyles.rtl,
|
138
|
+
state.bar.className = mergeClasses(progressBarClassNames.bar, barStyles.base, barStyles.brand, value === undefined && barStyles.indeterminate, value === undefined && dir === 'rtl' && barStyles.rtl, value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate, color && value !== undefined && barStyles[color], state.bar.className);
|
154
139
|
}
|
155
|
-
|
156
140
|
if (state.bar && value !== undefined) {
|
157
141
|
state.bar.style = {
|
158
142
|
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
|
159
143
|
...state.bar.style
|
160
144
|
};
|
161
145
|
}
|
162
|
-
|
163
146
|
return state;
|
164
147
|
};
|
165
148
|
//# sourceMappingURL=useProgressBarStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","tokens","useFluent_unstable","useFluent","progressBarClassNames","root","bar","ZERO_THRESHOLD","barThicknessValues","medium","large","indeterminateProgressBar","left","indeterminateProgressBarRTL","right","useRootStyles","mc9l5x","De3pzq","a9b677","B68tc82","Bmxbyg5","Bpep1pd","rounded","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","square","Bqenvij","d","m","useBarStyles","base","nonZeroDeterminate","Bmy1vo4","B3o57yi","Bkqvd7p","indeterminate","B2u0y6b","qhf8xq","Bcmaq0h","Bv12yb3","vin17d","w3vfg9","Gqtpxc","B3vm3ge","rtl","brand","error","warning","success","k","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","rootStyles","barStyles","dir","className","undefined","style","width","Math","min"],"sources":["../src/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 width: '100%',\n ...shorthands.overflow('hidden'),\n\n '@media screen and (forced-colors: active)': {\n backgroundColor: '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 '@media screen and (forced-colors: active)': {\n backgroundColor: 'Highlight',\n },\n ...shorthands.borderRadius('inherit'),\n height: '100%',\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 },\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 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"],"mappings":"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"}
|
@@ -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,"sources":["packages/react-components/react-progress/src/components/ProgressField/ProgressField.tsx"],"
|
1
|
+
{"version":3,"names":["getDeprecatedFieldClassNames","makeDeprecatedField","ProgressBar","progressBarClassNames","progressFieldClassNames","root","ProgressField","displayName","mapProps","props","control","validationState"],"sources":["../src/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"],"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"}
|
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,"sources":["packages/react-components/react-progress/src/index.ts"],"
|
1
|
+
{"version":3,"names":["ProgressBar","progressBarClassNames","renderProgressBar_unstable","useProgressBar_unstable","useProgressBarStyles_unstable","ProgressField","ProgressField_unstable","progressFieldClassNames"],"sources":["../src/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"],"mappings":"AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,uBAAuB,EACvBC,6BAA6B,QACxB,eAAe;AAGtB;AACA,SAASC,aAAa,IAAIC,sBAAsB,EAAEC,uBAAuB,QAAQ,iBAAiB"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export const clampMax = max => {
|
2
|
+
const internalMax = max <= 0 ? 1 : max;
|
3
|
+
if (process.env.NODE_ENV !== 'production') {
|
4
|
+
if (max <= 0) {
|
5
|
+
// eslint-disable-next-line no-console
|
6
|
+
console.error(`The prop 'max' must be greater than 0. Received max: ${max}`);
|
7
|
+
}
|
8
|
+
}
|
9
|
+
return internalMax;
|
10
|
+
};
|
11
|
+
//# sourceMappingURL=clampMax.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["clampMax","max","internalMax","process","env","NODE_ENV","console","error"],"sources":["../src/packages/react-components/react-progress/src/utils/clampMax.ts"],"sourcesContent":["export const clampMax = (max: number): number => {\n const internalMax = max <= 0 ? 1 : max;\n\n if (process.env.NODE_ENV !== 'production') {\n if (max <= 0) {\n // eslint-disable-next-line no-console\n console.error(`The prop 'max' must be greater than 0. Received max: ${max}`);\n }\n }\n return internalMax;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,QAAQ,GAAIC,GAAW,IAAY;EAC9C,MAAMC,WAAW,GAAGD,GAAG,IAAI,CAAC,GAAG,CAAC,GAAGA,GAAG;EAEtC,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIJ,GAAG,IAAI,CAAC,EAAE;MACZ;MACAK,OAAO,CAACC,KAAK,CAAC,wDAAwDN,GAAG,EAAE,CAAC;;;EAGhF,OAAOC,WAAW;AACpB,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export const clampValue = (value, max) => {
|
2
|
+
if (value === undefined) {
|
3
|
+
return value;
|
4
|
+
}
|
5
|
+
const internalValue = value < 0 ? 0 : value > max ? max : value;
|
6
|
+
if (process.env.NODE_ENV !== 'production') {
|
7
|
+
if (value < 0) {
|
8
|
+
// eslint-disable-next-line no-console
|
9
|
+
console.error(`The prop 'value' must be greater than or equal to zero. Received value: ${value}`);
|
10
|
+
}
|
11
|
+
if (value > max) {
|
12
|
+
// eslint-disable-next-line no-console
|
13
|
+
console.error(`The prop 'value' must be less than or equal to 'max'. Received value: ${value}, max: ${max}`);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
return internalValue;
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=clampValue.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["clampValue","value","max","undefined","internalValue","process","env","NODE_ENV","console","error"],"sources":["../src/packages/react-components/react-progress/src/utils/clampValue.ts"],"sourcesContent":["export const clampValue = (value: number | undefined, max: number): number | undefined => {\n if (value === undefined) {\n return value;\n }\n const internalValue = value < 0 ? 0 : value > max ? max : value;\n\n if (process.env.NODE_ENV !== 'production') {\n if (value < 0) {\n // eslint-disable-next-line no-console\n console.error(`The prop 'value' must be greater than or equal to zero. Received value: ${value}`);\n }\n if (value > max) {\n // eslint-disable-next-line no-console\n console.error(`The prop 'value' must be less than or equal to 'max'. Received value: ${value}, max: ${max}`);\n }\n }\n return internalValue;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAGA,CAACC,KAAyB,EAAEC,GAAW,KAAwB;EACvF,IAAID,KAAK,KAAKE,SAAS,EAAE;IACvB,OAAOF,KAAK;;EAEd,MAAMG,aAAa,GAAGH,KAAK,GAAG,CAAC,GAAG,CAAC,GAAGA,KAAK,GAAGC,GAAG,GAAGA,GAAG,GAAGD,KAAK;EAE/D,IAAII,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIN,KAAK,GAAG,CAAC,EAAE;MACb;MACAO,OAAO,CAACC,KAAK,CAAC,2EAA2ER,KAAK,EAAE,CAAC;;IAEnG,IAAIA,KAAK,GAAGC,GAAG,EAAE;MACf;MACAM,OAAO,CAACC,KAAK,CAAC,yEAAyER,KAAK,UAAUC,GAAG,EAAE,CAAC;;;EAGhH,OAAOE,aAAa;AACtB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-progress/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC","sourcesContent":["export * from './clampMax';\nexport * from './clampValue';\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,17 @@
|
|
1
|
+
define(["require", "exports", "react", "./useProgressBar", "./renderProgressBar", "./useProgressBarStyles", "@fluentui/react-shared-contexts"], function (require, exports, React, useProgressBar_1, renderProgressBar_1, useProgressBarStyles_1, react_shared_contexts_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
|
+
var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useProgressBarStyles_unstable;
|
12
|
+
useCustomStyles(state);
|
13
|
+
return renderProgressBar_1.renderProgressBar_unstable(state);
|
14
|
+
});
|
15
|
+
exports.ProgressBar.displayName = 'ProgressBar';
|
16
|
+
});
|
17
|
+
//# 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":";;;;IAQA;;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;QAE7B,IAA+B,eAAe,GAAK,oDAA4B,EAAE,8BAAnC,CAAoC;QAC1F,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,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';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\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\n const { useProgressBarStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\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,41 @@
|
|
1
|
+
define(["require", "exports", "tslib", "@fluentui/react-utilities", "../../utils/index"], function (require, exports, tslib_1, react_utilities_1, index_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
|
+
var _a;
|
16
|
+
// Props
|
17
|
+
var _b = props.color, color = _b === void 0 ? 'brand' : _b, _c = props.shape, shape = _c === void 0 ? 'rounded' : _c, _d = props.thickness, thickness = _d === void 0 ? 'medium' : _d;
|
18
|
+
var max = index_1.clampMax((_a = props.max) !== null && _a !== void 0 ? _a : 1);
|
19
|
+
var value = index_1.clampValue(props.value, max);
|
20
|
+
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));
|
21
|
+
var bar = react_utilities_1.resolveShorthand(props.bar, {
|
22
|
+
required: true,
|
23
|
+
});
|
24
|
+
var state = {
|
25
|
+
color: color,
|
26
|
+
max: max,
|
27
|
+
shape: shape,
|
28
|
+
thickness: thickness,
|
29
|
+
value: value,
|
30
|
+
components: {
|
31
|
+
root: 'div',
|
32
|
+
bar: 'div',
|
33
|
+
},
|
34
|
+
root: root,
|
35
|
+
bar: bar,
|
36
|
+
};
|
37
|
+
return state;
|
38
|
+
};
|
39
|
+
exports.useProgressBar_unstable = useProgressBar_unstable;
|
40
|
+
});
|
41
|
+
//# 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":";;;;IAKA;;;;;;;;OAQG;IACI,IAAM,uBAAuB,GAAG,UAAC,KAAuB,EAAE,GAA2B;;QAC1F,QAAQ;QACA,IAAA,KAA6D,KAAK,MAAnD,EAAf,KAAK,mBAAG,OAAO,KAAA,EAAE,KAA4C,KAAK,MAAhC,EAAjB,KAAK,mBAAG,SAAS,KAAA,EAAE,KAAyB,KAAK,UAAV,EAApB,SAAS,mBAAG,QAAQ,KAAA,CAAW;QAC3E,IAAM,GAAG,GAAG,gBAAQ,CAAC,MAAA,KAAK,CAAC,GAAG,mCAAI,CAAC,CAAC,CAAC;QACrC,IAAM,KAAK,GAAG,kBAAU,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE3C,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;IAlCW,QAAA,uBAAuB,2BAkClC","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport { clampValue, clampMax } from '../../utils/index';\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', shape = 'rounded', thickness = 'medium' } = props;\n const max = clampMax(props.max ?? 1);\n const value = clampValue(props.value, max);\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"]}
|