@dashadmin/dash-dialog 1.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/README.md +0 -0
- package/index.d.ts +3 -0
- package/index.js +92 -0
- package/package.json +49 -0
package/README.md
ADDED
|
File without changes
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as e, Fragment as o, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import * as x from "react";
|
|
3
|
+
import { createContext as T, useState as A, useContext as _ } from "react";
|
|
4
|
+
import { Dialog as j, DialogTitle as w, DialogContent as E, DialogActions as F, Button as D, Paper as I, Portal as M } from "@mui/material";
|
|
5
|
+
const b = (l) => /* @__PURE__ */ e(I, { ...l }), z = (l) => {
|
|
6
|
+
const {
|
|
7
|
+
onClose: i,
|
|
8
|
+
onConfirm: r,
|
|
9
|
+
onCancel: c,
|
|
10
|
+
open: a,
|
|
11
|
+
closeText: m = /* @__PURE__ */ e(o, {}),
|
|
12
|
+
confirmText: n = /* @__PURE__ */ e(o, {}),
|
|
13
|
+
cancelText: t = /* @__PURE__ */ e(o, {}),
|
|
14
|
+
title: C,
|
|
15
|
+
variant: p,
|
|
16
|
+
className: f,
|
|
17
|
+
showCancelButton: u = !1,
|
|
18
|
+
showConfirmButton: s = !0,
|
|
19
|
+
dialogActions: v,
|
|
20
|
+
content: S,
|
|
21
|
+
children: P,
|
|
22
|
+
...k
|
|
23
|
+
} = l, [B, d] = x.useState(a);
|
|
24
|
+
return x.useEffect(() => {
|
|
25
|
+
d(a);
|
|
26
|
+
}, [a]), /* @__PURE__ */ h(
|
|
27
|
+
j,
|
|
28
|
+
{
|
|
29
|
+
hideBackdrop: !0,
|
|
30
|
+
disableEnforceFocus: !0,
|
|
31
|
+
PaperComponent: b,
|
|
32
|
+
onClose: (g) => {
|
|
33
|
+
d(!1), i && i();
|
|
34
|
+
},
|
|
35
|
+
className: f,
|
|
36
|
+
open: B,
|
|
37
|
+
...k,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ e(w, { id: "alert-dialog-title", children: C }),
|
|
40
|
+
/* @__PURE__ */ e(E, { children: P || S }),
|
|
41
|
+
/* @__PURE__ */ h(F, { children: [
|
|
42
|
+
v || /* @__PURE__ */ e(o, {}),
|
|
43
|
+
u === !0 ? /* @__PURE__ */ e(D, { onClick: (g) => {
|
|
44
|
+
d(!1), c && c();
|
|
45
|
+
}, children: t }) : /* @__PURE__ */ e(o, {}),
|
|
46
|
+
s === !0 ? /* @__PURE__ */ e(D, { onClick: (g) => {
|
|
47
|
+
d(!1), r && r();
|
|
48
|
+
}, children: n }) : /* @__PURE__ */ e(o, {})
|
|
49
|
+
] })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}, O = T(null), J = () => _(O), K = (l) => {
|
|
54
|
+
const { component: i, componentProps: r = {}, children: c } = l, a = i || z, m = {
|
|
55
|
+
open: !1,
|
|
56
|
+
variant: "default",
|
|
57
|
+
content: "",
|
|
58
|
+
title: "",
|
|
59
|
+
children: null
|
|
60
|
+
}, [n, t] = A({ ...m, ...r }), C = () => {
|
|
61
|
+
t(null), n.onCancel && n.onCancel();
|
|
62
|
+
}, p = () => {
|
|
63
|
+
t(null), n.onClose && n.onClose();
|
|
64
|
+
}, f = () => {
|
|
65
|
+
t(null), n.onConfirm && n.onConfirm();
|
|
66
|
+
}, u = (s) => {
|
|
67
|
+
t({
|
|
68
|
+
...n,
|
|
69
|
+
...s,
|
|
70
|
+
...s ? { open: !0 } : { open: !1 }
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ h(o, { children: [
|
|
74
|
+
/* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
|
|
75
|
+
a,
|
|
76
|
+
{
|
|
77
|
+
sx: { zIndex: 1e6 },
|
|
78
|
+
...n,
|
|
79
|
+
onConfirm: () => f(),
|
|
80
|
+
onClose: () => p(),
|
|
81
|
+
onCancel: () => C()
|
|
82
|
+
}
|
|
83
|
+
) }),
|
|
84
|
+
/* @__PURE__ */ e(O.Provider, { value: u, children: c })
|
|
85
|
+
] });
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
O as DialogServiceContext,
|
|
89
|
+
K as DialogServiceProvider,
|
|
90
|
+
z as default,
|
|
91
|
+
J as useDialog
|
|
92
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dashadmin/dash-dialog",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "dash-dialog — DASH framework package",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Francisco Aranda <farandal@gmail.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"module": "index.js",
|
|
10
|
+
"types": "index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./index.d.ts",
|
|
14
|
+
"import": "./index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"**/*"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@emotion/react": "latest",
|
|
23
|
+
"@emotion/styled": "latest",
|
|
24
|
+
"@mui/material": "^7.3.10",
|
|
25
|
+
"query-string": "latest",
|
|
26
|
+
"react-admin": "5.14.6",
|
|
27
|
+
"react-custom-scrollbars-2": "latest",
|
|
28
|
+
"react-draggable": "latest",
|
|
29
|
+
"react-loading-overlay-ts": "latest",
|
|
30
|
+
"react-query": "latest",
|
|
31
|
+
"react-redux": "latest",
|
|
32
|
+
"react-router": "^7.9.6",
|
|
33
|
+
"react-router-dom": "^7.9.6",
|
|
34
|
+
"react-spinners": "latest",
|
|
35
|
+
"react-toastify": "latest"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "latest",
|
|
39
|
+
"react-beautiful-dnd": "latest",
|
|
40
|
+
"react-custom-scrollbars-2": "latest",
|
|
41
|
+
"react-dom": "latest"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18"
|
|
48
|
+
}
|
|
49
|
+
}
|