Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
676fff9
feat: SlotController implementation and tests
rkaraivanov Jun 27, 2025
020ce66
refactor(chip): Use SlotController and ARIA fixes
rkaraivanov Jun 27, 2025
caedbd4
docs(chip): Added missing slots JSDoc documentation
rkaraivanov Jun 27, 2025
e0822ce
refactor(checkbox): Migrated to SlotController
rkaraivanov Jun 27, 2025
36b0606
refactor(switch): Migrated to SlotController
rkaraivanov Jun 27, 2025
4fff672
refactor(checkbox,switch): Final batch of code clean-ups
rkaraivanov Jun 30, 2025
65385dc
refactor(dialog): Use SlotController and code clean-ups
rkaraivanov Jun 30, 2025
e4a29c8
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 1, 2025
f791738
refactor(textarea): Use SlotController and code clean-ups
rkaraivanov Jul 1, 2025
7e9a67d
refactor(nav-drawer): Use SlotController and code clean-up
rkaraivanov Jul 1, 2025
8dc6f9e
refactor(expansion-panel): Use SlotsController and code clean-ups
rkaraivanov Jul 1, 2025
f3e8502
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 1, 2025
eb7f33b
refactor(radio): Use SlotController
rkaraivanov Jul 2, 2025
d68a4e1
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 2, 2025
603846f
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 3, 2025
120c565
refactor(validation-container): Cached slot generation
rkaraivanov Jul 3, 2025
c1f14b4
refactor(progress): Use SlotController
rkaraivanov Jul 3, 2025
a48f730
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 7, 2025
1adc67f
refactor(select): Use SlotController and code clean-ups
rkaraivanov Jul 8, 2025
4904b58
refactor(tile): Use SlotController
rkaraivanov Jul 8, 2025
4eedcc0
chore(tile): Removed obsolete createRenderRoot
rkaraivanov Jul 8, 2025
b02116c
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 8, 2025
d743f9a
refactor(carousel): Use SlotController and code clean-ups
rkaraivanov Jul 9, 2025
e32c3bb
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 10, 2025
c669034
fix(carousel): Correct slide id assigned to aria attribute
rkaraivanov Jul 10, 2025
fb41075
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 10, 2025
b0f28d0
Merge remote-tracking branch 'origin/master' into rkaraivanov/feat-sl…
rkaraivanov Jul 15, 2025
dd26f37
refactor(checkbox,radio): Drop initial slotchange invocation
rkaraivanov Jul 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/carousel/carousel-indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class IgcCarouselIndicatorComponent extends LitElement {
});

@consume({ context: carouselContext, subscribe: true })
private _carousel?: IgcCarouselComponent;
private readonly _carousel?: IgcCarouselComponent;

protected get _labelFormat(): string {
return this._carousel ? this._carousel.indicatorsLabelFormat : '';
Expand Down
44 changes: 19 additions & 25 deletions src/components/carousel/carousel-slide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { addAnimationController } from '../../animations/player.js';
import { carouselContext } from '../common/context.js';
import { addInternalsController } from '../common/controllers/internals.js';
import { registerComponent } from '../common/definitions/register.js';
import { createCounter, formatString } from '../common/util.js';
import { formatString } from '../common/util.js';
import { animations } from './animations.js';
import type IgcCarouselComponent from './carousel.js';
import { styles } from './themes/carousel-slide.base.css.js';

let nextId = 1;

/**
* A single content container within a set of containers used in the context of an `igc-carousel`.
*
Expand All @@ -27,25 +29,23 @@ export default class IgcCarouselSlideComponent extends LitElement {
registerComponent(IgcCarouselSlideComponent);
}

private static readonly increment = createCounter();

private readonly _internals = addInternalsController(this, {
initialARIA: {
role: 'tabpanel',
ariaRoleDescription: 'slide',
},
});

private readonly _animationPlayer = addAnimationController(this);
private readonly _player = addAnimationController(this);

@consume({ context: carouselContext, subscribe: true })
private _carousel?: IgcCarouselComponent;
private readonly _carousel?: IgcCarouselComponent;

protected get _index() {
protected get _index(): number {
return this._carousel ? this._carousel.slides.indexOf(this) : 0;
}

protected get _total() {
protected get _total(): number {
return this._carousel ? this._carousel.slides.length : 0;
}

Expand All @@ -59,7 +59,7 @@ export default class IgcCarouselSlideComponent extends LitElement {
return animation;
}

protected get _labelFormat() {
protected get _labelFormat(): string {
return this._carousel ? this._carousel.slidesLabelFormat : '';
}

Expand All @@ -81,21 +81,16 @@ export default class IgcCarouselSlideComponent extends LitElement {
public async toggleAnimation(
type: 'in' | 'out',
direction: 'normal' | 'reverse' = 'normal'
) {
): Promise<boolean> {
const animation = animations.get(this._animation)!.get(type)!;

const options: KeyframeAnimationOptions = {
duration: 320,
easing: EaseInOut.Quad,
direction,
};

const [_, event] = await Promise.all([
this._animationPlayer.stopAll(),
this._animationPlayer.play(animation(options)),
]);

return event.type === 'finish';
return await this._player.playExclusive(
animation({
duration: 320,
easing: EaseInOut.Quad,
direction,
})
);
}

protected override willUpdate(): void {
Expand All @@ -104,15 +99,14 @@ export default class IgcCarouselSlideComponent extends LitElement {
});
}

/** @internal */
public override connectedCallback(): void {
super.connectedCallback();

this.id =
this.id || `igc-carousel-slide-${IgcCarouselSlideComponent.increment()}`;
this.id = this.id || `igc-carousel-slide-${nextId++}`;
}

protected override render() {
return html` <slot></slot> `;
return html`<slot></slot>`;
}
}

Expand Down
Loading