mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 00:09:52 +00:00
34 lines
1.3 KiB
Vue
34 lines
1.3 KiB
Vue
<script setup lang="ts">
|
|
import type { HTMLAttributes } from 'vue'
|
|
import { useVModel } from '@vueuse/core'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
const props = defineProps<{
|
|
defaultValue?: string | number
|
|
modelValue?: string | number
|
|
class?: HTMLAttributes['class']
|
|
}>()
|
|
|
|
const emits = defineEmits<{
|
|
(e: 'update:modelValue', payload: string | number): void
|
|
}>()
|
|
|
|
const modelValue = useVModel(props, 'modelValue', emits, {
|
|
passive: true,
|
|
defaultValue: props.defaultValue,
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<input
|
|
v-model="modelValue"
|
|
autocapitalize="off"
|
|
autocomplete="off"
|
|
data-slot="input"
|
|
:class="cn(
|
|
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
props.class,
|
|
)"
|
|
>
|
|
</template>
|