@ostack.tech/ui-kform 0.3.1 → 0.3.3

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.
@@ -56,19 +56,21 @@ export interface SubmitActionProps<T = unknown, TSubmitResult = unknown> extends
56
56
  */
57
57
  dialogCancelText?: ReactNode;
58
58
  /**
59
- * Message to show in a toast after a successful submission.
59
+ * Message to show in a toast after a successful submission. Can be set to
60
+ * `null` to not show any message.
60
61
  *
61
62
  * @param submitResult Result of `onSubmit`.
62
63
  * @returns Message to show in a toast.
63
64
  */
64
- successMessage?: (submitResult: TSubmitResult) => ReactNode;
65
+ successMessage?: ReactNode | ((submitResult: TSubmitResult) => ReactNode);
65
66
  /**
66
67
  * Message to show in a toast when an error occurs while submitting the form.
68
+ * Can be set to `null` to not show any message.
67
69
  *
68
70
  * @param error Error that occurred.
69
71
  * @returns Message to show in a toast.
70
72
  */
71
- errorMessage?: (error: unknown) => ReactNode;
73
+ errorMessage?: ReactNode | ((error: unknown) => ReactNode);
72
74
  /** Properties to pass to the confirmation dialog content component. */
73
75
  dialogContentProps?: Omit<ComponentPropsWithRef<typeof AlertDialogContent>, "children">;
74
76
  /** Properties to pass to the confirmation dialog header component. */
@@ -49,21 +49,22 @@ export interface FormLoaderOptions<T = unknown> {
49
49
  validateOnLoad?: boolean;
50
50
  /**
51
51
  * Message to show in a toast when successfully loading a form from a file.
52
+ * Can be set to `null` to not show any message.
52
53
  *
53
54
  * @param file Loaded file.
54
55
  * @returns Message to show in a toast.
55
56
  */
56
- successMessage?: (file: FileWithHandle) => ReactNode;
57
+ successMessage?: ReactNode | ((file: FileWithHandle) => ReactNode);
57
58
  /**
58
59
  * Message to show in a toast when an error occurs while loading the form from
59
- * a file.
60
+ * a file. Can be set to `null` to not show any message.
60
61
  *
61
62
  * @param file File from which the load was attempted (or `null` if the file
62
63
  * could not be accessed).
63
64
  * @param error Error that occurred.
64
65
  * @returns Message to show in a toast.
65
66
  */
66
- errorMessage?: (file: FileWithHandle | null, error: unknown) => ReactNode;
67
+ errorMessage?: ReactNode | ((file: FileWithHandle | null, error: unknown) => ReactNode);
67
68
  }
68
69
  /** Result of the {@link useFormLoader} hook. */
69
70
  export interface FormLoaderResult<T> {
@@ -61,22 +61,23 @@ export interface FormSaverOptions<T = unknown> {
61
61
  */
62
62
  setPristineOnSave?: boolean;
63
63
  /**
64
- * Message to show in a toast when successfully saving the form to a file.
64
+ * Message to show in a toast when successfully saving the form to a file. Can
65
+ * be set to `null` to not show any message.
65
66
  *
66
67
  * @param fileHandle Handle to the saved file.
67
68
  * @returns Message to show in a toast.
68
69
  */
69
- successMessage?: (fileHandle: FileSystemFileHandle) => ReactNode;
70
+ successMessage?: ReactNode | ((fileHandle: FileSystemFileHandle) => ReactNode);
70
71
  /**
71
72
  * Message to show in a toast when an error occurs while saving the form to a
72
- * file.
73
+ * file. Can be set to `null` to not show any message.
73
74
  *
74
75
  * @param fileHandle Handle of the file over which the save was attempted, or
75
76
  * `null` if no such file exists.
76
77
  * @param error Error that occurred.
77
78
  * @returns Message to show in a toast.
78
79
  */
79
- errorMessage?: (fileHandle: FileSystemFileHandle | null, error: unknown) => ReactNode;
80
+ errorMessage?: ReactNode | ((fileHandle: FileSystemFileHandle | null, error: unknown) => ReactNode);
80
81
  }
81
82
  /** Result of the {@link useFormSaver} hook. */
82
83
  export interface FormSaverResult<T> {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ostack.tech/ui-kform",
3
3
  "description": "Integration of ostack/UI with ostack/KForm.",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "homepage": "https://ui.ostack.tech/",
6
6
  "author": {
7
7
  "name": "Opensoft",
@@ -52,7 +52,7 @@
52
52
  "@fortawesome/free-solid-svg-icons": "^6.2.0 || ^7.0.0",
53
53
  "@ostack.tech/kform": "~0.31.0",
54
54
  "@ostack.tech/kform-react": "~0.31.0",
55
- "@ostack.tech/ui": "~0.3.1",
55
+ "@ostack.tech/ui": "~0.3.3",
56
56
  "@types/react": "^18.0.0 || ^19.0.0",
57
57
  "@types/react-dom": "^18.0.0 || ^19.0.0",
58
58
  "date-fns": "^4.1.0",