@js-smart/react-kit 5.12.0-beta.4 → 5.12.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/index.cjs +75 -0
- package/{react-kit/src/index.ts → index.d.ts} +9 -16
- package/index.js +6255 -0
- package/lib/components/CenteredCircularProgress.d.ts +7 -0
- package/lib/components/ConfirmationDialog.d.ts +11 -0
- package/lib/components/DismissibleAlert.d.ts +17 -0
- package/lib/components/NextLink.d.ts +17 -0
- package/lib/components/OpenInNewIconLink.d.ts +17 -0
- package/lib/components/ReactIf.d.ts +36 -0
- package/lib/components/buttons/CancelButton.d.ts +28 -0
- package/lib/components/buttons/DeleteButton.d.ts +16 -0
- package/lib/components/buttons/EditIconButton.d.ts +8 -0
- package/lib/components/buttons/ExcelButton.d.ts +26 -0
- package/lib/components/buttons/GoBackButton.d.ts +10 -0
- package/lib/components/buttons/HistoryButton.d.ts +28 -0
- package/lib/components/buttons/LoadingSuccessButton.d.ts +28 -0
- package/lib/components/buttons/ManageButton.d.ts +14 -0
- package/lib/components/buttons/SuccessButton.d.ts +28 -0
- package/lib/components/snack-bar/AppSnackBar.d.ts +6 -0
- package/lib/components/snack-bar/QuerySnackBar.d.ts +18 -0
- package/lib/components/table/TablePaginationActions.d.ts +9 -0
- package/lib/components/tabs/TabPanel.d.ts +12 -0
- package/lib/config/fetch/FetchClient.d.ts +58 -0
- package/lib/config/fetch/FetchClientTypes.d.ts +39 -0
- package/lib/config/fetch/FetchInterceptor.d.ts +21 -0
- package/lib/constants/AppConstants.d.ts +15 -0
- package/lib/constants/HttpConstants.d.ts +13 -0
- package/lib/types/ProgressState.d.ts +7 -0
- package/lib/utils/BooleanUtils.d.ts +7 -0
- package/{react-kit/src/lib/utils/CssUtils.ts → lib/utils/CssUtils.d.ts} +1 -3
- package/lib/utils/DateUtils.d.ts +22 -0
- package/lib/utils/NumberUtils.d.ts +7 -0
- package/lib/utils/ProgressStateUtils.d.ts +38 -0
- package/lib/utils/StringUtils.d.ts +7 -0
- package/lib/utils/UrlUtils.d.ts +11 -0
- package/package.json +44 -98
- package/.editorconfig +0 -13
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -41
- package/.github/copilot-instructions.md +0 -11
- package/.github/workflows/build.yml +0 -45
- package/.github/workflows/release.yml +0 -65
- package/.prettierignore +0 -5
- package/.prettierrc +0 -9
- package/.vscode/extensions.json +0 -7
- package/CHANGELOG.md +0 -24
- package/CODE_OF_CONDUCT.md +0 -128
- package/FUNDING.yml +0 -1
- package/LICENSE +0 -21
- package/README.md +0 -1
- package/apps/react-kit-demo/.eslintrc.json +0 -22
- package/apps/react-kit-demo/index.html +0 -16
- package/apps/react-kit-demo/project.json +0 -9
- package/apps/react-kit-demo/public/favicon.ico +0 -0
- package/apps/react-kit-demo/src/app/Home.tsx +0 -17
- package/apps/react-kit-demo/src/app/all-books/AllBooks.tsx +0 -68
- package/apps/react-kit-demo/src/app/app.module.scss +0 -1
- package/apps/react-kit-demo/src/app/app.tsx +0 -29
- package/apps/react-kit-demo/src/app/buttons/ButtonsDemo.tsx +0 -58
- package/apps/react-kit-demo/src/app/dialog/DialogDemo.tsx +0 -23
- package/apps/react-kit-demo/src/app/links/LinksDemo.tsx +0 -20
- package/apps/react-kit-demo/src/app/progress-bar/CenterCircularProgressDemo.tsx +0 -10
- package/apps/react-kit-demo/src/app/react-if/ReactIfDemo.tsx +0 -44
- package/apps/react-kit-demo/src/app/snack-bar/SnackBarDemo.tsx +0 -35
- package/apps/react-kit-demo/src/assets/.gitkeep +0 -0
- package/apps/react-kit-demo/src/constants/ApiConstants.ts +0 -7
- package/apps/react-kit-demo/src/constants/DialogMode.ts +0 -2
- package/apps/react-kit-demo/src/constants/HttpConstants.ts +0 -18
- package/apps/react-kit-demo/src/constants/StateConstants.ts +0 -2
- package/apps/react-kit-demo/src/main.tsx +0 -17
- package/apps/react-kit-demo/src/routes/Routes.tsx +0 -55
- package/apps/react-kit-demo/src/services/BookService.ts +0 -21
- package/apps/react-kit-demo/src/styles.scss +0 -36
- package/apps/react-kit-demo/src/theme.ts +0 -46
- package/apps/react-kit-demo/src/types/Book.ts +0 -8
- package/apps/react-kit-demo/src/utils/CssUtils.ts +0 -13
- package/apps/react-kit-demo/tsconfig.app.json +0 -18
- package/apps/react-kit-demo/tsconfig.json +0 -21
- package/apps/react-kit-demo/tsconfig.spec.json +0 -28
- package/apps/react-kit-demo/vite.config.ts +0 -50
- package/nx.json +0 -52
- package/react-kit/.babelrc +0 -12
- package/react-kit/.eslintrc.json +0 -18
- package/react-kit/README.md +0 -7
- package/react-kit/package-lock.json +0 -1330
- package/react-kit/package.json +0 -45
- package/react-kit/project.json +0 -10
- package/react-kit/src/lib/components/CenteredCircularProgress.tsx +0 -15
- package/react-kit/src/lib/components/ConfirmationDialog.tsx +0 -28
- package/react-kit/src/lib/components/DismissibleAlert.tsx +0 -60
- package/react-kit/src/lib/components/NextLink.tsx +0 -26
- package/react-kit/src/lib/components/OpenInNewIconLink.tsx +0 -42
- package/react-kit/src/lib/components/ReactIf.tsx +0 -53
- package/react-kit/src/lib/components/buttons/CancelButton.tsx +0 -45
- package/react-kit/src/lib/components/buttons/DeleteButton.tsx +0 -35
- package/react-kit/src/lib/components/buttons/EditIconButton.tsx +0 -23
- package/react-kit/src/lib/components/buttons/ExcelButton.tsx +0 -43
- package/react-kit/src/lib/components/buttons/GoBackButton.tsx +0 -22
- package/react-kit/src/lib/components/buttons/HistoryButton.tsx +0 -45
- package/react-kit/src/lib/components/buttons/LoadingSuccessButton.tsx +0 -53
- package/react-kit/src/lib/components/buttons/ManageButton.tsx +0 -31
- package/react-kit/src/lib/components/buttons/SuccessButton.tsx +0 -44
- package/react-kit/src/lib/components/snack-bar/AppSnackBar.tsx +0 -46
- package/react-kit/src/lib/components/snack-bar/QuerySnackBar.tsx +0 -62
- package/react-kit/src/lib/components/table/TablePaginationActions.tsx +0 -58
- package/react-kit/src/lib/components/tabs/TabPanel.tsx +0 -26
- package/react-kit/src/lib/constants/AppConstants.ts +0 -17
- package/react-kit/src/lib/types/ProgressState.ts +0 -7
- package/react-kit/src/lib/utils/BooleanUtils.ts +0 -13
- package/react-kit/src/lib/utils/DateUtils.ts +0 -43
- package/react-kit/src/lib/utils/NumberUtils.ts +0 -12
- package/react-kit/src/lib/utils/ProgressStateUtils.ts +0 -68
- package/react-kit/src/lib/utils/StringUtils.ts +0 -14
- package/react-kit/src/lib/utils/UrlUtils.ts +0 -19
- package/react-kit/src/lib/utils/fetchClient.ts +0 -64
- package/react-kit/src/tests/buttons/CancelButton.test.tsx +0 -69
- package/react-kit/src/tests/buttons/DeleteButton.test.tsx +0 -63
- package/react-kit/src/tests/buttons/EditIconButton.test.tsx +0 -34
- package/react-kit/src/tests/buttons/HistoryButton.test.tsx +0 -46
- package/react-kit/src/tests/buttons/LoadingSuccessButton.test.tsx +0 -53
- package/react-kit/src/tests/buttons/ManageButton.test.tsx +0 -49
- package/react-kit/src/tests/buttons/SuccessButton.test.tsx +0 -46
- package/react-kit/src/tests/snack-bar/AppSnackBar.test.tsx +0 -54
- package/react-kit/src/tests/utils/BooleanUtils.test.ts +0 -35
- package/react-kit/src/tests/utils/CssUtils.test.ts +0 -17
- package/react-kit/src/tests/utils/DateUtils.test.ts +0 -46
- package/react-kit/src/tests/utils/NumberUtils.test.ts +0 -19
- package/react-kit/src/tests/utils/ProgressStateUtils.test.ts +0 -131
- package/react-kit/src/tests/utils/StringUtils.test.ts +0 -33
- package/react-kit/src/tests/utils/UrlUtils.test.ts +0 -19
- package/react-kit/tsconfig.json +0 -21
- package/react-kit/tsconfig.lib.json +0 -18
- package/react-kit/tsconfig.spec.json +0 -27
- package/react-kit/vite.config.ts +0 -72
- package/release.sh +0 -28
- package/tsconfig.base.json +0 -22
- package/vitest.workspace.js +0 -3
- package/vitest.workspace.ts +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ConfirmDialogProps {
|
|
2
|
+
id: string;
|
|
3
|
+
keepMounted: boolean;
|
|
4
|
+
title?: string;
|
|
5
|
+
message: string;
|
|
6
|
+
value: string;
|
|
7
|
+
open: boolean;
|
|
8
|
+
onClose: (value: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function ConfirmDialog(props: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AlertColor } from '@mui/material';
|
|
2
|
+
/**
|
|
3
|
+
* Dismissible Alert properties
|
|
4
|
+
*
|
|
5
|
+
* @author Pavan Kumar Jadda
|
|
6
|
+
* @since 0.2.17
|
|
7
|
+
*/
|
|
8
|
+
type DismissibleAlertProps = {
|
|
9
|
+
message: string;
|
|
10
|
+
severity: AlertColor;
|
|
11
|
+
className?: string;
|
|
12
|
+
dismissible?: boolean;
|
|
13
|
+
dismissOnTimeOut?: boolean;
|
|
14
|
+
dismissTimeOut?: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function DismissibleAlert(props: Readonly<DismissibleAlertProps>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
href: string;
|
|
4
|
+
linkText?: string;
|
|
5
|
+
target?: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reusable custom Next.js 13 Link component.
|
|
10
|
+
*
|
|
11
|
+
* @param props Properties of the React Node
|
|
12
|
+
*
|
|
13
|
+
* @author Pavan Kumar Jadda
|
|
14
|
+
* @since 0.3.2
|
|
15
|
+
*/
|
|
16
|
+
export declare function NextLink(props: Readonly<Props>): React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
href: string;
|
|
4
|
+
linkText: string;
|
|
5
|
+
target: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Reusable component to open a link in new tab and show open new icon at the end
|
|
10
|
+
*
|
|
11
|
+
* @param props Properties of the component
|
|
12
|
+
*
|
|
13
|
+
* @author Pavan Kumar Jadda
|
|
14
|
+
* @since 1.2.24
|
|
15
|
+
*/
|
|
16
|
+
export declare function OpenInNewIconLink(props: Readonly<Props>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
type ReactIfProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The condition that determines whether children should be rendered
|
|
5
|
+
*/
|
|
6
|
+
condition: boolean | null | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Content to render when condition is true.
|
|
9
|
+
* Can be either a ReactNode or a function returning a ReactNode
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode | (() => ReactNode);
|
|
12
|
+
/**
|
|
13
|
+
* Optional content to render when condition is false
|
|
14
|
+
*/
|
|
15
|
+
else?: ReactNode | (() => ReactNode);
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reusable If component, that renders content if the condition is true. Similar to *ngIf from Angular
|
|
19
|
+
*
|
|
20
|
+
* @param props Properties of the component
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <ReactIf condition={isVisible}>
|
|
25
|
+
* <div>Visible content</div>
|
|
26
|
+
* </ReactIf>
|
|
27
|
+
*
|
|
28
|
+
* <ReactIf condition={isVisible} else={<div>Alternative content</div>}>
|
|
29
|
+
* <div>Main content</div>
|
|
30
|
+
* </ReactIf>
|
|
31
|
+
*```
|
|
32
|
+
* @author Pavan Kumar Jadda
|
|
33
|
+
* @since 0.1.0
|
|
34
|
+
*/
|
|
35
|
+
export declare function ReactIf(props: ReactIfProps): React.ReactNode;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
/**
|
|
4
|
+
* Reusable Success Button component properties
|
|
5
|
+
*
|
|
6
|
+
* @author Pavan Kumar Jadda
|
|
7
|
+
* @since 1.2.14
|
|
8
|
+
*/
|
|
9
|
+
interface CancelButtonProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
dataCy?: string;
|
|
14
|
+
sx?: SxProps<Theme>;
|
|
15
|
+
type?: 'button' | 'submit' | 'reset';
|
|
16
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
17
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
18
|
+
onClick: () => void;
|
|
19
|
+
startIcon?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reusable Cancel Button component
|
|
23
|
+
*
|
|
24
|
+
* @author Pavan Kumar Jadda
|
|
25
|
+
* @since 1.2.14
|
|
26
|
+
*/
|
|
27
|
+
export declare function CancelButton(props: CancelButtonProps): React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface DeleteButtonProps {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
loadingLabel?: string;
|
|
6
|
+
loadingPosition?: 'start' | 'end' | 'center';
|
|
7
|
+
type?: 'button' | 'submit' | 'reset' | undefined;
|
|
8
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
9
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
10
|
+
name?: string;
|
|
11
|
+
dataCy?: string;
|
|
12
|
+
startIcon?: React.ReactNode;
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function DeleteButton(props: DeleteButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface EditIconButtonProps {
|
|
3
|
+
tooltipTitle: string;
|
|
4
|
+
onClick: React.Dispatch<React.SetStateAction<boolean>>;
|
|
5
|
+
color?: 'inherit' | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
6
|
+
}
|
|
7
|
+
export declare function EditIconButton(props: Readonly<EditIconButtonProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
/**
|
|
4
|
+
* Reusable Excel Button component properties
|
|
5
|
+
*
|
|
6
|
+
* @author Pavan Kumar Jadda
|
|
7
|
+
* @since 1.2.9
|
|
8
|
+
*/
|
|
9
|
+
interface SuccessButtonProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
type?: 'button' | 'submit' | 'reset';
|
|
15
|
+
onClick: () => void;
|
|
16
|
+
startIcon?: React.ReactNode;
|
|
17
|
+
dataCy?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Reusable Excel Button component
|
|
21
|
+
*
|
|
22
|
+
* @author Pavan Kumar Jadda
|
|
23
|
+
* @since 1.2.9
|
|
24
|
+
*/
|
|
25
|
+
export declare function ExcelButton(props: SuccessButtonProps): React.JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { NavigateFunction } from 'react-router-dom';
|
|
3
|
+
interface GoBackButtonProps {
|
|
4
|
+
name?: string;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
navigate: NavigateFunction;
|
|
7
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
8
|
+
}
|
|
9
|
+
export declare function GoBackButton(props: GoBackButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
/**
|
|
4
|
+
* Reusable History Button component properties
|
|
5
|
+
*
|
|
6
|
+
* @author Pavan Kumar Jadda
|
|
7
|
+
* @since 1.2.15
|
|
8
|
+
*/
|
|
9
|
+
interface HistoryButtonProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
dataCy?: string;
|
|
14
|
+
sx?: SxProps<Theme>;
|
|
15
|
+
type?: 'button' | 'submit' | 'reset';
|
|
16
|
+
onClick: () => void;
|
|
17
|
+
startIcon?: React.ReactNode;
|
|
18
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
19
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reusable History Button component
|
|
23
|
+
*
|
|
24
|
+
* @author Pavan Kumar Jadda
|
|
25
|
+
* @since 1.2.15
|
|
26
|
+
*/
|
|
27
|
+
export declare function HistoryButton(props: HistoryButtonProps): React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
/**
|
|
4
|
+
* Reusable Success Button component properties
|
|
5
|
+
*
|
|
6
|
+
* @author Pavan Kumar Jadda
|
|
7
|
+
* @since 0.3.3
|
|
8
|
+
*/
|
|
9
|
+
interface Props {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
type?: 'button' | 'submit' | 'reset';
|
|
12
|
+
name?: string;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
dataCy?: string;
|
|
15
|
+
startIcon?: React.ReactNode;
|
|
16
|
+
sx?: SxProps<Theme>;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
19
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reusable Success Loading Button
|
|
23
|
+
*
|
|
24
|
+
* @author Pavan Kumar Jadda
|
|
25
|
+
* @since 0.1.0
|
|
26
|
+
*/
|
|
27
|
+
export declare function LoadingSuccessButton(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface ManageButtonProps {
|
|
3
|
+
size?: 'small' | 'medium' | 'large';
|
|
4
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
5
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
6
|
+
className?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
dataCy?: string;
|
|
9
|
+
startIcon?: React.ReactNode;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function ManageButton(props: ManageButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
/**
|
|
4
|
+
* Reusable Success Button component properties
|
|
5
|
+
*
|
|
6
|
+
* @author Pavan Kumar Jadda
|
|
7
|
+
* @since 0.3.3
|
|
8
|
+
*/
|
|
9
|
+
interface SuccessButtonProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
dataCy?: string;
|
|
14
|
+
sx?: SxProps<Theme>;
|
|
15
|
+
type?: 'button' | 'submit' | 'reset';
|
|
16
|
+
onClick: () => void;
|
|
17
|
+
startIcon?: React.ReactNode;
|
|
18
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
19
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reusable Success Button component
|
|
23
|
+
*
|
|
24
|
+
* @author Pavan Kumar Jadda
|
|
25
|
+
* @since 0.1.0
|
|
26
|
+
*/
|
|
27
|
+
export declare function SuccessButton(props: SuccessButtonProps): React.JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface QuerySnackBarProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
isPending?: boolean;
|
|
4
|
+
isSuccess: boolean;
|
|
5
|
+
isError: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
autoHideDuration?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reusable component to display snackbar based on React Query mutation state
|
|
11
|
+
*
|
|
12
|
+
* @param props QuerySnackBarProps
|
|
13
|
+
*
|
|
14
|
+
* @author Pavan Kumar Jadda
|
|
15
|
+
* @since 1.2.27
|
|
16
|
+
*/
|
|
17
|
+
export declare const QuerySnackBar: (props: QuerySnackBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface TablePaginationActionsProps {
|
|
3
|
+
count: number;
|
|
4
|
+
page: number;
|
|
5
|
+
rowsPerPage: number;
|
|
6
|
+
onPageChange: (event: React.MouseEvent<HTMLButtonElement>, newPage: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function TablePaginationActions(props: TablePaginationActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare function TabPanel(props: TabPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function a11yProps(index: number): {
|
|
4
|
+
id: string;
|
|
5
|
+
'aria-controls': string;
|
|
6
|
+
};
|
|
7
|
+
interface TabPanelProps {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
index: number;
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { FetchError, FetchResponse, RequestConfig } from './FetchClientTypes';
|
|
2
|
+
/**
|
|
3
|
+
* Reusable fetch client class
|
|
4
|
+
*
|
|
5
|
+
* @author Pavan Kumar Jadda
|
|
6
|
+
* @since 0.2.19
|
|
7
|
+
*/
|
|
8
|
+
declare class FetchInstance {
|
|
9
|
+
private readonly baseURL;
|
|
10
|
+
private requestInterceptors;
|
|
11
|
+
private responseInterceptors;
|
|
12
|
+
private errorInterceptors;
|
|
13
|
+
/**
|
|
14
|
+
* Add request interceptor
|
|
15
|
+
*/
|
|
16
|
+
interceptors: {
|
|
17
|
+
request: {
|
|
18
|
+
use: (interceptor: (config: RequestConfig) => RequestConfig | Promise<RequestConfig>) => void;
|
|
19
|
+
};
|
|
20
|
+
response: {
|
|
21
|
+
use: (successInterceptor?: (response: FetchResponse<unknown>) => FetchResponse<unknown> | Promise<FetchResponse<unknown>>, errorInterceptor?: (error: FetchError) => FetchError | Promise<FetchError> | void | Promise<void>) => void;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
constructor(baseURL?: string);
|
|
25
|
+
/**
|
|
26
|
+
* GET request
|
|
27
|
+
*/
|
|
28
|
+
get<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<FetchResponse<T>>;
|
|
29
|
+
/**
|
|
30
|
+
* POST request
|
|
31
|
+
*/
|
|
32
|
+
post<T = unknown>(url: string, data?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<FetchResponse<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* PUT request
|
|
35
|
+
*/
|
|
36
|
+
put<T = unknown>(url: string, data?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<FetchResponse<T>>;
|
|
37
|
+
/**
|
|
38
|
+
* DELETE request
|
|
39
|
+
*/
|
|
40
|
+
delete<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<FetchResponse<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* PATCH request
|
|
43
|
+
*/
|
|
44
|
+
patch<T = unknown>(url: string, data?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<FetchResponse<T>>;
|
|
45
|
+
/**
|
|
46
|
+
* Generic request method
|
|
47
|
+
*/
|
|
48
|
+
request<T = unknown>(config: RequestConfig): Promise<FetchResponse<T>>;
|
|
49
|
+
/**
|
|
50
|
+
* Execute request with interceptors
|
|
51
|
+
*/
|
|
52
|
+
private executeRequest;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Callable fetch client that defaults to GET requests
|
|
56
|
+
*/
|
|
57
|
+
export declare const FetchClient: (<T = unknown>(url: string, config?: Omit<RequestConfig, "method" | "url">) => Promise<T>) & FetchInstance;
|
|
58
|
+
export default FetchClient;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for error response structure
|
|
3
|
+
*/
|
|
4
|
+
export interface ErrorResponse {
|
|
5
|
+
message: string;
|
|
6
|
+
errorCode: string | null;
|
|
7
|
+
status: string;
|
|
8
|
+
statusCode: number;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
errors: unknown[] | null;
|
|
11
|
+
path: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Interface for request configuration
|
|
15
|
+
*/
|
|
16
|
+
export interface RequestConfig extends RequestInit {
|
|
17
|
+
baseURL?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
params?: Record<string, string | number | boolean>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Interface for response structure
|
|
23
|
+
*/
|
|
24
|
+
export interface FetchResponse<T = unknown> {
|
|
25
|
+
data: T;
|
|
26
|
+
status: number;
|
|
27
|
+
statusText: string;
|
|
28
|
+
headers: Headers;
|
|
29
|
+
config: RequestConfig;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Interface for error structure
|
|
33
|
+
*/
|
|
34
|
+
export interface FetchError extends Error {
|
|
35
|
+
statusCode: number;
|
|
36
|
+
originalError: Error;
|
|
37
|
+
response?: Response;
|
|
38
|
+
request?: Request;
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FetchError } from './FetchClientTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Adds error handling interceptor
|
|
5
|
+
*
|
|
6
|
+
* @author Pavan Kumar Jadda
|
|
7
|
+
* @since 1.1.1
|
|
8
|
+
*/
|
|
9
|
+
export declare const FetchInterceptor: (props: {
|
|
10
|
+
children: React.JSX.Element;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a formatted error object with additional context
|
|
14
|
+
* @param error The original error
|
|
15
|
+
* @param statusCode HTTP status code
|
|
16
|
+
* @param message Error message
|
|
17
|
+
* @param response Response object
|
|
18
|
+
* @param request Request object
|
|
19
|
+
* @returns Formatted error object
|
|
20
|
+
*/
|
|
21
|
+
export declare const createFormattedError: (error: Error, statusCode: number, message: string, response?: Response, request?: Request) => FetchError;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global System settings used in the application
|
|
3
|
+
*
|
|
4
|
+
* @author Pavan Kumar Jadda
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
export declare enum SystemConfig {
|
|
8
|
+
SYSTEM_TIME_ZONE = "America/New_York",
|
|
9
|
+
SYSTEM_LOCALE = "en-US",
|
|
10
|
+
SYSTEM_DATE_FORMAT = "MM/dd/yyyy",
|
|
11
|
+
SYSTEM_DATE_TIME_FORMAT = "MM/dd/yyyy hh:mm:ss a",
|
|
12
|
+
ISO_DATE_FORMAT = "yyyy-MM-dd",
|
|
13
|
+
SYSTEM_COOKIE_TIMEOUT_HOURS = 24,
|
|
14
|
+
SYSTEM_COOKIE_TIMEOUT_MILLI_SECONDS = 3600000
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const HTTP_200 = 200;
|
|
2
|
+
export declare const HTTP_201 = 201;
|
|
3
|
+
export declare const HTTP_401 = 401;
|
|
4
|
+
export declare const HTTP_403 = 403;
|
|
5
|
+
export declare const HTTP_404 = 404;
|
|
6
|
+
export declare const HTTP_405 = 405;
|
|
7
|
+
export declare const HTTP_409 = 409;
|
|
8
|
+
export declare const HTTP_500 = 500;
|
|
9
|
+
export declare const HTTP_501 = 501;
|
|
10
|
+
export declare const HTTP_502 = 502;
|
|
11
|
+
export declare const HTTP_503 = 503;
|
|
12
|
+
export declare const HTTP_504 = 504;
|
|
13
|
+
export declare const HTTP_505 = 505;
|
|
@@ -8,6 +8,4 @@
|
|
|
8
8
|
* @author Pavan Kumar Jadda
|
|
9
9
|
* @since 1.6.0
|
|
10
10
|
*/
|
|
11
|
-
export function getCssVariable(variable: string): string
|
|
12
|
-
return getComputedStyle(document.documentElement).getPropertyValue(variable).trim();
|
|
13
|
-
}
|
|
11
|
+
export declare function getCssVariable(variable: string): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets Cookie expiration to 24 hours. By default, server sets 60 minutes expiration but after each API request it extends to another 60 minutes. In client side set 24 hours as expiration date,
|
|
3
|
+
* if the user hasn't refreshed web page in 60 minutes, they would get HTTP 401 isError and redirected to login page. And redirect URL will be stored in cookie
|
|
4
|
+
*
|
|
5
|
+
* @author Pavan Kumar Jadda
|
|
6
|
+
* @since 0.2.30
|
|
7
|
+
*/
|
|
8
|
+
export declare const setCookieExpirationDate: () => Date;
|
|
9
|
+
/**
|
|
10
|
+
* Convert String format browser Date Time to ISO Date
|
|
11
|
+
*
|
|
12
|
+
* @author Pavan Kumar Jadda
|
|
13
|
+
* @since 0.2.30
|
|
14
|
+
*/
|
|
15
|
+
export declare const convertToIsoDate: (currentDateTime: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Convert String format browser Date Time to ISO Date
|
|
18
|
+
*
|
|
19
|
+
* @author Pavan Kumar Jadda
|
|
20
|
+
* @since 0.2.30
|
|
21
|
+
*/
|
|
22
|
+
export declare const formatDate: (date: string | undefined, newFormat: string) => string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ProgressState } from '../types/ProgressState';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize Loading or Update ProgressState
|
|
4
|
+
*
|
|
5
|
+
* @return Updated State Object
|
|
6
|
+
*
|
|
7
|
+
* @author Pavan Kumar Jadda
|
|
8
|
+
* @since 1.4.6
|
|
9
|
+
*/
|
|
10
|
+
export declare const initializeState: () => ProgressState;
|
|
11
|
+
/**
|
|
12
|
+
* Initialize Loading or Update ProgressState
|
|
13
|
+
*
|
|
14
|
+
* @param progressState Object to initialize
|
|
15
|
+
* @return ProgressState Updated State Object
|
|
16
|
+
*
|
|
17
|
+
* @author Pavan Kumar Jadda
|
|
18
|
+
* @since 0.2.30
|
|
19
|
+
*/
|
|
20
|
+
export declare const markLoading: (progressState: ProgressState) => ProgressState;
|
|
21
|
+
/**
|
|
22
|
+
* Update state as isSuccess
|
|
23
|
+
*
|
|
24
|
+
* @return ProgressState Updated State Object
|
|
25
|
+
*
|
|
26
|
+
* @author Pavan Kumar Jadda
|
|
27
|
+
* @since 0.2.30
|
|
28
|
+
*/
|
|
29
|
+
export declare const markSuccess: (progressState: ProgressState, message?: string) => ProgressState;
|
|
30
|
+
/**
|
|
31
|
+
* Update state as failure or isError
|
|
32
|
+
*
|
|
33
|
+
* @return ProgressState Updated State Object
|
|
34
|
+
*
|
|
35
|
+
* @author Pavan Kumar Jadda
|
|
36
|
+
* @since 0.2.30
|
|
37
|
+
*/
|
|
38
|
+
export declare const markError: (progressState: ProgressState, message?: string) => ProgressState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given URL is encoded or not
|
|
3
|
+
*
|
|
4
|
+
* @param url The URL to check
|
|
5
|
+
*
|
|
6
|
+
* @returns True if the URL is encoded, false otherwise
|
|
7
|
+
*
|
|
8
|
+
* @author Pavan Kumar Jadda
|
|
9
|
+
* @since 1.3.14
|
|
10
|
+
*/
|
|
11
|
+
export declare const isEncoded: (url: string) => boolean;
|