@bigbinary/neeto-site-blocks 1.1.0 → 1.1.1
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.js +263 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +263 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15978,6 +15978,16 @@ function elementParents(el, selector) {
|
|
|
15978
15978
|
}
|
|
15979
15979
|
return parents;
|
|
15980
15980
|
}
|
|
15981
|
+
function elementTransitionEnd(el, callback) {
|
|
15982
|
+
function fireCallBack(e) {
|
|
15983
|
+
if (e.target !== el) return;
|
|
15984
|
+
callback.call(el, e);
|
|
15985
|
+
el.removeEventListener('transitionend', fireCallBack);
|
|
15986
|
+
}
|
|
15987
|
+
if (callback) {
|
|
15988
|
+
el.addEventListener('transitionend', fireCallBack);
|
|
15989
|
+
}
|
|
15990
|
+
}
|
|
15981
15991
|
function elementOuterSize(el, size, includeMargins) {
|
|
15982
15992
|
const window = getWindow();
|
|
15983
15993
|
if (includeMargins) {
|
|
@@ -39930,6 +39940,239 @@ function Thumb(_ref) {
|
|
|
39930
39940
|
});
|
|
39931
39941
|
}
|
|
39932
39942
|
|
|
39943
|
+
function freeMode(_ref) {
|
|
39944
|
+
let {
|
|
39945
|
+
swiper,
|
|
39946
|
+
extendParams,
|
|
39947
|
+
emit,
|
|
39948
|
+
once
|
|
39949
|
+
} = _ref;
|
|
39950
|
+
extendParams({
|
|
39951
|
+
freeMode: {
|
|
39952
|
+
enabled: false,
|
|
39953
|
+
momentum: true,
|
|
39954
|
+
momentumRatio: 1,
|
|
39955
|
+
momentumBounce: true,
|
|
39956
|
+
momentumBounceRatio: 1,
|
|
39957
|
+
momentumVelocityRatio: 1,
|
|
39958
|
+
sticky: false,
|
|
39959
|
+
minimumVelocity: 0.02
|
|
39960
|
+
}
|
|
39961
|
+
});
|
|
39962
|
+
function onTouchStart() {
|
|
39963
|
+
if (swiper.params.cssMode) return;
|
|
39964
|
+
const translate = swiper.getTranslate();
|
|
39965
|
+
swiper.setTranslate(translate);
|
|
39966
|
+
swiper.setTransition(0);
|
|
39967
|
+
swiper.touchEventsData.velocities.length = 0;
|
|
39968
|
+
swiper.freeMode.onTouchEnd({
|
|
39969
|
+
currentPos: swiper.rtl ? swiper.translate : -swiper.translate
|
|
39970
|
+
});
|
|
39971
|
+
}
|
|
39972
|
+
function onTouchMove() {
|
|
39973
|
+
if (swiper.params.cssMode) return;
|
|
39974
|
+
const {
|
|
39975
|
+
touchEventsData: data,
|
|
39976
|
+
touches
|
|
39977
|
+
} = swiper;
|
|
39978
|
+
// Velocity
|
|
39979
|
+
if (data.velocities.length === 0) {
|
|
39980
|
+
data.velocities.push({
|
|
39981
|
+
position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
|
|
39982
|
+
time: data.touchStartTime
|
|
39983
|
+
});
|
|
39984
|
+
}
|
|
39985
|
+
data.velocities.push({
|
|
39986
|
+
position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
|
|
39987
|
+
time: now()
|
|
39988
|
+
});
|
|
39989
|
+
}
|
|
39990
|
+
function onTouchEnd(_ref2) {
|
|
39991
|
+
let {
|
|
39992
|
+
currentPos
|
|
39993
|
+
} = _ref2;
|
|
39994
|
+
if (swiper.params.cssMode) return;
|
|
39995
|
+
const {
|
|
39996
|
+
params,
|
|
39997
|
+
wrapperEl,
|
|
39998
|
+
rtlTranslate: rtl,
|
|
39999
|
+
snapGrid,
|
|
40000
|
+
touchEventsData: data
|
|
40001
|
+
} = swiper;
|
|
40002
|
+
// Time diff
|
|
40003
|
+
const touchEndTime = now();
|
|
40004
|
+
const timeDiff = touchEndTime - data.touchStartTime;
|
|
40005
|
+
if (currentPos < -swiper.minTranslate()) {
|
|
40006
|
+
swiper.slideTo(swiper.activeIndex);
|
|
40007
|
+
return;
|
|
40008
|
+
}
|
|
40009
|
+
if (currentPos > -swiper.maxTranslate()) {
|
|
40010
|
+
if (swiper.slides.length < snapGrid.length) {
|
|
40011
|
+
swiper.slideTo(snapGrid.length - 1);
|
|
40012
|
+
} else {
|
|
40013
|
+
swiper.slideTo(swiper.slides.length - 1);
|
|
40014
|
+
}
|
|
40015
|
+
return;
|
|
40016
|
+
}
|
|
40017
|
+
if (params.freeMode.momentum) {
|
|
40018
|
+
if (data.velocities.length > 1) {
|
|
40019
|
+
const lastMoveEvent = data.velocities.pop();
|
|
40020
|
+
const velocityEvent = data.velocities.pop();
|
|
40021
|
+
const distance = lastMoveEvent.position - velocityEvent.position;
|
|
40022
|
+
const time = lastMoveEvent.time - velocityEvent.time;
|
|
40023
|
+
swiper.velocity = distance / time;
|
|
40024
|
+
swiper.velocity /= 2;
|
|
40025
|
+
if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
|
|
40026
|
+
swiper.velocity = 0;
|
|
40027
|
+
}
|
|
40028
|
+
// this implies that the user stopped moving a finger then released.
|
|
40029
|
+
// There would be no events with distance zero, so the last event is stale.
|
|
40030
|
+
if (time > 150 || now() - lastMoveEvent.time > 300) {
|
|
40031
|
+
swiper.velocity = 0;
|
|
40032
|
+
}
|
|
40033
|
+
} else {
|
|
40034
|
+
swiper.velocity = 0;
|
|
40035
|
+
}
|
|
40036
|
+
swiper.velocity *= params.freeMode.momentumVelocityRatio;
|
|
40037
|
+
data.velocities.length = 0;
|
|
40038
|
+
let momentumDuration = 1000 * params.freeMode.momentumRatio;
|
|
40039
|
+
const momentumDistance = swiper.velocity * momentumDuration;
|
|
40040
|
+
let newPosition = swiper.translate + momentumDistance;
|
|
40041
|
+
if (rtl) newPosition = -newPosition;
|
|
40042
|
+
let doBounce = false;
|
|
40043
|
+
let afterBouncePosition;
|
|
40044
|
+
const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
|
|
40045
|
+
let needsLoopFix;
|
|
40046
|
+
if (newPosition < swiper.maxTranslate()) {
|
|
40047
|
+
if (params.freeMode.momentumBounce) {
|
|
40048
|
+
if (newPosition + swiper.maxTranslate() < -bounceAmount) {
|
|
40049
|
+
newPosition = swiper.maxTranslate() - bounceAmount;
|
|
40050
|
+
}
|
|
40051
|
+
afterBouncePosition = swiper.maxTranslate();
|
|
40052
|
+
doBounce = true;
|
|
40053
|
+
data.allowMomentumBounce = true;
|
|
40054
|
+
} else {
|
|
40055
|
+
newPosition = swiper.maxTranslate();
|
|
40056
|
+
}
|
|
40057
|
+
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
40058
|
+
} else if (newPosition > swiper.minTranslate()) {
|
|
40059
|
+
if (params.freeMode.momentumBounce) {
|
|
40060
|
+
if (newPosition - swiper.minTranslate() > bounceAmount) {
|
|
40061
|
+
newPosition = swiper.minTranslate() + bounceAmount;
|
|
40062
|
+
}
|
|
40063
|
+
afterBouncePosition = swiper.minTranslate();
|
|
40064
|
+
doBounce = true;
|
|
40065
|
+
data.allowMomentumBounce = true;
|
|
40066
|
+
} else {
|
|
40067
|
+
newPosition = swiper.minTranslate();
|
|
40068
|
+
}
|
|
40069
|
+
if (params.loop && params.centeredSlides) needsLoopFix = true;
|
|
40070
|
+
} else if (params.freeMode.sticky) {
|
|
40071
|
+
let nextSlide;
|
|
40072
|
+
for (let j = 0; j < snapGrid.length; j += 1) {
|
|
40073
|
+
if (snapGrid[j] > -newPosition) {
|
|
40074
|
+
nextSlide = j;
|
|
40075
|
+
break;
|
|
40076
|
+
}
|
|
40077
|
+
}
|
|
40078
|
+
if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
|
|
40079
|
+
newPosition = snapGrid[nextSlide];
|
|
40080
|
+
} else {
|
|
40081
|
+
newPosition = snapGrid[nextSlide - 1];
|
|
40082
|
+
}
|
|
40083
|
+
newPosition = -newPosition;
|
|
40084
|
+
}
|
|
40085
|
+
if (needsLoopFix) {
|
|
40086
|
+
once('transitionEnd', () => {
|
|
40087
|
+
swiper.loopFix();
|
|
40088
|
+
});
|
|
40089
|
+
}
|
|
40090
|
+
// Fix duration
|
|
40091
|
+
if (swiper.velocity !== 0) {
|
|
40092
|
+
if (rtl) {
|
|
40093
|
+
momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
|
|
40094
|
+
} else {
|
|
40095
|
+
momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
|
|
40096
|
+
}
|
|
40097
|
+
if (params.freeMode.sticky) {
|
|
40098
|
+
// If freeMode.sticky is active and the user ends a swipe with a slow-velocity
|
|
40099
|
+
// event, then durations can be 20+ seconds to slide one (or zero!) slides.
|
|
40100
|
+
// It's easy to see this when simulating touch with mouse events. To fix this,
|
|
40101
|
+
// limit single-slide swipes to the default slide duration. This also has the
|
|
40102
|
+
// nice side effect of matching slide speed if the user stopped moving before
|
|
40103
|
+
// lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
|
|
40104
|
+
// For faster swipes, also apply limits (albeit higher ones).
|
|
40105
|
+
const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
|
|
40106
|
+
const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
|
|
40107
|
+
if (moveDistance < currentSlideSize) {
|
|
40108
|
+
momentumDuration = params.speed;
|
|
40109
|
+
} else if (moveDistance < 2 * currentSlideSize) {
|
|
40110
|
+
momentumDuration = params.speed * 1.5;
|
|
40111
|
+
} else {
|
|
40112
|
+
momentumDuration = params.speed * 2.5;
|
|
40113
|
+
}
|
|
40114
|
+
}
|
|
40115
|
+
} else if (params.freeMode.sticky) {
|
|
40116
|
+
swiper.slideToClosest();
|
|
40117
|
+
return;
|
|
40118
|
+
}
|
|
40119
|
+
if (params.freeMode.momentumBounce && doBounce) {
|
|
40120
|
+
swiper.updateProgress(afterBouncePosition);
|
|
40121
|
+
swiper.setTransition(momentumDuration);
|
|
40122
|
+
swiper.setTranslate(newPosition);
|
|
40123
|
+
swiper.transitionStart(true, swiper.swipeDirection);
|
|
40124
|
+
swiper.animating = true;
|
|
40125
|
+
elementTransitionEnd(wrapperEl, () => {
|
|
40126
|
+
if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
|
|
40127
|
+
emit('momentumBounce');
|
|
40128
|
+
swiper.setTransition(params.speed);
|
|
40129
|
+
setTimeout(() => {
|
|
40130
|
+
swiper.setTranslate(afterBouncePosition);
|
|
40131
|
+
elementTransitionEnd(wrapperEl, () => {
|
|
40132
|
+
if (!swiper || swiper.destroyed) return;
|
|
40133
|
+
swiper.transitionEnd();
|
|
40134
|
+
});
|
|
40135
|
+
}, 0);
|
|
40136
|
+
});
|
|
40137
|
+
} else if (swiper.velocity) {
|
|
40138
|
+
emit('_freeModeNoMomentumRelease');
|
|
40139
|
+
swiper.updateProgress(newPosition);
|
|
40140
|
+
swiper.setTransition(momentumDuration);
|
|
40141
|
+
swiper.setTranslate(newPosition);
|
|
40142
|
+
swiper.transitionStart(true, swiper.swipeDirection);
|
|
40143
|
+
if (!swiper.animating) {
|
|
40144
|
+
swiper.animating = true;
|
|
40145
|
+
elementTransitionEnd(wrapperEl, () => {
|
|
40146
|
+
if (!swiper || swiper.destroyed) return;
|
|
40147
|
+
swiper.transitionEnd();
|
|
40148
|
+
});
|
|
40149
|
+
}
|
|
40150
|
+
} else {
|
|
40151
|
+
swiper.updateProgress(newPosition);
|
|
40152
|
+
}
|
|
40153
|
+
swiper.updateActiveIndex();
|
|
40154
|
+
swiper.updateSlidesClasses();
|
|
40155
|
+
} else if (params.freeMode.sticky) {
|
|
40156
|
+
swiper.slideToClosest();
|
|
40157
|
+
return;
|
|
40158
|
+
} else if (params.freeMode) {
|
|
40159
|
+
emit('_freeModeNoMomentumRelease');
|
|
40160
|
+
}
|
|
40161
|
+
if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
|
|
40162
|
+
swiper.updateProgress();
|
|
40163
|
+
swiper.updateActiveIndex();
|
|
40164
|
+
swiper.updateSlidesClasses();
|
|
40165
|
+
}
|
|
40166
|
+
}
|
|
40167
|
+
Object.assign(swiper, {
|
|
40168
|
+
freeMode: {
|
|
40169
|
+
onTouchStart,
|
|
40170
|
+
onTouchMove,
|
|
40171
|
+
onTouchEnd
|
|
40172
|
+
}
|
|
40173
|
+
});
|
|
40174
|
+
}
|
|
40175
|
+
|
|
39933
40176
|
var GalleryClassic = function GalleryClassic(_ref) {
|
|
39934
40177
|
var configurations = _ref.configurations,
|
|
39935
40178
|
_ref$className = _ref.className,
|
|
@@ -40042,14 +40285,14 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
40042
40285
|
src = properties.backgroundImage.src;
|
|
40043
40286
|
var baseClasses = "grid grid-cols-12 items-center gap-y-8";
|
|
40044
40287
|
return /*#__PURE__*/React__default.createElement(BlockWrapper, {
|
|
40288
|
+
className: className,
|
|
40289
|
+
enableAnimation: enableAnimation,
|
|
40290
|
+
id: id,
|
|
40045
40291
|
as: "footer",
|
|
40046
40292
|
backgroundImage: mergeLeft({
|
|
40047
40293
|
src: src
|
|
40048
40294
|
}, design.backgroundImage),
|
|
40049
|
-
className: className,
|
|
40050
40295
|
design: design.body,
|
|
40051
|
-
enableAnimation: enableAnimation,
|
|
40052
|
-
id: id,
|
|
40053
40296
|
nestedClassName: baseClasses
|
|
40054
40297
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
40055
40298
|
className: "col-span-12 col-start-1 sm:col-span-6 sm:col-start-4"
|
|
@@ -40063,50 +40306,49 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
40063
40306
|
}, description)), /*#__PURE__*/React__default.createElement("div", {
|
|
40064
40307
|
className: "ns-gallery-with-sliding-images col-span-12 space-y-6 sm:col-span-10 sm:col-start-2"
|
|
40065
40308
|
}, /*#__PURE__*/React__default.createElement(Swiper, {
|
|
40309
|
+
autoplay: {
|
|
40310
|
+
delay: 5000,
|
|
40311
|
+
disableOnInteraction: false
|
|
40312
|
+
},
|
|
40066
40313
|
modules: [Thumb, Autoplay, Mousewheel, Pagination],
|
|
40314
|
+
mousewheel: {
|
|
40315
|
+
sensitivity: 0.5
|
|
40316
|
+
},
|
|
40067
40317
|
pagination: !isThumbsView && {
|
|
40068
40318
|
clickable: true
|
|
40069
40319
|
},
|
|
40070
40320
|
spaceBetween: 10,
|
|
40071
40321
|
thumbs: {
|
|
40072
40322
|
swiper: thumbsSwiper
|
|
40073
|
-
},
|
|
40074
|
-
autoplay: {
|
|
40075
|
-
delay: 5000,
|
|
40076
|
-
enabled: true,
|
|
40077
|
-
disableOnInteraction: false
|
|
40078
|
-
},
|
|
40079
|
-
mouseWheel: {
|
|
40080
|
-
sensitivity: 0.5,
|
|
40081
|
-
enabled: true
|
|
40082
40323
|
}
|
|
40083
40324
|
}, images.map(function (_ref2, index) {
|
|
40084
40325
|
var src = _ref2.src,
|
|
40085
40326
|
alt = _ref2.alt,
|
|
40086
40327
|
title = _ref2.title;
|
|
40087
40328
|
return /*#__PURE__*/React__default.createElement(SwiperSlide, {
|
|
40329
|
+
className: "swiper__wrapper",
|
|
40088
40330
|
key: getUniqueKey(src, title, index)
|
|
40089
40331
|
}, /*#__PURE__*/React__default.createElement(StyledImage$1, {
|
|
40090
40332
|
alt: alt,
|
|
40091
|
-
className: "sliding-image",
|
|
40092
40333
|
src: src,
|
|
40093
|
-
title: title
|
|
40334
|
+
title: title,
|
|
40335
|
+
className: "sliding-image"
|
|
40094
40336
|
}));
|
|
40095
40337
|
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
40096
40338
|
className: "ns-gallery-with-sliding-images sm:col-span-6 sm:col-start-4"
|
|
40097
40339
|
}, isThumbsView && /*#__PURE__*/React__default.createElement(Swiper, {
|
|
40340
|
+
freeMode: true,
|
|
40098
40341
|
watchSlidesProgress: true,
|
|
40099
40342
|
className: "hidden sm:block",
|
|
40100
|
-
modules: [Thumb, Pagination, Mousewheel],
|
|
40343
|
+
modules: [Thumb, Pagination, Mousewheel, freeMode],
|
|
40344
|
+
mousewheel: {
|
|
40345
|
+
sensitivity: 0.5
|
|
40346
|
+
},
|
|
40101
40347
|
pagination: {
|
|
40102
40348
|
clickable: true
|
|
40103
40349
|
},
|
|
40104
40350
|
slidesPerView: 4,
|
|
40105
40351
|
spaceBetween: 12,
|
|
40106
|
-
mouseWheel: {
|
|
40107
|
-
sensitivity: 0.5,
|
|
40108
|
-
enabled: true
|
|
40109
|
-
},
|
|
40110
40352
|
onSwiper: setThumbsSwiper
|
|
40111
40353
|
}, images.map(function (_ref3, index) {
|
|
40112
40354
|
var src = _ref3.src,
|
|
@@ -40117,9 +40359,9 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
|
|
|
40117
40359
|
key: getUniqueKey(src, title, index)
|
|
40118
40360
|
}, /*#__PURE__*/React__default.createElement(StyledImage$1, {
|
|
40119
40361
|
alt: alt,
|
|
40120
|
-
className: "clickable-image",
|
|
40121
40362
|
src: src,
|
|
40122
|
-
title: title
|
|
40363
|
+
title: title,
|
|
40364
|
+
className: "clickable-image"
|
|
40123
40365
|
}));
|
|
40124
40366
|
}))));
|
|
40125
40367
|
};
|