-
Notifications
You must be signed in to change notification settings - Fork 2
/
dropdown-group.ts
59 lines (51 loc) · 1.69 KB
/
dropdown-group.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 { LitElement, html } from 'lit';
import { queryAssignedElements } from 'lit/decorators.js';
import type IgcDropdownItemComponent from './dropdown-item';
import { styles } from './themes/dropdown-group.base.css.js';
import { all } from './themes/group.js';
import { styles as shared } from './themes/shared/group/dropdown-group.common.css.js';
import { themes } from '../../theming/theming-decorator.js';
import { blazorSuppress } from '../common/decorators/blazorSuppress.js';
import { registerComponent } from '../common/definitions/register.js';
/**
* A container for a group of `igc-dropdown-item` components.
*
* @element igc-dropdown-group
*
* @slot label - Contains the group's label.
* @slot - Intended to contain the items belonging to this group.
*
* @csspart label - The native label element.
*/
@themes(all)
export default class IgcDropdownGroupComponent extends LitElement {
public static readonly tagName: string = 'igc-dropdown-group';
public static override styles = [styles, shared];
/* blazorSuppress */
public static register() {
registerComponent(this);
}
private _internals: ElementInternals;
/** All child `igc-dropdown-item`s. */
@blazorSuppress()
@queryAssignedElements({ flatten: true, selector: 'igc-dropdown-item' })
public items!: Array<IgcDropdownItemComponent>;
constructor() {
super();
this._internals = this.attachInternals();
this._internals.role = 'group';
}
protected override render() {
return html`
<label part="label">
<slot name="label"></slot>
</label>
<slot></slot>
`;
}
}
declare global {
interface HTMLElementTagNameMap {
'igc-dropdown-group': IgcDropdownGroupComponent;
}
}