@sapudex/web-components 2.46.0 → 2.48.0

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.
Files changed (157) hide show
  1. package/cypress/specs/DatePicker.cy.tsx +62 -0
  2. package/cypress/specs/Tag.cy.tsx +34 -3
  3. package/cypress/specs/TextField.cy.tsx +68 -0
  4. package/dist/Carousel.d.ts +48 -3
  5. package/dist/Carousel.js +149 -7
  6. package/dist/Carousel.js.map +1 -1
  7. package/dist/CarouselTemplate.js +9 -2
  8. package/dist/CarouselTemplate.js.map +1 -1
  9. package/dist/DatePicker.d.ts +5 -0
  10. package/dist/DatePicker.js +10 -0
  11. package/dist/DatePicker.js.map +1 -1
  12. package/dist/DatePickerTemplate.js +1 -1
  13. package/dist/DatePickerTemplate.js.map +1 -1
  14. package/dist/MastheadItem.d.ts +7 -4
  15. package/dist/MastheadItem.js +6 -17
  16. package/dist/MastheadItem.js.map +1 -1
  17. package/dist/Tag.js +3 -2
  18. package/dist/Tag.js.map +1 -1
  19. package/dist/TagTemplate.js +2 -2
  20. package/dist/TagTemplate.js.map +1 -1
  21. package/dist/TextField.d.ts +12 -0
  22. package/dist/TextField.js +15 -0
  23. package/dist/TextField.js.map +1 -1
  24. package/dist/TextFieldTemplate.js +1 -1
  25. package/dist/TextFieldTemplate.js.map +1 -1
  26. package/dist/assets/{InputSuggestions-BwpJ8Exf.js → InputSuggestions-BcK6O4Bk.js} +1 -1
  27. package/dist/assets/{ListItemStandardExpandableTextTemplate-7iRPZq6L.js → ListItemStandardExpandableTextTemplate-u600dmHC.js} +1 -1
  28. package/dist/assets/{bundle.esm-BbkM4Bz9.js → bundle.esm-C6Ie2WeI.js} +230 -230
  29. package/dist/assets/messagebundle_en-DoNTK1BE.js +1 -0
  30. package/dist/assets/messagebundle_pl-CsXeN1y6.js +1 -0
  31. package/dist/assets/messagebundle_pt_PT-CQ5YAsmx.js +1 -0
  32. package/dist/css/themes/Badge.css +1 -1
  33. package/dist/css/themes/Carousel.css +1 -1
  34. package/dist/css/themes/ListItem.css +1 -1
  35. package/dist/css/themes/MastheadCountrySelector.css +1 -1
  36. package/dist/css/themes/MastheadItem.css +1 -1
  37. package/dist/css/themes/MastheadMenu.css +1 -1
  38. package/dist/css/themes/MastheadMobileMenu.css +1 -1
  39. package/dist/css/themes/MastheadProfileMenu.css +1 -1
  40. package/dist/css/themes/Table.css +1 -1
  41. package/dist/css/themes/TableCell.css +1 -1
  42. package/dist/css/themes/TableGroupRow.css +1 -1
  43. package/dist/css/themes/TableHeaderCell.css +1 -1
  44. package/dist/css/themes/Tag.css +1 -1
  45. package/dist/css/themes/Wizard.css +1 -1
  46. package/dist/css/themes/WizardTab.css +1 -1
  47. package/dist/custom-elements-internal.json +104 -0
  48. package/dist/custom-elements.json +90 -0
  49. package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
  50. package/dist/generated/assets/i18n/messagebundle_pl.json +1 -1
  51. package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -1
  52. package/dist/generated/i18n/i18n-defaults.d.ts +3 -1
  53. package/dist/generated/i18n/i18n-defaults.js +3 -1
  54. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  55. package/dist/generated/templates/MastheadItemTemplate.lit.js +29 -26
  56. package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
  57. package/dist/generated/themes/Badge.css.d.ts +1 -1
  58. package/dist/generated/themes/Badge.css.js +1 -1
  59. package/dist/generated/themes/Badge.css.js.map +1 -1
  60. package/dist/generated/themes/Carousel.css.d.ts +1 -1
  61. package/dist/generated/themes/Carousel.css.js +1 -1
  62. package/dist/generated/themes/Carousel.css.js.map +1 -1
  63. package/dist/generated/themes/ListItem.css.d.ts +1 -1
  64. package/dist/generated/themes/ListItem.css.js +1 -1
  65. package/dist/generated/themes/ListItem.css.js.map +1 -1
  66. package/dist/generated/themes/MastheadCountrySelector.css.d.ts +1 -1
  67. package/dist/generated/themes/MastheadCountrySelector.css.js +1 -1
  68. package/dist/generated/themes/MastheadCountrySelector.css.js.map +1 -1
  69. package/dist/generated/themes/MastheadItem.css.d.ts +1 -1
  70. package/dist/generated/themes/MastheadItem.css.js +1 -1
  71. package/dist/generated/themes/MastheadItem.css.js.map +1 -1
  72. package/dist/generated/themes/MastheadMenu.css.d.ts +1 -1
  73. package/dist/generated/themes/MastheadMenu.css.js +1 -1
  74. package/dist/generated/themes/MastheadMenu.css.js.map +1 -1
  75. package/dist/generated/themes/MastheadMobileMenu.css.d.ts +1 -1
  76. package/dist/generated/themes/MastheadMobileMenu.css.js +1 -1
  77. package/dist/generated/themes/MastheadMobileMenu.css.js.map +1 -1
  78. package/dist/generated/themes/MastheadProfileMenu.css.d.ts +1 -1
  79. package/dist/generated/themes/MastheadProfileMenu.css.js +1 -1
  80. package/dist/generated/themes/MastheadProfileMenu.css.js.map +1 -1
  81. package/dist/generated/themes/Table.css.d.ts +1 -1
  82. package/dist/generated/themes/Table.css.js +1 -1
  83. package/dist/generated/themes/Table.css.js.map +1 -1
  84. package/dist/generated/themes/TableCell.css.d.ts +1 -1
  85. package/dist/generated/themes/TableCell.css.js +1 -1
  86. package/dist/generated/themes/TableCell.css.js.map +1 -1
  87. package/dist/generated/themes/TableGroupRow.css.d.ts +1 -1
  88. package/dist/generated/themes/TableGroupRow.css.js +1 -1
  89. package/dist/generated/themes/TableGroupRow.css.js.map +1 -1
  90. package/dist/generated/themes/TableHeaderCell.css.d.ts +1 -1
  91. package/dist/generated/themes/TableHeaderCell.css.js +1 -1
  92. package/dist/generated/themes/TableHeaderCell.css.js.map +1 -1
  93. package/dist/generated/themes/Tag.css.d.ts +1 -1
  94. package/dist/generated/themes/Tag.css.js +1 -1
  95. package/dist/generated/themes/Tag.css.js.map +1 -1
  96. package/dist/generated/themes/Wizard.css.d.ts +1 -1
  97. package/dist/generated/themes/Wizard.css.js +1 -1
  98. package/dist/generated/themes/Wizard.css.js.map +1 -1
  99. package/dist/generated/themes/WizardTab.css.d.ts +1 -1
  100. package/dist/generated/themes/WizardTab.css.js +1 -1
  101. package/dist/generated/themes/WizardTab.css.js.map +1 -1
  102. package/dist/messagebundle.properties +3 -0
  103. package/dist/messagebundle_en.properties +2 -0
  104. package/dist/messagebundle_pl.properties +134 -1
  105. package/dist/messagebundle_pt_PT.properties +126 -1
  106. package/dist/vscode.html-custom-data.json +21 -1
  107. package/dist/web-types.json +50 -2
  108. package/package.json +1 -1
  109. package/src/Carousel.ts +180 -9
  110. package/src/CarouselTemplate.tsx +66 -27
  111. package/src/DatePicker.ts +9 -0
  112. package/src/DatePickerTemplate.tsx +2 -1
  113. package/src/MastheadItem.hbs +15 -0
  114. package/src/MastheadItem.ts +12 -21
  115. package/src/Tag.ts +3 -2
  116. package/src/TagTemplate.tsx +2 -0
  117. package/src/TextField.ts +26 -1
  118. package/src/TextFieldTemplate.tsx +1 -0
  119. package/src/generated/i18n/i18n-defaults.ts +2 -2
  120. package/src/generated/templates/MastheadItemTemplate.lit.ts +29 -26
  121. package/src/generated/themes/Badge.css.ts +1 -1
  122. package/src/generated/themes/Carousel.css.ts +1 -1
  123. package/src/generated/themes/ListItem.css.ts +1 -1
  124. package/src/generated/themes/MastheadCountrySelector.css.ts +1 -1
  125. package/src/generated/themes/MastheadItem.css.ts +1 -1
  126. package/src/generated/themes/MastheadMenu.css.ts +1 -1
  127. package/src/generated/themes/MastheadMobileMenu.css.ts +1 -1
  128. package/src/generated/themes/MastheadProfileMenu.css.ts +1 -1
  129. package/src/generated/themes/Table.css.ts +1 -1
  130. package/src/generated/themes/TableCell.css.ts +1 -1
  131. package/src/generated/themes/TableGroupRow.css.ts +1 -1
  132. package/src/generated/themes/TableHeaderCell.css.ts +1 -1
  133. package/src/generated/themes/Tag.css.ts +1 -1
  134. package/src/generated/themes/Wizard.css.ts +1 -1
  135. package/src/generated/themes/WizardTab.css.ts +1 -1
  136. package/src/i18n/messagebundle.properties +3 -0
  137. package/src/i18n/messagebundle_en.properties +2 -0
  138. package/src/i18n/messagebundle_pl.properties +134 -1
  139. package/src/i18n/messagebundle_pt_PT.properties +126 -1
  140. package/src/themes/Badge.css +3 -0
  141. package/src/themes/Carousel.css +20 -8
  142. package/src/themes/ListItem.css +3 -0
  143. package/src/themes/MastheadCountrySelector.css +4 -9
  144. package/src/themes/MastheadItem.css +45 -25
  145. package/src/themes/MastheadMenu.css +0 -2
  146. package/src/themes/MastheadMobileMenu.css +12 -0
  147. package/src/themes/MastheadProfileMenu.css +0 -15
  148. package/src/themes/Table.css +1 -1
  149. package/src/themes/TableCell.css +3 -3
  150. package/src/themes/TableGroupRow.css +1 -1
  151. package/src/themes/TableHeaderCell.css +3 -4
  152. package/src/themes/Tag.css +24 -0
  153. package/src/themes/Wizard.css +1 -0
  154. package/src/themes/WizardTab.css +16 -7
  155. package/dist/assets/messagebundle_en-BZqDcZHN.js +0 -1
  156. package/dist/assets/messagebundle_pl-BmaELnDD.js +0 -1
  157. package/dist/assets/messagebundle_pt_PT-DcVh6BH6.js +0 -1
@@ -191,6 +191,68 @@ describe("Date Picker", () => {
191
191
  });
192
192
  });
193
193
 
194
+ describe("calendar icon aria-haspopup / aria-expanded (a11y)", () => {
195
+ // Updated: accessibility fix moved aria-haspopup/aria-expanded off the input and onto the
196
+ // calendar icon *button*. DatePicker's template passes `_icon-aria-has-popup="grid"` and
197
+ // `_icon-aria-expanded={this._isPopoverOpen ? "true" : "false"}` to the inner UDExTextField.
198
+ // TextField exposes these as the private string props `_iconAriaHasPopup` / `_iconAriaExpanded`,
199
+ // whose `iconAccessibilityAttributes` getter forwards a ButtonAccessibilityAttributes object to
200
+ // the UDExControlButton (a UI5 Button), whose shadow `.ui5-button-root` renders aria-haspopup /
201
+ // aria-expanded. `_isPopoverOpen` (toggled in _afterDropdownOpen/_afterDropdownClose) drives expanded.
202
+ // The previous object-based `_calendarIconAccessibilityAttributes` / `_icon-accessibility-attributes`
203
+ // forwarding no longer exists.
204
+ // Traversal: [udex-date-picker] -> shadow -> [udex-text-field] -> shadow ->
205
+ // [udex-control-button] -> shadow -> .ui5-button-root
206
+
207
+ const buttonRoot = () =>
208
+ cy
209
+ .get("#a11yDatePicker")
210
+ .shadow()
211
+ .find("[udex-text-field]")
212
+ .shadow()
213
+ .find("[udex-control-button]")
214
+ .shadow()
215
+ .find(".ui5-button-root");
216
+
217
+ const nativeInput = () =>
218
+ cy
219
+ .get("#a11yDatePicker")
220
+ .shadow()
221
+ .find("[udex-text-field]")
222
+ .shadow()
223
+ .find("input");
224
+
225
+ beforeEach(() => {
226
+ cy.mount(<UDExDatePicker id="a11yDatePicker" label="Date"></UDExDatePicker>);
227
+ });
228
+
229
+ it("sets aria-haspopup=\"grid\" on the calendar icon button", () => {
230
+ buttonRoot().should("have.attr", "aria-haspopup", "grid");
231
+ });
232
+
233
+ it("does NOT set aria-haspopup on the native input", () => {
234
+ // The accessibility fix removed aria-haspopup from the input entirely.
235
+ nativeInput().should("not.have.attr", "aria-haspopup");
236
+ });
237
+
238
+ it("sets aria-expanded=\"false\" on the calendar icon button when the popover is closed", () => {
239
+ buttonRoot().should("have.attr", "aria-expanded", "false");
240
+ });
241
+
242
+ it("sets aria-expanded=\"true\" on the calendar icon button after opening the calendar", () => {
243
+ // Click the icon button to open the calendar popover; `_isPopoverOpen` flips true
244
+ // in `_afterDropdownOpen`, which re-renders the button with aria-expanded="true".
245
+ cy.get("#a11yDatePicker")
246
+ .shadow()
247
+ .find("[udex-text-field]")
248
+ .shadow()
249
+ .find("[udex-control-button]")
250
+ .click();
251
+
252
+ buttonRoot().should("have.attr", "aria-expanded", "true");
253
+ });
254
+ });
255
+
194
256
  describe("calendar timestamp navigation", () => {
195
257
  // Regression coverage for the fix that forwards `_calendarTimestamp` to the inner
196
258
  // `udex-calendar`. UI5's Calendar guards `timestamp` behind an internal
@@ -10,10 +10,11 @@ const outlineTag =<UDExTag id="tag-outlined" text="Outlined" design="Outlined"><
10
10
  const iconTag = <UDExTag id="tag-icon" text="Tag text" icon="decline"></UDExTag>
11
11
  const startIconTag = <UDExTag id="tag-icon-start" text="Tag text" icon="decline" iconPlacement="Start"></UDExTag>
12
12
  const readonlyTag = <UDExTag id="tag-readonly" text="Tag text" icon="accept" readOnly></UDExTag>
13
+ const readonlyNoIconTag = <UDExTag id="tag-readonly-no-icon" text="Tag text" readOnly></UDExTag>
13
14
  const nonselectableTag = <UDExTag id="tag-nonselectable" text="Non selectable" non-selectable></UDExTag>
14
15
  const nonselectableIconTag = <UDExTag id="tag-nonselectable-icon" text="Non selectable" icon="decline" non-selectable></UDExTag>
15
16
  const linkTag = <UDExTag id="tag-link" text="SAP home page" href="https://sap.com"></UDExTag>
16
- const nonInteractiveTag = <UDExTag id="tag-nonselectable" text="Non selectable" icon="decline" non-interactive></UDExTag>
17
+ const nonInteractiveTag = <UDExTag id="tag-noninteractive" text="Non selectable" icon="decline" non-interactive></UDExTag>
17
18
 
18
19
  describe("Tag", () => {
19
20
  it("is rendered", () => {
@@ -118,8 +119,38 @@ describe("Tag", () => {
118
119
 
119
120
  it("icon is not focusable when non-interactive attribute is set", () => {
120
121
  cy.mount(nonInteractiveTag)
121
- cy.get("#tag-nonselectable").shadow().find(".udex-tag__icon").should("have.attr", "mode", "Decorative")
122
- });
122
+ cy.get("#tag-noninteractive").shadow().find(".udex-tag__icon").should("have.attr", "mode", "Decorative")
123
+ });
124
+
125
+ it("non-interactive tag renders with udex-tag--noninteractive class", () => {
126
+ cy.mount(nonInteractiveTag)
127
+ cy.get("#tag-noninteractive").shadow().find(".udex-tag--noninteractive").should("be.visible")
128
+ });
129
+
130
+ it("non-interactive tag icon has no wrapping button", () => {
131
+ cy.mount(nonInteractiveTag)
132
+ cy.get("#tag-noninteractive").shadow().find(".udex-tag__btn-icon").should("not.exist")
133
+ });
134
+
135
+ it("readonly tag renders the icon inside shadow DOM", () => {
136
+ cy.mount(readonlyTag)
137
+ cy.get("#tag-readonly").shadow().find(".udex-tag__icon").should("be.visible")
138
+ });
139
+
140
+ it("readonly tag icon has no wrapping button", () => {
141
+ cy.mount(readonlyTag)
142
+ cy.get("#tag-readonly").shadow().find(".udex-tag__btn-icon").should("not.exist")
143
+ });
144
+
145
+ it("readonly tag icon is non-interactive (decorative)", () => {
146
+ cy.mount(readonlyTag)
147
+ cy.get("#tag-readonly").shadow().find(".udex-tag__icon").should("have.attr", "mode", "Decorative")
148
+ });
149
+
150
+ it("readonly tag without icon renders no icon", () => {
151
+ cy.mount(readonlyNoIconTag)
152
+ cy.get("#tag-readonly-no-icon").shadow().find(".udex-tag__icon").should("not.exist")
153
+ });
123
154
 
124
155
  it("tests if tag with link is correctly rendered", () => {
125
156
  cy.mount(linkTag)
@@ -262,6 +262,74 @@ describe("Text Field", () => {
262
262
  });
263
263
  });
264
264
 
265
+ describe("icon accessibility attributes (a11y)", () => {
266
+ // Updated: the accessibility fix now uses two private string properties on TextField —
267
+ // `_iconAriaHasPopup` and `_iconAriaExpanded` (both @property type String, reflected as the
268
+ // kebab attributes `_icon-aria-has-popup` / `_icon-aria-expanded`). The `iconAccessibilityAttributes`
269
+ // getter assembles a ButtonAccessibilityAttributes object from them (returning undefined when both
270
+ // are unset) and forwards it to the internal UDExControlButton via `accessibilityAttributes`, so
271
+ // aria-haspopup / aria-expanded land on the icon *button* (its shadow `.ui5-button-root`), not the input.
272
+ // The previous object-based `_iconAccessibilityAttributes` approach no longer exists.
273
+ // Traversal to the button root:
274
+ // [udex-text-field] -> shadow -> [udex-control-button] -> shadow -> .ui5-button-root
275
+
276
+ const controlButtonRoot = (id: string) =>
277
+ cy
278
+ .get(`#${id}`)
279
+ .shadow()
280
+ .find("[udex-control-button]")
281
+ .shadow()
282
+ .find(".ui5-button-root");
283
+
284
+ it("does NOT render aria-haspopup on the native input", () => {
285
+ // The input's aria-haspopup is driven only by `_ariaHasPopup`, which is unset here.
286
+ cy.mount(<UDExTextField id="noHasPopupTextField" icon="appointment-2"></UDExTextField>);
287
+ cy.get("#noHasPopupTextField").shadow().find("input").should("not.have.attr", "aria-haspopup");
288
+ });
289
+
290
+ it("does not forward accessibilityAttributes when neither string prop is set", () => {
291
+ // getter returns undefined => the control button renders no aria-haspopup / aria-expanded.
292
+ cy.mount(<UDExTextField id="noIconA11yTextField" icon="appointment-2"></UDExTextField>);
293
+ controlButtonRoot("noIconA11yTextField").should("not.have.attr", "aria-haspopup");
294
+ controlButtonRoot("noIconA11yTextField").should("not.have.attr", "aria-expanded");
295
+ });
296
+
297
+ it("forwards _iconAriaHasPopup / _iconAriaExpanded to the control button (aria-haspopup / aria-expanded)", () => {
298
+ // Both string props supplied as the reflected kebab attributes on the host.
299
+ cy.mount(
300
+ <UDExTextField
301
+ id="iconA11yTextField"
302
+ icon="appointment-2"
303
+ _icon-aria-has-popup="grid"
304
+ _icon-aria-expanded="false"
305
+ ></UDExTextField>,
306
+ );
307
+
308
+ controlButtonRoot("iconA11yTextField").should("have.attr", "aria-haspopup", "grid");
309
+ controlButtonRoot("iconA11yTextField").should("have.attr", "aria-expanded", "false");
310
+ });
311
+
312
+ it("reflects an updated expanded value onto the control button", () => {
313
+ cy.mount(
314
+ <UDExTextField
315
+ id="iconExpandedTextField"
316
+ icon="appointment-2"
317
+ _icon-aria-has-popup="grid"
318
+ _icon-aria-expanded="false"
319
+ ></UDExTextField>,
320
+ );
321
+
322
+ controlButtonRoot("iconExpandedTextField").should("have.attr", "aria-expanded", "false");
323
+
324
+ // Flip the reactive string property; the getter re-derives and the button re-renders.
325
+ cy.get("#iconExpandedTextField").then($el => {
326
+ ($el[0] as unknown as { _iconAriaExpanded: string })._iconAriaExpanded = "true";
327
+ });
328
+
329
+ controlButtonRoot("iconExpandedTextField").should("have.attr", "aria-expanded", "true");
330
+ });
331
+ });
332
+
265
333
  describe("with the type Number", () => {
266
334
  beforeEach( () => {
267
335
  cy.mount(numberTextField)
@@ -5,7 +5,6 @@ import type UI5Carousel from "@ui5/webcomponents/dist/Carousel.js";
5
5
  import type { CarouselNavigateEventDetail } from "@ui5/webcomponents/dist/Carousel.js";
6
6
  import type { UI5CustomEvent } from "@ui5/webcomponents-base";
7
7
  import type CarouselPageIndicatorType from "@ui5/webcomponents/dist/types/CarouselPageIndicatorType.js";
8
- import type UDExButton from "./Button.js";
9
8
  export declare enum UDExCarouselNavigationPosition {
10
9
  top = "top",
11
10
  bottom = "bottom"
@@ -14,6 +13,9 @@ export declare enum UDExCarouselButtonDesign {
14
13
  Secondary = "Secondary",
15
14
  Tertiary = "Tertiary"
16
15
  }
16
+ type UDExCarouselAutoplayToggleEventDetails = {
17
+ isPaused: boolean;
18
+ };
17
19
  /**
18
20
  * @class
19
21
  *
@@ -35,6 +37,7 @@ export declare enum UDExCarouselButtonDesign {
35
37
  declare class UDExCarousel extends UI5Element {
36
38
  eventDetails: {
37
39
  "navigate": CarouselNavigateEventDetail;
40
+ "autoplay-toggle-click": UDExCarouselAutoplayToggleEventDetails;
38
41
  };
39
42
  /**
40
43
  * Defines the position of the navigation.
@@ -48,6 +51,30 @@ declare class UDExCarousel extends UI5Element {
48
51
  * @public
49
52
  */
50
53
  navigationPlacement: `${UDExCarouselNavigationPosition}`;
54
+ /**
55
+ * Controls carousel autoplay functionality
56
+ * @public
57
+ * @default undefined
58
+ */
59
+ autoplay?: boolean;
60
+ /**
61
+ * Defines carousel autoplay speed in milliseconds till next slide
62
+ * @public
63
+ */
64
+ autoplaySpeed: number;
65
+ /**
66
+ * Indicates current state of autoplay.
67
+ *
68
+ * @default true
69
+ * @private
70
+ */
71
+ _autoplayIsPaused: boolean;
72
+ /**
73
+ * Defines whether the carousel should loop, i.e show the first page after the last page is reached and vice versa.
74
+ * @public
75
+ * @default false
76
+ */
77
+ cyclic?: boolean;
51
78
  /**
52
79
  * Defines the content of the component.
53
80
  *
@@ -101,9 +128,16 @@ declare class UDExCarousel extends UI5Element {
101
128
  */
102
129
  accessibleName: string;
103
130
  static i18nBundle: I18nBundle;
131
+ _autoplayInterval: ReturnType<typeof setInterval> | null;
132
+ _autoplayLastToggle: number;
133
+ _autoplayMinTimeBetweenToggle: number;
134
+ _autoplayManualStop: boolean;
135
+ _autoplayLoop: () => void;
104
136
  get nextPageText(): string;
105
137
  get previousPageText(): string;
106
138
  get carouselClass(): string;
139
+ get navigationWrapperClass(): string;
140
+ get navigationButtonWrapperClass(): string;
107
141
  get buttonDesign(): UDExCarouselButtonDesign;
108
142
  get showNavigationButtons(): {
109
143
  top: boolean;
@@ -112,11 +146,22 @@ declare class UDExCarousel extends UI5Element {
112
146
  get _hidePageIndicator(): boolean;
113
147
  get _carousel(): UI5Carousel | null;
114
148
  get _ui5CarouselRoot(): HTMLElement | null | undefined;
149
+ _startAutoplay(): void;
150
+ _stopAutoplay(): void;
151
+ _onAutoplayToggleClick(): void;
152
+ get _isBottomNavigation(): boolean;
153
+ get autoplayToggleButtonTooltipText(): string;
154
+ _onFocusIn(): void;
155
+ _onFocusOut(): void;
156
+ _onMouseEnter(): void;
157
+ _onMouseLeave(): void;
115
158
  _calculateDisabledButtonsState(): void;
116
- _prevButtonClick(e: UI5CustomEvent<UDExButton, "click">): void;
117
- _nextButtonClick(e: UI5CustomEvent<UDExButton, "click">): void;
159
+ _prevButtonClick(): void;
160
+ _nextButtonClick(): void;
118
161
  _onkeydown(e: KeyboardEvent): void;
119
162
  _handleNavigate(e: UI5CustomEvent<UI5Carousel, "navigate">): void;
120
163
  onAfterRendering(): void;
164
+ onExitDOM(): void;
121
165
  }
122
166
  export default UDExCarousel;
167
+ export type { CarouselNavigateEventDetail, UDExCarouselAutoplayToggleEventDetails };
package/dist/Carousel.js CHANGED
@@ -13,7 +13,7 @@ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
13
13
  import jsxRenderer from "@ui5/webcomponents-base/renderer/JsxRenderer.js";
14
14
  import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
15
15
  import { isUp, isDown, isRight, isLeft, } from "@ui5/webcomponents-base/dist/Keys.js";
16
- import { CAROUSEL_NEXT_ARROW_TEXT, CAROUSEL_PREVIOUS_ARROW_TEXT } from "./generated/i18n/i18n-defaults.js";
16
+ import { CAROUSEL_NEXT_ARROW_TEXT, CAROUSEL_PREVIOUS_ARROW_TEXT, CAROUSEL_AUTOPLAY_TOGGLE_START, CAROUSEL_AUTOPLAY_TOGGLE_STOP, } from "./generated/i18n/i18n-defaults.js";
17
17
  import redirectAttributes from "./utils/redirectAttributes.js";
18
18
  import translate from "./utils/translate.js";
19
19
  import CarouselTemplate from "./CarouselTemplate.js";
@@ -62,6 +62,18 @@ let UDExCarousel = UDExCarousel_1 = class UDExCarousel extends UI5Element {
62
62
  * @public
63
63
  */
64
64
  this.navigationPlacement = UDExCarouselNavigationPosition.top;
65
+ /**
66
+ * Defines carousel autoplay speed in milliseconds till next slide
67
+ * @public
68
+ */
69
+ this.autoplaySpeed = 2000;
70
+ /**
71
+ * Indicates current state of autoplay.
72
+ *
73
+ * @default true
74
+ * @private
75
+ */
76
+ this._autoplayIsPaused = true;
65
77
  /**
66
78
  * Defines the number of items per page depending on the carousel width.
67
79
  *
@@ -93,6 +105,27 @@ let UDExCarousel = UDExCarousel_1 = class UDExCarousel extends UI5Element {
93
105
  * @public
94
106
  */
95
107
  this.accessibleName = "";
108
+ this._autoplayInterval = null;
109
+ this._autoplayLastToggle = Date.now();
110
+ this._autoplayMinTimeBetweenToggle = 250;
111
+ this._autoplayManualStop = false;
112
+ this._autoplayLoop = () => {
113
+ const items = this._carousel?.items;
114
+ if (!items) {
115
+ return;
116
+ }
117
+ const currentSlide = this._carousel._currentPageIndex;
118
+ const itemsPerPage = this._carousel.effectiveItemsPerPage;
119
+ const isLastSlide = currentSlide === (items.length - itemsPerPage);
120
+ if (isLastSlide && !this.cyclic) {
121
+ this._stopAutoplay();
122
+ this._autoplayManualStop = true;
123
+ return;
124
+ }
125
+ const nextSlide = isLastSlide ? 0 : (currentSlide + itemsPerPage);
126
+ this._carousel?.navigateTo(nextSlide);
127
+ this._calculateDisabledButtonsState();
128
+ };
96
129
  }
97
130
  get nextPageText() {
98
131
  return translate(UDExCarousel_1, CAROUSEL_NEXT_ARROW_TEXT);
@@ -104,6 +137,20 @@ let UDExCarousel = UDExCarousel_1 = class UDExCarousel extends UI5Element {
104
137
  const classes = "udex-carousel";
105
138
  return `${classes} udex-carousel__navigation--${this.navigationPlacement}`;
106
139
  }
140
+ get navigationWrapperClass() {
141
+ let _class = "udex-carousel__navigation-wrapper";
142
+ if (this.autoplay) {
143
+ _class += " udex-carousel__navigation-wrapper--autoplay";
144
+ }
145
+ return _class;
146
+ }
147
+ get navigationButtonWrapperClass() {
148
+ let _class = "udex-carousel__navigation-button-wrapper";
149
+ if (this._carousel?.isPageTypeDots) {
150
+ _class += " udex-carousel__navigation-button-wrapper--dot-indicators";
151
+ }
152
+ return _class;
153
+ }
107
154
  get buttonDesign() {
108
155
  return this.navigationPlacement === UDExCarouselNavigationPosition.top
109
156
  ? UDExCarouselButtonDesign.Secondary
@@ -124,21 +171,88 @@ let UDExCarousel = UDExCarousel_1 = class UDExCarousel extends UI5Element {
124
171
  get _ui5CarouselRoot() {
125
172
  return this._carousel?.shadowRoot?.querySelector(".ui5-carousel-root");
126
173
  }
174
+ _startAutoplay() {
175
+ if (!this.autoplay) {
176
+ return;
177
+ }
178
+ if (!this._carousel?.items) {
179
+ console.warn("[UDExCarousel] Cannot start autoplay on an empty carousel");
180
+ return;
181
+ }
182
+ const toggleBuffer = Date.now() - this._autoplayLastToggle;
183
+ if (this._autoplayInterval !== null && toggleBuffer <= this._autoplayMinTimeBetweenToggle) {
184
+ this._autoplayLastToggle = Date.now();
185
+ return;
186
+ }
187
+ if (this._autoplayInterval !== null) {
188
+ clearInterval(this._autoplayInterval);
189
+ }
190
+ this._autoplayInterval = setInterval(this._autoplayLoop, this.autoplaySpeed);
191
+ this._autoplayIsPaused = false;
192
+ this._autoplayLastToggle = Date.now();
193
+ }
194
+ _stopAutoplay() {
195
+ if (!this._autoplayInterval) {
196
+ return;
197
+ }
198
+ clearInterval(this._autoplayInterval);
199
+ this._autoplayIsPaused = true;
200
+ this._autoplayLastToggle = Date.now();
201
+ }
202
+ _onAutoplayToggleClick() {
203
+ if (this._autoplayIsPaused) {
204
+ this._startAutoplay();
205
+ this._autoplayManualStop = false;
206
+ }
207
+ else {
208
+ this._stopAutoplay();
209
+ this._autoplayManualStop = true;
210
+ }
211
+ this.fireDecoratorEvent("autoplay-toggle-click", {
212
+ isPaused: this._autoplayIsPaused,
213
+ });
214
+ }
215
+ get _isBottomNavigation() {
216
+ return this.navigationPlacement === UDExCarouselNavigationPosition.bottom;
217
+ }
218
+ get autoplayToggleButtonTooltipText() {
219
+ return this._autoplayIsPaused
220
+ ? translate(UDExCarousel_1, CAROUSEL_AUTOPLAY_TOGGLE_START)
221
+ : translate(UDExCarousel_1, CAROUSEL_AUTOPLAY_TOGGLE_STOP);
222
+ }
223
+ _onFocusIn() {
224
+ this._stopAutoplay();
225
+ }
226
+ _onFocusOut() {
227
+ if (!this._autoplayManualStop) {
228
+ this._startAutoplay();
229
+ }
230
+ }
231
+ _onMouseEnter() {
232
+ this._stopAutoplay();
233
+ }
234
+ _onMouseLeave() {
235
+ if (!this._autoplayManualStop) {
236
+ this._startAutoplay();
237
+ }
238
+ }
127
239
  _calculateDisabledButtonsState() {
128
240
  this.isPrevButtonDisabled = !this._carousel?.hasPrev;
129
241
  this.isNextButtonDisabled = !this._carousel?.hasNext;
130
242
  }
131
- _prevButtonClick(e) {
132
- if (this.isPrevButtonDisabled) {
243
+ _prevButtonClick() {
244
+ if (this.isPrevButtonDisabled || !this._carousel) {
133
245
  return;
134
246
  }
135
- this._carousel?._navButtonClick(e);
247
+ this._carousel.navigateLeft();
248
+ this._calculateDisabledButtonsState();
136
249
  }
137
- _nextButtonClick(e) {
138
- if (this.isNextButtonDisabled) {
250
+ _nextButtonClick() {
251
+ if (this.isNextButtonDisabled || !this._carousel) {
139
252
  return;
140
253
  }
141
- this._carousel?._navButtonClick(e);
254
+ this._carousel.navigateRight();
255
+ this._calculateDisabledButtonsState();
142
256
  }
143
257
  _onkeydown(e) {
144
258
  if (isLeft(e) || isDown(e) || isRight(e) || isUp(e)) {
@@ -152,11 +266,31 @@ let UDExCarousel = UDExCarousel_1 = class UDExCarousel extends UI5Element {
152
266
  onAfterRendering() {
153
267
  redirectAttributes(this, "carousel");
154
268
  this._calculateDisabledButtonsState();
269
+ if (this._autoplayInterval === null) {
270
+ this._startAutoplay();
271
+ }
272
+ }
273
+ onExitDOM() {
274
+ if (this._autoplayInterval) {
275
+ clearInterval(this._autoplayInterval);
276
+ }
155
277
  }
156
278
  };
157
279
  __decorate([
158
280
  property()
159
281
  ], UDExCarousel.prototype, "navigationPlacement", void 0);
282
+ __decorate([
283
+ property({ type: Boolean })
284
+ ], UDExCarousel.prototype, "autoplay", void 0);
285
+ __decorate([
286
+ property({ type: Number })
287
+ ], UDExCarousel.prototype, "autoplaySpeed", void 0);
288
+ __decorate([
289
+ property({ type: Boolean })
290
+ ], UDExCarousel.prototype, "_autoplayIsPaused", void 0);
291
+ __decorate([
292
+ property({ type: Boolean })
293
+ ], UDExCarousel.prototype, "cyclic", void 0);
160
294
  __decorate([
161
295
  slot({ "default": true, type: HTMLElement, individualSlots: true })
162
296
  ], UDExCarousel.prototype, "items", void 0);
@@ -192,6 +326,14 @@ UDExCarousel = UDExCarousel_1 = __decorate([
192
326
  */
193
327
  ,
194
328
  event("navigate")
329
+ /**
330
+ * Fired event when the user click on a play/paused button.
331
+ *
332
+ * @public
333
+ * @param {boolean} isPaused - Indicates current state of autoplay
334
+ */
335
+ ,
336
+ event("autoplay-toggle-click", { bubbles: true })
195
337
  ], UDExCarousel);
196
338
  UDExCarousel.define();
197
339
  export default UDExCarousel;
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.js","sourceRoot":"","sources":["../src/Carousel.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO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;IACF,KAAK,CAAC,UAAU,CAAC;GAEZ,YAAY,CAkKjB;AAED,YAAY,CAAC,MAAM,EAAE,CAAC;AAEtB,eAAe,YAAY,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/renderer/JsxRenderer.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n isUp, isDown, isRight, isLeft,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { CAROUSEL_NEXT_ARROW_TEXT, CAROUSEL_PREVIOUS_ARROW_TEXT } from \"./generated/i18n/i18n-defaults.js\";\nimport redirectAttributes from \"./utils/redirectAttributes.js\";\nimport type UI5Carousel from \"@ui5/webcomponents/dist/Carousel.js\";\nimport type { CarouselNavigateEventDetail } from \"@ui5/webcomponents/dist/Carousel.js\";\nimport type { UI5CustomEvent } from \"@ui5/webcomponents-base\";\nimport type Icon from \"@ui5/webcomponents/dist/Icon.js\";\nimport translate from \"./utils/translate.js\";\n\nimport CarouselTemplate from \"./CarouselTemplate.js\";\n\n// Styles\nimport CarouselCss from \"./generated/themes/Carousel.css.js\";\nimport type CarouselPageIndicatorType from \"@ui5/webcomponents/dist/types/CarouselPageIndicatorType.js\";\nimport type UDExButton from \"./Button.js\";\n\nexport enum UDExCarouselNavigationPosition {\n top = \"top\",\n bottom = \"bottom\",\n}\n\nexport enum UDExCarouselButtonDesign {\n Secondary = \"Secondary\",\n Tertiary = \"Tertiary\",\n}\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-carousel</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/Carousel.js\";</code>\n *\n * @constructor\n * @extends UI5Element\n * @tagname udex-carousel\n * @public\n */\n@customElement({\n tag: \"udex-carousel\",\n renderer: jsxRenderer,\n styles: CarouselCss,\n template: CarouselTemplate,\n})\n/**\n * Triggered when carousel navigates to a new slide\n * @public\n * @param { CustomEvent }\n */\n@event(\"navigate\")\n\nclass UDExCarousel extends UI5Element {\n eventDetails!: {\n \"navigate\": CarouselNavigateEventDetail,\n };\n /**\n * Defines the position of the navigation.\n * <br><br>\n * Available options are:\n * <ul>\n * <li><code>top</code> - the navigation button are placed above the component.</li>\n * <li><code>bottom</code> - the navigation button arrows are placed below the component.</li>\n * </ul>\n *\n * @public\n */\n @property()\n navigationPlacement: `${UDExCarouselNavigationPosition}` = UDExCarouselNavigationPosition.top;\n\n /**\n * Defines the content of the component.\n *\n * @slot\n * @public\n */\n @slot({ \"default\": true, type: HTMLElement, individualSlots: true })\n items!: DefaultSlot<HTMLElement>;\n\n /**\n * Defines the number of items per page depending on the carousel width.\n *\n * - 'S' for screens smaller than 600 pixels.\n * - 'M' for screens greater than or equal to 600 pixels and smaller than 1024 pixels.\n * - 'L' for screens greater than or equal to 1024 pixels and smaller than 1440 pixels.\n * - 'XL' for screens greater than or equal to 1440 pixels.\n *\n * One item per page is shown by default.\n * @default \"S1 M1 L1 XL1\"\n * @public\n */\n @property()\n itemsPerPage = \"S1 M1 L1 XL1\";\n\n /**\n * Defines the style of the page indicator.\n * Available options are:\n *\n * - `Default` - 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)\n * - `Numeric` - The page indicator will display the current page and the total number of pages. (e.g. X of Y)\n * @since 1.10\n * @default \"Default\"\n * @public\n */\n @property()\n pageIndicatorType: `${CarouselPageIndicatorType}` = \"Default\";\n\n /**\n * Defines the prev button is disabled\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isPrevButtonDisabled!: boolean;\n\n /**\n * Defines the next button is disabled\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isNextButtonDisabled!: boolean;\n\n /**\n * Defines the accessible ARIA name of the component.\n *\n * @default ''\n * @public\n */\n @property({ type: String })\n accessibleName: string = \"\";\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n get nextPageText(): string {\n return translate(UDExCarousel, CAROUSEL_NEXT_ARROW_TEXT);\n }\n\n get previousPageText(): string {\n return translate(UDExCarousel, CAROUSEL_PREVIOUS_ARROW_TEXT);\n }\n\n get carouselClass(): string {\n const classes = \"udex-carousel\";\n\n return `${classes} udex-carousel__navigation--${this.navigationPlacement}`;\n }\n\n get buttonDesign(): UDExCarouselButtonDesign {\n return this.navigationPlacement === UDExCarouselNavigationPosition.top\n ? UDExCarouselButtonDesign.Secondary\n : UDExCarouselButtonDesign.Tertiary;\n }\n\n get showNavigationButtons(): { top: boolean; bottom: boolean } {\n return {\n top: this.navigationPlacement === UDExCarouselNavigationPosition.top,\n bottom: this.navigationPlacement === UDExCarouselNavigationPosition.bottom,\n };\n }\n\n get _hidePageIndicator(): boolean {\n return this.navigationPlacement === UDExCarouselNavigationPosition.top;\n }\n\n get _carousel(): UI5Carousel | null {\n return this.shadowRoot!.querySelector<UI5Carousel>(\"[ui5-carousel]\");\n }\n\n get _ui5CarouselRoot(): HTMLElement | null | undefined {\n return this._carousel?.shadowRoot?.querySelector(\".ui5-carousel-root\");\n }\n\n _calculateDisabledButtonsState() {\n this.isPrevButtonDisabled = !this._carousel?.hasPrev;\n this.isNextButtonDisabled = !this._carousel?.hasNext;\n }\n\n _prevButtonClick(e: UI5CustomEvent<UDExButton, \"click\">) {\n if (this.isPrevButtonDisabled) {\n return;\n }\n\n this._carousel?._navButtonClick(e as unknown as UI5CustomEvent<Icon, \"click\">);\n }\n\n _nextButtonClick(e: UI5CustomEvent<UDExButton, \"click\">) {\n if (this.isNextButtonDisabled) {\n return;\n }\n\n this._carousel?._navButtonClick(e as unknown as UI5CustomEvent<Icon, \"click\">);\n }\n\n _onkeydown(e: KeyboardEvent) {\n if (isLeft(e) || isDown(e) || isRight(e) || isUp(e)) {\n this._calculateDisabledButtonsState();\n }\n }\n\n _handleNavigate(e: UI5CustomEvent<UI5Carousel, \"navigate\">): void {\n this._calculateDisabledButtonsState();\n\n this.fireDecoratorEvent(\"navigate\", e.detail);\n }\n\n onAfterRendering() {\n redirectAttributes(this, \"carousel\");\n\n this._calculateDisabledButtonsState();\n }\n}\n\nUDExCarousel.define();\n\nexport default UDExCarousel;\n"]}
1
+ {"version":3,"file":"Carousel.js","sourceRoot":"","sources":["../src/Carousel.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAC1E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,EACL,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAC9B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAI/D,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAE7C,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAErD,SAAS;AACT,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAG7D,MAAM,CAAN,IAAY,8BAGX;AAHD,WAAY,8BAA8B;I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TjB;AAED,YAAY,CAAC,MAAM,EAAE,CAAC;AAEtB,eAAe,YAAY,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/renderer/JsxRenderer.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n isUp, isDown, isRight, isLeft,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport {\n CAROUSEL_NEXT_ARROW_TEXT,\n CAROUSEL_PREVIOUS_ARROW_TEXT,\n CAROUSEL_AUTOPLAY_TOGGLE_START,\n CAROUSEL_AUTOPLAY_TOGGLE_STOP,\n} from \"./generated/i18n/i18n-defaults.js\";\nimport redirectAttributes from \"./utils/redirectAttributes.js\";\nimport type UI5Carousel from \"@ui5/webcomponents/dist/Carousel.js\";\nimport type { CarouselNavigateEventDetail } from \"@ui5/webcomponents/dist/Carousel.js\";\nimport type { UI5CustomEvent } from \"@ui5/webcomponents-base\";\nimport translate from \"./utils/translate.js\";\n\nimport CarouselTemplate from \"./CarouselTemplate.js\";\n\n// Styles\nimport CarouselCss from \"./generated/themes/Carousel.css.js\";\nimport type CarouselPageIndicatorType from \"@ui5/webcomponents/dist/types/CarouselPageIndicatorType.js\";\n\nexport enum UDExCarouselNavigationPosition {\n top = \"top\",\n bottom = \"bottom\",\n}\n\nexport enum UDExCarouselButtonDesign {\n Secondary = \"Secondary\",\n Tertiary = \"Tertiary\",\n}\n\ntype UDExCarouselAutoplayToggleEventDetails = {\n isPaused: boolean;\n}\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-carousel</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/Carousel.js\";</code>\n *\n * @constructor\n * @extends UI5Element\n * @tagname udex-carousel\n * @public\n */\n@customElement({\n tag: \"udex-carousel\",\n renderer: jsxRenderer,\n styles: CarouselCss,\n template: CarouselTemplate,\n})\n/**\n * Triggered when carousel navigates to a new slide\n * @public\n * @param { CustomEvent }\n */\n@event(\"navigate\")\n/**\n * Fired event when the user click on a play/paused button.\n *\n * @public\n * @param {boolean} isPaused - Indicates current state of autoplay\n */\n@event(\"autoplay-toggle-click\", { bubbles: true })\n\nclass UDExCarousel extends UI5Element {\n eventDetails!: {\n \"navigate\": CarouselNavigateEventDetail,\n \"autoplay-toggle-click\": UDExCarouselAutoplayToggleEventDetails,\n };\n /**\n * Defines the position of the navigation.\n * <br><br>\n * Available options are:\n * <ul>\n * <li><code>top</code> - the navigation button are placed above the component.</li>\n * <li><code>bottom</code> - the navigation button arrows are placed below the component.</li>\n * </ul>\n *\n * @public\n */\n @property()\n navigationPlacement: `${UDExCarouselNavigationPosition}` = UDExCarouselNavigationPosition.top;\n /**\n * Controls carousel autoplay functionality\n * @public\n * @default undefined\n */\n @property({ type: Boolean })\n autoplay?: boolean;\n\n /**\n * Defines carousel autoplay speed in milliseconds till next slide\n * @public\n */\n @property({ type: Number })\n autoplaySpeed: number = 2000;\n\n /**\n * Indicates current state of autoplay.\n *\n * @default true\n * @private\n */\n @property({ type: Boolean })\n _autoplayIsPaused = true;\n\n /**\n * Defines whether the carousel should loop, i.e show the first page after the last page is reached and vice versa.\n * @public\n * @default false\n */\n @property({ type: Boolean })\n cyclic?: boolean;\n\n /**\n * Defines the content of the component.\n *\n * @slot\n * @public\n */\n @slot({ \"default\": true, type: HTMLElement, individualSlots: true })\n items!: DefaultSlot<HTMLElement>;\n\n /**\n * Defines the number of items per page depending on the carousel width.\n *\n * - 'S' for screens smaller than 600 pixels.\n * - 'M' for screens greater than or equal to 600 pixels and smaller than 1024 pixels.\n * - 'L' for screens greater than or equal to 1024 pixels and smaller than 1440 pixels.\n * - 'XL' for screens greater than or equal to 1440 pixels.\n *\n * One item per page is shown by default.\n * @default \"S1 M1 L1 XL1\"\n * @public\n */\n @property()\n itemsPerPage = \"S1 M1 L1 XL1\";\n\n /**\n * Defines the style of the page indicator.\n * Available options are:\n *\n * - `Default` - 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)\n * - `Numeric` - The page indicator will display the current page and the total number of pages. (e.g. X of Y)\n * @since 1.10\n * @default \"Default\"\n * @public\n */\n @property()\n pageIndicatorType: `${CarouselPageIndicatorType}` = \"Default\";\n\n /**\n * Defines the prev button is disabled\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isPrevButtonDisabled!: boolean;\n\n /**\n * Defines the next button is disabled\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isNextButtonDisabled!: boolean;\n\n /**\n * Defines the accessible ARIA name of the component.\n *\n * @default ''\n * @public\n */\n @property({ type: String })\n accessibleName: string = \"\";\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n _autoplayInterval: ReturnType<typeof setInterval> | null = null;\n _autoplayLastToggle = Date.now();\n _autoplayMinTimeBetweenToggle = 250;\n _autoplayManualStop = false;\n _autoplayLoop = () => {\n const items = this._carousel?.items;\n if (!items) { return; }\n\n const currentSlide = this._carousel._currentPageIndex;\n const itemsPerPage = this._carousel.effectiveItemsPerPage;\n const isLastSlide = currentSlide === (items.length - itemsPerPage);\n\n if (isLastSlide && !this.cyclic) {\n this._stopAutoplay();\n this._autoplayManualStop = true;\n\n return;\n }\n\n const nextSlide = isLastSlide ? 0 : (currentSlide + itemsPerPage);\n\n this._carousel?.navigateTo(nextSlide);\n this._calculateDisabledButtonsState();\n };\n\n get nextPageText(): string {\n return translate(UDExCarousel, CAROUSEL_NEXT_ARROW_TEXT);\n }\n\n get previousPageText(): string {\n return translate(UDExCarousel, CAROUSEL_PREVIOUS_ARROW_TEXT);\n }\n\n get carouselClass(): string {\n const classes = \"udex-carousel\";\n\n return `${classes} udex-carousel__navigation--${this.navigationPlacement}`;\n }\n\n get navigationWrapperClass(): string {\n let _class = \"udex-carousel__navigation-wrapper\";\n\n if (this.autoplay) {\n _class += \" udex-carousel__navigation-wrapper--autoplay\";\n }\n\n return _class;\n }\n\n get navigationButtonWrapperClass(): string {\n let _class = \"udex-carousel__navigation-button-wrapper\";\n\n if (this._carousel?.isPageTypeDots) {\n _class += \" udex-carousel__navigation-button-wrapper--dot-indicators\";\n }\n\n return _class;\n }\n\n get buttonDesign(): UDExCarouselButtonDesign {\n return this.navigationPlacement === UDExCarouselNavigationPosition.top\n ? UDExCarouselButtonDesign.Secondary\n : UDExCarouselButtonDesign.Tertiary;\n }\n\n get showNavigationButtons(): { top: boolean; bottom: boolean } {\n return {\n top: this.navigationPlacement === UDExCarouselNavigationPosition.top,\n bottom: this.navigationPlacement === UDExCarouselNavigationPosition.bottom,\n };\n }\n\n get _hidePageIndicator(): boolean {\n return this.navigationPlacement === UDExCarouselNavigationPosition.top;\n }\n\n get _carousel(): UI5Carousel | null {\n return this.shadowRoot!.querySelector<UI5Carousel>(\"[ui5-carousel]\");\n }\n\n get _ui5CarouselRoot(): HTMLElement | null | undefined {\n return this._carousel?.shadowRoot?.querySelector(\".ui5-carousel-root\");\n }\n\n _startAutoplay(): void {\n if (!this.autoplay) { return; }\n\n if (!this._carousel?.items) {\n console.warn(\"[UDExCarousel] Cannot start autoplay on an empty carousel\");\n return;\n }\n\n const toggleBuffer = Date.now() - this._autoplayLastToggle;\n if (this._autoplayInterval !== null && toggleBuffer <= this._autoplayMinTimeBetweenToggle) {\n this._autoplayLastToggle = Date.now();\n return;\n }\n\n if (this._autoplayInterval !== null) {\n clearInterval(this._autoplayInterval);\n }\n\n this._autoplayInterval = setInterval(this._autoplayLoop, this.autoplaySpeed);\n this._autoplayIsPaused = false;\n this._autoplayLastToggle = Date.now();\n }\n\n _stopAutoplay(): void {\n if (!this._autoplayInterval) { return; }\n\n clearInterval(this._autoplayInterval);\n this._autoplayIsPaused = true;\n this._autoplayLastToggle = Date.now();\n }\n\n _onAutoplayToggleClick(): void {\n if (this._autoplayIsPaused) {\n this._startAutoplay();\n this._autoplayManualStop = false;\n } else {\n this._stopAutoplay();\n this._autoplayManualStop = true;\n }\n\n this.fireDecoratorEvent(\"autoplay-toggle-click\", {\n isPaused: this._autoplayIsPaused,\n });\n }\n\n get _isBottomNavigation(): boolean {\n return this.navigationPlacement === UDExCarouselNavigationPosition.bottom;\n }\n\n get autoplayToggleButtonTooltipText(): string {\n return this._autoplayIsPaused\n ? translate(UDExCarousel, CAROUSEL_AUTOPLAY_TOGGLE_START)\n : translate(UDExCarousel, CAROUSEL_AUTOPLAY_TOGGLE_STOP);\n }\n\n _onFocusIn(): void {\n this._stopAutoplay();\n }\n\n _onFocusOut(): void {\n if (!this._autoplayManualStop) { this._startAutoplay(); }\n }\n\n _onMouseEnter(): void {\n this._stopAutoplay();\n }\n\n _onMouseLeave(): void {\n if (!this._autoplayManualStop) { this._startAutoplay(); }\n }\n\n _calculateDisabledButtonsState() {\n this.isPrevButtonDisabled = !this._carousel?.hasPrev;\n this.isNextButtonDisabled = !this._carousel?.hasNext;\n }\n\n _prevButtonClick() {\n if (this.isPrevButtonDisabled || !this._carousel) {\n return;\n }\n\n this._carousel.navigateLeft();\n this._calculateDisabledButtonsState();\n }\n\n _nextButtonClick() {\n if (this.isNextButtonDisabled || !this._carousel) {\n return;\n }\n\n this._carousel.navigateRight();\n this._calculateDisabledButtonsState();\n }\n\n _onkeydown(e: KeyboardEvent) {\n if (isLeft(e) || isDown(e) || isRight(e) || isUp(e)) {\n this._calculateDisabledButtonsState();\n }\n }\n\n _handleNavigate(e: UI5CustomEvent<UI5Carousel, \"navigate\">): void {\n this._calculateDisabledButtonsState();\n\n this.fireDecoratorEvent(\"navigate\", e.detail);\n }\n\n onAfterRendering() {\n redirectAttributes(this, \"carousel\");\n\n this._calculateDisabledButtonsState();\n\n if (this._autoplayInterval === null) { this._startAutoplay(); }\n }\n\n onExitDOM(): void {\n if (this._autoplayInterval) { clearInterval(this._autoplayInterval); }\n }\n}\n\nUDExCarousel.define();\n\nexport default UDExCarousel;\nexport type { CarouselNavigateEventDetail, UDExCarouselAutoplayToggleEventDetails };\n"]}
@@ -2,14 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime"
2
2
  import UI5Carousel from "@ui5/webcomponents/dist/Carousel.js";
3
3
  import UDExButton from "./Button.js";
4
4
  import UDExButtonSize from "./types/ButtonSize.js";
5
+ import UDExButtonDesign from "./types/ButtonDesign.js";
5
6
  import CarouselArrowsPlacement from "@ui5/webcomponents/dist/types/CarouselArrowsPlacement.js";
6
7
  import slimArrowLeft from "@ui5/webcomponents-icons/dist/slim-arrow-left.js";
7
8
  import slimArrowRight from "@ui5/webcomponents-icons/dist/slim-arrow-right.js";
9
+ import play from "@ui5/webcomponents-icons/dist/play.js";
10
+ import pause from "@ui5/webcomponents-icons/dist/pause.js";
8
11
  export default function CarouselTemplate() {
9
- return (_jsxs("div", { className: this.carouselClass, onKeyDown: this._onkeydown, children: [this.showNavigationButtons.top && navigation.call(this), _jsx(UI5Carousel, { itemsPerPage: this.itemsPerPage, pageIndicatorType: this.pageIndicatorType, id: "carousel", hideNavigationArrows: true, arrowsPlacement: CarouselArrowsPlacement.Navigation, accessibleName: this.accessibleName, hidePageIndicator: this._hidePageIndicator, onNavigate: this._handleNavigate, children: this.items.map(item => _jsx("slot", { name: item._individualSlot })) }), this.showNavigationButtons.bottom && navigation.call(this)] }));
12
+ return (_jsxs("div", { className: this.carouselClass, onKeyDown: this._onkeydown, children: [this.showNavigationButtons.top && navigation.call(this), _jsx(UI5Carousel, { itemsPerPage: this.itemsPerPage, pageIndicatorType: this.pageIndicatorType, id: "carousel", hideNavigationArrows: true, arrowsPlacement: CarouselArrowsPlacement.Navigation, accessibleName: this.accessibleName, hidePageIndicator: this._hidePageIndicator, onNavigate: this._handleNavigate, onMouseEnter: this._onMouseEnter, onMouseLeave: this._onMouseLeave, onFocusIn: this._onFocusIn, onFocusOut: this._onFocusOut, cyclic: this.cyclic, children: this.items.map(item => _jsx("slot", { name: item._individualSlot })) }), this.showNavigationButtons.bottom && navigation.call(this)] }));
10
13
  }
11
14
  function navigation() {
12
15
  const btnClassName = "udex-carousel__navigation-button";
13
- return (_jsxs("div", { class: "udex-carousel__navigation-wrapper", part: "navigation", children: [_jsx(UDExButton, { "data-ui5-arrow-back": true, size: UDExButtonSize.Large, disabled: this.isPrevButtonDisabled, class: btnClassName, icon: slimArrowLeft, design: this.buttonDesign, tooltip: this.previousPageText, onClick: this._prevButtonClick, part: "prev-button" }), _jsx(UDExButton, { "data-ui5-arrow-forward": true, size: UDExButtonSize.Large, disabled: this.isNextButtonDisabled, class: btnClassName, icon: slimArrowRight, design: this.buttonDesign, tooltip: this.nextPageText, onClick: this._nextButtonClick, part: "next-button" })] }));
16
+ const icon = this._autoplayIsPaused ? play : pause;
17
+ return (_jsxs("div", { className: this.navigationWrapperClass, part: "navigation", children: [this.autoplay &&
18
+ _jsx(UDExButton, { class: `udex-carousel__autoplay-toggle-button`, size: UDExButtonSize.Large, design: UDExButtonDesign.Tertiary, icon: icon, onClick: this._onAutoplayToggleClick, tooltip: this.autoplayToggleButtonTooltipText }), _jsxs("div", { className: this.navigationButtonWrapperClass, children: [_jsx(UDExButton, { "data-ui5-arrow-back": true, size: UDExButtonSize.Large, disabled: this.isPrevButtonDisabled, class: btnClassName, icon: slimArrowLeft, design: this.buttonDesign, tooltip: this.previousPageText, onClick: this._prevButtonClick, part: "prev-button" }), this._isBottomNavigation &&
19
+ _jsx("div", { className: "udex-carousel__navigation-page-indicator-spacer" }), _jsx(UDExButton, { "data-ui5-arrow-forward": true, size: UDExButtonSize.Large, disabled: this.isNextButtonDisabled, class: btnClassName, icon: slimArrowRight, design: this.buttonDesign, tooltip: this.nextPageText, onClick: this._nextButtonClick, part: "next-button" })] }), this.autoplay && this._isBottomNavigation &&
20
+ _jsx("div", { className: "udex-carousel__navigation-spacer" })] }));
14
21
  }
15
22
  //# sourceMappingURL=CarouselTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarouselTemplate.js","sourceRoot":"","sources":["../src/CarouselTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAEnD,OAAO,uBAAuB,MAAM,0DAA0D,CAAC;AAC/F,OAAO,aAAa,MAAM,kDAAkD,CAAC;AAC7E,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAE/E,MAAM,CAAC,OAAO,UAAU,gBAAgB;IACtC,OAAO,CACL,eAAK,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,aAC3D,IAAI,CAAC,qBAAqB,CAAC,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EACxD,KAAC,WAAW,IACV,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,EAAE,EAAC,UAAU,EACb,oBAAoB,QACpB,eAAe,EAAE,uBAAuB,CAAC,UAAU,EACnD,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,iBAAiB,EAAE,IAAI,CAAC,kBAAkB,EAC1C,UAAU,EAAE,IAAI,CAAC,eAAe,YAC/B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACrB,eAAM,IAAI,EAAG,IAAqB,CAAC,eAAe,GAAS,CAC5D,GACW,EACb,IAAI,CAAC,qBAAqB,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IACvD,CACP,CAAC;AACJ,CAAC;AAED,SAAS,UAAU;IACjB,MAAM,YAAY,GAAG,kCAAkC,CAAC;IAExD,OAAO,CACL,eAAK,KAAK,EAAC,mCAAmC,EAAC,IAAI,EAAC,YAAY,aAC9D,KAAC,UAAU,iCAET,IAAI,EAAE,cAAc,CAAC,KAAK,EAC1B,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,IAAI,EAAC,aAAa,GACP,EACb,KAAC,UAAU,oCAET,IAAI,EAAE,cAAc,CAAC,KAAK,EAC1B,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,IAAI,EAAC,aAAa,GACP,IACT,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type Carousel from \"./Carousel.js\";\nimport UI5Carousel from \"@ui5/webcomponents/dist/Carousel.js\";\nimport UDExButton from \"./Button.js\";\nimport UDExButtonSize from \"./types/ButtonSize.js\";\nimport type SlottedChild from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport CarouselArrowsPlacement from \"@ui5/webcomponents/dist/types/CarouselArrowsPlacement.js\";\nimport slimArrowLeft from \"@ui5/webcomponents-icons/dist/slim-arrow-left.js\";\nimport slimArrowRight from \"@ui5/webcomponents-icons/dist/slim-arrow-right.js\";\n\nexport default function CarouselTemplate(this: Carousel) {\n return (\n <div className={this.carouselClass} onKeyDown={this._onkeydown}>\n {this.showNavigationButtons.top && navigation.call(this)}\n <UI5Carousel\n itemsPerPage={this.itemsPerPage}\n pageIndicatorType={this.pageIndicatorType}\n id=\"carousel\"\n hideNavigationArrows\n arrowsPlacement={CarouselArrowsPlacement.Navigation}\n accessibleName={this.accessibleName}\n hidePageIndicator={this._hidePageIndicator}\n onNavigate={this._handleNavigate}>\n {this.items.map(item =>\n <slot name={(item as SlottedChild)._individualSlot}></slot>\n )}\n </UI5Carousel>\n {this.showNavigationButtons.bottom && navigation.call(this)}\n </div>\n );\n}\n\nfunction navigation(this: Carousel) {\n const btnClassName = \"udex-carousel__navigation-button\";\n\n return (\n <div class=\"udex-carousel__navigation-wrapper\" part=\"navigation\">\n <UDExButton\n data-ui5-arrow-back\n size={UDExButtonSize.Large}\n disabled={this.isPrevButtonDisabled}\n class={btnClassName}\n icon={slimArrowLeft}\n design={this.buttonDesign}\n tooltip={this.previousPageText}\n onClick={this._prevButtonClick}\n part=\"prev-button\">\n </UDExButton>\n <UDExButton\n data-ui5-arrow-forward\n size={UDExButtonSize.Large}\n disabled={this.isNextButtonDisabled}\n class={btnClassName}\n icon={slimArrowRight}\n design={this.buttonDesign}\n tooltip={this.nextPageText}\n onClick={this._nextButtonClick}\n part=\"next-button\">\n </UDExButton>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"CarouselTemplate.js","sourceRoot":"","sources":["../src/CarouselTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD,OAAO,uBAAuB,MAAM,0DAA0D,CAAC;AAC/F,OAAO,aAAa,MAAM,kDAAkD,CAAC;AAC7E,OAAO,cAAc,MAAM,mDAAmD,CAAC;AAC/E,OAAO,IAAI,MAAM,uCAAuC,CAAC;AACzD,OAAO,KAAK,MAAM,wCAAwC,CAAC;AAE3D,MAAM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C,KAAK,EAC1B,MAAM,EAAE,gBAAgB,CAAC,QAAQ,EACjC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,IAAI,CAAC,sBAAsB,EACpC,OAAO,EAAE,IAAI,CAAC,+BAA+B,GACjC,EAGhB,eAAK,SAAS,EAAE,IAAI,CAAC,4BAA4B,aAC/C,KAAC,UAAU,iCAET,IAAI,EAAE,cAAc,CAAC,KAAK,EAC1B,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,IAAI,EAAC,aAAa,GACP,EAGX,IAAI,CAAC,mBAAmB;wBACxB,cAAK,SAAS,EAAC,iDAAiD,GAAG,EAGrE,KAAC,UAAU,oCAET,IAAI,EAAE,cAAc,CAAC,KAAK,EAC1B,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EACnC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,IAAI,CAAC,YAAY,EACzB,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,IAAI,EAAC,aAAa,GACP,IACT,EAGJ,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,mBAAmB;gBACzC,cAAK,SAAS,EAAC,kCAAkC,GAAO,IAEtD,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type Carousel from \"./Carousel.js\";\nimport UI5Carousel from \"@ui5/webcomponents/dist/Carousel.js\";\nimport UDExButton from \"./Button.js\";\nimport UDExButtonSize from \"./types/ButtonSize.js\";\nimport UDExButtonDesign from \"./types/ButtonDesign.js\";\nimport type SlottedChild from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport CarouselArrowsPlacement from \"@ui5/webcomponents/dist/types/CarouselArrowsPlacement.js\";\nimport slimArrowLeft from \"@ui5/webcomponents-icons/dist/slim-arrow-left.js\";\nimport slimArrowRight from \"@ui5/webcomponents-icons/dist/slim-arrow-right.js\";\nimport play from \"@ui5/webcomponents-icons/dist/play.js\";\nimport pause from \"@ui5/webcomponents-icons/dist/pause.js\";\n\nexport default function CarouselTemplate(this: Carousel) {\n return (\n <div className={this.carouselClass} onKeyDown={this._onkeydown}>\n {this.showNavigationButtons.top && navigation.call(this)}\n\n <UI5Carousel\n itemsPerPage={this.itemsPerPage}\n pageIndicatorType={this.pageIndicatorType}\n id=\"carousel\"\n hideNavigationArrows\n arrowsPlacement={CarouselArrowsPlacement.Navigation}\n accessibleName={this.accessibleName}\n hidePageIndicator={this._hidePageIndicator}\n onNavigate={this._handleNavigate}\n onMouseEnter={this._onMouseEnter}\n onMouseLeave={this._onMouseLeave}\n onFocusIn={this._onFocusIn}\n onFocusOut={this._onFocusOut}\n cyclic={this.cyclic}\n >\n {\n this.items.map(item =>\n <slot name={(item as SlottedChild)._individualSlot}></slot>\n )\n }\n </UI5Carousel>\n\n {this.showNavigationButtons.bottom && navigation.call(this)}\n </div>\n );\n}\n\nfunction navigation(this: Carousel) {\n const btnClassName = \"udex-carousel__navigation-button\";\n const icon = this._autoplayIsPaused ? play : pause;\n\n return (\n <div className={this.navigationWrapperClass} part=\"navigation\">\n {\n this.autoplay &&\n <UDExButton\n class={`udex-carousel__autoplay-toggle-button`}\n size={UDExButtonSize.Large}\n design={UDExButtonDesign.Tertiary}\n icon={icon}\n onClick={this._onAutoplayToggleClick}\n tooltip={this.autoplayToggleButtonTooltipText}\n ></UDExButton>\n }\n\n <div className={this.navigationButtonWrapperClass}>\n <UDExButton\n data-ui5-arrow-back\n size={UDExButtonSize.Large}\n disabled={this.isPrevButtonDisabled}\n class={btnClassName}\n icon={slimArrowLeft}\n design={this.buttonDesign}\n tooltip={this.previousPageText}\n onClick={this._prevButtonClick}\n part=\"prev-button\">\n </UDExButton>\n\n {\n this._isBottomNavigation &&\n <div className=\"udex-carousel__navigation-page-indicator-spacer\" />\n }\n\n <UDExButton\n data-ui5-arrow-forward\n size={UDExButtonSize.Large}\n disabled={this.isNextButtonDisabled}\n class={btnClassName}\n icon={slimArrowRight}\n design={this.buttonDesign}\n tooltip={this.nextPageText}\n onClick={this._nextButtonClick}\n part=\"next-button\">\n </UDExButton>\n </div>\n\n {\n this.autoplay && this._isBottomNavigation &&\n <div className=\"udex-carousel__navigation-spacer\"></div>\n }\n </div>\n );\n}\n"]}