UNPKG

@coreui/react

Version:

UI Components Library for React.js

39 lines (35 loc) 2.03 kB
'use strict'; 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'); var CBadge = React.forwardRef(function (_a, ref) { var _b; var children = _a.children, _c = _a.as, Component = _c === void 0 ? 'span' : _c, className = _a.className, color = _a.color, position = _a.position, shape = _a.shape, size = _a.size, textBgColor = _a.textBgColor, textColor = _a.textColor, rest = tslib_es6.__rest(_a, ["children", "as", "className", "color", "position", "shape", "size", "textBgColor", "textColor"]); return (React.createElement(Component, tslib_es6.__assign({ className: index.default('badge', (_b = {}, _b["bg-".concat(color)] = color, _b['position-absolute translate-middle'] = position, _b['top-0'] = position === null || position === void 0 ? void 0 : position.includes('top'), _b['top-100'] = position === null || position === void 0 ? void 0 : position.includes('bottom'), _b['start-100'] = position === null || position === void 0 ? void 0 : position.includes('end'), _b['start-0'] = position === null || position === void 0 ? void 0 : position.includes('start'), _b["badge-".concat(size)] = size, _b["text-".concat(textColor)] = textColor, _b["text-bg-".concat(textBgColor)] = textBgColor, _b), shape, className) }, rest, { ref: ref }), children)); }); CBadge.propTypes = { as: PropTypes.elementType, children: PropTypes.node, className: PropTypes.string, color: props.colorPropType, 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