-
Notifications
You must be signed in to change notification settings - Fork 25
/
dropdown-more.js
62 lines (55 loc) · 1.5 KB
/
dropdown-more.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import '../button/button-icon.js';
import { css, html, LitElement } from 'lit';
import { VisibleOnAncestorMixin, visibleOnAncestorStyles } from '../../mixins/visible-on-ancestor/visible-on-ancestor-mixin.js';
import { DropdownOpenerMixin } from './dropdown-opener-mixin.js';
import { dropdownOpenerStyles } from './dropdown-opener-styles.js';
/**
* A simple/minimal opener for dropdown content.
* @slot - Dropdown content (e.g., "d2l-dropdown-content", "d2l-dropdown-menu" or "d2l-dropdown-tabs")
*/
class DropdownMore extends DropdownOpenerMixin(VisibleOnAncestorMixin(LitElement)) {
static get properties() {
return {
/**
* REQUIRED: Label for the more button
* @type {string}
*/
text: {
type: String
},
/**
* Attribute for busy/rich backgrounds
* @type {boolean}
*/
translucent: {
type: Boolean
},
};
}
static get styles() {
return [dropdownOpenerStyles, visibleOnAncestorStyles, css`
:host {
display: inline-block;
}
`];
}
constructor() {
super();
this.translucent = false;
}
render() {
return html`
<d2l-button-icon ?disabled=${this.disabled} icon="tier1:more" text=${this.text} ?translucent=${this.translucent}>
</d2l-button-icon>
<slot></slot>
`;
}
/**
* Gets the "d2l-button-icon" opener element (required by dropdown-opener-mixin).
* @return {HTMLElement}
*/
getOpenerElement() {
return this.shadowRoot && this.shadowRoot.querySelector('d2l-button-icon');
}
}
customElements.define('d2l-dropdown-more', DropdownMore);