UNPKG

@universal-material/web

Version:
57 lines 1.77 kB
import { __decorate } from "tslib"; import { html } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { styles as baseStyles } from '../shared/base.styles.js'; import { UmSelectionControl } from '../shared/selection-control/selection-control.js'; import { styles } from './checkbox.styles.js'; let UmCheckbox = class UmCheckbox extends UmSelectionControl { static { this.styles = [ baseStyles, styles, ]; } #indeterminate; get indeterminate() { return this.#indeterminate; } set indeterminate(indeterminate) { this.#indeterminate = indeterminate; if (!indeterminate) { this.input?.classList.remove('indeterminate'); return; } this.input?.classList.add('indeterminate'); this.elementInternals.setFormValue(null); } get checked() { return super.checked; } set checked(checked) { super.checked = checked; this.indeterminate = false; } constructor() { super(); this.#indeterminate = false; this.hideStateLayer = false; } firstUpdated(changedProperties) { super.firstUpdated(changedProperties); this.indeterminate = this.indeterminate; } renderIndicator() { return html ` <div class="border"><div class="indicator"></div></div> `; } }; __decorate([ property({ type: Boolean, attribute: 'hide-state-layer', reflect: true }) ], UmCheckbox.prototype, "hideStateLayer", void 0); __decorate([ property({ type: Boolean }) ], UmCheckbox.prototype, "indeterminate", null); UmCheckbox = __decorate([ customElement('u-checkbox') ], UmCheckbox); export { UmCheckbox }; //# sourceMappingURL=checkbox.js.map