@megafon/ui-shared 5.15.0 → 5.17.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.
- package/CHANGELOG.md +40 -0
- package/dist/es/components/Card/Card.css +54 -8
- package/dist/es/components/Card/Card.d.ts +7 -3
- package/dist/es/components/Card/Card.js +27 -6
- package/dist/es/components/Card/types.d.ts +6 -0
- package/dist/es/components/Container/Container.css +237 -93
- package/dist/es/components/Container/Container.js +3 -1
- package/dist/es/components/ImageBanner/ImageBanner.css +29 -16
- package/dist/es/components/ImageBanner/ImageBanner.d.ts +4 -9
- package/dist/es/components/ImageBanner/ImageBanner.js +11 -22
- package/dist/es/components/TextWithIcon/TextWithIconItem.css +8 -10
- package/dist/es/helpers/getColumnConfig.d.ts +1 -1
- package/dist/lib/components/Card/Card.css +54 -8
- package/dist/lib/components/Card/Card.d.ts +7 -3
- package/dist/lib/components/Card/Card.js +27 -6
- package/dist/lib/components/Card/types.d.ts +6 -0
- package/dist/lib/components/Container/Container.css +237 -93
- package/dist/lib/components/Container/Container.js +3 -1
- package/dist/lib/components/ImageBanner/ImageBanner.css +29 -16
- package/dist/lib/components/ImageBanner/ImageBanner.d.ts +4 -9
- package/dist/lib/components/ImageBanner/ImageBanner.js +10 -22
- package/dist/lib/components/TextWithIcon/TextWithIconItem.css +8 -10
- package/dist/lib/helpers/getColumnConfig.d.ts +1 -1
- package/package.json +4 -4
@@ -1,5 +1,4 @@
|
|
1
1
|
import React, { Ref } from 'react';
|
2
|
-
import { PriceBadge } from '@megafon/ui-core';
|
3
2
|
import './ImageBanner.less';
|
4
3
|
export declare const BackgroundColor: {
|
5
4
|
readonly TRANSPARENT: "transparent";
|
@@ -26,11 +25,6 @@ export declare const ImageVerticalAlign: {
|
|
26
25
|
readonly BOTTOM: "bottom";
|
27
26
|
};
|
28
27
|
export declare type ImageVerticalAlignType = typeof ImageVerticalAlign[keyof typeof ImageVerticalAlign];
|
29
|
-
declare type PriceBadgeTypes = React.ComponentProps<typeof PriceBadge>;
|
30
|
-
export declare type PriceBadgePropsType = Pick<PriceBadgeTypes, 'iconType'> & {
|
31
|
-
/** Текст бейджа */
|
32
|
-
text: string;
|
33
|
-
};
|
34
28
|
export interface IImageBannerProps {
|
35
29
|
/** Дополнительные data атрибуты к внутренним элементам */
|
36
30
|
dataAttrs?: {
|
@@ -43,13 +37,14 @@ export interface IImageBannerProps {
|
|
43
37
|
classes?: {
|
44
38
|
root?: string;
|
45
39
|
image?: string;
|
40
|
+
imageSource?: string;
|
46
41
|
title?: string;
|
47
42
|
description?: string;
|
48
43
|
cost?: string;
|
49
44
|
badgesContainer?: string;
|
50
45
|
badges?: string;
|
51
|
-
badge?: string;
|
52
46
|
adBlock?: string;
|
47
|
+
children?: string;
|
53
48
|
};
|
54
49
|
/** Ссылка на корневой элемент */
|
55
50
|
rootRef?: Ref<HTMLDivElement>;
|
@@ -83,8 +78,8 @@ export interface IImageBannerProps {
|
|
83
78
|
autoHeight?: boolean;
|
84
79
|
/** Изображение растягивается на всю ширину или вписывается в фиксированный фрейм (по умолчанию фрейм) */
|
85
80
|
isImageFullWidth?: boolean;
|
86
|
-
/**
|
87
|
-
badges?:
|
81
|
+
/** Бейджи */
|
82
|
+
badges?: JSX.Element[] | JSX.Element;
|
88
83
|
/** Элемент блока с рекламой */
|
89
84
|
adBlock?: JSX.Element | null;
|
90
85
|
}
|
@@ -2,11 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
3
|
import "core-js/modules/es.symbol.js";
|
4
4
|
import "core-js/modules/es.symbol.description.js";
|
5
|
-
import "core-js/modules/es.array.map.js";
|
6
5
|
import "core-js/modules/es.array.concat.js";
|
7
6
|
import "core-js/modules/es.object.values.js";
|
8
7
|
import React from 'react';
|
9
|
-
import { Header
|
8
|
+
import { Header } from '@megafon/ui-core';
|
10
9
|
import { breakpoints, cnCreate, filterDataAttrs, convert, titleConvertConfig } from '@megafon/ui-helpers';
|
11
10
|
import * as PropTypes from 'prop-types';
|
12
11
|
import "./ImageBanner.css";
|
@@ -88,8 +87,7 @@ var ImageBanner = function ImageBanner(_ref2) {
|
|
88
87
|
radius = _ref2$radius === void 0 ? Radius.CORNERS : _ref2$radius,
|
89
88
|
autoHeight = _ref2.autoHeight,
|
90
89
|
isImageFullWidth = _ref2.isImageFullWidth,
|
91
|
-
|
92
|
-
badges = _ref2$badges === void 0 ? [] : _ref2$badges,
|
90
|
+
badges = _ref2.badges,
|
93
91
|
adBlock = _ref2.adBlock,
|
94
92
|
_ref2$children = _ref2.children,
|
95
93
|
children = _ref2$children === void 0 ? [] : _ref2$children;
|
@@ -115,18 +113,9 @@ var ImageBanner = function ImageBanner(_ref2) {
|
|
115
113
|
}, []);
|
116
114
|
var navTheme = getTheme(backgroundColor);
|
117
115
|
var hasImage = !!(imageMobile || imageMobile2x || imageDesktop || imageDesktop2x);
|
118
|
-
var renderBadges = !!badges
|
116
|
+
var renderBadges = !!badges && /*#__PURE__*/React.createElement("div", {
|
119
117
|
className: cn('badges', [classes.badges])
|
120
|
-
}, badges
|
121
|
-
var text = _ref4.text,
|
122
|
-
iconType = _ref4.iconType;
|
123
|
-
return /*#__PURE__*/React.createElement(PriceBadge, {
|
124
|
-
className: classes.badge,
|
125
|
-
theme: navTheme,
|
126
|
-
iconType: iconType,
|
127
|
-
key: text
|
128
|
-
}, text);
|
129
|
-
}));
|
118
|
+
}, badges);
|
130
119
|
var renderAdBlock = !!adBlock && /*#__PURE__*/React.createElement("div", {
|
131
120
|
className: cn('ad-block', [classes.adBlock])
|
132
121
|
}, adBlock);
|
@@ -145,17 +134,18 @@ var ImageBanner = function ImageBanner(_ref2) {
|
|
145
134
|
}, typeof description === 'string' ? convert(description, titleConvertConfig) : description), !!cost && /*#__PURE__*/React.createElement("div", {
|
146
135
|
className: cn('cost', [classes.cost])
|
147
136
|
}, convert(cost, typographyConfig)), !!children && !!React.Children.count(children) && /*#__PURE__*/React.createElement("div", {
|
148
|
-
className: cn('children')
|
137
|
+
className: cn('children', [classes.children])
|
149
138
|
}, children));
|
150
139
|
var renderImage = /*#__PURE__*/React.createElement("picture", {
|
151
140
|
className: cn('picture', {
|
152
141
|
'v-align': imageVerticalAlign
|
153
142
|
})
|
154
143
|
}, /*#__PURE__*/React.createElement("source", {
|
144
|
+
className: classes.imageSource,
|
155
145
|
media: "(min-width: ".concat(breakpoints.DESKTOP_SMALL_START, "px)"),
|
156
146
|
srcSet: "".concat(imageDesktop, ", ").concat(imageDesktop2x, " 2x")
|
157
147
|
}), /*#__PURE__*/React.createElement("img", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image), {
|
158
|
-
className: cn('
|
148
|
+
className: cn('image', [classes.image]),
|
159
149
|
src: imageMobile || imageMobile2x,
|
160
150
|
srcSet: imageMobile2x ? "".concat(imageMobile2x, " 2x") : undefined,
|
161
151
|
alt: imageAlt
|
@@ -182,13 +172,15 @@ ImageBanner.propTypes = {
|
|
182
172
|
classes: PropTypes.shape({
|
183
173
|
root: PropTypes.string,
|
184
174
|
image: PropTypes.string,
|
175
|
+
imageSource: PropTypes.string,
|
185
176
|
title: PropTypes.string,
|
186
177
|
description: PropTypes.string,
|
187
178
|
cost: PropTypes.string,
|
188
179
|
badgesContainer: PropTypes.string,
|
189
180
|
badges: PropTypes.string,
|
190
181
|
badge: PropTypes.string,
|
191
|
-
adBlock: PropTypes.string
|
182
|
+
adBlock: PropTypes.string,
|
183
|
+
children: PropTypes.string
|
192
184
|
}),
|
193
185
|
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
194
186
|
current: PropTypes.elementType
|
@@ -208,10 +200,7 @@ ImageBanner.propTypes = {
|
|
208
200
|
imageVerticalAlign: PropTypes.oneOf(Object.values(ImageVerticalAlign)),
|
209
201
|
autoHeight: PropTypes.bool,
|
210
202
|
isImageFullWidth: PropTypes.bool,
|
211
|
-
badges: PropTypes.arrayOf(PropTypes.
|
212
|
-
iconType: PropTypes.oneOf(['timer', 'price', 'check', 'attention', 'info', 'profile']).isRequired,
|
213
|
-
text: PropTypes.string.isRequired
|
214
|
-
}).isRequired),
|
203
|
+
badges: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element]),
|
215
204
|
adBlock: PropTypes.element
|
216
205
|
};
|
217
206
|
export default ImageBanner;
|
@@ -14,18 +14,16 @@ h5 {
|
|
14
14
|
align-items: center;
|
15
15
|
}
|
16
16
|
.mfui-text-with-icon-item:not(:first-of-type) {
|
17
|
-
margin-top:
|
18
|
-
}
|
19
|
-
@media screen and (max-width: 767px) {
|
20
|
-
.mfui-text-with-icon-item:not(:first-of-type) {
|
21
|
-
margin-top: 24px;
|
22
|
-
}
|
17
|
+
margin-top: 12px;
|
23
18
|
}
|
24
19
|
.mfui-text-with-icon-item__svg-icon {
|
25
|
-
width:
|
26
|
-
min-width:
|
27
|
-
height:
|
28
|
-
min-height:
|
20
|
+
width: 44px;
|
21
|
+
min-width: 44px;
|
22
|
+
height: 44px;
|
23
|
+
min-height: 44px;
|
29
24
|
margin-right: 16px;
|
25
|
+
padding: 6px;
|
26
|
+
border: 1px solid var(--spbSky2);
|
27
|
+
border-radius: 50%;
|
30
28
|
overflow: hidden;
|
31
29
|
}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
export declare const getColumnConfig: (isFullWidth: boolean) => Pick<React.PropsWithChildren<import("
|
2
|
+
export declare const getColumnConfig: (isFullWidth: boolean) => Pick<React.PropsWithChildren<import("../../../ui-core/dist/lib/components/Grid/GridColumn").IGridColumn>, "all" | "wide" | "mobile" | "desktop" | "tablet">;
|
@@ -18,7 +18,7 @@ h5 {
|
|
18
18
|
-ms-flex-direction: column;
|
19
19
|
flex-direction: column;
|
20
20
|
padding: 16px 16px 24px;
|
21
|
-
border-radius:
|
21
|
+
border-radius: 24px;
|
22
22
|
color: var(--content);
|
23
23
|
text-decoration: none !important;
|
24
24
|
background-color: var(--base);
|
@@ -42,6 +42,7 @@ h5 {
|
|
42
42
|
-webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
43
43
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
44
44
|
}
|
45
|
+
.mfui-card_link.mfui-card_view_hover-shadow:hover,
|
45
46
|
.mfui-card_link.mfui-card_view_shadow:hover {
|
46
47
|
-webkit-box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.1);
|
47
48
|
box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.1);
|
@@ -60,6 +61,18 @@ h5 {
|
|
60
61
|
padding: 32px;
|
61
62
|
}
|
62
63
|
}
|
64
|
+
.mfui-card__header {
|
65
|
+
display: -webkit-box;
|
66
|
+
display: -ms-flexbox;
|
67
|
+
display: flex;
|
68
|
+
gap: 12px;
|
69
|
+
-webkit-box-align: start;
|
70
|
+
-ms-flex-align: start;
|
71
|
+
align-items: start;
|
72
|
+
-webkit-box-pack: justify;
|
73
|
+
-ms-flex-pack: justify;
|
74
|
+
justify-content: space-between;
|
75
|
+
}
|
63
76
|
.mfui-card__icon {
|
64
77
|
width: 40px;
|
65
78
|
height: 40px;
|
@@ -67,23 +80,24 @@ h5 {
|
|
67
80
|
}
|
68
81
|
.mfui-card__img-box {
|
69
82
|
position: relative;
|
70
|
-
margin-bottom: 24px;
|
71
83
|
padding-bottom: 56.25%;
|
72
|
-
border-radius:
|
84
|
+
border-radius: 24px;
|
73
85
|
overflow: hidden;
|
74
86
|
}
|
87
|
+
.mfui-card__img-box_position_top {
|
88
|
+
margin: -6px -6px 24px -6px;
|
89
|
+
}
|
75
90
|
@media screen and (min-width: 1280px) {
|
76
|
-
.mfui-card__img-
|
77
|
-
margin
|
91
|
+
.mfui-card__img-box_position_top {
|
92
|
+
margin: -12px -12px 32px -12px;
|
78
93
|
}
|
79
94
|
}
|
80
95
|
.mfui-card__img-box_position_bottom {
|
81
|
-
margin
|
82
|
-
margin-bottom: 0;
|
96
|
+
margin: 24px -6px 0 -6px;
|
83
97
|
}
|
84
98
|
@media screen and (min-width: 1280px) {
|
85
99
|
.mfui-card__img-box_position_bottom {
|
86
|
-
margin
|
100
|
+
margin: 32px -12px 0 -12px;
|
87
101
|
}
|
88
102
|
}
|
89
103
|
.mfui-card__img {
|
@@ -101,6 +115,35 @@ h5 {
|
|
101
115
|
-webkit-transform: scale(1.2);
|
102
116
|
transform: scale(1.2);
|
103
117
|
}
|
118
|
+
.mfui-card__marker-list {
|
119
|
+
margin: 16px 0 0 0;
|
120
|
+
padding: 0;
|
121
|
+
list-style-type: none;
|
122
|
+
}
|
123
|
+
.mfui-card__marker-item {
|
124
|
+
position: relative;
|
125
|
+
padding-left: 20px;
|
126
|
+
}
|
127
|
+
.mfui-card__marker-item:not(:last-child) {
|
128
|
+
margin-bottom: 12px;
|
129
|
+
}
|
130
|
+
.mfui-card__marker-item:before {
|
131
|
+
content: '';
|
132
|
+
position: absolute;
|
133
|
+
top: 7px;
|
134
|
+
left: 0;
|
135
|
+
width: 6px;
|
136
|
+
height: 6px;
|
137
|
+
border-radius: 50%;
|
138
|
+
background-color: var(--stcBlack20);
|
139
|
+
opacity: 0.8;
|
140
|
+
}
|
141
|
+
.mfui-card__marker-note {
|
142
|
+
display: block;
|
143
|
+
margin: 4px 0 0 0;
|
144
|
+
padding: 0;
|
145
|
+
font-weight: 500;
|
146
|
+
}
|
104
147
|
.mfui-card__texts {
|
105
148
|
display: -webkit-box;
|
106
149
|
display: -ms-flexbox;
|
@@ -117,6 +160,9 @@ h5 {
|
|
117
160
|
margin: 0;
|
118
161
|
padding-left: 24px;
|
119
162
|
}
|
163
|
+
.mfui-card__texts ul {
|
164
|
+
list-style-type: disc;
|
165
|
+
}
|
120
166
|
.mfui-card__texts-title {
|
121
167
|
font-weight: 500;
|
122
168
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import React, { Ref } from 'react';
|
1
|
+
import React, { ReactElement, Ref } from 'react';
|
2
2
|
import './Card.less';
|
3
|
-
import { ButtonType, FeaturesList, IconsList, Image, Link, Price, TextsList, Title } from './types';
|
3
|
+
import { ButtonType, FeaturesList, IconsList, Image, Link, MarkerList, Price, TextsList, Title } from './types';
|
4
4
|
export interface ICard {
|
5
5
|
/** Дополнительные data атрибуты к внутренним элементам */
|
6
6
|
dataAttrs?: {
|
@@ -22,7 +22,7 @@ export interface ICard {
|
|
22
22
|
rootRef?: Ref<HTMLDivElement | HTMLAnchorElement>;
|
23
23
|
isFullHeight?: boolean;
|
24
24
|
/** Вид */
|
25
|
-
view?: 'shadow' | 'background';
|
25
|
+
view?: 'shadow' | 'hover-shadow' | 'background';
|
26
26
|
/** Ссылка для карточки */
|
27
27
|
link?: Link;
|
28
28
|
/** Изображение */
|
@@ -31,6 +31,8 @@ export interface ICard {
|
|
31
31
|
icon?: React.ReactNode;
|
32
32
|
/** Заголовок */
|
33
33
|
title: Title;
|
34
|
+
/** Маркированный список */
|
35
|
+
markerList?: MarkerList;
|
34
36
|
/** Список текстов */
|
35
37
|
textsList?: TextsList;
|
36
38
|
/** Список характеристик */
|
@@ -43,6 +45,8 @@ export interface ICard {
|
|
43
45
|
button?: ButtonType;
|
44
46
|
/** Дополнительная кнопка */
|
45
47
|
extraButton?: ButtonType;
|
48
|
+
/** Бейдж */
|
49
|
+
badge?: ReactElement;
|
46
50
|
/** Обработчик клика по карточке */
|
47
51
|
onClick?: () => void;
|
48
52
|
}
|
@@ -62,14 +62,16 @@ var Card = function Card(_ref5) {
|
|
62
62
|
image = _ref5.image,
|
63
63
|
icon = _ref5.icon,
|
64
64
|
title = _ref5.title,
|
65
|
+
markerList = _ref5.markerList,
|
65
66
|
textsList = _ref5.textsList,
|
66
67
|
featuresList = _ref5.featuresList,
|
67
68
|
iconsList = _ref5.iconsList,
|
68
69
|
price = _ref5.price,
|
69
70
|
button = _ref5.button,
|
70
71
|
extraButton = _ref5.extraButton,
|
72
|
+
badge = _ref5.badge,
|
71
73
|
onClick = _ref5.onClick;
|
72
|
-
var isOnlyTitle = !image && !icon && !textsList && !featuresList && !iconsList && !price && !button && !extraButton;
|
74
|
+
var isOnlyTitle = !image && !icon && !markerList && !textsList && !featuresList && !iconsList && !price && !button && !extraButton;
|
73
75
|
var isLink = (link === null || link === void 0 ? void 0 : link.href) && !button && !extraButton;
|
74
76
|
var isBottomImage = (image === null || image === void 0 ? void 0 : image.position) === 'bottom';
|
75
77
|
var ElementType = isLink ? 'a' : 'div';
|
@@ -79,14 +81,18 @@ var Card = function Card(_ref5) {
|
|
79
81
|
return null;
|
80
82
|
}
|
81
83
|
|
84
|
+
var _image$position = image.position,
|
85
|
+
position = _image$position === void 0 ? 'top' : _image$position,
|
86
|
+
src = image.src,
|
87
|
+
alt = image.alt;
|
82
88
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.imgBox), {
|
83
89
|
className: cn('img-box', {
|
84
|
-
position:
|
90
|
+
position: position
|
85
91
|
})
|
86
92
|
}), /*#__PURE__*/_react["default"].createElement("img", {
|
87
93
|
className: cn('img'),
|
88
|
-
src:
|
89
|
-
alt:
|
94
|
+
src: src,
|
95
|
+
alt: alt
|
90
96
|
}));
|
91
97
|
};
|
92
98
|
|
@@ -101,6 +107,19 @@ var Card = function Card(_ref5) {
|
|
101
107
|
};
|
102
108
|
|
103
109
|
var renderContent = function renderContent() {
|
110
|
+
if (markerList) {
|
111
|
+
return /*#__PURE__*/_react["default"].createElement("ul", {
|
112
|
+
className: cn('marker-list')
|
113
|
+
}, markerList.map(function (item, i) {
|
114
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
115
|
+
className: cn('marker-item'),
|
116
|
+
key: i
|
117
|
+
}, (0, _uiHelpers.convert)(item.title, {}), !!item.note && /*#__PURE__*/_react["default"].createElement("span", {
|
118
|
+
className: cn('marker-note')
|
119
|
+
}, (0, _uiHelpers.convert)(item.note, {})));
|
120
|
+
}));
|
121
|
+
}
|
122
|
+
|
104
123
|
if (textsList) {
|
105
124
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
106
125
|
className: cn('texts')
|
@@ -225,11 +244,13 @@ var Card = function Card(_ref5) {
|
|
225
244
|
target: isLink ? link === null || link === void 0 ? void 0 : link.target : undefined,
|
226
245
|
onClick: isLink ? onClick : undefined,
|
227
246
|
ref: rootRef
|
228
|
-
}), renderIcon(), !isBottomImage && renderImage(), /*#__PURE__*/_react["default"].createElement(
|
247
|
+
}), renderIcon(), !isBottomImage && renderImage(), /*#__PURE__*/_react["default"].createElement("div", {
|
248
|
+
className: cn('header')
|
249
|
+
}, /*#__PURE__*/_react["default"].createElement(_uiCore.Header, {
|
229
250
|
className: cn('title'),
|
230
251
|
as: "h3",
|
231
252
|
align: title.align
|
232
|
-
}, title.text), renderContent(), renderFooter());
|
253
|
+
}, title.text), badge), renderContent(), renderFooter());
|
233
254
|
};
|
234
255
|
|
235
256
|
Card.propTypes = {
|
@@ -20,6 +20,12 @@ export declare type Title = {
|
|
20
20
|
/** Выравнивание */
|
21
21
|
align?: 'left' | 'center';
|
22
22
|
};
|
23
|
+
export declare type MarkerList = {
|
24
|
+
/** Заголовок */
|
25
|
+
title: string;
|
26
|
+
/** Примечание */
|
27
|
+
note?: string;
|
28
|
+
}[];
|
23
29
|
export declare type TextsList = {
|
24
30
|
/** Заголовок */
|
25
31
|
title?: string;
|