-
Notifications
You must be signed in to change notification settings - Fork 2
/
select-item.ts
46 lines (41 loc) · 1.41 KB
/
select-item.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
import { themes } from '../../theming/theming-decorator.js';
import { watch } from '../common/decorators/watch.js';
import { registerComponent } from '../common/definitions/register.js';
import { IgcBaseOptionLikeComponent } from '../common/mixins/option.js';
import { styles } from '../dropdown/themes/dropdown-item.base.css.js';
import { all } from '../dropdown/themes/item.js';
import { styles as shared } from '../dropdown/themes/shared/item/dropdown-item.common.css.js';
/**
* Represents an item in a select list.
*
* @element igc-select-item
*
* @slot - Renders the all content bar the prefix and suffix.
* @slot prefix - Renders content before the main content area.
* @slot suffix - Renders content after the main content area.
*
* @csspart prefix - The prefix wrapper.
* @csspart content - The main content wrapper.
* @csspart suffix - The suffix wrapper.
*/
@themes(all)
export default class IgcSelectItemComponent extends IgcBaseOptionLikeComponent {
public static readonly tagName = 'igc-select-item';
public static override styles = [styles, shared];
/* blazorSuppress */
public static register() {
registerComponent(IgcSelectItemComponent);
}
@watch('active')
protected activeChange() {
this.tabIndex = this.active ? 0 : -1;
if (this.active) {
this.focus();
}
}
}
declare global {
interface HTMLElementTagNameMap {
'igc-select-item': IgcSelectItemComponent;
}
}