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.
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface ModalProps {
3
+ visible: boolean;
4
+ onClose: () => void;
5
+ children: React.ReactNode;
6
+ }
7
+ declare const Modal: React.FC<ModalProps>;
8
+ export default Modal;
@@ -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 { Modal } from 'antd';
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
- const AntdModal = ({ config }) => (_jsx(Modal, { open: true, title: config.title || '提示', width: config.width || 600, onCancel: config.onClose, footer: null, children: config.content }));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "0.0.31-beta.0",
3
+ "version": "0.0.33-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
@@ -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 { Modal } from 'antd'
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
- const AntdModal = ({ config }: { config: ModalConfig }) => (
50
- <Modal
51
- open={true}
52
- title={config.title || '提示'}
53
- width={config.width || 600}
54
- onCancel={config.onClose}
55
- footer={null}
56
- >
57
- {config.content}
58
- </Modal>
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')