mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 16:56:35 +00:00
New component files
This commit is contained in:
parent
5d58dfab3e
commit
9b9b2f0710
25
src/components/ha-icon-next.ts
Normal file
25
src/components/ha-icon-next.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import "@polymer/iron-icon/iron-icon";
|
||||
// Not duplicate, this is for typing.
|
||||
// tslint:disable-next-line
|
||||
import { HaIcon } from "./ha-icon";
|
||||
|
||||
export class HaIconNext extends HaIcon {
|
||||
public connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
this.icon =
|
||||
window.getComputedStyle(this).direction === "ltr"
|
||||
? "hass:chevron-right"
|
||||
: "hass:chevron-left";
|
||||
|
||||
this.fire("iron-resize");
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-icon-next": HaIconNext;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("ha-icon-next", HaIconNext);
|
25
src/components/ha-icon-prev.ts
Normal file
25
src/components/ha-icon-prev.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import "@polymer/iron-icon/iron-icon";
|
||||
// Not duplicate, this is for typing.
|
||||
// tslint:disable-next-line
|
||||
import { HaIcon } from "./ha-icon";
|
||||
|
||||
export class HaIconPrev extends HaIcon {
|
||||
public connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
this.icon =
|
||||
window.getComputedStyle(this).direction === "ltr"
|
||||
? "hass:chevron-left"
|
||||
: "hass:chevron-right";
|
||||
|
||||
this.fire("iron-resize");
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-icon-prev": HaIconPrev;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("ha-icon-prev", HaIconPrev);
|
31
src/components/ha-paper-icon-button-arrow-next.ts
Normal file
31
src/components/ha-paper-icon-button-arrow-next.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { Constructor } from "lit-element";
|
||||
import "@polymer/paper-icon-button/paper-icon-button";
|
||||
// Not duplicate, this is for typing.
|
||||
// tslint:disable-next-line
|
||||
import { PaperIconButtonElement } from "@polymer/paper-icon-button/paper-icon-button";
|
||||
|
||||
const paperIconButtonClass = customElements.get(
|
||||
"paper-icon-button"
|
||||
) as Constructor<PaperIconButtonElement>;
|
||||
|
||||
export class HaPaperIconButtonArrowNext extends paperIconButtonClass {
|
||||
public connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
this.icon =
|
||||
window.getComputedStyle(this).direction === "ltr"
|
||||
? "hass:arrow-right"
|
||||
: "hass:arrow-left";
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-paper-icon-button-arrow-next": HaPaperIconButtonArrowNext;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define(
|
||||
"ha-paper-icon-button-arrow-next",
|
||||
HaPaperIconButtonArrowNext
|
||||
);
|
31
src/components/ha-paper-icon-button-arrow-prev.ts
Normal file
31
src/components/ha-paper-icon-button-arrow-prev.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { Constructor } from "lit-element";
|
||||
import "@polymer/paper-icon-button/paper-icon-button";
|
||||
// Not duplicate, this is for typing.
|
||||
// tslint:disable-next-line
|
||||
import { PaperIconButtonElement } from "@polymer/paper-icon-button/paper-icon-button";
|
||||
|
||||
const paperIconButtonClass = customElements.get(
|
||||
"paper-icon-button"
|
||||
) as Constructor<PaperIconButtonElement>;
|
||||
|
||||
export class HaPaperIconButtonArrowPrev extends paperIconButtonClass {
|
||||
public connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
this.icon =
|
||||
window.getComputedStyle(this).direction === "ltr"
|
||||
? "hass:arrow-left"
|
||||
: "hass:arrow-right";
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-paper-icon-button-arrow-prev": HaPaperIconButtonArrowPrev;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define(
|
||||
"ha-paper-icon-button-arrow-prev",
|
||||
HaPaperIconButtonArrowPrev
|
||||
);
|
28
src/components/ha-paper-icon-button-next.ts
Normal file
28
src/components/ha-paper-icon-button-next.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { Constructor } from "lit-element";
|
||||
import "@polymer/paper-icon-button/paper-icon-button";
|
||||
// Not duplicate, this is for typing.
|
||||
// tslint:disable-next-line
|
||||
import { PaperIconButtonElement } from "@polymer/paper-icon-button/paper-icon-button";
|
||||
|
||||
const paperIconButtonClass = customElements.get(
|
||||
"paper-icon-button"
|
||||
) as Constructor<PaperIconButtonElement>;
|
||||
|
||||
export class HaPaperIconButtonNext extends paperIconButtonClass {
|
||||
public connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
this.icon =
|
||||
window.getComputedStyle(this).direction === "ltr"
|
||||
? "hass:chevron-right"
|
||||
: "hass:chevron-left";
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-paper-icon-button-next": HaPaperIconButtonNext;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("ha-paper-icon-button-next", HaPaperIconButtonNext);
|
28
src/components/ha-paper-icon-button-prev.ts
Normal file
28
src/components/ha-paper-icon-button-prev.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { Constructor } from "lit-element";
|
||||
import "@polymer/paper-icon-button/paper-icon-button";
|
||||
// Not duplicate, this is for typing.
|
||||
// tslint:disable-next-line
|
||||
import { PaperIconButtonElement } from "@polymer/paper-icon-button/paper-icon-button";
|
||||
|
||||
const paperIconButtonClass = customElements.get(
|
||||
"paper-icon-button"
|
||||
) as Constructor<PaperIconButtonElement>;
|
||||
|
||||
export class HaPaperIconButtonPrev extends paperIconButtonClass {
|
||||
public connectedCallback() {
|
||||
super.connectedCallback();
|
||||
|
||||
this.icon =
|
||||
window.getComputedStyle(this).direction === "ltr"
|
||||
? "hass:chevron-left"
|
||||
: "hass:chevron-right";
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-paper-icon-button-prev": HaPaperIconButtonPrev;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("ha-paper-icon-button-prev", HaPaperIconButtonPrev);
|
Loading…
x
Reference in New Issue
Block a user