@fonixtree/magic-design 1.0.160 → 1.0.162

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.
@@ -44,17 +44,19 @@ function ProductCardModal(_a) {
44
44
 
45
45
  var flag = true;
46
46
 
47
+ var _data = data.slice(0, 2);
48
+
47
49
  var handleNext = function handleNext(e) {
48
50
  e.stopPropagation();
49
51
  setActive(function (prev) {
50
- return (prev + 1) % data.length;
52
+ return (prev + 1) % _data.length;
51
53
  });
52
54
  };
53
55
 
54
56
  var handlePrev = function handlePrev(e) {
55
57
  e.stopPropagation();
56
58
  setActive(function (prev) {
57
- return (prev - 1 + data.length) % data.length;
59
+ return (prev - 1 + _data.length) % _data.length;
58
60
  });
59
61
  };
60
62
 
@@ -121,7 +123,7 @@ function ProductCardModal(_a) {
121
123
  onClick: function onClick(e) {
122
124
  return e.stopPropagation();
123
125
  }
124
- }, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, data.slice(0, 2).map(function (item, index) {
126
+ }, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, _data.map(function (item, index) {
125
127
  return /*#__PURE__*/_react["default"].createElement(_framerMotion.motion.div, {
126
128
  key: item.offerId,
127
129
  animate: {
@@ -129,7 +131,7 @@ function ProductCardModal(_a) {
129
131
  scale: isActive(index) ? 1 : 0.95,
130
132
  z: isActive(index) ? 0 : -100,
131
133
  rotate: isActive(index) ? 0 : randomRotateY(index),
132
- zIndex: isActive(index) ? 999 : data.length + 2 - index,
134
+ zIndex: isActive(index) ? 999 : _data.length + 2 - index,
133
135
  y: isActive(index) ? [0, -80, 0] : 0
134
136
  },
135
137
  className: "card",
@@ -25,6 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
25
25
 
26
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
27
 
28
+ var num = 0;
29
+
28
30
  function ParallaxScroll(_a) {
29
31
  var source = _a.source,
30
32
  xGap = _a.xGap,
@@ -86,14 +88,18 @@ function ParallaxScroll(_a) {
86
88
  };
87
89
 
88
90
  var onLoad = function onLoad() {
89
- initLayout();
91
+ if (num < source.length - 1) {
92
+ num += 1;
93
+ } else {
94
+ initLayout();
95
+ setTimeout(function () {
96
+ initLayout();
97
+ }, 1000);
98
+ }
90
99
  };
91
100
 
92
101
  (0, _react.useEffect)(function () {
93
102
  if (!(0, _coreUtil.isDesignMode)()) {
94
- // setTimeout(() => {
95
- // initLayout();
96
- // }, 1500);
97
103
  window.addEventListener('resize', (0, _debounce["default"])(initLayout, 200));
98
104
  return function () {
99
105
  window.removeEventListener('resize', initLayout);
@@ -44,17 +44,19 @@ function ProductCardModal(_a) {
44
44
 
45
45
  var flag = true;
46
46
 
47
+ var _data = data.slice(0, 2);
48
+
47
49
  var handleNext = function handleNext(e) {
48
50
  e.stopPropagation();
49
51
  setActive(function (prev) {
50
- return (prev + 1) % data.length;
52
+ return (prev + 1) % _data.length;
51
53
  });
52
54
  };
53
55
 
54
56
  var handlePrev = function handlePrev(e) {
55
57
  e.stopPropagation();
56
58
  setActive(function (prev) {
57
- return (prev - 1 + data.length) % data.length;
59
+ return (prev - 1 + _data.length) % _data.length;
58
60
  });
59
61
  };
60
62
 
@@ -121,7 +123,7 @@ function ProductCardModal(_a) {
121
123
  onClick: function onClick(e) {
122
124
  return e.stopPropagation();
123
125
  }
124
- }, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, data.slice(0, 2).map(function (item, index) {
126
+ }, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, _data.map(function (item, index) {
125
127
  return /*#__PURE__*/_react["default"].createElement(_framerMotion.motion.div, {
126
128
  key: item.offerId,
127
129
  animate: {
@@ -129,7 +131,7 @@ function ProductCardModal(_a) {
129
131
  scale: isActive(index) ? 1 : 0.95,
130
132
  z: isActive(index) ? 0 : -100,
131
133
  rotate: isActive(index) ? 0 : randomRotateY(index),
132
- zIndex: isActive(index) ? 999 : data.length + 2 - index,
134
+ zIndex: isActive(index) ? 999 : _data.length + 2 - index,
133
135
  y: isActive(index) ? [0, -80, 0] : 0
134
136
  },
135
137
  className: "card",
@@ -25,6 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
25
25
 
26
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
27
 
28
+ var num = 0;
29
+
28
30
  function ParallaxScroll(_a) {
29
31
  var source = _a.source,
30
32
  xGap = _a.xGap,
@@ -86,14 +88,18 @@ function ParallaxScroll(_a) {
86
88
  };
87
89
 
88
90
  var onLoad = function onLoad() {
89
- initLayout();
91
+ if (num < source.length - 1) {
92
+ num += 1;
93
+ } else {
94
+ initLayout();
95
+ setTimeout(function () {
96
+ initLayout();
97
+ }, 1000);
98
+ }
90
99
  };
91
100
 
92
101
  (0, _react.useEffect)(function () {
93
102
  if (!(0, _coreUtil.isDesignMode)()) {
94
- // setTimeout(() => {
95
- // initLayout();
96
- // }, 1500);
97
103
  window.addEventListener('resize', (0, _debounce["default"])(initLayout, 200));
98
104
  return function () {
99
105
  window.removeEventListener('resize', initLayout);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "1.0.160",
4
+ "version": "1.0.162",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",