<script setup lang="ts">
import { computed } from 'vue';
import { Progress as ShadcnProgress } from '@/components/core/progress';
import { type UiProgressProps } from './types';

defineOptions({
  name: 'UiProgress',
});

const props = withDefaults(defineProps<UiProgressProps>(), {
  max: 100,
});

const model = defineModel<number>({
  default: 0,
});

const currentProgress = computed(() => {
  return model.value > props.max ? props.max : model.value;
});
</script>

<template>
  <ShadcnProgress :model-value="currentProgress" :max />
</template>
