@megafon/ui-core 8.11.1 → 8.12.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.
@@ -16,6 +16,7 @@ export declare const PriceBadgeIcon: {
16
16
  readonly ATTENTION: "attention";
17
17
  readonly INFO: "info";
18
18
  readonly PROFILE: "profile";
19
+ readonly BAN: "ban";
19
20
  };
20
21
  export declare const PriseBadgeSize: {
21
22
  readonly SMALL: "small";
@@ -23,6 +23,17 @@ var AttentionIcon = function AttentionIcon(props) {
23
23
  d: "M10 2c4.4 0 8 3.6 8 8s-3.6 8-8 8-8-3.6-8-8 3.6-8 8-8zm0 13c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7s-.1-.5-.3-.7c-.2-.2-.5-.3-.7-.3s-.5.1-.7.3c-.2.2-.3.4-.3.7s.1.5.3.7.5.3.7.3zM9 5v6h2V5H9z"
24
24
  }));
25
25
  };
26
+ var BanIcon = function BanIcon(props) {
27
+ return /*#__PURE__*/React.createElement("svg", _extends({
28
+ viewBox: "0 0 20 20"
29
+ }, props), /*#__PURE__*/React.createElement("path", {
30
+ d: "M12.172 13.056a3.75 3.75 0 01-5.229-5.228l5.229 5.228zM10 6.25a3.75 3.75 0 013.056 5.922L7.827 6.943A3.733 3.733 0 0110 6.25z"
31
+ }), /*#__PURE__*/React.createElement("path", {
32
+ fillRule: "evenodd",
33
+ clipRule: "evenodd",
34
+ d: "M10 2a8 8 0 110 16 8 8 0 010-16zm0 3a5 5 0 100 10 5 5 0 000-10z"
35
+ }));
36
+ };
26
37
  var CheckIcon = function CheckIcon(props) {
27
38
  return /*#__PURE__*/React.createElement("svg", _extends({
28
39
  viewBox: "0 0 20 20"
@@ -64,6 +75,17 @@ var AttentionIconBig = function AttentionIconBig(props) {
64
75
  d: "M16 4C9.4 4 4 9.4 4 16s5.4 12 12 12 12-5.4 12-12S22.6 4 16 4zm1 18h-2v-2h2v2zm0-4h-2v-8h2v8z"
65
76
  }));
66
77
  };
78
+ var BanIconBig = function BanIconBig(props) {
79
+ return /*#__PURE__*/React.createElement("svg", _extends({
80
+ viewBox: "0 0 32 32"
81
+ }, props), /*#__PURE__*/React.createElement("path", {
82
+ d: "M19.475 20.89a6 6 0 01-8.365-8.365l8.365 8.365zM16 10a6 6 0 014.89 9.475l-8.366-8.366A5.972 5.972 0 0116 10z"
83
+ }), /*#__PURE__*/React.createElement("path", {
84
+ fillRule: "evenodd",
85
+ clipRule: "evenodd",
86
+ d: "M16 4c6.627 0 12 5.373 12 12s-5.373 12-12 12S4 22.627 4 16 9.373 4 16 4zm0 4a8 8 0 100 16 8 8 0 000-16z"
87
+ }));
88
+ };
67
89
  var CheckIconBig = function CheckIconBig(props) {
68
90
  return /*#__PURE__*/React.createElement("svg", _extends({
69
91
  viewBox: "0 0 32 32"
@@ -113,7 +135,8 @@ export var PriceBadgeIcon = {
113
135
  CHECK: 'check',
114
136
  ATTENTION: 'attention',
115
137
  INFO: 'info',
116
- PROFILE: 'profile'
138
+ PROFILE: 'profile',
139
+ BAN: 'ban'
117
140
  };
118
141
  export var PriseBadgeSize = {
119
142
  SMALL: 'small',
@@ -134,6 +157,8 @@ var getPriceBadgeIcon = function getPriceBadgeIcon(iconType, size) {
134
157
  return InfoIconBig;
135
158
  case iconType === PriceBadgeIcon.PROFILE && isBigIcon:
136
159
  return ProfileIconBig;
160
+ case iconType === PriceBadgeIcon.BAN && isBigIcon:
161
+ return BanIconBig;
137
162
  case iconType === PriceBadgeIcon.PRICE:
138
163
  return PriceIcon;
139
164
  case iconType === PriceBadgeIcon.CHECK:
@@ -144,6 +169,8 @@ var getPriceBadgeIcon = function getPriceBadgeIcon(iconType, size) {
144
169
  return InfoIcon;
145
170
  case iconType === PriceBadgeIcon.PROFILE:
146
171
  return ProfileIcon;
172
+ case iconType === PriceBadgeIcon.BAN:
173
+ return BanIcon;
147
174
  default:
148
175
  return TimerIcon;
149
176
  }
@@ -21,6 +21,11 @@ export declare const NavTheme: {
21
21
  readonly DARK: "dark";
22
22
  };
23
23
  type NavThemeType = (typeof NavTheme)[keyof typeof NavTheme];
24
+ export declare const PaginationAlign: {
25
+ readonly CENTER: "center";
26
+ readonly LEFT: "left";
27
+ };
28
+ export type PaginationAlignType = (typeof PaginationAlign)[keyof typeof PaginationAlign];
24
29
  export declare const PaginationTheme: {
25
30
  readonly DEFAULT: "default";
26
31
  readonly LIGHT: "light";
@@ -63,8 +68,8 @@ export interface IBannerProps {
63
68
  dotSvg?: Record<string, string>;
64
69
  dotInner?: Record<string, string>;
65
70
  };
66
- /** Выравнивание блока пагинации */
67
- paginationAlign?: 'center' | 'left';
71
+ /** Выравнивание блока пагинации. DEPRECATED: 'left' */
72
+ paginationAlign?: PaginationAlignType;
68
73
  /** Цветовая тема пагинации */
69
74
  paginationTheme?: PaginationThemeType;
70
75
  /** Тип кнопок пагинации */
@@ -22,7 +22,7 @@ try {
22
22
  Autoplay = Modules.Autoplay;
23
23
  } catch (e) {
24
24
  // eslint-disable-next-line no-console
25
- console.warn("\n WARNING: megafon/ui-core is using the latest version of swiper. \n For more information about server-side rendering\n please check the Banner component documentation at:\n https://ui.megafon.ru/components/banner\n ");
25
+ console.warn("\n WARNING: megafon/ui-core is using the latest version of swiper.\n For more information about server-side rendering\n please check the Banner component documentation at:\n https://ui.megafon.ru/components/banner\n ");
26
26
  }
27
27
  export var BackgroundColor = {
28
28
  TRANSPARENT: 'transparent',
@@ -40,6 +40,10 @@ export var NavTheme = {
40
40
  LIGHT: 'light',
41
41
  DARK: 'dark'
42
42
  };
43
+ export var PaginationAlign = {
44
+ CENTER: 'center',
45
+ LEFT: 'left'
46
+ };
43
47
  export var PaginationTheme = {
44
48
  DEFAULT: 'default',
45
49
  LIGHT: 'light',
@@ -59,10 +63,9 @@ var Banner = function Banner(_ref) {
59
63
  _ref$classes = _ref.classes,
60
64
  classes = _ref$classes === void 0 ? {} : _ref$classes,
61
65
  dataAttrs = _ref.dataAttrs,
62
- paginationAlign = _ref.paginationAlign,
63
- paginationTheme = _ref.paginationTheme,
66
+ _ref$paginationAlign = _ref.paginationAlign,
67
+ paginationAlign = _ref$paginationAlign === void 0 ? PaginationAlign.CENTER : _ref$paginationAlign,
64
68
  paginationType = _ref.paginationType,
65
- paginationPosition = _ref.paginationPosition,
66
69
  _ref$withPaginationBo = _ref.withPaginationBottomOffset,
67
70
  withPaginationBottomOffset = _ref$withPaginationBo === void 0 ? false : _ref$withPaginationBo,
68
71
  _ref$autoPlay = _ref.autoPlay,
@@ -73,8 +76,7 @@ var Banner = function Banner(_ref) {
73
76
  loop = _ref$loop === void 0 ? false : _ref$loop,
74
77
  _ref$pauseOnHover = _ref.pauseOnHover,
75
78
  pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover,
76
- _ref$backgroundColor = _ref.backgroundColor,
77
- backgroundColor = _ref$backgroundColor === void 0 ? BackgroundColor.TRANSPARENT : _ref$backgroundColor,
79
+ backgroundColor = _ref.backgroundColor,
78
80
  _ref$radius = _ref.radius,
79
81
  radius = _ref$radius === void 0 ? Radius.ROUNDED : _ref$radius,
80
82
  _ref$arrowTheme = _ref.arrowTheme,
@@ -130,6 +132,20 @@ var Banner = function Banner(_ref) {
130
132
  var dotTimerDelay = delay / 1000;
131
133
  var arrowSize = arrowTheme === ArrowTheme.WHITE ? ArrowSize.LARGE : ArrowSize.MIDDLE;
132
134
  var rootRef = React.useRef(null);
135
+ var correctPaginationPosition = paginationType === PaginationButtonType.FLAT ? PaginationPositionType.TOP_IN : PaginationPositionType.BOTTOM_OUT;
136
+ var correctPaginationAlign = paginationType === PaginationButtonType.FLAT ? paginationAlign : PaginationAlign.CENTER;
137
+ var getCorrectPaginationTheme = function getCorrectPaginationTheme() {
138
+ switch (backgroundColor) {
139
+ case BackgroundColor.GREEN:
140
+ case BackgroundColor.PURPLE:
141
+ return PaginationTheme.LIGHT;
142
+ case BackgroundColor.LIGHT:
143
+ case BackgroundColor.GRADIENT:
144
+ return PaginationTheme.DARK;
145
+ default:
146
+ return PaginationTheme.DEFAULT;
147
+ }
148
+ };
133
149
  var increaseAutoplayDelay = React.useCallback(function (_ref2) {
134
150
  var params = _ref2.params,
135
151
  autoplay = _ref2.autoplay;
@@ -249,8 +265,8 @@ var Banner = function Banner(_ref) {
249
265
  var renderPagination = /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
250
266
  className: cn('pagination', {
251
267
  type: paginationType,
252
- align: paginationAlign,
253
- position: paginationPosition,
268
+ align: correctPaginationAlign,
269
+ position: correctPaginationPosition,
254
270
  'bottom-offset': withPaginationBottomOffset
255
271
  }, [classes.pagination])
256
272
  }), children && React.Children.map(children, function (_, i) {
@@ -267,7 +283,7 @@ var Banner = function Banner(_ref) {
267
283
  showTimer: showDotTimer,
268
284
  timerDelay: dotTimerDelay,
269
285
  type: paginationType,
270
- theme: paginationTheme,
286
+ theme: getCorrectPaginationTheme(),
271
287
  onClick: handleDotClick
272
288
  });
273
289
  }));
@@ -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;-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}}
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}}
@@ -161,10 +161,7 @@ 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,
165
- onClick: function onClick(e) {
166
- return e.stopPropagation();
167
- }
164
+ ref: containerInnerRef
168
165
  }), isStickyHeader && renderHeader, /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.containerBody), {
169
166
  className: cn('container-body', {
170
167
  'native-scroll': isEnabledNativeScroll
@@ -79,6 +79,7 @@ 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;
82
83
  var containerWrapNode = containerWrapRef.current;
83
84
  var scrollableNode = scrollBarScrollableRef.current;
84
85
  var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
@@ -86,28 +87,12 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
86
87
  return;
87
88
  }
88
89
  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
- }
105
90
  var containerCenterPosition = containerWrapNode.offsetTop + offsetHeightCenter;
106
- var isMoreHalfClosed = touchEndY > containerCenterPosition;
91
+ var isMoreHalfClosed = ((_a = e.changedTouches[0]) === null || _a === void 0 ? void 0 : _a.clientY) > containerCenterPosition;
107
92
  setInitialTouchPosition(null);
108
93
  onChangeContainerWrapTransform(isMoreHalfClosed ? 'translateY(100%)' : 'none');
109
94
  onChangeTransitionStep(isMoreHalfClosed ? MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP : MODAL_TRANSITIONS_STEPS_ENUM.INITIAL_STEP);
110
- }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, initialTouchPosition, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
95
+ }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
111
96
  React.useEffect(function () {
112
97
  if (isSwipeDisabled) {
113
98
  return undefined;
@@ -16,6 +16,7 @@ export declare const PriceBadgeIcon: {
16
16
  readonly ATTENTION: "attention";
17
17
  readonly INFO: "info";
18
18
  readonly PROFILE: "profile";
19
+ readonly BAN: "ban";
19
20
  };
20
21
  export declare const PriseBadgeSize: {
21
22
  readonly SMALL: "small";
@@ -32,6 +32,17 @@ var AttentionIcon = function AttentionIcon(props) {
32
32
  d: "M10 2c4.4 0 8 3.6 8 8s-3.6 8-8 8-8-3.6-8-8 3.6-8 8-8zm0 13c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7s-.1-.5-.3-.7c-.2-.2-.5-.3-.7-.3s-.5.1-.7.3c-.2.2-.3.4-.3.7s.1.5.3.7.5.3.7.3zM9 5v6h2V5H9z"
33
33
  }));
34
34
  };
35
+ var BanIcon = function BanIcon(props) {
36
+ return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
37
+ viewBox: "0 0 20 20"
38
+ }, props), /*#__PURE__*/React.createElement("path", {
39
+ d: "M12.172 13.056a3.75 3.75 0 01-5.229-5.228l5.229 5.228zM10 6.25a3.75 3.75 0 013.056 5.922L7.827 6.943A3.733 3.733 0 0110 6.25z"
40
+ }), /*#__PURE__*/React.createElement("path", {
41
+ fillRule: "evenodd",
42
+ clipRule: "evenodd",
43
+ d: "M10 2a8 8 0 110 16 8 8 0 010-16zm0 3a5 5 0 100 10 5 5 0 000-10z"
44
+ }));
45
+ };
35
46
  var CheckIcon = function CheckIcon(props) {
36
47
  return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
37
48
  viewBox: "0 0 20 20"
@@ -73,6 +84,17 @@ var AttentionIconBig = function AttentionIconBig(props) {
73
84
  d: "M16 4C9.4 4 4 9.4 4 16s5.4 12 12 12 12-5.4 12-12S22.6 4 16 4zm1 18h-2v-2h2v2zm0-4h-2v-8h2v8z"
74
85
  }));
75
86
  };
87
+ var BanIconBig = function BanIconBig(props) {
88
+ return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
89
+ viewBox: "0 0 32 32"
90
+ }, props), /*#__PURE__*/React.createElement("path", {
91
+ d: "M19.475 20.89a6 6 0 01-8.365-8.365l8.365 8.365zM16 10a6 6 0 014.89 9.475l-8.366-8.366A5.972 5.972 0 0116 10z"
92
+ }), /*#__PURE__*/React.createElement("path", {
93
+ fillRule: "evenodd",
94
+ clipRule: "evenodd",
95
+ d: "M16 4c6.627 0 12 5.373 12 12s-5.373 12-12 12S4 22.627 4 16 9.373 4 16 4zm0 4a8 8 0 100 16 8 8 0 000-16z"
96
+ }));
97
+ };
76
98
  var CheckIconBig = function CheckIconBig(props) {
77
99
  return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
78
100
  viewBox: "0 0 32 32"
@@ -122,7 +144,8 @@ var PriceBadgeIcon = exports.PriceBadgeIcon = {
122
144
  CHECK: 'check',
123
145
  ATTENTION: 'attention',
124
146
  INFO: 'info',
125
- PROFILE: 'profile'
147
+ PROFILE: 'profile',
148
+ BAN: 'ban'
126
149
  };
127
150
  var PriseBadgeSize = exports.PriseBadgeSize = {
128
151
  SMALL: 'small',
@@ -143,6 +166,8 @@ var getPriceBadgeIcon = function getPriceBadgeIcon(iconType, size) {
143
166
  return InfoIconBig;
144
167
  case iconType === PriceBadgeIcon.PROFILE && isBigIcon:
145
168
  return ProfileIconBig;
169
+ case iconType === PriceBadgeIcon.BAN && isBigIcon:
170
+ return BanIconBig;
146
171
  case iconType === PriceBadgeIcon.PRICE:
147
172
  return PriceIcon;
148
173
  case iconType === PriceBadgeIcon.CHECK:
@@ -153,6 +178,8 @@ var getPriceBadgeIcon = function getPriceBadgeIcon(iconType, size) {
153
178
  return InfoIcon;
154
179
  case iconType === PriceBadgeIcon.PROFILE:
155
180
  return ProfileIcon;
181
+ case iconType === PriceBadgeIcon.BAN:
182
+ return BanIcon;
156
183
  default:
157
184
  return TimerIcon;
158
185
  }
@@ -21,6 +21,11 @@ export declare const NavTheme: {
21
21
  readonly DARK: "dark";
22
22
  };
23
23
  type NavThemeType = (typeof NavTheme)[keyof typeof NavTheme];
24
+ export declare const PaginationAlign: {
25
+ readonly CENTER: "center";
26
+ readonly LEFT: "left";
27
+ };
28
+ export type PaginationAlignType = (typeof PaginationAlign)[keyof typeof PaginationAlign];
24
29
  export declare const PaginationTheme: {
25
30
  readonly DEFAULT: "default";
26
31
  readonly LIGHT: "light";
@@ -63,8 +68,8 @@ export interface IBannerProps {
63
68
  dotSvg?: Record<string, string>;
64
69
  dotInner?: Record<string, string>;
65
70
  };
66
- /** Выравнивание блока пагинации */
67
- paginationAlign?: 'center' | 'left';
71
+ /** Выравнивание блока пагинации. DEPRECATED: 'left' */
72
+ paginationAlign?: PaginationAlignType;
68
73
  /** Цветовая тема пагинации */
69
74
  paginationTheme?: PaginationThemeType;
70
75
  /** Тип кнопок пагинации */
@@ -4,7 +4,7 @@ function _typeof3(o) { "@babel/helpers - typeof"; return _typeof3 = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports["default"] = exports.Radius = exports.PaginationTheme = exports.PaginationPositionType = exports.PaginationButtonType = exports.NavTheme = exports.BackgroundColor = void 0;
7
+ exports["default"] = exports.Radius = exports.PaginationTheme = exports.PaginationPositionType = exports.PaginationButtonType = exports.PaginationAlign = exports.NavTheme = exports.BackgroundColor = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -32,7 +32,7 @@ try {
32
32
  Autoplay = Modules.Autoplay;
33
33
  } catch (e) {
34
34
  // eslint-disable-next-line no-console
35
- console.warn("\n WARNING: megafon/ui-core is using the latest version of swiper. \n For more information about server-side rendering\n please check the Banner component documentation at:\n https://ui.megafon.ru/components/banner\n ");
35
+ console.warn("\n WARNING: megafon/ui-core is using the latest version of swiper.\n For more information about server-side rendering\n please check the Banner component documentation at:\n https://ui.megafon.ru/components/banner\n ");
36
36
  }
37
37
  var BackgroundColor = exports.BackgroundColor = {
38
38
  TRANSPARENT: 'transparent',
@@ -50,6 +50,10 @@ var NavTheme = exports.NavTheme = {
50
50
  LIGHT: 'light',
51
51
  DARK: 'dark'
52
52
  };
53
+ var PaginationAlign = exports.PaginationAlign = {
54
+ CENTER: 'center',
55
+ LEFT: 'left'
56
+ };
53
57
  var PaginationTheme = exports.PaginationTheme = {
54
58
  DEFAULT: 'default',
55
59
  LIGHT: 'light',
@@ -69,10 +73,9 @@ var Banner = function Banner(_ref) {
69
73
  _ref$classes = _ref.classes,
70
74
  classes = _ref$classes === void 0 ? {} : _ref$classes,
71
75
  dataAttrs = _ref.dataAttrs,
72
- paginationAlign = _ref.paginationAlign,
73
- paginationTheme = _ref.paginationTheme,
76
+ _ref$paginationAlign = _ref.paginationAlign,
77
+ paginationAlign = _ref$paginationAlign === void 0 ? PaginationAlign.CENTER : _ref$paginationAlign,
74
78
  paginationType = _ref.paginationType,
75
- paginationPosition = _ref.paginationPosition,
76
79
  _ref$withPaginationBo = _ref.withPaginationBottomOffset,
77
80
  withPaginationBottomOffset = _ref$withPaginationBo === void 0 ? false : _ref$withPaginationBo,
78
81
  _ref$autoPlay = _ref.autoPlay,
@@ -83,8 +86,7 @@ var Banner = function Banner(_ref) {
83
86
  loop = _ref$loop === void 0 ? false : _ref$loop,
84
87
  _ref$pauseOnHover = _ref.pauseOnHover,
85
88
  pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover,
86
- _ref$backgroundColor = _ref.backgroundColor,
87
- backgroundColor = _ref$backgroundColor === void 0 ? BackgroundColor.TRANSPARENT : _ref$backgroundColor,
89
+ backgroundColor = _ref.backgroundColor,
88
90
  _ref$radius = _ref.radius,
89
91
  radius = _ref$radius === void 0 ? Radius.ROUNDED : _ref$radius,
90
92
  _ref$arrowTheme = _ref.arrowTheme,
@@ -140,6 +142,20 @@ var Banner = function Banner(_ref) {
140
142
  var dotTimerDelay = delay / 1000;
141
143
  var arrowSize = arrowTheme === _NavArrow.Theme.WHITE ? _NavArrow.Size.LARGE : _NavArrow.Size.MIDDLE;
142
144
  var rootRef = React.useRef(null);
145
+ var correctPaginationPosition = paginationType === PaginationButtonType.FLAT ? PaginationPositionType.TOP_IN : PaginationPositionType.BOTTOM_OUT;
146
+ var correctPaginationAlign = paginationType === PaginationButtonType.FLAT ? paginationAlign : PaginationAlign.CENTER;
147
+ var getCorrectPaginationTheme = function getCorrectPaginationTheme() {
148
+ switch (backgroundColor) {
149
+ case BackgroundColor.GREEN:
150
+ case BackgroundColor.PURPLE:
151
+ return PaginationTheme.LIGHT;
152
+ case BackgroundColor.LIGHT:
153
+ case BackgroundColor.GRADIENT:
154
+ return PaginationTheme.DARK;
155
+ default:
156
+ return PaginationTheme.DEFAULT;
157
+ }
158
+ };
143
159
  var increaseAutoplayDelay = React.useCallback(function (_ref2) {
144
160
  var params = _ref2.params,
145
161
  autoplay = _ref2.autoplay;
@@ -259,8 +275,8 @@ var Banner = function Banner(_ref) {
259
275
  var renderPagination = /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
260
276
  className: cn('pagination', {
261
277
  type: paginationType,
262
- align: paginationAlign,
263
- position: paginationPosition,
278
+ align: correctPaginationAlign,
279
+ position: correctPaginationPosition,
264
280
  'bottom-offset': withPaginationBottomOffset
265
281
  }, [classes.pagination])
266
282
  }), children && React.Children.map(children, function (_, i) {
@@ -277,7 +293,7 @@ var Banner = function Banner(_ref) {
277
293
  showTimer: showDotTimer,
278
294
  timerDelay: dotTimerDelay,
279
295
  type: paginationType,
280
- theme: paginationTheme,
296
+ theme: getCorrectPaginationTheme(),
281
297
  onClick: handleDotClick
282
298
  });
283
299
  }));
@@ -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;-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}}
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}}
@@ -170,10 +170,7 @@ 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,
174
- onClick: function onClick(e) {
175
- return e.stopPropagation();
176
- }
173
+ ref: containerInnerRef
177
174
  }), isStickyHeader && renderHeader, /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.containerBody), {
178
175
  className: cn('container-body', {
179
176
  'native-scroll': isEnabledNativeScroll
@@ -88,6 +88,7 @@ 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;
91
92
  var containerWrapNode = containerWrapRef.current;
92
93
  var scrollableNode = scrollBarScrollableRef.current;
93
94
  var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
@@ -95,28 +96,12 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
95
96
  return;
96
97
  }
97
98
  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
- }
114
99
  var containerCenterPosition = containerWrapNode.offsetTop + offsetHeightCenter;
115
- var isMoreHalfClosed = touchEndY > containerCenterPosition;
100
+ var isMoreHalfClosed = ((_a = e.changedTouches[0]) === null || _a === void 0 ? void 0 : _a.clientY) > containerCenterPosition;
116
101
  setInitialTouchPosition(null);
117
102
  onChangeContainerWrapTransform(isMoreHalfClosed ? 'translateY(100%)' : 'none');
118
103
  onChangeTransitionStep(isMoreHalfClosed ? _Modal.MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP : _Modal.MODAL_TRANSITIONS_STEPS_ENUM.INITIAL_STEP);
119
- }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, initialTouchPosition, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
104
+ }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
120
105
  React.useEffect(function () {
121
106
  if (isSwipeDisabled) {
122
107
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "8.11.1",
3
+ "version": "8.12.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -50,7 +50,7 @@
50
50
  "@babel/preset-env": "^7.8.6",
51
51
  "@babel/preset-react": "^7.8.3",
52
52
  "@babel/preset-typescript": "^7.8.3",
53
- "@megafon/ui-icons": "^3.12.0",
53
+ "@megafon/ui-icons": "^3.12.1",
54
54
  "@svgr/core": "^2.4.1",
55
55
  "@testing-library/jest-dom": "^6.5.0",
56
56
  "@testing-library/react": "^16.0.1",
@@ -104,5 +104,5 @@
104
104
  "simplebar-react": "^3.2.5",
105
105
  "swiper": "^11.1.1"
106
106
  },
107
- "gitHead": "c748a0748d78a2872ab16a384d8e81b83fcd60db"
107
+ "gitHead": "8a69aba34853a115f6b8aba23641784eb6ffe1cf"
108
108
  }