Skip to content

feat(carousel): align with WC carousel #14651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e0dbf78
feat(carousel): add vertical & indicator props; add keyboard focus cl…
RivaIvanova Aug 20, 2024
bbce1b8
fix(carousel): change keyboardSupport to false
RivaIvanova Aug 22, 2024
21d2c3a
feat(carousel): add vertical animation; change prev/next to buttons
RivaIvanova Aug 22, 2024
d9c20db
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Aug 22, 2024
cdca6a9
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Aug 23, 2024
d5522dd
feat(carousel): use CarouselAnimationType; deprecate keyboardSupport;
RivaIvanova Aug 23, 2024
306828b
Merge branch 'rivanova/feat-carousel-14627' of https://github.com/Ign…
RivaIvanova Aug 23, 2024
0625afb
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Aug 23, 2024
a5d7e01
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Aug 26, 2024
a9b730f
feat(carousel): add panup/pandown support
RivaIvanova Aug 26, 2024
f43e7c6
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova Aug 27, 2024
4372b03
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Aug 28, 2024
8b231f5
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Aug 28, 2024
516cd2f
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova Sep 2, 2024
d1850e2
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 2, 2024
0b8dfeb
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 3, 2024
31dff62
refactor(carousel): update themes according to new design
SisIvanova Aug 13, 2024
6e26800
fix(carousel): theming version and navigation icons
SisIvanova Aug 19, 2024
e4675e0
deps(theming): bump to beta with changes
SisIvanova Sep 3, 2024
9b52df0
fix(carousel): disable prev/next buttons
RivaIvanova Sep 4, 2024
2bb676e
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 10, 2024
2eaa04a
feat(carousel): indicators focus styles
SisIvanova Sep 12, 2024
2e65e97
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova Sep 16, 2024
b8c7158
refactor(carousel): navigation button styles
SisIvanova Sep 16, 2024
b7305cb
feat(carousel): vertical mode styles
SisIvanova Sep 16, 2024
e10f92f
Update _carousel-theme.scss
SisIvanova Sep 16, 2024
e47e28a
fix(carousel): navigation button border-radiuse
SisIvanova Sep 16, 2024
3a7a747
Merge branch 'master' into rivanova/feat-carousel-14627
SisIvanova Sep 16, 2024
8bfef9e
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 17, 2024
05eb02a
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 17, 2024
fdda740
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 18, 2024
88025a1
fix(carousel): indigo focus indicator styles
SisIvanova Sep 18, 2024
6a702f9
refactor(carousel): navigation buttons in vertical mode
SisIvanova Sep 18, 2024
992b061
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 19, 2024
bc767a7
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 19, 2024
44f52e0
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 19, 2024
f2eb158
fix(carousel): keep focused class on keyboard nav;
RivaIvanova Sep 19, 2024
0a6bd84
Merge branch 'rivanova/feat-carousel-14627' of https://github.com/Ign…
RivaIvanova Sep 19, 2024
d4b0d99
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 19, 2024
c6455ba
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 20, 2024
97a7823
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular…
RivaIvanova Sep 24, 2024
610874c
Merge branch 'master' into rivanova/feat-carousel-14627
SisIvanova Sep 24, 2024
dc2d366
deps(theming): update to latest beta
SisIvanova Sep 24, 2024
8264f49
deps(theming): update to latest version
SisIvanova Sep 24, 2024
b3d7520
Merge branch 'master' into rivanova/feat-carousel-14627
SisIvanova Sep 24, 2024
41265f4
build(theming): bump theming version in shipped package
simeonoff Sep 24, 2024
98465dc
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 25, 2024
c7ae728
Merge branch 'master' into rivanova/feat-carousel-14627
simeonoff Sep 25, 2024
89d3566
fix(carousel): support keyboard nav on indicators
RivaIvanova Sep 25, 2024
6ba3767
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 25, 2024
89b8d4c
test(carousel): revert document body dir after rtl tests
RivaIvanova Sep 25, 2024
fbb76f8
Merge branch 'master' into rivanova/feat-carousel-14627
RivaIvanova Sep 25, 2024
864565a
Merge branch 'master' into rivanova/feat-carousel-14627
simeonoff Sep 26, 2024
ed99aab
chore(carousel): deprecate keyboardSupport in changelog
RivaIvanova Sep 26, 2024
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
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ All notable changes for each version of this project will be documented in this
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
- To streamline the sorting of columns with custom formats, a new `FormattedValuesSortingStrategy` has been introduced. This strategy simplifies the sorting process by allowing direct sorting based on formatted values, eliminating the need to extend the `DefaultSortingStrategy` or implement a custom `ISortingStrategy`. This enhancement improves the ease of handling sorting with custom column formatters.

- `IgxCarousel`
- Added support for vertical alignment. Can be configured via the `vertical` property. Defaults to `false`.
- Added support for showing/hiding the indicator controls (dots). Can be configured via the `indicators` property. Defaults to `true`.

#### Scrollbar: New CSS variables

We have introduced new CSS variables to allow for more customizable scrollbars. This enhancement utilizes the available WebKit pseudo-selectors such as `::-webkit-scrollbar-track`. However, please note that these pseudo-selectors are prefixed with `-webkit-` and are only supported in WebKit-based browsers (e.g., Chrome, Safari).
Expand All @@ -34,6 +38,12 @@ For Firefox users, we provide limited scrollbar styling options through the foll
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`, `IgxPivotGrid`
- **Deprecation** The `shouldGenerate` property has been deprecated and will be removed in a future version. Column re-creation now relies on `autoGenerate` instead. Automatic migration to this is available and will be applied on `ng update`. Note that if `autoGenerate` is already set initially, there is no need to explicitly set it elsewhere in your code.

- `IgxCarousel`
- `animationType` input property is now of type `CarouselAnimationType`. `HorizontalAnimationType` can also be used, however, to accommodate the new vertical mode, which supports vertical slide animations, it is recommended to use `CarouselAnimationType`.

- **Behavioral Changes** - the `keyboardSupport` input property now defaults to `false`.
- **Deprecation** - the `keyboardSupport` input property has been deprecated and will be removed in a future version. Keyboard navigation with `ArrowLeft`, `ArrowRight`, `Home`, and `End` keys will be supported when focusing the indicators' container via ` Tab`/`Shift+Tab`.

## 18.1.0
### New Features
- `IgxPivotGrid`
Expand Down Expand Up @@ -4620,4 +4630,3 @@ export class IgxCustomFilteringOperand extends IgxFilteringOperand {
- `IgxDraggableDirective` moved inside `../directives/dragdrop/` folder
- `IgxRippleDirective` moved inside `../directives/ripple/` folder
- Folder `"./navigation/nav-service"` renamed to `"./navigation/nav.service"`

9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/source-map": "0.5.2",
"express": "^4.21.0",
"fflate": "^0.8.1",
"igniteui-theming": "^12.2.1",
"igniteui-theming": "^13.0.0",
"igniteui-trial-watermark": "^3.0.2",
"lodash-es": "^4.17.21",
"rxjs": "^7.8.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/igniteui-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"igniteui-trial-watermark": "^3.0.2",
"lodash-es": "^4.17.21",
"uuid": "^9.0.0",
"igniteui-theming": "^12.2.1",
"igniteui-theming": "^13.0.0",
"@igniteui/material-icons-extended": "^3.0.0"
},
"peerDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions projects/igniteui-angular/src/lib/carousel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
| `pause` | boolean | Should the carousel stop playing on user interaction. Defaults to `true`. |
| `interval` | number | The amount of time in milliseconds between slides transition. |
| `navigation` | boolean | Controls should the carousel render the left/right navigation buttons. Defaults to `true`. |
| `keyboardSupport` | boolean | Controls should the keyboard navigation should be supported. Defaults to `true`. |
| `indicators` | boolean | Controls should the carousel render the indicators. Defaults to `true`. |
| `vertical` | boolean | Controls should the carousel be rendered in vertical alignment. Defaults to `false`. |
| `keyboardSupport` | boolean | Controls should the keyboard navigation should be supported. Defaults to `false`. |
| `gesturesSupport` | boolean | Controls should the gestures should be supported. Defaults to `true`. |
| `maximumIndicatorsCount` | number | The number of visible indicators. Defaults to `5`. |
| `indicatorsOrientation` | CarouselIndicatorsOrientation | Controls whether the indicators should be previewed on top or on bottom of carousel. Defaults to `bottom`. |
| `animationType` | HorizontalAnimationType | Controls what animation should be played when slides are changing. Defaults to `slide`. |
| `animationType` | CarouselAnimationType | Controls what animation should be played when slides are changing. Defaults to `slide`. |
| `total` | number | The number of slides the carousel currently has. |
| `current` | number | The index of the slide currently showing. |
| `isPlaying` | boolean | Returns whether the carousel is paused/playing. |
Expand Down
20 changes: 11 additions & 9 deletions projects/igniteui-angular/src/lib/carousel/carousel-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ChangeDetectorRef, EventEmitter, Inject } from '@angular/core';
import { IgxAngularAnimationService } from '../services/animation/angular-animation-service';
import { AnimationPlayer, AnimationService } from '../services/animation/animation';
import { fadeIn, slideInLeft } from 'igniteui-angular/animations';
import { HorizontalAnimationType } from './enums';
import { CarouselAnimationType } from './enums';

export enum Direction { NONE, NEXT, PREV }

Expand All @@ -21,7 +21,7 @@ export interface IgxSlideComponentBase {
/** @hidden */
export abstract class IgxCarouselComponentBase {
/** @hidden */
public animationType: HorizontalAnimationType = HorizontalAnimationType.slide;
public animationType: CarouselAnimationType = CarouselAnimationType.slide;

/** @hidden @internal */
public enterAnimationDone = new EventEmitter();
Expand All @@ -42,6 +42,8 @@ export abstract class IgxCarouselComponentBase {
protected animationPosition = 0;
/** @hidden */
protected newDuration = 0;
/** @hidden */
protected vertical = false;

constructor(
@Inject(IgxAngularAnimationService) private animationService: AnimationService,
Expand All @@ -50,7 +52,7 @@ export abstract class IgxCarouselComponentBase {

/** @hidden */
protected triggerAnimations() {
if (this.animationType !== HorizontalAnimationType.none) {
if (this.animationType !== CarouselAnimationType.none) {
if (this.animationStarted(this.leaveAnimationPlayer) || this.animationStarted(this.enterAnimationPlayer)) {
requestAnimationFrame(() => {
this.resetAnimations();
Expand Down Expand Up @@ -96,7 +98,7 @@ export abstract class IgxCarouselComponentBase {

const trans = this.animationPosition ? this.animationPosition * 100 : 100;
switch (this.animationType) {
case HorizontalAnimationType.slide:
case CarouselAnimationType.slide:
return {
enterAnimation: useAnimation(slideInLeft,
{
Expand All @@ -105,8 +107,8 @@ export abstract class IgxCarouselComponentBase {
duration: `${duration}ms`,
endOpacity: 1,
startOpacity: 1,
fromPosition: `translateX(${this.currentItem.direction === 1 ? trans : -trans}%)`,
toPosition: 'translateX(0%)'
fromPosition: `${this.vertical ? 'translateY' : 'translateX'}(${this.currentItem.direction === 1 ? trans : -trans}%)`,
toPosition: `${this.vertical ? 'translateY(0%)' : 'translateX(0%)'}`
}
}),
leaveAnimation: useAnimation(slideInLeft,
Expand All @@ -116,12 +118,12 @@ export abstract class IgxCarouselComponentBase {
duration: `${duration}ms`,
endOpacity: 1,
startOpacity: 1,
fromPosition: `translateX(0%)`,
toPosition: `translateX(${this.currentItem.direction === 1 ? -trans : trans}%)`,
fromPosition: `${this.vertical ? 'translateY(0%)' : 'translateX(0%)'}`,
toPosition: `${this.vertical ? 'translateY' : 'translateX'}(${this.currentItem.direction === 1 ? -trans : trans}%)`,
}
})
};
case HorizontalAnimationType.fade:
case CarouselAnimationType.fade:
return {
enterAnimation: useAnimation(fadeIn,
{ params: { duration: `${duration}ms`, startOpacity: `${this.animationPosition}` } }),
Expand Down
53 changes: 32 additions & 21 deletions projects/igniteui-angular/src/lib/carousel/carousel.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,56 @@
</div>
</ng-template>

<ng-template #defaultNextButton let-disabled>
<span class="igx-nav-arrow"
[class.igx-nav-arrow--disabled]="disabled">
<igx-icon aria-hidden="true" family="default" name="carousel_next"></igx-icon>
</span>
<ng-template #defaultNextButton>
<igx-icon aria-hidden="true" family="default" name="carousel_next"
class="igx-nav-arrow">
</igx-icon>
</ng-template>

<ng-template #defaultPrevButton let-disabled>
<span class="igx-nav-arrow"
[class.igx-nav-arrow--disabled]="disabled">
<igx-icon aria-hidden="true" family="default" name="carousel_prev"></igx-icon>
</span>
<ng-template #defaultPrevButton>
<igx-icon aria-hidden="true" family="default" name="carousel_prev"
class="igx-nav-arrow">
</igx-icon>
</ng-template>

<div *ngIf="showIndicators" [ngClass]="indicatorsOrientationClass" [attr.role]="'tablist'">
<div *ngFor="let slide of slides"
<button *ngIf="navigation && slides.length"
igxButton
class="igx-carousel__arrow--prev"
[attr.aria-label]="resourceStrings.igx_carousel_previous_slide"
[disabled]="prevButtonDisabled"
(click)="prev()"
(keydown)="handleKeydownPrev($event)">
<ng-container *ngTemplateOutlet="getPrevButtonTemplate; context: {$implicit: prevButtonDisabled};"></ng-container>
</button>

<button *ngIf="navigation && slides.length"
igxButton
class="igx-carousel__arrow--next"
[attr.aria-label]="resourceStrings.igx_carousel_next_slide"
[disabled]="nextButtonDisabled"
(click)="next()"
(keydown)="handleKeydownNext($event)">
<ng-container *ngTemplateOutlet="getNextButtonTemplate; context: {$implicit: nextButtonDisabled};"></ng-container>
</button>

<div *ngIf="showIndicators" [ngClass]="indicatorsClass" [attr.role]="'tablist'" (keyup)="handleKeyUp($event)" (focusout)="handleFocusOut($event)" (click)="handleClick()" (keydown)="handleKeydown($event)">
<div #indicators *ngFor="let slide of slides"
class="igx-carousel-indicators__indicator"
(click)="select(slide)"
[id]="'tab-'+ slide.index + '-' + total"
[attr.role]="'tab'"
[attr.tabindex]="slide.active ? 0 : -1"
[attr.aria-label]="resourceStrings.igx_carousel_slide + ' ' + (slide.index + 1) + ' ' + resourceStrings.igx_carousel_of + ' ' + this.total"
[attr.aria-controls]="'panel-' + slide.index"
[attr.aria-selected]="slide.active">
<ng-container *ngTemplateOutlet="getIndicatorTemplate; context: {$implicit: slide};"></ng-container>
</div>
</div>

<div *ngIf="showIndicatorsLabel" [ngClass]="indicatorsOrientationClass">
<div *ngIf="showIndicatorsLabel" [ngClass]="indicatorsClass" class="igx-carousel-label-indicator">
<span [id]="labelId" class="igx-carousel__label">{{getCarouselLabel}}</span>
</div>

<div class="igx-carousel__inner" [attr.aria-live]="!interval || stoppedByInteraction ? 'polite' : 'off'">
<ng-content></ng-content>
</div>

<div *ngIf="navigation && slides.length" role="button" tabindex="0" class="igx-carousel__arrow--prev" [attr.aria-label]="resourceStrings.igx_carousel_previous_slide" (keydown.enter)="prev()" (click)="prev()">
<ng-container *ngTemplateOutlet="getPrevButtonTemplate; context: {$implicit: prevButtonDisabled};"></ng-container>
</div>

<div *ngIf="navigation && slides.length" role="button" tabindex="0" class="igx-carousel__arrow--next" [attr.aria-label]="resourceStrings.igx_carousel_next_slide" (keydown.enter)="next()" (click)="next()">
<ng-container *ngTemplateOutlet="getNextButtonTemplate; context: {$implicit: nextButtonDisabled};"></ng-container>
</div>
Loading
Loading