<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 Progress rings are used to show the progress of a determinate operation in a circular fashion.
 * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-progress-ring--docs
 * @status stable
 * @since 1.18.0
 *
 * @slot - A label to show inside the ring.
 *
 * @csspart base - The component's base wrapper.
 * @csspart label - The progress ring label.
 *
 * @cssproperty --size - The diameter of the progress ring (cannot be a percentage).
 * @cssproperty --track-width - The width of the track.
 * @cssproperty --track-color - The color of the track.
 * @cssproperty --indicator-width - The width of the indicator. Defaults to the track width.
 * @cssproperty --indicator-color - The color of the indicator.
 * @cssproperty --indicator-transition-duration - The duration of the indicator's transition when the value changes.
 */
import { computed, ref } from 'vue';
import '@synergy-design-system/components/components/progress-ring/progress-ring.js';

import type SynProgressRing from '@synergy-design-system/components/components/progress-ring/progress-ring.component.js';

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

defineExpose({
  nativeElement,
});

// Map attributes
const props = defineProps<{
  /**
   * The current progress as a percentage, 0 to 100.
   */
  value?: SynProgressRing['value'];

  /**
   * A custom label for assistive devices.
   */
  label?: SynProgressRing['label'];
}>();

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