@megafon/ui-shared 4.1.2 → 4.2.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
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
|
+
# [4.2.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@4.1.2...@megafon/ui-shared@4.2.0) (2022-10-13)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* **card:** add tests for button onClick; fix propTypes; ([148ca04](https://github.com/MegafonWebLab/megafon-ui/commit/148ca04afb9194eff52421ca228dd4de5e094323))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* **card:** add button onClick property ([766c66f](https://github.com/MegafonWebLab/megafon-ui/commit/766c66f609ee5a20b86322acd5a40dfc14cee223))
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
## [4.1.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@4.1.1...@megafon/ui-shared@4.1.2) (2022-10-10)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @megafon/ui-shared
|
@@ -7,9 +7,10 @@ export declare const Target: {
|
|
7
7
|
declare type TargetType = typeof Target[keyof typeof Target];
|
8
8
|
interface IButton {
|
9
9
|
title: string;
|
10
|
-
href
|
10
|
+
href?: string;
|
11
11
|
target?: TargetType;
|
12
12
|
download?: boolean;
|
13
|
+
onClick?: () => void;
|
13
14
|
}
|
14
15
|
interface ILink {
|
15
16
|
title: string;
|
@@ -101,7 +101,8 @@ var Card = function Card(_ref) {
|
|
101
101
|
var btnHref = button.href,
|
102
102
|
btnTitle = button.title,
|
103
103
|
btnTarget = button.target,
|
104
|
-
|
104
|
+
btnDownload = button.download,
|
105
|
+
btnOnClick = button.onClick;
|
105
106
|
return /*#__PURE__*/React.createElement(Button, {
|
106
107
|
dataAttrs: {
|
107
108
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
|
@@ -109,7 +110,8 @@ var Card = function Card(_ref) {
|
|
109
110
|
className: cn('button', [classes.button]),
|
110
111
|
href: btnHref,
|
111
112
|
target: btnTarget,
|
112
|
-
download:
|
113
|
+
download: btnDownload,
|
114
|
+
onClick: btnOnClick
|
113
115
|
}, btnTitle);
|
114
116
|
}, [button, isCardLink, classes, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button]);
|
115
117
|
var renderBtnsWrapper = React.useCallback(function () {
|
@@ -167,9 +169,10 @@ Card.propTypes = {
|
|
167
169
|
text: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
168
170
|
button: PropTypes.shape({
|
169
171
|
title: PropTypes.string.isRequired,
|
170
|
-
href: PropTypes.string
|
172
|
+
href: PropTypes.string,
|
171
173
|
target: PropTypes.oneOf(Object.values(Target)),
|
172
|
-
download: PropTypes.bool
|
174
|
+
download: PropTypes.bool,
|
175
|
+
onClick: PropTypes.func
|
173
176
|
}),
|
174
177
|
link: PropTypes.shape({
|
175
178
|
title: PropTypes.string.isRequired,
|
@@ -7,9 +7,10 @@ export declare const Target: {
|
|
7
7
|
declare type TargetType = typeof Target[keyof typeof Target];
|
8
8
|
interface IButton {
|
9
9
|
title: string;
|
10
|
-
href
|
10
|
+
href?: string;
|
11
11
|
target?: TargetType;
|
12
12
|
download?: boolean;
|
13
|
+
onClick?: () => void;
|
13
14
|
}
|
14
15
|
interface ILink {
|
15
16
|
title: string;
|
@@ -121,7 +121,8 @@ var Card = function Card(_ref) {
|
|
121
121
|
var btnHref = button.href,
|
122
122
|
btnTitle = button.title,
|
123
123
|
btnTarget = button.target,
|
124
|
-
|
124
|
+
btnDownload = button.download,
|
125
|
+
btnOnClick = button.onClick;
|
125
126
|
return /*#__PURE__*/_react["default"].createElement(_uiCore.Button, {
|
126
127
|
dataAttrs: {
|
127
128
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
|
@@ -129,7 +130,8 @@ var Card = function Card(_ref) {
|
|
129
130
|
className: cn('button', [classes.button]),
|
130
131
|
href: btnHref,
|
131
132
|
target: btnTarget,
|
132
|
-
download:
|
133
|
+
download: btnDownload,
|
134
|
+
onClick: btnOnClick
|
133
135
|
}, btnTitle);
|
134
136
|
}, [button, isCardLink, classes, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button]);
|
135
137
|
|
@@ -189,9 +191,10 @@ Card.propTypes = {
|
|
189
191
|
text: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]),
|
190
192
|
button: _propTypes["default"].shape({
|
191
193
|
title: _propTypes["default"].string.isRequired,
|
192
|
-
href: _propTypes["default"].string
|
194
|
+
href: _propTypes["default"].string,
|
193
195
|
target: _propTypes["default"].oneOf(Object.values(Target)),
|
194
|
-
download: _propTypes["default"].bool
|
196
|
+
download: _propTypes["default"].bool,
|
197
|
+
onClick: _propTypes["default"].func
|
195
198
|
}),
|
196
199
|
link: _propTypes["default"].shape({
|
197
200
|
title: _propTypes["default"].string.isRequired,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@megafon/ui-shared",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.2.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": "
|
93
|
+
"gitHead": "5bbe52acfc131f03673fbb8c18761cfcb5df357e"
|
94
94
|
}
|