<template>
  <div :class="growing ? 'grow' : 'w-full'">
    <div class="flex flex-row gap-2 items-center">
      <label :for="title">{{ title }}</label>
      <lottie-player src="/typing_animation.json" class="w-fit h-5" loop autoplay />
    </div>
    <input :type="type" :id="title" v-model="value" :min="min" />
  </div>
</template>

<script setup lang="ts">
import { defineComponent } from "vue";
import { mapActions, mapState, mapWritableState } from "pinia";
import "@lottiefiles/lottie-player";
</script>

<script lang="ts">
export default defineComponent({
  props: {
    modelValue: {
      type: String,
      default: "",
    },
    title: {
      type: String,
      default: "",
    },
    growing: {
      type: Boolean,
      default: false,
    },
    type: {
      type: String,
      default: "text",
    },
    min: {
      type: String,
      default: "",
    },
  },
  emits: ["update:model-value"],
  computed: {
    value: {
      get() {
        return this.modelValue;
      },
      set(val: string) {
        this.$emit("update:model-value", val);
      },
    },
  },
});
</script>
