@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.
- package/CHANGELOG.md +20 -0
- package/dist/es/components/BenefitsIcons/BenefitsIcons.js +19 -116
- package/dist/es/components/BenefitsIcons/BenefitsIconsTile.js +3 -1
- package/dist/es/components/BenefitsIcons/helpers.d.ts +8 -0
- package/dist/es/components/BenefitsIcons/helpers.js +116 -0
- package/dist/es/components/ButtonBanner/ButtonBanner.js +5 -2
- package/dist/es/components/DownloadLinks/DownloadLink.js +1 -1
- package/dist/es/components/DownloadLinks/DownloadLinks.d.ts +10 -0
- package/dist/es/components/DownloadLinks/DownloadLinks.js +4 -4
- package/dist/es/components/Instructions/Instructions.js +11 -5
- package/dist/es/components/PageTitle/PageTitle.d.ts +2 -2
- package/dist/es/components/PageTitle/PageTitle.js +8 -1
- package/dist/es/components/Partners/Partners.js +12 -2
- package/dist/es/components/PictureWithDescription/PictureWithDescription.js +5 -2
- package/dist/es/components/Property/Property.js +2 -2
- package/dist/es/components/Property/types.d.ts +1 -1
- package/dist/es/components/StoreBanner/StoreBanner.js +5 -2
- package/dist/es/components/Table/Table.css +10 -1
- package/dist/es/components/Table/Table.d.ts +2 -0
- package/dist/es/components/Table/Table.js +17 -6
- package/dist/es/components/Table/TableRow.d.ts +2 -0
- package/dist/es/components/Table/TableRow.js +2 -0
- package/dist/es/components/TabsBox/TabsBox.d.ts +1 -1
- package/dist/es/components/TabsBox/TabsBox.js +3 -2
- package/dist/es/components/TextBox/TextBox.js +6 -1
- package/dist/es/components/TextWithIcon/TextWithIcon.js +8 -1
- package/dist/es/components/TextWithIcon/TextWithIconItem.js +5 -2
- package/dist/lib/components/BenefitsIcons/BenefitsIcons.js +21 -116
- package/dist/lib/components/BenefitsIcons/BenefitsIconsTile.js +3 -1
- package/dist/lib/components/BenefitsIcons/helpers.d.ts +8 -0
- package/dist/lib/components/BenefitsIcons/helpers.js +135 -0
- package/dist/lib/components/ButtonBanner/ButtonBanner.js +5 -2
- package/dist/lib/components/DownloadLinks/DownloadLink.js +1 -1
- package/dist/lib/components/DownloadLinks/DownloadLinks.d.ts +10 -0
- package/dist/lib/components/DownloadLinks/DownloadLinks.js +5 -2
- package/dist/lib/components/Instructions/Instructions.js +11 -5
- package/dist/lib/components/PageTitle/PageTitle.d.ts +2 -2
- package/dist/lib/components/PageTitle/PageTitle.js +8 -1
- package/dist/lib/components/Partners/Partners.js +12 -2
- package/dist/lib/components/PictureWithDescription/PictureWithDescription.js +5 -2
- package/dist/lib/components/Property/Property.js +2 -2
- package/dist/lib/components/Property/types.d.ts +1 -1
- package/dist/lib/components/StoreBanner/StoreBanner.js +5 -2
- package/dist/lib/components/Table/Table.css +10 -1
- package/dist/lib/components/Table/Table.d.ts +2 -0
- package/dist/lib/components/Table/Table.js +17 -6
- package/dist/lib/components/Table/TableRow.d.ts +2 -0
- package/dist/lib/components/Table/TableRow.js +2 -0
- package/dist/lib/components/TabsBox/TabsBox.d.ts +1 -1
- package/dist/lib/components/TabsBox/TabsBox.js +3 -2
- package/dist/lib/components/TextBox/TextBox.js +6 -1
- package/dist/lib/components/TextWithIcon/TextWithIcon.js +8 -1
- package/dist/lib/components/TextWithIcon/TextWithIconItem.js +5 -2
- package/package.json +3 -3
@@ -14,6 +14,8 @@ var Table = function Table(_ref) {
|
|
14
14
|
fixColumn = _ref$fixColumn === void 0 ? true : _ref$fixColumn,
|
15
15
|
_ref$minCellSize = _ref.minCellSize,
|
16
16
|
minCellSize = _ref$minCellSize === void 0 ? 'large' : _ref$minCellSize,
|
17
|
+
_ref$disableHeightLim = _ref.disableHeightLimit,
|
18
|
+
disableHeightLimit = _ref$disableHeightLim === void 0 ? false : _ref$disableHeightLim,
|
17
19
|
children = _ref.children;
|
18
20
|
var scrollRef = React.useRef(null);
|
19
21
|
|
@@ -75,17 +77,23 @@ var Table = function Table(_ref) {
|
|
75
77
|
}, []);
|
76
78
|
|
77
79
|
var renderRows = function renderRows() {
|
78
|
-
return React.Children.map(children, function (_ref2) {
|
80
|
+
return React.Children.map(children, function (_ref2, index) {
|
79
81
|
var _ref2$props = _ref2.props,
|
80
82
|
cells = _ref2$props.children,
|
81
|
-
head = _ref2$props.head
|
83
|
+
head = _ref2$props.head,
|
84
|
+
_ref2$props$vAlign = _ref2$props.vAlign,
|
85
|
+
vAlign = _ref2$props$vAlign === void 0 ? 'default' : _ref2$props$vAlign;
|
82
86
|
return /*#__PURE__*/React.createElement("tr", {
|
87
|
+
key: index,
|
83
88
|
className: cn('row', {
|
84
|
-
head: head
|
85
|
-
|
86
|
-
|
89
|
+
head: head,
|
90
|
+
align: vAlign
|
91
|
+
}),
|
92
|
+
"data-testid": "Table-row"
|
93
|
+
}, React.Children.map(cells, function (_ref3, cellIndex) {
|
87
94
|
var cell = _ref3.props.children;
|
88
95
|
return /*#__PURE__*/React.createElement("td", {
|
96
|
+
key: cellIndex,
|
89
97
|
className: cn('cell')
|
90
98
|
}, typeof cell === 'string' ? convert(cell) : cell);
|
91
99
|
}));
|
@@ -99,7 +107,9 @@ var Table = function Table(_ref) {
|
|
99
107
|
touch: isTouchDevice
|
100
108
|
}, [className])
|
101
109
|
}, /*#__PURE__*/React.createElement("div", {
|
102
|
-
className: cn('scroll'
|
110
|
+
className: cn('scroll', {
|
111
|
+
limit: !disableHeightLimit
|
112
|
+
}),
|
103
113
|
ref: scrollRef,
|
104
114
|
onScroll: handleTableScroll
|
105
115
|
}, isTopShadow && /*#__PURE__*/React.createElement("div", {
|
@@ -119,6 +129,7 @@ Table.propTypes = {
|
|
119
129
|
className: PropTypes.string,
|
120
130
|
fixColumn: PropTypes.bool,
|
121
131
|
minCellSize: PropTypes.oneOf(['small', 'large']),
|
132
|
+
disableHeightLimit: PropTypes.bool,
|
122
133
|
children: PropTypes.arrayOf(PropTypes.element.isRequired).isRequired
|
123
134
|
};
|
124
135
|
export 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>;
|
@@ -9,6 +9,8 @@ var TableRow = function TableRow(_ref) {
|
|
9
9
|
TableRow.propTypes = {
|
10
10
|
// eslint-disable-next-line react/no-unused-prop-types
|
11
11
|
head: PropTypes.bool,
|
12
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
13
|
+
vAlign: PropTypes.oneOf(['default', 'bottom', 'top']),
|
12
14
|
children: PropTypes.arrayOf(PropTypes.element.isRequired).isRequired
|
13
15
|
};
|
14
16
|
export 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
|
};
|
@@ -21,12 +21,13 @@ var cn = cnCreate('mfui-tabs-box');
|
|
21
21
|
|
22
22
|
var TabsBox = function TabsBox(_a) {
|
23
23
|
var rootRef = _a.rootRef,
|
24
|
-
|
24
|
+
children = _a.children,
|
25
|
+
props = __rest(_a, ["rootRef", "children"]);
|
25
26
|
|
26
27
|
return /*#__PURE__*/React.createElement("div", {
|
27
28
|
ref: rootRef,
|
28
29
|
className: cn()
|
29
|
-
}, /*#__PURE__*/React.createElement(Tabs, props));
|
30
|
+
}, /*#__PURE__*/React.createElement(Tabs, props, children));
|
30
31
|
};
|
31
32
|
|
32
33
|
export default TabsBox;
|
@@ -24,7 +24,12 @@ var TextBox = function TextBox(_ref) {
|
|
24
24
|
|
25
25
|
var renderTextBoxWithGrid = function renderTextBoxWithGrid() {
|
26
26
|
return /*#__PURE__*/React.createElement(Grid, {
|
27
|
-
hAlign: centeringWithLimitedWidth ? 'center' : 'left'
|
27
|
+
hAlign: centeringWithLimitedWidth ? 'center' : 'left',
|
28
|
+
dataAttrs: {
|
29
|
+
container: {
|
30
|
+
'data-testid': 'TextBox-grid'
|
31
|
+
}
|
32
|
+
}
|
28
33
|
}, /*#__PURE__*/React.createElement(GridColumn, {
|
29
34
|
wide: "8",
|
30
35
|
desktop: "10",
|
@@ -4,6 +4,7 @@ import { Header, Grid, GridColumn } from '@megafon/ui-core';
|
|
4
4
|
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
5
5
|
import * as PropTypes from 'prop-types';
|
6
6
|
import "./TextWithIcon.css";
|
7
|
+
var testIdPrefix = 'TextWithIcon';
|
7
8
|
var cn = cnCreate('mfui-text-with-icon');
|
8
9
|
|
9
10
|
var TextWithIcon = function TextWithIcon(_ref) {
|
@@ -23,7 +24,13 @@ var TextWithIcon = function TextWithIcon(_ref) {
|
|
23
24
|
};
|
24
25
|
|
25
26
|
var renderContentWithGrid = function renderContentWithGrid() {
|
26
|
-
return /*#__PURE__*/React.createElement(Grid,
|
27
|
+
return /*#__PURE__*/React.createElement(Grid, {
|
28
|
+
dataAttrs: {
|
29
|
+
container: {
|
30
|
+
'data-testid': "".concat(testIdPrefix, "-grid")
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}, /*#__PURE__*/React.createElement(GridColumn, {
|
27
34
|
mobile: '12',
|
28
35
|
tablet: '7',
|
29
36
|
desktop: '6',
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
5
5
|
import { cnCreate, convert, filterDataAttrs, textConvertConfig } from '@megafon/ui-helpers';
|
6
6
|
import * as PropTypes from 'prop-types';
|
7
7
|
import "./TextWithIconItem.css";
|
8
|
+
var testIdPrefix = 'TextWithIconItem';
|
8
9
|
var cn = cnCreate('mfui-text-with-icon-item');
|
9
10
|
|
10
11
|
var TextWithIconItem = function TextWithIconItem(_ref) {
|
@@ -28,9 +29,11 @@ var TextWithIconItem = function TextWithIconItem(_ref) {
|
|
28
29
|
className: cn([className]),
|
29
30
|
ref: rootRef
|
30
31
|
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
|
31
|
-
className: cn('svg-icon', [classes.icon])
|
32
|
+
className: cn('svg-icon', [classes.icon]),
|
33
|
+
"data-testid": "".concat(testIdPrefix, "-icon")
|
32
34
|
}, icon), /*#__PURE__*/React.createElement("div", {
|
33
|
-
className: cn('text', [classes.text])
|
35
|
+
className: cn('text', [classes.text]),
|
36
|
+
"data-testid": "".concat(testIdPrefix, "-text")
|
34
37
|
}, renderText));
|
35
38
|
};
|
36
39
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports["default"] = void 0;
|
9
9
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
11
|
-
|
12
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
11
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
|
+
|
14
14
|
require("core-js/modules/es.array.map.js");
|
15
15
|
|
16
16
|
require("core-js/modules/es.object.values.js");
|
@@ -29,6 +29,8 @@ var _throttleTime = _interopRequireDefault(require("../../constants/throttleTime
|
|
29
29
|
|
30
30
|
var _BenefitsIconsTile = _interopRequireDefault(require("./BenefitsIconsTile"));
|
31
31
|
|
32
|
+
var _helpers = _interopRequireWildcard(require("./helpers"));
|
33
|
+
|
32
34
|
var _types = require("./types");
|
33
35
|
|
34
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -37,117 +39,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
37
39
|
|
38
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
39
41
|
|
40
|
-
var
|
41
|
-
var everySecondWithoutOffset = index % 2 ? '1' : undefined;
|
42
|
-
var columnSize = {
|
43
|
-
wide: '4',
|
44
|
-
desktop: '5',
|
45
|
-
tablet: '10'
|
46
|
-
};
|
47
|
-
|
48
|
-
switch (count) {
|
49
|
-
case 2:
|
50
|
-
case 4:
|
51
|
-
return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
|
52
|
-
leftOffsetWide: everySecondWithoutOffset,
|
53
|
-
leftOffsetDesktop: everySecondWithoutOffset
|
54
|
-
});
|
55
|
-
|
56
|
-
default:
|
57
|
-
return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
|
58
|
-
leftOffsetDesktop: everySecondWithoutOffset
|
59
|
-
});
|
60
|
-
}
|
61
|
-
}; // left-aligned column with left-aligned icon on top
|
62
|
-
|
63
|
-
|
64
|
-
var getLeftTopConfig = function getLeftTopConfig(count, index) {
|
65
|
-
var everySecondWithoutOffset = index % 2 ? '1' : undefined;
|
66
|
-
var everyThirdWithoutOffset = index % 3 ? '1' : undefined;
|
67
|
-
|
68
|
-
switch (count) {
|
69
|
-
case 2:
|
70
|
-
return {
|
71
|
-
wide: '4',
|
72
|
-
desktop: '4',
|
73
|
-
tablet: '5',
|
74
|
-
leftOffsetWide: everySecondWithoutOffset,
|
75
|
-
leftOffsetDesktop: everySecondWithoutOffset,
|
76
|
-
leftOffsetTablet: everySecondWithoutOffset
|
77
|
-
};
|
78
|
-
|
79
|
-
case 4:
|
80
|
-
return {
|
81
|
-
wide: '3',
|
82
|
-
desktop: '4',
|
83
|
-
tablet: '5',
|
84
|
-
leftOffsetDesktop: everySecondWithoutOffset,
|
85
|
-
leftOffsetTablet: everySecondWithoutOffset
|
86
|
-
};
|
87
|
-
|
88
|
-
default:
|
89
|
-
return {
|
90
|
-
wide: '3',
|
91
|
-
desktop: '4',
|
92
|
-
tablet: '5',
|
93
|
-
leftOffsetWide: everyThirdWithoutOffset,
|
94
|
-
leftOffsetTablet: everySecondWithoutOffset
|
95
|
-
};
|
96
|
-
}
|
97
|
-
}; // center-aligned column with center-aligned icon on top
|
98
|
-
|
99
|
-
|
100
|
-
var getCenterTopConfig = function getCenterTopConfig(count, index) {
|
101
|
-
var isEvenIndex = !(index % 2);
|
102
|
-
var everyEvenWithLeftOffset = isEvenIndex ? '1' : undefined;
|
103
|
-
var everyOddWithRightOffset = isEvenIndex ? undefined : '1';
|
104
|
-
|
105
|
-
switch (count) {
|
106
|
-
case 4:
|
107
|
-
return {
|
108
|
-
wide: '3',
|
109
|
-
desktop: '5',
|
110
|
-
tablet: '5',
|
111
|
-
leftOffsetDesktop: everyEvenWithLeftOffset,
|
112
|
-
leftOffsetTablet: everyEvenWithLeftOffset,
|
113
|
-
rightOffsetTablet: everyOddWithRightOffset,
|
114
|
-
rightOffsetDesktop: everyOddWithRightOffset
|
115
|
-
};
|
116
|
-
|
117
|
-
default:
|
118
|
-
return {
|
119
|
-
wide: '4',
|
120
|
-
desktop: '4',
|
121
|
-
tablet: '4'
|
122
|
-
};
|
123
|
-
}
|
124
|
-
};
|
125
|
-
|
126
|
-
var getOneColumnConfig = function getOneColumnConfig(iconPosition) {
|
127
|
-
return iconPosition !== _types.IconPositionEnum.CENTER_TOP ? {
|
128
|
-
wide: '10',
|
129
|
-
desktop: '10',
|
130
|
-
tablet: '10'
|
131
|
-
} : {
|
132
|
-
wide: '12',
|
133
|
-
desktop: '12',
|
134
|
-
tablet: '12'
|
135
|
-
};
|
136
|
-
};
|
137
|
-
|
138
|
-
var getMultiColumnConfig = function getMultiColumnConfig(iconPosition, count, index) {
|
139
|
-
switch (iconPosition) {
|
140
|
-
case _types.IconPositionEnum.LEFT_TOP:
|
141
|
-
return getLeftTopConfig(count, index);
|
142
|
-
|
143
|
-
case _types.IconPositionEnum.CENTER_TOP:
|
144
|
-
return getCenterTopConfig(count, index);
|
145
|
-
|
146
|
-
default:
|
147
|
-
return getLeftSideConfig(count, index);
|
148
|
-
}
|
149
|
-
};
|
150
|
-
|
42
|
+
var testIdPrefix = 'BenefitsIcons';
|
151
43
|
var cn = (0, _uiHelpers.cnCreate)('mfui-benefits-icons');
|
152
44
|
|
153
45
|
var BenefitsIcons = function BenefitsIcons(_ref) {
|
@@ -202,15 +94,28 @@ var BenefitsIcons = function BenefitsIcons(_ref) {
|
|
202
94
|
}, /*#__PURE__*/React.createElement(_uiCore.Grid, {
|
203
95
|
className: classes.grid,
|
204
96
|
guttersLeft: "medium",
|
205
|
-
hAlign: itemsAlign
|
97
|
+
hAlign: itemsAlign,
|
98
|
+
dataAttrs: {
|
99
|
+
root: {
|
100
|
+
'data-testid': "".concat(testIdPrefix, "-grid-root")
|
101
|
+
},
|
102
|
+
container: {
|
103
|
+
'data-testid': "".concat(testIdPrefix, "-grid-container")
|
104
|
+
}
|
105
|
+
}
|
206
106
|
}, items.map(function (_ref2, i) {
|
207
107
|
var title = _ref2.title,
|
208
108
|
text = _ref2.text,
|
209
109
|
icon = _ref2.icon;
|
210
|
-
var columnConfig = inOneColumn ? getOneColumnConfig(iconPosition) :
|
110
|
+
var columnConfig = inOneColumn ? (0, _helpers.getOneColumnConfig)(iconPosition) : (0, _helpers["default"])(iconPosition, items.length, i);
|
211
111
|
return /*#__PURE__*/React.createElement(_uiCore.GridColumn, (0, _extends2["default"])({
|
212
112
|
className: classes.gridColumn,
|
213
|
-
key: i
|
113
|
+
key: i,
|
114
|
+
dataAttrs: {
|
115
|
+
root: {
|
116
|
+
'data-testid': "".concat(testIdPrefix, "-grid-column")
|
117
|
+
}
|
118
|
+
}
|
214
119
|
}, columnConfig), /*#__PURE__*/React.createElement(_BenefitsIconsTile["default"], {
|
215
120
|
className: cn('tile', [classes.item]),
|
216
121
|
title: title,
|
@@ -25,6 +25,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
25
25
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
27
27
|
|
28
|
+
var testIdPrefix = 'BenefitsIconsTile';
|
28
29
|
var cn = (0, _uiHelpers.cnCreate)('mfui-benefits-icons-tile');
|
29
30
|
|
30
31
|
var BenefitsIconsTile = function BenefitsIconsTile(_ref) {
|
@@ -37,7 +38,8 @@ var BenefitsIconsTile = function BenefitsIconsTile(_ref) {
|
|
37
38
|
return /*#__PURE__*/React.createElement("div", {
|
38
39
|
className: cn({
|
39
40
|
'icon-position': iconPosition
|
40
|
-
}, [className])
|
41
|
+
}, [className]),
|
42
|
+
"data-testid": "".concat(testIdPrefix, "-root")
|
41
43
|
}, /*#__PURE__*/React.createElement("div", {
|
42
44
|
className: cn('svg-icon')
|
43
45
|
}, icon), /*#__PURE__*/React.createElement("div", {
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { GridConfig } from './types';
|
2
|
+
declare const getLeftSideConfig: (count: number, index: number) => GridConfig;
|
3
|
+
declare const getLeftTopConfig: (count: number, index: number) => GridConfig;
|
4
|
+
declare const getCenterTopConfig: (count: number, index: number) => GridConfig;
|
5
|
+
declare const getOneColumnConfig: (iconPosition: "left-top" | "center-top" | "left-side") => GridConfig;
|
6
|
+
declare const getMultiColumnConfig: (iconPosition: "left-top" | "center-top" | "left-side", count: number, index: number) => GridConfig;
|
7
|
+
export default getMultiColumnConfig;
|
8
|
+
export { getLeftSideConfig, getLeftTopConfig, getCenterTopConfig, getOneColumnConfig };
|
@@ -0,0 +1,135 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getOneColumnConfig = exports.getCenterTopConfig = exports.getLeftTopConfig = exports.getLeftSideConfig = exports["default"] = void 0;
|
7
|
+
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
|
10
|
+
var _types = require("./types");
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13
|
+
|
14
|
+
// left-aligned column with left side icon
|
15
|
+
var getLeftSideConfig = function getLeftSideConfig(count, index) {
|
16
|
+
var everySecondWithoutOffset = index % 2 ? '1' : undefined;
|
17
|
+
var columnSize = {
|
18
|
+
wide: '4',
|
19
|
+
desktop: '5',
|
20
|
+
tablet: '10'
|
21
|
+
};
|
22
|
+
|
23
|
+
switch (count) {
|
24
|
+
case 2:
|
25
|
+
case 4:
|
26
|
+
return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
|
27
|
+
leftOffsetWide: everySecondWithoutOffset,
|
28
|
+
leftOffsetDesktop: everySecondWithoutOffset
|
29
|
+
});
|
30
|
+
|
31
|
+
default:
|
32
|
+
return (0, _extends2["default"])((0, _extends2["default"])({}, columnSize), {
|
33
|
+
leftOffsetDesktop: everySecondWithoutOffset
|
34
|
+
});
|
35
|
+
}
|
36
|
+
}; // left-aligned column with left-aligned icon on top
|
37
|
+
|
38
|
+
|
39
|
+
exports.getLeftSideConfig = getLeftSideConfig;
|
40
|
+
|
41
|
+
var getLeftTopConfig = function getLeftTopConfig(count, index) {
|
42
|
+
var everySecondWithoutOffset = index % 2 ? '1' : undefined;
|
43
|
+
var everyThirdWithoutOffset = index % 3 ? '1' : undefined;
|
44
|
+
|
45
|
+
switch (count) {
|
46
|
+
case 2:
|
47
|
+
return {
|
48
|
+
wide: '4',
|
49
|
+
desktop: '4',
|
50
|
+
tablet: '5',
|
51
|
+
leftOffsetWide: everySecondWithoutOffset,
|
52
|
+
leftOffsetDesktop: everySecondWithoutOffset,
|
53
|
+
leftOffsetTablet: everySecondWithoutOffset
|
54
|
+
};
|
55
|
+
|
56
|
+
case 4:
|
57
|
+
return {
|
58
|
+
wide: '3',
|
59
|
+
desktop: '4',
|
60
|
+
tablet: '5',
|
61
|
+
leftOffsetDesktop: everySecondWithoutOffset,
|
62
|
+
leftOffsetTablet: everySecondWithoutOffset
|
63
|
+
};
|
64
|
+
|
65
|
+
default:
|
66
|
+
return {
|
67
|
+
wide: '3',
|
68
|
+
desktop: '4',
|
69
|
+
tablet: '5',
|
70
|
+
leftOffsetWide: everyThirdWithoutOffset,
|
71
|
+
leftOffsetTablet: everySecondWithoutOffset
|
72
|
+
};
|
73
|
+
}
|
74
|
+
}; // center-aligned column with center-aligned icon on top
|
75
|
+
|
76
|
+
|
77
|
+
exports.getLeftTopConfig = getLeftTopConfig;
|
78
|
+
|
79
|
+
var getCenterTopConfig = function getCenterTopConfig(count, index) {
|
80
|
+
var isEvenIndex = !(index % 2);
|
81
|
+
var everyEvenWithLeftOffset = isEvenIndex ? '1' : undefined;
|
82
|
+
var everyOddWithRightOffset = isEvenIndex ? undefined : '1';
|
83
|
+
|
84
|
+
switch (count) {
|
85
|
+
case 4:
|
86
|
+
return {
|
87
|
+
wide: '3',
|
88
|
+
desktop: '5',
|
89
|
+
tablet: '5',
|
90
|
+
leftOffsetDesktop: everyEvenWithLeftOffset,
|
91
|
+
leftOffsetTablet: everyEvenWithLeftOffset,
|
92
|
+
rightOffsetTablet: everyOddWithRightOffset,
|
93
|
+
rightOffsetDesktop: everyOddWithRightOffset
|
94
|
+
};
|
95
|
+
|
96
|
+
default:
|
97
|
+
return {
|
98
|
+
wide: '4',
|
99
|
+
desktop: '4',
|
100
|
+
tablet: '4'
|
101
|
+
};
|
102
|
+
}
|
103
|
+
};
|
104
|
+
|
105
|
+
exports.getCenterTopConfig = getCenterTopConfig;
|
106
|
+
|
107
|
+
var getOneColumnConfig = function getOneColumnConfig(iconPosition) {
|
108
|
+
return iconPosition !== _types.IconPositionEnum.CENTER_TOP ? {
|
109
|
+
wide: '10',
|
110
|
+
desktop: '10',
|
111
|
+
tablet: '10'
|
112
|
+
} : {
|
113
|
+
wide: '12',
|
114
|
+
desktop: '12',
|
115
|
+
tablet: '12'
|
116
|
+
};
|
117
|
+
};
|
118
|
+
|
119
|
+
exports.getOneColumnConfig = getOneColumnConfig;
|
120
|
+
|
121
|
+
var getMultiColumnConfig = function getMultiColumnConfig(iconPosition, count, index) {
|
122
|
+
switch (iconPosition) {
|
123
|
+
case _types.IconPositionEnum.LEFT_TOP:
|
124
|
+
return getLeftTopConfig(count, index);
|
125
|
+
|
126
|
+
case _types.IconPositionEnum.CENTER_TOP:
|
127
|
+
return getCenterTopConfig(count, index);
|
128
|
+
|
129
|
+
default:
|
130
|
+
return getLeftSideConfig(count, index);
|
131
|
+
}
|
132
|
+
};
|
133
|
+
|
134
|
+
var _default = getMultiColumnConfig;
|
135
|
+
exports["default"] = _default;
|
@@ -48,6 +48,7 @@ var getMediaStyle = function getMediaStyle(imageUrl) {
|
|
48
48
|
};
|
49
49
|
|
50
50
|
var cn = (0, _uiHelpers.cnCreate)('mfui-button-banner');
|
51
|
+
var testIdPrefix = 'ButtonBanner';
|
51
52
|
|
52
53
|
var ButtonBanner = function ButtonBanner(_ref) {
|
53
54
|
var dataAttrs = _ref.dataAttrs,
|
@@ -99,7 +100,8 @@ var ButtonBanner = function ButtonBanner(_ref) {
|
|
99
100
|
leftOffsetDesktop: "1",
|
100
101
|
leftOffsetWide: "1"
|
101
102
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
102
|
-
className: cn('content')
|
103
|
+
className: cn('content'),
|
104
|
+
"data-testid": "".concat(testIdPrefix, "-content")
|
103
105
|
}, /*#__PURE__*/_react["default"].createElement(_uiCore.Header, {
|
104
106
|
className: cn('header'),
|
105
107
|
as: "h2"
|
@@ -110,7 +112,8 @@ var ButtonBanner = function ButtonBanner(_ref) {
|
|
110
112
|
mobile: "12"
|
111
113
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
112
114
|
className: cn('media'),
|
113
|
-
style: getMediaStyle(imageUrl)
|
115
|
+
style: getMediaStyle(imageUrl),
|
116
|
+
"data-testid": "".concat(testIdPrefix, "-media")
|
114
117
|
}, !imageUrl && buttonElem))));
|
115
118
|
};
|
116
119
|
|
@@ -65,7 +65,7 @@ var DownloadLink = function DownloadLink(_ref) {
|
|
65
65
|
className: cn('link', [classes.link])
|
66
66
|
}, text), /*#__PURE__*/React.createElement("p", {
|
67
67
|
className: cn('info')
|
68
|
-
}, "".concat(extension).concat(extension && fileSize ? ',' : ''
|
68
|
+
}, "".concat(extension).concat(extension && fileSize ? ', ' : '').concat(fileSize))));
|
69
69
|
};
|
70
70
|
|
71
71
|
DownloadLink.propTypes = {
|
@@ -1,6 +1,16 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
+
import { GridColumn } from '@megafon/ui-core';
|
2
3
|
import './DownloadLinks.less';
|
3
4
|
import { IDownloadLink } from './DownloadLink';
|
5
|
+
declare type GridColumnType = React.ComponentProps<typeof GridColumn>;
|
6
|
+
declare type ColumnConfig = {
|
7
|
+
wide?: GridColumnType['wide'];
|
8
|
+
desktop?: GridColumnType['desktop'];
|
9
|
+
tablet?: GridColumnType['tablet'];
|
10
|
+
mobile?: GridColumnType['mobile'];
|
11
|
+
all?: GridColumnType['all'];
|
12
|
+
};
|
13
|
+
export declare const getColumnConfig: (itemsCount: number) => ColumnConfig;
|
4
14
|
interface IDownloadLinks {
|
5
15
|
/** Выстраивать ссылки в одну колонку вне зависимости от количества */
|
6
16
|
inOneColumn?: boolean;
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
6
6
|
value: true
|
7
7
|
});
|
8
|
-
exports["default"] = void 0;
|
8
|
+
exports["default"] = exports.getColumnConfig = void 0;
|
9
9
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
11
|
|
@@ -55,6 +55,8 @@ var getColumnConfig = function getColumnConfig(itemsCount) {
|
|
55
55
|
}
|
56
56
|
};
|
57
57
|
|
58
|
+
exports.getColumnConfig = getColumnConfig;
|
59
|
+
var testIdPrefix = 'DownloadLinks';
|
58
60
|
var cn = (0, _uiHelpers.cnCreate)('mfui-download-links');
|
59
61
|
|
60
62
|
var DownloadLinks = function DownloadLinks(_ref) {
|
@@ -64,7 +66,8 @@ var DownloadLinks = function DownloadLinks(_ref) {
|
|
64
66
|
|
65
67
|
if (inOneColumn) {
|
66
68
|
return /*#__PURE__*/React.createElement("div", {
|
67
|
-
className: cn()
|
69
|
+
className: cn(),
|
70
|
+
"data-testid": "".concat(testIdPrefix, "-oneColumn")
|
68
71
|
}, React.Children.map(children, function (child) {
|
69
72
|
return /*#__PURE__*/React.createElement("div", {
|
70
73
|
className: cn('item')
|
@@ -46,6 +46,7 @@ var pictureMaskTypes = {
|
|
46
46
|
NONE: 'none'
|
47
47
|
};
|
48
48
|
exports.pictureMaskTypes = pictureMaskTypes;
|
49
|
+
var testIdPrefix = 'Instructions';
|
49
50
|
var cn = (0, _uiHelpers.cnCreate)('mfui-instructions');
|
50
51
|
var swiperSlideCn = cn('slide');
|
51
52
|
|
@@ -169,7 +170,8 @@ var Instructions = function Instructions(_ref) {
|
|
169
170
|
}
|
170
171
|
|
171
172
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
172
|
-
className: cn('img-wrapper')
|
173
|
+
className: cn('img-wrapper'),
|
174
|
+
"data-testid": "".concat(testIdPrefix, "-img-wrapper")
|
173
175
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
174
176
|
className: cn('device-screen')
|
175
177
|
}), renderSlider());
|
@@ -180,7 +182,8 @@ var Instructions = function Instructions(_ref) {
|
|
180
182
|
className: cn('articles-list', {
|
181
183
|
'text-after': !!text,
|
182
184
|
desktop: true
|
183
|
-
})
|
185
|
+
}),
|
186
|
+
"data-testid": "".concat(testIdPrefix, "-articles-list-desktop")
|
184
187
|
}, instructionItems.map(function (_ref4, i) {
|
185
188
|
var itemTitle = _ref4.title;
|
186
189
|
return (
|
@@ -208,7 +211,8 @@ var Instructions = function Instructions(_ref) {
|
|
208
211
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
209
212
|
className: cn('articles-list', {
|
210
213
|
mobile: true
|
211
|
-
})
|
214
|
+
}),
|
215
|
+
"data-testid": "".concat(testIdPrefix, "-articles-list-mobile")
|
212
216
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
213
217
|
className: cn('articles-title-block')
|
214
218
|
}, instructionItems.map(function (_ref5, i) {
|
@@ -222,7 +226,8 @@ var Instructions = function Instructions(_ref) {
|
|
222
226
|
})), /*#__PURE__*/_react["default"].createElement("ul", {
|
223
227
|
className: cn('articles-dots', {
|
224
228
|
'text-after': !!text
|
225
|
-
})
|
229
|
+
}),
|
230
|
+
"data-testid": "".concat(testIdPrefix, "-articles-dots-mobile")
|
226
231
|
}, instructionItems.map(function (_item, i) {
|
227
232
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1), {
|
228
233
|
key: i,
|
@@ -251,7 +256,8 @@ var Instructions = function Instructions(_ref) {
|
|
251
256
|
className: cn('picture', {
|
252
257
|
align: pictureAlign,
|
253
258
|
'vertical-align': pictureVerticalAlign
|
254
|
-
})
|
259
|
+
}),
|
260
|
+
"data-testid": "".concat(testIdPrefix, "-picture")
|
255
261
|
}, renderPicture()), /*#__PURE__*/_react["default"].createElement("div", {
|
256
262
|
className: cn('articles', {
|
257
263
|
align: pictureAlign
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import './PageTitle.less';
|
3
3
|
import { Props as BreadcrumbsType } from '../Breadcrumbs/Breadcrumbs';
|
4
|
-
declare type
|
4
|
+
export declare type PageTitleProps = {
|
5
5
|
/** Дополнительные data атрибуты к внутренним элементам */
|
6
6
|
dataAttrs?: {
|
7
7
|
root?: Record<string, string>;
|
@@ -27,5 +27,5 @@ declare type Props = {
|
|
27
27
|
/** Ссылка на корневой элемент */
|
28
28
|
rootRef?: React.RefObject<HTMLDivElement>;
|
29
29
|
};
|
30
|
-
declare const PageTitle: React.FC<
|
30
|
+
declare const PageTitle: React.FC<PageTitleProps>;
|
31
31
|
export default PageTitle;
|