1234 |
- /*!
- * (C) Ionic http://ionicframework.com - MIT License
- */
- import{r as t,h as o,e as s,f as e}from"./p-66a5d6a8.js";import{p as i}from"./p-17e21141.js";import{c as n}from"./p-47794def.js";import{x as a,y as r}from"./p-da2b833b.js";import{b as p}from"./p-dabe3bd4.js";const d=class{constructor(o){t(this,o),this.togglePasswordVisibility=()=>{const{inputElRef:t}=this;t&&(t.type="text"===t.type?"password":"text")},this.color=void 0,this.showIcon=void 0,this.hideIcon=void 0,this.type="password"}onTypeChange(t){"text"===t||"password"===t||i(`[ion-input-password-toggle] - Only inputs of type "text" or "password" are supported. Input of type "${t}" is not compatible.`,this.el)}connectedCallback(){const{el:t}=this,o=this.inputElRef=t.closest("ion-input");o?this.type=o.type:i("[ion-input-password-toggle] - No ancestor ion-input found. This component must be slotted inside of an ion-input.",t)}disconnectedCallback(){this.inputElRef=null}render(){var t,e;const{color:i,type:d}=this,c=p(this),l=null!==(t=this.showIcon)&&void 0!==t?t:a,h=null!==(e=this.hideIcon)&&void 0!==e?e:r,u="text"===d;return o(s,{key:"1a28e078c83e74c72d8bb8189ece93ec2e3fa3d0",class:n(i,{[c]:!0})},o("ion-button",{key:"039d1bab764093bb6fe4a34299b0872abda087fd",mode:c,color:i,fill:"clear",shape:"round","aria-checked":u?"true":"false","aria-label":"show password",role:"switch",type:"button",onPointerDown:t=>{t.preventDefault()},onClick:this.togglePasswordVisibility},o("ion-icon",{key:"26477ee97b808c3d79944bf5e33d4e05f1ae0b3f",slot:"icon-only","aria-hidden":"true",icon:u?h:l})))}get el(){return e(this)}static get watchers(){return{type:["onTypeChange"]}}};d.style={ios:"",md:""};export{d as ion_input_password_toggle}
|