@bluemarble/bm-components 1.20.0 → 2.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/dist/index.d.mts +16 -17
- package/dist/index.d.ts +16 -17
- package/dist/index.js +612 -369
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +753 -510
- package/dist/index.mjs.map +1 -1
- package/package.json +36 -36
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode, FC, Provider } from 'react';
|
|
2
|
+
import React__default, { PropsWithChildren, ReactNode, FC, Provider } from 'react';
|
|
3
3
|
import * as _mui_material from '@mui/material';
|
|
4
4
|
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps, AutocompleteProps as AutocompleteProps$1, AutocompleteRenderInputParams, CheckboxProps as CheckboxProps$1, FormControlLabelProps, SwitchProps as SwitchProps$1, RadioGroupProps, ButtonProps, CircularProgressProps, Theme, SxProps, TableSortLabelProps, BoxProps, PaperProps, TableProps, TableHeadProps, TableBodyProps, ModalProps, DialogProps, StackProps, IconButtonProps, TypographyProps, AlertColor } from '@mui/material';
|
|
5
5
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
6
|
-
import
|
|
6
|
+
import { FactoryOpts } from 'imask';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import { NextApiRequest, NextApiResponse, GetServerSidePropsContext } from 'next';
|
|
9
|
-
import {
|
|
9
|
+
import { ZodType, ZodSchema } from 'zod';
|
|
10
10
|
import { AxiosInstance } from 'axios';
|
|
11
11
|
|
|
12
12
|
interface ColumnTitleProps {
|
|
@@ -38,7 +38,7 @@ interface GridProps$1<T> {
|
|
|
38
38
|
noFilters?: boolean;
|
|
39
39
|
primaryKey?: string;
|
|
40
40
|
}
|
|
41
|
-
declare const Grid: <ObjectType>(props:
|
|
41
|
+
declare const Grid: <ObjectType>(props: PropsWithChildren<GridProps$1<ObjectType>>) => React__default.JSX.Element;
|
|
42
42
|
|
|
43
43
|
declare function filterData<T>(filters: FilterProps$1[], defaultData: {
|
|
44
44
|
current: T[];
|
|
@@ -54,7 +54,7 @@ interface EditableTableCellProps extends TableCellProps {
|
|
|
54
54
|
type?: TextFieldProps['type'];
|
|
55
55
|
fullWidth?: boolean;
|
|
56
56
|
rowData?: Record<string, any>;
|
|
57
|
-
mask?:
|
|
57
|
+
mask?: FactoryOpts;
|
|
58
58
|
bordered?: boolean;
|
|
59
59
|
rowIndex?: string | number;
|
|
60
60
|
formatCellValue?: (value: string) => string;
|
|
@@ -83,7 +83,7 @@ interface InputMaskProps extends Partial<StandardTextFieldProps> {
|
|
|
83
83
|
label: string;
|
|
84
84
|
withFormik?: boolean;
|
|
85
85
|
value?: string;
|
|
86
|
-
mask:
|
|
86
|
+
mask: FactoryOpts;
|
|
87
87
|
onChangeValue?: (value: string, unmaskedValue: string) => void;
|
|
88
88
|
}
|
|
89
89
|
declare function InputMask({ withFormik, ...rest }: InputMaskProps): React__default.JSX.Element;
|
|
@@ -96,7 +96,6 @@ type SelectProps<T> = MuiSelectPropsWithouVariant<T> & {
|
|
|
96
96
|
name: string;
|
|
97
97
|
label: string;
|
|
98
98
|
withFormik?: boolean;
|
|
99
|
-
variant?: SelectProps$1<T>['variant'];
|
|
100
99
|
FormControlProps?: Partial<FormControlProps>;
|
|
101
100
|
InputLabelProps?: Partial<CustomInputLabelProps>;
|
|
102
101
|
helperText?: string;
|
|
@@ -256,8 +255,8 @@ declare function useGrid<T extends Record<string, any>>({ columns, filters, sear
|
|
|
256
255
|
onSortBy: (prop: string) => void;
|
|
257
256
|
onPageChange: (pageNumber: number) => void;
|
|
258
257
|
setRowsPerPage: (rows: number) => void;
|
|
259
|
-
appendSort: (prop: string, direction:
|
|
260
|
-
setSort: (prop: string, direction:
|
|
258
|
+
appendSort: (prop: string, direction: "desc" | "asc") => void;
|
|
259
|
+
setSort: (prop: string, direction: "desc" | "asc") => void;
|
|
261
260
|
clearSort: () => void;
|
|
262
261
|
};
|
|
263
262
|
|
|
@@ -376,7 +375,7 @@ interface IBaseDialogContext {
|
|
|
376
375
|
declare function useBaseDialog(): IBaseDialogContext;
|
|
377
376
|
declare function useBaseDialogInstance(): {
|
|
378
377
|
name: symbol;
|
|
379
|
-
actions:
|
|
378
|
+
actions: ReturnType<typeof useBaseDialog>;
|
|
380
379
|
};
|
|
381
380
|
|
|
382
381
|
interface IBaseDialogInstanceProviderProps {
|
|
@@ -399,8 +398,8 @@ interface IBaseDialogTriggerProps extends Omit<ButtonProps, 'name'> {
|
|
|
399
398
|
declare const BaseDialogTrigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
400
399
|
declare const BaseDialogCreate: (name?: symbol) => {
|
|
401
400
|
name: symbol;
|
|
402
|
-
Trigger: (props: Omit<IBaseDialogTriggerProps,
|
|
403
|
-
Root: (props: Omit<IBaseDialogInstanceProviderProps,
|
|
401
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, "name">) => React__default.JSX.Element;
|
|
402
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, "name">) => React__default.JSX.Element;
|
|
404
403
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
405
404
|
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
406
405
|
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
@@ -408,8 +407,8 @@ declare const BaseDialogCreate: (name?: symbol) => {
|
|
|
408
407
|
declare const BaseDialog: {
|
|
409
408
|
Create: (name?: symbol) => {
|
|
410
409
|
name: symbol;
|
|
411
|
-
Trigger: (props: Omit<IBaseDialogTriggerProps,
|
|
412
|
-
Root: (props: Omit<IBaseDialogInstanceProviderProps,
|
|
410
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, "name">) => React__default.JSX.Element;
|
|
411
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, "name">) => React__default.JSX.Element;
|
|
413
412
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
414
413
|
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
415
414
|
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
@@ -449,7 +448,7 @@ declare class ApiHelper<T> {
|
|
|
449
448
|
constructor(props?: ConstructorProps$1<T>);
|
|
450
449
|
setMiddlewares(middlewares: any[]): this;
|
|
451
450
|
createMethods(methods: MethodProps<T>): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
452
|
-
static parserErrorWrapper<Output, Def extends
|
|
451
|
+
static parserErrorWrapper<Output, Def extends ZodType>(body: Record<string, any>, parser: ZodSchema<Output, Def>): Output;
|
|
453
452
|
static parseQueyFilters<T extends Record<string, any>>(filters: T): T;
|
|
454
453
|
static create({ onFinally }: {
|
|
455
454
|
onFinally: any;
|
|
@@ -539,7 +538,7 @@ declare class AuthHelper {
|
|
|
539
538
|
redirect?: undefined;
|
|
540
539
|
}>;
|
|
541
540
|
private generateJwtAndRefreshToken;
|
|
542
|
-
invalidateCookies: (res: NextApiResponse) => NextApiResponse
|
|
541
|
+
invalidateCookies: (res: NextApiResponse) => NextApiResponse;
|
|
543
542
|
}
|
|
544
543
|
|
|
545
544
|
type SortedDirectionProps = 'asc' | 'desc';
|
|
@@ -592,7 +591,7 @@ declare function useAsyncGrid<T extends Record<string, any>>({ columns, filters,
|
|
|
592
591
|
setRowsPerPage: (rows: number) => void;
|
|
593
592
|
rowsPerPageOptions: number[];
|
|
594
593
|
rowsPerPage: number;
|
|
595
|
-
setSort: (prop: string, direction:
|
|
594
|
+
setSort: (prop: string, direction: "desc" | "asc") => void;
|
|
596
595
|
isLoading: boolean;
|
|
597
596
|
setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
|
598
597
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode, FC, Provider } from 'react';
|
|
2
|
+
import React__default, { PropsWithChildren, ReactNode, FC, Provider } from 'react';
|
|
3
3
|
import * as _mui_material from '@mui/material';
|
|
4
4
|
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps, AutocompleteProps as AutocompleteProps$1, AutocompleteRenderInputParams, CheckboxProps as CheckboxProps$1, FormControlLabelProps, SwitchProps as SwitchProps$1, RadioGroupProps, ButtonProps, CircularProgressProps, Theme, SxProps, TableSortLabelProps, BoxProps, PaperProps, TableProps, TableHeadProps, TableBodyProps, ModalProps, DialogProps, StackProps, IconButtonProps, TypographyProps, AlertColor } from '@mui/material';
|
|
5
5
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
6
|
-
import
|
|
6
|
+
import { FactoryOpts } from 'imask';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import { NextApiRequest, NextApiResponse, GetServerSidePropsContext } from 'next';
|
|
9
|
-
import {
|
|
9
|
+
import { ZodType, ZodSchema } from 'zod';
|
|
10
10
|
import { AxiosInstance } from 'axios';
|
|
11
11
|
|
|
12
12
|
interface ColumnTitleProps {
|
|
@@ -38,7 +38,7 @@ interface GridProps$1<T> {
|
|
|
38
38
|
noFilters?: boolean;
|
|
39
39
|
primaryKey?: string;
|
|
40
40
|
}
|
|
41
|
-
declare const Grid: <ObjectType>(props:
|
|
41
|
+
declare const Grid: <ObjectType>(props: PropsWithChildren<GridProps$1<ObjectType>>) => React__default.JSX.Element;
|
|
42
42
|
|
|
43
43
|
declare function filterData<T>(filters: FilterProps$1[], defaultData: {
|
|
44
44
|
current: T[];
|
|
@@ -54,7 +54,7 @@ interface EditableTableCellProps extends TableCellProps {
|
|
|
54
54
|
type?: TextFieldProps['type'];
|
|
55
55
|
fullWidth?: boolean;
|
|
56
56
|
rowData?: Record<string, any>;
|
|
57
|
-
mask?:
|
|
57
|
+
mask?: FactoryOpts;
|
|
58
58
|
bordered?: boolean;
|
|
59
59
|
rowIndex?: string | number;
|
|
60
60
|
formatCellValue?: (value: string) => string;
|
|
@@ -83,7 +83,7 @@ interface InputMaskProps extends Partial<StandardTextFieldProps> {
|
|
|
83
83
|
label: string;
|
|
84
84
|
withFormik?: boolean;
|
|
85
85
|
value?: string;
|
|
86
|
-
mask:
|
|
86
|
+
mask: FactoryOpts;
|
|
87
87
|
onChangeValue?: (value: string, unmaskedValue: string) => void;
|
|
88
88
|
}
|
|
89
89
|
declare function InputMask({ withFormik, ...rest }: InputMaskProps): React__default.JSX.Element;
|
|
@@ -96,7 +96,6 @@ type SelectProps<T> = MuiSelectPropsWithouVariant<T> & {
|
|
|
96
96
|
name: string;
|
|
97
97
|
label: string;
|
|
98
98
|
withFormik?: boolean;
|
|
99
|
-
variant?: SelectProps$1<T>['variant'];
|
|
100
99
|
FormControlProps?: Partial<FormControlProps>;
|
|
101
100
|
InputLabelProps?: Partial<CustomInputLabelProps>;
|
|
102
101
|
helperText?: string;
|
|
@@ -256,8 +255,8 @@ declare function useGrid<T extends Record<string, any>>({ columns, filters, sear
|
|
|
256
255
|
onSortBy: (prop: string) => void;
|
|
257
256
|
onPageChange: (pageNumber: number) => void;
|
|
258
257
|
setRowsPerPage: (rows: number) => void;
|
|
259
|
-
appendSort: (prop: string, direction:
|
|
260
|
-
setSort: (prop: string, direction:
|
|
258
|
+
appendSort: (prop: string, direction: "desc" | "asc") => void;
|
|
259
|
+
setSort: (prop: string, direction: "desc" | "asc") => void;
|
|
261
260
|
clearSort: () => void;
|
|
262
261
|
};
|
|
263
262
|
|
|
@@ -376,7 +375,7 @@ interface IBaseDialogContext {
|
|
|
376
375
|
declare function useBaseDialog(): IBaseDialogContext;
|
|
377
376
|
declare function useBaseDialogInstance(): {
|
|
378
377
|
name: symbol;
|
|
379
|
-
actions:
|
|
378
|
+
actions: ReturnType<typeof useBaseDialog>;
|
|
380
379
|
};
|
|
381
380
|
|
|
382
381
|
interface IBaseDialogInstanceProviderProps {
|
|
@@ -399,8 +398,8 @@ interface IBaseDialogTriggerProps extends Omit<ButtonProps, 'name'> {
|
|
|
399
398
|
declare const BaseDialogTrigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
400
399
|
declare const BaseDialogCreate: (name?: symbol) => {
|
|
401
400
|
name: symbol;
|
|
402
|
-
Trigger: (props: Omit<IBaseDialogTriggerProps,
|
|
403
|
-
Root: (props: Omit<IBaseDialogInstanceProviderProps,
|
|
401
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, "name">) => React__default.JSX.Element;
|
|
402
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, "name">) => React__default.JSX.Element;
|
|
404
403
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
405
404
|
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
406
405
|
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
@@ -408,8 +407,8 @@ declare const BaseDialogCreate: (name?: symbol) => {
|
|
|
408
407
|
declare const BaseDialog: {
|
|
409
408
|
Create: (name?: symbol) => {
|
|
410
409
|
name: symbol;
|
|
411
|
-
Trigger: (props: Omit<IBaseDialogTriggerProps,
|
|
412
|
-
Root: (props: Omit<IBaseDialogInstanceProviderProps,
|
|
410
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, "name">) => React__default.JSX.Element;
|
|
411
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, "name">) => React__default.JSX.Element;
|
|
413
412
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
414
413
|
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
415
414
|
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
@@ -449,7 +448,7 @@ declare class ApiHelper<T> {
|
|
|
449
448
|
constructor(props?: ConstructorProps$1<T>);
|
|
450
449
|
setMiddlewares(middlewares: any[]): this;
|
|
451
450
|
createMethods(methods: MethodProps<T>): (req: NextApiRequest, res: NextApiResponse) => Promise<void | NextApiResponse<any>>;
|
|
452
|
-
static parserErrorWrapper<Output, Def extends
|
|
451
|
+
static parserErrorWrapper<Output, Def extends ZodType>(body: Record<string, any>, parser: ZodSchema<Output, Def>): Output;
|
|
453
452
|
static parseQueyFilters<T extends Record<string, any>>(filters: T): T;
|
|
454
453
|
static create({ onFinally }: {
|
|
455
454
|
onFinally: any;
|
|
@@ -539,7 +538,7 @@ declare class AuthHelper {
|
|
|
539
538
|
redirect?: undefined;
|
|
540
539
|
}>;
|
|
541
540
|
private generateJwtAndRefreshToken;
|
|
542
|
-
invalidateCookies: (res: NextApiResponse) => NextApiResponse
|
|
541
|
+
invalidateCookies: (res: NextApiResponse) => NextApiResponse;
|
|
543
542
|
}
|
|
544
543
|
|
|
545
544
|
type SortedDirectionProps = 'asc' | 'desc';
|
|
@@ -592,7 +591,7 @@ declare function useAsyncGrid<T extends Record<string, any>>({ columns, filters,
|
|
|
592
591
|
setRowsPerPage: (rows: number) => void;
|
|
593
592
|
rowsPerPageOptions: number[];
|
|
594
593
|
rowsPerPage: number;
|
|
595
|
-
setSort: (prop: string, direction:
|
|
594
|
+
setSort: (prop: string, direction: "desc" | "asc") => void;
|
|
596
595
|
isLoading: boolean;
|
|
597
596
|
setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
|
598
597
|
};
|