@megafon/ui-shared 5.6.1 → 5.7.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 +16 -0
- package/dist/es/components/DownloadLinks/DownloadLink.d.ts +6 -0
- package/dist/es/components/DownloadLinks/DownloadLink.js +28 -6
- package/dist/es/components/Instructions/Instructions.js +1 -1
- package/dist/lib/components/DownloadLinks/DownloadLink.d.ts +6 -0
- package/dist/lib/components/DownloadLinks/DownloadLink.js +28 -6
- package/dist/lib/components/Instructions/Instructions.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
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
|
+
# [5.7.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-shared@5.6.1...@megafon/ui-shared@5.7.0) (2024-02-20)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* **instructions:** fix prop types ([e01d353](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/e01d353fc4570b4414240d06bd69dfcfbfda313c))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* **dowloadlink:** add new props and fix reviews ([90f2d5c](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/90f2d5c8d8c9b99eb988f45edf6530a895f51e4b))
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
## [5.6.1](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-shared@5.6.0...@megafon/ui-shared@5.6.1) (2024-02-13)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @megafon/ui-shared
|
@@ -25,6 +25,12 @@ export interface IDownloadLink {
|
|
25
25
|
};
|
26
26
|
/** Обработчик клика по ссылке */
|
27
27
|
onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
|
28
|
+
/** Флаг для управления атрибутом download в теге <a> */
|
29
|
+
disableDownload?: boolean;
|
30
|
+
/** target - аргумент тега <a> */
|
31
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
32
|
+
/** rel - аргумент тега <a> */
|
33
|
+
rel?: string;
|
28
34
|
}
|
29
35
|
declare const DownloadLink: React.FC<IDownloadLink>;
|
30
36
|
export default DownloadLink;
|
@@ -27,7 +27,23 @@ var DownloadLink = function DownloadLink(_ref) {
|
|
27
27
|
_ref$classes = _ref.classes,
|
28
28
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
29
29
|
rootRef = _ref.rootRef,
|
30
|
-
dataAttrs = _ref.dataAttrs
|
30
|
+
dataAttrs = _ref.dataAttrs,
|
31
|
+
disableDownload = _ref.disableDownload,
|
32
|
+
target = _ref.target,
|
33
|
+
rel = _ref.rel;
|
34
|
+
|
35
|
+
var setRelAttribute = function setRelAttribute() {
|
36
|
+
if (rel) {
|
37
|
+
return rel;
|
38
|
+
}
|
39
|
+
|
40
|
+
if (target && target !== '_self') {
|
41
|
+
return 'noreferrer noopener';
|
42
|
+
}
|
43
|
+
|
44
|
+
return undefined;
|
45
|
+
};
|
46
|
+
|
31
47
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
32
48
|
className: cn([className, classes.root]),
|
33
49
|
ref: rootRef
|
@@ -35,15 +51,18 @@ var DownloadLink = function DownloadLink(_ref) {
|
|
35
51
|
className: cn('icon')
|
36
52
|
}, /*#__PURE__*/React.createElement(DownloadIcon, {
|
37
53
|
className: cn('icon-svg')
|
38
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextLink, {
|
39
|
-
download: true
|
54
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextLink, _extends({}, !disableDownload && {
|
55
|
+
download: true
|
56
|
+
}, {
|
40
57
|
href: href,
|
41
58
|
onClick: onClick,
|
42
59
|
dataAttrs: {
|
43
60
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link
|
44
61
|
},
|
45
|
-
className: cn('link', [classes.link])
|
46
|
-
|
62
|
+
className: cn('link', [classes.link]),
|
63
|
+
target: target,
|
64
|
+
rel: setRelAttribute()
|
65
|
+
}), text), /*#__PURE__*/React.createElement("p", {
|
47
66
|
className: cn('info')
|
48
67
|
}, "".concat(extension).concat(extension && fileSize ? ', ' : '').concat(fileSize))));
|
49
68
|
};
|
@@ -65,6 +84,9 @@ DownloadLink.propTypes = {
|
|
65
84
|
root: PropTypes.string,
|
66
85
|
link: PropTypes.string
|
67
86
|
}),
|
68
|
-
onClick: PropTypes.func
|
87
|
+
onClick: PropTypes.func,
|
88
|
+
disableDownload: PropTypes.bool,
|
89
|
+
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
90
|
+
rel: PropTypes.string
|
69
91
|
};
|
70
92
|
export default DownloadLink;
|
@@ -345,7 +345,7 @@ Instructions.propTypes = {
|
|
345
345
|
}).isRequired).isRequired,
|
346
346
|
pictureAlign: PropTypes.oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
347
347
|
pictureVerticalAlign: PropTypes.oneOf([pictureVerticalAlignTypes.CENTER, pictureVerticalAlignTypes.TOP, pictureVerticalAlignTypes.UNSET]),
|
348
|
-
pictureMask: PropTypes.oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.NONE]),
|
348
|
+
pictureMask: PropTypes.oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.ANDROID_CROPPED, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.IPHONE_CROPPED, pictureMaskTypes.NONE]),
|
349
349
|
pictureBackgroundColor: PropTypes.oneOf([pictureBackgroundColorTypes.SPB_SKY_0]),
|
350
350
|
showArrows: PropTypes.bool,
|
351
351
|
arrowsTheme: PropTypes.oneOf([arrowTheme.DARK, arrowTheme.PURPLE]),
|
@@ -25,6 +25,12 @@ export interface IDownloadLink {
|
|
25
25
|
};
|
26
26
|
/** Обработчик клика по ссылке */
|
27
27
|
onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
|
28
|
+
/** Флаг для управления атрибутом download в теге <a> */
|
29
|
+
disableDownload?: boolean;
|
30
|
+
/** target - аргумент тега <a> */
|
31
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
32
|
+
/** rel - аргумент тега <a> */
|
33
|
+
rel?: string;
|
28
34
|
}
|
29
35
|
declare const DownloadLink: React.FC<IDownloadLink>;
|
30
36
|
export default DownloadLink;
|
@@ -47,7 +47,23 @@ var DownloadLink = function DownloadLink(_ref) {
|
|
47
47
|
_ref$classes = _ref.classes,
|
48
48
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
49
49
|
rootRef = _ref.rootRef,
|
50
|
-
dataAttrs = _ref.dataAttrs
|
50
|
+
dataAttrs = _ref.dataAttrs,
|
51
|
+
disableDownload = _ref.disableDownload,
|
52
|
+
target = _ref.target,
|
53
|
+
rel = _ref.rel;
|
54
|
+
|
55
|
+
var setRelAttribute = function setRelAttribute() {
|
56
|
+
if (rel) {
|
57
|
+
return rel;
|
58
|
+
}
|
59
|
+
|
60
|
+
if (target && target !== '_self') {
|
61
|
+
return 'noreferrer noopener';
|
62
|
+
}
|
63
|
+
|
64
|
+
return undefined;
|
65
|
+
};
|
66
|
+
|
51
67
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
52
68
|
className: cn([className, classes.root]),
|
53
69
|
ref: rootRef
|
@@ -55,15 +71,18 @@ var DownloadLink = function DownloadLink(_ref) {
|
|
55
71
|
className: cn('icon')
|
56
72
|
}, /*#__PURE__*/React.createElement(DownloadIcon, {
|
57
73
|
className: cn('icon-svg')
|
58
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_uiCore.TextLink, {
|
59
|
-
download: true
|
74
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_uiCore.TextLink, (0, _extends2["default"])({}, !disableDownload && {
|
75
|
+
download: true
|
76
|
+
}, {
|
60
77
|
href: href,
|
61
78
|
onClick: onClick,
|
62
79
|
dataAttrs: {
|
63
80
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link
|
64
81
|
},
|
65
|
-
className: cn('link', [classes.link])
|
66
|
-
|
82
|
+
className: cn('link', [classes.link]),
|
83
|
+
target: target,
|
84
|
+
rel: setRelAttribute()
|
85
|
+
}), text), /*#__PURE__*/React.createElement("p", {
|
67
86
|
className: cn('info')
|
68
87
|
}, "".concat(extension).concat(extension && fileSize ? ', ' : '').concat(fileSize))));
|
69
88
|
};
|
@@ -85,7 +104,10 @@ DownloadLink.propTypes = {
|
|
85
104
|
root: PropTypes.string,
|
86
105
|
link: PropTypes.string
|
87
106
|
}),
|
88
|
-
onClick: PropTypes.func
|
107
|
+
onClick: PropTypes.func,
|
108
|
+
disableDownload: PropTypes.bool,
|
109
|
+
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
110
|
+
rel: PropTypes.string
|
89
111
|
};
|
90
112
|
var _default = DownloadLink;
|
91
113
|
exports["default"] = _default;
|
@@ -380,7 +380,7 @@ Instructions.propTypes = {
|
|
380
380
|
}).isRequired).isRequired,
|
381
381
|
pictureAlign: _propTypes["default"].oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
382
382
|
pictureVerticalAlign: _propTypes["default"].oneOf([pictureVerticalAlignTypes.CENTER, pictureVerticalAlignTypes.TOP, pictureVerticalAlignTypes.UNSET]),
|
383
|
-
pictureMask: _propTypes["default"].oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.NONE]),
|
383
|
+
pictureMask: _propTypes["default"].oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.ANDROID_CROPPED, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.IPHONE_CROPPED, pictureMaskTypes.NONE]),
|
384
384
|
pictureBackgroundColor: _propTypes["default"].oneOf([pictureBackgroundColorTypes.SPB_SKY_0]),
|
385
385
|
showArrows: _propTypes["default"].bool,
|
386
386
|
arrowsTheme: _propTypes["default"].oneOf([arrowTheme.DARK, arrowTheme.PURPLE]),
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@megafon/ui-shared",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.7.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": "^5.
|
85
|
+
"@megafon/ui-core": "^5.6.0",
|
86
86
|
"@megafon/ui-helpers": "^2.5.4",
|
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": "bbacc7ca8173754967c131090ce860c050b2ce36"
|
94
94
|
}
|