@coreui/react-pro
Version:
UI Components Library for React.js
38 lines (34 loc) • 1.86 kB
JavaScript
;
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
var React = require('react');
var PropTypes = require('prop-types');
var index = require('../../_virtual/index.js');
var props = require('../../props.js');
const CBadge = React.forwardRef((_a, ref) => {
var { children, as: Component = 'span', className, color, position, shape, size, textBgColor, textColor } = _a, rest = tslib_es6.__rest(_a, ["children", "as", "className", "color", "position", "shape", "size", "textBgColor", "textColor"]);
return (React.createElement(Component, Object.assign({ className: index.default('badge', {
[`bg-${color}`]: color,
'position-absolute translate-middle': position,
'top-0': position === null || position === void 0 ? void 0 : position.includes('top'),
'top-100': position === null || position === void 0 ? void 0 : position.includes('bottom'),
'start-100': position === null || position === void 0 ? void 0 : position.includes('end'),
'start-0': position === null || position === void 0 ? void 0 : position.includes('start'),
[`badge-${size}`]: size,
[`text-${textColor}`]: textColor,
[`text-bg-${textBgColor}`]: textBgColor,
}, shape, className) }, rest, { ref: ref }), children));
});
CBadge.propTypes = {
as: PropTypes.elementType,
children: PropTypes.node,
className: PropTypes.string,
color: PropTypes.oneOfType([props.colorPropType, props.gradientsPropType]),
position: PropTypes.oneOf(['top-start', 'top-end', 'bottom-end', 'bottom-start']),
shape: props.shapePropType,
size: PropTypes.oneOf(['sm']),
textBgColor: props.colorPropType,
textColor: props.textColorsPropType,
};
CBadge.displayName = 'CBadge';
exports.CBadge = CBadge;
//# sourceMappingURL=CBadge.js.map