jobiqo-cl
Version:
[](https://circleci.com/gh/jobiqo/jobiqo-cl)
28 lines (25 loc) • 1.24 kB
JavaScript
import { __rest } from '../../../../../node_modules/tslib/tslib.es6.js';
import React__default from 'react';
import { CheckboxWrapper, Checkbox as Checkbox$1, CheckboxLabel } from './styles.js';
/**
* @file index.tsx
*
* @fileoverview Checkbox component. Renders a checkbox together with a label.
*/
/**
* A checkbox is an input of type checkbox.
* Will have a label next to it and styling will come from the theme property.
* The component inherits props from the "InputHTMLAttributes" so any property for a checkbox can be used with this component.
*/
const Checkbox = (_a) => {
var { id, checkboxStyle, label, onChange, disabled = false } = _a, props = __rest(_a, ["id", "checkboxStyle", "label", "onChange", "disabled"]);
return (React__default.createElement(CheckboxWrapper, null,
React__default.createElement(Checkbox$1, Object.assign({ type: "checkbox", id: id, disabled: disabled, onChange: onChange, checkboxStyle: checkboxStyle }, props)),
React__default.createElement(CheckboxLabel, { disabled: disabled, checkboxStyle: checkboxStyle, htmlFor: id }, label)));
};
Checkbox.defaultProps = {
label: '',
checkboxStyle: 'primary',
theme: null
};
export { Checkbox };