-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathtext.ts
58 lines (50 loc) · 1.29 KB
/
text.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
46
47
48
49
50
51
52
53
54
55
56
57
58
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 "./text.scss";
export type TextSize = "large" | "medium";
/**
* Properties of the text.
*/
export interface ITextProperties {
size: TextSize;
role: AriaRole;
}
/**
* Group text into paragraphs.
* @slot - Default content.
* @cssprop --text-margin - Margin
* @cssprop --text-line-height - Line height
* @cssprop --text-opacity - Opacity
* @cssprop --text-font-size-m - Font size medium
* @cssprop --text-font-size-l - Font size large
* @cssprop --text-font-family - Font family
*/
@customElement("wl-text")
export class Text extends LitElement implements ITextProperties {
static styles = [sharedStyles, cssResult(styles)];
/**
* Size of the text.
* @attr
*/
@property({ type: String, reflect: true }) size: TextSize = "medium";
/**
* Role of the text.
* @attr
*/
@property({ type: String, reflect: true }) role: AriaRole = "paragraph";
/**
* Returns the template for the element.
*/
protected render(): TemplateResult {
return html`
<slot></slot>
`;
}
}
declare global {
interface HTMLElementTagNameMap {
"wl-text": Text;
}
}