UNPKG

@dr.pogodin/react-utils

Version:

Collection of generic ReactJS components and utils

35 lines 1.13 kB
import themed from '@dr.pogodin/react-themes'; import defaultTheme from "./theme.scss"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; const Checkbox = ({ checked, disabled, label, onChange, testId, theme }) => { let containerClassName = theme.container; if (disabled) containerClassName += ` ${theme.disabled}`; let checkboxClassName = theme.checkbox; if (checked === 'indeterminate') checkboxClassName += ` ${theme.indeterminate}`; return /*#__PURE__*/_jsxs("div", { className: containerClassName, children: [label === undefined ? null : /*#__PURE__*/_jsx("div", { className: theme.label, children: label }), /*#__PURE__*/_jsx("input", { checked: checked === undefined ? undefined : checked === true, className: checkboxClassName, "data-testid": process.env.NODE_ENV === 'production' ? undefined : testId, disabled: disabled, onChange: onChange, onClick: e => { e.stopPropagation(); }, type: "checkbox" })] }); }; export default themed(Checkbox, 'Checkbox', defaultTheme); //# sourceMappingURL=index.js.map