@coreui/react-pro
Version:
UI Components Library for React.js
35 lines (32 loc) • 1.55 kB
JavaScript
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 { CFormLabel } from './CFormLabel.js';
const CFormSwitch = forwardRef((_a, ref) => {
var { className, id, invalid, label, reverse, size, type = 'checkbox', valid } = _a, rest = __rest(_a, ["className", "id", "invalid", "label", "reverse", "size", "type", "valid"]);
return (React.createElement("div", { className: classNames('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: classNames('form-check-input', {
'is-invalid': invalid,
'is-valid': valid,
}), id: id }, rest, { ref: ref })),
label && (React.createElement(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';
export { CFormSwitch };
//# sourceMappingURL=CFormSwitch.js.map