@intuitionrobotics/thunderstorm
Version:
39 lines • 2.13 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TS_Checkbox = void 0;
const React = require("react");
class TS_Checkbox extends React.Component {
constructor() {
super(...arguments);
this.renderLabel = () => React.createElement("div", { className: 'match_width' }, typeof this.props.label === "function" ? this.props.label(this.props.checked, !!this.props.disabled) : this.props.label);
}
render() {
const defaultButtonStyle = {
borderRadius: this.props.circle ? "50%" : "1px",
border: "1px solid #68678d50",
boxShadow: "0px 0 1px 0px #867979",
marginRight: this.props.rtl ? 'unset' : 10,
marginLeft: this.props.rtl ? 10 : 'unset',
};
const radioContainer = {
cursor: !this.props.disabled && this.props.onCheck ? "pointer" : "inherit"
};
const btnInner = {
width: 15,
height: 15,
borderRadius: this.props.circle ? "50%" : "1px",
boxSizing: "border-box"
};
if (this.props.checked) {
btnInner.border = "4.5px #3499fe solid";
if (!this.props.circle)
btnInner.background = "#3499fe";
}
return React.createElement("div", { className: `${this.props.containerClass && this.props.containerClass(this.props.checked, !!this.props.disabled)} ll_h_c`, style: radioContainer, id: this.props.id, onClick: () => !this.props.disabled && this.props.onCheck && this.props.onCheck(this.props.value, this.props.checked) },
this.props.rtl && this.renderLabel(),
React.createElement("div", { style: this.props.buttonClass ? {} : defaultButtonStyle, className: this.props.buttonClass && this.props.buttonClass(this.props.checked, !!this.props.disabled) }, this.props.innerNode ? this.props.innerNode(this.props.checked, !!this.props.disabled) : React.createElement("div", { style: btnInner })),
!this.props.rtl && this.renderLabel());
}
}
exports.TS_Checkbox = TS_Checkbox;
//# sourceMappingURL=TS_Checkbox.js.map