<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 Breadcrumb Items are used inside [breadcrumbs](/components/breadcrumb) to represent different links.
 * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-breadcrumb-item--docs
 * @status stable
 * @since 1.26.0
 *
 * @slot - The breadcrumb item's label.
 * @slot prefix - An optional prefix, usually an icon or icon button.
 * @slot suffix - An optional suffix, usually an icon or icon button.
 * @slot separator - The separator to use for the breadcrumb item. This will only change the separator for this item. If
 * you want to change it for all items in the group, set the separator on `<syn-breadcrumb>` instead.
 *
 * @csspart base - The component's base wrapper.
 * @csspart label - The breadcrumb item's label.
 * @csspart prefix - The container that wraps the prefix.
 * @csspart suffix - The container that wraps the suffix.
 * @csspart separator - The container that wraps the separator.
 */
import { computed, ref } from 'vue';
import '@synergy-design-system/components/components/breadcrumb-item/breadcrumb-item.js';

import type SynBreadcrumbItem from '@synergy-design-system/components/components/breadcrumb-item/breadcrumb-item.component.js';

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

defineExpose({
  nativeElement,
});

// Map attributes
const props = defineProps<{
  /**
* Optional URL to direct the user to when the breadcrumb item is activated.
* When set, a link will be rendered
internally.
* When unset, a button will be rendered instead.
 */
  href?: SynBreadcrumbItem['href'];

  /**
   * Tells the browser where to open the link.
   * Only used when `href` is set.
   */
  target?: SynBreadcrumbItem['target'];

  /**
   * The `rel` attribute to use on the link.
   * Only used when `href` is set.
   */
  rel?: SynBreadcrumbItem['rel'];
}>();

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