@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.
- package/CHANGELOG.md +29 -0
- package/dist/es/components/Card/Card.css +1 -1
- package/dist/es/components/Container/Container.css +934 -7
- package/dist/es/components/DarkGradientCards/DarkGradientCards.css +18 -0
- package/dist/es/components/DarkGradientCards/DarkGradientCards.d.ts +28 -0
- package/dist/es/components/DarkGradientCards/DarkGradientCards.js +88 -0
- package/dist/es/components/DarkGradientCards/components/DarkGradientCard.css +175 -0
- package/dist/es/components/DarkGradientCards/components/DarkGradientCard.d.ts +15 -0
- package/dist/es/components/DarkGradientCards/components/DarkGradientCard.js +52 -0
- package/dist/es/components/DarkGradientCards/types.d.ts +21 -0
- package/dist/es/components/DarkGradientCards/types.js +0 -0
- package/dist/es/components/InfoCards/InfoCards.css +75 -0
- package/dist/es/components/InfoCards/InfoCards.d.ts +21 -0
- package/dist/es/components/InfoCards/InfoCards.js +66 -0
- package/dist/es/components/InfoCards/components/InfoCard/InfoCard.css +237 -0
- package/dist/es/components/InfoCards/components/InfoCard/InfoCard.d.ts +15 -0
- package/dist/es/components/InfoCards/components/InfoCard/InfoCard.js +108 -0
- package/dist/es/components/InfoCards/types.d.ts +26 -0
- package/dist/es/components/InfoCards/types.js +0 -0
- package/dist/es/components/SidePictureCards/SidePictureCards.d.ts +22 -0
- package/dist/es/components/SidePictureCards/SidePictureCards.js +77 -0
- package/dist/es/components/SidePictureCards/components/SidePictureCard.css +183 -0
- package/dist/es/components/SidePictureCards/components/SidePictureCard.d.ts +16 -0
- package/dist/es/components/SidePictureCards/components/SidePictureCard.js +91 -0
- package/dist/es/components/SidePictureCards/types.d.ts +46 -0
- package/dist/es/components/SidePictureCards/types.js +0 -0
- package/dist/es/components/TextWithIcon/TextWithIconItem.css +16 -7
- package/dist/es/components/TextWithIcon/TextWithIconItem.d.ts +2 -0
- package/dist/es/components/TextWithIcon/TextWithIconItem.js +6 -1
- package/dist/es/hooks/useResolutions.d.ts +1 -0
- package/dist/es/hooks/useResolutions.js +12 -1
- package/dist/es/index.d.ts +6 -0
- package/dist/es/index.js +6 -0
- package/dist/lib/components/Card/Card.css +1 -1
- package/dist/lib/components/Container/Container.css +934 -7
- package/dist/lib/components/DarkGradientCards/DarkGradientCards.css +18 -0
- package/dist/lib/components/DarkGradientCards/DarkGradientCards.d.ts +28 -0
- package/dist/lib/components/DarkGradientCards/DarkGradientCards.js +104 -0
- package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.css +175 -0
- package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.d.ts +15 -0
- package/dist/lib/components/DarkGradientCards/components/DarkGradientCard.js +65 -0
- package/dist/lib/components/DarkGradientCards/types.d.ts +21 -0
- package/dist/lib/components/DarkGradientCards/types.js +1 -0
- package/dist/lib/components/InfoCards/InfoCards.css +75 -0
- package/dist/lib/components/InfoCards/InfoCards.d.ts +21 -0
- package/dist/lib/components/InfoCards/InfoCards.js +88 -0
- package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.css +237 -0
- package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.d.ts +15 -0
- package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.js +129 -0
- package/dist/lib/components/InfoCards/types.d.ts +26 -0
- package/dist/lib/components/InfoCards/types.js +1 -0
- package/dist/lib/components/SidePictureCards/SidePictureCards.d.ts +22 -0
- package/dist/lib/components/SidePictureCards/SidePictureCards.js +95 -0
- package/dist/lib/components/SidePictureCards/components/SidePictureCard.css +183 -0
- package/dist/lib/components/SidePictureCards/components/SidePictureCard.d.ts +16 -0
- package/dist/lib/components/SidePictureCards/components/SidePictureCard.js +108 -0
- package/dist/lib/components/SidePictureCards/types.d.ts +46 -0
- package/dist/lib/components/SidePictureCards/types.js +1 -0
- package/dist/lib/components/TextWithIcon/TextWithIconItem.css +16 -7
- package/dist/lib/components/TextWithIcon/TextWithIconItem.d.ts +2 -0
- package/dist/lib/components/TextWithIcon/TextWithIconItem.js +6 -1
- package/dist/lib/hooks/useResolutions.d.ts +1 -0
- package/dist/lib/hooks/useResolutions.js +12 -1
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.js +48 -0
- package/package.json +2 -2
@@ -0,0 +1,91 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import "core-js/modules/es.array.slice.js";
|
3
|
+
import "core-js/modules/es.array.map.js";
|
4
|
+
import "core-js/modules/es.array.concat.js";
|
5
|
+
import React from 'react';
|
6
|
+
import { Button, Header } from '@megafon/ui-core';
|
7
|
+
import { breakpoints, cnCreate, convert } from '@megafon/ui-helpers';
|
8
|
+
import { setRelAttribute } from "../../../helpers/setRelAttribute";
|
9
|
+
import "./SidePictureCard.css";
|
10
|
+
var MAX_ICON_ITEMS_COUNT = 4;
|
11
|
+
var cn = cnCreate('mfui-side-picture-card');
|
12
|
+
|
13
|
+
var SidePictureCard = function SidePictureCard(_ref) {
|
14
|
+
var background = _ref.background,
|
15
|
+
title = _ref.title,
|
16
|
+
image = _ref.image,
|
17
|
+
_ref$iconItems = _ref.iconItems,
|
18
|
+
iconItems = _ref$iconItems === void 0 ? [] : _ref$iconItems,
|
19
|
+
_ref$button = _ref.button,
|
20
|
+
button = _ref$button === void 0 ? {} : _ref$button,
|
21
|
+
href = _ref.href,
|
22
|
+
target = _ref.target,
|
23
|
+
rel = _ref.rel,
|
24
|
+
_ref$classes = _ref.classes,
|
25
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
26
|
+
dataAttrs = _ref.dataAttrs;
|
27
|
+
var buttonTitle = button.title,
|
28
|
+
buttonHref = button.href,
|
29
|
+
buttonTarget = button.target,
|
30
|
+
buttonRel = button.rel;
|
31
|
+
var isLink = !!href && !buttonHref;
|
32
|
+
var ElementType = isLink ? 'a' : 'div';
|
33
|
+
var currentRel = setRelAttribute(rel, target);
|
34
|
+
var currentButtonRel = setRelAttribute(buttonRel, buttonTarget);
|
35
|
+
var visibleIconItems = iconItems.slice(0, MAX_ICON_ITEMS_COUNT);
|
36
|
+
var items = visibleIconItems.map(function (item, i) {
|
37
|
+
var icon = item.icon,
|
38
|
+
_item$text = item.text,
|
39
|
+
text = _item$text === void 0 ? '' : _item$text,
|
40
|
+
_item$info = item.info,
|
41
|
+
info = _item$info === void 0 ? '' : _item$info;
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
43
|
+
className: cn('item'),
|
44
|
+
key: "".concat(text || info, "_").concat(i)
|
45
|
+
}, /*#__PURE__*/React.createElement("div", {
|
46
|
+
className: cn('item-icon')
|
47
|
+
}, icon), /*#__PURE__*/React.createElement("div", {
|
48
|
+
className: cn('item-description')
|
49
|
+
}, !!text && /*#__PURE__*/React.createElement("div", {
|
50
|
+
className: cn('item-text')
|
51
|
+
}, convert(text, {})), !!info && /*#__PURE__*/React.createElement("div", {
|
52
|
+
className: cn('item-info')
|
53
|
+
}, convert(info, {}))));
|
54
|
+
});
|
55
|
+
return /*#__PURE__*/React.createElement(ElementType, _extends({
|
56
|
+
className: cn({
|
57
|
+
background: background,
|
58
|
+
active: isLink
|
59
|
+
}, [classes.root])
|
60
|
+
}, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root, {
|
61
|
+
href: href,
|
62
|
+
target: isLink ? target : undefined,
|
63
|
+
rel: isLink ? currentRel : undefined
|
64
|
+
}), /*#__PURE__*/React.createElement("div", {
|
65
|
+
className: cn('content')
|
66
|
+
}, !!title && /*#__PURE__*/React.createElement(Header, {
|
67
|
+
className: cn('title'),
|
68
|
+
as: "h3"
|
69
|
+
}, convert(title, {})), /*#__PURE__*/React.createElement("div", {
|
70
|
+
className: cn('items')
|
71
|
+
}, items), !!buttonTitle && /*#__PURE__*/React.createElement(Button, {
|
72
|
+
className: cn('button', [classes.button]),
|
73
|
+
dataAttrs: {
|
74
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
|
75
|
+
},
|
76
|
+
href: buttonHref,
|
77
|
+
target: buttonTarget,
|
78
|
+
rel: currentButtonRel
|
79
|
+
}, buttonTitle)), /*#__PURE__*/React.createElement("picture", {
|
80
|
+
className: cn('picture')
|
81
|
+
}, /*#__PURE__*/React.createElement("source", {
|
82
|
+
media: "(min-width: ".concat(breakpoints.DESKTOP_MIDDLE_START, "px)"),
|
83
|
+
srcSet: image.srcWide
|
84
|
+
}), /*#__PURE__*/React.createElement("img", {
|
85
|
+
className: cn('image'),
|
86
|
+
src: image.src,
|
87
|
+
alt: image.alt || 'image'
|
88
|
+
})));
|
89
|
+
};
|
90
|
+
|
91
|
+
export default SidePictureCard;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
declare type TargetType = '_self' | '_blank' | '_parent' | '_top';
|
3
|
+
declare type ButtonType = {
|
4
|
+
/** Название */
|
5
|
+
title: string;
|
6
|
+
/** Ссылка */
|
7
|
+
href: string;
|
8
|
+
/** Атрибут ссылки target */
|
9
|
+
target?: TargetType;
|
10
|
+
/** Атрибут ссылки rel */
|
11
|
+
rel?: string;
|
12
|
+
};
|
13
|
+
declare type ImageType = {
|
14
|
+
/** Изображение на разрешении экрана 0-1279 */
|
15
|
+
src: string;
|
16
|
+
/** Изображение на разрешении экрана 1280+ */
|
17
|
+
srcWide: string;
|
18
|
+
/** Значение тега alt для изображения */
|
19
|
+
alt?: string;
|
20
|
+
};
|
21
|
+
declare type IconContentType = {
|
22
|
+
/** Иконка */
|
23
|
+
icon: JSX.Element;
|
24
|
+
/** Текст-описание */
|
25
|
+
text?: string;
|
26
|
+
/** Дополнительная информация, значение */
|
27
|
+
info?: string;
|
28
|
+
};
|
29
|
+
export declare type CardDataType = {
|
30
|
+
/** Заголовок */
|
31
|
+
title?: string;
|
32
|
+
/** Изображение */
|
33
|
+
image: ImageType;
|
34
|
+
/** Список пунктов с иконками */
|
35
|
+
iconItems: IconContentType[];
|
36
|
+
/** Кнопка */
|
37
|
+
button?: ButtonType;
|
38
|
+
/** Ссылка */
|
39
|
+
href?: string;
|
40
|
+
/** Атрибут ссылки target */
|
41
|
+
target?: TargetType;
|
42
|
+
/** Атрибут ссылки rel */
|
43
|
+
rel?: string;
|
44
|
+
};
|
45
|
+
export declare type BackgroundType = 'white' | 'gray';
|
46
|
+
export {};
|
File without changes
|
@@ -17,13 +17,22 @@ h5 {
|
|
17
17
|
margin-top: 12px;
|
18
18
|
}
|
19
19
|
.mfui-text-with-icon-item__svg-icon {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
min-
|
24
|
-
|
25
|
-
|
20
|
+
-webkit-box-sizing: border-box;
|
21
|
+
box-sizing: border-box;
|
22
|
+
width: 40px;
|
23
|
+
min-width: 40px;
|
24
|
+
height: 40px;
|
25
|
+
min-height: 40px;
|
26
|
+
margin-right: 12px;
|
27
|
+
overflow: hidden;
|
28
|
+
}
|
29
|
+
.mfui-text-with-icon-item_icon-background_stroke .mfui-text-with-icon-item__svg-icon {
|
30
|
+
padding: 3px;
|
26
31
|
border: 1px solid var(--spbSky2);
|
27
32
|
border-radius: 50%;
|
28
|
-
|
33
|
+
}
|
34
|
+
.mfui-text-with-icon-item_icon-background_gray .mfui-text-with-icon-item__svg-icon {
|
35
|
+
padding: 4px;
|
36
|
+
border-radius: 50%;
|
37
|
+
background-color: var(--spbSky0);
|
29
38
|
}
|
@@ -10,6 +10,8 @@ export interface ITextWithIconItem {
|
|
10
10
|
text: string | string[];
|
11
11
|
/** Иконка */
|
12
12
|
icon: React.ReactNode;
|
13
|
+
/** Фон для иконки */
|
14
|
+
iconBackground?: 'no' | 'stroke' | 'gray';
|
13
15
|
/** Ссылка на корневой элемент */
|
14
16
|
rootRef?: React.Ref<HTMLDivElement>;
|
15
17
|
/** Дополнительные data атрибуты к внутренним элементам */
|
@@ -14,6 +14,8 @@ var TextWithIconItem = function TextWithIconItem(_ref) {
|
|
14
14
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
15
15
|
text = _ref.text,
|
16
16
|
icon = _ref.icon,
|
17
|
+
_ref$iconBackground = _ref.iconBackground,
|
18
|
+
iconBackground = _ref$iconBackground === void 0 ? 'no' : _ref$iconBackground,
|
17
19
|
rootRef = _ref.rootRef,
|
18
20
|
dataAttrs = _ref.dataAttrs;
|
19
21
|
var renderText = React.useMemo(function () {
|
@@ -26,7 +28,9 @@ var TextWithIconItem = function TextWithIconItem(_ref) {
|
|
26
28
|
return convert(text, textConvertConfig);
|
27
29
|
}, [text]);
|
28
30
|
return /*#__PURE__*/React.createElement("div", _extends({
|
29
|
-
className: cn(
|
31
|
+
className: cn({
|
32
|
+
'icon-background': iconBackground
|
33
|
+
}, [className]),
|
30
34
|
ref: rootRef
|
31
35
|
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
|
32
36
|
className: cn('svg-icon', [classes.icon]),
|
@@ -40,6 +44,7 @@ var TextWithIconItem = function TextWithIconItem(_ref) {
|
|
40
44
|
TextWithIconItem.propTypes = {
|
41
45
|
text: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.arrayOf(PropTypes.string.isRequired)]).isRequired,
|
42
46
|
icon: PropTypes.node.isRequired,
|
47
|
+
iconBackground: PropTypes.oneOf(['no', 'stroke', 'gray']),
|
43
48
|
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
44
49
|
current: PropTypes.elementType
|
45
50
|
}), PropTypes.any])]),
|
@@ -5,7 +5,8 @@ import { breakpoints } from '@megafon/ui-helpers';
|
|
5
5
|
var MOBILE_MIDDLE_END = breakpoints.MOBILE_MIDDLE_END,
|
6
6
|
MOBILE_BIG_START = breakpoints.MOBILE_BIG_START,
|
7
7
|
MOBILE_BIG_END = breakpoints.MOBILE_BIG_END,
|
8
|
-
DESKTOP_SMALL_START = breakpoints.DESKTOP_SMALL_START
|
8
|
+
DESKTOP_SMALL_START = breakpoints.DESKTOP_SMALL_START,
|
9
|
+
DESKTOP_MIDDLE_START = breakpoints.DESKTOP_MIDDLE_START;
|
9
10
|
|
10
11
|
var useResolutions = function useResolutions() {
|
11
12
|
var _React$useState = React.useState(false),
|
@@ -23,6 +24,11 @@ var useResolutions = function useResolutions() {
|
|
23
24
|
isDesktop = _React$useState6[0],
|
24
25
|
setIsDesktop = _React$useState6[1];
|
25
26
|
|
27
|
+
var _React$useState7 = React.useState(false),
|
28
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
29
|
+
isDesktopWide = _React$useState8[0],
|
30
|
+
setIsDesktopWide = _React$useState8[1];
|
31
|
+
|
26
32
|
React.useEffect(function () {
|
27
33
|
if (typeof window === 'undefined') {
|
28
34
|
return undefined;
|
@@ -33,24 +39,29 @@ var useResolutions = function useResolutions() {
|
|
33
39
|
var mobileQuery = matchMedia("(max-width: ".concat(MOBILE_MIDDLE_END, "px)"));
|
34
40
|
var tabletQuery = matchMedia("(min-width: ".concat(MOBILE_BIG_START, "px) and (max-width: ").concat(MOBILE_BIG_END, "px)"));
|
35
41
|
var desktopQuery = matchMedia("(min-width: ".concat(DESKTOP_SMALL_START, "px)"));
|
42
|
+
var desktopWideQuery = matchMedia("(min-width: ".concat(DESKTOP_MIDDLE_START, "px)"));
|
36
43
|
|
37
44
|
var handleResize = function handleResize() {
|
38
45
|
setIsMobile(mobileQuery.matches);
|
39
46
|
setIsTablet(tabletQuery.matches);
|
40
47
|
setIsDesktop(desktopQuery.matches);
|
48
|
+
setIsDesktopWide(desktopWideQuery.matches);
|
41
49
|
};
|
42
50
|
|
43
51
|
handleResize();
|
44
52
|
mobileQuery.addEventListener('change', handleResize);
|
45
53
|
tabletQuery.addEventListener('change', handleResize);
|
46
54
|
desktopQuery.addEventListener('change', handleResize);
|
55
|
+
desktopWideQuery.addEventListener('change', handleResize);
|
47
56
|
return function () {
|
48
57
|
mobileQuery.removeEventListener('change', handleResize);
|
49
58
|
tabletQuery.removeEventListener('change', handleResize);
|
50
59
|
desktopQuery.removeEventListener('change', handleResize);
|
60
|
+
desktopWideQuery.addEventListener('change', handleResize);
|
51
61
|
};
|
52
62
|
}, []);
|
53
63
|
return {
|
64
|
+
isDesktopWide: isDesktopWide,
|
54
65
|
isDesktop: isDesktop,
|
55
66
|
isMobile: isMobile,
|
56
67
|
isTablet: isTablet
|
package/dist/es/index.d.ts
CHANGED
@@ -17,10 +17,14 @@ export { default as Card } from './components/Card/Card';
|
|
17
17
|
export { default as CardsBox } from './components/CardsBox/CardsBox';
|
18
18
|
export { default as CarouselBox } from './components/CarouselBox/CarouselBox';
|
19
19
|
export { default as Container } from './components/Container/Container';
|
20
|
+
export { default as DarkGradientCard } from './components/DarkGradientCards/components/DarkGradientCard';
|
21
|
+
export { default as DarkGradientCards } from './components/DarkGradientCards/DarkGradientCards';
|
20
22
|
export { default as DownloadLink } from './components/DownloadLinks/DownloadLink';
|
21
23
|
export { default as DownloadLinks } from './components/DownloadLinks/DownloadLinks';
|
22
24
|
export { default as FaqWrapper } from './components/FaqWrapper/FaqWrapper';
|
23
25
|
export { default as ImageBanner } from './components/ImageBanner/ImageBanner';
|
26
|
+
export { default as InfoCard } from './components/InfoCards/components/InfoCard/InfoCard';
|
27
|
+
export { default as InfoCards } from './components/InfoCards/InfoCards';
|
24
28
|
export { default as Instructions } from './components/Instructions/Instructions';
|
25
29
|
export { default as NotificationBox } from './components/NotificationBox/NotificationBox';
|
26
30
|
export { default as PageTitle } from './components/PageTitle/PageTitle';
|
@@ -28,6 +32,8 @@ export { default as Partners } from './components/Partners/Partners';
|
|
28
32
|
export { default as PictureWithDescription } from './components/PictureWithDescription/PictureWithDescription';
|
29
33
|
export { default as Property } from './components/Property/Property';
|
30
34
|
export { default as PropertyDescription } from './components/Property/PropertyDescription';
|
35
|
+
export { default as SidePictureCard } from './components/SidePictureCards/components/SidePictureCard';
|
36
|
+
export { default as SidePictureCards } from './components/SidePictureCards/SidePictureCards';
|
31
37
|
export { default as Steps } from './components/Steps/Steps';
|
32
38
|
export { default as StepsItem } from './components/Steps/StepsItem';
|
33
39
|
export { default as StoreBanner } from './components/StoreBanner/StoreBanner';
|
package/dist/es/index.js
CHANGED
@@ -17,10 +17,14 @@ export { default as Card } from "./components/Card/Card";
|
|
17
17
|
export { default as CardsBox } from "./components/CardsBox/CardsBox";
|
18
18
|
export { default as CarouselBox } from "./components/CarouselBox/CarouselBox";
|
19
19
|
export { default as Container } from "./components/Container/Container";
|
20
|
+
export { default as DarkGradientCard } from "./components/DarkGradientCards/components/DarkGradientCard";
|
21
|
+
export { default as DarkGradientCards } from "./components/DarkGradientCards/DarkGradientCards";
|
20
22
|
export { default as DownloadLink } from "./components/DownloadLinks/DownloadLink";
|
21
23
|
export { default as DownloadLinks } from "./components/DownloadLinks/DownloadLinks";
|
22
24
|
export { default as FaqWrapper } from "./components/FaqWrapper/FaqWrapper";
|
23
25
|
export { default as ImageBanner } from "./components/ImageBanner/ImageBanner";
|
26
|
+
export { default as InfoCard } from "./components/InfoCards/components/InfoCard/InfoCard";
|
27
|
+
export { default as InfoCards } from "./components/InfoCards/InfoCards";
|
24
28
|
export { default as Instructions } from "./components/Instructions/Instructions";
|
25
29
|
export { default as NotificationBox } from "./components/NotificationBox/NotificationBox";
|
26
30
|
export { default as PageTitle } from "./components/PageTitle/PageTitle";
|
@@ -28,6 +32,8 @@ export { default as Partners } from "./components/Partners/Partners";
|
|
28
32
|
export { default as PictureWithDescription } from "./components/PictureWithDescription/PictureWithDescription";
|
29
33
|
export { default as Property } from "./components/Property/Property";
|
30
34
|
export { default as PropertyDescription } from "./components/Property/PropertyDescription";
|
35
|
+
export { default as SidePictureCard } from "./components/SidePictureCards/components/SidePictureCard";
|
36
|
+
export { default as SidePictureCards } from "./components/SidePictureCards/SidePictureCards";
|
31
37
|
export { default as Steps } from "./components/Steps/Steps";
|
32
38
|
export { default as StepsItem } from "./components/Steps/StepsItem";
|
33
39
|
export { default as StoreBanner } from "./components/StoreBanner/StoreBanner";
|