UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

31 lines (28 loc) 1.35 kB
import { __rest } from '../../node_modules/tslib/tslib.es6.js'; import React, { forwardRef } from 'react'; import PropTypes from 'prop-types'; import classNames from '../../_virtual/index.js'; import { CLink } from '../link/CLink.js'; import { colorPropType } from '../../props.js'; const CButton = forwardRef((_a, ref) => { var { children, as = 'button', className, color, shape, size, type = 'button', variant } = _a, rest = __rest(_a, ["children", "as", "className", "color", "shape", "size", "type", "variant"]); return (React.createElement(CLink, Object.assign({ as: rest.href ? 'a' : as }, (!rest.href && { type: type }), { className: classNames('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: colorPropType, shape: PropTypes.string, size: PropTypes.oneOf(['sm', 'lg']), type: PropTypes.oneOf(['button', 'submit', 'reset']), variant: PropTypes.oneOf(['outline', 'ghost']), }; CButton.displayName = 'CButton'; export { CButton }; //# sourceMappingURL=CButton.js.map