@coreui/react
Version:
UI Components Library for React.js
32 lines (28 loc) • 1.54 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 CLink = require('../link/CLink.js');
var props = require('../../props.js');
var CButton = React.forwardRef(function (_a, ref) {
var _b;
var children = _a.children, _c = _a.as, as = _c === void 0 ? 'button' : _c, className = _a.className, color = _a.color, shape = _a.shape, size = _a.size, _d = _a.type, type = _d === void 0 ? 'button' : _d, variant = _a.variant, rest = tslib_es6.__rest(_a, ["children", "as", "className", "color", "shape", "size", "type", "variant"]);
return (React.createElement(CLink.CLink, tslib_es6.__assign({ as: rest.href ? 'a' : as }, (!rest.href && { type: type }), { className: index.default('btn', variant && color ? "btn-".concat(variant, "-").concat(color) : "btn-".concat(variant), (_b = {},
_b["btn-".concat(color)] = color && !variant,
_b["btn-".concat(size)] = size,
_b), shape, className) }, rest, { ref: ref }), children));
});
CButton.propTypes = {
as: PropTypes.elementType,
children: PropTypes.node,
className: PropTypes.string,
color: props.colorPropType,
shape: PropTypes.string,
size: PropTypes.oneOf(['sm', 'lg']),
type: PropTypes.oneOf(['button', 'submit', 'reset']),
variant: PropTypes.oneOf(['outline', 'ghost']),
};
CButton.displayName = 'CButton';
exports.CButton = CButton;
//# sourceMappingURL=CButton.js.map
;