@megafon/ui-shared 4.10.0 → 4.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/CHANGELOG.md +27 -0
- package/dist/es/components/BenefitsPictures/BenefitsPictures.js +5 -3
- package/dist/es/components/BenefitsPictures/types.d.ts +2 -0
- package/dist/es/components/Card/Card.d.ts +2 -0
- package/dist/es/components/Card/Card.js +4 -2
- package/dist/es/components/CardsBox/CardsBox.d.ts +2 -0
- package/dist/es/components/CardsBox/CardsBox.js +6 -3
- package/dist/es/components/Instructions/Instructions.d.ts +1 -0
- package/dist/es/components/Instructions/Instructions.js +5 -3
- package/dist/es/components/PictureWithDescription/PictureWithDescription.d.ts +2 -0
- package/dist/es/components/PictureWithDescription/PictureWithDescription.js +3 -1
- package/dist/es/components/TextBox/TextBoxPicture.d.ts +2 -0
- package/dist/es/components/TextBox/TextBoxPicture.js +5 -3
- package/dist/es/components/VideoBanner/VideoBanner.d.ts +2 -0
- package/dist/es/components/VideoBanner/VideoBanner.js +3 -1
- package/dist/lib/components/BenefitsPictures/BenefitsPictures.js +5 -3
- package/dist/lib/components/BenefitsPictures/types.d.ts +2 -0
- package/dist/lib/components/Card/Card.d.ts +2 -0
- package/dist/lib/components/Card/Card.js +4 -2
- package/dist/lib/components/CardsBox/CardsBox.d.ts +2 -0
- package/dist/lib/components/CardsBox/CardsBox.js +6 -3
- package/dist/lib/components/Instructions/Instructions.d.ts +1 -0
- package/dist/lib/components/Instructions/Instructions.js +5 -3
- package/dist/lib/components/PictureWithDescription/PictureWithDescription.d.ts +2 -0
- package/dist/lib/components/PictureWithDescription/PictureWithDescription.js +3 -1
- package/dist/lib/components/TextBox/TextBoxPicture.d.ts +2 -0
- package/dist/lib/components/TextBox/TextBoxPicture.js +5 -3
- package/dist/lib/components/VideoBanner/VideoBanner.d.ts +2 -0
- package/dist/lib/components/VideoBanner/VideoBanner.js +3 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,33 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [4.12.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@4.11.0...@megafon/ui-shared@4.12.0) (2023-02-06)
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* **benefitpictures:** add alt prop for images ([3fd19e7](https://github.com/MegafonWebLab/megafon-ui/commit/3fd19e718068db8d418adccbb1812e4e8dd6e090))
|
12
|
+
* **card:** add alt prop for image ([a56a159](https://github.com/MegafonWebLab/megafon-ui/commit/a56a1595b1114e63aa80d9f8976bfb8d54b871db))
|
13
|
+
* **instructions:** add alt prop for images ([94d4750](https://github.com/MegafonWebLab/megafon-ui/commit/94d4750a51a4d3e848c319ed98a31b3fd241e733))
|
14
|
+
* **picturewithdescription:** add alt prop for image ([0ed9e19](https://github.com/MegafonWebLab/megafon-ui/commit/0ed9e195b00c41a2a736de741af82b3808eb1677))
|
15
|
+
* **textboxpicture:** add alt prop for image ([6df38e2](https://github.com/MegafonWebLab/megafon-ui/commit/6df38e23d9a42fbb8833c0f4968fd6f6ff4f28b7))
|
16
|
+
* **videobanner:** add alt prop for image ([3ec8c6c](https://github.com/MegafonWebLab/megafon-ui/commit/3ec8c6cda08b42fe8f36b9bee029ad0c3ad18d5f))
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
# [4.11.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@4.10.0...@megafon/ui-shared@4.11.0) (2023-01-31)
|
23
|
+
|
24
|
+
|
25
|
+
### Features
|
26
|
+
|
27
|
+
* **cardsbox:** add prop hGridAlign ([883d12b](https://github.com/MegafonWebLab/megafon-ui/commit/883d12b3447659787d8aa3f61e734e8cb1b03656))
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
6
33
|
# [4.10.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@4.9.1...@megafon/ui-shared@4.10.0) (2023-01-23)
|
7
34
|
|
8
35
|
|
@@ -157,7 +157,8 @@ var BenefitsPictures = function BenefitsPictures(_ref) {
|
|
157
157
|
}, items.map(function (_ref2, index) {
|
158
158
|
var img = _ref2.img,
|
159
159
|
title = _ref2.title,
|
160
|
-
text = _ref2.text
|
160
|
+
text = _ref2.text,
|
161
|
+
alt = _ref2.alt;
|
161
162
|
return /*#__PURE__*/React.createElement(GridColumn, _extends({}, align === 'left' ? getLeftConfig(items.length, index) : getCenterConfig(items.length, index, gridGap), {
|
162
163
|
key: index
|
163
164
|
}), /*#__PURE__*/React.createElement("div", {
|
@@ -167,7 +168,7 @@ var BenefitsPictures = function BenefitsPictures(_ref) {
|
|
167
168
|
'h-align': align
|
168
169
|
}),
|
169
170
|
src: img,
|
170
|
-
alt:
|
171
|
+
alt: alt
|
171
172
|
}), /*#__PURE__*/React.createElement(Header, {
|
172
173
|
className: cn('title'),
|
173
174
|
align: align,
|
@@ -185,7 +186,8 @@ BenefitsPictures.propTypes = {
|
|
185
186
|
items: PropTypes.arrayOf(PropTypes.shape({
|
186
187
|
title: PropTypes.string.isRequired,
|
187
188
|
text: PropTypes.string.isRequired,
|
188
|
-
img: PropTypes.string.isRequired
|
189
|
+
img: PropTypes.string.isRequired,
|
190
|
+
alt: PropTypes.string
|
189
191
|
}).isRequired).isRequired,
|
190
192
|
align: PropTypes.oneOf(['left', 'center']),
|
191
193
|
gridGap: PropTypes.oneOf(['medium', 'large']),
|
@@ -5,6 +5,8 @@ export interface IBenefit {
|
|
5
5
|
text: string;
|
6
6
|
/** Изображение */
|
7
7
|
img: string;
|
8
|
+
/** Значение тега alt для изображения */
|
9
|
+
alt?: string;
|
8
10
|
}
|
9
11
|
declare type TGridSizeValues = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';
|
10
12
|
export declare type GridConfig = {
|
@@ -43,6 +43,8 @@ export interface ICard {
|
|
43
43
|
rootRef?: Ref<HTMLDivElement>;
|
44
44
|
/** Изображение в карточке */
|
45
45
|
imageSrc?: string;
|
46
|
+
/** Значение тега alt для изображения */
|
47
|
+
imageAlt?: string;
|
46
48
|
/** Иконка в карточке */
|
47
49
|
svgSrc?: React.ReactNode;
|
48
50
|
/** Заголовок карточки */
|
@@ -23,6 +23,7 @@ var Card = function Card(_ref) {
|
|
23
23
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
24
24
|
rootRef = _ref.rootRef,
|
25
25
|
imageSrc = _ref.imageSrc,
|
26
|
+
imageAlt = _ref.imageAlt,
|
26
27
|
svgSrc = _ref.svgSrc,
|
27
28
|
title = _ref.title,
|
28
29
|
text = _ref.text,
|
@@ -52,7 +53,7 @@ var Card = function Card(_ref) {
|
|
52
53
|
}, /*#__PURE__*/React.createElement("img", {
|
53
54
|
className: cn('img'),
|
54
55
|
src: imageSrc,
|
55
|
-
alt:
|
56
|
+
alt: imageAlt
|
56
57
|
}));
|
57
58
|
}
|
58
59
|
|
@@ -66,7 +67,7 @@ var Card = function Card(_ref) {
|
|
66
67
|
default:
|
67
68
|
return null;
|
68
69
|
}
|
69
|
-
}, [imageSrc, svgSrc, objectFit]);
|
70
|
+
}, [imageSrc, svgSrc, objectFit, imageAlt]);
|
70
71
|
var renderLink = React.useCallback(function () {
|
71
72
|
if (!link) {
|
72
73
|
return null;
|
@@ -164,6 +165,7 @@ Card.propTypes = {
|
|
164
165
|
current: PropTypes.elementType
|
165
166
|
}), PropTypes.any])]),
|
166
167
|
imageSrc: PropTypes.string,
|
168
|
+
imageAlt: PropTypes.string,
|
167
169
|
svgSrc: PropTypes.node,
|
168
170
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired,
|
169
171
|
text: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { ICard } from '../Card/Card';
|
3
3
|
interface ICardsBoxProps {
|
4
|
+
/** Выравнивание всех колонок компонента Grid по горизонтали */
|
5
|
+
gridHAlign?: 'left' | 'right' | 'center' | 'between' | 'around';
|
4
6
|
/** Ссылка на корневой элемент */
|
5
7
|
rootRef?: React.Ref<HTMLDivElement>;
|
6
8
|
/** Дата атрибуты для корневого элемента */
|
@@ -22,7 +22,8 @@ var SlidesSettings = (_SlidesSettings = {}, _defineProperty(_SlidesSettings, bre
|
|
22
22
|
var cn = cnCreate('mfui-cards-box');
|
23
23
|
|
24
24
|
var CardsBox = function CardsBox(_ref) {
|
25
|
-
var
|
25
|
+
var gridHAlign = _ref.gridHAlign,
|
26
|
+
rootRef = _ref.rootRef,
|
26
27
|
dataAttrs = _ref.dataAttrs,
|
27
28
|
onChange = _ref.onChange,
|
28
29
|
children = _ref.children;
|
@@ -37,14 +38,15 @@ var CardsBox = function CardsBox(_ref) {
|
|
37
38
|
var renderGrid = React.useCallback(function () {
|
38
39
|
return /*#__PURE__*/React.createElement(Grid, {
|
39
40
|
guttersBottom: "medium",
|
40
|
-
guttersLeft: "medium"
|
41
|
+
guttersLeft: "medium",
|
42
|
+
hAlign: gridHAlign
|
41
43
|
}, React.Children.map(children, function (child) {
|
42
44
|
return /*#__PURE__*/React.createElement(GridColumn, {
|
43
45
|
all: "4",
|
44
46
|
mobile: "12"
|
45
47
|
}, child);
|
46
48
|
}));
|
47
|
-
}, [children]);
|
49
|
+
}, [children, gridHAlign]);
|
48
50
|
var renderCarousel = React.useCallback(function () {
|
49
51
|
return /*#__PURE__*/React.createElement(Carousel, {
|
50
52
|
slidesSettings: SlidesSettings,
|
@@ -70,6 +72,7 @@ var CardsBox = function CardsBox(_ref) {
|
|
70
72
|
};
|
71
73
|
|
72
74
|
CardsBox.propTypes = {
|
75
|
+
gridHAlign: PropTypes.oneOf(['left', 'right', 'center', 'between', 'around']),
|
73
76
|
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
74
77
|
current: PropTypes.elementType
|
75
78
|
}), PropTypes.any])]),
|
@@ -20,6 +20,7 @@ export declare type InstructionItemType = {
|
|
20
20
|
title: string | React.ReactNode | React.ReactNode[];
|
21
21
|
mediaUrl: string;
|
22
22
|
isVideo: boolean;
|
23
|
+
imageAlt?: string;
|
23
24
|
};
|
24
25
|
export interface IInstructionsProps {
|
25
26
|
/** Дополнительные data атрибуты к внутренним элементам */
|
@@ -104,12 +104,13 @@ var Instructions = function Instructions(_ref) {
|
|
104
104
|
className: cn('swiper')
|
105
105
|
}, instructionItems.map(function (_ref3, i) {
|
106
106
|
var mediaUrl = _ref3.mediaUrl,
|
107
|
-
isVideo = _ref3.isVideo
|
107
|
+
isVideo = _ref3.isVideo,
|
108
|
+
imageAlt = _ref3.imageAlt;
|
108
109
|
return /*#__PURE__*/React.createElement(SwiperSlide, {
|
109
110
|
className: swiperSlideCn,
|
110
111
|
key: i + mediaUrl
|
111
112
|
}, isVideo ? renderVideo(mediaUrl, i) : /*#__PURE__*/React.createElement("img", _extends({
|
112
|
-
alt:
|
113
|
+
alt: imageAlt,
|
113
114
|
src: mediaUrl
|
114
115
|
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image, i + 1), {
|
115
116
|
className: cn('swiper-img', [instructionItemImg])
|
@@ -246,7 +247,8 @@ Instructions.propTypes = {
|
|
246
247
|
instructionItems: PropTypes.arrayOf(PropTypes.shape({
|
247
248
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired,
|
248
249
|
mediaUrl: PropTypes.string.isRequired,
|
249
|
-
isVideo: PropTypes.bool.isRequired
|
250
|
+
isVideo: PropTypes.bool.isRequired,
|
251
|
+
imageAlt: PropTypes.string
|
250
252
|
}).isRequired).isRequired,
|
251
253
|
pictureAlign: PropTypes.oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
252
254
|
pictureMask: PropTypes.oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.NONE]),
|
@@ -21,6 +21,8 @@ export interface IPictureWithDescriptionProps {
|
|
21
21
|
pictureUrl: string;
|
22
22
|
/** Расположение изображения */
|
23
23
|
pictureAlign?: PictureAlignTypesType;
|
24
|
+
/** Значение тега alt для изображения */
|
25
|
+
pictureAlt?: string;
|
24
26
|
/** Выравнивание текста по верхнему краю */
|
25
27
|
isTextTopAlign?: boolean;
|
26
28
|
}
|
@@ -18,6 +18,7 @@ var PictureWithDescription = function PictureWithDescription(_ref) {
|
|
18
18
|
pictureUrl = _ref.pictureUrl,
|
19
19
|
_ref$pictureAlign = _ref.pictureAlign,
|
20
20
|
pictureAlign = _ref$pictureAlign === void 0 ? 'left' : _ref$pictureAlign,
|
21
|
+
pictureAlt = _ref.pictureAlt,
|
21
22
|
isTextTopAlign = _ref.isTextTopAlign,
|
22
23
|
children = _ref.children;
|
23
24
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -30,7 +31,7 @@ var PictureWithDescription = function PictureWithDescription(_ref) {
|
|
30
31
|
}, /*#__PURE__*/React.createElement("img", {
|
31
32
|
className: cn('img'),
|
32
33
|
src: pictureUrl,
|
33
|
-
alt:
|
34
|
+
alt: pictureAlt
|
34
35
|
})), /*#__PURE__*/React.createElement("div", {
|
35
36
|
className: cn('articles', {
|
36
37
|
align: pictureAlign,
|
@@ -56,6 +57,7 @@ PictureWithDescription.propTypes = {
|
|
56
57
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
57
58
|
pictureUrl: PropTypes.string.isRequired,
|
58
59
|
pictureAlign: PropTypes.oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
60
|
+
pictureAlt: PropTypes.string,
|
59
61
|
isTextTopAlign: PropTypes.bool
|
60
62
|
};
|
61
63
|
export default PictureWithDescription;
|
@@ -12,6 +12,8 @@ export interface ITextBoxPictureProps {
|
|
12
12
|
url: string;
|
13
13
|
/** Значение вертикальных отступов */
|
14
14
|
margin?: PictureMarginTypesType;
|
15
|
+
/** Значение тега alt для изображения */
|
16
|
+
alt?: string;
|
15
17
|
}
|
16
18
|
declare const TextBoxPicture: React.FC<ITextBoxPictureProps>;
|
17
19
|
export default TextBoxPicture;
|
@@ -13,7 +13,8 @@ var cn = cnCreate('mfui-text-box-picture');
|
|
13
13
|
var TextBoxPicture = function TextBoxPicture(_ref) {
|
14
14
|
var url = _ref.url,
|
15
15
|
_ref$margin = _ref.margin,
|
16
|
-
margin = _ref$margin === void 0 ? pictureMarginTypes.DEFAULT : _ref$margin
|
16
|
+
margin = _ref$margin === void 0 ? pictureMarginTypes.DEFAULT : _ref$margin,
|
17
|
+
alt = _ref.alt;
|
17
18
|
return /*#__PURE__*/React.createElement("div", {
|
18
19
|
className: cn({
|
19
20
|
margin: margin
|
@@ -21,12 +22,13 @@ var TextBoxPicture = function TextBoxPicture(_ref) {
|
|
21
22
|
}, /*#__PURE__*/React.createElement("img", {
|
22
23
|
className: cn('img'),
|
23
24
|
src: url,
|
24
|
-
alt:
|
25
|
+
alt: alt
|
25
26
|
}));
|
26
27
|
};
|
27
28
|
|
28
29
|
TextBoxPicture.propTypes = {
|
29
30
|
url: PropTypes.string.isRequired,
|
30
|
-
margin: PropTypes.oneOf([pictureMarginTypes.DEFAULT, pictureMarginTypes.BIG_TOP, pictureMarginTypes.BIG_BOTTOM, pictureMarginTypes.BIG_VERTICAL])
|
31
|
+
margin: PropTypes.oneOf([pictureMarginTypes.DEFAULT, pictureMarginTypes.BIG_TOP, pictureMarginTypes.BIG_BOTTOM, pictureMarginTypes.BIG_VERTICAL]),
|
32
|
+
alt: PropTypes.string
|
31
33
|
};
|
32
34
|
export default TextBoxPicture;
|
@@ -94,6 +94,8 @@ interface IVideoBannerProps {
|
|
94
94
|
imageDesktop?: string;
|
95
95
|
/** Изображение для большого компьютерного разрешения */
|
96
96
|
imageDesktopWide?: string;
|
97
|
+
/** Значение тега alt для изображения */
|
98
|
+
imageAlt?: string;
|
97
99
|
/** Хлебные крошки */
|
98
100
|
breadcrumbs?: BreadCrumbsItemsType;
|
99
101
|
/** Включить микроразметку хлебных крошек */
|
@@ -60,6 +60,7 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
60
60
|
imageDesktop = _ref2$imageDesktop === void 0 ? '' : _ref2$imageDesktop,
|
61
61
|
_ref2$imageDesktopWid = _ref2.imageDesktopWide,
|
62
62
|
imageDesktopWide = _ref2$imageDesktopWid === void 0 ? '' : _ref2$imageDesktopWid,
|
63
|
+
imageAlt = _ref2.imageAlt,
|
63
64
|
content = _ref2.content,
|
64
65
|
_ref2$isMuted = _ref2.isMuted,
|
65
66
|
isMuted = _ref2$isMuted === void 0 ? true : _ref2$isMuted,
|
@@ -232,7 +233,7 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
232
233
|
}), /*#__PURE__*/React.createElement("img", {
|
233
234
|
className: cn('background-image'),
|
234
235
|
src: imageMobile,
|
235
|
-
alt:
|
236
|
+
alt: imageAlt
|
236
237
|
})))));
|
237
238
|
};
|
238
239
|
|
@@ -278,6 +279,7 @@ VideoBanner.propTypes = {
|
|
278
279
|
imageTablet: PropTypes.string.isRequired,
|
279
280
|
imageDesktop: PropTypes.string,
|
280
281
|
imageDesktopWide: PropTypes.string,
|
282
|
+
imageAlt: PropTypes.string,
|
281
283
|
breadcrumbs: PropTypes.arrayOf(PropTypes.shape({
|
282
284
|
title: PropTypes.string.isRequired,
|
283
285
|
href: PropTypes.string
|
@@ -180,7 +180,8 @@ var BenefitsPictures = function BenefitsPictures(_ref) {
|
|
180
180
|
}, items.map(function (_ref2, index) {
|
181
181
|
var img = _ref2.img,
|
182
182
|
title = _ref2.title,
|
183
|
-
text = _ref2.text
|
183
|
+
text = _ref2.text,
|
184
|
+
alt = _ref2.alt;
|
184
185
|
return /*#__PURE__*/React.createElement(_uiCore.GridColumn, (0, _extends2["default"])({}, align === 'left' ? getLeftConfig(items.length, index) : getCenterConfig(items.length, index, gridGap), {
|
185
186
|
key: index
|
186
187
|
}), /*#__PURE__*/React.createElement("div", {
|
@@ -190,7 +191,7 @@ var BenefitsPictures = function BenefitsPictures(_ref) {
|
|
190
191
|
'h-align': align
|
191
192
|
}),
|
192
193
|
src: img,
|
193
|
-
alt:
|
194
|
+
alt: alt
|
194
195
|
}), /*#__PURE__*/React.createElement(_uiCore.Header, {
|
195
196
|
className: cn('title'),
|
196
197
|
align: align,
|
@@ -208,7 +209,8 @@ BenefitsPictures.propTypes = {
|
|
208
209
|
items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
209
210
|
title: _propTypes["default"].string.isRequired,
|
210
211
|
text: _propTypes["default"].string.isRequired,
|
211
|
-
img: _propTypes["default"].string.isRequired
|
212
|
+
img: _propTypes["default"].string.isRequired,
|
213
|
+
alt: _propTypes["default"].string
|
212
214
|
}).isRequired).isRequired,
|
213
215
|
align: _propTypes["default"].oneOf(['left', 'center']),
|
214
216
|
gridGap: _propTypes["default"].oneOf(['medium', 'large']),
|
@@ -5,6 +5,8 @@ export interface IBenefit {
|
|
5
5
|
text: string;
|
6
6
|
/** Изображение */
|
7
7
|
img: string;
|
8
|
+
/** Значение тега alt для изображения */
|
9
|
+
alt?: string;
|
8
10
|
}
|
9
11
|
declare type TGridSizeValues = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | '11' | '12';
|
10
12
|
export declare type GridConfig = {
|
@@ -43,6 +43,8 @@ export interface ICard {
|
|
43
43
|
rootRef?: Ref<HTMLDivElement>;
|
44
44
|
/** Изображение в карточке */
|
45
45
|
imageSrc?: string;
|
46
|
+
/** Значение тега alt для изображения */
|
47
|
+
imageAlt?: string;
|
46
48
|
/** Иконка в карточке */
|
47
49
|
svgSrc?: React.ReactNode;
|
48
50
|
/** Заголовок карточки */
|
@@ -40,6 +40,7 @@ var Card = function Card(_ref) {
|
|
40
40
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
41
41
|
rootRef = _ref.rootRef,
|
42
42
|
imageSrc = _ref.imageSrc,
|
43
|
+
imageAlt = _ref.imageAlt,
|
43
44
|
svgSrc = _ref.svgSrc,
|
44
45
|
title = _ref.title,
|
45
46
|
text = _ref.text,
|
@@ -70,7 +71,7 @@ var Card = function Card(_ref) {
|
|
70
71
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
71
72
|
className: cn('img'),
|
72
73
|
src: imageSrc,
|
73
|
-
alt:
|
74
|
+
alt: imageAlt
|
74
75
|
}));
|
75
76
|
}
|
76
77
|
|
@@ -84,7 +85,7 @@ var Card = function Card(_ref) {
|
|
84
85
|
default:
|
85
86
|
return null;
|
86
87
|
}
|
87
|
-
}, [imageSrc, svgSrc, objectFit]);
|
88
|
+
}, [imageSrc, svgSrc, objectFit, imageAlt]);
|
88
89
|
|
89
90
|
var renderLink = _react["default"].useCallback(function () {
|
90
91
|
if (!link) {
|
@@ -186,6 +187,7 @@ Card.propTypes = {
|
|
186
187
|
current: _propTypes["default"].elementType
|
187
188
|
}), _propTypes["default"].any])]),
|
188
189
|
imageSrc: _propTypes["default"].string,
|
190
|
+
imageAlt: _propTypes["default"].string,
|
189
191
|
svgSrc: _propTypes["default"].node,
|
190
192
|
title: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]).isRequired,
|
191
193
|
text: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]),
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { ICard } from '../Card/Card';
|
3
3
|
interface ICardsBoxProps {
|
4
|
+
/** Выравнивание всех колонок компонента Grid по горизонтали */
|
5
|
+
gridHAlign?: 'left' | 'right' | 'center' | 'between' | 'around';
|
4
6
|
/** Ссылка на корневой элемент */
|
5
7
|
rootRef?: React.Ref<HTMLDivElement>;
|
6
8
|
/** Дата атрибуты для корневого элемента */
|
@@ -46,7 +46,8 @@ var SlidesSettings = (_SlidesSettings = {}, (0, _defineProperty2["default"])(_Sl
|
|
46
46
|
var cn = (0, _uiHelpers.cnCreate)('mfui-cards-box');
|
47
47
|
|
48
48
|
var CardsBox = function CardsBox(_ref) {
|
49
|
-
var
|
49
|
+
var gridHAlign = _ref.gridHAlign,
|
50
|
+
rootRef = _ref.rootRef,
|
50
51
|
dataAttrs = _ref.dataAttrs,
|
51
52
|
onChange = _ref.onChange,
|
52
53
|
children = _ref.children;
|
@@ -61,14 +62,15 @@ var CardsBox = function CardsBox(_ref) {
|
|
61
62
|
var renderGrid = React.useCallback(function () {
|
62
63
|
return /*#__PURE__*/React.createElement(_uiCore.Grid, {
|
63
64
|
guttersBottom: "medium",
|
64
|
-
guttersLeft: "medium"
|
65
|
+
guttersLeft: "medium",
|
66
|
+
hAlign: gridHAlign
|
65
67
|
}, React.Children.map(children, function (child) {
|
66
68
|
return /*#__PURE__*/React.createElement(_uiCore.GridColumn, {
|
67
69
|
all: "4",
|
68
70
|
mobile: "12"
|
69
71
|
}, child);
|
70
72
|
}));
|
71
|
-
}, [children]);
|
73
|
+
}, [children, gridHAlign]);
|
72
74
|
var renderCarousel = React.useCallback(function () {
|
73
75
|
return /*#__PURE__*/React.createElement(_uiCore.Carousel, {
|
74
76
|
slidesSettings: SlidesSettings,
|
@@ -94,6 +96,7 @@ var CardsBox = function CardsBox(_ref) {
|
|
94
96
|
};
|
95
97
|
|
96
98
|
CardsBox.propTypes = {
|
99
|
+
gridHAlign: PropTypes.oneOf(['left', 'right', 'center', 'between', 'around']),
|
97
100
|
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
98
101
|
current: PropTypes.elementType
|
99
102
|
}), PropTypes.any])]),
|
@@ -20,6 +20,7 @@ export declare type InstructionItemType = {
|
|
20
20
|
title: string | React.ReactNode | React.ReactNode[];
|
21
21
|
mediaUrl: string;
|
22
22
|
isVideo: boolean;
|
23
|
+
imageAlt?: string;
|
23
24
|
};
|
24
25
|
export interface IInstructionsProps {
|
25
26
|
/** Дополнительные data атрибуты к внутренним элементам */
|
@@ -126,12 +126,13 @@ var Instructions = function Instructions(_ref) {
|
|
126
126
|
className: cn('swiper')
|
127
127
|
}, instructionItems.map(function (_ref3, i) {
|
128
128
|
var mediaUrl = _ref3.mediaUrl,
|
129
|
-
isVideo = _ref3.isVideo
|
129
|
+
isVideo = _ref3.isVideo,
|
130
|
+
imageAlt = _ref3.imageAlt;
|
130
131
|
return /*#__PURE__*/_react["default"].createElement(_react2.SwiperSlide, {
|
131
132
|
className: swiperSlideCn,
|
132
133
|
key: i + mediaUrl
|
133
134
|
}, isVideo ? renderVideo(mediaUrl, i) : /*#__PURE__*/_react["default"].createElement("img", (0, _extends2["default"])({
|
134
|
-
alt:
|
135
|
+
alt: imageAlt,
|
135
136
|
src: mediaUrl
|
136
137
|
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image, i + 1), {
|
137
138
|
className: cn('swiper-img', [instructionItemImg])
|
@@ -274,7 +275,8 @@ Instructions.propTypes = {
|
|
274
275
|
instructionItems: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
275
276
|
title: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]).isRequired,
|
276
277
|
mediaUrl: _propTypes["default"].string.isRequired,
|
277
|
-
isVideo: _propTypes["default"].bool.isRequired
|
278
|
+
isVideo: _propTypes["default"].bool.isRequired,
|
279
|
+
imageAlt: _propTypes["default"].string
|
278
280
|
}).isRequired).isRequired,
|
279
281
|
pictureAlign: _propTypes["default"].oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
280
282
|
pictureMask: _propTypes["default"].oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.NONE]),
|
@@ -21,6 +21,8 @@ export interface IPictureWithDescriptionProps {
|
|
21
21
|
pictureUrl: string;
|
22
22
|
/** Расположение изображения */
|
23
23
|
pictureAlign?: PictureAlignTypesType;
|
24
|
+
/** Значение тега alt для изображения */
|
25
|
+
pictureAlt?: string;
|
24
26
|
/** Выравнивание текста по верхнему краю */
|
25
27
|
isTextTopAlign?: boolean;
|
26
28
|
}
|
@@ -37,6 +37,7 @@ var PictureWithDescription = function PictureWithDescription(_ref) {
|
|
37
37
|
pictureUrl = _ref.pictureUrl,
|
38
38
|
_ref$pictureAlign = _ref.pictureAlign,
|
39
39
|
pictureAlign = _ref$pictureAlign === void 0 ? 'left' : _ref$pictureAlign,
|
40
|
+
pictureAlt = _ref.pictureAlt,
|
40
41
|
isTextTopAlign = _ref.isTextTopAlign,
|
41
42
|
children = _ref.children;
|
42
43
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -49,7 +50,7 @@ var PictureWithDescription = function PictureWithDescription(_ref) {
|
|
49
50
|
}, /*#__PURE__*/React.createElement("img", {
|
50
51
|
className: cn('img'),
|
51
52
|
src: pictureUrl,
|
52
|
-
alt:
|
53
|
+
alt: pictureAlt
|
53
54
|
})), /*#__PURE__*/React.createElement("div", {
|
54
55
|
className: cn('articles', {
|
55
56
|
align: pictureAlign,
|
@@ -75,6 +76,7 @@ PictureWithDescription.propTypes = {
|
|
75
76
|
title: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]),
|
76
77
|
pictureUrl: _propTypes["default"].string.isRequired,
|
77
78
|
pictureAlign: _propTypes["default"].oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
79
|
+
pictureAlt: _propTypes["default"].string,
|
78
80
|
isTextTopAlign: _propTypes["default"].bool
|
79
81
|
};
|
80
82
|
var _default = PictureWithDescription;
|
@@ -12,6 +12,8 @@ export interface ITextBoxPictureProps {
|
|
12
12
|
url: string;
|
13
13
|
/** Значение вертикальных отступов */
|
14
14
|
margin?: PictureMarginTypesType;
|
15
|
+
/** Значение тега alt для изображения */
|
16
|
+
alt?: string;
|
15
17
|
}
|
16
18
|
declare const TextBoxPicture: React.FC<ITextBoxPictureProps>;
|
17
19
|
export default TextBoxPicture;
|
@@ -29,7 +29,8 @@ var cn = (0, _uiHelpers.cnCreate)('mfui-text-box-picture');
|
|
29
29
|
var TextBoxPicture = function TextBoxPicture(_ref) {
|
30
30
|
var url = _ref.url,
|
31
31
|
_ref$margin = _ref.margin,
|
32
|
-
margin = _ref$margin === void 0 ? pictureMarginTypes.DEFAULT : _ref$margin
|
32
|
+
margin = _ref$margin === void 0 ? pictureMarginTypes.DEFAULT : _ref$margin,
|
33
|
+
alt = _ref.alt;
|
33
34
|
return /*#__PURE__*/React.createElement("div", {
|
34
35
|
className: cn({
|
35
36
|
margin: margin
|
@@ -37,13 +38,14 @@ var TextBoxPicture = function TextBoxPicture(_ref) {
|
|
37
38
|
}, /*#__PURE__*/React.createElement("img", {
|
38
39
|
className: cn('img'),
|
39
40
|
src: url,
|
40
|
-
alt:
|
41
|
+
alt: alt
|
41
42
|
}));
|
42
43
|
};
|
43
44
|
|
44
45
|
TextBoxPicture.propTypes = {
|
45
46
|
url: PropTypes.string.isRequired,
|
46
|
-
margin: PropTypes.oneOf([pictureMarginTypes.DEFAULT, pictureMarginTypes.BIG_TOP, pictureMarginTypes.BIG_BOTTOM, pictureMarginTypes.BIG_VERTICAL])
|
47
|
+
margin: PropTypes.oneOf([pictureMarginTypes.DEFAULT, pictureMarginTypes.BIG_TOP, pictureMarginTypes.BIG_BOTTOM, pictureMarginTypes.BIG_VERTICAL]),
|
48
|
+
alt: PropTypes.string
|
47
49
|
};
|
48
50
|
var _default = TextBoxPicture;
|
49
51
|
exports["default"] = _default;
|
@@ -94,6 +94,8 @@ interface IVideoBannerProps {
|
|
94
94
|
imageDesktop?: string;
|
95
95
|
/** Изображение для большого компьютерного разрешения */
|
96
96
|
imageDesktopWide?: string;
|
97
|
+
/** Значение тега alt для изображения */
|
98
|
+
imageAlt?: string;
|
97
99
|
/** Хлебные крошки */
|
98
100
|
breadcrumbs?: BreadCrumbsItemsType;
|
99
101
|
/** Включить микроразметку хлебных крошек */
|
@@ -92,6 +92,7 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
92
92
|
imageDesktop = _ref2$imageDesktop === void 0 ? '' : _ref2$imageDesktop,
|
93
93
|
_ref2$imageDesktopWid = _ref2.imageDesktopWide,
|
94
94
|
imageDesktopWide = _ref2$imageDesktopWid === void 0 ? '' : _ref2$imageDesktopWid,
|
95
|
+
imageAlt = _ref2.imageAlt,
|
95
96
|
content = _ref2.content,
|
96
97
|
_ref2$isMuted = _ref2.isMuted,
|
97
98
|
isMuted = _ref2$isMuted === void 0 ? true : _ref2$isMuted,
|
@@ -268,7 +269,7 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
268
269
|
}), /*#__PURE__*/_react["default"].createElement("img", {
|
269
270
|
className: cn('background-image'),
|
270
271
|
src: imageMobile,
|
271
|
-
alt:
|
272
|
+
alt: imageAlt
|
272
273
|
})))));
|
273
274
|
};
|
274
275
|
|
@@ -314,6 +315,7 @@ VideoBanner.propTypes = {
|
|
314
315
|
imageTablet: PropTypes.string.isRequired,
|
315
316
|
imageDesktop: PropTypes.string,
|
316
317
|
imageDesktopWide: PropTypes.string,
|
318
|
+
imageAlt: PropTypes.string,
|
317
319
|
breadcrumbs: PropTypes.arrayOf(PropTypes.shape({
|
318
320
|
title: PropTypes.string.isRequired,
|
319
321
|
href: PropTypes.string
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@megafon/ui-shared",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.12.0",
|
4
4
|
"files": [
|
5
5
|
"dist"
|
6
6
|
],
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"@babel/preset-env": "^7.8.6",
|
53
53
|
"@babel/preset-react": "^7.8.3",
|
54
54
|
"@babel/preset-typescript": "^7.8.3",
|
55
|
-
"@megafon/ui-icons": "^2.
|
55
|
+
"@megafon/ui-icons": "^2.6.0",
|
56
56
|
"@svgr/core": "^2.4.1",
|
57
57
|
"@testing-library/jest-dom": "5.16.2",
|
58
58
|
"@testing-library/react": "12.1.2",
|
@@ -85,7 +85,7 @@
|
|
85
85
|
},
|
86
86
|
"dependencies": {
|
87
87
|
"@babel/runtime": "^7.8.4",
|
88
|
-
"@megafon/ui-core": "^4.11.
|
88
|
+
"@megafon/ui-core": "^4.11.4",
|
89
89
|
"@megafon/ui-helpers": "^2.4.0",
|
90
90
|
"core-js": "^3.6.4",
|
91
91
|
"htmr": "^0.9.2",
|
@@ -93,5 +93,5 @@
|
|
93
93
|
"prop-types": "^15.7.2",
|
94
94
|
"swiper": "^6.5.6"
|
95
95
|
},
|
96
|
-
"gitHead": "
|
96
|
+
"gitHead": "e7bdd83cccb39b833ced5eb1a5714f22166a0672"
|
97
97
|
}
|