<script setup lang="ts">
// ---------------------------------------------------------------------
// 🔒 AUTOGENERATED @synergy-design-system/vue wrappers for @synergy-design-system/components
// Please do not edit this file directly!
// It will get recreated when running pnpm build.
// ---------------------------------------------------------------------

/**
 * @summary Cards can be used to group related subjects in a container.
 * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-card--docs
 * @status stable
 * @since 1.25.0
 *
 * @slot - The card's main content.
 * @slot header - An optional header for the card.
 * @slot footer - An optional footer for the card.
 * @slot image - An optional image to render at the start of the card.
 *
 * @csspart base - The component's base wrapper.
 * @csspart image - The container that wraps the card's image.
 * @csspart header - The container that wraps the card's header.
 * @csspart body - The container that wraps the card's main content.
 * @csspart footer - The container that wraps the card's footer.
 *
 * @cssproperty --border-color - The card's border color, including borders that occur inside the card.
 * @cssproperty --border-radius - The border radius for the card's edges.
 * @cssproperty --border-width - The width of the card's borders.
 * @cssproperty --padding - The padding to use for the card's sections.
 */
import { computed, ref } from 'vue';
import '@synergy-design-system/components/components/card/card.js';

import type SynCard from '@synergy-design-system/components/components/card/card.component.js';

// DOM Reference to the element
const nativeElement = ref<SynCard>();

defineExpose({
  nativeElement,
});

// Map attributes
const props = defineProps<{
  /**
   * Draws the card with a shadow.
   * Can be used when the card has to stand out visually, for example in dashboards.
   */
  shadow?: SynCard['shadow'];

  /**
   * Draws the card with sharp edges.
   * Can be used e.g.
   * when nesting multiple syn-cards to create hierarchy.
   */
  sharp?: SynCard['sharp'];
}>();

// Make sure prop binding only forwards the props that are actually there.
// This is needed because :param="param" also adds an empty attribute
// when using web-components, which breaks optional arguments like size in SynInput
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
const visibleProps = computed(() =>
  Object.fromEntries(
    Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
  ),
);
</script>

<template>
  <syn-card v-bind="visibleProps" ref="nativeElement">
    <slot></slot>
  </syn-card>
</template>
