<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 A tag group is used to display multiple tags that belong together, often representing selected filters, categories, or user‑generated labels.
 * It arranges tags in flexible rows and supports different sizes and layouts.
 * Tags can be removable, icon‑based, or purely textual.
 *
 * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-tag-group--docs
 * @status stable
 * @since 3.7.0
 *
 * @slot - The tag group's main content. Must be `<syn-tag />` elements.
 * @slot label - The tag group's label. Alternatively, you can use the `label` attribute.
 *
 * @csspart base - The component's base wrapper.
 * @csspart tag-label - The tag group's label.
 */
import { computed, ref } from 'vue';
import '@synergy-design-system/components/components/tag-group/tag-group.js';

import type SynTagGroup from '@synergy-design-system/components/components/tag-group/tag-group.component.js';

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

defineExpose({
  nativeElement,
});

// Map attributes
const props = defineProps<{
  /**
   * The tag group's label.
   * If you need to display HTML, use the `label` slot instead.
   */
  label?: SynTagGroup['label'];

  /**
   * Controls the label position.
   * Use 'top' to place the label above the tags, or 'start' to place it to the begin of the tag group.
   */
  labelPosition?: SynTagGroup['labelPosition'];

  /**
   * The size that should be applied to all slotted `<syn-tag>` elements
   */
  size?: SynTagGroup['size'];
}>();

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