@coreui/react-pro
Version:
UI Components Library for React.js
37 lines (33 loc) • 1.6 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 CFormLabel = require('./CFormLabel.js');
const CFormSwitch = React.forwardRef((_a, ref) => {
var { className, id, invalid, label, reverse, size, type = 'checkbox', valid } = _a, rest = tslib_es6.__rest(_a, ["className", "id", "invalid", "label", "reverse", "size", "type", "valid"]);
return (React.createElement("div", { className: index.default('form-check form-switch', {
'form-check-reverse': reverse,
[`form-switch-${size}`]: size,
'is-invalid': invalid,
'is-valid': valid,
}, className) },
React.createElement("input", Object.assign({ type: type, className: index.default('form-check-input', {
'is-invalid': invalid,
'is-valid': valid,
}), id: id }, rest, { ref: ref })),
label && (React.createElement(CFormLabel.CFormLabel, Object.assign({ customClassName: "form-check-label" }, (id && { htmlFor: id })), label))));
});
CFormSwitch.propTypes = {
className: PropTypes.string,
id: PropTypes.string,
invalid: PropTypes.bool,
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
reverse: PropTypes.bool,
size: PropTypes.oneOf(['lg', 'xl']),
type: PropTypes.oneOf(['checkbox', 'radio']),
valid: PropTypes.bool,
};
CFormSwitch.displayName = 'CFormSwitch';
exports.CFormSwitch = CFormSwitch;
//# sourceMappingURL=CFormSwitch.js.map