pb-sxp-ui 1.9.1 → 1.9.2

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.
package/dist/index.cjs CHANGED
@@ -320,6 +320,17 @@ function getCookie(val) {
320
320
  });
321
321
  return value !== null && value !== void 0 ? value : '';
322
322
  }
323
+ function getScreenReader() {
324
+ let userAgent = self.navigator.userAgent;
325
+ if (!userAgent)
326
+ return false;
327
+ return (/TalkBack/i.test(userAgent) ||
328
+ /Funtouch/i.test(userAgent) ||
329
+ /VoiceOver/i.test(userAgent) ||
330
+ /NVDA/i.test(userAgent) ||
331
+ /JAWS/i.test(userAgent) ||
332
+ /ChromeVox/i.test(userAgent));
333
+ }
323
334
 
324
335
  function unzip(b64Data) {
325
336
  const strData = atob(b64Data);
@@ -2601,6 +2612,119 @@ function makeElementsArray(el) {
2601
2612
  return (Array.isArray(el) ? el : [el]).filter(e => !!e);
2602
2613
  }
2603
2614
 
2615
+ /* eslint-disable consistent-return */
2616
+ function Keyboard(_ref) {
2617
+ let {
2618
+ swiper,
2619
+ extendParams,
2620
+ on,
2621
+ emit
2622
+ } = _ref;
2623
+ const document = getDocument();
2624
+ const window = getWindow();
2625
+ swiper.keyboard = {
2626
+ enabled: false
2627
+ };
2628
+ extendParams({
2629
+ keyboard: {
2630
+ enabled: false,
2631
+ onlyInViewport: true,
2632
+ pageUpDown: true
2633
+ }
2634
+ });
2635
+ function handle(event) {
2636
+ if (!swiper.enabled) return;
2637
+ const {
2638
+ rtlTranslate: rtl
2639
+ } = swiper;
2640
+ let e = event;
2641
+ if (e.originalEvent) e = e.originalEvent; // jquery fix
2642
+ const kc = e.keyCode || e.charCode;
2643
+ const pageUpDown = swiper.params.keyboard.pageUpDown;
2644
+ const isPageUp = pageUpDown && kc === 33;
2645
+ const isPageDown = pageUpDown && kc === 34;
2646
+ const isArrowLeft = kc === 37;
2647
+ const isArrowRight = kc === 39;
2648
+ const isArrowUp = kc === 38;
2649
+ const isArrowDown = kc === 40;
2650
+ // Directions locks
2651
+ if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {
2652
+ return false;
2653
+ }
2654
+ if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {
2655
+ return false;
2656
+ }
2657
+ if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
2658
+ return undefined;
2659
+ }
2660
+ if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
2661
+ return undefined;
2662
+ }
2663
+ if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
2664
+ let inView = false;
2665
+ // Check that swiper should be inside of visible area of window
2666
+ if (elementParents(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && elementParents(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) {
2667
+ return undefined;
2668
+ }
2669
+ const el = swiper.el;
2670
+ const swiperWidth = el.clientWidth;
2671
+ const swiperHeight = el.clientHeight;
2672
+ const windowWidth = window.innerWidth;
2673
+ const windowHeight = window.innerHeight;
2674
+ const swiperOffset = elementOffset(el);
2675
+ if (rtl) swiperOffset.left -= el.scrollLeft;
2676
+ const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]];
2677
+ for (let i = 0; i < swiperCoord.length; i += 1) {
2678
+ const point = swiperCoord[i];
2679
+ if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {
2680
+ if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
2681
+ inView = true;
2682
+ }
2683
+ }
2684
+ if (!inView) return undefined;
2685
+ }
2686
+ if (swiper.isHorizontal()) {
2687
+ if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {
2688
+ if (e.preventDefault) e.preventDefault();else e.returnValue = false;
2689
+ }
2690
+ if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();
2691
+ if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();
2692
+ } else {
2693
+ if (isPageUp || isPageDown || isArrowUp || isArrowDown) {
2694
+ if (e.preventDefault) e.preventDefault();else e.returnValue = false;
2695
+ }
2696
+ if (isPageDown || isArrowDown) swiper.slideNext();
2697
+ if (isPageUp || isArrowUp) swiper.slidePrev();
2698
+ }
2699
+ emit('keyPress', kc);
2700
+ return undefined;
2701
+ }
2702
+ function enable() {
2703
+ if (swiper.keyboard.enabled) return;
2704
+ document.addEventListener('keydown', handle);
2705
+ swiper.keyboard.enabled = true;
2706
+ }
2707
+ function disable() {
2708
+ if (!swiper.keyboard.enabled) return;
2709
+ document.removeEventListener('keydown', handle);
2710
+ swiper.keyboard.enabled = false;
2711
+ }
2712
+ on('init', () => {
2713
+ if (swiper.params.keyboard.enabled) {
2714
+ enable();
2715
+ }
2716
+ });
2717
+ on('destroy', () => {
2718
+ if (swiper.keyboard.enabled) {
2719
+ disable();
2720
+ }
2721
+ });
2722
+ Object.assign(swiper.keyboard, {
2723
+ enable,
2724
+ disable
2725
+ });
2726
+ }
2727
+
2604
2728
  /* eslint-disable consistent-return */
2605
2729
  function Mousewheel(_ref) {
2606
2730
  let {
@@ -3008,6 +3132,202 @@ function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
3008
3132
  return params;
3009
3133
  }
3010
3134
 
3135
+ function Navigation(_ref) {
3136
+ let {
3137
+ swiper,
3138
+ extendParams,
3139
+ on,
3140
+ emit
3141
+ } = _ref;
3142
+ extendParams({
3143
+ navigation: {
3144
+ nextEl: null,
3145
+ prevEl: null,
3146
+ hideOnClick: false,
3147
+ disabledClass: 'swiper-button-disabled',
3148
+ hiddenClass: 'swiper-button-hidden',
3149
+ lockClass: 'swiper-button-lock',
3150
+ navigationDisabledClass: 'swiper-navigation-disabled'
3151
+ }
3152
+ });
3153
+ swiper.navigation = {
3154
+ nextEl: null,
3155
+ prevEl: null
3156
+ };
3157
+ function getEl(el) {
3158
+ let res;
3159
+ if (el && typeof el === 'string' && swiper.isElement) {
3160
+ res = swiper.el.querySelector(el);
3161
+ if (res) return res;
3162
+ }
3163
+ if (el) {
3164
+ if (typeof el === 'string') res = [...document.querySelectorAll(el)];
3165
+ if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
3166
+ res = swiper.el.querySelector(el);
3167
+ } else if (res && res.length === 1) {
3168
+ res = res[0];
3169
+ }
3170
+ }
3171
+ if (el && !res) return el;
3172
+ // if (Array.isArray(res) && res.length === 1) res = res[0];
3173
+ return res;
3174
+ }
3175
+ function toggleEl(el, disabled) {
3176
+ const params = swiper.params.navigation;
3177
+ el = makeElementsArray(el);
3178
+ el.forEach(subEl => {
3179
+ if (subEl) {
3180
+ subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));
3181
+ if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
3182
+ if (swiper.params.watchOverflow && swiper.enabled) {
3183
+ subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
3184
+ }
3185
+ }
3186
+ });
3187
+ }
3188
+ function update() {
3189
+ // Update Navigation Buttons
3190
+ const {
3191
+ nextEl,
3192
+ prevEl
3193
+ } = swiper.navigation;
3194
+ if (swiper.params.loop) {
3195
+ toggleEl(prevEl, false);
3196
+ toggleEl(nextEl, false);
3197
+ return;
3198
+ }
3199
+ toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
3200
+ toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
3201
+ }
3202
+ function onPrevClick(e) {
3203
+ e.preventDefault();
3204
+ if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
3205
+ swiper.slidePrev();
3206
+ emit('navigationPrev');
3207
+ }
3208
+ function onNextClick(e) {
3209
+ e.preventDefault();
3210
+ if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
3211
+ swiper.slideNext();
3212
+ emit('navigationNext');
3213
+ }
3214
+ function init() {
3215
+ const params = swiper.params.navigation;
3216
+ swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
3217
+ nextEl: 'swiper-button-next',
3218
+ prevEl: 'swiper-button-prev'
3219
+ });
3220
+ if (!(params.nextEl || params.prevEl)) return;
3221
+ let nextEl = getEl(params.nextEl);
3222
+ let prevEl = getEl(params.prevEl);
3223
+ Object.assign(swiper.navigation, {
3224
+ nextEl,
3225
+ prevEl
3226
+ });
3227
+ nextEl = makeElementsArray(nextEl);
3228
+ prevEl = makeElementsArray(prevEl);
3229
+ const initButton = (el, dir) => {
3230
+ if (el) {
3231
+ el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
3232
+ }
3233
+ if (!swiper.enabled && el) {
3234
+ el.classList.add(...params.lockClass.split(' '));
3235
+ }
3236
+ };
3237
+ nextEl.forEach(el => initButton(el, 'next'));
3238
+ prevEl.forEach(el => initButton(el, 'prev'));
3239
+ }
3240
+ function destroy() {
3241
+ let {
3242
+ nextEl,
3243
+ prevEl
3244
+ } = swiper.navigation;
3245
+ nextEl = makeElementsArray(nextEl);
3246
+ prevEl = makeElementsArray(prevEl);
3247
+ const destroyButton = (el, dir) => {
3248
+ el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
3249
+ el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));
3250
+ };
3251
+ nextEl.forEach(el => destroyButton(el, 'next'));
3252
+ prevEl.forEach(el => destroyButton(el, 'prev'));
3253
+ }
3254
+ on('init', () => {
3255
+ if (swiper.params.navigation.enabled === false) {
3256
+ // eslint-disable-next-line
3257
+ disable();
3258
+ } else {
3259
+ init();
3260
+ update();
3261
+ }
3262
+ });
3263
+ on('toEdge fromEdge lock unlock', () => {
3264
+ update();
3265
+ });
3266
+ on('destroy', () => {
3267
+ destroy();
3268
+ });
3269
+ on('enable disable', () => {
3270
+ let {
3271
+ nextEl,
3272
+ prevEl
3273
+ } = swiper.navigation;
3274
+ nextEl = makeElementsArray(nextEl);
3275
+ prevEl = makeElementsArray(prevEl);
3276
+ if (swiper.enabled) {
3277
+ update();
3278
+ return;
3279
+ }
3280
+ [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass));
3281
+ });
3282
+ on('click', (_s, e) => {
3283
+ let {
3284
+ nextEl,
3285
+ prevEl
3286
+ } = swiper.navigation;
3287
+ nextEl = makeElementsArray(nextEl);
3288
+ prevEl = makeElementsArray(prevEl);
3289
+ const targetEl = e.target;
3290
+ let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl);
3291
+ if (swiper.isElement && !targetIsButton) {
3292
+ const path = e.path || e.composedPath && e.composedPath();
3293
+ if (path) {
3294
+ targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl));
3295
+ }
3296
+ }
3297
+ if (swiper.params.navigation.hideOnClick && !targetIsButton) {
3298
+ if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
3299
+ let isHidden;
3300
+ if (nextEl.length) {
3301
+ isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
3302
+ } else if (prevEl.length) {
3303
+ isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
3304
+ }
3305
+ if (isHidden === true) {
3306
+ emit('navigationShow');
3307
+ } else {
3308
+ emit('navigationHide');
3309
+ }
3310
+ [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));
3311
+ }
3312
+ });
3313
+ const enable = () => {
3314
+ swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));
3315
+ init();
3316
+ update();
3317
+ };
3318
+ const disable = () => {
3319
+ swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));
3320
+ destroy();
3321
+ };
3322
+ Object.assign(swiper.navigation, {
3323
+ enable,
3324
+ disable,
3325
+ update,
3326
+ init,
3327
+ destroy
3328
+ });
3329
+ }
3330
+
3011
3331
  function classesToSelector(classes) {
3012
3332
  if (classes === void 0) {
3013
3333
  classes = '';
@@ -3814,6 +4134,374 @@ function Scrollbar(_ref) {
3814
4134
  });
3815
4135
  }
3816
4136
 
4137
+ function A11y(_ref) {
4138
+ let {
4139
+ swiper,
4140
+ extendParams,
4141
+ on
4142
+ } = _ref;
4143
+ extendParams({
4144
+ a11y: {
4145
+ enabled: true,
4146
+ notificationClass: 'swiper-notification',
4147
+ prevSlideMessage: 'Previous slide',
4148
+ nextSlideMessage: 'Next slide',
4149
+ firstSlideMessage: 'This is the first slide',
4150
+ lastSlideMessage: 'This is the last slide',
4151
+ paginationBulletMessage: 'Go to slide {{index}}',
4152
+ slideLabelMessage: '{{index}} / {{slidesLength}}',
4153
+ containerMessage: null,
4154
+ containerRoleDescriptionMessage: null,
4155
+ itemRoleDescriptionMessage: null,
4156
+ slideRole: 'group',
4157
+ id: null
4158
+ }
4159
+ });
4160
+ swiper.a11y = {
4161
+ clicked: false
4162
+ };
4163
+ let liveRegion = null;
4164
+ let preventFocusHandler;
4165
+ let focusTargetSlideEl;
4166
+ let visibilityChangedTimestamp = new Date().getTime();
4167
+ function notify(message) {
4168
+ const notification = liveRegion;
4169
+ if (notification.length === 0) return;
4170
+ notification.innerHTML = '';
4171
+ notification.innerHTML = message;
4172
+ }
4173
+ function getRandomNumber(size) {
4174
+ if (size === void 0) {
4175
+ size = 16;
4176
+ }
4177
+ const randomChar = () => Math.round(16 * Math.random()).toString(16);
4178
+ return 'x'.repeat(size).replace(/x/g, randomChar);
4179
+ }
4180
+ function makeElFocusable(el) {
4181
+ el = makeElementsArray(el);
4182
+ el.forEach(subEl => {
4183
+ subEl.setAttribute('tabIndex', '0');
4184
+ });
4185
+ }
4186
+ function makeElNotFocusable(el) {
4187
+ el = makeElementsArray(el);
4188
+ el.forEach(subEl => {
4189
+ subEl.setAttribute('tabIndex', '-1');
4190
+ });
4191
+ }
4192
+ function addElRole(el, role) {
4193
+ el = makeElementsArray(el);
4194
+ el.forEach(subEl => {
4195
+ subEl.setAttribute('role', role);
4196
+ });
4197
+ }
4198
+ function addElRoleDescription(el, description) {
4199
+ el = makeElementsArray(el);
4200
+ el.forEach(subEl => {
4201
+ subEl.setAttribute('aria-roledescription', description);
4202
+ });
4203
+ }
4204
+ function addElControls(el, controls) {
4205
+ el = makeElementsArray(el);
4206
+ el.forEach(subEl => {
4207
+ subEl.setAttribute('aria-controls', controls);
4208
+ });
4209
+ }
4210
+ function addElLabel(el, label) {
4211
+ el = makeElementsArray(el);
4212
+ el.forEach(subEl => {
4213
+ subEl.setAttribute('aria-label', label);
4214
+ });
4215
+ }
4216
+ function addElId(el, id) {
4217
+ el = makeElementsArray(el);
4218
+ el.forEach(subEl => {
4219
+ subEl.setAttribute('id', id);
4220
+ });
4221
+ }
4222
+ function addElLive(el, live) {
4223
+ el = makeElementsArray(el);
4224
+ el.forEach(subEl => {
4225
+ subEl.setAttribute('aria-live', live);
4226
+ });
4227
+ }
4228
+ function disableEl(el) {
4229
+ el = makeElementsArray(el);
4230
+ el.forEach(subEl => {
4231
+ subEl.setAttribute('aria-disabled', true);
4232
+ });
4233
+ }
4234
+ function enableEl(el) {
4235
+ el = makeElementsArray(el);
4236
+ el.forEach(subEl => {
4237
+ subEl.setAttribute('aria-disabled', false);
4238
+ });
4239
+ }
4240
+ function onEnterOrSpaceKey(e) {
4241
+ if (e.keyCode !== 13 && e.keyCode !== 32) return;
4242
+ const params = swiper.params.a11y;
4243
+ const targetEl = e.target;
4244
+ if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {
4245
+ if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;
4246
+ }
4247
+ if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) {
4248
+ const prevEls = makeElementsArray(swiper.navigation.prevEl);
4249
+ const nextEls = makeElementsArray(swiper.navigation.nextEl);
4250
+ if (nextEls.includes(targetEl)) {
4251
+ if (!(swiper.isEnd && !swiper.params.loop)) {
4252
+ swiper.slideNext();
4253
+ }
4254
+ if (swiper.isEnd) {
4255
+ notify(params.lastSlideMessage);
4256
+ } else {
4257
+ notify(params.nextSlideMessage);
4258
+ }
4259
+ }
4260
+ if (prevEls.includes(targetEl)) {
4261
+ if (!(swiper.isBeginning && !swiper.params.loop)) {
4262
+ swiper.slidePrev();
4263
+ }
4264
+ if (swiper.isBeginning) {
4265
+ notify(params.firstSlideMessage);
4266
+ } else {
4267
+ notify(params.prevSlideMessage);
4268
+ }
4269
+ }
4270
+ }
4271
+ if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {
4272
+ targetEl.click();
4273
+ }
4274
+ }
4275
+ function updateNavigation() {
4276
+ if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;
4277
+ const {
4278
+ nextEl,
4279
+ prevEl
4280
+ } = swiper.navigation;
4281
+ if (prevEl) {
4282
+ if (swiper.isBeginning) {
4283
+ disableEl(prevEl);
4284
+ makeElNotFocusable(prevEl);
4285
+ } else {
4286
+ enableEl(prevEl);
4287
+ makeElFocusable(prevEl);
4288
+ }
4289
+ }
4290
+ if (nextEl) {
4291
+ if (swiper.isEnd) {
4292
+ disableEl(nextEl);
4293
+ makeElNotFocusable(nextEl);
4294
+ } else {
4295
+ enableEl(nextEl);
4296
+ makeElFocusable(nextEl);
4297
+ }
4298
+ }
4299
+ }
4300
+ function hasPagination() {
4301
+ return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;
4302
+ }
4303
+ function hasClickablePagination() {
4304
+ return hasPagination() && swiper.params.pagination.clickable;
4305
+ }
4306
+ function updatePagination() {
4307
+ const params = swiper.params.a11y;
4308
+ if (!hasPagination()) return;
4309
+ swiper.pagination.bullets.forEach(bulletEl => {
4310
+ if (swiper.params.pagination.clickable) {
4311
+ makeElFocusable(bulletEl);
4312
+ if (!swiper.params.pagination.renderBullet) {
4313
+ addElRole(bulletEl, 'button');
4314
+ addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, elementIndex(bulletEl) + 1));
4315
+ }
4316
+ }
4317
+ if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) {
4318
+ bulletEl.setAttribute('aria-current', 'true');
4319
+ } else {
4320
+ bulletEl.removeAttribute('aria-current');
4321
+ }
4322
+ });
4323
+ }
4324
+ const initNavEl = (el, wrapperId, message) => {
4325
+ makeElFocusable(el);
4326
+ if (el.tagName !== 'BUTTON') {
4327
+ addElRole(el, 'button');
4328
+ el.addEventListener('keydown', onEnterOrSpaceKey);
4329
+ }
4330
+ addElLabel(el, message);
4331
+ addElControls(el, wrapperId);
4332
+ };
4333
+ const handlePointerDown = e => {
4334
+ if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) {
4335
+ preventFocusHandler = true;
4336
+ }
4337
+ swiper.a11y.clicked = true;
4338
+ };
4339
+ const handlePointerUp = () => {
4340
+ preventFocusHandler = false;
4341
+ requestAnimationFrame(() => {
4342
+ requestAnimationFrame(() => {
4343
+ if (!swiper.destroyed) {
4344
+ swiper.a11y.clicked = false;
4345
+ }
4346
+ });
4347
+ });
4348
+ };
4349
+ const onVisibilityChange = e => {
4350
+ visibilityChangedTimestamp = new Date().getTime();
4351
+ };
4352
+ const handleFocus = e => {
4353
+ if (swiper.a11y.clicked) return;
4354
+ if (new Date().getTime() - visibilityChangedTimestamp < 100) return;
4355
+ const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
4356
+ if (!slideEl || !swiper.slides.includes(slideEl)) return;
4357
+ focusTargetSlideEl = slideEl;
4358
+ const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
4359
+ const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
4360
+ if (isActive || isVisible) return;
4361
+ if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
4362
+ if (swiper.isHorizontal()) {
4363
+ swiper.el.scrollLeft = 0;
4364
+ } else {
4365
+ swiper.el.scrollTop = 0;
4366
+ }
4367
+ requestAnimationFrame(() => {
4368
+ if (preventFocusHandler) return;
4369
+ if (swiper.params.loop) {
4370
+ swiper.slideToLoop(parseInt(slideEl.getAttribute('data-swiper-slide-index')), 0);
4371
+ } else {
4372
+ swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
4373
+ }
4374
+ preventFocusHandler = false;
4375
+ });
4376
+ };
4377
+ const initSlides = () => {
4378
+ const params = swiper.params.a11y;
4379
+ if (params.itemRoleDescriptionMessage) {
4380
+ addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage);
4381
+ }
4382
+ if (params.slideRole) {
4383
+ addElRole(swiper.slides, params.slideRole);
4384
+ }
4385
+ const slidesLength = swiper.slides.length;
4386
+ if (params.slideLabelMessage) {
4387
+ swiper.slides.forEach((slideEl, index) => {
4388
+ const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index;
4389
+ const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
4390
+ addElLabel(slideEl, ariaLabelMessage);
4391
+ });
4392
+ }
4393
+ };
4394
+ const init = () => {
4395
+ const params = swiper.params.a11y;
4396
+ swiper.el.append(liveRegion);
4397
+
4398
+ // Container
4399
+ const containerEl = swiper.el;
4400
+ if (params.containerRoleDescriptionMessage) {
4401
+ addElRoleDescription(containerEl, params.containerRoleDescriptionMessage);
4402
+ }
4403
+ if (params.containerMessage) {
4404
+ addElLabel(containerEl, params.containerMessage);
4405
+ }
4406
+
4407
+ // Wrapper
4408
+ const wrapperEl = swiper.wrapperEl;
4409
+ const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`;
4410
+ const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
4411
+ addElId(wrapperEl, wrapperId);
4412
+ addElLive(wrapperEl, live);
4413
+
4414
+ // Slide
4415
+ initSlides();
4416
+
4417
+ // Navigation
4418
+ let {
4419
+ nextEl,
4420
+ prevEl
4421
+ } = swiper.navigation ? swiper.navigation : {};
4422
+ nextEl = makeElementsArray(nextEl);
4423
+ prevEl = makeElementsArray(prevEl);
4424
+ if (nextEl) {
4425
+ nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage));
4426
+ }
4427
+ if (prevEl) {
4428
+ prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage));
4429
+ }
4430
+
4431
+ // Pagination
4432
+ if (hasClickablePagination()) {
4433
+ const paginationEl = makeElementsArray(swiper.pagination.el);
4434
+ paginationEl.forEach(el => {
4435
+ el.addEventListener('keydown', onEnterOrSpaceKey);
4436
+ });
4437
+ }
4438
+
4439
+ // Tab focus
4440
+ const document = getDocument();
4441
+ document.addEventListener('visibilitychange', onVisibilityChange);
4442
+ swiper.el.addEventListener('focus', handleFocus, true);
4443
+ swiper.el.addEventListener('focus', handleFocus, true);
4444
+ swiper.el.addEventListener('pointerdown', handlePointerDown, true);
4445
+ swiper.el.addEventListener('pointerup', handlePointerUp, true);
4446
+ };
4447
+ function destroy() {
4448
+ if (liveRegion) liveRegion.remove();
4449
+ let {
4450
+ nextEl,
4451
+ prevEl
4452
+ } = swiper.navigation ? swiper.navigation : {};
4453
+ nextEl = makeElementsArray(nextEl);
4454
+ prevEl = makeElementsArray(prevEl);
4455
+ if (nextEl) {
4456
+ nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
4457
+ }
4458
+ if (prevEl) {
4459
+ prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
4460
+ }
4461
+
4462
+ // Pagination
4463
+ if (hasClickablePagination()) {
4464
+ const paginationEl = makeElementsArray(swiper.pagination.el);
4465
+ paginationEl.forEach(el => {
4466
+ el.removeEventListener('keydown', onEnterOrSpaceKey);
4467
+ });
4468
+ }
4469
+ const document = getDocument();
4470
+ document.removeEventListener('visibilitychange', onVisibilityChange);
4471
+ // Tab focus
4472
+ if (swiper.el && typeof swiper.el !== 'string') {
4473
+ swiper.el.removeEventListener('focus', handleFocus, true);
4474
+ swiper.el.removeEventListener('pointerdown', handlePointerDown, true);
4475
+ swiper.el.removeEventListener('pointerup', handlePointerUp, true);
4476
+ }
4477
+ }
4478
+ on('beforeInit', () => {
4479
+ liveRegion = createElement('span', swiper.params.a11y.notificationClass);
4480
+ liveRegion.setAttribute('aria-live', 'assertive');
4481
+ liveRegion.setAttribute('aria-atomic', 'true');
4482
+ });
4483
+ on('afterInit', () => {
4484
+ if (!swiper.params.a11y.enabled) return;
4485
+ init();
4486
+ });
4487
+ on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => {
4488
+ if (!swiper.params.a11y.enabled) return;
4489
+ initSlides();
4490
+ });
4491
+ on('fromEdge toEdge afterInit lock unlock', () => {
4492
+ if (!swiper.params.a11y.enabled) return;
4493
+ updateNavigation();
4494
+ });
4495
+ on('paginationUpdate', () => {
4496
+ if (!swiper.params.a11y.enabled) return;
4497
+ updatePagination();
4498
+ });
4499
+ on('destroy', () => {
4500
+ if (!swiper.params.a11y.enabled) return;
4501
+ destroy();
4502
+ });
4503
+ }
4504
+
3817
4505
  /* eslint no-underscore-dangle: "off" */
3818
4506
  /* eslint no-use-before-define: "off" */
3819
4507
  function Autoplay(_ref) {
@@ -8997,13 +9685,13 @@ SwiperSlide.displayName = 'SwiperSlide';
8997
9685
  * @Author: binruan@chatlabs.com
8998
9686
  * @Date: 2023-11-02 18:34:34
8999
9687
  * @LastEditors: binruan@chatlabs.com
9000
- * @LastEditTime: 2024-11-19 14:28:41
9688
+ * @LastEditTime: 2024-11-20 18:37:10
9001
9689
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Modal\index.tsx
9002
9690
  *
9003
9691
  */
9004
9692
  const closeIcon$1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
9005
9693
  const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false, openState }) => {
9006
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
9694
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
9007
9695
  const touchRef = React.useRef(null);
9008
9696
  const fTouchRef = React.useRef(null);
9009
9697
  const touchMoveRef = React.useRef(null);
@@ -9058,7 +9746,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
9058
9746
  }, [_popup, openState, globalConfig]);
9059
9747
  React.useEffect(() => {
9060
9748
  const trapFocus = (element) => {
9061
- var focusableEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('a, a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
9749
+ var focusableEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('[role="button"],a, a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
9062
9750
  var firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
9063
9751
  var lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
9064
9752
  var KEYCODE_TAB = 9;
@@ -9181,7 +9869,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
9181
9869
  }
9182
9870
  })), child()),
9183
9871
  React.createElement("button", { className: 'modal-icon-wrapper', role: 'button', "aria-label": 'close button', onClick: onClose, style: { top: scrollTop } },
9184
- React.createElement("img", { src: (_0 = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _0 !== void 0 ? _0 : closeIcon$1, alt: 'close button', className: 'modal-icon' }))))))), modalEleRef.current);
9872
+ React.createElement("img", { src: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) || closeIcon$1, alt: 'close button', className: 'modal-icon' }))))))), modalEleRef.current);
9185
9873
  };
9186
9874
  var Modal$1 = React.memo(Modal);
9187
9875
 
@@ -9448,7 +10136,8 @@ const CommodityDetail$1 = (_a) => {
9448
10136
  const [showModal, setShowModal] = React.useState(false);
9449
10137
  const [show3DModal, setShow3DModal] = React.useState(false);
9450
10138
  const [checkCommodityIndex, setCheckCommodityIndex] = React.useState((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
9451
- const ref = React.useRef();
10139
+ const swiperRef = React.useRef();
10140
+ const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
9452
10141
  const data = isPost ? rec : popupDetailData;
9453
10142
  let product = isPost ? data === null || data === void 0 ? void 0 : data.product : (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) !== null && _d !== void 0 ? _d : (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProducts) === null || _f === void 0 ? void 0 : _f[0];
9454
10143
  let cta = isPost
@@ -9539,9 +10228,9 @@ const CommodityDetail$1 = (_a) => {
9539
10228
  popupCurTimeRef.current = new Date();
9540
10229
  setCheckCommodityIndex(index);
9541
10230
  checkCommodityIndexRef.current = index;
9542
- if (ref === null || ref === void 0 ? void 0 : ref.current) {
9543
- ref.current.swiper.slideTo(0);
9544
- ref.current.swiper.autoplay.start();
10231
+ if (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) {
10232
+ swiperRef.current.swiper.slideTo(0);
10233
+ swiperRef.current.swiper.autoplay.start();
9545
10234
  }
9546
10235
  }, []);
9547
10236
  const renderCommodityGroup = React.useCallback(() => {
@@ -9559,19 +10248,40 @@ const CommodityDetail$1 = (_a) => {
9559
10248
  return dotsAlignClass === null || dotsAlignClass === void 0 ? void 0 : dotsAlignClass[swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign];
9560
10249
  }, [swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign]);
9561
10250
  const iframeUrl = product === null || product === void 0 ? void 0 : product.remark;
10251
+ const handleMouseEnter = React.useCallback(() => {
10252
+ if (swiperRef.current && swiperRef.current.swiper && isAlly) {
10253
+ swiperRef.current.swiper.autoplay.stop();
10254
+ }
10255
+ }, []);
10256
+ const handleMouseLeave = React.useCallback(() => {
10257
+ if (swiperRef.current && swiperRef.current.swiper && isAlly) {
10258
+ swiperRef.current.swiper.autoplay.start();
10259
+ }
10260
+ }, []);
10261
+ const handleSlideChange = React.useCallback((swiper) => {
10262
+ setSwiperActiveIndex(swiper.activeIndex);
10263
+ }, []);
10264
+ const isAlly = React.useMemo(() => getScreenReader(), []);
9562
10265
  return (React.createElement(React.Fragment, null,
9563
10266
  React.createElement("div", Object.assign({ className: css.css(Object.assign({}, style)) }, props),
9564
- React.createElement("div", { style: { position: 'relative' } },
9565
- product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (React.createElement(Swiper, { a11y: {
9566
- enabled: true
9567
- }, height: height, modules: [Pagination, Autoplay], pagination: {
10267
+ React.createElement("div", { style: { position: 'relative' }, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
10268
+ product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (React.createElement(Swiper, Object.assign({ height: height, modules: [Pagination, Autoplay, ...(isAlly ? [Navigation, A11y, Mousewheel, Keyboard] : [])], pagination: {
9568
10269
  clickable: true,
9569
10270
  bulletActiveClass: 'swipe-item-active-bullet',
9570
10271
  clickableClass: getDotsAlign,
9571
10272
  bulletElement: 'button'
9572
- }, loop: true, autoplay: {
10273
+ } }, (isAlly
10274
+ ? {
10275
+ mousewheel: true,
10276
+ keyboard: true,
10277
+ navigation: true,
10278
+ a11y: {
10279
+ enabled: true
10280
+ }
10281
+ }
10282
+ : {}), { loop: true, autoplay: {
9573
10283
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
9574
- }, ref: ref, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': { bottom: (_x = swiper === null || swiper === void 0 ? void 0 : swiper.dotsMarginBottom) !== null && _x !== void 0 ? _x : 0, fontSize: '14px' } }, ((swiper === null || swiper === void 0 ? void 0 : swiper.dotsBgColor) && {
10284
+ }, ref: swiperRef, onSlideChange: handleSlideChange, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': { bottom: (_x = swiper === null || swiper === void 0 ? void 0 : swiper.dotsMarginBottom) !== null && _x !== void 0 ? _x : 0, fontSize: '14px' } }, ((swiper === null || swiper === void 0 ? void 0 : swiper.dotsBgColor) && {
9575
10285
  '.swiper-pagination-bullet': {
9576
10286
  backgroundColor: swiper === null || swiper === void 0 ? void 0 : swiper.dotsBgColor,
9577
10287
  opacity: 1
@@ -9581,10 +10291,10 @@ const CommodityDetail$1 = (_a) => {
9581
10291
  backgroundColor: `${swiper === null || swiper === void 0 ? void 0 : swiper.dotsActiveColor}!important`,
9582
10292
  opacity: 1
9583
10293
  }
9584
- }))) },
9585
- React.createElement(React.Fragment, null, (_y = product === null || product === void 0 ? void 0 : product.homePage) === null || _y === void 0 ? void 0 : _y.map((src) => {
10294
+ }))) }),
10295
+ React.createElement(React.Fragment, null, (_y = product === null || product === void 0 ? void 0 : product.homePage) === null || _y === void 0 ? void 0 : _y.map((src, srcKey) => {
9586
10296
  var _a;
9587
- return (React.createElement(SwiperSlide, { key: src },
10297
+ return (React.createElement(SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
9588
10298
  React.createElement("div", { style: {
9589
10299
  overflow: 'hidden',
9590
10300
  width,
@@ -10337,7 +11047,8 @@ const CommodityDetailDiroNew$1 = (_a) => {
10337
11047
  const curTimeRef = React.useRef(null);
10338
11048
  const [show3DModal, setShow3DModal] = React.useState(false);
10339
11049
  const [checkCommodityIndex, setCheckCommodityIndex] = React.useState((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
10340
- const ref = React.useRef();
11050
+ const swiperRef = React.useRef();
11051
+ const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
10341
11052
  const data = isPost ? rec : popupDetailData;
10342
11053
  let product = isPost ? data === null || data === void 0 ? void 0 : data.product : (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) !== null && _d !== void 0 ? _d : (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProducts) === null || _f === void 0 ? void 0 : _f[0];
10343
11054
  let cta = isPost
@@ -10457,9 +11168,9 @@ Made in Italy` })));
10457
11168
  popupCurTimeRef.current = new Date();
10458
11169
  setCheckCommodityIndex(index);
10459
11170
  checkCommodityIndexRef.current = index;
10460
- if (ref === null || ref === void 0 ? void 0 : ref.current) {
10461
- ref.current.swiper.slideTo(0);
10462
- ref.current.swiper.autoplay.start();
11171
+ if (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) {
11172
+ swiperRef.current.swiper.slideTo(0);
11173
+ swiperRef.current.swiper.autoplay.start();
10463
11174
  }
10464
11175
  }, []);
10465
11176
  const renderCommodityGroup = React.useCallback(() => {
@@ -10477,17 +11188,40 @@ Made in Italy` })));
10477
11188
  return dotsAlignClass === null || dotsAlignClass === void 0 ? void 0 : dotsAlignClass[swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign];
10478
11189
  }, [swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign]);
10479
11190
  const iframeUrl = product === null || product === void 0 ? void 0 : product.remark;
11191
+ const handleMouseEnter = React.useCallback(() => {
11192
+ if (swiperRef.current && swiperRef.current.swiper && isAlly) {
11193
+ swiperRef.current.swiper.autoplay.stop();
11194
+ }
11195
+ }, []);
11196
+ const handleMouseLeave = React.useCallback(() => {
11197
+ if (swiperRef.current && swiperRef.current.swiper && isAlly) {
11198
+ swiperRef.current.swiper.autoplay.start();
11199
+ }
11200
+ }, []);
11201
+ const handleSlideChange = React.useCallback((swiper) => {
11202
+ setSwiperActiveIndex(swiper.activeIndex);
11203
+ }, []);
11204
+ const isAlly = React.useMemo(() => getScreenReader(), []);
10480
11205
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
10481
11206
  React.createElement("div", Object.assign({ className: css.css(Object.assign(Object.assign({}, style), { transform: 'translate3d(0px, 0px, 0px)' })) }, props),
10482
- React.createElement("div", { style: { position: 'relative' } },
10483
- product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (React.createElement(Swiper, { height: height, modules: [Pagination, Autoplay], pagination: {
11207
+ React.createElement("div", { style: { position: 'relative' }, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
11208
+ product && ((_w = product === null || product === void 0 ? void 0 : product.homePage) === null || _w === void 0 ? void 0 : _w.length) > 0 && (React.createElement(Swiper, Object.assign({ height: height, modules: [Pagination, Autoplay, ...(isAlly ? [Navigation, A11y, Mousewheel, Keyboard] : [])], pagination: {
10484
11209
  clickable: true,
10485
11210
  bulletActiveClass: 'swipe-item-active-bullet',
10486
11211
  clickableClass: getDotsAlign,
10487
11212
  bulletElement: 'button'
10488
- }, loop: true, autoplay: {
11213
+ } }, (isAlly
11214
+ ? {
11215
+ mousewheel: true,
11216
+ keyboard: true,
11217
+ navigation: true,
11218
+ a11y: {
11219
+ enabled: true
11220
+ }
11221
+ }
11222
+ : {}), { loop: true, ref: swiperRef, onSlideChange: handleSlideChange, autoplay: {
10489
11223
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
10490
- }, ref: ref, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': {
11224
+ }, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': {
10491
11225
  bottom: (_x = swiper === null || swiper === void 0 ? void 0 : swiper.dotsMarginBottom) !== null && _x !== void 0 ? _x : 0,
10492
11226
  fontSize: '14px'
10493
11227
  } }, ((swiper === null || swiper === void 0 ? void 0 : swiper.dotsBgColor) && {
@@ -10500,9 +11234,9 @@ Made in Italy` })));
10500
11234
  backgroundColor: `${swiper === null || swiper === void 0 ? void 0 : swiper.dotsActiveColor}!important`,
10501
11235
  opacity: 1
10502
11236
  }
10503
- }))) }, (_y = product === null || product === void 0 ? void 0 : product.homePage) === null || _y === void 0 ? void 0 : _y.map((src) => {
11237
+ }))) }), (_y = product === null || product === void 0 ? void 0 : product.homePage) === null || _y === void 0 ? void 0 : _y.map((src, srcKey) => {
10504
11238
  var _a;
10505
- return (React.createElement(SwiperSlide, { key: src },
11239
+ return (React.createElement(SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
10506
11240
  React.createElement("div", { style: {
10507
11241
  overflow: 'hidden',
10508
11242
  width,
@@ -15408,7 +16142,7 @@ var styles = {"aniLinkPopup":"index-module_aniLinkPopup__YT7kj","animated-fadeIn
15408
16142
 
15409
16143
  const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
15410
16144
  const AniLinkPopup$1 = (_a) => {
15411
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
16145
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
15412
16146
  var { style, recData, ctaTempStyles, index, event, bottom_image, translateY, isTel, onClick, isExternalLink = false, isActive } = _a, props = __rest(_a, ["style", "recData", "ctaTempStyles", "index", "event", "bottom_image", "translateY", "isTel", "onClick", "isExternalLink", "isActive"]);
15413
16147
  style === null || style === void 0 ? true : delete style.transform;
15414
16148
  const { sxpParameter, globalConfig, ctaEvent, setPopupDetailData } = useSxpDataSource();
@@ -15465,12 +16199,12 @@ const AniLinkPopup$1 = (_a) => {
15465
16199
  paddingLeft: '6px'
15466
16200
  } }, "Cta Title")) : (React.createElement("div", Object.assign({}, props, { className: `${css.css(Object.assign(Object.assign({}, style), { '--transY': `translateY(calc(100% + ${(_r = style === null || style === void 0 ? void 0 : style.margin) !== null && _r !== void 0 ? _r : 0}px))` }))} ${styles['aniLinkPopup']} ${aniNamStyle} ${css.css(aniTimStyle)}`, onClick: handleTo }),
15467
16201
  React.createElement("div", { onClick: onClose, className: styles['modal-icon-wrapper'], style: { padding: (_s = style === null || style === void 0 ? void 0 : style['padding']) !== null && _s !== void 0 ? _s : 0 } },
15468
- React.createElement("img", { src: (_t = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) !== null && _t !== void 0 ? _t : closeIcon, alt: 'close', className: styles['modal-icon-wrapper-img'] })),
15469
- React.createElement(Img$1, { src: src, rec: recData, item: (_y = (_w = (_v = (_u = recData === null || recData === void 0 ? void 0 : recData.video) === null || _u === void 0 ? void 0 : _u.bindProducts) === null || _v === void 0 ? void 0 : _v[0]) !== null && _w !== void 0 ? _w : (_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.bindProduct) !== null && _y !== void 0 ? _y : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img, isActive: isActive }),
16202
+ React.createElement("img", { src: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.popupCloseIcon) || closeIcon, alt: 'close', className: styles['modal-icon-wrapper-img'] })),
16203
+ React.createElement(Img$1, { src: src, rec: recData, item: (_x = (_v = (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.bindProducts) === null || _u === void 0 ? void 0 : _u[0]) !== null && _v !== void 0 ? _v : (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.bindProduct) !== null && _x !== void 0 ? _x : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img, isActive: isActive }),
15470
16204
  (!recData || (product === null || product === void 0 ? void 0 : product.title)) && (React.createElement("div", { className: styles['one-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title, dangerouslySetInnerHTML: {
15471
- __html: setFontForText((_z = product === null || product === void 0 ? void 0 : product.title) !== null && _z !== void 0 ? _z : 'Product Name', ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title)
16205
+ __html: setFontForText((_y = product === null || product === void 0 ? void 0 : product.title) !== null && _y !== void 0 ? _y : 'Product Name', ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title)
15472
16206
  } })),
15473
- React.createElement("div", { className: styles['one-line-ellipsis'], style: Object.assign(Object.assign({}, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle), { lineHeight: ((_0 = ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle) === null || _0 === void 0 ? void 0 : _0.height) + 'px' }), dangerouslySetInnerHTML: {
16207
+ React.createElement("div", { className: styles['one-line-ellipsis'], style: Object.assign(Object.assign({}, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle), { lineHeight: ((_z = ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle) === null || _z === void 0 ? void 0 : _z.height) + 'px' }), dangerouslySetInnerHTML: {
15474
16208
  __html: setFontForText(title, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)
15475
16209
  } })))));
15476
16210
  };
@@ -16482,15 +17216,16 @@ const Picture = (props) => {
16482
17216
 
16483
17217
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
16484
17218
  var _a, _b;
16485
- const ref = React.useRef();
17219
+ const swiperRef = React.useRef();
16486
17220
  const { isActive } = useSwiperSlide();
16487
17221
  const { sxpParameter, openHashtag } = useSxpDataSource();
16488
17222
  const [isLoad, setIsLoad] = React.useState(false);
16489
17223
  const [imgInfo, setImgInfo] = React.useState();
16490
17224
  const initTime = new Date();
17225
+ const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
16491
17226
  React.useEffect(() => {
16492
17227
  if (isLoad && isActive) {
16493
- (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.start();
17228
+ (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
16494
17229
  if (openHashtag) {
16495
17230
  onViewImageEndEvent(rec);
16496
17231
  }
@@ -16499,7 +17234,7 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
16499
17234
  }
16500
17235
  }
16501
17236
  else {
16502
- (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
17237
+ (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.stop();
16503
17238
  }
16504
17239
  }, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
16505
17240
  const showFirstImageFn = React.useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
@@ -16523,27 +17258,51 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
16523
17258
  SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
16524
17259
  };
16525
17260
  }, [imgInfo]);
16526
- return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: {
16527
- clickable: true,
16528
- bulletActiveClass: 'swipe-item-active-bullet',
16529
- bulletElement: 'button'
16530
- }, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': {
16531
- bottom: (_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) !== null && _a !== void 0 ? _a : 0,
16532
- fontSize: '14px'
16533
- } }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
16534
- '.swiper-pagination-bullet': {
16535
- backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor,
16536
- opacity: 1
16537
- }
16538
- })), ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsActiveColor) && {
16539
- '.swipe-item-active-bullet': {
16540
- backgroundColor: `${imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsActiveColor}!important`,
16541
- opacity: 1
17261
+ const handleMouseEnter = React.useCallback(() => {
17262
+ if (swiperRef.current && swiperRef.current.swiper && isAlly) {
17263
+ swiperRef.current.swiper.autoplay.stop();
17264
+ }
17265
+ }, []);
17266
+ const handleMouseLeave = React.useCallback(() => {
17267
+ if (swiperRef.current && swiperRef.current.swiper && isAlly) {
17268
+ swiperRef.current.swiper.autoplay.start();
17269
+ }
17270
+ }, []);
17271
+ const handleSlideChange = React.useCallback((swiper) => {
17272
+ setSwiperActiveIndex(swiper.activeIndex);
17273
+ }, []);
17274
+ const isAlly = React.useMemo(() => getScreenReader(), []);
17275
+ return (React.createElement("div", { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
17276
+ React.createElement(Swiper, Object.assign({ defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay, ...(isAlly ? [Navigation, A11y, Mousewheel, Keyboard] : [])], pagination: {
17277
+ clickable: true,
17278
+ bulletActiveClass: 'swipe-item-active-bullet',
17279
+ bulletElement: 'button'
17280
+ } }, (isAlly
17281
+ ? {
17282
+ mousewheel: true,
17283
+ keyboard: true,
17284
+ navigation: true,
17285
+ a11y: {
17286
+ enabled: true
17287
+ }
16542
17288
  }
16543
- }))), height: height, loop: true, autoplay: { delay: ((_b = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _b !== void 0 ? _b : 3) * 1000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url, index) => {
16544
- return (React.createElement(SwiperSlide, { key: index },
16545
- React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
16546
- })));
17289
+ : {}), { loop: true, ref: swiperRef, onSlideChange: handleSlideChange, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': {
17290
+ bottom: (_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) !== null && _a !== void 0 ? _a : 0,
17291
+ fontSize: '14px'
17292
+ } }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
17293
+ '.swiper-pagination-bullet': {
17294
+ backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor,
17295
+ opacity: 1
17296
+ }
17297
+ })), ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsActiveColor) && {
17298
+ '.swipe-item-active-bullet': {
17299
+ backgroundColor: `${imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsActiveColor}!important`,
17300
+ opacity: 1
17301
+ }
17302
+ }))), height: height, autoplay: { delay: ((_b = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _b !== void 0 ? _b : 3) * 1000 } }), imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url, srcKey) => {
17303
+ return (React.createElement(SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
17304
+ React.createElement(Picture, { src: !isLoad && srcKey > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
17305
+ }))));
16547
17306
  };
16548
17307
  var PictureGroup$3 = React.memo(PictureGroup$2);
16549
17308