@megafon/ui-shared 6.13.0 → 6.14.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.
@@ -0,0 +1,88 @@
1
+ h1,
2
+ h2,
3
+ h3,
4
+ h4,
5
+ h5 {
6
+ margin: 0;
7
+ }
8
+ .mfui-v6-picture-box_mask_none .mfui-v6-picture-box__image {
9
+ width: 100%;
10
+ border-radius: 24px;
11
+ vertical-align: top;
12
+ }
13
+ @media screen and (min-width: 768px) {
14
+ .mfui-v6-picture-box_mask_none .mfui-v6-picture-box__image {
15
+ height: 414px;
16
+ -o-object-fit: cover;
17
+ object-fit: cover;
18
+ }
19
+ }
20
+ @media screen and (min-width: 1280px) {
21
+ .mfui-v6-picture-box_mask_none .mfui-v6-picture-box__image {
22
+ height: 520px;
23
+ }
24
+ }
25
+ .mfui-v6-picture-box_mask_mac-book .mfui-v6-picture-box__image {
26
+ position: absolute;
27
+ top: 2%;
28
+ right: 0;
29
+ left: 0;
30
+ width: 82%;
31
+ height: 87%;
32
+ margin: 0 auto;
33
+ border-top-left-radius: 1.4% 2.29885057%;
34
+ border-top-right-radius: 1.4% 2.29885057%;
35
+ -o-object-fit: cover;
36
+ object-fit: cover;
37
+ }
38
+ .mfui-v6-picture-box__content {
39
+ -ms-flex-item-align: center;
40
+ align-self: center;
41
+ margin-top: 32px;
42
+ }
43
+ @media screen and (min-width: 1024px) {
44
+ .mfui-v6-picture-box__content {
45
+ margin-top: 0;
46
+ }
47
+ }
48
+ @media screen and (min-width: 1024px) and (max-width: 1279px) {
49
+ .mfui-v6-picture-box_align_left .mfui-v6-picture-box__content {
50
+ margin-left: 12px;
51
+ }
52
+ }
53
+ @media screen and (min-width: 1280px) {
54
+ .mfui-v6-picture-box_align_left .mfui-v6-picture-box__content {
55
+ margin-left: 44px;
56
+ }
57
+ }
58
+ @media screen and (min-width: 1024px) and (max-width: 1279px) {
59
+ .mfui-v6-picture-box_align_right .mfui-v6-picture-box__content {
60
+ margin-right: 12px;
61
+ }
62
+ }
63
+ @media screen and (min-width: 1280px) {
64
+ .mfui-v6-picture-box_align_right .mfui-v6-picture-box__content {
65
+ margin-right: 44px;
66
+ }
67
+ }
68
+ .mfui-v6-picture-box__button-wrapper {
69
+ display: -webkit-box;
70
+ display: -ms-flexbox;
71
+ display: flex;
72
+ -ms-flex-wrap: wrap;
73
+ flex-wrap: wrap;
74
+ gap: 20px;
75
+ margin-top: 32px;
76
+ }
77
+ .mfui-v6-picture-box_mask_mac-book .mfui-v6-picture-box__mask {
78
+ position: relative;
79
+ padding-bottom: 60.9%;
80
+ background-image: url('./img/mac-book-1x.png');
81
+ background-repeat: no-repeat;
82
+ background-size: 100% auto;
83
+ }
84
+ @media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min--moz-device-pixel-ratio: 2), screen and (min-device-pixel-ratio: 2), screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) {
85
+ .mfui-v6-picture-box_mask_mac-book .mfui-v6-picture-box__mask {
86
+ background-image: url('./img/mac-book-2x.png');
87
+ }
88
+ }
@@ -0,0 +1,46 @@
1
+ import * as React from 'react';
2
+ import './PictureBox.less';
3
+ declare type ImageType = {
4
+ src: string;
5
+ src2x?: string;
6
+ align?: 'right' | 'left';
7
+ alt?: string;
8
+ };
9
+ declare type ButtonType = {
10
+ title?: string;
11
+ href?: string;
12
+ target?: '_self' | '_blank';
13
+ rel?: string;
14
+ onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
15
+ };
16
+ export interface IPictureBoxProps {
17
+ /** Изображение */
18
+ image: ImageType;
19
+ /** Кнопка */
20
+ button?: ButtonType;
21
+ /** Дополнительная кнопка */
22
+ extraButton?: ButtonType;
23
+ /** Маска */
24
+ pictureMask?: 'mac-book' | 'none';
25
+ /** Ссылка на корневой элемент */
26
+ rootRef?: React.Ref<HTMLDivElement>;
27
+ /** Дополнительный класс для корневого элемента */
28
+ className?: string;
29
+ /** Дополнительный класс корневого элемента */
30
+ classes?: {
31
+ root?: string;
32
+ button?: string;
33
+ extraButton?: string;
34
+ };
35
+ /** Дополнительные data атрибуты к внутренним элементам */
36
+ dataAttrs?: {
37
+ root?: Record<string, string>;
38
+ button?: Record<string, string>;
39
+ extraButton?: Record<string, string>;
40
+ image?: Record<string, string>;
41
+ mask?: Record<string, string>;
42
+ buttonsWrapper?: Record<string, string>;
43
+ };
44
+ }
45
+ declare const PictureBox: React.FC<IPictureBoxProps>;
46
+ export default PictureBox;
@@ -0,0 +1,134 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import "core-js/modules/es.array.concat.js";
3
+ import * as React from 'react';
4
+ import { Button, Grid, GridColumn } from '@megafon/ui-core';
5
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
+ import PropTypes from 'prop-types';
7
+ import "./PictureBox.css";
8
+ var cn = cnCreate('mfui-v6-picture-box');
9
+
10
+ var PictureBox = function PictureBox(_ref) {
11
+ var image = _ref.image,
12
+ button = _ref.button,
13
+ extraButton = _ref.extraButton,
14
+ _ref$pictureMask = _ref.pictureMask,
15
+ pictureMask = _ref$pictureMask === void 0 ? 'none' : _ref$pictureMask,
16
+ dataAttrs = _ref.dataAttrs,
17
+ className = _ref.className,
18
+ classes = _ref.classes,
19
+ rootRef = _ref.rootRef,
20
+ children = _ref.children;
21
+ var imageSrc = image.src,
22
+ imageSrc2x = image.src2x,
23
+ _image$align = image.align,
24
+ imageAlign = _image$align === void 0 ? 'left' : _image$align,
25
+ _image$alt = image.alt,
26
+ imageAlt = _image$alt === void 0 ? '' : _image$alt;
27
+ var imageOrder = imageAlign === 'left' ? '0' : '1';
28
+
29
+ var renderImg = function renderImg() {
30
+ var srcSet = imageSrc2x ? "".concat(imageSrc, ", ").concat(imageSrc2x, " 2x") : undefined;
31
+ var img = /*#__PURE__*/React.createElement("img", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image), {
32
+ className: cn('image'),
33
+ srcSet: srcSet,
34
+ src: imageSrc,
35
+ alt: imageAlt
36
+ }));
37
+
38
+ if (pictureMask !== 'none') {
39
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.mask), {
40
+ className: cn('mask')
41
+ }), img);
42
+ }
43
+
44
+ return img;
45
+ };
46
+
47
+ var renderButtons = function renderButtons() {
48
+ if (!button && !extraButton) {
49
+ return null;
50
+ }
51
+
52
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.buttonsWrapper), {
53
+ className: cn('button-wrapper')
54
+ }), !!button && /*#__PURE__*/React.createElement(Button, {
55
+ href: button.href,
56
+ target: button.target,
57
+ rel: button.rel,
58
+ dataAttrs: {
59
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
60
+ },
61
+ classes: {
62
+ root: classes === null || classes === void 0 ? void 0 : classes.button
63
+ },
64
+ onClick: button.onClick
65
+ }, button.title), !!extraButton && /*#__PURE__*/React.createElement(Button, {
66
+ href: extraButton.href,
67
+ target: extraButton.target,
68
+ rel: extraButton.rel,
69
+ type: "outline",
70
+ dataAttrs: {
71
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.extraButton
72
+ },
73
+ classes: {
74
+ root: classes === null || classes === void 0 ? void 0 : classes.extraButton
75
+ },
76
+ onClick: extraButton.onClick
77
+ }, extraButton.title));
78
+ };
79
+
80
+ return /*#__PURE__*/React.createElement("div", _extends({
81
+ className: cn({
82
+ align: imageAlign,
83
+ mask: pictureMask
84
+ }, [classes === null || classes === void 0 ? void 0 : classes.root, className])
85
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
86
+ ref: rootRef
87
+ }), /*#__PURE__*/React.createElement(Grid, {
88
+ guttersLeft: "medium"
89
+ }, /*#__PURE__*/React.createElement(GridColumn, {
90
+ all: "7",
91
+ tablet: "12",
92
+ mobile: "12",
93
+ orderWide: imageOrder,
94
+ orderDesktop: imageOrder
95
+ }, renderImg()), /*#__PURE__*/React.createElement(GridColumn, {
96
+ all: "5",
97
+ tablet: "12",
98
+ mobile: "12",
99
+ flex: true
100
+ }, /*#__PURE__*/React.createElement("div", {
101
+ className: cn('content')
102
+ }, children, renderButtons()))));
103
+ };
104
+
105
+ PictureBox.propTypes = {
106
+ image: PropTypes.shape({
107
+ src: PropTypes.string.isRequired,
108
+ src2x: PropTypes.string,
109
+ align: PropTypes.oneOf(['right', 'left']),
110
+ alt: PropTypes.string
111
+ }).isRequired,
112
+ button: PropTypes.shape({
113
+ title: PropTypes.string,
114
+ href: PropTypes.string,
115
+ target: PropTypes.oneOf(['_self', '_blank']),
116
+ rel: PropTypes.string,
117
+ onClick: PropTypes.func
118
+ }),
119
+ extraButton: PropTypes.shape({
120
+ title: PropTypes.string,
121
+ href: PropTypes.string,
122
+ target: PropTypes.oneOf(['_self', '_blank']),
123
+ rel: PropTypes.string,
124
+ onClick: PropTypes.func
125
+ }),
126
+ pictureMask: PropTypes.oneOf(['mac-book', 'none']),
127
+ className: PropTypes.string,
128
+ classes: PropTypes.objectOf(PropTypes.string),
129
+ dataAttrs: PropTypes.objectOf(PropTypes.object),
130
+ rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
131
+ current: PropTypes.elementType
132
+ }), PropTypes.any])])
133
+ };
134
+ export default PictureBox;
@@ -30,6 +30,7 @@ export { default as Instructions } from './components/Instructions/Instructions'
30
30
  export { default as NotificationBox } from './components/NotificationBox/NotificationBox';
31
31
  export { default as PageTitle } from './components/PageTitle/PageTitle';
32
32
  export { default as Partners } from './components/Partners/Partners';
33
+ export { default as PictureBox } from './components/PictureBox/PictureBox';
33
34
  export { default as PictureWithDescription } from './components/PictureWithDescription/PictureWithDescription';
34
35
  export { default as PromoCard } from './components/PromoCards/components/PromoCard/PromoCard';
35
36
  export { default as PromoCards } from './components/PromoCards/PromoCards';
package/dist/es/index.js CHANGED
@@ -30,6 +30,7 @@ export { default as Instructions } from "./components/Instructions/Instructions"
30
30
  export { default as NotificationBox } from "./components/NotificationBox/NotificationBox";
31
31
  export { default as PageTitle } from "./components/PageTitle/PageTitle";
32
32
  export { default as Partners } from "./components/Partners/Partners";
33
+ export { default as PictureBox } from "./components/PictureBox/PictureBox";
33
34
  export { default as PictureWithDescription } from "./components/PictureWithDescription/PictureWithDescription";
34
35
  export { default as PromoCard } from "./components/PromoCards/components/PromoCard/PromoCard";
35
36
  export { default as PromoCards } from "./components/PromoCards/PromoCards";
@@ -6,6 +6,8 @@ h5 {
6
6
  margin: 0;
7
7
  }
8
8
  .mfui-v6-benefits-icons {
9
+ -webkit-box-sizing: border-box;
10
+ box-sizing: border-box;
9
11
  overflow: hidden;
10
12
  }
11
13
  .mfui-v6-benefits-icons__inner {
@@ -8,7 +8,7 @@ h5 {
8
8
  .mfui-v6-benefits-icons-tile {
9
9
  min-height: 100%;
10
10
  padding: 24px;
11
- border-radius: 12px;
11
+ border-radius: 24px;
12
12
  }
13
13
  .mfui-v6-benefits-icons-tile_background_transparent {
14
14
  padding: 0;
@@ -22,6 +22,12 @@ h5 {
22
22
  .mfui-v6-benefits-icons-tile_background_purple {
23
23
  background-color: var(--brandPurple20);
24
24
  }
25
+ .mfui-v6-benefits-icons-tile_background_white {
26
+ background-color: var(--base);
27
+ }
28
+ .mfui-v6-benefits-icons-tile_background_stroke {
29
+ border: 1px solid var(--spbSky2);
30
+ }
25
31
  .mfui-v6-benefits-icons-tile .mfui-v6-benefits-icons-tile__svg-icon {
26
32
  margin-bottom: 10px;
27
33
  }
@@ -38,6 +38,8 @@ export declare const BackgroundEnum: {
38
38
  readonly GRAY: "gray";
39
39
  readonly GREEN: "green";
40
40
  readonly PURPLE: "purple";
41
+ readonly WHITE: "white";
42
+ readonly STROKE: "stroke";
41
43
  };
42
44
  export declare type BackgroundType = typeof BackgroundEnum[keyof typeof BackgroundEnum];
43
45
  export declare type GridConfig = {
@@ -19,6 +19,8 @@ var BackgroundEnum = {
19
19
  TRANSPARENT: 'transparent',
20
20
  GRAY: 'gray',
21
21
  GREEN: 'green',
22
- PURPLE: 'purple'
22
+ PURPLE: 'purple',
23
+ WHITE: 'white',
24
+ STROKE: 'stroke'
23
25
  };
24
26
  exports.BackgroundEnum = BackgroundEnum;