UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 2.98 kB
export const __rspack_esm_id=79927;export const __rspack_esm_ids=[79927];export const __webpack_modules__={7466(e,t,s){s.a(e,async function(e,a){try{s.r(t),s.d(t,{CloudForgotPasswordCard:()=>y});var r=s(62826),i=s(5124),o=s(22441),n=s(1087),l=s(89300),d=s(38962),h=(s(76776),s(91485)),c=s(71117),p=s(79007),_=s(14503),u=e([l,d,h]);[l,d,h]=u.then?(await u)():u;class y extends i.WF{render(){return this.cardLess?this._renderContent():i.qy` <ha-card outlined .header="${this.localize(`ui.panel.${this.translationKeyPanel}.subtitle`)}"> ${this._renderContent()} </ha-card> `}_renderContent(){return i.qy` <div class="card-content"> <p> ${this.localize(`ui.panel.${this.translationKeyPanel}.instructions`)} </p> ${this._error?i.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:i.s6} <ha-input autofocus id="email" label="${this.localize(`ui.panel.${this.translationKeyPanel}.email`)}" .value="${this.email??""}" type="email" required .disabled="${this._inProgress}" @keydown="${this._keyDown}" .validationMessage="${this.localize(`ui.panel.${this.translationKeyPanel}.email_error_msg`)}"></ha-input> </div> <div class="card-actions"> <ha-progress-button @click="${this._handleEmailPasswordReset}" .progress="${this._inProgress}"> ${this.localize(`ui.panel.${this.translationKeyPanel}.send_reset_email`)} </ha-progress-button> </div> `}_keyDown(e){"Enter"===e.key&&this._handleEmailPasswordReset()}async _handleEmailPasswordReset(){const e=this.emailField,t=e.value??"";e.reportValidity()?(this._inProgress=!0,this._resetPassword(t)):e.focus()}static get styles(){return[_.RF,i.AH`ha-card{max-width:600px;margin:0 auto;margin-top:24px}h1{margin:0}ha-input{width:100%}.card-actions{display:flex;justify-content:flex-end;align-items:center}`]}constructor(...e){super(...e),this.translationKeyPanel="config.cloud.forgot_password",this.cardLess=!1,this._inProgress=!1,this._resetPassword=async e=>{this._inProgress=!0;try{this.hass?await(0,c.Ut)(this.hass,e):await(0,p.zN)(e),(0,n.r)(this,"cloud-email-changed",{value:e}),this._inProgress=!1,(0,n.r)(this,"cloud-done",{flashMessage:this.localize(`ui.panel.${this.translationKeyPanel}.check_your_email`)})}catch(t){this._inProgress=!1;"usernotfound"===(t&&t.body&&t.body.code)&&e!==e.toLowerCase()?await this._resetPassword(e.toLowerCase()):this._error=t&&t.body&&t.body.message?t.body.message:"Unknown error"}}}}(0,r.Cg)([(0,o.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,r.Cg)([(0,o.MZ)({attribute:!1})],y.prototype,"localize",void 0),(0,r.Cg)([(0,o.MZ)({attribute:"translation-key-panel"})],y.prototype,"translationKeyPanel",void 0),(0,r.Cg)([(0,o.MZ)()],y.prototype,"email",void 0),(0,r.Cg)([(0,o.MZ)({type:Boolean,attribute:"card-less"})],y.prototype,"cardLess",void 0),(0,r.Cg)([(0,o.wk)()],y.prototype,"_inProgress",void 0),(0,r.Cg)([(0,o.wk)()],y.prototype,"_error",void 0),(0,r.Cg)([(0,o.P)("#email",!0)],y.prototype,"emailField",void 0),y=(0,r.Cg)([(0,o.EM)("cloud-forgot-password-card")],y),a()}catch(e){a(e)}})}};