3737 <slot v-if =" toggleMask && !unmasked" :name =" $slots.unmaskicon ? 'unmaskicon' : 'showicon'" :toggleCallback =" onMaskToggle" :class =" [cx('unmaskIcon')]" v-bind =" ptm('unmaskIcon')" >
3838 <component :is =" unmaskIcon ? 'i' : 'EyeIcon'" :class =" [cx('unmaskIcon'), unmaskIcon]" @click =" onMaskToggle" v-bind =" ptm('unmaskIcon')" />
3939 </slot >
40+ <slot v-if =" isClearIconVisible" name =" clearicon" :class =" cx('clearIcon')" :clearCallback =" onClearClick" >
41+ <TimesIcon :class =" [cx('clearIcon')]" @click =" onClearClick" v-bind =" ptm('clearIcon')" />
42+ </slot >
4043 <span class =" p-hidden-accessible" aria-live =" polite" v-bind =" ptm('hiddenAccesible')" :data-p-hidden-accessible =" true" >
4144 {{ infoText }}
4245 </span >
@@ -77,6 +80,7 @@ import { ZIndex } from '@primeuix/utils/zindex';
7780import { ConnectedOverlayScrollHandler } from ' @primevue/core/utils' ;
7881import EyeIcon from ' @primevue/icons/eye' ;
7982import EyeSlashIcon from ' @primevue/icons/eyeslash' ;
83+ import TimesIcon from ' @primevue/icons/times' ;
8084import InputText from ' primevue/inputtext' ;
8185import OverlayEventBus from ' primevue/overlayeventbus' ;
8286import Portal from ' primevue/portal' ;
@@ -297,6 +301,9 @@ export default {
297301 onMaskToggle () {
298302 this .unmasked = ! this .unmasked ;
299303 },
304+ onClearClick (event ) {
305+ this .writeValue (null , {});
306+ },
300307 onOverlayClick (event ) {
301308 OverlayEventBus .emit (' overlay-click' , {
302309 originalEvent: event ,
@@ -320,6 +327,9 @@ export default {
320327 promptText () {
321328 return this .promptLabel || this .$primevue .config .locale .passwordPrompt ;
322329 },
330+ isClearIconVisible () {
331+ return this .showClear && this .$filled && ! this .disabled ;
332+ },
323333 overlayUniqueId () {
324334 return this .$id + ' _overlay' ;
325335 },
@@ -343,7 +353,8 @@ export default {
343353 InputText,
344354 Portal,
345355 EyeSlashIcon,
346- EyeIcon
356+ EyeIcon,
357+ TimesIcon
347358 }
348359};
349360< / script>
0 commit comments