Skip to content

Commit

Permalink
refactor(ui5-carousel): rename pageIndicatorStyle to pageIndicatorType (
Browse files Browse the repository at this point in the history
#8511)

Renames the property `pageIndicatorStyle` to `pageIndicatorType` and enumeration `PageIndicatorStyle` to `PageIndicatorType`.

BREAKING CHANGE: The `pageIndicatorStyle` no longer exists. If you previously used it like:
```html
<ui5-carousel page-indicator-style="Numeric"></ui5-carousel>
```
Now you should use `pageIndicatorType` instead:
```html
<ui5-carousel page-indicator-type="Numeric"></ui5-carousel>
```

Related to #8461
  • Loading branch information
dimovpetar authored Mar 22, 2024
1 parent e5c7faf commit a3aa04e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions packages/main/src/Carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
CAROUSEL_NEXT_ARROW_TEXT,
} from "./generated/i18n/i18n-defaults.js";
import CarouselArrowsPlacement from "./types/CarouselArrowsPlacement.js";
import CarouselPageIndicatorStyle from "./types/CarouselPageIndicatorStyle.js";
import CarouselPageIndicatorType from "./types/CarouselPageIndicatorType.js";
import BackgroundDesign from "./types/BackgroundDesign.js";
import BorderDesign from "./types/BorderDesign.js";
import CarouselTemplate from "./generated/templates/CarouselTemplate.lit.js";
Expand Down Expand Up @@ -189,8 +189,8 @@ class Carousel extends UI5Element {
* @default "Default"
* @public
*/
@property({ type: CarouselPageIndicatorStyle, defaultValue: CarouselPageIndicatorStyle.Default })
pageIndicatorStyle!: `${CarouselPageIndicatorStyle}`;
@property({ type: CarouselPageIndicatorType, defaultValue: CarouselPageIndicatorType.Default })
pageIndicatorType!: `${CarouselPageIndicatorType}`;

/**
* Defines the carousel's background design.
Expand Down Expand Up @@ -615,7 +615,7 @@ class Carousel extends UI5Element {
}

get isPageTypeDots() {
if (this.pageIndicatorStyle === CarouselPageIndicatorStyle.Numeric) {
if (this.pageIndicatorType === CarouselPageIndicatorType.Numeric) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Different Carousel page indicator styles.
* Different Carousel page indicator types.
* @public
*/
enum CarouselPageIndicatorStyle {
enum CarouselPageIndicatorType {
/**
* The page indicator will be visualized as dots if there are fewer than 9 pages.
* If there are more pages, the page indicator will switch to displaying the current page and the total number of pages. (e.g. X of Y)
Expand All @@ -17,4 +17,4 @@ enum CarouselPageIndicatorStyle {
Numeric = "Numeric",
}

export default CarouselPageIndicatorStyle;
export default CarouselPageIndicatorType;
4 changes: 2 additions & 2 deletions packages/main/test/pages/Carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@
</ui5-carousel>
<ui5-input id="visible-items" value="0"></ui5-input>

<ui5-title class="carousel2auto">Carousel with Numeric style page indicator</ui5-title>
<ui5-carousel id="carouselNumericPageIndicator" page-indicator-style="Numeric">
<ui5-title class="carousel2auto">Carousel with Numeric type page indicator</ui5-title>
<ui5-carousel id="carouselNumericPageIndicator" page-indicator-type="Numeric">
<ui5-button>Button 1</ui5-button>
<ui5-button>Button 2</ui5-button>
</ui5-carousel>
Expand Down
2 changes: 1 addition & 1 deletion packages/main/test/specs/Carousel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe("Carousel general interaction", () => {
assert.strictEqual(await eventCounter.getProperty("value"), "6", "The navigate event is not fired as no previous item.");
});

it("page-indicator-style property", async () => {
it("page-indicator-type property", async () => {
const carousel = await browser.$("#carouselNumericPageIndicator");
await carousel.scrollIntoView();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Template: UI5StoryArgs<Carousel, StoryArgsSlots> = (args) => {
items-per-page-l="${ifDefined(args.itemsPerPageL)}"
?hide-navigation-arrows="${ifDefined(args.hideNavigationArrows)}"
?hide-page-indicator="${ifDefined(args.hidePageIndicator)}"
page-indicator-style="${ifDefined(args.pageIndicatorStyle)}"
page-indicator-type="${ifDefined(args.pageIndicatorType)}"
arrows-placement="${ifDefined(args.arrowsPlacement)}"
>
${unsafeHTML(args.default)}
Expand Down
8 changes: 4 additions & 4 deletions packages/website/docs/_components_pages/main/Carousel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ When the first page is reached, pressing "Backward" will navigate to the last pa
<Cyclic />

### Arrows Placement
When **pageIndicatorStyle** is set to **"Content"**, the arrows are placed on the sides of the current page.
When **pageIndicatorStyle** is set to **"Navigation"**, the arrows are placed on the sides of the page indicator.
When **arrowsPlacement** is set to **"Content"**, the arrows are placed on the sides of the current page.
When **arrowsPlacement** is set to **"Navigation"**, the arrows are placed on the sides of the page indicator.

<ArrowsPlacement />

### Page Indicator
When **pageIndicatorStyle** is set to **"Default"**, the page indicator appear as dots.
When **pageIndicatorStyle** is set to **"Numeric"** - as numbers.
When **pageIndicatorType** is set to **"Default"**, the page indicator appear as dots.
When **pageIndicatorType** is set to **"Numeric"** - as numbers.

<PageIndicatorType />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body style="background-color: var(--sapBackgroundColor)">
<!-- playground-fold-end -->

<ui5-carousel page-indicator-style="Numeric">
<ui5-carousel page-indicator-type="Numeric">
<img src="../assets/images/sample1.jpg" alt="Landscape 1">
<img src="../assets/images/sample2.jpg" alt="Landscape 2">
<img src="../assets/images/sample3.jpg" alt="Bulb">
Expand Down

0 comments on commit a3aa04e

Please sign in to comment.