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,159 +1,159 @@
1
- import { Spinner } from './Spinner';
2
-
3
- const VARIANTS = {
4
- default: {
5
- background: '#fff',
6
- color: 'var(--def-btn-text,#0f111c)',
7
- border: '1px solid var(--bd,#d7d8e0)',
8
- hoverBg: 'var(--grey-1,#f5f5f8)',
9
- hoverBorder: 'var(--grey-2,#ebebee)',
10
- },
11
- primary: {
12
- background: 'var(--accent,#f99e2c)',
13
- color: '#fff',
14
- border: '1px solid transparent',
15
- hoverBg: 'var(--accent-hover,#e68d1f)',
16
- hoverShadow: '0 2px 8px rgba(249,158,44,.35)',
17
- },
18
- secondary: {
19
- background: 'var(--blue-bg,rgba(39,130,228,.1))',
20
- color: 'var(--blue,#2782e4)',
21
- border: '1px solid rgba(39,130,228,.2)',
22
- hoverBg: 'rgba(39,130,228,.18)',
23
- hoverShadow: '0 2px 8px rgba(39,130,228,.25)',
24
- },
25
- danger: {
26
- background: 'var(--danger-bg,rgba(246,71,71,.1))',
27
- color: 'var(--danger,#f64747)',
28
- border: '1px solid rgba(246,71,71,.2)',
29
- hoverBg: 'rgba(246,71,71,.18)',
30
- hoverShadow: '0 2px 8px rgba(246,71,71,.25)',
31
- },
32
- success: {
33
- background: 'var(--success-bg,rgba(39,174,96,.1))',
34
- color: 'var(--success,#27ae60)',
35
- border: '1px solid rgba(39,174,96,.2)',
36
- hoverBg: 'rgba(39,174,96,.18)',
37
- hoverShadow: '0 2px 8px rgba(39,174,96,.25)',
38
- },
39
- warning: {
40
- background: 'var(--accent-bg,rgba(249,158,44,.1))',
41
- color: 'var(--accent,#f99e2c)',
42
- border: '1px solid var(--accent-border,rgba(249,158,44,.25))',
43
- hoverBg: 'rgba(249,158,44,.18)',
44
- hoverShadow: '0 2px 8px rgba(249,158,44,.25)',
45
- },
46
- ghost: {
47
- background: 'transparent',
48
- color: 'var(--t2,#797b8d)',
49
- border: '1px solid var(--bd,#d7d8e0)',
50
- hoverColor: 'var(--t1,#1a1a2e)',
51
- hoverBg: 'var(--grey-1,#f5f5f8)',
52
- hoverBorder: 'var(--grey-2,#ebebee)',
53
- },
54
- outline: {
55
- background: 'transparent',
56
- color: 'var(--accent,#f99e2c)',
57
- border: '1px solid var(--accent,#f99e2c)',
58
- hoverBg: 'var(--accent-bg,rgba(249,158,44,.1))',
59
- },
60
- link: {
61
- background: 'transparent',
62
- color: 'var(--accent,#f99e2c)',
63
- border: '1px solid transparent',
64
- paddingLeft: 4,
65
- paddingRight: 4,
66
- boxShadow: 'none',
67
- hoverTextDec: 'underline',
68
- },
69
- 'no-line': {
70
- background: 'none',
71
- border: 'none',
72
- boxShadow: 'none',
73
- color: 'var(--t3,#8a96b0)',
74
- paddingLeft: 14,
75
- paddingRight: 14,
76
- borderRadius: 'var(--rmd,8px)',
77
- hoverColor: 'var(--p,var(--accent,#f99e2c))',
78
- hoverBg: 'var(--pd,var(--accent-bg,rgba(249,158,44,.1)))',
79
- },
80
- };
81
-
82
- const SIZES = {
83
- xs: { padding: '4px 8px', fontSize: 12, height: 28 },
84
- sm: { padding: '4px 8px', fontSize: 12, height: 32 },
85
- md: { padding: '8px 16px', fontSize: 13, height: 38 },
86
- lg: { padding: '10px 20px', fontSize: 14, height: 44 },
87
- };
88
-
89
- const ICON_STYLE = {
90
- padding: 0,
91
- width: 30,
92
- height: 30,
93
- borderRadius: 'var(--rads,8px)',
94
- display: 'inline-flex',
95
- alignItems: 'center',
96
- justifyContent: 'center',
97
- lineHeight: 0,
98
- };
99
-
100
- export default function Button({
101
- children,
102
- variant = 'default',
103
- size = 'md',
104
- icon = null,
105
- iconRight = null,
106
- disabled = false,
107
- loading = false,
108
- onClick = null,
109
- style = {},
110
- className = '',
111
- ...props
112
- }) {
113
- const v = VARIANTS[variant] || VARIANTS.default;
114
- const s = SIZES[size] || SIZES.md;
115
-
116
- const isIconOnly = variant === 'icon';
117
-
118
- return (
119
- <button
120
- className={className}
121
- disabled={disabled || loading}
122
- onClick={onClick}
123
- style={{
124
- display: 'inline-flex',
125
- alignItems: 'center',
126
- justifyContent: 'center',
127
- gap: 6,
128
- borderRadius: 'var(--rads,8px)',
129
- fontFamily: 'var(--f,var(--sans,inherit))',
130
- fontWeight: 500,
131
- cursor: disabled ? 'not-allowed' : 'pointer',
132
- whiteSpace: 'nowrap',
133
- transition: 'all .14s',
134
- letterSpacing: '-.01em',
135
- outline: 'none',
136
- boxShadow: 'var(--shadow,0 1px 3px rgba(20,22,41,.1))',
137
- opacity: disabled ? 0.45 : 1,
138
- pointerEvents: disabled ? 'none' : undefined,
139
- background: v.background,
140
- color: v.color,
141
- border: v.border,
142
- padding: isIconOnly ? 0 : s.padding,
143
- fontSize: s.fontSize,
144
- height: isIconOnly ? 30 : s.height,
145
- width: isIconOnly ? 30 : undefined,
146
- ...(v.paddingLeft !== undefined && { paddingLeft: v.paddingLeft }),
147
- ...(v.paddingRight !== undefined && { paddingRight: v.paddingRight }),
148
- ...(v.boxShadow !== undefined && { boxShadow: v.boxShadow }),
149
- ...style,
150
- }}
151
- {...props}
152
- >
153
- {loading && <Spinner size={14} inline color="currentColor" />}
154
- {!loading && icon && icon}
155
- {!loading && children}
156
- {!loading && iconRight && iconRight}
157
- </button>
158
- );
159
- }
1
+ import { Spinner } from './Spinner';
2
+
3
+ const VARIANTS = {
4
+ default: {
5
+ background: '#fff',
6
+ color: 'var(--def-btn-text,#0f111c)',
7
+ border: '1px solid var(--bd,#d7d8e0)',
8
+ hoverBg: 'var(--grey-1,#f5f5f8)',
9
+ hoverBorder: 'var(--grey-2,#ebebee)',
10
+ },
11
+ primary: {
12
+ background: 'var(--accent,#f99e2c)',
13
+ color: '#fff',
14
+ border: '1px solid transparent',
15
+ hoverBg: 'var(--accent-hover,#e68d1f)',
16
+ hoverShadow: '0 2px 8px rgba(249,158,44,.35)',
17
+ },
18
+ secondary: {
19
+ background: 'var(--blue-bg,rgba(39,130,228,.1))',
20
+ color: 'var(--blue,#2782e4)',
21
+ border: '1px solid rgba(39,130,228,.2)',
22
+ hoverBg: 'rgba(39,130,228,.18)',
23
+ hoverShadow: '0 2px 8px rgba(39,130,228,.25)',
24
+ },
25
+ danger: {
26
+ background: 'var(--danger-bg,rgba(246,71,71,.1))',
27
+ color: 'var(--danger,#f64747)',
28
+ border: '1px solid rgba(246,71,71,.2)',
29
+ hoverBg: 'rgba(246,71,71,.18)',
30
+ hoverShadow: '0 2px 8px rgba(246,71,71,.25)',
31
+ },
32
+ success: {
33
+ background: 'var(--success-bg,rgba(39,174,96,.1))',
34
+ color: 'var(--success,#27ae60)',
35
+ border: '1px solid rgba(39,174,96,.2)',
36
+ hoverBg: 'rgba(39,174,96,.18)',
37
+ hoverShadow: '0 2px 8px rgba(39,174,96,.25)',
38
+ },
39
+ warning: {
40
+ background: 'var(--accent-bg,rgba(249,158,44,.1))',
41
+ color: 'var(--accent,#f99e2c)',
42
+ border: '1px solid var(--accent-border,rgba(249,158,44,.25))',
43
+ hoverBg: 'rgba(249,158,44,.18)',
44
+ hoverShadow: '0 2px 8px rgba(249,158,44,.25)',
45
+ },
46
+ ghost: {
47
+ background: 'transparent',
48
+ color: 'var(--t2,#797b8d)',
49
+ border: '1px solid var(--bd,#d7d8e0)',
50
+ hoverColor: 'var(--t1,#1a1a2e)',
51
+ hoverBg: 'var(--grey-1,#f5f5f8)',
52
+ hoverBorder: 'var(--grey-2,#ebebee)',
53
+ },
54
+ outline: {
55
+ background: 'transparent',
56
+ color: 'var(--accent,#f99e2c)',
57
+ border: '1px solid var(--accent,#f99e2c)',
58
+ hoverBg: 'var(--accent-bg,rgba(249,158,44,.1))',
59
+ },
60
+ link: {
61
+ background: 'transparent',
62
+ color: 'var(--accent,#f99e2c)',
63
+ border: '1px solid transparent',
64
+ paddingLeft: 4,
65
+ paddingRight: 4,
66
+ boxShadow: 'none',
67
+ hoverTextDec: 'underline',
68
+ },
69
+ 'no-line': {
70
+ background: 'none',
71
+ border: 'none',
72
+ boxShadow: 'none',
73
+ color: 'var(--t3,#8a96b0)',
74
+ paddingLeft: 14,
75
+ paddingRight: 14,
76
+ borderRadius: 'var(--rmd,8px)',
77
+ hoverColor: 'var(--p,var(--accent,#f99e2c))',
78
+ hoverBg: 'var(--pd,var(--accent-bg,rgba(249,158,44,.1)))',
79
+ },
80
+ };
81
+
82
+ const SIZES = {
83
+ xs: { padding: '4px 8px', fontSize: 12, height: 28 },
84
+ sm: { padding: '4px 8px', fontSize: 12, height: 32 },
85
+ md: { padding: '8px 16px', fontSize: 13, height: 38 },
86
+ lg: { padding: '10px 20px', fontSize: 14, height: 44 },
87
+ };
88
+
89
+ const ICON_STYLE = {
90
+ padding: 0,
91
+ width: 30,
92
+ height: 30,
93
+ borderRadius: 'var(--rads,8px)',
94
+ display: 'inline-flex',
95
+ alignItems: 'center',
96
+ justifyContent: 'center',
97
+ lineHeight: 0,
98
+ };
99
+
100
+ export default function Button({
101
+ children,
102
+ variant = 'default',
103
+ size = 'md',
104
+ icon = null,
105
+ iconRight = null,
106
+ disabled = false,
107
+ loading = false,
108
+ onClick = null,
109
+ style = {},
110
+ className = '',
111
+ ...props
112
+ }) {
113
+ const v = VARIANTS[variant] || VARIANTS.default;
114
+ const s = SIZES[size] || SIZES.md;
115
+
116
+ const isIconOnly = variant === 'icon';
117
+
118
+ return (
119
+ <button
120
+ className={className}
121
+ disabled={disabled || loading}
122
+ onClick={onClick}
123
+ style={{
124
+ display: 'inline-flex',
125
+ alignItems: 'center',
126
+ justifyContent: 'center',
127
+ gap: 6,
128
+ borderRadius: 'var(--rads,8px)',
129
+ fontFamily: 'var(--f,var(--sans,inherit))',
130
+ fontWeight: 500,
131
+ cursor: disabled ? 'not-allowed' : 'pointer',
132
+ whiteSpace: 'nowrap',
133
+ transition: 'all .14s',
134
+ letterSpacing: '-.01em',
135
+ outline: 'none',
136
+ boxShadow: 'var(--shadow,0 1px 3px rgba(20,22,41,.1))',
137
+ opacity: disabled ? 0.45 : 1,
138
+ pointerEvents: disabled ? 'none' : undefined,
139
+ background: v.background,
140
+ color: v.color,
141
+ border: v.border,
142
+ padding: isIconOnly ? 0 : s.padding,
143
+ fontSize: s.fontSize,
144
+ height: isIconOnly ? 30 : s.height,
145
+ width: isIconOnly ? 30 : undefined,
146
+ ...(v.paddingLeft !== undefined && { paddingLeft: v.paddingLeft }),
147
+ ...(v.paddingRight !== undefined && { paddingRight: v.paddingRight }),
148
+ ...(v.boxShadow !== undefined && { boxShadow: v.boxShadow }),
149
+ ...style,
150
+ }}
151
+ {...props}
152
+ >
153
+ {loading && <Spinner size={14} inline color="currentColor" />}
154
+ {!loading && icon && icon}
155
+ {!loading && children}
156
+ {!loading && iconRight && iconRight}
157
+ </button>
158
+ );
159
+ }
@@ -1,62 +1,62 @@
1
- import { Pagination } from './Pagination';
2
-
3
- export function PageShell({ title, children }) {
4
- return (
5
- <div className="page-shell" style={{ padding: '20px 24px' }}>
6
- {children}
7
- </div>
8
- );
9
- }
10
-
11
- export function TableCard({ children }) {
12
- return <div className="table-card">{children}</div>;
13
- }
14
- export function TableCardFilters({ children }) {
15
- return <div className="table-card-filters">{children}</div>;
16
- }
17
- export function TableCardBody({ children }) {
18
- return <div className="table-card-body">{children}</div>;
19
- }
20
- export function TableCardFooter({ total, page, limit, pages, onChange }) {
21
- const from = total === 0 ? 0 : (page - 1) * limit + 1;
22
- const to = Math.min(page * limit, total);
23
- return (
24
- <div className="table-card-footer">
25
- <span className="table-card-footer-count">
26
- {total === 0 ? 'No records' : `${from}–${to} of ${total}`}
27
- </span>
28
- <Pagination page={page} pages={pages} onChange={onChange} />
29
- </div>
30
- );
31
- }
32
-
33
- export function CardHdr({ title, icon: Icon, tabs, children }) {
34
- return (
35
- <div className="card-hdr">
36
- <div className="card-title">
37
- {Icon && <Icon size={14} />}
38
- {title}
39
- {tabs && <span style={{ marginLeft: 12 }}>{tabs}</span>}
40
- </div>
41
- {children && <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>{children}</div>}
42
- </div>
43
- );
44
- }
45
-
46
- export function StatCard({ label, value, sub }) {
47
- return (
48
- <div className="stat">
49
- <div className="stat-label">{label}</div>
50
- <div className="stat-val">{value ?? '—'}</div>
51
- {sub && <div className="stat-sub">{sub}</div>}
52
- </div>
53
- );
54
- }
55
- export function StatCardSkeleton() {
56
- return (
57
- <div className="stat-skeleton">
58
- <div className="skeleton skeleton-text short" style={{ marginBottom: 10 }} />
59
- <div className="skeleton skeleton-text mid" style={{ height: 28, marginBottom: 6 }} />
60
- </div>
61
- );
62
- }
1
+ import { Pagination } from './Pagination';
2
+
3
+ export function PageShell({ title, children }) {
4
+ return (
5
+ <div style={{ padding: '20px 24px' }}>
6
+ {children}
7
+ </div>
8
+ );
9
+ }
10
+
11
+ export function TableCard({ children }) {
12
+ return <div style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column', minHeight: 0 }}>{children}</div>;
13
+ }
14
+ export function TableCardFilters({ children }) {
15
+ return <div style={{ display: 'flex', alignItems: 'center', gap: 8, padding: '8px 0', borderBottom: '1px solid var(--border-light, #ebebf0)' }}>{children}</div>;
16
+ }
17
+ export function TableCardBody({ children }) {
18
+ return <div style={{ flex: 1, overflowY: 'auto', minHeight: 0, scrollbarWidth: 'thin', scrollbarColor: 'var(--grey-2, #d7d8e0) transparent' }}>{children}</div>;
19
+ }
20
+ export function TableCardFooter({ total, page, limit, pages, onChange }) {
21
+ const from = total === 0 ? 0 : (page - 1) * limit + 1;
22
+ const to = Math.min(page * limit, total);
23
+ return (
24
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '10px 0', borderTop: '1px solid var(--border-light, #ebebf0)', fontSize: '.78rem', color: 'var(--muted, #9b9daa)' }}>
25
+ <span>
26
+ {total === 0 ? 'No records' : `${from}–${to} of ${total}`}
27
+ </span>
28
+ <Pagination page={page} pages={pages} onChange={onChange} />
29
+ </div>
30
+ );
31
+ }
32
+
33
+ export function CardHdr({ title, icon: Icon, tabs, children }) {
34
+ return (
35
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '13px 0', borderBottom: '1px solid var(--border-light, #ebebf0)' }}>
36
+ <div style={{ display: 'flex', alignItems: 'center', gap: 6, fontSize: '.85rem', fontWeight: 600, color: 'var(--primary-text, #0f111c)' }}>
37
+ {Icon && <Icon size={14} />}
38
+ {title}
39
+ {tabs && <span style={{ marginLeft: 12 }}>{tabs}</span>}
40
+ </div>
41
+ {children && <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>{children}</div>}
42
+ </div>
43
+ );
44
+ }
45
+
46
+ export function StatCard({ label, value, sub }) {
47
+ return (
48
+ <div style={{ background: 'var(--surface, #fff)', border: '1px solid var(--border-light, #ebebf0)', borderRadius: 'var(--rads, 8px)', padding: '14px 16px', boxShadow: 'var(--shadow, 0px 1px 3px rgba(20,22,41,.10))' }}>
49
+ <div style={{ fontSize: '.62rem', fontWeight: 600, textTransform: 'uppercase', letterSpacing: '.08em', color: 'var(--muted, #9b9daa)', marginBottom: 4 }}>{label}</div>
50
+ <div style={{ fontSize: '1.4rem', fontWeight: 700, color: 'var(--primary-text, #0f111c)', lineHeight: 1.2 }}>{value ?? '—'}</div>
51
+ {sub && <div style={{ fontSize: '.72rem', color: 'var(--muted, #9b9daa)', marginTop: 2 }}>{sub}</div>}
52
+ </div>
53
+ );
54
+ }
55
+ export function StatCardSkeleton() {
56
+ return (
57
+ <div style={{ background: 'var(--surface, #fff)', border: '1px solid var(--border-light, #ebebf0)', borderRadius: 'var(--rads, 8px)', padding: '14px 16px' }}>
58
+ <div className="skeleton skeleton-text" style={{ marginBottom: 10, height: 12, width: '40%', background: 'linear-gradient(90deg, var(--grey-1, #f5f5f8) 25%, var(--border-light, #ebebf0) 50%, var(--grey-1, #f5f5f8) 75%)', backgroundSize: '600px 100%', animation: 'shimmer 1.4s ease infinite', borderRadius: 'var(--radxs, 6px)' }} />
59
+ <div className="skeleton skeleton-text" style={{ height: 28, width: '60%', marginBottom: 6, background: 'linear-gradient(90deg, var(--grey-1, #f5f5f8) 25%, var(--border-light, #ebebf0) 50%, var(--grey-1, #f5f5f8) 75%)', backgroundSize: '600px 100%', animation: 'shimmer 1.4s ease infinite', borderRadius: 'var(--radxs, 6px)' }} />
60
+ </div>
61
+ );
62
+ }