@megafon/ui-shared 6.11.1 → 6.12.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/dist/es/components/Card/Card.d.ts +3 -3
- package/dist/es/components/Card/Card.js +7 -1
- package/dist/es/components/Card/types.d.ts +19 -1
- package/dist/es/components/PageTitle/PageTitle.css +27 -0
- package/dist/es/components/PageTitle/PageTitle.d.ts +6 -1
- package/dist/es/components/PageTitle/PageTitle.js +33 -17
- package/dist/lib/components/Card/Card.d.ts +3 -3
- package/dist/lib/components/Card/Card.js +7 -1
- package/dist/lib/components/Card/types.d.ts +19 -1
- package/dist/lib/components/PageTitle/PageTitle.css +27 -0
- package/dist/lib/components/PageTitle/PageTitle.d.ts +6 -1
- package/dist/lib/components/PageTitle/PageTitle.js +34 -16
- package/package.json +3 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { ReactElement, Ref } from 'react';
|
2
2
|
import './Card.less';
|
3
|
-
import {
|
3
|
+
import { ExtraButtonType, FeaturesList, IconsList, Image, Link, MainButtonType, MarkerList, Price, TextsList, Title } from './types';
|
4
4
|
export interface ICard {
|
5
5
|
/** Дополнительные data атрибуты к внутренним элементам */
|
6
6
|
dataAttrs?: {
|
@@ -42,9 +42,9 @@ export interface ICard {
|
|
42
42
|
/** Цена */
|
43
43
|
price?: Price;
|
44
44
|
/** Кнопка */
|
45
|
-
button?:
|
45
|
+
button?: MainButtonType;
|
46
46
|
/** Дополнительная кнопка */
|
47
|
-
extraButton?:
|
47
|
+
extraButton?: ExtraButtonType;
|
48
48
|
/** Бейдж */
|
49
49
|
badge?: ReactElement;
|
50
50
|
/** Обработчик клика по карточке */
|
@@ -184,6 +184,7 @@ var Card = function Card(_ref5) {
|
|
184
184
|
return null;
|
185
185
|
}
|
186
186
|
|
187
|
+
var extraButtonType = (button === null || button === void 0 ? void 0 : button.type) === 'outline' ? 'text' : extraButton === null || extraButton === void 0 ? void 0 : extraButton.type;
|
187
188
|
return /*#__PURE__*/React.createElement("div", {
|
188
189
|
className: cn('buttons', {
|
189
190
|
centered: (button === null || button === void 0 ? void 0 : button.isCentered) || (extraButton === null || extraButton === void 0 ? void 0 : extraButton.isCentered)
|
@@ -195,6 +196,8 @@ var Card = function Card(_ref5) {
|
|
195
196
|
className: cn('button', [classes === null || classes === void 0 ? void 0 : classes.button]),
|
196
197
|
href: button.href,
|
197
198
|
target: button.target,
|
199
|
+
type: button.type || 'primary',
|
200
|
+
theme: button.theme || 'green',
|
198
201
|
onClick: button === null || button === void 0 ? void 0 : button.onClick
|
199
202
|
}, button.title), !!extraButton && /*#__PURE__*/React.createElement(Button, {
|
200
203
|
dataAttrs: {
|
@@ -203,7 +206,7 @@ var Card = function Card(_ref5) {
|
|
203
206
|
className: cn('button', [classes === null || classes === void 0 ? void 0 : classes.extraButton]),
|
204
207
|
href: extraButton.href,
|
205
208
|
target: extraButton.target,
|
206
|
-
type:
|
209
|
+
type: extraButtonType || 'outline',
|
207
210
|
onClick: extraButton === null || extraButton === void 0 ? void 0 : extraButton.onClick
|
208
211
|
}, extraButton.title));
|
209
212
|
};
|
@@ -298,6 +301,8 @@ Card.propTypes = {
|
|
298
301
|
href: PropTypes.string,
|
299
302
|
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
300
303
|
isCentered: PropTypes.bool,
|
304
|
+
type: PropTypes.oneOf(['primary', 'outline']),
|
305
|
+
theme: PropTypes.oneOf(['green', 'green-soft']),
|
301
306
|
onClick: PropTypes.func
|
302
307
|
}),
|
303
308
|
extraButton: PropTypes.shape({
|
@@ -305,6 +310,7 @@ Card.propTypes = {
|
|
305
310
|
href: PropTypes.string,
|
306
311
|
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
307
312
|
isCentered: PropTypes.bool,
|
313
|
+
type: PropTypes.oneOf(['text', 'outline']),
|
308
314
|
onClick: PropTypes.func
|
309
315
|
}),
|
310
316
|
onClick: PropTypes.func
|
@@ -62,7 +62,7 @@ export declare type Price = {
|
|
62
62
|
/** Период */
|
63
63
|
period?: string;
|
64
64
|
};
|
65
|
-
export declare type
|
65
|
+
export declare type MainButtonType = {
|
66
66
|
/** Название */
|
67
67
|
title: string;
|
68
68
|
/** Ссылка */
|
@@ -71,6 +71,24 @@ export declare type ButtonType = {
|
|
71
71
|
target?: Target;
|
72
72
|
/** Центрировать кнопку */
|
73
73
|
isCentered?: boolean;
|
74
|
+
/** Тип кнопки */
|
75
|
+
type?: 'primary' | 'outline';
|
76
|
+
/** Тема кнопки */
|
77
|
+
theme?: 'green' | 'green-soft';
|
78
|
+
/** Обработчик клика по кнопке */
|
79
|
+
onClick?: () => void;
|
80
|
+
};
|
81
|
+
export declare type ExtraButtonType = {
|
82
|
+
/** Название */
|
83
|
+
title: string;
|
84
|
+
/** Ссылка */
|
85
|
+
href?: string;
|
86
|
+
/** Target свойство кнопки */
|
87
|
+
target?: Target;
|
88
|
+
/** Центрировать кнопку */
|
89
|
+
isCentered?: boolean;
|
90
|
+
/** Тип кнопки */
|
91
|
+
type?: 'outline' | 'text';
|
74
92
|
/** Обработчик клика по кнопке */
|
75
93
|
onClick?: () => void;
|
76
94
|
};
|
@@ -67,6 +67,33 @@ h5 {
|
|
67
67
|
margin-top: 45px;
|
68
68
|
}
|
69
69
|
}
|
70
|
+
.mfui-v6-page-title__title_single.mfui-v6-page-title__title_margin-top_small {
|
71
|
+
margin-top: 48px;
|
72
|
+
}
|
73
|
+
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
74
|
+
.mfui-v6-page-title__title_single.mfui-v6-page-title__title_margin-top_small {
|
75
|
+
margin-top: 40px;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
@media screen and (max-width: 767px) {
|
79
|
+
.mfui-v6-page-title__title_single.mfui-v6-page-title__title_margin-top_small {
|
80
|
+
margin-top: 32px;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
.mfui-v6-page-title__description {
|
84
|
+
font-family: inherit;
|
85
|
+
font-size: 15px;
|
86
|
+
line-height: 24px;
|
87
|
+
font-weight: 400;
|
88
|
+
margin-top: 24px;
|
89
|
+
color: inherit;
|
90
|
+
white-space: pre-wrap;
|
91
|
+
}
|
92
|
+
@media screen and (max-width: 767px) {
|
93
|
+
.mfui-v6-page-title__description {
|
94
|
+
margin-top: 16px;
|
95
|
+
}
|
96
|
+
}
|
70
97
|
.mfui-v6-page-title__badge + .mfui-v6-page-title__title {
|
71
98
|
margin-top: 8px;
|
72
99
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import './PageTitle.less';
|
3
2
|
import { Props as BreadcrumbsType } from '../Breadcrumbs/Breadcrumbs';
|
3
|
+
import './PageTitle.less';
|
4
4
|
export declare type PageTitleProps = {
|
5
5
|
/** Дополнительные data атрибуты к внутренним элементам */
|
6
6
|
dataAttrs?: {
|
@@ -10,6 +10,8 @@ export declare type PageTitleProps = {
|
|
10
10
|
};
|
11
11
|
/** Текст заголовка */
|
12
12
|
title: string | React.ReactNode | React.ReactNode[];
|
13
|
+
/** Описание */
|
14
|
+
description?: string | React.ReactNode | React.ReactNode[];
|
13
15
|
/** Хлебные крошки */
|
14
16
|
breadcrumbs?: BreadcrumbsType['items'];
|
15
17
|
/** Текст бейджа */
|
@@ -18,10 +20,13 @@ export declare type PageTitleProps = {
|
|
18
20
|
isFullWidth?: boolean;
|
19
21
|
/** Включить микроразметку для хлебных крошек */
|
20
22
|
hasBreadcrumbsMicrodata?: boolean;
|
23
|
+
/** Отступ сверху */
|
24
|
+
marginTop?: 'default' | 'small';
|
21
25
|
/** Класс для корневого элемента */
|
22
26
|
className?: string;
|
23
27
|
/** Дополнительные классы для внутренних элементов */
|
24
28
|
classes?: {
|
29
|
+
title?: string;
|
25
30
|
breadcrumbs?: string;
|
26
31
|
};
|
27
32
|
/** Ссылка на корневой элемент */
|
@@ -1,40 +1,52 @@
|
|
1
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";
|
2
4
|
import * as React from 'react';
|
3
5
|
import { Header, Grid, GridColumn } from '@megafon/ui-core';
|
4
6
|
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
5
7
|
import PropTypes from 'prop-types';
|
6
|
-
import "./PageTitle.css";
|
7
8
|
import Breadcrumbs from "../Breadcrumbs/Breadcrumbs";
|
9
|
+
import "./PageTitle.css";
|
8
10
|
var testIdPrefix = 'PageTitle';
|
9
11
|
var cn = cnCreate('mfui-v6-page-title');
|
10
12
|
|
11
13
|
var PageTitle = function PageTitle(_ref) {
|
12
14
|
var dataAttrs = _ref.dataAttrs,
|
13
15
|
title = _ref.title,
|
16
|
+
description = _ref.description,
|
14
17
|
breadcrumbs = _ref.breadcrumbs,
|
15
18
|
badge = _ref.badge,
|
16
19
|
_ref$isFullWidth = _ref.isFullWidth,
|
17
20
|
isFullWidth = _ref$isFullWidth === void 0 ? true : _ref$isFullWidth,
|
18
21
|
_ref$hasBreadcrumbsMi = _ref.hasBreadcrumbsMicrodata,
|
19
22
|
hasBreadcrumbsMicrodata = _ref$hasBreadcrumbsMi === void 0 ? false : _ref$hasBreadcrumbsMi,
|
23
|
+
_ref$marginTop = _ref.marginTop,
|
24
|
+
marginTop = _ref$marginTop === void 0 ? 'default' : _ref$marginTop,
|
20
25
|
className = _ref.className,
|
21
26
|
_ref$classes = _ref.classes,
|
22
27
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
23
28
|
rootRef = _ref.rootRef;
|
24
29
|
var isBreadcrumbs = !!(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length);
|
25
|
-
var
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
},
|
37
|
-
|
30
|
+
var titleContent = /*#__PURE__*/React.createElement(React.Fragment, null, badge && /*#__PURE__*/React.createElement("div", {
|
31
|
+
className: cn('badge', {
|
32
|
+
'under-breadcrumbs': isBreadcrumbs
|
33
|
+
})
|
34
|
+
}, badge), /*#__PURE__*/React.createElement(Header, {
|
35
|
+
className: cn('title', {
|
36
|
+
single: !isBreadcrumbs && !badge,
|
37
|
+
'margin-top': marginTop,
|
38
|
+
'under-breadcrumbs': isBreadcrumbs && !badge
|
39
|
+
}, [classes.title]),
|
40
|
+
as: "h1"
|
41
|
+
}, title), description && /*#__PURE__*/React.createElement("div", {
|
42
|
+
className: cn('description')
|
43
|
+
}, description));
|
44
|
+
|
45
|
+
var renderContent = function renderContent() {
|
46
|
+
if (isFullWidth) {
|
47
|
+
return titleContent;
|
48
|
+
}
|
49
|
+
|
38
50
|
return /*#__PURE__*/React.createElement(Grid, {
|
39
51
|
dataAttrs: {
|
40
52
|
root: {
|
@@ -46,8 +58,9 @@ var PageTitle = function PageTitle(_ref) {
|
|
46
58
|
desktop: "10",
|
47
59
|
tablet: "12",
|
48
60
|
mobile: "12"
|
49
|
-
},
|
50
|
-
}
|
61
|
+
}, titleContent));
|
62
|
+
};
|
63
|
+
|
51
64
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
52
65
|
className: cn([className]),
|
53
66
|
ref: rootRef
|
@@ -61,7 +74,7 @@ var PageTitle = function PageTitle(_ref) {
|
|
61
74
|
link: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.breadcrumbsLink
|
62
75
|
},
|
63
76
|
className: cn('breadcrumbs', [classes.breadcrumbs])
|
64
|
-
}),
|
77
|
+
}), renderContent());
|
65
78
|
};
|
66
79
|
|
67
80
|
PageTitle.propTypes = {
|
@@ -71,6 +84,7 @@ PageTitle.propTypes = {
|
|
71
84
|
breadcrumbsLink: PropTypes.objectOf(PropTypes.string.isRequired)
|
72
85
|
}),
|
73
86
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired,
|
87
|
+
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
74
88
|
breadcrumbs: PropTypes.arrayOf(PropTypes.shape({
|
75
89
|
title: PropTypes.string.isRequired,
|
76
90
|
href: PropTypes.string
|
@@ -78,8 +92,10 @@ PageTitle.propTypes = {
|
|
78
92
|
badge: PropTypes.string,
|
79
93
|
isFullWidth: PropTypes.bool,
|
80
94
|
hasBreadcrumbsMicrodata: PropTypes.bool,
|
95
|
+
marginTop: PropTypes.oneOf(['default', 'small']),
|
81
96
|
className: PropTypes.string,
|
82
97
|
classes: PropTypes.shape({
|
98
|
+
title: PropTypes.string,
|
83
99
|
breadcrumbs: PropTypes.string
|
84
100
|
}),
|
85
101
|
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { ReactElement, Ref } from 'react';
|
2
2
|
import './Card.less';
|
3
|
-
import {
|
3
|
+
import { ExtraButtonType, FeaturesList, IconsList, Image, Link, MainButtonType, MarkerList, Price, TextsList, Title } from './types';
|
4
4
|
export interface ICard {
|
5
5
|
/** Дополнительные data атрибуты к внутренним элементам */
|
6
6
|
dataAttrs?: {
|
@@ -42,9 +42,9 @@ export interface ICard {
|
|
42
42
|
/** Цена */
|
43
43
|
price?: Price;
|
44
44
|
/** Кнопка */
|
45
|
-
button?:
|
45
|
+
button?: MainButtonType;
|
46
46
|
/** Дополнительная кнопка */
|
47
|
-
extraButton?:
|
47
|
+
extraButton?: ExtraButtonType;
|
48
48
|
/** Бейдж */
|
49
49
|
badge?: ReactElement;
|
50
50
|
/** Обработчик клика по карточке */
|
@@ -199,6 +199,7 @@ var Card = function Card(_ref5) {
|
|
199
199
|
return null;
|
200
200
|
}
|
201
201
|
|
202
|
+
var extraButtonType = (button === null || button === void 0 ? void 0 : button.type) === 'outline' ? 'text' : extraButton === null || extraButton === void 0 ? void 0 : extraButton.type;
|
202
203
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
203
204
|
className: cn('buttons', {
|
204
205
|
centered: (button === null || button === void 0 ? void 0 : button.isCentered) || (extraButton === null || extraButton === void 0 ? void 0 : extraButton.isCentered)
|
@@ -210,6 +211,8 @@ var Card = function Card(_ref5) {
|
|
210
211
|
className: cn('button', [classes === null || classes === void 0 ? void 0 : classes.button]),
|
211
212
|
href: button.href,
|
212
213
|
target: button.target,
|
214
|
+
type: button.type || 'primary',
|
215
|
+
theme: button.theme || 'green',
|
213
216
|
onClick: button === null || button === void 0 ? void 0 : button.onClick
|
214
217
|
}, button.title), !!extraButton && /*#__PURE__*/_react["default"].createElement(_uiCore.Button, {
|
215
218
|
dataAttrs: {
|
@@ -218,7 +221,7 @@ var Card = function Card(_ref5) {
|
|
218
221
|
className: cn('button', [classes === null || classes === void 0 ? void 0 : classes.extraButton]),
|
219
222
|
href: extraButton.href,
|
220
223
|
target: extraButton.target,
|
221
|
-
type:
|
224
|
+
type: extraButtonType || 'outline',
|
222
225
|
onClick: extraButton === null || extraButton === void 0 ? void 0 : extraButton.onClick
|
223
226
|
}, extraButton.title));
|
224
227
|
};
|
@@ -313,6 +316,8 @@ Card.propTypes = {
|
|
313
316
|
href: _propTypes["default"].string,
|
314
317
|
target: _propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']),
|
315
318
|
isCentered: _propTypes["default"].bool,
|
319
|
+
type: _propTypes["default"].oneOf(['primary', 'outline']),
|
320
|
+
theme: _propTypes["default"].oneOf(['green', 'green-soft']),
|
316
321
|
onClick: _propTypes["default"].func
|
317
322
|
}),
|
318
323
|
extraButton: _propTypes["default"].shape({
|
@@ -320,6 +325,7 @@ Card.propTypes = {
|
|
320
325
|
href: _propTypes["default"].string,
|
321
326
|
target: _propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']),
|
322
327
|
isCentered: _propTypes["default"].bool,
|
328
|
+
type: _propTypes["default"].oneOf(['text', 'outline']),
|
323
329
|
onClick: _propTypes["default"].func
|
324
330
|
}),
|
325
331
|
onClick: _propTypes["default"].func
|
@@ -62,7 +62,7 @@ export declare type Price = {
|
|
62
62
|
/** Период */
|
63
63
|
period?: string;
|
64
64
|
};
|
65
|
-
export declare type
|
65
|
+
export declare type MainButtonType = {
|
66
66
|
/** Название */
|
67
67
|
title: string;
|
68
68
|
/** Ссылка */
|
@@ -71,6 +71,24 @@ export declare type ButtonType = {
|
|
71
71
|
target?: Target;
|
72
72
|
/** Центрировать кнопку */
|
73
73
|
isCentered?: boolean;
|
74
|
+
/** Тип кнопки */
|
75
|
+
type?: 'primary' | 'outline';
|
76
|
+
/** Тема кнопки */
|
77
|
+
theme?: 'green' | 'green-soft';
|
78
|
+
/** Обработчик клика по кнопке */
|
79
|
+
onClick?: () => void;
|
80
|
+
};
|
81
|
+
export declare type ExtraButtonType = {
|
82
|
+
/** Название */
|
83
|
+
title: string;
|
84
|
+
/** Ссылка */
|
85
|
+
href?: string;
|
86
|
+
/** Target свойство кнопки */
|
87
|
+
target?: Target;
|
88
|
+
/** Центрировать кнопку */
|
89
|
+
isCentered?: boolean;
|
90
|
+
/** Тип кнопки */
|
91
|
+
type?: 'outline' | 'text';
|
74
92
|
/** Обработчик клика по кнопке */
|
75
93
|
onClick?: () => void;
|
76
94
|
};
|
@@ -67,6 +67,33 @@ h5 {
|
|
67
67
|
margin-top: 45px;
|
68
68
|
}
|
69
69
|
}
|
70
|
+
.mfui-v6-page-title__title_single.mfui-v6-page-title__title_margin-top_small {
|
71
|
+
margin-top: 48px;
|
72
|
+
}
|
73
|
+
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
74
|
+
.mfui-v6-page-title__title_single.mfui-v6-page-title__title_margin-top_small {
|
75
|
+
margin-top: 40px;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
@media screen and (max-width: 767px) {
|
79
|
+
.mfui-v6-page-title__title_single.mfui-v6-page-title__title_margin-top_small {
|
80
|
+
margin-top: 32px;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
.mfui-v6-page-title__description {
|
84
|
+
font-family: inherit;
|
85
|
+
font-size: 15px;
|
86
|
+
line-height: 24px;
|
87
|
+
font-weight: 400;
|
88
|
+
margin-top: 24px;
|
89
|
+
color: inherit;
|
90
|
+
white-space: pre-wrap;
|
91
|
+
}
|
92
|
+
@media screen and (max-width: 767px) {
|
93
|
+
.mfui-v6-page-title__description {
|
94
|
+
margin-top: 16px;
|
95
|
+
}
|
96
|
+
}
|
70
97
|
.mfui-v6-page-title__badge + .mfui-v6-page-title__title {
|
71
98
|
margin-top: 8px;
|
72
99
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import './PageTitle.less';
|
3
2
|
import { Props as BreadcrumbsType } from '../Breadcrumbs/Breadcrumbs';
|
3
|
+
import './PageTitle.less';
|
4
4
|
export declare type PageTitleProps = {
|
5
5
|
/** Дополнительные data атрибуты к внутренним элементам */
|
6
6
|
dataAttrs?: {
|
@@ -10,6 +10,8 @@ export declare type PageTitleProps = {
|
|
10
10
|
};
|
11
11
|
/** Текст заголовка */
|
12
12
|
title: string | React.ReactNode | React.ReactNode[];
|
13
|
+
/** Описание */
|
14
|
+
description?: string | React.ReactNode | React.ReactNode[];
|
13
15
|
/** Хлебные крошки */
|
14
16
|
breadcrumbs?: BreadcrumbsType['items'];
|
15
17
|
/** Текст бейджа */
|
@@ -18,10 +20,13 @@ export declare type PageTitleProps = {
|
|
18
20
|
isFullWidth?: boolean;
|
19
21
|
/** Включить микроразметку для хлебных крошек */
|
20
22
|
hasBreadcrumbsMicrodata?: boolean;
|
23
|
+
/** Отступ сверху */
|
24
|
+
marginTop?: 'default' | 'small';
|
21
25
|
/** Класс для корневого элемента */
|
22
26
|
className?: string;
|
23
27
|
/** Дополнительные классы для внутренних элементов */
|
24
28
|
classes?: {
|
29
|
+
title?: string;
|
25
30
|
breadcrumbs?: string;
|
26
31
|
};
|
27
32
|
/** Ссылка на корневой элемент */
|
@@ -9,6 +9,10 @@ exports["default"] = void 0;
|
|
9
9
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
11
|
|
12
|
+
require("core-js/modules/es.symbol.js");
|
13
|
+
|
14
|
+
require("core-js/modules/es.symbol.description.js");
|
15
|
+
|
12
16
|
var React = _interopRequireWildcard(require("react"));
|
13
17
|
|
14
18
|
var _uiCore = require("@megafon/ui-core");
|
@@ -31,30 +35,40 @@ var cn = (0, _uiHelpers.cnCreate)('mfui-v6-page-title');
|
|
31
35
|
var PageTitle = function PageTitle(_ref) {
|
32
36
|
var dataAttrs = _ref.dataAttrs,
|
33
37
|
title = _ref.title,
|
38
|
+
description = _ref.description,
|
34
39
|
breadcrumbs = _ref.breadcrumbs,
|
35
40
|
badge = _ref.badge,
|
36
41
|
_ref$isFullWidth = _ref.isFullWidth,
|
37
42
|
isFullWidth = _ref$isFullWidth === void 0 ? true : _ref$isFullWidth,
|
38
43
|
_ref$hasBreadcrumbsMi = _ref.hasBreadcrumbsMicrodata,
|
39
44
|
hasBreadcrumbsMicrodata = _ref$hasBreadcrumbsMi === void 0 ? false : _ref$hasBreadcrumbsMi,
|
45
|
+
_ref$marginTop = _ref.marginTop,
|
46
|
+
marginTop = _ref$marginTop === void 0 ? 'default' : _ref$marginTop,
|
40
47
|
className = _ref.className,
|
41
48
|
_ref$classes = _ref.classes,
|
42
49
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
43
50
|
rootRef = _ref.rootRef;
|
44
51
|
var isBreadcrumbs = !!(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length);
|
45
|
-
var
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
},
|
57
|
-
|
52
|
+
var titleContent = /*#__PURE__*/React.createElement(React.Fragment, null, badge && /*#__PURE__*/React.createElement("div", {
|
53
|
+
className: cn('badge', {
|
54
|
+
'under-breadcrumbs': isBreadcrumbs
|
55
|
+
})
|
56
|
+
}, badge), /*#__PURE__*/React.createElement(_uiCore.Header, {
|
57
|
+
className: cn('title', {
|
58
|
+
single: !isBreadcrumbs && !badge,
|
59
|
+
'margin-top': marginTop,
|
60
|
+
'under-breadcrumbs': isBreadcrumbs && !badge
|
61
|
+
}, [classes.title]),
|
62
|
+
as: "h1"
|
63
|
+
}, title), description && /*#__PURE__*/React.createElement("div", {
|
64
|
+
className: cn('description')
|
65
|
+
}, description));
|
66
|
+
|
67
|
+
var renderContent = function renderContent() {
|
68
|
+
if (isFullWidth) {
|
69
|
+
return titleContent;
|
70
|
+
}
|
71
|
+
|
58
72
|
return /*#__PURE__*/React.createElement(_uiCore.Grid, {
|
59
73
|
dataAttrs: {
|
60
74
|
root: {
|
@@ -66,8 +80,9 @@ var PageTitle = function PageTitle(_ref) {
|
|
66
80
|
desktop: "10",
|
67
81
|
tablet: "12",
|
68
82
|
mobile: "12"
|
69
|
-
},
|
70
|
-
}
|
83
|
+
}, titleContent));
|
84
|
+
};
|
85
|
+
|
71
86
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
72
87
|
className: cn([className]),
|
73
88
|
ref: rootRef
|
@@ -81,7 +96,7 @@ var PageTitle = function PageTitle(_ref) {
|
|
81
96
|
link: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.breadcrumbsLink
|
82
97
|
},
|
83
98
|
className: cn('breadcrumbs', [classes.breadcrumbs])
|
84
|
-
}),
|
99
|
+
}), renderContent());
|
85
100
|
};
|
86
101
|
|
87
102
|
PageTitle.propTypes = {
|
@@ -91,6 +106,7 @@ PageTitle.propTypes = {
|
|
91
106
|
breadcrumbsLink: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
92
107
|
}),
|
93
108
|
title: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]).isRequired,
|
109
|
+
description: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]),
|
94
110
|
breadcrumbs: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
95
111
|
title: _propTypes["default"].string.isRequired,
|
96
112
|
href: _propTypes["default"].string
|
@@ -98,8 +114,10 @@ PageTitle.propTypes = {
|
|
98
114
|
badge: _propTypes["default"].string,
|
99
115
|
isFullWidth: _propTypes["default"].bool,
|
100
116
|
hasBreadcrumbsMicrodata: _propTypes["default"].bool,
|
117
|
+
marginTop: _propTypes["default"].oneOf(['default', 'small']),
|
101
118
|
className: _propTypes["default"].string,
|
102
119
|
classes: _propTypes["default"].shape({
|
120
|
+
title: _propTypes["default"].string,
|
103
121
|
breadcrumbs: _propTypes["default"].string
|
104
122
|
}),
|
105
123
|
rootRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@megafon/ui-shared",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.12.0",
|
4
4
|
"files": [
|
5
5
|
"dist"
|
6
6
|
],
|
@@ -82,7 +82,7 @@
|
|
82
82
|
},
|
83
83
|
"dependencies": {
|
84
84
|
"@babel/runtime": "^7.8.4",
|
85
|
-
"@megafon/ui-core": "^6.
|
85
|
+
"@megafon/ui-core": "^6.7.0",
|
86
86
|
"@megafon/ui-helpers": "^2.6.0",
|
87
87
|
"core-js": "^3.6.4",
|
88
88
|
"htmr": "^0.9.2",
|
@@ -90,5 +90,5 @@
|
|
90
90
|
"prop-types": "^15.7.2",
|
91
91
|
"swiper": "^6.5.6"
|
92
92
|
},
|
93
|
-
"gitHead": "
|
93
|
+
"gitHead": "bf7d2cc9e75cf3527fae3ea8a58e8e3f4958e18a"
|
94
94
|
}
|