UNPKG

robust-react-ui

Version:

A React component library, built with a focus on accessibility, extensibility and reusability.

26 lines (21 loc) 1.54 kB
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var React = require('react'); var React__default = _interopDefault(React); var index = require('../../utils/getClassNames/index.js'); // Generated with util/create-component.js var ProgressBar = function (_a) { var _b; var _c = _a.minimumValue, minimumValue = _c === void 0 ? 0 : _c, _d = _a.maximumValue, maximumValue = _d === void 0 ? 100 : _d, currentValue = _a.currentValue, _e = _a.size, size = _e === void 0 ? 'medium' : _e, _f = _a.variant, variant = _f === void 0 ? 'primary' : _f, fullWidth = _a.fullWidth, _g = _a.ariaLabel, ariaLabel = _g === void 0 ? 'Progress bar' : _g; var percentage = ((currentValue - minimumValue) / (maximumValue - minimumValue)) * 100; return (React__default.createElement("div", { className: index((_b = { 'rrui-progress': true, 'rrui-progress--full-width': fullWidth }, _b["rrui-progress--" + variant] = true, _b["rrui-progress--" + size] = true, _b)), "data-testid": "ProgressBar" }, React__default.createElement("div", { "aria-label": ariaLabel, "data-testid": "ProgressBarInner", className: "rrui-progress__inner", role: "progressbar", "aria-valuenow": currentValue, "aria-valuemin": minimumValue, "aria-valuemax": maximumValue, style: { width: percentage.toString() + "%" } }))); }; module.exports = ProgressBar; //# sourceMappingURL=ProgressBar.js.map