@megafon/ui-core 3.10.0 → 3.10.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.10.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.10.0...@megafon/ui-core@3.10.1) (2022-06-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **banner:** fix bug with hover on autoplay ([93271d8](https://github.com/MegafonWebLab/megafon-ui/commit/93271d8c8f9dd900c031d41f89207f61c41db063))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.10.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.9.0...@megafon/ui-core@3.10.0) (2022-05-30)
7
18
 
8
19
 
@@ -160,12 +160,6 @@ var Banner = function Banner(_ref) {
160
160
  setActiveIndex(realIndex);
161
161
  onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
162
162
  }, [onChange]);
163
- var handleAutoplayStop = React.useCallback(function () {
164
- setAutoPlaying(false);
165
- }, []);
166
- var handleAutoPlayStart = React.useCallback(function () {
167
- setAutoPlaying(true);
168
- }, []);
169
163
  React.useEffect(function () {
170
164
  var rootElement = rootRef.current;
171
165
 
@@ -175,9 +169,11 @@ var Banner = function Banner(_ref) {
175
169
 
176
170
  rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseenter', function () {
177
171
  swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.stop();
172
+ setAutoPlaying(false);
178
173
  });
179
174
  rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseleave', function () {
180
175
  swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
176
+ setAutoPlaying(true);
181
177
  });
182
178
  }, [autoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
183
179
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
@@ -195,8 +191,6 @@ var Banner = function Banner(_ref) {
195
191
  onReachEnd: handleReachEnd,
196
192
  onFromEdge: handleFromEdge,
197
193
  onSlideChange: handleSlideChange,
198
- onAutoplayStop: handleAutoplayStop,
199
- onAutoplayStart: handleAutoPlayStart,
200
194
  onTouchEnd: increaseAutoplayDelay
201
195
  }), React.Children.map(children, function (child, i) {
202
196
  return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
@@ -188,12 +188,6 @@ var Banner = function Banner(_ref) {
188
188
  setActiveIndex(realIndex);
189
189
  onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
190
190
  }, [onChange]);
191
- var handleAutoplayStop = React.useCallback(function () {
192
- setAutoPlaying(false);
193
- }, []);
194
- var handleAutoPlayStart = React.useCallback(function () {
195
- setAutoPlaying(true);
196
- }, []);
197
191
  React.useEffect(function () {
198
192
  var rootElement = rootRef.current;
199
193
 
@@ -203,9 +197,11 @@ var Banner = function Banner(_ref) {
203
197
 
204
198
  rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseenter', function () {
205
199
  swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.stop();
200
+ setAutoPlaying(false);
206
201
  });
207
202
  rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseleave', function () {
208
203
  swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
204
+ setAutoPlaying(true);
209
205
  });
210
206
  }, [autoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
211
207
  return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
@@ -223,8 +219,6 @@ var Banner = function Banner(_ref) {
223
219
  onReachEnd: handleReachEnd,
224
220
  onFromEdge: handleFromEdge,
225
221
  onSlideChange: handleSlideChange,
226
- onAutoplayStop: handleAutoplayStop,
227
- onAutoplayStart: handleAutoPlayStart,
228
222
  onTouchEnd: increaseAutoplayDelay
229
223
  }), React.Children.map(children, function (child, i) {
230
224
  return /*#__PURE__*/React.createElement(_react2.SwiperSlide, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -97,5 +97,5 @@
97
97
  "react-popper": "^2.2.3",
98
98
  "swiper": "^6.5.6"
99
99
  },
100
- "gitHead": "eca7dfc6c6f0f7317f404b989bb8d7bd5ec429ed"
100
+ "gitHead": "ab5598d6f428c21c22d939ed586a3795b3d6467a"
101
101
  }