@megafon/ui-shared 6.3.0 → 6.5.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 (66) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/es/components/Card/Card.css +1 -1
  3. package/dist/es/components/Container/Container.css +934 -7
  4. package/dist/es/components/DarkGradientCards/DarkGradientCards.css +18 -0
  5. package/dist/es/components/DarkGradientCards/DarkGradientCards.d.ts +28 -0
  6. package/dist/es/components/DarkGradientCards/DarkGradientCards.js +88 -0
  7. package/dist/es/components/DarkGradientCards/components/DarkGradientCard.css +175 -0
  8. package/dist/es/components/DarkGradientCards/components/DarkGradientCard.d.ts +15 -0
  9. package/dist/es/components/DarkGradientCards/components/DarkGradientCard.js +52 -0
  10. package/dist/es/components/DarkGradientCards/types.d.ts +21 -0
  11. package/dist/es/components/DarkGradientCards/types.js +0 -0
  12. package/dist/es/components/InfoCards/InfoCards.css +75 -0
  13. package/dist/es/components/InfoCards/InfoCards.d.ts +21 -0
  14. package/dist/es/components/InfoCards/InfoCards.js +66 -0
  15. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.css +237 -0
  16. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.d.ts +15 -0
  17. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.js +108 -0
  18. package/dist/es/components/InfoCards/types.d.ts +26 -0
  19. package/dist/es/components/InfoCards/types.js +0 -0
  20. package/dist/es/components/SidePictureCards/SidePictureCards.d.ts +22 -0
  21. package/dist/es/components/SidePictureCards/SidePictureCards.js +77 -0
  22. package/dist/es/components/SidePictureCards/components/SidePictureCard.css +183 -0
  23. package/dist/es/components/SidePictureCards/components/SidePictureCard.d.ts +16 -0
  24. package/dist/es/components/SidePictureCards/components/SidePictureCard.js +91 -0
  25. package/dist/es/components/SidePictureCards/types.d.ts +46 -0
  26. package/dist/es/components/SidePictureCards/types.js +0 -0
  27. package/dist/es/components/TextWithIcon/TextWithIconItem.css +16 -7
  28. package/dist/es/components/TextWithIcon/TextWithIconItem.d.ts +2 -0
  29. package/dist/es/components/TextWithIcon/TextWithIconItem.js +6 -1
  30. package/dist/es/hooks/useResolutions.d.ts +1 -0
  31. package/dist/es/hooks/useResolutions.js +12 -1
  32. package/dist/es/index.d.ts +6 -0
  33. package/dist/es/index.js +6 -0
  34. package/dist/lib/components/Card/Card.css +1 -1
  35. package/dist/lib/components/Container/Container.css +934 -7
  36. package/dist/lib/components/DarkGradientCards/DarkGradientCards.css +18 -0
  37. package/dist/lib/components/DarkGradientCards/DarkGradientCards.d.ts +28 -0
  38. package/dist/lib/components/DarkGradientCards/DarkGradientCards.js +104 -0
  39. package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.css +175 -0
  40. package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.d.ts +15 -0
  41. package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.js +65 -0
  42. package/dist/lib/components/DarkGradientCards/types.d.ts +21 -0
  43. package/dist/lib/components/DarkGradientCards/types.js +1 -0
  44. package/dist/lib/components/InfoCards/InfoCards.css +75 -0
  45. package/dist/lib/components/InfoCards/InfoCards.d.ts +21 -0
  46. package/dist/lib/components/InfoCards/InfoCards.js +88 -0
  47. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.css +237 -0
  48. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.d.ts +15 -0
  49. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.js +129 -0
  50. package/dist/lib/components/InfoCards/types.d.ts +26 -0
  51. package/dist/lib/components/InfoCards/types.js +1 -0
  52. package/dist/lib/components/SidePictureCards/SidePictureCards.d.ts +22 -0
  53. package/dist/lib/components/SidePictureCards/SidePictureCards.js +95 -0
  54. package/dist/lib/components/SidePictureCards/components/SidePictureCard.css +183 -0
  55. package/dist/lib/components/SidePictureCards/components/SidePictureCard.d.ts +16 -0
  56. package/dist/lib/components/SidePictureCards/components/SidePictureCard.js +108 -0
  57. package/dist/lib/components/SidePictureCards/types.d.ts +46 -0
  58. package/dist/lib/components/SidePictureCards/types.js +1 -0
  59. package/dist/lib/components/TextWithIcon/TextWithIconItem.css +16 -7
  60. package/dist/lib/components/TextWithIcon/TextWithIconItem.d.ts +2 -0
  61. package/dist/lib/components/TextWithIcon/TextWithIconItem.js +6 -1
  62. package/dist/lib/hooks/useResolutions.d.ts +1 -0
  63. package/dist/lib/hooks/useResolutions.js +12 -1
  64. package/dist/lib/index.d.ts +6 -0
  65. package/dist/lib/index.js +48 -0
  66. package/package.json +2 -2
@@ -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,129 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ require("core-js/modules/es.symbol.js");
13
+
14
+ require("core-js/modules/es.symbol.description.js");
15
+
16
+ var React = _interopRequireWildcard(require("react"));
17
+
18
+ var _uiHelpers = require("@megafon/ui-helpers");
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ var _setRelAttribute = require("../../../../helpers/setRelAttribute");
23
+
24
+ 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); }
25
+
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
+
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
+
30
+ var ArrowRight16 = function ArrowRight16(props) {
31
+ return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
32
+ viewBox: "0 0 20 20"
33
+ }, props), /*#__PURE__*/React.createElement("path", {
34
+ d: "M8 13l3-3-3-3 1-1 4 4-4 4z"
35
+ }));
36
+ };
37
+
38
+ var ArrowRight24 = function ArrowRight24(props) {
39
+ return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
40
+ viewBox: "0 0 32 32"
41
+ }, props), /*#__PURE__*/React.createElement("path", {
42
+ d: "M12.5 20.8l4.8-4.8-4.8-4.8 1.6-1.7 6.4 6.5-6.4 6.5z"
43
+ }));
44
+ };
45
+
46
+ var cn = (0, _uiHelpers.cnCreate)('mfui-info-card');
47
+
48
+ var InfoCard = function InfoCard(_ref) {
49
+ var className = _ref.className,
50
+ title = _ref.title,
51
+ description = _ref.description,
52
+ imgSrc = _ref.imgSrc,
53
+ _ref$imgAlt = _ref.imgAlt,
54
+ imgAlt = _ref$imgAlt === void 0 ? '' : _ref$imgAlt,
55
+ href = _ref.href,
56
+ target = _ref.target,
57
+ rel = _ref.rel,
58
+ moreInfo = _ref.moreInfo,
59
+ _ref$size = _ref.size,
60
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
61
+ _ref$imgPosition = _ref.imgPosition,
62
+ imgPosition = _ref$imgPosition === void 0 ? 'right-side' : _ref$imgPosition,
63
+ _ref$background = _ref.background,
64
+ background = _ref$background === void 0 ? 'stroke' : _ref$background,
65
+ dataAttrs = _ref.dataAttrs;
66
+ var RootElement = href ? 'a' : 'div';
67
+ var isBigSize = size === 'big';
68
+ var finalImgPosition = isBigSize ? false : imgPosition;
69
+ var isInvalidBackground = background === 'no' && (imgPosition === 'right-side' || size === 'big');
70
+ var finalBackground = isInvalidBackground ? 'stroke' : background;
71
+ var isLink = !!href;
72
+
73
+ var renderArrowRight = function renderArrowRight() {
74
+ var ArrowRight = isBigSize ? ArrowRight24 : ArrowRight16;
75
+ return /*#__PURE__*/React.createElement(ArrowRight, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.moreArrow), {
76
+ className: cn('more-info-arrow')
77
+ }));
78
+ };
79
+
80
+ return /*#__PURE__*/React.createElement(RootElement, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
81
+ href: isLink ? href : undefined,
82
+ target: isLink ? target : undefined,
83
+ rel: isLink ? (0, _setRelAttribute.setRelAttribute)(rel, target) : undefined,
84
+ className: cn({
85
+ size: size,
86
+ position: finalImgPosition,
87
+ background: finalBackground,
88
+ link: isLink
89
+ }, [className])
90
+ }), /*#__PURE__*/React.createElement("img", {
91
+ className: cn('image'),
92
+ src: imgSrc,
93
+ alt: imgAlt
94
+ }), /*#__PURE__*/React.createElement("div", {
95
+ className: cn('content')
96
+ }, !!title && /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title), {
97
+ className: cn('title')
98
+ }), title), !!description && /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.description), {
99
+ className: cn('description')
100
+ }), description), !!moreInfo && /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.moreInfo), {
101
+ className: cn('more-info')
102
+ }), /*#__PURE__*/React.createElement("span", {
103
+ className: cn('more-info-text')
104
+ }, moreInfo), isLink && renderArrowRight())));
105
+ };
106
+
107
+ InfoCard.propTypes = {
108
+ className: _propTypes["default"].string,
109
+ dataAttrs: _propTypes["default"].shape({
110
+ root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
111
+ title: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
112
+ description: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
113
+ moreInfo: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
114
+ moreArrow: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
115
+ }),
116
+ size: _propTypes["default"].oneOf(['big', 'medium', 'small']),
117
+ imgPosition: _propTypes["default"].oneOf(['right-side', 'top-left']),
118
+ background: _propTypes["default"].oneOf(['shadow', 'stroke', 'gray', 'green', 'purple', 'white', 'gray', 'no']),
119
+ title: _propTypes["default"].string,
120
+ description: _propTypes["default"].string,
121
+ imgSrc: _propTypes["default"].string.isRequired,
122
+ imgAlt: _propTypes["default"].string,
123
+ href: _propTypes["default"].string,
124
+ target: _propTypes["default"].oneOf(['_self', '_blank']),
125
+ rel: _propTypes["default"].string,
126
+ moreInfo: _propTypes["default"].string
127
+ };
128
+ var _default = InfoCard;
129
+ exports["default"] = _default;
@@ -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
+ }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -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,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+
10
+ require("core-js/modules/es.array.map.js");
11
+
12
+ require("core-js/modules/es.array.concat.js");
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _uiCore = require("@megafon/ui-core");
17
+
18
+ var _uiHelpers = require("@megafon/ui-helpers");
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ var _SidePictureCard = _interopRequireDefault(require("./components/SidePictureCard"));
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
26
+ var MIN_ITEMS_COUNT = 2;
27
+ var cn = (0, _uiHelpers.cnCreate)('mfui-side-picture-cards');
28
+
29
+ var SidePictureCards = function SidePictureCards(_ref) {
30
+ var items = _ref.items,
31
+ _ref$background = _ref.background,
32
+ background = _ref$background === void 0 ? 'gray' : _ref$background,
33
+ className = _ref.className,
34
+ _ref$classes = _ref.classes,
35
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
36
+ dataAttrs = _ref.dataAttrs;
37
+
38
+ if (items.length < MIN_ITEMS_COUNT) {
39
+ return null;
40
+ }
41
+
42
+ return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
43
+ className: cn([className, classes.root])
44
+ }), /*#__PURE__*/_react["default"].createElement(_uiCore.Grid, {
45
+ className: cn(),
46
+ guttersLeft: "medium",
47
+ guttersBottom: "medium"
48
+ }, items.map(function (item, i) {
49
+ return /*#__PURE__*/_react["default"].createElement(_uiCore.GridColumn, {
50
+ all: "6",
51
+ mobile: "12",
52
+ key: "".concat(item === null || item === void 0 ? void 0 : item.title, "_").concat(i)
53
+ }, /*#__PURE__*/_react["default"].createElement(_SidePictureCard["default"], (0, _extends2["default"])({}, item, {
54
+ background: background,
55
+ key: "".concat(item === null || item === void 0 ? void 0 : item.title, "_").concat(i),
56
+ classes: {
57
+ root: classes.item
58
+ },
59
+ dataAttrs: {
60
+ root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1))
61
+ }
62
+ })));
63
+ })));
64
+ };
65
+
66
+ SidePictureCards.propTypes = {
67
+ items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
68
+ title: _propTypes["default"].string,
69
+ image: _propTypes["default"].shape({
70
+ src: _propTypes["default"].string.isRequired,
71
+ srcWide: _propTypes["default"].string.isRequired,
72
+ alt: _propTypes["default"].string
73
+ }).isRequired,
74
+ iconItems: _propTypes["default"].arrayOf(_propTypes["default"].shape({
75
+ icon: _propTypes["default"].element.isRequired,
76
+ text: _propTypes["default"].string,
77
+ info: _propTypes["default"].string
78
+ }).isRequired).isRequired,
79
+ button: _propTypes["default"].shape({
80
+ title: _propTypes["default"].string.isRequired,
81
+ href: _propTypes["default"].string.isRequired,
82
+ target: _propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']),
83
+ rel: _propTypes["default"].string
84
+ }),
85
+ href: _propTypes["default"].string,
86
+ target: _propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']),
87
+ rel: _propTypes["default"].string
88
+ }).isRequired).isRequired,
89
+ background: _propTypes["default"].oneOf(['white', 'gray']),
90
+ className: _propTypes["default"].string,
91
+ classes: _propTypes["default"].objectOf(_propTypes["default"].string),
92
+ dataAttrs: _propTypes["default"].objectOf(_propTypes["default"].object)
93
+ };
94
+ var _default = SidePictureCards;
95
+ exports["default"] = _default;