Refactor #3832 Refactor #3833 - icon & .d.ts. updates

This commit is contained in:
Tuğçe Küçükoğlu 2023-04-18 13:51:10 +03:00
parent f93e2be93d
commit cd7ef52319
32 changed files with 239 additions and 53 deletions

View file

@ -61,10 +61,12 @@ export interface PasswordProps extends InputHTMLAttributes {
toggleMask?: boolean | undefined;
/**
* Icon to hide displaying the password as plain text.
* @deprecated since v3.27.0. Use 'hideicon' slot.
*/
hideIcon?: string | undefined;
/**
* Icon to show displaying the password as plain text.
* @deprecated since v3.27.0. Use 'showicon' slot.
*/
showIcon?: string | undefined;
/**
@ -142,11 +144,21 @@ export interface PasswordSlots {
/**
* Custom hide icon template.
*/
hideicon(): VNode[];
hideicon(scope: {
/**
* Hide icon click event
*/
onClick(): void;
}): VNode[];
/**
* Custom show icon template.
*/
showicon(): VNode[];
showicon(scope: {
/**
* Show icon click event
*/
onClick(): void;
}): VNode[];
}
/**

View file

@ -21,10 +21,10 @@
@invalid="onInvalid"
v-bind="inputProps"
/>
<slot v-if="toggleMask && unmasked" name="hideicon">
<slot v-if="toggleMask && unmasked" name="hideicon" :onClick="() => onMaskToggle">
<component :is="hideIcon ? 'i' : 'EyeSlashIcon'" :class="hideIcon" @click="onMaskToggle" />
</slot>
<slot v-if="toggleMask && !unmasked" name="showicon">
<slot v-if="toggleMask && !unmasked" name="showicon" :onClick="() => onMaskToggle">
<component :is="showIcon ? 'i' : 'EyeIcon'" :class="showIcon" @click="onMaskToggle" />
</slot>
<span class="p-hidden-accessible" aria-live="polite">