cynx-lib 1.3.100 → 1.3.102
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/package.json +5 -1
- package/ui/components/Globe.jsx +764 -0
- package/ui/components/Input.jsx +54 -4
- package/ui/index.cjs +5 -0
- package/ui/index.js +3 -0
- package/utils/index.cjs +5 -0
- package/utils/index.js +3 -1
- package/utils/utils/sso_manager.cjs +621 -0
- package/utils/utils/sso_manager.js +702 -0
package/ui/components/Input.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
|
+
import { Eye, EyeOff } from 'lucide-react';
|
|
2
3
|
|
|
3
4
|
const SIZES = {
|
|
4
5
|
xs: { height: 24, fontSize: 11, paddingH: 6 },
|
|
@@ -23,18 +24,25 @@ export default function Input({
|
|
|
23
24
|
className = '',
|
|
24
25
|
style = {},
|
|
25
26
|
value,
|
|
27
|
+
toggle,
|
|
28
|
+
togglePassword,
|
|
26
29
|
...props
|
|
27
30
|
}) {
|
|
28
31
|
const inputRef = useRef(null);
|
|
29
32
|
const [focused, setFocused] = useState(false);
|
|
30
33
|
const [hovered, setHovered] = useState(false);
|
|
34
|
+
const [revealed, setRevealed] = useState(false);
|
|
31
35
|
const s = SIZES[size] || SIZES.md;
|
|
32
36
|
|
|
33
37
|
const isPasswd = type === 'passwd';
|
|
34
|
-
const
|
|
38
|
+
const isPassword = type === 'password';
|
|
39
|
+
const isSecret = isPasswd || isPassword;
|
|
40
|
+
const showToggle = isSecret && toggle !== false && togglePassword !== false && !props.disabled && !multiline;
|
|
41
|
+
|
|
42
|
+
const resolvedType = isPassword ? (revealed ? 'text' : 'password') : (isPasswd ? 'text' : type);
|
|
35
43
|
const hasValue = value !== undefined && value !== null && value !== '';
|
|
36
44
|
|
|
37
|
-
const passwdStyle = isPasswd ? {
|
|
45
|
+
const passwdStyle = (isPasswd && !revealed) ? {
|
|
38
46
|
WebkitTextSecurity: 'disc',
|
|
39
47
|
textSecurity: 'disc',
|
|
40
48
|
fontFamily: hasValue ? 'monospace' : 'var(--f,var(--sans,inherit))',
|
|
@@ -42,6 +50,13 @@ export default function Input({
|
|
|
42
50
|
letterSpacing: hasValue ? '0.15em' : 'normal',
|
|
43
51
|
} : {};
|
|
44
52
|
|
|
53
|
+
const passwdAttrs = isPasswd ? {
|
|
54
|
+
autoComplete: props.autoComplete !== undefined ? props.autoComplete : 'off',
|
|
55
|
+
'data-1p-ignore': 'true',
|
|
56
|
+
'data-form-type': 'other',
|
|
57
|
+
'data-bwignore': 'true',
|
|
58
|
+
} : {};
|
|
59
|
+
|
|
45
60
|
function handleClear() {
|
|
46
61
|
if (props.onChange) props.onChange({ target: { value: '' } });
|
|
47
62
|
if (onClear) onClear();
|
|
@@ -52,7 +67,8 @@ export default function Input({
|
|
|
52
67
|
const hasIconRight = !!iconRight;
|
|
53
68
|
const showClear = clearable && !!value && !props.disabled && !multiline;
|
|
54
69
|
const hasSuffix = !!suffix && !multiline;
|
|
55
|
-
const showRightSlot = showClear || hasSuffix;
|
|
70
|
+
const showRightSlot = showClear || hasSuffix || showToggle;
|
|
71
|
+
const rightSlotPadding = (showClear && showToggle) ? 54 : (hasIconRight || showRightSlot) ? 34 : s.paddingH;
|
|
56
72
|
|
|
57
73
|
return (
|
|
58
74
|
<div style={{
|
|
@@ -164,7 +180,7 @@ export default function Input({
|
|
|
164
180
|
height: s.height,
|
|
165
181
|
padding: `0 ${s.paddingH}px`,
|
|
166
182
|
paddingLeft: hasIconLeft ? 34 : s.paddingH,
|
|
167
|
-
paddingRight:
|
|
183
|
+
paddingRight: rightSlotPadding,
|
|
168
184
|
outline: 'none',
|
|
169
185
|
transition: 'border-color .14s, box-shadow .14s',
|
|
170
186
|
boxShadow: error
|
|
@@ -178,6 +194,7 @@ export default function Input({
|
|
|
178
194
|
...style,
|
|
179
195
|
}}
|
|
180
196
|
value={value}
|
|
197
|
+
{...passwdAttrs}
|
|
181
198
|
{...props}
|
|
182
199
|
onFocus={e => { setFocused(true); props.onFocus?.(e); }}
|
|
183
200
|
onBlur={e => { setFocused(false); setHovered(false); props.onBlur?.(e); }}
|
|
@@ -186,6 +203,39 @@ export default function Input({
|
|
|
186
203
|
/>
|
|
187
204
|
)}
|
|
188
205
|
|
|
206
|
+
{showToggle && (
|
|
207
|
+
<button
|
|
208
|
+
type="button"
|
|
209
|
+
tabIndex={-1}
|
|
210
|
+
onClick={() => setRevealed(r => !r)}
|
|
211
|
+
style={{
|
|
212
|
+
position: 'absolute',
|
|
213
|
+
right: showClear ? 28 : 8,
|
|
214
|
+
top: '50%',
|
|
215
|
+
transform: 'translateY(-50%)',
|
|
216
|
+
display: 'flex',
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
justifyContent: 'center',
|
|
219
|
+
width: 20,
|
|
220
|
+
height: 20,
|
|
221
|
+
borderRadius: 'var(--radxs,4px)',
|
|
222
|
+
background: 'transparent',
|
|
223
|
+
border: 'none',
|
|
224
|
+
cursor: 'pointer',
|
|
225
|
+
color: 'var(--t3,#9b9daa)',
|
|
226
|
+
padding: 0,
|
|
227
|
+
lineHeight: 0,
|
|
228
|
+
transition: 'color .15s',
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{revealed ? (
|
|
232
|
+
<EyeOff size={size === 'xs' ? 12 : size === 'sm' ? 13 : 15} />
|
|
233
|
+
) : (
|
|
234
|
+
<Eye size={size === 'xs' ? 12 : size === 'sm' ? 13 : 15} />
|
|
235
|
+
)}
|
|
236
|
+
</button>
|
|
237
|
+
)}
|
|
238
|
+
|
|
189
239
|
{showClear && (
|
|
190
240
|
<button
|
|
191
241
|
type="button"
|
package/ui/index.cjs
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
Drawer: () => Drawer,
|
|
45
45
|
Dropzone: () => Dropzone,
|
|
46
46
|
FilePicker: () => FilePicker,
|
|
47
|
+
Globe: () => Globe,
|
|
47
48
|
HoverCard: () => HoverCard,
|
|
48
49
|
ImageUpload: () => ImageUpload,
|
|
49
50
|
InfoBadge: () => InfoBadge,
|
|
@@ -87,6 +88,7 @@ __export(index_exports, {
|
|
|
87
88
|
XThead: () => XThead,
|
|
88
89
|
XTr: () => XTr,
|
|
89
90
|
confirm: () => confirm,
|
|
91
|
+
createGlobe: () => createGlobe,
|
|
90
92
|
toast: () => toast,
|
|
91
93
|
useToast: () => useToast
|
|
92
94
|
});
|
|
@@ -133,6 +135,7 @@ var import_Layout = __toESM(require("./components/Layout.jsx"), 1);
|
|
|
133
135
|
var import_Sidebar = __toESM(require("./components/Sidebar.jsx"), 1);
|
|
134
136
|
var import_LoginPage = __toESM(require("./components/LoginPage.jsx"), 1);
|
|
135
137
|
var import_PrivacyBlur = __toESM(require("./components/PrivacyBlur.jsx"), 1);
|
|
138
|
+
var import_Globe = __toESM(require("./components/Globe.jsx"), 1);
|
|
136
139
|
const Layout = import_Layout.default;
|
|
137
140
|
const Sidebar = import_Sidebar.default;
|
|
138
141
|
const LoginPage = import_LoginPage.default;
|
|
@@ -195,3 +198,5 @@ const CardHdr = import_Card.CardHdr;
|
|
|
195
198
|
const StatCard = import_Card.StatCard;
|
|
196
199
|
const StatCardSkeleton = import_Card.StatCardSkeleton;
|
|
197
200
|
const PrivacyBlur = import_PrivacyBlur.default;
|
|
201
|
+
const Globe = import_Globe.default || import_Globe.Globe;
|
|
202
|
+
const createGlobe = import_Globe.createGlobe;
|
package/ui/index.js
CHANGED
|
@@ -42,6 +42,7 @@ import { default as _Layout } from './components/Layout.jsx';
|
|
|
42
42
|
import { default as _Sidebar } from './components/Sidebar.jsx';
|
|
43
43
|
import { default as _LoginPage } from './components/LoginPage.jsx';
|
|
44
44
|
import { default as _PrivacyBlur } from './components/PrivacyBlur.jsx';
|
|
45
|
+
import { default as _Globe, createGlobe as _createGlobe, Globe as _GlobeNamed } from './components/Globe.jsx';
|
|
45
46
|
|
|
46
47
|
export const Layout = _Layout;
|
|
47
48
|
export const Sidebar = _Sidebar;
|
|
@@ -105,3 +106,5 @@ export const CardHdr = _CardHdr;
|
|
|
105
106
|
export const StatCard = _StatCard;
|
|
106
107
|
export const StatCardSkeleton = _StatCardSkeleton;
|
|
107
108
|
export const PrivacyBlur = _PrivacyBlur;
|
|
109
|
+
export const Globe = _Globe || _GlobeNamed;
|
|
110
|
+
export const createGlobe = _createGlobe;
|
package/utils/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
realtimeUtil: () => import_realtime.default,
|
|
35
35
|
sessionManagerUtil: () => import_session_manager.default,
|
|
36
36
|
sessionUtil: () => import_session.default,
|
|
37
|
+
ssoManagerUtil: () => import_sso_manager.default,
|
|
37
38
|
storageUtil: () => import_storage.default,
|
|
38
39
|
tzUtil: () => import_tz.default,
|
|
39
40
|
uiUtil: () => import_ui.default,
|
|
@@ -48,6 +49,7 @@ __reExport(index_exports, require("./utils/storage.cjs"), module.exports);
|
|
|
48
49
|
__reExport(index_exports, require("./utils/duration.cjs"), module.exports);
|
|
49
50
|
__reExport(index_exports, require("./utils/session.cjs"), module.exports);
|
|
50
51
|
__reExport(index_exports, require("./utils/session_manager.cjs"), module.exports);
|
|
52
|
+
__reExport(index_exports, require("./utils/sso_manager.cjs"), module.exports);
|
|
51
53
|
__reExport(index_exports, require("./utils/ui.cjs"), module.exports);
|
|
52
54
|
__reExport(index_exports, require("./utils/db.cjs"), module.exports);
|
|
53
55
|
var import_uid = __toESM(require("./utils/uid.cjs"), 1);
|
|
@@ -58,6 +60,7 @@ var import_storage = __toESM(require("./utils/storage.cjs"), 1);
|
|
|
58
60
|
var import_duration = __toESM(require("./utils/duration.cjs"), 1);
|
|
59
61
|
var import_session = __toESM(require("./utils/session.cjs"), 1);
|
|
60
62
|
var import_session_manager = __toESM(require("./utils/session_manager.cjs"), 1);
|
|
63
|
+
var import_sso_manager = __toESM(require("./utils/sso_manager.cjs"), 1);
|
|
61
64
|
var import_ui = __toESM(require("./utils/ui.cjs"), 1);
|
|
62
65
|
var import_db = __toESM(require("./utils/db.cjs"), 1);
|
|
63
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -68,6 +71,7 @@ var import_db = __toESM(require("./utils/db.cjs"), 1);
|
|
|
68
71
|
realtimeUtil,
|
|
69
72
|
sessionManagerUtil,
|
|
70
73
|
sessionUtil,
|
|
74
|
+
ssoManagerUtil,
|
|
71
75
|
storageUtil,
|
|
72
76
|
tzUtil,
|
|
73
77
|
uiUtil,
|
|
@@ -80,6 +84,7 @@ var import_db = __toESM(require("./utils/db.cjs"), 1);
|
|
|
80
84
|
...require("./utils/duration.cjs"),
|
|
81
85
|
...require("./utils/session.cjs"),
|
|
82
86
|
...require("./utils/session_manager.cjs"),
|
|
87
|
+
...require("./utils/sso_manager.cjs"),
|
|
83
88
|
...require("./utils/ui.cjs"),
|
|
84
89
|
...require("./utils/db.cjs")
|
|
85
90
|
});
|
package/utils/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './utils/storage.js';
|
|
|
7
7
|
export * from './utils/duration.js';
|
|
8
8
|
export * from './utils/session.js';
|
|
9
9
|
export * from './utils/session_manager.js';
|
|
10
|
+
export * from './utils/sso_manager.js';
|
|
10
11
|
export * from './utils/ui.js';
|
|
11
12
|
export * from './utils/db.js';
|
|
12
13
|
|
|
@@ -18,5 +19,6 @@ export { default as storageUtil } from './utils/storage.js';
|
|
|
18
19
|
export { default as durationUtil } from './utils/duration.js';
|
|
19
20
|
export { default as sessionUtil } from './utils/session.js';
|
|
20
21
|
export { default as sessionManagerUtil } from './utils/session_manager.js';
|
|
22
|
+
export { default as ssoManagerUtil } from './utils/sso_manager.js';
|
|
21
23
|
export { default as uiUtil } from './utils/ui.js';
|
|
22
|
-
export { default as dbUtil } from './utils/db.js';
|
|
24
|
+
export { default as dbUtil } from './utils/db.js';
|