@bigbinary/neeto-site-blocks 1.2.12 → 1.3.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 CHANGED
@@ -15533,6 +15533,29 @@ var Media = function Media(_ref) {
15533
15533
  }, otherProps));
15534
15534
  };
15535
15535
 
15536
+ var PageNavigation = function PageNavigation(_ref) {
15537
+ var Icon = _ref.Icon,
15538
+ isStart = _ref.isStart,
15539
+ onClick = _ref.onClick,
15540
+ _ref$className = _ref.className,
15541
+ className = _ref$className === void 0 ? "" : _ref$className;
15542
+ var StyledIcon = styled__default["default"](Icon)(function () {
15543
+ return {
15544
+ borderColor: "#1F2433"
15545
+ };
15546
+ });
15547
+ return /*#__PURE__*/React__default["default"].createElement("button", {
15548
+ onClick: onClick,
15549
+ className: classnames("col-span-1", {
15550
+ "col-start-1": isStart,
15551
+ "col-start-12 flex justify-end": !isStart
15552
+ }, className)
15553
+ }, /*#__PURE__*/React__default["default"].createElement(StyledIcon, {
15554
+ fill: "#66C1D4",
15555
+ size: 52
15556
+ }));
15557
+ };
15558
+
15536
15559
  var Pagination$1 = function Pagination(_ref) {
15537
15560
  var _classnames, _classnames2;
15538
15561
  var swiper = _ref.swiper,
@@ -16075,6 +16098,20 @@ function createElement(tag, classes) {
16075
16098
  el.classList.add(...(Array.isArray(classes) ? classes : [classes]));
16076
16099
  return el;
16077
16100
  }
16101
+ function elementOffset(el) {
16102
+ const window = getWindow();
16103
+ const document = getDocument();
16104
+ const box = el.getBoundingClientRect();
16105
+ const body = document.body;
16106
+ const clientTop = el.clientTop || body.clientTop || 0;
16107
+ const clientLeft = el.clientLeft || body.clientLeft || 0;
16108
+ const scrollTop = el === window ? window.scrollY : el.scrollTop;
16109
+ const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
16110
+ return {
16111
+ top: box.top + scrollTop - clientTop,
16112
+ left: box.left + scrollLeft - clientLeft
16113
+ };
16114
+ }
16078
16115
  function elementPrevAll(el, selector) {
16079
16116
  const prevEls = [];
16080
16117
  while (el.previousElementSibling) {
@@ -38849,6 +38886,119 @@ var FooterWithLinks = function FooterWithLinks(_ref) {
38849
38886
  }, copyrightText));
38850
38887
  };
38851
38888
 
38889
+ /* eslint-disable consistent-return */
38890
+ function Keyboard(_ref) {
38891
+ let {
38892
+ swiper,
38893
+ extendParams,
38894
+ on,
38895
+ emit
38896
+ } = _ref;
38897
+ const document = getDocument();
38898
+ const window = getWindow();
38899
+ swiper.keyboard = {
38900
+ enabled: false
38901
+ };
38902
+ extendParams({
38903
+ keyboard: {
38904
+ enabled: false,
38905
+ onlyInViewport: true,
38906
+ pageUpDown: true
38907
+ }
38908
+ });
38909
+ function handle(event) {
38910
+ if (!swiper.enabled) return;
38911
+ const {
38912
+ rtlTranslate: rtl
38913
+ } = swiper;
38914
+ let e = event;
38915
+ if (e.originalEvent) e = e.originalEvent; // jquery fix
38916
+ const kc = e.keyCode || e.charCode;
38917
+ const pageUpDown = swiper.params.keyboard.pageUpDown;
38918
+ const isPageUp = pageUpDown && kc === 33;
38919
+ const isPageDown = pageUpDown && kc === 34;
38920
+ const isArrowLeft = kc === 37;
38921
+ const isArrowRight = kc === 39;
38922
+ const isArrowUp = kc === 38;
38923
+ const isArrowDown = kc === 40;
38924
+ // Directions locks
38925
+ if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {
38926
+ return false;
38927
+ }
38928
+ if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {
38929
+ return false;
38930
+ }
38931
+ if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
38932
+ return undefined;
38933
+ }
38934
+ if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
38935
+ return undefined;
38936
+ }
38937
+ if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
38938
+ let inView = false;
38939
+ // Check that swiper should be inside of visible area of window
38940
+ if (elementParents(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && elementParents(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) {
38941
+ return undefined;
38942
+ }
38943
+ const el = swiper.el;
38944
+ const swiperWidth = el.clientWidth;
38945
+ const swiperHeight = el.clientHeight;
38946
+ const windowWidth = window.innerWidth;
38947
+ const windowHeight = window.innerHeight;
38948
+ const swiperOffset = elementOffset(el);
38949
+ if (rtl) swiperOffset.left -= el.scrollLeft;
38950
+ const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]];
38951
+ for (let i = 0; i < swiperCoord.length; i += 1) {
38952
+ const point = swiperCoord[i];
38953
+ if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {
38954
+ if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
38955
+ inView = true;
38956
+ }
38957
+ }
38958
+ if (!inView) return undefined;
38959
+ }
38960
+ if (swiper.isHorizontal()) {
38961
+ if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {
38962
+ if (e.preventDefault) e.preventDefault();else e.returnValue = false;
38963
+ }
38964
+ if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();
38965
+ if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();
38966
+ } else {
38967
+ if (isPageUp || isPageDown || isArrowUp || isArrowDown) {
38968
+ if (e.preventDefault) e.preventDefault();else e.returnValue = false;
38969
+ }
38970
+ if (isPageDown || isArrowDown) swiper.slideNext();
38971
+ if (isPageUp || isArrowUp) swiper.slidePrev();
38972
+ }
38973
+ emit('keyPress', kc);
38974
+ return undefined;
38975
+ }
38976
+ function enable() {
38977
+ if (swiper.keyboard.enabled) return;
38978
+ document.addEventListener('keydown', handle);
38979
+ swiper.keyboard.enabled = true;
38980
+ }
38981
+ function disable() {
38982
+ if (!swiper.keyboard.enabled) return;
38983
+ document.removeEventListener('keydown', handle);
38984
+ swiper.keyboard.enabled = false;
38985
+ }
38986
+ on('init', () => {
38987
+ if (swiper.params.keyboard.enabled) {
38988
+ enable();
38989
+ }
38990
+ });
38991
+ on('destroy', () => {
38992
+ if (swiper.keyboard.enabled) {
38993
+ disable();
38994
+ }
38995
+ });
38996
+ Object.assign(swiper.keyboard, {
38997
+ enable,
38998
+ disable
38999
+ });
39000
+ }
39001
+
38852
39002
  /* eslint-disable consistent-return */
38853
39003
  function Mousewheel(_ref) {
38854
39004
  let {
@@ -39726,6 +39876,145 @@ function Pagination(_ref) {
39726
39876
  });
39727
39877
  }
39728
39878
 
39879
+ function History(_ref) {
39880
+ let {
39881
+ swiper,
39882
+ extendParams,
39883
+ on
39884
+ } = _ref;
39885
+ extendParams({
39886
+ history: {
39887
+ enabled: false,
39888
+ root: '',
39889
+ replaceState: false,
39890
+ key: 'slides',
39891
+ keepQuery: false
39892
+ }
39893
+ });
39894
+ let initialized = false;
39895
+ let paths = {};
39896
+ const slugify = text => {
39897
+ return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
39898
+ };
39899
+ const getPathValues = urlOverride => {
39900
+ const window = getWindow();
39901
+ let location;
39902
+ if (urlOverride) {
39903
+ location = new URL(urlOverride);
39904
+ } else {
39905
+ location = window.location;
39906
+ }
39907
+ const pathArray = location.pathname.slice(1).split('/').filter(part => part !== '');
39908
+ const total = pathArray.length;
39909
+ const key = pathArray[total - 2];
39910
+ const value = pathArray[total - 1];
39911
+ return {
39912
+ key,
39913
+ value
39914
+ };
39915
+ };
39916
+ const setHistory = (key, index) => {
39917
+ const window = getWindow();
39918
+ if (!initialized || !swiper.params.history.enabled) return;
39919
+ let location;
39920
+ if (swiper.params.url) {
39921
+ location = new URL(swiper.params.url);
39922
+ } else {
39923
+ location = window.location;
39924
+ }
39925
+ const slide = swiper.slides[index];
39926
+ let value = slugify(slide.getAttribute('data-history'));
39927
+ if (swiper.params.history.root.length > 0) {
39928
+ let root = swiper.params.history.root;
39929
+ if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);
39930
+ value = `${root}/${key ? `${key}/` : ''}${value}`;
39931
+ } else if (!location.pathname.includes(key)) {
39932
+ value = `${key ? `${key}/` : ''}${value}`;
39933
+ }
39934
+ if (swiper.params.history.keepQuery) {
39935
+ value += location.search;
39936
+ }
39937
+ const currentState = window.history.state;
39938
+ if (currentState && currentState.value === value) {
39939
+ return;
39940
+ }
39941
+ if (swiper.params.history.replaceState) {
39942
+ window.history.replaceState({
39943
+ value
39944
+ }, null, value);
39945
+ } else {
39946
+ window.history.pushState({
39947
+ value
39948
+ }, null, value);
39949
+ }
39950
+ };
39951
+ const scrollToSlide = (speed, value, runCallbacks) => {
39952
+ if (value) {
39953
+ for (let i = 0, length = swiper.slides.length; i < length; i += 1) {
39954
+ const slide = swiper.slides[i];
39955
+ const slideHistory = slugify(slide.getAttribute('data-history'));
39956
+ if (slideHistory === value) {
39957
+ const index = swiper.getSlideIndex(slide);
39958
+ swiper.slideTo(index, speed, runCallbacks);
39959
+ }
39960
+ }
39961
+ } else {
39962
+ swiper.slideTo(0, speed, runCallbacks);
39963
+ }
39964
+ };
39965
+ const setHistoryPopState = () => {
39966
+ paths = getPathValues(swiper.params.url);
39967
+ scrollToSlide(swiper.params.speed, paths.value, false);
39968
+ };
39969
+ const init = () => {
39970
+ const window = getWindow();
39971
+ if (!swiper.params.history) return;
39972
+ if (!window.history || !window.history.pushState) {
39973
+ swiper.params.history.enabled = false;
39974
+ swiper.params.hashNavigation.enabled = true;
39975
+ return;
39976
+ }
39977
+ initialized = true;
39978
+ paths = getPathValues(swiper.params.url);
39979
+ if (!paths.key && !paths.value) {
39980
+ if (!swiper.params.history.replaceState) {
39981
+ window.addEventListener('popstate', setHistoryPopState);
39982
+ }
39983
+ return;
39984
+ }
39985
+ scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit);
39986
+ if (!swiper.params.history.replaceState) {
39987
+ window.addEventListener('popstate', setHistoryPopState);
39988
+ }
39989
+ };
39990
+ const destroy = () => {
39991
+ const window = getWindow();
39992
+ if (!swiper.params.history.replaceState) {
39993
+ window.removeEventListener('popstate', setHistoryPopState);
39994
+ }
39995
+ };
39996
+ on('init', () => {
39997
+ if (swiper.params.history.enabled) {
39998
+ init();
39999
+ }
40000
+ });
40001
+ on('destroy', () => {
40002
+ if (swiper.params.history.enabled) {
40003
+ destroy();
40004
+ }
40005
+ });
40006
+ on('transitionEnd _freeModeNoMomentumRelease', () => {
40007
+ if (initialized) {
40008
+ setHistory(swiper.params.history.key, swiper.activeIndex);
40009
+ }
40010
+ });
40011
+ on('slideChange', () => {
40012
+ if (initialized && swiper.params.cssMode) {
40013
+ setHistory(swiper.params.history.key, swiper.activeIndex);
40014
+ }
40015
+ });
40016
+ }
40017
+
39729
40018
  /* eslint no-underscore-dangle: "off" */
39730
40019
  /* eslint no-use-before-define: "off" */
39731
40020
  function Autoplay(_ref) {
@@ -41393,6 +41682,138 @@ var PricingInCardView = function PricingInCardView(_ref) {
41393
41682
  })));
41394
41683
  };
41395
41684
 
41685
+ var Slides = function Slides(_ref) {
41686
+ var configurations = _ref.configurations,
41687
+ _ref$className = _ref.className,
41688
+ className = _ref$className === void 0 ? "" : _ref$className,
41689
+ id = _ref.id,
41690
+ disableButtonAndLinks = _ref.disableButtonAndLinks,
41691
+ pageUrl = _ref.pageUrl;
41692
+ var _useState = React.useState(0),
41693
+ _useState2 = _slicedToArray__default["default"](_useState, 2),
41694
+ activeIndex = _useState2[0],
41695
+ setActiveIndex = _useState2[1];
41696
+ var swiperRef = React.useRef(null);
41697
+ var properties = configurations.properties,
41698
+ design = configurations.design;
41699
+ var _properties$content$s = properties.content.slides,
41700
+ slides = _properties$content$s === void 0 ? [] : _properties$content$s,
41701
+ src = properties.backgroundImage.src,
41702
+ enableAnimation = properties.enableAnimation;
41703
+ var baseClasses = "grid grid-cols-12 items-center gap-y-4 sm:gap-x-4 grid-flow-row-dense";
41704
+ var swiperModules = disableButtonAndLinks ? [Keyboard] : [Keyboard, History];
41705
+ var renderSwiperSlide = function renderSwiperSlide(_ref2) {
41706
+ var title = _ref2.title,
41707
+ logoUrl = _ref2.logoUrl,
41708
+ subTitle = _ref2.subTitle,
41709
+ layout = _ref2.layout,
41710
+ imageUrl = _ref2.imageUrl;
41711
+ if (layout === "titleWithSubTitle") {
41712
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
41713
+ className: "absolute top-8 right-12 w-20",
41714
+ src: logoUrl
41715
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
41716
+ className: "col-span-12"
41717
+ }, /*#__PURE__*/React__default["default"].createElement(Typography$1, {
41718
+ isTitle: true,
41719
+ component: "h1",
41720
+ style: design.title
41721
+ }, title), /*#__PURE__*/React__default["default"].createElement(Typography$1, {
41722
+ isTitle: true,
41723
+ component: "h1",
41724
+ style: design.subTitle
41725
+ }, subTitle)));
41726
+ }
41727
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
41728
+ className: "absolute top-8 right-12 w-20",
41729
+ src: logoUrl
41730
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
41731
+ className: "bottom-0 col-span-12 flex w-full justify-center sm:absolute sm:col-span-10 sm:col-start-2"
41732
+ }, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
41733
+ design: design.image,
41734
+ src: imageUrl
41735
+ })));
41736
+ };
41737
+ return /*#__PURE__*/React__default["default"].createElement(MotionWrapper, {
41738
+ enableAnimation: enableAnimation,
41739
+ id: id,
41740
+ backgroundImage: mergeLeft({
41741
+ src: src
41742
+ }, design.backgroundImage),
41743
+ className: "relative flex items-center justify-between",
41744
+ design: mergeDesign(design.body, 80)
41745
+ }, /*#__PURE__*/React__default["default"].createElement(PageNavigation, {
41746
+ activeIndex: activeIndex,
41747
+ slides: slides,
41748
+ swiperRef: swiperRef,
41749
+ isStart: true,
41750
+ Icon: ArrowLeftS$1,
41751
+ className: "absolute left-0 top-1/2 z-20 sm:left-2 lg:left-28",
41752
+ onClick: function onClick() {
41753
+ var _swiperRef$current;
41754
+ return (_swiperRef$current = swiperRef.current) === null || _swiperRef$current === void 0 ? void 0 : _swiperRef$current.slidePrev();
41755
+ }
41756
+ }), /*#__PURE__*/React__default["default"].createElement(Swiper, {
41757
+ loop: true,
41758
+ history: {
41759
+ enabled: true,
41760
+ key: pageUrl !== null && pageUrl !== void 0 ? pageUrl : "slides"
41761
+ },
41762
+ keyboard: {
41763
+ enabled: true,
41764
+ onlyInViewport: true
41765
+ },
41766
+ modules: swiperModules,
41767
+ spaceBetween: 10,
41768
+ onSlideChange: function onSlideChange(swiper) {
41769
+ return setActiveIndex(swiper.activeIndex);
41770
+ },
41771
+ onSwiper: function onSwiper(swiper) {
41772
+ swiperRef.current = swiper;
41773
+ }
41774
+ }, slides.map(function (_ref3, index) {
41775
+ var title = _ref3.title,
41776
+ url = _ref3.url,
41777
+ logoUrl = _ref3.logoUrl,
41778
+ subTitle = _ref3.subTitle,
41779
+ layout = _ref3.layout,
41780
+ imageUrl = _ref3.imageUrl,
41781
+ backgroundImage = _ref3.backgroundImage;
41782
+ return /*#__PURE__*/React__default["default"].createElement(SwiperSlide, {
41783
+ className: classnames("my-auto", className),
41784
+ "data-history": !disableButtonAndLinks ? url : "",
41785
+ key: getUniqueKey(title, index)
41786
+ }, /*#__PURE__*/React__default["default"].createElement(StyledWrapper, {
41787
+ isRootWrapper: true,
41788
+ backgroundImage: mergeLeft({
41789
+ src: backgroundImage.src
41790
+ }, design.backgroundImage),
41791
+ className: classnames("neeto-site-block-wrapper relative lg:w-9/12", baseClasses),
41792
+ design: mergeRight(design.container, {
41793
+ paddingHorizontal: design.body.paddingHorizontal
41794
+ })
41795
+ }, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
41796
+ className: "absolute top-8 right-12 w-20",
41797
+ src: logoUrl
41798
+ }), renderSwiperSlide({
41799
+ title: title,
41800
+ logoUrl: logoUrl,
41801
+ subTitle: subTitle,
41802
+ layout: layout,
41803
+ imageUrl: imageUrl
41804
+ })));
41805
+ })), /*#__PURE__*/React__default["default"].createElement(PageNavigation, {
41806
+ activeIndex: activeIndex,
41807
+ swiperRef: swiperRef,
41808
+ Icon: ArrowRightS$1,
41809
+ className: "absolute top-1/2 right-0 z-20 sm:right-2 lg:right-28",
41810
+ onClick: function onClick() {
41811
+ var _swiperRef$current2;
41812
+ return (_swiperRef$current2 = swiperRef.current) === null || _swiperRef$current2 === void 0 ? void 0 : _swiperRef$current2.slideNext();
41813
+ }
41814
+ }));
41815
+ };
41816
+
41396
41817
  var _excluded$1 = ["configurations", "className", "id"];
41397
41818
  var TestimonialWithSlider = function TestimonialWithSlider(_ref) {
41398
41819
  var configurations = _ref.configurations,
@@ -41623,6 +42044,7 @@ exports.Icons = index;
41623
42044
  exports.LogoClouds = LogoClouds;
41624
42045
  exports.Paragraph = Paragraph;
41625
42046
  exports.PricingInCardView = PricingInCardView;
42047
+ exports.Slides = Slides;
41626
42048
  exports.TestimonialWithSlider = TestimonialWithSlider;
41627
42049
  exports.TestimonialWithVerticalView = TestimonialWithVerticalView;
41628
42050
  //# sourceMappingURL=index.cjs.js.map