jobiqo-cl
Version:
[](https://circleci.com/gh/jobiqo/jobiqo-cl)
37 lines (31 loc) • 1.72 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var tslib_es6 = require('../../../../../node_modules/tslib/tslib.es6.js');
var React = require('react');
var React__default = _interopDefault(React);
var styles = require('./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, error = false, required = false, disabled = false } = _a, props = tslib_es6.__rest(_a, ["id", "checkboxStyle", "label", "onChange", "error", "required", "disabled"]);
return (React__default.createElement(styles.CheckboxWrapper, null,
React__default.createElement(styles.Checkbox, Object.assign({ type: "checkbox", id: id, disabled: disabled, onChange: onChange, checkboxStyle: checkboxStyle }, props)),
React__default.createElement(styles.CheckboxLabel, { disabled: disabled, error: error, required: required, checkboxStyle: checkboxStyle, htmlFor: id },
label,
React__default.createElement(React__default.Fragment, null, required && React__default.createElement(styles.CheckboxRequiredMark, null, "*")))));
};
Checkbox.defaultProps = {
label: '',
checkboxStyle: 'primary',
theme: null
};
exports.Checkbox = Checkbox;