cynx-ui 1.2.16 → 1.2.18

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,52 +1,52 @@
1
- const STYLES = `.spin{animation:cx-spin .7s linear infinite}@keyframes cx-spin{to{transform:rotate(360deg)}}`;
2
-
3
- let _id = 'cynx-spinner-styles';
4
- function ensureStyles() {
5
- if (typeof document === 'undefined') return;
6
- if (document.getElementById(_id)) return;
7
- const tag = document.createElement('style');
8
- tag.id = _id;
9
- tag.textContent = STYLES;
10
- document.head.appendChild(tag);
11
- }
12
-
13
- // Auto-inject on module load
14
- if (typeof document !== 'undefined') ensureStyles();
15
-
16
- export function Spinner({ size = 20, inline = false, color = 'currentColor', fullPage = false }) {
17
- ensureStyles();
18
- const s = inline ? 14 : size;
19
- const svg = (
20
- <svg className="spin" width={s} height={s} viewBox="0 0 24 24" fill="none"
21
- stroke={color} strokeWidth="2.5" strokeLinecap="round">
22
- <path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"/>
23
- </svg>
24
- );
25
-
26
- if (fullPage) {
27
- return (
28
- <div style={{
29
- position: 'fixed', inset: 0,
30
- background: 'var(--bg)',
31
- display: 'flex', flexDirection: 'column',
32
- alignItems: 'center', justifyContent: 'center', gap: 16,
33
- zIndex: 9999,
34
- }}>
35
- {svg}
36
- <div style={{ fontSize: '.75rem', fontFamily: 'var(--mono)', color: 'var(--muted)' }}>
37
- Loading...
38
- </div>
39
- </div>
40
- );
41
- }
42
-
43
- if (inline) return svg;
44
-
45
- return (
46
- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '48px 0' }}>
47
- {svg}
48
- </div>
49
- );
50
- }
51
-
52
- export default Spinner;
1
+ const STYLES = `.spin{animation:cx-spin .7s linear infinite}@keyframes cx-spin{to{transform:rotate(360deg)}}`;
2
+
3
+ let _id = 'cynx-spinner-styles';
4
+ function ensureStyles() {
5
+ if (typeof document === 'undefined') return;
6
+ if (document.getElementById(_id)) return;
7
+ const tag = document.createElement('style');
8
+ tag.id = _id;
9
+ tag.textContent = STYLES;
10
+ document.head.appendChild(tag);
11
+ }
12
+
13
+ // Auto-inject on module load
14
+ if (typeof document !== 'undefined') ensureStyles();
15
+
16
+ export function Spinner({ size = 20, inline = false, color = 'currentColor', fullPage = false }) {
17
+ ensureStyles();
18
+ const s = inline ? 14 : size;
19
+ const svg = (
20
+ <svg className="spin" width={s} height={s} viewBox="0 0 24 24" fill="none"
21
+ stroke={color} strokeWidth="2.5" strokeLinecap="round">
22
+ <path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"/>
23
+ </svg>
24
+ );
25
+
26
+ if (fullPage) {
27
+ return (
28
+ <div style={{
29
+ position: 'fixed', inset: 0,
30
+ background: 'var(--bg)',
31
+ display: 'flex', flexDirection: 'column',
32
+ alignItems: 'center', justifyContent: 'center', gap: 16,
33
+ zIndex: 9999,
34
+ }}>
35
+ {svg}
36
+ <div style={{ fontSize: '.75rem', fontFamily: 'var(--mono)', color: 'var(--muted)' }}>
37
+ Loading...
38
+ </div>
39
+ </div>
40
+ );
41
+ }
42
+
43
+ if (inline) return svg;
44
+
45
+ return (
46
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '48px 0' }}>
47
+ {svg}
48
+ </div>
49
+ );
50
+ }
51
+
52
+ export default Spinner;
@@ -1,25 +1,25 @@
1
- import LineProgress from './LineProgress';
2
-
3
- export default function StatBarCard({ title, icon, items, style }) {
4
- const total = items.reduce((s, i) => s + (i.value || 0), 0);
5
-
6
- return (
7
- <div style={{
8
- background: '#fff', border: '1px solid var(--border)', borderRadius: 'var(--rad)',
9
- boxShadow: '0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04)',
10
- padding: '12px 14px', minWidth: 220, ...style,
11
- }}>
12
- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 10 }}>
13
- <div style={{ fontSize: '.58rem', fontWeight: 700, color: 'var(--muted, #9ca3af)', textTransform: 'uppercase', letterSpacing: '.08em' }}>
14
- {title}{total ? ` (${total})` : ''}
15
- </div>
16
- {icon && <span style={{ color: 'var(--muted, #9ca3af)' }}>{icon}</span>}
17
- </div>
18
- <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
19
- {items.map((item, i) => (
20
- <LineProgress key={i} value={item.value} total={total} color={item.color} label={item.label} size="sm" />
21
- ))}
22
- </div>
23
- </div>
24
- );
25
- }
1
+ import LineProgress from './LineProgress';
2
+
3
+ export default function StatBarCard({ title, icon, items, style }) {
4
+ const total = items.reduce((s, i) => s + (i.value || 0), 0);
5
+
6
+ return (
7
+ <div style={{
8
+ background: '#fff', border: '1px solid var(--border)', borderRadius: 'var(--rad)',
9
+ boxShadow: '0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04)',
10
+ padding: '12px 14px', minWidth: 220, ...style,
11
+ }}>
12
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 10 }}>
13
+ <div style={{ fontSize: '.58rem', fontWeight: 700, color: 'var(--muted, #9ca3af)', textTransform: 'uppercase', letterSpacing: '.08em' }}>
14
+ {title}{total ? ` (${total})` : ''}
15
+ </div>
16
+ {icon && <span style={{ color: 'var(--muted, #9ca3af)' }}>{icon}</span>}
17
+ </div>
18
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
19
+ {items.map((item, i) => (
20
+ <LineProgress key={i} value={item.value} total={total} color={item.color} label={item.label} size="sm" />
21
+ ))}
22
+ </div>
23
+ </div>
24
+ );
25
+ }
@@ -1,171 +1,171 @@
1
- import CircularProgress from './CircularProgress';
2
-
3
- const BASE = {
4
- display: 'flex',
5
- alignItems: 'center',
6
- justifyContent: 'space-between',
7
- padding: '10px 14px',
8
- minHeight: 68,
9
- borderRadius: 'var(--rad,10px)',
10
- background: 'var(--surface,#fff)',
11
- border: '1px solid var(--border)',
12
- boxShadow: '0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04)',
13
- minWidth: 0,
14
- transition: 'border-color .15s',
15
- };
16
-
17
- const SIMPLE_BASE = {
18
- ...BASE,
19
- padding: '12px 14px',
20
- flexDirection: 'column',
21
- alignItems: 'flex-start',
22
- justifyContent: 'flex-start',
23
- };
24
-
25
- export default function StatsCard({
26
- variant = 'default',
27
- icon,
28
- iconColor = 'var(--blue)',
29
- iconBg = 'rgba(39,130,228,.1)',
30
- title,
31
- value,
32
- subtitle,
33
- percent,
34
- percentColor,
35
- progressSize = 'sm',
36
- progressTrackColor = '#e8e8ec',
37
- headRight,
38
- className = '',
39
- style = {},
40
- children,
41
- }) {
42
- if (variant === 'simple') {
43
- return (
44
- <div className={className} style={{ ...SIMPLE_BASE, ...style }}>
45
- <div style={{
46
- width: '100%',
47
- marginBottom: 8,
48
- display: 'flex',
49
- alignItems: 'center',
50
- justifyContent: 'space-between',
51
- }}>
52
- {title && (
53
- <div style={{
54
- fontSize: '.58rem',
55
- fontWeight: 600,
56
- textTransform: 'uppercase',
57
- letterSpacing: '.08em',
58
- color: 'var(--muted,#9b9daa)',
59
- }}>{title}</div>
60
- )}
61
- {icon && (
62
- <div style={{
63
- display: 'inline-flex',
64
- alignItems: 'center',
65
- justifyContent: 'center',
66
- flexShrink: 0,
67
- color: iconColor,
68
- }}>
69
- {icon}
70
- </div>
71
- )}
72
- </div>
73
- {value !== undefined && (
74
- <div style={{
75
- fontSize: '1.25rem',
76
- fontWeight: 800,
77
- letterSpacing: '-.03em',
78
- lineHeight: 1.1,
79
- minHeight: '1.375em',
80
- }}>{value}</div>
81
- )}
82
- {children}
83
- </div>
84
- );
85
- }
86
-
87
- return (
88
- <div className={className} style={{ ...BASE, ...style }}>
89
- <div style={{
90
- display: 'flex',
91
- flexDirection: 'column',
92
- minWidth: 0,
93
- flex: 1,
94
- }}>
95
- <div style={{
96
- display: 'flex',
97
- alignItems: 'center',
98
- justifyContent: 'space-between',
99
- marginBottom: 8,
100
- }}>
101
- <div style={{
102
- display: 'flex',
103
- alignItems: 'center',
104
- gap: 6,
105
- }}>
106
- {icon && (
107
- <div style={{
108
- width: 24,
109
- height: 24,
110
- borderRadius: 6,
111
- display: 'inline-flex',
112
- alignItems: 'center',
113
- justifyContent: 'center',
114
- flexShrink: 0,
115
- background: iconBg,
116
- color: iconColor,
117
- }}>
118
- {icon}
119
- </div>
120
- )}
121
- {title && (
122
- <div style={{
123
- fontSize: '.58rem',
124
- fontWeight: 600,
125
- textTransform: 'uppercase',
126
- letterSpacing: '.08em',
127
- color: 'var(--muted,#9b9daa)',
128
- }}>{title}</div>
129
- )}
130
- </div>
131
- {headRight}
132
- </div>
133
- {value !== undefined && (
134
- <div style={{
135
- fontSize: '1.1rem',
136
- fontWeight: 800,
137
- letterSpacing: '-.02em',
138
- color: 'var(--primary-text,#0f111c)',
139
- lineHeight: 1.2,
140
- minHeight: '1.32em',
141
- }}>{value}</div>
142
- )}
143
- <div style={{
144
- fontSize: '.62rem',
145
- color: 'var(--muted,#9b9daa)',
146
- fontWeight: 500,
147
- marginTop: 1,
148
- minHeight: 14,
149
- }}>{subtitle || '\u00A0'}</div>
150
- {children}
151
- </div>
152
- <div style={{
153
- display: 'flex',
154
- alignItems: 'center',
155
- gap: 8,
156
- flexShrink: 0,
157
- }}>
158
- {percent !== undefined && (
159
- <CircularProgress
160
- value={percent}
161
- size={progressSize}
162
- color={percentColor}
163
- trackColor={progressTrackColor}
164
- showPercent
165
- rounded
166
- />
167
- )}
168
- </div>
169
- </div>
170
- );
171
- }
1
+ import CircularProgress from './CircularProgress';
2
+
3
+ const BASE = {
4
+ display: 'flex',
5
+ alignItems: 'center',
6
+ justifyContent: 'space-between',
7
+ padding: '10px 14px',
8
+ minHeight: 68,
9
+ borderRadius: 'var(--rad,10px)',
10
+ background: 'var(--surface,#fff)',
11
+ border: '1px solid var(--border)',
12
+ boxShadow: '0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04)',
13
+ minWidth: 0,
14
+ transition: 'border-color .15s',
15
+ };
16
+
17
+ const SIMPLE_BASE = {
18
+ ...BASE,
19
+ padding: '12px 14px',
20
+ flexDirection: 'column',
21
+ alignItems: 'flex-start',
22
+ justifyContent: 'flex-start',
23
+ };
24
+
25
+ export default function StatsCard({
26
+ variant = 'default',
27
+ icon,
28
+ iconColor = 'var(--blue)',
29
+ iconBg = 'rgba(39,130,228,.1)',
30
+ title,
31
+ value,
32
+ subtitle,
33
+ percent,
34
+ percentColor,
35
+ progressSize = 'sm',
36
+ progressTrackColor = '#e8e8ec',
37
+ headRight,
38
+ className = '',
39
+ style = {},
40
+ children,
41
+ }) {
42
+ if (variant === 'simple') {
43
+ return (
44
+ <div className={className} style={{ ...SIMPLE_BASE, ...style }}>
45
+ <div style={{
46
+ width: '100%',
47
+ marginBottom: 8,
48
+ display: 'flex',
49
+ alignItems: 'center',
50
+ justifyContent: 'space-between',
51
+ }}>
52
+ {title && (
53
+ <div style={{
54
+ fontSize: '.58rem',
55
+ fontWeight: 600,
56
+ textTransform: 'uppercase',
57
+ letterSpacing: '.08em',
58
+ color: 'var(--muted,#9b9daa)',
59
+ }}>{title}</div>
60
+ )}
61
+ {icon && (
62
+ <div style={{
63
+ display: 'inline-flex',
64
+ alignItems: 'center',
65
+ justifyContent: 'center',
66
+ flexShrink: 0,
67
+ color: iconColor,
68
+ }}>
69
+ {icon}
70
+ </div>
71
+ )}
72
+ </div>
73
+ {value !== undefined && (
74
+ <div style={{
75
+ fontSize: '1.25rem',
76
+ fontWeight: 800,
77
+ letterSpacing: '-.03em',
78
+ lineHeight: 1.1,
79
+ minHeight: '1.375em',
80
+ }}>{value}</div>
81
+ )}
82
+ {children}
83
+ </div>
84
+ );
85
+ }
86
+
87
+ return (
88
+ <div className={className} style={{ ...BASE, ...style }}>
89
+ <div style={{
90
+ display: 'flex',
91
+ flexDirection: 'column',
92
+ minWidth: 0,
93
+ flex: 1,
94
+ }}>
95
+ <div style={{
96
+ display: 'flex',
97
+ alignItems: 'center',
98
+ justifyContent: 'space-between',
99
+ marginBottom: 8,
100
+ }}>
101
+ <div style={{
102
+ display: 'flex',
103
+ alignItems: 'center',
104
+ gap: 6,
105
+ }}>
106
+ {icon && (
107
+ <div style={{
108
+ width: 24,
109
+ height: 24,
110
+ borderRadius: 6,
111
+ display: 'inline-flex',
112
+ alignItems: 'center',
113
+ justifyContent: 'center',
114
+ flexShrink: 0,
115
+ background: iconBg,
116
+ color: iconColor,
117
+ }}>
118
+ {icon}
119
+ </div>
120
+ )}
121
+ {title && (
122
+ <div style={{
123
+ fontSize: '.58rem',
124
+ fontWeight: 600,
125
+ textTransform: 'uppercase',
126
+ letterSpacing: '.08em',
127
+ color: 'var(--muted,#9b9daa)',
128
+ }}>{title}</div>
129
+ )}
130
+ </div>
131
+ {headRight}
132
+ </div>
133
+ {value !== undefined && (
134
+ <div style={{
135
+ fontSize: '1.1rem',
136
+ fontWeight: 800,
137
+ letterSpacing: '-.02em',
138
+ color: 'var(--primary-text,#0f111c)',
139
+ lineHeight: 1.2,
140
+ minHeight: '1.32em',
141
+ }}>{value}</div>
142
+ )}
143
+ <div style={{
144
+ fontSize: '.62rem',
145
+ color: 'var(--muted,#9b9daa)',
146
+ fontWeight: 500,
147
+ marginTop: 1,
148
+ minHeight: 14,
149
+ }}>{subtitle || '\u00A0'}</div>
150
+ {children}
151
+ </div>
152
+ <div style={{
153
+ display: 'flex',
154
+ alignItems: 'center',
155
+ gap: 8,
156
+ flexShrink: 0,
157
+ }}>
158
+ {percent !== undefined && (
159
+ <CircularProgress
160
+ value={percent}
161
+ size={progressSize}
162
+ color={percentColor}
163
+ trackColor={progressTrackColor}
164
+ showPercent
165
+ rounded
166
+ />
167
+ )}
168
+ </div>
169
+ </div>
170
+ );
171
+ }