@sb1/ffe-messages-react 1.1.7 → 2.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.
@@ -29,12 +29,11 @@ import { MessageCollapse } from './MessageCollapse';
29
29
  import { Content } from './Content';
30
30
  import { txt } from './texts';
31
31
  export var ContextMessage = function (_a) {
32
- var type = _a.type, className = _a.className, onColoredBg = _a.onColoredBg, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, header = _a.header, compact = _a.compact, closeButton = _a.closeButton, rest = __rest(_a, ["type", "className", "onColoredBg", "locale", "children", "onClose", "iconFileUrl", "header", "compact", "closeButton"]);
32
+ var type = _a.type, className = _a.className, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, header = _a.header, compact = _a.compact, closeButton = _a.closeButton, rest = __rest(_a, ["type", "className", "locale", "children", "onClose", "iconFileUrl", "header", "compact", "closeButton"]);
33
33
  var _c = useState(false), isClosed = _c[0], setIsClosed = _c[1];
34
34
  return (React.createElement(MessageCollapse, { isClosed: isClosed },
35
35
  React.createElement("div", __assign({ className: classNames("ffe-message", "ffe-message--context", "ffe-message--".concat(type), {
36
36
  'ffe-message--context-compact': compact,
37
- 'ffe-message--colored-bg': onColoredBg,
38
37
  }, className), role: type === 'error' ? 'alert' : 'group', "aria-label": txt[locale][type].ariaLabel }, rest),
39
38
  React.createElement("div", { className: "ffe-message__background" },
40
39
  React.createElement(MessageIcon, { iconFileUrl: iconFileUrl }),
package/es/MessageBox.js CHANGED
@@ -27,10 +27,8 @@ import classNames from 'classnames';
27
27
  import { Content } from './Content';
28
28
  import { txt } from './texts';
29
29
  export var MessageBox = function (_a) {
30
- var type = _a.type, header = _a.header, iconFileUrl = _a.iconFileUrl, children = _a.children, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, onColoredBg = _a.onColoredBg, className = _a.className, rest = __rest(_a, ["type", "header", "iconFileUrl", "children", "locale", "onColoredBg", "className"]);
31
- return (React.createElement("div", __assign({ className: classNames("ffe-message", "ffe-message--box", "ffe-message--".concat(type), {
32
- 'ffe-message--colored-bg': onColoredBg,
33
- }, className), role: type === 'error' ? 'alert' : 'group', "aria-label": txt[locale][type].ariaLabel }, rest),
30
+ var type = _a.type, header = _a.header, iconFileUrl = _a.iconFileUrl, children = _a.children, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, className = _a.className, rest = __rest(_a, ["type", "header", "iconFileUrl", "children", "locale", "className"]);
31
+ return (React.createElement("div", __assign({ className: classNames("ffe-message", "ffe-message--box", "ffe-message--".concat(type), className), role: type === 'error' ? 'alert' : 'group', "aria-label": txt[locale][type].ariaLabel }, rest),
34
32
  React.createElement("div", { className: "ffe-message__background" },
35
33
  React.createElement(Content, null,
36
34
  typeof header === 'string' ? (React.createElement(MessageHeader, { as: "h2" }, header)) : (header),
@@ -28,12 +28,10 @@ import { MessageCollapse } from './MessageCollapse';
28
28
  import { Content } from './Content';
29
29
  import { txt } from './texts';
30
30
  export var SystemMessage = function (_a) {
31
- var type = _a.type, className = _a.className, onColoredBg = _a.onColoredBg, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, rest = __rest(_a, ["type", "className", "onColoredBg", "locale", "children", "onClose", "iconFileUrl"]);
31
+ var type = _a.type, className = _a.className, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, rest = __rest(_a, ["type", "className", "locale", "children", "onClose", "iconFileUrl"]);
32
32
  var _c = useState(false), isClosed = _c[0], setIsClosed = _c[1];
33
33
  return (React.createElement(MessageCollapse, { isClosed: isClosed },
34
- React.createElement("div", __assign({ className: classNames("ffe-message", "ffe-message--system", "ffe-message--".concat(type), {
35
- 'ffe-message--colored-bg': onColoredBg,
36
- }, className), role: type === 'error' ? 'alert' : 'group', "aria-label": txt[locale][type].ariaLabel }, rest),
34
+ React.createElement("div", __assign({ className: classNames("ffe-message", "ffe-message--system", "ffe-message--".concat(type), className), role: type === 'error' ? 'alert' : 'group', "aria-label": txt[locale][type].ariaLabel }, rest),
37
35
  React.createElement("div", { className: "ffe-message__background" },
38
36
  React.createElement(MessageIcon, { iconFileUrl: iconFileUrl }),
39
37
  React.createElement(Content, null, children),
package/es/texts.js CHANGED
@@ -9,8 +9,8 @@ var nb = {
9
9
  success: {
10
10
  ariaLabel: 'Suksessmelding',
11
11
  },
12
- news: {
13
- ariaLabel: 'Nyhetsmelding',
12
+ warning: {
13
+ ariaLabel: 'Advarsel',
14
14
  },
15
15
  tips: {
16
16
  ariaLabel: 'Tipsmelding',
@@ -27,8 +27,8 @@ var nn = {
27
27
  success: {
28
28
  ariaLabel: 'Suksessmelding',
29
29
  },
30
- news: {
31
- ariaLabel: 'Nyheitsmelding',
30
+ warning: {
31
+ ariaLabel: 'Advarsel',
32
32
  },
33
33
  tips: {
34
34
  ariaLabel: 'Tipsmelding',
@@ -45,8 +45,8 @@ var en = {
45
45
  success: {
46
46
  ariaLabel: 'Success message',
47
47
  },
48
- news: {
49
- ariaLabel: 'News message',
48
+ warning: {
49
+ ariaLabel: 'Warning message',
50
50
  },
51
51
  tips: {
52
52
  ariaLabel: 'Tip Message',
@@ -68,12 +68,11 @@ var MessageCollapse_1 = require("./MessageCollapse");
68
68
  var Content_1 = require("./Content");
69
69
  var texts_1 = require("./texts");
70
70
  var ContextMessage = function (_a) {
71
- var type = _a.type, className = _a.className, onColoredBg = _a.onColoredBg, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, header = _a.header, compact = _a.compact, closeButton = _a.closeButton, rest = __rest(_a, ["type", "className", "onColoredBg", "locale", "children", "onClose", "iconFileUrl", "header", "compact", "closeButton"]);
71
+ var type = _a.type, className = _a.className, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, header = _a.header, compact = _a.compact, closeButton = _a.closeButton, rest = __rest(_a, ["type", "className", "locale", "children", "onClose", "iconFileUrl", "header", "compact", "closeButton"]);
72
72
  var _c = (0, react_1.useState)(false), isClosed = _c[0], setIsClosed = _c[1];
73
73
  return (react_1.default.createElement(MessageCollapse_1.MessageCollapse, { isClosed: isClosed },
74
74
  react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("ffe-message", "ffe-message--context", "ffe-message--".concat(type), {
75
75
  'ffe-message--context-compact': compact,
76
- 'ffe-message--colored-bg': onColoredBg,
77
76
  }, className), role: type === 'error' ? 'alert' : 'group', "aria-label": texts_1.txt[locale][type].ariaLabel }, rest),
78
77
  react_1.default.createElement("div", { className: "ffe-message__background" },
79
78
  react_1.default.createElement(MessageIcon_1.MessageIcon, { iconFileUrl: iconFileUrl }),
package/lib/MessageBox.js CHANGED
@@ -33,10 +33,8 @@ var classnames_1 = __importDefault(require("classnames"));
33
33
  var Content_1 = require("./Content");
34
34
  var texts_1 = require("./texts");
35
35
  var MessageBox = function (_a) {
36
- var type = _a.type, header = _a.header, iconFileUrl = _a.iconFileUrl, children = _a.children, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, onColoredBg = _a.onColoredBg, className = _a.className, rest = __rest(_a, ["type", "header", "iconFileUrl", "children", "locale", "onColoredBg", "className"]);
37
- return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("ffe-message", "ffe-message--box", "ffe-message--".concat(type), {
38
- 'ffe-message--colored-bg': onColoredBg,
39
- }, className), role: type === 'error' ? 'alert' : 'group', "aria-label": texts_1.txt[locale][type].ariaLabel }, rest),
36
+ var type = _a.type, header = _a.header, iconFileUrl = _a.iconFileUrl, children = _a.children, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, className = _a.className, rest = __rest(_a, ["type", "header", "iconFileUrl", "children", "locale", "className"]);
37
+ return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("ffe-message", "ffe-message--box", "ffe-message--".concat(type), className), role: type === 'error' ? 'alert' : 'group', "aria-label": texts_1.txt[locale][type].ariaLabel }, rest),
40
38
  react_1.default.createElement("div", { className: "ffe-message__background" },
41
39
  react_1.default.createElement(Content_1.Content, null,
42
40
  typeof header === 'string' ? (react_1.default.createElement(MessageHeader_1.MessageHeader, { as: "h2" }, header)) : (header),
@@ -67,12 +67,10 @@ var MessageCollapse_1 = require("./MessageCollapse");
67
67
  var Content_1 = require("./Content");
68
68
  var texts_1 = require("./texts");
69
69
  var SystemMessage = function (_a) {
70
- var type = _a.type, className = _a.className, onColoredBg = _a.onColoredBg, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, rest = __rest(_a, ["type", "className", "onColoredBg", "locale", "children", "onClose", "iconFileUrl"]);
70
+ var type = _a.type, className = _a.className, _b = _a.locale, locale = _b === void 0 ? 'nb' : _b, children = _a.children, onClose = _a.onClose, iconFileUrl = _a.iconFileUrl, rest = __rest(_a, ["type", "className", "locale", "children", "onClose", "iconFileUrl"]);
71
71
  var _c = (0, react_1.useState)(false), isClosed = _c[0], setIsClosed = _c[1];
72
72
  return (react_1.default.createElement(MessageCollapse_1.MessageCollapse, { isClosed: isClosed },
73
- react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("ffe-message", "ffe-message--system", "ffe-message--".concat(type), {
74
- 'ffe-message--colored-bg': onColoredBg,
75
- }, className), role: type === 'error' ? 'alert' : 'group', "aria-label": texts_1.txt[locale][type].ariaLabel }, rest),
73
+ react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)("ffe-message", "ffe-message--system", "ffe-message--".concat(type), className), role: type === 'error' ? 'alert' : 'group', "aria-label": texts_1.txt[locale][type].ariaLabel }, rest),
76
74
  react_1.default.createElement("div", { className: "ffe-message__background" },
77
75
  react_1.default.createElement(MessageIcon_1.MessageIcon, { iconFileUrl: iconFileUrl }),
78
76
  react_1.default.createElement(Content_1.Content, null, children),
package/lib/texts.js CHANGED
@@ -12,8 +12,8 @@ var nb = {
12
12
  success: {
13
13
  ariaLabel: 'Suksessmelding',
14
14
  },
15
- news: {
16
- ariaLabel: 'Nyhetsmelding',
15
+ warning: {
16
+ ariaLabel: 'Advarsel',
17
17
  },
18
18
  tips: {
19
19
  ariaLabel: 'Tipsmelding',
@@ -30,8 +30,8 @@ var nn = {
30
30
  success: {
31
31
  ariaLabel: 'Suksessmelding',
32
32
  },
33
- news: {
34
- ariaLabel: 'Nyheitsmelding',
33
+ warning: {
34
+ ariaLabel: 'Advarsel',
35
35
  },
36
36
  tips: {
37
37
  ariaLabel: 'Tipsmelding',
@@ -48,8 +48,8 @@ var en = {
48
48
  success: {
49
49
  ariaLabel: 'Success message',
50
50
  },
51
- news: {
52
- ariaLabel: 'News message',
51
+ warning: {
52
+ ariaLabel: 'Warning message',
53
53
  },
54
54
  tips: {
55
55
  ariaLabel: 'Tip Message',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-messages-react",
3
- "version": "1.1.7",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "author": "SpareBank 1",
6
6
  "files": [
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@sb1/ffe-icons-react": "^11.0.15",
29
- "@sb1/ffe-messages": "^1.2.2",
29
+ "@sb1/ffe-messages": "^2.0.0",
30
30
  "classnames": "^2.3.1"
31
31
  },
32
32
  "devDependencies": {
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "54845cf40835313b152b999c27dfbf9a8f602d3f"
44
+ "gitHead": "9f3d07c726368b31a79a15acbb545809c58ff413"
45
45
  }
@@ -8,14 +8,12 @@ export interface ContextMessageProps extends React.ComponentPropsWithoutRef<'div
8
8
  iconFileUrl?: string;
9
9
  /** Decides the language of the aria-label for the close icon */
10
10
  locale?: Locale;
11
- /** info, success, tips, news or error */
11
+ /** info, success, tips, warning or error */
12
12
  type: MessageType;
13
13
  /** Called when closed */
14
14
  onClose?: () => void;
15
15
  /** Show close button */
16
16
  closeButton?: boolean;
17
- /** Adds alternative styling for better contrast on certain backgrounds */
18
- onColoredBg?: boolean;
19
17
  /** The header */
20
18
  header?: React.ReactElement<MessageHeaderProps> | string;
21
19
  }
@@ -6,10 +6,8 @@ export interface MessageBoxProps extends React.ComponentPropsWithoutRef<'div'> {
6
6
  iconFileUrl?: string;
7
7
  /** The header */
8
8
  header?: React.ReactElement<MessageHeaderProps> | string;
9
- /** info, success, tips, news or error */
9
+ /** info, success, tips, warning or error */
10
10
  type: MessageType;
11
- /** Adds alternative styling for better contrast on certain backgrounds */
12
- onColoredBg?: boolean;
13
11
  /** Decides the language of the aria-label for the close icon */
14
12
  locale?: Locale;
15
13
  }
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
2
  import { MessageType, Locale } from './types';
3
3
  export interface SystemMessageProps extends React.ComponentPropsWithoutRef<'div'> {
4
- /** info, success, tips, news or error */
4
+ /** info, success, tips, warning or error */
5
5
  type: MessageType;
6
- /** Adds alternative styling for better contrast on certain backgrounds */
7
- onColoredBg?: boolean;
8
6
  /** url to svg icon to override default*/
9
7
  iconFileUrl?: string;
10
8
  /** nn, nb or en */
package/types/texts.d.ts CHANGED
@@ -10,8 +10,8 @@ export declare const txt: {
10
10
  readonly success: {
11
11
  readonly ariaLabel: "Suksessmelding";
12
12
  };
13
- readonly news: {
14
- readonly ariaLabel: "Nyhetsmelding";
13
+ readonly warning: {
14
+ readonly ariaLabel: "Advarsel";
15
15
  };
16
16
  readonly tips: {
17
17
  readonly ariaLabel: "Tipsmelding";
@@ -28,8 +28,8 @@ export declare const txt: {
28
28
  readonly success: {
29
29
  readonly ariaLabel: "Suksessmelding";
30
30
  };
31
- readonly news: {
32
- readonly ariaLabel: "Nyheitsmelding";
31
+ readonly warning: {
32
+ readonly ariaLabel: "Advarsel";
33
33
  };
34
34
  readonly tips: {
35
35
  readonly ariaLabel: "Tipsmelding";
@@ -46,8 +46,8 @@ export declare const txt: {
46
46
  readonly success: {
47
47
  readonly ariaLabel: "Success message";
48
48
  };
49
- readonly news: {
50
- readonly ariaLabel: "News message";
49
+ readonly warning: {
50
+ readonly ariaLabel: "Warning message";
51
51
  };
52
52
  readonly tips: {
53
53
  readonly ariaLabel: "Tip Message";
package/types/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ElementType } from 'react';
2
- export type MessageType = 'info' | 'error' | 'success' | 'tips' | 'news';
2
+ export type MessageType = 'info' | 'error' | 'success' | 'tips' | 'warning';
3
3
  export type Locale = 'nb' | 'nn' | 'en';
4
4
  export type DistributiveOmit<T, Omitted extends PropertyKey> = T extends any ? Omit<T, Omitted> : never;
5
5
  export type ComponentWithoutRefAsPropParams<As extends ElementType = any> = {