mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-09 16:52:17 +01:00
34 lines
843 B
Vue
34 lines
843 B
Vue
<script setup lang="ts">
|
|
import { onMounted, ref } from 'vue';
|
|
import { twMerge } from 'tailwind-merge';
|
|
|
|
const props = defineProps<{
|
|
name?: string;
|
|
class?: string;
|
|
}>();
|
|
|
|
const input = ref<HTMLInputElement | null>(null);
|
|
|
|
onMounted(() => {
|
|
if (input.value?.hasAttribute('autofocus')) {
|
|
input.value?.focus();
|
|
}
|
|
});
|
|
|
|
defineExpose({ focus: () => input.value?.focus() });
|
|
const model = defineModel();
|
|
</script>
|
|
|
|
<template>
|
|
<input
|
|
ref="input"
|
|
v-model="model"
|
|
:class="
|
|
twMerge(
|
|
'h-9 px-3 py-1 text-base sm:text-sm border-input-border border bg-input-background text-text-primary focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-transparent rounded-md shadow-sm',
|
|
props.class
|
|
)
|
|
"
|
|
:name="name" />
|
|
</template>
|