UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

33 lines (29 loc) 1.38 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 CLink = require('../link/CLink.js'); var props = require('../../props.js'); const CButton = React.forwardRef((_a, ref) => { var { children, as = 'button', className, color, shape, size, type = 'button', variant } = _a, rest = tslib_es6.__rest(_a, ["children", "as", "className", "color", "shape", "size", "type", "variant"]); return (React.createElement(CLink.CLink, Object.assign({ as: rest.href ? 'a' : as }, (!rest.href && { type: type }), { className: index.default('btn', { [`btn-${variant}-${color}`]: variant && color, [`btn-${variant}`]: variant && !color, [`btn-${color}`]: !variant && color, [`btn-${size}`]: size, }, 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