-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathtab.js
46 lines (40 loc) · 1.04 KB
/
tab.js
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
import { css, html, LitElement, unsafeCSS } from 'lit';
import { classMap } from 'lit/directives/class-map.js';
import { getFocusPseudoClass } from '../../helpers/focus.js';
import { TabMixin } from './tab-mixin.js';
class Tab extends TabMixin(LitElement) {
static get styles() {
const styles = [ css`
.d2l-tab-text {
margin: 0.5rem;
overflow: hidden;
padding: 0.1rem;
text-overflow: ellipsis;
white-space: nowrap;
}
:host(:first-child) .d2l-tab-text {
margin-inline-end: 0.6rem;
margin-inline-start: 0;
}
:host(:${unsafeCSS(getFocusPseudoClass())}) > .d2l-tab-text {
border-radius: 0.3rem;
box-shadow: 0 0 0 2px var(--d2l-color-celestine);
color: var(--d2l-color-celestine);
}
`];
super.styles && styles.unshift(super.styles);
return styles;
}
renderContent() {
const contentClasses = {
'd2l-tab-handler': true,
'd2l-tab-text': true,
};
return html`
<div class="${classMap(contentClasses)}">
<slot></slot>
</div>
`;
}
}
customElements.define('d2l-tab-wip', Tab);