@megafon/ui-shared 6.2.0 → 6.4.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 (48) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/es/components/Card/Card.css +1 -1
  3. package/dist/es/components/Container/Container.css +898 -7
  4. package/dist/es/components/InfoCards/InfoCards.css +75 -0
  5. package/dist/es/components/InfoCards/InfoCards.d.ts +21 -0
  6. package/dist/es/components/InfoCards/InfoCards.js +66 -0
  7. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.css +237 -0
  8. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.d.ts +15 -0
  9. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.js +108 -0
  10. package/dist/es/components/InfoCards/types.d.ts +26 -0
  11. package/dist/es/components/InfoCards/types.js +0 -0
  12. package/dist/es/components/SidePictureCards/SidePictureCards.d.ts +22 -0
  13. package/dist/es/components/SidePictureCards/SidePictureCards.js +77 -0
  14. package/dist/es/components/SidePictureCards/components/SidePictureCard.css +183 -0
  15. package/dist/es/components/SidePictureCards/components/SidePictureCard.d.ts +16 -0
  16. package/dist/es/components/SidePictureCards/components/SidePictureCard.js +91 -0
  17. package/dist/es/components/SidePictureCards/types.d.ts +46 -0
  18. package/dist/es/components/SidePictureCards/types.js +0 -0
  19. package/dist/es/components/TextWithIcon/TextWithIconItem.css +16 -7
  20. package/dist/es/components/TextWithIcon/TextWithIconItem.d.ts +2 -0
  21. package/dist/es/components/TextWithIcon/TextWithIconItem.js +6 -1
  22. package/dist/es/helpers/getColumnConfig.d.ts +1 -1
  23. package/dist/es/index.d.ts +4 -0
  24. package/dist/es/index.js +4 -0
  25. package/dist/lib/components/Card/Card.css +1 -1
  26. package/dist/lib/components/Container/Container.css +898 -7
  27. package/dist/lib/components/InfoCards/InfoCards.css +75 -0
  28. package/dist/lib/components/InfoCards/InfoCards.d.ts +21 -0
  29. package/dist/lib/components/InfoCards/InfoCards.js +88 -0
  30. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.css +237 -0
  31. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.d.ts +15 -0
  32. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.js +129 -0
  33. package/dist/lib/components/InfoCards/types.d.ts +26 -0
  34. package/dist/lib/components/InfoCards/types.js +1 -0
  35. package/dist/lib/components/SidePictureCards/SidePictureCards.d.ts +22 -0
  36. package/dist/lib/components/SidePictureCards/SidePictureCards.js +95 -0
  37. package/dist/lib/components/SidePictureCards/components/SidePictureCard.css +183 -0
  38. package/dist/lib/components/SidePictureCards/components/SidePictureCard.d.ts +16 -0
  39. package/dist/lib/components/SidePictureCards/components/SidePictureCard.js +108 -0
  40. package/dist/lib/components/SidePictureCards/types.d.ts +46 -0
  41. package/dist/lib/components/SidePictureCards/types.js +1 -0
  42. package/dist/lib/components/TextWithIcon/TextWithIconItem.css +16 -7
  43. package/dist/lib/components/TextWithIcon/TextWithIconItem.d.ts +2 -0
  44. package/dist/lib/components/TextWithIcon/TextWithIconItem.js +6 -1
  45. package/dist/lib/helpers/getColumnConfig.d.ts +1 -1
  46. package/dist/lib/index.d.ts +4 -0
  47. package/dist/lib/index.js +32 -0
  48. package/package.json +3 -3
@@ -0,0 +1,75 @@
1
+ h1,
2
+ h2,
3
+ h3,
4
+ h4,
5
+ h5 {
6
+ margin: 0;
7
+ }
8
+ .mfui-info-cards {
9
+ display: grid;
10
+ grid-template-columns: auto;
11
+ gap: 20px;
12
+ }
13
+ @media screen and (min-width: 768px) {
14
+ .mfui-info-cards_size_small.mfui-info-cards_position_right-side {
15
+ grid-template-columns: repeat(auto-fit, minmax(326px, 1fr));
16
+ }
17
+ }
18
+ @media screen and (min-width: 1024px) and (max-width: 1279px) {
19
+ .mfui-info-cards_size_small.mfui-info-cards_position_right-side {
20
+ grid-template-columns: repeat(auto-fit, minmax(438px, 1fr));
21
+ }
22
+ }
23
+ @media screen and (min-width: 1280px) {
24
+ .mfui-info-cards_size_small.mfui-info-cards_position_right-side {
25
+ grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
26
+ }
27
+ }
28
+ @media screen and (min-width: 768px) {
29
+ .mfui-info-cards_size_small.mfui-info-cards_position_top-left {
30
+ grid-template-columns: repeat(auto-fit, minmax(326px, 1fr));
31
+ }
32
+ }
33
+ @media screen and (min-width: 1024px) {
34
+ .mfui-info-cards_size_small.mfui-info-cards_position_top-left {
35
+ grid-template-columns: repeat(auto-fit, minmax(208px, 1fr));
36
+ }
37
+ }
38
+ @media screen and (min-width: 768px) and (max-width: 1023px) {
39
+ .mfui-info-cards_size_medium.mfui-info-cards_position_right-side {
40
+ grid-template-columns: repeat(auto-fit, minmax(326px, 1fr));
41
+ }
42
+ }
43
+ @media screen and (min-width: 1024px) and (max-width: 1279px) {
44
+ .mfui-info-cards_size_medium.mfui-info-cards_position_right-side {
45
+ grid-template-columns: repeat(auto-fit, minmax(438px, 1fr));
46
+ }
47
+ }
48
+ @media screen and (min-width: 1280px) {
49
+ .mfui-info-cards_size_medium.mfui-info-cards_position_right-side {
50
+ grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
51
+ }
52
+ }
53
+ @media screen and (min-width: 768px) and (max-width: 1023px) {
54
+ .mfui-info-cards_size_medium.mfui-info-cards_position_top-left {
55
+ grid-template-columns: repeat(auto-fit, minmax(326px, 1fr));
56
+ }
57
+ }
58
+ @media screen and (min-width: 1024px) and (max-width: 1279px) {
59
+ .mfui-info-cards_size_medium.mfui-info-cards_position_top-left {
60
+ grid-template-columns: repeat(auto-fit, minmax(209px, 1fr));
61
+ }
62
+ }
63
+ @media screen and (min-width: 1280px) {
64
+ .mfui-info-cards_size_medium.mfui-info-cards_position_top-left {
65
+ grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
66
+ }
67
+ }
68
+ @media screen and (min-width: 1024px) {
69
+ .mfui-info-cards_size_big {
70
+ grid-template-columns: 1fr 1fr;
71
+ }
72
+ }
73
+ .mfui-info-cards_position_top-left.mfui-info-cards_background_no {
74
+ row-gap: 40px;
75
+ }
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { IInfoCardData, IInfoCardSettings } from './types';
3
+ import './InfoCards.less';
4
+ export interface IInfoCards extends IInfoCardSettings {
5
+ /** Дополнительный css класс для корневого элемента */
6
+ className?: string;
7
+ /** Дополнительные css классы для корневого и внутренних элементов */
8
+ classes?: {
9
+ root?: string;
10
+ card?: string;
11
+ };
12
+ /** Дополнительные data атрибуты к внутренним элементам */
13
+ dataAttrs?: {
14
+ root?: Record<string, string>;
15
+ card?: Record<string, string>;
16
+ };
17
+ /** Список карточек */
18
+ items: IInfoCardData[];
19
+ }
20
+ declare const InfoCards: React.FC<IInfoCards>;
21
+ export default InfoCards;
@@ -0,0 +1,66 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import "core-js/modules/es.array.map.js";
3
+ import "core-js/modules/es.array.concat.js";
4
+ import * as React from 'react';
5
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
+ import PropTypes from 'prop-types';
7
+ import InfoCard from "./components/InfoCard/InfoCard";
8
+ import "./InfoCards.css";
9
+ var cn = cnCreate('mfui-info-cards');
10
+
11
+ var InfoCards = function InfoCards(_ref) {
12
+ var className = _ref.className,
13
+ classes = _ref.classes,
14
+ items = _ref.items,
15
+ _ref$size = _ref.size,
16
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
17
+ _ref$imgPosition = _ref.imgPosition,
18
+ imgPosition = _ref$imgPosition === void 0 ? 'top-left' : _ref$imgPosition,
19
+ _ref$background = _ref.background,
20
+ background = _ref$background === void 0 ? 'stroke' : _ref$background,
21
+ dataAttrs = _ref.dataAttrs;
22
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
23
+ className: cn({
24
+ size: size,
25
+ position: imgPosition,
26
+ background: background
27
+ }, [className, classes === null || classes === void 0 ? void 0 : classes.root])
28
+ }), items.map(function (item, i) {
29
+ return /*#__PURE__*/React.createElement(InfoCard, _extends({}, item, {
30
+ className: classes === null || classes === void 0 ? void 0 : classes.card,
31
+ size: size,
32
+ imgPosition: imgPosition,
33
+ background: background,
34
+ dataAttrs: {
35
+ root: filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.card, i + 1)
36
+ },
37
+ key: "".concat(item.title, "_").concat(i)
38
+ }));
39
+ }));
40
+ };
41
+
42
+ InfoCards.propTypes = {
43
+ className: PropTypes.string,
44
+ classes: PropTypes.shape({
45
+ root: PropTypes.string,
46
+ card: PropTypes.string
47
+ }),
48
+ dataAttrs: PropTypes.shape({
49
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
50
+ card: PropTypes.objectOf(PropTypes.string.isRequired)
51
+ }),
52
+ size: PropTypes.oneOf(['big', 'medium', 'small']),
53
+ imgPosition: PropTypes.oneOf(['right-side', 'top-left']),
54
+ background: PropTypes.oneOf(['shadow', 'stroke', 'gray', 'green', 'purple', 'white', 'gray', 'no']),
55
+ items: PropTypes.arrayOf(PropTypes.shape({
56
+ title: PropTypes.string,
57
+ description: PropTypes.string,
58
+ imgSrc: PropTypes.string.isRequired,
59
+ imgAlt: PropTypes.string,
60
+ href: PropTypes.string,
61
+ target: PropTypes.oneOf(['_self', '_blank']),
62
+ rel: PropTypes.string,
63
+ moreInfo: PropTypes.string
64
+ }).isRequired).isRequired
65
+ };
66
+ export default InfoCards;
@@ -0,0 +1,237 @@
1
+ h1,
2
+ h2,
3
+ h3,
4
+ h4,
5
+ h5 {
6
+ margin: 0;
7
+ }
8
+ .mfui-info-card {
9
+ font-family: inherit;
10
+ font-size: 15px;
11
+ line-height: 24px;
12
+ display: -webkit-box;
13
+ display: -ms-flexbox;
14
+ display: flex;
15
+ -webkit-box-sizing: border-box;
16
+ box-sizing: border-box;
17
+ border-radius: 24px;
18
+ color: var(--content);
19
+ text-decoration: none;
20
+ -webkit-column-gap: 12px;
21
+ -moz-column-gap: 12px;
22
+ column-gap: 12px;
23
+ -webkit-transition: background-color 0.3s, -webkit-box-shadow 0.3s;
24
+ transition: background-color 0.3s, -webkit-box-shadow 0.3s;
25
+ transition: background-color 0.3s, box-shadow 0.3s;
26
+ transition: background-color 0.3s, box-shadow 0.3s, -webkit-box-shadow 0.3s;
27
+ }
28
+ .mfui-info-card:hover {
29
+ text-decoration: none;
30
+ }
31
+ .mfui-info-card__content {
32
+ display: -webkit-box;
33
+ display: -ms-flexbox;
34
+ display: flex;
35
+ -webkit-box-orient: vertical;
36
+ -webkit-box-direction: normal;
37
+ -ms-flex-direction: column;
38
+ flex-direction: column;
39
+ -webkit-box-flex: 1;
40
+ -ms-flex-positive: 1;
41
+ flex-grow: 1;
42
+ }
43
+ .mfui-info-card__title + .mfui-info-card__description {
44
+ margin-top: 8px;
45
+ }
46
+ .mfui-info-card__more-info {
47
+ display: -webkit-inline-box;
48
+ display: -ms-inline-flexbox;
49
+ display: inline-flex;
50
+ -webkit-box-align: center;
51
+ -ms-flex-align: center;
52
+ align-items: center;
53
+ font-size: 12px;
54
+ line-height: 18px;
55
+ margin-top: auto;
56
+ padding-top: 12px;
57
+ font-weight: 500;
58
+ -webkit-transition: color 0.3s;
59
+ transition: color 0.3s;
60
+ }
61
+ .mfui-info-card_link:hover .mfui-info-card__more-info {
62
+ color: var(--brandGreen);
63
+ }
64
+ .mfui-info-card__more-info-text {
65
+ margin-top: -2px;
66
+ }
67
+ .mfui-info-card__more-info-arrow {
68
+ width: 20px;
69
+ height: 20px;
70
+ fill: currentColor;
71
+ }
72
+ .mfui-info-card_size_small {
73
+ padding: 16px 20px;
74
+ }
75
+ .mfui-info-card_size_small .mfui-info-card__image {
76
+ width: 64px;
77
+ height: 64px;
78
+ margin-bottom: 16px;
79
+ }
80
+ .mfui-info-card_size_small .mfui-info-card__title {
81
+ font-size: 15px;
82
+ line-height: 24px;
83
+ font-weight: 500;
84
+ }
85
+ .mfui-info-card_size_small .mfui-info-card__description {
86
+ font-size: 12px;
87
+ line-height: 18px;
88
+ }
89
+ .mfui-info-card_size_medium {
90
+ padding: 20px 24px;
91
+ }
92
+ .mfui-info-card_size_medium .mfui-info-card__image {
93
+ width: 80px;
94
+ height: 80px;
95
+ margin-bottom: 16px;
96
+ }
97
+ @media screen and (min-width: 768px) {
98
+ .mfui-info-card_size_medium .mfui-info-card__image {
99
+ margin-bottom: 24px;
100
+ }
101
+ }
102
+ .mfui-info-card_size_medium .mfui-info-card__title {
103
+ font-weight: 500;
104
+ font-size: 18px;
105
+ line-height: 24px;
106
+ letter-spacing: 0.5px;
107
+ }
108
+ @media screen and (min-width: 1280px) {
109
+ .mfui-info-card_size_medium .mfui-info-card__title {
110
+ font-size: 20px;
111
+ line-height: 28px;
112
+ }
113
+ }
114
+ .mfui-info-card_size_big {
115
+ -webkit-box-orient: vertical;
116
+ -webkit-box-direction: normal;
117
+ -ms-flex-direction: column;
118
+ flex-direction: column;
119
+ padding: 24px;
120
+ }
121
+ @media screen and (min-width: 768px) {
122
+ .mfui-info-card_size_big {
123
+ -webkit-box-orient: horizontal;
124
+ -webkit-box-direction: normal;
125
+ -ms-flex-direction: row;
126
+ flex-direction: row;
127
+ -webkit-box-pack: justify;
128
+ -ms-flex-pack: justify;
129
+ justify-content: space-between;
130
+ padding: 32px;
131
+ }
132
+ }
133
+ .mfui-info-card_size_big .mfui-info-card__image {
134
+ -ms-flex-item-align: center;
135
+ align-self: center;
136
+ -webkit-box-ordinal-group: 2;
137
+ -ms-flex-order: 1;
138
+ order: 1;
139
+ width: 150px;
140
+ height: 150px;
141
+ }
142
+ @media screen and (max-width: 767px) {
143
+ .mfui-info-card_size_big .mfui-info-card__image {
144
+ -ms-flex-item-align: start;
145
+ align-self: start;
146
+ -webkit-box-ordinal-group: 1;
147
+ -ms-flex-order: 0;
148
+ order: 0;
149
+ margin-bottom: 16px;
150
+ }
151
+ }
152
+ .mfui-info-card_size_big .mfui-info-card__title {
153
+ font-weight: 500;
154
+ font-size: 18px;
155
+ line-height: 24px;
156
+ letter-spacing: 0.5px;
157
+ }
158
+ @media screen and (min-width: 1280px) {
159
+ .mfui-info-card_size_big .mfui-info-card__title {
160
+ font-size: 20px;
161
+ line-height: 28px;
162
+ }
163
+ }
164
+ .mfui-info-card_size_big .mfui-info-card__more-info {
165
+ font-size: 15px;
166
+ line-height: 24px;
167
+ padding-top: 24px;
168
+ }
169
+ .mfui-info-card_size_big .mfui-info-card__more-info-arrow {
170
+ width: 32px;
171
+ height: 32px;
172
+ }
173
+ .mfui-info-card_position_top-left {
174
+ -webkit-box-orient: vertical;
175
+ -webkit-box-direction: normal;
176
+ -ms-flex-direction: column;
177
+ flex-direction: column;
178
+ }
179
+ .mfui-info-card_position_right-side {
180
+ -webkit-box-pack: justify;
181
+ -ms-flex-pack: justify;
182
+ justify-content: space-between;
183
+ }
184
+ .mfui-info-card_position_right-side .mfui-info-card__image {
185
+ -ms-flex-item-align: center;
186
+ align-self: center;
187
+ -webkit-box-ordinal-group: 2;
188
+ -ms-flex-order: 1;
189
+ order: 1;
190
+ margin-bottom: 0;
191
+ }
192
+ .mfui-info-card_position_right-side .mfui-info-card__title + .mfui-info-card__description {
193
+ margin-top: 2px;
194
+ }
195
+ .mfui-info-card_position_right-side .mfui-info-card__more-info {
196
+ padding-top: 8px;
197
+ }
198
+ .mfui-info-card_background_stroke {
199
+ border: 1px solid var(--spbSky2);
200
+ }
201
+ .mfui-info-card_background_shadow {
202
+ background-color: var(--base);
203
+ -webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
204
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
205
+ }
206
+ .mfui-info-card_background_green {
207
+ background-color: var(--brandGreen20);
208
+ }
209
+ .mfui-info-card_background_purple {
210
+ background-color: var(--brandPurple20);
211
+ }
212
+ .mfui-info-card_background_white {
213
+ background-color: var(--base);
214
+ }
215
+ .mfui-info-card_background_gray {
216
+ background-color: var(--spbSky0);
217
+ }
218
+ .mfui-info-card_background_no {
219
+ padding: 0;
220
+ }
221
+ .mfui-info-card_background_stroke.mfui-info-card_link:hover {
222
+ background-color: var(--spbSky0);
223
+ }
224
+ .mfui-info-card_background_shadow.mfui-info-card_link:hover,
225
+ .mfui-info-card_background_white.mfui-info-card_link:hover {
226
+ -webkit-box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
227
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
228
+ }
229
+ .mfui-info-card_background_gray.mfui-info-card_link:hover {
230
+ background-color: var(--spbSky1);
231
+ }
232
+ .mfui-info-card_background_purple.mfui-info-card_link:hover {
233
+ background-color: var(--buttonHoverPurpleSoft);
234
+ }
235
+ .mfui-info-card_background_green.mfui-info-card_link:hover {
236
+ background-color: var(--buttonHoverGreenSoft);
237
+ }
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { IInfoCardData, IInfoCardSettings } from '../../types';
3
+ import './InfoCard.less';
4
+ export interface IInfoCard extends IInfoCardSettings, IInfoCardData {
5
+ className?: string;
6
+ dataAttrs?: {
7
+ root?: Record<string, string>;
8
+ title?: Record<string, string>;
9
+ description?: Record<string, string>;
10
+ moreInfo?: Record<string, string>;
11
+ moreArrow?: Record<string, string>;
12
+ };
13
+ }
14
+ declare const InfoCard: React.FC<IInfoCard>;
15
+ export default InfoCard;
@@ -0,0 +1,108 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import "core-js/modules/es.symbol.js";
3
+ import "core-js/modules/es.symbol.description.js";
4
+ import * as React from 'react';
5
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
+ import PropTypes from 'prop-types';
7
+ import { setRelAttribute } from "../../../../helpers/setRelAttribute";
8
+ import "./InfoCard.css";
9
+
10
+ var ArrowRight16 = function ArrowRight16(props) {
11
+ return /*#__PURE__*/React.createElement("svg", _extends({
12
+ viewBox: "0 0 20 20"
13
+ }, props), /*#__PURE__*/React.createElement("path", {
14
+ d: "M8 13l3-3-3-3 1-1 4 4-4 4z"
15
+ }));
16
+ };
17
+
18
+ var ArrowRight24 = function ArrowRight24(props) {
19
+ return /*#__PURE__*/React.createElement("svg", _extends({
20
+ viewBox: "0 0 32 32"
21
+ }, props), /*#__PURE__*/React.createElement("path", {
22
+ d: "M12.5 20.8l4.8-4.8-4.8-4.8 1.6-1.7 6.4 6.5-6.4 6.5z"
23
+ }));
24
+ };
25
+
26
+ var cn = cnCreate('mfui-info-card');
27
+
28
+ var InfoCard = function InfoCard(_ref) {
29
+ var className = _ref.className,
30
+ title = _ref.title,
31
+ description = _ref.description,
32
+ imgSrc = _ref.imgSrc,
33
+ _ref$imgAlt = _ref.imgAlt,
34
+ imgAlt = _ref$imgAlt === void 0 ? '' : _ref$imgAlt,
35
+ href = _ref.href,
36
+ target = _ref.target,
37
+ rel = _ref.rel,
38
+ moreInfo = _ref.moreInfo,
39
+ _ref$size = _ref.size,
40
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
41
+ _ref$imgPosition = _ref.imgPosition,
42
+ imgPosition = _ref$imgPosition === void 0 ? 'right-side' : _ref$imgPosition,
43
+ _ref$background = _ref.background,
44
+ background = _ref$background === void 0 ? 'stroke' : _ref$background,
45
+ dataAttrs = _ref.dataAttrs;
46
+ var RootElement = href ? 'a' : 'div';
47
+ var isBigSize = size === 'big';
48
+ var finalImgPosition = isBigSize ? false : imgPosition;
49
+ var isInvalidBackground = background === 'no' && (imgPosition === 'right-side' || size === 'big');
50
+ var finalBackground = isInvalidBackground ? 'stroke' : background;
51
+ var isLink = !!href;
52
+
53
+ var renderArrowRight = function renderArrowRight() {
54
+ var ArrowRight = isBigSize ? ArrowRight24 : ArrowRight16;
55
+ return /*#__PURE__*/React.createElement(ArrowRight, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.moreArrow), {
56
+ className: cn('more-info-arrow')
57
+ }));
58
+ };
59
+
60
+ return /*#__PURE__*/React.createElement(RootElement, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
61
+ href: isLink ? href : undefined,
62
+ target: isLink ? target : undefined,
63
+ rel: isLink ? setRelAttribute(rel, target) : undefined,
64
+ className: cn({
65
+ size: size,
66
+ position: finalImgPosition,
67
+ background: finalBackground,
68
+ link: isLink
69
+ }, [className])
70
+ }), /*#__PURE__*/React.createElement("img", {
71
+ className: cn('image'),
72
+ src: imgSrc,
73
+ alt: imgAlt
74
+ }), /*#__PURE__*/React.createElement("div", {
75
+ className: cn('content')
76
+ }, !!title && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title), {
77
+ className: cn('title')
78
+ }), title), !!description && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.description), {
79
+ className: cn('description')
80
+ }), description), !!moreInfo && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.moreInfo), {
81
+ className: cn('more-info')
82
+ }), /*#__PURE__*/React.createElement("span", {
83
+ className: cn('more-info-text')
84
+ }, moreInfo), isLink && renderArrowRight())));
85
+ };
86
+
87
+ InfoCard.propTypes = {
88
+ className: PropTypes.string,
89
+ dataAttrs: PropTypes.shape({
90
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
91
+ title: PropTypes.objectOf(PropTypes.string.isRequired),
92
+ description: PropTypes.objectOf(PropTypes.string.isRequired),
93
+ moreInfo: PropTypes.objectOf(PropTypes.string.isRequired),
94
+ moreArrow: PropTypes.objectOf(PropTypes.string.isRequired)
95
+ }),
96
+ size: PropTypes.oneOf(['big', 'medium', 'small']),
97
+ imgPosition: PropTypes.oneOf(['right-side', 'top-left']),
98
+ background: PropTypes.oneOf(['shadow', 'stroke', 'gray', 'green', 'purple', 'white', 'gray', 'no']),
99
+ title: PropTypes.string,
100
+ description: PropTypes.string,
101
+ imgSrc: PropTypes.string.isRequired,
102
+ imgAlt: PropTypes.string,
103
+ href: PropTypes.string,
104
+ target: PropTypes.oneOf(['_self', '_blank']),
105
+ rel: PropTypes.string,
106
+ moreInfo: PropTypes.string
107
+ };
108
+ export default InfoCard;
@@ -0,0 +1,26 @@
1
+ export interface IInfoCardSettings {
2
+ /** Размер карточки */
3
+ size?: 'big' | 'medium' | 'small';
4
+ /** Расположение изображения */
5
+ imgPosition?: 'right-side' | 'top-left';
6
+ /** Фон карточки */
7
+ background?: 'shadow' | 'stroke' | 'gray' | 'green' | 'purple' | 'white' | 'gray' | 'no';
8
+ }
9
+ export interface IInfoCardData {
10
+ /** Заголовок */
11
+ title?: string;
12
+ /** Текст */
13
+ description?: string;
14
+ /** URL изображения */
15
+ imgSrc: string;
16
+ /** Атрибут alt изображения */
17
+ imgAlt?: string;
18
+ /** URL ссылки */
19
+ href?: string;
20
+ /** Атрибут target ссылки */
21
+ target?: '_self' | '_blank';
22
+ /** Атрибут rel ссылки */
23
+ rel?: string;
24
+ /** Дополнительная информация */
25
+ moreInfo?: string;
26
+ }
File without changes
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { BackgroundType, CardDataType } from './types';
3
+ export interface ISidePictureCards {
4
+ /** Карточки. Минимальное количество 2 карточки */
5
+ items: CardDataType[];
6
+ /** Цвет фона карточек */
7
+ background?: BackgroundType;
8
+ /** Дополнительный класс для компонента */
9
+ className?: string;
10
+ /** Дополнительные классы для внутренних элементов */
11
+ classes?: {
12
+ root?: string;
13
+ item?: string;
14
+ };
15
+ /** Дополнительные data атрибуты к внутренним элементам */
16
+ dataAttrs?: {
17
+ root?: Record<string, string>;
18
+ item?: Record<string, string>;
19
+ };
20
+ }
21
+ declare const SidePictureCards: React.FC<ISidePictureCards>;
22
+ export default SidePictureCards;
@@ -0,0 +1,77 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import "core-js/modules/es.array.map.js";
3
+ import "core-js/modules/es.array.concat.js";
4
+ import React from 'react';
5
+ import { Grid, GridColumn } from '@megafon/ui-core';
6
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
7
+ import PropTypes from 'prop-types';
8
+ import SidePictureCard from "./components/SidePictureCard";
9
+ var MIN_ITEMS_COUNT = 2;
10
+ var cn = cnCreate('mfui-side-picture-cards');
11
+
12
+ var SidePictureCards = function SidePictureCards(_ref) {
13
+ var items = _ref.items,
14
+ _ref$background = _ref.background,
15
+ background = _ref$background === void 0 ? 'gray' : _ref$background,
16
+ className = _ref.className,
17
+ _ref$classes = _ref.classes,
18
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
19
+ dataAttrs = _ref.dataAttrs;
20
+
21
+ if (items.length < MIN_ITEMS_COUNT) {
22
+ return null;
23
+ }
24
+
25
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
26
+ className: cn([className, classes.root])
27
+ }), /*#__PURE__*/React.createElement(Grid, {
28
+ className: cn(),
29
+ guttersLeft: "medium",
30
+ guttersBottom: "medium"
31
+ }, items.map(function (item, i) {
32
+ return /*#__PURE__*/React.createElement(GridColumn, {
33
+ all: "6",
34
+ mobile: "12",
35
+ key: "".concat(item === null || item === void 0 ? void 0 : item.title, "_").concat(i)
36
+ }, /*#__PURE__*/React.createElement(SidePictureCard, _extends({}, item, {
37
+ background: background,
38
+ key: "".concat(item === null || item === void 0 ? void 0 : item.title, "_").concat(i),
39
+ classes: {
40
+ root: classes.item
41
+ },
42
+ dataAttrs: {
43
+ root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1))
44
+ }
45
+ })));
46
+ })));
47
+ };
48
+
49
+ SidePictureCards.propTypes = {
50
+ items: PropTypes.arrayOf(PropTypes.shape({
51
+ title: PropTypes.string,
52
+ image: PropTypes.shape({
53
+ src: PropTypes.string.isRequired,
54
+ srcWide: PropTypes.string.isRequired,
55
+ alt: PropTypes.string
56
+ }).isRequired,
57
+ iconItems: PropTypes.arrayOf(PropTypes.shape({
58
+ icon: PropTypes.element.isRequired,
59
+ text: PropTypes.string,
60
+ info: PropTypes.string
61
+ }).isRequired).isRequired,
62
+ button: PropTypes.shape({
63
+ title: PropTypes.string.isRequired,
64
+ href: PropTypes.string.isRequired,
65
+ target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
66
+ rel: PropTypes.string
67
+ }),
68
+ href: PropTypes.string,
69
+ target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
70
+ rel: PropTypes.string
71
+ }).isRequired).isRequired,
72
+ background: PropTypes.oneOf(['white', 'gray']),
73
+ className: PropTypes.string,
74
+ classes: PropTypes.objectOf(PropTypes.string),
75
+ dataAttrs: PropTypes.objectOf(PropTypes.object)
76
+ };
77
+ export default SidePictureCards;