UNPKG

@bokeh/bokehjs

Version:

Interactive, novel data visualization

35 lines 1.13 kB
import { ToggleInput, ToggleInputView } from "./toggle_input"; import { input } from "../../core/dom"; import checkbox_css from "../../styles/widgets/checkbox.css"; export class CheckboxView extends ToggleInputView { static __name__ = "CheckboxView"; checkbox_el; stylesheets() { return [...super.stylesheets(), checkbox_css]; } render() { super.render(); this.checkbox_el = input({ type: "checkbox" }); this.checkbox_el.addEventListener("change", () => this._toggle_active()); this._update_label(); this._update_active(); this._update_disabled(); this.shadow_el.append(this.checkbox_el, this.label_el); } _update_active() { this.checkbox_el.checked = this.model.active; } _update_disabled() { this.checkbox_el.toggleAttribute("disabled", this.model.disabled); } } export class Checkbox extends ToggleInput { static __name__ = "Checkbox"; constructor(attrs) { super(attrs); } static { this.prototype.default_view = CheckboxView; } } //# sourceMappingURL=checkbox.js.map