<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 Tab panels are used inside [tab groups](/components/tab-group) to display tabbed content.
 * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-tab-panel--docs
 * @status stable
 * @since 2.1.0
 *
 * @slot - The tab panel's content.
 *
 * @csspart base - The component's base wrapper.
 *
 * @cssproperty --padding - The tab panel's padding.
 */
import { computed, ref } from 'vue';
import '@synergy-design-system/components/components/tab-panel/tab-panel.js';

import type SynTabPanel from '@synergy-design-system/components/components/tab-panel/tab-panel.component.js';

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

defineExpose({
  nativeElement,
});

// Map attributes
const props = defineProps<{
  /**
   * The tab panel's name.
   */
  name?: SynTabPanel['name'];

  /**
   * When true, the tab panel will be shown.
   */
  active?: SynTabPanel['active'];
}>();

// 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-tab-panel v-bind="visibleProps" ref="nativeElement">
    <slot></slot>
  </syn-tab-panel>
</template>
