UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

29 lines (26 loc) 1.33 kB
import { __rest } 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, gradientsPropType } from '../../props.js'; import { CProgressStackedContext } from './CProgressStackedContext.js'; const CProgressBar = forwardRef((_a, ref) => { var { children, animated, className, color, value = 0, variant } = _a, rest = __rest(_a, ["children", "animated", "className", "color", "value", "variant"]); const { stacked } = useContext(CProgressStackedContext); return (React.createElement("div", Object.assign({ className: classNames('progress-bar', { [`bg-${color}`]: color, [`progress-bar-${variant}`]: variant, 'progress-bar-animated': animated, }, className) }, (!stacked && { style: { width: `${value}%` } }), rest, { ref: ref }), children)); }); CProgressBar.propTypes = { animated: PropTypes.bool, children: PropTypes.node, className: PropTypes.string, color: PropTypes.oneOfType([colorPropType, gradientsPropType]), value: PropTypes.number, variant: PropTypes.oneOf(['striped']), }; CProgressBar.displayName = 'CProgressBar'; export { CProgressBar }; //# sourceMappingURL=CProgressBar.js.map