<template lang="pug">
  .flex.flex-col.gap-y-2
    .label.font-semibold.text-sm.opacity-40(v-if="label") {{ label }}
    .input-wrapper.flex.gap-x-2.px-4.box-border.py-2.h-10
      input.input.w-full.outline-0.not-italic.cursor-text(
        v-model="value"
        type="time"
        :placeholder="placeholder"
      )
      .slot(v-if="withIcon" :class="iconPosition")
        slot.cursor-pointer
</template>

<script>
export default {
  name: "BaseInputTime",
  props: {
    modelValue: String,
    withIcon: {
      default: false,
    },
    iconPosition: {
      default: "right",
    },
    placeholder: String,
    label: String,
  },
  emits: ["update:modelValue"],
  computed: {
    value: {
      get() {
        return this.modelValue;
      },
      set(value) {
        this.$emit("update:modelValue", value);
      },
    },
  },
};
</script>

<style lang="sass" scoped>
.left
  order: -1
.right
  order: 1
.input-wrapper
  border-radius: 4px
  background-color: var(--default-white)
  color: var(--font-black-color)
  border: 1.5px solid var(--border-light-grey-color)
input::-webkit-calendar-picker-indicator
  cursor: pointer
</style>
