@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,155 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ require("core-js/modules/es.array.concat.js");
13
+
14
+ var React = _interopRequireWildcard(require("react"));
15
+
16
+ var _uiCore = require("@megafon/ui-core");
17
+
18
+ var _uiHelpers = require("@megafon/ui-helpers");
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
+
28
+ var cn = (0, _uiHelpers.cnCreate)('mfui-v6-picture-box');
29
+
30
+ var PictureBox = function PictureBox(_ref) {
31
+ var image = _ref.image,
32
+ button = _ref.button,
33
+ extraButton = _ref.extraButton,
34
+ _ref$pictureMask = _ref.pictureMask,
35
+ pictureMask = _ref$pictureMask === void 0 ? 'none' : _ref$pictureMask,
36
+ dataAttrs = _ref.dataAttrs,
37
+ className = _ref.className,
38
+ classes = _ref.classes,
39
+ rootRef = _ref.rootRef,
40
+ children = _ref.children;
41
+ var imageSrc = image.src,
42
+ imageSrc2x = image.src2x,
43
+ _image$align = image.align,
44
+ imageAlign = _image$align === void 0 ? 'left' : _image$align,
45
+ _image$alt = image.alt,
46
+ imageAlt = _image$alt === void 0 ? '' : _image$alt;
47
+ var imageOrder = imageAlign === 'left' ? '0' : '1';
48
+
49
+ var renderImg = function renderImg() {
50
+ var srcSet = imageSrc2x ? "".concat(imageSrc, ", ").concat(imageSrc2x, " 2x") : undefined;
51
+ var img = /*#__PURE__*/React.createElement("img", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image), {
52
+ className: cn('image'),
53
+ srcSet: srcSet,
54
+ src: imageSrc,
55
+ alt: imageAlt
56
+ }));
57
+
58
+ if (pictureMask !== 'none') {
59
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.mask), {
60
+ className: cn('mask')
61
+ }), img);
62
+ }
63
+
64
+ return img;
65
+ };
66
+
67
+ var renderButtons = function renderButtons() {
68
+ if (!button && !extraButton) {
69
+ return null;
70
+ }
71
+
72
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.buttonsWrapper), {
73
+ className: cn('button-wrapper')
74
+ }), !!button && /*#__PURE__*/React.createElement(_uiCore.Button, {
75
+ href: button.href,
76
+ target: button.target,
77
+ rel: button.rel,
78
+ dataAttrs: {
79
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
80
+ },
81
+ classes: {
82
+ root: classes === null || classes === void 0 ? void 0 : classes.button
83
+ },
84
+ onClick: button.onClick
85
+ }, button.title), !!extraButton && /*#__PURE__*/React.createElement(_uiCore.Button, {
86
+ href: extraButton.href,
87
+ target: extraButton.target,
88
+ rel: extraButton.rel,
89
+ type: "outline",
90
+ dataAttrs: {
91
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.extraButton
92
+ },
93
+ classes: {
94
+ root: classes === null || classes === void 0 ? void 0 : classes.extraButton
95
+ },
96
+ onClick: extraButton.onClick
97
+ }, extraButton.title));
98
+ };
99
+
100
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
101
+ className: cn({
102
+ align: imageAlign,
103
+ mask: pictureMask
104
+ }, [classes === null || classes === void 0 ? void 0 : classes.root, className])
105
+ }, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
106
+ ref: rootRef
107
+ }), /*#__PURE__*/React.createElement(_uiCore.Grid, {
108
+ guttersLeft: "medium"
109
+ }, /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
110
+ all: "7",
111
+ tablet: "12",
112
+ mobile: "12",
113
+ orderWide: imageOrder,
114
+ orderDesktop: imageOrder
115
+ }, renderImg()), /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
116
+ all: "5",
117
+ tablet: "12",
118
+ mobile: "12",
119
+ flex: true
120
+ }, /*#__PURE__*/React.createElement("div", {
121
+ className: cn('content')
122
+ }, children, renderButtons()))));
123
+ };
124
+
125
+ PictureBox.propTypes = {
126
+ image: _propTypes["default"].shape({
127
+ src: _propTypes["default"].string.isRequired,
128
+ src2x: _propTypes["default"].string,
129
+ align: _propTypes["default"].oneOf(['right', 'left']),
130
+ alt: _propTypes["default"].string
131
+ }).isRequired,
132
+ button: _propTypes["default"].shape({
133
+ title: _propTypes["default"].string,
134
+ href: _propTypes["default"].string,
135
+ target: _propTypes["default"].oneOf(['_self', '_blank']),
136
+ rel: _propTypes["default"].string,
137
+ onClick: _propTypes["default"].func
138
+ }),
139
+ extraButton: _propTypes["default"].shape({
140
+ title: _propTypes["default"].string,
141
+ href: _propTypes["default"].string,
142
+ target: _propTypes["default"].oneOf(['_self', '_blank']),
143
+ rel: _propTypes["default"].string,
144
+ onClick: _propTypes["default"].func
145
+ }),
146
+ pictureMask: _propTypes["default"].oneOf(['mac-book', 'none']),
147
+ className: _propTypes["default"].string,
148
+ classes: _propTypes["default"].objectOf(_propTypes["default"].string),
149
+ dataAttrs: _propTypes["default"].objectOf(_propTypes["default"].object),
150
+ rootRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].oneOfType([_propTypes["default"].shape({
151
+ current: _propTypes["default"].elementType
152
+ }), _propTypes["default"].any])])
153
+ };
154
+ var _default = PictureBox;
155
+ exports["default"] = _default;
@@ -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/lib/index.js CHANGED
@@ -195,6 +195,12 @@ Object.defineProperty(exports, "Partners", {
195
195
  return _Partners["default"];
196
196
  }
197
197
  });
198
+ Object.defineProperty(exports, "PictureBox", {
199
+ enumerable: true,
200
+ get: function get() {
201
+ return _PictureBox["default"];
202
+ }
203
+ });
198
204
  Object.defineProperty(exports, "PictureWithDescription", {
199
205
  enumerable: true,
200
206
  get: function get() {
@@ -410,6 +416,8 @@ var _PageTitle = _interopRequireDefault(require("./components/PageTitle/PageTitl
410
416
 
411
417
  var _Partners = _interopRequireDefault(require("./components/Partners/Partners"));
412
418
 
419
+ var _PictureBox = _interopRequireDefault(require("./components/PictureBox/PictureBox"));
420
+
413
421
  var _PictureWithDescription = _interopRequireDefault(require("./components/PictureWithDescription/PictureWithDescription"));
414
422
 
415
423
  var _PromoCard = _interopRequireDefault(require("./components/PromoCards/components/PromoCard/PromoCard"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-shared",
3
- "version": "6.13.0",
3
+ "version": "6.14.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -90,5 +90,5 @@
90
90
  "prop-types": "^15.7.2",
91
91
  "swiper": "^6.5.6"
92
92
  },
93
- "gitHead": "186610744e45978f2f18cfce24ff802193a999e0"
93
+ "gitHead": "e69e53767fbb36f2f54c1c90b1fc233fb8560549"
94
94
  }