@megafon/ui-core 6.9.1 → 6.10.0

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.
@@ -126,6 +126,32 @@
126
126
  justify-content: center;
127
127
  margin-top: 32px;
128
128
  }
129
+ .mfui-v6-banner__pagination_position_top-in {
130
+ position: absolute;
131
+ top: 16px;
132
+ left: 0;
133
+ width: 100%;
134
+ margin-top: 0;
135
+ padding: 0 24px;
136
+ }
137
+ @media screen and (min-width: 1280px) {
138
+ .mfui-v6-banner__pagination_position_top-in {
139
+ padding: 0 80px;
140
+ }
141
+ }
142
+ .mfui-v6-banner__pagination_type_flat {
143
+ gap: 4px;
144
+ }
145
+ @media screen and (min-width: 1280px) {
146
+ .mfui-v6-banner__pagination_type_flat {
147
+ gap: 10px;
148
+ }
149
+ }
150
+ .mfui-v6-banner__pagination_align_left {
151
+ -webkit-box-pack: start;
152
+ -ms-flex-pack: start;
153
+ justify-content: flex-start;
154
+ }
129
155
  .mfui-v6-banner__pagination_bottom-offset {
130
156
  position: absolute;
131
157
  bottom: 60px;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import SwiperCore from 'swiper';
3
3
  import { ThemeType as ArrowThemeType } from '../NavArrow/NavArrow';
4
+ import type { PaginationThemeType, PaginationType } from './BannerDot';
4
5
  import './Banner.less';
5
6
  export declare const BackgroundColor: {
6
7
  readonly TRANSPARENT: "transparent";
@@ -21,6 +22,11 @@ export declare const NavTheme: {
21
22
  readonly DARK: "dark";
22
23
  };
23
24
  declare type NavThemeType = typeof NavTheme[keyof typeof NavTheme];
25
+ export declare const PaginationPositionType: {
26
+ readonly BOTTOM_OUT: "bottom-out";
27
+ readonly TOP_IN: "top-in";
28
+ };
29
+ declare type PaginationPositionType = typeof PaginationPositionType[keyof typeof PaginationPositionType];
24
30
  export interface IBannerProps {
25
31
  /** Сss класс для внешнего контейнера */
26
32
  className?: string;
@@ -44,7 +50,17 @@ export interface IBannerProps {
44
50
  arrowNext?: Record<string, string>;
45
51
  pagination?: Record<string, string>;
46
52
  dot?: Record<string, string>;
53
+ dotSvg?: Record<string, string>;
54
+ dotInner?: Record<string, string>;
47
55
  };
56
+ /** Выравнивание блока пагинации */
57
+ paginationAlign?: 'center' | 'left';
58
+ /** Цветовая тема пагинации */
59
+ paginationTheme?: PaginationThemeType;
60
+ /** Тип кнопок пагинации */
61
+ paginationType?: PaginationType;
62
+ /** Расположение пагинации */
63
+ paginationPosition?: PaginationPositionType;
48
64
  /** Предполагается использование с наезжанием на баннер следующего за баннером элемента */
49
65
  withPaginationBottomOffset?: boolean;
50
66
  /** Автоматическая прокрутка */
@@ -9,7 +9,7 @@ import * as PropTypes from 'prop-types';
9
9
  import SwiperCore, { Autoplay } from 'swiper';
10
10
  import { Swiper, SwiperSlide } from 'swiper/react';
11
11
  import NavArrow, { Theme as ArrowTheme } from "../NavArrow/NavArrow";
12
- import BannerDot from "./BannerDot";
12
+ import BannerDot, { PaginationButtonType, PaginationTheme } from "./BannerDot";
13
13
  import SLIDES_SETTINGS from "./slidesSettings";
14
14
  import "./Banner.css";
15
15
  SwiperCore.use([Autoplay]);
@@ -29,6 +29,10 @@ export var NavTheme = {
29
29
  LIGHT: 'light',
30
30
  DARK: 'dark'
31
31
  };
32
+ export var PaginationPositionType = {
33
+ BOTTOM_OUT: 'bottom-out',
34
+ TOP_IN: 'top-in'
35
+ };
32
36
 
33
37
  var getAutoPlayConfig = function getAutoPlayConfig(delay) {
34
38
  return {
@@ -46,6 +50,10 @@ var Banner = function Banner(_ref) {
46
50
  _ref$classes = _ref.classes,
47
51
  classes = _ref$classes === void 0 ? {} : _ref$classes,
48
52
  dataAttrs = _ref.dataAttrs,
53
+ paginationAlign = _ref.paginationAlign,
54
+ paginationTheme = _ref.paginationTheme,
55
+ paginationType = _ref.paginationType,
56
+ paginationPosition = _ref.paginationPosition,
49
57
  _ref$withPaginationBo = _ref.withPaginationBottomOffset,
50
58
  withPaginationBottomOffset = _ref$withPaginationBo === void 0 ? false : _ref$withPaginationBo,
51
59
  _ref$autoPlay = _ref.autoPlay,
@@ -248,19 +256,26 @@ var Banner = function Banner(_ref) {
248
256
  }));
249
257
  var renderPagination = /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
250
258
  className: cn('pagination', {
259
+ type: paginationType,
260
+ align: paginationAlign,
261
+ position: paginationPosition,
251
262
  'bottom-offset': withPaginationBottomOffset
252
263
  }, [classes.pagination])
253
- }), React.Children.map(children, function (_, i) {
264
+ }), children && React.Children.map(children, function (_, i) {
254
265
  return /*#__PURE__*/React.createElement(BannerDot, {
255
266
  className: cn('dot', [classes.dot]),
256
267
  dataAttrs: {
257
- root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1))
268
+ root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1)),
269
+ svg: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dotSvg, i + 1)),
270
+ inner: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dotInner, i + 1))
258
271
  },
259
272
  key: i,
260
273
  index: i,
261
274
  isActive: i === activeIndex,
262
275
  showTimer: showDotTimer,
263
276
  timerDelay: dotTimerDelay,
277
+ type: paginationType,
278
+ theme: paginationTheme,
264
279
  onClick: handleDotClick
265
280
  });
266
281
  }));
@@ -318,9 +333,14 @@ Banner.propTypes = {
318
333
  arrowPrev: PropTypes.objectOf(PropTypes.string.isRequired),
319
334
  arrowNext: PropTypes.objectOf(PropTypes.string.isRequired),
320
335
  pagination: PropTypes.objectOf(PropTypes.string.isRequired),
321
- dot: PropTypes.objectOf(PropTypes.string.isRequired)
336
+ dot: PropTypes.objectOf(PropTypes.string.isRequired),
337
+ dotSvg: PropTypes.objectOf(PropTypes.string.isRequired),
338
+ dotInner: PropTypes.objectOf(PropTypes.string.isRequired)
322
339
  }),
323
- withPaginationBottomOffset: PropTypes.bool,
340
+ paginationAlign: PropTypes.oneOf(['center', 'left']),
341
+ paginationTheme: PropTypes.oneOf(Object.values(PaginationTheme)),
342
+ paginationType: PropTypes.oneOf(Object.values(PaginationButtonType)),
343
+ paginationPosition: PropTypes.oneOf(Object.values(PaginationPositionType)),
324
344
  autoPlay: PropTypes.bool,
325
345
  autoPlayDelay: PropTypes.number,
326
346
  loop: PropTypes.bool,
@@ -1,45 +1,82 @@
1
1
  .mfui-v6-banner-dot {
2
2
  position: relative;
3
- display: -webkit-box;
4
- display: -ms-flexbox;
5
- display: flex;
6
- -webkit-box-align: center;
7
- -ms-flex-align: center;
8
- align-items: center;
9
- -webkit-box-pack: center;
10
- -ms-flex-pack: center;
11
- justify-content: center;
12
3
  -webkit-box-sizing: border-box;
13
4
  box-sizing: border-box;
14
- margin: -2px;
15
- padding: 2px;
16
- cursor: pointer;
17
- }
18
- .mfui-v6-banner-dot:before {
19
- content: '';
20
- display: block;
21
5
  width: 8px;
22
6
  height: 8px;
23
7
  border-radius: 4px;
24
8
  background-color: var(--spbSky2);
9
+ cursor: pointer;
25
10
  }
26
11
  .mfui-v6-banner-dot_active {
27
- cursor: default;
28
- }
29
- .mfui-v6-banner-dot_active:before {
30
- width: 20px;
12
+ width: 24px;
31
13
  background-color: var(--brandGreen);
14
+ cursor: default;
15
+ -webkit-transition: background-color 0.2s linear;
16
+ transition: background-color 0.2s linear;
32
17
  }
33
18
  .mfui-v6-banner-dot_active .mfui-v6-banner-dot__timer-inner {
34
19
  fill: var(--brandGreen);
35
20
  }
36
- .mfui-v6-banner-dot_active.mfui-v6-banner-dot_timer:before {
21
+ .mfui-v6-banner-dot_active.mfui-v6-banner-dot_has-timer {
37
22
  background-color: var(--spbSky2);
38
23
  }
24
+ .mfui-v6-banner-dot_type_flat {
25
+ -webkit-box-flex: 1;
26
+ -ms-flex: 1 1 auto;
27
+ flex: 1 1 auto;
28
+ width: auto;
29
+ height: 2px;
30
+ border-radius: 24px;
31
+ }
32
+ .mfui-v6-banner-dot_type_flat .mfui-v6-banner-dot__timer {
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+ .mfui-v6-banner-dot_type_flat .mfui-v6-banner-dot__timer-inner {
37
+ width: 100%;
38
+ height: 100%;
39
+ -webkit-transform: scale(1);
40
+ transform: scale(1);
41
+ -webkit-animation: timer-reversed linear;
42
+ animation: timer-reversed linear;
43
+ }
44
+ .mfui-v6-banner-dot_theme_light {
45
+ background-color: var(--stcWhite50);
46
+ }
47
+ .mfui-v6-banner-dot_theme_light .mfui-v6-banner-dot__timer {
48
+ background-color: var(--stcWhite50);
49
+ }
50
+ .mfui-v6-banner-dot_theme_light .mfui-v6-banner-dot__timer-inner {
51
+ fill: var(--stcWhite);
52
+ }
53
+ .mfui-v6-banner-dot_theme_light.mfui-v6-banner-dot_active {
54
+ background-color: var(--stcWhite);
55
+ }
56
+ .mfui-v6-banner-dot_theme_light.mfui-v6-banner-dot_has-timer {
57
+ background-color: transparent;
58
+ }
59
+ .mfui-v6-banner-dot_theme_dark {
60
+ background-color: var(--stcBlack10);
61
+ }
62
+ .mfui-v6-banner-dot_theme_dark .mfui-v6-banner-dot__timer {
63
+ background-color: var(--stcBlack10);
64
+ }
65
+ .mfui-v6-banner-dot_theme_dark .mfui-v6-banner-dot__timer-inner {
66
+ fill: var(--stcBlack);
67
+ }
68
+ .mfui-v6-banner-dot_theme_dark.mfui-v6-banner-dot_active {
69
+ background-color: var(--stcBlack);
70
+ }
71
+ .mfui-v6-banner-dot_theme_dark.mfui-v6-banner-dot_has-timer {
72
+ background-color: transparent;
73
+ }
39
74
  .mfui-v6-banner-dot__timer {
40
75
  position: absolute;
76
+ top: 0;
77
+ left: 0;
41
78
  display: block;
42
- width: 20px;
79
+ width: 24px;
43
80
  height: 8px;
44
81
  border-radius: 4px;
45
82
  }
@@ -67,3 +104,19 @@
67
104
  width: 0;
68
105
  }
69
106
  }
107
+ @-webkit-keyframes timer-reversed {
108
+ 0% {
109
+ width: 0;
110
+ }
111
+ 100% {
112
+ width: 100%;
113
+ }
114
+ }
115
+ @keyframes timer-reversed {
116
+ 0% {
117
+ width: 0;
118
+ }
119
+ 100% {
120
+ width: 100%;
121
+ }
122
+ }
@@ -1,5 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import './BannerDot.less';
3
+ export declare const PaginationTheme: {
4
+ readonly DEFAULT: "default";
5
+ readonly LIGHT: "light";
6
+ readonly DARK: "dark";
7
+ };
8
+ export declare type PaginationThemeType = typeof PaginationTheme[keyof typeof PaginationTheme];
9
+ export declare const PaginationButtonType: {
10
+ readonly DOT: "dot";
11
+ readonly FLAT: "flat";
12
+ };
13
+ export declare type PaginationType = typeof PaginationButtonType[keyof typeof PaginationButtonType];
3
14
  export interface IBannerDotProps {
4
15
  className?: string;
5
16
  index: number;
@@ -11,6 +22,8 @@ export interface IBannerDotProps {
11
22
  svg?: Record<string, string>;
12
23
  inner?: Record<string, string>;
13
24
  };
25
+ type?: PaginationType;
26
+ theme?: PaginationThemeType;
14
27
  onClick: (index: number) => void;
15
28
  }
16
29
  declare const BannerDot: React.FC<IBannerDotProps>;
@@ -1,8 +1,27 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import "core-js/modules/es.object.values.js";
2
3
  import * as React from 'react';
3
4
  import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
4
5
  import * as PropTypes from 'prop-types';
5
6
  import "./BannerDot.css";
7
+ var DOT_VIEW_BOX = '0 0 250 100';
8
+ var DOT_RECT_PROPS = {
9
+ x: '0',
10
+ y: '0',
11
+ width: '250',
12
+ height: '100',
13
+ rx: '50',
14
+ ry: '50'
15
+ };
16
+ export var PaginationTheme = {
17
+ DEFAULT: 'default',
18
+ LIGHT: 'light',
19
+ DARK: 'dark'
20
+ };
21
+ export var PaginationButtonType = {
22
+ DOT: 'dot',
23
+ FLAT: 'flat'
24
+ };
6
25
  var cn = cnCreate('mfui-v6-banner-dot');
7
26
 
8
27
  var BannerDot = function BannerDot(_ref) {
@@ -12,30 +31,32 @@ var BannerDot = function BannerDot(_ref) {
12
31
  isActive = _ref.isActive,
13
32
  showTimer = _ref.showTimer,
14
33
  timerDelay = _ref.timerDelay,
34
+ _ref$type = _ref.type,
35
+ type = _ref$type === void 0 ? PaginationButtonType.DOT : _ref$type,
36
+ theme = _ref.theme,
15
37
  onClick = _ref.onClick;
16
38
  var handleDotClick = React.useCallback(function () {
17
39
  onClick(index);
18
40
  }, [onClick, index]);
41
+ var viewBox = type === PaginationButtonType.DOT ? DOT_VIEW_BOX : undefined;
42
+ var rectProps = type === PaginationButtonType.DOT ? DOT_RECT_PROPS : {};
43
+ var hasTimer = showTimer && isActive;
19
44
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
20
45
  className: cn({
21
46
  active: isActive,
22
- timer: showTimer
47
+ type: type,
48
+ theme: theme,
49
+ 'has-timer': hasTimer
23
50
  }, className),
24
51
  onClick: handleDotClick
25
- }), showTimer && isActive && /*#__PURE__*/React.createElement("svg", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.svg), {
52
+ }), hasTimer && /*#__PURE__*/React.createElement("svg", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.svg), {
26
53
  className: cn('timer'),
27
- viewBox: "0 0 250 100"
28
- }), /*#__PURE__*/React.createElement("rect", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
54
+ viewBox: viewBox
55
+ }), /*#__PURE__*/React.createElement("rect", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), rectProps, {
29
56
  className: cn('timer-inner'),
30
57
  style: {
31
58
  animationDuration: "".concat(timerDelay, "s")
32
- },
33
- x: "0",
34
- y: "0",
35
- width: "250",
36
- height: "100",
37
- rx: "50",
38
- ry: "50"
59
+ }
39
60
  }))));
40
61
  };
41
62
 
@@ -50,6 +71,8 @@ BannerDot.propTypes = {
50
71
  isActive: PropTypes.bool.isRequired,
51
72
  showTimer: PropTypes.bool.isRequired,
52
73
  timerDelay: PropTypes.number.isRequired,
74
+ type: PropTypes.oneOf(Object.values(PaginationButtonType)),
75
+ theme: PropTypes.oneOf(Object.values(PaginationTheme)),
53
76
  onClick: PropTypes.func.isRequired
54
77
  };
55
78
  export default BannerDot;
@@ -126,6 +126,32 @@
126
126
  justify-content: center;
127
127
  margin-top: 32px;
128
128
  }
129
+ .mfui-v6-banner__pagination_position_top-in {
130
+ position: absolute;
131
+ top: 16px;
132
+ left: 0;
133
+ width: 100%;
134
+ margin-top: 0;
135
+ padding: 0 24px;
136
+ }
137
+ @media screen and (min-width: 1280px) {
138
+ .mfui-v6-banner__pagination_position_top-in {
139
+ padding: 0 80px;
140
+ }
141
+ }
142
+ .mfui-v6-banner__pagination_type_flat {
143
+ gap: 4px;
144
+ }
145
+ @media screen and (min-width: 1280px) {
146
+ .mfui-v6-banner__pagination_type_flat {
147
+ gap: 10px;
148
+ }
149
+ }
150
+ .mfui-v6-banner__pagination_align_left {
151
+ -webkit-box-pack: start;
152
+ -ms-flex-pack: start;
153
+ justify-content: flex-start;
154
+ }
129
155
  .mfui-v6-banner__pagination_bottom-offset {
130
156
  position: absolute;
131
157
  bottom: 60px;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import SwiperCore from 'swiper';
3
3
  import { ThemeType as ArrowThemeType } from '../NavArrow/NavArrow';
4
+ import type { PaginationThemeType, PaginationType } from './BannerDot';
4
5
  import './Banner.less';
5
6
  export declare const BackgroundColor: {
6
7
  readonly TRANSPARENT: "transparent";
@@ -21,6 +22,11 @@ export declare const NavTheme: {
21
22
  readonly DARK: "dark";
22
23
  };
23
24
  declare type NavThemeType = typeof NavTheme[keyof typeof NavTheme];
25
+ export declare const PaginationPositionType: {
26
+ readonly BOTTOM_OUT: "bottom-out";
27
+ readonly TOP_IN: "top-in";
28
+ };
29
+ declare type PaginationPositionType = typeof PaginationPositionType[keyof typeof PaginationPositionType];
24
30
  export interface IBannerProps {
25
31
  /** Сss класс для внешнего контейнера */
26
32
  className?: string;
@@ -44,7 +50,17 @@ export interface IBannerProps {
44
50
  arrowNext?: Record<string, string>;
45
51
  pagination?: Record<string, string>;
46
52
  dot?: Record<string, string>;
53
+ dotSvg?: Record<string, string>;
54
+ dotInner?: Record<string, string>;
47
55
  };
56
+ /** Выравнивание блока пагинации */
57
+ paginationAlign?: 'center' | 'left';
58
+ /** Цветовая тема пагинации */
59
+ paginationTheme?: PaginationThemeType;
60
+ /** Тип кнопок пагинации */
61
+ paginationType?: PaginationType;
62
+ /** Расположение пагинации */
63
+ paginationPosition?: PaginationPositionType;
48
64
  /** Предполагается использование с наезжанием на баннер следующего за баннером элемента */
49
65
  withPaginationBottomOffset?: boolean;
50
66
  /** Автоматическая прокрутка */
@@ -5,7 +5,7 @@ function _typeof3(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "funct
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.NavTheme = exports.Radius = exports.BackgroundColor = void 0;
8
+ exports["default"] = exports.PaginationPositionType = exports.NavTheme = exports.Radius = exports.BackgroundColor = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
@@ -29,7 +29,7 @@ var _react2 = require("swiper/react");
29
29
 
30
30
  var _NavArrow = _interopRequireWildcard(require("../NavArrow/NavArrow"));
31
31
 
32
- var _BannerDot = _interopRequireDefault(require("./BannerDot"));
32
+ var _BannerDot = _interopRequireWildcard(require("./BannerDot"));
33
33
 
34
34
  var _slidesSettings = _interopRequireDefault(require("./slidesSettings"));
35
35
 
@@ -60,6 +60,11 @@ var NavTheme = {
60
60
  DARK: 'dark'
61
61
  };
62
62
  exports.NavTheme = NavTheme;
63
+ var PaginationPositionType = {
64
+ BOTTOM_OUT: 'bottom-out',
65
+ TOP_IN: 'top-in'
66
+ };
67
+ exports.PaginationPositionType = PaginationPositionType;
63
68
 
64
69
  var getAutoPlayConfig = function getAutoPlayConfig(delay) {
65
70
  return {
@@ -77,6 +82,10 @@ var Banner = function Banner(_ref) {
77
82
  _ref$classes = _ref.classes,
78
83
  classes = _ref$classes === void 0 ? {} : _ref$classes,
79
84
  dataAttrs = _ref.dataAttrs,
85
+ paginationAlign = _ref.paginationAlign,
86
+ paginationTheme = _ref.paginationTheme,
87
+ paginationType = _ref.paginationType,
88
+ paginationPosition = _ref.paginationPosition,
80
89
  _ref$withPaginationBo = _ref.withPaginationBottomOffset,
81
90
  withPaginationBottomOffset = _ref$withPaginationBo === void 0 ? false : _ref$withPaginationBo,
82
91
  _ref$autoPlay = _ref.autoPlay,
@@ -279,19 +288,26 @@ var Banner = function Banner(_ref) {
279
288
  }));
280
289
  var renderPagination = /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
281
290
  className: cn('pagination', {
291
+ type: paginationType,
292
+ align: paginationAlign,
293
+ position: paginationPosition,
282
294
  'bottom-offset': withPaginationBottomOffset
283
295
  }, [classes.pagination])
284
- }), React.Children.map(children, function (_, i) {
296
+ }), children && React.Children.map(children, function (_, i) {
285
297
  return /*#__PURE__*/React.createElement(_BannerDot["default"], {
286
298
  className: cn('dot', [classes.dot]),
287
299
  dataAttrs: {
288
- root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1))
300
+ root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1)),
301
+ svg: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dotSvg, i + 1)),
302
+ inner: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dotInner, i + 1))
289
303
  },
290
304
  key: i,
291
305
  index: i,
292
306
  isActive: i === activeIndex,
293
307
  showTimer: showDotTimer,
294
308
  timerDelay: dotTimerDelay,
309
+ type: paginationType,
310
+ theme: paginationTheme,
295
311
  onClick: handleDotClick
296
312
  });
297
313
  }));
@@ -349,9 +365,14 @@ Banner.propTypes = {
349
365
  arrowPrev: PropTypes.objectOf(PropTypes.string.isRequired),
350
366
  arrowNext: PropTypes.objectOf(PropTypes.string.isRequired),
351
367
  pagination: PropTypes.objectOf(PropTypes.string.isRequired),
352
- dot: PropTypes.objectOf(PropTypes.string.isRequired)
368
+ dot: PropTypes.objectOf(PropTypes.string.isRequired),
369
+ dotSvg: PropTypes.objectOf(PropTypes.string.isRequired),
370
+ dotInner: PropTypes.objectOf(PropTypes.string.isRequired)
353
371
  }),
354
- withPaginationBottomOffset: PropTypes.bool,
372
+ paginationAlign: PropTypes.oneOf(['center', 'left']),
373
+ paginationTheme: PropTypes.oneOf(Object.values(_BannerDot.PaginationTheme)),
374
+ paginationType: PropTypes.oneOf(Object.values(_BannerDot.PaginationButtonType)),
375
+ paginationPosition: PropTypes.oneOf(Object.values(PaginationPositionType)),
355
376
  autoPlay: PropTypes.bool,
356
377
  autoPlayDelay: PropTypes.number,
357
378
  loop: PropTypes.bool,
@@ -1,45 +1,82 @@
1
1
  .mfui-v6-banner-dot {
2
2
  position: relative;
3
- display: -webkit-box;
4
- display: -ms-flexbox;
5
- display: flex;
6
- -webkit-box-align: center;
7
- -ms-flex-align: center;
8
- align-items: center;
9
- -webkit-box-pack: center;
10
- -ms-flex-pack: center;
11
- justify-content: center;
12
3
  -webkit-box-sizing: border-box;
13
4
  box-sizing: border-box;
14
- margin: -2px;
15
- padding: 2px;
16
- cursor: pointer;
17
- }
18
- .mfui-v6-banner-dot:before {
19
- content: '';
20
- display: block;
21
5
  width: 8px;
22
6
  height: 8px;
23
7
  border-radius: 4px;
24
8
  background-color: var(--spbSky2);
9
+ cursor: pointer;
25
10
  }
26
11
  .mfui-v6-banner-dot_active {
27
- cursor: default;
28
- }
29
- .mfui-v6-banner-dot_active:before {
30
- width: 20px;
12
+ width: 24px;
31
13
  background-color: var(--brandGreen);
14
+ cursor: default;
15
+ -webkit-transition: background-color 0.2s linear;
16
+ transition: background-color 0.2s linear;
32
17
  }
33
18
  .mfui-v6-banner-dot_active .mfui-v6-banner-dot__timer-inner {
34
19
  fill: var(--brandGreen);
35
20
  }
36
- .mfui-v6-banner-dot_active.mfui-v6-banner-dot_timer:before {
21
+ .mfui-v6-banner-dot_active.mfui-v6-banner-dot_has-timer {
37
22
  background-color: var(--spbSky2);
38
23
  }
24
+ .mfui-v6-banner-dot_type_flat {
25
+ -webkit-box-flex: 1;
26
+ -ms-flex: 1 1 auto;
27
+ flex: 1 1 auto;
28
+ width: auto;
29
+ height: 2px;
30
+ border-radius: 24px;
31
+ }
32
+ .mfui-v6-banner-dot_type_flat .mfui-v6-banner-dot__timer {
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+ .mfui-v6-banner-dot_type_flat .mfui-v6-banner-dot__timer-inner {
37
+ width: 100%;
38
+ height: 100%;
39
+ -webkit-transform: scale(1);
40
+ transform: scale(1);
41
+ -webkit-animation: timer-reversed linear;
42
+ animation: timer-reversed linear;
43
+ }
44
+ .mfui-v6-banner-dot_theme_light {
45
+ background-color: var(--stcWhite50);
46
+ }
47
+ .mfui-v6-banner-dot_theme_light .mfui-v6-banner-dot__timer {
48
+ background-color: var(--stcWhite50);
49
+ }
50
+ .mfui-v6-banner-dot_theme_light .mfui-v6-banner-dot__timer-inner {
51
+ fill: var(--stcWhite);
52
+ }
53
+ .mfui-v6-banner-dot_theme_light.mfui-v6-banner-dot_active {
54
+ background-color: var(--stcWhite);
55
+ }
56
+ .mfui-v6-banner-dot_theme_light.mfui-v6-banner-dot_has-timer {
57
+ background-color: transparent;
58
+ }
59
+ .mfui-v6-banner-dot_theme_dark {
60
+ background-color: var(--stcBlack10);
61
+ }
62
+ .mfui-v6-banner-dot_theme_dark .mfui-v6-banner-dot__timer {
63
+ background-color: var(--stcBlack10);
64
+ }
65
+ .mfui-v6-banner-dot_theme_dark .mfui-v6-banner-dot__timer-inner {
66
+ fill: var(--stcBlack);
67
+ }
68
+ .mfui-v6-banner-dot_theme_dark.mfui-v6-banner-dot_active {
69
+ background-color: var(--stcBlack);
70
+ }
71
+ .mfui-v6-banner-dot_theme_dark.mfui-v6-banner-dot_has-timer {
72
+ background-color: transparent;
73
+ }
39
74
  .mfui-v6-banner-dot__timer {
40
75
  position: absolute;
76
+ top: 0;
77
+ left: 0;
41
78
  display: block;
42
- width: 20px;
79
+ width: 24px;
43
80
  height: 8px;
44
81
  border-radius: 4px;
45
82
  }
@@ -67,3 +104,19 @@
67
104
  width: 0;
68
105
  }
69
106
  }
107
+ @-webkit-keyframes timer-reversed {
108
+ 0% {
109
+ width: 0;
110
+ }
111
+ 100% {
112
+ width: 100%;
113
+ }
114
+ }
115
+ @keyframes timer-reversed {
116
+ 0% {
117
+ width: 0;
118
+ }
119
+ 100% {
120
+ width: 100%;
121
+ }
122
+ }
@@ -1,5 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import './BannerDot.less';
3
+ export declare const PaginationTheme: {
4
+ readonly DEFAULT: "default";
5
+ readonly LIGHT: "light";
6
+ readonly DARK: "dark";
7
+ };
8
+ export declare type PaginationThemeType = typeof PaginationTheme[keyof typeof PaginationTheme];
9
+ export declare const PaginationButtonType: {
10
+ readonly DOT: "dot";
11
+ readonly FLAT: "flat";
12
+ };
13
+ export declare type PaginationType = typeof PaginationButtonType[keyof typeof PaginationButtonType];
3
14
  export interface IBannerDotProps {
4
15
  className?: string;
5
16
  index: number;
@@ -11,6 +22,8 @@ export interface IBannerDotProps {
11
22
  svg?: Record<string, string>;
12
23
  inner?: Record<string, string>;
13
24
  };
25
+ type?: PaginationType;
26
+ theme?: PaginationThemeType;
14
27
  onClick: (index: number) => void;
15
28
  }
16
29
  declare const BannerDot: React.FC<IBannerDotProps>;
@@ -5,10 +5,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = void 0;
8
+ exports["default"] = exports.PaginationButtonType = exports.PaginationTheme = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
+ require("core-js/modules/es.object.values.js");
13
+
12
14
  var React = _interopRequireWildcard(require("react"));
13
15
 
14
16
  var _uiHelpers = require("@megafon/ui-helpers");
@@ -21,6 +23,26 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
23
 
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
25
 
26
+ var DOT_VIEW_BOX = '0 0 250 100';
27
+ var DOT_RECT_PROPS = {
28
+ x: '0',
29
+ y: '0',
30
+ width: '250',
31
+ height: '100',
32
+ rx: '50',
33
+ ry: '50'
34
+ };
35
+ var PaginationTheme = {
36
+ DEFAULT: 'default',
37
+ LIGHT: 'light',
38
+ DARK: 'dark'
39
+ };
40
+ exports.PaginationTheme = PaginationTheme;
41
+ var PaginationButtonType = {
42
+ DOT: 'dot',
43
+ FLAT: 'flat'
44
+ };
45
+ exports.PaginationButtonType = PaginationButtonType;
24
46
  var cn = (0, _uiHelpers.cnCreate)('mfui-v6-banner-dot');
25
47
 
26
48
  var BannerDot = function BannerDot(_ref) {
@@ -30,30 +52,32 @@ var BannerDot = function BannerDot(_ref) {
30
52
  isActive = _ref.isActive,
31
53
  showTimer = _ref.showTimer,
32
54
  timerDelay = _ref.timerDelay,
55
+ _ref$type = _ref.type,
56
+ type = _ref$type === void 0 ? PaginationButtonType.DOT : _ref$type,
57
+ theme = _ref.theme,
33
58
  onClick = _ref.onClick;
34
59
  var handleDotClick = React.useCallback(function () {
35
60
  onClick(index);
36
61
  }, [onClick, index]);
62
+ var viewBox = type === PaginationButtonType.DOT ? DOT_VIEW_BOX : undefined;
63
+ var rectProps = type === PaginationButtonType.DOT ? DOT_RECT_PROPS : {};
64
+ var hasTimer = showTimer && isActive;
37
65
  return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
38
66
  className: cn({
39
67
  active: isActive,
40
- timer: showTimer
68
+ type: type,
69
+ theme: theme,
70
+ 'has-timer': hasTimer
41
71
  }, className),
42
72
  onClick: handleDotClick
43
- }), showTimer && isActive && /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.svg), {
73
+ }), hasTimer && /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.svg), {
44
74
  className: cn('timer'),
45
- viewBox: "0 0 250 100"
46
- }), /*#__PURE__*/React.createElement("rect", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
75
+ viewBox: viewBox
76
+ }), /*#__PURE__*/React.createElement("rect", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), rectProps, {
47
77
  className: cn('timer-inner'),
48
78
  style: {
49
79
  animationDuration: "".concat(timerDelay, "s")
50
- },
51
- x: "0",
52
- y: "0",
53
- width: "250",
54
- height: "100",
55
- rx: "50",
56
- ry: "50"
80
+ }
57
81
  }))));
58
82
  };
59
83
 
@@ -68,6 +92,8 @@ BannerDot.propTypes = {
68
92
  isActive: PropTypes.bool.isRequired,
69
93
  showTimer: PropTypes.bool.isRequired,
70
94
  timerDelay: PropTypes.number.isRequired,
95
+ type: PropTypes.oneOf(Object.values(PaginationButtonType)),
96
+ theme: PropTypes.oneOf(Object.values(PaginationTheme)),
71
97
  onClick: PropTypes.func.isRequired
72
98
  };
73
99
  var _default = BannerDot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "6.9.1",
3
+ "version": "6.10.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -99,5 +99,5 @@
99
99
  "react-popper": "^2.2.3",
100
100
  "swiper": "^6.5.6"
101
101
  },
102
- "gitHead": "7dd1739619a676bfce199986dfc728c92e5610e4"
102
+ "gitHead": "ac551b2c79b8181de0b934289413d3abbd4addb2"
103
103
  }