forked from andreasbm/weightless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
banner.ts
59 lines (53 loc) · 1.48 KB
/
banner.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
59
import { customElement, html, LitElement, property, TemplateResult } from "lit-element";
import "../divider";
import { sharedStyles } from "../style/shared";
import { AriaRole } from "../util/aria";
import { cssResult } from "../util/css";
import styles from "./banner.scss";
/**
* Properties of the banner.
*/
export interface IBannerProperties {
role: AriaRole;
}
/**
* Display a non-interruptive message and related optional actions.
* @slot icon - Icon content.
* @slot action - Action content (you can have multiple slots named action).
* @slot - Default content.
* @cssprop --banner-icon-margin - Margin of the icon slot
* @cssprop --banner-padding - Padding
* @cssprop --banner-content-padding - Padding of the content slot
* @cssprop --banner-icon-color - Color of the icon
* @cssprop --banner-color - Color
* @cssprop --banner-bg - Background
*/
@customElement("wl-banner")
export class Banner extends LitElement implements IBannerProperties {
static styles = [sharedStyles, cssResult(styles)];
/**
* Role of the banner.
* @attr
*/
@property({type: String, reflect: true}) role: AriaRole = "banner";
/**
* Returns the template of the element.
*/
protected render (): TemplateResult {
return html`
<div id="content">
<slot name="icon"></slot>
<slot></slot>
</div>
<div id="actions">
<slot name="action"></slot>
</div>
<wl-divider id="divider"></wl-divider>
`;
}
}
declare global {
interface HTMLElementTagNameMap {
"wl-banner": Banner;
}
}