Line data Source code
1 16 : <script setup lang="ts">
2 : import type { HTMLAttributes } from 'vue'
3 : import { useTemplateRef } from 'vue'
4 :
5 : import { cn } from '@comfyorg/tailwind-utils'
6 :
7 : const { class: className } = defineProps<{
8 : class?: HTMLAttributes['class']
9 : }>()
10 :
11 2374 : const modelValue = defineModel<string | number>()
12 :
13 2374 : const textareaEl = useTemplateRef<HTMLTextAreaElement>('textareaEl')
14 :
15 2374 : defineExpose({
16 : focus: () => textareaEl.value?.focus()
17 : })
18 : </script>
19 :
20 : <template>
21 : <textarea
22 : ref="textareaEl"
23 : v-model="modelValue"
24 : :class="
25 : cn(
26 : 'flex min-h-16 w-full scrollbar-gutter-stable rounded-lg border-none bg-secondary px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-1 aria-invalid:ring-destructive',
27 : className
28 : )
29 : "
30 : />
31 : </template>
|