import { defineComponent, createVNode } from 'vue';
import { DeleteOutlined } from '@ant-design/icons-vue';
import localeValues from '../locale/lang/en_US.mjs';
import '../checkbox/index.mjs';
import LocaleReceiver from '../locale-provider/LocaleReceiver.mjs';
import TransButton from '../_util/components/transButton.mjs';
import classNames from '../_util/classNames.mjs';
import PropTypes from '../_util/vue-types/index.mjs';
import { booleanType } from '../_util/type.mjs';
import Checkbox from '../checkbox/Checkbox.mjs';

function noop() {
}
const transferListItemProps = {
  renderedText: PropTypes.any,
  renderedEl: PropTypes.any,
  item: PropTypes.any,
  checked: booleanType(),
  prefixCls: String,
  disabled: booleanType(),
  showRemove: booleanType(),
  onClick: Function,
  onRemove: Function
};
var ListItem = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ListItem",
  inheritAttrs: false,
  props: transferListItemProps,
  emits: ["click", "remove"],
  setup(props, {
    emit
  }) {
    return () => {
      const {
        renderedText,
        renderedEl,
        item,
        checked,
        disabled,
        prefixCls,
        showRemove
      } = props;
      const className = classNames({
        [`${prefixCls}-content-item`]: true,
        [`${prefixCls}-content-item-disabled`]: disabled || item.disabled
      });
      let title;
      if (typeof renderedText === "string" || typeof renderedText === "number")
        title = String(renderedText);
      return createVNode(LocaleReceiver, {
        "componentName": "Transfer",
        "defaultLocale": localeValues.Transfer
      }, {
        default: (transferLocale) => {
          const labelNode = createVNode("span", {
            "class": `${prefixCls}-content-item-text`
          }, [renderedEl]);
          if (showRemove) {
            return createVNode("li", {
              "class": className,
              "title": title
            }, [labelNode, createVNode(TransButton, {
              "disabled": disabled || item.disabled,
              "class": `${prefixCls}-content-item-remove`,
              "aria-label": transferLocale.remove,
              "onClick": () => {
                emit("remove", item);
              }
            }, {
              default: () => [createVNode(DeleteOutlined, null, null)]
            })]);
          }
          return createVNode("li", {
            "class": className,
            "title": title,
            "onClick": disabled || item.disabled ? noop : () => {
              emit("click", item);
            }
          }, [createVNode(Checkbox, {
            "class": `${prefixCls}-checkbox`,
            "checked": checked,
            "disabled": disabled || item.disabled
          }, null), labelNode]);
        }
      });
    };
  }
});

export { ListItem as default, transferListItemProps };
//# sourceMappingURL=ListItem.mjs.map
