@sb1/ffe-message-box-react 7.0.7 → 7.1.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/es/BaseMessage.js +13 -7
- package/lib/BaseMessage.js +12 -6
- package/package.json +2 -2
- package/types/index.d.ts +1 -0
package/es/BaseMessage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["type", "title", "icon", "content", "children", "className"];
|
|
1
|
+
var _excluded = ["type", "title", "icon", "content", "children", "className", "onColoredBg"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
13
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
14
|
|
|
15
15
|
import React from 'react';
|
|
16
|
-
import { node, oneOf, string } from 'prop-types';
|
|
16
|
+
import { bool, node, oneOf, string } from 'prop-types';
|
|
17
17
|
import classNames from 'classnames';
|
|
18
18
|
var iconStyles = {
|
|
19
19
|
width: '40px',
|
|
@@ -28,18 +28,21 @@ var BaseMessage = function BaseMessage(props) {
|
|
|
28
28
|
children = props.children,
|
|
29
29
|
_props$className = props.className,
|
|
30
30
|
className = _props$className === void 0 ? '' : _props$className,
|
|
31
|
+
onColoredBg = props.onColoredBg,
|
|
31
32
|
rest = _objectWithoutProperties(props, _excluded);
|
|
32
33
|
|
|
33
34
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
34
|
-
className: classNames('ffe-message-box',
|
|
35
|
+
className: classNames('ffe-message-box', "ffe-message-box--".concat(type), {
|
|
36
|
+
'ffe-message-box--coloredbg': onColoredBg
|
|
37
|
+
}, className)
|
|
35
38
|
}, rest), /*#__PURE__*/React.createElement("span", {
|
|
36
|
-
className:
|
|
39
|
+
className: "ffe-message-box__icon"
|
|
37
40
|
}, /*#__PURE__*/React.cloneElement(icon, _objectSpread({
|
|
38
41
|
style: iconStyles
|
|
39
42
|
}, icon.props))), /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className:
|
|
43
|
+
className: "ffe-message-box__box"
|
|
41
44
|
}, title && /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className:
|
|
45
|
+
className: "ffe-h4 ffe-message-box__title"
|
|
43
46
|
}, title), content && /*#__PURE__*/React.createElement("p", null, content), !content && children));
|
|
44
47
|
};
|
|
45
48
|
|
|
@@ -54,6 +57,9 @@ BaseMessage.propTypes = {
|
|
|
54
57
|
* Internal type enum for specifying the style of message box. Should not be used directly
|
|
55
58
|
* @ignore
|
|
56
59
|
*/
|
|
57
|
-
type: oneOf(['success', 'error', 'tips', 'info']).isRequired
|
|
60
|
+
type: oneOf(['success', 'error', 'tips', 'info']).isRequired,
|
|
61
|
+
|
|
62
|
+
/* Adds alternative styling for better contrast on certain backgrounds */
|
|
63
|
+
onColoredBg: bool
|
|
58
64
|
};
|
|
59
65
|
export default BaseMessage;
|
package/lib/BaseMessage.js
CHANGED
|
@@ -11,7 +11,7 @@ var _propTypes = require("prop-types");
|
|
|
11
11
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
-
var _excluded = ["type", "title", "icon", "content", "children", "className"];
|
|
14
|
+
var _excluded = ["type", "title", "icon", "content", "children", "className", "onColoredBg"];
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -40,18 +40,21 @@ var BaseMessage = function BaseMessage(props) {
|
|
|
40
40
|
children = props.children,
|
|
41
41
|
_props$className = props.className,
|
|
42
42
|
className = _props$className === void 0 ? '' : _props$className,
|
|
43
|
+
onColoredBg = props.onColoredBg,
|
|
43
44
|
rest = _objectWithoutProperties(props, _excluded);
|
|
44
45
|
|
|
45
46
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
46
|
-
className: (0, _classnames.default)('ffe-message-box',
|
|
47
|
+
className: (0, _classnames.default)('ffe-message-box', "ffe-message-box--".concat(type), {
|
|
48
|
+
'ffe-message-box--coloredbg': onColoredBg
|
|
49
|
+
}, className)
|
|
47
50
|
}, rest), /*#__PURE__*/_react.default.createElement("span", {
|
|
48
|
-
className:
|
|
51
|
+
className: "ffe-message-box__icon"
|
|
49
52
|
}, /*#__PURE__*/_react.default.cloneElement(icon, _objectSpread({
|
|
50
53
|
style: iconStyles
|
|
51
54
|
}, icon.props))), /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
-
className:
|
|
55
|
+
className: "ffe-message-box__box"
|
|
53
56
|
}, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
-
className:
|
|
57
|
+
className: "ffe-h4 ffe-message-box__title"
|
|
55
58
|
}, title), content && /*#__PURE__*/_react.default.createElement("p", null, content), !content && children));
|
|
56
59
|
};
|
|
57
60
|
|
|
@@ -66,7 +69,10 @@ BaseMessage.propTypes = {
|
|
|
66
69
|
* Internal type enum for specifying the style of message box. Should not be used directly
|
|
67
70
|
* @ignore
|
|
68
71
|
*/
|
|
69
|
-
type: (0, _propTypes.oneOf)(['success', 'error', 'tips', 'info']).isRequired
|
|
72
|
+
type: (0, _propTypes.oneOf)(['success', 'error', 'tips', 'info']).isRequired,
|
|
73
|
+
|
|
74
|
+
/* Adds alternative styling for better contrast on certain backgrounds */
|
|
75
|
+
onColoredBg: _propTypes.bool
|
|
70
76
|
};
|
|
71
77
|
var _default = BaseMessage;
|
|
72
78
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-message-box-react",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank 1",
|
|
6
6
|
"files": [
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a65e9a094adc4226cf148163f9729d2398fdd3ed"
|
|
52
52
|
}
|