import { html, nothing } from 'lit'; import { property, query } from 'lit/decorators.js'; import { classMap } from 'lit/directives/class-map.js'; import { BootstrapElement, defineElement } from '@bootstrap-wc/core'; export type CheckType = 'checkbox' | 'radio' | 'switch'; /** * `` — unified checkbox / radio / switch. * * Renders the native `` into LIGHT DOM so * browser autofill, password-manager autofill, and form-association all * work the same way they do for plain HTML. See `bs-input` for * background on the light-DOM rendering choice. * * Use `type="switch"` for the toggle style. `type="radio"` requires a * `name` attribute to group with sibling radios. Author label content * either via the `label` attribute or by placing inline children inside * the element. */ export class BsFormCheck extends BootstrapElement { static formAssociated = true; @property({ type: String }) type: CheckType = 'checkbox'; @property({ type: Boolean, reflect: true }) checked = false; @property({ type: Boolean, reflect: true }) disabled = false; @property({ type: Boolean, reflect: true }) required = false; @property({ type: Boolean, reflect: true }) indeterminate = false; @property({ type: String }) name = ''; @property({ type: String }) value = 'on'; @property({ type: String }) autocomplete?: string; @property({ type: String }) label?: string; @property({ type: String, attribute: 'aria-label' }) override ariaLabel: string | null = null; @property({ type: Boolean }) inline = false; @property({ type: Boolean }) reverse = false; @property({ type: Boolean }) invalid = false; @property({ type: Boolean }) valid = false; @query('input') private _input!: HTMLInputElement; @query('label[part="label"]') private _label!: HTMLLabelElement | null; /** Snapshot of author-provided label children, taken before Lit's * light-DOM render replaces them. Re-inserted into the rendered * `