@bigbinary/neeto-site-blocks 1.1.0 → 1.1.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.js CHANGED
@@ -15582,6 +15582,51 @@ var Typography = function Typography(_ref) {
15582
15582
  Typography.displayName = "Typography";
15583
15583
  var Typography$1 = withConditionalRender(Typography, prop("children"));
15584
15584
 
15585
+ var BlogContent = function BlogContent(_ref) {
15586
+ var configurations = _ref.configurations,
15587
+ _ref$className = _ref.className,
15588
+ className = _ref$className === void 0 ? "" : _ref$className,
15589
+ id = _ref.id;
15590
+ var properties = configurations.properties,
15591
+ design = configurations.design;
15592
+ var _properties$content = properties.content,
15593
+ title = _properties$content.title,
15594
+ description = _properties$content.description,
15595
+ content = _properties$content.content,
15596
+ enableAnimation = properties.enableAnimation,
15597
+ imageSrc = properties.image.src,
15598
+ src = properties.backgroundImage.src;
15599
+ var baseClasses = "grid grid-cols-12 items-center";
15600
+ var textClasses = "col-span-12 sm:col-span-8 sm:col-start-3 lg:col-span-6 lg:col-start-4";
15601
+ return /*#__PURE__*/React__default["default"].createElement(BlockWrapper, {
15602
+ className: className,
15603
+ enableAnimation: enableAnimation,
15604
+ id: id,
15605
+ backgroundImage: mergeLeft({
15606
+ src: src
15607
+ }, design.backgroundImage),
15608
+ design: design.body,
15609
+ nestedClassName: baseClasses
15610
+ }, /*#__PURE__*/React__default["default"].createElement(Typography$1, {
15611
+ isTitle: true,
15612
+ className: textClasses,
15613
+ component: "h1",
15614
+ style: design.title
15615
+ }, title), /*#__PURE__*/React__default["default"].createElement(Typography$1, {
15616
+ isTitle: true,
15617
+ className: textClasses,
15618
+ style: design.description
15619
+ }, description), /*#__PURE__*/React__default["default"].createElement("div", {
15620
+ className: "col-span-12 flex justify-center sm:col-span-8 sm:col-start-3"
15621
+ }, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
15622
+ design: design.image,
15623
+ src: imageSrc
15624
+ })), /*#__PURE__*/React__default["default"].createElement(Typography$1, {
15625
+ className: textClasses,
15626
+ style: design.content
15627
+ }, content));
15628
+ };
15629
+
15585
15630
  var CardsClassic = function CardsClassic(_ref) {
15586
15631
  var configurations = _ref.configurations,
15587
15632
  _ref$className = _ref.className,
@@ -16024,6 +16069,16 @@ function elementParents(el, selector) {
16024
16069
  }
16025
16070
  return parents;
16026
16071
  }
16072
+ function elementTransitionEnd(el, callback) {
16073
+ function fireCallBack(e) {
16074
+ if (e.target !== el) return;
16075
+ callback.call(el, e);
16076
+ el.removeEventListener('transitionend', fireCallBack);
16077
+ }
16078
+ if (callback) {
16079
+ el.addEventListener('transitionend', fireCallBack);
16080
+ }
16081
+ }
16027
16082
  function elementOuterSize(el, size, includeMargins) {
16028
16083
  const window = getWindow();
16029
16084
  if (includeMargins) {
@@ -39976,6 +40031,239 @@ function Thumb(_ref) {
39976
40031
  });
39977
40032
  }
39978
40033
 
40034
+ function freeMode(_ref) {
40035
+ let {
40036
+ swiper,
40037
+ extendParams,
40038
+ emit,
40039
+ once
40040
+ } = _ref;
40041
+ extendParams({
40042
+ freeMode: {
40043
+ enabled: false,
40044
+ momentum: true,
40045
+ momentumRatio: 1,
40046
+ momentumBounce: true,
40047
+ momentumBounceRatio: 1,
40048
+ momentumVelocityRatio: 1,
40049
+ sticky: false,
40050
+ minimumVelocity: 0.02
40051
+ }
40052
+ });
40053
+ function onTouchStart() {
40054
+ if (swiper.params.cssMode) return;
40055
+ const translate = swiper.getTranslate();
40056
+ swiper.setTranslate(translate);
40057
+ swiper.setTransition(0);
40058
+ swiper.touchEventsData.velocities.length = 0;
40059
+ swiper.freeMode.onTouchEnd({
40060
+ currentPos: swiper.rtl ? swiper.translate : -swiper.translate
40061
+ });
40062
+ }
40063
+ function onTouchMove() {
40064
+ if (swiper.params.cssMode) return;
40065
+ const {
40066
+ touchEventsData: data,
40067
+ touches
40068
+ } = swiper;
40069
+ // Velocity
40070
+ if (data.velocities.length === 0) {
40071
+ data.velocities.push({
40072
+ position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
40073
+ time: data.touchStartTime
40074
+ });
40075
+ }
40076
+ data.velocities.push({
40077
+ position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
40078
+ time: now()
40079
+ });
40080
+ }
40081
+ function onTouchEnd(_ref2) {
40082
+ let {
40083
+ currentPos
40084
+ } = _ref2;
40085
+ if (swiper.params.cssMode) return;
40086
+ const {
40087
+ params,
40088
+ wrapperEl,
40089
+ rtlTranslate: rtl,
40090
+ snapGrid,
40091
+ touchEventsData: data
40092
+ } = swiper;
40093
+ // Time diff
40094
+ const touchEndTime = now();
40095
+ const timeDiff = touchEndTime - data.touchStartTime;
40096
+ if (currentPos < -swiper.minTranslate()) {
40097
+ swiper.slideTo(swiper.activeIndex);
40098
+ return;
40099
+ }
40100
+ if (currentPos > -swiper.maxTranslate()) {
40101
+ if (swiper.slides.length < snapGrid.length) {
40102
+ swiper.slideTo(snapGrid.length - 1);
40103
+ } else {
40104
+ swiper.slideTo(swiper.slides.length - 1);
40105
+ }
40106
+ return;
40107
+ }
40108
+ if (params.freeMode.momentum) {
40109
+ if (data.velocities.length > 1) {
40110
+ const lastMoveEvent = data.velocities.pop();
40111
+ const velocityEvent = data.velocities.pop();
40112
+ const distance = lastMoveEvent.position - velocityEvent.position;
40113
+ const time = lastMoveEvent.time - velocityEvent.time;
40114
+ swiper.velocity = distance / time;
40115
+ swiper.velocity /= 2;
40116
+ if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
40117
+ swiper.velocity = 0;
40118
+ }
40119
+ // this implies that the user stopped moving a finger then released.
40120
+ // There would be no events with distance zero, so the last event is stale.
40121
+ if (time > 150 || now() - lastMoveEvent.time > 300) {
40122
+ swiper.velocity = 0;
40123
+ }
40124
+ } else {
40125
+ swiper.velocity = 0;
40126
+ }
40127
+ swiper.velocity *= params.freeMode.momentumVelocityRatio;
40128
+ data.velocities.length = 0;
40129
+ let momentumDuration = 1000 * params.freeMode.momentumRatio;
40130
+ const momentumDistance = swiper.velocity * momentumDuration;
40131
+ let newPosition = swiper.translate + momentumDistance;
40132
+ if (rtl) newPosition = -newPosition;
40133
+ let doBounce = false;
40134
+ let afterBouncePosition;
40135
+ const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
40136
+ let needsLoopFix;
40137
+ if (newPosition < swiper.maxTranslate()) {
40138
+ if (params.freeMode.momentumBounce) {
40139
+ if (newPosition + swiper.maxTranslate() < -bounceAmount) {
40140
+ newPosition = swiper.maxTranslate() - bounceAmount;
40141
+ }
40142
+ afterBouncePosition = swiper.maxTranslate();
40143
+ doBounce = true;
40144
+ data.allowMomentumBounce = true;
40145
+ } else {
40146
+ newPosition = swiper.maxTranslate();
40147
+ }
40148
+ if (params.loop && params.centeredSlides) needsLoopFix = true;
40149
+ } else if (newPosition > swiper.minTranslate()) {
40150
+ if (params.freeMode.momentumBounce) {
40151
+ if (newPosition - swiper.minTranslate() > bounceAmount) {
40152
+ newPosition = swiper.minTranslate() + bounceAmount;
40153
+ }
40154
+ afterBouncePosition = swiper.minTranslate();
40155
+ doBounce = true;
40156
+ data.allowMomentumBounce = true;
40157
+ } else {
40158
+ newPosition = swiper.minTranslate();
40159
+ }
40160
+ if (params.loop && params.centeredSlides) needsLoopFix = true;
40161
+ } else if (params.freeMode.sticky) {
40162
+ let nextSlide;
40163
+ for (let j = 0; j < snapGrid.length; j += 1) {
40164
+ if (snapGrid[j] > -newPosition) {
40165
+ nextSlide = j;
40166
+ break;
40167
+ }
40168
+ }
40169
+ if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
40170
+ newPosition = snapGrid[nextSlide];
40171
+ } else {
40172
+ newPosition = snapGrid[nextSlide - 1];
40173
+ }
40174
+ newPosition = -newPosition;
40175
+ }
40176
+ if (needsLoopFix) {
40177
+ once('transitionEnd', () => {
40178
+ swiper.loopFix();
40179
+ });
40180
+ }
40181
+ // Fix duration
40182
+ if (swiper.velocity !== 0) {
40183
+ if (rtl) {
40184
+ momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
40185
+ } else {
40186
+ momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
40187
+ }
40188
+ if (params.freeMode.sticky) {
40189
+ // If freeMode.sticky is active and the user ends a swipe with a slow-velocity
40190
+ // event, then durations can be 20+ seconds to slide one (or zero!) slides.
40191
+ // It's easy to see this when simulating touch with mouse events. To fix this,
40192
+ // limit single-slide swipes to the default slide duration. This also has the
40193
+ // nice side effect of matching slide speed if the user stopped moving before
40194
+ // lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
40195
+ // For faster swipes, also apply limits (albeit higher ones).
40196
+ const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
40197
+ const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
40198
+ if (moveDistance < currentSlideSize) {
40199
+ momentumDuration = params.speed;
40200
+ } else if (moveDistance < 2 * currentSlideSize) {
40201
+ momentumDuration = params.speed * 1.5;
40202
+ } else {
40203
+ momentumDuration = params.speed * 2.5;
40204
+ }
40205
+ }
40206
+ } else if (params.freeMode.sticky) {
40207
+ swiper.slideToClosest();
40208
+ return;
40209
+ }
40210
+ if (params.freeMode.momentumBounce && doBounce) {
40211
+ swiper.updateProgress(afterBouncePosition);
40212
+ swiper.setTransition(momentumDuration);
40213
+ swiper.setTranslate(newPosition);
40214
+ swiper.transitionStart(true, swiper.swipeDirection);
40215
+ swiper.animating = true;
40216
+ elementTransitionEnd(wrapperEl, () => {
40217
+ if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
40218
+ emit('momentumBounce');
40219
+ swiper.setTransition(params.speed);
40220
+ setTimeout(() => {
40221
+ swiper.setTranslate(afterBouncePosition);
40222
+ elementTransitionEnd(wrapperEl, () => {
40223
+ if (!swiper || swiper.destroyed) return;
40224
+ swiper.transitionEnd();
40225
+ });
40226
+ }, 0);
40227
+ });
40228
+ } else if (swiper.velocity) {
40229
+ emit('_freeModeNoMomentumRelease');
40230
+ swiper.updateProgress(newPosition);
40231
+ swiper.setTransition(momentumDuration);
40232
+ swiper.setTranslate(newPosition);
40233
+ swiper.transitionStart(true, swiper.swipeDirection);
40234
+ if (!swiper.animating) {
40235
+ swiper.animating = true;
40236
+ elementTransitionEnd(wrapperEl, () => {
40237
+ if (!swiper || swiper.destroyed) return;
40238
+ swiper.transitionEnd();
40239
+ });
40240
+ }
40241
+ } else {
40242
+ swiper.updateProgress(newPosition);
40243
+ }
40244
+ swiper.updateActiveIndex();
40245
+ swiper.updateSlidesClasses();
40246
+ } else if (params.freeMode.sticky) {
40247
+ swiper.slideToClosest();
40248
+ return;
40249
+ } else if (params.freeMode) {
40250
+ emit('_freeModeNoMomentumRelease');
40251
+ }
40252
+ if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
40253
+ swiper.updateProgress();
40254
+ swiper.updateActiveIndex();
40255
+ swiper.updateSlidesClasses();
40256
+ }
40257
+ }
40258
+ Object.assign(swiper, {
40259
+ freeMode: {
40260
+ onTouchStart,
40261
+ onTouchMove,
40262
+ onTouchEnd
40263
+ }
40264
+ });
40265
+ }
40266
+
39979
40267
  var GalleryClassic = function GalleryClassic(_ref) {
39980
40268
  var configurations = _ref.configurations,
39981
40269
  _ref$className = _ref.className,
@@ -40088,14 +40376,14 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
40088
40376
  src = properties.backgroundImage.src;
40089
40377
  var baseClasses = "grid grid-cols-12 items-center gap-y-8";
40090
40378
  return /*#__PURE__*/React__default["default"].createElement(BlockWrapper, {
40379
+ className: className,
40380
+ enableAnimation: enableAnimation,
40381
+ id: id,
40091
40382
  as: "footer",
40092
40383
  backgroundImage: mergeLeft({
40093
40384
  src: src
40094
40385
  }, design.backgroundImage),
40095
- className: className,
40096
40386
  design: design.body,
40097
- enableAnimation: enableAnimation,
40098
- id: id,
40099
40387
  nestedClassName: baseClasses
40100
40388
  }, /*#__PURE__*/React__default["default"].createElement("div", {
40101
40389
  className: "col-span-12 col-start-1 sm:col-span-6 sm:col-start-4"
@@ -40109,50 +40397,49 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
40109
40397
  }, description)), /*#__PURE__*/React__default["default"].createElement("div", {
40110
40398
  className: "ns-gallery-with-sliding-images col-span-12 space-y-6 sm:col-span-10 sm:col-start-2"
40111
40399
  }, /*#__PURE__*/React__default["default"].createElement(Swiper, {
40400
+ autoplay: {
40401
+ delay: 5000,
40402
+ disableOnInteraction: false
40403
+ },
40112
40404
  modules: [Thumb, Autoplay, Mousewheel, Pagination],
40405
+ mousewheel: {
40406
+ sensitivity: 0.5
40407
+ },
40113
40408
  pagination: !isThumbsView && {
40114
40409
  clickable: true
40115
40410
  },
40116
40411
  spaceBetween: 10,
40117
40412
  thumbs: {
40118
40413
  swiper: thumbsSwiper
40119
- },
40120
- autoplay: {
40121
- delay: 5000,
40122
- enabled: true,
40123
- disableOnInteraction: false
40124
- },
40125
- mouseWheel: {
40126
- sensitivity: 0.5,
40127
- enabled: true
40128
40414
  }
40129
40415
  }, images.map(function (_ref2, index) {
40130
40416
  var src = _ref2.src,
40131
40417
  alt = _ref2.alt,
40132
40418
  title = _ref2.title;
40133
40419
  return /*#__PURE__*/React__default["default"].createElement(SwiperSlide, {
40420
+ className: "swiper__wrapper",
40134
40421
  key: getUniqueKey(src, title, index)
40135
40422
  }, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
40136
40423
  alt: alt,
40137
- className: "sliding-image",
40138
40424
  src: src,
40139
- title: title
40425
+ title: title,
40426
+ className: "sliding-image"
40140
40427
  }));
40141
40428
  }))), /*#__PURE__*/React__default["default"].createElement("div", {
40142
40429
  className: "ns-gallery-with-sliding-images sm:col-span-6 sm:col-start-4"
40143
40430
  }, isThumbsView && /*#__PURE__*/React__default["default"].createElement(Swiper, {
40431
+ freeMode: true,
40144
40432
  watchSlidesProgress: true,
40145
40433
  className: "hidden sm:block",
40146
- modules: [Thumb, Pagination, Mousewheel],
40434
+ modules: [Thumb, Pagination, Mousewheel, freeMode],
40435
+ mousewheel: {
40436
+ sensitivity: 0.5
40437
+ },
40147
40438
  pagination: {
40148
40439
  clickable: true
40149
40440
  },
40150
40441
  slidesPerView: 4,
40151
40442
  spaceBetween: 12,
40152
- mouseWheel: {
40153
- sensitivity: 0.5,
40154
- enabled: true
40155
- },
40156
40443
  onSwiper: setThumbsSwiper
40157
40444
  }, images.map(function (_ref3, index) {
40158
40445
  var src = _ref3.src,
@@ -40163,9 +40450,9 @@ var GalleryWithAutoplay = function GalleryWithAutoplay(_ref) {
40163
40450
  key: getUniqueKey(src, title, index)
40164
40451
  }, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
40165
40452
  alt: alt,
40166
- className: "clickable-image",
40167
40453
  src: src,
40168
- title: title
40454
+ title: title,
40455
+ className: "clickable-image"
40169
40456
  }));
40170
40457
  }))));
40171
40458
  };
@@ -41077,6 +41364,7 @@ var index = /*#__PURE__*/Object.freeze({
41077
41364
  Outlined: OutlineIcons
41078
41365
  });
41079
41366
 
41367
+ exports.BlogContent = BlogContent;
41080
41368
  exports.CardsClassic = CardsClassic;
41081
41369
  exports.CardsInGridView = CardsInGridView;
41082
41370
  exports.CardsWithCustomizableGrid = CardsWithCustomizableGrid;