igniteui-webcomponents 5.1.0 → 5.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/components/button-group/button-group.js +2 -2
- package/components/button-group/button-group.js.map +1 -1
- package/components/carousel/carousel.d.ts +10 -6
- package/components/carousel/carousel.js +16 -7
- package/components/carousel/carousel.js.map +1 -1
- package/components/common/controllers/mutation-observer.d.ts +6 -2
- package/components/common/controllers/mutation-observer.js +2 -2
- package/components/common/controllers/mutation-observer.js.map +1 -1
- package/components/tabs/tabs.js +7 -4
- package/components/tabs/tabs.js.map +1 -1
- package/components/validation-container/validation-container.js +1 -1
- package/components/validation-container/validation-container.js.map +1 -1
- package/custom-elements.json +57 -6
- package/package.json +3 -2
- package/web-types.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [5.1.2] - 2024-11-04
|
|
8
|
+
### Added
|
|
9
|
+
- Carousel component select method overload accepting index [#1457](https://github.com/IgniteUI/igniteui-webcomponents/issues/1457)
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- Tabs - nested tabs selection [#713](https://github.com/IgniteUI/igniteui-webcomponents/issues/713)
|
|
13
|
+
|
|
14
|
+
## [5.1.1] - 2024-10-28
|
|
15
|
+
### Fixed
|
|
16
|
+
- Library - internal import path for styles and public exports for themes
|
|
17
|
+
|
|
7
18
|
## [5.1.0] - 2024-10-25
|
|
8
19
|
### Added
|
|
9
20
|
- Carousel component [#1226](https://github.com/IgniteUI/igniteui-webcomponents/issues/1226)
|
|
@@ -598,6 +609,8 @@ Initial release of Ignite UI Web Components
|
|
|
598
609
|
- Ripple component
|
|
599
610
|
- Switch component
|
|
600
611
|
|
|
612
|
+
[5.1.2]: https://github.com/IgniteUI/igniteui-webcomponents/compare/5.1.1...5.1.2
|
|
613
|
+
[5.1.1]: https://github.com/IgniteUI/igniteui-webcomponents/compare/5.1.0...5.1.1
|
|
601
614
|
[5.1.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/5.0.2...5.1.0
|
|
602
615
|
[5.0.2]: https://github.com/IgniteUI/igniteui-webcomponents/compare/5.0.1...5.0.2
|
|
603
616
|
[5.0.1]: https://github.com/IgniteUI/igniteui-webcomponents/compare/5.0.0...5.0.1
|
|
@@ -12,7 +12,7 @@ import { createMutationController, } from '../common/controllers/mutation-observ
|
|
|
12
12
|
import { watch } from '../common/decorators/watch.js';
|
|
13
13
|
import { registerComponent } from '../common/definitions/register.js';
|
|
14
14
|
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
15
|
-
import { findElementFromEventPath } from '../common/util.js';
|
|
15
|
+
import { findElementFromEventPath, last } from '../common/util.js';
|
|
16
16
|
import { styles } from './themes/group.base.css.js';
|
|
17
17
|
import { all } from './themes/group.js';
|
|
18
18
|
import { styles as shared } from './themes/shared/group/group.common.css.js';
|
|
@@ -29,7 +29,7 @@ let IgcButtonGroupComponent = IgcButtonGroupComponent_1 = class IgcButtonGroupCo
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
const buttons = this.toggleButtons;
|
|
32
|
-
const idx = buttons.indexOf(added.length ? added.
|
|
32
|
+
const idx = buttons.indexOf(added.length ? last(added).node : last(attributes));
|
|
33
33
|
for (const [i, button] of buttons.entries()) {
|
|
34
34
|
if (button.selected && i !== idx) {
|
|
35
35
|
button.selected = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","sourceRoot":"","sources":["../../../src/components/button-group/button-group.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,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,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;mEAOlD;AA7FkB,uBAAuB;IAD3C,MAAM,CAAC,GAAG,CAAC;GACS,uBAAuB,CAyM3C;eAzMoB,uBAAuB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\n\nimport { themes } from '../../theming/theming-decorator.js';\nimport {\n type MutationControllerParams,\n createMutationController,\n} from '../common/controllers/mutation-observer.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { findElementFromEventPath } from '../common/util.js';\nimport { styles } from './themes/group.base.css.js';\nimport { all } from './themes/group.js';\nimport { styles as shared } from './themes/shared/group/group.common.css.js';\nimport IgcToggleButtonComponent from './toggle-button.js';\n\nexport interface IgcButtonGroupComponentEventMap {\n igcSelect: CustomEvent<string | undefined>;\n igcDeselect: CustomEvent<string | undefined>;\n}\n\n/* blazorAdditionalDependency: IgcToggleButtonComponent */\n/**\n * The `igc-button-group` groups a series of `igc-toggle-button`s together, exposing features such as layout and selection.\n *\n * @element igc-button-group\n *\n * @slot - Renders `igc-toggle-button` component.\n *\n * @fires igcSelect - Emitted when a button is selected through user interaction.\n * @fires igcDeselect - Emitted when a button is deselected through user interaction.\n *\n * @csspart group - The button group container.\n */\n@themes(all)\nexport default class IgcButtonGroupComponent extends EventEmitterMixin<\n IgcButtonGroupComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-button-group';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register() {\n registerComponent(IgcButtonGroupComponent, IgcToggleButtonComponent);\n }\n\n private get isMultiple() {\n return this.selection === 'multiple';\n }\n\n private _selectedItems: Set<string> = new Set();\n\n private _observerCallback({\n changes: { added, attributes },\n }: MutationControllerParams<IgcToggleButtonComponent>) {\n if (this.isMultiple || this._selectedButtons.length <= 1) {\n return;\n }\n\n const buttons = this.toggleButtons;\n const idx = buttons.indexOf(\n added.length ? added.at(-1)! : attributes.at(-1)!\n );\n\n for (const [i, button] of buttons.entries()) {\n if (button.selected && i !== idx) {\n button.selected = false;\n }\n }\n }\n\n private get _selectedButtons(): Array<IgcToggleButtonComponent> {\n return this.toggleButtons.filter((b) => b.selected);\n }\n\n @queryAssignedElements({ selector: IgcToggleButtonComponent.tagName })\n private toggleButtons!: Array<IgcToggleButtonComponent>;\n\n /**\n * Disables all buttons inside the group.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Sets the orientation of the buttons in the group.\n * @attr\n */\n @property({ reflect: true })\n public alignment: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Controls the mode of selection for the button group.\n * @attr\n */\n @property({ reflect: false })\n public selection: 'single' | 'single-required' | 'multiple' = 'single';\n\n /**\n * Gets/Sets the currently selected buttons (their values).\n * @attr\n */\n @property({ attribute: 'selected-items', type: Array, reflect: false })\n public get selectedItems(): string[] {\n return this._selectedButtons.map((b) => b.value).filter((v) => v);\n }\n\n public set selectedItems(values: string[]) {\n this._selectedItems = new Set(Array.isArray(values) ? values : []);\n this.setSelection(this._selectedItems);\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n protected updateDisabledState() {\n this.toggleButtons.forEach((b) => {\n b.disabled = this.disabled;\n });\n }\n\n @watch('selection', { waitUntilFirstUpdate: true })\n protected updateSelectionState() {\n if (this._selectedButtons.length) {\n this.toggleButtons.forEach((b) => {\n b.selected = false;\n });\n }\n }\n\n constructor() {\n super();\n\n createMutationController(this, {\n callback: this._observerCallback,\n filter: [IgcToggleButtonComponent.tagName],\n config: {\n attributeFilter: ['selected'],\n childList: true,\n subtree: true,\n },\n });\n }\n\n protected override firstUpdated() {\n if (this.disabled) {\n this.updateDisabledState();\n }\n\n const buttons = this._selectedButtons;\n\n if (buttons.length) {\n if (!this.isMultiple) {\n const index = buttons.indexOf(buttons.at(-1)!);\n\n for (let i = 0; i < index; i++) {\n buttons[i].selected = false;\n }\n }\n } else {\n this.setSelection(this._selectedItems);\n }\n }\n\n private handleClick(event: MouseEvent) {\n const button = findElementFromEventPath<IgcToggleButtonComponent>(\n IgcToggleButtonComponent.tagName,\n event\n );\n\n if (button) {\n this.isMultiple\n ? this.handleMultipleSelection(button)\n : this.handleSingleSelection(button);\n }\n }\n\n private handleSingleSelection(button: IgcToggleButtonComponent) {\n const singleRequired = this.selection === 'single-required';\n const selectedButton = this._selectedButtons.at(0);\n const isSame = selectedButton && selectedButton.value === button.value;\n\n if (selectedButton) {\n if (singleRequired && isSame) return;\n this.emitDeselectEvent(selectedButton);\n }\n if (isSame) return;\n this.emitSelectEvent(button);\n }\n\n private handleMultipleSelection(button: IgcToggleButtonComponent) {\n button.selected\n ? this.emitDeselectEvent(button)\n : this.emitSelectEvent(button);\n }\n\n private emitSelectEvent(button: IgcToggleButtonComponent) {\n button.selected = true;\n this.emitEvent('igcSelect', { detail: button.value });\n }\n\n private emitDeselectEvent(button: IgcToggleButtonComponent) {\n button.selected = false;\n this.emitEvent('igcDeselect', { detail: button.value });\n }\n\n private setSelection(values: Set<string>) {\n if (!values.size) {\n this.toggleButtons.forEach((b) => {\n b.selected = false;\n });\n return;\n }\n\n for (const button of this.toggleButtons) {\n if (values.has(button.value)) {\n button.selected = true;\n if (!this.isMultiple) {\n break;\n }\n }\n }\n }\n\n protected override render() {\n return html`\n <div\n part=\"group\"\n role=\"group\"\n aria-disabled=${this.disabled}\n @click=${this.handleClick}\n >\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-button-group': IgcButtonGroupComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"button-group.js","sourceRoot":"","sources":["../../../src/components/button-group/button-group.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAA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KAAK,CAAC,WAAW,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;mEAOlD;AA7FkB,uBAAuB;IAD3C,MAAM,CAAC,GAAG,CAAC;GACS,uBAAuB,CAyM3C;eAzMoB,uBAAuB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\n\nimport { themes } from '../../theming/theming-decorator.js';\nimport {\n type MutationControllerParams,\n createMutationController,\n} from '../common/controllers/mutation-observer.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { findElementFromEventPath, last } from '../common/util.js';\nimport { styles } from './themes/group.base.css.js';\nimport { all } from './themes/group.js';\nimport { styles as shared } from './themes/shared/group/group.common.css.js';\nimport IgcToggleButtonComponent from './toggle-button.js';\n\nexport interface IgcButtonGroupComponentEventMap {\n igcSelect: CustomEvent<string | undefined>;\n igcDeselect: CustomEvent<string | undefined>;\n}\n\n/* blazorAdditionalDependency: IgcToggleButtonComponent */\n/**\n * The `igc-button-group` groups a series of `igc-toggle-button`s together, exposing features such as layout and selection.\n *\n * @element igc-button-group\n *\n * @slot - Renders `igc-toggle-button` component.\n *\n * @fires igcSelect - Emitted when a button is selected through user interaction.\n * @fires igcDeselect - Emitted when a button is deselected through user interaction.\n *\n * @csspart group - The button group container.\n */\n@themes(all)\nexport default class IgcButtonGroupComponent extends EventEmitterMixin<\n IgcButtonGroupComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-button-group';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register() {\n registerComponent(IgcButtonGroupComponent, IgcToggleButtonComponent);\n }\n\n private get isMultiple() {\n return this.selection === 'multiple';\n }\n\n private _selectedItems: Set<string> = new Set();\n\n private _observerCallback({\n changes: { added, attributes },\n }: MutationControllerParams<IgcToggleButtonComponent>) {\n if (this.isMultiple || this._selectedButtons.length <= 1) {\n return;\n }\n\n const buttons = this.toggleButtons;\n const idx = buttons.indexOf(\n added.length ? last(added).node : last(attributes)\n );\n\n for (const [i, button] of buttons.entries()) {\n if (button.selected && i !== idx) {\n button.selected = false;\n }\n }\n }\n\n private get _selectedButtons(): Array<IgcToggleButtonComponent> {\n return this.toggleButtons.filter((b) => b.selected);\n }\n\n @queryAssignedElements({ selector: IgcToggleButtonComponent.tagName })\n private toggleButtons!: Array<IgcToggleButtonComponent>;\n\n /**\n * Disables all buttons inside the group.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Sets the orientation of the buttons in the group.\n * @attr\n */\n @property({ reflect: true })\n public alignment: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Controls the mode of selection for the button group.\n * @attr\n */\n @property({ reflect: false })\n public selection: 'single' | 'single-required' | 'multiple' = 'single';\n\n /**\n * Gets/Sets the currently selected buttons (their values).\n * @attr\n */\n @property({ attribute: 'selected-items', type: Array, reflect: false })\n public get selectedItems(): string[] {\n return this._selectedButtons.map((b) => b.value).filter((v) => v);\n }\n\n public set selectedItems(values: string[]) {\n this._selectedItems = new Set(Array.isArray(values) ? values : []);\n this.setSelection(this._selectedItems);\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n protected updateDisabledState() {\n this.toggleButtons.forEach((b) => {\n b.disabled = this.disabled;\n });\n }\n\n @watch('selection', { waitUntilFirstUpdate: true })\n protected updateSelectionState() {\n if (this._selectedButtons.length) {\n this.toggleButtons.forEach((b) => {\n b.selected = false;\n });\n }\n }\n\n constructor() {\n super();\n\n createMutationController(this, {\n callback: this._observerCallback,\n filter: [IgcToggleButtonComponent.tagName],\n config: {\n attributeFilter: ['selected'],\n childList: true,\n subtree: true,\n },\n });\n }\n\n protected override firstUpdated() {\n if (this.disabled) {\n this.updateDisabledState();\n }\n\n const buttons = this._selectedButtons;\n\n if (buttons.length) {\n if (!this.isMultiple) {\n const index = buttons.indexOf(buttons.at(-1)!);\n\n for (let i = 0; i < index; i++) {\n buttons[i].selected = false;\n }\n }\n } else {\n this.setSelection(this._selectedItems);\n }\n }\n\n private handleClick(event: MouseEvent) {\n const button = findElementFromEventPath<IgcToggleButtonComponent>(\n IgcToggleButtonComponent.tagName,\n event\n );\n\n if (button) {\n this.isMultiple\n ? this.handleMultipleSelection(button)\n : this.handleSingleSelection(button);\n }\n }\n\n private handleSingleSelection(button: IgcToggleButtonComponent) {\n const singleRequired = this.selection === 'single-required';\n const selectedButton = this._selectedButtons.at(0);\n const isSame = selectedButton && selectedButton.value === button.value;\n\n if (selectedButton) {\n if (singleRequired && isSame) return;\n this.emitDeselectEvent(selectedButton);\n }\n if (isSame) return;\n this.emitSelectEvent(button);\n }\n\n private handleMultipleSelection(button: IgcToggleButtonComponent) {\n button.selected\n ? this.emitDeselectEvent(button)\n : this.emitSelectEvent(button);\n }\n\n private emitSelectEvent(button: IgcToggleButtonComponent) {\n button.selected = true;\n this.emitEvent('igcSelect', { detail: button.value });\n }\n\n private emitDeselectEvent(button: IgcToggleButtonComponent) {\n button.selected = false;\n this.emitEvent('igcDeselect', { detail: button.value });\n }\n\n private setSelection(values: Set<string>) {\n if (!values.size) {\n this.toggleButtons.forEach((b) => {\n b.selected = false;\n });\n return;\n }\n\n for (const button of this.toggleButtons) {\n if (values.has(button.value)) {\n button.selected = true;\n if (!this.isMultiple) {\n break;\n }\n }\n }\n }\n\n protected override render() {\n return html`\n <div\n part=\"group\"\n role=\"group\"\n aria-disabled=${this.disabled}\n @click=${this.handleClick}\n >\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-button-group': IgcButtonGroupComponent;\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { LitElement } from 'lit';
|
|
|
2
2
|
import type { Constructor } from '../common/mixins/constructor.js';
|
|
3
3
|
import IgcCarouselSlideComponent from './carousel-slide.js';
|
|
4
4
|
export interface IgcCarouselComponentEventMap {
|
|
5
|
-
igcSlideChanged: CustomEvent<
|
|
5
|
+
igcSlideChanged: CustomEvent<number>;
|
|
6
6
|
igcPlaying: CustomEvent<void>;
|
|
7
7
|
igcPaused: CustomEvent<void>;
|
|
8
8
|
}
|
|
@@ -104,7 +104,7 @@ export default class IgcCarouselComponent extends IgcCarouselComponent_base {
|
|
|
104
104
|
* The duration in milliseconds between changing the active slide.
|
|
105
105
|
* @attr interval
|
|
106
106
|
*/
|
|
107
|
-
interval: number;
|
|
107
|
+
interval: number | undefined;
|
|
108
108
|
/**
|
|
109
109
|
* Controls the maximum indicator controls (dots) that can be shown. Default value is `10`.
|
|
110
110
|
* @attr maximum-indicators-count
|
|
@@ -170,17 +170,21 @@ export default class IgcCarouselComponent extends IgcCarouselComponent_base {
|
|
|
170
170
|
*/
|
|
171
171
|
pause(): void;
|
|
172
172
|
/**
|
|
173
|
-
* Switches to the next slide
|
|
173
|
+
* Switches to the next slide, runs any animations, and returns if the operation was successful.
|
|
174
174
|
*/
|
|
175
175
|
next(): Promise<boolean>;
|
|
176
176
|
/**
|
|
177
|
-
* Switches to the previous slide
|
|
177
|
+
* Switches to the previous slide, runs any animations, and returns if the operation was successful.
|
|
178
178
|
*/
|
|
179
179
|
prev(): Promise<boolean>;
|
|
180
180
|
/**
|
|
181
|
-
* Switches the passed
|
|
181
|
+
* Switches to the passed-in slide, runs any animations, and returns if the operation was successful.
|
|
182
182
|
*/
|
|
183
|
-
select(slide: IgcCarouselSlideComponent,
|
|
183
|
+
select(slide: IgcCarouselSlideComponent, animationDirection?: 'next' | 'prev'): Promise<boolean>;
|
|
184
|
+
/**
|
|
185
|
+
* Switches to slide by index, runs any animations, and returns if the operation was successful.
|
|
186
|
+
*/
|
|
187
|
+
select(index: number, animationDirection?: 'next' | 'prev'): Promise<boolean>;
|
|
184
188
|
private navigationTemplate;
|
|
185
189
|
protected renderIndicators(): Generator<import("lit-html").TemplateResult<1>, void, unknown>;
|
|
186
190
|
private indicatorTemplate;
|
|
@@ -49,7 +49,7 @@ let IgcCarouselComponent = IgcCarouselComponent_1 = class IgcCarouselComponent e
|
|
|
49
49
|
if (activeSlides.length <= 1) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
const idx = this.slides.indexOf(
|
|
52
|
+
const idx = this.slides.indexOf(added.length ? last(added).node : last(attributes));
|
|
53
53
|
for (const [i, slide] of this.slides.entries()) {
|
|
54
54
|
if (slide.active && i !== idx) {
|
|
55
55
|
slide.active = false;
|
|
@@ -252,7 +252,7 @@ let IgcCarouselComponent = IgcCarouselComponent_1 = class IgcCarouselComponent e
|
|
|
252
252
|
this.resetInterval();
|
|
253
253
|
}
|
|
254
254
|
await callback.call(this);
|
|
255
|
-
this.emitEvent('igcSlideChanged');
|
|
255
|
+
this.emitEvent('igcSlideChanged', { detail: this.current });
|
|
256
256
|
if (this.interval) {
|
|
257
257
|
this.restartInterval();
|
|
258
258
|
}
|
|
@@ -290,7 +290,7 @@ let IgcCarouselComponent = IgcCarouselComponent_1 = class IgcCarouselComponent e
|
|
|
290
290
|
this._lastInterval = setInterval(() => {
|
|
291
291
|
if (this.isPlaying && this.total) {
|
|
292
292
|
this.next();
|
|
293
|
-
this.emitEvent('igcSlideChanged');
|
|
293
|
+
this.emitEvent('igcSlideChanged', { detail: this.current });
|
|
294
294
|
}
|
|
295
295
|
else {
|
|
296
296
|
this.pause();
|
|
@@ -342,12 +342,21 @@ let IgcCarouselComponent = IgcCarouselComponent_1 = class IgcCarouselComponent e
|
|
|
342
342
|
}
|
|
343
343
|
return await this.select(this.slides[this.prevIndex], 'prev');
|
|
344
344
|
}
|
|
345
|
-
async select(
|
|
346
|
-
|
|
347
|
-
|
|
345
|
+
async select(slideOrIndex, animationDirection) {
|
|
346
|
+
let index;
|
|
347
|
+
let slide;
|
|
348
|
+
if (typeof slideOrIndex === 'number') {
|
|
349
|
+
index = slideOrIndex;
|
|
350
|
+
slide = this.slides.at(index);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
slide = slideOrIndex;
|
|
354
|
+
index = this.slides.indexOf(slide);
|
|
355
|
+
}
|
|
356
|
+
if (index === this.current || index === -1 || !slide) {
|
|
348
357
|
return false;
|
|
349
358
|
}
|
|
350
|
-
const dir =
|
|
359
|
+
const dir = animationDirection ?? (index > this.current ? 'next' : 'prev');
|
|
351
360
|
await this.animateSlides(slide, this._activeSlide, dir);
|
|
352
361
|
return true;
|
|
353
362
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/components/carousel/carousel.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAY,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,kBAAkB,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEL,qBAAqB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,SAAS,EACT,UAAU,EACV,MAAM,EACN,OAAO,GACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEL,wBAAwB,GACzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EACL,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EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;mEACZ;AAS/C;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC;mEACR;AAWpC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;+DACP;AAOjC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;sDAClB;AAWlB;IALN,QAAQ,CAAC;QACR,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,0BAA0B;KACtC,CAAC;oEACiC;AAO5B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;2DACgB;AAMnD;IADN,qBAAqB,CAAC,EAAE,QAAQ,EAAE,yBAAyB,CAAC,OAAO,EAAE,CAAC;oDACtB;AAiCvC;IAHT,KAAK,CAAC,eAAe,CAAC;IACtB,KAAK,CAAC,mBAAmB,CAAC;IAC1B,KAAK,CAAC,uBAAuB,CAAC;0DAG9B;AAGS;IADT,KAAK,CAAC,UAAU,CAAC;0DAOjB;AAvOkB,oBAAoB;IADxC,MAAM,CAAC,GAAG,CAAC;GACS,oBAAoB,CAsrBxC;eAtrBoB,oBAAoB","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport { LitElement, html, nothing } from 'lit';\nimport {\n property,\n queryAll,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\n\nimport { type Ref, createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport IgcButtonComponent from '../button/button.js';\nimport { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';\nimport {\n type SwipeEvent,\n addGesturesController,\n} from '../common/controllers/gestures.js';\nimport {\n addKeybindings,\n arrowLeft,\n arrowRight,\n endKey,\n homeKey,\n} from '../common/controllers/key-bindings.js';\nimport {\n type MutationControllerParams,\n createMutationController,\n} from '../common/controllers/mutation-observer.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport {\n asNumber,\n createCounter,\n findElementFromEventPath,\n first,\n formatString,\n isLTR,\n last,\n partNameMap,\n wrap,\n} from '../common/util.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport IgcCarouselIndicatorContainerComponent from './carousel-indicator-container.js';\nimport IgcCarouselIndicatorComponent from './carousel-indicator.js';\nimport IgcCarouselSlideComponent from './carousel-slide.js';\nimport { carouselContext } from './context.js';\nimport { styles } from './themes/carousel.base.css.js';\nimport { all } from './themes/container.js';\nimport { styles as shared } from './themes/shared/carousel.common.css.js';\n\nexport interface IgcCarouselComponentEventMap {\n igcSlideChanged: CustomEvent<void>;\n igcPlaying: CustomEvent<void>;\n igcPaused: CustomEvent<void>;\n}\n\n/**\n * The `igc-carousel` presents a set of `igc-carousel-slide`s by sequentially displaying a subset of one or more slides.\n *\n * @element igc-carousel\n *\n * @slot Default slot for the carousel. Any projected `igc-carousel-slide` components should be projected here.\n * @slot previous-button - Renders content inside the previous button.\n * @slot next-button - Renders content inside the next button.\n *\n * @fires igcSlideChanged - Emitted when the current active slide is changed either by user interaction or by the interval callback.\n * @fires igcPlaying - Emitted when the carousel enters playing state by a user interaction.\n * @fires igcPaused - Emitted when the carousel enters paused state by a user interaction.\n *\n * @csspart navigation - The wrapper container of each carousel navigation button.\n * @csspart previous - The wrapper container of the carousel previous navigation button.\n * @csspart next - The wrapper container of the carousel next navigation button.\n * @csspart dot - The carousel dot indicator container.\n * @csspart active - The carousel active dot indicator container.\n * @csspart label - The label container of the carousel indicators.\n * @csspart start - The wrapping container of all carousel indicators when indicators-orientation is set to start.\n */\n\n@themes(all)\nexport default class IgcCarouselComponent extends EventEmitterMixin<\n IgcCarouselComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static styles = [styles, shared];\n public static readonly tagName = 'igc-carousel';\n\n /* blazorSuppress */\n public static register() {\n registerComponent(\n IgcCarouselComponent,\n IgcCarouselIndicatorComponent,\n IgcCarouselIndicatorContainerComponent,\n IgcCarouselSlideComponent,\n IgcIconComponent,\n IgcButtonComponent\n );\n }\n\n private static readonly increment = createCounter();\n private _carouselId = `igc-carousel-${IgcCarouselComponent.increment()}`;\n private _carouselKeyboardInteractionFocus = addKeyboardFocusRing(this);\n\n private _internals: ElementInternals;\n private _lastInterval!: ReturnType<typeof setInterval> | null;\n private _hasKeyboardInteractionOnIndicators = false;\n private _hasMouseStop = false;\n\n private _context = new ContextProvider(this, {\n context: carouselContext,\n initialValue: this,\n });\n\n private _carouselSlidesContainerRef: Ref<HTMLDivElement> = createRef();\n private _indicatorsContainerRef: Ref<HTMLDivElement> = createRef();\n private _prevButtonRef: Ref<IgcButtonComponent> = createRef();\n private _nextButtonRef: Ref<IgcButtonComponent> = createRef();\n\n private get hasProjectedIndicators(): boolean {\n return this._projectedIndicators.length > 0;\n }\n\n private get showIndicatorsLabel(): boolean {\n return this.total > this.maximumIndicatorsCount;\n }\n\n private get nextIndex(): number {\n return wrap(0, this.total - 1, this.current + 1);\n }\n\n private get prevIndex(): number {\n return wrap(0, this.total - 1, this.current - 1);\n }\n\n @queryAll(IgcCarouselIndicatorComponent.tagName)\n private _defaultIndicators!: NodeListOf<IgcCarouselIndicatorComponent>;\n\n @queryAssignedElements({\n selector: IgcCarouselIndicatorComponent.tagName,\n slot: 'indicator',\n })\n private _projectedIndicators!: Array<IgcCarouselIndicatorComponent>;\n\n @state()\n private _activeSlide!: IgcCarouselSlideComponent;\n\n @state()\n private _playing = false;\n\n @state()\n private _paused = false;\n\n private _observerCallback({\n changes: { added, attributes },\n }: MutationControllerParams<IgcCarouselSlideComponent>) {\n const activeSlides = this.slides.filter((slide) => slide.active);\n\n if (activeSlides.length <= 1) {\n return;\n }\n\n const idx = this.slides.indexOf(last(added.length ? added : attributes));\n\n for (const [i, slide] of this.slides.entries()) {\n if (slide.active && i !== idx) {\n slide.active = false;\n }\n }\n\n this.activateSlide(this.slides[idx]);\n }\n\n /**\n * Whether the carousel should skip rotating to the first slide after it reaches the last.\n * @attr disable-loop\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-loop' })\n public disableLoop = false;\n\n /**\n * Whether the carousel should ignore use interactions and not pause on them.\n * @attr disable-pause-on-interaction\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'disable-pause-on-interaction',\n })\n public disablePauseOnInteraction = false;\n\n /**\n * Whether the carousel should skip rendering of the default navigation buttons.\n * @attr hide-navigation\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-navigation' })\n public hideNavigation = false;\n\n /**\n * Whether the carousel should render the indicator controls (dots).\n * @attr hide-indicators\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-indicators' })\n public hideIndicators = false;\n\n /**\n * Whether the carousel has vertical alignment.\n * @attr vertical\n */\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n /**\n * Sets the orientation of the indicator controls (dots).\n * @attr indicators-orientation\n */\n @property({ reflect: false, attribute: 'indicators-orientation' })\n public indicatorsOrientation: 'start' | 'end' = 'end';\n\n /**\n * The format used to set the aria-label on the carousel indicators.\n * Instances of '{0}' will be replaced with the index of the corresponding slide.\n *\n * @attr indicators-label-format\n */\n @property({ attribute: 'indicators-label-format' })\n public indicatorsLabelFormat = 'Slide {0}';\n\n /**\n * The format used to set the aria-label on the carousel slides and the text displayed\n * when the number of indicators is greater than tha maximum indicator count.\n * Instances of '{0}' will be replaced with the index of the corresponding slide.\n * Instances of '{1}' will be replaced with the total amount of slides.\n *\n * @attr slides-label-format\n */\n @property({ attribute: 'slides-label-format' })\n public slidesLabelFormat = '{0} of {1}';\n\n /**\n * The duration in milliseconds between changing the active slide.\n * @attr interval\n */\n @property({ type: Number, reflect: false })\n public interval!: number;\n\n /**\n * Controls the maximum indicator controls (dots) that can be shown. Default value is `10`.\n * @attr maximum-indicators-count\n */\n @property({\n type: Number,\n reflect: false,\n attribute: 'maximum-indicators-count',\n })\n public maximumIndicatorsCount = 10;\n\n /**\n * The animation type.\n * @attr animation-type\n */\n @property({ attribute: 'animation-type' })\n public animationType: 'slide' | 'fade' | 'none' = 'slide';\n\n /**\n * The slides of the carousel.\n */\n @queryAssignedElements({ selector: IgcCarouselSlideComponent.tagName })\n public slides!: Array<IgcCarouselSlideComponent>;\n\n /**\n * The total number of slides.\n */\n public get total(): number {\n return this.slides.length;\n }\n\n /**\n * The index of the current active slide.\n */\n public get current(): number {\n return Math.max(0, this.slides.indexOf(this._activeSlide));\n }\n\n /**\n * Whether the carousel is in playing state.\n */\n public get isPlaying(): boolean {\n return this._playing;\n }\n\n /**\n * Whether the carousel in in paused state.\n */\n public get isPaused(): boolean {\n return this._paused;\n }\n\n @watch('animationType')\n @watch('slidesLabelFormat')\n @watch('indicatorsLabelFormat')\n protected contextChanged() {\n this._context.setValue(this, true);\n }\n\n @watch('interval')\n protected intervalChange() {\n if (!this.isPlaying) {\n this._playing = true;\n }\n\n this.restartInterval();\n }\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n\n this._internals.role = 'region';\n this._internals.ariaRoleDescription = 'carousel';\n\n this.addEventListener('pointerdown', this.handlePointerDown);\n this.addEventListener('pointerenter', this.handlePointerEnter);\n this.addEventListener('pointerleave', this.handlePointerLeave);\n\n addGesturesController(this, {\n ref: this._carouselSlidesContainerRef,\n touchOnly: true,\n })\n .set('swipe-left', this.handleHorizontalSwipe)\n .set('swipe-right', this.handleHorizontalSwipe)\n .set('swipe-up', this.handleVerticalSwipe)\n .set('swipe-down', this.handleVerticalSwipe);\n\n addKeybindings(this, {\n ref: this._indicatorsContainerRef,\n bindingDefaults: { preventDefault: true },\n })\n .set(arrowLeft, this.handleArrowLeft)\n .set(arrowRight, this.handleArrowRight)\n .set(homeKey, this.handleHomeKey)\n .set(endKey, this.handleEndKey);\n\n addKeybindings(this, {\n ref: this._prevButtonRef,\n bindingDefaults: { preventDefault: true },\n }).setActivateHandler(this.handleNavigationInteractionPrevious);\n\n addKeybindings(this, {\n ref: this._nextButtonRef,\n bindingDefaults: { preventDefault: true },\n }).setActivateHandler(this.handleNavigationInteractionNext);\n\n createMutationController(this, {\n callback: this._observerCallback,\n filter: [IgcCarouselSlideComponent.tagName],\n config: {\n attributeFilter: ['active'],\n childList: true,\n subtree: true,\n },\n });\n }\n\n private handleSlotChange(): void {\n if (this.total) {\n this.activateSlide(\n this.slides.findLast((slide) => slide.active) ?? first(this.slides)\n );\n }\n }\n\n private handleIndicatorSlotChange(): void {\n this.requestUpdate();\n }\n\n private handlePointerDown(): void {\n if (this._carouselKeyboardInteractionFocus.focused) {\n this._carouselKeyboardInteractionFocus.reset();\n }\n }\n\n private handlePointerEnter(): void {\n this._hasMouseStop = true;\n if (this._carouselKeyboardInteractionFocus.focused) {\n return;\n }\n this.handlePauseOnInteraction();\n }\n\n private handlePointerLeave(): void {\n this._hasMouseStop = false;\n if (this._carouselKeyboardInteractionFocus.focused) {\n return;\n }\n this.handlePauseOnInteraction();\n }\n\n private handleFocusIn(): void {\n if (this._carouselKeyboardInteractionFocus.focused || this._hasMouseStop) {\n return;\n }\n this.handlePauseOnInteraction();\n }\n\n private handleFocusOut(event: FocusEvent): void {\n const node = event.relatedTarget as Node;\n\n if (this.contains(node) || this.renderRoot.contains(node)) {\n return;\n }\n\n if (this._carouselKeyboardInteractionFocus.focused) {\n this._carouselKeyboardInteractionFocus.reset();\n\n if (!this._hasMouseStop) {\n this.handlePauseOnInteraction();\n }\n }\n }\n\n private handlePauseOnInteraction(): void {\n if (!this.interval || this.disablePauseOnInteraction) return;\n\n if (this.isPlaying) {\n this.pause();\n this.emitEvent('igcPaused');\n } else {\n this.play();\n this.emitEvent('igcPlaying');\n }\n }\n\n private async handleArrowLeft(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(isLTR(this) ? this.prev : this.next);\n }\n\n private async handleArrowRight(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(isLTR(this) ? this.next : this.prev);\n }\n\n private async handleHomeKey(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(() =>\n this.select(isLTR(this) ? first(this.slides) : last(this.slides))\n );\n }\n\n private async handleEndKey(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(() =>\n this.select(isLTR(this) ? last(this.slides) : first(this.slides))\n );\n }\n\n private handleVerticalSwipe({ data: { direction } }: SwipeEvent) {\n if (this.vertical) {\n this.handleInteraction(direction === 'up' ? this.next : this.prev);\n }\n }\n\n private handleHorizontalSwipe({ data: { direction } }: SwipeEvent) {\n if (!this.vertical) {\n this.handleInteraction(async () => {\n if (isLTR(this)) {\n direction === 'left' ? await this.next() : await this.prev();\n } else {\n direction === 'left' ? await this.prev() : await this.next();\n }\n });\n }\n }\n\n private async handleIndicatorClick(event: PointerEvent): Promise<void> {\n const indicator = findElementFromEventPath<IgcCarouselIndicatorComponent>(\n IgcCarouselIndicatorComponent.tagName,\n event\n )!;\n\n const index = this.hasProjectedIndicators\n ? this._projectedIndicators.indexOf(indicator)\n : Array.from(this._defaultIndicators).indexOf(indicator);\n\n this.handleInteraction(() =>\n this.select(this.slides[index], index > this.current ? 'next' : 'prev')\n );\n }\n\n private handleNavigationInteractionNext() {\n this.handleInteraction(this.next);\n }\n\n private handleNavigationInteractionPrevious() {\n this.handleInteraction(this.prev);\n }\n\n private async handleInteraction(\n callback: () => Promise<unknown>\n ): Promise<void> {\n if (this.interval) {\n this.resetInterval();\n }\n\n await callback.call(this);\n this.emitEvent('igcSlideChanged');\n\n if (this.interval) {\n this.restartInterval();\n }\n }\n\n private activateSlide(slide: IgcCarouselSlideComponent): void {\n if (this._activeSlide) {\n this._activeSlide.active = false;\n }\n\n this._activeSlide = slide;\n this._activeSlide.active = true;\n\n if (this._hasKeyboardInteractionOnIndicators) {\n this.hasProjectedIndicators\n ? this._projectedIndicators[this.current].focus()\n : this._defaultIndicators[this.current].focus();\n\n this._hasKeyboardInteractionOnIndicators = false;\n }\n }\n\n private updateProjectedIndicators(): void {\n for (const [idx, slide] of this.slides.entries()) {\n const indicator = this._projectedIndicators[idx];\n indicator.active = slide.active;\n indicator.index = idx;\n\n this.setAttribute('aria-controls', slide.id);\n }\n }\n\n private resetInterval(): void {\n if (this._lastInterval) {\n clearInterval(this._lastInterval);\n this._lastInterval = null;\n }\n }\n\n private restartInterval(): void {\n this.resetInterval();\n\n if (asNumber(this.interval) > 0) {\n this._lastInterval = setInterval(() => {\n if (this.isPlaying && this.total) {\n this.next();\n this.emitEvent('igcSlideChanged');\n } else {\n this.pause();\n }\n }, this.interval);\n }\n }\n\n private async animateSlides(\n nextSlide: IgcCarouselSlideComponent,\n currentSlide: IgcCarouselSlideComponent,\n dir: 'next' | 'prev'\n ): Promise<void> {\n if (dir === 'next') {\n // Animate slides in next direction\n currentSlide.previous = true;\n currentSlide.toggleAnimation('out');\n this.activateSlide(nextSlide);\n await nextSlide.toggleAnimation('in');\n currentSlide.previous = false;\n } else {\n // Animate slides in previous direction\n currentSlide.previous = true;\n currentSlide.toggleAnimation('in', 'reverse');\n this.activateSlide(nextSlide);\n await nextSlide.toggleAnimation('out', 'reverse');\n currentSlide.previous = false;\n }\n }\n\n /**\n * Resumes playing of the carousel slides.\n */\n public play(): void {\n if (!this.isPlaying) {\n this._paused = false;\n this._playing = true;\n this.restartInterval();\n }\n }\n\n /**\n * Pauses the carousel rotation of slides.\n */\n public pause(): void {\n if (this.isPlaying) {\n this._playing = false;\n this._paused = true;\n this.resetInterval();\n }\n }\n\n /**\n * Switches to the next slide running any animations and returns if the operation was a success.\n */\n public async next(): Promise<boolean> {\n if (this.disableLoop && this.nextIndex === 0) {\n this.pause();\n return false;\n }\n\n return await this.select(this.slides[this.nextIndex], 'next');\n }\n\n /**\n * Switches to the previous slide running any animations and returns if the operation was a success.\n */\n public async prev(): Promise<boolean> {\n if (this.disableLoop && this.prevIndex === this.total - 1) {\n this.pause();\n return false;\n }\n\n return await this.select(this.slides[this.prevIndex], 'prev');\n }\n\n /**\n * Switches the passed in slide running any animations and returns if the operation was a success.\n */\n public async select(\n slide: IgcCarouselSlideComponent,\n direction?: 'next' | 'prev'\n ): Promise<boolean> {\n const index = this.slides.indexOf(slide);\n\n if (index === this.current || index === -1) {\n return false;\n }\n\n const dir = direction ?? (index > this.current ? 'next' : 'prev');\n\n await this.animateSlides(slide, this._activeSlide, dir);\n return true;\n }\n\n private navigationTemplate() {\n return html`\n <igc-button\n ${ref(this._prevButtonRef)}\n type=\"button\"\n part=\"navigation previous\"\n aria-label=\"Previous slide\"\n aria-controls=${this._carouselId}\n ?disabled=${this.disableLoop && this.current === 0}\n @click=${this.handleNavigationInteractionPrevious}\n >\n <slot name=\"previous-button\">\n <igc-icon\n name=\"carousel_prev\"\n collection=\"default\"\n aria-hidden=\"true\"\n ></igc-icon>\n </slot>\n </igc-button>\n <igc-button\n ${ref(this._nextButtonRef)}\n type=\"button\"\n part=\"navigation next\"\n aria-label=\"Next slide\"\n aria-controls=${this._carouselId}\n ?disabled=${this.disableLoop && this.current === this.total - 1}\n @click=${this.handleNavigationInteractionNext}\n >\n <slot name=\"next-button\">\n <igc-icon\n name=\"carousel_next\"\n collection=\"default\"\n aria-hidden=\"true\"\n ></igc-icon>\n </slot>\n </igc-button>\n `;\n }\n\n protected *renderIndicators() {\n for (const [i, slide] of this.slides.entries()) {\n const forward = slide.active ? 'visible' : 'hidden';\n const backward = slide.active ? 'hidden' : 'visible';\n\n yield html`\n <igc-carousel-indicator\n exportparts=\"indicator, active, inactive\"\n .active=${slide.active}\n .index=${i}\n >\n <div\n part=\"dot\"\n style=${styleMap({ visibility: backward, zIndex: 1 })}\n ></div>\n <div\n part=\"dot active\"\n slot=\"active\"\n style=${styleMap({ visibility: forward })}\n ></div>\n </igc-carousel-indicator>\n `;\n }\n }\n\n private indicatorTemplate() {\n const parts = partNameMap({\n indicators: true,\n start: this.indicatorsOrientation === 'start',\n });\n\n return html`\n <igc-carousel-indicator-container>\n <div ${ref(this._indicatorsContainerRef)} role=\"tablist\" part=${parts}>\n <slot\n name=\"indicator\"\n @slotchange=${this.handleIndicatorSlotChange}\n @click=${this.handleIndicatorClick}\n >\n ${this.hasProjectedIndicators\n ? this.updateProjectedIndicators()\n : this.renderIndicators()}\n </slot>\n </div>\n </igc-carousel-indicator-container>\n `;\n }\n\n private labelTemplate() {\n const parts = partNameMap({\n label: true,\n indicators: true,\n start: this.indicatorsOrientation === 'start',\n });\n const value = formatString(\n this.slidesLabelFormat,\n this.current + 1,\n this.total\n );\n\n return html`\n <div part=${parts}>\n <span>${value}</span>\n </div>\n `;\n }\n\n protected override render() {\n return html`\n <section @focusin=${this.handleFocusIn} @focusout=${this.handleFocusOut}>\n ${this.hideNavigation ? nothing : this.navigationTemplate()}\n ${this.hideIndicators || this.showIndicatorsLabel\n ? nothing\n : this.indicatorTemplate()}\n ${!this.hideIndicators && this.showIndicatorsLabel\n ? this.labelTemplate()\n : nothing}\n <div\n ${ref(this._carouselSlidesContainerRef)}\n id=${this._carouselId}\n aria-live=${this.interval && this.isPlaying ? 'off' : 'polite'}\n >\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n </section>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-carousel': IgcCarouselComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/components/carousel/carousel.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAY,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,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AE,CAAC;sDACP;AAW7B;IALN,QAAQ,CAAC;QACR,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,0BAA0B;KACtC,CAAC;oEACiC;AAO5B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;2DACgB;AAOnD;IADN,qBAAqB,CAAC,EAAE,QAAQ,EAAE,yBAAyB,CAAC,OAAO,EAAE,CAAC;oDACtB;AAiCvC;IAHT,KAAK,CAAC,eAAe,CAAC;IACtB,KAAK,CAAC,mBAAmB,CAAC;IAC1B,KAAK,CAAC,uBAAuB,CAAC;0DAG9B;AAGS;IADT,KAAK,CAAC,UAAU,CAAC;0DAOjB;AAzOkB,oBAAoB;IADxC,MAAM,CAAC,GAAG,CAAC;GACS,oBAAoB,CA6sBxC;eA7sBoB,oBAAoB","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport { LitElement, html, nothing } from 'lit';\nimport {\n property,\n queryAll,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\n\nimport { type Ref, createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { themes } from '../../theming/theming-decorator.js';\nimport IgcButtonComponent from '../button/button.js';\nimport { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';\nimport {\n type SwipeEvent,\n addGesturesController,\n} from '../common/controllers/gestures.js';\nimport {\n addKeybindings,\n arrowLeft,\n arrowRight,\n endKey,\n homeKey,\n} from '../common/controllers/key-bindings.js';\nimport {\n type MutationControllerParams,\n createMutationController,\n} from '../common/controllers/mutation-observer.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport {\n asNumber,\n createCounter,\n findElementFromEventPath,\n first,\n formatString,\n isLTR,\n last,\n partNameMap,\n wrap,\n} from '../common/util.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport IgcCarouselIndicatorContainerComponent from './carousel-indicator-container.js';\nimport IgcCarouselIndicatorComponent from './carousel-indicator.js';\nimport IgcCarouselSlideComponent from './carousel-slide.js';\nimport { carouselContext } from './context.js';\nimport { styles } from './themes/carousel.base.css.js';\nimport { all } from './themes/container.js';\nimport { styles as shared } from './themes/shared/carousel.common.css.js';\n\nexport interface IgcCarouselComponentEventMap {\n igcSlideChanged: CustomEvent<number>;\n igcPlaying: CustomEvent<void>;\n igcPaused: CustomEvent<void>;\n}\n\n/**\n * The `igc-carousel` presents a set of `igc-carousel-slide`s by sequentially displaying a subset of one or more slides.\n *\n * @element igc-carousel\n *\n * @slot Default slot for the carousel. Any projected `igc-carousel-slide` components should be projected here.\n * @slot previous-button - Renders content inside the previous button.\n * @slot next-button - Renders content inside the next button.\n *\n * @fires igcSlideChanged - Emitted when the current active slide is changed either by user interaction or by the interval callback.\n * @fires igcPlaying - Emitted when the carousel enters playing state by a user interaction.\n * @fires igcPaused - Emitted when the carousel enters paused state by a user interaction.\n *\n * @csspart navigation - The wrapper container of each carousel navigation button.\n * @csspart previous - The wrapper container of the carousel previous navigation button.\n * @csspart next - The wrapper container of the carousel next navigation button.\n * @csspart dot - The carousel dot indicator container.\n * @csspart active - The carousel active dot indicator container.\n * @csspart label - The label container of the carousel indicators.\n * @csspart start - The wrapping container of all carousel indicators when indicators-orientation is set to start.\n */\n\n@themes(all)\nexport default class IgcCarouselComponent extends EventEmitterMixin<\n IgcCarouselComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static styles = [styles, shared];\n public static readonly tagName = 'igc-carousel';\n\n /* blazorSuppress */\n public static register() {\n registerComponent(\n IgcCarouselComponent,\n IgcCarouselIndicatorComponent,\n IgcCarouselIndicatorContainerComponent,\n IgcCarouselSlideComponent,\n IgcIconComponent,\n IgcButtonComponent\n );\n }\n\n private static readonly increment = createCounter();\n private _carouselId = `igc-carousel-${IgcCarouselComponent.increment()}`;\n private _carouselKeyboardInteractionFocus = addKeyboardFocusRing(this);\n\n private _internals: ElementInternals;\n private _lastInterval!: ReturnType<typeof setInterval> | null;\n private _hasKeyboardInteractionOnIndicators = false;\n private _hasMouseStop = false;\n\n private _context = new ContextProvider(this, {\n context: carouselContext,\n initialValue: this,\n });\n\n private _carouselSlidesContainerRef: Ref<HTMLDivElement> = createRef();\n private _indicatorsContainerRef: Ref<HTMLDivElement> = createRef();\n private _prevButtonRef: Ref<IgcButtonComponent> = createRef();\n private _nextButtonRef: Ref<IgcButtonComponent> = createRef();\n\n private get hasProjectedIndicators(): boolean {\n return this._projectedIndicators.length > 0;\n }\n\n private get showIndicatorsLabel(): boolean {\n return this.total > this.maximumIndicatorsCount;\n }\n\n private get nextIndex(): number {\n return wrap(0, this.total - 1, this.current + 1);\n }\n\n private get prevIndex(): number {\n return wrap(0, this.total - 1, this.current - 1);\n }\n\n @queryAll(IgcCarouselIndicatorComponent.tagName)\n private _defaultIndicators!: NodeListOf<IgcCarouselIndicatorComponent>;\n\n @queryAssignedElements({\n selector: IgcCarouselIndicatorComponent.tagName,\n slot: 'indicator',\n })\n private _projectedIndicators!: Array<IgcCarouselIndicatorComponent>;\n\n @state()\n private _activeSlide!: IgcCarouselSlideComponent;\n\n @state()\n private _playing = false;\n\n @state()\n private _paused = false;\n\n private _observerCallback({\n changes: { added, attributes },\n }: MutationControllerParams<IgcCarouselSlideComponent>) {\n const activeSlides = this.slides.filter((slide) => slide.active);\n\n if (activeSlides.length <= 1) {\n return;\n }\n const idx = this.slides.indexOf(\n added.length ? last(added).node : last(attributes)\n );\n\n for (const [i, slide] of this.slides.entries()) {\n if (slide.active && i !== idx) {\n slide.active = false;\n }\n }\n\n this.activateSlide(this.slides[idx]);\n }\n\n /**\n * Whether the carousel should skip rotating to the first slide after it reaches the last.\n * @attr disable-loop\n */\n @property({ type: Boolean, reflect: true, attribute: 'disable-loop' })\n public disableLoop = false;\n\n /**\n * Whether the carousel should ignore use interactions and not pause on them.\n * @attr disable-pause-on-interaction\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'disable-pause-on-interaction',\n })\n public disablePauseOnInteraction = false;\n\n /**\n * Whether the carousel should skip rendering of the default navigation buttons.\n * @attr hide-navigation\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-navigation' })\n public hideNavigation = false;\n\n /**\n * Whether the carousel should render the indicator controls (dots).\n * @attr hide-indicators\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-indicators' })\n public hideIndicators = false;\n\n /**\n * Whether the carousel has vertical alignment.\n * @attr vertical\n */\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n /**\n * Sets the orientation of the indicator controls (dots).\n * @attr indicators-orientation\n */\n @property({ reflect: false, attribute: 'indicators-orientation' })\n public indicatorsOrientation: 'start' | 'end' = 'end';\n\n /**\n * The format used to set the aria-label on the carousel indicators.\n * Instances of '{0}' will be replaced with the index of the corresponding slide.\n *\n * @attr indicators-label-format\n */\n @property({ attribute: 'indicators-label-format' })\n public indicatorsLabelFormat = 'Slide {0}';\n\n /**\n * The format used to set the aria-label on the carousel slides and the text displayed\n * when the number of indicators is greater than tha maximum indicator count.\n * Instances of '{0}' will be replaced with the index of the corresponding slide.\n * Instances of '{1}' will be replaced with the total amount of slides.\n *\n * @attr slides-label-format\n */\n @property({ attribute: 'slides-label-format' })\n public slidesLabelFormat = '{0} of {1}';\n\n /**\n * The duration in milliseconds between changing the active slide.\n * @attr interval\n */\n @property({ type: Number, reflect: false })\n public interval: number | undefined;\n\n /**\n * Controls the maximum indicator controls (dots) that can be shown. Default value is `10`.\n * @attr maximum-indicators-count\n */\n @property({\n type: Number,\n reflect: false,\n attribute: 'maximum-indicators-count',\n })\n public maximumIndicatorsCount = 10;\n\n /**\n * The animation type.\n * @attr animation-type\n */\n @property({ attribute: 'animation-type' })\n public animationType: 'slide' | 'fade' | 'none' = 'slide';\n\n /* blazorSuppress */\n /**\n * The slides of the carousel.\n */\n @queryAssignedElements({ selector: IgcCarouselSlideComponent.tagName })\n public slides!: Array<IgcCarouselSlideComponent>;\n\n /**\n * The total number of slides.\n */\n public get total(): number {\n return this.slides.length;\n }\n\n /**\n * The index of the current active slide.\n */\n public get current(): number {\n return Math.max(0, this.slides.indexOf(this._activeSlide));\n }\n\n /**\n * Whether the carousel is in playing state.\n */\n public get isPlaying(): boolean {\n return this._playing;\n }\n\n /**\n * Whether the carousel in in paused state.\n */\n public get isPaused(): boolean {\n return this._paused;\n }\n\n @watch('animationType')\n @watch('slidesLabelFormat')\n @watch('indicatorsLabelFormat')\n protected contextChanged() {\n this._context.setValue(this, true);\n }\n\n @watch('interval')\n protected intervalChange() {\n if (!this.isPlaying) {\n this._playing = true;\n }\n\n this.restartInterval();\n }\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n\n this._internals.role = 'region';\n this._internals.ariaRoleDescription = 'carousel';\n\n this.addEventListener('pointerdown', this.handlePointerDown);\n this.addEventListener('pointerenter', this.handlePointerEnter);\n this.addEventListener('pointerleave', this.handlePointerLeave);\n\n addGesturesController(this, {\n ref: this._carouselSlidesContainerRef,\n touchOnly: true,\n })\n .set('swipe-left', this.handleHorizontalSwipe)\n .set('swipe-right', this.handleHorizontalSwipe)\n .set('swipe-up', this.handleVerticalSwipe)\n .set('swipe-down', this.handleVerticalSwipe);\n\n addKeybindings(this, {\n ref: this._indicatorsContainerRef,\n bindingDefaults: { preventDefault: true },\n })\n .set(arrowLeft, this.handleArrowLeft)\n .set(arrowRight, this.handleArrowRight)\n .set(homeKey, this.handleHomeKey)\n .set(endKey, this.handleEndKey);\n\n addKeybindings(this, {\n ref: this._prevButtonRef,\n bindingDefaults: { preventDefault: true },\n }).setActivateHandler(this.handleNavigationInteractionPrevious);\n\n addKeybindings(this, {\n ref: this._nextButtonRef,\n bindingDefaults: { preventDefault: true },\n }).setActivateHandler(this.handleNavigationInteractionNext);\n\n createMutationController(this, {\n callback: this._observerCallback,\n filter: [IgcCarouselSlideComponent.tagName],\n config: {\n attributeFilter: ['active'],\n childList: true,\n subtree: true,\n },\n });\n }\n\n private handleSlotChange(): void {\n if (this.total) {\n this.activateSlide(\n this.slides.findLast((slide) => slide.active) ?? first(this.slides)\n );\n }\n }\n\n private handleIndicatorSlotChange(): void {\n this.requestUpdate();\n }\n\n private handlePointerDown(): void {\n if (this._carouselKeyboardInteractionFocus.focused) {\n this._carouselKeyboardInteractionFocus.reset();\n }\n }\n\n private handlePointerEnter(): void {\n this._hasMouseStop = true;\n if (this._carouselKeyboardInteractionFocus.focused) {\n return;\n }\n this.handlePauseOnInteraction();\n }\n\n private handlePointerLeave(): void {\n this._hasMouseStop = false;\n if (this._carouselKeyboardInteractionFocus.focused) {\n return;\n }\n this.handlePauseOnInteraction();\n }\n\n private handleFocusIn(): void {\n if (this._carouselKeyboardInteractionFocus.focused || this._hasMouseStop) {\n return;\n }\n this.handlePauseOnInteraction();\n }\n\n private handleFocusOut(event: FocusEvent): void {\n const node = event.relatedTarget as Node;\n\n if (this.contains(node) || this.renderRoot.contains(node)) {\n return;\n }\n\n if (this._carouselKeyboardInteractionFocus.focused) {\n this._carouselKeyboardInteractionFocus.reset();\n\n if (!this._hasMouseStop) {\n this.handlePauseOnInteraction();\n }\n }\n }\n\n private handlePauseOnInteraction(): void {\n if (!this.interval || this.disablePauseOnInteraction) return;\n\n if (this.isPlaying) {\n this.pause();\n this.emitEvent('igcPaused');\n } else {\n this.play();\n this.emitEvent('igcPlaying');\n }\n }\n\n private async handleArrowLeft(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(isLTR(this) ? this.prev : this.next);\n }\n\n private async handleArrowRight(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(isLTR(this) ? this.next : this.prev);\n }\n\n private async handleHomeKey(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(() =>\n this.select(isLTR(this) ? first(this.slides) : last(this.slides))\n );\n }\n\n private async handleEndKey(): Promise<void> {\n this._hasKeyboardInteractionOnIndicators = true;\n this.handleInteraction(() =>\n this.select(isLTR(this) ? last(this.slides) : first(this.slides))\n );\n }\n\n private handleVerticalSwipe({ data: { direction } }: SwipeEvent) {\n if (this.vertical) {\n this.handleInteraction(direction === 'up' ? this.next : this.prev);\n }\n }\n\n private handleHorizontalSwipe({ data: { direction } }: SwipeEvent) {\n if (!this.vertical) {\n this.handleInteraction(async () => {\n if (isLTR(this)) {\n direction === 'left' ? await this.next() : await this.prev();\n } else {\n direction === 'left' ? await this.prev() : await this.next();\n }\n });\n }\n }\n\n private async handleIndicatorClick(event: PointerEvent): Promise<void> {\n const indicator = findElementFromEventPath<IgcCarouselIndicatorComponent>(\n IgcCarouselIndicatorComponent.tagName,\n event\n )!;\n\n const index = this.hasProjectedIndicators\n ? this._projectedIndicators.indexOf(indicator)\n : Array.from(this._defaultIndicators).indexOf(indicator);\n\n this.handleInteraction(() =>\n this.select(this.slides[index], index > this.current ? 'next' : 'prev')\n );\n }\n\n private handleNavigationInteractionNext() {\n this.handleInteraction(this.next);\n }\n\n private handleNavigationInteractionPrevious() {\n this.handleInteraction(this.prev);\n }\n\n private async handleInteraction(\n callback: () => Promise<unknown>\n ): Promise<void> {\n if (this.interval) {\n this.resetInterval();\n }\n\n await callback.call(this);\n this.emitEvent('igcSlideChanged', { detail: this.current });\n\n if (this.interval) {\n this.restartInterval();\n }\n }\n\n private activateSlide(slide: IgcCarouselSlideComponent): void {\n if (this._activeSlide) {\n this._activeSlide.active = false;\n }\n\n this._activeSlide = slide;\n this._activeSlide.active = true;\n\n if (this._hasKeyboardInteractionOnIndicators) {\n this.hasProjectedIndicators\n ? this._projectedIndicators[this.current].focus()\n : this._defaultIndicators[this.current].focus();\n\n this._hasKeyboardInteractionOnIndicators = false;\n }\n }\n\n private updateProjectedIndicators(): void {\n for (const [idx, slide] of this.slides.entries()) {\n const indicator = this._projectedIndicators[idx];\n indicator.active = slide.active;\n indicator.index = idx;\n\n this.setAttribute('aria-controls', slide.id);\n }\n }\n\n private resetInterval(): void {\n if (this._lastInterval) {\n clearInterval(this._lastInterval);\n this._lastInterval = null;\n }\n }\n\n private restartInterval(): void {\n this.resetInterval();\n\n if (asNumber(this.interval) > 0) {\n this._lastInterval = setInterval(() => {\n if (this.isPlaying && this.total) {\n this.next();\n this.emitEvent('igcSlideChanged', { detail: this.current });\n } else {\n this.pause();\n }\n }, this.interval);\n }\n }\n\n private async animateSlides(\n nextSlide: IgcCarouselSlideComponent,\n currentSlide: IgcCarouselSlideComponent,\n dir: 'next' | 'prev'\n ): Promise<void> {\n if (dir === 'next') {\n // Animate slides in next direction\n currentSlide.previous = true;\n currentSlide.toggleAnimation('out');\n this.activateSlide(nextSlide);\n await nextSlide.toggleAnimation('in');\n currentSlide.previous = false;\n } else {\n // Animate slides in previous direction\n currentSlide.previous = true;\n currentSlide.toggleAnimation('in', 'reverse');\n this.activateSlide(nextSlide);\n await nextSlide.toggleAnimation('out', 'reverse');\n currentSlide.previous = false;\n }\n }\n\n /**\n * Resumes playing of the carousel slides.\n */\n public play(): void {\n if (!this.isPlaying) {\n this._paused = false;\n this._playing = true;\n this.restartInterval();\n }\n }\n\n /**\n * Pauses the carousel rotation of slides.\n */\n public pause(): void {\n if (this.isPlaying) {\n this._playing = false;\n this._paused = true;\n this.resetInterval();\n }\n }\n\n /**\n * Switches to the next slide, runs any animations, and returns if the operation was successful.\n */\n public async next(): Promise<boolean> {\n if (this.disableLoop && this.nextIndex === 0) {\n this.pause();\n return false;\n }\n\n return await this.select(this.slides[this.nextIndex], 'next');\n }\n\n /**\n * Switches to the previous slide, runs any animations, and returns if the operation was successful.\n */\n public async prev(): Promise<boolean> {\n if (this.disableLoop && this.prevIndex === this.total - 1) {\n this.pause();\n return false;\n }\n\n return await this.select(this.slides[this.prevIndex], 'prev');\n }\n\n /* blazorSuppress */\n /**\n * Switches to the passed-in slide, runs any animations, and returns if the operation was successful.\n */\n public async select(\n slide: IgcCarouselSlideComponent,\n animationDirection?: 'next' | 'prev'\n ): Promise<boolean>;\n /**\n * Switches to slide by index, runs any animations, and returns if the operation was successful.\n */\n public async select(\n index: number,\n animationDirection?: 'next' | 'prev'\n ): Promise<boolean>;\n public async select(\n slideOrIndex: IgcCarouselSlideComponent | number,\n animationDirection?: 'next' | 'prev'\n ): Promise<boolean> {\n let index: number;\n let slide: IgcCarouselSlideComponent | undefined;\n\n if (typeof slideOrIndex === 'number') {\n index = slideOrIndex;\n slide = this.slides.at(index);\n } else {\n slide = slideOrIndex;\n index = this.slides.indexOf(slide);\n }\n\n if (index === this.current || index === -1 || !slide) {\n return false;\n }\n\n const dir = animationDirection ?? (index > this.current ? 'next' : 'prev');\n\n await this.animateSlides(slide, this._activeSlide, dir);\n return true;\n }\n\n private navigationTemplate() {\n return html`\n <igc-button\n ${ref(this._prevButtonRef)}\n type=\"button\"\n part=\"navigation previous\"\n aria-label=\"Previous slide\"\n aria-controls=${this._carouselId}\n ?disabled=${this.disableLoop && this.current === 0}\n @click=${this.handleNavigationInteractionPrevious}\n >\n <slot name=\"previous-button\">\n <igc-icon\n name=\"carousel_prev\"\n collection=\"default\"\n aria-hidden=\"true\"\n ></igc-icon>\n </slot>\n </igc-button>\n <igc-button\n ${ref(this._nextButtonRef)}\n type=\"button\"\n part=\"navigation next\"\n aria-label=\"Next slide\"\n aria-controls=${this._carouselId}\n ?disabled=${this.disableLoop && this.current === this.total - 1}\n @click=${this.handleNavigationInteractionNext}\n >\n <slot name=\"next-button\">\n <igc-icon\n name=\"carousel_next\"\n collection=\"default\"\n aria-hidden=\"true\"\n ></igc-icon>\n </slot>\n </igc-button>\n `;\n }\n\n protected *renderIndicators() {\n for (const [i, slide] of this.slides.entries()) {\n const forward = slide.active ? 'visible' : 'hidden';\n const backward = slide.active ? 'hidden' : 'visible';\n\n yield html`\n <igc-carousel-indicator\n exportparts=\"indicator, active, inactive\"\n .active=${slide.active}\n .index=${i}\n >\n <div\n part=\"dot\"\n style=${styleMap({ visibility: backward, zIndex: 1 })}\n ></div>\n <div\n part=\"dot active\"\n slot=\"active\"\n style=${styleMap({ visibility: forward })}\n ></div>\n </igc-carousel-indicator>\n `;\n }\n }\n\n private indicatorTemplate() {\n const parts = partNameMap({\n indicators: true,\n start: this.indicatorsOrientation === 'start',\n });\n\n return html`\n <igc-carousel-indicator-container>\n <div ${ref(this._indicatorsContainerRef)} role=\"tablist\" part=${parts}>\n <slot\n name=\"indicator\"\n @slotchange=${this.handleIndicatorSlotChange}\n @click=${this.handleIndicatorClick}\n >\n ${this.hasProjectedIndicators\n ? this.updateProjectedIndicators()\n : this.renderIndicators()}\n </slot>\n </div>\n </igc-carousel-indicator-container>\n `;\n }\n\n private labelTemplate() {\n const parts = partNameMap({\n label: true,\n indicators: true,\n start: this.indicatorsOrientation === 'start',\n });\n const value = formatString(\n this.slidesLabelFormat,\n this.current + 1,\n this.total\n );\n\n return html`\n <div part=${parts}>\n <span>${value}</span>\n </div>\n `;\n }\n\n protected override render() {\n return html`\n <section @focusin=${this.handleFocusIn} @focusout=${this.handleFocusOut}>\n ${this.hideNavigation ? nothing : this.navigationTemplate()}\n ${this.hideIndicators || this.showIndicatorsLabel\n ? nothing\n : this.indicatorTemplate()}\n ${!this.hideIndicators && this.showIndicatorsLabel\n ? this.labelTemplate()\n : nothing}\n <div\n ${ref(this._carouselSlidesContainerRef)}\n id=${this._carouselId}\n aria-live=${this.interval && this.isPlaying ? 'off' : 'polite'}\n >\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n </section>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-carousel': IgcCarouselComponent;\n }\n}\n"]}
|
|
@@ -22,13 +22,17 @@ type MutationControllerCallback<T> = (params: MutationControllerParams<T>) => un
|
|
|
22
22
|
* an array of selector strings or a predicate function.
|
|
23
23
|
*/
|
|
24
24
|
type MutationControllerFilter<T> = string[] | ((node: T) => boolean);
|
|
25
|
+
type MutationDOMChange<T> = {
|
|
26
|
+
target: Element;
|
|
27
|
+
node: T;
|
|
28
|
+
};
|
|
25
29
|
type MutationChange<T> = {
|
|
26
30
|
/** Elements that have attribute(s) changes. */
|
|
27
31
|
attributes: T[];
|
|
28
32
|
/** Elements that have been added. */
|
|
29
|
-
added: T[];
|
|
33
|
+
added: MutationDOMChange<T>[];
|
|
30
34
|
/** Elements that have been removed. */
|
|
31
|
-
removed: T[];
|
|
35
|
+
removed: MutationDOMChange<T>[];
|
|
32
36
|
};
|
|
33
37
|
export type MutationControllerParams<T> = {
|
|
34
38
|
/** The original mutation records from the underlying observer. */
|
|
@@ -39,8 +39,8 @@ class MutationController {
|
|
|
39
39
|
changes.attributes.push(...mutationFilter([record.target], filter));
|
|
40
40
|
}
|
|
41
41
|
else if (record.type === 'childList') {
|
|
42
|
-
changes.added.push(...mutationFilter(Array.from(record.addedNodes), filter));
|
|
43
|
-
changes.removed.push(...mutationFilter(Array.from(record.removedNodes), filter));
|
|
42
|
+
changes.added.push(...mutationFilter(Array.from(record.addedNodes), filter).map((node) => ({ target: record.target, node })));
|
|
43
|
+
changes.removed.push(...mutationFilter(Array.from(record.removedNodes), filter).map((node) => ({ target: record.target, node })));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
return { records, changes, observer: this };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-observer.js","sourceRoot":"","sources":["../../../../src/components/common/controllers/mutation-observer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"mutation-observer.js","sourceRoot":"","sources":["../../../../src/components/common/controllers/mutation-observer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAiDvC,SAAS,cAAc,CAAI,KAAU,EAAE,MAAoC;IACzE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAC1B,CAAC,CAAC,KAAK,CAAC,MAAM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AmC;IAEnC,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nimport { isElement } from '../util.js';\n\n/** @ignore */\nexport interface MutationControllerConfig<T> {\n /** The callback function to run when a mutation occurs. */\n callback: MutationControllerCallback<T>;\n /** The underlying mutation observer configuration parameters. */\n config: MutationObserverInit;\n /**\n * The element to observe.\n * If left out, the observer will listen on the host component itself.\n */\n target?: Element;\n /**\n * A filter configuration.\n * See {@link MutationControllerFilter|this} for additional information.\n */\n filter?: MutationControllerFilter<T>;\n}\n\ntype MutationControllerCallback<T> = (\n params: MutationControllerParams<T>\n) => unknown;\n\n/**\n * Filter configuration to return elements that either match\n * an array of selector strings or a predicate function.\n */\ntype MutationControllerFilter<T> = string[] | ((node: T) => boolean);\ntype MutationDOMChange<T> = { target: Element; node: T };\n\ntype MutationChange<T> = {\n /** Elements that have attribute(s) changes. */\n attributes: T[];\n /** Elements that have been added. */\n added: MutationDOMChange<T>[];\n /** Elements that have been removed. */\n removed: MutationDOMChange<T>[];\n};\n\nexport type MutationControllerParams<T> = {\n /** The original mutation records from the underlying observer. */\n records: MutationRecord[];\n /** The aggregated changes. */\n changes: MutationChange<T>;\n /** The observer controller instance. */\n observer: MutationController<T>;\n};\n\nfunction mutationFilter<T>(nodes: T[], filter?: MutationControllerFilter<T>) {\n if (!filter) {\n return nodes;\n }\n\n return Array.isArray(filter)\n ? nodes.filter((node) =>\n filter.some((selector) => isElement(node) && node.matches(selector))\n )\n : nodes.filter((node) => filter(node));\n}\n\nclass MutationController<T> implements ReactiveController {\n private _host: ReactiveControllerHost & Element;\n private _observer: MutationObserver;\n private _target: Element;\n private _config: MutationObserverInit;\n private _callback: MutationControllerCallback<T>;\n private _filter?: MutationControllerFilter<T>;\n\n constructor(\n host: ReactiveControllerHost & Element,\n options: MutationControllerConfig<T>\n ) {\n this._host = host;\n this._callback = options.callback;\n this._config = options.config;\n this._target = options.target ?? this._host;\n this._filter = options.filter ?? [];\n\n this._observer = new MutationObserver((records) => {\n this.disconnect();\n this._callback.call(this._host, this._process(records));\n this.observe();\n });\n\n host.addController(this);\n }\n\n public hostConnected() {\n this.observe();\n }\n\n public hostDisconnected() {\n this.disconnect();\n }\n\n private _process(records: MutationRecord[]): MutationControllerParams<T> {\n const changes: MutationChange<T> = {\n attributes: [],\n added: [],\n removed: [],\n };\n const filter = this._filter;\n\n for (const record of records) {\n if (record.type === 'attributes') {\n changes.attributes.push(\n ...mutationFilter([record.target as T], filter)\n );\n } else if (record.type === 'childList') {\n changes.added.push(\n ...mutationFilter(Array.from(record.addedNodes) as T[], filter).map(\n (node) => ({ target: record.target as Element, node })\n )\n );\n changes.removed.push(\n ...mutationFilter(Array.from(record.removedNodes) as T[], filter).map(\n (node) => ({ target: record.target as Element, node })\n )\n );\n }\n }\n\n return { records, changes, observer: this };\n }\n\n /**\n * Begin receiving notifications of changes to the DOM based\n * on the configured {@link MutationControllerConfig.target|target} and observer {@link MutationControllerConfig.config|options}.\n */\n public observe() {\n this._observer.observe(this._target, this._config);\n }\n\n /** Stop watching for mutations. */\n public disconnect() {\n this._observer.disconnect();\n }\n}\n\n/**\n * Creates and attaches a mutation controller with `config` to the passed in `host`.\n *\n * Automatically starts/stops observing for mutation changes\n * in the respective component connect/disconnect callbacks.\n *\n * The mutation observer is disconnected before invoking the passed in callback and re-attached\n * after that in order to not loop itself in endless stream of changes.\n */\nexport function createMutationController<T>(\n host: ReactiveControllerHost & Element,\n config: MutationControllerConfig<T>\n) {\n return new MutationController(host, config);\n}\n"]}
|
package/components/tabs/tabs.js
CHANGED
|
@@ -35,15 +35,18 @@ let IgcTabsComponent = IgcTabsComponent_1 = class IgcTabsComponent extends Event
|
|
|
35
35
|
return tabs.indexOf(tab);
|
|
36
36
|
}
|
|
37
37
|
_mutationCallback({ changes: { attributes, added, removed }, }) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const ownAttributes = attributes.filter((tab) => tab.closest(this.tagName) === this);
|
|
39
|
+
const ownAdded = added.filter(({ target }) => target.closest(this.tagName) === this);
|
|
40
|
+
const ownRemoved = removed.filter(({ target }) => target.closest(this.tagName) === this);
|
|
41
|
+
this.setSelectedTab(ownAttributes.find((tab) => tab.selected));
|
|
42
|
+
if (ownRemoved.length || ownAdded.length) {
|
|
43
|
+
for (const { node: tab } of ownRemoved) {
|
|
41
44
|
this.resizeObserver?.unobserve(tab);
|
|
42
45
|
if (tab.selected && tab === this.activeTab) {
|
|
43
46
|
this.activeTab = undefined;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
for (const tab of
|
|
49
|
+
for (const { node: tab } of ownAdded) {
|
|
47
50
|
this.resizeObserver?.observe(tab);
|
|
48
51
|
if (tab.selected) {
|
|
49
52
|
this.setSelectedTab(tab);
|