@megafon/ui-core 6.0.0-beta.1 → 6.0.0-beta.2

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.
Files changed (160) hide show
  1. package/dist/es/components/Banner/Banner.d.ts +9 -4
  2. package/dist/es/components/Banner/Banner.js +61 -47
  3. package/dist/es/components/Banner/BannerDot.d.ts +0 -7
  4. package/dist/es/components/Banner/BannerDot.js +5 -12
  5. package/dist/es/components/Banner/slidesSettings.d.ts +7 -0
  6. package/dist/es/components/Banner/slidesSettings.js +10 -0
  7. package/dist/es/components/ContentView/ContentView.d.ts +1 -0
  8. package/dist/es/components/ContentView/ContentView.js +3 -3
  9. package/dist/es/components/ListData/ListData.d.ts +66 -0
  10. package/dist/es/components/ListData/ListData.js +160 -0
  11. package/dist/es/components/ListData/ListDataGroup.d.ts +46 -0
  12. package/dist/es/components/ListData/ListDataGroup.js +150 -0
  13. package/dist/es/components/ListData/components/ListDataSortable.d.ts +34 -0
  14. package/dist/es/components/ListData/components/ListDataSortable.js +81 -0
  15. package/dist/es/components/ListData/helpers.d.ts +6 -0
  16. package/dist/es/components/ListData/helpers.js +33 -0
  17. package/dist/es/components/Search/Search.d.ts +1 -0
  18. package/dist/es/components/Search/Search.js +3 -4
  19. package/dist/es/index.d.ts +4 -0
  20. package/dist/es/index.js +4 -0
  21. package/dist/lib/components/Banner/Banner.d.ts +9 -4
  22. package/dist/lib/components/Banner/Banner.js +61 -47
  23. package/dist/lib/components/Banner/BannerDot.d.ts +0 -7
  24. package/dist/lib/components/Banner/BannerDot.js +6 -13
  25. package/dist/lib/components/Banner/slidesSettings.d.ts +7 -0
  26. package/dist/lib/components/Banner/slidesSettings.js +17 -0
  27. package/dist/lib/components/ContentView/ContentView.d.ts +1 -0
  28. package/dist/lib/components/ContentView/ContentView.js +2 -2
  29. package/dist/lib/components/ListData/ListData.d.ts +66 -0
  30. package/dist/lib/components/ListData/ListData.js +169 -0
  31. package/dist/lib/components/ListData/ListDataGroup.d.ts +46 -0
  32. package/dist/lib/components/ListData/ListDataGroup.js +159 -0
  33. package/dist/lib/components/ListData/components/ListDataSortable.d.ts +34 -0
  34. package/dist/lib/components/ListData/components/ListDataSortable.js +90 -0
  35. package/dist/lib/components/ListData/helpers.d.ts +6 -0
  36. package/dist/lib/components/ListData/helpers.js +40 -0
  37. package/dist/lib/components/Search/Search.d.ts +1 -0
  38. package/dist/lib/components/Search/Search.js +3 -4
  39. package/dist/lib/index.d.ts +4 -0
  40. package/dist/lib/index.js +28 -0
  41. package/package.json +10 -10
  42. package/styles/base.scss +24 -32
  43. package/dist/es/components/Badges/CounterBadge/CounterBadge.css +0 -1
  44. package/dist/es/components/Badges/NotificationBadge/NotificationBadge.css +0 -1
  45. package/dist/es/components/Badges/PriceBadge/PriceBadge.css +0 -1
  46. package/dist/es/components/Badges/PromoBadge/PromoBadge.css +0 -1
  47. package/dist/es/components/Badges/TimerBadge/TimerBadge.css +0 -1
  48. package/dist/es/components/Banner/Banner.css +0 -1
  49. package/dist/es/components/Banner/BannerDot.css +0 -1
  50. package/dist/es/components/Button/Button.css +0 -1
  51. package/dist/es/components/Calendar/Calendar.css +0 -1
  52. package/dist/es/components/Calendar/components/_Day/Day.css +0 -1
  53. package/dist/es/components/Calendar/components/_Month/Month.css +0 -1
  54. package/dist/es/components/Caption/Caption.css +0 -1
  55. package/dist/es/components/Carousel/Carousel.css +0 -1
  56. package/dist/es/components/Checkbox/Checkbox.css +0 -1
  57. package/dist/es/components/Chips/Chip.css +0 -1
  58. package/dist/es/components/Chips/Chips.css +0 -1
  59. package/dist/es/components/Chips/components/ChipsDropdown.css +0 -1
  60. package/dist/es/components/ContentArea/ContentArea.css +0 -1
  61. package/dist/es/components/ContentView/ContentView.css +0 -1
  62. package/dist/es/components/Counter/Counter.css +0 -1
  63. package/dist/es/components/Grid/Grid.css +0 -1
  64. package/dist/es/components/Grid/GridColumn.css +0 -1
  65. package/dist/es/components/Header/Header.css +0 -1
  66. package/dist/es/components/List/List.css +0 -1
  67. package/dist/es/components/List/ListItem.css +0 -1
  68. package/dist/es/components/Logo/Logo.css +0 -1
  69. package/dist/es/components/Modal/Modal.css +0 -1
  70. package/dist/es/components/Modal/_ModalContent/ModalContent.css +0 -1
  71. package/dist/es/components/Modal/_ModalDesktop/ModalDesktop.css +0 -1
  72. package/dist/es/components/Modal/_ModalMobileBottom/ModalMobileBottom.css +0 -1
  73. package/dist/es/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.css +0 -1
  74. package/dist/es/components/NavArrow/NavArrow.css +0 -1
  75. package/dist/es/components/Notification/Notification.css +0 -1
  76. package/dist/es/components/Pagination/Pagination.css +0 -1
  77. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.css +0 -1
  78. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.css +0 -1
  79. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.css +0 -1
  80. package/dist/es/components/Paragraph/Paragraph.css +0 -1
  81. package/dist/es/components/Preloader/Preloader.css +0 -1
  82. package/dist/es/components/RadioButton/RadioButton.css +0 -1
  83. package/dist/es/components/Row/Row.css +0 -1
  84. package/dist/es/components/ScrollBar/ScrollBar.css +0 -1
  85. package/dist/es/components/Search/Search.css +0 -1
  86. package/dist/es/components/Select/Select.css +0 -1
  87. package/dist/es/components/Selector/Selector.css +0 -1
  88. package/dist/es/components/Sliders/Slider/Slider.css +0 -1
  89. package/dist/es/components/Sliders/SliderRange/SliderRange.css +0 -1
  90. package/dist/es/components/Sliders/SliderRatio/SliderRatio.css +0 -1
  91. package/dist/es/components/Sliders/components/SliderDisplayValue/SliderDisplayValue.css +0 -1
  92. package/dist/es/components/Sliders/components/SliderScale/SliderScale.css +0 -1
  93. package/dist/es/components/Snackbar/Snackbar.css +0 -1
  94. package/dist/es/components/Snackbar/SnackbarTimer/SnackbarTimer.css +0 -1
  95. package/dist/es/components/Switcher/Switcher.css +0 -1
  96. package/dist/es/components/Tabs/Tabs.css +0 -1
  97. package/dist/es/components/TextField/TextField.css +0 -1
  98. package/dist/es/components/TextLink/TextLink.css +0 -1
  99. package/dist/es/components/Tile/Tile.css +0 -1
  100. package/dist/es/components/Tooltip/Tooltip.css +0 -1
  101. package/dist/es/components/_Collapse/Collapse.css +0 -1
  102. package/dist/lib/components/Badges/CounterBadge/CounterBadge.css +0 -1
  103. package/dist/lib/components/Badges/NotificationBadge/NotificationBadge.css +0 -1
  104. package/dist/lib/components/Badges/PriceBadge/PriceBadge.css +0 -1
  105. package/dist/lib/components/Badges/PromoBadge/PromoBadge.css +0 -1
  106. package/dist/lib/components/Badges/TimerBadge/TimerBadge.css +0 -1
  107. package/dist/lib/components/Banner/Banner.css +0 -1
  108. package/dist/lib/components/Banner/BannerDot.css +0 -1
  109. package/dist/lib/components/Button/Button.css +0 -1
  110. package/dist/lib/components/Calendar/Calendar.css +0 -1
  111. package/dist/lib/components/Calendar/components/_Day/Day.css +0 -1
  112. package/dist/lib/components/Calendar/components/_Month/Month.css +0 -1
  113. package/dist/lib/components/Caption/Caption.css +0 -1
  114. package/dist/lib/components/Carousel/Carousel.css +0 -1
  115. package/dist/lib/components/Checkbox/Checkbox.css +0 -1
  116. package/dist/lib/components/Chips/Chip.css +0 -1
  117. package/dist/lib/components/Chips/Chips.css +0 -1
  118. package/dist/lib/components/Chips/components/ChipsDropdown.css +0 -1
  119. package/dist/lib/components/ContentArea/ContentArea.css +0 -1
  120. package/dist/lib/components/ContentView/ContentView.css +0 -1
  121. package/dist/lib/components/Counter/Counter.css +0 -1
  122. package/dist/lib/components/Grid/Grid.css +0 -1
  123. package/dist/lib/components/Grid/GridColumn.css +0 -1
  124. package/dist/lib/components/Header/Header.css +0 -1
  125. package/dist/lib/components/List/List.css +0 -1
  126. package/dist/lib/components/List/ListItem.css +0 -1
  127. package/dist/lib/components/Logo/Logo.css +0 -1
  128. package/dist/lib/components/Modal/Modal.css +0 -1
  129. package/dist/lib/components/Modal/_ModalContent/ModalContent.css +0 -1
  130. package/dist/lib/components/Modal/_ModalDesktop/ModalDesktop.css +0 -1
  131. package/dist/lib/components/Modal/_ModalMobileBottom/ModalMobileBottom.css +0 -1
  132. package/dist/lib/components/Modal/_ModalMobileFullScreen/ModalMobileFullScreen.css +0 -1
  133. package/dist/lib/components/NavArrow/NavArrow.css +0 -1
  134. package/dist/lib/components/Notification/Notification.css +0 -1
  135. package/dist/lib/components/Pagination/Pagination.css +0 -1
  136. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.css +0 -1
  137. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.css +0 -1
  138. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.css +0 -1
  139. package/dist/lib/components/Paragraph/Paragraph.css +0 -1
  140. package/dist/lib/components/Preloader/Preloader.css +0 -1
  141. package/dist/lib/components/RadioButton/RadioButton.css +0 -1
  142. package/dist/lib/components/Row/Row.css +0 -1
  143. package/dist/lib/components/ScrollBar/ScrollBar.css +0 -1
  144. package/dist/lib/components/Search/Search.css +0 -1
  145. package/dist/lib/components/Select/Select.css +0 -1
  146. package/dist/lib/components/Selector/Selector.css +0 -1
  147. package/dist/lib/components/Sliders/Slider/Slider.css +0 -1
  148. package/dist/lib/components/Sliders/SliderRange/SliderRange.css +0 -1
  149. package/dist/lib/components/Sliders/SliderRatio/SliderRatio.css +0 -1
  150. package/dist/lib/components/Sliders/components/SliderDisplayValue/SliderDisplayValue.css +0 -1
  151. package/dist/lib/components/Sliders/components/SliderScale/SliderScale.css +0 -1
  152. package/dist/lib/components/Snackbar/Snackbar.css +0 -1
  153. package/dist/lib/components/Snackbar/SnackbarTimer/SnackbarTimer.css +0 -1
  154. package/dist/lib/components/Switcher/Switcher.css +0 -1
  155. package/dist/lib/components/Tabs/Tabs.css +0 -1
  156. package/dist/lib/components/TextField/TextField.css +0 -1
  157. package/dist/lib/components/TextLink/TextLink.css +0 -1
  158. package/dist/lib/components/Tile/Tile.css +0 -1
  159. package/dist/lib/components/Tooltip/Tooltip.css +0 -1
  160. package/dist/lib/components/_Collapse/Collapse.css +0 -1
@@ -24,8 +24,6 @@ type NavThemeType = (typeof NavTheme)[keyof typeof NavTheme];
24
24
  export interface IBannerProps {
25
25
  /** Сss класс для внешнего контейнера */
26
26
  className?: string;
27
- /** Прокрутка с зацикливанием */
28
- loop?: boolean;
29
27
  /** Дополнительные классы для корневого и внутренних элементов */
30
28
  classes?: {
31
29
  swiper?: string;
@@ -35,6 +33,7 @@ export interface IBannerProps {
35
33
  arrowNext?: string;
36
34
  pagination?: string;
37
35
  dot?: string;
36
+ noSwiping?: string;
38
37
  };
39
38
  /** Дополнительные data атрибуты к внутренним элементам */
40
39
  dataAttrs?: {
@@ -52,18 +51,25 @@ export interface IBannerProps {
52
51
  autoPlay?: boolean;
53
52
  /** Задержка автоматической прокрутки */
54
53
  autoPlayDelay?: number;
54
+ /** Прокрутка с зацикливанием */
55
+ loop?: boolean;
55
56
  /** Пауза автоматической прокрутки при наведении курсора на компонент */
56
57
  pauseOnHover?: boolean;
57
58
  /** Фоновый цвет */
58
59
  backgroundColor?: BackgroundColorType;
59
60
  /** Радиус границы */
60
61
  radius?: RadiusType;
61
- /** Цветовая тема навигации */
62
+ /** Цветовая тема навигации (не используется) */
62
63
  navTheme?: NavThemeType;
63
64
  /** Цветовая тема стрелок */
64
65
  arrowTheme?: ArrowThemeType;
65
66
  /** Автоматическая высота слайдов */
66
67
  autoHeight?: boolean;
68
+ /** Не увеличивать время прокрутки при взаимодействии с баннером */
69
+ noIncreaseAutoplayDelay?: boolean;
70
+ /** Показать часть следующего слайда */
71
+ showNextSlide?: boolean;
72
+ children?: React.ReactNode;
67
73
  /** Ref на swiper */
68
74
  getSwiper?: (instance: SwiperCore) => void;
69
75
  /** Обработчик клика по стрелке "вперед" (должен быть обернут в useCallback) */
@@ -74,7 +80,6 @@ export interface IBannerProps {
74
80
  onDotClick?: (index: number) => void;
75
81
  /** Обработчик смены слайда (должен быть обернут в useCallback) */
76
82
  onChange?: (index: number) => void;
77
- children?: React.ReactNode;
78
83
  }
79
84
  declare const Banner: React.FC<IBannerProps>;
80
85
  export default Banner;
@@ -8,6 +8,7 @@ import { Autoplay } from 'swiper/modules';
8
8
  import { Swiper, SwiperSlide } from 'swiper/react';
9
9
  import NavArrow, { Theme as ArrowTheme } from "../NavArrow/NavArrow";
10
10
  import BannerDot from "./BannerDot";
11
+ import SLIDES_SETTINGS from "./slidesSettings";
11
12
  import "./Banner.css";
12
13
  export var BackgroundColor = {
13
14
  TRANSPARENT: 'transparent',
@@ -38,6 +39,7 @@ var Banner = function Banner(_ref) {
38
39
  var className = _ref.className,
39
40
  _ref$classes = _ref.classes,
40
41
  classes = _ref$classes === void 0 ? {} : _ref$classes,
42
+ dataAttrs = _ref.dataAttrs,
41
43
  _ref$withPaginationBo = _ref.withPaginationBottomOffset,
42
44
  withPaginationBottomOffset = _ref$withPaginationBo === void 0 ? false : _ref$withPaginationBo,
43
45
  _ref$autoPlay = _ref.autoPlay,
@@ -46,26 +48,27 @@ var Banner = function Banner(_ref) {
46
48
  autoPlayDelay = _ref$autoPlayDelay === void 0 ? 5000 : _ref$autoPlayDelay,
47
49
  _ref$loop = _ref.loop,
48
50
  loop = _ref$loop === void 0 ? false : _ref$loop,
49
- _ref$navTheme = _ref.navTheme,
50
- navTheme = _ref$navTheme === void 0 ? NavTheme.LIGHT : _ref$navTheme,
51
- _ref$arrowTheme = _ref.arrowTheme,
52
- arrowTheme = _ref$arrowTheme === void 0 ? ArrowTheme.DARK : _ref$arrowTheme,
51
+ _ref$pauseOnHover = _ref.pauseOnHover,
52
+ pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover,
53
53
  _ref$backgroundColor = _ref.backgroundColor,
54
54
  backgroundColor = _ref$backgroundColor === void 0 ? BackgroundColor.TRANSPARENT : _ref$backgroundColor,
55
55
  _ref$radius = _ref.radius,
56
56
  radius = _ref$radius === void 0 ? Radius.ROUNDED : _ref$radius,
57
+ _ref$arrowTheme = _ref.arrowTheme,
58
+ arrowTheme = _ref$arrowTheme === void 0 ? ArrowTheme.DARK : _ref$arrowTheme,
57
59
  _ref$autoHeight = _ref.autoHeight,
58
60
  autoHeight = _ref$autoHeight === void 0 ? false : _ref$autoHeight,
61
+ noIncreaseAutoplayDelay = _ref.noIncreaseAutoplayDelay,
62
+ showNextSlide = _ref.showNextSlide,
59
63
  _ref$children = _ref.children,
60
64
  children = _ref$children === void 0 ? [] : _ref$children,
61
65
  getSwiper = _ref.getSwiper,
62
66
  onNextClick = _ref.onNextClick,
63
67
  onPrevClick = _ref.onPrevClick,
64
68
  onDotClick = _ref.onDotClick,
65
- onChange = _ref.onChange,
66
- dataAttrs = _ref.dataAttrs,
67
- _ref$pauseOnHover = _ref.pauseOnHover,
68
- pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover;
69
+ onChange = _ref.onChange;
70
+ var isSingleSlide = React.Children.count(children) === 1;
71
+ var canAutoPlay = autoPlay && !isSingleSlide;
69
72
  var _React$useState = React.useState(false),
70
73
  _React$useState2 = _slicedToArray(_React$useState, 2),
71
74
  isTouch = _React$useState2[0],
@@ -82,7 +85,7 @@ var Banner = function Banner(_ref) {
82
85
  _React$useState8 = _slicedToArray(_React$useState7, 2),
83
86
  isEnd = _React$useState8[0],
84
87
  setEnd = _React$useState8[1];
85
- var _React$useState9 = React.useState(autoPlay),
88
+ var _React$useState9 = React.useState(canAutoPlay),
86
89
  _React$useState10 = _slicedToArray(_React$useState9, 2),
87
90
  isAutoPlaying = _React$useState10[0],
88
91
  setAutoPlaying = _React$useState10[1];
@@ -98,14 +101,13 @@ var Banner = function Banner(_ref) {
98
101
  _React$useState16 = _slicedToArray(_React$useState15, 2),
99
102
  isIncreasedDelay = _React$useState16[0],
100
103
  setIsIncreasedDelay = _React$useState16[1];
101
- var isSingleSlide = React.Children.count(children) === 1;
102
104
  var showDotTimer = loop ? isAutoPlaying : isAutoPlaying && !isEnd;
103
105
  var dotTimerDelay = delay / 1000;
104
106
  var rootRef = React.useRef(null);
105
107
  var increaseAutoplayDelay = React.useCallback(function (_ref2) {
106
108
  var params = _ref2.params,
107
109
  autoplay = _ref2.autoplay;
108
- if (_typeof(params.autoplay) !== 'object' || !autoPlay) {
110
+ if (_typeof(params.autoplay) !== 'object' || !canAutoPlay || noIncreaseAutoplayDelay) {
109
111
  return;
110
112
  }
111
113
  autoplay.stop();
@@ -114,7 +116,7 @@ var Banner = function Banner(_ref) {
114
116
  setDelay(autoPlayDelay * 3);
115
117
  setIsIncreasedDelay(true);
116
118
  autoplay.start();
117
- }, [autoPlay, autoPlayDelay]);
119
+ }, [canAutoPlay, autoPlayDelay, noIncreaseAutoplayDelay]);
118
120
  var handlePrevClick = React.useCallback(function () {
119
121
  if (!swiperInstance) {
120
122
  return;
@@ -172,7 +174,7 @@ var Banner = function Banner(_ref) {
172
174
  }, []);
173
175
  React.useEffect(function () {
174
176
  var rootElement = rootRef.current;
175
- if (!pauseOnHover || !autoPlay) {
177
+ if (!pauseOnHover || !canAutoPlay) {
176
178
  return;
177
179
  }
178
180
  rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseenter', function () {
@@ -183,36 +185,16 @@ var Banner = function Banner(_ref) {
183
185
  swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
184
186
  setAutoPlaying(true);
185
187
  });
186
- }, [autoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
187
- return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
188
- className: cn({
189
- 'nav-theme': navTheme,
190
- 'auto-height': autoHeight,
191
- 'background-color': backgroundColor,
192
- 'no-touch': !isTouch,
193
- radius: radius
194
- }, className),
195
- ref: rootRef
196
- }), /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
197
- className: cn('swiper', [classes.swiper]),
198
- loop: loop,
199
- autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
200
- onSwiper: handleSwiper,
201
- onReachBeginning: handleReachBeginning,
202
- onReachEnd: handleReachEnd,
203
- onFromEdge: handleFromEdge,
204
- onSlideChange: handleSlideChange,
205
- onTouchEnd: increaseAutoplayDelay,
206
- modules: [Autoplay],
207
- watchSlidesProgress: true
208
- }), React.Children.map(children, function (child, i) {
209
- return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
210
- className: cn('slide', [classes.slide]),
211
- key: i
212
- }), /*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.cloneElement(child, {
213
- hasBottomOffset: !isSingleSlide
214
- }));
215
- })), !isSingleSlide && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NavArrow, {
188
+ }, [canAutoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
189
+ React.useEffect(function () {
190
+ setAutoPlaying(canAutoPlay);
191
+ if (canAutoPlay) {
192
+ swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
193
+ return;
194
+ }
195
+ swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.stop();
196
+ }, [canAutoPlay, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
197
+ var renderNavArrows = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NavArrow, {
216
198
  className: cn('arrow', {
217
199
  prev: true,
218
200
  theme: arrowTheme
@@ -235,9 +217,9 @@ var Banner = function Banner(_ref) {
235
217
  onClick: handleNextClick,
236
218
  disabled: !loop && isEnd,
237
219
  theme: arrowTheme
238
- }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
220
+ }));
221
+ var renderPagination = /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
239
222
  className: cn('pagination', {
240
- theme: navTheme,
241
223
  'bottom-offset': withPaginationBottomOffset
242
224
  }, [classes.pagination])
243
225
  }), React.Children.map(children, function (_, i) {
@@ -251,9 +233,41 @@ var Banner = function Banner(_ref) {
251
233
  isActive: i === activeIndex,
252
234
  showTimer: showDotTimer,
253
235
  timerDelay: dotTimerDelay,
254
- theme: navTheme,
255
236
  onClick: handleDotClick
256
237
  });
257
- }))));
238
+ }));
239
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
240
+ className: cn({
241
+ 'auto-height': autoHeight,
242
+ 'background-color': backgroundColor,
243
+ 'no-touch': !isTouch,
244
+ radius: radius,
245
+ 'show-next-slide': showNextSlide
246
+ }, className),
247
+ ref: rootRef
248
+ }), /*#__PURE__*/React.createElement("div", {
249
+ className: cn('swiper-container')
250
+ }, /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
251
+ className: cn('swiper', [classes.swiper]),
252
+ loop: loop,
253
+ autoplay: canAutoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
254
+ watchSlidesProgress: true,
255
+ noSwipingClass: classes.noSwiping,
256
+ breakpoints: showNextSlide ? SLIDES_SETTINGS : undefined,
257
+ onSwiper: handleSwiper,
258
+ onReachBeginning: handleReachBeginning,
259
+ onReachEnd: handleReachEnd,
260
+ onFromEdge: handleFromEdge,
261
+ onSlideChange: handleSlideChange,
262
+ onTouchEnd: increaseAutoplayDelay,
263
+ modules: [Autoplay]
264
+ }), React.Children.map(children, function (child, i) {
265
+ return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
266
+ className: cn('slide', [classes.slide]),
267
+ key: i
268
+ }), /*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.cloneElement(child, {
269
+ className: cn('slide-content', [child === null || child === void 0 ? void 0 : child.props.className])
270
+ }));
271
+ })), !isSingleSlide && renderNavArrows), !isSingleSlide && renderPagination);
258
272
  };
259
273
  export default Banner;
@@ -1,18 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import './BannerDot.scss';
3
- export declare const BannerDotTheme: {
4
- readonly LIGHT: "light";
5
- readonly DARK: "dark";
6
- };
7
- type BannerDotThemeType = (typeof BannerDotTheme)[keyof typeof BannerDotTheme];
8
3
  export interface IBannerDotProps {
9
4
  className?: string;
10
5
  index: number;
11
6
  isActive: boolean;
12
7
  showTimer: boolean;
13
8
  timerDelay: number;
14
- /** Цветовая тема */
15
- theme?: BannerDotThemeType;
16
9
  dataAttrs?: {
17
10
  root?: Record<string, string>;
18
11
  svg?: Record<string, string>;
@@ -2,10 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import * as React from 'react';
3
3
  import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
4
4
  import "./BannerDot.css";
5
- export var BannerDotTheme = {
6
- LIGHT: 'light',
7
- DARK: 'dark'
8
- };
9
5
  var cn = cnCreate('mfui-banner-dot');
10
6
  var BannerDot = function BannerDot(_ref) {
11
7
  var className = _ref.className,
@@ -14,8 +10,6 @@ var BannerDot = function BannerDot(_ref) {
14
10
  isActive = _ref.isActive,
15
11
  showTimer = _ref.showTimer,
16
12
  timerDelay = _ref.timerDelay,
17
- _ref$theme = _ref.theme,
18
- theme = _ref$theme === void 0 ? BannerDotTheme.LIGHT : _ref$theme,
19
13
  onClick = _ref.onClick;
20
14
  var handleDotClick = React.useCallback(function () {
21
15
  onClick(index);
@@ -23,21 +17,20 @@ var BannerDot = function BannerDot(_ref) {
23
17
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
24
18
  className: cn({
25
19
  active: isActive,
26
- timer: showTimer,
27
- theme: theme
20
+ timer: showTimer
28
21
  }, className),
29
22
  onClick: handleDotClick
30
- }), showTimer && isActive && /*#__PURE__*/React.createElement("svg", _extends({
23
+ }), showTimer && isActive && /*#__PURE__*/React.createElement("svg", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.svg), {
31
24
  className: cn('timer'),
32
- viewBox: "0 0 300 100"
33
- }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.svg)), /*#__PURE__*/React.createElement("rect", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
25
+ viewBox: "0 0 250 100"
26
+ }), /*#__PURE__*/React.createElement("rect", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
34
27
  className: cn('timer-inner'),
35
28
  style: {
36
29
  animationDuration: "".concat(timerDelay, "s")
37
30
  },
38
31
  x: "0",
39
32
  y: "0",
40
- width: "300",
33
+ width: "250",
41
34
  height: "100",
42
35
  rx: "50",
43
36
  ry: "50"
@@ -0,0 +1,7 @@
1
+ declare const SLIDES_SETTINGS: {
2
+ [x: number]: {
3
+ slidesPerView: number;
4
+ spaceBetween: number;
5
+ };
6
+ };
7
+ export default SLIDES_SETTINGS;
@@ -0,0 +1,10 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { breakpoints } from '@megafon/ui-helpers';
3
+ var SLIDES_SETTINGS = _defineProperty(_defineProperty({}, breakpoints.MOBILE_SMALL_START, {
4
+ slidesPerView: 1,
5
+ spaceBetween: 16
6
+ }), breakpoints.MOBILE_BIG_START, {
7
+ slidesPerView: 1,
8
+ spaceBetween: 0
9
+ });
10
+ export default SLIDES_SETTINGS;
@@ -22,6 +22,7 @@ export interface IContentViewProps {
22
22
  title?: string;
23
23
  button?: string;
24
24
  link?: string;
25
+ bgImage?: string;
25
26
  };
26
27
  /** Заголовок */
27
28
  title: string;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import "core-js/modules/es.string.link.js";
3
3
  import * as React from 'react';
4
- import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
4
+ import { cnCreate, convert, filterDataAttrs, titleConvertConfig } from '@megafon/ui-helpers';
5
5
  import Button from "../Button/Button";
6
6
  import "./ContentView.css";
7
7
  var cn = cnCreate('mfui-content-view');
@@ -29,14 +29,14 @@ var ContentView = function ContentView(_ref) {
29
29
  }, !!type && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.bgImage), {
30
30
  className: cn('bg-image', {
31
31
  type: type
32
- })
32
+ }, [classes.bgImage])
33
33
  })), !!src && !type && /*#__PURE__*/React.createElement("img", {
34
34
  className: cn('image'),
35
35
  src: src,
36
36
  alt: alt
37
37
  }), /*#__PURE__*/React.createElement("div", {
38
38
  className: cn('title', [classes.title])
39
- }, title), !!children && /*#__PURE__*/React.createElement("div", {
39
+ }, convert(title, titleConvertConfig)), !!children && /*#__PURE__*/React.createElement("div", {
40
40
  className: cn('text')
41
41
  }, children)), showButtons && /*#__PURE__*/React.createElement("div", {
42
42
  className: cn('buttons')
@@ -0,0 +1,66 @@
1
+ import * as React from 'react';
2
+ import './ListData.scss';
3
+ type Target = '_self' | '_blank' | '_parent' | '_top';
4
+ export type TitlePropsType = {
5
+ /** Текст заголовка */
6
+ text: string;
7
+ /** Ссылка */
8
+ href: string;
9
+ /** Атрибут ссылки target */
10
+ target?: Target;
11
+ /** Атрибут ссылки rel */
12
+ rel?: string;
13
+ };
14
+ declare const ValueColors: {
15
+ readonly DEFAULT: "default";
16
+ readonly GREEN: "green";
17
+ };
18
+ export type ValueColorsType = (typeof ValueColors)[keyof typeof ValueColors];
19
+ declare const Actions: {
20
+ readonly DELETE: "delete";
21
+ readonly CONTROL: "control";
22
+ };
23
+ export type ActionsType = (typeof Actions)[keyof typeof Actions];
24
+ export interface IListDataProps {
25
+ /** Заголовок */
26
+ title: string | TitlePropsType;
27
+ /** Подзаголовок */
28
+ subTitle?: string;
29
+ /** Значение */
30
+ value?: string;
31
+ /** Цвет */
32
+ valueColor?: ValueColorsType;
33
+ /** Дополнительное значение */
34
+ subValue?: string;
35
+ /** Иконка */
36
+ icon?: JSX.Element;
37
+ /** Фоновая заливка у иконки */
38
+ isIconColored?: boolean;
39
+ /** Аватар */
40
+ avatar?: JSX.Element;
41
+ /** Отключение компонента */
42
+ disabled?: boolean;
43
+ /** Элемент дополнительного действия */
44
+ actionType?: ActionsType;
45
+ /** Обработчик дополнительного действия */
46
+ onAction?: (e: React.SyntheticEvent<EventTarget>) => void;
47
+ /** Обработчик клика */
48
+ onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
49
+ /** Дополнительный класс корневого элемента */
50
+ className?: string;
51
+ /** Дополнительные классы для внутренних элементов */
52
+ classes?: {
53
+ root?: string;
54
+ title?: string;
55
+ subtitle?: string;
56
+ };
57
+ /** Дополнительные data атрибуты к внутренним элементам */
58
+ dataAttrs?: {
59
+ root?: Record<string, string>;
60
+ actionIcon?: Record<string, string>;
61
+ };
62
+ /** Дочерние элементы: Button, Selector */
63
+ children?: React.ReactNode;
64
+ }
65
+ declare const ListData: React.FC<IListDataProps>;
66
+ export default ListData;
@@ -0,0 +1,160 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ import "core-js/modules/es.parse-int.js";
5
+ import * as React from 'react';
6
+ import { cnCreate, convert, filterDataAttrs, textConvertConfig } from '@megafon/ui-helpers';
7
+ import "./ListData.css";
8
+ var DeleteIcon = function DeleteIcon(props) {
9
+ return /*#__PURE__*/React.createElement("svg", _extends({
10
+ viewBox: "0 0 20 20"
11
+ }, props), /*#__PURE__*/React.createElement("path", {
12
+ d: "M16 4h-3.2c-.4-1.2-1.5-2-2.8-2s-2.4.8-2.8 2H4v4h1l1 10h8l1-10h1V4zM5 5h3v-.4C8.2 3.7 9.1 3 10 3s1.8.7 2 1.6V5h3v2H5V5zm8 12H7l-.9-9H14l-1 9z"
13
+ }));
14
+ };
15
+ var NothingIcon = function NothingIcon(props) {
16
+ return /*#__PURE__*/React.createElement("svg", _extends({
17
+ viewBox: "0 0 32 32"
18
+ }, props), /*#__PURE__*/React.createElement("circle", {
19
+ cx: 21,
20
+ cy: 16,
21
+ r: 1.5
22
+ }), /*#__PURE__*/React.createElement("circle", {
23
+ cx: 16,
24
+ cy: 16,
25
+ r: 1.5
26
+ }), /*#__PURE__*/React.createElement("circle", {
27
+ cx: 11,
28
+ cy: 16,
29
+ r: 1.5
30
+ }));
31
+ };
32
+ var LINE_COUNT = 2;
33
+ var ValueColors = {
34
+ DEFAULT: 'default',
35
+ GREEN: 'green'
36
+ };
37
+ var Actions = {
38
+ DELETE: 'delete',
39
+ CONTROL: 'control'
40
+ };
41
+ var cn = cnCreate('mfui-list-data');
42
+ var ListData = function ListData(_ref) {
43
+ var title = _ref.title,
44
+ subTitle = _ref.subTitle,
45
+ value = _ref.value,
46
+ valueColor = _ref.valueColor,
47
+ subValue = _ref.subValue,
48
+ icon = _ref.icon,
49
+ _ref$isIconColored = _ref.isIconColored,
50
+ isIconColored = _ref$isIconColored === void 0 ? false : _ref$isIconColored,
51
+ avatar = _ref.avatar,
52
+ _ref$disabled = _ref.disabled,
53
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
54
+ actionType = _ref.actionType,
55
+ onClick = _ref.onClick,
56
+ onAction = _ref.onAction,
57
+ className = _ref.className,
58
+ _ref$classes = _ref.classes,
59
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
60
+ dataAttrs = _ref.dataAttrs,
61
+ children = _ref.children;
62
+ var valueRef = React.useRef(null);
63
+ var _React$useState = React.useState('right'),
64
+ _React$useState2 = _slicedToArray(_React$useState, 2),
65
+ valueAlignment = _React$useState2[0],
66
+ setValueAlignment = _React$useState2[1];
67
+ var isActive = !!onClick && !(_typeof(title) === 'object' && (title === null || title === void 0 ? void 0 : title.href));
68
+ var showActionElement = !!actionType || !!children;
69
+ var handleClick = function handleClick(e) {
70
+ !disabled && (onClick === null || onClick === void 0 ? void 0 : onClick(e));
71
+ };
72
+ var handleAction = React.useCallback(function (e) {
73
+ e.stopPropagation();
74
+ !disabled && (onAction === null || onAction === void 0 ? void 0 : onAction(e));
75
+ }, [disabled, onAction]);
76
+ React.useEffect(function () {
77
+ if (!valueRef.current) {
78
+ return;
79
+ }
80
+ var lineHeight = parseInt(getComputedStyle(valueRef.current).lineHeight, 10);
81
+ var actualHeight = valueRef.current.offsetHeight;
82
+ var currentLineCount = actualHeight / lineHeight;
83
+ setValueAlignment(currentLineCount >= LINE_COUNT ? 'left' : 'right');
84
+ }, [value]);
85
+ var renderedTitle = /*#__PURE__*/React.createElement("div", {
86
+ className: cn('title', [classes.title])
87
+ }, typeof title === 'string' ? title : /*#__PURE__*/React.createElement("a", {
88
+ className: cn('title-link'),
89
+ href: title.href,
90
+ target: title === null || title === void 0 ? void 0 : title.target,
91
+ rel: title === null || title === void 0 ? void 0 : title.rel
92
+ }, title.text));
93
+ var renderIcon = function renderIcon() {
94
+ if (!icon && !avatar) {
95
+ return null;
96
+ }
97
+ return /*#__PURE__*/React.createElement("div", {
98
+ className: cn('icon-container', {
99
+ colored: isIconColored && !avatar
100
+ })
101
+ }, avatar || /*#__PURE__*/React.createElement("div", {
102
+ className: cn('icon')
103
+ }, icon));
104
+ };
105
+ var renderExtraContent = function renderExtraContent() {
106
+ if (children) {
107
+ return /*#__PURE__*/React.createElement("div", {
108
+ className: cn('children', {
109
+ 'event-none': !!onClick
110
+ })
111
+ }, children);
112
+ }
113
+ if (value) {
114
+ return /*#__PURE__*/React.createElement("div", {
115
+ className: cn('value-container')
116
+ }, /*#__PURE__*/React.createElement("div", {
117
+ className: cn('value', {
118
+ color: valueColor
119
+ }),
120
+ ref: valueRef,
121
+ style: {
122
+ textAlign: valueAlignment
123
+ }
124
+ }, convert(value, textConvertConfig)), !!subValue && /*#__PURE__*/React.createElement("div", {
125
+ className: cn('sub-value')
126
+ }, subValue));
127
+ }
128
+ if (actionType) {
129
+ var isDelete = actionType === Actions.DELETE;
130
+ var ActionIcon = isDelete ? DeleteIcon : NothingIcon;
131
+ return /*#__PURE__*/React.createElement("div", _extends({
132
+ className: cn('icon', {
133
+ small: isDelete
134
+ })
135
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.actionIcon), {
136
+ onClick: handleAction
137
+ }), /*#__PURE__*/React.createElement(ActionIcon, {
138
+ className: cn('action-icon', {
139
+ active: !disabled
140
+ })
141
+ }));
142
+ }
143
+ return null;
144
+ };
145
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
146
+ className: cn({
147
+ active: isActive,
148
+ disabled: disabled
149
+ }, [className, classes.root]),
150
+ onClick: handleClick
151
+ }), renderIcon(), /*#__PURE__*/React.createElement("div", {
152
+ className: cn('header', {
153
+ gap: showActionElement,
154
+ align: !!subTitle
155
+ })
156
+ }, renderedTitle, !!subTitle && /*#__PURE__*/React.createElement("div", {
157
+ className: cn('sub-title', [classes.subtitle])
158
+ }, subTitle)), renderExtraContent());
159
+ };
160
+ export default ListData;
@@ -0,0 +1,46 @@
1
+ import * as React from 'react';
2
+ import { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
3
+ import { ActivatorNodesType, GapSizesType } from './components/ListDataSortable';
4
+ import { IListDataProps } from './ListData';
5
+ import './ListDataGroup.scss';
6
+ export type ListItemPropsType = IListDataProps & {
7
+ id: string | number;
8
+ };
9
+ type DragOverlayPropsType = {
10
+ className?: string;
11
+ zIndex?: number;
12
+ };
13
+ export interface IListDataGroupProps {
14
+ /** Массив элементов */
15
+ items: ListItemPropsType[];
16
+ /** Активатор события перетаскивания */
17
+ activatorNode?: ActivatorNodesType;
18
+ /** Отступ между элементами */
19
+ gap?: GapSizesType;
20
+ /** Показать разделитель */
21
+ showDivider?: boolean;
22
+ /** Обработчик начала процесса перетаскивания */
23
+ onDragStart?: (event?: DragStartEvent) => void;
24
+ /** Обработчик окончания процесса перетаскивания */
25
+ onDragEnd?: (items: ListItemPropsType[], event?: DragEndEvent) => void;
26
+ /** Отключить перетаскивание */
27
+ disabled?: boolean;
28
+ /** Параметры DragOverlay элемента */
29
+ dragOverlayProps?: DragOverlayPropsType;
30
+ /** Дополнительный класс корневого элемента */
31
+ className?: string;
32
+ /** Дополнительные классы для внутренних элементов */
33
+ classes?: {
34
+ root?: string;
35
+ cell?: string;
36
+ control?: string;
37
+ };
38
+ /** Дополнительные data атрибуты к внутренним элементам */
39
+ dataAttrs?: {
40
+ root?: Record<string, string>;
41
+ cell?: Record<string, string>;
42
+ control?: Record<string, string>;
43
+ };
44
+ }
45
+ declare const ListDataGroup: React.FC<IListDataGroupProps>;
46
+ export default ListDataGroup;