@longline/aqua-ui 1.0.293 → 1.0.294

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.293",
3
+ "version": "1.0.294",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",
@@ -7,6 +7,10 @@ interface IToastContext {
7
7
  * properties can be provided.
8
8
  */
9
9
  toast: (content: React.ReactNode, options: IToastProps) => void;
10
+ /**
11
+ * Removes all toasts from the display.
12
+ */
13
+ clear: () => void;
10
14
  /**
11
15
  * List of toasts currently displayed.
12
16
  */
@@ -1,7 +1,3 @@
1
1
  import * as React from 'react';
2
- var ToastContext = React.createContext({
3
- toast: function () { },
4
- messages: {},
5
- remove: function () { }
6
- });
2
+ var ToastContext = React.createContext(null);
7
3
  export { ToastContext };
@@ -53,6 +53,12 @@ var ToastProvider = function (_a) {
53
53
  return __assign({}, messages);
54
54
  });
55
55
  };
56
+ /**
57
+ * Remove all current toasts.
58
+ */
59
+ var clear = function () {
60
+ setMessages({});
61
+ };
56
62
  /**
57
63
  * Remove a toast from the display list by key.
58
64
  */
@@ -62,7 +68,7 @@ var ToastProvider = function (_a) {
62
68
  return __assign({}, messages);
63
69
  });
64
70
  };
65
- return (React.createElement(ToastContext.Provider, { value: { toast: toast, messages: messages, remove: remove } }, props.children));
71
+ return (React.createElement(ToastContext.Provider, { value: { toast: toast, messages: messages, clear: clear, remove: remove } }, props.children));
66
72
  };
67
73
  ToastProvider.displayName = 'ToastProvider';
68
74
  export { ToastProvider };