forked from andreasbm/weightless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
icon.ts
45 lines (39 loc) · 978 Bytes
/
icon.ts
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
import { customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { sharedStyles } from "../style/shared";
import { AriaRole } from "../util/aria";
import { cssResult } from "../util/css";
import styles from "./icon.scss";
/**
* Properties of the icon.
*/
export interface IIconProperties {
role: AriaRole;
}
/**
* Symbols for common actions and items.
* @slot - Name of the icon.
* @cssprop --icon-font - Font family
* @cssprop --icon-size - Width and height
*/
@customElement("wl-icon")
export class Icon extends LitElement implements IIconProperties {
static styles = [cssResult(styles), sharedStyles];
/**
* Roles of the icon.
* @attr
*/
@property({type: String, reflect: true}) role: AriaRole = "presentation";
/**
* Returns the template for the element.
*/
protected render (): TemplateResult {
return html`
<slot></slot>
`;
}
}
declare global {
interface HTMLElementTagNameMap {
"wl-icon": Icon;
}
}