/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import { defineComponent, toRefs, computed, createVNode } from 'vue';
import { usePrefixClass, useCommonClassName } from '../hooks/useConfig.js';
import useVModel from '../hooks/useVModel.js';
import { useContent } from '../hooks/tnode.js';
import props from './check-tag-props.js';
import '../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import 'lodash/isFunction';
import 'lodash/isString';
import '../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import 'lodash/isArray';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../_chunks/dep-2e5d8948.js';
import 'dayjs';
import '../_chunks/dep-4580aabe.js';
import '../config-provider/type.js';
import 'lodash/kebabCase';
import 'lodash/camelCase';
import '../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isObject';

var _CheckTag = defineComponent({
  name: "TCheckTag",
  props: props,
  setup: function setup(props2) {
    var COMPONENT_NAME = usePrefixClass("tag");
    var _useCommonClassName = useCommonClassName(),
      SIZE = _useCommonClassName.SIZE;
    var renderContent = useContent();
    var _toRefs = toRefs(props2),
      checked = _toRefs.checked,
      modelValue = _toRefs.modelValue;
    var _useVModel = useVModel(checked, modelValue, props2.defaultChecked, props2.onChange, "checked"),
      _useVModel2 = _slicedToArray(_useVModel, 2),
      innerChecked = _useVModel2[0],
      setInnerChecked = _useVModel2[1];
    var tagClass = computed(function () {
      var _ref;
      return ["".concat(COMPONENT_NAME.value), "".concat(COMPONENT_NAME.value, "--check"), "".concat(COMPONENT_NAME.value, "--default"), SIZE.value[props2.size], (_ref = {}, _defineProperty(_ref, "".concat(COMPONENT_NAME.value, "--checked"), !props2.disabled && innerChecked.value), _defineProperty(_ref, "".concat(COMPONENT_NAME.value, "--disabled"), props2.disabled), _ref)];
    });
    var handleClick = function handleClick(e) {
      if (!props2.disabled) {
        var _props2$onClick;
        (_props2$onClick = props2.onClick) === null || _props2$onClick === void 0 ? void 0 : _props2$onClick.call(props2, {
          e: e
        });
        setInnerChecked(!innerChecked.value);
      }
    };
    return function () {
      var tagContent = renderContent("default", "content");
      return createVNode("span", {
        "class": tagClass.value,
        "onClick": handleClick
      }, [tagContent]);
    };
  }
});

export { _CheckTag as default };
//# sourceMappingURL=check-tag.js.map
