Line data Source code
1 12 : <script setup lang="ts">
2 : import type { HTMLAttributes } from 'vue'
3 : import { ref } from 'vue'
4 :
5 : import InputGroup from '@comfyorg/design-system/input-group/InputGroup'
6 : import InputGroupAddon from '@comfyorg/design-system/input-group/InputGroupAddon'
7 : import InputGroupButton from '@comfyorg/design-system/input-group/InputGroupButton'
8 : import InputGroupInput from '@comfyorg/design-system/input-group/InputGroupInput'
9 :
10 : const {
11 : class: className,
12 : disabled = false,
13 : hidePasswordLabel,
14 : showPasswordLabel
15 : } = defineProps<{
16 : hidePasswordLabel: string
17 : showPasswordLabel: string
18 : class?: HTMLAttributes['class']
19 : disabled?: boolean
20 : }>()
21 :
22 21 : const modelValue = defineModel<string>()
23 21 : const visible = ref(false)
24 21 :
25 : defineOptions({ inheritAttrs: false })
26 : </script>
27 :
28 : <template>
29 29 : <InputGroup :class="className">
30 : <InputGroupInput
31 : v-model="modelValue"
32 : v-bind="$attrs"
33 : :type="visible ? 'text' : 'password'"
34 : :disabled
35 : />
36 : <InputGroupAddon align="inline-end">
37 : <InputGroupButton
38 : size="icon-sm"
39 : :disabled
40 : :aria-label="visible ? hidePasswordLabel : showPasswordLabel"
41 : :aria-pressed="visible"
42 : @click="visible = !visible"
43 : >
44 : <i :class="visible ? 'icon-[lucide--eye-off]' : 'icon-[lucide--eye]'" />
45 : </InputGroupButton>
46 : </InputGroupAddon>
47 : </InputGroup>
48 : </template>
|