| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <script setup>
- import { computed } from 'vue'
-
- const props = defineProps({
- label: {
- type: String,
- required: true,
- },
- error: {
- type: String,
- default: null,
- },
- })
-
- const isError = computed(() => (props.error ? true : false))
-
- const ariaDescribedbyLabel = computed(
- () => props.label.toLowerCase().replace(/\s+/g, '-') + '-error'
- )
- </script>
-
- <template>
- <div class="field">
- <label>{{ label }}</label>
-
- <Password
- class="w-full"
- input-class="w-full"
- :class="{ 'p-invalid': isError }"
- v-bind="$attrs"
- @input="$emit('update:modelValue', $event.target.value)"
- />
-
- <small
- v-if="error"
- :aria-describedby="ariaDescribedbyLabel"
- :class="{ 'p-error': isError }"
- >
- {{ error }}
- </small>
- </div>
- </template>
|