@megafon/ui-shared 5.1.0 → 5.2.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 (54) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/es/components/BenefitsIcons/BenefitsIcons.js +19 -116
  3. package/dist/es/components/BenefitsIcons/BenefitsIconsTile.js +3 -1
  4. package/dist/es/components/BenefitsIcons/helpers.d.ts +8 -0
  5. package/dist/es/components/BenefitsIcons/helpers.js +116 -0
  6. package/dist/es/components/ButtonBanner/ButtonBanner.js +5 -2
  7. package/dist/es/components/DownloadLinks/DownloadLink.js +1 -1
  8. package/dist/es/components/DownloadLinks/DownloadLinks.d.ts +10 -0
  9. package/dist/es/components/DownloadLinks/DownloadLinks.js +4 -4
  10. package/dist/es/components/Instructions/Instructions.js +11 -5
  11. package/dist/es/components/PageTitle/PageTitle.d.ts +2 -2
  12. package/dist/es/components/PageTitle/PageTitle.js +8 -1
  13. package/dist/es/components/Partners/Partners.js +12 -2
  14. package/dist/es/components/PictureWithDescription/PictureWithDescription.js +5 -2
  15. package/dist/es/components/Property/Property.js +2 -2
  16. package/dist/es/components/Property/types.d.ts +1 -1
  17. package/dist/es/components/StoreBanner/StoreBanner.js +5 -2
  18. package/dist/es/components/Table/Table.css +10 -1
  19. package/dist/es/components/Table/Table.d.ts +2 -0
  20. package/dist/es/components/Table/Table.js +17 -6
  21. package/dist/es/components/Table/TableRow.d.ts +2 -0
  22. package/dist/es/components/Table/TableRow.js +2 -0
  23. package/dist/es/components/TabsBox/TabsBox.d.ts +1 -1
  24. package/dist/es/components/TabsBox/TabsBox.js +3 -2
  25. package/dist/es/components/TextBox/TextBox.js +6 -1
  26. package/dist/es/components/TextWithIcon/TextWithIcon.js +8 -1
  27. package/dist/es/components/TextWithIcon/TextWithIconItem.js +5 -2
  28. package/dist/lib/components/BenefitsIcons/BenefitsIcons.js +21 -116
  29. package/dist/lib/components/BenefitsIcons/BenefitsIconsTile.js +3 -1
  30. package/dist/lib/components/BenefitsIcons/helpers.d.ts +8 -0
  31. package/dist/lib/components/BenefitsIcons/helpers.js +135 -0
  32. package/dist/lib/components/ButtonBanner/ButtonBanner.js +5 -2
  33. package/dist/lib/components/DownloadLinks/DownloadLink.js +1 -1
  34. package/dist/lib/components/DownloadLinks/DownloadLinks.d.ts +10 -0
  35. package/dist/lib/components/DownloadLinks/DownloadLinks.js +5 -2
  36. package/dist/lib/components/Instructions/Instructions.js +11 -5
  37. package/dist/lib/components/PageTitle/PageTitle.d.ts +2 -2
  38. package/dist/lib/components/PageTitle/PageTitle.js +8 -1
  39. package/dist/lib/components/Partners/Partners.js +12 -2
  40. package/dist/lib/components/PictureWithDescription/PictureWithDescription.js +5 -2
  41. package/dist/lib/components/Property/Property.js +2 -2
  42. package/dist/lib/components/Property/types.d.ts +1 -1
  43. package/dist/lib/components/StoreBanner/StoreBanner.js +5 -2
  44. package/dist/lib/components/Table/Table.css +10 -1
  45. package/dist/lib/components/Table/Table.d.ts +2 -0
  46. package/dist/lib/components/Table/Table.js +17 -6
  47. package/dist/lib/components/Table/TableRow.d.ts +2 -0
  48. package/dist/lib/components/Table/TableRow.js +2 -0
  49. package/dist/lib/components/TabsBox/TabsBox.d.ts +1 -1
  50. package/dist/lib/components/TabsBox/TabsBox.js +3 -2
  51. package/dist/lib/components/TextBox/TextBox.js +6 -1
  52. package/dist/lib/components/TextWithIcon/TextWithIcon.js +8 -1
  53. package/dist/lib/components/TextWithIcon/TextWithIconItem.js +5 -2
  54. package/package.json +3 -3
@@ -25,6 +25,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
27
 
28
+ var testIdPrefix = 'PageTitle';
28
29
  var cn = (0, _uiHelpers.cnCreate)('mfui-page-title');
29
30
 
30
31
  var PageTitle = function PageTitle(_ref) {
@@ -54,7 +55,13 @@ var PageTitle = function PageTitle(_ref) {
54
55
  }, title));
55
56
  }, [badge, title, isBreadcrumbs]);
56
57
  var renderPageTitleWithGrid = React.useCallback(function () {
57
- return /*#__PURE__*/React.createElement(_uiCore.Grid, null, /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
58
+ return /*#__PURE__*/React.createElement(_uiCore.Grid, {
59
+ dataAttrs: {
60
+ root: {
61
+ 'data-testid': "".concat(testIdPrefix, "-grid")
62
+ }
63
+ }
64
+ }, /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
58
65
  wide: "8",
59
66
  desktop: "10",
60
67
  tablet: "12",
@@ -42,6 +42,7 @@ var slidesSettings = (_slidesSettings = {}, (0, _defineProperty2["default"])(_sl
42
42
  slidesPerView: 4,
43
43
  spaceBetween: 20
44
44
  }), _slidesSettings);
45
+ var testIdPrefix = 'Partners';
45
46
  var cn = (0, _uiHelpers.cnCreate)('mfui-partners');
46
47
 
47
48
  var Partners = function Partners(_ref) {
@@ -77,7 +78,8 @@ var Partners = function Partners(_ref) {
77
78
  root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, index + 1))
78
79
  }
79
80
  }, /*#__PURE__*/React.createElement("div", {
80
- className: cn('tile-inner', [itemClass])
81
+ className: cn('tile-inner', [itemClass]),
82
+ "data-testid": "".concat(testIdPrefix, "-tile-inner")
81
83
  }, /*#__PURE__*/React.createElement("div", {
82
84
  className: cn('img-wrapper')
83
85
  }, /*#__PURE__*/React.createElement("img", {
@@ -106,7 +108,15 @@ var Partners = function Partners(_ref) {
106
108
  slidesSettings: slidesSettings,
107
109
  onChange: onChange,
108
110
  onNextClick: onNextClick,
109
- onPrevClick: onPrevClick
111
+ onPrevClick: onPrevClick,
112
+ dataAttrs: {
113
+ prev: {
114
+ 'data-testid': "".concat(testIdPrefix, "-prev")
115
+ },
116
+ next: {
117
+ 'data-testid': "".concat(testIdPrefix, "-next")
118
+ }
119
+ }
110
120
  }, topRow.map(function (item, i) {
111
121
  return /*#__PURE__*/React.createElement("div", {
112
122
  key: i + item.src,
@@ -26,6 +26,7 @@ var pictureAlignTypes = {
26
26
  RIGHT: 'right'
27
27
  };
28
28
  exports.pictureAlignTypes = pictureAlignTypes;
29
+ var testIdPrefix = 'PictureWithDescription';
29
30
  var cn = (0, _uiHelpers.cnCreate)('mfui-picture-with-description');
30
31
 
31
32
  var PictureWithDescription = function PictureWithDescription(_ref) {
@@ -46,7 +47,8 @@ var PictureWithDescription = function PictureWithDescription(_ref) {
46
47
  }, /*#__PURE__*/React.createElement("div", {
47
48
  className: cn('picture', {
48
49
  align: pictureAlign
49
- })
50
+ }),
51
+ "data-testid": "".concat(testIdPrefix, "-picture")
50
52
  }, /*#__PURE__*/React.createElement("img", {
51
53
  className: cn('img'),
52
54
  src: pictureUrl,
@@ -55,7 +57,8 @@ var PictureWithDescription = function PictureWithDescription(_ref) {
55
57
  className: cn('articles', {
56
58
  align: pictureAlign,
57
59
  'text-top-align': isTextTopAlign
58
- })
60
+ }),
61
+ "data-testid": "".concat(testIdPrefix, "-articles")
59
62
  }, !!title && /*#__PURE__*/React.createElement(_uiCore.Header, {
60
63
  className: cn('title', [classes.title]),
61
64
  as: "h2"
@@ -122,7 +122,7 @@ var Property = function Property(_ref) {
122
122
  "data-testid": "".concat(testIdPrefix, "-value")
123
123
  }, /*#__PURE__*/_react["default"].createElement("div", {
124
124
  className: cn('value')
125
- }, (0, _uiHelpers.convert)(value, {})), valueUnit && /*#__PURE__*/_react["default"].createElement(_uiCore.Caption, {
125
+ }, typeof value === 'string' ? (0, _uiHelpers.convert)(value, {}) : value), valueUnit && /*#__PURE__*/_react["default"].createElement(_uiCore.Caption, {
126
126
  className: cn('value-unit'),
127
127
  hasMargin: false
128
128
  }, (0, _uiHelpers.convert)(valueUnit, {})));
@@ -181,7 +181,7 @@ Property.propTypes = {
181
181
  value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].arrayOf(_propTypes["default"].node)]).isRequired,
182
182
  isCollapsible: _propTypes["default"].bool
183
183
  })),
184
- value: _propTypes["default"].string,
184
+ value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
185
185
  titleSize: _propTypes["default"].oneOf(['default', 'big']),
186
186
  valueUnit: _propTypes["default"].string,
187
187
  valueFrameColor: _propTypes["default"].oneOf(['none', 'default', 'gray'])
@@ -14,7 +14,7 @@ export declare type Item = {
14
14
  title?: string[] | React.ReactNode[];
15
15
  titleSize?: 'default' | 'big';
16
16
  description?: Desc[];
17
- value?: string;
17
+ value?: string | React.ReactNode;
18
18
  valueUnit?: string;
19
19
  valueFrameColor?: 'none' | 'default' | 'gray';
20
20
  };
@@ -42,6 +42,7 @@ var DeviceMask = {
42
42
  WHITE_IPHONE: 'white-iphone'
43
43
  };
44
44
  exports.DeviceMask = DeviceMask;
45
+ var testIdPrefix = 'StoreBanner';
45
46
  var cn = (0, _uiHelpers.cnCreate)('mfui-store-banner');
46
47
 
47
48
  var StoreBanner = function StoreBanner(_ref) {
@@ -113,9 +114,11 @@ var StoreBanner = function StoreBanner(_ref) {
113
114
  }, !linkButton && qrCode && /*#__PURE__*/React.createElement("img", {
114
115
  src: qrCode,
115
116
  className: cn('qr-code'),
116
- alt: "QR-\u043A\u043E\u0434"
117
+ alt: "QR-\u043A\u043E\u0434",
118
+ "data-testid": "".concat(testIdPrefix, "-qrCode")
117
119
  }), !linkButton && /*#__PURE__*/React.createElement("div", {
118
- className: cn('stores')
120
+ className: cn('stores'),
121
+ "data-testid": "".concat(testIdPrefix, "-stores")
119
122
  }, linkApple && /*#__PURE__*/React.createElement(_StoreButton["default"], {
120
123
  dataAttrs: {
121
124
  root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.linkApple
@@ -40,7 +40,7 @@ h5 {
40
40
  overflow: auto;
41
41
  }
42
42
  @media screen and (min-width: 1024px) {
43
- .mfui-table__scroll {
43
+ .mfui-table__scroll_limit {
44
44
  max-height: 500px;
45
45
  }
46
46
  }
@@ -131,6 +131,15 @@ h5 {
131
131
  .mfui-table__row:not(:last-child) .mfui-table__cell {
132
132
  border-bottom: 1px solid var(--spbSky2);
133
133
  }
134
+ .mfui-table__row_align_bottom .mfui-table__cell {
135
+ vertical-align: bottom;
136
+ }
137
+ .mfui-table__row_align_top .mfui-table__cell {
138
+ vertical-align: top;
139
+ }
140
+ .mfui-table__row_align_top.mfui-table__row_head .mfui-table__cell {
141
+ padding-top: 12px;
142
+ }
134
143
  .mfui-table_min-cell-size_small .mfui-table__cell:not(:first-child) {
135
144
  min-width: 72px;
136
145
  }
@@ -8,6 +8,8 @@ export interface ITable {
8
8
  fixColumn?: boolean;
9
9
  /** Минимальный размер ячеек */
10
10
  minCellSize?: 'small' | 'large';
11
+ /** Отключить ограничение по высоте при разрешении больше 1024px */
12
+ disableHeightLimit?: boolean;
11
13
  children: Array<React.ReactElement<ITableRow>>;
12
14
  }
13
15
  declare const Table: React.FC<ITable>;
@@ -35,6 +35,8 @@ var Table = function Table(_ref) {
35
35
  fixColumn = _ref$fixColumn === void 0 ? true : _ref$fixColumn,
36
36
  _ref$minCellSize = _ref.minCellSize,
37
37
  minCellSize = _ref$minCellSize === void 0 ? 'large' : _ref$minCellSize,
38
+ _ref$disableHeightLim = _ref.disableHeightLimit,
39
+ disableHeightLimit = _ref$disableHeightLim === void 0 ? false : _ref$disableHeightLim,
38
40
  children = _ref.children;
39
41
  var scrollRef = React.useRef(null);
40
42
 
@@ -96,17 +98,23 @@ var Table = function Table(_ref) {
96
98
  }, []);
97
99
 
98
100
  var renderRows = function renderRows() {
99
- return React.Children.map(children, function (_ref2) {
101
+ return React.Children.map(children, function (_ref2, index) {
100
102
  var _ref2$props = _ref2.props,
101
103
  cells = _ref2$props.children,
102
- head = _ref2$props.head;
104
+ head = _ref2$props.head,
105
+ _ref2$props$vAlign = _ref2$props.vAlign,
106
+ vAlign = _ref2$props$vAlign === void 0 ? 'default' : _ref2$props$vAlign;
103
107
  return /*#__PURE__*/React.createElement("tr", {
108
+ key: index,
104
109
  className: cn('row', {
105
- head: head
106
- })
107
- }, React.Children.map(cells, function (_ref3) {
110
+ head: head,
111
+ align: vAlign
112
+ }),
113
+ "data-testid": "Table-row"
114
+ }, React.Children.map(cells, function (_ref3, cellIndex) {
108
115
  var cell = _ref3.props.children;
109
116
  return /*#__PURE__*/React.createElement("td", {
117
+ key: cellIndex,
110
118
  className: cn('cell')
111
119
  }, typeof cell === 'string' ? (0, _htmr["default"])(cell) : cell);
112
120
  }));
@@ -120,7 +128,9 @@ var Table = function Table(_ref) {
120
128
  touch: isTouchDevice
121
129
  }, [className])
122
130
  }, /*#__PURE__*/React.createElement("div", {
123
- className: cn('scroll'),
131
+ className: cn('scroll', {
132
+ limit: !disableHeightLimit
133
+ }),
124
134
  ref: scrollRef,
125
135
  onScroll: handleTableScroll
126
136
  }, isTopShadow && /*#__PURE__*/React.createElement("div", {
@@ -140,6 +150,7 @@ Table.propTypes = {
140
150
  className: PropTypes.string,
141
151
  fixColumn: PropTypes.bool,
142
152
  minCellSize: PropTypes.oneOf(['small', 'large']),
153
+ disableHeightLimit: PropTypes.bool,
143
154
  children: PropTypes.arrayOf(PropTypes.element.isRequired).isRequired
144
155
  };
145
156
  var _default = Table;
@@ -3,6 +3,8 @@ import { ITableCell } from './TableCell';
3
3
  export interface ITableRow {
4
4
  /** Ряд таблицы как заголовок */
5
5
  head?: boolean;
6
+ /** Выравнивание по вертикали в ячейках таблицы */
7
+ vAlign?: 'default' | 'bottom' | 'top';
6
8
  children: Array<React.ReactElement<ITableCell>>;
7
9
  }
8
10
  declare const TableRow: React.FC<ITableRow>;
@@ -23,6 +23,8 @@ var TableRow = function TableRow(_ref) {
23
23
  TableRow.propTypes = {
24
24
  // eslint-disable-next-line react/no-unused-prop-types
25
25
  head: PropTypes.bool,
26
+ // eslint-disable-next-line react/no-unused-prop-types
27
+ vAlign: PropTypes.oneOf(['default', 'bottom', 'top']),
26
28
  children: PropTypes.arrayOf(PropTypes.element.isRequired).isRequired
27
29
  };
28
30
  var _default = TableRow;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Tabs } from '@megafon/ui-core';
3
- declare type TabsPropsType = React.ComponentProps<typeof Tabs> & {
3
+ export declare type TabsPropsType = React.ComponentProps<typeof Tabs> & {
4
4
  /** Ссылка на корневой элемент */
5
5
  rootRef?: React.Ref<HTMLDivElement>;
6
6
  };
@@ -38,12 +38,13 @@ var cn = (0, _uiHelpers.cnCreate)('mfui-tabs-box');
38
38
 
39
39
  var TabsBox = function TabsBox(_a) {
40
40
  var rootRef = _a.rootRef,
41
- props = __rest(_a, ["rootRef"]);
41
+ children = _a.children,
42
+ props = __rest(_a, ["rootRef", "children"]);
42
43
 
43
44
  return /*#__PURE__*/React.createElement("div", {
44
45
  ref: rootRef,
45
46
  className: cn()
46
- }, /*#__PURE__*/React.createElement(_uiCore.Tabs, props));
47
+ }, /*#__PURE__*/React.createElement(_uiCore.Tabs, props, children));
47
48
  };
48
49
 
49
50
  var _default = TabsBox;
@@ -40,7 +40,12 @@ var TextBox = function TextBox(_ref) {
40
40
 
41
41
  var renderTextBoxWithGrid = function renderTextBoxWithGrid() {
42
42
  return /*#__PURE__*/React.createElement(_uiCore.Grid, {
43
- hAlign: centeringWithLimitedWidth ? 'center' : 'left'
43
+ hAlign: centeringWithLimitedWidth ? 'center' : 'left',
44
+ dataAttrs: {
45
+ container: {
46
+ 'data-testid': 'TextBox-grid'
47
+ }
48
+ }
44
49
  }, /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
45
50
  wide: "8",
46
51
  desktop: "10",
@@ -23,6 +23,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
25
 
26
+ var testIdPrefix = 'TextWithIcon';
26
27
  var cn = (0, _uiHelpers.cnCreate)('mfui-text-with-icon');
27
28
 
28
29
  var TextWithIcon = function TextWithIcon(_ref) {
@@ -42,7 +43,13 @@ var TextWithIcon = function TextWithIcon(_ref) {
42
43
  };
43
44
 
44
45
  var renderContentWithGrid = function renderContentWithGrid() {
45
- return /*#__PURE__*/React.createElement(_uiCore.Grid, null, /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
46
+ return /*#__PURE__*/React.createElement(_uiCore.Grid, {
47
+ dataAttrs: {
48
+ container: {
49
+ 'data-testid': "".concat(testIdPrefix, "-grid")
50
+ }
51
+ }
52
+ }, /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
46
53
  mobile: '12',
47
54
  tablet: '7',
48
55
  desktop: '6',
@@ -25,6 +25,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
27
 
28
+ var testIdPrefix = 'TextWithIconItem';
28
29
  var cn = (0, _uiHelpers.cnCreate)('mfui-text-with-icon-item');
29
30
 
30
31
  var TextWithIconItem = function TextWithIconItem(_ref) {
@@ -48,9 +49,11 @@ var TextWithIconItem = function TextWithIconItem(_ref) {
48
49
  className: cn([className]),
49
50
  ref: rootRef
50
51
  }, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
51
- className: cn('svg-icon', [classes.icon])
52
+ className: cn('svg-icon', [classes.icon]),
53
+ "data-testid": "".concat(testIdPrefix, "-icon")
52
54
  }, icon), /*#__PURE__*/React.createElement("div", {
53
- className: cn('text', [classes.text])
55
+ className: cn('text', [classes.text]),
56
+ "data-testid": "".concat(testIdPrefix, "-text")
54
57
  }, renderText));
55
58
  };
56
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-shared",
3
- "version": "5.1.0",
3
+ "version": "5.2.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -82,7 +82,7 @@
82
82
  },
83
83
  "dependencies": {
84
84
  "@babel/runtime": "^7.8.4",
85
- "@megafon/ui-core": "^5.2.2",
85
+ "@megafon/ui-core": "^5.2.3",
86
86
  "@megafon/ui-helpers": "^2.5.3",
87
87
  "core-js": "^3.6.4",
88
88
  "htmr": "^0.9.2",
@@ -90,5 +90,5 @@
90
90
  "prop-types": "^15.7.2",
91
91
  "swiper": "^6.5.6"
92
92
  },
93
- "gitHead": "67d1595c72454846b31ebcd4acc8f7550a5f0df3"
93
+ "gitHead": "1bb6769da99d917f5dd4420892c57a7af5be3ab4"
94
94
  }