Private
Public Access
1
0

feat: Fluent UI Outlook Lite + connections mockup

This commit is contained in:
2026-04-14 18:52:25 +00:00
parent 1199eff6c3
commit dfa4010406
34820 changed files with 1003813 additions and 205 deletions

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ProgressBar: function() {
return _index.ProgressBar;
},
progressBarClassNames: function() {
return _index.progressBarClassNames;
},
renderProgressBar_unstable: function() {
return _index.renderProgressBar_unstable;
},
useProgressBarBase_unstable: function() {
return _index.useProgressBarBase_unstable;
},
useProgressBarStyles_unstable: function() {
return _index.useProgressBarStyles_unstable;
},
useProgressBar_unstable: function() {
return _index.useProgressBar_unstable;
}
});
const _index = require("./components/ProgressBar/index");

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/ProgressBar.ts"],"sourcesContent":["export type {\n ProgressBarProps,\n ProgressBarBaseProps,\n ProgressBarSlots,\n ProgressBarState,\n ProgressBarBaseState,\n} from './components/ProgressBar/index';\nexport {\n ProgressBar,\n progressBarClassNames,\n renderProgressBar_unstable,\n useProgressBarStyles_unstable,\n useProgressBar_unstable,\n useProgressBarBase_unstable,\n} from './components/ProgressBar/index';\n"],"names":["ProgressBar","progressBarClassNames","renderProgressBar_unstable","useProgressBarStyles_unstable","useProgressBar_unstable","useProgressBarBase_unstable"],"mappings":";;;;;;;;;;;;eAQEA,kBAAW;;;eACXC,4BAAqB;;;eACrBC,iCAA0B;;;eAG1BG,kCAA2B;;;eAF3BF,oCAA6B;;;eAC7BC,8BAAuB;;;uBAElB,iCAAiC"}

View File

@@ -0,0 +1,24 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ProgressBar", {
enumerable: true,
get: function() {
return ProgressBar;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _useProgressBar = require("./useProgressBar");
const _renderProgressBar = require("./renderProgressBar");
const _useProgressBarStylesstyles = require("./useProgressBarStyles.styles");
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
const ProgressBar = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
const state = (0, _useProgressBar.useProgressBar_unstable)(props, ref);
(0, _useProgressBarStylesstyles.useProgressBarStyles_unstable)(state);
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useProgressBarStyles_unstable')(state);
return (0, _renderProgressBar.renderProgressBar_unstable)(state);
});
ProgressBar.displayName = 'ProgressBar';

View File

@@ -0,0 +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,mBAAmB;mCAChB,sBAAsB;4CACnB,gCAAgC;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"}

View File

@@ -0,0 +1,6 @@
/**
* ProgressBar base state — excludes design props (shape, thickness, color).
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});

View File

@@ -0,0 +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"}

View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ProgressBar: function() {
return _ProgressBar.ProgressBar;
},
progressBarClassNames: function() {
return _useProgressBarStylesstyles.progressBarClassNames;
},
renderProgressBar_unstable: function() {
return _renderProgressBar.renderProgressBar_unstable;
},
useProgressBarBase_unstable: function() {
return _useProgressBar.useProgressBarBase_unstable;
},
useProgressBarStyles_unstable: function() {
return _useProgressBarStylesstyles.useProgressBarStyles_unstable;
},
useProgressBar_unstable: function() {
return _useProgressBar.useProgressBar_unstable;
}
});
const _ProgressBar = require("./ProgressBar");
const _renderProgressBar = require("./renderProgressBar");
const _useProgressBar = require("./useProgressBar");
const _useProgressBarStylesstyles = require("./useProgressBarStyles.styles");

View File

@@ -0,0 +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,gBAAgB;mCAQD,sBAAsB;gCACI,mBAAmB;4CACnB,gCAAgC"}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ProgressBarIndeterminateMotion", {
enumerable: true,
get: function() {
return ProgressBarIndeterminateMotion;
}
});
const _reactmotion = require("@fluentui/react-motion");
const ProgressBarIndeterminateMotion = (0, _reactmotion.createMotionComponent)({
// translate percentages are relative to the element's own width, not the container's.
// The indeterminate bar is ~33% the width of its container, so:
// translate: '-100%' === left: '-33%' (one bar-width off-screen to the left)
// translate: '300%' === left: '100%' (3 × bar-width ≈ full container width, off-screen to the right)
keyframes: [
{
translate: '-100%'
},
{
translate: '300%'
}
],
duration: 3000,
iterations: Infinity,
easing: _reactmotion.motionTokens.curveLinear,
reducedMotion: {
keyframes: [
{
opacity: 0.2
},
{
opacity: 1
},
{
opacity: 0.2
}
],
duration: 3000,
iterations: Infinity
}
});

View File

@@ -0,0 +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"}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "renderProgressBar_unstable", {
enumerable: true,
get: function() {
return renderProgressBar_unstable;
}
});
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
const _reactutilities = require("@fluentui/react-utilities");
const renderProgressBar_unstable = (state)=>{
(0, _reactutilities.assertSlots)(state);
return /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {
children: state.bar && (state.indeterminateMotion ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.indeterminateMotion, {
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.bar, {})
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(state.bar, {}))
});
};

View File

@@ -0,0 +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;;;;;;4BATb,gDAAiD;gCAErB,4BAA4B;AAOjD,mCAAmC,CAACC;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"}

View File

@@ -0,0 +1,84 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
useProgressBarBase_unstable: function() {
return useProgressBarBase_unstable;
},
useProgressBar_unstable: function() {
return useProgressBar_unstable;
}
});
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactfield = require("@fluentui/react-field");
const _reactmotion = require("@fluentui/react-motion");
const _reactutilities = require("@fluentui/react-utilities");
const _index = require("../../utils/index");
const _progressBarMotions = require("./progressBarMotions");
const useProgressBar_unstable = (props, ref)=>{
const field = (0, _reactfield.useFieldContext_unstable)();
const fieldState = field === null || field === void 0 ? void 0 : field.validationState;
const { color = fieldState === 'error' || fieldState === 'warning' || fieldState === 'success' ? fieldState : 'brand', shape = 'rounded', thickness = 'medium', indeterminateMotion, ...baseProps } = props;
const state = useProgressBarBase_unstable(baseProps, ref);
return {
...state,
color,
shape,
thickness,
indeterminateMotion: state.value === undefined ? (0, _reactmotion.motionSlot)(indeterminateMotion, {
elementType: _progressBarMotions.ProgressBarIndeterminateMotion,
defaultProps: {}
}) : undefined
};
};
const useProgressBarBase_unstable = (props, ref)=>{
const field = (0, _reactfield.useFieldContext_unstable)();
var _props_max;
const max = (0, _index.clampMax)((_props_max = props.max) !== null && _props_max !== void 0 ? _props_max : 1);
const value = (0, _index.clampValue)(props.value, max);
const root = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
// FIXME:
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
ref: ref,
role: 'progressbar',
'aria-valuemin': value !== undefined ? 0 : undefined,
'aria-valuemax': value !== undefined ? max : undefined,
'aria-valuenow': value,
'aria-labelledby': field === null || field === void 0 ? void 0 : field.labelId,
...props
}), {
elementType: 'div'
});
if (field && (field.validationMessageId || field.hintId)) {
// Prepend the field's validation message and/or hint to the user's aria-describedby
root['aria-describedby'] = [
field === null || field === void 0 ? void 0 : field.validationMessageId,
field === null || field === void 0 ? void 0 : field.hintId,
root['aria-describedby']
].filter(Boolean).join(' ');
}
const bar = _reactutilities.slot.always(props.bar, {
elementType: 'div'
});
return {
max,
value,
components: {
root: 'div',
bar: 'div',
indeterminateMotion: _progressBarMotions.ProgressBarIndeterminateMotion
},
root,
bar
};
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,189 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
progressBarClassNames: function() {
return progressBarClassNames;
},
useProgressBarStyles_unstable: function() {
return useProgressBarStyles_unstable;
}
});
const _react = require("@griffel/react");
const progressBarClassNames = {
root: 'fui-ProgressBar',
bar: 'fui-ProgressBar__bar'
};
// If the percentComplete is near 0, don't animate it.
// This prevents animations on reset to 0 scenarios.
const ZERO_THRESHOLD = 0.01;
const barThicknessValues = {
medium: '2px',
large: '4px'
};
/**
* Styles for the root slot
*/ const useRootStyles = /*#__PURE__*/ (0, _react.__styles)({
root: {
mc9l5x: "ftgm304",
De3pzq: "f18f03hv",
a9b677: "fly5x3f",
B68tc82: 0,
Bmxbyg5: 0,
Bpg54ce: "f1a3p1vp",
Bomf52o: "f1skxd4g"
},
rounded: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "ft85np5"
},
square: {
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f1fabniw"
},
medium: {
Bqenvij: "f4t8t6x"
},
large: {
Bqenvij: "f6ywr7j"
}
}, {
d: [
".ftgm304{display:block;}",
".f18f03hv{background-color:var(--colorNeutralBackground6);}",
".fly5x3f{width:100%;}",
[
".f1a3p1vp{overflow:hidden;}",
{
p: -1
}
],
[
".ft85np5{border-radius:var(--borderRadiusMedium);}",
{
p: -1
}
],
[
".f1fabniw{border-radius:var(--borderRadiusNone);}",
{
p: -1
}
],
".f4t8t6x{height:2px;}",
".f6ywr7j{height:4px;}"
],
m: [
[
"@media screen and (forced-colors: active){.f1skxd4g{background-color:CanvasText;}}",
{
m: "screen and (forced-colors: active)"
}
]
]
});
/**
* Styles for the ProgressBar bar
*/ const useBarStyles = /*#__PURE__*/ (0, _react.__styles)({
base: {
Bomf52o: "f1tnpuu0",
Beyfa6y: 0,
Bbmb7ep: 0,
Btl43ni: 0,
B7oj6ja: 0,
Dimara: "f12b9xdw",
Bqenvij: "f1l02sjl"
},
nonZeroDeterminate: {
Bmy1vo4: "fjt6zfz",
B3o57yi: "f1wofebd",
Bkqvd7p: "fv71qf3"
},
indeterminate: {
B2u0y6b: "fa0wk36",
qhf8xq: "f10pi13n",
Bcmaq0h: [
"fpo0yib",
"f1u5hf6c"
],
jpy9cc: "f3z2g5w"
},
brand: {
De3pzq: "ftywsgz"
},
error: {
De3pzq: "fdl5y0r"
},
warning: {
De3pzq: "f1s438gw"
},
success: {
De3pzq: "flxk52p"
}
}, {
m: [
[
"@media screen and (forced-colors: active){.f1tnpuu0{background-color:Highlight;}}",
{
m: "screen and (forced-colors: active)"
}
],
[
"@media screen and (prefers-reduced-motion: reduce){.f3z2g5w{max-width:100%;}}",
{
m: "screen and (prefers-reduced-motion: reduce)"
}
]
],
d: [
[
".f12b9xdw{border-radius:inherit;}",
{
p: -1
}
],
".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 );}",
".ftywsgz{background-color:var(--colorCompoundBrandBackground);}",
".fdl5y0r{background-color:var(--colorPaletteRedBackground3);}",
".f1s438gw{background-color:var(--colorPaletteDarkOrangeBackground3);}",
".flxk52p{background-color:var(--colorPaletteGreenBackground3);}"
]
});
const useProgressBarStyles_unstable = (state)=>{
'use no memo';
const { color, max, shape, thickness, value } = state;
const rootStyles = useRootStyles();
const barStyles = useBarStyles();
state.root.className = (0, _react.mergeClasses)(progressBarClassNames.root, rootStyles.root, rootStyles[shape], rootStyles[thickness], state.root.className);
if (state.bar) {
state.bar.className = (0, _react.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);
}
if (state.bar && value !== undefined) {
state.bar.style = {
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
...state.bar.style
};
}
return state;
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,116 @@
'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
progressBarClassNames: function() {
return progressBarClassNames;
},
useProgressBarStyles_unstable: function() {
return useProgressBarStyles_unstable;
}
});
const _react = require("@griffel/react");
const _reacttheme = require("@fluentui/react-theme");
const progressBarClassNames = {
root: 'fui-ProgressBar',
bar: 'fui-ProgressBar__bar'
};
// If the percentComplete is near 0, don't animate it.
// This prevents animations on reset to 0 scenarios.
const ZERO_THRESHOLD = 0.01;
const barThicknessValues = {
medium: '2px',
large: '4px'
};
/**
* Styles for the root slot
*/ const useRootStyles = (0, _react.makeStyles)({
root: {
display: 'block',
backgroundColor: _reacttheme.tokens.colorNeutralBackground6,
width: '100%',
overflow: 'hidden',
'@media screen and (forced-colors: active)': {
backgroundColor: 'CanvasText'
}
},
rounded: {
borderRadius: _reacttheme.tokens.borderRadiusMedium
},
square: {
borderRadius: _reacttheme.tokens.borderRadiusNone
},
medium: {
height: barThicknessValues.medium
},
large: {
height: barThicknessValues.large
}
});
/**
* Styles for the ProgressBar bar
*/ const useBarStyles = (0, _react.makeStyles)({
base: {
'@media screen and (forced-colors: active)': {
backgroundColor: 'Highlight'
},
borderRadius: 'inherit',
height: '100%'
},
nonZeroDeterminate: {
transitionProperty: 'width',
transitionDuration: '0.3s',
transitionTimingFunction: 'ease'
},
indeterminate: {
maxWidth: '33%',
position: 'relative',
backgroundImage: `linear-gradient(
to right,
${_reacttheme.tokens.colorNeutralBackground6} 0%,
${_reacttheme.tokens.colorTransparentBackground} 50%,
${_reacttheme.tokens.colorNeutralBackground6} 100%
)`,
'@media screen and (prefers-reduced-motion: reduce)': {
// Reduced motion: bar is sized here, and the opacity is pulsed by ProgressBarIndeterminateMotion
maxWidth: '100%'
}
},
brand: {
backgroundColor: _reacttheme.tokens.colorCompoundBrandBackground
},
error: {
backgroundColor: _reacttheme.tokens.colorPaletteRedBackground3
},
warning: {
backgroundColor: _reacttheme.tokens.colorPaletteDarkOrangeBackground3
},
success: {
backgroundColor: _reacttheme.tokens.colorPaletteGreenBackground3
}
});
const useProgressBarStyles_unstable = (state)=>{
'use no memo';
const { color, max, shape, thickness, value } = state;
const rootStyles = useRootStyles();
const barStyles = useBarStyles();
state.root.className = (0, _react.mergeClasses)(progressBarClassNames.root, rootStyles.root, rootStyles[shape], rootStyles[thickness], state.root.className);
if (state.bar) {
state.bar.className = (0, _react.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);
}
if (state.bar && value !== undefined) {
state.bar.style = {
width: Math.min(100, Math.max(0, value / max * 100)) + '%',
...state.bar.style
};
}
return state;
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ProgressBar: function() {
return _ProgressBar.ProgressBar;
},
progressBarClassNames: function() {
return _ProgressBar.progressBarClassNames;
},
renderProgressBar_unstable: function() {
return _ProgressBar.renderProgressBar_unstable;
},
useProgressBarBase_unstable: function() {
return _ProgressBar.useProgressBarBase_unstable;
},
useProgressBarStyles_unstable: function() {
return _ProgressBar.useProgressBarStyles_unstable;
},
useProgressBar_unstable: function() {
return _ProgressBar.useProgressBar_unstable;
}
});
const _ProgressBar = require("./ProgressBar");

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n ProgressBar,\n progressBarClassNames,\n renderProgressBar_unstable,\n useProgressBar_unstable,\n useProgressBarStyles_unstable,\n useProgressBarBase_unstable,\n} from './ProgressBar';\nexport type {\n ProgressBarProps,\n ProgressBarSlots,\n ProgressBarState,\n ProgressBarBaseProps,\n ProgressBarBaseState,\n} from './ProgressBar';\n"],"names":["ProgressBar","progressBarClassNames","renderProgressBar_unstable","useProgressBar_unstable","useProgressBarStyles_unstable","useProgressBarBase_unstable"],"mappings":";;;;;;;;;;;;eACEA,wBAAW;;;eACXC,kCAAqB;;;eACrBC,uCAA0B;;;eAG1BG,wCAA2B;;;eAD3BD,0CAA6B;;;eAD7BD,oCAAuB;;;6BAGlB,gBAAgB"}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "clampMax", {
enumerable: true,
get: function() {
return clampMax;
}
});
const clampMax = (max)=>{
const internalMax = max <= 0 ? 1 : max;
if (process.env.NODE_ENV !== 'production') {
if (max <= 0) {
// eslint-disable-next-line no-console
console.error(`The prop 'max' must be greater than 0. Received max: ${max}`);
}
}
return internalMax;
};

View File

@@ -0,0 +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"}

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "clampValue", {
enumerable: true,
get: function() {
return clampValue;
}
});
const clampValue = (value, max)=>{
if (value === undefined) {
return value;
}
const internalValue = value < 0 ? 0 : value > max ? max : value;
if (process.env.NODE_ENV !== 'production') {
if (value < 0) {
// eslint-disable-next-line no-console
console.error(`The prop 'value' must be greater than or equal to zero. Received value: ${value}`);
}
if (value > max) {
// eslint-disable-next-line no-console
console.error(`The prop 'value' must be less than or equal to 'max'. Received value: ${value}, max: ${max}`);
}
}
return internalValue;
};

View File

@@ -0,0 +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"}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
clampMax: function() {
return _clampMax.clampMax;
},
clampValue: function() {
return _clampValue.clampValue;
}
});
const _clampMax = require("./clampMax");
const _clampValue = require("./clampValue");

View File

@@ -0,0 +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,aAAa;4BACX,eAAe"}