<template>
  <input
    :value="text"
    :required="true"
    :placeholder="placeholder"
    class="input"
    type="text"
    @input="emitValue"
  />
</template>

<script lang="ts" setup>
const emit = defineEmits<{ (e: 'input', value: string): void }>()
defineProps({
  text: { type: String, default: null },
  placeholder: { type: String, default: '' }
})

function emitValue(event: Event): void {
  const inputValue = (event.target as HTMLInputElement).value
  emit('input', inputValue)
}
</script>

<style scoped lang="scss">
.input {
  padding: toRem(1);
  border-radius: toRem(0.5);
  border: toRem(0.1) solid var(--blue-dark);
  color: var(--blue-dark);
  width: 100%;
}
</style>
