Line data Source code
1 16 : <script setup lang="ts">
2 : import type { HTMLAttributes } from 'vue'
3 : import { useI18n } from 'vue-i18n'
4 :
5 : import Spinner from '@comfyorg/design-system/spinner/Spinner'
6 :
7 : import DotSpinner from '@comfyorg/design-system/common/DotSpinner'
8 :
9 : defineOptions({ inheritAttrs: false })
10 :
11 : const {
12 : label = false,
13 : variant = 'ring',
14 : class: customClass = ''
15 : } = defineProps<{
16 : label?: boolean
17 : variant?: 'ring' | 'dots'
18 : class?: HTMLAttributes['class']
19 : }>()
20 :
21 59 : const { t } = useI18n()
22 : </script>
23 :
24 : <template>
25 : <span v-if="label" class="inline-flex items-center gap-2">
26 : <component
27 : :is="variant === 'ring' ? Spinner : DotSpinner"
28 : v-bind="$attrs"
29 : role="progressbar"
30 : :aria-label="t('g.loading')"
31 : :class="customClass"
32 : />
33 : <span aria-hidden="true">{{ t('g.loading') }}</span>
34 : </span>
35 : <component
36 : :is="variant === 'ring' ? Spinner : DotSpinner"
37 : v-else
38 : v-bind="$attrs"
39 : role="progressbar"
40 : :aria-label="t('g.loading')"
41 : :class="customClass"
42 : />
43 : </template>
|