@campxdev/campx-web-utils 2.0.17 → 2.1.0-alpha.2
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/cjs/index.js +1 -1
- package/dist/cjs/types/src/context/application-store.d.ts +2 -2
- package/dist/cjs/types/src/hooks/useConfirm.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/src/context/application-store.d.ts +2 -2
- package/dist/esm/types/src/hooks/useConfirm.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/styles.css +938 -212
- package/package.json +3 -3
- package/src/context/ConfirmDialogProvider.tsx +14 -14
- package/src/context/application-store.ts +2 -2
- package/src/hooks/useConfirm.ts +3 -3
- package/src/routes/main.tsx +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/campx-web-utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-alpha.2",
|
|
4
4
|
"author": "CampX",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"private": false,
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@campxdev/react-blueprint": ">=3.
|
|
25
|
+
"@campxdev/react-blueprint": ">=3.1.0",
|
|
26
26
|
"react-redux": "=>9.1.2",
|
|
27
27
|
"react-router-dom": "^6.24.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@campxdev/react-blueprint": "3.0.
|
|
30
|
+
"@campxdev/react-blueprint": "3.1.0-alpha.9",
|
|
31
31
|
"@exotel-npm-dev/exotel-ip-calling-crm-websdk": "^1.2.2",
|
|
32
32
|
"@hookform/resolvers": "^2.9.10",
|
|
33
33
|
"axios": "^1.7.2",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfirmDialog,
|
|
1
|
+
import { ConfirmDialog, ConfirmDialogVariant } from '@campxdev/react-blueprint';
|
|
2
2
|
import { createContext, ReactNode } from 'react';
|
|
3
3
|
import { ApplicationStore } from './application-store';
|
|
4
4
|
|
|
@@ -8,9 +8,9 @@ interface ConfirmStateProps {
|
|
|
8
8
|
message: string,
|
|
9
9
|
onConfirm: () => void,
|
|
10
10
|
onCancel: () => void,
|
|
11
|
-
type?:
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
type?: ConfirmDialogVariant,
|
|
12
|
+
confirmText?: string,
|
|
13
|
+
cancelText?: string,
|
|
14
14
|
) => void;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -30,9 +30,9 @@ export const ConfirmDialogProvider = ({
|
|
|
30
30
|
message: string,
|
|
31
31
|
onConfirm: () => void,
|
|
32
32
|
onCancel: () => void,
|
|
33
|
-
type:
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
type: ConfirmDialogVariant = 'confirm',
|
|
34
|
+
confirmText?: string,
|
|
35
|
+
cancelText?: string,
|
|
36
36
|
) => {
|
|
37
37
|
ApplicationStore.update((s) => {
|
|
38
38
|
s.confirmDialog = {
|
|
@@ -42,8 +42,8 @@ export const ConfirmDialogProvider = ({
|
|
|
42
42
|
onConfirm,
|
|
43
43
|
onCancel,
|
|
44
44
|
type,
|
|
45
|
-
confirmButtonText,
|
|
46
|
-
cancelButtonText,
|
|
45
|
+
confirmButtonText: confirmText,
|
|
46
|
+
cancelButtonText: cancelText,
|
|
47
47
|
};
|
|
48
48
|
});
|
|
49
49
|
};
|
|
@@ -58,17 +58,17 @@ export const ConfirmDialogProvider = ({
|
|
|
58
58
|
<ConfirmContext.Provider value={{ showConfirmDialog }}>
|
|
59
59
|
{children}
|
|
60
60
|
<ConfirmDialog
|
|
61
|
-
|
|
61
|
+
open={confirmDialog.isOpen}
|
|
62
62
|
title={confirmDialog.title}
|
|
63
63
|
message={confirmDialog.message}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
variant={confirmDialog.type}
|
|
65
|
+
confirmText={confirmDialog.confirmButtonText}
|
|
66
|
+
cancelText={confirmDialog.cancelButtonText}
|
|
67
67
|
onConfirm={() => {
|
|
68
68
|
confirmDialog.onConfirm();
|
|
69
69
|
handleCloseDialog();
|
|
70
70
|
}}
|
|
71
|
-
|
|
71
|
+
onClose={() => {
|
|
72
72
|
confirmDialog.onCancel();
|
|
73
73
|
handleCloseDialog();
|
|
74
74
|
}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfirmDialogVariant, Severity } from '@campxdev/react-blueprint';
|
|
2
2
|
import { Store } from 'pullstate';
|
|
3
3
|
|
|
4
4
|
type Classroom = {
|
|
@@ -47,7 +47,7 @@ export type ApplicationStoreType = {
|
|
|
47
47
|
message: string;
|
|
48
48
|
onConfirm: () => void;
|
|
49
49
|
onCancel: () => void;
|
|
50
|
-
type:
|
|
50
|
+
type: ConfirmDialogVariant;
|
|
51
51
|
confirmButtonText?: string;
|
|
52
52
|
cancelButtonText?: string;
|
|
53
53
|
};
|
package/src/hooks/useConfirm.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfirmDialogVariant } from '@campxdev/react-blueprint';
|
|
2
2
|
import { ApplicationStore } from '../context/application-store';
|
|
3
3
|
|
|
4
4
|
const defaultConfirmDialogState = {
|
|
@@ -7,7 +7,7 @@ const defaultConfirmDialogState = {
|
|
|
7
7
|
message: '',
|
|
8
8
|
confirmButtonText: '',
|
|
9
9
|
cancelButtonText: '',
|
|
10
|
-
type: 'confirm' as
|
|
10
|
+
type: 'confirm' as ConfirmDialogVariant,
|
|
11
11
|
onConfirm: () => {},
|
|
12
12
|
onCancel: () => {},
|
|
13
13
|
};
|
|
@@ -24,7 +24,7 @@ export const useConfirm = () => {
|
|
|
24
24
|
message: string;
|
|
25
25
|
confirmButtonText?: string;
|
|
26
26
|
cancelButtonText?: string;
|
|
27
|
-
type?:
|
|
27
|
+
type?: ConfirmDialogVariant;
|
|
28
28
|
}): Promise<boolean> =>
|
|
29
29
|
new Promise((resolve) => {
|
|
30
30
|
ApplicationStore.update((s) => {
|
package/src/routes/main.tsx
CHANGED