summaryrefslogtreecommitdiff
path: root/pse-dashboard/src/components/PasswordInput.vue
blob: 599f438788a43c55ac3d79c0d9650cd455afd4d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<script setup>
import { ref } from 'vue';
import { FloatingLabelInput } from '@/components';

defineProps({
    modelValue: {
        type: String,
        default: ""
    },
    label: {
        type: String,
        default: "Password"
    }
});

defineEmits(['update:modelValue'])
const isPasswordVisible = ref(false);
</script>
<template>
    <div class="input-group form-input">
        <FloatingLabelInput
            :type="isPasswordVisible ? 'text' : 'password'"
            :label="label"
            :model-value="modelValue"
            @update:model-value="newValue =>
                $emit('update:modelValue', newValue)"
        />

        <label class="btn btn-outline-secondary d-flex align-items-center password-visible">
            <input
                v-model="isPasswordVisible"
                type="checkbox"
                class="btn-check"
                autocomplete="off"
            >
            <i
                class="fa"
                :class="isPasswordVisible ? 'fa-eye-slash' : 'fa-eye'"
            />
        </label>
    </div>
</template>
<style scoped>
</style>