cynx-lib 1.3.115 → 1.3.116

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.
Files changed (42) hide show
  1. package/gen.js +77 -77
  2. package/package.json +1 -1
  3. package/ui/components/ActionsMenu.jsx +357 -357
  4. package/ui/components/BrandingCard.jsx +6 -6
  5. package/ui/components/Drawer.jsx +208 -208
  6. package/ui/components/Globe.jsx +764 -764
  7. package/ui/components/HoverCard.jsx +85 -85
  8. package/ui/components/PrivacyBlur.jsx +603 -603
  9. package/utils/index.js +24 -24
  10. package/utils/utils/duration.js +139 -139
  11. package/utils/utils/oidc.js +214 -214
  12. package/utils/utils/realtime.js +1634 -1634
  13. package/utils/utils/server.js +371 -371
  14. package/utils/utils/session.js +131 -131
  15. package/utils/utils/session_manager.js +580 -580
  16. package/utils/utils/sso_manager.js +702 -702
  17. package/utils/utils/storage.js +393 -393
  18. package/utils/utils/ui.js +111 -111
  19. package/vue/components/Badge.vue +79 -79
  20. package/vue/components/Button.vue +209 -209
  21. package/vue/components/Checkbox.vue +103 -103
  22. package/vue/components/CircularProgress.vue +383 -383
  23. package/vue/components/Divider.vue +94 -94
  24. package/vue/components/Drawer.vue +243 -243
  25. package/vue/components/InfoBadge.vue +223 -223
  26. package/vue/components/Input.vue +341 -341
  27. package/vue/components/LinearProgress.vue +268 -268
  28. package/vue/components/Modal.vue +226 -226
  29. package/vue/components/Pagination.vue +199 -199
  30. package/vue/components/Select.vue +713 -713
  31. package/vue/components/Sidebar.vue +955 -955
  32. package/vue/components/Skeleton.vue +91 -91
  33. package/vue/components/Spinner.vue +263 -263
  34. package/vue/components/StatusTag.vue +89 -89
  35. package/vue/components/TabBar.vue +176 -176
  36. package/vue/components/Table.vue +393 -393
  37. package/vue/components/TimePicker.vue +399 -399
  38. package/vue/components/Toggle.vue +115 -115
  39. package/vue/components/XTable.vue +140 -140
  40. package/vue/composables/useAutoSkeletonRows.ts +71 -71
  41. package/vue/index.d.ts +67 -67
  42. package/vue/index.js +86 -86
@@ -76,10 +76,10 @@ export function BrandingCard({ label, hint, value, onUpload, onRemove, saving, o
76
76
  {filename || 'Not set'}
77
77
  </div>
78
78
  )}
79
- <div style={{ display: 'flex', gap: 4, flexShrink: 0 }}>
80
- <Button variant="ghost" size="xs" type="button" icon={<Pencil size={11} />} onClick={() => setEditOpen(true)} style={cardStyle ? { background: 'var(--surface,#fff)', color: 'var(--t, #333)' } : undefined}>Edit</Button>
79
+ <div style={{ display: 'flex', gap: 6, flexShrink: 0 }}>
80
+ <Button variant="ghost" size="md" type="button" icon={<Pencil size={14} />} onClick={() => setEditOpen(true)} style={cardStyle ? { background: 'var(--surface,#fff)', color: 'var(--t, #333)' } : undefined}>Edit</Button>
81
81
  {hasExisting && (
82
- <Button variant="ghost" size="xs" type="button" icon={<Trash2 size={11} />} style={cardStyle ? { background: 'var(--surface,#fff)', color: 'var(--danger, #f64747)' } : { color: 'var(--danger, #f64747)' }}
82
+ <Button variant="ghost" size="md" type="button" icon={<Trash2 size={14} />} style={cardStyle ? { background: 'var(--surface,#fff)', color: 'var(--danger, #f64747)' } : { color: 'var(--danger, #f64747)' }}
83
83
  onClick={handleRemove} disabled={saving}>Remove</Button>
84
84
  )}
85
85
  </div>
@@ -88,7 +88,7 @@ export function BrandingCard({ label, hint, value, onUpload, onRemove, saving, o
88
88
 
89
89
  {previewOpen && (
90
90
  <Modal title={label} open={previewOpen} onClose={() => setPreviewOpen(false)}
91
- footer={<Button variant="ghost" size="sm" onClick={() => setPreviewOpen(false)}>Close</Button>}>
91
+ footer={<Button variant="ghost" size="md" onClick={() => setPreviewOpen(false)}>Close</Button>}>
92
92
  <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '16px 0' }}>
93
93
  <img src={previewUrl} alt={label} style={{ maxWidth: '100%', maxHeight: 400, objectFit: 'contain', borderRadius: 6 }} />
94
94
  </div>
@@ -99,8 +99,8 @@ export function BrandingCard({ label, hint, value, onUpload, onRemove, saving, o
99
99
  <Modal title={`Edit ${label}`} open={editOpen} onClose={() => { setEditOpen(false); setPendingFile(null); setPendingUrl(''); }}
100
100
  footer={
101
101
  <>
102
- <Button variant="ghost" size="sm" onClick={() => { setEditOpen(false); setPendingFile(null); setPendingUrl(''); }}>Cancel</Button>
103
- <Button variant="primary" size="sm" disabled={saving || uploading} onClick={handleSave}>
102
+ <Button variant="ghost" size="md" onClick={() => { setEditOpen(false); setPendingFile(null); setPendingUrl(''); }}>Cancel</Button>
103
+ <Button variant="primary" size="md" disabled={saving || uploading} onClick={handleSave}>
104
104
  {uploading ? 'Uploading...' : saving ? 'Saving...' : 'Save'}
105
105
  </Button>
106
106
  </>
@@ -1,208 +1,208 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import { createPortal } from 'react-dom';
3
- import { X } from 'lucide-react';
4
-
5
- const DRAWER_STYLES = `
6
- @keyframes cynxDrawerFadeIn { from { opacity: 0; } to { opacity: 1; } }
7
- @keyframes cynxDrawerFadeOut { from { opacity: 1; } to { opacity: 0; } }
8
- @keyframes cynxDrawerSlideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
9
- @keyframes cynxDrawerSlideOutRight { from { transform: translateX(0); } to { transform: translateX(100%); } }
10
- @keyframes cynxDrawerSlideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
11
- @keyframes cynxDrawerSlideOutLeft { from { transform: translateX(0); } to { transform: translateX(-100%); } }
12
- `;
13
-
14
- let _drawer_id = 'cynx-drawer-styles';
15
- function ensureDrawerStyles() {
16
- if (typeof document === 'undefined') return;
17
- if (document.getElementById(_drawer_id)) return;
18
- const tag = document.createElement('style');
19
- tag.id = _drawer_id;
20
- tag.textContent = DRAWER_STYLES;
21
- document.head.appendChild(tag);
22
- }
23
-
24
- export function Drawer({
25
- open = false,
26
- onClose,
27
- title = '',
28
- description = '',
29
- width = 560,
30
- side = 'right',
31
- showClose = true,
32
- children,
33
- footer,
34
- header,
35
- style = {},
36
- bodyStyle = {},
37
- }) {
38
- const [closing, setClosing] = useState(false);
39
-
40
- useEffect(() => {
41
- ensureDrawerStyles();
42
- }, []);
43
-
44
- const handleClose = () => {
45
- if (closing) return;
46
- setClosing(true);
47
- setTimeout(() => {
48
- setClosing(false);
49
- onClose?.();
50
- }, 260);
51
- };
52
-
53
- useEffect(() => {
54
- if (typeof document === 'undefined') return;
55
- const handleKeydown = (e) => {
56
- if (e.key === 'Escape' && open) handleClose();
57
- };
58
- if (open) {
59
- document.body.style.overflow = 'hidden';
60
- window.addEventListener('keydown', handleKeydown);
61
- } else {
62
- document.body.style.overflow = '';
63
- window.removeEventListener('keydown', handleKeydown);
64
- }
65
- return () => {
66
- document.body.style.overflow = '';
67
- window.removeEventListener('keydown', handleKeydown);
68
- };
69
- }, [open]);
70
-
71
- if (!open && !closing) return null;
72
- if (typeof document === 'undefined') return null;
73
-
74
- const resolvedWidth = typeof width === 'number' ? `${width}px` : width;
75
- const slideInAnim = side === 'left' ? 'cynxDrawerSlideInLeft' : 'cynxDrawerSlideInRight';
76
- const slideOutAnim = side === 'left' ? 'cynxDrawerSlideOutLeft' : 'cynxDrawerSlideOutRight';
77
-
78
- return createPortal(
79
- <div
80
- style={{
81
- position: 'fixed',
82
- inset: 0,
83
- background: 'rgba(20, 22, 41, .45)',
84
- zIndex: 8500,
85
- display: 'flex',
86
- justifyContent: side === 'left' ? 'flex-start' : 'flex-end',
87
- animation: `${closing ? 'cynxDrawerFadeOut' : 'cynxDrawerFadeIn'} .26s ease forwards`,
88
- }}
89
- onMouseDown={(e) => {
90
- if (e.target === e.currentTarget) handleClose();
91
- }}
92
- >
93
- <div
94
- style={{
95
- background: 'var(--surface, #ffffff)',
96
- borderLeft: side === 'right' ? '1px solid var(--border, var(--bd, #e2e8f0))' : 'none',
97
- borderRight: side === 'left' ? '1px solid var(--border, var(--bd, #e2e8f0))' : 'none',
98
- width: resolvedWidth,
99
- maxWidth: '100vw',
100
- height: '100%',
101
- boxShadow: 'var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, .25))',
102
- display: 'flex',
103
- flexDirection: 'column',
104
- overflow: 'hidden',
105
- animation: `${closing ? slideOutAnim : slideInAnim} .26s cubic-bezier(.16, 1, .3, 1) forwards`,
106
- ...style,
107
- }}
108
- onMouseDown={(e) => e.stopPropagation()}
109
- >
110
- {/* Header */}
111
- <div
112
- style={{
113
- display: 'flex',
114
- alignItems: 'center',
115
- justifyContent: 'space-between',
116
- padding: '16px 20px',
117
- borderBottom: '1px solid var(--border-light, #ebebf0)',
118
- flexShrink: 0,
119
- }}
120
- >
121
- {header ? (
122
- header
123
- ) : (
124
- <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
125
- <span
126
- style={{
127
- fontSize: '1rem',
128
- fontWeight: 700,
129
- letterSpacing: '-.01em',
130
- color: 'var(--t, var(--primary-text, #0f111c))',
131
- }}
132
- >
133
- {{ title }}
134
- </span>
135
- {description && (
136
- <span
137
- style={{
138
- fontSize: '.75rem',
139
- color: 'var(--muted, #797b8d)',
140
- }}
141
- >
142
- {description}
143
- </span>
144
- )}
145
- </div>
146
- )}
147
-
148
- {showClose && (
149
- <button
150
- type="button"
151
- style={{
152
- background: 'none',
153
- border: 'none',
154
- cursor: 'pointer',
155
- padding: '6px',
156
- borderRadius: '6px',
157
- color: 'var(--muted, #797b8d)',
158
- display: 'flex',
159
- alignItems: 'center',
160
- justifyContent: 'center',
161
- transition: 'all .14s',
162
- }}
163
- onClick={handleClose}
164
- >
165
- <X size={18} />
166
- </button>
167
- )}
168
- </div>
169
-
170
- {/* Body */}
171
- <div
172
- className="custom-scrollbar"
173
- style={{
174
- padding: '20px',
175
- overflowX: 'hidden',
176
- overflowY: 'auto',
177
- flex: '1 1 auto',
178
- minHeight: 0,
179
- color: 'var(--t, var(--primary-text, #0f111c))',
180
- ...bodyStyle,
181
- }}
182
- >
183
- {children}
184
- </div>
185
-
186
- {/* Footer */}
187
- {footer && (
188
- <div
189
- style={{
190
- display: 'flex',
191
- justifyContent: 'flex-end',
192
- gap: 8,
193
- padding: '14px 20px',
194
- borderTop: '1px solid var(--border-light, #ebebf0)',
195
- background: 'var(--grey-1, #f5f5f8)',
196
- flexShrink: 0,
197
- }}
198
- >
199
- {footer}
200
- </div>
201
- )}
202
- </div>
203
- </div>,
204
- document.body
205
- );
206
- }
207
-
208
- export default Drawer;
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { X } from 'lucide-react';
4
+
5
+ const DRAWER_STYLES = `
6
+ @keyframes cynxDrawerFadeIn { from { opacity: 0; } to { opacity: 1; } }
7
+ @keyframes cynxDrawerFadeOut { from { opacity: 1; } to { opacity: 0; } }
8
+ @keyframes cynxDrawerSlideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
9
+ @keyframes cynxDrawerSlideOutRight { from { transform: translateX(0); } to { transform: translateX(100%); } }
10
+ @keyframes cynxDrawerSlideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }
11
+ @keyframes cynxDrawerSlideOutLeft { from { transform: translateX(0); } to { transform: translateX(-100%); } }
12
+ `;
13
+
14
+ let _drawer_id = 'cynx-drawer-styles';
15
+ function ensureDrawerStyles() {
16
+ if (typeof document === 'undefined') return;
17
+ if (document.getElementById(_drawer_id)) return;
18
+ const tag = document.createElement('style');
19
+ tag.id = _drawer_id;
20
+ tag.textContent = DRAWER_STYLES;
21
+ document.head.appendChild(tag);
22
+ }
23
+
24
+ export function Drawer({
25
+ open = false,
26
+ onClose,
27
+ title = '',
28
+ description = '',
29
+ width = 560,
30
+ side = 'right',
31
+ showClose = true,
32
+ children,
33
+ footer,
34
+ header,
35
+ style = {},
36
+ bodyStyle = {},
37
+ }) {
38
+ const [closing, setClosing] = useState(false);
39
+
40
+ useEffect(() => {
41
+ ensureDrawerStyles();
42
+ }, []);
43
+
44
+ const handleClose = () => {
45
+ if (closing) return;
46
+ setClosing(true);
47
+ setTimeout(() => {
48
+ setClosing(false);
49
+ onClose?.();
50
+ }, 260);
51
+ };
52
+
53
+ useEffect(() => {
54
+ if (typeof document === 'undefined') return;
55
+ const handleKeydown = (e) => {
56
+ if (e.key === 'Escape' && open) handleClose();
57
+ };
58
+ if (open) {
59
+ document.body.style.overflow = 'hidden';
60
+ window.addEventListener('keydown', handleKeydown);
61
+ } else {
62
+ document.body.style.overflow = '';
63
+ window.removeEventListener('keydown', handleKeydown);
64
+ }
65
+ return () => {
66
+ document.body.style.overflow = '';
67
+ window.removeEventListener('keydown', handleKeydown);
68
+ };
69
+ }, [open]);
70
+
71
+ if (!open && !closing) return null;
72
+ if (typeof document === 'undefined') return null;
73
+
74
+ const resolvedWidth = typeof width === 'number' ? `${width}px` : width;
75
+ const slideInAnim = side === 'left' ? 'cynxDrawerSlideInLeft' : 'cynxDrawerSlideInRight';
76
+ const slideOutAnim = side === 'left' ? 'cynxDrawerSlideOutLeft' : 'cynxDrawerSlideOutRight';
77
+
78
+ return createPortal(
79
+ <div
80
+ style={{
81
+ position: 'fixed',
82
+ inset: 0,
83
+ background: 'rgba(20, 22, 41, .45)',
84
+ zIndex: 8500,
85
+ display: 'flex',
86
+ justifyContent: side === 'left' ? 'flex-start' : 'flex-end',
87
+ animation: `${closing ? 'cynxDrawerFadeOut' : 'cynxDrawerFadeIn'} .26s ease forwards`,
88
+ }}
89
+ onMouseDown={(e) => {
90
+ if (e.target === e.currentTarget) handleClose();
91
+ }}
92
+ >
93
+ <div
94
+ style={{
95
+ background: 'var(--surface, #ffffff)',
96
+ borderLeft: side === 'right' ? '1px solid var(--border, var(--bd, #e2e8f0))' : 'none',
97
+ borderRight: side === 'left' ? '1px solid var(--border, var(--bd, #e2e8f0))' : 'none',
98
+ width: resolvedWidth,
99
+ maxWidth: '100vw',
100
+ height: '100%',
101
+ boxShadow: 'var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, .25))',
102
+ display: 'flex',
103
+ flexDirection: 'column',
104
+ overflow: 'hidden',
105
+ animation: `${closing ? slideOutAnim : slideInAnim} .26s cubic-bezier(.16, 1, .3, 1) forwards`,
106
+ ...style,
107
+ }}
108
+ onMouseDown={(e) => e.stopPropagation()}
109
+ >
110
+ {/* Header */}
111
+ <div
112
+ style={{
113
+ display: 'flex',
114
+ alignItems: 'center',
115
+ justifyContent: 'space-between',
116
+ padding: '16px 20px',
117
+ borderBottom: '1px solid var(--border-light, #ebebf0)',
118
+ flexShrink: 0,
119
+ }}
120
+ >
121
+ {header ? (
122
+ header
123
+ ) : (
124
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
125
+ <span
126
+ style={{
127
+ fontSize: '1rem',
128
+ fontWeight: 700,
129
+ letterSpacing: '-.01em',
130
+ color: 'var(--t, var(--primary-text, #0f111c))',
131
+ }}
132
+ >
133
+ {{ title }}
134
+ </span>
135
+ {description && (
136
+ <span
137
+ style={{
138
+ fontSize: '.75rem',
139
+ color: 'var(--muted, #797b8d)',
140
+ }}
141
+ >
142
+ {description}
143
+ </span>
144
+ )}
145
+ </div>
146
+ )}
147
+
148
+ {showClose && (
149
+ <button
150
+ type="button"
151
+ style={{
152
+ background: 'none',
153
+ border: 'none',
154
+ cursor: 'pointer',
155
+ padding: '6px',
156
+ borderRadius: '6px',
157
+ color: 'var(--muted, #797b8d)',
158
+ display: 'flex',
159
+ alignItems: 'center',
160
+ justifyContent: 'center',
161
+ transition: 'all .14s',
162
+ }}
163
+ onClick={handleClose}
164
+ >
165
+ <X size={18} />
166
+ </button>
167
+ )}
168
+ </div>
169
+
170
+ {/* Body */}
171
+ <div
172
+ className="custom-scrollbar"
173
+ style={{
174
+ padding: '20px',
175
+ overflowX: 'hidden',
176
+ overflowY: 'auto',
177
+ flex: '1 1 auto',
178
+ minHeight: 0,
179
+ color: 'var(--t, var(--primary-text, #0f111c))',
180
+ ...bodyStyle,
181
+ }}
182
+ >
183
+ {children}
184
+ </div>
185
+
186
+ {/* Footer */}
187
+ {footer && (
188
+ <div
189
+ style={{
190
+ display: 'flex',
191
+ justifyContent: 'flex-end',
192
+ gap: 8,
193
+ padding: '14px 20px',
194
+ borderTop: '1px solid var(--border-light, #ebebf0)',
195
+ background: 'var(--grey-1, #f5f5f8)',
196
+ flexShrink: 0,
197
+ }}
198
+ >
199
+ {footer}
200
+ </div>
201
+ )}
202
+ </div>
203
+ </div>,
204
+ document.body
205
+ );
206
+ }
207
+
208
+ export default Drawer;