@sb1/ffe-system-message-react 8.0.15 → 8.0.17

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.
@@ -1,20 +1,22 @@
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
6
  import { func, string, number, node, oneOf, bool } from 'prop-types';
7
7
  import { Icon } from '@sb1/ffe-icons-react';
8
+ import texts from './texts';
8
9
  import SystemMessage from './SystemMessage';
9
10
  export default function SystemErrorMessage(props) {
10
11
  var alert = props.alert,
12
+ locale = props.locale,
11
13
  rest = _objectWithoutProperties(props, _excluded);
12
14
  var priorityHighIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
13
15
  return /*#__PURE__*/React.createElement(SystemMessage, _extends({
14
16
  modifier: "error",
15
- "aria-label": "Feilmelding",
17
+ "aria-label": texts[locale].error.ariaLabel,
18
+ locale: locale,
16
19
  icon: /*#__PURE__*/React.createElement(Icon, {
17
- ariaLabel: "Utropstegn",
18
20
  fileUrl: priorityHighIconSmall,
19
21
  size: "sm"
20
22
  }),
@@ -1,16 +1,30 @@
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
6
  import { Icon } from '@sb1/ffe-icons-react';
7
+ import texts from './texts';
4
8
  import SystemMessage from './SystemMessage';
5
- export default function SystemInfoMessage(props) {
9
+ import { oneOf } from 'prop-types';
10
+ export default function SystemInfoMessage(_ref) {
11
+ var locale = _ref.locale,
12
+ rest = _objectWithoutProperties(_ref, _excluded);
6
13
  var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
7
14
  return /*#__PURE__*/React.createElement(SystemMessage, _extends({
8
15
  modifier: "info",
9
- "aria-label": "Infomelding",
16
+ "aria-label": texts[locale].info.ariaLabel,
17
+ locale: locale,
10
18
  icon: /*#__PURE__*/React.createElement(Icon, {
11
- ariaLabel: "Infotegn",
12
19
  size: "sm",
13
20
  fileUrl: infoIconSmall
14
21
  })
15
- }, props));
16
- }
22
+ }, rest));
23
+ }
24
+ SystemInfoMessage.defaultProps = {
25
+ locale: 'nb'
26
+ };
27
+ SystemInfoMessage.propTypes = {
28
+ /** 'nb', 'nn', or 'en' */
29
+ locale: oneOf(['en', 'nb', 'nn'])
30
+ };
@@ -22,6 +22,7 @@ import React, { Component } from 'react';
22
22
  import { func, string, number, node, oneOf, bool } from 'prop-types';
23
23
  import classNames from 'classnames';
24
24
  import { Icon } from '@sb1/ffe-icons-react';
25
+ import texts from './texts';
25
26
  var SystemMessage = /*#__PURE__*/function (_Component) {
26
27
  _inherits(SystemMessage, _Component);
27
28
  function SystemMessage() {
@@ -89,7 +90,7 @@ var SystemMessage = /*#__PURE__*/function (_Component) {
89
90
  }, icon && /*#__PURE__*/React.cloneElement(icon, _objectSpread({}, icon.props))), /*#__PURE__*/React.createElement("p", {
90
91
  className: "ffe-system-message__content"
91
92
  }, children), /*#__PURE__*/React.createElement("button", {
92
- "aria-label": locale === 'en' ? 'Close' : 'Lukk',
93
+ "aria-label": texts[locale].close,
93
94
  className: "ffe-system-message__close",
94
95
  onClick: this.close,
95
96
  type: "button"
@@ -1,16 +1,30 @@
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
6
  import { Icon } from '@sb1/ffe-icons-react';
7
+ import texts from './texts';
4
8
  import SystemMessage from './SystemMessage';
5
- export default function SystemNewsMessage(props) {
9
+ import { oneOf } from 'prop-types';
10
+ export default function SystemNewsMessage(_ref) {
11
+ var locale = _ref.locale,
12
+ rest = _objectWithoutProperties(_ref, _excluded);
6
13
  var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
7
14
  return /*#__PURE__*/React.createElement(SystemMessage, _extends({
8
15
  modifier: "news",
9
- "aria-label": "Nyhetsmelding",
16
+ "aria-label": texts[locale].news.ariaLabel,
17
+ locale: locale,
10
18
  icon: /*#__PURE__*/React.createElement(Icon, {
11
- ariaLabel: "Infotegn",
12
19
  size: "sm",
13
20
  fileUrl: infoIconSmall
14
21
  })
15
- }, props));
16
- }
22
+ }, rest));
23
+ }
24
+ SystemNewsMessage.defaultProps = {
25
+ locale: 'nb'
26
+ };
27
+ SystemNewsMessage.propTypes = {
28
+ /** 'nb', 'nn', or 'en' */
29
+ locale: oneOf(['en', 'nb', 'nn'])
30
+ };
@@ -1,16 +1,30 @@
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
6
  import { Icon } from '@sb1/ffe-icons-react';
7
+ import texts from './texts';
4
8
  import SystemMessage from './SystemMessage';
5
- export default function SystemSuccessMessage(props) {
9
+ import { oneOf } from 'prop-types';
10
+ export default function SystemSuccessMessage(_ref) {
11
+ var locale = _ref.locale,
12
+ rest = _objectWithoutProperties(_ref, _excluded);
6
13
  var checkIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
7
14
  return /*#__PURE__*/React.createElement(SystemMessage, _extends({
8
15
  modifier: "success",
9
- "aria-label": "Suksessmelding",
16
+ "aria-label": texts[locale].success.ariaLabel,
17
+ locale: locale,
10
18
  icon: /*#__PURE__*/React.createElement(Icon, {
11
- ariaLabel: "Hake",
12
19
  size: "sm",
13
20
  fileUrl: checkIconSmall
14
21
  })
15
- }, props));
16
- }
22
+ }, rest));
23
+ }
24
+ SystemSuccessMessage.defaultProps = {
25
+ locale: 'nb'
26
+ };
27
+ SystemSuccessMessage.propTypes = {
28
+ /** 'nb', 'nn', or 'en' */
29
+ locale: oneOf(['en', 'nb', 'nn'])
30
+ };
package/es/texts.js ADDED
@@ -0,0 +1,50 @@
1
+ var nb = {
2
+ close: 'Lukk',
3
+ error: {
4
+ ariaLabel: 'Feilmelding'
5
+ },
6
+ info: {
7
+ ariaLabel: 'Infomelding'
8
+ },
9
+ success: {
10
+ ariaLabel: 'Suksessmelding'
11
+ },
12
+ news: {
13
+ ariaLabel: 'Nyhetsmelding'
14
+ }
15
+ };
16
+ var nn = {
17
+ close: 'Lukk',
18
+ error: {
19
+ ariaLabel: 'Feilmelding'
20
+ },
21
+ info: {
22
+ ariaLabel: 'Infomelding'
23
+ },
24
+ success: {
25
+ ariaLabel: 'Suksessmelding'
26
+ },
27
+ news: {
28
+ ariaLabel: 'Nyheitsmelding'
29
+ }
30
+ };
31
+ var en = {
32
+ close: 'Close',
33
+ error: {
34
+ ariaLabel: 'Error message'
35
+ },
36
+ info: {
37
+ ariaLabel: 'Info message'
38
+ },
39
+ success: {
40
+ ariaLabel: 'Success message'
41
+ },
42
+ news: {
43
+ ariaLabel: 'News message'
44
+ }
45
+ };
46
+ export default {
47
+ nb: nb,
48
+ nn: nn,
49
+ en: en
50
+ };
@@ -7,21 +7,23 @@ exports.default = SystemErrorMessage;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = require("prop-types");
9
9
  var _ffeIconsReact = require("@sb1/ffe-icons-react");
10
+ var _texts = _interopRequireDefault(require("./texts"));
10
11
  var _SystemMessage = _interopRequireDefault(require("./SystemMessage"));
11
- var _excluded = ["alert"];
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
  function SystemErrorMessage(props) {
17
18
  var alert = props.alert,
19
+ locale = props.locale,
18
20
  rest = _objectWithoutProperties(props, _excluded);
19
21
  var priorityHighIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
20
22
  return /*#__PURE__*/_react.default.createElement(_SystemMessage.default, _extends({
21
23
  modifier: "error",
22
- "aria-label": "Feilmelding",
24
+ "aria-label": _texts.default[locale].error.ariaLabel,
25
+ locale: locale,
23
26
  icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
24
- ariaLabel: "Utropstegn",
25
27
  fileUrl: priorityHighIconSmall,
26
28
  size: "sm"
27
29
  }),
@@ -6,18 +6,32 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = SystemInfoMessage;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _ffeIconsReact = require("@sb1/ffe-icons-react");
9
+ var _texts = _interopRequireDefault(require("./texts"));
9
10
  var _SystemMessage = _interopRequireDefault(require("./SystemMessage"));
11
+ var _propTypes = require("prop-types");
12
+ var _excluded = ["locale"];
10
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
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); }
12
- function SystemInfoMessage(props) {
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
+ function SystemInfoMessage(_ref) {
18
+ var locale = _ref.locale,
19
+ rest = _objectWithoutProperties(_ref, _excluded);
13
20
  var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
14
21
  return /*#__PURE__*/_react.default.createElement(_SystemMessage.default, _extends({
15
22
  modifier: "info",
16
- "aria-label": "Infomelding",
23
+ "aria-label": _texts.default[locale].info.ariaLabel,
24
+ locale: locale,
17
25
  icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
18
- ariaLabel: "Infotegn",
19
26
  size: "sm",
20
27
  fileUrl: infoIconSmall
21
28
  })
22
- }, props));
23
- }
29
+ }, rest));
30
+ }
31
+ SystemInfoMessage.defaultProps = {
32
+ locale: 'nb'
33
+ };
34
+ SystemInfoMessage.propTypes = {
35
+ /** 'nb', 'nn', or 'en' */
36
+ locale: (0, _propTypes.oneOf)(['en', 'nb', 'nn'])
37
+ };
@@ -9,6 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
9
9
  var _propTypes = require("prop-types");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _ffeIconsReact = require("@sb1/ffe-icons-react");
12
+ var _texts = _interopRequireDefault(require("./texts"));
12
13
  var _excluded = ["animationLengthMs", "children", "className", "icon", "locale", "modifier", "onColoredBg"];
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -98,7 +99,7 @@ var SystemMessage = /*#__PURE__*/function (_Component) {
98
99
  }, icon && /*#__PURE__*/_react.default.cloneElement(icon, _objectSpread({}, icon.props))), /*#__PURE__*/_react.default.createElement("p", {
99
100
  className: "ffe-system-message__content"
100
101
  }, children), /*#__PURE__*/_react.default.createElement("button", {
101
- "aria-label": locale === 'en' ? 'Close' : 'Lukk',
102
+ "aria-label": _texts.default[locale].close,
102
103
  className: "ffe-system-message__close",
103
104
  onClick: this.close,
104
105
  type: "button"
@@ -6,18 +6,32 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = SystemNewsMessage;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _ffeIconsReact = require("@sb1/ffe-icons-react");
9
+ var _texts = _interopRequireDefault(require("./texts"));
9
10
  var _SystemMessage = _interopRequireDefault(require("./SystemMessage"));
11
+ var _propTypes = require("prop-types");
12
+ var _excluded = ["locale"];
10
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
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); }
12
- function SystemNewsMessage(props) {
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
+ function SystemNewsMessage(_ref) {
18
+ var locale = _ref.locale,
19
+ rest = _objectWithoutProperties(_ref, _excluded);
13
20
  var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
14
21
  return /*#__PURE__*/_react.default.createElement(_SystemMessage.default, _extends({
15
22
  modifier: "news",
16
- "aria-label": "Nyhetsmelding",
23
+ "aria-label": _texts.default[locale].news.ariaLabel,
24
+ locale: locale,
17
25
  icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
18
- ariaLabel: "Infotegn",
19
26
  size: "sm",
20
27
  fileUrl: infoIconSmall
21
28
  })
22
- }, props));
23
- }
29
+ }, rest));
30
+ }
31
+ SystemNewsMessage.defaultProps = {
32
+ locale: 'nb'
33
+ };
34
+ SystemNewsMessage.propTypes = {
35
+ /** 'nb', 'nn', or 'en' */
36
+ locale: (0, _propTypes.oneOf)(['en', 'nb', 'nn'])
37
+ };
@@ -6,18 +6,32 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = SystemSuccessMessage;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _ffeIconsReact = require("@sb1/ffe-icons-react");
9
+ var _texts = _interopRequireDefault(require("./texts"));
9
10
  var _SystemMessage = _interopRequireDefault(require("./SystemMessage"));
11
+ var _propTypes = require("prop-types");
12
+ var _excluded = ["locale"];
10
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
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); }
12
- function SystemSuccessMessage(props) {
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
+ function SystemSuccessMessage(_ref) {
18
+ var locale = _ref.locale,
19
+ rest = _objectWithoutProperties(_ref, _excluded);
13
20
  var checkIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
14
21
  return /*#__PURE__*/_react.default.createElement(_SystemMessage.default, _extends({
15
22
  modifier: "success",
16
- "aria-label": "Suksessmelding",
23
+ "aria-label": _texts.default[locale].success.ariaLabel,
24
+ locale: locale,
17
25
  icon: /*#__PURE__*/_react.default.createElement(_ffeIconsReact.Icon, {
18
- ariaLabel: "Hake",
19
26
  size: "sm",
20
27
  fileUrl: checkIconSmall
21
28
  })
22
- }, props));
23
- }
29
+ }, rest));
30
+ }
31
+ SystemSuccessMessage.defaultProps = {
32
+ locale: 'nb'
33
+ };
34
+ SystemSuccessMessage.propTypes = {
35
+ /** 'nb', 'nn', or 'en' */
36
+ locale: (0, _propTypes.oneOf)(['en', 'nb', 'nn'])
37
+ };
package/lib/texts.js ADDED
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var nb = {
8
+ close: 'Lukk',
9
+ error: {
10
+ ariaLabel: 'Feilmelding'
11
+ },
12
+ info: {
13
+ ariaLabel: 'Infomelding'
14
+ },
15
+ success: {
16
+ ariaLabel: 'Suksessmelding'
17
+ },
18
+ news: {
19
+ ariaLabel: 'Nyhetsmelding'
20
+ }
21
+ };
22
+ var nn = {
23
+ close: 'Lukk',
24
+ error: {
25
+ ariaLabel: 'Feilmelding'
26
+ },
27
+ info: {
28
+ ariaLabel: 'Infomelding'
29
+ },
30
+ success: {
31
+ ariaLabel: 'Suksessmelding'
32
+ },
33
+ news: {
34
+ ariaLabel: 'Nyheitsmelding'
35
+ }
36
+ };
37
+ var en = {
38
+ close: 'Close',
39
+ error: {
40
+ ariaLabel: 'Error message'
41
+ },
42
+ info: {
43
+ ariaLabel: 'Info message'
44
+ },
45
+ success: {
46
+ ariaLabel: 'Success message'
47
+ },
48
+ news: {
49
+ ariaLabel: 'News message'
50
+ }
51
+ };
52
+ var _default = exports.default = {
53
+ nb: nb,
54
+ nn: nn,
55
+ en: en
56
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-system-message-react",
3
- "version": "8.0.15",
3
+ "version": "8.0.17",
4
4
  "description": "SpareBank 1 System Message komponent",
5
5
  "license": "MIT",
6
6
  "author": "SpareBank 1",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "db3b392dd100ec14693efb0ee083c26e5062cb6f"
44
+ "gitHead": "a16b7e585429fc416939e2d1d50b6d8a2b050c0b"
45
45
  }