UNPKG

@intuitionrobotics/thunderstorm

Version:
19 lines 1.34 kB
import * as React from "react"; import { Component } from "react"; import { TS_Checkbox } from "./TS_Checkbox.js"; export class TS_CheckboxField extends Component { gridCss = () => { if (this.props.gridColumns) return { display: "grid", gridAutoFlow: this.props.horizontal ? "unset" : "column", gridGap: "1px", gridTemplateColumns: `repeat(${this.props.gridColumns}, 1fr)`, gridTemplateRows: `repeat(${Math.ceil(this.props.options.length / this.props.gridColumns)}, auto)` }; return {}; }; render() { return React.createElement("div", { className: `${this.props.fieldContainerClass} ${this.props.horizontal && !this.props.gridColumns ? 'll_h_c' : ''}`, style: this.gridCss() }, this.props.options.map((option, i) => React.createElement(TS_Checkbox, { key: i, value: option.value, checked: Array.isArray(this.props.value) ? this.props.value.includes(option.value) : this.props.value === option.value, onCheck: this.props.onCheck, label: this.props.label(option), circle: this.props.circle, rtl: this.props.rtl, disabled: option.disabled, buttonClass: this.props.buttonClass, containerClass: this.props.checkboxContainerClass, innerNode: this.props.innerNode }))); } } //# sourceMappingURL=TS_CheckboxField.js.map