@bluemarble/bm-components 0.0.100 → 0.1.1
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/dist/index.d.mts +1 -6
- package/dist/index.d.ts +1 -6
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,6 @@ import { TableCellProps, TextFieldProps, TableRowProps, StandardTextFieldProps,
|
|
|
4
4
|
import IMask$1 from 'imask';
|
|
5
5
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
6
6
|
import { ZodTypeDef, ZodSchema } from 'zod';
|
|
7
|
-
import { AxiosInstance } from 'axios';
|
|
8
7
|
|
|
9
8
|
interface ColumnTitleProps {
|
|
10
9
|
name: string;
|
|
@@ -291,11 +290,7 @@ declare type Methods = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options';
|
|
|
291
290
|
declare type HandleProps = {
|
|
292
291
|
name: `${Methods}:${string}`;
|
|
293
292
|
};
|
|
294
|
-
declare
|
|
295
|
-
formatErrorMessage: (message: any) => string;
|
|
296
|
-
api: AxiosInstance;
|
|
297
|
-
};
|
|
298
|
-
declare function useFormHelper({ formatErrorMessage, api }: UseFormHelperProps): {
|
|
293
|
+
declare function useFormHelper(): {
|
|
299
294
|
onSubmitWrapper: <T extends Record<string, any>>(fn: (fields: T, methods: any) => Promise<void>, { name }: HandleProps) => (fields: T, methods: any) => Promise<void>;
|
|
300
295
|
onRequestWrapper: <F extends (...args: Parameters<F>) => R, R>(fn: F, { name }: HandleProps) => (...params: Parameters<F>) => Promise<R>;
|
|
301
296
|
isLoading: (prop: string) => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { TableCellProps, TextFieldProps, TableRowProps, StandardTextFieldProps,
|
|
|
4
4
|
import IMask$1 from 'imask';
|
|
5
5
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
6
6
|
import { ZodTypeDef, ZodSchema } from 'zod';
|
|
7
|
-
import { AxiosInstance } from 'axios';
|
|
8
7
|
|
|
9
8
|
interface ColumnTitleProps {
|
|
10
9
|
name: string;
|
|
@@ -291,11 +290,7 @@ declare type Methods = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options';
|
|
|
291
290
|
declare type HandleProps = {
|
|
292
291
|
name: `${Methods}:${string}`;
|
|
293
292
|
};
|
|
294
|
-
declare
|
|
295
|
-
formatErrorMessage: (message: any) => string;
|
|
296
|
-
api: AxiosInstance;
|
|
297
|
-
};
|
|
298
|
-
declare function useFormHelper({ formatErrorMessage, api }: UseFormHelperProps): {
|
|
293
|
+
declare function useFormHelper(): {
|
|
299
294
|
onSubmitWrapper: <T extends Record<string, any>>(fn: (fields: T, methods: any) => Promise<void>, { name }: HandleProps) => (fields: T, methods: any) => Promise<void>;
|
|
300
295
|
onRequestWrapper: <F extends (...args: Parameters<F>) => R, R>(fn: F, { name }: HandleProps) => (...params: Parameters<F>) => Promise<R>;
|
|
301
296
|
isLoading: (prop: string) => boolean;
|
package/dist/index.js
CHANGED
|
@@ -4078,10 +4078,16 @@ function useLoading() {
|
|
|
4078
4078
|
return { isLoading, setLoading };
|
|
4079
4079
|
}
|
|
4080
4080
|
|
|
4081
|
+
// src/contexts/FormHelperProvider.tsx
|
|
4082
|
+
|
|
4083
|
+
|
|
4084
|
+
var FormHelperContext = _react.createContext.call(void 0, {});
|
|
4085
|
+
|
|
4081
4086
|
// src/hooks/useFormHelper.ts
|
|
4082
|
-
function useFormHelper(
|
|
4087
|
+
function useFormHelper() {
|
|
4083
4088
|
const alertProps = useAlert();
|
|
4084
4089
|
const loadingProps = useLoading();
|
|
4090
|
+
const { api, formatErrorMessage } = _react.useContext.call(void 0, FormHelperContext);
|
|
4085
4091
|
const { createAlert } = alertProps;
|
|
4086
4092
|
const { setLoading } = loadingProps;
|
|
4087
4093
|
const sourceRef = _react.useRef.call(void 0, );
|