@megafon/ui-shared 5.0.1 → 5.2.0

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 (42) hide show
  1. package/CHANGELOG.md +29 -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/BenefitsPictures/BenefitsPictures.d.ts +1 -0
  7. package/dist/es/components/BenefitsPictures/BenefitsPictures.js +12 -102
  8. package/dist/es/components/BenefitsPictures/helpers.d.ts +11 -0
  9. package/dist/es/components/BenefitsPictures/helpers.js +99 -0
  10. package/dist/es/components/Card/Card.css +5 -1
  11. package/dist/es/components/Card/Card.d.ts +9 -1
  12. package/dist/es/components/Card/Card.js +15 -4
  13. package/dist/es/components/Property/Property.js +2 -2
  14. package/dist/es/components/Property/types.d.ts +1 -1
  15. package/dist/es/components/Table/Table.css +10 -1
  16. package/dist/es/components/Table/Table.d.ts +2 -0
  17. package/dist/es/components/Table/Table.js +17 -6
  18. package/dist/es/components/Table/TableRow.d.ts +2 -0
  19. package/dist/es/components/Table/TableRow.js +2 -0
  20. package/dist/es/index.d.ts +0 -1
  21. package/dist/es/index.js +0 -1
  22. package/dist/lib/components/BenefitsIcons/BenefitsIcons.js +21 -116
  23. package/dist/lib/components/BenefitsIcons/BenefitsIconsTile.js +3 -1
  24. package/dist/lib/components/BenefitsIcons/helpers.d.ts +8 -0
  25. package/dist/lib/components/BenefitsIcons/helpers.js +135 -0
  26. package/dist/lib/components/BenefitsPictures/BenefitsPictures.d.ts +1 -0
  27. package/dist/lib/components/BenefitsPictures/BenefitsPictures.js +16 -104
  28. package/dist/lib/components/BenefitsPictures/helpers.d.ts +11 -0
  29. package/dist/lib/components/BenefitsPictures/helpers.js +122 -0
  30. package/dist/lib/components/Card/Card.css +5 -1
  31. package/dist/lib/components/Card/Card.d.ts +9 -1
  32. package/dist/lib/components/Card/Card.js +15 -4
  33. package/dist/lib/components/Property/Property.js +2 -2
  34. package/dist/lib/components/Property/types.d.ts +1 -1
  35. package/dist/lib/components/Table/Table.css +10 -1
  36. package/dist/lib/components/Table/Table.d.ts +2 -0
  37. package/dist/lib/components/Table/Table.js +17 -6
  38. package/dist/lib/components/Table/TableRow.d.ts +2 -0
  39. package/dist/lib/components/Table/TableRow.js +2 -0
  40. package/dist/lib/index.d.ts +0 -1
  41. package/dist/lib/index.js +0 -8
  42. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,35 @@
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
+ # [5.2.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-shared@5.1.0...@megafon/ui-shared@5.2.0) (2023-09-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * **property:** add type ReactNode to props item.value ([5f59136](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/5f59136ffdc6fc863a6910bd45f17c6783be19c8))
12
+ * **table:** add vAlign and disableHeightLimit props ([813b1ce](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/813b1ceef71576104d8c397cf372c52192daa258))
13
+
14
+
15
+
16
+
17
+
18
+ # [5.1.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-shared@5.0.1...@megafon/ui-shared@5.1.0) (2023-09-14)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **benefitpictures:** rename helpers ([282fcfe](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/282fcfec6f6fc8f0bec325c52f7ec5ada955e4ff))
24
+ * **dulpfile:** fix ignore rule ([525138b](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/525138bafeaa3836fa37997691da544419efd7fa))
25
+
26
+
27
+ ### Features
28
+
29
+ * **card:** add minor features ([e80582c](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/e80582c863f7baeaf17effe7566531f2f9a2c695))
30
+
31
+
32
+
33
+
34
+
6
35
  ## [5.0.1](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/compare/@megafon/ui-shared@5.0.0...@megafon/ui-shared@5.0.1) (2023-08-31)
7
36
 
8
37
 
@@ -1,5 +1,5 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "core-js/modules/es.array.map.js";
4
4
  import "core-js/modules/es.object.values.js";
5
5
  import * as React from 'react';
@@ -9,120 +9,10 @@ import throttle from 'lodash.throttle';
9
9
  import PropTypes from 'prop-types';
10
10
  import throttleTime from "../../constants/throttleTime";
11
11
  import BenefitsIconsTile from "./BenefitsIconsTile";
12
+ import getMultiColumnConfig, { getOneColumnConfig } from "./helpers";
12
13
  import { IconPositionEnum, ItemsAlignEnum } from "./types";
13
- import "./style/BenefitsIcons.css"; // left-aligned column with left side icon,
14
-
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 _extends(_extends({}, columnSize), {
27
- leftOffsetWide: everySecondWithoutOffset,
28
- leftOffsetDesktop: everySecondWithoutOffset
29
- });
30
-
31
- default:
32
- return _extends(_extends({}, columnSize), {
33
- leftOffsetDesktop: everySecondWithoutOffset
34
- });
35
- }
36
- }; // left-aligned column with left-aligned icon on top
37
-
38
-
39
- var getLeftTopConfig = function getLeftTopConfig(count, index) {
40
- var everySecondWithoutOffset = index % 2 ? '1' : undefined;
41
- var everyThirdWithoutOffset = index % 3 ? '1' : undefined;
42
-
43
- switch (count) {
44
- case 2:
45
- return {
46
- wide: '4',
47
- desktop: '4',
48
- tablet: '5',
49
- leftOffsetWide: everySecondWithoutOffset,
50
- leftOffsetDesktop: everySecondWithoutOffset,
51
- leftOffsetTablet: everySecondWithoutOffset
52
- };
53
-
54
- case 4:
55
- return {
56
- wide: '3',
57
- desktop: '4',
58
- tablet: '5',
59
- leftOffsetDesktop: everySecondWithoutOffset,
60
- leftOffsetTablet: everySecondWithoutOffset
61
- };
62
-
63
- default:
64
- return {
65
- wide: '3',
66
- desktop: '4',
67
- tablet: '5',
68
- leftOffsetWide: everyThirdWithoutOffset,
69
- leftOffsetTablet: everySecondWithoutOffset
70
- };
71
- }
72
- }; // center-aligned column with center-aligned icon on top
73
-
74
-
75
- var getCenterTopConfig = function getCenterTopConfig(count, index) {
76
- var isEvenIndex = !(index % 2);
77
- var everyEvenWithLeftOffset = isEvenIndex ? '1' : undefined;
78
- var everyOddWithRightOffset = isEvenIndex ? undefined : '1';
79
-
80
- switch (count) {
81
- case 4:
82
- return {
83
- wide: '3',
84
- desktop: '5',
85
- tablet: '5',
86
- leftOffsetDesktop: everyEvenWithLeftOffset,
87
- leftOffsetTablet: everyEvenWithLeftOffset,
88
- rightOffsetTablet: everyOddWithRightOffset,
89
- rightOffsetDesktop: everyOddWithRightOffset
90
- };
91
-
92
- default:
93
- return {
94
- wide: '4',
95
- desktop: '4',
96
- tablet: '4'
97
- };
98
- }
99
- };
100
-
101
- var getOneColumnConfig = function getOneColumnConfig(iconPosition) {
102
- return iconPosition !== IconPositionEnum.CENTER_TOP ? {
103
- wide: '10',
104
- desktop: '10',
105
- tablet: '10'
106
- } : {
107
- wide: '12',
108
- desktop: '12',
109
- tablet: '12'
110
- };
111
- };
112
-
113
- var getMultiColumnConfig = function getMultiColumnConfig(iconPosition, count, index) {
114
- switch (iconPosition) {
115
- case IconPositionEnum.LEFT_TOP:
116
- return getLeftTopConfig(count, index);
117
-
118
- case IconPositionEnum.CENTER_TOP:
119
- return getCenterTopConfig(count, index);
120
-
121
- default:
122
- return getLeftSideConfig(count, index);
123
- }
124
- };
125
-
14
+ import "./style/BenefitsIcons.css";
15
+ var testIdPrefix = 'BenefitsIcons';
126
16
  var cn = cnCreate('mfui-benefits-icons');
127
17
 
128
18
  var BenefitsIcons = function BenefitsIcons(_ref) {
@@ -177,7 +67,15 @@ var BenefitsIcons = function BenefitsIcons(_ref) {
177
67
  }, /*#__PURE__*/React.createElement(Grid, {
178
68
  className: classes.grid,
179
69
  guttersLeft: "medium",
180
- hAlign: itemsAlign
70
+ hAlign: itemsAlign,
71
+ dataAttrs: {
72
+ root: {
73
+ 'data-testid': "".concat(testIdPrefix, "-grid-root")
74
+ },
75
+ container: {
76
+ 'data-testid': "".concat(testIdPrefix, "-grid-container")
77
+ }
78
+ }
181
79
  }, items.map(function (_ref2, i) {
182
80
  var title = _ref2.title,
183
81
  text = _ref2.text,
@@ -185,7 +83,12 @@ var BenefitsIcons = function BenefitsIcons(_ref) {
185
83
  var columnConfig = inOneColumn ? getOneColumnConfig(iconPosition) : getMultiColumnConfig(iconPosition, items.length, i);
186
84
  return /*#__PURE__*/React.createElement(GridColumn, _extends({
187
85
  className: classes.gridColumn,
188
- key: i
86
+ key: i,
87
+ dataAttrs: {
88
+ root: {
89
+ 'data-testid': "".concat(testIdPrefix, "-grid-column")
90
+ }
91
+ }
189
92
  }, columnConfig), /*#__PURE__*/React.createElement(BenefitsIconsTile, {
190
93
  className: cn('tile', [classes.item]),
191
94
  title: title,
@@ -5,6 +5,7 @@ import { cnCreate } from '@megafon/ui-helpers';
5
5
  import PropTypes from 'prop-types';
6
6
  import { IconPositionEnum } from "./types";
7
7
  import "./style/BenefitsIconsTile.css";
8
+ var testIdPrefix = 'BenefitsIconsTile';
8
9
  var cn = cnCreate('mfui-benefits-icons-tile');
9
10
 
10
11
  var BenefitsIconsTile = function BenefitsIconsTile(_ref) {
@@ -17,7 +18,8 @@ var BenefitsIconsTile = function BenefitsIconsTile(_ref) {
17
18
  return /*#__PURE__*/React.createElement("div", {
18
19
  className: cn({
19
20
  'icon-position': iconPosition
20
- }, [className])
21
+ }, [className]),
22
+ "data-testid": "".concat(testIdPrefix, "-root")
21
23
  }, /*#__PURE__*/React.createElement("div", {
22
24
  className: cn('svg-icon')
23
25
  }, 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,116 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import { IconPositionEnum } from "./types"; // left-aligned column with left side icon
3
+
4
+ var getLeftSideConfig = function getLeftSideConfig(count, index) {
5
+ var everySecondWithoutOffset = index % 2 ? '1' : undefined;
6
+ var columnSize = {
7
+ wide: '4',
8
+ desktop: '5',
9
+ tablet: '10'
10
+ };
11
+
12
+ switch (count) {
13
+ case 2:
14
+ case 4:
15
+ return _extends(_extends({}, columnSize), {
16
+ leftOffsetWide: everySecondWithoutOffset,
17
+ leftOffsetDesktop: everySecondWithoutOffset
18
+ });
19
+
20
+ default:
21
+ return _extends(_extends({}, columnSize), {
22
+ leftOffsetDesktop: everySecondWithoutOffset
23
+ });
24
+ }
25
+ }; // left-aligned column with left-aligned icon on top
26
+
27
+
28
+ var getLeftTopConfig = function getLeftTopConfig(count, index) {
29
+ var everySecondWithoutOffset = index % 2 ? '1' : undefined;
30
+ var everyThirdWithoutOffset = index % 3 ? '1' : undefined;
31
+
32
+ switch (count) {
33
+ case 2:
34
+ return {
35
+ wide: '4',
36
+ desktop: '4',
37
+ tablet: '5',
38
+ leftOffsetWide: everySecondWithoutOffset,
39
+ leftOffsetDesktop: everySecondWithoutOffset,
40
+ leftOffsetTablet: everySecondWithoutOffset
41
+ };
42
+
43
+ case 4:
44
+ return {
45
+ wide: '3',
46
+ desktop: '4',
47
+ tablet: '5',
48
+ leftOffsetDesktop: everySecondWithoutOffset,
49
+ leftOffsetTablet: everySecondWithoutOffset
50
+ };
51
+
52
+ default:
53
+ return {
54
+ wide: '3',
55
+ desktop: '4',
56
+ tablet: '5',
57
+ leftOffsetWide: everyThirdWithoutOffset,
58
+ leftOffsetTablet: everySecondWithoutOffset
59
+ };
60
+ }
61
+ }; // center-aligned column with center-aligned icon on top
62
+
63
+
64
+ var getCenterTopConfig = function getCenterTopConfig(count, index) {
65
+ var isEvenIndex = !(index % 2);
66
+ var everyEvenWithLeftOffset = isEvenIndex ? '1' : undefined;
67
+ var everyOddWithRightOffset = isEvenIndex ? undefined : '1';
68
+
69
+ switch (count) {
70
+ case 4:
71
+ return {
72
+ wide: '3',
73
+ desktop: '5',
74
+ tablet: '5',
75
+ leftOffsetDesktop: everyEvenWithLeftOffset,
76
+ leftOffsetTablet: everyEvenWithLeftOffset,
77
+ rightOffsetTablet: everyOddWithRightOffset,
78
+ rightOffsetDesktop: everyOddWithRightOffset
79
+ };
80
+
81
+ default:
82
+ return {
83
+ wide: '4',
84
+ desktop: '4',
85
+ tablet: '4'
86
+ };
87
+ }
88
+ };
89
+
90
+ var getOneColumnConfig = function getOneColumnConfig(iconPosition) {
91
+ return iconPosition !== IconPositionEnum.CENTER_TOP ? {
92
+ wide: '10',
93
+ desktop: '10',
94
+ tablet: '10'
95
+ } : {
96
+ wide: '12',
97
+ desktop: '12',
98
+ tablet: '12'
99
+ };
100
+ };
101
+
102
+ var getMultiColumnConfig = function getMultiColumnConfig(iconPosition, count, index) {
103
+ switch (iconPosition) {
104
+ case IconPositionEnum.LEFT_TOP:
105
+ return getLeftTopConfig(count, index);
106
+
107
+ case IconPositionEnum.CENTER_TOP:
108
+ return getCenterTopConfig(count, index);
109
+
110
+ default:
111
+ return getLeftSideConfig(count, index);
112
+ }
113
+ };
114
+
115
+ export default getMultiColumnConfig;
116
+ export { getLeftSideConfig, getLeftTopConfig, getCenterTopConfig, getOneColumnConfig };
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { IBenefit, GridGutterSize } from './types';
3
3
  import './BenfitsPictures.less';
4
+ export declare const ONLY_LEFT_ALIGN_ITEMS_COUNT = 3;
4
5
  export interface IBenefitsPicturesProps {
5
6
  /** Ссылка на корневой элемент */
6
7
  rootRef?: React.Ref<HTMLDivElement>;
@@ -1,5 +1,5 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "core-js/modules/es.array.map.js";
4
4
  import * as React from 'react';
5
5
  import { useCallback } from 'react';
@@ -9,106 +9,10 @@ import convert from 'htmr';
9
9
  import throttle from 'lodash.throttle';
10
10
  import PropTypes from 'prop-types';
11
11
  import throttleTime from "../../constants/throttleTime";
12
+ import getCenterConfig, { getLeftConfig } from "./helpers";
12
13
  import "./BenfitsPictures.css";
13
- var ONLY_LEFT_ALIGN_ITEMS_COUNT = 3;
14
- var columnSize = {
15
- wide: '4',
16
- desktop: '4',
17
- tablet: '5'
18
- };
19
-
20
- var isEvenIndex = function isEvenIndex(index) {
21
- return !((index + 1) % 2);
22
- };
23
-
24
- var getEvenOffset = function getEvenOffset(index) {
25
- return isEvenIndex(index) ? '1' : undefined;
26
- };
27
-
28
- var getOddOffset = function getOddOffset(index) {
29
- return isEvenIndex(index) ? undefined : '1';
30
- };
31
-
32
- var getLeftConfig = function getLeftConfig(count, index) {
33
- switch (count) {
34
- case 2:
35
- case 4:
36
- return _extends(_extends({}, columnSize), {
37
- leftOffsetWide: getEvenOffset(index),
38
- leftOffsetDesktop: getEvenOffset(index),
39
- leftOffsetTablet: getEvenOffset(index)
40
- });
41
-
42
- default:
43
- return _extends(_extends({}, columnSize), {
44
- leftOffsetTablet: getEvenOffset(index)
45
- });
46
- }
47
- };
48
-
49
- var getCenterMediumConfig = function getCenterMediumConfig(count, index) {
50
- switch (count) {
51
- case 3:
52
- return _extends(_extends({}, columnSize), {
53
- leftOffsetTablet: getOddOffset(index)
54
- });
55
-
56
- case 4:
57
- return _extends(_extends({}, columnSize), {
58
- rightOffsetWide: getOddOffset(index),
59
- leftOffsetWide: getEvenOffset(index),
60
- rightOffsetDesktop: getEvenOffset(index),
61
- leftOffsetDesktop: getOddOffset(index),
62
- rightOffsetTablet: getEvenOffset(index),
63
- leftOffsetTablet: getOddOffset(index)
64
- });
65
-
66
- default:
67
- return _extends(_extends({}, columnSize), {
68
- rightOffsetWide: getOddOffset(index),
69
- leftOffsetWide: getEvenOffset(index)
70
- });
71
- }
72
- };
73
-
74
- var getCenterLargeConfig = function getCenterLargeConfig(count, index) {
75
- switch (count) {
76
- case 4:
77
- return _extends(_extends({}, columnSize), {
78
- leftOffsetWide: getOddOffset(index),
79
- rightOffsetWide: getEvenOffset(index),
80
- leftOffsetDesktop: getOddOffset(index),
81
- rightOffsetDesktop: getEvenOffset(index),
82
- leftOffsetTablet: getOddOffset(index),
83
- rightOffsetTablet: getEvenOffset(index)
84
- });
85
-
86
- case 3:
87
- {
88
- return _extends(_extends({}, columnSize), {
89
- leftOffsetTablet: getOddOffset(index)
90
- });
91
- }
92
-
93
- default:
94
- return _extends({}, columnSize);
95
- }
96
- };
97
-
98
- var getCenterConfig = function getCenterConfig(count, index, gutterSize) {
99
- switch (gutterSize) {
100
- case 'medium':
101
- {
102
- return getCenterMediumConfig(count, index);
103
- }
104
-
105
- default:
106
- {
107
- return getCenterLargeConfig(count, index);
108
- }
109
- }
110
- };
111
-
14
+ export var ONLY_LEFT_ALIGN_ITEMS_COUNT = 3;
15
+ var testIdPrefix = 'BenefitsPictures';
112
16
  var cn = cnCreate('mfui-benefits-pictures');
113
17
 
114
18
  var BenefitsPictures = function BenefitsPictures(_ref) {
@@ -153,7 +57,12 @@ var BenefitsPictures = function BenefitsPictures(_ref) {
153
57
  ref: rootRef
154
58
  }, /*#__PURE__*/React.createElement(Grid, {
155
59
  guttersLeft: currentGutter,
156
- hAlign: isGridCenterAlign ? 'center' : 'left'
60
+ hAlign: isGridCenterAlign ? 'center' : 'left',
61
+ dataAttrs: {
62
+ container: {
63
+ 'data-testid': "".concat(testIdPrefix, "-grid-container")
64
+ }
65
+ }
157
66
  }, items.map(function (_ref2, index) {
158
67
  var img = _ref2.img,
159
68
  title = _ref2.title,
@@ -162,7 +71,8 @@ var BenefitsPictures = function BenefitsPictures(_ref) {
162
71
  return /*#__PURE__*/React.createElement(GridColumn, _extends({}, align === 'left' ? getLeftConfig(items.length, index) : getCenterConfig(items.length, index, gridGap), {
163
72
  key: index
164
73
  }), /*#__PURE__*/React.createElement("div", {
165
- className: cn('item', [classes.item])
74
+ className: cn('item', [classes.item]),
75
+ "data-testid": "".concat(testIdPrefix, "-item")
166
76
  }, /*#__PURE__*/React.createElement("img", {
167
77
  className: cn('img', {
168
78
  'h-align': align
@@ -0,0 +1,11 @@
1
+ import { GridConfig } from './types';
2
+ declare const columnSize: GridConfig;
3
+ declare const isOddIndex: (index: number) => boolean;
4
+ declare const getEvenOffset: (index: number) => "1" | undefined;
5
+ declare const getOddOffset: (index: number) => "1" | undefined;
6
+ declare const getLeftConfig: (count: number, index: number) => GridConfig;
7
+ declare const getCenterMediumConfig: (count: number, index: number) => GridConfig;
8
+ declare const getCenterLargeConfig: (count: number, index: number) => GridConfig;
9
+ declare const getCenterConfig: (count: number, index: number, gutterSize: string) => GridConfig;
10
+ export default getCenterConfig;
11
+ export { columnSize, isOddIndex, getEvenOffset, getOddOffset, getLeftConfig, getCenterMediumConfig, getCenterLargeConfig, };
@@ -0,0 +1,99 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ var columnSize = {
3
+ wide: '4',
4
+ desktop: '4',
5
+ tablet: '5'
6
+ };
7
+
8
+ var isOddIndex = function isOddIndex(index) {
9
+ return !((index + 1) % 2);
10
+ };
11
+
12
+ var getEvenOffset = function getEvenOffset(index) {
13
+ return isOddIndex(index) ? '1' : undefined;
14
+ };
15
+
16
+ var getOddOffset = function getOddOffset(index) {
17
+ return isOddIndex(index) ? undefined : '1';
18
+ };
19
+
20
+ var getLeftConfig = function getLeftConfig(count, index) {
21
+ switch (count) {
22
+ case 2:
23
+ case 4:
24
+ return _extends(_extends({}, columnSize), {
25
+ leftOffsetWide: getEvenOffset(index),
26
+ leftOffsetDesktop: getEvenOffset(index),
27
+ leftOffsetTablet: getEvenOffset(index)
28
+ });
29
+
30
+ default:
31
+ return _extends(_extends({}, columnSize), {
32
+ leftOffsetTablet: getEvenOffset(index)
33
+ });
34
+ }
35
+ };
36
+
37
+ var getCenterMediumConfig = function getCenterMediumConfig(count, index) {
38
+ switch (count) {
39
+ case 3:
40
+ return _extends(_extends({}, columnSize), {
41
+ leftOffsetTablet: getOddOffset(index)
42
+ });
43
+
44
+ case 4:
45
+ return _extends(_extends({}, columnSize), {
46
+ rightOffsetWide: getOddOffset(index),
47
+ leftOffsetWide: getEvenOffset(index),
48
+ rightOffsetDesktop: getEvenOffset(index),
49
+ leftOffsetDesktop: getOddOffset(index),
50
+ rightOffsetTablet: getEvenOffset(index),
51
+ leftOffsetTablet: getOddOffset(index)
52
+ });
53
+
54
+ default:
55
+ return _extends(_extends({}, columnSize), {
56
+ rightOffsetWide: getOddOffset(index),
57
+ leftOffsetWide: getEvenOffset(index)
58
+ });
59
+ }
60
+ };
61
+
62
+ var getCenterLargeConfig = function getCenterLargeConfig(count, index) {
63
+ switch (count) {
64
+ case 4:
65
+ return _extends(_extends({}, columnSize), {
66
+ leftOffsetWide: getOddOffset(index),
67
+ rightOffsetWide: getEvenOffset(index),
68
+ leftOffsetDesktop: getOddOffset(index),
69
+ rightOffsetDesktop: getEvenOffset(index),
70
+ leftOffsetTablet: getOddOffset(index),
71
+ rightOffsetTablet: getEvenOffset(index)
72
+ });
73
+
74
+ case 3:
75
+ return _extends(_extends({}, columnSize), {
76
+ leftOffsetTablet: getOddOffset(index)
77
+ });
78
+
79
+ default:
80
+ return _extends({}, columnSize);
81
+ }
82
+ };
83
+
84
+ var getCenterConfig = function getCenterConfig(count, index, gutterSize) {
85
+ switch (gutterSize) {
86
+ case 'medium':
87
+ {
88
+ return getCenterMediumConfig(count, index);
89
+ }
90
+
91
+ default:
92
+ {
93
+ return getCenterLargeConfig(count, index);
94
+ }
95
+ }
96
+ };
97
+
98
+ export default getCenterConfig;
99
+ export { columnSize, isOddIndex, getEvenOffset, getOddOffset, getLeftConfig, getCenterMediumConfig, getCenterLargeConfig };
@@ -20,8 +20,12 @@ h5 {
20
20
  padding: 16px 16px 24px;
21
21
  border-radius: 12px;
22
22
  color: var(--content);
23
- text-decoration: none;
23
+ text-decoration: none !important;
24
24
  background-color: var(--base);
25
+ -webkit-transition: background-color 0.3s, 0.3s, -webkit-box-shadow;
26
+ transition: background-color 0.3s, 0.3s, -webkit-box-shadow;
27
+ transition: background-color 0.3s, box-shadow, 0.3s;
28
+ transition: background-color 0.3s, box-shadow, 0.3s, -webkit-box-shadow;
25
29
  }
26
30
  @media screen and (min-width: 1280px) {
27
31
  .mfui-card {
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { Ref } from 'react';
2
2
  import './Card.less';
3
3
  import { ButtonType, FeaturesList, IconsList, Image, Link, Price, TextsList, Title } from './types';
4
4
  export interface ICard {
@@ -12,6 +12,14 @@ export interface ICard {
12
12
  };
13
13
  /** Дополнительный класс для компонента */
14
14
  className?: string;
15
+ /** Дополнительные классы для внутренних элементов */
16
+ classes?: {
17
+ root?: string;
18
+ button?: string;
19
+ extraButton?: string;
20
+ };
21
+ /** Ссылка на корневой элемент */
22
+ rootRef?: Ref<HTMLDivElement | HTMLAnchorElement>;
15
23
  isFullHeight?: boolean;
16
24
  /** Вид */
17
25
  view?: 'shadow' | 'background';
@@ -37,6 +37,8 @@ var cn = cnCreate('mfui-card');
37
37
  var Card = function Card(_ref5) {
38
38
  var dataAttrs = _ref5.dataAttrs,
39
39
  className = _ref5.className,
40
+ classes = _ref5.classes,
41
+ rootRef = _ref5.rootRef,
40
42
  _ref5$isFullHeight = _ref5.isFullHeight,
41
43
  isFullHeight = _ref5$isFullHeight === void 0 ? false : _ref5$isFullHeight,
42
44
  link = _ref5.link,
@@ -169,7 +171,7 @@ var Card = function Card(_ref5) {
169
171
  dataAttrs: {
170
172
  root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
171
173
  },
172
- className: cn('button'),
174
+ className: cn('button', [classes === null || classes === void 0 ? void 0 : classes.button]),
173
175
  href: button.href,
174
176
  target: button.target,
175
177
  onClick: button === null || button === void 0 ? void 0 : button.onClick
@@ -177,7 +179,7 @@ var Card = function Card(_ref5) {
177
179
  dataAttrs: {
178
180
  root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.extraButton
179
181
  },
180
- className: cn('button'),
182
+ className: cn('button', [classes === null || classes === void 0 ? void 0 : classes.extraButton]),
181
183
  href: extraButton.href,
182
184
  target: extraButton.target,
183
185
  type: "outline",
@@ -201,10 +203,11 @@ var Card = function Card(_ref5) {
201
203
  view: view,
202
204
  link: isLink,
203
205
  'full-height': isFullHeight
204
- }, [className]),
206
+ }, [className, classes === null || classes === void 0 ? void 0 : classes.root]),
205
207
  href: isLink ? link === null || link === void 0 ? void 0 : link.href : undefined,
206
208
  target: isLink ? link === null || link === void 0 ? void 0 : link.target : undefined,
207
- onClick: isLink ? onClick : undefined
209
+ onClick: isLink ? onClick : undefined,
210
+ ref: rootRef
208
211
  }), renderIcon(), !isBottomImage && renderImage(), /*#__PURE__*/React.createElement(Header, {
209
212
  className: cn('title'),
210
213
  as: "h3",
@@ -221,6 +224,14 @@ Card.propTypes = {
221
224
  extraButton: PropTypes.objectOf(PropTypes.string.isRequired)
222
225
  }),
223
226
  className: PropTypes.string,
227
+ classes: PropTypes.shape({
228
+ root: PropTypes.string,
229
+ button: PropTypes.string,
230
+ extraButton: PropTypes.string
231
+ }),
232
+ rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
233
+ current: PropTypes.elementType
234
+ }), PropTypes.any])]),
224
235
  view: PropTypes.oneOf(['shadow', 'background']),
225
236
  link: PropTypes.shape({
226
237
  href: PropTypes.string,