@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.js CHANGED
@@ -15487,6 +15487,29 @@ var Media = function Media(_ref) {
15487
15487
  }, otherProps));
15488
15488
  };
15489
15489
 
15490
+ var PageNavigation = function PageNavigation(_ref) {
15491
+ var Icon = _ref.Icon,
15492
+ isStart = _ref.isStart,
15493
+ onClick = _ref.onClick,
15494
+ _ref$className = _ref.className,
15495
+ className = _ref$className === void 0 ? "" : _ref$className;
15496
+ var StyledIcon = styled(Icon)(function () {
15497
+ return {
15498
+ borderColor: "#1F2433"
15499
+ };
15500
+ });
15501
+ return /*#__PURE__*/React__default.createElement("button", {
15502
+ onClick: onClick,
15503
+ className: classnames("col-span-1", {
15504
+ "col-start-1": isStart,
15505
+ "col-start-12 flex justify-end": !isStart
15506
+ }, className)
15507
+ }, /*#__PURE__*/React__default.createElement(StyledIcon, {
15508
+ fill: "#66C1D4",
15509
+ size: 52
15510
+ }));
15511
+ };
15512
+
15490
15513
  var Pagination$1 = function Pagination(_ref) {
15491
15514
  var _classnames, _classnames2;
15492
15515
  var swiper = _ref.swiper,
@@ -16029,6 +16052,20 @@ function createElement(tag, classes) {
16029
16052
  el.classList.add(...(Array.isArray(classes) ? classes : [classes]));
16030
16053
  return el;
16031
16054
  }
16055
+ function elementOffset(el) {
16056
+ const window = getWindow();
16057
+ const document = getDocument();
16058
+ const box = el.getBoundingClientRect();
16059
+ const body = document.body;
16060
+ const clientTop = el.clientTop || body.clientTop || 0;
16061
+ const clientLeft = el.clientLeft || body.clientLeft || 0;
16062
+ const scrollTop = el === window ? window.scrollY : el.scrollTop;
16063
+ const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
16064
+ return {
16065
+ top: box.top + scrollTop - clientTop,
16066
+ left: box.left + scrollLeft - clientLeft
16067
+ };
16068
+ }
16032
16069
  function elementPrevAll(el, selector) {
16033
16070
  const prevEls = [];
16034
16071
  while (el.previousElementSibling) {
@@ -38803,6 +38840,119 @@ var FooterWithLinks = function FooterWithLinks(_ref) {
38803
38840
  }, copyrightText));
38804
38841
  };
38805
38842
 
38843
+ /* eslint-disable consistent-return */
38844
+ function Keyboard(_ref) {
38845
+ let {
38846
+ swiper,
38847
+ extendParams,
38848
+ on,
38849
+ emit
38850
+ } = _ref;
38851
+ const document = getDocument();
38852
+ const window = getWindow();
38853
+ swiper.keyboard = {
38854
+ enabled: false
38855
+ };
38856
+ extendParams({
38857
+ keyboard: {
38858
+ enabled: false,
38859
+ onlyInViewport: true,
38860
+ pageUpDown: true
38861
+ }
38862
+ });
38863
+ function handle(event) {
38864
+ if (!swiper.enabled) return;
38865
+ const {
38866
+ rtlTranslate: rtl
38867
+ } = swiper;
38868
+ let e = event;
38869
+ if (e.originalEvent) e = e.originalEvent; // jquery fix
38870
+ const kc = e.keyCode || e.charCode;
38871
+ const pageUpDown = swiper.params.keyboard.pageUpDown;
38872
+ const isPageUp = pageUpDown && kc === 33;
38873
+ const isPageDown = pageUpDown && kc === 34;
38874
+ const isArrowLeft = kc === 37;
38875
+ const isArrowRight = kc === 39;
38876
+ const isArrowUp = kc === 38;
38877
+ const isArrowDown = kc === 40;
38878
+ // Directions locks
38879
+ if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {
38880
+ return false;
38881
+ }
38882
+ if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {
38883
+ return false;
38884
+ }
38885
+ if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
38886
+ return undefined;
38887
+ }
38888
+ if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
38889
+ return undefined;
38890
+ }
38891
+ if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
38892
+ let inView = false;
38893
+ // Check that swiper should be inside of visible area of window
38894
+ if (elementParents(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && elementParents(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) {
38895
+ return undefined;
38896
+ }
38897
+ const el = swiper.el;
38898
+ const swiperWidth = el.clientWidth;
38899
+ const swiperHeight = el.clientHeight;
38900
+ const windowWidth = window.innerWidth;
38901
+ const windowHeight = window.innerHeight;
38902
+ const swiperOffset = elementOffset(el);
38903
+ if (rtl) swiperOffset.left -= el.scrollLeft;
38904
+ const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]];
38905
+ for (let i = 0; i < swiperCoord.length; i += 1) {
38906
+ const point = swiperCoord[i];
38907
+ if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {
38908
+ if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
38909
+ inView = true;
38910
+ }
38911
+ }
38912
+ if (!inView) return undefined;
38913
+ }
38914
+ if (swiper.isHorizontal()) {
38915
+ if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {
38916
+ if (e.preventDefault) e.preventDefault();else e.returnValue = false;
38917
+ }
38918
+ if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();
38919
+ if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();
38920
+ } else {
38921
+ if (isPageUp || isPageDown || isArrowUp || isArrowDown) {
38922
+ if (e.preventDefault) e.preventDefault();else e.returnValue = false;
38923
+ }
38924
+ if (isPageDown || isArrowDown) swiper.slideNext();
38925
+ if (isPageUp || isArrowUp) swiper.slidePrev();
38926
+ }
38927
+ emit('keyPress', kc);
38928
+ return undefined;
38929
+ }
38930
+ function enable() {
38931
+ if (swiper.keyboard.enabled) return;
38932
+ document.addEventListener('keydown', handle);
38933
+ swiper.keyboard.enabled = true;
38934
+ }
38935
+ function disable() {
38936
+ if (!swiper.keyboard.enabled) return;
38937
+ document.removeEventListener('keydown', handle);
38938
+ swiper.keyboard.enabled = false;
38939
+ }
38940
+ on('init', () => {
38941
+ if (swiper.params.keyboard.enabled) {
38942
+ enable();
38943
+ }
38944
+ });
38945
+ on('destroy', () => {
38946
+ if (swiper.keyboard.enabled) {
38947
+ disable();
38948
+ }
38949
+ });
38950
+ Object.assign(swiper.keyboard, {
38951
+ enable,
38952
+ disable
38953
+ });
38954
+ }
38955
+
38806
38956
  /* eslint-disable consistent-return */
38807
38957
  function Mousewheel(_ref) {
38808
38958
  let {
@@ -39680,6 +39830,145 @@ function Pagination(_ref) {
39680
39830
  });
39681
39831
  }
39682
39832
 
39833
+ function History(_ref) {
39834
+ let {
39835
+ swiper,
39836
+ extendParams,
39837
+ on
39838
+ } = _ref;
39839
+ extendParams({
39840
+ history: {
39841
+ enabled: false,
39842
+ root: '',
39843
+ replaceState: false,
39844
+ key: 'slides',
39845
+ keepQuery: false
39846
+ }
39847
+ });
39848
+ let initialized = false;
39849
+ let paths = {};
39850
+ const slugify = text => {
39851
+ return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
39852
+ };
39853
+ const getPathValues = urlOverride => {
39854
+ const window = getWindow();
39855
+ let location;
39856
+ if (urlOverride) {
39857
+ location = new URL(urlOverride);
39858
+ } else {
39859
+ location = window.location;
39860
+ }
39861
+ const pathArray = location.pathname.slice(1).split('/').filter(part => part !== '');
39862
+ const total = pathArray.length;
39863
+ const key = pathArray[total - 2];
39864
+ const value = pathArray[total - 1];
39865
+ return {
39866
+ key,
39867
+ value
39868
+ };
39869
+ };
39870
+ const setHistory = (key, index) => {
39871
+ const window = getWindow();
39872
+ if (!initialized || !swiper.params.history.enabled) return;
39873
+ let location;
39874
+ if (swiper.params.url) {
39875
+ location = new URL(swiper.params.url);
39876
+ } else {
39877
+ location = window.location;
39878
+ }
39879
+ const slide = swiper.slides[index];
39880
+ let value = slugify(slide.getAttribute('data-history'));
39881
+ if (swiper.params.history.root.length > 0) {
39882
+ let root = swiper.params.history.root;
39883
+ if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);
39884
+ value = `${root}/${key ? `${key}/` : ''}${value}`;
39885
+ } else if (!location.pathname.includes(key)) {
39886
+ value = `${key ? `${key}/` : ''}${value}`;
39887
+ }
39888
+ if (swiper.params.history.keepQuery) {
39889
+ value += location.search;
39890
+ }
39891
+ const currentState = window.history.state;
39892
+ if (currentState && currentState.value === value) {
39893
+ return;
39894
+ }
39895
+ if (swiper.params.history.replaceState) {
39896
+ window.history.replaceState({
39897
+ value
39898
+ }, null, value);
39899
+ } else {
39900
+ window.history.pushState({
39901
+ value
39902
+ }, null, value);
39903
+ }
39904
+ };
39905
+ const scrollToSlide = (speed, value, runCallbacks) => {
39906
+ if (value) {
39907
+ for (let i = 0, length = swiper.slides.length; i < length; i += 1) {
39908
+ const slide = swiper.slides[i];
39909
+ const slideHistory = slugify(slide.getAttribute('data-history'));
39910
+ if (slideHistory === value) {
39911
+ const index = swiper.getSlideIndex(slide);
39912
+ swiper.slideTo(index, speed, runCallbacks);
39913
+ }
39914
+ }
39915
+ } else {
39916
+ swiper.slideTo(0, speed, runCallbacks);
39917
+ }
39918
+ };
39919
+ const setHistoryPopState = () => {
39920
+ paths = getPathValues(swiper.params.url);
39921
+ scrollToSlide(swiper.params.speed, paths.value, false);
39922
+ };
39923
+ const init = () => {
39924
+ const window = getWindow();
39925
+ if (!swiper.params.history) return;
39926
+ if (!window.history || !window.history.pushState) {
39927
+ swiper.params.history.enabled = false;
39928
+ swiper.params.hashNavigation.enabled = true;
39929
+ return;
39930
+ }
39931
+ initialized = true;
39932
+ paths = getPathValues(swiper.params.url);
39933
+ if (!paths.key && !paths.value) {
39934
+ if (!swiper.params.history.replaceState) {
39935
+ window.addEventListener('popstate', setHistoryPopState);
39936
+ }
39937
+ return;
39938
+ }
39939
+ scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit);
39940
+ if (!swiper.params.history.replaceState) {
39941
+ window.addEventListener('popstate', setHistoryPopState);
39942
+ }
39943
+ };
39944
+ const destroy = () => {
39945
+ const window = getWindow();
39946
+ if (!swiper.params.history.replaceState) {
39947
+ window.removeEventListener('popstate', setHistoryPopState);
39948
+ }
39949
+ };
39950
+ on('init', () => {
39951
+ if (swiper.params.history.enabled) {
39952
+ init();
39953
+ }
39954
+ });
39955
+ on('destroy', () => {
39956
+ if (swiper.params.history.enabled) {
39957
+ destroy();
39958
+ }
39959
+ });
39960
+ on('transitionEnd _freeModeNoMomentumRelease', () => {
39961
+ if (initialized) {
39962
+ setHistory(swiper.params.history.key, swiper.activeIndex);
39963
+ }
39964
+ });
39965
+ on('slideChange', () => {
39966
+ if (initialized && swiper.params.cssMode) {
39967
+ setHistory(swiper.params.history.key, swiper.activeIndex);
39968
+ }
39969
+ });
39970
+ }
39971
+
39683
39972
  /* eslint no-underscore-dangle: "off" */
39684
39973
  /* eslint no-use-before-define: "off" */
39685
39974
  function Autoplay(_ref) {
@@ -41347,6 +41636,138 @@ var PricingInCardView = function PricingInCardView(_ref) {
41347
41636
  })));
41348
41637
  };
41349
41638
 
41639
+ var Slides = function Slides(_ref) {
41640
+ var configurations = _ref.configurations,
41641
+ _ref$className = _ref.className,
41642
+ className = _ref$className === void 0 ? "" : _ref$className,
41643
+ id = _ref.id,
41644
+ disableButtonAndLinks = _ref.disableButtonAndLinks,
41645
+ pageUrl = _ref.pageUrl;
41646
+ var _useState = useState(0),
41647
+ _useState2 = _slicedToArray(_useState, 2),
41648
+ activeIndex = _useState2[0],
41649
+ setActiveIndex = _useState2[1];
41650
+ var swiperRef = useRef(null);
41651
+ var properties = configurations.properties,
41652
+ design = configurations.design;
41653
+ var _properties$content$s = properties.content.slides,
41654
+ slides = _properties$content$s === void 0 ? [] : _properties$content$s,
41655
+ src = properties.backgroundImage.src,
41656
+ enableAnimation = properties.enableAnimation;
41657
+ var baseClasses = "grid grid-cols-12 items-center gap-y-4 sm:gap-x-4 grid-flow-row-dense";
41658
+ var swiperModules = disableButtonAndLinks ? [Keyboard] : [Keyboard, History];
41659
+ var renderSwiperSlide = function renderSwiperSlide(_ref2) {
41660
+ var title = _ref2.title,
41661
+ logoUrl = _ref2.logoUrl,
41662
+ subTitle = _ref2.subTitle,
41663
+ layout = _ref2.layout,
41664
+ imageUrl = _ref2.imageUrl;
41665
+ if (layout === "titleWithSubTitle") {
41666
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledImage$1, {
41667
+ className: "absolute top-8 right-12 w-20",
41668
+ src: logoUrl
41669
+ }), /*#__PURE__*/React__default.createElement("div", {
41670
+ className: "col-span-12"
41671
+ }, /*#__PURE__*/React__default.createElement(Typography$1, {
41672
+ isTitle: true,
41673
+ component: "h1",
41674
+ style: design.title
41675
+ }, title), /*#__PURE__*/React__default.createElement(Typography$1, {
41676
+ isTitle: true,
41677
+ component: "h1",
41678
+ style: design.subTitle
41679
+ }, subTitle)));
41680
+ }
41681
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledImage$1, {
41682
+ className: "absolute top-8 right-12 w-20",
41683
+ src: logoUrl
41684
+ }), /*#__PURE__*/React__default.createElement("div", {
41685
+ className: "bottom-0 col-span-12 flex w-full justify-center sm:absolute sm:col-span-10 sm:col-start-2"
41686
+ }, /*#__PURE__*/React__default.createElement(StyledImage$1, {
41687
+ design: design.image,
41688
+ src: imageUrl
41689
+ })));
41690
+ };
41691
+ return /*#__PURE__*/React__default.createElement(MotionWrapper, {
41692
+ enableAnimation: enableAnimation,
41693
+ id: id,
41694
+ backgroundImage: mergeLeft({
41695
+ src: src
41696
+ }, design.backgroundImage),
41697
+ className: "relative flex items-center justify-between",
41698
+ design: mergeDesign(design.body, 80)
41699
+ }, /*#__PURE__*/React__default.createElement(PageNavigation, {
41700
+ activeIndex: activeIndex,
41701
+ slides: slides,
41702
+ swiperRef: swiperRef,
41703
+ isStart: true,
41704
+ Icon: ArrowLeftS$1,
41705
+ className: "absolute left-0 top-1/2 z-20 sm:left-2 lg:left-28",
41706
+ onClick: function onClick() {
41707
+ var _swiperRef$current;
41708
+ return (_swiperRef$current = swiperRef.current) === null || _swiperRef$current === void 0 ? void 0 : _swiperRef$current.slidePrev();
41709
+ }
41710
+ }), /*#__PURE__*/React__default.createElement(Swiper, {
41711
+ loop: true,
41712
+ history: {
41713
+ enabled: true,
41714
+ key: pageUrl !== null && pageUrl !== void 0 ? pageUrl : "slides"
41715
+ },
41716
+ keyboard: {
41717
+ enabled: true,
41718
+ onlyInViewport: true
41719
+ },
41720
+ modules: swiperModules,
41721
+ spaceBetween: 10,
41722
+ onSlideChange: function onSlideChange(swiper) {
41723
+ return setActiveIndex(swiper.activeIndex);
41724
+ },
41725
+ onSwiper: function onSwiper(swiper) {
41726
+ swiperRef.current = swiper;
41727
+ }
41728
+ }, slides.map(function (_ref3, index) {
41729
+ var title = _ref3.title,
41730
+ url = _ref3.url,
41731
+ logoUrl = _ref3.logoUrl,
41732
+ subTitle = _ref3.subTitle,
41733
+ layout = _ref3.layout,
41734
+ imageUrl = _ref3.imageUrl,
41735
+ backgroundImage = _ref3.backgroundImage;
41736
+ return /*#__PURE__*/React__default.createElement(SwiperSlide, {
41737
+ className: classnames("my-auto", className),
41738
+ "data-history": !disableButtonAndLinks ? url : "",
41739
+ key: getUniqueKey(title, index)
41740
+ }, /*#__PURE__*/React__default.createElement(StyledWrapper, {
41741
+ isRootWrapper: true,
41742
+ backgroundImage: mergeLeft({
41743
+ src: backgroundImage.src
41744
+ }, design.backgroundImage),
41745
+ className: classnames("neeto-site-block-wrapper relative lg:w-9/12", baseClasses),
41746
+ design: mergeRight(design.container, {
41747
+ paddingHorizontal: design.body.paddingHorizontal
41748
+ })
41749
+ }, /*#__PURE__*/React__default.createElement(StyledImage$1, {
41750
+ className: "absolute top-8 right-12 w-20",
41751
+ src: logoUrl
41752
+ }), renderSwiperSlide({
41753
+ title: title,
41754
+ logoUrl: logoUrl,
41755
+ subTitle: subTitle,
41756
+ layout: layout,
41757
+ imageUrl: imageUrl
41758
+ })));
41759
+ })), /*#__PURE__*/React__default.createElement(PageNavigation, {
41760
+ activeIndex: activeIndex,
41761
+ swiperRef: swiperRef,
41762
+ Icon: ArrowRightS$1,
41763
+ className: "absolute top-1/2 right-0 z-20 sm:right-2 lg:right-28",
41764
+ onClick: function onClick() {
41765
+ var _swiperRef$current2;
41766
+ return (_swiperRef$current2 = swiperRef.current) === null || _swiperRef$current2 === void 0 ? void 0 : _swiperRef$current2.slideNext();
41767
+ }
41768
+ }));
41769
+ };
41770
+
41350
41771
  var _excluded$1 = ["configurations", "className", "id"];
41351
41772
  var TestimonialWithSlider = function TestimonialWithSlider(_ref) {
41352
41773
  var configurations = _ref.configurations,
@@ -41545,5 +41966,5 @@ var index = /*#__PURE__*/Object.freeze({
41545
41966
  Outlined: OutlineIcons
41546
41967
  });
41547
41968
 
41548
- export { BlogContent, CardsClassic, CardsInGridView, CardsWithCustomizableGrid, CardsWithImage, CtaClassic, CtaWithEmailAction, CtaWithLogo, index$1 as DESIGN_OPTIONS, Embed, FaqWithHamburgerView as FaqWithAccordion, FeatureWithBulletList, FeatureWithDetails, FeatureWithGrid, FeatureWithImage, FeatureWithJumboText, FeatureWithList, FeatureWithProgressBar, FooterClassic, FooterWithIcons, FooterWithLinks, GalleryClassic, GalleryWithAutoplay, HeaderWithButtons, HeaderWithIcons, HeaderWithLogoTitle, HeroWithCallToAction, HeroWithMultipleLayouts, index as Icons, LogoClouds, Paragraph, PricingInCardView, TestimonialWithSlider, TestimonialWithVerticalView };
41969
+ export { BlogContent, CardsClassic, CardsInGridView, CardsWithCustomizableGrid, CardsWithImage, CtaClassic, CtaWithEmailAction, CtaWithLogo, index$1 as DESIGN_OPTIONS, Embed, FaqWithHamburgerView as FaqWithAccordion, FeatureWithBulletList, FeatureWithDetails, FeatureWithGrid, FeatureWithImage, FeatureWithJumboText, FeatureWithList, FeatureWithProgressBar, FooterClassic, FooterWithIcons, FooterWithLinks, GalleryClassic, GalleryWithAutoplay, HeaderWithButtons, HeaderWithIcons, HeaderWithLogoTitle, HeroWithCallToAction, HeroWithMultipleLayouts, index as Icons, LogoClouds, Paragraph, PricingInCardView, Slides, TestimonialWithSlider, TestimonialWithVerticalView };
41549
41970
  //# sourceMappingURL=index.js.map