@megafon/ui-shared 6.0.0-beta.1 → 6.0.0-beta.3
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/dist/es/components/AudioPlayer/style/AudioRange.css +1 -1
- package/dist/es/components/BannerBox/BannerBox.d.ts +1 -1
- package/dist/es/components/Card/Card.css +1 -1
- package/dist/es/components/Card/Card.d.ts +6 -2
- package/dist/es/components/Card/Card.js +26 -6
- package/dist/es/components/Card/types.d.ts +6 -0
- package/dist/es/components/Container/Container.css +1 -1
- package/dist/es/components/Container/Container.js +3 -1
- package/dist/es/components/ImageBanner/ImageBanner.css +1 -1
- package/dist/es/components/ImageBanner/ImageBanner.d.ts +12 -14
- package/dist/es/components/ImageBanner/ImageBanner.js +31 -23
- package/dist/es/components/TextWithIcon/TextWithIconItem.css +1 -1
- package/dist/lib/components/AudioPlayer/style/AudioRange.css +1 -1
- package/dist/lib/components/BannerBox/BannerBox.d.ts +1 -1
- package/dist/lib/components/Card/Card.css +1 -1
- package/dist/lib/components/Card/Card.d.ts +6 -2
- package/dist/lib/components/Card/Card.js +26 -6
- package/dist/lib/components/Card/types.d.ts +6 -0
- package/dist/lib/components/Container/Container.css +1 -1
- package/dist/lib/components/Container/Container.js +3 -1
- package/dist/lib/components/ImageBanner/ImageBanner.css +1 -1
- package/dist/lib/components/ImageBanner/ImageBanner.d.ts +12 -14
- package/dist/lib/components/ImageBanner/ImageBanner.js +30 -22
- package/dist/lib/components/TextWithIcon/TextWithIconItem.css +1 -1
- package/package.json +8 -10
@@ -1 +1 @@
|
|
1
|
-
h1,h2,h3,h4,h5{margin:0}.mfui-image-banner{
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-image-banner{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;overflow:hidden}@media screen and (min-width:1024px){.mfui-image-banner{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:420px}}.mfui-image-banner__picture{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}@media screen and (min-width:1024px){.mfui-image-banner__picture{height:100%;max-width:672px;width:50%}}.mfui-image-banner__picture_v-align_top{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.mfui-image-banner__picture_v-align_center{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.mfui-image-banner__picture_v-align_bottom{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.mfui-image-banner__image{display:block;max-height:150px;max-width:100%}@media screen and (min-width:768px) and (max-width:1023px){.mfui-image-banner__image{max-height:230px}}@media screen and (min-width:1024px){.mfui-image-banner__image{max-height:100%;-o-object-fit:contain;object-fit:contain}}.mfui-image-banner__content{z-index:1;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}@media screen and (max-width:1023px){.mfui-image-banner__content{padding:24px}}@media screen and (min-width:768px) and (max-width:1023px){.mfui-image-banner__content{text-align:center}}@media screen and (min-width:1024px){.mfui-image-banner__content{padding:0 80px;width:50%}}.mfui-image-banner__description{margin-top:16px;white-space:pre-wrap}.mfui-image-banner__cost{font-size:15px;font-weight:500;line-height:24px;margin-top:16px}.mfui-image-banner__value{display:inline;margin:0 4px}@media screen and (max-width:1023px),screen and (min-width:1024px) and (max-width:1279px){.mfui-image-banner__value{line-height:21px}}.mfui-image-banner__text,.mfui-image-banner__title{white-space:pre-wrap}.mfui-image-banner__children{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:16px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-top:32px}@media screen and (max-width:767px){.mfui-image-banner__children{-webkit-box-align:center;-ms-flex-align:center;align-items:center}}@media screen and (min-width:768px){.mfui-image-banner__children{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}}@media screen and (min-width:1024px){.mfui-image-banner__children{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}}@media screen and (max-width:1023px){.mfui-image-banner__badges-container{display:-webkit-box;display:-ms-flexbox;display:flex;gap:8px}}.mfui-image-banner__badges{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:8px;margin-bottom:16px}.mfui-image-banner__ad-block{margin:0 0 16px auto}@media screen and (min-width:1024px){.mfui-image-banner__ad-block{position:absolute;right:24px;top:24px}}.mfui-image-banner_radius_rounded{border-radius:24px}@media screen and (min-width:1024px){.mfui-image-banner_auto-height .mfui-image-banner__content{padding:48px 80px}.mfui-image-banner_auto-height{height:auto}.mfui-image-banner_has-image .mfui-image-banner__content{padding-right:0}.mfui-image-banner_full-width .mfui-image-banner__image{bottom:0;display:block;max-width:unset;position:absolute;right:0}.mfui-image-banner_full-width.mfui-image-banner_auto-height .mfui-image-banner__image{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}}.mfui-image-banner_background-color_green{background-color:var(--brandGreen)}.mfui-image-banner_background-color_purple{background-color:var(--brandPurple)}.mfui-image-banner_background-color_gradient{background:-webkit-gradient(linear,right top,left top,from(#ada6ba),to(#f6f2f9));background:linear-gradient(270deg,#ada6ba,#f6f2f9)}.mfui-image-banner_background-color_light{background-color:#f6f2f9}.mfui-image-banner_background-color_spbSky0{background-color:var(--spbSky0)}.mfui-image-banner_text-color_light .mfui-image-banner__content{color:var(--stcWhite)}.mfui-image-banner_text-color_dark .mfui-image-banner__content{color:var(--stcBlack)}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { PriceBadge } from '@megafon/ui-core';
|
3
2
|
import './ImageBanner.scss';
|
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 type ImageVerticalAlignType = (typeof ImageVerticalAlign)[keyof typeof ImageVerticalAlign];
|
29
|
-
type PriceBadgeTypes = React.ComponentProps<typeof PriceBadge>;
|
30
|
-
export type PriceBadgePropsType = Pick<PriceBadgeTypes, 'iconType'> & {
|
31
|
-
/** Текст бейджа */
|
32
|
-
text: string;
|
33
|
-
};
|
34
28
|
export interface IImageBannerProps {
|
35
29
|
/** Дополнительные data атрибуты к внутренним элементам */
|
36
30
|
dataAttrs?: {
|
@@ -43,22 +37,27 @@ 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?: React.Ref<HTMLDivElement>;
|
56
51
|
/** Заголовок */
|
57
|
-
title
|
52
|
+
title?: string | React.ReactNode | React.ReactNode[];
|
58
53
|
/** Текст-описание */
|
59
54
|
description?: string | React.ReactNode | React.ReactNode[];
|
60
55
|
/** Строка со стоимостью услуги */
|
61
56
|
cost?: string;
|
57
|
+
/** Тег заголовка на разрешении экрана 0-767 */
|
58
|
+
headerLevelMobile?: 'h1' | 'h2';
|
59
|
+
/** Тег заголовка на разрешении экрана 768+ */
|
60
|
+
headerLevel?: 'h1' | 'h2';
|
62
61
|
/** Фоновый цвет */
|
63
62
|
backgroundColor?: BackgroundColorType;
|
64
63
|
/** Радиус границы */
|
@@ -79,12 +78,11 @@ export interface IImageBannerProps {
|
|
79
78
|
autoHeight?: boolean;
|
80
79
|
/** Изображение растягивается на всю ширину или вписывается в фиксированный фрейм (по умолчанию фрейм) */
|
81
80
|
isImageFullWidth?: boolean;
|
82
|
-
/**
|
83
|
-
badges?:
|
84
|
-
/** Дополнительный отступ снизу при использовании в баннере */
|
85
|
-
hasBottomOffset?: boolean;
|
81
|
+
/** Бейджи */
|
82
|
+
badges?: JSX.Element[] | JSX.Element;
|
86
83
|
/** Элемент блока с рекламой */
|
87
|
-
adBlock?: JSX.Element;
|
84
|
+
adBlock?: JSX.Element | null;
|
85
|
+
children?: React.ReactNode;
|
88
86
|
}
|
89
|
-
declare const ImageBanner: React.FC<
|
87
|
+
declare const ImageBanner: React.FC<IImageBannerProps>;
|
90
88
|
export default ImageBanner;
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports["default"] = exports.Radius = exports.NavTheme = exports.ImageVerticalAlign = exports.BackgroundColor = void 0;
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
10
|
require("core-js/modules/es.symbol.js");
|
10
11
|
require("core-js/modules/es.symbol.description.js");
|
11
12
|
require("core-js/modules/es.array.concat.js");
|
12
|
-
require("core-js/modules/es.array.map.js");
|
13
13
|
var React = _interopRequireWildcard(require("react"));
|
14
14
|
var _uiCore = require("@megafon/ui-core");
|
15
15
|
var _uiHelpers = require("@megafon/ui-helpers");
|
@@ -80,32 +80,41 @@ var ImageBanner = function ImageBanner(_ref2) {
|
|
80
80
|
title = _ref2.title,
|
81
81
|
description = _ref2.description,
|
82
82
|
cost = _ref2.cost,
|
83
|
+
_ref2$headerLevelMobi = _ref2.headerLevelMobile,
|
84
|
+
headerLevelMobile = _ref2$headerLevelMobi === void 0 ? 'h1' : _ref2$headerLevelMobi,
|
85
|
+
_ref2$headerLevel = _ref2.headerLevel,
|
86
|
+
headerLevel = _ref2$headerLevel === void 0 ? 'h1' : _ref2$headerLevel,
|
83
87
|
_ref2$backgroundColor = _ref2.backgroundColor,
|
84
88
|
backgroundColor = _ref2$backgroundColor === void 0 ? BackgroundColor.TRANSPARENT : _ref2$backgroundColor,
|
85
89
|
_ref2$radius = _ref2.radius,
|
86
90
|
radius = _ref2$radius === void 0 ? Radius.CORNERS : _ref2$radius,
|
87
91
|
autoHeight = _ref2.autoHeight,
|
88
92
|
isImageFullWidth = _ref2.isImageFullWidth,
|
89
|
-
|
90
|
-
badges = _ref2$badges === void 0 ? [] : _ref2$badges,
|
91
|
-
hasBottomOffset = _ref2.hasBottomOffset,
|
93
|
+
badges = _ref2.badges,
|
92
94
|
adBlock = _ref2.adBlock,
|
93
95
|
_ref2$children = _ref2.children,
|
94
96
|
children = _ref2$children === void 0 ? [] : _ref2$children;
|
97
|
+
var _React$useState = React.useState(false),
|
98
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
99
|
+
isMobile = _React$useState2[0],
|
100
|
+
setIsMobile = _React$useState2[1];
|
101
|
+
React.useEffect(function () {
|
102
|
+
var mediaQuery = window.matchMedia("(max-width: ".concat(_uiHelpers.breakpoints.MOBILE_MIDDLE_END, "px)"));
|
103
|
+
var handleMediaChange = function handleMediaChange(_ref3) {
|
104
|
+
var matches = _ref3.matches;
|
105
|
+
setIsMobile(matches);
|
106
|
+
};
|
107
|
+
setIsMobile(mediaQuery.matches);
|
108
|
+
mediaQuery.addEventListener('change', handleMediaChange);
|
109
|
+
return function () {
|
110
|
+
mediaQuery.removeEventListener('change', handleMediaChange);
|
111
|
+
};
|
112
|
+
}, []);
|
95
113
|
var navTheme = getTheme(backgroundColor);
|
96
114
|
var hasImage = !!(imageMobile || imageMobile2x || imageDesktop || imageDesktop2x);
|
97
|
-
var renderBadges = !!badges
|
115
|
+
var renderBadges = !!badges && /*#__PURE__*/React.createElement("div", {
|
98
116
|
className: cn('badges', [classes.badges])
|
99
|
-
}, badges
|
100
|
-
var text = _ref3.text,
|
101
|
-
iconType = _ref3.iconType;
|
102
|
-
return /*#__PURE__*/React.createElement(_uiCore.PriceBadge, {
|
103
|
-
className: classes.badge,
|
104
|
-
theme: navTheme,
|
105
|
-
iconType: iconType,
|
106
|
-
key: text
|
107
|
-
}, text);
|
108
|
-
}));
|
117
|
+
}, badges);
|
109
118
|
var renderAdBlock = !!adBlock && /*#__PURE__*/React.createElement("div", {
|
110
119
|
className: cn('ad-block', [classes.adBlock])
|
111
120
|
}, adBlock);
|
@@ -115,7 +124,8 @@ var ImageBanner = function ImageBanner(_ref2) {
|
|
115
124
|
className: cn('badges-container', [classes.badgesContainer])
|
116
125
|
}, renderBadges, renderAdBlock), !!title && /*#__PURE__*/React.createElement(_uiCore.Header, {
|
117
126
|
className: cn('title', [classes.title]),
|
118
|
-
color: "inherit"
|
127
|
+
color: "inherit",
|
128
|
+
as: isMobile ? headerLevelMobile : headerLevel
|
119
129
|
}, typeof title === 'string' ? (0, _uiHelpers.convert)(title, _uiHelpers.titleConvertConfig) : title), !!description && /*#__PURE__*/React.createElement(_uiCore.Header, {
|
120
130
|
className: cn('description', [classes.description]),
|
121
131
|
as: "h5",
|
@@ -123,17 +133,18 @@ var ImageBanner = function ImageBanner(_ref2) {
|
|
123
133
|
}, typeof description === 'string' ? (0, _uiHelpers.convert)(description, _uiHelpers.titleConvertConfig) : description), !!cost && /*#__PURE__*/React.createElement("div", {
|
124
134
|
className: cn('cost', [classes.cost])
|
125
135
|
}, (0, _uiHelpers.convert)(cost, typographyConfig)), !!children && !!React.Children.count(children) && /*#__PURE__*/React.createElement("div", {
|
126
|
-
className: cn('children')
|
136
|
+
className: cn('children', [classes.children])
|
127
137
|
}, children));
|
128
138
|
var renderImage = /*#__PURE__*/React.createElement("picture", {
|
129
139
|
className: cn('picture', {
|
130
140
|
'v-align': imageVerticalAlign
|
131
141
|
})
|
132
142
|
}, /*#__PURE__*/React.createElement("source", {
|
143
|
+
className: classes.imageSource,
|
133
144
|
media: "(min-width: ".concat(_uiHelpers.breakpoints.DESKTOP_SMALL_START, "px)"),
|
134
145
|
srcSet: "".concat(imageDesktop, ", ").concat(imageDesktop2x, " 2x")
|
135
146
|
}), /*#__PURE__*/React.createElement("img", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image), {
|
136
|
-
className: cn('
|
147
|
+
className: cn('image', [classes.image]),
|
137
148
|
src: imageMobile || imageMobile2x,
|
138
149
|
srcSet: imageMobile2x ? "".concat(imageMobile2x, " 2x") : undefined,
|
139
150
|
alt: imageAlt
|
@@ -145,12 +156,9 @@ var ImageBanner = function ImageBanner(_ref2) {
|
|
145
156
|
'has-image': hasImage,
|
146
157
|
'auto-height': autoHeight,
|
147
158
|
'full-width': isImageFullWidth,
|
148
|
-
'bottom-offset': hasBottomOffset && !hasImage,
|
149
159
|
radius: radius
|
150
160
|
}, [className, classes.root]),
|
151
161
|
ref: rootRef
|
152
|
-
}),
|
153
|
-
className: cn('wrapper')
|
154
|
-
}, renderContent, hasImage && renderImage));
|
162
|
+
}), renderContent, hasImage && renderImage);
|
155
163
|
};
|
156
164
|
var _default = exports["default"] = ImageBanner;
|
@@ -1 +1 @@
|
|
1
|
-
h1,h2,h3,h4,h5{margin:0}.mfui-text-with-icon-item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.mfui-text-with-icon-item:not(:first-of-type){margin-top:
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-text-with-icon-item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.mfui-text-with-icon-item:not(:first-of-type){margin-top:12px}.mfui-text-with-icon-item__svg-icon{border:1px solid var(--spbSky2);border-radius:50%;height:44px;margin-right:16px;min-height:44px;min-width:44px;overflow:hidden;padding:6px;width:44px}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@megafon/ui-shared",
|
3
|
-
"version": "6.0.0-beta.
|
3
|
+
"version": "6.0.0-beta.3",
|
4
4
|
"files": [
|
5
5
|
"dist"
|
6
6
|
],
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"typings": "dist/lib/index.d.ts",
|
10
10
|
"sideEffects": [
|
11
11
|
"*.css",
|
12
|
-
"*.
|
12
|
+
"*.scss"
|
13
13
|
],
|
14
14
|
"author": "MegaFon",
|
15
15
|
"license": "MIT",
|
@@ -21,10 +21,10 @@
|
|
21
21
|
"typecheck": "tsc --noEmit -p .",
|
22
22
|
"prettier:check": "prettier --list-different \"src/**/*.{js,jsx,ts,tsx}\"",
|
23
23
|
"prettier:fix": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
|
24
|
-
"lint": "yarn lint:ts && yarn lint:
|
24
|
+
"lint": "yarn lint:ts && yarn lint:style",
|
25
25
|
"lint:ts": "eslint --ext .js,.jsx,.ts,.tsx src --max-warnings=0",
|
26
|
-
"lint:
|
27
|
-
"lint:
|
26
|
+
"lint:style": "stylelint --syntax scss src/**/*.scss src/**/**/*.scss",
|
27
|
+
"lint:style:fix": "yarn lint:style --fix",
|
28
28
|
"test": "yarn test:unit",
|
29
29
|
"test:unit": "jest",
|
30
30
|
"test:update": "jest --updateSnapshot"
|
@@ -48,7 +48,6 @@
|
|
48
48
|
"@babel/preset-env": "^7.8.6",
|
49
49
|
"@babel/preset-react": "^7.8.3",
|
50
50
|
"@babel/preset-typescript": "^7.8.3",
|
51
|
-
"@megafon/ui-icons": "^3.0.0-beta.1",
|
52
51
|
"@svgr/core": "^2.4.1",
|
53
52
|
"@testing-library/jest-dom": "6.4.2",
|
54
53
|
"@testing-library/react": "14.2.1",
|
@@ -64,12 +63,10 @@
|
|
64
63
|
"gulp": "^4.0.2",
|
65
64
|
"gulp-babel": "^8.0.0-beta.2",
|
66
65
|
"gulp-imagemin": "^7.1.0",
|
67
|
-
"gulp-less": "^4.0.1",
|
68
66
|
"gulp-postcss": "^10.0.0",
|
69
67
|
"gulp-sass": "^5.1.0",
|
70
68
|
"gulp-typescript": "^5.0.1",
|
71
69
|
"jest": "^29.7.0",
|
72
|
-
"less-plugin-autoprefix": "^2.0.0",
|
73
70
|
"merge2": "^1.3.0",
|
74
71
|
"react": "^18.2.0",
|
75
72
|
"react-dom": "^18.2.0",
|
@@ -80,12 +77,13 @@
|
|
80
77
|
},
|
81
78
|
"dependencies": {
|
82
79
|
"@babel/runtime": "^7.8.4",
|
83
|
-
"@megafon/ui-core": "^6.0.0-beta.
|
80
|
+
"@megafon/ui-core": "^6.0.0-beta.3",
|
84
81
|
"@megafon/ui-helpers": "^3.0.0-beta.1",
|
82
|
+
"@megafon/ui-icons": "^3.0.0-beta.1",
|
85
83
|
"core-js": "^3.6.4",
|
86
84
|
"htmr": "^1.0.2",
|
87
85
|
"lodash.throttle": "^4.1.1",
|
88
86
|
"swiper": "^11.1.1"
|
89
87
|
},
|
90
|
-
"gitHead": "
|
88
|
+
"gitHead": "091a93c01faf8ceb783603f3770bfbd78e41ef00"
|
91
89
|
}
|