((LitElement) => {
const html = LitElement.prototype.html;
const css = LitElement.prototype.css;
const version = '1.0.7';
const SUPPORTED_ENTITY_DOMAINS = [
'input_text',
'var', // custom component: https://github.com/snarky-snark/home-assistant-variables/
];
const HA_ATTRIBUTE_MAX_LENGTH = 65535;
const HA_STATE_MAX_LENGTH = 255;
class LovelaceMultilineTextInput extends LitElement {
static get properties() {
return {
_hass: {},
stateObj: {},
config: {},
};
}
static get styles() {
return css`
.action-result-message-container {
background-color: var(--primary-background-color);
border: 1px solid var(--primary-color);
border-radius: 3px;
bottom: 10px;
opacity: 1;
padding: 5px;
position: absolute;
transition: opacity 0.5s linear;
}
.button {
cursor: pointer;
opacity: 1;
padding: 5px 0;
transition: opacity 0.5s linear;
}
.button-disabled {
cursor: auto;
pointer-events: none;
}
.flex-1 {
flex: 1;
}
.flex-center {
align-items: center;
display: flex;
justify-content: space-evenly;
}
.flex-col {
display: flex;
flex-direction: column;
}
.flex-left {
display: flex;
justify-content: start;
}
.flex-right {
display: flex;
justify-content: end;
}
.flex-row {
display: flex;
flex-direction: row;
}
.h-full {
height: 100%;
}
.invisible {
visibility: hidden;
}
.opacity-0 {
opacity: 0 !important;
}
.space-between {
justify-content: space-between;
}
.textarea {
background: inherit;
border: inherit;
border-left: 1px solid var(--primary-color);
border-bottom: 1px solid var(--primary-color);
box-shadow: none;
color: inherit;
field-sizing: content;
font: inherit;
font-size: 16px;
letter-spacing: inherit;
line-height: inherit;
max-width: 100%;
min-width: 100%;
outline: none;
padding: 0 5px;
word-spacing: inherit;
word-wrap: break-word;
}
.text-bold {
font-weight: bold;
}
.text-center {
text-align: center;
}
.text-italic {
font-style: italic;
}
.text-red {
color: red;
}
.text-small {
font-size: 11px;
}
.w-full {
width: 100%;
}
ha-card, ha-card * {
box-sizing: border-box;
}
`;
}
updated() {
this.updateComplete.then(() => {
const new_state = this.getState();
// only overwrite if state has changed since last overwrite
if (this.config.last_updated_text === null || new_state !== this.config.last_updated_text) {
this.setText(new_state, true);
}
});
}
render() {
return this.stateObj ?
html`