import { defineComponent, computed, createVNode, mergeProps } from 'vue';
import '../hooks/index.mjs';
import classNames from '../_util/classNames.mjs';
import useStyle from './style/index.mjs';
import useConfigInject from '../config-provider/hooks/useConfigInject.mjs';

const checkableTagProps = () => ({
  "prefixCls": String,
  "checked": {
    type: Boolean,
    default: void 0
  },
  "onChange": {
    type: Function
  },
  "onClick": {
    type: Function
  },
  "onUpdate:checked": Function
});
const CheckableTag = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ACheckableTag",
  inheritAttrs: false,
  props: checkableTagProps(),
  // emits: ['update:checked', 'change', 'click'],
  setup(props, {
    slots,
    emit,
    attrs
  }) {
    const {
      prefixCls
    } = useConfigInject("tag", props);
    const [wrapSSR, hashId] = useStyle(prefixCls);
    const handleClick = (e) => {
      const {
        checked
      } = props;
      emit("update:checked", !checked);
      emit("change", !checked);
      emit("click", e);
    };
    const cls = computed(() => classNames(prefixCls.value, hashId.value, {
      [`${prefixCls.value}-checkable`]: true,
      [`${prefixCls.value}-checkable-checked`]: props.checked
    }));
    return () => {
      var _a;
      return wrapSSR(createVNode("span", mergeProps(attrs, {
        "class": cls.value,
        "onClick": handleClick
      }), [(_a = slots.default) == null ? void 0 : _a.call(slots)]));
    };
  }
});

export { CheckableTag as default };
//# sourceMappingURL=CheckableTag.mjs.map
