tekivex-ui 2.1.0 → 2.2.0
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/dist/index.cjs +12 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1623 -1511
- package/dist/src/components/TkxConfigProvider.d.ts +100 -0
- package/dist/src/components/TkxConfigProvider.d.ts.map +1 -0
- package/dist/src/components/TkxEmpty.d.ts +870 -0
- package/dist/src/components/TkxEmpty.d.ts.map +1 -0
- package/dist/src/components/TkxForm.d.ts +54 -0
- package/dist/src/components/TkxForm.d.ts.map +1 -0
- package/dist/src/components/TkxLayout.d.ts +87 -0
- package/dist/src/components/TkxLayout.d.ts.map +1 -0
- package/dist/src/components/TkxSpin.d.ts +15 -0
- package/dist/src/components/TkxSpin.d.ts.map +1 -0
- package/dist/src/components/TkxStatistic.d.ts +1746 -0
- package/dist/src/components/TkxStatistic.d.ts.map +1 -0
- package/dist/src/components/TkxTypography.d.ts +2614 -0
- package/dist/src/components/TkxTypography.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +7 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/themes/index.d.ts +108 -0
- package/dist/src/themes/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/TkxConfigProvider.tsx +458 -0
- package/src/components/TkxEmpty.tsx +219 -0
- package/src/components/TkxForm.tsx +607 -0
- package/src/components/TkxLayout.tsx +647 -0
- package/src/components/TkxSpin.tsx +261 -0
- package/src/components/TkxStatistic.tsx +261 -0
- package/src/components/TkxTypography.tsx +263 -0
- package/src/components/index.ts +7 -0
- package/src/themes/index.ts +149 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { type ReactNode, type CSSProperties, createElement } from 'react';
|
|
2
|
+
import { useTheme } from '../themes';
|
|
3
|
+
import { sanitizeString } from '../engine/security';
|
|
4
|
+
|
|
5
|
+
// ── Interface ───────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
export interface TkxEmptyProps {
|
|
8
|
+
image?: ReactNode | 'default' | 'simple';
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ── Default SVG Illustration (empty box) ────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
function DefaultImage({ color, mutedColor }: { color: string; mutedColor: string }) {
|
|
17
|
+
return createElement(
|
|
18
|
+
'svg',
|
|
19
|
+
{
|
|
20
|
+
width: 120,
|
|
21
|
+
height: 100,
|
|
22
|
+
viewBox: '0 0 120 100',
|
|
23
|
+
fill: 'none',
|
|
24
|
+
'aria-hidden': 'true',
|
|
25
|
+
},
|
|
26
|
+
// Box base
|
|
27
|
+
createElement('path', {
|
|
28
|
+
d: 'M20 40 L60 20 L100 40 L60 60 Z',
|
|
29
|
+
fill: `${mutedColor}18`,
|
|
30
|
+
stroke: mutedColor,
|
|
31
|
+
strokeWidth: 1.5,
|
|
32
|
+
strokeLinejoin: 'round',
|
|
33
|
+
}),
|
|
34
|
+
// Box left side
|
|
35
|
+
createElement('path', {
|
|
36
|
+
d: 'M20 40 L20 65 L60 85 L60 60 Z',
|
|
37
|
+
fill: `${mutedColor}10`,
|
|
38
|
+
stroke: mutedColor,
|
|
39
|
+
strokeWidth: 1.5,
|
|
40
|
+
strokeLinejoin: 'round',
|
|
41
|
+
}),
|
|
42
|
+
// Box right side
|
|
43
|
+
createElement('path', {
|
|
44
|
+
d: 'M100 40 L100 65 L60 85 L60 60 Z',
|
|
45
|
+
fill: `${mutedColor}0d`,
|
|
46
|
+
stroke: mutedColor,
|
|
47
|
+
strokeWidth: 1.5,
|
|
48
|
+
strokeLinejoin: 'round',
|
|
49
|
+
}),
|
|
50
|
+
// Box opening flap left
|
|
51
|
+
createElement('path', {
|
|
52
|
+
d: 'M20 40 L40 28 L60 40 L40 52 Z',
|
|
53
|
+
fill: `${color}15`,
|
|
54
|
+
stroke: color,
|
|
55
|
+
strokeWidth: 1,
|
|
56
|
+
strokeLinejoin: 'round',
|
|
57
|
+
strokeDasharray: '3 2',
|
|
58
|
+
}),
|
|
59
|
+
// Box opening flap right
|
|
60
|
+
createElement('path', {
|
|
61
|
+
d: 'M60 40 L80 28 L100 40 L80 52 Z',
|
|
62
|
+
fill: `${color}15`,
|
|
63
|
+
stroke: color,
|
|
64
|
+
strokeWidth: 1,
|
|
65
|
+
strokeLinejoin: 'round',
|
|
66
|
+
strokeDasharray: '3 2',
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ── Simple SVG Icon (minimal) ───────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
function SimpleImage({ mutedColor }: { mutedColor: string }) {
|
|
74
|
+
return createElement(
|
|
75
|
+
'svg',
|
|
76
|
+
{
|
|
77
|
+
width: 64,
|
|
78
|
+
height: 64,
|
|
79
|
+
viewBox: '0 0 64 64',
|
|
80
|
+
fill: 'none',
|
|
81
|
+
'aria-hidden': 'true',
|
|
82
|
+
},
|
|
83
|
+
// Page outline
|
|
84
|
+
createElement('rect', {
|
|
85
|
+
x: 16,
|
|
86
|
+
y: 8,
|
|
87
|
+
width: 32,
|
|
88
|
+
height: 40,
|
|
89
|
+
rx: 3,
|
|
90
|
+
fill: `${mutedColor}12`,
|
|
91
|
+
stroke: mutedColor,
|
|
92
|
+
strokeWidth: 1.5,
|
|
93
|
+
}),
|
|
94
|
+
// Lines on page
|
|
95
|
+
createElement('line', {
|
|
96
|
+
x1: 24,
|
|
97
|
+
y1: 20,
|
|
98
|
+
x2: 40,
|
|
99
|
+
y2: 20,
|
|
100
|
+
stroke: mutedColor,
|
|
101
|
+
strokeWidth: 1.5,
|
|
102
|
+
strokeLinecap: 'round',
|
|
103
|
+
}),
|
|
104
|
+
createElement('line', {
|
|
105
|
+
x1: 24,
|
|
106
|
+
y1: 28,
|
|
107
|
+
x2: 36,
|
|
108
|
+
y2: 28,
|
|
109
|
+
stroke: mutedColor,
|
|
110
|
+
strokeWidth: 1.5,
|
|
111
|
+
strokeLinecap: 'round',
|
|
112
|
+
}),
|
|
113
|
+
createElement('line', {
|
|
114
|
+
x1: 24,
|
|
115
|
+
y1: 36,
|
|
116
|
+
x2: 32,
|
|
117
|
+
y2: 36,
|
|
118
|
+
stroke: mutedColor,
|
|
119
|
+
strokeWidth: 1.5,
|
|
120
|
+
strokeLinecap: 'round',
|
|
121
|
+
}),
|
|
122
|
+
// Circle with dash (empty indicator)
|
|
123
|
+
createElement('circle', {
|
|
124
|
+
cx: 32,
|
|
125
|
+
cy: 54,
|
|
126
|
+
r: 6,
|
|
127
|
+
stroke: mutedColor,
|
|
128
|
+
strokeWidth: 1.2,
|
|
129
|
+
fill: 'none',
|
|
130
|
+
}),
|
|
131
|
+
createElement('line', {
|
|
132
|
+
x1: 28,
|
|
133
|
+
y1: 54,
|
|
134
|
+
x2: 36,
|
|
135
|
+
y2: 54,
|
|
136
|
+
stroke: mutedColor,
|
|
137
|
+
strokeWidth: 1.2,
|
|
138
|
+
strokeLinecap: 'round',
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ── TkxEmpty ────────────────────────────────────────────────────────────────
|
|
144
|
+
|
|
145
|
+
export function TkxEmpty({
|
|
146
|
+
image = 'default',
|
|
147
|
+
description = 'No data',
|
|
148
|
+
children,
|
|
149
|
+
style,
|
|
150
|
+
}: TkxEmptyProps) {
|
|
151
|
+
const theme = useTheme();
|
|
152
|
+
|
|
153
|
+
const safeDescription =
|
|
154
|
+
typeof description === 'string' ? sanitizeString(description) : description;
|
|
155
|
+
|
|
156
|
+
let imageContent: ReactNode;
|
|
157
|
+
if (image === 'default') {
|
|
158
|
+
imageContent = createElement(DefaultImage, {
|
|
159
|
+
color: theme.primary,
|
|
160
|
+
mutedColor: theme.textMuted,
|
|
161
|
+
});
|
|
162
|
+
} else if (image === 'simple') {
|
|
163
|
+
imageContent = createElement(SimpleImage, { mutedColor: theme.textMuted });
|
|
164
|
+
} else {
|
|
165
|
+
imageContent = image;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return createElement(
|
|
169
|
+
'div',
|
|
170
|
+
{
|
|
171
|
+
role: 'status',
|
|
172
|
+
style: {
|
|
173
|
+
display: 'flex',
|
|
174
|
+
flexDirection: 'column' as const,
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
padding: '32px 16px',
|
|
178
|
+
textAlign: 'center' as const,
|
|
179
|
+
...style,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
// Image area
|
|
183
|
+
createElement(
|
|
184
|
+
'div',
|
|
185
|
+
{
|
|
186
|
+
style: {
|
|
187
|
+
marginBottom: '12px',
|
|
188
|
+
opacity: 0.85,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
imageContent,
|
|
192
|
+
),
|
|
193
|
+
// Description
|
|
194
|
+
safeDescription &&
|
|
195
|
+
createElement(
|
|
196
|
+
'div',
|
|
197
|
+
{
|
|
198
|
+
style: {
|
|
199
|
+
color: theme.textMuted,
|
|
200
|
+
fontSize: '0.875rem',
|
|
201
|
+
lineHeight: '1.5',
|
|
202
|
+
maxWidth: '320px',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
safeDescription,
|
|
206
|
+
),
|
|
207
|
+
// Action area (children)
|
|
208
|
+
children &&
|
|
209
|
+
createElement(
|
|
210
|
+
'div',
|
|
211
|
+
{
|
|
212
|
+
style: {
|
|
213
|
+
marginTop: '16px',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
children,
|
|
217
|
+
),
|
|
218
|
+
);
|
|
219
|
+
}
|