@abyss-project/commons-front-core 16.2.0 → 17.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/CHANGELOG.md +6 -0
- package/catalog/pages/Toast.tsx +5 -5
- package/dist/components/layers/Toast/Toast.d.ts +3 -2
- package/dist/components/layers/Toast/toast-store.d.ts +11 -8
- package/dist/index.js +1542 -1537
- package/dist/legacy/components/Utils/index.d.ts +0 -1
- package/dist/legacy.js +2550 -2685
- package/package.json +3 -3
- package/dist/legacy/components/Utils/Toast/AbyssToast.component.d.ts +0 -9
- package/dist/legacy/components/Utils/Toast/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog — @abyss-project/commons-front-core
|
|
2
2
|
|
|
3
|
+
## 17.0.0
|
|
4
|
+
|
|
5
|
+
Breaking (card #286 M6): `AbyssToast` is removed from `./legacy`. Mount `ToastProvider` and call the core's `toast`. `react-toastify` stays a peer dependency while the satellites use it. A satellite that moves to 17.x without migrating keeps its react-toastify `ToastContainer` and only loses the `AbyssToast` styling.
|
|
6
|
+
|
|
7
|
+
- `@abyss-project/main` is resolved to 31.1.0 (P4b #783, workflows in AbyssFlow).
|
|
8
|
+
|
|
3
9
|
## 16.1.1
|
|
4
10
|
|
|
5
11
|
No export or signature changed (card #782).
|
package/catalog/pages/Toast.tsx
CHANGED
|
@@ -17,7 +17,7 @@ const TONE_LABELS: Record<ToastTone, string> = {
|
|
|
17
17
|
[ToastTone.Danger]: 'erreur',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
/** A progress notification, shown at 40 %: the page
|
|
20
|
+
/** A progress notification, shown at 40 %: a button of the page, apart from the four tones of the stack. */
|
|
21
21
|
const showProgress = () => {
|
|
22
22
|
const id = toast.progress('Envoi de 12 fichiers…');
|
|
23
23
|
toast.update(id, { progress: 0.4 });
|
|
@@ -59,14 +59,14 @@ const ToastDemo = () => {
|
|
|
59
59
|
[log],
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
-
//
|
|
62
|
+
// The four tones are shown on arrival, so the page shows the stack without a click; once, despite
|
|
63
|
+
// StrictMode. The progress is not: it would hold a place of the stack and push a tone out.
|
|
63
64
|
useEffect(() => {
|
|
64
65
|
if (shown.current) {
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
shown.current = true;
|
|
68
69
|
samples.forEach((sample) => toasts.show(sample));
|
|
69
|
-
showProgress();
|
|
70
70
|
}, [samples, toasts]);
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -92,9 +92,9 @@ export const ToastPage = () => (
|
|
|
92
92
|
<Showcase
|
|
93
93
|
family="Couches"
|
|
94
94
|
name="Toast"
|
|
95
|
-
description="Notification passagère en bas à droite, au-dessus du bandeau de cookies quand il est là : quatre tons, une action facultative, retenue au survol ou au focus, et une notification de progression."
|
|
95
|
+
description="Notification passagère en bas à droite, au-dessus du bandeau de cookies quand il est là : quatre tons, une action facultative, retenue au survol ou au focus, et une notification de progression à la demande."
|
|
96
96
|
>
|
|
97
|
-
<Example title="Les quatre tons, deux avec action
|
|
97
|
+
<Example title="Les quatre tons, deux avec action ; la progression se déclenche au bouton">
|
|
98
98
|
<ToastDemo />
|
|
99
99
|
</Example>
|
|
100
100
|
<LastEvent />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ToastApi } from './toast-store';
|
|
3
|
-
export { toast, ToastTone } from './toast-store';
|
|
3
|
+
export { toast, TOAST_LIMIT, ToastTone } from './toast-store';
|
|
4
4
|
export type { ToastAction, ToastApi, ToastCallOptions, ToastOptions, ToastProgressOptions, ToastUpdate, } from './toast-store';
|
|
5
5
|
export interface ToastProviderProps {
|
|
6
6
|
children: ReactNode;
|
|
@@ -12,7 +12,8 @@ export interface ToastProviderProps {
|
|
|
12
12
|
export declare const TOAST_DURATION = 5000;
|
|
13
13
|
/**
|
|
14
14
|
* Holds the toasts of the application and renders them in a live region at the bottom right (full
|
|
15
|
-
* width below `md`), on the `overlay` elevation
|
|
15
|
+
* width below `md`), on the `overlay` elevation, the most recent on top (first in the DOM too).
|
|
16
|
+
* Mount it once, inside the theme and the messages.
|
|
16
17
|
*/
|
|
17
18
|
export declare function ToastProvider({ children }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
/** Shows toasts from any component below a `ToastProvider`. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export declare enum ToastTone {
|
|
2
3
|
Success = "success",
|
|
3
4
|
Warning = "warning",
|
|
@@ -10,7 +11,7 @@ export interface ToastAction {
|
|
|
10
11
|
}
|
|
11
12
|
export interface ToastOptions {
|
|
12
13
|
tone: ToastTone;
|
|
13
|
-
message:
|
|
14
|
+
message: ReactNode;
|
|
14
15
|
action?: ToastAction;
|
|
15
16
|
}
|
|
16
17
|
/** Options of `toast.success`, `toast.error`, `toast.info` and `toast.warning`. */
|
|
@@ -27,7 +28,7 @@ export interface ToastProgressOptions {
|
|
|
27
28
|
export interface ToastUpdate {
|
|
28
29
|
/** A tone ends the progress: the notification then leaves like any other. */
|
|
29
30
|
tone?: ToastTone;
|
|
30
|
-
message?:
|
|
31
|
+
message?: ReactNode;
|
|
31
32
|
/** Between 0 and 1; shown while the notification has no final tone. */
|
|
32
33
|
progress?: number;
|
|
33
34
|
}
|
|
@@ -35,7 +36,7 @@ export interface ToastUpdate {
|
|
|
35
36
|
export interface ToastItem {
|
|
36
37
|
id: string;
|
|
37
38
|
tone: ToastTone;
|
|
38
|
-
message:
|
|
39
|
+
message: ReactNode;
|
|
39
40
|
action?: ToastAction;
|
|
40
41
|
durationMs?: number;
|
|
41
42
|
/** True for a progress notification that has not received its final tone yet. */
|
|
@@ -47,6 +48,8 @@ export interface ToastApi {
|
|
|
47
48
|
show(toast: ToastOptions): void;
|
|
48
49
|
}
|
|
49
50
|
type Listener = () => void;
|
|
51
|
+
/** Most notifications held at once; a new one beyond it pushes out the oldest one that is neither pending nor itself. */
|
|
52
|
+
export declare const TOAST_LIMIT = 4;
|
|
50
53
|
/**
|
|
51
54
|
* Store read by the mounted `ToastProvider`. Calls made before it mounts are kept and shown when
|
|
52
55
|
* it does.
|
|
@@ -62,12 +65,12 @@ export declare const toastStore: {
|
|
|
62
65
|
* mounted `ToastProvider`. Every call returns the id of its notification.
|
|
63
66
|
*/
|
|
64
67
|
export declare const toast: {
|
|
65
|
-
success: (message:
|
|
66
|
-
error: (message:
|
|
67
|
-
info: (message:
|
|
68
|
-
warning: (message:
|
|
68
|
+
success: (message: ReactNode, options?: ToastCallOptions) => string;
|
|
69
|
+
error: (message: ReactNode, options?: ToastCallOptions) => string;
|
|
70
|
+
info: (message: ReactNode, options?: ToastCallOptions) => string;
|
|
71
|
+
warning: (message: ReactNode, options?: ToastCallOptions) => string;
|
|
69
72
|
/** A persistent notification, ended with `toast.update(id, { tone })`. */
|
|
70
|
-
progress(message:
|
|
73
|
+
progress(message: ReactNode, options?: ToastProgressOptions): string;
|
|
71
74
|
/** Does nothing when the notification has already left. */
|
|
72
75
|
update(id: string, changes: ToastUpdate): void;
|
|
73
76
|
/** Removes one notification, or all of them without an id. */
|