UNPKG

@coreui/react

Version:

UI Components Library for React.js

30 lines (27 loc) 1.43 kB
import { __rest, __assign } from '../../node_modules/tslib/tslib.es6.js'; import React, { forwardRef, useContext } from 'react'; import PropTypes from 'prop-types'; import classNames from '../../_virtual/index.js'; import { colorPropType } from '../../props.js'; import { CProgressStackedContext } from './CProgressStackedContext.js'; var CProgressBar = forwardRef(function (_a, ref) { var _b; var children = _a.children, animated = _a.animated, className = _a.className, color = _a.color, _c = _a.value, value = _c === void 0 ? 0 : _c, variant = _a.variant, rest = __rest(_a, ["children", "animated", "className", "color", "value", "variant"]); var stacked = useContext(CProgressStackedContext).stacked; return (React.createElement("div", __assign({ className: classNames('progress-bar', (_b = {}, _b["bg-".concat(color)] = color, _b["progress-bar-".concat(variant)] = variant, _b['progress-bar-animated'] = animated, _b), className) }, (!stacked && { style: { width: "".concat(value, "%") } }), rest, { ref: ref }), children)); }); CProgressBar.propTypes = { animated: PropTypes.bool, children: PropTypes.node, className: PropTypes.string, color: colorPropType, value: PropTypes.number, variant: PropTypes.oneOf(['striped']), }; CProgressBar.displayName = 'CProgressBar'; export { CProgressBar }; //# sourceMappingURL=CProgressBar.js.map