@fluentui/react-progress 9.74.9-experimental.menu-disable-autofocus.20261008-e9914a95c6.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -10
- package/README.md +6 -0
- package/lib/components/ProgressBar/ProgressBar.js.map +1 -1
- package/lib/components/ProgressBar/ProgressBar.module.css +89 -0
- package/lib/components/ProgressBar/ProgressBar.types.js.map +1 -1
- package/lib/components/ProgressBar/index.js.map +1 -1
- package/lib/components/ProgressBar/progressBarMotions.js.map +1 -1
- package/lib/components/ProgressBar/renderProgressBar.js +2 -2
- package/lib/components/ProgressBar/renderProgressBar.js.map +1 -1
- package/lib/components/ProgressBar/useProgressBar.js +1 -1
- package/lib/components/ProgressBar/useProgressBar.js.map +1 -1
- package/lib/components/ProgressBar/useProgressBarStyles.styles.css.js +20 -0
- package/lib/components/ProgressBar/useProgressBarStyles.styles.css.js.map +1 -0
- package/lib/components/ProgressBar/useProgressBarStyles.styles.raw.css.js +20 -0
- package/lib/components/ProgressBar/useProgressBarStyles.styles.raw.css.js.map +1 -0
- package/lib/components/ProgressBar/useProgressBarStyles.styles.raw.js.map +1 -1
- package/lib/utils/clampMax.js.map +1 -1
- package/lib/utils/clampValue.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib-commonjs/ProgressBar.cjs +7 -7
- package/lib-commonjs/components/ProgressBar/ProgressBar.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/ProgressBar.module.css +89 -0
- package/lib-commonjs/components/ProgressBar/ProgressBar.types.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/index.cjs +7 -7
- package/lib-commonjs/components/ProgressBar/index.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/progressBarMotions.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/renderProgressBar.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/useProgressBar.cjs +4 -4
- package/lib-commonjs/components/ProgressBar/useProgressBar.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.cjs +3 -3
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.css.cjs +39 -0
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.raw.css.cjs +39 -0
- package/lib-commonjs/components/ProgressBar/useProgressBarStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/index.cjs +7 -7
- package/lib-commonjs/utils/clampMax.cjs.map +1 -1
- package/lib-commonjs/utils/clampValue.cjs.map +1 -1
- package/lib-commonjs/utils/index.cjs +3 -3
- package/lib-commonjs/utils/index.cjs.map +1 -1
- package/package.json +12 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-progress
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Sat, 31 Oct 2026 11:08:52 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.
|
|
7
|
+
## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-progress_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Sat, 31 Oct 2026 11:08:52 GMT
|
|
10
10
|
|
|
11
11
|
### Changes
|
|
12
12
|
|
|
13
|
-
- Release 9.
|
|
14
|
-
- Bump @fluentui/react-field to v9.
|
|
15
|
-
- Bump @fluentui/react-jsx-runtime to v9.
|
|
16
|
-
- Bump @fluentui/react-motion to v9.
|
|
17
|
-
- Bump @fluentui/react-shared-contexts to v9.
|
|
18
|
-
- Bump @fluentui/react-theme to v9.
|
|
19
|
-
- Bump @fluentui/react-utilities to v9.
|
|
13
|
+
- Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
|
|
14
|
+
- Bump @fluentui/react-field to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-motion to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-theme to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
|
|
21
|
+
## [9.5.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-progress_v9.5.7)
|
|
22
|
+
|
|
23
|
+
Mon, 19 Oct 2026 16:49:01 GMT
|
|
24
|
+
|
|
25
|
+
### Patches
|
|
26
|
+
|
|
27
|
+
- Bump @fluentui/react-field to v9.5.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
28
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
29
|
+
- Bump @fluentui/react-motion to v9.16.5 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
30
|
+
- Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
31
|
|
|
21
32
|
## [9.5.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-progress_v9.5.6)
|
|
22
33
|
|
package/README.md
CHANGED
|
@@ -42,3 +42,9 @@ const FieldExample = () => {
|
|
|
42
42
|
);
|
|
43
43
|
};
|
|
44
44
|
```
|
|
45
|
+
|
|
46
|
+
## Opt-in CSS Modules styles
|
|
47
|
+
|
|
48
|
+
CSS Modules alternatives are available for `ProgressBar`. The default exports and component imports continue to use Griffel.
|
|
49
|
+
|
|
50
|
+
To opt in, configure your bundler to replace each `use<Component>Styles.styles.js` module with its adjacent `use<Component>Styles.styles.css.js` alternative (or `.styles.ts` with `.styles.css.ts` for source builds). Apply the replacement consistently to client and server bundles. The CSS loader must provide a default class-name map and retain the adjacent `.module.css` asset, including CSS from dependencies. All component rules are in `@layer fluentui` and use the theme custom properties supplied by `FluentProvider`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useProgressBar_unstable } from './useProgressBar';\nimport { renderProgressBar_unstable } from './renderProgressBar';\nimport { useProgressBarStyles_unstable } from './useProgressBarStyles.styles';\nimport type { ProgressBarProps } from './ProgressBar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_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 useCustomStyleHook_unstable('useProgressBarStyles_unstable')(state);\n\n return renderProgressBar_unstable(state);\n});\n\nProgressBar.displayName = 'ProgressBar';\n"],"names":["React","useProgressBar_unstable","renderProgressBar_unstable","useProgressBarStyles_unstable","useCustomStyleHook_unstable","ProgressBar","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,yBAAsB;AACjE,SAASC,6BAA6B,QAAQ,mCAAgC;AAG9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,QAAQR,wBAAwBM,OAAOC;IAE7CL,8BAA8BM;IAE9BL,4BAA4B,iCAAiCK;IAE7D,OAAOP,2BAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root {
|
|
3
|
+
display: block;
|
|
4
|
+
background-color: var(--colorNeutralBackground6);
|
|
5
|
+
width: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.rounded {
|
|
10
|
+
border-radius: var(--borderRadiusMedium);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.square {
|
|
14
|
+
border-radius: var(--borderRadiusNone);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.medium {
|
|
18
|
+
height: var(--strokeWidthThick);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.large {
|
|
22
|
+
height: var(--spacingHorizontalXS);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.bar {
|
|
26
|
+
border-radius: inherit;
|
|
27
|
+
height: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.bar {
|
|
31
|
+
background-color: var(--colorCompoundBrandBackground);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.indeterminate {
|
|
35
|
+
max-width: 33%;
|
|
36
|
+
position: relative;
|
|
37
|
+
background-image: linear-gradient(
|
|
38
|
+
to right,
|
|
39
|
+
var(--colorNeutralBackground6) 0%,
|
|
40
|
+
var(--colorTransparentBackground) 50%,
|
|
41
|
+
var(--colorNeutralBackground6) 100%
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.indeterminate:where(:dir(rtl)) {
|
|
46
|
+
background-image: linear-gradient(
|
|
47
|
+
to left,
|
|
48
|
+
var(--colorNeutralBackground6) 0%,
|
|
49
|
+
var(--colorTransparentBackground) 50%,
|
|
50
|
+
var(--colorNeutralBackground6) 100%
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nonZeroDeterminate {
|
|
55
|
+
transition-property: width;
|
|
56
|
+
transition-duration: 0.3s;
|
|
57
|
+
transition-timing-function: ease;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.error {
|
|
61
|
+
background-color: var(--colorPaletteRedBackground3);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.warning {
|
|
65
|
+
background-color: var(--colorPaletteDarkOrangeBackground3);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.success {
|
|
69
|
+
background-color: var(--colorPaletteGreenBackground3);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media screen and (forced-colors: active) {
|
|
73
|
+
.root {
|
|
74
|
+
background-color: CanvasText;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media screen and (forced-colors: active) {
|
|
79
|
+
.bar {
|
|
80
|
+
background-color: Highlight;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
85
|
+
.indeterminate {
|
|
86
|
+
max-width: 100%;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/ProgressBar.types.ts"],"sourcesContent":["import type { MotionSlotProps } from '@fluentui/react-motion';\nimport 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 * Motion slot for the indeterminate animation. Pass `null` to disable the animation.\n */\n indeterminateMotion?: Slot<MotionSlotProps>;\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 * ProgressBar base props — excludes design props (shape, thickness, color).\n */\nexport type ProgressBarBaseProps = Omit<ProgressBarProps, 'shape' | 'thickness' | 'color' | 'indeterminateMotion'>;\n\n/**\n * State used in rendering ProgressBar\n */\nexport type ProgressBarState = ComponentState<Required<ProgressBarSlots>> &\n Required<Pick<ProgressBarProps, 'max' | 'shape' | 'thickness'>> &\n Pick<ProgressBarProps, 'value' | 'color'>;\n\n/**\n * ProgressBar base state — excludes design props (shape, thickness, color).\n */\nexport type ProgressBarBaseState = Omit<ProgressBarState, 'shape' | 'thickness' | 'color' | 'indeterminateMotion'>;\n"],"names":[],"mappings":"AAiEA;;CAEC,GACD,WAAmH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/index.ts"],"sourcesContent":["export { ProgressBar } from './ProgressBar';\nexport type {\n ProgressBarProps,\n ProgressBarBaseProps,\n ProgressBarSlots,\n ProgressBarState,\n ProgressBarBaseState,\n} from './ProgressBar.types';\nexport { renderProgressBar_unstable } from './renderProgressBar';\nexport { useProgressBar_unstable, useProgressBarBase_unstable } from './useProgressBar';\nexport { progressBarClassNames, useProgressBarStyles_unstable } from './useProgressBarStyles.styles';\n"],"names":["ProgressBar","renderProgressBar_unstable","useProgressBar_unstable","useProgressBarBase_unstable","progressBarClassNames","useProgressBarStyles_unstable"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mBAAgB;AAQ5C,SAASC,0BAA0B,QAAQ,yBAAsB;AACjE,SAASC,uBAAuB,EAAEC,2BAA2B,QAAQ,sBAAmB;AACxF,SAASC,qBAAqB,EAAEC,6BAA6B,QAAQ,mCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/progressBarMotions.ts"],"sourcesContent":["import { createMotionComponent, motionTokens } from '@fluentui/react-motion';\n\n/**\n * Motion component for the indeterminate ProgressBar bar:\n * a horizontal sliding animation that loops indefinitely.\n * In reduced motion mode, the bar pulses opacity instead of sliding.\n */\nexport const ProgressBarIndeterminateMotion = createMotionComponent({\n // translate percentages are relative to the element's own width, not the container's.\n // The indeterminate bar is ~33% the width of its container, so:\n // translate: '-100%' === left: '-33%' (one bar-width off-screen to the left)\n // translate: '300%' === left: '100%' (3 × bar-width ≈ full container width, off-screen to the right)\n keyframes: [{ translate: '-100%' }, { translate: '300%' }],\n duration: 3000,\n iterations: Infinity,\n easing: motionTokens.curveLinear,\n\n reducedMotion: {\n keyframes: [{ opacity: 0.2 }, { opacity: 1 }, { opacity: 0.2 }],\n duration: 3000,\n iterations: Infinity,\n },\n});\n"],"names":["createMotionComponent","motionTokens","ProgressBarIndeterminateMotion","keyframes","translate","duration","iterations","Infinity","easing","curveLinear","reducedMotion","opacity"],"mappings":"AAAA,SAASA,qBAAqB,EAAEC,YAAY,QAAQ,yBAAyB;AAE7E;;;;CAIC,GACD,OAAO,MAAMC,iCAAiCF,sBAAsB;IAClE,sFAAsF;IACtF,gEAAgE;IAChE,+EAA+E;IAC/E,wGAAwG;IACxGG,WAAW;QAAC;YAAEC,WAAW;QAAQ;QAAG;YAAEA,WAAW;QAAO;KAAE;IAC1DC,UAAU;IACVC,YAAYC;IACZC,QAAQP,aAAaQ,WAAW;IAEhCC,eAAe;QACbP,WAAW;YAAC;gBAAEQ,SAAS;YAAI;YAAG;gBAAEA,SAAS;YAAE;YAAG;gBAAEA,SAAS;YAAI;SAAE;QAC/DN,UAAU;QACVC,YAAYC;IACd;AACF,GAAG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { assertSlots } from "@fluentui/react-utilities";
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of ProgressBar
|
|
5
5
|
*/ export const renderProgressBar_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/renderProgressBar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { ProgressBarBaseState, ProgressBarSlots } from './ProgressBar.types';\n\n/**\n * Render the final JSX of ProgressBar\n */\nexport const renderProgressBar_unstable = (state: ProgressBarBaseState): JSXElement => {\n assertSlots<ProgressBarSlots>(state);\n return (\n <state.root>\n {state.bar &&\n (state.indeterminateMotion ? (\n <state.indeterminateMotion>\n <state.bar />\n </state.indeterminateMotion>\n ) : (\n <state.bar />\n ))}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderProgressBar_unstable","state","root","bar","indeterminateMotion"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzCF,YAA8BE;IAC9B,qBACE,KAACA,MAAMC,IAAI;kBACRD,MAAME,GAAG,IACPF,CAAAA,MAAMG,mBAAmB,iBACxB,KAACH,MAAMG,mBAAmB;sBACxB,cAAA,KAACH,MAAME,GAAG;2BAGZ,KAACF,MAAME,GAAG,KACZ;;AAGR,EAAE"}
|
|
@@ -41,8 +41,8 @@ import { ProgressBarIndeterminateMotion } from "./progressBarMotions.js";
|
|
|
41
41
|
* @param props - props from this instance of ProgressBar (without shape, thickness, color)
|
|
42
42
|
* @param ref - reference to root HTMLElement of ProgressBar
|
|
43
43
|
*/ export const useProgressBarBase_unstable = (props, ref)=>{
|
|
44
|
-
const field = useFieldContext_unstable();
|
|
45
44
|
var _props_max;
|
|
45
|
+
const field = useFieldContext_unstable();
|
|
46
46
|
const max = clampMax((_props_max = props.max) !== null && _props_max !== void 0 ? _props_max : 1);
|
|
47
47
|
const value = clampValue(props.value, max);
|
|
48
48
|
const root = slot.always(getIntrinsicElementProps('div', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBar.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFieldContext_unstable } from '@fluentui/react-field';\nimport { motionSlot } from '@fluentui/react-motion';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { clampValue, clampMax } from '../../utils/index';\nimport type {\n ProgressBarProps,\n ProgressBarState,\n ProgressBarBaseProps,\n ProgressBarBaseState,\n} from './ProgressBar.types';\nimport { ProgressBarIndeterminateMotion } from './progressBarMotions';\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 const field = useFieldContext_unstable();\n const fieldState = field?.validationState;\n\n const {\n color = fieldState === 'error' || fieldState === 'warning' || fieldState === 'success' ? fieldState : 'brand',\n shape = 'rounded',\n thickness = 'medium',\n indeterminateMotion,\n ...baseProps\n } = props;\n\n const state = useProgressBarBase_unstable(baseProps, ref);\n\n return {\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\n indeterminateMotion: ProgressBarIndeterminateMotion,\n },\n color,\n shape,\n thickness,\n indeterminateMotion:\n state.value === undefined\n ? motionSlot(indeterminateMotion, {\n elementType: ProgressBarIndeterminateMotion,\n defaultProps: {},\n })\n : undefined,\n };\n};\n\n/**\n * Base hook for ProgressBar component. Manages state related to ARIA progressbar attributes\n * (role, aria-valuemin, aria-valuemax, aria-valuenow) and field context integration —\n * without design props (shape, thickness, color).\n *\n * @param props - props from this instance of ProgressBar (without shape, thickness, color)\n * @param ref - reference to root HTMLElement of ProgressBar\n */\nexport const useProgressBarBase_unstable = (\n props: ProgressBarBaseProps,\n ref: React.Ref<HTMLElement>,\n): ProgressBarBaseState => {\n const field = useFieldContext_unstable();\n\n const max = clampMax(props.max ?? 1);\n const value = clampValue(props.value, max);\n\n const root = slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n role: 'progressbar',\n 'aria-valuemin': value !== undefined ? 0 : undefined,\n 'aria-valuemax': value !== undefined ? max : undefined,\n 'aria-valuenow': value,\n 'aria-labelledby': field?.labelId,\n ...props,\n }),\n { elementType: 'div' },\n );\n if (field && (field.validationMessageId || field.hintId)) {\n // Prepend the field's validation message and/or hint to the user's aria-describedby\n root['aria-describedby'] = [field?.validationMessageId, field?.hintId, root['aria-describedby']]\n .filter(Boolean)\n .join(' ');\n }\n const bar = slot.always(props.bar, { elementType: 'div' });\n\n return {\n max,\n value,\n components: { root: 'div', bar: 'div', indeterminateMotion: 'div' },\n root,\n bar,\n };\n};\n"],"names":["useFieldContext_unstable","motionSlot","getIntrinsicElementProps","slot","clampValue","clampMax","ProgressBarIndeterminateMotion","useProgressBar_unstable","props","ref","field","fieldState","validationState","color","shape","thickness","indeterminateMotion","baseProps","state","useProgressBarBase_unstable","components","value","undefined","elementType","defaultProps","max","root","always","role","labelId","validationMessageId","hintId","filter","Boolean","join","bar"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAC3E,SAASC,UAAU,EAAEC,QAAQ,QAAQ,uBAAoB;AAOzD,SAASC,8BAA8B,QAAQ,0BAAuB;AAEtE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAMC,QAAQV;IACd,MAAMW,aAAaD,kBAAAA,4BAAAA,MAAOE,eAAe;IAEzC,MAAM,EACJC,QAAQF,eAAe,WAAWA,eAAe,aAAaA,eAAe,YAAYA,aAAa,OAAO,EAC7GG,QAAQ,SAAS,EACjBC,YAAY,QAAQ,EACpBC,mBAAmB,EACnB,GAAGC,WACJ,GAAGT;IAEJ,MAAMU,QAAQC,4BAA4BF,WAAWR;IAErD,OAAO;QACL,GAAGS,KAAK;QACRE,YAAY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0,0 +1,20 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./ProgressBar.module.css";
|
|
3
|
+
export const progressBarClassNames = {
|
|
4
|
+
root: 'fui-ProgressBar',
|
|
5
|
+
bar: 'fui-ProgressBar__bar'
|
|
6
|
+
};
|
|
7
|
+
export const useProgressBarStyles_unstable = (state)=>{
|
|
8
|
+
const { color, max, shape, thickness, value } = state;
|
|
9
|
+
state.root.className = clsx(progressBarClassNames.root, styles.root, styles[shape], styles[thickness], state.root.className);
|
|
10
|
+
if (state.bar) {
|
|
11
|
+
state.bar.className = clsx(progressBarClassNames.bar, styles.bar, value === undefined && styles.indeterminate, value !== undefined && value > 0.01 && styles.nonZeroDeterminate, value !== undefined && color && styles[color], state.bar.className);
|
|
12
|
+
if (value !== undefined) {
|
|
13
|
+
state.bar.style = {
|
|
14
|
+
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
|
|
15
|
+
...state.bar.style
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return state;
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBarStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\nimport styles from './ProgressBar.module.css';\n\nexport const progressBarClassNames: SlotClassNames<Omit<ProgressBarSlots, 'indeterminateMotion'>> = {\n root: 'fui-ProgressBar',\n bar: 'fui-ProgressBar__bar',\n};\n\nexport const useProgressBarStyles_unstable = (state: ProgressBarState): ProgressBarState => {\n const { color, max, shape, thickness, value } = state;\n state.root.className = clsx(\n progressBarClassNames.root,\n styles.root,\n styles[shape],\n styles[thickness],\n state.root.className,\n );\n if (state.bar) {\n state.bar.className = clsx(\n progressBarClassNames.bar,\n styles.bar,\n value === undefined && styles.indeterminate,\n value !== undefined && value > 0.01 && styles.nonZeroDeterminate,\n value !== undefined && color && styles[color],\n state.bar.className,\n );\n if (value !== undefined) {\n state.bar.style = { width: Math.min(100, Math.max(0, (value / max) * 100)) + '%', ...state.bar.style };\n }\n }\n return state;\n};\n"],"names":["clsx","styles","progressBarClassNames","root","bar","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","className","undefined","indeterminate","nonZeroDeterminate","style","width","Math","min"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,2BAA2B;AAE9C,OAAO,MAAMC,wBAAuF;IAClGC,MAAM;IACNC,KAAK;AACP,EAAE;AAEF,OAAO,MAAMC,gCAAgC,CAACC;IAC5C,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGL;IAChDA,MAAMH,IAAI,CAACS,SAAS,GAAGZ,KACrBE,sBAAsBC,IAAI,EAC1BF,OAAOE,IAAI,EACXF,MAAM,CAACQ,MAAM,EACbR,MAAM,CAACS,UAAU,EACjBJ,MAAMH,IAAI,CAACS,SAAS;IAEtB,IAAIN,MAAMF,GAAG,EAAE;QACbE,MAAMF,GAAG,CAACQ,SAAS,GAAGZ,KACpBE,sBAAsBE,GAAG,EACzBH,OAAOG,GAAG,EACVO,UAAUE,aAAaZ,OAAOa,aAAa,EAC3CH,UAAUE,aAAaF,QAAQ,QAAQV,OAAOc,kBAAkB,EAChEJ,UAAUE,aAAaN,SAASN,MAAM,CAACM,MAAM,EAC7CD,MAAMF,GAAG,CAACQ,SAAS;QAErB,IAAID,UAAUE,WAAW;YACvBP,MAAMF,GAAG,CAACY,KAAK,GAAG;gBAAEC,OAAOC,KAAKC,GAAG,CAAC,KAAKD,KAAKV,GAAG,CAAC,GAAG,AAACG,QAAQH,MAAO,QAAQ;gBAAK,GAAGF,MAAMF,GAAG,CAACY,KAAK;YAAC;QACvG;IACF;IACA,OAAOV;AACT,EAAE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./ProgressBar.module.css";
|
|
3
|
+
export const progressBarClassNames = {
|
|
4
|
+
root: 'fui-ProgressBar',
|
|
5
|
+
bar: 'fui-ProgressBar__bar'
|
|
6
|
+
};
|
|
7
|
+
export const useProgressBarStyles_unstable = (state)=>{
|
|
8
|
+
const { color, max, shape, thickness, value } = state;
|
|
9
|
+
state.root.className = clsx(progressBarClassNames.root, styles.root, styles[shape], styles[thickness], state.root.className);
|
|
10
|
+
if (state.bar) {
|
|
11
|
+
state.bar.className = clsx(progressBarClassNames.bar, styles.bar, value === undefined && styles.indeterminate, value !== undefined && value > 0.01 && styles.nonZeroDeterminate, value !== undefined && color && styles[color], state.bar.className);
|
|
12
|
+
if (value !== undefined) {
|
|
13
|
+
state.bar.style = {
|
|
14
|
+
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
|
|
15
|
+
...state.bar.style
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return state;
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBarStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\nimport styles from './ProgressBar.module.css';\n\nexport const progressBarClassNames: SlotClassNames<Omit<ProgressBarSlots, 'indeterminateMotion'>> = {\n root: 'fui-ProgressBar',\n bar: 'fui-ProgressBar__bar',\n};\n\nexport const useProgressBarStyles_unstable = (state: ProgressBarState): ProgressBarState => {\n const { color, max, shape, thickness, value } = state;\n state.root.className = clsx(\n progressBarClassNames.root,\n styles.root,\n styles[shape],\n styles[thickness],\n state.root.className,\n );\n if (state.bar) {\n state.bar.className = clsx(\n progressBarClassNames.bar,\n styles.bar,\n value === undefined && styles.indeterminate,\n value !== undefined && value > 0.01 && styles.nonZeroDeterminate,\n value !== undefined && color && styles[color],\n state.bar.className,\n );\n if (value !== undefined) {\n state.bar.style = { width: Math.min(100, Math.max(0, (value / max) * 100)) + '%', ...state.bar.style };\n }\n }\n return state;\n};\n"],"names":["clsx","styles","progressBarClassNames","root","bar","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","className","undefined","indeterminate","nonZeroDeterminate","style","width","Math","min"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,2BAA2B;AAE9C,OAAO,MAAMC,wBAAuF;IAClGC,MAAM;IACNC,KAAK;AACP,EAAE;AAEF,OAAO,MAAMC,gCAAgC,CAACC;IAC5C,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGL;IAChDA,MAAMH,IAAI,CAACS,SAAS,GAAGZ,KACrBE,sBAAsBC,IAAI,EAC1BF,OAAOE,IAAI,EACXF,MAAM,CAACQ,MAAM,EACbR,MAAM,CAACS,UAAU,EACjBJ,MAAMH,IAAI,CAACS,SAAS;IAEtB,IAAIN,MAAMF,GAAG,EAAE;QACbE,MAAMF,GAAG,CAACQ,SAAS,GAAGZ,KACpBE,sBAAsBE,GAAG,EACzBH,OAAOG,GAAG,EACVO,UAAUE,aAAaZ,OAAOa,aAAa,EAC3CH,UAAUE,aAAaF,QAAQ,QAAQV,OAAOc,kBAAkB,EAChEJ,UAAUE,aAAaN,SAASN,MAAM,CAACM,MAAM,EAC7CD,MAAMF,GAAG,CAACQ,SAAS;QAErB,IAAID,UAAUE,WAAW;YACvBP,MAAMF,GAAG,CAACY,KAAK,GAAG;gBAAEC,OAAOC,KAAKC,GAAG,CAAC,KAAKD,KAAKV,GAAG,CAAC,GAAG,AAACG,QAAQH,MAAO,QAAQ;gBAAK,GAAGF,MAAMF,GAAG,CAACY,KAAK;YAAC;QACvG;IACF;IACA,OAAOV;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBarStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const progressBarClassNames: SlotClassNames<Omit<ProgressBarSlots, 'indeterminateMotion'>> = {\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\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n display: 'block',\n backgroundColor: tokens.colorNeutralBackground6,\n width: '100%',\n overflow: 'hidden',\n\n '@media screen and (forced-colors: active)': {\n backgroundColor: 'CanvasText',\n },\n },\n rounded: {\n borderRadius: tokens.borderRadiusMedium,\n },\n square: {\n 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 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 '@media screen and (prefers-reduced-motion: reduce)': {\n // Reduced motion: bar is sized here, and the opacity is pulsed by ProgressBarIndeterminateMotion\n maxWidth: '100%',\n },\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\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\n state.bar.className = mergeClasses(\n progressBarClassNames.bar,\n barStyles.base,\n barStyles.brand,\n value === undefined && barStyles.indeterminate,\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 // eslint-disable-next-line react-hooks/immutability\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"],"names":["makeStyles","mergeClasses","tokens","progressBarClassNames","root","bar","ZERO_THRESHOLD","barThicknessValues","medium","large","useRootStyles","display","backgroundColor","colorNeutralBackground6","width","overflow","rounded","borderRadius","borderRadiusMedium","square","borderRadiusNone","height","useBarStyles","base","nonZeroDeterminate","transitionProperty","transitionDuration","transitionTimingFunction","indeterminate","maxWidth","position","backgroundImage","colorTransparentBackground","brand","colorCompoundBrandBackground","error","colorPaletteRedBackground3","warning","colorPaletteDarkOrangeBackground3","success","colorPaletteGreenBackground3","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","rootStyles","barStyles","className","undefined","style","Math","min"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC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gC,CAACC;IAC5C,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGL;IAChD,MAAMM,aAAatC;IACnB,MAAMuC,YAAY3B;IAElB,oDAAoD;IACpDoB,MAAMtC,IAAI,CAAC8C,SAAS,GAAGjD,aACrBE,sBAAsBC,IAAI,EAC1B4C,WAAW5C,IAAI,EACf4C,UAAU,CAACH,MAAM,EACjBG,UAAU,CAACF,UAAU,EACrBJ,MAAMtC,IAAI,CAAC8C,SAAS;IAGtB,IAAIR,MAAMrC,GAAG,EAAE;QACb,oDAAoD;QACpDqC,MAAMrC,GAAG,CAAC6C,SAAS,GAAGjD,aACpBE,sBAAsBE,GAAG,EACzB4C,UAAU1B,IAAI,EACd0B,UAAUhB,KAAK,EACfc,UAAUI,aAAaF,UAAUrB,aAAa,EAC9CmB,UAAUI,aAAaJ,QAAQzC,kBAAkB2C,UAAUzB,kBAAkB,EAC7EmB,SAASI,UAAUI,aAAaF,SAAS,CAACN,MAAM,EAChDD,MAAMrC,GAAG,CAAC6C,SAAS;IAEvB;IAEA,IAAIR,MAAMrC,GAAG,IAAI0C,UAAUI,WAAW;QACpC,oDAAoD;QACpDT,MAAMrC,GAAG,CAAC+C,KAAK,GAAG;YAChBtC,OAAOuC,KAAKC,GAAG,CAAC,KAAKD,KAAKT,GAAG,CAAC,GAAG,AAACG,QAAQH,MAAO,QAAQ;YACzD,GAAGF,MAAMrC,GAAG,CAAC+C,KAAK;QACpB;IACF;IAEA,OAAOV;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../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"],"names":["clampMax","max","internalMax","process","env","NODE_ENV","console","error"],"mappings":"AAAA,OAAO,MAAMA,WAAW,CAACC;IACvB,MAAMC,cAAcD,OAAO,IAAI,IAAIA;IAEnC,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAIJ,OAAO,GAAG;YACZ,sCAAsC;YACtCK,QAAQC,KAAK,CAAC,CAAC,qDAAqD,EAAEN,KAAK;QAC7E;IACF;IACA,OAAOC;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../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"],"names":["clampValue","value","max","undefined","internalValue","process","env","NODE_ENV","console","error"],"mappings":"AAAA,OAAO,MAAMA,aAAa,CAACC,OAA2BC;IACpD,IAAID,UAAUE,WAAW;QACvB,OAAOF;IACT;IACA,MAAMG,gBAAgBH,QAAQ,IAAI,IAAIA,QAAQC,MAAMA,MAAMD;IAE1D,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAIN,QAAQ,GAAG;YACb,sCAAsC;YACtCO,QAAQC,KAAK,CAAC,CAAC,wEAAwE,EAAER,OAAO;QAClG;QACA,IAAIA,QAAQC,KAAK;YACf,sCAAsC;YACtCM,QAAQC,KAAK,CAAC,CAAC,sEAAsE,EAAER,MAAM,OAAO,EAAEC,KAAK;QAC7G;IACF;IACA,OAAOE;AACT,EAAE"}
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export { clampMax } from './clampMax';\nexport { clampValue } from './clampValue';\n"],"names":["clampMax","clampValue"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAa;AACtC,SAASC,UAAU,QAAQ,kBAAe"}
|
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ProgressBar
|
|
12
|
+
get ProgressBar () {
|
|
13
13
|
return _index.ProgressBar;
|
|
14
14
|
},
|
|
15
|
-
progressBarClassNames
|
|
15
|
+
get progressBarClassNames () {
|
|
16
16
|
return _index.progressBarClassNames;
|
|
17
17
|
},
|
|
18
|
-
renderProgressBar_unstable
|
|
18
|
+
get renderProgressBar_unstable () {
|
|
19
19
|
return _index.renderProgressBar_unstable;
|
|
20
20
|
},
|
|
21
|
-
useProgressBarBase_unstable
|
|
21
|
+
get useProgressBarBase_unstable () {
|
|
22
22
|
return _index.useProgressBarBase_unstable;
|
|
23
23
|
},
|
|
24
|
-
useProgressBarStyles_unstable
|
|
24
|
+
get useProgressBarStyles_unstable () {
|
|
25
25
|
return _index.useProgressBarStyles_unstable;
|
|
26
26
|
},
|
|
27
|
-
useProgressBar_unstable
|
|
27
|
+
get useProgressBar_unstable () {
|
|
28
28
|
return _index.useProgressBar_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useProgressBar_unstable } from './useProgressBar';\nimport { renderProgressBar_unstable } from './renderProgressBar';\nimport { useProgressBarStyles_unstable } from './useProgressBarStyles.styles';\nimport type { ProgressBarProps } from './ProgressBar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_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 useCustomStyleHook_unstable('useProgressBarStyles_unstable')(state);\n\n return renderProgressBar_unstable(state);\n});\n\nProgressBar.displayName = 'ProgressBar';\n"],"names":["React","useProgressBar_unstable","renderProgressBar_unstable","useProgressBarStyles_unstable","useCustomStyleHook_unstable","ProgressBar","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;gCACS,sBAAmB;mCAChB,yBAAsB;4CACnB,mCAAgC;qCAGlC,kCAAkC;AAKvE,MAAMK,cAAAA,WAAAA,GAAqDL,OAAMM,UAAU,CAAC,CAACC,OAAOC;IACzF,MAAMC,YAAQR,uCAAAA,EAAwBM,OAAOC;QAE7CL,yDAAAA,EAA8BM;QAE9BL,gDAAAA,EAA4B,iCAAiCK;IAE7D,WAAOP,6CAAAA,EAA2BO;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root {
|
|
3
|
+
display: block;
|
|
4
|
+
background-color: var(--colorNeutralBackground6);
|
|
5
|
+
width: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.rounded {
|
|
10
|
+
border-radius: var(--borderRadiusMedium);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.square {
|
|
14
|
+
border-radius: var(--borderRadiusNone);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.medium {
|
|
18
|
+
height: var(--strokeWidthThick);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.large {
|
|
22
|
+
height: var(--spacingHorizontalXS);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.bar {
|
|
26
|
+
border-radius: inherit;
|
|
27
|
+
height: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.bar {
|
|
31
|
+
background-color: var(--colorCompoundBrandBackground);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.indeterminate {
|
|
35
|
+
max-width: 33%;
|
|
36
|
+
position: relative;
|
|
37
|
+
background-image: linear-gradient(
|
|
38
|
+
to right,
|
|
39
|
+
var(--colorNeutralBackground6) 0%,
|
|
40
|
+
var(--colorTransparentBackground) 50%,
|
|
41
|
+
var(--colorNeutralBackground6) 100%
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.indeterminate:where(:dir(rtl)) {
|
|
46
|
+
background-image: linear-gradient(
|
|
47
|
+
to left,
|
|
48
|
+
var(--colorNeutralBackground6) 0%,
|
|
49
|
+
var(--colorTransparentBackground) 50%,
|
|
50
|
+
var(--colorNeutralBackground6) 100%
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nonZeroDeterminate {
|
|
55
|
+
transition-property: width;
|
|
56
|
+
transition-duration: 0.3s;
|
|
57
|
+
transition-timing-function: ease;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.error {
|
|
61
|
+
background-color: var(--colorPaletteRedBackground3);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.warning {
|
|
65
|
+
background-color: var(--colorPaletteDarkOrangeBackground3);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.success {
|
|
69
|
+
background-color: var(--colorPaletteGreenBackground3);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media screen and (forced-colors: active) {
|
|
73
|
+
.root {
|
|
74
|
+
background-color: CanvasText;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media screen and (forced-colors: active) {
|
|
79
|
+
.bar {
|
|
80
|
+
background-color: Highlight;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
85
|
+
.indeterminate {
|
|
86
|
+
max-width: 100%;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/ProgressBar.types.ts"],"sourcesContent":["import type { MotionSlotProps } from '@fluentui/react-motion';\nimport 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 * Motion slot for the indeterminate animation. Pass `null` to disable the animation.\n */\n indeterminateMotion?: Slot<MotionSlotProps>;\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 * ProgressBar base props — excludes design props (shape, thickness, color).\n */\nexport type ProgressBarBaseProps = Omit<ProgressBarProps, 'shape' | 'thickness' | 'color' | 'indeterminateMotion'>;\n\n/**\n * State used in rendering ProgressBar\n */\nexport type ProgressBarState = ComponentState<Required<ProgressBarSlots>> &\n Required<Pick<ProgressBarProps, 'max' | 'shape' | 'thickness'>> &\n Pick<ProgressBarProps, 'value' | 'color'>;\n\n/**\n * ProgressBar base state — excludes design props (shape, thickness, color).\n */\nexport type ProgressBarBaseState = Omit<ProgressBarState, 'shape' | 'thickness' | 'color' | 'indeterminateMotion'>;\n"],"names":[],"mappings":"AAiEA;;CAEC,GACD,WAAmH"}
|
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ProgressBar
|
|
12
|
+
get ProgressBar () {
|
|
13
13
|
return _ProgressBar.ProgressBar;
|
|
14
14
|
},
|
|
15
|
-
progressBarClassNames
|
|
15
|
+
get progressBarClassNames () {
|
|
16
16
|
return _useProgressBarStylesstyles.progressBarClassNames;
|
|
17
17
|
},
|
|
18
|
-
renderProgressBar_unstable
|
|
18
|
+
get renderProgressBar_unstable () {
|
|
19
19
|
return _renderProgressBar.renderProgressBar_unstable;
|
|
20
20
|
},
|
|
21
|
-
useProgressBarBase_unstable
|
|
21
|
+
get useProgressBarBase_unstable () {
|
|
22
22
|
return _useProgressBar.useProgressBarBase_unstable;
|
|
23
23
|
},
|
|
24
|
-
useProgressBarStyles_unstable
|
|
24
|
+
get useProgressBarStyles_unstable () {
|
|
25
25
|
return _useProgressBarStylesstyles.useProgressBarStyles_unstable;
|
|
26
26
|
},
|
|
27
|
-
useProgressBar_unstable
|
|
27
|
+
get useProgressBar_unstable () {
|
|
28
28
|
return _useProgressBar.useProgressBar_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/index.ts"],"sourcesContent":["export { ProgressBar } from './ProgressBar';\nexport type {\n ProgressBarProps,\n ProgressBarBaseProps,\n ProgressBarSlots,\n ProgressBarState,\n ProgressBarBaseState,\n} from './ProgressBar.types';\nexport { renderProgressBar_unstable } from './renderProgressBar';\nexport { useProgressBar_unstable, useProgressBarBase_unstable } from './useProgressBar';\nexport { progressBarClassNames, useProgressBarStyles_unstable } from './useProgressBarStyles.styles';\n"],"names":["ProgressBar","renderProgressBar_unstable","useProgressBar_unstable","useProgressBarBase_unstable","progressBarClassNames","useProgressBarStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,wBAAW;;;eAUXI,iDAAqB;;;eAFrBH,6CAA0B;;;eACDE,2CAA2B;;;eAC7BE,yDAA6B;;;eADpDH,uCAAuB;;;6BATJ,mBAAgB;mCAQD,yBAAsB;gCACI,sBAAmB;4CACnB,mCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/progressBarMotions.ts"],"sourcesContent":["import { createMotionComponent, motionTokens } from '@fluentui/react-motion';\n\n/**\n * Motion component for the indeterminate ProgressBar bar:\n * a horizontal sliding animation that loops indefinitely.\n * In reduced motion mode, the bar pulses opacity instead of sliding.\n */\nexport const ProgressBarIndeterminateMotion = createMotionComponent({\n // translate percentages are relative to the element's own width, not the container's.\n // The indeterminate bar is ~33% the width of its container, so:\n // translate: '-100%' === left: '-33%' (one bar-width off-screen to the left)\n // translate: '300%' === left: '100%' (3 × bar-width ≈ full container width, off-screen to the right)\n keyframes: [{ translate: '-100%' }, { translate: '300%' }],\n duration: 3000,\n iterations: Infinity,\n easing: motionTokens.curveLinear,\n\n reducedMotion: {\n keyframes: [{ opacity: 0.2 }, { opacity: 1 }, { opacity: 0.2 }],\n duration: 3000,\n iterations: Infinity,\n },\n});\n"],"names":["createMotionComponent","motionTokens","ProgressBarIndeterminateMotion","keyframes","translate","duration","iterations","Infinity","easing","curveLinear","reducedMotion","opacity"],"mappings":";;;;+BAOaE;;;;;;6BAPuC,yBAAyB;AAOtE,2CAAuCF,kCAAAA,EAAsB;IAClE,sFAAsF;IACtF,gEAAgE;IAChE,+EAA+E;IAC/E,wGAAwG;IACxGG,WAAW;QAAC;YAAEC,WAAW;QAAQ;QAAG;YAAEA,WAAW;QAAO;KAAE;IAC1DC,UAAU;IACVC,YAAYC;IACZC,QAAQP,yBAAAA,CAAaQ,WAAW;IAEhCC,eAAe;QACbP,WAAW;YAAC;gBAAEQ,SAAS;YAAI;YAAG;gBAAEA,SAAS;YAAE;YAAG;gBAAEA,SAAS;YAAI;SAAE;QAC/DN,UAAU;QACVC,YAAYC;IACd;AACF,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/renderProgressBar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { ProgressBarBaseState, ProgressBarSlots } from './ProgressBar.types';\n\n/**\n * Render the final JSX of ProgressBar\n */\nexport const renderProgressBar_unstable = (state: ProgressBarBaseState): JSXElement => {\n assertSlots<ProgressBarSlots>(state);\n return (\n <state.root>\n {state.bar &&\n (state.indeterminateMotion ? (\n <state.indeterminateMotion>\n <state.bar />\n </state.indeterminateMotion>\n ) : (\n <state.bar />\n ))}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderProgressBar_unstable","state","root","bar","indeterminateMotion"],"mappings":";;;;+BAUaC;;;;;;;gCATb,gDAAiD,GAEjD,SAASD,WAAW,QAAQ,4BAA4B;AAOjD,mCAAmC,CAACE;QACzCF,2BAAAA,EAA8BE;IAC9B,OAAA,WAAA,OACE,eAAA,EAACA,MAAMC,IAAI,EAAA;kBACRD,MAAME,GAAG,IACPF,CAAAA,MAAMG,mBAAmB,GAAA,WAAA,OACxB,eAAA,EAACH,MAAMG,mBAAmB,EAAA;sBACxB,WAAA,OAAA,eAAA,EAACH,MAAME,GAAG,EAAA,CAAA;+BAGZ,eAAA,EAACF,MAAME,GAAG,EAAA,CAAA,EAAA,CACZ;;AAGR,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
useProgressBarBase_unstable
|
|
13
|
+
get useProgressBarBase_unstable () {
|
|
14
14
|
return useProgressBarBase_unstable;
|
|
15
15
|
},
|
|
16
|
-
useProgressBar_unstable
|
|
16
|
+
get useProgressBar_unstable () {
|
|
17
17
|
return useProgressBar_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -44,8 +44,8 @@ const useProgressBar_unstable = (props, ref)=>{
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
const useProgressBarBase_unstable = (props, ref)=>{
|
|
47
|
-
const field = (0, _reactfield.useFieldContext_unstable)();
|
|
48
47
|
var _props_max;
|
|
48
|
+
const field = (0, _reactfield.useFieldContext_unstable)();
|
|
49
49
|
const max = (0, _index.clampMax)((_props_max = props.max) !== null && _props_max !== void 0 ? _props_max : 1);
|
|
50
50
|
const value = (0, _index.clampValue)(props.value, max);
|
|
51
51
|
const root = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBar.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useFieldContext_unstable } from '@fluentui/react-field';\nimport { motionSlot } from '@fluentui/react-motion';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { clampValue, clampMax } from '../../utils/index';\nimport type {\n ProgressBarProps,\n ProgressBarState,\n ProgressBarBaseProps,\n ProgressBarBaseState,\n} from './ProgressBar.types';\nimport { ProgressBarIndeterminateMotion } from './progressBarMotions';\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 const field = useFieldContext_unstable();\n const fieldState = field?.validationState;\n\n const {\n color = fieldState === 'error' || fieldState === 'warning' || fieldState === 'success' ? fieldState : 'brand',\n shape = 'rounded',\n thickness = 'medium',\n indeterminateMotion,\n ...baseProps\n } = props;\n\n const state = useProgressBarBase_unstable(baseProps, ref);\n\n return {\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\n indeterminateMotion: ProgressBarIndeterminateMotion,\n },\n color,\n shape,\n thickness,\n indeterminateMotion:\n state.value === undefined\n ? motionSlot(indeterminateMotion, {\n elementType: ProgressBarIndeterminateMotion,\n defaultProps: {},\n })\n : undefined,\n };\n};\n\n/**\n * Base hook for ProgressBar component. Manages state related to ARIA progressbar attributes\n * (role, aria-valuemin, aria-valuemax, aria-valuenow) and field context integration —\n * without design props (shape, thickness, color).\n *\n * @param props - props from this instance of ProgressBar (without shape, thickness, color)\n * @param ref - reference to root HTMLElement of ProgressBar\n */\nexport const useProgressBarBase_unstable = (\n props: ProgressBarBaseProps,\n ref: React.Ref<HTMLElement>,\n): ProgressBarBaseState => {\n const field = useFieldContext_unstable();\n\n const max = clampMax(props.max ?? 1);\n const value = clampValue(props.value, max);\n\n const root = slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n role: 'progressbar',\n 'aria-valuemin': value !== undefined ? 0 : undefined,\n 'aria-valuemax': value !== undefined ? max : undefined,\n 'aria-valuenow': value,\n 'aria-labelledby': field?.labelId,\n ...props,\n }),\n { elementType: 'div' },\n );\n if (field && (field.validationMessageId || field.hintId)) {\n // Prepend the field's validation message and/or hint to the user's aria-describedby\n root['aria-describedby'] = [field?.validationMessageId, field?.hintId, root['aria-describedby']]\n .filter(Boolean)\n .join(' ');\n }\n const bar = slot.always(props.bar, { elementType: 'div' });\n\n return {\n max,\n value,\n components: { root: 'div', bar: 'div', indeterminateMotion: 'div' },\n root,\n bar,\n };\n};\n"],"names":["useFieldContext_unstable","motionSlot","getIntrinsicElementProps","slot","clampValue","clampMax","ProgressBarIndeterminateMotion","useProgressBar_unstable","props","ref","field","fieldState","validationState","color","shape","thickness","indeterminateMotion","baseProps","state","useProgressBarBase_unstable","components","value","undefined","elementType","defaultProps","max","root","always","role","labelId","validationMessageId","hintId","filter","Boolean","join","bar"],"mappings":"AAAA;;;;;;;;;;;;QAkEamB;;;QA1CAZ;;;;4BArB4B,wBAAwB;6BACtC,yBAAyB;gCACL,4BAA4B;uBACtC,uBAAoB;oCAOV,0BAAuB;AAW/D,gCAAgC,CAACC,OAAyBC;IAC/D,MAAMC,YAAQV,oCAAAA;IACd,MAAMW,aAAaD,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,MAAOE,eAAe;IAEzC,MAAM,EACJC,QAAQF,eAAe,WAAWA,eAAe,aAAaA,eAAe,YAAYA,aAAa,OAAO,EAC7GG,QAA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AAA,KAAAA,IAAAA,MAAOqB,MAAM;YAAEL,IAAI,CAAC,mBAAmB;SAAC,CAC7FM,MAAM,CAACC,SACPC,IAAI,CAAC;IACV;IACA,MAAMC,MAAMhC,oBAAAA,CAAKwB,MAAM,CAACnB,MAAM2B,GAAG,EAAE;QAAEZ,aAAa;IAAM;IAExD,OAAO;QACLE;QACAJ;QACAD,YAAY;YAAEM,MAAM;YAAOS,KAAK;YAAOnB,qBAAqB;QAAM;QAClEU;QACAS;IACF;AACF,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
progressBarClassNames
|
|
13
|
+
get progressBarClassNames () {
|
|
14
14
|
return progressBarClassNames;
|
|
15
15
|
},
|
|
16
|
-
useProgressBarStyles_unstable
|
|
16
|
+
get useProgressBarStyles_unstable () {
|
|
17
17
|
return useProgressBarStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useProgressBarStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nexport const progressBarClassNames = {\n root: 'fui-ProgressBar',\n bar: 'fui-ProgressBar__bar'\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;\nconst barThicknessValues = {\n medium: '2px',\n large: '4px'\n};\n/**\n * Styles for the root slot\n */ const useRootStyles = makeStyles({\n root: {\n display: 'block',\n backgroundColor: tokens.colorNeutralBackground6,\n width: '100%',\n overflow: 'hidden',\n '@media screen and (forced-colors: active)': {\n backgroundColor: 'CanvasText'\n }\n },\n rounded: {\n borderRadius: tokens.borderRadiusMedium\n },\n square: {\n borderRadius: tokens.borderRadiusNone\n },\n medium: {\n height: barThicknessValues.medium\n },\n large: {\n height: barThicknessValues.large\n }\n});\n/**\n * Styles for the ProgressBar bar\n */ const useBarStyles = makeStyles({\n base: {\n '@media screen and (forced-colors: active)': {\n backgroundColor: 'Highlight'\n },\n 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 '@media screen and (prefers-reduced-motion: reduce)': {\n // Reduced motion: bar is sized here, and the opacity is pulsed by ProgressBarIndeterminateMotion\n maxWidth: '100%'\n }\n },\n brand: {\n backgroundColor: tokens.colorCompoundBrandBackground\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 * Apply styling to the ProgressBar slots based on the state\n */ export const useProgressBarStyles_unstable = (state)=>{\n const { color, max, shape, thickness, value } = state;\n const rootStyles = useRootStyles();\n const barStyles = useBarStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(progressBarClassNames.root, rootStyles.root, rootStyles[shape], rootStyles[thickness], state.root.className);\n if (state.bar) {\n // eslint-disable-next-line react-hooks/immutability\n state.bar.className = mergeClasses(progressBarClassNames.bar, barStyles.base, barStyles.brand, value === undefined && barStyles.indeterminate, value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate, color && value !== undefined && barStyles[color], state.bar.className);\n }\n if (state.bar && value !== undefined) {\n // eslint-disable-next-line react-hooks/immutability\n state.bar.style = {\n width: Math.min(100, Math.max(0, value / max * 100)) + '%',\n ...state.bar.style\n };\n }\n return state;\n};\n"],"names":["__styles","mergeClasses","tokens","progressBarClassNames","root","bar","ZERO_THRESHOLD","barThicknessValues","medium","large","useRootStyles","mc9l5x","De3pzq","a9b677","B68tc82","Bmxbyg5","Bpg54ce","Bomf52o","rounded","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","square","Bqenvij","d","p","m","useBarStyles","base","nonZeroDeterminate","Bmy1vo4","B3o57yi","Bkqvd7p","indeterminate","B2u0y6b","qhf8xq","Bcmaq0h","jpy9cc","brand","error","warning","success","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","rootStyles","barStyles","className","undefined","style","width","Math","min"],"mappings":"AAAA,YAAY;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["useProgressBarStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens } from \"@fluentui/react-theme\";\nexport const progressBarClassNames = {\n root: 'fui-ProgressBar',\n bar: 'fui-ProgressBar__bar'\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;\nconst barThicknessValues = {\n medium: '2px',\n large: '4px'\n};\n/**\n * Styles for the root slot\n */ const useRootStyles = makeStyles({\n root: {\n display: 'block',\n backgroundColor: tokens.colorNeutralBackground6,\n width: '100%',\n overflow: 'hidden',\n '@media screen and (forced-colors: active)': {\n backgroundColor: 'CanvasText'\n }\n },\n rounded: {\n borderRadius: tokens.borderRadiusMedium\n },\n square: {\n borderRadius: tokens.borderRadiusNone\n },\n medium: {\n height: barThicknessValues.medium\n },\n large: {\n height: barThicknessValues.large\n }\n});\n/**\n * Styles for the ProgressBar bar\n */ const useBarStyles = makeStyles({\n base: {\n '@media screen and (forced-colors: active)': {\n backgroundColor: 'Highlight'\n },\n 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 '@media screen and (prefers-reduced-motion: reduce)': {\n // Reduced motion: bar is sized here, and the opacity is pulsed by ProgressBarIndeterminateMotion\n maxWidth: '100%'\n }\n },\n brand: {\n backgroundColor: tokens.colorCompoundBrandBackground\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 * Apply styling to the ProgressBar slots based on the state\n */ export const useProgressBarStyles_unstable = (state)=>{\n const { color, max, shape, thickness, value } = state;\n const rootStyles = useRootStyles();\n const barStyles = useBarStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(progressBarClassNames.root, rootStyles.root, rootStyles[shape], rootStyles[thickness], state.root.className);\n if (state.bar) {\n // eslint-disable-next-line react-hooks/immutability\n state.bar.className = mergeClasses(progressBarClassNames.bar, barStyles.base, barStyles.brand, value === undefined && barStyles.indeterminate, value !== undefined && value > ZERO_THRESHOLD && barStyles.nonZeroDeterminate, color && value !== undefined && barStyles[color], state.bar.className);\n }\n if (state.bar && value !== undefined) {\n // eslint-disable-next-line react-hooks/immutability\n state.bar.style = {\n width: Math.min(100, Math.max(0, value / max * 100)) + '%',\n ...state.bar.style\n };\n }\n return state;\n};\n"],"names":["__styles","mergeClasses","tokens","progressBarClassNames","root","bar","ZERO_THRESHOLD","barThicknessValues","medium","large","useRootStyles","mc9l5x","De3pzq","a9b677","B68tc82","Bmxbyg5","Bpg54ce","Bomf52o","rounded","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","square","Bqenvij","d","p","m","useBarStyles","base","nonZeroDeterminate","Bmy1vo4","B3o57yi","Bkqvd7p","indeterminate","B2u0y6b","qhf8xq","Bcmaq0h","jpy9cc","brand","error","warning","success","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","rootStyles","barStyles","className","undefined","style","width","Math","min"],"mappings":"AAAA,YAAY;;;;;;;;;;;;QAGCG,qBAAqB;;;QAgFjByC,6BAA6B;;;;uBAlFL,gBAAgB;AAElD,8BAA8B;IACjCxC,IAAI,EAAE,iBAAiB;IACvBC,GAAG,EAAE;AACT,CAAC;AACD,sDAAA;AACA,oDAAA;AACA,MAAMC,cAAc,GAAG,IAAI;AAC3B,MAAMC,kBAAkB,GAAG;IACvBC,MAAM,EAAE,KAAK;IACbC,KAAK,EAAE;AACX,CAAC;AACD;;CAEA,GAAI,MAAMC,aAAa,GAAA,WAAA,OAAGV,eAAA,EAAA;IAAAI,IAAA,EAAA;QAAAO,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAC,MAAA,EAAA;QAAAL,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAf,MAAA,EAAA;QAAAiB,OAAA,EAAA;IAAA;IAAAhB,KAAA,EAAA;QAAAgB,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBAAAC,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CA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
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get progressBarClassNames () {
|
|
13
|
+
return progressBarClassNames;
|
|
14
|
+
},
|
|
15
|
+
get useProgressBarStyles_unstable () {
|
|
16
|
+
return useProgressBarStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _clsx = require("clsx");
|
|
21
|
+
const _ProgressBarmodulecss = /*#__PURE__*/ _interop_require_default._(require("./ProgressBar.module.css"));
|
|
22
|
+
const progressBarClassNames = {
|
|
23
|
+
root: 'fui-ProgressBar',
|
|
24
|
+
bar: 'fui-ProgressBar__bar'
|
|
25
|
+
};
|
|
26
|
+
const useProgressBarStyles_unstable = (state)=>{
|
|
27
|
+
const { color, max, shape, thickness, value } = state;
|
|
28
|
+
state.root.className = (0, _clsx.clsx)(progressBarClassNames.root, _ProgressBarmodulecss.default.root, _ProgressBarmodulecss.default[shape], _ProgressBarmodulecss.default[thickness], state.root.className);
|
|
29
|
+
if (state.bar) {
|
|
30
|
+
state.bar.className = (0, _clsx.clsx)(progressBarClassNames.bar, _ProgressBarmodulecss.default.bar, value === undefined && _ProgressBarmodulecss.default.indeterminate, value !== undefined && value > 0.01 && _ProgressBarmodulecss.default.nonZeroDeterminate, value !== undefined && color && _ProgressBarmodulecss.default[color], state.bar.className);
|
|
31
|
+
if (value !== undefined) {
|
|
32
|
+
state.bar.style = {
|
|
33
|
+
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
|
|
34
|
+
...state.bar.style
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return state;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBarStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\nimport styles from './ProgressBar.module.css';\n\nexport const progressBarClassNames: SlotClassNames<Omit<ProgressBarSlots, 'indeterminateMotion'>> = {\n root: 'fui-ProgressBar',\n bar: 'fui-ProgressBar__bar',\n};\n\nexport const useProgressBarStyles_unstable = (state: ProgressBarState): ProgressBarState => {\n const { color, max, shape, thickness, value } = state;\n state.root.className = clsx(\n progressBarClassNames.root,\n styles.root,\n styles[shape],\n styles[thickness],\n state.root.className,\n );\n if (state.bar) {\n state.bar.className = clsx(\n progressBarClassNames.bar,\n styles.bar,\n value === undefined && styles.indeterminate,\n value !== undefined && value > 0.01 && styles.nonZeroDeterminate,\n value !== undefined && color && styles[color],\n state.bar.className,\n );\n if (value !== undefined) {\n state.bar.style = { width: Math.min(100, Math.max(0, (value / max) * 100)) + '%', ...state.bar.style };\n }\n }\n return state;\n};\n"],"names":["clsx","styles","progressBarClassNames","root","bar","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","className","undefined","indeterminate","nonZeroDeterminate","style","width","Math","min"],"mappings":";;;;;;;;;;;QAKaE;;;QAKAG;;;;;sBAVQ,OAAO;+EAGT,2BAA2B;AAEvC,8BAA6F;IAClGF,MAAM;IACNC,KAAK;AACP,EAAE;AAEK,sCAAsC,CAACE;IAC5C,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGL;IAChDA,MAAMH,IAAI,CAACS,SAAS,OAAGZ,UAAAA,EACrBE,sBAAsBC,IAAI,EAC1BF,6BAAAA,CAAOE,IAAI,EACXF,6BAAM,CAACQ,MAAM,EACbR,6BAAM,CAACS,UAAU,EACjBJ,MAAMH,IAAI,CAACS,SAAS;IAEtB,IAAIN,MAAMF,GAAG,EAAE;QACbE,MAAMF,GAAG,CAACQ,SAAS,OAAGZ,UAAAA,EACpBE,sBAAsBE,GAAG,EACzBH,6BAAAA,CAAOG,GAAG,EACVO,UAAUE,aAAaZ,6BAAAA,CAAOa,aAAa,EAC3CH,UAAUE,aAAaF,QAAQ,QAAQV,6BAAAA,CAAOc,kBAAkB,EAChEJ,UAAUE,aAAaN,SAASN,6BAAM,CAACM,MAAM,EAC7CD,MAAMF,GAAG,CAACQ,SAAS;QAErB,IAAID,UAAUE,WAAW;YACvBP,MAAMF,GAAG,CAACY,KAAK,GAAG;gBAAEC,OAAOC,KAAKC,GAAG,CAAC,KAAKD,KAAKV,GAAG,CAAC,GAAIG,QAAQH,MAAO,QAAQ;gBAAK,GAAGF,MAAMF,GAAG,CAACY,KAAK;YAAC;QACvG;IACF;IACA,OAAOV;AACT,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
progressBarClassNames
|
|
13
|
+
get progressBarClassNames () {
|
|
14
14
|
return progressBarClassNames;
|
|
15
15
|
},
|
|
16
|
-
useProgressBarStyles_unstable
|
|
16
|
+
get useProgressBarStyles_unstable () {
|
|
17
17
|
return useProgressBarStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBarStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const progressBarClassNames: SlotClassNames<Omit<ProgressBarSlots, 'indeterminateMotion'>> = {\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\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n root: {\n display: 'block',\n backgroundColor: tokens.colorNeutralBackground6,\n width: '100%',\n overflow: 'hidden',\n\n '@media screen and (forced-colors: active)': {\n backgroundColor: 'CanvasText',\n },\n },\n rounded: {\n borderRadius: tokens.borderRadiusMedium,\n },\n square: {\n 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 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 '@media screen and (prefers-reduced-motion: reduce)': {\n // Reduced motion: bar is sized here, and the opacity is pulsed by ProgressBarIndeterminateMotion\n maxWidth: '100%',\n },\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\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\n state.bar.className = mergeClasses(\n progressBarClassNames.bar,\n barStyles.base,\n barStyles.brand,\n value === undefined && barStyles.indeterminate,\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 // eslint-disable-next-line react-hooks/immutability\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"],"names":["makeStyles","mergeClasses","tokens","progressBarClassNames","root","bar","ZERO_THRESHOLD","barThicknessValues","medium","large","useRootStyles","display","backgroundColor","colorNeutralBackground6","width","overflow","rounded","borderRadius","borderRadiusMedium","square","borderRadiusNone","height","useBarStyles","base","nonZeroDeterminate","transitionProperty","transitionDuration","transitionTimingFunction","indeterminate","maxWidth","position","backgroundImage","colorTransparentBackground","brand","colorCompoundBrandBackground","error","colorPaletteRedBackground3","warning","colorPaletteDarkOrangeBackground3","success","colorPaletteGreenBackground3","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","rootStyles","barStyles","className","undefined","style","Math","min"],"mappings":"AAAA;;;;;;;;;;;;QAOaG;;;QA2FAsC;;;;uBAhG4B,iBAAiB;4BACnC,wBAAwB;AAIxC,8BAA6F;IAClGrC,MAAM;IACNC,KAAK;AACP,EAAE;AAEF,sDAAsD;AACtD,oDAAoD;AACpD,MAAMC,iBAAiB;AAEvB,MAAMC,qBAAqB;IACzBC,QAAQ;IACRC,OAAO;AACT;AAEA;;CAEC,GACD,MAAMC,oBAAgBV,iBAAAA,EAAW;I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B,MAAMtC,IAAI,CAAC8C,SAAS,OAAGjD,mBAAAA,EACrBE,sBAAsBC,IAAI,EAC1B4C,WAAW5C,IAAI,EACf4C,UAAU,CAACH,MAAM,EACjBG,UAAU,CAACF,UAAU,EACrBJ,MAAMtC,IAAI,CAAC8C,SAAS;IAGtB,IAAIR,MAAMrC,GAAG,EAAE;QACb,oDAAoD;QACpDqC,MAAMrC,GAAG,CAAC6C,SAAS,OAAGjD,mBAAAA,EACpBE,sBAAsBE,GAAG,EACzB4C,UAAU1B,IAAI,EACd0B,UAAUhB,KAAK,EACfc,UAAUI,aAAaF,UAAUrB,aAAa,EAC9CmB,UAAUI,aAAaJ,QAAQzC,kBAAkB2C,UAAUzB,kBAAkB,EAC7EmB,SAASI,UAAUI,aAAaF,SAAS,CAACN,MAAM,EAChDD,MAAMrC,GAAG,CAAC6C,SAAS;IAEvB;IAEA,IAAIR,MAAMrC,GAAG,IAAI0C,UAAUI,WAAW;QACpC,oDAAoD;QACpDT,MAAMrC,GAAG,CAAC+C,KAAK,GAAG;YAChBtC,OAAOuC,KAAKC,GAAG,CAAC,KAAKD,KAAKT,GAAG,CAAC,GAAIG,QAAQH,MAAO,QAAQ;YACzD,GAAGF,MAAMrC,GAAG,CAAC+C,KAAK;QACpB;IACF;IAEA,OAAOV;AACT,EAAE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get progressBarClassNames () {
|
|
13
|
+
return progressBarClassNames;
|
|
14
|
+
},
|
|
15
|
+
get useProgressBarStyles_unstable () {
|
|
16
|
+
return useProgressBarStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _clsx = require("clsx");
|
|
21
|
+
const _ProgressBarmodulecss = /*#__PURE__*/ _interop_require_default._(require("./ProgressBar.module.css"));
|
|
22
|
+
const progressBarClassNames = {
|
|
23
|
+
root: 'fui-ProgressBar',
|
|
24
|
+
bar: 'fui-ProgressBar__bar'
|
|
25
|
+
};
|
|
26
|
+
const useProgressBarStyles_unstable = (state)=>{
|
|
27
|
+
const { color, max, shape, thickness, value } = state;
|
|
28
|
+
state.root.className = (0, _clsx.clsx)(progressBarClassNames.root, _ProgressBarmodulecss.default.root, _ProgressBarmodulecss.default[shape], _ProgressBarmodulecss.default[thickness], state.root.className);
|
|
29
|
+
if (state.bar) {
|
|
30
|
+
state.bar.className = (0, _clsx.clsx)(progressBarClassNames.bar, _ProgressBarmodulecss.default.bar, value === undefined && _ProgressBarmodulecss.default.indeterminate, value !== undefined && value > 0.01 && _ProgressBarmodulecss.default.nonZeroDeterminate, value !== undefined && color && _ProgressBarmodulecss.default[color], state.bar.className);
|
|
31
|
+
if (value !== undefined) {
|
|
32
|
+
state.bar.style = {
|
|
33
|
+
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
|
|
34
|
+
...state.bar.style
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return state;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ProgressBar/useProgressBarStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ProgressBarState, ProgressBarSlots } from './ProgressBar.types';\nimport styles from './ProgressBar.module.css';\n\nexport const progressBarClassNames: SlotClassNames<Omit<ProgressBarSlots, 'indeterminateMotion'>> = {\n root: 'fui-ProgressBar',\n bar: 'fui-ProgressBar__bar',\n};\n\nexport const useProgressBarStyles_unstable = (state: ProgressBarState): ProgressBarState => {\n const { color, max, shape, thickness, value } = state;\n state.root.className = clsx(\n progressBarClassNames.root,\n styles.root,\n styles[shape],\n styles[thickness],\n state.root.className,\n );\n if (state.bar) {\n state.bar.className = clsx(\n progressBarClassNames.bar,\n styles.bar,\n value === undefined && styles.indeterminate,\n value !== undefined && value > 0.01 && styles.nonZeroDeterminate,\n value !== undefined && color && styles[color],\n state.bar.className,\n );\n if (value !== undefined) {\n state.bar.style = { width: Math.min(100, Math.max(0, (value / max) * 100)) + '%', ...state.bar.style };\n }\n }\n return state;\n};\n"],"names":["clsx","styles","progressBarClassNames","root","bar","useProgressBarStyles_unstable","state","color","max","shape","thickness","value","className","undefined","indeterminate","nonZeroDeterminate","style","width","Math","min"],"mappings":";;;;;;;;;;;QAKaE;;;QAKAG;;;;;sBAVQ,OAAO;+EAGT,2BAA2B;AAEvC,8BAA6F;IAClGF,MAAM;IACNC,KAAK;AACP,EAAE;AAEK,sCAAsC,CAACE;IAC5C,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGL;IAChDA,MAAMH,IAAI,CAACS,SAAS,OAAGZ,UAAAA,EACrBE,sBAAsBC,IAAI,EAC1BF,6BAAAA,CAAOE,IAAI,EACXF,6BAAM,CAACQ,MAAM,EACbR,6BAAM,CAACS,UAAU,EACjBJ,MAAMH,IAAI,CAACS,SAAS;IAEtB,IAAIN,MAAMF,GAAG,EAAE;QACbE,MAAMF,GAAG,CAACQ,SAAS,OAAGZ,UAAAA,EACpBE,sBAAsBE,GAAG,EACzBH,6BAAAA,CAAOG,GAAG,EACVO,UAAUE,aAAaZ,6BAAAA,CAAOa,aAAa,EAC3CH,UAAUE,aAAaF,QAAQ,QAAQV,6BAAAA,CAAOc,kBAAkB,EAChEJ,UAAUE,aAAaN,SAASN,6BAAM,CAACM,MAAM,EAC7CD,MAAMF,GAAG,CAACQ,SAAS;QAErB,IAAID,UAAUE,WAAW;YACvBP,MAAMF,GAAG,CAACY,KAAK,GAAG;gBAAEC,OAAOC,KAAKC,GAAG,CAAC,KAAKD,KAAKV,GAAG,CAAC,GAAIG,QAAQH,MAAO,QAAQ;gBAAK,GAAGF,MAAMF,GAAG,CAACY,KAAK;YAAC;QACvG;IACF;IACA,OAAOV;AACT,EAAE"}
|
package/lib-commonjs/index.cjs
CHANGED
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
ProgressBar
|
|
12
|
+
get ProgressBar () {
|
|
13
13
|
return _ProgressBar.ProgressBar;
|
|
14
14
|
},
|
|
15
|
-
progressBarClassNames
|
|
15
|
+
get progressBarClassNames () {
|
|
16
16
|
return _ProgressBar.progressBarClassNames;
|
|
17
17
|
},
|
|
18
|
-
renderProgressBar_unstable
|
|
18
|
+
get renderProgressBar_unstable () {
|
|
19
19
|
return _ProgressBar.renderProgressBar_unstable;
|
|
20
20
|
},
|
|
21
|
-
useProgressBarBase_unstable
|
|
21
|
+
get useProgressBarBase_unstable () {
|
|
22
22
|
return _ProgressBar.useProgressBarBase_unstable;
|
|
23
23
|
},
|
|
24
|
-
useProgressBarStyles_unstable
|
|
24
|
+
get useProgressBarStyles_unstable () {
|
|
25
25
|
return _ProgressBar.useProgressBarStyles_unstable;
|
|
26
26
|
},
|
|
27
|
-
useProgressBar_unstable
|
|
27
|
+
get useProgressBar_unstable () {
|
|
28
28
|
return _ProgressBar.useProgressBar_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../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"],"names":["clampMax","max","internalMax","process","env","NODE_ENV","console","error"],"mappings":";;;;+BAAaA;;;;;;AAAN,iBAAiB,CAACC;IACvB,MAAMC,cAAcD,OAAO,IAAI,IAAIA;IAEnC,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAIJ,OAAO,GAAG;YACZ,sCAAsC;YACtCK,QAAQC,KAAK,CAAC,CAAC,qDAAqD,EAAEN,KAAK;QAC7E;IACF;IACA,OAAOC;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../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"],"names":["clampValue","value","max","undefined","internalValue","process","env","NODE_ENV","console","error"],"mappings":";;;;+BAAaA;;;;;;AAAN,mBAAmB,CAACC,OAA2BC;IACpD,IAAID,UAAUE,WAAW;QACvB,OAAOF;IACT;IACA,MAAMG,gBAAgBH,QAAQ,IAAI,IAAIA,QAAQC,MAAMA,MAAMD;IAE1D,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAIN,QAAQ,GAAG;YACb,sCAAsC;YACtCO,QAAQC,KAAK,CAAC,CAAC,wEAAwE,EAAER,OAAO;QAClG;QACA,IAAIA,QAAQC,KAAK;YACf,sCAAsC;YACtCM,QAAQC,KAAK,CAAC,CAAC,sEAAsE,EAAER,MAAM,OAAO,EAAEC,KAAK;QAC7G;IACF;IACA,OAAOE;AACT,EAAE"}
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
clampMax
|
|
12
|
+
get clampMax () {
|
|
13
13
|
return _clampMax.clampMax;
|
|
14
14
|
},
|
|
15
|
-
clampValue
|
|
15
|
+
get clampValue () {
|
|
16
16
|
return _clampValue.clampValue;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export { clampMax } from './clampMax';\nexport { clampValue } from './clampValue';\n"],"names":["clampMax","clampValue"],"mappings":";;;;;;;;;;;;eAASA,kBAAQ;;;eACRC,sBAAU;;;0BADM,gBAAa;4BACX,kBAAe"}
|
package/package.json
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-progress",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
4
4
|
"description": "Progress component for FluentUI v9",
|
|
5
5
|
"main": "lib-commonjs/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
|
-
"sideEffects":
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
13
|
"url": "https://github.com/microsoft/fluentui"
|
|
12
14
|
},
|
|
13
15
|
"license": "MIT",
|
|
14
16
|
"dependencies": {
|
|
15
|
-
"@fluentui/react-field": "9.
|
|
16
|
-
"@fluentui/react-jsx-runtime": "9.
|
|
17
|
-
"@fluentui/react-motion": "9.
|
|
18
|
-
"@fluentui/react-shared-contexts": "9.
|
|
19
|
-
"@fluentui/react-theme": "9.
|
|
20
|
-
"@fluentui/react-utilities": "9.
|
|
17
|
+
"@fluentui/react-field": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
18
|
+
"@fluentui/react-jsx-runtime": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
19
|
+
"@fluentui/react-motion": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
20
|
+
"@fluentui/react-shared-contexts": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
21
|
+
"@fluentui/react-theme": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
22
|
+
"@fluentui/react-utilities": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
21
23
|
"@griffel/react": "^1.5.32",
|
|
22
|
-
"@swc/helpers": "^0.5.1"
|
|
24
|
+
"@swc/helpers": "^0.5.1",
|
|
25
|
+
"clsx": "^2.1.1"
|
|
23
26
|
},
|
|
24
27
|
"peerDependencies": {
|
|
25
28
|
"@types/react": ">=16.14.0 <20.0.0",
|