@sb1/ffe-message-box-react 10.0.31 → 11.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 CHANGED
@@ -10,11 +10,6 @@ npm install --save @sb1/ffe-message-box-react
10
10
 
11
11
  Full documentation on message box usage is available at https://design.sparebank1.no/komponenter/meldinger/#messagebox.
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/BaseMessage.js CHANGED
@@ -1,63 +1,36 @@
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", "ariaLabel", "role"];
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
- 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
- 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; }
6
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
- 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); }
9
- 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; }
10
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
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
+ };
11
23
  import React from 'react';
12
- import { bool, node, oneOf, string } from 'prop-types';
13
24
  import classNames from 'classnames';
14
- var BaseMessage = function BaseMessage(props) {
15
- var type = props.type,
16
- title = props.title,
17
- _props$titleElement = props.titleElement,
18
- titleElement = _props$titleElement === void 0 ? 'h2' : _props$titleElement,
19
- icon = props.icon,
20
- children = props.children,
21
- _props$className = props.className,
22
- className = _props$className === void 0 ? '' : _props$className,
23
- _props$onColoredBg = props.onColoredBg,
24
- onColoredBg = _props$onColoredBg === void 0 ? false : _props$onColoredBg,
25
- ariaLabel = props.ariaLabel,
26
- _props$role = props.role,
27
- role = _props$role === void 0 ? 'group' : _props$role,
28
- rest = _objectWithoutProperties(props, _excluded);
29
- return /*#__PURE__*/React.createElement("div", _extends({
30
- className: classNames('ffe-message-box', "ffe-message-box--".concat(type), {
31
- 'ffe-message-box--coloredbg': onColoredBg
32
- }, className),
33
- "aria-label": ariaLabel,
34
- role: role
35
- }, rest), /*#__PURE__*/React.createElement("span", {
36
- className: "ffe-message-box__icon"
37
- }, /*#__PURE__*/React.cloneElement(icon, _objectSpread(_objectSpread({}, icon.props), {}, {
38
- size: 'xl',
39
- weight: 300
40
- }))), /*#__PURE__*/React.createElement("div", {
41
- className: "ffe-message-box__box"
42
- }, title && /*#__PURE__*/React.createElement(titleElement, {
43
- className: 'ffe-message-box__title'
44
- }, title), children));
45
- };
46
- BaseMessage.propTypes = {
47
- children: node,
48
- className: string,
49
- icon: node.isRequired,
50
- title: node,
51
- /** HTML element for the title */
52
- titleElement: string,
53
- /**
54
- * Internal type enum for specifying the style of message box. Should not be used directly
55
- * @ignore
56
- */
57
- type: oneOf(['success', 'error', 'tips', 'info']).isRequired,
58
- /* Adds alternative styling for better contrast on certain backgrounds */
59
- onColoredBg: bool,
60
- ariaLabel: string,
61
- role: oneOf(['alert', 'group'])
25
+ export var BaseMessage = function (_a) {
26
+ var type = _a.type, title = _a.title, _b = _a.titleElement, titleElement = _b === void 0 ? 'h2' : _b, icon = _a.icon, children = _a.children, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.onColoredBg, onColoredBg = _d === void 0 ? false : _d, ariaLabel = _a.ariaLabel, _e = _a.role, role = _e === void 0 ? 'group' : _e, rest = __rest(_a, ["type", "title", "titleElement", "icon", "children", "className", "onColoredBg", "ariaLabel", "role"]);
27
+ return (React.createElement("div", __assign({ className: classNames('ffe-message-box', "ffe-message-box--".concat(type), { 'ffe-message-box--coloredbg': onColoredBg }, className), "aria-label": ariaLabel, role: role }, rest),
28
+ React.createElement("span", { className: "ffe-message-box__icon" }, React.isValidElement(icon) &&
29
+ React.cloneElement(icon, __assign(__assign({}, icon.props), { size: 'xl', weight: 300 }))),
30
+ React.createElement("div", { className: "ffe-message-box__box" },
31
+ title &&
32
+ React.createElement(titleElement, {
33
+ className: 'ffe-message-box__title',
34
+ }, title),
35
+ children)));
62
36
  };
63
- export default BaseMessage;
@@ -1,41 +1,31 @@
1
- var _excluded = ["alert", "locale"];
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 = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
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 { node, string, bool, oneOf } from 'prop-types';
7
24
  import { Icon } from '@sb1/ffe-icons-react';
8
- import BaseMessage from './BaseMessage';
9
- import texts from './texts';
10
- var ErrorMessage = function ErrorMessage(props) {
11
- var _props$alert = props.alert,
12
- alert = _props$alert === void 0 ? true : _props$alert,
13
- _props$locale = props.locale,
14
- locale = _props$locale === void 0 ? 'nb' : _props$locale,
15
- rest = _objectWithoutProperties(props, _excluded);
16
- var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTE2My4wOHEtMjEuNzg0IDAtMzcuMTc4LTE1LjUxMy0xNS4zOTQtMTUuNTEzLTE1LjM5NC0zNy4yOTd0MTUuNTEzLTM3LjE3OHExNS41MTMtMTUuMzk0IDM3LjI5Ny0xNS4zOTR0MzcuMTc4IDE1LjUxM3ExNS4zOTQgMTUuNTEzIDE1LjM5NCAzNy4yOTd0LTE1LjUxMyAzNy4xNzhxLTE1LjUxMyAxNS4zOTQtMzcuMjk3IDE1LjM5NFptLS4wNjEtMTk2LjE1MXEtMTkuNTg5IDAtMzMuMzU3LTEzLjg5Ni0xMy43NjktMTMuODk2LTEzLjc2OS0zMy40MXYtMzYzLjA3OHEwLTE5LjUxNCAxMy45NDktMzMuNDEgMTMuOTQ5LTEzLjg5NiAzMy41MzctMTMuODk2IDE5LjU4OSAwIDMzLjM1NyAxMy44OTYgMTMuNzY5IDEzLjg5NiAxMy43NjkgMzMuNDF2MzYzLjA3OHEwIDE5LjUxNC0xMy45NDkgMzMuNDEtMTMuOTQ5IDEzLjg5Ni0zMy41MzcgMTMuODk2WiIvPjwvc3ZnPg==';
17
- return /*#__PURE__*/React.createElement(BaseMessage, _extends({
18
- type: "error",
19
- ariaLabel: texts[locale].error.ariaLabel,
20
- icon: /*#__PURE__*/React.createElement(Icon, {
21
- fileUrl: priorityHighIcon,
22
- size: "xl"
23
- }),
24
- role: alert ? 'alert' : 'group'
25
- }, rest));
26
- };
27
- ErrorMessage.propTypes = {
28
- /** The content of the message box */
29
- children: node,
30
- /** Any extra class names to the wrapping DOM node */
31
- className: string,
32
- /** The icon to show. Has a default value, but can be overridden */
33
- icon: node,
34
- /** An optional title for the message */
35
- title: node,
36
- /** 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,
38
- /** 'nb', 'nn', or 'en' */
39
- locale: oneOf(['en', 'nb', 'nn'])
25
+ import { BaseMessage } from './BaseMessage';
26
+ import { texts } from './texts';
27
+ export var ErrorMessage = function (_a) {
28
+ var _b = _a.alert, alert = _b === void 0 ? true : _b, _c = _a.locale, locale = _c === void 0 ? 'nb' : _c, rest = __rest(_a, ["alert", "locale"]);
29
+ var priorityHighIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTE2My4wOHEtMjEuNzg0IDAtMzcuMTc4LTE1LjUxMy0xNS4zOTQtMTUuNTEzLTE1LjM5NC0zNy4yOTd0MTUuNTEzLTM3LjE3OHExNS41MTMtMTUuMzk0IDM3LjI5Ny0xNS4zOTR0MzcuMTc4IDE1LjUxM3ExNS4zOTQgMTUuNTEzIDE1LjM5NCAzNy4yOTd0LTE1LjUxMyAzNy4xNzhxLTE1LjUxMyAxNS4zOTQtMzcuMjk3IDE1LjM5NFptLS4wNjEtMTk2LjE1MXEtMTkuNTg5IDAtMzMuMzU3LTEzLjg5Ni0xMy43NjktMTMuODk2LTEzLjc2OS0zMy40MXYtMzYzLjA3OHEwLTE5LjUxNCAxMy45NDktMzMuNDEgMTMuOTQ5LTEzLjg5NiAzMy41MzctMTMuODk2IDE5LjU4OSAwIDMzLjM1NyAxMy44OTYgMTMuNzY5IDEzLjg5NiAxMy43NjkgMzMuNDF2MzYzLjA3OHEwIDE5LjUxNC0xMy45NDkgMzMuNDEtMTMuOTQ5IDEzLjg5Ni0zMy41MzcgMTMuODk2WiIvPjwvc3ZnPg==';
30
+ return (React.createElement(BaseMessage, __assign({ type: "error", ariaLabel: texts[locale].error.ariaLabel, icon: React.createElement(Icon, { fileUrl: priorityHighIcon, size: "xl" }), role: alert ? 'alert' : 'group' }, rest)));
40
31
  };
41
- export default ErrorMessage;
package/es/InfoMessage.js CHANGED
@@ -1,36 +1,31 @@
1
- var _excluded = ["locale"];
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 = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
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 { node, oneOf, string } from 'prop-types';
7
24
  import { Icon } from '@sb1/ffe-icons-react';
8
- import BaseMessage from './BaseMessage';
9
- import texts from './texts';
10
- var InfoMessage = function InfoMessage(_ref) {
11
- var _ref$locale = _ref.locale,
12
- locale = _ref$locale === void 0 ? 'nb' : _ref$locale,
13
- rest = _objectWithoutProperties(_ref, _excluded);
14
- var infoIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTY5NC42MTVxLTI2LjE4OCAwLTQ0LjM4MS0xOC4zMTEtMTguMTkyLTE4LjMxMi0xOC4xOTItNDQuNXQxOC4zMTItNDQuMzhxMTguMzExLTE4LjE5MyA0NC40OTktMTguMTkzIDI2LjE4OCAwIDQ0LjM4MSAxOC4zMTIgMTguMTkyIDE4LjMxMSAxOC4xOTIgNDQuNDk5IDAgMjYuMTg5LTE4LjMxMiA0NC4zODEtMTguMzExIDE4LjE5Mi00NC40OTkgMTguMTkyWm0uMDI0IDU1NC42MTRxLTE3LjgyOCAwLTMwLjIxMi0xMi40NTItMTIuMzg1LTEyLjQ1Mi0xMi4zODUtMzAuMjR2LTM1OS4yMjlxMC0xNy43ODkgMTIuNDgtMzAuMjQgMTIuNDc5LTEyLjQ1MiAzMC4zMDctMTIuNDUydDMwLjIxMiAxMi40NTJxMTIuMzg1IDEyLjQ1MSAxMi4zODUgMzAuMjR2MzU5LjIyOXEwIDE3Ljc4OC0xMi40OCAzMC4yNC0xMi40NzkgMTIuNDUyLTMwLjMwNyAxMi40NTJaIi8+PC9zdmc+';
15
- return /*#__PURE__*/React.createElement(BaseMessage, _extends({
16
- type: "info",
17
- ariaLabel: texts[locale].info.ariaLabel,
18
- icon: /*#__PURE__*/React.createElement(Icon, {
19
- fileUrl: infoIcon,
20
- size: "xl"
21
- })
22
- }, rest));
23
- };
24
- InfoMessage.propTypes = {
25
- /** The content of the message box */
26
- children: node,
27
- /** Any extra class names to the wrapping DOM node */
28
- className: string,
29
- /** The icon to show. Has a default value, but can be overridden */
30
- icon: node,
31
- /** An optional title for the message */
32
- title: node,
33
- /** 'nb', 'nn', or 'en' */
34
- locale: oneOf(['en', 'nb', 'nn'])
25
+ import { BaseMessage } from './BaseMessage';
26
+ import { texts } from './texts';
27
+ export var InfoMessage = function (_a) {
28
+ var _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, rest = __rest(_a, ["locale"]);
29
+ var infoIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00NzkuODgxLTY5NC42MTVxLTI2LjE4OCAwLTQ0LjM4MS0xOC4zMTEtMTguMTkyLTE4LjMxMi0xOC4xOTItNDQuNXQxOC4zMTItNDQuMzhxMTguMzExLTE4LjE5MyA0NC40OTktMTguMTkzIDI2LjE4OCAwIDQ0LjM4MSAxOC4zMTIgMTguMTkyIDE4LjMxMSAxOC4xOTIgNDQuNDk5IDAgMjYuMTg5LTE4LjMxMiA0NC4zODEtMTguMzExIDE4LjE5Mi00NC40OTkgMTguMTkyWm0uMDI0IDU1NC42MTRxLTE3LjgyOCAwLTMwLjIxMi0xMi40NTItMTIuMzg1LTEyLjQ1Mi0xMi4zODUtMzAuMjR2LTM1OS4yMjlxMC0xNy43ODkgMTIuNDgtMzAuMjQgMTIuNDc5LTEyLjQ1MiAzMC4zMDctMTIuNDUydDMwLjIxMiAxMi40NTJxMTIuMzg1IDEyLjQ1MSAxMi4zODUgMzAuMjR2MzU5LjIyOXEwIDE3Ljc4OC0xMi40OCAzMC4yNC0xMi40NzkgMTIuNDUyLTMwLjMwNyAxMi40NTJaIi8+PC9zdmc+';
30
+ return (React.createElement(BaseMessage, __assign({ type: "info", ariaLabel: texts[locale].info.ariaLabel, icon: React.createElement(Icon, { fileUrl: infoIcon, size: "xl" }) }, rest)));
35
31
  };
36
- export default InfoMessage;
@@ -1,20 +1,9 @@
1
1
  import React from 'react';
2
- import { string, node } from 'prop-types';
3
- export var InfoMessageListItem = function InfoMessageListItem(props) {
4
- return /*#__PURE__*/React.createElement("li", null, props.href && /*#__PURE__*/React.createElement("a", {
5
- href: props.href,
6
- className: "ffe-message-box__link"
7
- }, props.children), !props.href && props.children);
2
+ export var InfoMessageListItem = function (_a) {
3
+ var children = _a.children, href = _a.href;
4
+ return (React.createElement("li", null, href ? (React.createElement("a", { href: href, className: "ffe-message-box__link" }, children)) : (children)));
8
5
  };
9
- InfoMessageListItem.propTypes = {
10
- href: string,
11
- children: string.isRequired
6
+ export var InfoMessageList = function (_a) {
7
+ var children = _a.children;
8
+ return React.createElement("ul", { className: "ffe-message-box__list" }, children);
12
9
  };
13
- export var InfoMessageList = function InfoMessageList(props) {
14
- return /*#__PURE__*/React.createElement("ul", {
15
- className: "ffe-message-box__list"
16
- }, props.children);
17
- };
18
- InfoMessageList.propTypes = {
19
- children: node.isRequired
20
- };
@@ -1,36 +1,31 @@
1
- var _excluded = ["locale"];
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 = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
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 { node, oneOf, string } from 'prop-types';
7
24
  import { Icon } from '@sb1/ffe-icons-react';
8
- import BaseMessage from './BaseMessage';
9
- import texts from './texts';
10
- var SuccessMessage = function SuccessMessage(_ref) {
11
- var _ref$locale = _ref.locale,
12
- locale = _ref$locale === void 0 ? 'nb' : _ref$locale,
13
- rest = _objectWithoutProperties(_ref, _excluded);
14
- var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Im0zNzkuMTU0LTMyMy4xNTMgMzYzLTM2My4zODVxNi43NTktNi4zMDcgMTYuMTQ4LTYuNSA5LjM5LS4xOTIgMTYuNDY3IDYuNTUzIDYuNjkyIDcuMTI5IDYuNjkyIDE2LjQ5OSAwIDkuMzcxLTYuNjkyIDE2LjA2M0wzOTkuMzg1LTI3OC41MzlxLTguNjE2IDguNjE1LTIwLjIzMSA4LjYxNS0xMS42MTUgMC0yMC4yMzEtOC42MTVMMTg0LjYxNi00NTIuODQ2cS02LjY5Mi02Ljc1OS02LjU3Ny0xNi4xNDkuMTE2LTkuMzg5IDcuMjQ1LTE2LjQ2NiA3LjEyOS02LjY5MiAxNi4zMDctNi42OTIgOS4xNzggMCAxNi4yNTUgNi42OTJsMTYxLjMwOCAxNjIuMzA4WiIvPjwvc3ZnPg==';
15
- return /*#__PURE__*/React.createElement(BaseMessage, _extends({
16
- type: "success",
17
- ariaLabel: texts[locale].success.ariaLabel,
18
- icon: /*#__PURE__*/React.createElement(Icon, {
19
- fileUrl: checkIcon,
20
- size: "xl"
21
- })
22
- }, rest));
23
- };
24
- SuccessMessage.propTypes = {
25
- /** The content of the message box */
26
- children: node,
27
- /** Any extra class names to the wrapping DOM node */
28
- className: string,
29
- /** The icon to show. Has a default value, but can be overridden */
30
- icon: node,
31
- /** An optional title for the message */
32
- title: node,
33
- /** 'nb', 'nn', or 'en' */
34
- locale: oneOf(['en', 'nb', 'nn'])
25
+ import { BaseMessage } from './BaseMessage';
26
+ import { texts } from './texts';
27
+ export var SuccessMessage = function (_a) {
28
+ var _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, rest = __rest(_a, ["locale"]);
29
+ var checkIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Im0zNzkuMTU0LTMyMy4xNTMgMzYzLTM2My4zODVxNi43NTktNi4zMDcgMTYuMTQ4LTYuNSA5LjM5LS4xOTIgMTYuNDY3IDYuNTUzIDYuNjkyIDcuMTI5IDYuNjkyIDE2LjQ5OSAwIDkuMzcxLTYuNjkyIDE2LjA2M0wzOTkuMzg1LTI3OC41MzlxLTguNjE2IDguNjE1LTIwLjIzMSA4LjYxNS0xMS42MTUgMC0yMC4yMzEtOC42MTVMMTg0LjYxNi00NTIuODQ2cS02LjY5Mi02Ljc1OS02LjU3Ny0xNi4xNDkuMTE2LTkuMzg5IDcuMjQ1LTE2LjQ2NiA3LjEyOS02LjY5MiAxNi4zMDctNi42OTIgOS4xNzggMCAxNi4yNTUgNi42OTJsMTYxLjMwOCAxNjIuMzA4WiIvPjwvc3ZnPg==';
30
+ return (React.createElement(BaseMessage, __assign({ type: "success", ariaLabel: texts[locale].success.ariaLabel, icon: React.createElement(Icon, { fileUrl: checkIcon, size: "xl" }) }, rest)));
35
31
  };
36
- export default SuccessMessage;
package/es/TipsMessage.js CHANGED
@@ -1,36 +1,31 @@
1
- var _excluded = ["locale"];
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 = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
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 { node, oneOf, string } from 'prop-types';
7
24
  import { Icon } from '@sb1/ffe-icons-react';
8
- import BaseMessage from './BaseMessage';
9
- import texts from './texts';
10
- var TipsMessage = function TipsMessage(props) {
11
- var _props$locale = props.locale,
12
- locale = _props$locale === void 0 ? 'nb' : _props$locale,
13
- rest = _objectWithoutProperties(props, _excluded);
14
- var lightbulbIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00ODAtOTYuOTI0cS0zMC45MjMgMC01My4wNzctMjEtMjIuMTUzLTIxLTIzLjY5Mi01MS45MjNoMTUzLjUzOHEtMS41MzkgMzAuOTIzLTIzLjY5MiA1MS45MjMtMjIuMTU0IDIxLTUzLjA3NyAyMVpNMzUxLjA3Ny0yNDEuNDYzcS05LjY2MyAwLTE2LjE3Ny02LjU2Ny02LjUxNS02LjU2Ni02LjUxNS0xNi4zMDd0Ni41MTUtMTYuMTI1cTYuNTE0LTYuMzg0IDE2LjE3Ny02LjM4NGgyNTcuODQ2cTkuNjYzIDAgMTYuMTc3IDYuNTY2IDYuNTE1IDYuNTY3IDYuNTE1IDE2LjMwOCAwIDkuNzQtNi41MTUgMTYuMTI1LTYuNTE0IDYuMzg0LTE2LjE3NyA2LjM4NEgzNTEuMDc3Wm0tMTkuOTk5LTExNnEtNjAuNjE1LTQwLjY5Mi05NS44NDYtMTAwLjM4NHQtMzUuMjMxLTEzNC41MzdxMC0xMTQuNjkyIDgyLjY1NC0xOTcuMzQ1UTM2NS4zMDgtODcyLjM4MyA0ODAtODcyLjM4M3QxOTcuMzQ1IDgyLjY1NHE4Mi42NTQgODIuNjUzIDgyLjY1NCAxOTcuMzQ1IDAgNzQuODQ1LTM0LjkyMyAxMzQuNTM3LTM0LjkyMyA1OS42OTItOTYuMTU0IDEwMC4zODRIMzMxLjA3OFptMTYuMjMtNDUuMzgzaDI2NS43NzFxNDcuNDU5LTMyIDc0LjQ5OC04Mi4wMjkgMjcuMDM4LTUwLjAyOSAyNy4wMzgtMTA3LjUwOSAwLTk3LjA3Ny02OC43NjktMTY1Ljg0NlQ0ODAtODI2Ljk5OXEtOTcuMDc3IDAtMTY1Ljg0NiA2OC43NjlUMjQ1LjM4NS01OTIuNHEwIDU3LjYwNSAyNy4wMzggMTA3LjU3OSAyNy4wMzkgNDkuOTc1IDc0Ljg4NSA4MS45NzVabTEzMi42OTIgMFoiLz48L3N2Zz4=';
15
- return /*#__PURE__*/React.createElement(BaseMessage, _extends({
16
- type: "tips",
17
- ariaLabel: texts[locale].tip.ariaLabel,
18
- icon: /*#__PURE__*/React.createElement(Icon, {
19
- fileUrl: lightbulbIcon,
20
- size: "xl"
21
- })
22
- }, rest));
23
- };
24
- TipsMessage.propTypes = {
25
- /** The content of the message box */
26
- children: node,
27
- /** Any extra class names to the wrapping DOM node */
28
- className: string,
29
- /** The icon to show. Has a default value, but can be overridden */
30
- icon: node,
31
- /** An optional title for the message */
32
- title: node,
33
- /** 'nb', 'nn', or 'en' */
34
- locale: oneOf(['en', 'nb', 'nn'])
25
+ import { BaseMessage } from './BaseMessage';
26
+ import { texts } from './texts';
27
+ export var TipsMessage = function (_a) {
28
+ var _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, rest = __rest(_a, ["locale"]);
29
+ var lightbulbIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik00ODAtOTYuOTI0cS0zMC45MjMgMC01My4wNzctMjEtMjIuMTUzLTIxLTIzLjY5Mi01MS45MjNoMTUzLjUzOHEtMS41MzkgMzAuOTIzLTIzLjY5MiA1MS45MjMtMjIuMTU0IDIxLTUzLjA3NyAyMVpNMzUxLjA3Ny0yNDEuNDYzcS05LjY2MyAwLTE2LjE3Ny02LjU2Ny02LjUxNS02LjU2Ni02LjUxNS0xNi4zMDd0Ni41MTUtMTYuMTI1cTYuNTE0LTYuMzg0IDE2LjE3Ny02LjM4NGgyNTcuODQ2cTkuNjYzIDAgMTYuMTc3IDYuNTY2IDYuNTE1IDYuNTY3IDYuNTE1IDE2LjMwOCAwIDkuNzQtNi41MTUgMTYuMTI1LTYuNTE0IDYuMzg0LTE2LjE3NyA2LjM4NEgzNTEuMDc3Wm0tMTkuOTk5LTExNnEtNjAuNjE1LTQwLjY5Mi05NS44NDYtMTAwLjM4NHQtMzUuMjMxLTEzNC41MzdxMC0xMTQuNjkyIDgyLjY1NC0xOTcuMzQ1UTM2NS4zMDgtODcyLjM4MyA0ODAtODcyLjM4M3QxOTcuMzQ1IDgyLjY1NHE4Mi42NTQgODIuNjUzIDgyLjY1NCAxOTcuMzQ1IDAgNzQuODQ1LTM0LjkyMyAxMzQuNTM3LTM0LjkyMyA1OS42OTItOTYuMTU0IDEwMC4zODRIMzMxLjA3OFptMTYuMjMtNDUuMzgzaDI2NS43NzFxNDcuNDU5LTMyIDc0LjQ5OC04Mi4wMjkgMjcuMDM4LTUwLjAyOSAyNy4wMzgtMTA3LjUwOSAwLTk3LjA3Ny02OC43NjktMTY1Ljg0NlQ0ODAtODI2Ljk5OXEtOTcuMDc3IDAtMTY1Ljg0NiA2OC43NjlUMjQ1LjM4NS01OTIuNHEwIDU3LjYwNSAyNy4wMzggMTA3LjU3OSAyNy4wMzkgNDkuOTc1IDc0Ljg4NSA4MS45NzVabTEzMi42OTIgMFoiLz48L3N2Zz4=';
30
+ return (React.createElement(BaseMessage, __assign({ type: "tips", ariaLabel: texts[locale].tip.ariaLabel, icon: React.createElement(Icon, { fileUrl: lightbulbIcon, size: "xl" }) }, rest)));
35
31
  };
36
- export default TipsMessage;
package/es/index.js CHANGED
@@ -1,6 +1,5 @@
1
- import SuccessMessage from './SuccessMessage';
2
- import ErrorMessage from './ErrorMessage';
3
- import InfoMessage from './InfoMessage';
4
- import TipsMessage from './TipsMessage';
5
- import { InfoMessageList, InfoMessageListItem } from './InfoMessageList';
6
- export { SuccessMessage, ErrorMessage, InfoMessage, TipsMessage, InfoMessageList, InfoMessageListItem };
1
+ export { SuccessMessage } from './SuccessMessage';
2
+ export { ErrorMessage } from './ErrorMessage';
3
+ export { InfoMessage } from './InfoMessage';
4
+ export { TipsMessage } from './TipsMessage';
5
+ export { InfoMessageList, InfoMessageListItem, } from './InfoMessageList';
package/es/texts.js CHANGED
@@ -1,47 +1,43 @@
1
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
- }
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
14
  };
15
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
- }
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
28
  };
29
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
- }
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
42
  };
43
- export default {
44
- nb: nb,
45
- nn: nn,
46
- en: en
47
- };
43
+ export var texts = { nb: nb, nn: nn, en: en };