<template>
  <view :class="cardClass" :style="cardStyle">
    <view v-if="!headless" :class="bem.e('header')">
      <view :class="bem.e('title')">
        <slot name="title">{{ title }}</slot>
      </view>
      <view :class="bem.e('extra')">
        <slot name="extra">{{ extra }}</slot>
      </view>
    </view>
    <view :class="bem.e('body')">
      <slot></slot>
    </view>
    <view v-if="!footless" :class="bem.e('footer')">
      <slot name="footer">{{ footer }}</slot>
    </view>
  </view>
</template>

<script lang="ts">
import { defineComponent as _defineComponent } from "vue";
import { computed, useSlots } from "vue";
import { classNames, stringifyStyle, createBem, isVisibleEmpty } from "../utils";
import { cardProps } from "./common";
const __default__ = {
  options: {
    virtualHost: true,
    styleIsolation: "shared"
  }
};
export default /* @__PURE__ */ _defineComponent({
  ...__default__,
  __name: "card",
  props: cardProps,
  emits: ["click"],
  setup(__props, { expose: __expose }) {
    __expose();
    const props = __props;
    const slots = useSlots();
    const bem = createBem("card");
    const headless = computed(() => {
      return isVisibleEmpty(props.title) && !slots.title && isVisibleEmpty(props.extra) && !slots.extra;
    });
    const footless = computed(() => {
      return isVisibleEmpty(props.footer) && !slots.footer;
    });
    const cardClass = computed(() => {
      return classNames(
        bem.b(),
        bem.m("headless", headless.value),
        bem.m("footless", footless.value),
        props.rootClass
      );
    });
    const cardStyle = computed(() => {
      return stringifyStyle(props.rootStyle);
    });
    const __returned__ = { props, slots, bem, headless, footless, cardClass, cardStyle };
    return __returned__;
  }
});
</script>

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