-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
index.ts
34 lines (27 loc) · 1.04 KB
/
index.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
import { html, LitElement } from 'lit'
import { property } from 'lit/decorators.js'
import { resetStyles } from '../../utils/ThemeUtil.js'
import type { ColorType, SizeType } from '../../utils/TypeUtil.js'
import { customElement } from '../../utils/WebComponentsUtil.js'
import styles from './styles.js'
@customElement('wui-loading-spinner')
export class WuiLoadingSpinner extends LitElement {
public static override styles = [resetStyles, styles]
@property() public color: ColorType = 'accent-100'
@property() public size: Exclude<SizeType, 'inherit' | 'xs' | 'xxs' | 'mdl'> = 'lg'
// -- Render -------------------------------------------- //
public override render() {
this.style.cssText = `--local-color: ${
this.color === 'inherit' ? 'inherit' : `var(--wui-color-${this.color})`
}`
this.dataset['size'] = this.size
return html`<svg viewBox="25 25 50 50">
<circle r="20" cy="50" cx="50"></circle>
</svg>`
}
}
declare global {
interface HTMLElementTagNameMap {
'wui-loading-spinner': WuiLoadingSpinner
}
}