@micromag/element-button 0.3.531 → 0.3.547
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/package.json +4 -5
- package/lib/index.js +0 -97
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-button",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.547",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
}
|
|
31
31
|
],
|
|
32
32
|
"license": "ISC",
|
|
33
|
-
"
|
|
33
|
+
"type": "module",
|
|
34
34
|
"module": "es/index.js",
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
37
|
-
"require": "./lib/index.js",
|
|
38
37
|
"import": "./es/index.js"
|
|
39
38
|
},
|
|
40
39
|
"./assets/css/styles": "./assets/css/styles.css",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
},
|
|
61
60
|
"dependencies": {
|
|
62
61
|
"@babel/runtime": "^7.13.10",
|
|
63
|
-
"@micromag/core": "^0.3.
|
|
62
|
+
"@micromag/core": "^0.3.547",
|
|
64
63
|
"classnames": "^2.2.6",
|
|
65
64
|
"prop-types": "^15.7.2",
|
|
66
65
|
"react-intl": "^6.6.4",
|
|
@@ -70,5 +69,5 @@
|
|
|
70
69
|
"access": "public",
|
|
71
70
|
"registry": "https://registry.npmjs.org/"
|
|
72
71
|
},
|
|
73
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "3c2f5904ce61fcfa61f673c38c2a5ec56e9e2b07"
|
|
74
73
|
}
|
package/lib/index.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
-
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
5
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
-
var classNames = require('classnames');
|
|
7
|
-
var PropTypes = require('prop-types');
|
|
8
|
-
var React = require('react');
|
|
9
|
-
var core = require('@micromag/core');
|
|
10
|
-
var components = require('@micromag/core/components');
|
|
11
|
-
var utils = require('@micromag/core/utils');
|
|
12
|
-
|
|
13
|
-
var styles = {"container":"micromag-element-button-container","disabled":"micromag-element-button-disabled","border":"micromag-element-button-border"};
|
|
14
|
-
|
|
15
|
-
var _excluded = ["textStyle", "buttonStyle", "type", "disabled", "focusable", "inline", "onClick", "children", "className", "withoutExternalBorder", "refButton"],
|
|
16
|
-
_excluded2 = ["body"];
|
|
17
|
-
var propTypes = {
|
|
18
|
-
textStyle: core.PropTypes.textStyle,
|
|
19
|
-
buttonStyle: core.PropTypes.boxStyle,
|
|
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
|
|
30
|
-
})])
|
|
31
|
-
};
|
|
32
|
-
var defaultProps = {
|
|
33
|
-
textStyle: null,
|
|
34
|
-
buttonStyle: null,
|
|
35
|
-
type: 'button',
|
|
36
|
-
disabled: false,
|
|
37
|
-
focusable: true,
|
|
38
|
-
inline: false,
|
|
39
|
-
onClick: null,
|
|
40
|
-
children: null,
|
|
41
|
-
className: null,
|
|
42
|
-
withoutExternalBorder: true,
|
|
43
|
-
refButton: null
|
|
44
|
-
};
|
|
45
|
-
var Button = function Button(_ref) {
|
|
46
|
-
var textStyle = _ref.textStyle,
|
|
47
|
-
buttonStyle = _ref.buttonStyle,
|
|
48
|
-
type = _ref.type,
|
|
49
|
-
disabled = _ref.disabled,
|
|
50
|
-
focusable = _ref.focusable,
|
|
51
|
-
inline = _ref.inline,
|
|
52
|
-
onClick = _ref.onClick,
|
|
53
|
-
children = _ref.children,
|
|
54
|
-
className = _ref.className,
|
|
55
|
-
withoutExternalBorder = _ref.withoutExternalBorder,
|
|
56
|
-
refButton = _ref.refButton,
|
|
57
|
-
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
58
|
-
var finalStyles = null;
|
|
59
|
-
// eslint-disable-next-line no-unused-vars
|
|
60
|
-
var _ref2 = buttonProps || {};
|
|
61
|
-
_ref2.body;
|
|
62
|
-
var otherProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
63
|
-
if (textStyle !== null) {
|
|
64
|
-
finalStyles = _objectSpread(_objectSpread({}, finalStyles), utils.getStyleFromText(textStyle));
|
|
65
|
-
}
|
|
66
|
-
if (buttonStyle !== null) {
|
|
67
|
-
finalStyles = _objectSpread(_objectSpread(_objectSpread({}, finalStyles), utils.getStyleFromBox(buttonStyle)), {}, {
|
|
68
|
-
display: withoutExternalBorder && inline ? 'inline-block' : null
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
if (!withoutExternalBorder) {
|
|
72
|
-
var _ref3 = finalStyles || {},
|
|
73
|
-
_ref3$borderWidth = _ref3.borderWidth,
|
|
74
|
-
borderWidth = _ref3$borderWidth === void 0 ? null : _ref3$borderWidth;
|
|
75
|
-
var margin = borderWidth !== null && borderWidth > 0 ? '-1px' : null;
|
|
76
|
-
finalStyles = _objectSpread(_objectSpread({}, finalStyles), {}, {
|
|
77
|
-
display: inline ? 'inline-block' : null
|
|
78
|
-
}, margin !== null ? {
|
|
79
|
-
margin: margin
|
|
80
|
-
} : null);
|
|
81
|
-
}
|
|
82
|
-
return /*#__PURE__*/React.createElement(components.Button, Object.assign({
|
|
83
|
-
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
84
|
-
disabled: disabled,
|
|
85
|
-
style: finalStyles,
|
|
86
|
-
onClick: onClick,
|
|
87
|
-
refButton: refButton,
|
|
88
|
-
type: type,
|
|
89
|
-
focusable: focusable,
|
|
90
|
-
withoutBootstrapStyles: true
|
|
91
|
-
}, otherProps), children);
|
|
92
|
-
};
|
|
93
|
-
Button.propTypes = propTypes;
|
|
94
|
-
Button.defaultProps = defaultProps;
|
|
95
|
-
var Button$1 = Button;
|
|
96
|
-
|
|
97
|
-
module.exports = Button$1;
|