first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
@@ -0,0 +1,19 @@
import * as React from 'react';
import type { IProgressIndicatorProps } from './ProgressIndicator.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* ProgressIndicator with no default styles.
* [Use the `styles` API to add your own styles.](https://github.com/microsoft/fluentui/wiki/Styling)
*/
export declare class ProgressIndicatorBase extends React.Component<IProgressIndicatorProps, {}> {
static defaultProps: {
label: string;
description: string;
width: number;
};
private _labelId;
private _descriptionId;
constructor(props: IProgressIndicatorProps);
render(): JSXElement;
private _onRenderProgress;
}
@@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgressIndicatorBase = void 0;
var tslib_1 = require("tslib");
var React = require("react");
var Utilities_1 = require("../../Utilities");
var getClassNames = (0, Utilities_1.classNamesFunction)();
// if the percentComplete is near 0, don't animate it.
// This prevents animations on reset to 0 scenarios
var ZERO_THRESHOLD = 0.01;
/**
* ProgressIndicator with no default styles.
* [Use the `styles` API to add your own styles.](https://github.com/microsoft/fluentui/wiki/Styling)
*/
var ProgressIndicatorBase = /** @class */ (function (_super) {
tslib_1.__extends(ProgressIndicatorBase, _super);
function ProgressIndicatorBase(props) {
var _this = _super.call(this, props) || this;
_this._onRenderProgress = function (props) {
var _a = _this.props, ariaLabel = _a.ariaLabel, ariaValueText = _a.ariaValueText, barHeight = _a.barHeight, className = _a.className, description = _a.description,
// eslint-disable-next-line @typescript-eslint/no-deprecated
_b = _a.label,
// eslint-disable-next-line @typescript-eslint/no-deprecated
label = _b === void 0 ? _this.props.title : _b, styles = _a.styles, theme = _a.theme;
var percentComplete = typeof _this.props.percentComplete === 'number'
? Math.min(100, Math.max(0, _this.props.percentComplete * 100))
: undefined;
var classNames = getClassNames(styles, {
theme: theme,
className: className,
barHeight: barHeight,
indeterminate: percentComplete === undefined ? true : false,
});
var progressBarStyles = {
width: percentComplete !== undefined ? percentComplete + '%' : undefined,
transition: percentComplete !== undefined && percentComplete < ZERO_THRESHOLD ? 'none' : undefined,
};
var ariaValueMin = percentComplete !== undefined ? 0 : undefined;
var ariaValueMax = percentComplete !== undefined ? 100 : undefined;
var ariaValueNow = percentComplete !== undefined ? Math.floor(percentComplete) : undefined;
return (React.createElement("div", { className: classNames.itemProgress },
React.createElement("div", { className: classNames.progressTrack }),
React.createElement("div", { className: classNames.progressBar, style: progressBarStyles, role: "progressbar", "aria-describedby": description ? _this._descriptionId : undefined, "aria-label": ariaLabel, "aria-labelledby": label ? _this._labelId : undefined, "aria-valuemin": ariaValueMin, "aria-valuemax": ariaValueMax, "aria-valuenow": ariaValueNow, "aria-valuetext": ariaValueText })));
};
var id = (0, Utilities_1.getId)('progress-indicator');
_this._labelId = id + '-label';
_this._descriptionId = id + '-description';
return _this;
}
ProgressIndicatorBase.prototype.render = function () {
var _a = this.props, barHeight = _a.barHeight, className = _a.className,
// eslint-disable-next-line @typescript-eslint/no-deprecated
_b = _a.label,
// eslint-disable-next-line @typescript-eslint/no-deprecated
label = _b === void 0 ? this.props.title : _b, // Fall back to deprecated value.
description = _a.description, styles = _a.styles, theme = _a.theme, progressHidden = _a.progressHidden, _c = _a.onRenderProgress, onRenderProgress = _c === void 0 ? this._onRenderProgress : _c;
var percentComplete = typeof this.props.percentComplete === 'number'
? Math.min(100, Math.max(0, this.props.percentComplete * 100))
: undefined;
var classNames = getClassNames(styles, {
theme: theme,
className: className,
barHeight: barHeight,
indeterminate: percentComplete === undefined ? true : false,
});
return (React.createElement("div", { className: classNames.root },
label ? (React.createElement("div", { id: this._labelId, className: classNames.itemName }, label)) : null,
!progressHidden
? onRenderProgress(tslib_1.__assign(tslib_1.__assign({}, this.props), { percentComplete: percentComplete }), this._onRenderProgress)
: null,
description ? (React.createElement("div", { id: this._descriptionId, className: classNames.itemDescription }, description)) : null));
};
ProgressIndicatorBase.defaultProps = {
label: '',
description: '',
width: 180,
};
return ProgressIndicatorBase;
}(React.Component));
exports.ProgressIndicatorBase = ProgressIndicatorBase;
//# sourceMappingURL=ProgressIndicator.base.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
import * as React from 'react';
import type { IProgressIndicatorProps } from './ProgressIndicator.types';
/**
* ProgressIndicator description
*/
export declare const ProgressIndicator: React.FunctionComponent<IProgressIndicatorProps>;
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgressIndicator = void 0;
var Utilities_1 = require("../../Utilities");
var ProgressIndicator_base_1 = require("./ProgressIndicator.base");
var ProgressIndicator_styles_1 = require("./ProgressIndicator.styles");
/**
* ProgressIndicator description
*/
exports.ProgressIndicator = (0, Utilities_1.styled)(ProgressIndicator_base_1.ProgressIndicatorBase, ProgressIndicator_styles_1.getStyles, undefined, { scope: 'ProgressIndicator' });
//# sourceMappingURL=ProgressIndicator.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ProgressIndicator.js","sourceRoot":"../src/","sources":["components/ProgressIndicator/ProgressIndicator.tsx"],"names":[],"mappings":";;;AACA,6CAAyC;AACzC,mEAAiE;AACjE,uEAAuD;AAOvD;;GAEG;AACU,QAAA,iBAAiB,GAAqD,IAAA,kBAAM,EAIvF,8CAAqB,EAAE,oCAAS,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { styled } from '../../Utilities';\nimport { ProgressIndicatorBase } from './ProgressIndicator.base';\nimport { getStyles } from './ProgressIndicator.styles';\nimport type {\n IProgressIndicatorProps,\n IProgressIndicatorStyleProps,\n IProgressIndicatorStyles,\n} from './ProgressIndicator.types';\n\n/**\n * ProgressIndicator description\n */\nexport const ProgressIndicator: React.FunctionComponent<IProgressIndicatorProps> = styled<\n IProgressIndicatorProps,\n IProgressIndicatorStyleProps,\n IProgressIndicatorStyles\n>(ProgressIndicatorBase, getStyles, undefined, { scope: 'ProgressIndicator' });\n"]}
@@ -0,0 +1,2 @@
import type { IProgressIndicatorStyleProps, IProgressIndicatorStyles } from './ProgressIndicator.types';
export declare const getStyles: (props: IProgressIndicatorStyleProps) => IProgressIndicatorStyles;
@@ -0,0 +1,118 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
var tslib_1 = require("tslib");
var Styling_1 = require("../../Styling");
var Utilities_1 = require("../../Utilities");
var GlobalClassNames = {
root: 'ms-ProgressIndicator',
itemName: 'ms-ProgressIndicator-itemName',
itemDescription: 'ms-ProgressIndicator-itemDescription',
itemProgress: 'ms-ProgressIndicator-itemProgress',
progressTrack: 'ms-ProgressIndicator-progressTrack',
progressBar: 'ms-ProgressIndicator-progressBar',
};
var IndeterminateProgress = (0, Utilities_1.memoizeFunction)(function () {
return (0, Styling_1.keyframes)({
'0%': {
left: '-30%',
},
'100%': {
left: '100%',
},
});
});
var IndeterminateProgressRTL = (0, Utilities_1.memoizeFunction)(function () {
return (0, Styling_1.keyframes)({
'100%': {
right: '-30%',
},
'0%': {
right: '100%',
},
});
});
var getStyles = function (props) {
var _a, _b, _c;
var isRTL = (0, Utilities_1.getRTL)(props.theme);
var className = props.className, indeterminate = props.indeterminate, theme = props.theme, _d = props.barHeight, barHeight = _d === void 0 ? 2 : _d;
var palette = theme.palette, semanticColors = theme.semanticColors, fonts = theme.fonts;
var classNames = (0, Styling_1.getGlobalClassNames)(GlobalClassNames, theme);
var marginBetweenText = 8;
var textHeight = 18;
var progressTrackColor = palette.neutralLight;
return {
root: [classNames.root, fonts.medium, className],
itemName: [
classNames.itemName,
Styling_1.noWrap,
{
color: semanticColors.bodyText,
paddingTop: marginBetweenText / 2,
lineHeight: textHeight + 2,
},
],
itemDescription: [
classNames.itemDescription,
{
color: semanticColors.bodySubtext,
fontSize: fonts.small.fontSize,
lineHeight: textHeight,
},
],
itemProgress: [
classNames.itemProgress,
{
position: 'relative',
overflow: 'hidden',
height: barHeight,
padding: "".concat(marginBetweenText, "px 0"),
},
],
progressTrack: [
classNames.progressTrack,
{
position: 'absolute',
width: '100%',
height: barHeight,
backgroundColor: progressTrackColor,
selectors: (_a = {},
_a[Styling_1.HighContrastSelector] = {
borderBottom: '1px solid WindowText',
},
_a),
},
],
progressBar: [
{
backgroundColor: palette.themePrimary,
height: barHeight,
position: 'absolute',
transition: 'width .3s ease',
width: 0,
selectors: (_b = {},
_b[Styling_1.HighContrastSelector] = tslib_1.__assign({ backgroundColor: 'highlight' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_b),
},
indeterminate
? {
position: 'absolute',
minWidth: '33%',
background: "linear-gradient(to right, ".concat(progressTrackColor, " 0%, ") +
"".concat(palette.themePrimary, " 50%, ").concat(progressTrackColor, " 100%)"),
animation: "".concat(isRTL ? IndeterminateProgressRTL() : IndeterminateProgress(), " 3s infinite"),
selectors: (_c = {},
_c[Styling_1.HighContrastSelector] = {
background: "highlight",
},
_c),
}
: {
transition: 'width .15s linear',
},
classNames.progressBar,
],
};
};
exports.getStyles = getStyles;
//# sourceMappingURL=ProgressIndicator.styles.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,90 @@
import * as React from 'react';
import { ProgressIndicatorBase } from './ProgressIndicator.base';
import type { IStyle, ITheme } from '../../Styling';
import type { IStyleFunctionOrObject, IRenderFunction } from '../../Utilities';
/**
* {@docCategory ProgressIndicator}
*/
export interface IProgressIndicatorProps extends React.ClassAttributes<ProgressIndicatorBase> {
/**
* Call to provide customized styling that will layer on top of the variant rules.
*/
styles?: IStyleFunctionOrObject<IProgressIndicatorStyleProps, IProgressIndicatorStyles>;
/**
* Theme provided by High-Order Component.
*/
theme?: ITheme;
/**
* Additional css class to apply to the ProgressIndicator
* @defaultvalue undefined
*/
className?: string;
/**
* Label to display above the control. May be a string or React virtual elements.
*/
label?: React.ReactNode;
/**
* Add screen-reader-only label text to the progressbar.
* Prefer `label`, and use this only when other text or visual context provides a visible label
*/
ariaLabel?: string;
/**
* Text describing or supplementing the operation. May be a string or React virtual elements.
*/
description?: React.ReactNode;
/**
* Percentage of the operation's completeness, numerically between 0 and 1. If this is not set,
* the indeterminate progress animation will be shown instead.
*/
percentComplete?: number;
/**
* Whether or not to hide the progress state.
*/
progressHidden?: boolean;
/**
* A render override for the progress track.
*/
onRenderProgress?: IRenderFunction<IProgressIndicatorProps>;
/**
* Text alternative of the progress status, used by screen readers for reading the value of the progress.
*/
ariaValueText?: string;
/**
* @deprecated Use `label` instead. Deprecated at v0.43.0, to be removed at \>= v0.53.0.
*/
title?: string;
/**
* Height of the ProgressIndicator
* @defaultvalue 2
*/
barHeight?: number;
}
/**
* {@docCategory ProgressIndicator}
*/
export interface IProgressIndicatorStyleProps {
/**
* Theme provided by High-Order Component.
*/
theme: ITheme;
/**
* Accept custom classNames
*/
className?: string;
indeterminate?: boolean;
barHeight?: number;
}
/**
* {@docCategory ProgressIndicator}
*/
export interface IProgressIndicatorStyles {
/**
* Style for the root element.
*/
root: IStyle;
itemName: IStyle;
itemDescription: IStyle;
itemProgress: IStyle;
progressTrack: IStyle;
progressBar: IStyle;
}
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=ProgressIndicator.types.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ProgressIndicator.types.js","sourceRoot":"../src/","sources":["components/ProgressIndicator/ProgressIndicator.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ProgressIndicatorBase } from './ProgressIndicator.base';\nimport type { IStyle, ITheme } from '../../Styling';\nimport type { IStyleFunctionOrObject, IRenderFunction } from '../../Utilities';\n\n/**\n * {@docCategory ProgressIndicator}\n */\nexport interface IProgressIndicatorProps extends React.ClassAttributes<ProgressIndicatorBase> {\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IProgressIndicatorStyleProps, IProgressIndicatorStyles>;\n\n /**\n * Theme provided by High-Order Component.\n */\n theme?: ITheme;\n\n /**\n * Additional css class to apply to the ProgressIndicator\n * @defaultvalue undefined\n */\n className?: string;\n\n /**\n * Label to display above the control. May be a string or React virtual elements.\n */\n label?: React.ReactNode;\n\n /**\n * Add screen-reader-only label text to the progressbar.\n * Prefer `label`, and use this only when other text or visual context provides a visible label\n */\n ariaLabel?: string;\n\n /**\n * Text describing or supplementing the operation. May be a string or React virtual elements.\n */\n description?: React.ReactNode;\n\n /**\n * Percentage of the operation's completeness, numerically between 0 and 1. If this is not set,\n * the indeterminate progress animation will be shown instead.\n */\n percentComplete?: number;\n\n /**\n * Whether or not to hide the progress state.\n */\n progressHidden?: boolean;\n\n /**\n * A render override for the progress track.\n */\n onRenderProgress?: IRenderFunction<IProgressIndicatorProps>;\n\n /**\n * Text alternative of the progress status, used by screen readers for reading the value of the progress.\n */\n ariaValueText?: string;\n\n /**\n * @deprecated Use `label` instead. Deprecated at v0.43.0, to be removed at \\>= v0.53.0.\n */\n title?: string;\n\n /**\n * Height of the ProgressIndicator\n * @defaultvalue 2\n */\n barHeight?: number;\n}\n\n/**\n * {@docCategory ProgressIndicator}\n */\nexport interface IProgressIndicatorStyleProps {\n /**\n * Theme provided by High-Order Component.\n */\n theme: ITheme;\n\n /**\n * Accept custom classNames\n */\n className?: string;\n indeterminate?: boolean;\n barHeight?: number;\n}\n\n/**\n * {@docCategory ProgressIndicator}\n */\nexport interface IProgressIndicatorStyles {\n /**\n * Style for the root element.\n */\n root: IStyle;\n itemName: IStyle;\n itemDescription: IStyle;\n itemProgress: IStyle;\n progressTrack: IStyle;\n progressBar: IStyle;\n}\n"]}
@@ -0,0 +1,3 @@
export * from './ProgressIndicator';
export * from './ProgressIndicator.base';
export * from './ProgressIndicator.types';
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./ProgressIndicator"), exports);
tslib_1.__exportStar(require("./ProgressIndicator.base"), exports);
tslib_1.__exportStar(require("./ProgressIndicator.types"), exports);
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/ProgressIndicator/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,mEAAyC;AACzC,oEAA0C","sourcesContent":["export * from './ProgressIndicator';\nexport * from './ProgressIndicator.base';\nexport * from './ProgressIndicator.types';\n"]}