Files
hnh-map/frontend-nuxt/components/PasswordInput.vue
Nikolay Tatarinov adfdfd01c4 Update frontend components for accessibility and functionality improvements
- Modified docker-compose.dev.yml to conditionally run npm install based on the presence of package-lock.json.
- Upgraded Nuxt version in package-lock.json from 3.21.1 to 4.3.1 for enhanced features.
- Enhanced ConfirmModal component with aria-modal attribute for better accessibility.
- Updated MapErrorBoundary component's error message for clarity.
- Added role and aria-label attributes to MapView and MapSearch components for improved screen reader support.
- Refactored various components to manage focus behavior on modal close, enhancing user experience.
- Improved ToastContainer styling for better responsiveness and visibility.
- Updated layout components to include skip navigation links for improved accessibility.
2026-03-04 01:00:56 +03:00

52 lines
1.6 KiB
Vue

<template>
<fieldset class="fieldset">
<label v-if="label" class="label" :for="inputId">
<span>{{ label }}</span>
</label>
<div class="relative flex">
<input
:id="inputId"
:value="modelValue"
:type="showPass ? 'text' : 'password'"
class="input flex-1 pr-10 min-h-11 touch-manipulation"
:placeholder="placeholder"
:required="required"
:autocomplete="autocomplete"
:readonly="readonly"
:aria-describedby="ariaDescribedby"
@input="emit('update:modelValue', ($event.target as HTMLInputElement).value)"
/>
<button
type="button"
class="absolute right-2 top-1/2 -translate-y-1/2 btn btn-ghost btn-sm btn-square min-h-9 min-w-9 touch-manipulation"
:aria-label="showPass ? 'Hide password' : 'Show password'"
@click="showPass = !showPass"
>
<icons-icon-eye-off v-if="showPass" />
<icons-icon-eye v-else />
</button>
</div>
</fieldset>
</template>
<script setup lang="ts">
const props = withDefaults(
defineProps<{
modelValue: string
label?: string
placeholder?: string
required?: boolean
autocomplete?: string
readonly?: boolean
inputId?: string
ariaDescribedby?: string
}>(),
{ required: false, autocomplete: 'off', inputId: undefined, ariaDescribedby: undefined }
)
const emit = defineEmits<{ 'update:modelValue': [value: string] }>()
const showPass = ref(false)
const inputId = computed(() => props.inputId ?? `password-${Math.random().toString(36).slice(2, 9)}`)
</script>