@abyss-project/commons-front-core 16.1.1 → 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.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/catalog/pages/Toast.tsx +5 -5
  3. package/dist/components/data/FacetPanel/FacetPanel.d.ts +5 -0
  4. package/dist/components/editors/MarkdownEditor/MarkdownEditor.d.ts +6 -0
  5. package/dist/components/layers/Toast/Toast.d.ts +3 -2
  6. package/dist/components/layers/Toast/toast-store.d.ts +11 -8
  7. package/dist/{editors-C2rcatuM.js → editors-NTlXfUf3.js} +6328 -6308
  8. package/dist/editors.js +1 -1
  9. package/dist/hooks/index.d.ts +1 -0
  10. package/dist/hooks/use-optimistic-mutation.hook.d.ts +41 -0
  11. package/dist/hooks/use-optimistic-mutation.hook.spec.d.ts +1 -0
  12. package/dist/{index-BT4II8Xn.js → index-7ovesCC_.js} +2 -2
  13. package/dist/{index-vvVLoC4J.js → index-BEm81V4i.js} +3 -3
  14. package/dist/{index-Cv2nccBd.js → index-BH6GeV66.js} +2 -2
  15. package/dist/{index-N01-gzsR.js → index-BHFYCrDl.js} +4 -4
  16. package/dist/{index-Ds9SlbVU.js → index-BIQNTPCh.js} +2 -2
  17. package/dist/{index-PFLipTVz.js → index-BKbESj9f.js} +2 -2
  18. package/dist/{index-zLjfdiAC.js → index-Bt3EOSkY.js} +4 -4
  19. package/dist/{index-CNEoRNth.js → index-C-pVBVRm.js} +3 -3
  20. package/dist/{index-4Yy0aUgK.js → index-CHsTUwr0.js} +1 -1
  21. package/dist/{index-CY7TSo5q.js → index-D-75Bwy8.js} +2 -2
  22. package/dist/{index-Dc4AUxs3.js → index-DDsn4UyZ.js} +2 -2
  23. package/dist/{index-Dn53bUXz.js → index-DGKfXQr5.js} +2 -2
  24. package/dist/{index-BQDShLfx.js → index-DTfxCpd4.js} +4 -4
  25. package/dist/{index-3lv992-d.js → index-DXSxiqo1.js} +2 -2
  26. package/dist/{index-CwT2qdxO.js → index-DeB1ImKD.js} +2 -2
  27. package/dist/{index-CSuco3OH.js → index-DloK9ass.js} +2 -2
  28. package/dist/{index-CV-IfV6z.js → index-DmtNuZcU.js} +2 -2
  29. package/dist/{index-wZeZLKGl.js → index-Dr3sF4q3.js} +2 -2
  30. package/dist/{index-D0JsaNEm.js → index-MiIytQo8.js} +3 -3
  31. package/dist/{index-BFmuZ1fy.js → index-VntY82At.js} +2 -2
  32. package/dist/{index-DoXNSm4g.js → index-rHl9uQvG.js} +3 -3
  33. package/dist/index.js +3424 -3364
  34. package/dist/legacy/components/Utils/index.d.ts +0 -1
  35. package/dist/legacy.js +2550 -2685
  36. package/package.json +4 -3
  37. package/dist/legacy/components/Utils/Toast/AbyssToast.component.d.ts +0 -9
  38. 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).
@@ -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 shows it next to the four tones. */
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
- // Shown on arrival, so the page shows the stack without a click; once, despite StrictMode.
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, et une progression">
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 />
@@ -12,6 +12,11 @@ export interface Facet {
12
12
  loading: boolean;
13
13
  /** Why the values could not be read; shown in place of the list. */
14
14
  error?: string;
15
+ /**
16
+ * Why the facet has no value although the period holds rows (a field the lines do not carry):
17
+ * a sentence shown in place of the list, distinct from an empty period and from a failed read.
18
+ */
19
+ unavailable?: string;
15
20
  /** Reads the facet again; with it, a failed facet offers « Réessayer » under its cause. */
16
21
  onRetry?: () => void;
17
22
  }
@@ -21,6 +21,12 @@ export type MarkdownEditorHandle = {
21
21
  * read-only, lacks `enableFileUpload` or `onUploadFile`, or is not ready yet.
22
22
  */
23
23
  appendFiles: (files: File[]) => Promise<void>;
24
+ /**
25
+ * Puts the keyboard focus in the document, with the caret at its end: what is typed next follows
26
+ * the existing text. Called before the editor is ready, it applies once the editor is. Does
27
+ * nothing when the editor is read-only.
28
+ */
29
+ focus: () => void;
24
30
  };
25
31
  /**
26
32
  * Markdown editor of the design system: Milkdown Crepe, themed from `theme.design`, with its
@@ -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. Mount it once, inside the theme and the messages.
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: string;
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?: string;
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: string;
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: string, options?: ToastCallOptions) => string;
66
- error: (message: string, options?: ToastCallOptions) => string;
67
- info: (message: string, options?: ToastCallOptions) => string;
68
- warning: (message: string, options?: ToastCallOptions) => string;
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: string, options?: ToastProgressOptions): string;
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. */