<template>
  <view
    :class="listItemClass"
    :style="stringifyStyle(rootStyle)"
    @click="onClick"
  >
    <slot>
      <view v-if="isRenderVisible($slots.icon || icon)" :class="bem.e('icon')">
        <slot name="icon">
          <sar-icon
            :name="icon"
            :color="iconColor"
            :size="iconSize"
            :family="iconFamily"
          />
        </slot>
      </view>
      <view :class="bem.e('title')">
        <slot name="title">{{ title }}</slot>
        <view
          v-if="isRenderVisible($slots.description || description)"
          :class="bem.e('description')"
        >
          <slot name="description">{{ description }}</slot>
        </view>
      </view>

      <view
        v-if="isRenderVisible($slots.value || value)"
        :class="bem.e('value')"
      >
        <slot name="value">{{ value }}</slot>
      </view>
      <slot name="arrow">
        <view v-if="arrow" :class="bem.e('arrow')">
          <sar-icon :name="arrowDirection" />
        </view>
      </slot>
    </slot>
  </view>
</template>

<script lang="ts">
import { defineComponent as _defineComponent } from "vue";
import { computed, useSlots } from "vue";
import {
  classNames,
  stringifyStyle,
  isRenderVisible,
  createBem
} from "../utils";
import SarIcon from "../icon/icon.vue";
import { listItemProps } from "../list/common";
const __default__ = {
  options: {
    virtualHost: true,
    styleIsolation: "shared"
  }
};
export default /* @__PURE__ */ _defineComponent({
  ...__default__,
  __name: "list-item",
  props: listItemProps,
  emits: ["click"],
  setup(__props, { expose: __expose, emit: __emit }) {
    __expose();
    const props = __props;
    const emit = __emit;
    const slots = useSlots();
    const bem = createBem("list-item");
    const onClick = (event) => {
      emit("click", event);
    };
    const listItemClass = computed(() => {
      return classNames(
        bem.b(),
        bem.m("hover", props.hover),
        bem.m("custom", !!slots.default),
        props.rootClass
      );
    });
    const __returned__ = { props, emit, slots, bem, onClick, listItemClass, get stringifyStyle() {
      return stringifyStyle;
    }, get isRenderVisible() {
      return isRenderVisible;
    }, SarIcon };
    return __returned__;
  }
});
</script>

<style lang="scss">
@use './index.scss';
</style>