1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"use strict";
import { LitElement, html, css } from "lit-element";
import { state } from "./state.js";
import "./card.js";
class Prompt extends LitElement {
render() {
return html`
<h4>Enter the passphrase:</h4>
<form @submit=${this.handleSubmit}>
<smarthome-card>
<input type="password" id="accessToken">
</smarthome-card>
<mwc-icon-button icon="arrow_forward" @click=${this.handleSubmit}></mwc-icon-button>
</form>
`;
}
handleSubmit(evt) {
evt.preventDefault();
state.setAccessToken(this.shadowRoot.getElementById("accessToken").value);
return true;
}
static get styles() {
return css`
:host {
display: flex;
flex-direction: column;
align-items: center;
}
input {
padding: 0;
border: none;
height: 3em;
color: black;
}
smarthome-card {
display: flex;
margin: 0;
margin-right: 20px;
}
form {
display: flex;
flex-direction: row;
}
`;
}
}
customElements.define("smarthome-prompt", Prompt);