import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';

const indexCss = ".taro-checkbox{display:inline-block;position:relative}.taro-checkbox_checked{display:inline-block;position:relative;top:5px;border:1px solid #d1d1d1;border-radius:3px;width:23px;height:23px;min-height:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0;background-color:#fff;vertical-align:0;font-size:23px;color:#1aad19}.taro-checkbox_checked:checked::before{display:inline-block;position:absolute;left:50%;top:50%;vertical-align:middle;text-decoration:inherit;text-align:center;text-transform:none;font-family:weui;font-style:normal;font-weight:normal;font-variant:normal;font-size:inherit;color:inherit;content:\"\\ea08\";-webkit-transform:translate(-50%, -48%) scale(0.73);transform:translate(-50%, -48%) scale(0.73);speak:none}";

const Checkbox = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.onChange = createEvent(this, "checkboxchange", 7);
    this.handleChange = (e) => {
      e.stopPropagation();
      this.onChange.emit({
        value: this.value
      });
    };
    this.name = undefined;
    this.value = '';
    this.color = undefined;
    this.id = undefined;
    this.checked = false;
    this.disabled = false;
    this.nativeProps = {};
    this.isWillLoadCalled = false;
  }
  watchId(newVal) {
    if (!this.isWillLoadCalled)
      return;
    if (newVal)
      this.inputEl.setAttribute('id', newVal);
  }
  componentWillLoad() {
    this.isWillLoadCalled = true;
  }
  componentDidRender() {
    this.id && this.el.removeAttribute('id');
  }
  render() {
    const { checked, name, color, value, disabled, nativeProps } = this;
    return (h(Host, { className: 'weui-cells_checkbox' }, h("input", Object.assign({ ref: dom => {
        if (!dom)
          return;
        this.inputEl = dom;
        if (this.id)
          dom.setAttribute('id', this.id);
      }, type: 'checkbox', value: value, name: name, class: 'taro-checkbox_checked', style: { color }, checked: checked, disabled: disabled, onChange: this.handleChange }, nativeProps)), h("slot", null)));
  }
  get el() { return this; }
  static get watchers() { return {
    "id": ["watchId"]
  }; }
  static get style() { return indexCss; }
}, [4, "taro-checkbox-core", {
    "name": [1],
    "value": [1],
    "color": [1],
    "id": [1025],
    "checked": [4],
    "disabled": [4],
    "nativeProps": [16],
    "isWillLoadCalled": [32]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["taro-checkbox-core"];
  components.forEach(tagName => { switch (tagName) {
    case "taro-checkbox-core":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, Checkbox);
      }
      break;
  } });
}

const TaroCheckboxCore = Checkbox;
const defineCustomElement = defineCustomElement$1;

export { TaroCheckboxCore, defineCustomElement };

//# sourceMappingURL=taro-checkbox-core.js.map