import { defineComponent, computed, createVNode, createTextVNode } from 'vue';
import getPrefixCls from '../_util/getPrefixCls';
import { useTheme } from '../_theme/useTheme';
import { linkProps } from './props';

const prefixCls = getPrefixCls('link');
var link = defineComponent({
  name: 'FLink',
  props: linkProps,
  emits: ['click'],
  setup(props, _ref) {
    let {
      slots,
      emit
    } = _ref;
    useTheme();
    const linkClassList = computed(() => {
      const clsList = [`${prefixCls}`, `${prefixCls}-type-${props.type}`, `${prefixCls}-size-${props.size}`];
      props.disabled && clsList.push(`is-disabled`);
      props.underline && clsList.push('is-underline');
      return clsList;
    });
    function handleClick(event) {
      if (!props.disabled) {
        emit('click', event);
      }
    }
    return () => {
      var _slots$default;
      return createVNode("a", {
        "href": props.href,
        "target": props.target,
        "class": linkClassList.value,
        "onClick": handleClick
      }, [slots.icon ? createVNode("div", {
        "class": "icon"
      }, [createTextVNode(" "), slots.icon()]) : null, createVNode("div", null, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)])]);
    };
  }
});

export { link as default };
