@micromag/element-button 0.3.423 → 0.3.430
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/lib/index.js +17 -26
- package/package.json +9 -3
package/lib/index.js
CHANGED
|
@@ -10,15 +10,6 @@ var core = require('@micromag/core');
|
|
|
10
10
|
var components = require('@micromag/core/components');
|
|
11
11
|
var utils = require('@micromag/core/utils');
|
|
12
12
|
|
|
13
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
|
-
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
17
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
18
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
19
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
20
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
|
-
|
|
22
13
|
var styles = {"container":"micromag-element-button-container","disabled":"micromag-element-button-disabled","border":"micromag-element-button-border"};
|
|
23
14
|
|
|
24
15
|
var _excluded = ["textStyle", "buttonStyle", "type", "disabled", "focusable", "inline", "onClick", "children", "className", "withoutExternalBorder", "refButton"],
|
|
@@ -26,16 +17,16 @@ var _excluded = ["textStyle", "buttonStyle", "type", "disabled", "focusable", "i
|
|
|
26
17
|
var propTypes = {
|
|
27
18
|
textStyle: core.PropTypes.textStyle,
|
|
28
19
|
buttonStyle: core.PropTypes.boxStyle,
|
|
29
|
-
type:
|
|
30
|
-
disabled:
|
|
31
|
-
focusable:
|
|
32
|
-
inline:
|
|
33
|
-
onClick:
|
|
34
|
-
children:
|
|
35
|
-
className:
|
|
36
|
-
withoutExternalBorder:
|
|
37
|
-
refButton:
|
|
38
|
-
current:
|
|
20
|
+
type: PropTypes.oneOf(['button', 'submit']),
|
|
21
|
+
disabled: PropTypes.bool,
|
|
22
|
+
focusable: PropTypes.bool,
|
|
23
|
+
inline: PropTypes.bool,
|
|
24
|
+
onClick: PropTypes.func,
|
|
25
|
+
children: PropTypes.node,
|
|
26
|
+
className: PropTypes.string,
|
|
27
|
+
withoutExternalBorder: PropTypes.bool,
|
|
28
|
+
refButton: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
29
|
+
current: PropTypes.any // eslint-disable-line
|
|
39
30
|
})])
|
|
40
31
|
};
|
|
41
32
|
|
|
@@ -64,17 +55,17 @@ var Button = function Button(_ref) {
|
|
|
64
55
|
className = _ref.className,
|
|
65
56
|
withoutExternalBorder = _ref.withoutExternalBorder,
|
|
66
57
|
refButton = _ref.refButton,
|
|
67
|
-
buttonProps =
|
|
58
|
+
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
68
59
|
var finalStyles = null;
|
|
69
60
|
// eslint-disable-next-line no-unused-vars
|
|
70
61
|
var _ref2 = buttonProps || {};
|
|
71
62
|
_ref2.body;
|
|
72
|
-
var otherProps =
|
|
63
|
+
var otherProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
73
64
|
if (textStyle !== null) {
|
|
74
|
-
finalStyles =
|
|
65
|
+
finalStyles = _objectSpread(_objectSpread({}, finalStyles), utils.getStyleFromText(textStyle));
|
|
75
66
|
}
|
|
76
67
|
if (buttonStyle !== null) {
|
|
77
|
-
finalStyles =
|
|
68
|
+
finalStyles = _objectSpread(_objectSpread(_objectSpread({}, finalStyles), utils.getStyleFromBox(buttonStyle)), {}, {
|
|
78
69
|
display: withoutExternalBorder && inline ? 'inline-block' : null
|
|
79
70
|
});
|
|
80
71
|
}
|
|
@@ -83,14 +74,14 @@ var Button = function Button(_ref) {
|
|
|
83
74
|
_ref3$borderWidth = _ref3.borderWidth,
|
|
84
75
|
borderWidth = _ref3$borderWidth === void 0 ? null : _ref3$borderWidth;
|
|
85
76
|
var margin = borderWidth !== null && borderWidth > 0 ? '-1px' : null;
|
|
86
|
-
finalStyles =
|
|
77
|
+
finalStyles = _objectSpread(_objectSpread({}, finalStyles), {}, {
|
|
87
78
|
display: inline ? 'inline-block' : null
|
|
88
79
|
}, margin !== null ? {
|
|
89
80
|
margin: margin
|
|
90
81
|
} : null);
|
|
91
82
|
}
|
|
92
|
-
return /*#__PURE__*/
|
|
93
|
-
className:
|
|
83
|
+
return /*#__PURE__*/React.createElement(components.Button, Object.assign({
|
|
84
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
94
85
|
disabled: disabled,
|
|
95
86
|
style: finalStyles,
|
|
96
87
|
onClick: onClick,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-button",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.430",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"main": "lib/index.js",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": "./lib/index.js",
|
|
38
|
+
"import": "./es/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"files": [
|
|
36
42
|
"lib",
|
|
37
43
|
"es",
|
|
@@ -50,7 +56,7 @@
|
|
|
50
56
|
},
|
|
51
57
|
"dependencies": {
|
|
52
58
|
"@babel/runtime": "^7.13.10",
|
|
53
|
-
"@micromag/core": "^0.3.
|
|
59
|
+
"@micromag/core": "^0.3.430",
|
|
54
60
|
"classnames": "^2.2.6",
|
|
55
61
|
"prop-types": "^15.7.2",
|
|
56
62
|
"react-intl": "^5.12.1",
|
|
@@ -60,5 +66,5 @@
|
|
|
60
66
|
"access": "public",
|
|
61
67
|
"registry": "https://registry.npmjs.org/"
|
|
62
68
|
},
|
|
63
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "da790d76dba9d8e308d9f9c4e51d93a4a0e012a9"
|
|
64
70
|
}
|