UNPKG

@atlaskit/progress-bar

Version:

A progress bar communicates the status of a system process.

75 lines (73 loc) 3.11 kB
/* progress-bar.tsx generated by @compiled/babel-plugin v0.36.1 */ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; require("./progress-bar.compiled.css"); var _runtime = require("@compiled/react/runtime"); var _react = _interopRequireDefault(require("react")); var _colors = require("@atlaskit/theme/colors"); var MIN_VALUE = 0; var MAX_VALUE = 1; var increasingBarAnimation = null; var decreasingBarAnimation = null; var containerStyles = null; var containerAppearance = { default: "_bfhk1vi8", success: "_bfhk1vi8", inverse: "_bfhk18ht" }; var barAppearance = { default: "_bfhk1wby", success: "_bfhk1bh5", inverse: "_bfhkvuon" }; var barStyles = null; var determinateBarStyles = null; var increasingBarStyles = null; var decreasingBarStyles = null; /** * __Progress bar__ * * A progress bar displays the status of a given process. * * - [Examples](https://atlassian.design/components/progress-bar/examples) * - [Code](https://atlassian.design/components/progress-bar/code) * - [Usage](https://atlassian.design/components/progress-bar/usage) */ var ProgressBar = function ProgressBar(_ref) { var _ref$appearance = _ref.appearance, appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance, ariaLabel = _ref.ariaLabel, _ref$isIndeterminate = _ref.isIndeterminate, isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate, _ref$testId = _ref.testId, testId = _ref$testId === void 0 ? 'progress-bar' : _ref$testId, _ref$value = _ref.value, value = _ref$value === void 0 ? 0 : _ref$value; var valueParsed = isIndeterminate ? MIN_VALUE : Math.max(MIN_VALUE, Math.min(value, MAX_VALUE)); return /*#__PURE__*/_react.default.createElement("div", { role: "progressbar", "aria-label": ariaLabel, "aria-valuemin": MIN_VALUE, "aria-valuenow": valueParsed, "aria-valuemax": MAX_VALUE, "data-testid": testId, className: (0, _runtime.ax)(["_2rko1sit _1reo15vq _18m915vq _1bsb1osq _4t3ii2wt _kqswh2mm _bfhk1jmj", containerAppearance[appearance]]), style: { "--_1j2n3rv": (0, _runtime.ix)("var(--ds-background-neutral, ".concat(_colors.N40A, ")")) } }, isIndeterminate ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", { className: (0, _runtime.ax)(["_2rko1sit _1e0c1ule _4t3ii2wt _kqswstnw", barAppearance[appearance], "_5sagymdr _tip812c5 _j7hq7g40"]) }), /*#__PURE__*/_react.default.createElement("span", { className: (0, _runtime.ax)(["_2rko1sit _1e0c1ule _4t3ii2wt _kqswstnw", barAppearance[appearance], "_ju251bs3 _5sagymdr _tip812c5 _j7hqio0v"]) })) : /*#__PURE__*/_react.default.createElement("span", { style: { width: "".concat(Number(value) * 100, "%") }, className: (0, _runtime.ax)(["_2rko1sit _1e0c1ule _4t3ii2wt _kqswstnw", barAppearance[appearance], "_v564calv"]) })); }; var _default = exports.default = ProgressBar;