@sb1/ffe-message-box-react 7.0.4 → 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 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', className)
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: classNames('ffe-message-box__icon', "ffe-message-box__icon--".concat(type))
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: classNames('ffe-message-box__box', "ffe-message-box__box--".concat(type))
43
+ className: "ffe-message-box__box"
41
44
  }, title && /*#__PURE__*/React.createElement("div", {
42
- className: classNames('ffe-h4', "ffe-message-box__title")
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;
@@ -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', className)
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: (0, _classnames.default)('ffe-message-box__icon', "ffe-message-box__icon--".concat(type))
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: (0, _classnames.default)('ffe-message-box__box', "ffe-message-box__box--".concat(type))
55
+ className: "ffe-message-box__box"
53
56
  }, title && /*#__PURE__*/_react.default.createElement("div", {
54
- className: (0, _classnames.default)('ffe-h4', "ffe-message-box__title")
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.4",
3
+ "version": "7.1.0",
4
4
  "license": "MIT",
5
5
  "author": "SpareBank 1",
6
6
  "files": [
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "scripts": {
20
20
  "build": "ffe-buildtool babel",
21
+ "watch": "ffe-buildtool babel-watch",
21
22
  "lint": "eslint src",
22
23
  "test": "jest",
23
24
  "test:watch": "jest --watch"
@@ -26,11 +27,11 @@
26
27
  "setupTestFrameworkScriptFile": "../../test-setup.js"
27
28
  },
28
29
  "dependencies": {
29
- "@sb1/ffe-icons-react": "^7.2.21",
30
+ "@sb1/ffe-icons-react": "^7.2.22",
30
31
  "classnames": "^2.3.1"
31
32
  },
32
33
  "devDependencies": {
33
- "@sb1/ffe-buildtool": "^0.2.0",
34
+ "@sb1/ffe-buildtool": "^0.3.2",
34
35
  "enzyme": "^3.7.0",
35
36
  "enzyme-adapter-react-16": "^1.7.0",
36
37
  "eslint": "^5.9.0",
@@ -47,5 +48,5 @@
47
48
  "publishConfig": {
48
49
  "access": "public"
49
50
  },
50
- "gitHead": "5da885a3bba8e6990f1f06796983ca0f1add9d9a"
51
+ "gitHead": "a65e9a094adc4226cf148163f9729d2398fdd3ed"
51
52
  }
package/types/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export interface MessageBoxProps
11
11
  content?: React.ReactNode;
12
12
  icon?: React.ReactNode;
13
13
  title?: React.ReactNode;
14
+ onColoredBg?: boolean;
14
15
  }
15
16
 
16
17
  export interface ErrorMessageBoxProps extends MessageBoxProps {