@covet-pics/covet-pics-widget 0.115.2 → 0.115.3

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 (39) hide show
  1. package/dist/cjs/{lazy-400cf804.js → a11y-ec6649c6.js} +351 -2
  2. package/dist/cjs/covet-pics-direct-buy_6.cjs.entry.js +6 -6
  3. package/dist/cjs/covet-pics-gallery-grid_3.cjs.entry.js +20 -17
  4. package/dist/cjs/covet-pics-highlighted-hotspots_2.cjs.entry.js +16 -16
  5. package/dist/cjs/slider-c7104397.js +17 -0
  6. package/dist/collection/components/covet-pics-gallery-slider/covet-pics-gallery-slider.js +14 -4
  7. package/dist/collection/components/covet-pics-highlighted/covet-pics-highlighted.js +1 -8
  8. package/dist/covet-pics-widget/covet-pics-widget.esm.js +1 -1
  9. package/dist/covet-pics-widget/{p-8dbd940e.js → p-0b45bebd.js} +1 -1
  10. package/dist/covet-pics-widget/{p-be761ec2.system.entry.js → p-0f1df4a0.system.entry.js} +6 -6
  11. package/dist/covet-pics-widget/{p-99eee7c2.entry.js → p-3a78600b.entry.js} +2 -2
  12. package/dist/covet-pics-widget/{p-2861c063.entry.js → p-560f1b11.entry.js} +1 -1
  13. package/dist/covet-pics-widget/p-5e112b9f.js +4 -0
  14. package/dist/covet-pics-widget/p-92ebf89e.system.js +1 -1
  15. package/dist/covet-pics-widget/{p-7ee26d71.system.entry.js → p-9f687d29.system.entry.js} +1 -1
  16. package/dist/covet-pics-widget/p-a743a997.system.js +4 -0
  17. package/dist/covet-pics-widget/p-e6050d54.system.js +4 -0
  18. package/dist/covet-pics-widget/{p-fbe74325.system.entry.js → p-eea36aac.system.entry.js} +2 -2
  19. package/dist/covet-pics-widget/p-f5c2a18b.entry.js +40 -0
  20. package/dist/esm/{lazy-c503ad5f.js → a11y-61b12420.js} +351 -1
  21. package/dist/esm/covet-pics-direct-buy_6.entry.js +2 -2
  22. package/dist/esm/covet-pics-gallery-grid_3.entry.js +15 -12
  23. package/dist/esm/covet-pics-highlighted-hotspots_2.entry.js +2 -2
  24. package/dist/esm/slider-d4abfa66.js +15 -0
  25. package/dist/esm-es5/a11y-61b12420.js +4 -0
  26. package/dist/esm-es5/covet-pics-direct-buy_6.entry.js +1 -1
  27. package/dist/esm-es5/covet-pics-gallery-grid_3.entry.js +2 -2
  28. package/dist/esm-es5/covet-pics-highlighted-hotspots_2.entry.js +1 -1
  29. package/dist/esm-es5/slider-d4abfa66.js +4 -0
  30. package/dist/types/components/covet-pics-highlighted/covet-pics-highlighted.d.ts +0 -1
  31. package/package.json +1 -1
  32. package/dist/cjs/slider-3ccbc3e0.js +0 -370
  33. package/dist/covet-pics-widget/p-0d741dbb.js +0 -4
  34. package/dist/covet-pics-widget/p-3fc14161.system.js +0 -4
  35. package/dist/covet-pics-widget/p-46bca169.system.js +0 -4
  36. package/dist/covet-pics-widget/p-7a3aeae4.entry.js +0 -40
  37. package/dist/esm/slider-d6a4fcb1.js +0 -367
  38. package/dist/esm-es5/lazy-c503ad5f.js +0 -4
  39. package/dist/esm-es5/slider-d6a4fcb1.js +0 -4
@@ -5763,11 +5763,360 @@ function Lazy({
5763
5763
  });
5764
5764
  }
5765
5765
 
5766
- exports.$ = $;
5766
+ function A11y({
5767
+ swiper,
5768
+ extendParams,
5769
+ on
5770
+ }) {
5771
+ extendParams({
5772
+ a11y: {
5773
+ enabled: true,
5774
+ notificationClass: 'swiper-notification',
5775
+ prevSlideMessage: 'Previous slide',
5776
+ nextSlideMessage: 'Next slide',
5777
+ firstSlideMessage: 'This is the first slide',
5778
+ lastSlideMessage: 'This is the last slide',
5779
+ paginationBulletMessage: 'Go to slide {{index}}',
5780
+ slideLabelMessage: '{{index}} / {{slidesLength}}',
5781
+ containerMessage: null,
5782
+ containerRoleDescriptionMessage: null,
5783
+ itemRoleDescriptionMessage: null,
5784
+ slideRole: 'group',
5785
+ id: null
5786
+ }
5787
+ });
5788
+ swiper.a11y = {
5789
+ clicked: false
5790
+ };
5791
+ let liveRegion = null;
5792
+
5793
+ function notify(message) {
5794
+ const notification = liveRegion;
5795
+ if (notification.length === 0) return;
5796
+ notification.html('');
5797
+ notification.html(message);
5798
+ }
5799
+
5800
+ function getRandomNumber(size = 16) {
5801
+ const randomChar = () => Math.round(16 * Math.random()).toString(16);
5802
+
5803
+ return 'x'.repeat(size).replace(/x/g, randomChar);
5804
+ }
5805
+
5806
+ function makeElFocusable($el) {
5807
+ $el.attr('tabIndex', '0');
5808
+ }
5809
+
5810
+ function makeElNotFocusable($el) {
5811
+ $el.attr('tabIndex', '-1');
5812
+ }
5813
+
5814
+ function addElRole($el, role) {
5815
+ $el.attr('role', role);
5816
+ }
5817
+
5818
+ function addElRoleDescription($el, description) {
5819
+ $el.attr('aria-roledescription', description);
5820
+ }
5821
+
5822
+ function addElControls($el, controls) {
5823
+ $el.attr('aria-controls', controls);
5824
+ }
5825
+
5826
+ function addElLabel($el, label) {
5827
+ $el.attr('aria-label', label);
5828
+ }
5829
+
5830
+ function addElId($el, id) {
5831
+ $el.attr('id', id);
5832
+ }
5833
+
5834
+ function addElLive($el, live) {
5835
+ $el.attr('aria-live', live);
5836
+ }
5837
+
5838
+ function disableEl($el) {
5839
+ $el.attr('aria-disabled', true);
5840
+ }
5841
+
5842
+ function enableEl($el) {
5843
+ $el.attr('aria-disabled', false);
5844
+ }
5845
+
5846
+ function onEnterOrSpaceKey(e) {
5847
+ if (e.keyCode !== 13 && e.keyCode !== 32) return;
5848
+ const params = swiper.params.a11y;
5849
+ const $targetEl = $(e.target);
5850
+
5851
+ if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) {
5852
+ if (!(swiper.isEnd && !swiper.params.loop)) {
5853
+ swiper.slideNext();
5854
+ }
5855
+
5856
+ if (swiper.isEnd) {
5857
+ notify(params.lastSlideMessage);
5858
+ } else {
5859
+ notify(params.nextSlideMessage);
5860
+ }
5861
+ }
5862
+
5863
+ if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) {
5864
+ if (!(swiper.isBeginning && !swiper.params.loop)) {
5865
+ swiper.slidePrev();
5866
+ }
5867
+
5868
+ if (swiper.isBeginning) {
5869
+ notify(params.firstSlideMessage);
5870
+ } else {
5871
+ notify(params.prevSlideMessage);
5872
+ }
5873
+ }
5874
+
5875
+ if (swiper.pagination && $targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))) {
5876
+ $targetEl[0].click();
5877
+ }
5878
+ }
5879
+
5880
+ function updateNavigation() {
5881
+ if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;
5882
+ const {
5883
+ $nextEl,
5884
+ $prevEl
5885
+ } = swiper.navigation;
5886
+
5887
+ if ($prevEl && $prevEl.length > 0) {
5888
+ if (swiper.isBeginning) {
5889
+ disableEl($prevEl);
5890
+ makeElNotFocusable($prevEl);
5891
+ } else {
5892
+ enableEl($prevEl);
5893
+ makeElFocusable($prevEl);
5894
+ }
5895
+ }
5896
+
5897
+ if ($nextEl && $nextEl.length > 0) {
5898
+ if (swiper.isEnd) {
5899
+ disableEl($nextEl);
5900
+ makeElNotFocusable($nextEl);
5901
+ } else {
5902
+ enableEl($nextEl);
5903
+ makeElFocusable($nextEl);
5904
+ }
5905
+ }
5906
+ }
5907
+
5908
+ function hasPagination() {
5909
+ return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;
5910
+ }
5911
+
5912
+ function hasClickablePagination() {
5913
+ return hasPagination() && swiper.params.pagination.clickable;
5914
+ }
5915
+
5916
+ function updatePagination() {
5917
+ const params = swiper.params.a11y;
5918
+ if (!hasPagination()) return;
5919
+ swiper.pagination.bullets.each(bulletEl => {
5920
+ const $bulletEl = $(bulletEl);
5921
+
5922
+ if (swiper.params.pagination.clickable) {
5923
+ makeElFocusable($bulletEl);
5924
+
5925
+ if (!swiper.params.pagination.renderBullet) {
5926
+ addElRole($bulletEl, 'button');
5927
+ addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1));
5928
+ }
5929
+ }
5930
+
5931
+ if ($bulletEl.is(`.${swiper.params.pagination.bulletActiveClass}`)) {
5932
+ $bulletEl.attr('aria-current', 'true');
5933
+ } else {
5934
+ $bulletEl.removeAttr('aria-current');
5935
+ }
5936
+ });
5937
+ }
5938
+
5939
+ const initNavEl = ($el, wrapperId, message) => {
5940
+ makeElFocusable($el);
5941
+
5942
+ if ($el[0].tagName !== 'BUTTON') {
5943
+ addElRole($el, 'button');
5944
+ $el.on('keydown', onEnterOrSpaceKey);
5945
+ }
5946
+
5947
+ addElLabel($el, message);
5948
+ addElControls($el, wrapperId);
5949
+ };
5950
+
5951
+ const handlePointerDown = () => {
5952
+ swiper.a11y.clicked = true;
5953
+ };
5954
+
5955
+ const handlePointerUp = () => {
5956
+ requestAnimationFrame(() => {
5957
+ requestAnimationFrame(() => {
5958
+ if (!swiper.destroyed) {
5959
+ swiper.a11y.clicked = false;
5960
+ }
5961
+ });
5962
+ });
5963
+ };
5964
+
5965
+ const handleFocus = e => {
5966
+ if (swiper.a11y.clicked) return;
5967
+ const slideEl = e.target.closest(`.${swiper.params.slideClass}`);
5968
+ if (!slideEl || !swiper.slides.includes(slideEl)) return;
5969
+ const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
5970
+ const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
5971
+ if (isActive || isVisible) return;
5972
+ if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
5973
+
5974
+ if (swiper.isHorizontal()) {
5975
+ swiper.el.scrollLeft = 0;
5976
+ } else {
5977
+ swiper.el.scrollTop = 0;
5978
+ }
5979
+
5980
+ swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
5981
+ };
5982
+
5983
+ const initSlides = () => {
5984
+ const params = swiper.params.a11y;
5985
+
5986
+ if (params.itemRoleDescriptionMessage) {
5987
+ addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage);
5988
+ }
5989
+
5990
+ if (params.slideRole) {
5991
+ addElRole($(swiper.slides), params.slideRole);
5992
+ }
5993
+
5994
+ const slidesLength = swiper.params.loop ? swiper.slides.filter(el => !el.classList.contains(swiper.params.slideDuplicateClass)).length : swiper.slides.length;
5995
+
5996
+ if (params.slideLabelMessage) {
5997
+ swiper.slides.each((slideEl, index) => {
5998
+ const $slideEl = $(slideEl);
5999
+ const slideIndex = swiper.params.loop ? parseInt($slideEl.attr('data-swiper-slide-index'), 10) : index;
6000
+ const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
6001
+ addElLabel($slideEl, ariaLabelMessage);
6002
+ });
6003
+ }
6004
+ };
6005
+
6006
+ const init = () => {
6007
+ const params = swiper.params.a11y;
6008
+ swiper.$el.append(liveRegion); // Container
6009
+
6010
+ const $containerEl = swiper.$el;
6011
+
6012
+ if (params.containerRoleDescriptionMessage) {
6013
+ addElRoleDescription($containerEl, params.containerRoleDescriptionMessage);
6014
+ }
6015
+
6016
+ if (params.containerMessage) {
6017
+ addElLabel($containerEl, params.containerMessage);
6018
+ } // Wrapper
6019
+
6020
+
6021
+ const $wrapperEl = swiper.$wrapperEl;
6022
+ const wrapperId = params.id || $wrapperEl.attr('id') || `swiper-wrapper-${getRandomNumber(16)}`;
6023
+ const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
6024
+ addElId($wrapperEl, wrapperId);
6025
+ addElLive($wrapperEl, live); // Slide
6026
+
6027
+ initSlides(); // Navigation
6028
+
6029
+ let $nextEl;
6030
+ let $prevEl;
6031
+
6032
+ if (swiper.navigation && swiper.navigation.$nextEl) {
6033
+ $nextEl = swiper.navigation.$nextEl;
6034
+ }
6035
+
6036
+ if (swiper.navigation && swiper.navigation.$prevEl) {
6037
+ $prevEl = swiper.navigation.$prevEl;
6038
+ }
6039
+
6040
+ if ($nextEl && $nextEl.length) {
6041
+ initNavEl($nextEl, wrapperId, params.nextSlideMessage);
6042
+ }
6043
+
6044
+ if ($prevEl && $prevEl.length) {
6045
+ initNavEl($prevEl, wrapperId, params.prevSlideMessage);
6046
+ } // Pagination
6047
+
6048
+
6049
+ if (hasClickablePagination()) {
6050
+ swiper.pagination.$el.on('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey);
6051
+ } // Tab focus
6052
+
6053
+
6054
+ swiper.$el.on('focus', handleFocus, true);
6055
+ swiper.$el.on('pointerdown', handlePointerDown, true);
6056
+ swiper.$el.on('pointerup', handlePointerUp, true);
6057
+ };
6058
+
6059
+ function destroy() {
6060
+ if (liveRegion && liveRegion.length > 0) liveRegion.remove();
6061
+ let $nextEl;
6062
+ let $prevEl;
6063
+
6064
+ if (swiper.navigation && swiper.navigation.$nextEl) {
6065
+ $nextEl = swiper.navigation.$nextEl;
6066
+ }
6067
+
6068
+ if (swiper.navigation && swiper.navigation.$prevEl) {
6069
+ $prevEl = swiper.navigation.$prevEl;
6070
+ }
6071
+
6072
+ if ($nextEl) {
6073
+ $nextEl.off('keydown', onEnterOrSpaceKey);
6074
+ }
6075
+
6076
+ if ($prevEl) {
6077
+ $prevEl.off('keydown', onEnterOrSpaceKey);
6078
+ } // Pagination
6079
+
6080
+
6081
+ if (hasClickablePagination()) {
6082
+ swiper.pagination.$el.off('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey);
6083
+ } // Tab focus
6084
+
6085
+
6086
+ swiper.$el.off('focus', handleFocus, true);
6087
+ swiper.$el.off('pointerdown', handlePointerDown, true);
6088
+ swiper.$el.off('pointerup', handlePointerUp, true);
6089
+ }
6090
+
6091
+ on('beforeInit', () => {
6092
+ liveRegion = $(`<span class="${swiper.params.a11y.notificationClass}" aria-live="assertive" aria-atomic="true"></span>`);
6093
+ });
6094
+ on('afterInit', () => {
6095
+ if (!swiper.params.a11y.enabled) return;
6096
+ init();
6097
+ });
6098
+ on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => {
6099
+ if (!swiper.params.a11y.enabled) return;
6100
+ initSlides();
6101
+ });
6102
+ on('fromEdge toEdge afterInit lock unlock', () => {
6103
+ if (!swiper.params.a11y.enabled) return;
6104
+ updateNavigation();
6105
+ });
6106
+ on('paginationUpdate', () => {
6107
+ if (!swiper.params.a11y.enabled) return;
6108
+ updatePagination();
6109
+ });
6110
+ on('destroy', () => {
6111
+ if (!swiper.params.a11y.enabled) return;
6112
+ destroy();
6113
+ });
6114
+ }
6115
+
6116
+ exports.A11y = A11y;
5767
6117
  exports.Lazy = Lazy;
5768
6118
  exports.Navigation = Navigation;
5769
6119
  exports.Pagination = Pagination;
5770
6120
  exports.Swiper = Swiper;
5771
- exports.classesToSelector = classesToSelector;
5772
6121
  exports.getDocument = getDocument;
5773
6122
  exports.nextTick = nextTick;
@@ -7,8 +7,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const index = require('./index-65c0de9a.js');
9
9
  const utils = require('./utils-85481438.js');
10
- const lazy = require('./lazy-400cf804.js');
11
- const slider = require('./slider-3ccbc3e0.js');
10
+ const a11y = require('./a11y-ec6649c6.js');
11
+ const slider = require('./slider-c7104397.js');
12
12
  const fragment = require('./fragment-29c21ac8.js');
13
13
  const storeUtils = require('./storeUtils-6e9b9011.js');
14
14
  const getters = require('./getters-c3c47af0.js');
@@ -145,8 +145,8 @@ const CovetPicsDirectBuy = class {
145
145
  // TODO add exception for slides length == 1
146
146
  const galleryMainEl = this.el.shadowRoot.querySelector(".main-gallery");
147
147
  const paginationEl = this.el.shadowRoot.querySelector(".swiper-pagination");
148
- return this.mainGallery = new lazy.Swiper(galleryMainEl, {
149
- modules: [lazy.Pagination, slider.A11y],
148
+ return this.mainGallery = new a11y.Swiper(galleryMainEl, {
149
+ modules: [a11y.Pagination, a11y.A11y],
150
150
  on: {
151
151
  init: (e) => slider.swiperUpdateTabIndex(e),
152
152
  update: (e) => slider.swiperUpdateTabIndex(e),
@@ -4029,10 +4029,10 @@ const CovetPicsPopup = class {
4029
4029
  // if swiper exists then first destroy it
4030
4030
  if (typeof this.swiper !== "undefined")
4031
4031
  this.clearSwiper();
4032
- this.swiper = new lazy.Swiper(carouselMediaEl, {
4032
+ this.swiper = new a11y.Swiper(carouselMediaEl, {
4033
4033
  slidesPerView: 1,
4034
4034
  loop: true,
4035
- modules: [lazy.Navigation, lazy.Pagination, lazy.Lazy, slider.A11y],
4035
+ modules: [a11y.Navigation, a11y.Pagination, a11y.Lazy, a11y.A11y],
4036
4036
  on: {
4037
4037
  init: (e) => slider.swiperUpdateTabIndex(e),
4038
4038
  update: (e) => slider.swiperUpdateTabIndex(e),
@@ -8,7 +8,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
8
8
  const index = require('./index-65c0de9a.js');
9
9
  const utils$1 = require('./utils-85481438.js');
10
10
  const _commonjsHelpers = require('./_commonjsHelpers-b66a770d.js');
11
- const lazy = require('./lazy-400cf804.js');
11
+ const a11y = require('./a11y-ec6649c6.js');
12
12
  const slider = require('./slider-dbefa25c.js');
13
13
  require('./redux-toolkit.esm-ed0a74c1.js');
14
14
 
@@ -3713,7 +3713,7 @@ function Autoplay({
3713
3713
  }
3714
3714
 
3715
3715
  clearTimeout(timeout);
3716
- timeout = lazy.nextTick(() => {
3716
+ timeout = a11y.nextTick(() => {
3717
3717
  let autoplayResult;
3718
3718
 
3719
3719
  if (swiper.params.autoplay.reverseDirection) {
@@ -3790,7 +3790,7 @@ function Autoplay({
3790
3790
  }
3791
3791
 
3792
3792
  function onVisibilityChange() {
3793
- const document = lazy.getDocument();
3793
+ const document = a11y.getDocument();
3794
3794
 
3795
3795
  if (document.visibilityState === 'hidden' && swiper.autoplay.running) {
3796
3796
  pause();
@@ -3855,7 +3855,7 @@ function Autoplay({
3855
3855
  on('init', () => {
3856
3856
  if (swiper.params.autoplay.enabled) {
3857
3857
  start();
3858
- const document = lazy.getDocument();
3858
+ const document = a11y.getDocument();
3859
3859
  document.addEventListener('visibilitychange', onVisibilityChange);
3860
3860
  attachMouseEvents();
3861
3861
  }
@@ -3890,7 +3890,7 @@ function Autoplay({
3890
3890
  stop();
3891
3891
  }
3892
3892
 
3893
- const document = lazy.getDocument();
3893
+ const document = a11y.getDocument();
3894
3894
  document.removeEventListener('visibilitychange', onVisibilityChange);
3895
3895
  });
3896
3896
  Object.assign(swiper.autoplay, {
@@ -4000,7 +4000,8 @@ const CovetPicsGallerySlider = class {
4000
4000
  const mobileItemPaddingPX = (this.mobileItemPadding / 100) * galleryEl.offsetWidth;
4001
4001
  const desktopItemPaddingPX = (this.desktopItemPadding / 100) * galleryEl.offsetWidth;
4002
4002
  const paginationEl = this.el.querySelector(".gallery .swiper-pagination");
4003
- this.swiper = new lazy.Swiper(galleryEl, {
4003
+ this.swiper = new a11y.Swiper(galleryEl, {
4004
+ modules: [Autoplay, a11y.Lazy, a11y.Navigation, a11y.Pagination, a11y.A11y],
4004
4005
  on: {
4005
4006
  init: (e) => {
4006
4007
  this.sliderInit.emit(e);
@@ -4024,8 +4025,17 @@ const CovetPicsGallerySlider = class {
4024
4025
  }
4025
4026
  }
4026
4027
  },
4028
+ a11y: {
4029
+ enabled: true,
4030
+ prevSlideMessage: "Previous item",
4031
+ nextSlideMessage: "Next item",
4032
+ containerMessage: "Gallery slider",
4033
+ containerRoleDescriptionMessage: `Gallery slider ${this.items.length} items`,
4034
+ paginationBulletMessage: "Goto item #{{index}}",
4035
+ slideRole: "group",
4036
+ slideLabelMessage: "" // used custom aria-label
4037
+ },
4027
4038
  preloadImages: false,
4028
- modules: [Autoplay, lazy.Lazy, lazy.Navigation, lazy.Pagination],
4029
4039
  lazy: {
4030
4040
  elementClass: "bg",
4031
4041
  loadPrevNext: true,
@@ -4147,11 +4157,11 @@ const CovetPicsGallerySlider = class {
4147
4157
  }
4148
4158
  render() {
4149
4159
  if (this.items !== undefined) {
4150
- return (index.h("section", { id: "covet-pics-slider", class: "gallery swiper", role: "region", "aria-label": "main slider" }, index.h("button", { class: `swiper-button-prev ${this.itemStyle}`, tabindex: "0", "aria-label": "slider contol prev", "aria-controls": "covet-pics-slider", type: "button" }, index.h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, index.h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " }))), index.h("div", { class: "swiper-wrapper" }, this.itemStyle === "standard" && this.items.map((item, idx) => item.source === "upload_widget"
4160
+ return (index.h("section", { id: "covet-pics-slider", class: "gallery swiper" }, index.h("button", { class: `swiper-button-prev ${this.itemStyle}`, type: "button" }, index.h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, index.h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " }))), index.h("div", { class: "swiper-wrapper" }, this.itemStyle === "standard" && this.items.map((item, idx) => item.source === "upload_widget"
4151
4161
  ? this.renderStandardUploadItem(item, idx, this.items.length)
4152
4162
  : this.renderStandardItem(item, idx, this.items.length)), this.itemStyle !== "standard" && this.items.map((item, idx) => item.source === "upload_widget"
4153
4163
  ? this.renderDetailUploadItem(item, idx, this.items.length)
4154
- : this.renderDetailItem(item, idx, this.items.length))), index.h("div", { class: "swiper-pagination" }), index.h("button", { class: `swiper-button-next ${this.itemStyle}`, tabindex: "0", "aria-label": "slider contol next", "aria-controls": "covet-pics-slider", type: "button" }, index.h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, index.h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " })))));
4164
+ : this.renderDetailItem(item, idx, this.items.length))), index.h("div", { class: "swiper-pagination" }), index.h("button", { class: `swiper-button-next ${this.itemStyle}`, type: "button" }, index.h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, index.h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " })))));
4155
4165
  }
4156
4166
  }
4157
4167
  get el() { return index.getElement(this); }
@@ -4403,17 +4413,10 @@ const CovetPicsHighlighted = class {
4403
4413
  });
4404
4414
  return Promise.all([hide, show]);
4405
4415
  }
4406
- highlightedAriaLabel() {
4407
- if (this.layout === "zigzag")
4408
- return "pages vertical zigzag layout";
4409
- if (this.layout === "row")
4410
- return "pages vertical grid layout";
4411
- return null;
4412
- }
4413
4416
  render() {
4414
4417
  const showPagination = ((this.layout === "slider" && !this.isDesktopScreen) || this.layout === "spotlight")
4415
4418
  && this.items && this.items.length > 1;
4416
- return (index.h(index.Host, { class: this.layout, style: this.setCSSVariables(), onClick: (e) => !this.isDesktopScreen && this.layout === "row" ? this.isClickOutsideHotspot(e) : null, role: this.layout === "zigzag" || this.layout === "row" ? "grid" : "region", "aria-label": this.highlightedAriaLabel() }, this.renderMainLayout(), showPagination &&
4419
+ return (index.h(index.Host, { class: this.layout, style: this.setCSSVariables(), onClick: (e) => !this.isDesktopScreen && this.layout === "row" ? this.isClickOutsideHotspot(e) : null, role: "region", "aria-label": "Page gallery", "aria-roledescription": `Gallery ${this.items.length} posts` }, this.renderMainLayout(), showPagination &&
4417
4420
  index.h("span", { class: "page-pagination" }, `${this.mainSliderIndex + 1}/${this.items.length}`)));
4418
4421
  }
4419
4422
  get el() { return index.getElement(this); }
@@ -9,9 +9,9 @@ const index = require('./index-65c0de9a.js');
9
9
  const utils = require('./utils-85481438.js');
10
10
  const getters = require('./getters-c3c47af0.js');
11
11
  const storeUtils = require('./storeUtils-6e9b9011.js');
12
- const lazy = require('./lazy-400cf804.js');
13
- const slider = require('./slider-3ccbc3e0.js');
12
+ const a11y = require('./a11y-ec6649c6.js');
14
13
  const fragment = require('./fragment-29c21ac8.js');
14
+ const slider = require('./slider-c7104397.js');
15
15
 
16
16
  function effectInit(params) {
17
17
  const {
@@ -552,8 +552,8 @@ const CovetPicsHighlightedPage = class {
552
552
  slideLabelMessage: "Product item {{index}}/{{slidesLength}}"
553
553
  };
554
554
  if (this.isMobile && this.layout === "zigzag") {
555
- return this.productSlider = new lazy.Swiper(slider$1, {
556
- modules: [lazy.Lazy, slider.A11y],
555
+ return this.productSlider = new a11y.Swiper(slider$1, {
556
+ modules: [a11y.Lazy, a11y.A11y],
557
557
  slidesPerView: 1,
558
558
  loop: false,
559
559
  on: {
@@ -572,8 +572,8 @@ const CovetPicsHighlightedPage = class {
572
572
  }
573
573
  if (this.productsLayout === "layout-1") {
574
574
  const paginationEl = this.el.querySelector(".product .pagination");
575
- return this.productSlider = new lazy.Swiper(slider$1, {
576
- modules: [lazy.Lazy, lazy.Navigation, lazy.Pagination, EffectFade, slider.A11y],
575
+ return this.productSlider = new a11y.Swiper(slider$1, {
576
+ modules: [a11y.Lazy, a11y.Navigation, a11y.Pagination, EffectFade, a11y.A11y],
577
577
  slidesPerView: 1,
578
578
  effect: this.isMobile ? null : "fade",
579
579
  fadeEffect: {
@@ -608,8 +608,8 @@ const CovetPicsHighlightedPage = class {
608
608
  const sliderDescription = this.el.querySelector(".product .slider-description");
609
609
  this.additionalProductSlider = this.isMobile
610
610
  ? null
611
- : new lazy.Swiper(sliderDescription, {
612
- modules: [lazy.Lazy, lazy.Navigation, lazy.Pagination, EffectFade, slider.A11y],
611
+ : new a11y.Swiper(sliderDescription, {
612
+ modules: [a11y.Lazy, a11y.Navigation, a11y.Pagination, EffectFade, a11y.A11y],
613
613
  on: {
614
614
  init: (e) => slider.swiperUpdateTabIndex(e),
615
615
  update: (e) => slider.swiperUpdateTabIndex(e),
@@ -637,8 +637,8 @@ const CovetPicsHighlightedPage = class {
637
637
  loadPrevNext: true,
638
638
  },
639
639
  });
640
- return this.productSlider = new lazy.Swiper(slider$1, {
641
- modules: [lazy.Lazy, lazy.Navigation, lazy.Pagination, EffectFade, slider.A11y],
640
+ return this.productSlider = new a11y.Swiper(slider$1, {
641
+ modules: [a11y.Lazy, a11y.Navigation, a11y.Pagination, EffectFade, a11y.A11y],
642
642
  slidesPerView: 1,
643
643
  effect: this.isMobile ? null : "fade",
644
644
  fadeEffect: {
@@ -669,8 +669,8 @@ const CovetPicsHighlightedPage = class {
669
669
  });
670
670
  }
671
671
  if (this.productsLayout === "layout-3") {
672
- return this.productSlider = new lazy.Swiper(slider$1, {
673
- modules: [lazy.Lazy, lazy.Navigation, slider.A11y],
672
+ return this.productSlider = new a11y.Swiper(slider$1, {
673
+ modules: [a11y.Lazy, a11y.Navigation, a11y.A11y],
674
674
  slidesPerView: this.isMobile ? 1 : 2,
675
675
  effect: null,
676
676
  loop: this.isMobile ? false : true,
@@ -698,8 +698,8 @@ const CovetPicsHighlightedPage = class {
698
698
  const slidesCount = this.isMobile
699
699
  ? 1
700
700
  : 3;
701
- return this.productSlider = new lazy.Swiper(slider$1, {
702
- modules: [lazy.Lazy, lazy.Navigation, slider.A11y],
701
+ return this.productSlider = new a11y.Swiper(slider$1, {
702
+ modules: [a11y.Lazy, a11y.Navigation, a11y.A11y],
703
703
  slidesPerView: slidesCount,
704
704
  effect: null,
705
705
  loop: this.isMobile ? false : true,
@@ -728,8 +728,8 @@ const CovetPicsHighlightedPage = class {
728
728
  return true;
729
729
  const slider$1 = this.el.querySelector(".thumbnail .swiper");
730
730
  const paginationEl = this.el.querySelector(".thumbnail .thumbnail-pagination");
731
- return this.thumbnailCarousel = new lazy.Swiper(slider$1, {
732
- modules: [lazy.Lazy, lazy.Pagination, EffectFade, slider.A11y],
731
+ return this.thumbnailCarousel = new a11y.Swiper(slider$1, {
732
+ modules: [a11y.Lazy, a11y.Pagination, EffectFade, a11y.A11y],
733
733
  slidesPerView: 1,
734
734
  effect: "fade",
735
735
  fadeEffect: {
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright (c) 2020 by Space Squirrel Ltd.
3
+ */
4
+ 'use strict';
5
+
6
+ function swiperUpdateTabIndex(e) {
7
+ const activeIndex = e.activeIndex;
8
+ const slidesPerView = e.params.slidesPerView;
9
+ const slides = Array.from(e.slides);
10
+ slides.forEach((slide, idx) => {
11
+ slide.setAttribute("tabindex", `${activeIndex - 1 < idx && idx < activeIndex + slidesPerView ? 0 : -1}`);
12
+ slide.setAttribute("aria-hidden", `${!(activeIndex - 1 < idx && idx < activeIndex + slidesPerView)}`);
13
+ return slide;
14
+ });
15
+ }
16
+
17
+ exports.swiperUpdateTabIndex = swiperUpdateTabIndex;
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2020 by Space Squirrel Ltd.
3
3
  */
4
4
  import { h } from "@stencil/core";
5
- import Swiper, { Autoplay, Lazy, Navigation, Pagination } from "swiper";
5
+ import Swiper, { Autoplay, Lazy, Navigation, Pagination, A11y } from "swiper";
6
6
  import { buildEvent, createCovetPicsPopup, createUploadPopup, getCoverImage, getDateFromTimestamp, getSizesForResponsiveImage, getStyle } from "../../utils/utils";
7
7
  import { setSliderIndex, setSliderSlidesPerView } from "../../store/slider";
8
8
  export class CovetPicsGallerySlider {
@@ -98,6 +98,7 @@ export class CovetPicsGallerySlider {
98
98
  const desktopItemPaddingPX = (this.desktopItemPadding / 100) * galleryEl.offsetWidth;
99
99
  const paginationEl = this.el.querySelector(".gallery .swiper-pagination");
100
100
  this.swiper = new Swiper(galleryEl, {
101
+ modules: [Autoplay, Lazy, Navigation, Pagination, A11y],
101
102
  on: {
102
103
  init: (e) => {
103
104
  this.sliderInit.emit(e);
@@ -121,8 +122,17 @@ export class CovetPicsGallerySlider {
121
122
  }
122
123
  }
123
124
  },
125
+ a11y: {
126
+ enabled: true,
127
+ prevSlideMessage: "Previous item",
128
+ nextSlideMessage: "Next item",
129
+ containerMessage: "Gallery slider",
130
+ containerRoleDescriptionMessage: `Gallery slider ${this.items.length} items`,
131
+ paginationBulletMessage: "Goto item #{{index}}",
132
+ slideRole: "group",
133
+ slideLabelMessage: "" // used custom aria-label
134
+ },
124
135
  preloadImages: false,
125
- modules: [Autoplay, Lazy, Navigation, Pagination],
126
136
  lazy: {
127
137
  elementClass: "bg",
128
138
  loadPrevNext: true,
@@ -244,11 +254,11 @@ export class CovetPicsGallerySlider {
244
254
  }
245
255
  render() {
246
256
  if (this.items !== undefined) {
247
- return (h("section", { id: "covet-pics-slider", class: "gallery swiper", role: "region", "aria-label": "main slider" }, h("button", { class: `swiper-button-prev ${this.itemStyle}`, tabindex: "0", "aria-label": "slider contol prev", "aria-controls": "covet-pics-slider", type: "button" }, h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " }))), h("div", { class: "swiper-wrapper" }, this.itemStyle === "standard" && this.items.map((item, idx) => item.source === "upload_widget"
257
+ return (h("section", { id: "covet-pics-slider", class: "gallery swiper" }, h("button", { class: `swiper-button-prev ${this.itemStyle}`, type: "button" }, h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " }))), h("div", { class: "swiper-wrapper" }, this.itemStyle === "standard" && this.items.map((item, idx) => item.source === "upload_widget"
248
258
  ? this.renderStandardUploadItem(item, idx, this.items.length)
249
259
  : this.renderStandardItem(item, idx, this.items.length)), this.itemStyle !== "standard" && this.items.map((item, idx) => item.source === "upload_widget"
250
260
  ? this.renderDetailUploadItem(item, idx, this.items.length)
251
- : this.renderDetailItem(item, idx, this.items.length))), h("div", { class: "swiper-pagination" }), h("button", { class: `swiper-button-next ${this.itemStyle}`, tabindex: "0", "aria-label": "slider contol next", "aria-controls": "covet-pics-slider", type: "button" }, h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " })))));
261
+ : this.renderDetailItem(item, idx, this.items.length))), h("div", { class: "swiper-pagination" }), h("button", { class: `swiper-button-next ${this.itemStyle}`, type: "button" }, h("svg", { viewBox: "0 0 100 100", "aria-hidden": "true" }, h("path", { d: "M35.5992906,51.1028539 L41.7768136,57.2847304 L41.7768136,61.570226 L30,49.785113 L41.7768136,38 L41.7768136,42.2854956 L35.9938338,48.0725509 L69.1769366,48.0725509 L69.1769366,51.1028539 L35.5992906,51.1028539 Z", class: "arrow", transform: "translate(100, 100) rotate(180) " })))));
252
262
  }
253
263
  }
254
264
  static get is() { return "covet-pics-gallery-slider"; }