@megafon/ui-core 2.1.4 → 2.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 +11 -0
- package/dist/es/components/RadioButton/RadioButton.d.ts +5 -1
- package/dist/es/components/RadioButton/RadioButton.js +7 -5
- package/dist/lib/components/RadioButton/RadioButton.d.ts +5 -1
- package/dist/lib/components/RadioButton/RadioButton.js +6 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [2.2.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@2.1.4...@megafon/ui-core@2.2.0) (2021-12-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **radiobutton:** add dataAttrs prop ([3f8d0b4](https://github.com/MegafonWebLab/megafon-ui/commit/3f8d0b4c4ec4a6ca301ab44feed2842ec8e54f3a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.1.4](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@2.1.3...@megafon/ui-core@2.1.4) (2021-12-20)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
2
3
|
import * as PropTypes from 'prop-types';
|
|
3
4
|
import './RadioButton.less';
|
|
4
|
-
export interface IRadioButtonProps {
|
|
5
|
+
export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
5
6
|
/** Значение */
|
|
6
7
|
value: string;
|
|
7
8
|
/** Имя для тега form */
|
|
@@ -44,6 +45,9 @@ declare class RadioButton extends React.Component<IRadioButtonProps> {
|
|
|
44
45
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
45
46
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
47
|
inputRef: PropTypes.Requireable<any>;
|
|
48
|
+
dataAttrs: PropTypes.Requireable<{
|
|
49
|
+
[x: string]: string;
|
|
50
|
+
}>;
|
|
47
51
|
};
|
|
48
52
|
static defaultProps: Partial<IRadioButtonProps>;
|
|
49
53
|
handleChange: () => void;
|
|
@@ -18,7 +18,7 @@ function _createSuper(Derived) { return function () { var Super = _getPrototypeO
|
|
|
18
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
19
|
|
|
20
20
|
import * as React from 'react';
|
|
21
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
21
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
22
22
|
import * as PropTypes from 'prop-types';
|
|
23
23
|
import "./RadioButton.css";
|
|
24
24
|
var cn = cnCreate('mfui-radio-button');
|
|
@@ -58,14 +58,15 @@ var RadioButton = /*#__PURE__*/function (_React$Component) {
|
|
|
58
58
|
inputRef = _this$props2.inputRef,
|
|
59
59
|
className = _this$props2.className,
|
|
60
60
|
_this$props2$classes = _this$props2.classes,
|
|
61
|
-
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes
|
|
61
|
+
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes,
|
|
62
|
+
dataAttrs = _this$props2.dataAttrs;
|
|
62
63
|
var checkedProp = isChecked !== undefined ? {
|
|
63
64
|
checked: isChecked
|
|
64
65
|
} : {};
|
|
65
66
|
var rootClassNames = Array.isArray(className) ? [].concat(_toConsumableArray(className), [classes.root]) : [className, classes.root];
|
|
66
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
67
68
|
className: cn(rootClassNames)
|
|
68
|
-
}, /*#__PURE__*/React.createElement("label", {
|
|
69
|
+
}, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
69
70
|
className: cn('label', {
|
|
70
71
|
disabled: disabled
|
|
71
72
|
}, classes.label)
|
|
@@ -107,7 +108,8 @@ RadioButton.propTypes = {
|
|
|
107
108
|
onChange: PropTypes.func,
|
|
108
109
|
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
|
109
110
|
current: PropTypes.elementType
|
|
110
|
-
}), PropTypes.any])])
|
|
111
|
+
}), PropTypes.any])]),
|
|
112
|
+
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
111
113
|
};
|
|
112
114
|
RadioButton.defaultProps = {
|
|
113
115
|
textSize: 'medium',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
2
3
|
import * as PropTypes from 'prop-types';
|
|
3
4
|
import './RadioButton.less';
|
|
4
|
-
export interface IRadioButtonProps {
|
|
5
|
+
export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
5
6
|
/** Значение */
|
|
6
7
|
value: string;
|
|
7
8
|
/** Имя для тега form */
|
|
@@ -44,6 +45,9 @@ declare class RadioButton extends React.Component<IRadioButtonProps> {
|
|
|
44
45
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
45
46
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
47
|
inputRef: PropTypes.Requireable<any>;
|
|
48
|
+
dataAttrs: PropTypes.Requireable<{
|
|
49
|
+
[x: string]: string;
|
|
50
|
+
}>;
|
|
47
51
|
};
|
|
48
52
|
static defaultProps: Partial<IRadioButtonProps>;
|
|
49
53
|
handleChange: () => void;
|
|
@@ -112,14 +112,15 @@ var RadioButton = /*#__PURE__*/function (_React$Component) {
|
|
|
112
112
|
inputRef = _this$props2.inputRef,
|
|
113
113
|
className = _this$props2.className,
|
|
114
114
|
_this$props2$classes = _this$props2.classes,
|
|
115
|
-
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes
|
|
115
|
+
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes,
|
|
116
|
+
dataAttrs = _this$props2.dataAttrs;
|
|
116
117
|
var checkedProp = isChecked !== undefined ? {
|
|
117
118
|
checked: isChecked
|
|
118
119
|
} : {};
|
|
119
120
|
var rootClassNames = Array.isArray(className) ? [].concat((0, _toConsumableArray2["default"])(className), [classes.root]) : [className, classes.root];
|
|
120
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
|
|
121
122
|
className: cn(rootClassNames)
|
|
122
|
-
}, /*#__PURE__*/React.createElement("label", {
|
|
123
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
123
124
|
className: cn('label', {
|
|
124
125
|
disabled: disabled
|
|
125
126
|
}, classes.label)
|
|
@@ -160,7 +161,8 @@ RadioButton.propTypes = {
|
|
|
160
161
|
onChange: PropTypes.func,
|
|
161
162
|
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
|
162
163
|
current: PropTypes.elementType
|
|
163
|
-
}), PropTypes.any])])
|
|
164
|
+
}), PropTypes.any])]),
|
|
165
|
+
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
164
166
|
};
|
|
165
167
|
RadioButton.defaultProps = {
|
|
166
168
|
textSize: 'medium',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"react-popper": "^2.2.3",
|
|
97
97
|
"swiper": "^6.5.6"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "26b2f120bd0f51992981718c28cb8cd8138e1870"
|
|
100
100
|
}
|