@canonical/react-components 2.3.0 → 2.4.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.
Files changed (27) hide show
  1. package/dist/components/EventQueue/EventQueue.d.ts +51 -0
  2. package/dist/components/EventQueue/EventQueue.js +74 -0
  3. package/dist/components/EventQueue/EventQueueProvider.test.d.ts +1 -0
  4. package/dist/components/EventQueue/index.d.ts +2 -0
  5. package/dist/components/EventQueue/index.js +12 -0
  6. package/dist/components/Notifications/ToastNotification/Animate.js +1 -0
  7. package/dist/components/Notifications/ToastNotification/Toast.scss +10 -19
  8. package/dist/components/Notifications/ToastNotification/ToastNotification.stories.js +1 -0
  9. package/dist/components/Notifications/ToastNotification/ToastNotificationList.d.ts +1 -1
  10. package/dist/components/Notifications/ToastNotification/ToastNotificationList.js +2 -2
  11. package/dist/components/Notifications/ToastNotification/ToastNotificationProvider.js +1 -0
  12. package/dist/esm/components/EventQueue/EventQueue.d.ts +51 -0
  13. package/dist/esm/components/EventQueue/EventQueue.js +67 -0
  14. package/dist/esm/components/EventQueue/EventQueueProvider.test.d.ts +1 -0
  15. package/dist/esm/components/EventQueue/index.d.ts +2 -0
  16. package/dist/esm/components/EventQueue/index.js +1 -0
  17. package/dist/esm/components/Notifications/ToastNotification/Animate.js +1 -0
  18. package/dist/esm/components/Notifications/ToastNotification/Toast.scss +10 -19
  19. package/dist/esm/components/Notifications/ToastNotification/ToastNotification.stories.js +1 -0
  20. package/dist/esm/components/Notifications/ToastNotification/ToastNotificationList.d.ts +1 -1
  21. package/dist/esm/components/Notifications/ToastNotification/ToastNotificationList.js +2 -2
  22. package/dist/esm/components/Notifications/ToastNotification/ToastNotificationProvider.js +1 -0
  23. package/dist/esm/index.d.ts +2 -0
  24. package/dist/esm/index.js +1 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.js +8 -0
  27. package/package.json +1 -1
@@ -0,0 +1,51 @@
1
+ import { FC, ReactNode } from "react";
2
+ import React from "react";
3
+ export interface EventCallback<T> {
4
+ onSuccess: (event: T) => void;
5
+ onFailure: (msg: string) => void;
6
+ onFinish?: () => void;
7
+ }
8
+ export interface EventQueue<T> {
9
+ get: (operationId: string) => EventCallback<T> | undefined;
10
+ set: (operationId: string, onSuccess: (event: T) => void, onFailure: (msg: string) => void, onFinish?: () => void) => void;
11
+ remove: (operationId: string) => void;
12
+ }
13
+ /**
14
+ * This provides an event queue system for managing callbacks associated with
15
+ * asynchronous operations (e.g., API calls) in an application.
16
+ *
17
+ * It allows components to register success, failure,
18
+ * and optional finish handlers for a given operation ID, and later retrieve or remove them.
19
+ *
20
+ * This is useful for handling side effects when dealing
21
+ * with multiple operations that need to be tracked and updated independently.
22
+ *
23
+ * The `createEventQueue` function should be used to create a single provider and context that are shared throughout your application.
24
+ * The returned `EventQueueProvider` and `useEventQueue` hook should be exported
25
+ * from a shared module and reused across the app to ensure a single
26
+ * context instance is used.
27
+ *
28
+ * Usage pattern:
29
+ * // eventQueue.ts
30
+ * export const { EventQueueProvider, useEventQueue } = createEventQueue<EventType>();
31
+ *
32
+ * // App.tsx
33
+ * import { EventQueueProvider } from "./eventQueue";
34
+ * ...
35
+ * <EventQueueProvider>
36
+ * <App />
37
+ * </EventQueueProvider>
38
+ *
39
+ * // In any other component
40
+ * import { useEventQueue } from "./eventQueue";
41
+ * ...
42
+ * const eventQueue = useEventQueue();
43
+ * eventQueue.set(operationId, onSuccess, onFailure);
44
+ */
45
+ export declare function createEventQueue<T>(): {
46
+ EventQueueProvider: FC<{
47
+ children: ReactNode;
48
+ }>;
49
+ useEventQueue: () => EventQueue<T>;
50
+ EventQueueContext: React.Context<EventQueue<T>>;
51
+ };
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createEventQueue = createEventQueue;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ /**
11
+ * This provides an event queue system for managing callbacks associated with
12
+ * asynchronous operations (e.g., API calls) in an application.
13
+ *
14
+ * It allows components to register success, failure,
15
+ * and optional finish handlers for a given operation ID, and later retrieve or remove them.
16
+ *
17
+ * This is useful for handling side effects when dealing
18
+ * with multiple operations that need to be tracked and updated independently.
19
+ *
20
+ * The `createEventQueue` function should be used to create a single provider and context that are shared throughout your application.
21
+ * The returned `EventQueueProvider` and `useEventQueue` hook should be exported
22
+ * from a shared module and reused across the app to ensure a single
23
+ * context instance is used.
24
+ *
25
+ * Usage pattern:
26
+ * // eventQueue.ts
27
+ * export const { EventQueueProvider, useEventQueue } = createEventQueue<EventType>();
28
+ *
29
+ * // App.tsx
30
+ * import { EventQueueProvider } from "./eventQueue";
31
+ * ...
32
+ * <EventQueueProvider>
33
+ * <App />
34
+ * </EventQueueProvider>
35
+ *
36
+ * // In any other component
37
+ * import { useEventQueue } from "./eventQueue";
38
+ * ...
39
+ * const eventQueue = useEventQueue();
40
+ * eventQueue.set(operationId, onSuccess, onFailure);
41
+ */
42
+
43
+ function createEventQueue() {
44
+ const EventQueueContext = /*#__PURE__*/(0, _react.createContext)(undefined);
45
+ const eventQueue = new Map();
46
+ const EventQueueProvider = _ref => {
47
+ let {
48
+ children
49
+ } = _ref;
50
+ return /*#__PURE__*/_react.default.createElement(EventQueueContext.Provider, {
51
+ value: {
52
+ get: operationId => eventQueue.get(operationId),
53
+ set: (operationId, onSuccess, onFailure, onFinish) => eventQueue.set(operationId, {
54
+ onSuccess,
55
+ onFailure,
56
+ onFinish
57
+ }),
58
+ remove: operationId => eventQueue.delete(operationId)
59
+ }
60
+ }, children);
61
+ };
62
+ const useEventQueue = () => {
63
+ const context = (0, _react.useContext)(EventQueueContext);
64
+ if (!context) {
65
+ throw new Error("useEventQueue must be used within an EventQueueProvider");
66
+ }
67
+ return context;
68
+ };
69
+ return {
70
+ EventQueueProvider,
71
+ useEventQueue,
72
+ EventQueueContext
73
+ };
74
+ }
@@ -0,0 +1,2 @@
1
+ export { createEventQueue } from "./EventQueue";
2
+ export type { EventCallback, EventQueue } from "./EventQueue";
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "createEventQueue", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _EventQueue.createEventQueue;
10
+ }
11
+ });
12
+ var _EventQueue = require("./EventQueue");
@@ -46,6 +46,7 @@ const Animate = _ref => {
46
46
  element.style.display = "none";
47
47
  };
48
48
  }
49
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
50
  }, [show, removeState]);
50
51
  if (removeState) {
51
52
  return null;
@@ -1,6 +1,3 @@
1
- @import "vanilla-framework/scss/settings";
2
- @import "vanilla-framework/scss/build";
3
-
4
1
  .toast-animate {
5
2
  position: relative;
6
3
  z-index: 101;
@@ -13,21 +10,21 @@
13
10
  position: absolute;
14
11
  right: 0;
15
12
 
16
- @media screen and (min-width: $breakpoint-small) and (max-width: $breakpoint-large) {
13
+ @media screen and (min-width: 620px) and (max-width: 1036px) {
17
14
  width: 500px;
18
15
  }
19
16
 
20
- @media screen and (min-width: $breakpoint-large) {
17
+ @media screen and (min-width: 1036px) {
21
18
  width: 600px;
22
19
  }
23
20
  }
24
21
 
25
22
  .toast-notification {
26
- box-shadow: 0 0 calc($sp-unit * 4) $sp-unit rgb(0 0 0 / 15%);
23
+ box-shadow: 0 0 2rem 0.5rem rgb(0 0 0 / 15%);
27
24
  overflow: hidden;
28
25
  z-index: 101;
29
26
 
30
- @media screen and (max-width: $breakpoint-small) {
27
+ @media screen and (max-width: 620px) {
31
28
  left: 0;
32
29
  margin: 1.5rem auto;
33
30
  max-width: 400px;
@@ -37,7 +34,7 @@
37
34
 
38
35
  .toast-notification-list {
39
36
  background-color: white;
40
- box-shadow: 0 0 calc($sp-unit * 4) $sp-unit rgb(0 0 0 / 22%);
37
+ box-shadow: 0 0 2rem 0.5rem rgb(0 0 0 / 22%);
41
38
  max-height: calc(100vh - 4.5rem);
42
39
  overflow: auto;
43
40
  padding: 0 0.5rem;
@@ -66,7 +63,7 @@
66
63
  .dismiss-text {
67
64
  align-items: center;
68
65
  display: flex;
69
- gap: $sph--x-small;
66
+ gap: 0.25rem;
70
67
  }
71
68
  }
72
69
 
@@ -77,9 +74,9 @@
77
74
  align-items: center;
78
75
  border: none;
79
76
  display: flex;
80
- gap: $sph--x-small;
77
+ gap: 0.25rem;
81
78
  justify-content: center;
82
- margin-right: $sph--small !important;
79
+ margin-right: 0.5rem !important;
83
80
  padding: calc(0.4rem - 1px);
84
81
 
85
82
  /* stylelint-disable max-nesting-depth */
@@ -88,17 +85,11 @@
88
85
  padding: 0;
89
86
  text-align: center;
90
87
  }
91
-
92
- /* stylelint-disable-next-line selector-class-pattern */
93
- .p-icon--info--notification {
94
- @extend %icon;
95
- @include vf-icon-info-coloured-themed;
96
- }
97
88
  /* stylelint-enable max-nesting-depth */
98
89
  }
99
90
  }
100
91
 
101
- @media screen and (max-width: $breakpoint-small) {
92
+ @media screen and (max-width: 620px) {
102
93
  align-items: flex-start;
103
94
  flex-direction: column;
104
95
  gap: 0.5rem;
@@ -106,7 +97,7 @@
106
97
  }
107
98
  }
108
99
 
109
- @media screen and (max-width: $breakpoint-small) {
100
+ @media screen and (max-width: 620px) {
110
101
  bottom: 2rem;
111
102
  left: 0;
112
103
  margin: 1.5rem auto;
@@ -35,6 +35,7 @@ const PreloadedList = () => {
35
35
  toastNotify.info("Your changes are syncing in the background");
36
36
  toastNotify.failure("Save failed", new Error("500 Internal Server Error"), "Please try again.");
37
37
  toastNotify.toggleListView();
38
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38
39
  }, []);
39
40
  return /*#__PURE__*/_react.default.createElement("div", {
40
41
  style: {
@@ -7,7 +7,7 @@ export type FilterTypes = ValueOf<typeof NotificationSeverity>;
7
7
  export declare const severityOrder: readonly ["positive", "caution", "negative", "information"];
8
8
  export declare const iconLookup: {
9
9
  readonly positive: "success";
10
- readonly information: "info--notification";
10
+ readonly information: "information";
11
11
  readonly caution: "warning";
12
12
  readonly negative: "error";
13
13
  };
@@ -20,8 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  const severityOrder = exports.severityOrder = ["positive", "caution", "negative", "information"];
21
21
  const iconLookup = exports.iconLookup = {
22
22
  positive: _Icon.ICONS.success,
23
- // custom name for info icon to override default color from vanilla
24
- information: "info--notification",
23
+ information: _Icon.ICONS.information,
25
24
  caution: _Icon.ICONS.warning,
26
25
  negative: _Icon.ICONS.error
27
26
  };
@@ -39,6 +38,7 @@ const ToastNotificationList = _ref => {
39
38
  const preferReducedMotion = (0, _hooks.usePrefersReducedMotion)();
40
39
  (0, _react.useLayoutEffect)(() => {
41
40
  adjustScrollPosition();
41
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42
42
  }, [notifications]);
43
43
 
44
44
  // this layout effect is used to maintain scroll position of the
@@ -103,6 +103,7 @@ const ToastNotificationProvider = _ref => {
103
103
  clearTimeout(notificationTimer);
104
104
  }
105
105
  };
106
+ // eslint-disable-next-line react-hooks/exhaustive-deps
106
107
  }, []);
107
108
  const showNotificationWithDelay = () => {
108
109
  setNotificationTimer(prevTimer => {
@@ -0,0 +1,51 @@
1
+ import { FC, ReactNode } from "react";
2
+ import React from "react";
3
+ export interface EventCallback<T> {
4
+ onSuccess: (event: T) => void;
5
+ onFailure: (msg: string) => void;
6
+ onFinish?: () => void;
7
+ }
8
+ export interface EventQueue<T> {
9
+ get: (operationId: string) => EventCallback<T> | undefined;
10
+ set: (operationId: string, onSuccess: (event: T) => void, onFailure: (msg: string) => void, onFinish?: () => void) => void;
11
+ remove: (operationId: string) => void;
12
+ }
13
+ /**
14
+ * This provides an event queue system for managing callbacks associated with
15
+ * asynchronous operations (e.g., API calls) in an application.
16
+ *
17
+ * It allows components to register success, failure,
18
+ * and optional finish handlers for a given operation ID, and later retrieve or remove them.
19
+ *
20
+ * This is useful for handling side effects when dealing
21
+ * with multiple operations that need to be tracked and updated independently.
22
+ *
23
+ * The `createEventQueue` function should be used to create a single provider and context that are shared throughout your application.
24
+ * The returned `EventQueueProvider` and `useEventQueue` hook should be exported
25
+ * from a shared module and reused across the app to ensure a single
26
+ * context instance is used.
27
+ *
28
+ * Usage pattern:
29
+ * // eventQueue.ts
30
+ * export const { EventQueueProvider, useEventQueue } = createEventQueue<EventType>();
31
+ *
32
+ * // App.tsx
33
+ * import { EventQueueProvider } from "./eventQueue";
34
+ * ...
35
+ * <EventQueueProvider>
36
+ * <App />
37
+ * </EventQueueProvider>
38
+ *
39
+ * // In any other component
40
+ * import { useEventQueue } from "./eventQueue";
41
+ * ...
42
+ * const eventQueue = useEventQueue();
43
+ * eventQueue.set(operationId, onSuccess, onFailure);
44
+ */
45
+ export declare function createEventQueue<T>(): {
46
+ EventQueueProvider: FC<{
47
+ children: ReactNode;
48
+ }>;
49
+ useEventQueue: () => EventQueue<T>;
50
+ EventQueueContext: React.Context<EventQueue<T>>;
51
+ };
@@ -0,0 +1,67 @@
1
+ import { createContext, useContext } from "react";
2
+ import React from "react";
3
+ /**
4
+ * This provides an event queue system for managing callbacks associated with
5
+ * asynchronous operations (e.g., API calls) in an application.
6
+ *
7
+ * It allows components to register success, failure,
8
+ * and optional finish handlers for a given operation ID, and later retrieve or remove them.
9
+ *
10
+ * This is useful for handling side effects when dealing
11
+ * with multiple operations that need to be tracked and updated independently.
12
+ *
13
+ * The `createEventQueue` function should be used to create a single provider and context that are shared throughout your application.
14
+ * The returned `EventQueueProvider` and `useEventQueue` hook should be exported
15
+ * from a shared module and reused across the app to ensure a single
16
+ * context instance is used.
17
+ *
18
+ * Usage pattern:
19
+ * // eventQueue.ts
20
+ * export const { EventQueueProvider, useEventQueue } = createEventQueue<EventType>();
21
+ *
22
+ * // App.tsx
23
+ * import { EventQueueProvider } from "./eventQueue";
24
+ * ...
25
+ * <EventQueueProvider>
26
+ * <App />
27
+ * </EventQueueProvider>
28
+ *
29
+ * // In any other component
30
+ * import { useEventQueue } from "./eventQueue";
31
+ * ...
32
+ * const eventQueue = useEventQueue();
33
+ * eventQueue.set(operationId, onSuccess, onFailure);
34
+ */
35
+
36
+ export function createEventQueue() {
37
+ var EventQueueContext = /*#__PURE__*/createContext(undefined);
38
+ var eventQueue = new Map();
39
+ var EventQueueProvider = _ref => {
40
+ var {
41
+ children
42
+ } = _ref;
43
+ return /*#__PURE__*/React.createElement(EventQueueContext.Provider, {
44
+ value: {
45
+ get: operationId => eventQueue.get(operationId),
46
+ set: (operationId, onSuccess, onFailure, onFinish) => eventQueue.set(operationId, {
47
+ onSuccess,
48
+ onFailure,
49
+ onFinish
50
+ }),
51
+ remove: operationId => eventQueue.delete(operationId)
52
+ }
53
+ }, children);
54
+ };
55
+ var useEventQueue = () => {
56
+ var context = useContext(EventQueueContext);
57
+ if (!context) {
58
+ throw new Error("useEventQueue must be used within an EventQueueProvider");
59
+ }
60
+ return context;
61
+ };
62
+ return {
63
+ EventQueueProvider,
64
+ useEventQueue,
65
+ EventQueueContext
66
+ };
67
+ }
@@ -0,0 +1,2 @@
1
+ export { createEventQueue } from "./EventQueue";
2
+ export type { EventCallback, EventQueue } from "./EventQueue";
@@ -0,0 +1 @@
1
+ export { createEventQueue } from "./EventQueue";
@@ -39,6 +39,7 @@ var Animate = _ref => {
39
39
  element.style.display = "none";
40
40
  };
41
41
  }
42
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42
43
  }, [show, removeState]);
43
44
  if (removeState) {
44
45
  return null;
@@ -1,6 +1,3 @@
1
- @import "vanilla-framework/scss/settings";
2
- @import "vanilla-framework/scss/build";
3
-
4
1
  .toast-animate {
5
2
  position: relative;
6
3
  z-index: 101;
@@ -13,21 +10,21 @@
13
10
  position: absolute;
14
11
  right: 0;
15
12
 
16
- @media screen and (min-width: $breakpoint-small) and (max-width: $breakpoint-large) {
13
+ @media screen and (min-width: 620px) and (max-width: 1036px) {
17
14
  width: 500px;
18
15
  }
19
16
 
20
- @media screen and (min-width: $breakpoint-large) {
17
+ @media screen and (min-width: 1036px) {
21
18
  width: 600px;
22
19
  }
23
20
  }
24
21
 
25
22
  .toast-notification {
26
- box-shadow: 0 0 calc($sp-unit * 4) $sp-unit rgb(0 0 0 / 15%);
23
+ box-shadow: 0 0 2rem 0.5rem rgb(0 0 0 / 15%);
27
24
  overflow: hidden;
28
25
  z-index: 101;
29
26
 
30
- @media screen and (max-width: $breakpoint-small) {
27
+ @media screen and (max-width: 620px) {
31
28
  left: 0;
32
29
  margin: 1.5rem auto;
33
30
  max-width: 400px;
@@ -37,7 +34,7 @@
37
34
 
38
35
  .toast-notification-list {
39
36
  background-color: white;
40
- box-shadow: 0 0 calc($sp-unit * 4) $sp-unit rgb(0 0 0 / 22%);
37
+ box-shadow: 0 0 2rem 0.5rem rgb(0 0 0 / 22%);
41
38
  max-height: calc(100vh - 4.5rem);
42
39
  overflow: auto;
43
40
  padding: 0 0.5rem;
@@ -66,7 +63,7 @@
66
63
  .dismiss-text {
67
64
  align-items: center;
68
65
  display: flex;
69
- gap: $sph--x-small;
66
+ gap: 0.25rem;
70
67
  }
71
68
  }
72
69
 
@@ -77,9 +74,9 @@
77
74
  align-items: center;
78
75
  border: none;
79
76
  display: flex;
80
- gap: $sph--x-small;
77
+ gap: 0.25rem;
81
78
  justify-content: center;
82
- margin-right: $sph--small !important;
79
+ margin-right: 0.5rem !important;
83
80
  padding: calc(0.4rem - 1px);
84
81
 
85
82
  /* stylelint-disable max-nesting-depth */
@@ -88,17 +85,11 @@
88
85
  padding: 0;
89
86
  text-align: center;
90
87
  }
91
-
92
- /* stylelint-disable-next-line selector-class-pattern */
93
- .p-icon--info--notification {
94
- @extend %icon;
95
- @include vf-icon-info-coloured-themed;
96
- }
97
88
  /* stylelint-enable max-nesting-depth */
98
89
  }
99
90
  }
100
91
 
101
- @media screen and (max-width: $breakpoint-small) {
92
+ @media screen and (max-width: 620px) {
102
93
  align-items: flex-start;
103
94
  flex-direction: column;
104
95
  gap: 0.5rem;
@@ -106,7 +97,7 @@
106
97
  }
107
98
  }
108
99
 
109
- @media screen and (max-width: $breakpoint-small) {
100
+ @media screen and (max-width: 620px) {
110
101
  bottom: 2rem;
111
102
  left: 0;
112
103
  margin: 1.5rem auto;
@@ -26,6 +26,7 @@ var PreloadedList = () => {
26
26
  toastNotify.info("Your changes are syncing in the background");
27
27
  toastNotify.failure("Save failed", new Error("500 Internal Server Error"), "Please try again.");
28
28
  toastNotify.toggleListView();
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
30
  }, []);
30
31
  return /*#__PURE__*/React.createElement("div", {
31
32
  style: {
@@ -7,7 +7,7 @@ export type FilterTypes = ValueOf<typeof NotificationSeverity>;
7
7
  export declare const severityOrder: readonly ["positive", "caution", "negative", "information"];
8
8
  export declare const iconLookup: {
9
9
  readonly positive: "success";
10
- readonly information: "info--notification";
10
+ readonly information: "information";
11
11
  readonly caution: "warning";
12
12
  readonly negative: "error";
13
13
  };
@@ -13,8 +13,7 @@ import "./Toast.scss";
13
13
  export var severityOrder = ["positive", "caution", "negative", "information"];
14
14
  export var iconLookup = {
15
15
  positive: ICONS.success,
16
- // custom name for info icon to override default color from vanilla
17
- information: "info--notification",
16
+ information: ICONS.information,
18
17
  caution: ICONS.warning,
19
18
  negative: ICONS.error
20
19
  };
@@ -32,6 +31,7 @@ var ToastNotificationList = _ref => {
32
31
  var preferReducedMotion = usePrefersReducedMotion();
33
32
  useLayoutEffect(() => {
34
33
  adjustScrollPosition();
34
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35
35
  }, [notifications]);
36
36
 
37
37
  // this layout effect is used to maintain scroll position of the
@@ -100,6 +100,7 @@ var ToastNotificationProvider = _ref => {
100
100
  clearTimeout(notificationTimer);
101
101
  }
102
102
  };
103
+ // eslint-disable-next-line react-hooks/exhaustive-deps
103
104
  }, []);
104
105
  var showNotificationWithDelay = () => {
105
106
  setNotificationTimer(prevTimer => {
@@ -21,6 +21,7 @@ export { default as ConfirmationModal } from "./components/ConfirmationModal";
21
21
  export { default as ContextualMenu } from "./components/ContextualMenu";
22
22
  export { default as DoughnutChart } from "./components/DoughnutChart";
23
23
  export { default as EmptyState } from "./components/EmptyState";
24
+ export { createEventQueue } from "./components/EventQueue";
24
25
  export { default as Field } from "./components/Field";
25
26
  export { default as Form } from "./components/Form";
26
27
  export { default as FormikField } from "./components/FormikField";
@@ -92,6 +93,7 @@ export type { ConfirmationModalProps } from "./components/ConfirmationModal";
92
93
  export type { ContextualMenuProps, ContextualMenuDropdownProps, MenuLink, Position, } from "./components/ContextualMenu";
93
94
  export type { DoughnutChartProps, Segment } from "./components/DoughnutChart";
94
95
  export type { EmptyStateProps } from "./components/EmptyState";
96
+ export type { EventCallback, EventQueue } from "./components/EventQueue";
95
97
  export type { FieldProps } from "./components/Field";
96
98
  export type { FormProps } from "./components/Form";
97
99
  export type { FormikFieldProps } from "./components/FormikField";
package/dist/esm/index.js CHANGED
@@ -21,6 +21,7 @@ export { default as ConfirmationModal } from "./components/ConfirmationModal";
21
21
  export { default as ContextualMenu } from "./components/ContextualMenu";
22
22
  export { default as DoughnutChart } from "./components/DoughnutChart";
23
23
  export { default as EmptyState } from "./components/EmptyState";
24
+ export { createEventQueue } from "./components/EventQueue";
24
25
  export { default as Field } from "./components/Field";
25
26
  export { default as Form } from "./components/Form";
26
27
  export { default as FormikField } from "./components/FormikField";
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { default as ConfirmationModal } from "./components/ConfirmationModal";
21
21
  export { default as ContextualMenu } from "./components/ContextualMenu";
22
22
  export { default as DoughnutChart } from "./components/DoughnutChart";
23
23
  export { default as EmptyState } from "./components/EmptyState";
24
+ export { createEventQueue } from "./components/EventQueue";
24
25
  export { default as Field } from "./components/Field";
25
26
  export { default as Form } from "./components/Form";
26
27
  export { default as FormikField } from "./components/FormikField";
@@ -92,6 +93,7 @@ export type { ConfirmationModalProps } from "./components/ConfirmationModal";
92
93
  export type { ContextualMenuProps, ContextualMenuDropdownProps, MenuLink, Position, } from "./components/ContextualMenu";
93
94
  export type { DoughnutChartProps, Segment } from "./components/DoughnutChart";
94
95
  export type { EmptyStateProps } from "./components/EmptyState";
96
+ export type { EventCallback, EventQueue } from "./components/EventQueue";
95
97
  export type { FieldProps } from "./components/Field";
96
98
  export type { FormProps } from "./components/Form";
97
99
  export type { FormikFieldProps } from "./components/FormikField";
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ var _exportNames = {
29
29
  ContextualMenu: true,
30
30
  DoughnutChart: true,
31
31
  EmptyState: true,
32
+ createEventQueue: true,
32
33
  Field: true,
33
34
  Form: true,
34
35
  FormikField: true,
@@ -584,6 +585,12 @@ Object.defineProperty(exports, "Tooltip", {
584
585
  return _Tooltip.default;
585
586
  }
586
587
  });
588
+ Object.defineProperty(exports, "createEventQueue", {
589
+ enumerable: true,
590
+ get: function () {
591
+ return _EventQueue.createEventQueue;
592
+ }
593
+ });
587
594
  Object.defineProperty(exports, "failure", {
588
595
  enumerable: true,
589
596
  get: function () {
@@ -721,6 +728,7 @@ var _ConfirmationModal = _interopRequireDefault(require("./components/Confirmati
721
728
  var _ContextualMenu = _interopRequireDefault(require("./components/ContextualMenu"));
722
729
  var _DoughnutChart = _interopRequireDefault(require("./components/DoughnutChart"));
723
730
  var _EmptyState = _interopRequireDefault(require("./components/EmptyState"));
731
+ var _EventQueue = require("./components/EventQueue");
724
732
  var _Field = _interopRequireDefault(require("./components/Field"));
725
733
  var _Form = _interopRequireDefault(require("./components/Form"));
726
734
  var _FormikField = _interopRequireDefault(require("./components/FormikField"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": {