@salla.sa/twilight-components 2.9.48 → 2.10.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 (82) hide show
  1. package/dist/cjs/{index-4700898c.js → app-globals-a24e299c.js} +31 -2
  2. package/dist/cjs/index-1d2b3370.js +0 -4
  3. package/dist/cjs/loader.cjs.js +3 -2
  4. package/dist/cjs/salla-add-product-button.cjs.entry.js +7 -3
  5. package/dist/cjs/salla-button_35.cjs.entry.js +595 -1903
  6. package/dist/cjs/twilight.cjs.js +3 -2
  7. package/dist/collection/collection-manifest.json +0 -1
  8. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +9 -5
  9. package/dist/collection/components/salla-button/salla-button.js +5 -1
  10. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +3 -3
  11. package/dist/collection/components/salla-file-upload/salla-file-upload.js +9 -8
  12. package/dist/collection/components/salla-gifting/salla-gifting.js +18 -14
  13. package/dist/collection/components/salla-loyalty/salla-loyalty.js +5 -3
  14. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +6 -5
  15. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +14 -10
  16. package/dist/collection/components/salla-slider/salla-slider.css +242 -0
  17. package/dist/collection/components/salla-slider/salla-slider.js +403 -110
  18. package/dist/collection/components/salla-user-menu/salla-user-menu.js +8 -1
  19. package/dist/collection/global/app-dev.js +2 -1
  20. package/dist/collection/global/app.js +15 -0
  21. package/dist/components/index.d.ts +0 -1
  22. package/dist/components/index.js +31 -3
  23. package/dist/components/salla-add-product-button.js +7 -3
  24. package/dist/components/salla-button2.js +5 -1
  25. package/dist/components/salla-cart-summary.js +3 -3
  26. package/dist/components/salla-file-upload2.js +249 -3
  27. package/dist/components/salla-gifting.js +26 -16
  28. package/dist/components/salla-loyalty.js +3 -3
  29. package/dist/components/salla-offer-modal.js +5 -4
  30. package/dist/components/salla-rating-stars2.js +8 -4
  31. package/dist/components/salla-slider2.js +229 -1806
  32. package/dist/components/salla-user-menu.js +8 -1
  33. package/dist/esm/{index-55e33cdf.js → app-globals-1619c0de.js} +31 -2
  34. package/dist/esm/index-f1d446ac.js +0 -4
  35. package/dist/esm/loader.js +3 -2
  36. package/dist/esm/salla-add-product-button.entry.js +7 -3
  37. package/dist/esm/salla-button_35.entry.js +594 -1902
  38. package/dist/esm/twilight.js +3 -2
  39. package/dist/esm-es5/{index-55e33cdf.js → app-globals-1619c0de.js} +2 -2
  40. package/dist/esm-es5/index-f1d446ac.js +2 -2
  41. package/dist/esm-es5/loader.js +1 -1
  42. package/dist/esm-es5/salla-add-product-button.entry.js +1 -1
  43. package/dist/esm-es5/salla-button_35.entry.js +11 -5
  44. package/dist/esm-es5/twilight.js +1 -1
  45. package/dist/twilight/p-0f839b43.system.js +4 -0
  46. package/dist/twilight/p-3420f00c.entry.js +30 -0
  47. package/dist/twilight/p-5207a10c.system.js +24 -0
  48. package/dist/twilight/{p-486ce499.system.entry.js → p-5a1197bb.system.entry.js} +1 -1
  49. package/dist/twilight/p-5b30b649.system.entry.js +47 -0
  50. package/dist/twilight/p-97614f6d.js +24 -0
  51. package/dist/twilight/{p-6f41faf8.entry.js → p-dbb379ce.entry.js} +1 -1
  52. package/dist/twilight/twilight.esm.js +1 -1
  53. package/dist/twilight/twilight.js +1 -1
  54. package/dist/types/components/salla-cart-summary/salla-cart-summary.d.ts +3 -3
  55. package/dist/types/components/salla-slider/salla-slider.d.ts +73 -14
  56. package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +1 -0
  57. package/dist/types/components.d.ts +83 -60
  58. package/dist/types/global/app-dev.d.ts +0 -1
  59. package/package.json +6 -4
  60. package/dist/cjs/core-c7a9fb22.js +0 -4982
  61. package/dist/cjs/salla-swiper.cjs.entry.js +0 -62
  62. package/dist/collection/components/salla-swiper/salla-swiper.css +0 -177
  63. package/dist/collection/components/salla-swiper/salla-swiper.js +0 -152
  64. package/dist/components/arrow-left.js +0 -11
  65. package/dist/components/core.js +0 -4959
  66. package/dist/components/salla-swiper.d.ts +0 -11
  67. package/dist/components/salla-swiper.js +0 -92
  68. package/dist/esm/core-572aabd0.js +0 -4973
  69. package/dist/esm/salla-swiper.entry.js +0 -58
  70. package/dist/esm-es5/core-572aabd0.js +0 -4
  71. package/dist/esm-es5/salla-swiper.entry.js +0 -4
  72. package/dist/twilight/p-00e66d1a.system.js +0 -4
  73. package/dist/twilight/p-0cf11465.system.js +0 -4
  74. package/dist/twilight/p-0de275dc.system.entry.js +0 -41
  75. package/dist/twilight/p-37381192.entry.js +0 -30
  76. package/dist/twilight/p-684a004a.system.entry.js +0 -4
  77. package/dist/twilight/p-6b7896e1.system.js +0 -24
  78. package/dist/twilight/p-6ed7d3a2.js +0 -4
  79. package/dist/twilight/p-e8c3c209.entry.js +0 -4
  80. package/dist/twilight/p-f286c803.js +0 -24
  81. package/dist/types/components/salla-swiper/salla-swiper.d.ts +0 -31
  82. package/dist/types/index.d.ts +0 -7
@@ -1,8 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { Component, State, Prop, h, Event, Host, Method } from '@stencil/core';
5
- import Swiper, { Navigation, Pagination, Lazy, Controller, Thumbs, Parallax, Autoplay } from 'swiper';
4
+ import { Component, State, Prop, h, Event, Host, Method, Element } from '@stencil/core';
6
5
  import ArrowRightIcon from "../../assets/svg/keyboard_arrow_right.svg";
7
6
  import ArrowLeftIcon from "../../assets/svg/keyboard_arrow_left.svg";
8
7
  /**
@@ -11,14 +10,46 @@ import ArrowLeftIcon from "../../assets/svg/keyboard_arrow_left.svg";
11
10
  */
12
11
  export class SallaSwiper {
13
12
  constructor() {
13
+ /**
14
+ * Show/hide slider block title
15
+ */
16
+ this.blockTitle = '';
17
+ /**
18
+ * Show/hide slider block sub title
19
+ */
20
+ this.blockSubtitle = '';
21
+ /**
22
+ * Show/hide display all button beside arrows
23
+ */
24
+ this.displayAllUrl = '';
14
25
  /**
15
26
  * Show/hide arrows
16
27
  */
17
28
  this.showControls = true;
29
+ /**
30
+ * Show/hide arrows
31
+ */
32
+ this.controlsOuter = false;
18
33
  /**
19
34
  * Show/hide thumbs slider arrows
20
35
  */
21
36
  this.showThumbsControls = true;
37
+ /**
38
+ * Enable autoplay - working with `type="carousel" only`
39
+ */
40
+ this.autoPlay = false;
41
+ /**
42
+ * Enable pagination
43
+ */
44
+ this.pagination = false;
45
+ /**
46
+ * Enable center mode - working with `type="carousel" only`
47
+ */
48
+ this.centered = false;
49
+ /**
50
+ * Run slider in loop, Don't use it for slides with custom components inside it, because it may cause re-render issue
51
+ */
52
+ this.loop = false;
22
53
  /**
23
54
  * Set the type of the slider
24
55
  * Default: ''
@@ -37,22 +68,57 @@ export class SallaSwiper {
37
68
  */
38
69
  this.sliderConfig = {};
39
70
  /**
40
- * Thumbs Slider Configs refer to https://swiperjs.com/swiper-api#parameters and pass the entire config object
41
- * @example
42
- * let slider = document.querySelector('salla-slider');
43
- * slider.thumbsConfig = {
44
- * slidesPerView: 1,
45
- * spaceBetween : 30,
46
- * lazy: true,
47
- * }
48
- *
49
- */
71
+ * Thumbs Slider Configs refer to https://swiperjs.com/swiper-api#parameters and pass the entire config object
72
+ * @example
73
+ * let slider = document.querySelector('salla-slider');
74
+ * slider.thumbsConfig = {
75
+ * slidesPerView: 1,
76
+ * spaceBetween : 30,
77
+ * lazy: true,
78
+ * }
79
+ *
80
+ */
50
81
  this.thumbsConfig = {};
51
82
  // States
52
83
  this.currentIndex = undefined;
53
84
  this.isEnd = false;
54
85
  this.isBeginning = true;
55
86
  this.isRTL = document.documentElement.dir === 'rtl';
87
+ this.pre_defined_config = {
88
+ carousel: {
89
+ speed: 300,
90
+ slidesPerView: 'auto',
91
+ spaceBetween: 0,
92
+ },
93
+ fullscreen: {
94
+ speed: 750,
95
+ parallax: true,
96
+ autoplay: {
97
+ delay: 5000,
98
+ },
99
+ },
100
+ testimonials: {
101
+ draggable: true,
102
+ centeredSlides: true,
103
+ slidesPerView: 1,
104
+ breakpoints: { 1024: { slidesPerView: 2 } }
105
+ },
106
+ blog: {
107
+ slidesPerView: 1,
108
+ centeredSlides: true,
109
+ spaceBetween: 30,
110
+ effect: "fade",
111
+ breakpoints: {
112
+ 320: { spaceBetween: 10 },
113
+ 768: { spaceBetween: 15 },
114
+ 980: { paceBetween: 30 },
115
+ }
116
+ },
117
+ thumbs: {
118
+ slidesPerView: 1,
119
+ spaceBetween: 30
120
+ }
121
+ };
56
122
  }
57
123
  // Methods
58
124
  /**
@@ -63,7 +129,7 @@ export class SallaSwiper {
63
129
  * @param {boolean} runCallbacks - Set it to false (by default it is true) and transition will not produce transition events.
64
130
  * **/
65
131
  async slideTo(index, speed, runCallbacks) {
66
- this.slider.slideTo(index, speed, runCallbacks);
132
+ return this.slider.slideTo(index, speed, runCallbacks);
67
133
  }
68
134
  /**
69
135
  * Run transition to the next slide.
@@ -72,7 +138,8 @@ export class SallaSwiper {
72
138
  * @param {boolean} runCallbacks - Set it to false (by default it is true) and transition will not produce transition events.
73
139
  * **/
74
140
  async slideNext(speed, runCallbacks) {
75
- this.slider.slideNext(speed, runCallbacks);
141
+ var _a;
142
+ (_a = this.slider) === null || _a === void 0 ? void 0 : _a.slideNext(speed, runCallbacks);
76
143
  }
77
144
  /**
78
145
  * Run transition to the previous slide.
@@ -81,7 +148,8 @@ export class SallaSwiper {
81
148
  * @param {boolean} runCallbacks - Set it to false (by default it is true) and transition will not produce transition events.
82
149
  * **/
83
150
  async slidePrev(speed, runCallbacks) {
84
- this.slider.slidePrev(speed, runCallbacks);
151
+ var _a;
152
+ (_a = this.slider) === null || _a === void 0 ? void 0 : _a.slidePrev(speed, runCallbacks);
85
153
  }
86
154
  /**
87
155
  * Does the same as .slideTo but for the case when used with enabled loop. So this method will slide to slides with realIndex matching to passed index
@@ -128,7 +196,7 @@ export class SallaSwiper {
128
196
  this.slider.slideToClosest(speed, runCallbacks);
129
197
  }
130
198
  /**
131
- * You should call it after you add/remove slides manually, or after you hide/show it, or do any custom DOM modifications with Swiper This method also includes subcall of the following methods which you can use separately:
199
+ * You should call it after you add/remove slides manually, or after you hide/show it, or do any custom DOM modifications with Swiper This method also includes subcall of the following methods which you can use separately:
132
200
  * **/
133
201
  async update() {
134
202
  this.slider.update();
@@ -158,118 +226,180 @@ export class SallaSwiper {
158
226
  async updateSlidesClasses() {
159
227
  this.slider.updateSlidesClasses();
160
228
  }
161
- componentDidLoad() {
162
- let itemsSlot = this.sliderWrapper.querySelector('div[slot="items"]');
163
- !!itemsSlot ? itemsSlot.replaceWith(...itemsSlot.children) : null;
164
- if (this.type == 'thumbs') {
165
- let thumbsSlot = this.thumbsSliderWrapper.querySelector('div[slot="thumbs"]');
166
- !!thumbsSlot ? thumbsSlot.replaceWith(...thumbsSlot.children) : null;
167
- }
168
- this.initSlider();
229
+ /**
230
+ * Get slider slides
231
+ * **/
232
+ async getSlides() {
233
+ var _a;
234
+ return await ((_a = this.slider) === null || _a === void 0 ? void 0 : _a.slides);
169
235
  }
170
- initSlider() {
171
- Swiper.use([Controller, Navigation, Pagination, Lazy, Thumbs, Parallax, Autoplay]);
172
- for (const slide of this.sliderWrapper.children) {
173
- //todo:: use `s-slider-slide`
174
- slide.classList.add('swiper-slide');
175
- }
176
- if (this.type == 'carousel') {
177
- this.slider = new Swiper(this.sliderContainer, {
178
- loop: false,
179
- speed: 300,
180
- slidesPerView: 'auto',
181
- spaceBetween: 10,
182
- });
183
- }
184
- else if (this.type == 'thumbs') {
185
- this.thumbsSlider = new Swiper(this.thumbsSliderContainer, Object.assign({}, this.thumbsConfig));
236
+ componentWillLoad() {
237
+ salla.lang.onLoaded(() => {
238
+ this.displayAllTitle = salla.lang.get('blocks.home.display_all');
239
+ });
240
+ return new Promise((resolve, reject) => {
241
+ // @ts-ignore
242
+ if (typeof Swiper !== 'undefined') {
243
+ return resolve(true);
244
+ }
245
+ if (document.getElementById('swiper-script')) {
246
+ let interval = setInterval(() => {
247
+ // @ts-ignore
248
+ if (typeof Swiper !== 'undefined') {
249
+ clearInterval(interval);
250
+ resolve(true);
251
+ }
252
+ }, 5);
253
+ }
254
+ else {
255
+ // ? There is an issue with stencil bundling it breaks the swiper import, so we need to import it manually by swiperjs rerendered file
256
+ // ! IT'S NOT A GOOD SOLUTION, BUT IT WORKS, WE NEED TO FIND A BETTER SOLUTION
257
+ this.swiperScript = document.createElement('script');
258
+ this.swiperScript.onload = () => {
259
+ resolve(true);
260
+ salla.event.emit('swiper::loaded');
261
+ };
262
+ this.swiperScript.onerror = (error) => {
263
+ salla.logger.warn('failed load swiper bundle', error);
264
+ reject(true);
265
+ };
266
+ this.swiperScript.src = 'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js';
267
+ this.swiperScript.setAttribute('id', 'swiper-script');
268
+ document.body.appendChild(this.swiperScript);
269
+ }
270
+ });
271
+ }
272
+ getSwiperConfig() {
273
+ let pre_defined_config = {
274
+ loop: this.loop,
275
+ autoplay: this.autoPlay,
276
+ centeredSlides: this.centered,
277
+ lazy: true,
278
+ on: {
279
+ // todo:: find better way for this workaround to show lazyLoad for duplicated slides, for some reason they are loaded but class not added.
280
+ afterInit: (slider) => this.loop && slider.slides.map(slide => {
281
+ var _a;
282
+ (_a = document.lazyLoadInstance) === null || _a === void 0 ? void 0 : _a.update();
283
+ if (!slide.classList.contains('swiper-slide-duplicate')) {
284
+ return;
285
+ }
286
+ slide.querySelectorAll('img.lazy:not(.loaded)').forEach(img => img.classList.add('loaded'));
287
+ }),
288
+ },
289
+ pagination: this.pagination ? {
290
+ el: this.host.id ? `#${this.host.id} .swiper-pagination` : '',
291
+ clickable: true,
292
+ } : false,
293
+ navigation: this.showControls ? {
294
+ nextEl: this.host.id ? `#${this.host.id} .s-slider-next` : '',
295
+ prevEl: this.host.id ? `#${this.host.id} .s-slider-prev` : ''
296
+ } : false,
297
+ };
298
+ pre_defined_config = Object.assign(Object.assign({}, pre_defined_config), (this.pre_defined_config[this.type] || {}));
299
+ if (this.type == 'thumbs') {
186
300
  for (const slide of this.thumbsSliderWrapper.children) {
187
301
  //todo:: use `s-slider-slide`
188
302
  slide.classList.add('swiper-slide');
189
303
  }
190
- this.slider = new Swiper(this.sliderContainer, {
191
- slidesPerView: 1,
192
- spaceBetween: 30,
193
- lazy: true,
194
- thumbs: {
195
- swiper: this.thumbsSlider,
196
- },
304
+ // @ts-ignore
305
+ this.thumbsSlider = new Swiper(this.thumbsSliderContainer, {
306
+ freeMode: false,
307
+ watchSlidesProgress: true,
308
+ slidesPerView: 'auto',
197
309
  });
310
+ // @ts-ignore
311
+ pre_defined_config.thumbs = {
312
+ swiper: this.thumbsSlider,
313
+ };
198
314
  }
199
- else {
200
- this.slider = new Swiper(this.sliderContainer, Object.assign({}, this.sliderConfig));
315
+ pre_defined_config = Object.assign(Object.assign({}, pre_defined_config), this.sliderConfig);
316
+ return pre_defined_config;
317
+ }
318
+ initSlider() {
319
+ for (const slide of this.sliderWrapper.children) {
320
+ //todo:: use `s-slider-slide`
321
+ slide.classList.add('swiper-slide');
201
322
  }
323
+ // @ts-ignore
324
+ this.slider = new Swiper(this.sliderContainer, this.getSwiperConfig());
202
325
  // Expose slider events
203
326
  this.slider.on('slideChange', (slider) => {
327
+ //todo:: it doesn't change when loop is active, always will be false
204
328
  this.isBeginning = slider.isBeginning;
205
329
  this.isEnd = slider.isEnd;
206
330
  this.slideChange.emit(slider);
207
331
  });
208
- this.slider.on('reachBeginning', (slider) => {
209
- // this.isBeginning = true;
210
- this.reachBeginning.emit(slider);
211
- });
212
- this.slider.on('reachEnd', (slider) => {
213
- // this.isEnd = true;
214
- this.reachEnd.emit(slider);
215
- });
216
- this.slider.on('slideChangeTransitionEnd', (slider) => {
217
- this.slideChangeTransitionEnd.emit(slider);
218
- });
219
- this.slider.on('slideChangeTransitionStart', (slider) => {
220
- this.slideChangeTransitionStart.emit(slider);
221
- });
222
- this.slider.on('slideNextTransitionEnd', (slider) => {
223
- this.slideNextTransitionEnd.emit(slider);
224
- });
225
- this.slider.on('slideNextTransitionStart', (slider) => {
226
- this.slideNextTransitionStart.emit(slider);
227
- });
228
- this.slider.on('slidePrevTransitionEnd', (slider) => {
229
- this.slidePrevTransitionEnd.emit(slider);
230
- });
231
- this.slider.on('slidePrevTransitionStart', (slider) => {
232
- this.slidePrevTransitionStart.emit(slider);
233
- });
234
- this.slider.on('sliderMove', (slider) => {
235
- this.sliderMove.emit(slider);
236
- });
237
- this.slider.on('touchEnd', (slider) => {
238
- this.touchSliderEnd.emit(slider);
239
- });
240
- this.slider.on('touchMove', (slider) => {
241
- this.touchSliderMove.emit(slider);
242
- });
243
- this.slider.on('touchStart', (slider) => {
244
- this.touchSliderStart.emit(slider);
245
- });
246
- this.slider.on('transitionEnd', (slider) => {
247
- this.sliderTransitionEnd.emit(slider);
248
- });
249
- this.slider.on('transitionStart', (slider) => {
250
- this.sliderTransitionStart.emit(slider);
251
- });
332
+ this.slider.on('reachBeginning', (slider) => this.reachBeginning.emit(slider));
333
+ this.slider.on('reachEnd', (slider) => this.reachEnd.emit(slider));
334
+ this.slider.on('slideChangeTransitionEnd', (slider) => this.slideChangeTransitionEnd.emit(slider));
335
+ this.slider.on('slideChangeTransitionStart', (slider) => this.slideChangeTransitionStart.emit(slider));
336
+ this.slider.on('slideNextTransitionEnd', (slider) => this.slideNextTransitionEnd.emit(slider));
337
+ this.slider.on('slideNextTransitionStart', (slider) => this.slideNextTransitionStart.emit(slider));
338
+ this.slider.on('slidePrevTransitionEnd', (slider) => this.slidePrevTransitionEnd.emit(slider));
339
+ this.slider.on('slidePrevTransitionStart', (slider) => this.slidePrevTransitionStart.emit(slider));
340
+ this.slider.on('sliderMove', (slider) => this.sliderMove.emit(slider));
341
+ this.slider.on('touchEnd', (slider) => this.touchSliderEnd.emit(slider));
342
+ this.slider.on('touchMove', (slider) => this.touchSliderMove.emit(slider));
343
+ this.slider.on('touchStart', (slider) => this.touchSliderStart.emit(slider));
344
+ this.slider.on('transitionEnd', (slider) => this.sliderTransitionEnd.emit(slider));
345
+ this.slider.on('transitionStart', (slider) => this.sliderTransitionStart.emit(slider));
252
346
  }
253
347
  render() {
254
348
  var _a, _b, _c, _d;
255
- return (h(Host, { class: "s-slider-wrapper" },
349
+ let classes = this.type ? this.type + '-slider ' : '';
350
+ classes += this.controlsOuter ? ' s-slider-controls-outer ' : '';
351
+ classes += this.blockTitle == '' ? ' s-slider-has-notitle ' : '';
352
+ classes += this.blockTitle == '' || this.type == 'testimonials' ? ' s-slider-v-centered ' : '';
353
+ return (h(Host, { class: 's-slider-wrapper ' + classes },
354
+ this.blockTitle || this.showControls ?
355
+ h("div", { class: "s-slider-block__title" },
356
+ this.blockTitle ?
357
+ h("div", { class: "s-slider-block__title-right" },
358
+ h("h2", null, this.blockTitle),
359
+ this.blockSubtitle ? h("p", { innerHTML: this.blockSubtitle }) : '')
360
+ : '',
361
+ h("div", { class: "s-slider-block__title-left" },
362
+ this.displayAllUrl ?
363
+ h("a", { href: this.displayAllUrl, class: "s-slider-block__display-all" }, this.displayAllTitle)
364
+ : '',
365
+ this.showControls ?
366
+ h("div", { class: "s-slider-block__title-nav", dir: "rtl" },
367
+ h("button", { "aria-label": "Previous Slide", class: "s-slider-prev s-slider-nav-arrow" },
368
+ h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? ArrowRightIcon : ArrowLeftIcon })),
369
+ h("button", { "aria-label": "Next Slide", class: "s-slider-next s-slider-nav-arrow" },
370
+ h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? ArrowLeftIcon : ArrowRightIcon })))
371
+ : ''))
372
+ : '',
256
373
  h("div", { class: "swiper s-slider-container", ref: el => this.sliderContainer = el },
257
- h("div", { class: "swiper-wrapper", ref: el => this.sliderWrapper = el },
374
+ h("slot", null),
375
+ h("div", { class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el },
258
376
  h("slot", { name: 'items' })),
259
- this.showControls ? [h("div", { class: "s-slider-button-prev" },
260
- h("salla-button", { shape: "icon", disabled: this.isRTL ? this.isEnd : this.isBeginning, color: "light", onClick: () => this.isRTL ? this.slideNext() : this.slidePrev() },
261
- h("span", { class: "s-slider-button-icon", innerHTML: ArrowLeftIcon }))), h("div", { class: "s-slider-button-next" },
262
- h("salla-button", { disabled: this.isRTL ? this.isBeginning : this.isEnd, shape: "icon", color: "light", onClick: () => this.isRTL ? this.slidePrev() : this.slideNext() },
263
- h("span", { class: "s-slider-button-icon", innerHTML: ArrowRightIcon })))] : ''),
377
+ this.pagination ? h("div", { class: "swiper-pagination" }) : ''),
264
378
  this.type == 'thumbs' ? h("div", { class: "s-slider-thumbs" },
265
379
  h("div", { class: "swiper s-slider-thumbs-container", ref: el => this.thumbsSliderContainer = el },
266
- h("div", { class: "swiper-wrapper", ref: el => this.thumbsSliderWrapper = el },
380
+ h("div", { class: "s-slider-swiper-wrapper swiper-wrapper", ref: el => this.thumbsSliderWrapper = el },
267
381
  h("slot", { name: "thumbs" })),
268
- this.showThumbsControls ? [h("div", { class: "s-slider-button-prev" },
382
+ this.showThumbsControls ? [h("div", { class: "s-slider-button s-slider-button-prev" },
269
383
  h("salla-button", { disabled: this.isRTL ? (_a = this.thumbsSlider) === null || _a === void 0 ? void 0 : _a.isEnd : (_b = this.thumbsSlider) === null || _b === void 0 ? void 0 : _b.isBeginning, shape: "icon", color: "light", onClick: () => this.isRTL ? this.thumbsSlider.slideNext() : this.thumbsSlider.slidePrev() },
270
- h("span", { class: "s-slider-button-icon", innerHTML: ArrowLeftIcon }))), h("div", { class: "s-slider-button-next" },
384
+ h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? ArrowLeftIcon : ArrowRightIcon }))), h("div", { class: "s-slider-button s-slider-button-next" },
271
385
  h("salla-button", { disabled: this.isRTL ? (_c = this.thumbsSlider) === null || _c === void 0 ? void 0 : _c.isBeginning : (_d = this.thumbsSlider) === null || _d === void 0 ? void 0 : _d.isEnd, shape: "icon", color: "light", onClick: () => this.isRTL ? this.thumbsSlider.slidePrev() : this.thumbsSlider.slideNext() },
272
- h("span", { class: "s-slider-button-icon", innerHTML: ArrowRightIcon })))] : '')) : ''));
386
+ h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? ArrowRightIcon : ArrowLeftIcon })))] : '')) : ''));
387
+ }
388
+ componentDidLoad() {
389
+ let itemsSlot = this.sliderWrapper.querySelector('div[slot="items"]');
390
+ !!itemsSlot ? itemsSlot.replaceWith(...itemsSlot.children) : null;
391
+ if (this.type == 'thumbs') {
392
+ let thumbsSlot = this.thumbsSliderWrapper.querySelector('div[slot="thumbs"]');
393
+ !!thumbsSlot ? thumbsSlot.replaceWith(...thumbsSlot.children) : null;
394
+ }
395
+ // if swiper is not loaded, lets relay on event
396
+ // @ts-ignore
397
+ if (typeof Swiper === 'undefined') {
398
+ salla.event.once('swiper::loaded', () => this.initSlider());
399
+ }
400
+ else { // if swiper is loaded lets init our slider
401
+ this.initSlider();
402
+ }
273
403
  }
274
404
  static get is() { return "salla-slider"; }
275
405
  static get originalStyleUrls() { return {
@@ -279,6 +409,60 @@ export class SallaSwiper {
279
409
  "$": ["salla-slider.css"]
280
410
  }; }
281
411
  static get properties() { return {
412
+ "blockTitle": {
413
+ "type": "string",
414
+ "mutable": false,
415
+ "complexType": {
416
+ "original": "string",
417
+ "resolved": "string",
418
+ "references": {}
419
+ },
420
+ "required": false,
421
+ "optional": false,
422
+ "docs": {
423
+ "tags": [],
424
+ "text": "Show/hide slider block title"
425
+ },
426
+ "attribute": "block-title",
427
+ "reflect": true,
428
+ "defaultValue": "''"
429
+ },
430
+ "blockSubtitle": {
431
+ "type": "string",
432
+ "mutable": false,
433
+ "complexType": {
434
+ "original": "string",
435
+ "resolved": "string",
436
+ "references": {}
437
+ },
438
+ "required": false,
439
+ "optional": false,
440
+ "docs": {
441
+ "tags": [],
442
+ "text": "Show/hide slider block sub title"
443
+ },
444
+ "attribute": "block-subtitle",
445
+ "reflect": true,
446
+ "defaultValue": "''"
447
+ },
448
+ "displayAllUrl": {
449
+ "type": "string",
450
+ "mutable": false,
451
+ "complexType": {
452
+ "original": "string",
453
+ "resolved": "string",
454
+ "references": {}
455
+ },
456
+ "required": false,
457
+ "optional": false,
458
+ "docs": {
459
+ "tags": [],
460
+ "text": "Show/hide display all button beside arrows"
461
+ },
462
+ "attribute": "display-all-url",
463
+ "reflect": true,
464
+ "defaultValue": "''"
465
+ },
282
466
  "showControls": {
283
467
  "type": "boolean",
284
468
  "mutable": false,
@@ -297,6 +481,24 @@ export class SallaSwiper {
297
481
  "reflect": true,
298
482
  "defaultValue": "true"
299
483
  },
484
+ "controlsOuter": {
485
+ "type": "boolean",
486
+ "mutable": false,
487
+ "complexType": {
488
+ "original": "boolean",
489
+ "resolved": "boolean",
490
+ "references": {}
491
+ },
492
+ "required": false,
493
+ "optional": false,
494
+ "docs": {
495
+ "tags": [],
496
+ "text": "Show/hide arrows"
497
+ },
498
+ "attribute": "controls-outer",
499
+ "reflect": true,
500
+ "defaultValue": "false"
501
+ },
300
502
  "showThumbsControls": {
301
503
  "type": "boolean",
302
504
  "mutable": false,
@@ -315,19 +517,91 @@ export class SallaSwiper {
315
517
  "reflect": false,
316
518
  "defaultValue": "true"
317
519
  },
520
+ "autoPlay": {
521
+ "type": "boolean",
522
+ "mutable": false,
523
+ "complexType": {
524
+ "original": "boolean",
525
+ "resolved": "boolean",
526
+ "references": {}
527
+ },
528
+ "required": false,
529
+ "optional": false,
530
+ "docs": {
531
+ "tags": [],
532
+ "text": "Enable autoplay - working with `type=\"carousel\" only`"
533
+ },
534
+ "attribute": "auto-play",
535
+ "reflect": false,
536
+ "defaultValue": "false"
537
+ },
538
+ "pagination": {
539
+ "type": "boolean",
540
+ "mutable": false,
541
+ "complexType": {
542
+ "original": "boolean",
543
+ "resolved": "boolean",
544
+ "references": {}
545
+ },
546
+ "required": false,
547
+ "optional": false,
548
+ "docs": {
549
+ "tags": [],
550
+ "text": "Enable pagination"
551
+ },
552
+ "attribute": "pagination",
553
+ "reflect": false,
554
+ "defaultValue": "false"
555
+ },
556
+ "centered": {
557
+ "type": "boolean",
558
+ "mutable": false,
559
+ "complexType": {
560
+ "original": "boolean",
561
+ "resolved": "boolean",
562
+ "references": {}
563
+ },
564
+ "required": false,
565
+ "optional": false,
566
+ "docs": {
567
+ "tags": [],
568
+ "text": "Enable center mode - working with `type=\"carousel\" only`"
569
+ },
570
+ "attribute": "centered",
571
+ "reflect": false,
572
+ "defaultValue": "false"
573
+ },
574
+ "loop": {
575
+ "type": "boolean",
576
+ "mutable": false,
577
+ "complexType": {
578
+ "original": "boolean",
579
+ "resolved": "boolean",
580
+ "references": {}
581
+ },
582
+ "required": false,
583
+ "optional": false,
584
+ "docs": {
585
+ "tags": [],
586
+ "text": "Run slider in loop, Don't use it for slides with custom components inside it, because it may cause re-render issue"
587
+ },
588
+ "attribute": "loop",
589
+ "reflect": false,
590
+ "defaultValue": "false"
591
+ },
318
592
  "type": {
319
593
  "type": "string",
320
594
  "mutable": false,
321
595
  "complexType": {
322
- "original": "'carousel' | 'thumbs' | ''",
323
- "resolved": "\"\" | \"carousel\" | \"thumbs\"",
596
+ "original": "'carousel' | 'thumbs' | 'default' | 'hero' | 'testimonials' | 'blog' | ''",
597
+ "resolved": "\"\" | \"blog\" | \"carousel\" | \"default\" | \"hero\" | \"testimonials\" | \"thumbs\"",
324
598
  "references": {}
325
599
  },
326
600
  "required": false,
327
601
  "optional": false,
328
602
  "docs": {
329
603
  "tags": [],
330
- "text": "Set the type of the slider \nDefault: ''"
604
+ "text": "Set the type of the slider\nDefault: ''"
331
605
  },
332
606
  "attribute": "type",
333
607
  "reflect": false,
@@ -380,7 +654,9 @@ export class SallaSwiper {
380
654
  "currentIndex": {},
381
655
  "isEnd": {},
382
656
  "isBeginning": {},
383
- "isRTL": {}
657
+ "isRTL": {},
658
+ "swiperScript": {},
659
+ "displayAllTitle": {}
384
660
  }; }
385
661
  static get events() { return [{
386
662
  "method": "slideChange",
@@ -611,7 +887,7 @@ export class SallaSwiper {
611
887
  static get methods() { return {
612
888
  "slideTo": {
613
889
  "complexType": {
614
- "signature": "(index: number, speed?: number, runCallbacks?: boolean) => Promise<void>",
890
+ "signature": "(index: number, speed?: number, runCallbacks?: boolean) => Promise<any>",
615
891
  "parameters": [{
616
892
  "tags": [{
617
893
  "name": "param",
@@ -636,7 +912,7 @@ export class SallaSwiper {
636
912
  "location": "global"
637
913
  }
638
914
  },
639
- "return": "Promise<void>"
915
+ "return": "Promise<any>"
640
916
  },
641
917
  "docs": {
642
918
  "text": "Run transition to the slide with index number equal to 'index' parameter for the duration equal to 'speed' parameter.",
@@ -981,6 +1257,23 @@ export class SallaSwiper {
981
1257
  "text": "update active/prev/next classes on slides and bullets\n*",
982
1258
  "tags": []
983
1259
  }
1260
+ },
1261
+ "getSlides": {
1262
+ "complexType": {
1263
+ "signature": "() => Promise<any>",
1264
+ "parameters": [],
1265
+ "references": {
1266
+ "Promise": {
1267
+ "location": "global"
1268
+ }
1269
+ },
1270
+ "return": "Promise<any>"
1271
+ },
1272
+ "docs": {
1273
+ "text": "Get slider slides\n*",
1274
+ "tags": []
1275
+ }
984
1276
  }
985
1277
  }; }
1278
+ static get elementRef() { return "host"; }
986
1279
  }