<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 The <syn-header /> element provides a generic application header
 * that can be used to add applications name, toolbar and primary navigation.
 *
 * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-header--docs
 * @status stable
 * @since 1.10.0
 *
 * @slot label - The label for the header
 * @slot logo - The logo that should be displayed. Will fall back to the SICK logo if not provided
 * @slot meta-navigation - The meta-navigation is used to add various application toolbar icons
 *                     Best used with `<syn-icon-button />` and `<syn-drop-down />`
 * @slot navigation - This slot can be used to add an optional horizontal navigation
 * @slot open-burger-menu-icon - An icon to use in lieu of the default burger-menu=open state.
 *                      The default close icon is a 'x'.
 * @slot closed-burger-menu-icon - An icon to use in lieu of the default burger-menu=closed state.
 *                      The default open icon is a burger menu.
 *
 * @event syn-burger-menu-closed - Emitted when the burger menu is toggled to closed
 * @event syn-burger-menu-hidden - Emitted when the burger menu is toggled to hidden
 * @event syn-burger-menu-open - Emitted when the burger menu is toggled to open
 *
 * @csspart base - The component's base wrapper
 * @csspart content - The wrapper most content items reside
 * @csspart logo - The wrapper the application logo resides in
 * @csspart label - The element wrapping the application name
 * @csspart meta-navigation - The Item wrapping the optional application menu
 * @csspart navigation - The wrapper that is holding the optional top navigation section
 * @csspart burger-menu-toggle-button - The button that toggles the burger menu
 *
 * @cssproperty --sticky-position - The position of the sticky header from the top of the viewport. Defaults to the top of the screen.
 * @cssproperty --metanavigation-item-size - The size of the items in the meta navigation. Also used for the height of dividers in the meta navigation. Defaults to var(--syn-font-size-x-large)
 */
import { computed, ref } from 'vue';
import '@synergy-design-system/components/components/header/header.js';

import type { SynBurgerMenuClosedEvent } from '@synergy-design-system/components';
import type { SynBurgerMenuHiddenEvent } from '@synergy-design-system/components';
import type { SynBurgerMenuOpenEvent } from '@synergy-design-system/components';
import type SynHeader from '@synergy-design-system/components/components/header/header.component.js';

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

defineExpose({
  nativeElement,
});

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

  /**
* Defines the current visibility and icon of the burger-menu icon.
The menu button is added automatically if the component finds a syn-side-nav in
variant="default".
The following values can be used:
- hidden: The burger menu is not visible
- open: The burger menu is visible and shows the close icon
- closed: The burger menu is visible and shows the open icon
 */
  burgerMenu?: SynHeader['burgerMenu'];

  /**
* Makes the header stick to the top of the viewport when scrolling.
Also applies a shadow to the header when scrolling.
 */
  sticky?: SynHeader['sticky'];
}>();

// 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'),
  ),
);

// Map events
defineEmits<{
  /**
   * Emitted when the burger menu is toggled to closed
   */
  'syn-burger-menu-closed': [e: SynBurgerMenuClosedEvent];

  /**
   * Emitted when the burger menu is toggled to hidden
   */
  'syn-burger-menu-hidden': [e: SynBurgerMenuHiddenEvent];

  /**
   * Emitted when the burger menu is toggled to open
   */
  'syn-burger-menu-open': [e: SynBurgerMenuOpenEvent];
}>();
</script>

<script lang="ts">
export type { SynBurgerMenuClosedEvent } from '@synergy-design-system/components';
export type { SynBurgerMenuHiddenEvent } from '@synergy-design-system/components';
export type { SynBurgerMenuOpenEvent } from '@synergy-design-system/components';
</script>

<template>
  <syn-header
    @syn-burger-menu-closed="$emit('syn-burger-menu-closed', $event)"
    @syn-burger-menu-hidden="$emit('syn-burger-menu-hidden', $event)"
    @syn-burger-menu-open="$emit('syn-burger-menu-open', $event)"
    v-bind="visibleProps"
    ref="nativeElement">
    <slot></slot>
  </syn-header>
</template>
