@megafon/ui-core 8.11.0 → 8.11.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.
@@ -1 +1 @@
1
- h1,h2,h3,h4,h5{margin:0}.mfui-modal-open-body{height:100%;overflow:hidden}.mfui-modal__overlay{display:-webkit-box;display:-ms-flexbox;display:flex;left:0;position:fixed;top:0;z-index:1000;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-animation:show-popup-overlay .3s ease-out forwards;animation:show-popup-overlay .3s ease-out forwards;-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;justify-content:flex-start;opacity:0;padding:72px 0;width:100%}.mfui-modal__modal-content{margin:auto;position:relative}.mfui-modal_full-view .mfui-modal__overlay{display:block;padding:0}.mfui-modal_full-view .mfui-modal__modal-content{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:100%;width:100%}.mfui-modal_bottom-view .mfui-modal__overlay{bottom:0;display:block;height:auto;overflow:hidden;padding-bottom:0}.mfui-modal_bottom-view .mfui-modal__modal-content{height:100%;margin:0;outline:none;overflow:hidden}.mfui-modal_native-scroll .mfui-modal__overlay{overflow-x:hidden;overflow-y:scroll}@media screen and (hover:hover){.mfui-modal_native-scroll .mfui-modal__overlay{width:calc(100% + 15px)}}.mfui-modal_transition-end .mfui-modal__overlay{-webkit-animation:hide-popup-overlay .2s ease-in;animation:hide-popup-overlay .2s ease-in}@-webkit-keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@-webkit-keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}@keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-modal-open-body{height:100%;overflow:hidden}.mfui-modal__overlay{display:-webkit-box;display:-ms-flexbox;display:flex;left:0;position:fixed;top:0;z-index:1000;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-animation:show-popup-overlay .3s ease-out forwards;animation:show-popup-overlay .3s ease-out forwards;-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;justify-content:flex-start;opacity:0;padding:72px 0;width:100%}.mfui-modal__modal-content{margin:auto;position:relative}.mfui-modal_full-view .mfui-modal__overlay{display:block;padding:0}.mfui-modal_full-view .mfui-modal__modal-content{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:100%;width:100%}.mfui-modal_bottom-view .mfui-modal__overlay{bottom:0;display:block;height:auto;overflow:hidden;padding-bottom:0;-ms-touch-action:none;touch-action:none}.mfui-modal_bottom-view .mfui-modal__modal-content{height:100%;margin:0;outline:none;overflow:hidden;-ms-touch-action:pan-y;touch-action:pan-y}.mfui-modal_native-scroll .mfui-modal__overlay{overflow-x:hidden;overflow-y:scroll}@media screen and (hover:hover){.mfui-modal_native-scroll .mfui-modal__overlay{width:calc(100% + 15px)}}.mfui-modal_transition-end .mfui-modal__overlay{-webkit-animation:hide-popup-overlay .2s ease-in;animation:hide-popup-overlay .2s ease-in}@-webkit-keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@-webkit-keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}@keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}
@@ -161,7 +161,10 @@ var ModalContent = function ModalContent(_ref) {
161
161
  className: cn('container-inner', {
162
162
  'native-scroll': isEnabledNativeScroll
163
163
  }, classes === null || classes === void 0 ? void 0 : classes.containerInner),
164
- ref: containerInnerRef
164
+ ref: containerInnerRef,
165
+ onClick: function onClick(e) {
166
+ return e.stopPropagation();
167
+ }
165
168
  }), isStickyHeader && renderHeader, /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.containerBody), {
166
169
  className: cn('container-body', {
167
170
  'native-scroll': isEnabledNativeScroll
@@ -79,7 +79,6 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
79
79
  });
80
80
  }, [containerWrapRef, scrollBarScrollableRef, initialContainerWrapHeight, initialTouchPosition, onChangeContainerWrapTransform, onChangeTransitionStep]);
81
81
  var handleWindowTouchEnd = React.useCallback(function (e) {
82
- var _a;
83
82
  var containerWrapNode = containerWrapRef.current;
84
83
  var scrollableNode = scrollBarScrollableRef.current;
85
84
  var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
@@ -87,12 +86,28 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
87
86
  return;
88
87
  }
89
88
  window.cancelAnimationFrame(animationFrameId.current);
89
+ if (!e.changedTouches.length) {
90
+ setInitialTouchPosition(null);
91
+ return;
92
+ }
93
+ var touchStartY = initialTouchPosition;
94
+ var touchEndY = e.changedTouches[0].clientY;
95
+ if (touchStartY === null) {
96
+ setInitialTouchPosition(null);
97
+ return;
98
+ }
99
+ var deltaY = touchStartY - touchEndY;
100
+ var absDeltaY = Math.abs(deltaY);
101
+ if (absDeltaY < 5 || touchStartY > touchEndY) {
102
+ setInitialTouchPosition(null);
103
+ return;
104
+ }
90
105
  var containerCenterPosition = containerWrapNode.offsetTop + offsetHeightCenter;
91
- var isMoreHalfClosed = ((_a = e.changedTouches[0]) === null || _a === void 0 ? void 0 : _a.clientY) > containerCenterPosition;
106
+ var isMoreHalfClosed = touchEndY > containerCenterPosition;
92
107
  setInitialTouchPosition(null);
93
108
  onChangeContainerWrapTransform(isMoreHalfClosed ? 'translateY(100%)' : 'none');
94
109
  onChangeTransitionStep(isMoreHalfClosed ? MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP : MODAL_TRANSITIONS_STEPS_ENUM.INITIAL_STEP);
95
- }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
110
+ }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, initialTouchPosition, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
96
111
  React.useEffect(function () {
97
112
  if (isSwipeDisabled) {
98
113
  return undefined;
@@ -1 +1 @@
1
- h1,h2,h3,h4,h5{margin:0}.mfui-modal-open-body{height:100%;overflow:hidden}.mfui-modal__overlay{display:-webkit-box;display:-ms-flexbox;display:flex;left:0;position:fixed;top:0;z-index:1000;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-animation:show-popup-overlay .3s ease-out forwards;animation:show-popup-overlay .3s ease-out forwards;-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;justify-content:flex-start;opacity:0;padding:72px 0;width:100%}.mfui-modal__modal-content{margin:auto;position:relative}.mfui-modal_full-view .mfui-modal__overlay{display:block;padding:0}.mfui-modal_full-view .mfui-modal__modal-content{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:100%;width:100%}.mfui-modal_bottom-view .mfui-modal__overlay{bottom:0;display:block;height:auto;overflow:hidden;padding-bottom:0}.mfui-modal_bottom-view .mfui-modal__modal-content{height:100%;margin:0;outline:none;overflow:hidden}.mfui-modal_native-scroll .mfui-modal__overlay{overflow-x:hidden;overflow-y:scroll}@media screen and (hover:hover){.mfui-modal_native-scroll .mfui-modal__overlay{width:calc(100% + 15px)}}.mfui-modal_transition-end .mfui-modal__overlay{-webkit-animation:hide-popup-overlay .2s ease-in;animation:hide-popup-overlay .2s ease-in}@-webkit-keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@-webkit-keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}@keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-modal-open-body{height:100%;overflow:hidden}.mfui-modal__overlay{display:-webkit-box;display:-ms-flexbox;display:flex;left:0;position:fixed;top:0;z-index:1000;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;-webkit-animation:show-popup-overlay .3s ease-out forwards;animation:show-popup-overlay .3s ease-out forwards;-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;justify-content:flex-start;opacity:0;padding:72px 0;width:100%}.mfui-modal__modal-content{margin:auto;position:relative}.mfui-modal_full-view .mfui-modal__overlay{display:block;padding:0}.mfui-modal_full-view .mfui-modal__modal-content{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:100%;width:100%}.mfui-modal_bottom-view .mfui-modal__overlay{bottom:0;display:block;height:auto;overflow:hidden;padding-bottom:0;-ms-touch-action:none;touch-action:none}.mfui-modal_bottom-view .mfui-modal__modal-content{height:100%;margin:0;outline:none;overflow:hidden;-ms-touch-action:pan-y;touch-action:pan-y}.mfui-modal_native-scroll .mfui-modal__overlay{overflow-x:hidden;overflow-y:scroll}@media screen and (hover:hover){.mfui-modal_native-scroll .mfui-modal__overlay{width:calc(100% + 15px)}}.mfui-modal_transition-end .mfui-modal__overlay{-webkit-animation:hide-popup-overlay .2s ease-in;animation:hide-popup-overlay .2s ease-in}@-webkit-keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@keyframes show-popup-overlay{0%{opacity:0}to{opacity:1}}@-webkit-keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}@keyframes hide-popup-overlay{0%{opacity:1}to{opacity:0}}
@@ -170,7 +170,10 @@ var ModalContent = function ModalContent(_ref) {
170
170
  className: cn('container-inner', {
171
171
  'native-scroll': isEnabledNativeScroll
172
172
  }, classes === null || classes === void 0 ? void 0 : classes.containerInner),
173
- ref: containerInnerRef
173
+ ref: containerInnerRef,
174
+ onClick: function onClick(e) {
175
+ return e.stopPropagation();
176
+ }
174
177
  }), isStickyHeader && renderHeader, /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.containerBody), {
175
178
  className: cn('container-body', {
176
179
  'native-scroll': isEnabledNativeScroll
@@ -88,7 +88,6 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
88
88
  });
89
89
  }, [containerWrapRef, scrollBarScrollableRef, initialContainerWrapHeight, initialTouchPosition, onChangeContainerWrapTransform, onChangeTransitionStep]);
90
90
  var handleWindowTouchEnd = React.useCallback(function (e) {
91
- var _a;
92
91
  var containerWrapNode = containerWrapRef.current;
93
92
  var scrollableNode = scrollBarScrollableRef.current;
94
93
  var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
@@ -96,12 +95,28 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
96
95
  return;
97
96
  }
98
97
  window.cancelAnimationFrame(animationFrameId.current);
98
+ if (!e.changedTouches.length) {
99
+ setInitialTouchPosition(null);
100
+ return;
101
+ }
102
+ var touchStartY = initialTouchPosition;
103
+ var touchEndY = e.changedTouches[0].clientY;
104
+ if (touchStartY === null) {
105
+ setInitialTouchPosition(null);
106
+ return;
107
+ }
108
+ var deltaY = touchStartY - touchEndY;
109
+ var absDeltaY = Math.abs(deltaY);
110
+ if (absDeltaY < 5 || touchStartY > touchEndY) {
111
+ setInitialTouchPosition(null);
112
+ return;
113
+ }
99
114
  var containerCenterPosition = containerWrapNode.offsetTop + offsetHeightCenter;
100
- var isMoreHalfClosed = ((_a = e.changedTouches[0]) === null || _a === void 0 ? void 0 : _a.clientY) > containerCenterPosition;
115
+ var isMoreHalfClosed = touchEndY > containerCenterPosition;
101
116
  setInitialTouchPosition(null);
102
117
  onChangeContainerWrapTransform(isMoreHalfClosed ? 'translateY(100%)' : 'none');
103
118
  onChangeTransitionStep(isMoreHalfClosed ? _Modal.MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP : _Modal.MODAL_TRANSITIONS_STEPS_ENUM.INITIAL_STEP);
104
- }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
119
+ }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, initialTouchPosition, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
105
120
  React.useEffect(function () {
106
121
  if (isSwipeDisabled) {
107
122
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "8.11.0",
3
+ "version": "8.11.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -104,5 +104,5 @@
104
104
  "simplebar-react": "^3.2.5",
105
105
  "swiper": "^11.1.1"
106
106
  },
107
- "gitHead": "8b5230c1f266abd6da16ddc142f60205cc065c42"
107
+ "gitHead": "c748a0748d78a2872ab16a384d8e81b83fcd60db"
108
108
  }