@megafon/ui-shared 9.0.0-alpha.6 → 9.0.0-alpha.8

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 (39) hide show
  1. package/dist/es/components/BlogBox/BlogBox.d.ts +3 -0
  2. package/dist/es/components/BlogBox/BlogBox.js +8 -3
  3. package/dist/es/components/BlogBox/components/BlogBoxTile.d.ts +5 -1
  4. package/dist/es/components/BlogBox/components/BlogBoxTile.js +3 -2
  5. package/dist/es/components/DarkGradientCards/DarkGradientCards.d.ts +5 -0
  6. package/dist/es/components/DarkGradientCards/DarkGradientCards.js +9 -4
  7. package/dist/es/components/DarkGradientCards/components/DarkGradientCard.d.ts +1 -0
  8. package/dist/es/components/DarkGradientCards/components/DarkGradientCard.js +1 -1
  9. package/dist/es/components/NotificationBox/NotificationBox.d.ts +1 -1
  10. package/dist/es/components/NotificationBox/NotificationBox.js +1 -4
  11. package/dist/es/components/PromoCards/PromoCards.d.ts +3 -0
  12. package/dist/es/components/PromoCards/PromoCards.js +6 -1
  13. package/dist/es/components/PromoCards/components/PromoCard/PromoCard.d.ts +2 -0
  14. package/dist/es/components/PromoCards/components/PromoCard/PromoCard.js +5 -1
  15. package/dist/es/components/SidePictureCards/SidePictureCards.d.ts +5 -0
  16. package/dist/es/components/SidePictureCards/SidePictureCards.js +5 -2
  17. package/dist/es/components/SidePictureCards/components/SidePictureCard.d.ts +2 -0
  18. package/dist/es/components/SidePictureCards/components/SidePictureCard.js +8 -3
  19. package/dist/es/components/SidePictureCards/types.d.ts +3 -1
  20. package/dist/lib/components/BlogBox/BlogBox.d.ts +3 -0
  21. package/dist/lib/components/BlogBox/BlogBox.js +8 -3
  22. package/dist/lib/components/BlogBox/components/BlogBoxTile.d.ts +5 -1
  23. package/dist/lib/components/BlogBox/components/BlogBoxTile.js +3 -2
  24. package/dist/lib/components/DarkGradientCards/DarkGradientCards.d.ts +5 -0
  25. package/dist/lib/components/DarkGradientCards/DarkGradientCards.js +9 -4
  26. package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.d.ts +1 -0
  27. package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.js +1 -1
  28. package/dist/lib/components/NotificationBox/NotificationBox.d.ts +1 -1
  29. package/dist/lib/components/NotificationBox/NotificationBox.js +1 -5
  30. package/dist/lib/components/PromoCards/PromoCards.d.ts +3 -0
  31. package/dist/lib/components/PromoCards/PromoCards.js +6 -1
  32. package/dist/lib/components/PromoCards/components/PromoCard/PromoCard.d.ts +2 -0
  33. package/dist/lib/components/PromoCards/components/PromoCard/PromoCard.js +5 -1
  34. package/dist/lib/components/SidePictureCards/SidePictureCards.d.ts +5 -0
  35. package/dist/lib/components/SidePictureCards/SidePictureCards.js +5 -2
  36. package/dist/lib/components/SidePictureCards/components/SidePictureCard.d.ts +2 -0
  37. package/dist/lib/components/SidePictureCards/components/SidePictureCard.js +8 -3
  38. package/dist/lib/components/SidePictureCards/types.d.ts +3 -1
  39. package/package.json +4 -4
@@ -14,6 +14,7 @@ export interface IBlogBox {
14
14
  classes?: {
15
15
  root?: string;
16
16
  item?: string;
17
+ itemTitle?: string;
17
18
  button?: string;
18
19
  };
19
20
  /** Дополнительные data атрибуты к внутренним элементам */
@@ -23,6 +24,8 @@ export interface IBlogBox {
23
24
  item?: Record<string, string>;
24
25
  button?: Record<string, string>;
25
26
  };
27
+ /** Ссылка на корневой элемент */
28
+ rootRef?: React.Ref<HTMLDivElement>;
26
29
  }
27
30
  declare const BlogBox: React.FC<IBlogBox>;
28
31
  export default BlogBox;
@@ -17,7 +17,8 @@ var BlogBox = function BlogBox(_ref) {
17
17
  hasAlignLeft = _ref$hasAlignLeft === void 0 ? false : _ref$hasAlignLeft,
18
18
  className = _ref.className,
19
19
  classes = _ref.classes,
20
- dataAttrs = _ref.dataAttrs;
20
+ dataAttrs = _ref.dataAttrs,
21
+ rootRef = _ref.rootRef;
21
22
  var _useResolutions = useResolutions(),
22
23
  isDesktop = _useResolutions.isDesktop;
23
24
  var visibleItems = items.slice(0, maxItemsCount);
@@ -36,7 +37,8 @@ var BlogBox = function BlogBox(_ref) {
36
37
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
37
38
  className: cn({
38
39
  'align-left': isAlignLeft
39
- }, [className, classes === null || classes === void 0 ? void 0 : classes.root])
40
+ }, [className, classes === null || classes === void 0 ? void 0 : classes.root]),
41
+ ref: rootRef
40
42
  }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.list), {
41
43
  className: cn('list', {
42
44
  row: isRow,
@@ -50,7 +52,10 @@ var BlogBox = function BlogBox(_ref) {
50
52
  }, [classes === null || classes === void 0 ? void 0 : classes.item]),
51
53
  key: "".concat(item.title, "_").concat(i)
52
54
  }), /*#__PURE__*/React.createElement(BlogBoxTile, _extends({}, item, {
53
- view: view
55
+ view: view,
56
+ classes: {
57
+ title: classes === null || classes === void 0 ? void 0 : classes.itemTitle
58
+ }
54
59
  })));
55
60
  })), (button === null || button === void 0 ? void 0 : button.title) && /*#__PURE__*/React.createElement("div", {
56
61
  className: cn('button-wrapper')
@@ -4,6 +4,10 @@ import './BlogBoxTile.scss';
4
4
  type TileSettingsType = {
5
5
  view: TileViewType;
6
6
  };
7
- export type BlogBoxTileType = TileDataType & TileSettingsType;
7
+ export type BlogBoxTileType = TileDataType & TileSettingsType & {
8
+ classes?: {
9
+ title?: string;
10
+ };
11
+ };
8
12
  declare const BlogBoxTile: React.FC<BlogBoxTileType>;
9
13
  export default BlogBoxTile;
@@ -16,7 +16,8 @@ var BlogBoxTile = function BlogBoxTile(_ref) {
16
16
  srcThumbnail = _ref$image.srcThumbnail,
17
17
  _ref$image$alt = _ref$image.alt,
18
18
  alt = _ref$image$alt === void 0 ? 'image' : _ref$image$alt,
19
- view = _ref.view;
19
+ view = _ref.view,
20
+ classes = _ref.classes;
20
21
  var _useResolutions = useResolutions(),
21
22
  isMobile = _useResolutions.isMobile;
22
23
  var isViewThumbnail = view === 'thumbnail';
@@ -54,7 +55,7 @@ var BlogBoxTile = function BlogBoxTile(_ref) {
54
55
  }, /*#__PURE__*/React.createElement("div", {
55
56
  className: cn('date')
56
57
  }, date), /*#__PURE__*/React.createElement("div", {
57
- className: cn('title')
58
+ className: cn('title', [classes === null || classes === void 0 ? void 0 : classes.title])
58
59
  }, title)));
59
60
  };
60
61
  export default BlogBoxTile;
@@ -16,6 +16,7 @@ export interface IDarkGradientCards {
16
16
  classes?: {
17
17
  root?: string;
18
18
  item?: string;
19
+ itemTitle?: string;
19
20
  };
20
21
  /** Дополнительные data атрибуты к внутренним элементам */
21
22
  dataAttrs?: {
@@ -23,6 +24,10 @@ export interface IDarkGradientCards {
23
24
  carousel?: Record<string, string>;
24
25
  item?: Record<string, string>;
25
26
  };
27
+ /** Обработчик смены слайда карусели */
28
+ onCarouselChange?: CarouselProps['onChange'];
29
+ /** Ссылка на корневой элемент */
30
+ rootRef?: React.Ref<HTMLDivElement>;
26
31
  }
27
32
  declare const DarkGradientCards: React.FC<IDarkGradientCards>;
28
33
  export default DarkGradientCards;
@@ -23,7 +23,9 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
23
23
  className = _ref.className,
24
24
  _ref$classes = _ref.classes,
25
25
  classes = _ref$classes === void 0 ? {} : _ref$classes,
26
- dataAttrs = _ref.dataAttrs;
26
+ dataAttrs = _ref.dataAttrs,
27
+ onCarouselChange = _ref.onCarouselChange,
28
+ rootRef = _ref.rootRef;
27
29
  var _useResolutions = useResolutions(),
28
30
  isDesktopWide = _useResolutions.isDesktopWide;
29
31
  var isCarouselActive = items.length > MIN_ITEMS_COUNT || items.length === MIN_ITEMS_COUNT && !isDesktopWide;
@@ -33,7 +35,8 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
33
35
  size: i === 0 ? 'big' : 'small',
34
36
  className: cn('card'),
35
37
  classes: {
36
- root: classes.item
38
+ root: classes.item,
39
+ title: classes.itemTitle
37
40
  },
38
41
  dataAttrs: {
39
42
  root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1))
@@ -44,7 +47,8 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
44
47
  return null;
45
48
  }
46
49
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
47
- className: cn([className, classes.root])
50
+ className: cn([className, classes.root]),
51
+ ref: rootRef
48
52
  }), isCarouselActive ? /*#__PURE__*/React.createElement(Carousel, {
49
53
  dataAttrs: {
50
54
  root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.carousel))
@@ -53,7 +57,8 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
53
57
  navTheme: carouselNavTheme,
54
58
  threshold: CAROUSEL_THRESHOLD,
55
59
  gradient: true,
56
- gradientColor: carouselGradientColor
60
+ gradientColor: carouselGradientColor,
61
+ onChange: onCarouselChange
57
62
  }, cards) : /*#__PURE__*/React.createElement("div", {
58
63
  className: cn('cards')
59
64
  }, cards));
@@ -6,6 +6,7 @@ export type DarkGradientCardType = ItemType & {
6
6
  className?: string;
7
7
  classes?: {
8
8
  root?: string;
9
+ title?: string;
9
10
  };
10
11
  dataAttrs?: {
11
12
  root?: Record<string, string>;
@@ -38,7 +38,7 @@ var DarkGradientCard = function DarkGradientCard(_ref) {
38
38
  }), /*#__PURE__*/React.createElement("div", {
39
39
  className: cn('inner')
40
40
  }, /*#__PURE__*/React.createElement("div", {
41
- className: cn('title')
41
+ className: cn('title', [classes.title])
42
42
  }, convert(title, {})), subtitle && /*#__PURE__*/React.createElement("div", {
43
43
  className: cn('subtitle')
44
44
  }, convert(subtitle, {})), !!moreText && /*#__PURE__*/React.createElement("div", {
@@ -7,7 +7,7 @@ export declare const Align: {
7
7
  };
8
8
  type AlignType = (typeof Align)[keyof typeof Align];
9
9
  type NotificationProps = React.ComponentProps<typeof Notification>;
10
- type NotificationBoxProps = Omit<NotificationProps, 'isColored'> & {
10
+ type NotificationBoxProps = NotificationProps & {
11
11
  /** Горизонтальное выравнивание */
12
12
  align?: AlignType;
13
13
  };
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import "core-js/modules/es.symbol.js";
3
2
  import "core-js/modules/es.array.index-of.js";
4
3
  var __rest = this && this.__rest || function (s, e) {
@@ -28,8 +27,6 @@ var NotificationBox = function NotificationBox(_a) {
28
27
  })
29
28
  }, /*#__PURE__*/React.createElement("div", {
30
29
  className: cn('notification')
31
- }, /*#__PURE__*/React.createElement(Notification, _extends({}, restProps, {
32
- isColored: false
33
- }))));
30
+ }, /*#__PURE__*/React.createElement(Notification, restProps)));
34
31
  };
35
32
  export default NotificationBox;
@@ -15,12 +15,15 @@ export interface IPromoCards extends IPromoCardSettings {
15
15
  classes?: {
16
16
  root?: string;
17
17
  card?: string;
18
+ cardTitle?: string;
18
19
  };
19
20
  /** Дополнительные data атрибуты к внутренним элементам */
20
21
  dataAttrs?: {
21
22
  root?: Record<string, string>;
22
23
  card?: Record<string, string>;
23
24
  };
25
+ /** Обработчик смены слайда карусели */
26
+ onCarouselChange?: CarouselProps['onChange'];
24
27
  /** Ссылка на элемент */
25
28
  rootRef?: React.Ref<HTMLDivElement>;
26
29
  /** Дочерние элементы. Минимальное количество 2 элемента */
@@ -26,6 +26,7 @@ var PromoCards = function PromoCards(_ref) {
26
26
  dataAttrs = _ref.dataAttrs,
27
27
  className = _ref.className,
28
28
  classes = _ref.classes,
29
+ onCarouselChange = _ref.onCarouselChange,
29
30
  rootRef = _ref.rootRef,
30
31
  children = _ref.children;
31
32
  var itemsLength = (items === null || items === void 0 ? void 0 : items.length) || 0;
@@ -36,6 +37,9 @@ var PromoCards = function PromoCards(_ref) {
36
37
  var renderItems = (items || []).map(function (item, i) {
37
38
  return /*#__PURE__*/React.createElement(PromoCard, _extends({}, item, {
38
39
  className: classes === null || classes === void 0 ? void 0 : classes.card,
40
+ classes: {
41
+ title: classes === null || classes === void 0 ? void 0 : classes.cardTitle
42
+ },
39
43
  dataAttrs: {
40
44
  root: filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.card, i + 1)
41
45
  },
@@ -50,7 +54,8 @@ var PromoCards = function PromoCards(_ref) {
50
54
  slidesSettings: slidesSettings,
51
55
  navTheme: carouselNavTheme,
52
56
  gradient: true,
53
- gradientColor: carouselGradientColor
57
+ gradientColor: carouselGradientColor,
58
+ onChange: onCarouselChange
54
59
  }, childrenLength ? children : renderItems));
55
60
  };
56
61
  export default PromoCards;
@@ -7,6 +7,7 @@ export interface IPromoCard extends IPromoCardData, IPromoCardSettings {
7
7
  /** Дополнительные css классы для корневого элемента */
8
8
  classes?: {
9
9
  root?: string;
10
+ title?: string;
10
11
  };
11
12
  /** Дополнительные data атрибуты к корневому и внутренним элементам */
12
13
  dataAttrs?: {
@@ -14,6 +15,7 @@ export interface IPromoCard extends IPromoCardData, IPromoCardSettings {
14
15
  image?: Record<string, string>;
15
16
  badge?: Record<string, string>;
16
17
  logo?: Record<string, string>;
18
+ title?: Record<string, string>;
17
19
  subtitle?: Record<string, string>;
18
20
  list?: Record<string, string>;
19
21
  adTitle?: Record<string, string>;
@@ -149,7 +149,11 @@ var PromoCard = function PromoCard(_ref2) {
149
149
  src: logo.src,
150
150
  alt: logo.alt || ''
151
151
  })), /*#__PURE__*/React.createElement(Header, {
152
- as: "h3"
152
+ as: "h3",
153
+ className: classes === null || classes === void 0 ? void 0 : classes.title,
154
+ dataAttrs: {
155
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
156
+ }
153
157
  }, convert(title, {})), !!subtitle && /*#__PURE__*/React.createElement("div", {
154
158
  className: cn('subtitle')
155
159
  }, /*#__PURE__*/React.createElement(Paragraph, {
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { Carousel } from '@megafon/ui-core';
2
3
  import { BackgroundType, CardDataType } from './types';
4
+ type CarouselProps = React.ComponentProps<typeof Carousel>;
3
5
  export interface ISidePictureCards {
4
6
  /** Карточки. Минимальное количество 2 карточки */
5
7
  items: CardDataType[];
@@ -13,12 +15,15 @@ export interface ISidePictureCards {
13
15
  classes?: {
14
16
  root?: string;
15
17
  item?: string;
18
+ itemTitle?: string;
16
19
  };
17
20
  /** Дополнительные data атрибуты к внутренним элементам */
18
21
  dataAttrs?: {
19
22
  root?: Record<string, string>;
20
23
  item?: Record<string, string>;
21
24
  };
25
+ /** Обработчик смены слайда карусели */
26
+ onCarouselChange?: CarouselProps['onChange'];
22
27
  /** Ссылка на корневой элемент */
23
28
  rootRef?: React.Ref<HTMLDivElement>;
24
29
  }
@@ -25,6 +25,7 @@ var SidePictureCards = function SidePictureCards(_ref) {
25
25
  _ref$classes = _ref.classes,
26
26
  classes = _ref$classes === void 0 ? {} : _ref$classes,
27
27
  dataAttrs = _ref.dataAttrs,
28
+ onCarouselChange = _ref.onCarouselChange,
28
29
  rootRef = _ref.rootRef;
29
30
  if (items.length < MIN_ITEMS_COUNT) {
30
31
  return null;
@@ -34,7 +35,8 @@ var SidePictureCards = function SidePictureCards(_ref) {
34
35
  background: background,
35
36
  key: "".concat(item === null || item === void 0 ? void 0 : item.title, "_").concat(index),
36
37
  classes: {
37
- root: classes.item
38
+ root: classes.item,
39
+ title: classes.itemTitle
38
40
  },
39
41
  dataAttrs: {
40
42
  root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, index + 1))
@@ -44,7 +46,8 @@ var SidePictureCards = function SidePictureCards(_ref) {
44
46
  var renderContent = function renderContent() {
45
47
  if (hasCarousel) {
46
48
  return /*#__PURE__*/React.createElement(Carousel, {
47
- slidesSettings: slidesSettings
49
+ slidesSettings: slidesSettings,
50
+ onChange: onCarouselChange
48
51
  }, items.map(renderItem));
49
52
  }
50
53
  return /*#__PURE__*/React.createElement(Grid, {
@@ -5,10 +5,12 @@ export type SidePictureCardType = CardDataType & {
5
5
  background: BackgroundType;
6
6
  classes?: {
7
7
  root?: string;
8
+ title?: string;
8
9
  button?: string;
9
10
  };
10
11
  dataAttrs?: {
11
12
  root?: Record<string, string>;
13
+ title?: Record<string, string>;
12
14
  button?: Record<string, string>;
13
15
  };
14
16
  };
@@ -26,7 +26,8 @@ var SidePictureCard = function SidePictureCard(_ref) {
26
26
  buttonTitle = _ref2.title,
27
27
  buttonHref = _ref2.href,
28
28
  buttonTarget = _ref2.target,
29
- buttonRel = _ref2.rel;
29
+ buttonRel = _ref2.rel,
30
+ onButtonClick = _ref2.onClick;
30
31
  var isLink = !!href && !buttonHref;
31
32
  var ElementType = isLink ? 'a' : 'div';
32
33
  var currentRel = setRelAttribute(rel, target);
@@ -63,7 +64,10 @@ var SidePictureCard = function SidePictureCard(_ref) {
63
64
  }), /*#__PURE__*/React.createElement("div", {
64
65
  className: cn('content')
65
66
  }, !!title && /*#__PURE__*/React.createElement(Header, {
66
- className: cn('title'),
67
+ className: cn('title', [classes === null || classes === void 0 ? void 0 : classes.title]),
68
+ dataAttrs: {
69
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
70
+ },
67
71
  as: "h3"
68
72
  }, convert(title, {})), /*#__PURE__*/React.createElement("div", {
69
73
  className: cn('items')
@@ -74,7 +78,8 @@ var SidePictureCard = function SidePictureCard(_ref) {
74
78
  },
75
79
  href: buttonHref,
76
80
  target: buttonTarget,
77
- rel: currentButtonRel
81
+ rel: currentButtonRel,
82
+ onClick: onButtonClick
78
83
  }, buttonTitle)), /*#__PURE__*/React.createElement("picture", {
79
84
  className: cn('picture')
80
85
  }, /*#__PURE__*/React.createElement("source", {
@@ -4,11 +4,13 @@ type ButtonType = {
4
4
  /** Название */
5
5
  title: string;
6
6
  /** Ссылка */
7
- href: string;
7
+ href?: string;
8
8
  /** Атрибут ссылки target */
9
9
  target?: TargetType;
10
10
  /** Атрибут ссылки rel */
11
11
  rel?: string;
12
+ /** Обработчик клика */
13
+ onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
12
14
  };
13
15
  type ImageType = {
14
16
  /** Изображение на разрешении экрана 0-1279 */
@@ -14,6 +14,7 @@ export interface IBlogBox {
14
14
  classes?: {
15
15
  root?: string;
16
16
  item?: string;
17
+ itemTitle?: string;
17
18
  button?: string;
18
19
  };
19
20
  /** Дополнительные data атрибуты к внутренним элементам */
@@ -23,6 +24,8 @@ export interface IBlogBox {
23
24
  item?: Record<string, string>;
24
25
  button?: Record<string, string>;
25
26
  };
27
+ /** Ссылка на корневой элемент */
28
+ rootRef?: React.Ref<HTMLDivElement>;
26
29
  }
27
30
  declare const BlogBox: React.FC<IBlogBox>;
28
31
  export default BlogBox;
@@ -26,7 +26,8 @@ var BlogBox = function BlogBox(_ref) {
26
26
  hasAlignLeft = _ref$hasAlignLeft === void 0 ? false : _ref$hasAlignLeft,
27
27
  className = _ref.className,
28
28
  classes = _ref.classes,
29
- dataAttrs = _ref.dataAttrs;
29
+ dataAttrs = _ref.dataAttrs,
30
+ rootRef = _ref.rootRef;
30
31
  var _useResolutions = (0, _useResolutions2["default"])(),
31
32
  isDesktop = _useResolutions.isDesktop;
32
33
  var visibleItems = items.slice(0, maxItemsCount);
@@ -45,7 +46,8 @@ var BlogBox = function BlogBox(_ref) {
45
46
  return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
46
47
  className: cn({
47
48
  'align-left': isAlignLeft
48
- }, [className, classes === null || classes === void 0 ? void 0 : classes.root])
49
+ }, [className, classes === null || classes === void 0 ? void 0 : classes.root]),
50
+ ref: rootRef
49
51
  }), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.list), {
50
52
  className: cn('list', {
51
53
  row: isRow,
@@ -59,7 +61,10 @@ var BlogBox = function BlogBox(_ref) {
59
61
  }, [classes === null || classes === void 0 ? void 0 : classes.item]),
60
62
  key: "".concat(item.title, "_").concat(i)
61
63
  }), /*#__PURE__*/React.createElement(_BlogBoxTile["default"], (0, _extends2["default"])({}, item, {
62
- view: view
64
+ view: view,
65
+ classes: {
66
+ title: classes === null || classes === void 0 ? void 0 : classes.itemTitle
67
+ }
63
68
  })));
64
69
  })), (button === null || button === void 0 ? void 0 : button.title) && /*#__PURE__*/React.createElement("div", {
65
70
  className: cn('button-wrapper')
@@ -4,6 +4,10 @@ import './BlogBoxTile.scss';
4
4
  type TileSettingsType = {
5
5
  view: TileViewType;
6
6
  };
7
- export type BlogBoxTileType = TileDataType & TileSettingsType;
7
+ export type BlogBoxTileType = TileDataType & TileSettingsType & {
8
+ classes?: {
9
+ title?: string;
10
+ };
11
+ };
8
12
  declare const BlogBoxTile: React.FC<BlogBoxTileType>;
9
13
  export default BlogBoxTile;
@@ -25,7 +25,8 @@ var BlogBoxTile = function BlogBoxTile(_ref) {
25
25
  srcThumbnail = _ref$image.srcThumbnail,
26
26
  _ref$image$alt = _ref$image.alt,
27
27
  alt = _ref$image$alt === void 0 ? 'image' : _ref$image$alt,
28
- view = _ref.view;
28
+ view = _ref.view,
29
+ classes = _ref.classes;
29
30
  var _useResolutions = (0, _useResolutions2["default"])(),
30
31
  isMobile = _useResolutions.isMobile;
31
32
  var isViewThumbnail = view === 'thumbnail';
@@ -63,7 +64,7 @@ var BlogBoxTile = function BlogBoxTile(_ref) {
63
64
  }, /*#__PURE__*/React.createElement("div", {
64
65
  className: cn('date')
65
66
  }, date), /*#__PURE__*/React.createElement("div", {
66
- className: cn('title')
67
+ className: cn('title', [classes === null || classes === void 0 ? void 0 : classes.title])
67
68
  }, title)));
68
69
  };
69
70
  var _default = exports["default"] = BlogBoxTile;
@@ -16,6 +16,7 @@ export interface IDarkGradientCards {
16
16
  classes?: {
17
17
  root?: string;
18
18
  item?: string;
19
+ itemTitle?: string;
19
20
  };
20
21
  /** Дополнительные data атрибуты к внутренним элементам */
21
22
  dataAttrs?: {
@@ -23,6 +24,10 @@ export interface IDarkGradientCards {
23
24
  carousel?: Record<string, string>;
24
25
  item?: Record<string, string>;
25
26
  };
27
+ /** Обработчик смены слайда карусели */
28
+ onCarouselChange?: CarouselProps['onChange'];
29
+ /** Ссылка на корневой элемент */
30
+ rootRef?: React.Ref<HTMLDivElement>;
26
31
  }
27
32
  declare const DarkGradientCards: React.FC<IDarkGradientCards>;
28
33
  export default DarkGradientCards;
@@ -32,7 +32,9 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
32
32
  className = _ref.className,
33
33
  _ref$classes = _ref.classes,
34
34
  classes = _ref$classes === void 0 ? {} : _ref$classes,
35
- dataAttrs = _ref.dataAttrs;
35
+ dataAttrs = _ref.dataAttrs,
36
+ onCarouselChange = _ref.onCarouselChange,
37
+ rootRef = _ref.rootRef;
36
38
  var _useResolutions = (0, _useResolutions2["default"])(),
37
39
  isDesktopWide = _useResolutions.isDesktopWide;
38
40
  var isCarouselActive = items.length > MIN_ITEMS_COUNT || items.length === MIN_ITEMS_COUNT && !isDesktopWide;
@@ -42,7 +44,8 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
42
44
  size: i === 0 ? 'big' : 'small',
43
45
  className: cn('card'),
44
46
  classes: {
45
- root: classes.item
47
+ root: classes.item,
48
+ title: classes.itemTitle
46
49
  },
47
50
  dataAttrs: {
48
51
  root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1))
@@ -53,7 +56,8 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
53
56
  return null;
54
57
  }
55
58
  return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
56
- className: cn([className, classes.root])
59
+ className: cn([className, classes.root]),
60
+ ref: rootRef
57
61
  }), isCarouselActive ? /*#__PURE__*/React.createElement(_uiCore.Carousel, {
58
62
  dataAttrs: {
59
63
  root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.carousel))
@@ -62,7 +66,8 @@ var DarkGradientCards = function DarkGradientCards(_ref) {
62
66
  navTheme: carouselNavTheme,
63
67
  threshold: CAROUSEL_THRESHOLD,
64
68
  gradient: true,
65
- gradientColor: carouselGradientColor
69
+ gradientColor: carouselGradientColor,
70
+ onChange: onCarouselChange
66
71
  }, cards) : /*#__PURE__*/React.createElement("div", {
67
72
  className: cn('cards')
68
73
  }, cards));
@@ -6,6 +6,7 @@ export type DarkGradientCardType = ItemType & {
6
6
  className?: string;
7
7
  classes?: {
8
8
  root?: string;
9
+ title?: string;
9
10
  };
10
11
  dataAttrs?: {
11
12
  root?: Record<string, string>;
@@ -47,7 +47,7 @@ var DarkGradientCard = function DarkGradientCard(_ref) {
47
47
  }), /*#__PURE__*/React.createElement("div", {
48
48
  className: cn('inner')
49
49
  }, /*#__PURE__*/React.createElement("div", {
50
- className: cn('title')
50
+ className: cn('title', [classes.title])
51
51
  }, (0, _uiHelpers.convert)(title, {})), subtitle && /*#__PURE__*/React.createElement("div", {
52
52
  className: cn('subtitle')
53
53
  }, (0, _uiHelpers.convert)(subtitle, {})), !!moreText && /*#__PURE__*/React.createElement("div", {
@@ -7,7 +7,7 @@ export declare const Align: {
7
7
  };
8
8
  type AlignType = (typeof Align)[keyof typeof Align];
9
9
  type NotificationProps = React.ComponentProps<typeof Notification>;
10
- type NotificationBoxProps = Omit<NotificationProps, 'isColored'> & {
10
+ type NotificationBoxProps = NotificationProps & {
11
11
  /** Горизонтальное выравнивание */
12
12
  align?: AlignType;
13
13
  };
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = exports.Align = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
8
  require("core-js/modules/es.symbol.js");
10
9
  require("core-js/modules/es.array.index-of.js");
11
10
  var React = _interopRequireWildcard(require("react"));
@@ -13,7 +12,6 @@ var _uiCore = require("@megafon/ui-core");
13
12
  var _uiHelpers = require("@megafon/ui-helpers");
14
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
16
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
15
  var __rest = void 0 && (void 0).__rest || function (s, e) {
18
16
  var t = {};
19
17
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -37,8 +35,6 @@ var NotificationBox = function NotificationBox(_a) {
37
35
  })
38
36
  }, /*#__PURE__*/React.createElement("div", {
39
37
  className: cn('notification')
40
- }, /*#__PURE__*/React.createElement(_uiCore.Notification, (0, _extends2["default"])({}, restProps, {
41
- isColored: false
42
- }))));
38
+ }, /*#__PURE__*/React.createElement(_uiCore.Notification, restProps)));
43
39
  };
44
40
  var _default = exports["default"] = NotificationBox;
@@ -15,12 +15,15 @@ export interface IPromoCards extends IPromoCardSettings {
15
15
  classes?: {
16
16
  root?: string;
17
17
  card?: string;
18
+ cardTitle?: string;
18
19
  };
19
20
  /** Дополнительные data атрибуты к внутренним элементам */
20
21
  dataAttrs?: {
21
22
  root?: Record<string, string>;
22
23
  card?: Record<string, string>;
23
24
  };
25
+ /** Обработчик смены слайда карусели */
26
+ onCarouselChange?: CarouselProps['onChange'];
24
27
  /** Ссылка на элемент */
25
28
  rootRef?: React.Ref<HTMLDivElement>;
26
29
  /** Дочерние элементы. Минимальное количество 2 элемента */
@@ -36,6 +36,7 @@ var PromoCards = function PromoCards(_ref) {
36
36
  dataAttrs = _ref.dataAttrs,
37
37
  className = _ref.className,
38
38
  classes = _ref.classes,
39
+ onCarouselChange = _ref.onCarouselChange,
39
40
  rootRef = _ref.rootRef,
40
41
  children = _ref.children;
41
42
  var itemsLength = (items === null || items === void 0 ? void 0 : items.length) || 0;
@@ -46,6 +47,9 @@ var PromoCards = function PromoCards(_ref) {
46
47
  var renderItems = (items || []).map(function (item, i) {
47
48
  return /*#__PURE__*/React.createElement(_PromoCard["default"], (0, _extends2["default"])({}, item, {
48
49
  className: classes === null || classes === void 0 ? void 0 : classes.card,
50
+ classes: {
51
+ title: classes === null || classes === void 0 ? void 0 : classes.cardTitle
52
+ },
49
53
  dataAttrs: {
50
54
  root: (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.card, i + 1)
51
55
  },
@@ -60,7 +64,8 @@ var PromoCards = function PromoCards(_ref) {
60
64
  slidesSettings: slidesSettings,
61
65
  navTheme: carouselNavTheme,
62
66
  gradient: true,
63
- gradientColor: carouselGradientColor
67
+ gradientColor: carouselGradientColor,
68
+ onChange: onCarouselChange
64
69
  }, childrenLength ? children : renderItems));
65
70
  };
66
71
  var _default = exports["default"] = PromoCards;
@@ -7,6 +7,7 @@ export interface IPromoCard extends IPromoCardData, IPromoCardSettings {
7
7
  /** Дополнительные css классы для корневого элемента */
8
8
  classes?: {
9
9
  root?: string;
10
+ title?: string;
10
11
  };
11
12
  /** Дополнительные data атрибуты к корневому и внутренним элементам */
12
13
  dataAttrs?: {
@@ -14,6 +15,7 @@ export interface IPromoCard extends IPromoCardData, IPromoCardSettings {
14
15
  image?: Record<string, string>;
15
16
  badge?: Record<string, string>;
16
17
  logo?: Record<string, string>;
18
+ title?: Record<string, string>;
17
19
  subtitle?: Record<string, string>;
18
20
  list?: Record<string, string>;
19
21
  adTitle?: Record<string, string>;
@@ -157,7 +157,11 @@ var PromoCard = function PromoCard(_ref2) {
157
157
  src: logo.src,
158
158
  alt: logo.alt || ''
159
159
  })), /*#__PURE__*/React.createElement(_uiCore.Header, {
160
- as: "h3"
160
+ as: "h3",
161
+ className: classes === null || classes === void 0 ? void 0 : classes.title,
162
+ dataAttrs: {
163
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
164
+ }
161
165
  }, (0, _uiHelpers.convert)(title, {})), !!subtitle && /*#__PURE__*/React.createElement("div", {
162
166
  className: cn('subtitle')
163
167
  }, /*#__PURE__*/React.createElement(_uiCore.Paragraph, {
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { Carousel } from '@megafon/ui-core';
2
3
  import { BackgroundType, CardDataType } from './types';
4
+ type CarouselProps = React.ComponentProps<typeof Carousel>;
3
5
  export interface ISidePictureCards {
4
6
  /** Карточки. Минимальное количество 2 карточки */
5
7
  items: CardDataType[];
@@ -13,12 +15,15 @@ export interface ISidePictureCards {
13
15
  classes?: {
14
16
  root?: string;
15
17
  item?: string;
18
+ itemTitle?: string;
16
19
  };
17
20
  /** Дополнительные data атрибуты к внутренним элементам */
18
21
  dataAttrs?: {
19
22
  root?: Record<string, string>;
20
23
  item?: Record<string, string>;
21
24
  };
25
+ /** Обработчик смены слайда карусели */
26
+ onCarouselChange?: CarouselProps['onChange'];
22
27
  /** Ссылка на корневой элемент */
23
28
  rootRef?: React.Ref<HTMLDivElement>;
24
29
  }
@@ -35,6 +35,7 @@ var SidePictureCards = function SidePictureCards(_ref) {
35
35
  _ref$classes = _ref.classes,
36
36
  classes = _ref$classes === void 0 ? {} : _ref$classes,
37
37
  dataAttrs = _ref.dataAttrs,
38
+ onCarouselChange = _ref.onCarouselChange,
38
39
  rootRef = _ref.rootRef;
39
40
  if (items.length < MIN_ITEMS_COUNT) {
40
41
  return null;
@@ -44,7 +45,8 @@ var SidePictureCards = function SidePictureCards(_ref) {
44
45
  background: background,
45
46
  key: "".concat(item === null || item === void 0 ? void 0 : item.title, "_").concat(index),
46
47
  classes: {
47
- root: classes.item
48
+ root: classes.item,
49
+ title: classes.itemTitle
48
50
  },
49
51
  dataAttrs: {
50
52
  root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, index + 1))
@@ -54,7 +56,8 @@ var SidePictureCards = function SidePictureCards(_ref) {
54
56
  var renderContent = function renderContent() {
55
57
  if (hasCarousel) {
56
58
  return /*#__PURE__*/React.createElement(_uiCore.Carousel, {
57
- slidesSettings: slidesSettings
59
+ slidesSettings: slidesSettings,
60
+ onChange: onCarouselChange
58
61
  }, items.map(renderItem));
59
62
  }
60
63
  return /*#__PURE__*/React.createElement(_uiCore.Grid, {
@@ -5,10 +5,12 @@ export type SidePictureCardType = CardDataType & {
5
5
  background: BackgroundType;
6
6
  classes?: {
7
7
  root?: string;
8
+ title?: string;
8
9
  button?: string;
9
10
  };
10
11
  dataAttrs?: {
11
12
  root?: Record<string, string>;
13
+ title?: Record<string, string>;
12
14
  button?: Record<string, string>;
13
15
  };
14
16
  };
@@ -32,7 +32,8 @@ var SidePictureCard = function SidePictureCard(_ref) {
32
32
  buttonTitle = _ref2.title,
33
33
  buttonHref = _ref2.href,
34
34
  buttonTarget = _ref2.target,
35
- buttonRel = _ref2.rel;
35
+ buttonRel = _ref2.rel,
36
+ onButtonClick = _ref2.onClick;
36
37
  var isLink = !!href && !buttonHref;
37
38
  var ElementType = isLink ? 'a' : 'div';
38
39
  var currentRel = (0, _setRelAttribute.setRelAttribute)(rel, target);
@@ -69,7 +70,10 @@ var SidePictureCard = function SidePictureCard(_ref) {
69
70
  }), /*#__PURE__*/_react["default"].createElement("div", {
70
71
  className: cn('content')
71
72
  }, !!title && /*#__PURE__*/_react["default"].createElement(_uiCore.Header, {
72
- className: cn('title'),
73
+ className: cn('title', [classes === null || classes === void 0 ? void 0 : classes.title]),
74
+ dataAttrs: {
75
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
76
+ },
73
77
  as: "h3"
74
78
  }, (0, _uiHelpers.convert)(title, {})), /*#__PURE__*/_react["default"].createElement("div", {
75
79
  className: cn('items')
@@ -80,7 +84,8 @@ var SidePictureCard = function SidePictureCard(_ref) {
80
84
  },
81
85
  href: buttonHref,
82
86
  target: buttonTarget,
83
- rel: currentButtonRel
87
+ rel: currentButtonRel,
88
+ onClick: onButtonClick
84
89
  }, buttonTitle)), /*#__PURE__*/_react["default"].createElement("picture", {
85
90
  className: cn('picture')
86
91
  }, /*#__PURE__*/_react["default"].createElement("source", {
@@ -4,11 +4,13 @@ type ButtonType = {
4
4
  /** Название */
5
5
  title: string;
6
6
  /** Ссылка */
7
- href: string;
7
+ href?: string;
8
8
  /** Атрибут ссылки target */
9
9
  target?: TargetType;
10
10
  /** Атрибут ссылки rel */
11
11
  rel?: string;
12
+ /** Обработчик клика */
13
+ onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
12
14
  };
13
15
  type ImageType = {
14
16
  /** Изображение на разрешении экрана 0-1279 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-shared",
3
- "version": "9.0.0-alpha.6",
3
+ "version": "9.0.0-alpha.8",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -77,13 +77,13 @@
77
77
  },
78
78
  "dependencies": {
79
79
  "@babel/runtime": "^7.8.4",
80
- "@megafon/ui-core": "^9.0.0-alpha.6",
80
+ "@megafon/ui-core": "^9.0.0-alpha.8",
81
81
  "@megafon/ui-helpers": "^5.0.0-alpha.1",
82
- "@megafon/ui-icons": "^4.0.0-alpha.2",
82
+ "@megafon/ui-icons": "^4.0.0-alpha.3",
83
83
  "core-js": "^3.6.4",
84
84
  "htmr": "^1.0.2",
85
85
  "lodash.throttle": "^4.1.1",
86
86
  "swiper": "^11.1.1"
87
87
  },
88
- "gitHead": "135cffd0554e014ff570a74e967d311e5e243aac"
88
+ "gitHead": "5408ea18efefef2d21f6b358d14d1e1be78477e2"
89
89
  }