@megafon/ui-shared 3.0.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/es/components/AccordionBox/AccordionBox.d.ts +5 -0
  3. package/dist/es/components/AccordionBox/AccordionBox.js +6 -1
  4. package/dist/es/components/BenefitsIcons/BenefitsIcons.js +1 -1
  5. package/dist/es/components/Breadcrumbs/Breadcrumbs.css +2 -2
  6. package/dist/es/components/Breadcrumbs/Breadcrumbs.d.ts +7 -2
  7. package/dist/es/components/Breadcrumbs/Breadcrumbs.js +48 -18
  8. package/dist/es/components/ButtonBanner/ButtonBanner.d.ts +1 -0
  9. package/dist/es/components/ButtonBanner/ButtonBanner.js +5 -1
  10. package/dist/es/components/ButtonLinkBox/ButtonLinkBox.d.ts +2 -0
  11. package/dist/es/components/ButtonLinkBox/ButtonLinkBox.js +9 -1
  12. package/dist/es/components/Card/Card.d.ts +4 -2
  13. package/dist/es/components/Card/Card.js +16 -6
  14. package/dist/es/components/DownloadLinks/DownloadLink.css +1 -1
  15. package/dist/es/components/DownloadLinks/DownloadLink.d.ts +5 -0
  16. package/dist/es/components/DownloadLinks/DownloadLink.js +14 -6
  17. package/dist/es/components/Instructions/Instructions.d.ts +7 -0
  18. package/dist/es/components/Instructions/Instructions.js +55 -45
  19. package/dist/es/components/PageTitle/PageTitle.d.ts +6 -0
  20. package/dist/es/components/PageTitle/PageTitle.js +15 -4
  21. package/dist/es/components/Partners/Partners.d.ts +5 -4
  22. package/dist/es/components/Partners/Partners.js +15 -7
  23. package/dist/es/components/Property/Property.d.ts +3 -2
  24. package/dist/es/components/Property/Property.js +9 -3
  25. package/dist/es/components/Property/PropertyDescription.js +11 -5
  26. package/dist/es/components/Property/types.d.ts +3 -0
  27. package/dist/es/components/StoreBanner/StoreBanner.d.ts +4 -0
  28. package/dist/es/components/StoreBanner/StoreBanner.js +19 -4
  29. package/dist/es/components/StoreButton/StoreButton.d.ts +1 -1
  30. package/dist/es/components/StoreButton/StoreButton.js +26 -7
  31. package/dist/es/components/Table/Table.css +1 -1
  32. package/dist/es/components/TextWithIcon/TextWithIconItem.d.ts +1 -1
  33. package/dist/es/components/TextWithIcon/TextWithIconItem.js +1 -1
  34. package/dist/es/components/VideoBanner/VideoBanner.d.ts +7 -2
  35. package/dist/es/components/VideoBanner/VideoBanner.js +21 -5
  36. package/dist/es/components/VideoBlock/VideoBlock.d.ts +3 -2
  37. package/dist/es/components/VideoBlock/VideoBlock.js +9 -3
  38. package/dist/lib/components/AccordionBox/AccordionBox.d.ts +5 -0
  39. package/dist/lib/components/AccordionBox/AccordionBox.js +6 -1
  40. package/dist/lib/components/BenefitsIcons/BenefitsIcons.js +1 -1
  41. package/dist/lib/components/Breadcrumbs/Breadcrumbs.css +2 -2
  42. package/dist/lib/components/Breadcrumbs/Breadcrumbs.d.ts +7 -2
  43. package/dist/lib/components/Breadcrumbs/Breadcrumbs.js +49 -17
  44. package/dist/lib/components/ButtonBanner/ButtonBanner.d.ts +1 -0
  45. package/dist/lib/components/ButtonBanner/ButtonBanner.js +5 -1
  46. package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.d.ts +2 -0
  47. package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.js +9 -1
  48. package/dist/lib/components/Card/Card.d.ts +4 -2
  49. package/dist/lib/components/Card/Card.js +16 -6
  50. package/dist/lib/components/DownloadLinks/DownloadLink.css +1 -1
  51. package/dist/lib/components/DownloadLinks/DownloadLink.d.ts +5 -0
  52. package/dist/lib/components/DownloadLinks/DownloadLink.js +13 -5
  53. package/dist/lib/components/Instructions/Instructions.d.ts +7 -0
  54. package/dist/lib/components/Instructions/Instructions.js +55 -44
  55. package/dist/lib/components/PageTitle/PageTitle.d.ts +6 -0
  56. package/dist/lib/components/PageTitle/PageTitle.js +17 -5
  57. package/dist/lib/components/Partners/Partners.d.ts +5 -4
  58. package/dist/lib/components/Partners/Partners.js +15 -7
  59. package/dist/lib/components/Property/Property.d.ts +3 -2
  60. package/dist/lib/components/Property/Property.js +9 -3
  61. package/dist/lib/components/Property/PropertyDescription.js +11 -4
  62. package/dist/lib/components/Property/types.d.ts +3 -0
  63. package/dist/lib/components/StoreBanner/StoreBanner.d.ts +4 -0
  64. package/dist/lib/components/StoreBanner/StoreBanner.js +19 -4
  65. package/dist/lib/components/StoreButton/StoreButton.d.ts +1 -1
  66. package/dist/lib/components/StoreButton/StoreButton.js +30 -9
  67. package/dist/lib/components/Table/Table.css +1 -1
  68. package/dist/lib/components/TextWithIcon/TextWithIconItem.d.ts +1 -1
  69. package/dist/lib/components/TextWithIcon/TextWithIconItem.js +1 -1
  70. package/dist/lib/components/VideoBanner/VideoBanner.d.ts +7 -2
  71. package/dist/lib/components/VideoBanner/VideoBanner.js +21 -5
  72. package/dist/lib/components/VideoBlock/VideoBlock.d.ts +3 -2
  73. package/dist/lib/components/VideoBlock/VideoBlock.js +9 -3
  74. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.1.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.1.0...@megafon/ui-shared@3.1.1) (2022-02-28)
7
+
8
+ **Note:** Version bump only for package @megafon/ui-shared
9
+
10
+
11
+
12
+
13
+
14
+ # [3.1.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.0.3...@megafon/ui-shared@3.1.0) (2022-02-22)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **videobanner:** update snapshots ([77de901](https://github.com/MegafonWebLab/megafon-ui/commit/77de901fa76793cf76dc776b3234b2d792befd9a))
20
+ * fix Breadcrumbs, ButtonLinkBox, Card, CardBox, Container, DownloadLink & VideoBanner snapshots ([e149e2d](https://github.com/MegafonWebLab/megafon-ui/commit/e149e2d40ececff0065ec1d800fb807fabfe8640))
21
+ * **breadcrumbs:** allow to pass items as array of JSX elements ([1ca1583](https://github.com/MegafonWebLab/megafon-ui/commit/1ca158390c7c58b5ff117ae8ad16268b043d5ddb))
22
+ * **colors:** fix colors usage ([f2f59a8](https://github.com/MegafonWebLab/megafon-ui/commit/f2f59a81644c157394817af1531dabb1c0b67b19))
23
+ * **components:** better view of default props values ([1817ed5](https://github.com/MegafonWebLab/megafon-ui/commit/1817ed5cd17fd78a0911a89020138f05d7af9833))
24
+
25
+
26
+ ### Features
27
+
28
+ * **textwithiconitem:** add type string[] for text prop ([0df9680](https://github.com/MegafonWebLab/megafon-ui/commit/0df9680e10058ea24783fbc41cbce17e9b2a5594))
29
+ * **ui-shared:** add dataAttrs prop for interactive elements of components that did not have ([6b2fad8](https://github.com/MegafonWebLab/megafon-ui/commit/6b2fad84e72269d1fac0408e0b7e94202866b4aa))
30
+ * **videobanner:** added new classes for video ([d8b84a0](https://github.com/MegafonWebLab/megafon-ui/commit/d8b84a003103cf5f66102d354d2625e30a2c0d2a))
31
+
32
+
33
+
34
+
35
+
36
+ ## [3.0.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.0.2...@megafon/ui-shared@3.0.3) (2022-02-15)
37
+
38
+ **Note:** Version bump only for package @megafon/ui-shared
39
+
40
+
41
+
42
+
43
+
6
44
  ## [3.0.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.0.0...@megafon/ui-shared@3.0.2) (2022-02-11)
7
45
 
8
46
 
@@ -4,6 +4,11 @@ export interface IAccordionBox {
4
4
  /** Дополнительные data атрибуты к внутренним элементам */
5
5
  dataAttrs?: {
6
6
  root?: Record<string, string>;
7
+ header?: Record<string, string>;
8
+ collapse?: Record<string, string>;
9
+ titleWrap?: Record<string, string>;
10
+ arrowUp?: Record<string, string>;
11
+ arrowDown?: Record<string, string>;
7
12
  };
8
13
  /** Ссылка на корневой элемент */
9
14
  rootRef?: React.Ref<HTMLDivElement>;
@@ -42,7 +42,12 @@ var AccordionBox = function AccordionBox(_a) {
42
42
 
43
43
  AccordionBox.propTypes = {
44
44
  dataAttrs: PropTypes.shape({
45
- root: PropTypes.objectOf(PropTypes.string.isRequired)
45
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
46
+ header: PropTypes.objectOf(PropTypes.string.isRequired),
47
+ collapse: PropTypes.objectOf(PropTypes.string.isRequired),
48
+ titleWrap: PropTypes.objectOf(PropTypes.string.isRequired),
49
+ arrowUp: PropTypes.objectOf(PropTypes.string.isRequired),
50
+ arrowDown: PropTypes.objectOf(PropTypes.string.isRequired)
46
51
  }),
47
52
  rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
48
53
  current: PropTypes.elementType
@@ -128,7 +128,7 @@ var cn = cnCreate('mfui-benefits-icons');
128
128
  var BenefitsIcons = function BenefitsIcons(_ref) {
129
129
  var rootRef = _ref.rootRef,
130
130
  _ref$iconPosition = _ref.iconPosition,
131
- iconPosition = _ref$iconPosition === void 0 ? IconPositionEnum.LEFT_TOP : _ref$iconPosition,
131
+ iconPosition = _ref$iconPosition === void 0 ? 'left-top' : _ref$iconPosition,
132
132
  _ref$inOneColumn = _ref.inOneColumn,
133
133
  inOneColumn = _ref$inOneColumn === void 0 ? false : _ref$inOneColumn,
134
134
  items = _ref.items,
@@ -30,12 +30,12 @@ h5 {
30
30
  .mfui-breadcrumbs__item {
31
31
  position: relative;
32
32
  margin-right: 10px;
33
- padding-left: 22px;
33
+ padding-left: 26px;
34
34
  }
35
35
  .mfui-breadcrumbs__item:before {
36
36
  content: '→';
37
37
  position: absolute;
38
- top: -2px;
38
+ top: -1px;
39
39
  left: 0;
40
40
  }
41
41
  .mfui-breadcrumbs__item:first-child {
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import './Breadcrumbs.less';
3
- declare type ItemType = {
4
- component?: React.ReactElement;
3
+ declare type ItemObjectType = {
5
4
  title?: string;
6
5
  href?: string;
6
+ component?: React.ReactElement;
7
7
  };
8
+ declare type ItemType = JSX.Element | ItemObjectType;
8
9
  export declare const TextColor: {
9
10
  readonly DEFAULT: "default";
10
11
  readonly BLACK: "black";
@@ -12,6 +13,10 @@ export declare const TextColor: {
12
13
  };
13
14
  declare type TextColorType = typeof TextColor[keyof typeof TextColor];
14
15
  export declare type Props = {
16
+ dataAttrs?: {
17
+ root?: Record<string, string>;
18
+ link?: Record<string, string>;
19
+ };
15
20
  className?: string;
16
21
  classes?: {
17
22
  item?: string;
@@ -1,8 +1,10 @@
1
1
  import "core-js/modules/es.array.map";
2
2
  import "core-js/modules/es.object.values";
3
+ import "core-js/modules/es.string.link";
4
+ import _extends from "@babel/runtime/helpers/extends";
3
5
  import React from 'react';
4
6
  import { TextLink } from '@megafon/ui-core';
5
- import { cnCreate } from '@megafon/ui-helpers';
7
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
8
  import PropTypes from 'prop-types';
7
9
  import "./Breadcrumbs.css";
8
10
  export var TextColor = {
@@ -10,6 +12,15 @@ export var TextColor = {
10
12
  BLACK: 'black',
11
13
  WHITE: 'white'
12
14
  };
15
+
16
+ function isObjectElement(item) {
17
+ return !React.isValidElement(item);
18
+ }
19
+
20
+ function isJSXElement(item) {
21
+ return React.isValidElement(item);
22
+ }
23
+
13
24
  var cn = cnCreate('mfui-breadcrumbs');
14
25
 
15
26
  var Breadcrumbs = function Breadcrumbs(_ref) {
@@ -18,34 +29,53 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
18
29
  color = _ref$color === void 0 ? 'black' : _ref$color,
19
30
  className = _ref.className,
20
31
  _ref$classes = _ref.classes,
21
- classes = _ref$classes === void 0 ? {} : _ref$classes;
22
- return /*#__PURE__*/React.createElement("div", {
32
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
33
+ dataAttrs = _ref.dataAttrs;
34
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
23
35
  className: cn({
24
36
  color: color
25
37
  }, className)
26
- }, items.map(function (_ref2) {
27
- var component = _ref2.component,
28
- title = _ref2.title,
29
- href = _ref2.href;
30
- return /*#__PURE__*/React.createElement("div", {
31
- className: cn('item', classes.item),
32
- key: title
33
- }, component, !component && /*#__PURE__*/React.createElement(TextLink, {
34
- href: href,
35
- color: color
36
- }, component || title));
38
+ }), items.map(function (item, i) {
39
+ if (isJSXElement(item)) {
40
+ return /*#__PURE__*/React.createElement("div", {
41
+ className: cn('item', classes.item),
42
+ key: i
43
+ }, item);
44
+ }
45
+
46
+ if (isObjectElement(item)) {
47
+ return /*#__PURE__*/React.createElement("div", {
48
+ className: cn('item', classes.item),
49
+ key: item.component ? i : item.title
50
+ }, item.component || /*#__PURE__*/React.createElement(TextLink, {
51
+ href: item.href,
52
+ color: color,
53
+ dataAttrs: {
54
+ root: (dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link) ? _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link, i + 1)) : undefined
55
+ }
56
+ }, item.title));
57
+ }
58
+
59
+ return null;
37
60
  }));
38
61
  };
39
62
 
40
63
  Breadcrumbs.propTypes = {
64
+ dataAttrs: PropTypes.shape({
65
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
66
+ link: PropTypes.objectOf(PropTypes.string.isRequired)
67
+ }),
41
68
  className: PropTypes.string,
42
69
  classes: PropTypes.shape({
43
70
  item: PropTypes.string
44
71
  }),
45
- items: PropTypes.arrayOf(PropTypes.shape({
46
- title: PropTypes.string.isRequired,
47
- href: PropTypes.string
48
- }).isRequired).isRequired,
72
+ items: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.arrayOf(PropTypes.shape({
73
+ title: PropTypes.string,
74
+ href: PropTypes.string,
75
+
76
+ /* @deprecated */
77
+ component: PropTypes.element
78
+ }).isRequired)]).isRequired,
49
79
  color: PropTypes.oneOf(Object.values(TextColor))
50
80
  };
51
81
  export default Breadcrumbs;
@@ -19,6 +19,7 @@ export interface IButtonBannerProps {
19
19
  /** Дополнительные data атрибуты к внутренним элементам */
20
20
  dataAttrs?: {
21
21
  root?: Record<string, string>;
22
+ button?: Record<string, string>;
22
23
  };
23
24
  /** Дополнительный css класс для корневого элемента */
24
25
  className?: string;
@@ -47,6 +47,9 @@ var ButtonBanner = function ButtonBanner(_ref) {
47
47
  imageScaling = _ref$imageScaling === void 0 ? 'cover' : _ref$imageScaling,
48
48
  onButtonClick = _ref.onButtonClick;
49
49
  var buttonElem = /*#__PURE__*/React.createElement(Button, {
50
+ dataAttrs: {
51
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
52
+ },
50
53
  className: cn('button', [classes.button]),
51
54
  href: buttonUrl,
52
55
  target: buttonTarget,
@@ -86,7 +89,8 @@ var ButtonBanner = function ButtonBanner(_ref) {
86
89
 
87
90
  ButtonBanner.propTypes = {
88
91
  dataAttrs: PropTypes.shape({
89
- root: PropTypes.objectOf(PropTypes.string.isRequired)
92
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
93
+ button: PropTypes.objectOf(PropTypes.string.isRequired)
90
94
  }),
91
95
  className: PropTypes.string,
92
96
  classes: PropTypes.shape({
@@ -4,6 +4,8 @@ export interface IButtonLinkBoxProps {
4
4
  /** Дополнительные data атрибуты к внутренним элементам */
5
5
  dataAttrs?: {
6
6
  root?: Record<string, string>;
7
+ link?: Record<string, string>;
8
+ button?: Record<string, string>;
7
9
  };
8
10
  /** Дополнительный класс корневого элемента */
9
11
  className?: string;
@@ -34,6 +34,9 @@ var ButtonLinkBox = function ButtonLinkBox(_ref) {
34
34
  }), buttonTitle && /*#__PURE__*/React.createElement("div", {
35
35
  className: cn('row')
36
36
  }, /*#__PURE__*/React.createElement(Button, {
37
+ dataAttrs: {
38
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
39
+ },
37
40
  className: classes.button,
38
41
  href: buttonUrl,
39
42
  theme: buttonColor,
@@ -43,6 +46,9 @@ var ButtonLinkBox = function ButtonLinkBox(_ref) {
43
46
  }, buttonTitle)), linkTitle && /*#__PURE__*/React.createElement("div", {
44
47
  className: cn('row')
45
48
  }, /*#__PURE__*/React.createElement(TextLink, {
49
+ dataAttrs: {
50
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link
51
+ },
46
52
  className: classes.link,
47
53
  href: linkUrl,
48
54
  download: linkDownload,
@@ -54,7 +60,9 @@ var ButtonLinkBox = function ButtonLinkBox(_ref) {
54
60
 
55
61
  ButtonLinkBox.propTypes = {
56
62
  dataAttrs: PropTypes.shape({
57
- root: PropTypes.objectOf(PropTypes.string.isRequired)
63
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
64
+ link: PropTypes.objectOf(PropTypes.string.isRequired),
65
+ button: PropTypes.objectOf(PropTypes.string.isRequired)
58
66
  }),
59
67
  className: PropTypes.string,
60
68
  classes: PropTypes.shape({
@@ -23,9 +23,11 @@ export declare const ObjectFit: {
23
23
  };
24
24
  declare type ObjectFitType = typeof ObjectFit[keyof typeof ObjectFit];
25
25
  export interface ICard {
26
- /** Дата атрибуты для корневого элемента */
26
+ /** Дополнительные data атрибуты к внутренним элементам */
27
27
  dataAttrs?: {
28
- [key: string]: string;
28
+ root?: Record<string, string>;
29
+ link?: Record<string, string>;
30
+ button?: Record<string, string>;
29
31
  };
30
32
  /** Дополнительный класс корневого элемента */
31
33
  className?: string;
@@ -84,12 +84,15 @@ var Card = function Card(_ref) {
84
84
  }
85
85
 
86
86
  return /*#__PURE__*/React.createElement(TextLink, {
87
- className: cn('link', [classes.link]),
88
87
  href: linkHref,
88
+ download: download,
89
89
  target: linkTarget,
90
- download: download
90
+ dataAttrs: {
91
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link
92
+ },
93
+ className: cn('link', [classes.link])
91
94
  }, linkTitle);
92
- }, [link, isCardLink, classes]);
95
+ }, [link, isCardLink, classes, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link]);
93
96
  var renderBtn = React.useCallback(function () {
94
97
  if (!button || isCardLink) {
95
98
  return null;
@@ -100,12 +103,15 @@ var Card = function Card(_ref) {
100
103
  btnTarget = button.target,
101
104
  buttonDownload = button.download;
102
105
  return /*#__PURE__*/React.createElement(Button, {
106
+ dataAttrs: {
107
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
108
+ },
103
109
  className: cn('button', [classes.button]),
104
110
  href: btnHref,
105
111
  target: btnTarget,
106
112
  download: buttonDownload
107
113
  }, btnTitle);
108
- }, [button, isCardLink, classes]);
114
+ }, [button, isCardLink, classes, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button]);
109
115
  var renderBtnsWrapper = React.useCallback(function () {
110
116
  var btnElem = renderBtn();
111
117
  var linkElem = renderLink();
@@ -120,7 +126,7 @@ var Card = function Card(_ref) {
120
126
  })
121
127
  }, btnElem, linkElem);
122
128
  }, [renderBtn, renderLink, isAlignAvailable, isLeftHAlign]);
123
- return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs), {
129
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
124
130
  className: cn('', {
125
131
  href: !!href,
126
132
  'full-height': isFullHeight,
@@ -140,7 +146,11 @@ var Card = function Card(_ref) {
140
146
  };
141
147
 
142
148
  Card.propTypes = {
143
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
149
+ dataAttrs: PropTypes.shape({
150
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
151
+ link: PropTypes.objectOf(PropTypes.string.isRequired),
152
+ button: PropTypes.objectOf(PropTypes.string.isRequired)
153
+ }),
144
154
  className: PropTypes.string,
145
155
  classes: PropTypes.shape({
146
156
  root: PropTypes.string,
@@ -32,6 +32,6 @@ h5 {
32
32
  margin: 0;
33
33
  font-size: 12px;
34
34
  line-height: 16px;
35
- color: var(--stcBlack5);
35
+ color: var(--spbSky3);
36
36
  text-transform: uppercase;
37
37
  }
@@ -1,6 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import './DownloadLink.less';
3
3
  export interface IDownloadLink {
4
+ /** Дополнительные data атрибуты к внутренним элементам */
5
+ dataAttrs?: {
6
+ root?: Record<string, string>;
7
+ link?: Record<string, string>;
8
+ };
4
9
  /** Ссылка на корневой элемент */
5
10
  rootRef?: React.Ref<HTMLDivElement>;
6
11
  /** Адресы ссылки */
@@ -3,7 +3,7 @@ import "core-js/modules/es.string.link";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import * as React from 'react';
5
5
  import { TextLink } from '@megafon/ui-core';
6
- import { cnCreate } from '@megafon/ui-helpers';
6
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
7
7
  import * as PropTypes from 'prop-types';
8
8
  import "./DownloadLink.css";
9
9
 
@@ -26,25 +26,33 @@ var DownloadLink = function DownloadLink(_ref) {
26
26
  className = _ref.className,
27
27
  _ref$classes = _ref.classes,
28
28
  classes = _ref$classes === void 0 ? {} : _ref$classes,
29
- rootRef = _ref.rootRef;
30
- return /*#__PURE__*/React.createElement("div", {
29
+ rootRef = _ref.rootRef,
30
+ dataAttrs = _ref.dataAttrs;
31
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
31
32
  className: cn([className, classes.root]),
32
33
  ref: rootRef
33
- }, /*#__PURE__*/React.createElement("div", {
34
+ }), /*#__PURE__*/React.createElement("div", {
34
35
  className: cn('icon')
35
36
  }, /*#__PURE__*/React.createElement(DownloadIcon, {
36
37
  className: cn('icon-svg')
37
38
  })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextLink, {
38
- className: cn('link', [classes.link]),
39
+ download: true,
39
40
  href: href,
40
41
  onClick: onClick,
41
- download: true
42
+ dataAttrs: {
43
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link
44
+ },
45
+ className: cn('link', [classes.link])
42
46
  }, text), /*#__PURE__*/React.createElement("p", {
43
47
  className: cn('info')
44
48
  }, "".concat(extension).concat(extension && fileSize ? ',' : '', " ").concat(fileSize))));
45
49
  };
46
50
 
47
51
  DownloadLink.propTypes = {
52
+ dataAttrs: PropTypes.shape({
53
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
54
+ link: PropTypes.objectOf(PropTypes.string.isRequired)
55
+ }),
48
56
  rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
49
57
  current: PropTypes.elementType
50
58
  }), PropTypes.any])]),
@@ -22,6 +22,13 @@ export declare type InstructionItemType = {
22
22
  isVideo: boolean;
23
23
  };
24
24
  export interface IInstructionsProps {
25
+ /** Дополнительные data атрибуты к внутренним элементам */
26
+ dataAttrs?: {
27
+ root?: Record<string, string>;
28
+ item?: Record<string, string>;
29
+ image?: Record<string, string>;
30
+ mobileItemText?: Record<string, string>;
31
+ };
25
32
  /** Ссылка на корневой элемент */
26
33
  rootRef?: Ref<HTMLDivElement>;
27
34
  /** Дополнительные классы для внутренних элементов */
@@ -1,4 +1,5 @@
1
1
  import "core-js/modules/es.array.map";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
 
4
5
  /* eslint-disable jsx-a11y/no-static-element-interactions */
@@ -6,7 +7,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
7
  /* eslint-disable jsx-a11y/click-events-have-key-events */
7
8
  import React from 'react';
8
9
  import { Grid, GridColumn, Header, Paragraph } from '@megafon/ui-core';
9
- import { cnCreate } from '@megafon/ui-helpers';
10
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
10
11
  import convert from 'htmr';
11
12
  import PropTypes from 'prop-types';
12
13
  import { Swiper, SwiperSlide } from 'swiper/react';
@@ -28,7 +29,8 @@ var cn = cnCreate('mfui-instructions');
28
29
  var swiperSlideCn = cn('slide');
29
30
 
30
31
  var Instructions = function Instructions(_ref) {
31
- var rootRef = _ref.rootRef,
32
+ var dataAttrs = _ref.dataAttrs,
33
+ rootRef = _ref.rootRef,
32
34
  _ref$classes = _ref.classes;
33
35
  _ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
34
36
  var instructionItem = _ref$classes.instructionItem,
@@ -75,36 +77,37 @@ var Instructions = function Instructions(_ref) {
75
77
  swiperInstance && swiperInstance.slideTo(ind);
76
78
  };
77
79
  }, [swiperInstance]);
78
- var renderVideo = React.useCallback(function (mediaUrl) {
79
- return /*#__PURE__*/React.createElement("video", {
80
- className: cn('swiper-img'),
81
- autoPlay: true,
82
- muted: true,
80
+ var renderVideo = React.useCallback(function (mediaUrl, index) {
81
+ return /*#__PURE__*/React.createElement("video", _extends({
83
82
  loop: true,
84
- playsInline: true
85
- }, /*#__PURE__*/React.createElement("source", {
83
+ muted: true,
84
+ autoPlay: true,
85
+ playsInline: true,
86
+ className: cn('swiper-img')
87
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image, index + 1)), /*#__PURE__*/React.createElement("source", {
86
88
  src: mediaUrl,
87
89
  type: "video/mp4"
88
90
  }));
89
- }, []);
91
+ }, [dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image]);
90
92
  var renderSlider = React.useCallback(function () {
91
93
  return /*#__PURE__*/React.createElement(Swiper, {
92
94
  className: cn('swiper'),
93
95
  onSwiper: getSwiperInstance,
94
96
  noSwipingClass: swiperSlideCn
95
- }, instructionItems.map(function (_ref2, ind) {
97
+ }, instructionItems.map(function (_ref2, i) {
96
98
  var mediaUrl = _ref2.mediaUrl,
97
99
  isVideo = _ref2.isVideo;
98
100
  return /*#__PURE__*/React.createElement(SwiperSlide, {
99
101
  className: swiperSlideCn,
100
- key: ind + mediaUrl
101
- }, isVideo ? renderVideo(mediaUrl) : /*#__PURE__*/React.createElement("img", {
102
- className: cn('swiper-img', [instructionItemImg]),
103
- src: mediaUrl,
104
- alt: ""
105
- }));
102
+ key: i + mediaUrl
103
+ }, isVideo ? renderVideo(mediaUrl, i) : /*#__PURE__*/React.createElement("img", _extends({
104
+ alt: "",
105
+ src: mediaUrl
106
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image, i + 1), {
107
+ className: cn('swiper-img', [instructionItemImg])
108
+ })));
106
109
  }));
107
- }, [getSwiperInstance, instructionItemImg, instructionItems, renderVideo]);
110
+ }, [getSwiperInstance, instructionItemImg, instructionItems, renderVideo, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image]);
108
111
  var renderTitle = React.useCallback(function (resolution) {
109
112
  return /*#__PURE__*/React.createElement(Header, {
110
113
  className: cn('title', {
@@ -136,28 +139,28 @@ var Instructions = function Instructions(_ref) {
136
139
  'text-after': !!text,
137
140
  desktop: true
138
141
  })
139
- }, instructionItems.map(function (_ref3, ind) {
142
+ }, instructionItems.map(function (_ref3, i) {
140
143
  var itemTitle = _ref3.title;
141
144
  return (
142
145
  /*#__PURE__*/
143
146
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
144
- React.createElement("li", {
147
+ React.createElement("li", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1), {
145
148
  className: cn('articles-item', {
146
- active: slideIndex === ind
147
- }, [getActiveCustomClass(ind, slideIndex), instructionItem, desktopInstructionItem]),
148
- "data-index": ind,
149
- onClick: handleArticleClick(ind),
150
- key: ind
151
- }, /*#__PURE__*/React.createElement("div", {
149
+ active: slideIndex === i
150
+ }, [getActiveCustomClass(i, slideIndex), instructionItem, desktopInstructionItem]),
151
+ "data-index": i,
152
+ onClick: handleArticleClick(i),
153
+ key: i
154
+ }), /*#__PURE__*/React.createElement("div", {
152
155
  className: cn('articles-item-dot')
153
156
  }, /*#__PURE__*/React.createElement("span", {
154
157
  className: cn('articles-item-dot-number')
155
- }, ind + 1)), /*#__PURE__*/React.createElement("div", {
158
+ }, i + 1)), /*#__PURE__*/React.createElement("div", {
156
159
  className: cn('articles-item-title', [desktopItemTitle])
157
160
  }, itemTitle))
158
161
  );
159
162
  }));
160
- }, [desktopInstructionItem, desktopItemTitle, getActiveCustomClass, handleArticleClick, instructionItem, instructionItems, slideIndex, text]);
163
+ }, [desktopInstructionItem, desktopItemTitle, getActiveCustomClass, handleArticleClick, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, instructionItem, instructionItems, slideIndex, text]);
161
164
  var renderMobileArticles = React.useCallback(function () {
162
165
  return /*#__PURE__*/React.createElement("div", {
163
166
  className: cn('articles-list', {
@@ -165,35 +168,36 @@ var Instructions = function Instructions(_ref) {
165
168
  })
166
169
  }, /*#__PURE__*/React.createElement("div", {
167
170
  className: cn('articles-title-block')
168
- }, instructionItems.map(function (_ref4, ind) {
171
+ }, instructionItems.map(function (_ref4, i) {
169
172
  var itemTitle = _ref4.title;
170
- return slideIndex === ind && /*#__PURE__*/React.createElement("div", {
171
- className: cn('articles-title', [mobileItemTitle]),
172
- "data-index": ind,
173
- key: ind
174
- }, itemTitle);
173
+ return slideIndex === i && /*#__PURE__*/React.createElement("div", _extends({
174
+ key: i,
175
+ "data-index": i
176
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.mobileItemText, i + 1), {
177
+ className: cn('articles-title', [mobileItemTitle])
178
+ }), itemTitle);
175
179
  })), /*#__PURE__*/React.createElement("ul", {
176
180
  className: cn('articles-dots', {
177
181
  'text-after': !!text
178
182
  })
179
- }, instructionItems.map(function (_item, ind) {
180
- return /*#__PURE__*/React.createElement("div", {
181
- key: ind,
183
+ }, instructionItems.map(function (_item, i) {
184
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1), {
185
+ key: i,
182
186
  className: cn('articles-dot', {
183
- active: slideIndex === ind
184
- }, [getActiveCustomClass(ind, slideIndex), instructionItem, mobileInstructionItem]),
185
- onClick: handleArticleClick(ind)
186
- }, /*#__PURE__*/React.createElement("span", {
187
+ active: slideIndex === i
188
+ }, [getActiveCustomClass(i, slideIndex), instructionItem, mobileInstructionItem]),
189
+ onClick: handleArticleClick(i)
190
+ }), /*#__PURE__*/React.createElement("span", {
187
191
  className: cn('articles-dot-number')
188
- }, ind + 1));
192
+ }, i + 1));
189
193
  })));
190
- }, [getActiveCustomClass, handleArticleClick, instructionItem, instructionItems, mobileInstructionItem, mobileItemTitle, slideIndex, text]);
191
- return /*#__PURE__*/React.createElement("div", {
194
+ }, [dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.mobileItemText, getActiveCustomClass, handleArticleClick, instructionItem, instructionItems, mobileInstructionItem, mobileItemTitle, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, slideIndex, text]);
195
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
192
196
  className: cn({
193
197
  mask: pictureMask
194
198
  }),
195
199
  ref: rootRef
196
- }, /*#__PURE__*/React.createElement(Grid, {
200
+ }), /*#__PURE__*/React.createElement(Grid, {
197
201
  hAlign: "center"
198
202
  }, /*#__PURE__*/React.createElement(GridColumn, {
199
203
  all: "12"
@@ -211,6 +215,12 @@ var Instructions = function Instructions(_ref) {
211
215
  };
212
216
 
213
217
  Instructions.propTypes = {
218
+ dataAttrs: PropTypes.shape({
219
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
220
+ item: PropTypes.objectOf(PropTypes.string.isRequired),
221
+ image: PropTypes.objectOf(PropTypes.string.isRequired),
222
+ mobileItemText: PropTypes.objectOf(PropTypes.string.isRequired)
223
+ }),
214
224
  rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
215
225
  current: PropTypes.elementType
216
226
  }), PropTypes.any])]),
@@ -2,6 +2,12 @@ import * as React from 'react';
2
2
  import './PageTitle.less';
3
3
  import { Props as BreadcrumbsType } from '../Breadcrumbs/Breadcrumbs';
4
4
  declare type Props = {
5
+ /** Дополнительные data атрибуты к внутренним элементам */
6
+ dataAttrs?: {
7
+ root?: Record<string, string>;
8
+ breadcrumbs?: Record<string, string>;
9
+ breadcrumbsLink?: Record<string, string>;
10
+ };
5
11
  /** Текст заголовка */
6
12
  title: string | React.ReactNode | React.ReactNode[];
7
13
  /** Хлебные крошки */