2019-02-18 09:18:32 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2022-06-19 00:25:21 +00:00
|
|
|
<slot :is-visible="isVisible" />
|
2019-02-18 09:18:32 +00:00
|
|
|
<span
|
|
|
|
ref="revealButton"
|
|
|
|
type="button"
|
|
|
|
:class="[
|
|
|
|
'reveal-password tooltipped tooltipped-n tooltipped-no-delay',
|
2019-08-03 19:03:45 +00:00
|
|
|
{'reveal-password-visible': isVisible},
|
2019-02-18 09:18:32 +00:00
|
|
|
]"
|
|
|
|
:aria-label="isVisible ? 'Hide password' : 'Show password'"
|
2019-03-01 14:18:16 +00:00
|
|
|
@click="onClick"
|
|
|
|
>
|
2019-08-03 19:03:45 +00:00
|
|
|
<span :aria-label="isVisible ? 'Hide password' : 'Show password'" />
|
2019-02-18 09:18:32 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-06-19 00:25:21 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import {defineComponent, ref} from "vue";
|
|
|
|
|
|
|
|
export default defineComponent({
|
2019-02-18 09:18:32 +00:00
|
|
|
name: "RevealPassword",
|
2022-06-19 00:25:21 +00:00
|
|
|
setup() {
|
|
|
|
const isVisible = ref(false);
|
|
|
|
|
|
|
|
const onClick = () => {
|
|
|
|
isVisible.value = !isVisible.value;
|
|
|
|
};
|
|
|
|
|
2019-02-18 09:18:32 +00:00
|
|
|
return {
|
2022-06-19 00:25:21 +00:00
|
|
|
isVisible,
|
|
|
|
onClick,
|
2019-02-18 09:18:32 +00:00
|
|
|
};
|
|
|
|
},
|
2022-06-19 00:25:21 +00:00
|
|
|
});
|
2019-02-18 09:18:32 +00:00
|
|
|
</script>
|