@sb1/ffe-system-message-react 8.0.33 → 9.0.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/README.md +0 -5
- package/es/SystemErrorMessage.js +29 -51
- package/es/SystemInfoMessage.js +29 -26
- package/es/SystemMessage.js +36 -126
- package/es/SystemNewsMessage.js +29 -26
- package/es/SystemSuccessMessage.js +29 -26
- package/es/index.js +4 -5
- package/es/texts.js +40 -44
- package/lib/SystemErrorMessage.js +37 -59
- package/lib/SystemInfoMessage.js +37 -34
- package/lib/SystemMessage.js +64 -133
- package/lib/SystemNewsMessage.js +37 -34
- package/lib/SystemSuccessMessage.js +37 -34
- package/lib/index.js +10 -33
- package/lib/texts.js +42 -49
- package/package.json +8 -8
- package/types/SystemErrorMessage.d.ts +7 -0
- package/types/SystemInfoMessage.d.ts +5 -0
- package/types/SystemMessage.d.ts +15 -0
- package/types/SystemNewsMessage.d.ts +5 -0
- package/types/SystemSuccessMessage.d.ts +5 -0
- package/types/index.d.ts +4 -31
- package/types/texts.d.ts +47 -0
- package/es/index.d.js +0 -1
- package/lib/index.d.js +0 -6
package/README.md
CHANGED
|
@@ -10,11 +10,6 @@ npm install --save @sb1/ffe-system-message-react
|
|
|
10
10
|
|
|
11
11
|
Full documentation on system message usage is available at https://design.sparebank1.no/komponenter/meldinger/#systemmessage.
|
|
12
12
|
|
|
13
|
-
## TypeScript definition files
|
|
14
|
-
|
|
15
|
-
This component supports TypeScript - please update `index.d.ts` if you change any
|
|
16
|
-
of the external methods or properties in this component.
|
|
17
|
-
|
|
18
13
|
## Development
|
|
19
14
|
|
|
20
15
|
To start a local development server, run the following from the designsystem root folder:
|
package/es/SystemErrorMessage.js
CHANGED
|
@@ -1,53 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
5
23
|
import React from 'react';
|
|
6
|
-
import { func, string, number, node, oneOf, bool } from 'prop-types';
|
|
7
24
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
8
|
-
import texts from './texts';
|
|
9
|
-
import SystemMessage from './SystemMessage';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_props$animationLengt = props.animationLengthMs,
|
|
16
|
-
animationLengthMs = _props$animationLengt === void 0 ? 300 : _props$animationLengt,
|
|
17
|
-
_props$onClose = props.onClose,
|
|
18
|
-
onClose = _props$onClose === void 0 ? function (f) {
|
|
19
|
-
return f;
|
|
20
|
-
} : _props$onClose,
|
|
21
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
22
|
-
var priorityHighIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
|
|
23
|
-
return /*#__PURE__*/React.createElement(SystemMessage, _extends({
|
|
24
|
-
modifier: "error",
|
|
25
|
-
"aria-label": texts[locale].error.ariaLabel,
|
|
26
|
-
locale: locale,
|
|
27
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
28
|
-
fileUrl: priorityHighIconSmall,
|
|
29
|
-
size: "sm"
|
|
30
|
-
}),
|
|
31
|
-
role: alert ? 'alert' : 'group',
|
|
32
|
-
animationLengthMs: animationLengthMs,
|
|
33
|
-
onClose: onClose
|
|
34
|
-
}, rest));
|
|
35
|
-
}
|
|
36
|
-
SystemErrorMessage.propTypes = {
|
|
37
|
-
animationLengthMs: number,
|
|
38
|
-
/** The content of the system message */
|
|
39
|
-
children: node.isRequired,
|
|
40
|
-
/** Additional classes added to the surrounding div */
|
|
41
|
-
className: string,
|
|
42
|
-
/** 'nb', 'nn', or 'en' */
|
|
43
|
-
locale: oneOf(['en', 'nb', 'nn']),
|
|
44
|
-
/**
|
|
45
|
-
* The type of system message. Used internally only-
|
|
46
|
-
* @ignore
|
|
47
|
-
**/
|
|
48
|
-
modifier: oneOf(['error', 'info', 'success', 'news']),
|
|
49
|
-
/** Callback for when the system message has been closed (after animation ends) */
|
|
50
|
-
onClose: func,
|
|
51
|
-
/** When false, role is not set to alert, avoids message from being read up immediately after page load. Default value is true. */
|
|
52
|
-
alert: bool
|
|
53
|
-
};
|
|
25
|
+
import { texts } from './texts';
|
|
26
|
+
import { SystemMessage } from './SystemMessage';
|
|
27
|
+
export var SystemErrorMessage = function (_a) {
|
|
28
|
+
var _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, alert = _a.alert, rest = __rest(_a, ["locale", "alert"]);
|
|
29
|
+
var priorityHighIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTE4Ny4wOHEtMjEuNTM3IDAtMzYuNjYyLTE1LjMzN3QtMTUuMTI1LTM2Ljg3NHEwLTIxLjUzNyAxNS4zMzctMzYuNjYyIDE1LjMzNy0xNS4xMjQgMzYuODc0LTE1LjEyNCAyMS41MzcgMCAzNi42NjIgMTUuMzM3dDE1LjEyNSAzNi44NzRxMCAyMS41MzctMTUuMzM3IDM2LjY2MS0xNS4zMzcgMTUuMTI1LTM2Ljg3NCAxNS4xMjVabS0uMDYyLTE5Ni4xNTFxLTE5LjM0MSAwLTMyLjg0LTEzLjcwOS0xMy41LTEzLjcwOS0xMy41LTMyLjk2di0zMTYuNjg1cTAtMTkuMjUxIDEzLjc3NC0zMi43OTQgMTMuNzczLTEzLjU0MiAzMy4xMTQtMTMuNTQyIDE5LjM0MSAwIDMyLjg0IDEzLjcwOSAxMy41IDEzLjcwOSAxMy41IDMyLjk2djMxNi42ODVxMCAxOS4yNTEtMTMuNzc0IDMyLjc5NC0xMy43NzMgMTMuNTQyLTMzLjExNCAxMy41NDJaIi8+PC9zdmc+';
|
|
30
|
+
return (React.createElement(SystemMessage, __assign({ modifier: "error", "aria-label": texts[locale].error.ariaLabel, locale: locale, icon: React.createElement(Icon, { fileUrl: priorityHighIconSmall, size: "sm" }), role: alert ? 'alert' : 'group' }, rest)));
|
|
31
|
+
};
|
package/es/SystemInfoMessage.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
5
23
|
import React from 'react';
|
|
6
24
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
7
|
-
import texts from './texts';
|
|
8
|
-
import SystemMessage from './SystemMessage';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
locale
|
|
13
|
-
|
|
14
|
-
var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
|
|
15
|
-
return /*#__PURE__*/React.createElement(SystemMessage, _extends({
|
|
16
|
-
modifier: "info",
|
|
17
|
-
"aria-label": texts[locale].info.ariaLabel,
|
|
18
|
-
locale: locale,
|
|
19
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
20
|
-
size: "sm",
|
|
21
|
-
fileUrl: infoIconSmall
|
|
22
|
-
})
|
|
23
|
-
}, rest));
|
|
24
|
-
}
|
|
25
|
-
SystemInfoMessage.propTypes = {
|
|
26
|
-
/** 'nb', 'nn', or 'en' */
|
|
27
|
-
locale: oneOf(['en', 'nb', 'nn'])
|
|
28
|
-
};
|
|
25
|
+
import { texts } from './texts';
|
|
26
|
+
import { SystemMessage } from './SystemMessage';
|
|
27
|
+
export var SystemInfoMessage = function (_a) {
|
|
28
|
+
var _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, rest = __rest(_a, ["locale"]);
|
|
29
|
+
var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
|
|
30
|
+
return (React.createElement(SystemMessage, __assign({ modifier: "info", "aria-label": texts[locale].info.ariaLabel, locale: locale, icon: React.createElement(Icon, { size: "sm", fileUrl: infoIconSmall }) }, rest)));
|
|
31
|
+
};
|
package/es/SystemMessage.js
CHANGED
|
@@ -1,129 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
11
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
17
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
19
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
20
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
-
import React, { Component } from 'react';
|
|
22
|
-
import { func, string, number, node, oneOf, bool } from 'prop-types';
|
|
23
|
-
import classNames from 'classnames';
|
|
24
|
-
import { Icon } from '@sb1/ffe-icons-react';
|
|
25
|
-
import texts from './texts';
|
|
26
|
-
var SystemMessage = /*#__PURE__*/function (_Component) {
|
|
27
|
-
function SystemMessage() {
|
|
28
|
-
var _this;
|
|
29
|
-
_classCallCheck(this, SystemMessage);
|
|
30
|
-
_this = _callSuper(this, SystemMessage);
|
|
31
|
-
_this.close = _this.close.bind(_this);
|
|
32
|
-
_this.state = {
|
|
33
|
-
closed: false
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
34
9
|
};
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onClose = _this$props$onClose === void 0 ? function (f) {
|
|
46
|
-
return f;
|
|
47
|
-
} : _this$props$onClose;
|
|
48
|
-
var self = this._self;
|
|
49
|
-
self.style.height = "".concat(self.offsetHeight, "px");
|
|
50
|
-
setTimeout(function () {
|
|
51
|
-
self.style.height = 0;
|
|
52
|
-
}, 0);
|
|
53
|
-
setTimeout(function () {
|
|
54
|
-
_this2.setState({
|
|
55
|
-
closed: true
|
|
56
|
-
}, function () {
|
|
57
|
-
onClose(event);
|
|
58
|
-
});
|
|
59
|
-
}, animationLengthMs);
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
key: "render",
|
|
64
|
-
value: function render() {
|
|
65
|
-
var _this3 = this;
|
|
66
|
-
var _this$props2 = this.props,
|
|
67
|
-
_this$props2$animatio = _this$props2.animationLengthMs,
|
|
68
|
-
animationLengthMs = _this$props2$animatio === void 0 ? 300 : _this$props2$animatio,
|
|
69
|
-
children = _this$props2.children,
|
|
70
|
-
className = _this$props2.className,
|
|
71
|
-
icon = _this$props2.icon,
|
|
72
|
-
_this$props2$locale = _this$props2.locale,
|
|
73
|
-
locale = _this$props2$locale === void 0 ? 'nb' : _this$props2$locale,
|
|
74
|
-
modifier = _this$props2.modifier,
|
|
75
|
-
onColoredBg = _this$props2.onColoredBg,
|
|
76
|
-
rest = _objectWithoutProperties(_this$props2, _excluded);
|
|
77
|
-
if (this.state.closed) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
81
|
-
className: classNames('ffe-system-message-wrapper', "ffe-system-message-wrapper--".concat(modifier), {
|
|
82
|
-
'ffe-system-message-wrapper--coloredbg': onColoredBg
|
|
83
|
-
}, className),
|
|
84
|
-
role: "group",
|
|
85
|
-
ref: function ref(_self) {
|
|
86
|
-
_this3._self = _self;
|
|
87
|
-
},
|
|
88
|
-
style: {
|
|
89
|
-
transition: "height ".concat(animationLengthMs / 1000, "s")
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
90
20
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
SystemMessage.propTypes = {
|
|
110
|
-
animationLengthMs: number,
|
|
111
|
-
/** The content of the system message */
|
|
112
|
-
children: node.isRequired,
|
|
113
|
-
/** Additional classes added to the surrounding div */
|
|
114
|
-
className: string,
|
|
115
|
-
/** Override the default icon - use with caution! */
|
|
116
|
-
icon: node.isRequired,
|
|
117
|
-
/** 'nb', 'nn', or 'en' */
|
|
118
|
-
locale: oneOf(['en', 'nb', 'nn']),
|
|
119
|
-
/**
|
|
120
|
-
* The type of system message. Used internally only-
|
|
121
|
-
* @ignore
|
|
122
|
-
**/
|
|
123
|
-
modifier: oneOf(['error', 'info', 'success', 'news']),
|
|
124
|
-
/** Callback for when the system message has been closed (after animation ends) */
|
|
125
|
-
onClose: func,
|
|
126
|
-
/* Adds alternative styling for better contrast on certain backgrounds */
|
|
127
|
-
onColoredBg: bool
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React, { useState } from 'react';
|
|
24
|
+
import classNames from 'classnames';
|
|
25
|
+
import { Icon } from '@sb1/ffe-icons-react';
|
|
26
|
+
import { texts } from './texts';
|
|
27
|
+
import { Collapse } from '@sb1/ffe-collapse-react';
|
|
28
|
+
export var SystemMessage = function (_a) {
|
|
29
|
+
var children = _a.children, className = _a.className, icon = _a.icon, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, modifier = _a.modifier, onColoredBg = _a.onColoredBg, onClick = _a.onClick, onCloseRest = _a.onCloseRest, rest = __rest(_a, ["children", "className", "icon", "locale", "modifier", "onColoredBg", "onClick", "onCloseRest"]);
|
|
30
|
+
var _c = useState(true), isOpen = _c[0], setIsOpen = _c[1];
|
|
31
|
+
return (React.createElement(Collapse, { isOpen: isOpen, onRest: onCloseRest },
|
|
32
|
+
React.createElement("div", __assign({ className: classNames('ffe-system-message-wrapper', "ffe-system-message-wrapper--".concat(modifier), { 'ffe-system-message-wrapper--coloredbg': onColoredBg }, className), role: "group" }, rest),
|
|
33
|
+
React.createElement("div", { className: "ffe-system-message" },
|
|
34
|
+
React.createElement("span", { className: "ffe-system-message__icon" }, React.isValidElement(icon) &&
|
|
35
|
+
React.cloneElement(icon, __assign({}, icon.props))),
|
|
36
|
+
React.createElement("p", { className: "ffe-system-message__content" }, children),
|
|
37
|
+
React.createElement("button", { "aria-label": texts[locale].close, className: "ffe-system-message__close", onClick: function (event) { return setIsOpen(false); }, type: "button" },
|
|
38
|
+
React.createElement(Icon, { fileUrl: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00ODAtNDQyLjg0NyAzMDkuMDc2LTI3MS45MjRxLTguMzA3IDguMzA4LTE3Ljg4NCA4LTkuNTc2LS4zMDctMTguMjY4LTktOC42OTMtOC42OTItOC42OTMtMTguNTc2dDguNjkzLTE4LjU3Nkw0NDIuODQ3LTQ4MCAyNzEuOTI0LTY1MC45MjRxLTguMzA4LTguMzA3LTgtMTguMzg0LjMwNy0xMC4wNzYgOS0xOC43NjggOC42OTItOC42OTMgMTguNTc2LTguNjkzdDE4LjU3NiA4LjY5M0w0ODAtNTE3LjE1M2wxNzAuOTI0LTE3MC45MjNxOC4zMDctOC4zMDggMTguMzg0LTguNSAxMC4wNzYtLjE5MyAxOC43NjggOC41IDguNjkzIDguNjkyIDguNjkzIDE4LjU3NnQtOC42OTMgMTguNTc2TDUxNy4xNTMtNDgwbDE3MC45MjMgMTcwLjkyNHE4LjMwOCA4LjMwNyA4LjUgMTcuODg0LjE5MyA5LjU3Ni04LjUgMTguMjY4LTguNjkyIDguNjkzLTE4LjU3NiA4LjY5M3QtMTguNTc2LTguNjkzTDQ4MC00NDIuODQ3WiIvPjwvc3ZnPg==", size: "sm" }))))));
|
|
128
39
|
};
|
|
129
|
-
export default SystemMessage;
|
package/es/SystemNewsMessage.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
5
23
|
import React from 'react';
|
|
6
24
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
7
|
-
import texts from './texts';
|
|
8
|
-
import SystemMessage from './SystemMessage';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
locale
|
|
13
|
-
|
|
14
|
-
var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
|
|
15
|
-
return /*#__PURE__*/React.createElement(SystemMessage, _extends({
|
|
16
|
-
modifier: "news",
|
|
17
|
-
"aria-label": texts[locale].news.ariaLabel,
|
|
18
|
-
locale: locale,
|
|
19
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
20
|
-
size: "sm",
|
|
21
|
-
fileUrl: infoIconSmall
|
|
22
|
-
})
|
|
23
|
-
}, rest));
|
|
24
|
-
}
|
|
25
|
-
SystemNewsMessage.propTypes = {
|
|
26
|
-
/** 'nb', 'nn', or 'en' */
|
|
27
|
-
locale: oneOf(['en', 'nb', 'nn'])
|
|
28
|
-
};
|
|
25
|
+
import { texts } from './texts';
|
|
26
|
+
import { SystemMessage } from './SystemMessage';
|
|
27
|
+
export var SystemNewsMessage = function (_a) {
|
|
28
|
+
var _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, rest = __rest(_a, ["locale"]);
|
|
29
|
+
var infoIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Ik00NzkuNzg4LTY3MnEtMjUuOTQyIDAtNDMuODY0LTE4LjEzNS0xNy45MjMtMTguMTM2LTE3LjkyMy00NC4wNzd0MTguMTM1LTQzLjg2NHExOC4xMzUtMTcuOTIzIDQ0LjA3Ni0xNy45MjMgMjUuOTQyIDAgNDMuODY0IDE4LjEzNiAxNy45MjMgMTguMTM1IDE3LjkyMyA0NC4wNzZ0LTE4LjEzNSA0My44NjRRNTA1LjcyOS02NzIgNDc5Ljc4OC02NzJabS4yNTcgNTA3Ljk5OXEtMjAuODE0IDAtMzUuNDI5LTE0LjU4NC0xNC42MTUtMTQuNTgzLTE0LjYxNS0zNS40MTZ2LTI5Ni42MTRxMC0yMC44MzMgMTQuNTctMzUuNDE2IDE0LjU3LTE0LjU4MyAzNS4zODQtMTQuNTgzdDM1LjQyOSAxNC41ODNxMTQuNjE1IDE0LjU4MyAxNC42MTUgMzUuNDE2djI5Ni42MTRxMCAyMC44MzMtMTQuNTcgMzUuNDE2LTE0LjU3IDE0LjU4NC0zNS4zODQgMTQuNTg0WiIvPjwvc3ZnPg==';
|
|
30
|
+
return (React.createElement(SystemMessage, __assign({ modifier: "news", "aria-label": texts[locale].news.ariaLabel, locale: locale, icon: React.createElement(Icon, { size: "sm", fileUrl: infoIconSmall }) }, rest)));
|
|
31
|
+
};
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
5
23
|
import React from 'react';
|
|
6
24
|
import { Icon } from '@sb1/ffe-icons-react';
|
|
7
|
-
import texts from './texts';
|
|
8
|
-
import SystemMessage from './SystemMessage';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
locale
|
|
13
|
-
|
|
14
|
-
var checkIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
|
|
15
|
-
return /*#__PURE__*/React.createElement(SystemMessage, _extends({
|
|
16
|
-
modifier: "success",
|
|
17
|
-
"aria-label": texts[locale].success.ariaLabel,
|
|
18
|
-
locale: locale,
|
|
19
|
-
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
20
|
-
size: "sm",
|
|
21
|
-
fileUrl: checkIconSmall
|
|
22
|
-
})
|
|
23
|
-
}, rest));
|
|
24
|
-
}
|
|
25
|
-
SystemSuccessMessage.propTypes = {
|
|
26
|
-
/** 'nb', 'nn', or 'en' */
|
|
27
|
-
locale: oneOf(['en', 'nb', 'nn'])
|
|
28
|
-
};
|
|
25
|
+
import { texts } from './texts';
|
|
26
|
+
import { SystemMessage } from './SystemMessage';
|
|
27
|
+
export var SystemSuccessMessage = function (_a) {
|
|
28
|
+
var _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, rest = __rest(_a, ["locale"]);
|
|
29
|
+
var checkIconSmall = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iMjAiPjxwYXRoIGQ9Im0zOTUtMzcyLjM4NCAyNzAuNTM5LTI2OS41MzhxNy45MjMtNy45MjMgMTcuNjkyLTcuNjE2IDkuNzY5LjMwOCAxOC4wNzYgOC42MTYgOC4zMDggOC4zMDcgOC4zMDggMTcuODg0IDAgOS41NzYtOC4zMDggMTcuODg0bC0yODMgMjgyLjk5OXEtOS44NDYgOS44NDYtMjIuODA3IDkuODQ2LTEyLjk2MSAwLTIyLjgwNy05Ljg0NmwtMTE0LTExMy45OTlxLTcuOTIzLTcuOTIzLTguMzA4LTE3LjY5Mi0uMzg0LTkuNzY5IDcuOTIzLTE4LjA3NiA4LjMwOC04LjMwOCAxNy44ODQtOC4zMDggOS41NzcgMCAxNy44ODQgOC4zMDhMMzk1LTM3Mi4zODRaIi8+PC9zdmc+';
|
|
30
|
+
return (React.createElement(SystemMessage, __assign({ modifier: "success", "aria-label": texts[locale].success.ariaLabel, locale: locale, icon: React.createElement(Icon, { size: "sm", fileUrl: checkIconSmall }) }, rest)));
|
|
31
|
+
};
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { SystemErrorMessage, SystemInfoMessage, SystemNewsMessage, SystemSuccessMessage };
|
|
1
|
+
export { SystemErrorMessage, } from './SystemErrorMessage';
|
|
2
|
+
export { SystemInfoMessage } from './SystemInfoMessage';
|
|
3
|
+
export { SystemNewsMessage } from './SystemNewsMessage';
|
|
4
|
+
export { SystemSuccessMessage, } from './SystemSuccessMessage';
|
package/es/texts.js
CHANGED
|
@@ -1,50 +1,46 @@
|
|
|
1
1
|
var nb = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
};
|
|
16
16
|
var nn = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
30
|
};
|
|
31
31
|
var en = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
45
|
};
|
|
46
|
-
export
|
|
47
|
-
nb: nb,
|
|
48
|
-
nn: nn,
|
|
49
|
-
en: en
|
|
50
|
-
};
|
|
46
|
+
export var texts = { nb: nb, nn: nn, en: en };
|