import { tag, WeElement, h, extractClass } from 'omi' import * as css from './index.scss' import { MDCFormField } from '@material/form-field' import { MDCCheckbox } from '@material/checkbox' // @ts-ignore import { extract } from '../util.ts' //@ts-ignore import '../theme.ts' interface Props { label?: string, disabled?: boolean, indeterminate?: boolean, checked?: boolean, value: string } interface Data { } @tag('m-checkbox') export default class Checkbox extends WeElement{ static css = css static propTypes = { label: String, disabled: Boolean, indeterminate: Boolean, checked: Boolean, value: String } changeHandler = (e)=>{ this.fire('change', e.currentTarget.checked) } installed() { const checkbox = new MDCCheckbox(this.shadowRoot.querySelector('.mdc-checkbox')) const formField = new MDCFormField(this.shadowRoot.querySelector('.mdc-form-field')) formField.input = checkbox } render(props) { return (
) } }