message-verify 0.0.31-beta.0 → 0.0.33-beta.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/compoments/modal.d.ts +8 -0
- package/dist/compoments/modal.js +40 -0
- package/dist/index.js +11 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/compoments/modal.tsx +60 -0
- package/src/index.tsx +19 -12
@@ -0,0 +1,40 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
const modalStyle = {
|
3
|
+
position: 'fixed',
|
4
|
+
top: 0,
|
5
|
+
left: 0,
|
6
|
+
width: '100vw',
|
7
|
+
height: '100vh',
|
8
|
+
background: 'rgba(0,0,0,0.3)',
|
9
|
+
display: 'flex',
|
10
|
+
alignItems: 'center',
|
11
|
+
justifyContent: 'center',
|
12
|
+
zIndex: 1000,
|
13
|
+
};
|
14
|
+
const contentStyle = {
|
15
|
+
position: 'relative',
|
16
|
+
background: '#fff',
|
17
|
+
borderRadius: 8,
|
18
|
+
padding: 24,
|
19
|
+
minWidth: 320,
|
20
|
+
minHeight: 120,
|
21
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
|
22
|
+
};
|
23
|
+
const closeBtnStyle = {
|
24
|
+
position: 'absolute',
|
25
|
+
top: 12,
|
26
|
+
right: 12,
|
27
|
+
width: 24,
|
28
|
+
height: 24,
|
29
|
+
border: 'none',
|
30
|
+
background: 'transparent',
|
31
|
+
fontSize: 20,
|
32
|
+
cursor: 'pointer',
|
33
|
+
lineHeight: 1,
|
34
|
+
};
|
35
|
+
const Modal = ({ visible, onClose, children }) => {
|
36
|
+
if (!visible)
|
37
|
+
return null;
|
38
|
+
return (_jsx("div", { style: modalStyle, children: _jsxs("div", { style: contentStyle, children: [_jsx("button", { style: closeBtnStyle, onClick: onClose, "aria-label": "\u5173\u95ED", children: "\u00D7" }), children] }) }));
|
39
|
+
};
|
40
|
+
export default Modal;
|
package/dist/index.js
CHANGED
@@ -30,10 +30,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
30
|
// export default createMessageVerify;
|
31
31
|
// src/modal.tsx
|
32
32
|
// src/modal.tsx
|
33
|
-
import
|
33
|
+
import Modal from './compoments/modal.js';
|
34
34
|
import ReactDOM from 'react-dom/client';
|
35
|
+
import { useState } from 'react';
|
35
36
|
let modalRoot = null;
|
36
|
-
|
37
|
+
// ... existing code ...
|
38
|
+
const AntdModal = ({ config }) => {
|
39
|
+
const [visible, setVisible] = useState(true);
|
40
|
+
return (_jsx(Modal, { visible: visible, onClose: () => {
|
41
|
+
setVisible(false);
|
42
|
+
config.onClose?.();
|
43
|
+
}, children: config.content }));
|
44
|
+
};
|
45
|
+
// ... existing code ...
|
37
46
|
export const showModal = (config) => {
|
38
47
|
const container = document.createElement('div');
|
39
48
|
container.id = 'antd-modal-container';
|
@@ -1 +1 @@
|
|
1
|
-
{"root":["../src/app.tsx","../src/index.tsx","../src/main.tsx","../src/resource.ts","../src/vite-env.d.ts","../src/utils/getfingerprint.ts","../src/utils/index.ts","../src/utils/status.ts"],"version":"5.7.3"}
|
1
|
+
{"root":["../src/app.tsx","../src/index.tsx","../src/main.tsx","../src/resource.ts","../src/vite-env.d.ts","../src/compoments/modal.tsx","../src/utils/getfingerprint.ts","../src/utils/index.ts","../src/utils/status.ts"],"version":"5.7.3"}
|
package/package.json
CHANGED
@@ -0,0 +1,60 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
interface ModalProps {
|
4
|
+
visible: boolean;
|
5
|
+
onClose: () => void;
|
6
|
+
children: React.ReactNode;
|
7
|
+
}
|
8
|
+
|
9
|
+
const modalStyle: React.CSSProperties = {
|
10
|
+
position: 'fixed',
|
11
|
+
top: 0,
|
12
|
+
left: 0,
|
13
|
+
width: '100vw',
|
14
|
+
height: '100vh',
|
15
|
+
background: 'rgba(0,0,0,0.3)',
|
16
|
+
display: 'flex',
|
17
|
+
alignItems: 'center',
|
18
|
+
justifyContent: 'center',
|
19
|
+
zIndex: 1000,
|
20
|
+
};
|
21
|
+
|
22
|
+
const contentStyle: React.CSSProperties = {
|
23
|
+
position: 'relative',
|
24
|
+
background: '#fff',
|
25
|
+
borderRadius: 8,
|
26
|
+
padding: 24,
|
27
|
+
minWidth: 320,
|
28
|
+
minHeight: 120,
|
29
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.15)',
|
30
|
+
};
|
31
|
+
|
32
|
+
const closeBtnStyle: React.CSSProperties = {
|
33
|
+
position: 'absolute',
|
34
|
+
top: 12,
|
35
|
+
right: 12,
|
36
|
+
width: 24,
|
37
|
+
height: 24,
|
38
|
+
border: 'none',
|
39
|
+
background: 'transparent',
|
40
|
+
fontSize: 20,
|
41
|
+
cursor: 'pointer',
|
42
|
+
lineHeight: 1,
|
43
|
+
};
|
44
|
+
|
45
|
+
const Modal: React.FC<ModalProps> = ({ visible, onClose, children }) => {
|
46
|
+
if (!visible) return null;
|
47
|
+
|
48
|
+
return (
|
49
|
+
<div style={modalStyle}>
|
50
|
+
<div style={contentStyle}>
|
51
|
+
<button style={closeBtnStyle} onClick={onClose} aria-label="关闭">
|
52
|
+
×
|
53
|
+
</button>
|
54
|
+
{children}
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
);
|
58
|
+
};
|
59
|
+
|
60
|
+
export default Modal;
|
package/src/index.tsx
CHANGED
@@ -34,8 +34,9 @@
|
|
34
34
|
// export default createMessageVerify;
|
35
35
|
// src/modal.tsx
|
36
36
|
// src/modal.tsx
|
37
|
-
import
|
37
|
+
import Modal from './compoments/modal.js'
|
38
38
|
import ReactDOM from 'react-dom/client'
|
39
|
+
import { useState } from'react'
|
39
40
|
|
40
41
|
export type ModalConfig = {
|
41
42
|
content: React.ReactNode
|
@@ -46,17 +47,23 @@ export type ModalConfig = {
|
|
46
47
|
|
47
48
|
let modalRoot: ReactDOM.Root | null = null
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
// ... existing code ...
|
51
|
+
const AntdModal = ({ config }: { config: ModalConfig }) => {
|
52
|
+
const [visible, setVisible] = useState(true);
|
53
|
+
|
54
|
+
return (
|
55
|
+
<Modal
|
56
|
+
visible={visible}
|
57
|
+
onClose={() => {
|
58
|
+
setVisible(false);
|
59
|
+
config.onClose?.();
|
60
|
+
}}
|
61
|
+
>
|
62
|
+
{config.content}
|
63
|
+
</Modal>
|
64
|
+
);
|
65
|
+
};
|
66
|
+
// ... existing code ...
|
60
67
|
|
61
68
|
export const showModal = (config: ModalConfig) => {
|
62
69
|
const container = document.createElement('div')
|