@megafon/ui-core 3.0.0-beta.4 → 3.0.0-beta.5
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 +12 -0
- package/dist/es/components/Header/Header.d.ts +1 -18
- package/dist/es/components/Header/Header.js +28 -66
- package/dist/es/components/RadioButton/RadioButton.d.ts +1 -26
- package/dist/es/components/RadioButton/RadioButton.js +44 -83
- package/dist/lib/components/Header/Header.d.ts +1 -18
- package/dist/lib/components/Header/Header.js +28 -97
- package/dist/lib/components/RadioButton/RadioButton.d.ts +1 -26
- package/dist/lib/components/RadioButton/RadioButton.js +45 -115
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
# [3.0.0-beta.5](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.4...@megafon/ui-core@3.0.0-beta.5) (2022-01-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **header:** made header as a functional component ([81701ad](https://github.com/MegafonWebLab/megafon-ui/commit/81701ad87b6e9df2fe630bf4e183383264c0bb01))
|
|
12
|
+
* **radiobutton:** made radiobutton as a functional component ([65406af](https://github.com/MegafonWebLab/megafon-ui/commit/65406afc90fd82f7eb0fdcbbe78569fc98164e78))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [3.0.0-beta.4](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.3...@megafon/ui-core@3.0.0-beta.4) (2022-01-27)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @megafon/ui-core
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
|
-
import * as PropTypes from 'prop-types';
|
|
4
3
|
import './Header.less';
|
|
5
4
|
interface IHeaderProps extends IFilterDataAttrs {
|
|
6
5
|
/** Тег */
|
|
@@ -18,21 +17,5 @@ interface IHeaderProps extends IFilterDataAttrs {
|
|
|
18
17
|
/** Обработчик клика */
|
|
19
18
|
onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
|
|
20
19
|
}
|
|
21
|
-
declare
|
|
22
|
-
static propTypes: {
|
|
23
|
-
as: PropTypes.Requireable<string>;
|
|
24
|
-
color: PropTypes.Requireable<string>;
|
|
25
|
-
margin: PropTypes.Requireable<boolean>;
|
|
26
|
-
addition: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
27
|
-
hAlign: PropTypes.Requireable<string>;
|
|
28
|
-
dataAttrs: PropTypes.Requireable<{
|
|
29
|
-
[x: string]: string | null | undefined;
|
|
30
|
-
}>;
|
|
31
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
33
|
-
};
|
|
34
|
-
static defaultProps: Partial<IHeaderProps>;
|
|
35
|
-
renderAddition(): JSX.Element;
|
|
36
|
-
render(): JSX.Element;
|
|
37
|
-
}
|
|
20
|
+
declare const Header: React.FC<IHeaderProps>;
|
|
38
21
|
export default Header;
|
|
@@ -1,68 +1,36 @@
|
|
|
1
|
-
import "core-js/modules/es.date.to-string";
|
|
2
|
-
import "core-js/modules/es.object.to-string";
|
|
3
|
-
import "core-js/modules/es.reflect.construct";
|
|
4
|
-
import "core-js/modules/es.regexp.to-string";
|
|
5
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
6
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
7
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
8
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
10
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
11
|
-
|
|
12
|
-
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
|
|
14
|
-
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; } }
|
|
15
|
-
|
|
16
2
|
import * as React from 'react';
|
|
17
3
|
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
18
4
|
import * as PropTypes from 'prop-types';
|
|
19
5
|
import "./Header.css";
|
|
20
6
|
var cn = cnCreate('mfui-header');
|
|
21
7
|
|
|
22
|
-
var Header =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
onClick = _this$props.onClick,
|
|
49
|
-
dataAttrs = _this$props.dataAttrs,
|
|
50
|
-
className = _this$props.className;
|
|
51
|
-
var ElementType = level;
|
|
52
|
-
return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs), {
|
|
53
|
-
className: cn({
|
|
54
|
-
color: color,
|
|
55
|
-
margin: margin,
|
|
56
|
-
level: level,
|
|
57
|
-
'h-align': hAlign
|
|
58
|
-
}, className),
|
|
59
|
-
onClick: onClick
|
|
60
|
-
}), this.props.children, this.props.addition && this.renderAddition());
|
|
61
|
-
}
|
|
62
|
-
}]);
|
|
63
|
-
|
|
64
|
-
return Header;
|
|
65
|
-
}(React.Component);
|
|
8
|
+
var Header = function Header(_ref) {
|
|
9
|
+
var addition = _ref.addition,
|
|
10
|
+
_ref$as = _ref.as,
|
|
11
|
+
level = _ref$as === void 0 ? 'h1' : _ref$as,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
className = _ref.className,
|
|
14
|
+
_ref$color = _ref.color,
|
|
15
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
16
|
+
dataAttrs = _ref.dataAttrs,
|
|
17
|
+
_ref$hAlign = _ref.hAlign,
|
|
18
|
+
hAlign = _ref$hAlign === void 0 ? 'inherit' : _ref$hAlign,
|
|
19
|
+
margin = _ref.margin,
|
|
20
|
+
onClick = _ref.onClick;
|
|
21
|
+
var ElementType = level;
|
|
22
|
+
return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs), {
|
|
23
|
+
className: cn({
|
|
24
|
+
color: color,
|
|
25
|
+
margin: margin,
|
|
26
|
+
level: level,
|
|
27
|
+
'h-align': hAlign
|
|
28
|
+
}, className),
|
|
29
|
+
onClick: onClick
|
|
30
|
+
}), children, addition && /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: cn('addition')
|
|
32
|
+
}, addition));
|
|
33
|
+
};
|
|
66
34
|
|
|
67
35
|
Header.propTypes = {
|
|
68
36
|
as: PropTypes.oneOf(['h1', 'h2', 'h3', 'h5']),
|
|
@@ -70,13 +38,7 @@ Header.propTypes = {
|
|
|
70
38
|
margin: PropTypes.bool,
|
|
71
39
|
addition: PropTypes.element,
|
|
72
40
|
hAlign: PropTypes.oneOf(['inherit', 'left', 'center', 'right']),
|
|
73
|
-
dataAttrs: PropTypes.objectOf(PropTypes.string),
|
|
74
|
-
onClick: PropTypes.func
|
|
75
|
-
children: PropTypes.node
|
|
76
|
-
};
|
|
77
|
-
Header.defaultProps = {
|
|
78
|
-
as: 'h1',
|
|
79
|
-
color: 'default',
|
|
80
|
-
hAlign: 'inherit'
|
|
41
|
+
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
42
|
+
onClick: PropTypes.func
|
|
81
43
|
};
|
|
82
44
|
export default Header;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
|
-
import * as PropTypes from 'prop-types';
|
|
4
3
|
import './RadioButton.less';
|
|
5
4
|
export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
6
5
|
/** Значение */
|
|
@@ -28,29 +27,5 @@ export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
|
28
27
|
/** Ссылка на input */
|
|
29
28
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
30
29
|
}
|
|
31
|
-
declare
|
|
32
|
-
static propTypes: {
|
|
33
|
-
value: PropTypes.Validator<string>;
|
|
34
|
-
name: PropTypes.Requireable<string>;
|
|
35
|
-
textSize: PropTypes.Requireable<string>;
|
|
36
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
37
|
-
isChecked: PropTypes.Requireable<boolean>;
|
|
38
|
-
className: PropTypes.Requireable<string>;
|
|
39
|
-
classes: PropTypes.Requireable<PropTypes.InferProps<{
|
|
40
|
-
root: PropTypes.Requireable<string>;
|
|
41
|
-
label: PropTypes.Requireable<string>;
|
|
42
|
-
customInput: PropTypes.Requireable<string>;
|
|
43
|
-
labelText: PropTypes.Requireable<string>;
|
|
44
|
-
}>>;
|
|
45
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
46
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
-
inputRef: PropTypes.Requireable<any>;
|
|
48
|
-
dataAttrs: PropTypes.Requireable<{
|
|
49
|
-
[x: string]: string;
|
|
50
|
-
}>;
|
|
51
|
-
};
|
|
52
|
-
static defaultProps: Partial<IRadioButtonProps>;
|
|
53
|
-
handleChange: () => void;
|
|
54
|
-
render(): JSX.Element;
|
|
55
|
-
}
|
|
30
|
+
declare const RadioButton: React.FC<IRadioButtonProps>;
|
|
56
31
|
export default RadioButton;
|
|
@@ -1,95 +1,60 @@
|
|
|
1
1
|
import "core-js/modules/es.array.concat";
|
|
2
2
|
import "core-js/modules/es.array.is-array";
|
|
3
|
-
import "core-js/modules/es.date.to-string";
|
|
4
3
|
import "core-js/modules/es.function.name";
|
|
5
|
-
import "core-js/modules/es.object.to-string";
|
|
6
|
-
import "core-js/modules/es.reflect.construct";
|
|
7
|
-
import "core-js/modules/es.regexp.to-string";
|
|
8
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
5
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
10
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
11
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
12
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
13
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
14
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
15
|
-
|
|
16
|
-
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17
|
-
|
|
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
|
-
|
|
20
6
|
import * as React from 'react';
|
|
21
7
|
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
22
8
|
import * as PropTypes from 'prop-types';
|
|
23
9
|
import "./RadioButton.css";
|
|
24
10
|
var cn = cnCreate('mfui-radio-button');
|
|
25
11
|
|
|
26
|
-
var RadioButton =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
var RadioButton = function RadioButton(_ref) {
|
|
13
|
+
var isChecked = _ref.isChecked,
|
|
14
|
+
_ref$disabled = _ref.disabled,
|
|
15
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
16
|
+
name = _ref.name,
|
|
17
|
+
value = _ref.value,
|
|
18
|
+
_ref$textSize = _ref.textSize,
|
|
19
|
+
textSize = _ref$textSize === void 0 ? 'medium' : _ref$textSize,
|
|
20
|
+
children = _ref.children,
|
|
21
|
+
inputRef = _ref.inputRef,
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
_ref$classes = _ref.classes,
|
|
24
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
25
|
+
dataAttrs = _ref.dataAttrs,
|
|
26
|
+
onChange = _ref.onChange;
|
|
27
|
+
var checkedProp = isChecked !== undefined ? {
|
|
28
|
+
checked: isChecked
|
|
29
|
+
} : {};
|
|
30
|
+
var rootClassNames = Array.isArray(className) ? [].concat(_toConsumableArray(className), [classes.root]) : [className, classes.root];
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
var handleChange = function handleChange() {
|
|
33
|
+
return onChange && onChange(value);
|
|
34
|
+
};
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_this$props2$classes = _this$props2.classes,
|
|
61
|
-
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes,
|
|
62
|
-
dataAttrs = _this$props2.dataAttrs;
|
|
63
|
-
var checkedProp = isChecked !== undefined ? {
|
|
64
|
-
checked: isChecked
|
|
65
|
-
} : {};
|
|
66
|
-
var rootClassNames = Array.isArray(className) ? [].concat(_toConsumableArray(className), [classes.root]) : [className, classes.root];
|
|
67
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
68
|
-
className: cn(rootClassNames)
|
|
69
|
-
}, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
70
|
-
className: cn('label', {
|
|
71
|
-
disabled: disabled
|
|
72
|
-
}, classes.label)
|
|
73
|
-
}, /*#__PURE__*/React.createElement("input", _extends({}, checkedProp, {
|
|
74
|
-
className: cn('input'),
|
|
75
|
-
type: "radio",
|
|
76
|
-
name: name,
|
|
77
|
-
value: value,
|
|
78
|
-
onChange: this.handleChange,
|
|
79
|
-
disabled: disabled,
|
|
80
|
-
ref: inputRef
|
|
81
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
82
|
-
className: cn('custom-input', classes.customInput)
|
|
83
|
-
}), children && /*#__PURE__*/React.createElement("div", {
|
|
84
|
-
className: cn('text', {
|
|
85
|
-
size: textSize
|
|
86
|
-
}, classes.labelText)
|
|
87
|
-
}, children)));
|
|
88
|
-
}
|
|
89
|
-
}]);
|
|
90
|
-
|
|
91
|
-
return RadioButton;
|
|
92
|
-
}(React.Component);
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
37
|
+
className: cn(rootClassNames)
|
|
38
|
+
}, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
39
|
+
className: cn('label', {
|
|
40
|
+
disabled: disabled
|
|
41
|
+
}, classes.label)
|
|
42
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, checkedProp, {
|
|
43
|
+
className: cn('input'),
|
|
44
|
+
type: "radio",
|
|
45
|
+
name: name,
|
|
46
|
+
value: value,
|
|
47
|
+
onChange: handleChange,
|
|
48
|
+
disabled: disabled,
|
|
49
|
+
ref: inputRef
|
|
50
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: cn('custom-input', classes.customInput)
|
|
52
|
+
}), children && /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: cn('text', {
|
|
54
|
+
size: textSize
|
|
55
|
+
}, classes.labelText)
|
|
56
|
+
}, children)));
|
|
57
|
+
};
|
|
93
58
|
|
|
94
59
|
RadioButton.propTypes = {
|
|
95
60
|
value: PropTypes.string.isRequired,
|
|
@@ -111,8 +76,4 @@ RadioButton.propTypes = {
|
|
|
111
76
|
}), PropTypes.any])]),
|
|
112
77
|
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
113
78
|
};
|
|
114
|
-
RadioButton.defaultProps = {
|
|
115
|
-
textSize: 'medium',
|
|
116
|
-
disabled: false
|
|
117
|
-
};
|
|
118
79
|
export default RadioButton;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
|
-
import * as PropTypes from 'prop-types';
|
|
4
3
|
import './Header.less';
|
|
5
4
|
interface IHeaderProps extends IFilterDataAttrs {
|
|
6
5
|
/** Тег */
|
|
@@ -18,21 +17,5 @@ interface IHeaderProps extends IFilterDataAttrs {
|
|
|
18
17
|
/** Обработчик клика */
|
|
19
18
|
onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
|
|
20
19
|
}
|
|
21
|
-
declare
|
|
22
|
-
static propTypes: {
|
|
23
|
-
as: PropTypes.Requireable<string>;
|
|
24
|
-
color: PropTypes.Requireable<string>;
|
|
25
|
-
margin: PropTypes.Requireable<boolean>;
|
|
26
|
-
addition: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
27
|
-
hAlign: PropTypes.Requireable<string>;
|
|
28
|
-
dataAttrs: PropTypes.Requireable<{
|
|
29
|
-
[x: string]: string | null | undefined;
|
|
30
|
-
}>;
|
|
31
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
33
|
-
};
|
|
34
|
-
static defaultProps: Partial<IHeaderProps>;
|
|
35
|
-
renderAddition(): JSX.Element;
|
|
36
|
-
render(): JSX.Element;
|
|
37
|
-
}
|
|
20
|
+
declare const Header: React.FC<IHeaderProps>;
|
|
38
21
|
export default Header;
|
|
@@ -7,26 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
-
require("core-js/modules/es.date.to-string");
|
|
11
|
-
|
|
12
|
-
require("core-js/modules/es.object.to-string");
|
|
13
|
-
|
|
14
|
-
require("core-js/modules/es.reflect.construct");
|
|
15
|
-
|
|
16
|
-
require("core-js/modules/es.regexp.to-string");
|
|
17
|
-
|
|
18
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
19
11
|
|
|
20
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
21
|
-
|
|
22
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
|
-
|
|
24
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
-
|
|
26
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
30
12
|
var React = _interopRequireWildcard(require("react"));
|
|
31
13
|
|
|
32
14
|
var _uiHelpers = require("@megafon/ui-helpers");
|
|
@@ -39,79 +21,34 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
39
21
|
|
|
40
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
41
23
|
|
|
42
|
-
function _createSuper(Derived) {
|
|
43
|
-
return function () {
|
|
44
|
-
var Super = (0, _getPrototypeOf2["default"])(Derived),
|
|
45
|
-
result;
|
|
46
|
-
|
|
47
|
-
if (_isNativeReflectConstruct()) {
|
|
48
|
-
var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
|
|
49
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
50
|
-
} else {
|
|
51
|
-
result = Super.apply(this, arguments);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (0, _possibleConstructorReturn2["default"])(this, result);
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _isNativeReflectConstruct() {
|
|
59
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
60
|
-
if (Reflect.construct.sham) return false;
|
|
61
|
-
if (typeof Proxy === "function") return true;
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
65
|
-
return true;
|
|
66
|
-
} catch (e) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
24
|
var cn = (0, _uiHelpers.cnCreate)('mfui-header');
|
|
72
25
|
|
|
73
|
-
var Header =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
dataAttrs = _this$props.dataAttrs,
|
|
100
|
-
className = _this$props.className;
|
|
101
|
-
var ElementType = level;
|
|
102
|
-
return /*#__PURE__*/React.createElement(ElementType, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs), {
|
|
103
|
-
className: cn({
|
|
104
|
-
color: color,
|
|
105
|
-
margin: margin,
|
|
106
|
-
level: level,
|
|
107
|
-
'h-align': hAlign
|
|
108
|
-
}, className),
|
|
109
|
-
onClick: onClick
|
|
110
|
-
}), this.props.children, this.props.addition && this.renderAddition());
|
|
111
|
-
}
|
|
112
|
-
}]);
|
|
113
|
-
return Header;
|
|
114
|
-
}(React.Component);
|
|
26
|
+
var Header = function Header(_ref) {
|
|
27
|
+
var addition = _ref.addition,
|
|
28
|
+
_ref$as = _ref.as,
|
|
29
|
+
level = _ref$as === void 0 ? 'h1' : _ref$as,
|
|
30
|
+
children = _ref.children,
|
|
31
|
+
className = _ref.className,
|
|
32
|
+
_ref$color = _ref.color,
|
|
33
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
34
|
+
dataAttrs = _ref.dataAttrs,
|
|
35
|
+
_ref$hAlign = _ref.hAlign,
|
|
36
|
+
hAlign = _ref$hAlign === void 0 ? 'inherit' : _ref$hAlign,
|
|
37
|
+
margin = _ref.margin,
|
|
38
|
+
onClick = _ref.onClick;
|
|
39
|
+
var ElementType = level;
|
|
40
|
+
return /*#__PURE__*/React.createElement(ElementType, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs), {
|
|
41
|
+
className: cn({
|
|
42
|
+
color: color,
|
|
43
|
+
margin: margin,
|
|
44
|
+
level: level,
|
|
45
|
+
'h-align': hAlign
|
|
46
|
+
}, className),
|
|
47
|
+
onClick: onClick
|
|
48
|
+
}), children, addition && /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: cn('addition')
|
|
50
|
+
}, addition));
|
|
51
|
+
};
|
|
115
52
|
|
|
116
53
|
Header.propTypes = {
|
|
117
54
|
as: PropTypes.oneOf(['h1', 'h2', 'h3', 'h5']),
|
|
@@ -119,14 +56,8 @@ Header.propTypes = {
|
|
|
119
56
|
margin: PropTypes.bool,
|
|
120
57
|
addition: PropTypes.element,
|
|
121
58
|
hAlign: PropTypes.oneOf(['inherit', 'left', 'center', 'right']),
|
|
122
|
-
dataAttrs: PropTypes.objectOf(PropTypes.string),
|
|
123
|
-
onClick: PropTypes.func
|
|
124
|
-
children: PropTypes.node
|
|
125
|
-
};
|
|
126
|
-
Header.defaultProps = {
|
|
127
|
-
as: 'h1',
|
|
128
|
-
color: 'default',
|
|
129
|
-
hAlign: 'inherit'
|
|
59
|
+
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
60
|
+
onClick: PropTypes.func
|
|
130
61
|
};
|
|
131
62
|
var _default = Header;
|
|
132
63
|
exports["default"] = _default;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
|
-
import * as PropTypes from 'prop-types';
|
|
4
3
|
import './RadioButton.less';
|
|
5
4
|
export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
6
5
|
/** Значение */
|
|
@@ -28,29 +27,5 @@ export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
|
28
27
|
/** Ссылка на input */
|
|
29
28
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
30
29
|
}
|
|
31
|
-
declare
|
|
32
|
-
static propTypes: {
|
|
33
|
-
value: PropTypes.Validator<string>;
|
|
34
|
-
name: PropTypes.Requireable<string>;
|
|
35
|
-
textSize: PropTypes.Requireable<string>;
|
|
36
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
37
|
-
isChecked: PropTypes.Requireable<boolean>;
|
|
38
|
-
className: PropTypes.Requireable<string>;
|
|
39
|
-
classes: PropTypes.Requireable<PropTypes.InferProps<{
|
|
40
|
-
root: PropTypes.Requireable<string>;
|
|
41
|
-
label: PropTypes.Requireable<string>;
|
|
42
|
-
customInput: PropTypes.Requireable<string>;
|
|
43
|
-
labelText: PropTypes.Requireable<string>;
|
|
44
|
-
}>>;
|
|
45
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
46
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
47
|
-
inputRef: PropTypes.Requireable<any>;
|
|
48
|
-
dataAttrs: PropTypes.Requireable<{
|
|
49
|
-
[x: string]: string;
|
|
50
|
-
}>;
|
|
51
|
-
};
|
|
52
|
-
static defaultProps: Partial<IRadioButtonProps>;
|
|
53
|
-
handleChange: () => void;
|
|
54
|
-
render(): JSX.Element;
|
|
55
|
-
}
|
|
30
|
+
declare const RadioButton: React.FC<IRadioButtonProps>;
|
|
56
31
|
export default RadioButton;
|
|
@@ -11,30 +11,12 @@ require("core-js/modules/es.array.concat");
|
|
|
11
11
|
|
|
12
12
|
require("core-js/modules/es.array.is-array");
|
|
13
13
|
|
|
14
|
-
require("core-js/modules/es.date.to-string");
|
|
15
|
-
|
|
16
14
|
require("core-js/modules/es.function.name");
|
|
17
15
|
|
|
18
|
-
require("core-js/modules/es.object.to-string");
|
|
19
|
-
|
|
20
|
-
require("core-js/modules/es.reflect.construct");
|
|
21
|
-
|
|
22
|
-
require("core-js/modules/es.regexp.to-string");
|
|
23
|
-
|
|
24
16
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
25
17
|
|
|
26
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
27
19
|
|
|
28
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
29
|
-
|
|
30
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
31
|
-
|
|
32
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
33
|
-
|
|
34
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
35
|
-
|
|
36
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
37
|
-
|
|
38
20
|
var React = _interopRequireWildcard(require("react"));
|
|
39
21
|
|
|
40
22
|
var _uiHelpers = require("@megafon/ui-helpers");
|
|
@@ -47,102 +29,54 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
47
29
|
|
|
48
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
49
31
|
|
|
50
|
-
|
|
51
|
-
return function () {
|
|
52
|
-
var Super = (0, _getPrototypeOf2["default"])(Derived),
|
|
53
|
-
result;
|
|
54
|
-
|
|
55
|
-
if (_isNativeReflectConstruct()) {
|
|
56
|
-
var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
|
|
57
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
58
|
-
} else {
|
|
59
|
-
result = Super.apply(this, arguments);
|
|
60
|
-
}
|
|
32
|
+
var cn = (0, _uiHelpers.cnCreate)('mfui-radio-button');
|
|
61
33
|
|
|
62
|
-
|
|
34
|
+
var RadioButton = function RadioButton(_ref) {
|
|
35
|
+
var isChecked = _ref.isChecked,
|
|
36
|
+
_ref$disabled = _ref.disabled,
|
|
37
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
38
|
+
name = _ref.name,
|
|
39
|
+
value = _ref.value,
|
|
40
|
+
_ref$textSize = _ref.textSize,
|
|
41
|
+
textSize = _ref$textSize === void 0 ? 'medium' : _ref$textSize,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
inputRef = _ref.inputRef,
|
|
44
|
+
className = _ref.className,
|
|
45
|
+
_ref$classes = _ref.classes,
|
|
46
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
47
|
+
dataAttrs = _ref.dataAttrs,
|
|
48
|
+
onChange = _ref.onChange;
|
|
49
|
+
var checkedProp = isChecked !== undefined ? {
|
|
50
|
+
checked: isChecked
|
|
51
|
+
} : {};
|
|
52
|
+
var rootClassNames = Array.isArray(className) ? [].concat((0, _toConsumableArray2["default"])(className), [classes.root]) : [className, classes.root];
|
|
53
|
+
|
|
54
|
+
var handleChange = function handleChange() {
|
|
55
|
+
return onChange && onChange(value);
|
|
63
56
|
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _isNativeReflectConstruct() {
|
|
67
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
68
|
-
if (Reflect.construct.sham) return false;
|
|
69
|
-
if (typeof Proxy === "function") return true;
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
73
|
-
return true;
|
|
74
|
-
} catch (e) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
57
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(0, _createClass2["default"])(RadioButton, [{
|
|
103
|
-
key: "render",
|
|
104
|
-
value: function render() {
|
|
105
|
-
var _this$props2 = this.props,
|
|
106
|
-
isChecked = _this$props2.isChecked,
|
|
107
|
-
disabled = _this$props2.disabled,
|
|
108
|
-
name = _this$props2.name,
|
|
109
|
-
value = _this$props2.value,
|
|
110
|
-
textSize = _this$props2.textSize,
|
|
111
|
-
children = _this$props2.children,
|
|
112
|
-
inputRef = _this$props2.inputRef,
|
|
113
|
-
className = _this$props2.className,
|
|
114
|
-
_this$props2$classes = _this$props2.classes,
|
|
115
|
-
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes,
|
|
116
|
-
dataAttrs = _this$props2.dataAttrs;
|
|
117
|
-
var checkedProp = isChecked !== undefined ? {
|
|
118
|
-
checked: isChecked
|
|
119
|
-
} : {};
|
|
120
|
-
var rootClassNames = Array.isArray(className) ? [].concat((0, _toConsumableArray2["default"])(className), [classes.root]) : [className, classes.root];
|
|
121
|
-
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
|
|
122
|
-
className: cn(rootClassNames)
|
|
123
|
-
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
124
|
-
className: cn('label', {
|
|
125
|
-
disabled: disabled
|
|
126
|
-
}, classes.label)
|
|
127
|
-
}, /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({}, checkedProp, {
|
|
128
|
-
className: cn('input'),
|
|
129
|
-
type: "radio",
|
|
130
|
-
name: name,
|
|
131
|
-
value: value,
|
|
132
|
-
onChange: this.handleChange,
|
|
133
|
-
disabled: disabled,
|
|
134
|
-
ref: inputRef
|
|
135
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
136
|
-
className: cn('custom-input', classes.customInput)
|
|
137
|
-
}), children && /*#__PURE__*/React.createElement("div", {
|
|
138
|
-
className: cn('text', {
|
|
139
|
-
size: textSize
|
|
140
|
-
}, classes.labelText)
|
|
141
|
-
}, children)));
|
|
142
|
-
}
|
|
143
|
-
}]);
|
|
144
|
-
return RadioButton;
|
|
145
|
-
}(React.Component);
|
|
58
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
|
|
59
|
+
className: cn(rootClassNames)
|
|
60
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
61
|
+
className: cn('label', {
|
|
62
|
+
disabled: disabled
|
|
63
|
+
}, classes.label)
|
|
64
|
+
}, /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({}, checkedProp, {
|
|
65
|
+
className: cn('input'),
|
|
66
|
+
type: "radio",
|
|
67
|
+
name: name,
|
|
68
|
+
value: value,
|
|
69
|
+
onChange: handleChange,
|
|
70
|
+
disabled: disabled,
|
|
71
|
+
ref: inputRef
|
|
72
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: cn('custom-input', classes.customInput)
|
|
74
|
+
}), children && /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: cn('text', {
|
|
76
|
+
size: textSize
|
|
77
|
+
}, classes.labelText)
|
|
78
|
+
}, children)));
|
|
79
|
+
};
|
|
146
80
|
|
|
147
81
|
RadioButton.propTypes = {
|
|
148
82
|
value: PropTypes.string.isRequired,
|
|
@@ -164,9 +98,5 @@ RadioButton.propTypes = {
|
|
|
164
98
|
}), PropTypes.any])]),
|
|
165
99
|
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
166
100
|
};
|
|
167
|
-
RadioButton.defaultProps = {
|
|
168
|
-
textSize: 'medium',
|
|
169
|
-
disabled: false
|
|
170
|
-
};
|
|
171
101
|
var _default = RadioButton;
|
|
172
102
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.5",
|
|
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": "a5eb127179b8ccf27d6cd95fd2bb7dd909b119be"
|
|
100
100
|
}
|