-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcarousel-indicator-container.ts
More file actions
60 lines (53 loc) · 1.92 KB
/
carousel-indicator-container.ts
File metadata and controls
60 lines (53 loc) · 1.92 KB
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
import { LitElement, html } from 'lit';
import { themes } from '../../theming/theming-decorator.js';
import { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';
import { registerComponent } from '../common/definitions/register.js';
import { partMap } from '../common/part-map.js';
import IgcCarouselIndicatorComponent from './carousel-indicator.js';
import { styles } from './themes/carousel-indicator-container.base.css.js';
import { all } from './themes/indicator-container.js';
import { styles as shared } from './themes/shared/indicator-container/indicator-container.common.css.js';
/* blazorSuppress */
/**
* @element igc-carousel-indicator-container
*
* @slot - Default slot for the carousel indicator container.
*
* @csspart base - The wrapping container of all carousel indicators.
*/
@themes(all)
export default class IgcCarouselIndicatorContainerComponent extends LitElement {
public static readonly tagName = 'igc-carousel-indicator-container';
public static override styles = [styles, shared];
/* blazorSuppress */
public static register(): void {
registerComponent(IgcCarouselIndicatorContainerComponent);
}
private readonly _focusRingManager = addKeyboardFocusRing(this);
private _handleFocusOut(event: FocusEvent): void {
const target = event.relatedTarget as Element;
if (target?.matches(IgcCarouselIndicatorComponent.tagName)) {
// Stop the event from hitting the _focusRingManager handler redrawing
// the keyboard focus styles
event.stopPropagation();
}
}
protected override render() {
return html`
<div
part=${partMap({
base: true,
focused: this._focusRingManager.focused,
})}
@focusout=${this._handleFocusOut}
>
<slot></slot>
</div>
`;
}
}
declare global {
interface HTMLElementTagNameMap {
'igc-carousel-indicator-container': IgcCarouselIndicatorContainerComponent;
}
}