@sb1/ffe-message-box-react 10.0.13 → 10.0.15
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 +10 -4
- package/es/ErrorMessage.js +10 -6
- package/es/InfoMessage.js +16 -6
- package/es/SuccessMessage.js +16 -6
- package/es/TipsMessage.js +15 -5
- package/es/texts.js +47 -0
- package/lib/BaseMessage.js +10 -4
- package/lib/ErrorMessage.js +9 -5
- package/lib/InfoMessage.js +15 -5
- package/lib/SuccessMessage.js +15 -5
- package/lib/TipsMessage.js +14 -4
- package/lib/texts.js +53 -0
- package/package.json +2 -2
- package/types/index.d.ts +1 -0
package/es/BaseMessage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["type", "title", "titleElement", "icon", "children", "className", "onColoredBg"];
|
|
2
|
+
var _excluded = ["type", "title", "titleElement", "icon", "children", "className", "onColoredBg", "ariaLabel", "role"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -20,12 +20,15 @@ var BaseMessage = function BaseMessage(props) {
|
|
|
20
20
|
_props$className = props.className,
|
|
21
21
|
className = _props$className === void 0 ? '' : _props$className,
|
|
22
22
|
onColoredBg = props.onColoredBg,
|
|
23
|
+
ariaLabel = props.ariaLabel,
|
|
24
|
+
role = props.role,
|
|
23
25
|
rest = _objectWithoutProperties(props, _excluded);
|
|
24
26
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
25
27
|
className: classNames('ffe-message-box', "ffe-message-box--".concat(type), {
|
|
26
28
|
'ffe-message-box--coloredbg': onColoredBg
|
|
27
29
|
}, className),
|
|
28
|
-
|
|
30
|
+
"aria-label": ariaLabel,
|
|
31
|
+
role: role
|
|
29
32
|
}, rest), /*#__PURE__*/React.createElement("span", {
|
|
30
33
|
className: "ffe-message-box__icon"
|
|
31
34
|
}, /*#__PURE__*/React.cloneElement(icon, _objectSpread(_objectSpread({}, icon.props), {}, {
|
|
@@ -50,10 +53,13 @@ BaseMessage.propTypes = {
|
|
|
50
53
|
*/
|
|
51
54
|
type: oneOf(['success', 'error', 'tips', 'info']).isRequired,
|
|
52
55
|
/* Adds alternative styling for better contrast on certain backgrounds */
|
|
53
|
-
onColoredBg: bool
|
|
56
|
+
onColoredBg: bool,
|
|
57
|
+
ariaLabel: string,
|
|
58
|
+
role: oneOf(['alert', 'group'])
|
|
54
59
|
};
|
|
55
60
|
BaseMessage.defaultProps = {
|
|
56
61
|
titleElement: 'h2',
|
|
57
|
-
onColoredBg: false
|
|
62
|
+
onColoredBg: false,
|
|
63
|
+
role: 'group'
|
|
58
64
|
};
|
|
59
65
|
export default BaseMessage;
|
package/es/ErrorMessage.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
var _excluded = ["alert"];
|
|
1
|
+
var _excluded = ["alert", "locale"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
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; }
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { node, string, bool } from 'prop-types';
|
|
6
|
+
import { node, string, bool, oneOf } from 'prop-types';
|
|
7
7
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
8
8
|
import BaseMessage from './BaseMessage';
|
|
9
|
+
import texts from './texts';
|
|
9
10
|
var ErrorMessage = function ErrorMessage(props) {
|
|
10
11
|
var alert = props.alert,
|
|
12
|
+
locale = props.locale,
|
|
11
13
|
rest = _objectWithoutProperties(props, _excluded);
|
|
12
14
|
var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTE2My4wOHEtMjEuNzg0IDAtMzcuMTc4LTE1LjUxMy0xNS4zOTQtMTUuNTEzLTE1LjM5NC0zNy4yOTd0MTUuNTEzLTM3LjE3OHExNS41MTMtMTUuMzk0IDM3LjI5Ny0xNS4zOTR0MzcuMTc4IDE1LjUxM3ExNS4zOTQgMTUuNTEzIDE1LjM5NCAzNy4yOTd0LTE1LjUxMyAzNy4xNzhxLTE1LjUxMyAxNS4zOTQtMzcuMjk3IDE1LjM5NFptLS4wNjEtMTk2LjE1MXEtMTkuNTg5IDAtMzMuMzU3LTEzLjg5Ni0xMy43NjktMTMuODk2LTEzLjc2OS0zMy40MXYtMzYzLjA3OHEwLTE5LjUxNCAxMy45NDktMzMuNDEgMTMuOTQ5LTEzLjg5NiAzMy41MzctMTMuODk2IDE5LjU4OSAwIDMzLjM1NyAxMy44OTYgMTMuNzY5IDEzLjg5NiAxMy43NjkgMzMuNDF2MzYzLjA3OHEwIDE5LjUxNC0xMy45NDkgMzMuNDEtMTMuOTQ5IDEzLjg5Ni0zMy41MzcgMTMuODk2WiIvPjwvc3ZnPg==';
|
|
13
15
|
return /*#__PURE__*/React.createElement(BaseMessage, _extends({
|
|
14
16
|
type: "error",
|
|
15
|
-
|
|
17
|
+
ariaLabel: texts[locale].error.ariaLabel,
|
|
16
18
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
17
19
|
fileUrl: priorityHighIcon,
|
|
18
|
-
ariaLabel: "Utropstegn",
|
|
19
20
|
size: "xl"
|
|
20
21
|
}),
|
|
21
22
|
role: alert ? 'alert' : 'group'
|
|
22
23
|
}, rest));
|
|
23
24
|
};
|
|
24
25
|
ErrorMessage.defaultProps = {
|
|
25
|
-
alert: true
|
|
26
|
+
alert: true,
|
|
27
|
+
locale: 'nb'
|
|
26
28
|
};
|
|
27
29
|
ErrorMessage.propTypes = {
|
|
28
30
|
/** The content of the message box */
|
|
@@ -34,6 +36,8 @@ ErrorMessage.propTypes = {
|
|
|
34
36
|
/** An optional title for the message */
|
|
35
37
|
title: node,
|
|
36
38
|
/** When false, role is not set to alert, avoids message from being read up immediately after page load. Default value is true. */
|
|
37
|
-
alert: bool
|
|
39
|
+
alert: bool,
|
|
40
|
+
/** 'nb', 'nn', or 'en' */
|
|
41
|
+
locale: oneOf(['en', 'nb', 'nn'])
|
|
38
42
|
};
|
|
39
43
|
export default ErrorMessage;
|
package/es/InfoMessage.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
+
var _excluded = ["locale"];
|
|
1
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
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; }
|
|
2
5
|
import React from 'react';
|
|
3
|
-
import { node, string } from 'prop-types';
|
|
6
|
+
import { node, oneOf, string } from 'prop-types';
|
|
4
7
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
5
8
|
import BaseMessage from './BaseMessage';
|
|
6
|
-
|
|
9
|
+
import texts from './texts';
|
|
10
|
+
var InfoMessage = function InfoMessage(_ref) {
|
|
11
|
+
var locale = _ref.locale,
|
|
12
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
7
13
|
var infoIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTY5NC42MTVxLTI2LjE4OCAwLTQ0LjM4MS0xOC4zMTEtMTguMTkyLTE4LjMxMi0xOC4xOTItNDQuNXQxOC4zMTItNDQuMzhxMTguMzExLTE4LjE5MyA0NC40OTktMTguMTkzIDI2LjE4OCAwIDQ0LjM4MSAxOC4zMTIgMTguMTkyIDE4LjMxMSAxOC4xOTIgNDQuNDk5IDAgMjYuMTg5LTE4LjMxMiA0NC4zODEtMTguMzExIDE4LjE5Mi00NC40OTkgMTguMTkyWm0uMDI0IDU1NC42MTRxLTE3LjgyOCAwLTMwLjIxMi0xMi40NTItMTIuMzg1LTEyLjQ1Mi0xMi4zODUtMzAuMjR2LTM1OS4yMjlxMC0xNy43ODkgMTIuNDgtMzAuMjQgMTIuNDc5LTEyLjQ1MiAzMC4zMDctMTIuNDUydDMwLjIxMiAxMi40NTJxMTIuMzg1IDEyLjQ1MSAxMi4zODUgMzAuMjR2MzU5LjIyOXEwIDE3Ljc4OC0xMi40OCAzMC4yNC0xMi40NzkgMTIuNDUyLTMwLjMwNyAxMi40NTJaIi8+PC9zdmc+';
|
|
8
14
|
return /*#__PURE__*/React.createElement(BaseMessage, _extends({
|
|
9
15
|
type: "info",
|
|
10
|
-
|
|
16
|
+
ariaLabel: texts[locale].info.ariaLabel,
|
|
11
17
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
12
|
-
ariaLabel: "Infotegn",
|
|
13
18
|
fileUrl: infoIcon,
|
|
14
19
|
size: "xl"
|
|
15
20
|
})
|
|
16
|
-
},
|
|
21
|
+
}, rest));
|
|
22
|
+
};
|
|
23
|
+
InfoMessage.defaultProps = {
|
|
24
|
+
locale: 'nb'
|
|
17
25
|
};
|
|
18
26
|
InfoMessage.propTypes = {
|
|
19
27
|
/** The content of the message box */
|
|
@@ -23,6 +31,8 @@ InfoMessage.propTypes = {
|
|
|
23
31
|
/** The icon to show. Has a default value, but can be overridden */
|
|
24
32
|
icon: node,
|
|
25
33
|
/** An optional title for the message */
|
|
26
|
-
title: node
|
|
34
|
+
title: node,
|
|
35
|
+
/** 'nb', 'nn', or 'en' */
|
|
36
|
+
locale: oneOf(['en', 'nb', 'nn'])
|
|
27
37
|
};
|
|
28
38
|
export default InfoMessage;
|
package/es/SuccessMessage.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
+
var _excluded = ["locale"];
|
|
1
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
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; }
|
|
2
5
|
import React from 'react';
|
|
3
|
-
import { node, string } from 'prop-types';
|
|
6
|
+
import { node, oneOf, string } from 'prop-types';
|
|
4
7
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
5
8
|
import BaseMessage from './BaseMessage';
|
|
6
|
-
|
|
9
|
+
import texts from './texts';
|
|
10
|
+
var SuccessMessage = function SuccessMessage(_ref) {
|
|
11
|
+
var locale = _ref.locale,
|
|
12
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
7
13
|
var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Im0zNzkuMTU0LTMyMy4xNTMgMzYzLTM2My4zODVxNi43NTktNi4zMDcgMTYuMTQ4LTYuNSA5LjM5LS4xOTIgMTYuNDY3IDYuNTUzIDYuNjkyIDcuMTI5IDYuNjkyIDE2LjQ5OSAwIDkuMzcxLTYuNjkyIDE2LjA2M0wzOTkuMzg1LTI3OC41MzlxLTguNjE2IDguNjE1LTIwLjIzMSA4LjYxNS0xMS42MTUgMC0yMC4yMzEtOC42MTVMMTg0LjYxNi00NTIuODQ2cS02LjY5Mi02Ljc1OS02LjU3Ny0xNi4xNDkuMTE2LTkuMzg5IDcuMjQ1LTE2LjQ2NiA3LjEyOS02LjY5MiAxNi4zMDctNi42OTIgOS4xNzggMCAxNi4yNTUgNi42OTJsMTYxLjMwOCAxNjIuMzA4WiIvPjwvc3ZnPg==';
|
|
8
14
|
return /*#__PURE__*/React.createElement(BaseMessage, _extends({
|
|
9
15
|
type: "success",
|
|
10
|
-
|
|
16
|
+
ariaLabel: texts[locale].success.ariaLabel,
|
|
11
17
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
12
18
|
fileUrl: checkIcon,
|
|
13
|
-
ariaLabel: "Hake",
|
|
14
19
|
size: "xl"
|
|
15
20
|
})
|
|
16
|
-
},
|
|
21
|
+
}, rest));
|
|
22
|
+
};
|
|
23
|
+
SuccessMessage.defaultProps = {
|
|
24
|
+
locale: 'nb'
|
|
17
25
|
};
|
|
18
26
|
SuccessMessage.propTypes = {
|
|
19
27
|
/** The content of the message box */
|
|
@@ -23,6 +31,8 @@ SuccessMessage.propTypes = {
|
|
|
23
31
|
/** The icon to show. Has a default value, but can be overridden */
|
|
24
32
|
icon: node,
|
|
25
33
|
/** An optional title for the message */
|
|
26
|
-
title: node
|
|
34
|
+
title: node,
|
|
35
|
+
/** 'nb', 'nn', or 'en' */
|
|
36
|
+
locale: oneOf(['en', 'nb', 'nn'])
|
|
27
37
|
};
|
|
28
38
|
export default SuccessMessage;
|
package/es/TipsMessage.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
+
var _excluded = ["locale"];
|
|
1
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
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; }
|
|
2
5
|
import React from 'react';
|
|
3
|
-
import { node, string } from 'prop-types';
|
|
6
|
+
import { node, oneOf, string } from 'prop-types';
|
|
4
7
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
5
8
|
import BaseMessage from './BaseMessage';
|
|
9
|
+
import texts from './texts';
|
|
6
10
|
var TipsMessage = function TipsMessage(props) {
|
|
11
|
+
var locale = props.locale,
|
|
12
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
7
13
|
var lightbulbIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00ODAtOTYuOTI0cS0zMC45MjMgMC01My4wNzctMjEtMjIuMTUzLTIxLTIzLjY5Mi01MS45MjNoMTUzLjUzOHEtMS41MzkgMzAuOTIzLTIzLjY5MiA1MS45MjMtMjIuMTU0IDIxLTUzLjA3NyAyMVpNMzUxLjA3Ny0yNDEuNDYzcS05LjY2MyAwLTE2LjE3Ny02LjU2Ny02LjUxNS02LjU2Ni02LjUxNS0xNi4zMDd0Ni41MTUtMTYuMTI1cTYuNTE0LTYuMzg0IDE2LjE3Ny02LjM4NGgyNTcuODQ2cTkuNjYzIDAgMTYuMTc3IDYuNTY2IDYuNTE1IDYuNTY3IDYuNTE1IDE2LjMwOCAwIDkuNzQtNi41MTUgMTYuMTI1LTYuNTE0IDYuMzg0LTE2LjE3NyA2LjM4NEgzNTEuMDc3Wm0tMTkuOTk5LTExNnEtNjAuNjE1LTQwLjY5Mi05NS44NDYtMTAwLjM4NHQtMzUuMjMxLTEzNC41MzdxMC0xMTQuNjkyIDgyLjY1NC0xOTcuMzQ1UTM2NS4zMDgtODcyLjM4MyA0ODAtODcyLjM4M3QxOTcuMzQ1IDgyLjY1NHE4Mi42NTQgODIuNjUzIDgyLjY1NCAxOTcuMzQ1IDAgNzQuODQ1LTM0LjkyMyAxMzQuNTM3LTM0LjkyMyA1OS42OTItOTYuMTU0IDEwMC4zODRIMzMxLjA3OFptMTYuMjMtNDUuMzgzaDI2NS43NzFxNDcuNDU5LTMyIDc0LjQ5OC04Mi4wMjkgMjcuMDM4LTUwLjAyOSAyNy4wMzgtMTA3LjUwOSAwLTk3LjA3Ny02OC43NjktMTY1Ljg0NlQ0ODAtODI2Ljk5OXEtOTcuMDc3IDAtMTY1Ljg0NiA2OC43NjlUMjQ1LjM4NS01OTIuNHEwIDU3LjYwNSAyNy4wMzggMTA3LjU3OSAyNy4wMzkgNDkuOTc1IDc0Ljg4NSA4MS45NzVabTEzMi42OTIgMFoiLz48L3N2Zz4=';
|
|
8
14
|
return /*#__PURE__*/React.createElement(BaseMessage, _extends({
|
|
9
15
|
type: "tips",
|
|
10
|
-
|
|
16
|
+
ariaLabel: texts[locale].tip.ariaLabel,
|
|
11
17
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
12
18
|
fileUrl: lightbulbIcon,
|
|
13
|
-
ariaLabel: "Lysp\xE6re",
|
|
14
19
|
size: "xl"
|
|
15
20
|
})
|
|
16
|
-
},
|
|
21
|
+
}, rest));
|
|
22
|
+
};
|
|
23
|
+
TipsMessage.defaultProps = {
|
|
24
|
+
locale: 'nb'
|
|
17
25
|
};
|
|
18
26
|
TipsMessage.propTypes = {
|
|
19
27
|
/** The content of the message box */
|
|
@@ -23,6 +31,8 @@ TipsMessage.propTypes = {
|
|
|
23
31
|
/** The icon to show. Has a default value, but can be overridden */
|
|
24
32
|
icon: node,
|
|
25
33
|
/** An optional title for the message */
|
|
26
|
-
title: node
|
|
34
|
+
title: node,
|
|
35
|
+
/** 'nb', 'nn', or 'en' */
|
|
36
|
+
locale: oneOf(['en', 'nb', 'nn'])
|
|
27
37
|
};
|
|
28
38
|
export default TipsMessage;
|
package/es/texts.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var nb = {
|
|
2
|
+
error: {
|
|
3
|
+
ariaLabel: 'Feilmelding'
|
|
4
|
+
},
|
|
5
|
+
info: {
|
|
6
|
+
ariaLabel: 'Infomelding'
|
|
7
|
+
},
|
|
8
|
+
success: {
|
|
9
|
+
ariaLabel: 'Suksessmelding'
|
|
10
|
+
},
|
|
11
|
+
tip: {
|
|
12
|
+
ariaLabel: 'Tipsmelding'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var nn = {
|
|
16
|
+
error: {
|
|
17
|
+
ariaLabel: 'Feilmelding'
|
|
18
|
+
},
|
|
19
|
+
info: {
|
|
20
|
+
ariaLabel: 'Infomelding'
|
|
21
|
+
},
|
|
22
|
+
success: {
|
|
23
|
+
ariaLabel: 'Suksessmelding'
|
|
24
|
+
},
|
|
25
|
+
tip: {
|
|
26
|
+
ariaLabel: 'Tipsmelding'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var en = {
|
|
30
|
+
error: {
|
|
31
|
+
ariaLabel: 'Error message'
|
|
32
|
+
},
|
|
33
|
+
info: {
|
|
34
|
+
ariaLabel: 'Info message'
|
|
35
|
+
},
|
|
36
|
+
success: {
|
|
37
|
+
ariaLabel: 'Success message'
|
|
38
|
+
},
|
|
39
|
+
tip: {
|
|
40
|
+
ariaLabel: 'Tip message'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export default {
|
|
44
|
+
nb: nb,
|
|
45
|
+
nn: nn,
|
|
46
|
+
en: en
|
|
47
|
+
};
|
package/lib/BaseMessage.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _propTypes = require("prop-types");
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _excluded = ["type", "title", "titleElement", "icon", "children", "className", "onColoredBg"];
|
|
11
|
+
var _excluded = ["type", "title", "titleElement", "icon", "children", "className", "onColoredBg", "ariaLabel", "role"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -27,12 +27,15 @@ var BaseMessage = function BaseMessage(props) {
|
|
|
27
27
|
_props$className = props.className,
|
|
28
28
|
className = _props$className === void 0 ? '' : _props$className,
|
|
29
29
|
onColoredBg = props.onColoredBg,
|
|
30
|
+
ariaLabel = props.ariaLabel,
|
|
31
|
+
role = props.role,
|
|
30
32
|
rest = _objectWithoutProperties(props, _excluded);
|
|
31
33
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
32
34
|
className: (0, _classnames.default)('ffe-message-box', "ffe-message-box--".concat(type), {
|
|
33
35
|
'ffe-message-box--coloredbg': onColoredBg
|
|
34
36
|
}, className),
|
|
35
|
-
|
|
37
|
+
"aria-label": ariaLabel,
|
|
38
|
+
role: role
|
|
36
39
|
}, rest), /*#__PURE__*/_react.default.createElement("span", {
|
|
37
40
|
className: "ffe-message-box__icon"
|
|
38
41
|
}, /*#__PURE__*/_react.default.cloneElement(icon, _objectSpread(_objectSpread({}, icon.props), {}, {
|
|
@@ -57,10 +60,13 @@ BaseMessage.propTypes = {
|
|
|
57
60
|
*/
|
|
58
61
|
type: (0, _propTypes.oneOf)(['success', 'error', 'tips', 'info']).isRequired,
|
|
59
62
|
/* Adds alternative styling for better contrast on certain backgrounds */
|
|
60
|
-
onColoredBg: _propTypes.bool
|
|
63
|
+
onColoredBg: _propTypes.bool,
|
|
64
|
+
ariaLabel: _propTypes.string,
|
|
65
|
+
role: (0, _propTypes.oneOf)(['alert', 'group'])
|
|
61
66
|
};
|
|
62
67
|
BaseMessage.defaultProps = {
|
|
63
68
|
titleElement: 'h2',
|
|
64
|
-
onColoredBg: false
|
|
69
|
+
onColoredBg: false,
|
|
70
|
+
role: 'group'
|
|
65
71
|
};
|
|
66
72
|
var _default = exports.default = BaseMessage;
|
package/lib/ErrorMessage.js
CHANGED
|
@@ -8,28 +8,30 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _ffeIconsReact = require("@sb1/ffe-icons-react");
|
|
10
10
|
var _BaseMessage = _interopRequireDefault(require("./BaseMessage"));
|
|
11
|
-
var
|
|
11
|
+
var _texts = _interopRequireDefault(require("./texts"));
|
|
12
|
+
var _excluded = ["alert", "locale"];
|
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
14
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
16
|
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; }
|
|
16
17
|
var ErrorMessage = function ErrorMessage(props) {
|
|
17
18
|
var alert = props.alert,
|
|
19
|
+
locale = props.locale,
|
|
18
20
|
rest = _objectWithoutProperties(props, _excluded);
|
|
19
21
|
var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTE2My4wOHEtMjEuNzg0IDAtMzcuMTc4LTE1LjUxMy0xNS4zOTQtMTUuNTEzLTE1LjM5NC0zNy4yOTd0MTUuNTEzLTM3LjE3OHExNS41MTMtMTUuMzk0IDM3LjI5Ny0xNS4zOTR0MzcuMTc4IDE1LjUxM3ExNS4zOTQgMTUuNTEzIDE1LjM5NCAzNy4yOTd0LTE1LjUxMyAzNy4xNzhxLTE1LjUxMyAxNS4zOTQtMzcuMjk3IDE1LjM5NFptLS4wNjEtMTk2LjE1MXEtMTkuNTg5IDAtMzMuMzU3LTEzLjg5Ni0xMy43NjktMTMuODk2LTEzLjc2OS0zMy40MXYtMzYzLjA3OHEwLTE5LjUxNCAxMy45NDktMzMuNDEgMTMuOTQ5LTEzLjg5NiAzMy41MzctMTMuODk2IDE5LjU4OSAwIDMzLjM1NyAxMy44OTYgMTMuNzY5IDEzLjg5NiAxMy43NjkgMzMuNDF2MzYzLjA3OHEwIDE5LjUxNC0xMy45NDkgMzMuNDEtMTMuOTQ5IDEzLjg5Ni0zMy41MzcgMTMuODk2WiIvPjwvc3ZnPg==';
|
|
20
22
|
return /*#__PURE__*/_react.default.createElement(_BaseMessage.default, _extends({
|
|
21
23
|
type: "error",
|
|
22
|
-
|
|
24
|
+
ariaLabel: _texts.default[locale].error.ariaLabel,
|
|
23
25
|
icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
|
|
24
26
|
fileUrl: priorityHighIcon,
|
|
25
|
-
ariaLabel: "Utropstegn",
|
|
26
27
|
size: "xl"
|
|
27
28
|
}),
|
|
28
29
|
role: alert ? 'alert' : 'group'
|
|
29
30
|
}, rest));
|
|
30
31
|
};
|
|
31
32
|
ErrorMessage.defaultProps = {
|
|
32
|
-
alert: true
|
|
33
|
+
alert: true,
|
|
34
|
+
locale: 'nb'
|
|
33
35
|
};
|
|
34
36
|
ErrorMessage.propTypes = {
|
|
35
37
|
/** The content of the message box */
|
|
@@ -41,6 +43,8 @@ ErrorMessage.propTypes = {
|
|
|
41
43
|
/** An optional title for the message */
|
|
42
44
|
title: _propTypes.node,
|
|
43
45
|
/** When false, role is not set to alert, avoids message from being read up immediately after page load. Default value is true. */
|
|
44
|
-
alert: _propTypes.bool
|
|
46
|
+
alert: _propTypes.bool,
|
|
47
|
+
/** 'nb', 'nn', or 'en' */
|
|
48
|
+
locale: (0, _propTypes.oneOf)(['en', 'nb', 'nn'])
|
|
45
49
|
};
|
|
46
50
|
var _default = exports.default = ErrorMessage;
|
package/lib/InfoMessage.js
CHANGED
|
@@ -8,19 +8,27 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _ffeIconsReact = require("@sb1/ffe-icons-react");
|
|
10
10
|
var _BaseMessage = _interopRequireDefault(require("./BaseMessage"));
|
|
11
|
+
var _texts = _interopRequireDefault(require("./texts"));
|
|
12
|
+
var _excluded = ["locale"];
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
13
|
-
var
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
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; }
|
|
17
|
+
var InfoMessage = function InfoMessage(_ref) {
|
|
18
|
+
var locale = _ref.locale,
|
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
20
|
var infoIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTY5NC42MTVxLTI2LjE4OCAwLTQ0LjM4MS0xOC4zMTEtMTguMTkyLTE4LjMxMi0xOC4xOTItNDQuNXQxOC4zMTItNDQuMzhxMTguMzExLTE4LjE5MyA0NC40OTktMTguMTkzIDI2LjE4OCAwIDQ0LjM4MSAxOC4zMTIgMTguMTkyIDE4LjMxMSAxOC4xOTIgNDQuNDk5IDAgMjYuMTg5LTE4LjMxMiA0NC4zODEtMTguMzExIDE4LjE5Mi00NC40OTkgMTguMTkyWm0uMDI0IDU1NC42MTRxLTE3LjgyOCAwLTMwLjIxMi0xMi40NTItMTIuMzg1LTEyLjQ1Mi0xMi4zODUtMzAuMjR2LTM1OS4yMjlxMC0xNy43ODkgMTIuNDgtMzAuMjQgMTIuNDc5LTEyLjQ1MiAzMC4zMDctMTIuNDUydDMwLjIxMiAxMi40NTJxMTIuMzg1IDEyLjQ1MSAxMi4zODUgMzAuMjR2MzU5LjIyOXEwIDE3Ljc4OC0xMi40OCAzMC4yNC0xMi40NzkgMTIuNDUyLTMwLjMwNyAxMi40NTJaIi8+PC9zdmc+';
|
|
15
21
|
return /*#__PURE__*/_react.default.createElement(_BaseMessage.default, _extends({
|
|
16
22
|
type: "info",
|
|
17
|
-
|
|
23
|
+
ariaLabel: _texts.default[locale].info.ariaLabel,
|
|
18
24
|
icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
|
|
19
|
-
ariaLabel: "Infotegn",
|
|
20
25
|
fileUrl: infoIcon,
|
|
21
26
|
size: "xl"
|
|
22
27
|
})
|
|
23
|
-
},
|
|
28
|
+
}, rest));
|
|
29
|
+
};
|
|
30
|
+
InfoMessage.defaultProps = {
|
|
31
|
+
locale: 'nb'
|
|
24
32
|
};
|
|
25
33
|
InfoMessage.propTypes = {
|
|
26
34
|
/** The content of the message box */
|
|
@@ -30,6 +38,8 @@ InfoMessage.propTypes = {
|
|
|
30
38
|
/** The icon to show. Has a default value, but can be overridden */
|
|
31
39
|
icon: _propTypes.node,
|
|
32
40
|
/** An optional title for the message */
|
|
33
|
-
title: _propTypes.node
|
|
41
|
+
title: _propTypes.node,
|
|
42
|
+
/** 'nb', 'nn', or 'en' */
|
|
43
|
+
locale: (0, _propTypes.oneOf)(['en', 'nb', 'nn'])
|
|
34
44
|
};
|
|
35
45
|
var _default = exports.default = InfoMessage;
|
package/lib/SuccessMessage.js
CHANGED
|
@@ -8,19 +8,27 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _ffeIconsReact = require("@sb1/ffe-icons-react");
|
|
10
10
|
var _BaseMessage = _interopRequireDefault(require("./BaseMessage"));
|
|
11
|
+
var _texts = _interopRequireDefault(require("./texts"));
|
|
12
|
+
var _excluded = ["locale"];
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
13
|
-
var
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
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; }
|
|
17
|
+
var SuccessMessage = function SuccessMessage(_ref) {
|
|
18
|
+
var locale = _ref.locale,
|
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
20
|
var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Im0zNzkuMTU0LTMyMy4xNTMgMzYzLTM2My4zODVxNi43NTktNi4zMDcgMTYuMTQ4LTYuNSA5LjM5LS4xOTIgMTYuNDY3IDYuNTUzIDYuNjkyIDcuMTI5IDYuNjkyIDE2LjQ5OSAwIDkuMzcxLTYuNjkyIDE2LjA2M0wzOTkuMzg1LTI3OC41MzlxLTguNjE2IDguNjE1LTIwLjIzMSA4LjYxNS0xMS42MTUgMC0yMC4yMzEtOC42MTVMMTg0LjYxNi00NTIuODQ2cS02LjY5Mi02Ljc1OS02LjU3Ny0xNi4xNDkuMTE2LTkuMzg5IDcuMjQ1LTE2LjQ2NiA3LjEyOS02LjY5MiAxNi4zMDctNi42OTIgOS4xNzggMCAxNi4yNTUgNi42OTJsMTYxLjMwOCAxNjIuMzA4WiIvPjwvc3ZnPg==';
|
|
15
21
|
return /*#__PURE__*/_react.default.createElement(_BaseMessage.default, _extends({
|
|
16
22
|
type: "success",
|
|
17
|
-
|
|
23
|
+
ariaLabel: _texts.default[locale].success.ariaLabel,
|
|
18
24
|
icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
|
|
19
25
|
fileUrl: checkIcon,
|
|
20
|
-
ariaLabel: "Hake",
|
|
21
26
|
size: "xl"
|
|
22
27
|
})
|
|
23
|
-
},
|
|
28
|
+
}, rest));
|
|
29
|
+
};
|
|
30
|
+
SuccessMessage.defaultProps = {
|
|
31
|
+
locale: 'nb'
|
|
24
32
|
};
|
|
25
33
|
SuccessMessage.propTypes = {
|
|
26
34
|
/** The content of the message box */
|
|
@@ -30,6 +38,8 @@ SuccessMessage.propTypes = {
|
|
|
30
38
|
/** The icon to show. Has a default value, but can be overridden */
|
|
31
39
|
icon: _propTypes.node,
|
|
32
40
|
/** An optional title for the message */
|
|
33
|
-
title: _propTypes.node
|
|
41
|
+
title: _propTypes.node,
|
|
42
|
+
/** 'nb', 'nn', or 'en' */
|
|
43
|
+
locale: (0, _propTypes.oneOf)(['en', 'nb', 'nn'])
|
|
34
44
|
};
|
|
35
45
|
var _default = exports.default = SuccessMessage;
|
package/lib/TipsMessage.js
CHANGED
|
@@ -8,19 +8,27 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _ffeIconsReact = require("@sb1/ffe-icons-react");
|
|
10
10
|
var _BaseMessage = _interopRequireDefault(require("./BaseMessage"));
|
|
11
|
+
var _texts = _interopRequireDefault(require("./texts"));
|
|
12
|
+
var _excluded = ["locale"];
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
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; }
|
|
13
17
|
var TipsMessage = function TipsMessage(props) {
|
|
18
|
+
var locale = props.locale,
|
|
19
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
14
20
|
var lightbulbIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00ODAtOTYuOTI0cS0zMC45MjMgMC01My4wNzctMjEtMjIuMTUzLTIxLTIzLjY5Mi01MS45MjNoMTUzLjUzOHEtMS41MzkgMzAuOTIzLTIzLjY5MiA1MS45MjMtMjIuMTU0IDIxLTUzLjA3NyAyMVpNMzUxLjA3Ny0yNDEuNDYzcS05LjY2MyAwLTE2LjE3Ny02LjU2Ny02LjUxNS02LjU2Ni02LjUxNS0xNi4zMDd0Ni41MTUtMTYuMTI1cTYuNTE0LTYuMzg0IDE2LjE3Ny02LjM4NGgyNTcuODQ2cTkuNjYzIDAgMTYuMTc3IDYuNTY2IDYuNTE1IDYuNTY3IDYuNTE1IDE2LjMwOCAwIDkuNzQtNi41MTUgMTYuMTI1LTYuNTE0IDYuMzg0LTE2LjE3NyA2LjM4NEgzNTEuMDc3Wm0tMTkuOTk5LTExNnEtNjAuNjE1LTQwLjY5Mi05NS44NDYtMTAwLjM4NHQtMzUuMjMxLTEzNC41MzdxMC0xMTQuNjkyIDgyLjY1NC0xOTcuMzQ1UTM2NS4zMDgtODcyLjM4MyA0ODAtODcyLjM4M3QxOTcuMzQ1IDgyLjY1NHE4Mi42NTQgODIuNjUzIDgyLjY1NCAxOTcuMzQ1IDAgNzQuODQ1LTM0LjkyMyAxMzQuNTM3LTM0LjkyMyA1OS42OTItOTYuMTU0IDEwMC4zODRIMzMxLjA3OFptMTYuMjMtNDUuMzgzaDI2NS43NzFxNDcuNDU5LTMyIDc0LjQ5OC04Mi4wMjkgMjcuMDM4LTUwLjAyOSAyNy4wMzgtMTA3LjUwOSAwLTk3LjA3Ny02OC43NjktMTY1Ljg0NlQ0ODAtODI2Ljk5OXEtOTcuMDc3IDAtMTY1Ljg0NiA2OC43NjlUMjQ1LjM4NS01OTIuNHEwIDU3LjYwNSAyNy4wMzggMTA3LjU3OSAyNy4wMzkgNDkuOTc1IDc0Ljg4NSA4MS45NzVabTEzMi42OTIgMFoiLz48L3N2Zz4=';
|
|
15
21
|
return /*#__PURE__*/_react.default.createElement(_BaseMessage.default, _extends({
|
|
16
22
|
type: "tips",
|
|
17
|
-
|
|
23
|
+
ariaLabel: _texts.default[locale].tip.ariaLabel,
|
|
18
24
|
icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
|
|
19
25
|
fileUrl: lightbulbIcon,
|
|
20
|
-
ariaLabel: "Lysp\xE6re",
|
|
21
26
|
size: "xl"
|
|
22
27
|
})
|
|
23
|
-
},
|
|
28
|
+
}, rest));
|
|
29
|
+
};
|
|
30
|
+
TipsMessage.defaultProps = {
|
|
31
|
+
locale: 'nb'
|
|
24
32
|
};
|
|
25
33
|
TipsMessage.propTypes = {
|
|
26
34
|
/** The content of the message box */
|
|
@@ -30,6 +38,8 @@ TipsMessage.propTypes = {
|
|
|
30
38
|
/** The icon to show. Has a default value, but can be overridden */
|
|
31
39
|
icon: _propTypes.node,
|
|
32
40
|
/** An optional title for the message */
|
|
33
|
-
title: _propTypes.node
|
|
41
|
+
title: _propTypes.node,
|
|
42
|
+
/** 'nb', 'nn', or 'en' */
|
|
43
|
+
locale: (0, _propTypes.oneOf)(['en', 'nb', 'nn'])
|
|
34
44
|
};
|
|
35
45
|
var _default = exports.default = TipsMessage;
|
package/lib/texts.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var nb = {
|
|
8
|
+
error: {
|
|
9
|
+
ariaLabel: 'Feilmelding'
|
|
10
|
+
},
|
|
11
|
+
info: {
|
|
12
|
+
ariaLabel: 'Infomelding'
|
|
13
|
+
},
|
|
14
|
+
success: {
|
|
15
|
+
ariaLabel: 'Suksessmelding'
|
|
16
|
+
},
|
|
17
|
+
tip: {
|
|
18
|
+
ariaLabel: 'Tipsmelding'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var nn = {
|
|
22
|
+
error: {
|
|
23
|
+
ariaLabel: 'Feilmelding'
|
|
24
|
+
},
|
|
25
|
+
info: {
|
|
26
|
+
ariaLabel: 'Infomelding'
|
|
27
|
+
},
|
|
28
|
+
success: {
|
|
29
|
+
ariaLabel: 'Suksessmelding'
|
|
30
|
+
},
|
|
31
|
+
tip: {
|
|
32
|
+
ariaLabel: 'Tipsmelding'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var en = {
|
|
36
|
+
error: {
|
|
37
|
+
ariaLabel: 'Error message'
|
|
38
|
+
},
|
|
39
|
+
info: {
|
|
40
|
+
ariaLabel: 'Info message'
|
|
41
|
+
},
|
|
42
|
+
success: {
|
|
43
|
+
ariaLabel: 'Success message'
|
|
44
|
+
},
|
|
45
|
+
tip: {
|
|
46
|
+
ariaLabel: 'Tip message'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var _default = exports.default = {
|
|
50
|
+
nb: nb,
|
|
51
|
+
nn: nn,
|
|
52
|
+
en: en
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-message-box-react",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank 1",
|
|
6
6
|
"files": [
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a16b7e585429fc416939e2d1d50b6d8a2b050c0b"
|
|
45
45
|
}
|