<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 Ticks visually improve positioning on range sliders.
 * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-range-tick--docs
 * @status stable
 * @since 2.6.0
 *
 * @slot - The tick's label
 *
 * @csspart base - The component's base wrapper.
 * @csspart label - The component's label.
 * @csspart line - The component's tick line.
 *
 * @cssproperty --tick-height - The height of the tick marker.
 * @cssproperty --tick-label-top - The top offset of the tick label.
 */
import { computed, ref } from 'vue';
import '@synergy-design-system/components/components/range-tick/range-tick.js';

import type SynRangeTick from '@synergy-design-system/components/components/range-tick/range-tick.component.js';

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

defineExpose({
  nativeElement,
});

// Map attributes
const props = defineProps<{
  /**
   * Whether the tick should be shown as a subdivision.
   */
  subdivision?: SynRangeTick['subdivision'];
}>();

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