@bigbinary/neeto-site-blocks 1.16.10 → 1.16.12

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
@@ -7,7 +7,7 @@ import { motion, AnimatePresence } from 'framer-motion';
7
7
  import { has, __, isEmpty, mergeRight, pickBy, identity, mergeAll, prop, dissoc, equals, mergeLeft, omit } from 'ramda';
8
8
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
9
9
  import React, { useState, useEffect, useSyncExternalStore, createElement as createElement$1, forwardRef, useRef, useLayoutEffect, createContext, Fragment } from 'react';
10
- import { isNotPresent, isPresent, isNotEmpty } from '@bigbinary/neeto-cist';
10
+ import { isNotPresent, isPresent, isNotEmpty, existsBy } from '@bigbinary/neeto-cist';
11
11
  import Frame, { useFrame } from 'react-frame-component';
12
12
  import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
13
13
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
@@ -14549,13 +14549,14 @@ var _excluded$e = ["configurations", "className", "id", "image"];
14549
14549
  function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14550
14550
  function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14551
14551
  var FeatureWithProgressBar = function FeatureWithProgressBar(_ref) {
14552
+ var _configurations$prope, _features, _features2, _features3, _features4, _features5;
14552
14553
  var configurations = _ref.configurations,
14553
14554
  _ref$className = _ref.className,
14554
14555
  className = _ref$className === void 0 ? "" : _ref$className,
14555
14556
  id = _ref.id,
14556
14557
  image = _ref.image,
14557
14558
  otherProps = _objectWithoutProperties(_ref, _excluded$e);
14558
- var _useState = useState(configurations.properties.features[0].id),
14559
+ var _useState = useState(((_configurations$prope = configurations.properties.features[0]) === null || _configurations$prope === void 0 ? void 0 : _configurations$prope.position) || 1),
14559
14560
  _useState2 = _slicedToArray(_useState, 2),
14560
14561
  selectedTabId = _useState2[0],
14561
14562
  setSelectedTabId = _useState2[1];
@@ -14603,6 +14604,15 @@ var FeatureWithProgressBar = function FeatureWithProgressBar(_ref) {
14603
14604
  return clearInterval(id);
14604
14605
  };
14605
14606
  }, [selectedTabId]);
14607
+ useEffect(function () {
14608
+ var tabExists = existsBy({
14609
+ position: selectedTabId
14610
+ }, features);
14611
+ if (!tabExists && isNotEmpty(features)) {
14612
+ clearInterval(intervalId);
14613
+ setSelectedTabId(features[0].position);
14614
+ }
14615
+ }, [features.length]);
14606
14616
  var imageBaseClasses = classnames("col-span-12 flex justify-center", {
14607
14617
  "lg:col-start-7": contentPosition === POSITIONS.LEFT.label,
14608
14618
  "lg:col-span-6": contentPosition === POSITIONS.RIGHT.label
@@ -14636,13 +14646,13 @@ var FeatureWithProgressBar = function FeatureWithProgressBar(_ref) {
14636
14646
  children: description
14637
14647
  })), features.map(function (_ref2, index) {
14638
14648
  var featureTitle = _ref2.title,
14639
- id = _ref2.id;
14649
+ position = _ref2.position;
14640
14650
  return /*#__PURE__*/createElement$1(MotionWrapper, {
14641
14651
  enableAnimation: enableAnimation,
14642
14652
  className: "relative cursor-pointer",
14643
14653
  key: getUniqueKey(featureTitle, index),
14644
14654
  onClick: function onClick() {
14645
- return handleTabClick(id);
14655
+ return handleTabClick(position);
14646
14656
  }
14647
14657
  }, /*#__PURE__*/jsx(Typography$1, _objectSpread$e(_objectSpread$e({
14648
14658
  index: index,
@@ -14658,7 +14668,7 @@ var FeatureWithProgressBar = function FeatureWithProgressBar(_ref) {
14658
14668
  backgroundColor: "#E6E6E6",
14659
14669
  height: "1px"
14660
14670
  },
14661
- children: selectedTabId === id && /*#__PURE__*/jsx(StyledWrapper, {
14671
+ children: selectedTabId === position && /*#__PURE__*/jsx(StyledWrapper, {
14662
14672
  className: "h-full rounded-xl transition-all duration-300 ease-in-out",
14663
14673
  design: {
14664
14674
  width: "0%",
@@ -14672,16 +14682,16 @@ var FeatureWithProgressBar = function FeatureWithProgressBar(_ref) {
14672
14682
  className: imageBaseClasses,
14673
14683
  children: /*#__PURE__*/jsx(Media, {
14674
14684
  image: image,
14675
- alt: features[selectedTabId - 1].media.alt,
14676
- autoPlay: features[selectedTabId - 1].media.autoPlay,
14685
+ alt: (_features = features[selectedTabId - 1]) === null || _features === void 0 ? void 0 : _features.media.alt,
14686
+ autoPlay: (_features2 = features[selectedTabId - 1]) === null || _features2 === void 0 ? void 0 : _features2.media.autoPlay,
14677
14687
  design: design.media,
14678
14688
  disableButtonAndLinks: otherProps.disableButtonAndLinks,
14679
14689
  id: "feature-with-progress-bar-".concat(selectedTabId - 1, "-media"),
14680
14690
  index: selectedTabId - 1,
14681
14691
  isAddNewPane: otherProps.isAddNewPane,
14682
- isEmbedded: features[selectedTabId - 1].media.isEmbedded,
14683
- src: features[selectedTabId - 1].media.src,
14684
- videoUrl: features[selectedTabId - 1].media.videoUrl,
14692
+ isEmbedded: (_features3 = features[selectedTabId - 1]) === null || _features3 === void 0 ? void 0 : _features3.media.isEmbedded,
14693
+ src: (_features4 = features[selectedTabId - 1]) === null || _features4 === void 0 ? void 0 : _features4.media.src,
14694
+ videoUrl: (_features5 = features[selectedTabId - 1]) === null || _features5 === void 0 ? void 0 : _features5.media.videoUrl,
14685
14695
  wrapperClassName: "h-full w-full"
14686
14696
  })
14687
14697
  })]