@agenticmail/enterprise 0.5.246 → 0.5.247
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.
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { h, useState } from './utils.js';
|
|
1
|
+
import { h, useState, useEffect, useCallback } from './utils.js';
|
|
2
2
|
import { I } from './icons.js';
|
|
3
|
-
import { Modal } from './modal.js';
|
|
4
3
|
|
|
5
4
|
export function HelpButton(props) {
|
|
6
5
|
var _open = useState(false);
|
|
7
6
|
var isOpen = _open[0]; var setOpen = _open[1];
|
|
8
7
|
|
|
8
|
+
// Close on Escape key
|
|
9
|
+
useEffect(function() {
|
|
10
|
+
if (!isOpen) return;
|
|
11
|
+
function onKey(e) { if (e.key === 'Escape') setOpen(false); }
|
|
12
|
+
document.addEventListener('keydown', onKey);
|
|
13
|
+
return function() { document.removeEventListener('keydown', onKey); };
|
|
14
|
+
}, [isOpen]);
|
|
15
|
+
|
|
9
16
|
return h('span', { style: { display: 'inline-flex', alignItems: 'center' } },
|
|
10
17
|
h('button', {
|
|
11
|
-
onClick: function(e) { e.stopPropagation(); setOpen(
|
|
18
|
+
onClick: function(e) { e.stopPropagation(); e.preventDefault(); setOpen(!isOpen); },
|
|
12
19
|
title: 'Learn more about ' + (props.label || 'this section'),
|
|
13
20
|
style: {
|
|
14
21
|
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
@@ -22,18 +29,42 @@ export function HelpButton(props) {
|
|
|
22
29
|
onMouseLeave: function(e) { e.currentTarget.style.borderColor = 'var(--text-muted, #6b7280)'; e.currentTarget.style.color = 'var(--text-muted, #6b7280)'; }
|
|
23
30
|
}, '?'),
|
|
24
31
|
isOpen && h('div', {
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
onClick: function(e) { e.stopPropagation(); },
|
|
33
|
+
style: {
|
|
34
|
+
position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, zIndex: 200,
|
|
35
|
+
}
|
|
27
36
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
// Backdrop — click to close
|
|
38
|
+
h('div', {
|
|
39
|
+
onClick: function(e) { e.stopPropagation(); setOpen(false); },
|
|
40
|
+
style: { position: 'absolute', inset: 0, background: 'rgba(0,0,0,0.5)' }
|
|
41
|
+
}),
|
|
42
|
+
// Help panel — centered card, NOT a Modal component
|
|
43
|
+
h('div', {
|
|
44
|
+
onClick: function(e) { e.stopPropagation(); },
|
|
45
|
+
style: {
|
|
46
|
+
position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)',
|
|
47
|
+
background: 'var(--bg-card, #181b28)', border: '1px solid var(--border)',
|
|
48
|
+
borderRadius: 'var(--radius-xl, 14px)', width: 520, maxWidth: '92vw', maxHeight: '80vh',
|
|
49
|
+
overflow: 'hidden', boxShadow: '0 25px 50px rgba(0,0,0,0.4)',
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
// Header
|
|
53
|
+
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '14px 20px', borderBottom: '1px solid var(--border)' } },
|
|
54
|
+
h('h3', { style: { fontSize: 15, fontWeight: 700, margin: 0 } }, props.label || 'Help'),
|
|
55
|
+
h('button', {
|
|
56
|
+
onClick: function(e) { e.stopPropagation(); setOpen(false); },
|
|
57
|
+
style: {
|
|
58
|
+
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
59
|
+
width: 28, height: 28, borderRadius: 6, border: 'none',
|
|
60
|
+
background: 'var(--bg-tertiary)', color: 'var(--text-secondary)',
|
|
61
|
+
cursor: 'pointer', fontSize: 14,
|
|
62
|
+
}
|
|
63
|
+
}, I.x())
|
|
32
64
|
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)
|
|
65
|
+
// Body
|
|
66
|
+
h('div', { style: { padding: '16px 20px', overflowY: 'auto', maxHeight: 'calc(80vh - 60px)', fontSize: 14, lineHeight: 1.7, color: 'var(--text-secondary, #9ca3af)' } },
|
|
67
|
+
props.children
|
|
37
68
|
)
|
|
38
69
|
)
|
|
39
70
|
)
|
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { h, useState } from './utils.js';
|
|
1
|
+
import { h, useState, useEffect, useCallback } from './utils.js';
|
|
2
2
|
import { I } from './icons.js';
|
|
3
|
-
import { Modal } from './modal.js';
|
|
4
3
|
|
|
5
4
|
export function HelpButton(props) {
|
|
6
5
|
var _open = useState(false);
|
|
7
6
|
var isOpen = _open[0]; var setOpen = _open[1];
|
|
8
7
|
|
|
8
|
+
// Close on Escape key
|
|
9
|
+
useEffect(function() {
|
|
10
|
+
if (!isOpen) return;
|
|
11
|
+
function onKey(e) { if (e.key === 'Escape') setOpen(false); }
|
|
12
|
+
document.addEventListener('keydown', onKey);
|
|
13
|
+
return function() { document.removeEventListener('keydown', onKey); };
|
|
14
|
+
}, [isOpen]);
|
|
15
|
+
|
|
9
16
|
return h('span', { style: { display: 'inline-flex', alignItems: 'center' } },
|
|
10
17
|
h('button', {
|
|
11
|
-
onClick: function(e) { e.stopPropagation(); setOpen(
|
|
18
|
+
onClick: function(e) { e.stopPropagation(); e.preventDefault(); setOpen(!isOpen); },
|
|
12
19
|
title: 'Learn more about ' + (props.label || 'this section'),
|
|
13
20
|
style: {
|
|
14
21
|
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
@@ -22,18 +29,42 @@ export function HelpButton(props) {
|
|
|
22
29
|
onMouseLeave: function(e) { e.currentTarget.style.borderColor = 'var(--text-muted, #6b7280)'; e.currentTarget.style.color = 'var(--text-muted, #6b7280)'; }
|
|
23
30
|
}, '?'),
|
|
24
31
|
isOpen && h('div', {
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
onClick: function(e) { e.stopPropagation(); },
|
|
33
|
+
style: {
|
|
34
|
+
position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, zIndex: 200,
|
|
35
|
+
}
|
|
27
36
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
// Backdrop — click to close
|
|
38
|
+
h('div', {
|
|
39
|
+
onClick: function(e) { e.stopPropagation(); setOpen(false); },
|
|
40
|
+
style: { position: 'absolute', inset: 0, background: 'rgba(0,0,0,0.5)' }
|
|
41
|
+
}),
|
|
42
|
+
// Help panel — centered card, NOT a Modal component
|
|
43
|
+
h('div', {
|
|
44
|
+
onClick: function(e) { e.stopPropagation(); },
|
|
45
|
+
style: {
|
|
46
|
+
position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)',
|
|
47
|
+
background: 'var(--bg-card, #181b28)', border: '1px solid var(--border)',
|
|
48
|
+
borderRadius: 'var(--radius-xl, 14px)', width: 520, maxWidth: '92vw', maxHeight: '80vh',
|
|
49
|
+
overflow: 'hidden', boxShadow: '0 25px 50px rgba(0,0,0,0.4)',
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
// Header
|
|
53
|
+
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '14px 20px', borderBottom: '1px solid var(--border)' } },
|
|
54
|
+
h('h3', { style: { fontSize: 15, fontWeight: 700, margin: 0 } }, props.label || 'Help'),
|
|
55
|
+
h('button', {
|
|
56
|
+
onClick: function(e) { e.stopPropagation(); setOpen(false); },
|
|
57
|
+
style: {
|
|
58
|
+
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
|
59
|
+
width: 28, height: 28, borderRadius: 6, border: 'none',
|
|
60
|
+
background: 'var(--bg-tertiary)', color: 'var(--text-secondary)',
|
|
61
|
+
cursor: 'pointer', fontSize: 14,
|
|
62
|
+
}
|
|
63
|
+
}, I.x())
|
|
32
64
|
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)
|
|
65
|
+
// Body
|
|
66
|
+
h('div', { style: { padding: '16px 20px', overflowY: 'auto', maxHeight: 'calc(80vh - 60px)', fontSize: 14, lineHeight: 1.7, color: 'var(--text-secondary, #9ca3af)' } },
|
|
67
|
+
props.children
|
|
37
68
|
)
|
|
38
69
|
)
|
|
39
70
|
)
|