tekivex-ui 2.1.0 → 2.3.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 +75 -14
- package/dist/index.d.ts +34 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11013 -4880
- package/dist/src/components/TkxAffix.d.ts +10 -0
- package/dist/src/components/TkxAffix.d.ts.map +1 -0
- package/dist/src/components/TkxAnchor.d.ts +14 -0
- package/dist/src/components/TkxAnchor.d.ts.map +1 -0
- package/dist/src/components/TkxCascader.d.ts +16 -0
- package/dist/src/components/TkxCascader.d.ts.map +1 -0
- package/dist/src/components/TkxConfigProvider.d.ts +100 -0
- package/dist/src/components/TkxConfigProvider.d.ts.map +1 -0
- package/dist/src/components/TkxDataGrid.d.ts +5 -1
- package/dist/src/components/TkxDataGrid.d.ts.map +1 -1
- 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/TkxList.d.ts +24 -0
- package/dist/src/components/TkxList.d.ts.map +1 -0
- package/dist/src/components/TkxMentions.d.ts +15 -0
- package/dist/src/components/TkxMentions.d.ts.map +1 -0
- package/dist/src/components/TkxQRCode.d.ts +11 -0
- package/dist/src/components/TkxQRCode.d.ts.map +1 -0
- package/dist/src/components/TkxResult.d.ts +11 -0
- package/dist/src/components/TkxResult.d.ts.map +1 -0
- package/dist/src/components/TkxSegmented.d.ts +16 -0
- package/dist/src/components/TkxSegmented.d.ts.map +1 -0
- package/dist/src/components/TkxSelect.d.ts +5 -1
- package/dist/src/components/TkxSelect.d.ts.map +1 -1
- 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/TkxTour.d.ts +15 -0
- package/dist/src/components/TkxTour.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/TkxWatermark.d.ts +12 -0
- package/dist/src/components/TkxWatermark.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +17 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/engine/tkx.d.ts +38 -0
- package/dist/src/engine/tkx.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/TkxAffix.tsx +138 -0
- package/src/components/TkxAnchor.tsx +193 -0
- package/src/components/TkxCascader.tsx +276 -0
- package/src/components/TkxConfigProvider.tsx +458 -0
- package/src/components/TkxDataGrid.tsx +65 -2
- package/src/components/TkxEmpty.tsx +219 -0
- package/src/components/TkxForm.tsx +607 -0
- package/src/components/TkxLayout.tsx +647 -0
- package/src/components/TkxList.tsx +242 -0
- package/src/components/TkxMentions.tsx +210 -0
- package/src/components/TkxQRCode.tsx +174 -0
- package/src/components/TkxResult.tsx +128 -0
- package/src/components/TkxSegmented.tsx +169 -0
- package/src/components/TkxSelect.tsx +209 -6
- package/src/components/TkxSpin.tsx +261 -0
- package/src/components/TkxStatistic.tsx +261 -0
- package/src/components/TkxTour.tsx +239 -0
- package/src/components/TkxTypography.tsx +263 -0
- package/src/components/TkxWatermark.tsx +143 -0
- package/src/components/index.ts +17 -0
- package/src/engine/tkx.ts +62 -0
- package/src/themes/index.ts +149 -0
package/src/engine/tkx.ts
CHANGED
|
@@ -660,6 +660,10 @@ function resolveUtility(u: string): Declarations | null {
|
|
|
660
660
|
// ── CSS variable passthrough: [--my-var:value] ────────────────────────────
|
|
661
661
|
if ((m = u.match(/^\[(--[a-zA-Z0-9-]+):(.+)]$/))) { return { [m[1]]: m[2] }; }
|
|
662
662
|
|
|
663
|
+
// ── Plugin utilities ─────────────────────────────────────────────────────
|
|
664
|
+
const pluginResult = resolvePluginUtility(u);
|
|
665
|
+
if (pluginResult) return pluginResult;
|
|
666
|
+
|
|
663
667
|
return null;
|
|
664
668
|
}
|
|
665
669
|
|
|
@@ -872,3 +876,61 @@ export function resetAtomicCSS(): void {
|
|
|
872
876
|
export function cx(...classes: (string | false | null | undefined)[]): string {
|
|
873
877
|
return classes.filter(Boolean).join(' ');
|
|
874
878
|
}
|
|
879
|
+
|
|
880
|
+
// ── Plugin System ────────────────────────────────────────────────────────────
|
|
881
|
+
/**
|
|
882
|
+
* TKX Plugin API — extend the utility engine with custom utilities.
|
|
883
|
+
*
|
|
884
|
+
* @example
|
|
885
|
+
* ```tsx
|
|
886
|
+
* import { tkxPlugin, tkx } from '@tekivex/ui';
|
|
887
|
+
*
|
|
888
|
+
* // Register custom utilities
|
|
889
|
+
* tkxPlugin({
|
|
890
|
+
* name: 'brand',
|
|
891
|
+
* utilities: {
|
|
892
|
+
* 'brand-gradient': { background: 'linear-gradient(135deg, #667eea, #764ba2)' },
|
|
893
|
+
* 'brand-text': { color: '#667eea', fontWeight: '700' },
|
|
894
|
+
* 'card-shadow': { boxShadow: '0 8px 32px rgba(102, 126, 234, 0.15)' },
|
|
895
|
+
* 'glass': {
|
|
896
|
+
* background: 'rgba(255, 255, 255, 0.05)',
|
|
897
|
+
* backdropFilter: 'blur(12px)',
|
|
898
|
+
* border: '1px solid rgba(255, 255, 255, 0.1)',
|
|
899
|
+
* },
|
|
900
|
+
* },
|
|
901
|
+
* });
|
|
902
|
+
*
|
|
903
|
+
* // Use them like any built-in utility
|
|
904
|
+
* const cls = tkx('brand-gradient p-6 rounded-xl card-shadow');
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
|
|
908
|
+
export interface TkxPluginDef {
|
|
909
|
+
name: string;
|
|
910
|
+
utilities: Record<string, Record<string, string>>;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
const pluginRegistry = new Map<string, Record<string, Record<string, string>>>();
|
|
914
|
+
|
|
915
|
+
export function tkxPlugin(plugin: TkxPluginDef): void {
|
|
916
|
+
pluginRegistry.set(plugin.name, plugin.utilities);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
export function tkxRemovePlugin(name: string): void {
|
|
920
|
+
pluginRegistry.delete(name);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
export function tkxListPlugins(): string[] {
|
|
924
|
+
return Array.from(pluginRegistry.keys());
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* Resolve a plugin utility to CSS properties.
|
|
929
|
+
* Called internally by the TKX engine — but also exported for inspection.
|
|
930
|
+
*/
|
|
931
|
+
export function resolvePluginUtility(name: string): Record<string, string> | null {
|
|
932
|
+
for (const utilities of pluginRegistry.values()) {
|
|
933
|
+
if (utilities[name]) return utilities[name];
|
|
934
|
+
}
|
|
935
|
+
return null;
|
|
936
|
+
}
|
package/src/themes/index.ts
CHANGED
|
@@ -109,3 +109,152 @@ export function ThemeProvider({ theme = quantumDark, children }: ThemeProviderPr
|
|
|
109
109
|
export function useTheme(): ThemeTokens {
|
|
110
110
|
return useContext(ThemeContext);
|
|
111
111
|
}
|
|
112
|
+
|
|
113
|
+
// ── Color Palette Generator ─────────────────────────────────────────────────
|
|
114
|
+
// Generates 50-900 shades from a single hex color
|
|
115
|
+
|
|
116
|
+
function hexToHSL(hex: string): [number, number, number] {
|
|
117
|
+
const clean = hex.replace('#', '');
|
|
118
|
+
const r = parseInt(clean.slice(0, 2), 16) / 255;
|
|
119
|
+
const g = parseInt(clean.slice(2, 4), 16) / 255;
|
|
120
|
+
const b = parseInt(clean.slice(4, 6), 16) / 255;
|
|
121
|
+
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
122
|
+
let h = 0, s = 0;
|
|
123
|
+
const l = (max + min) / 2;
|
|
124
|
+
if (max !== min) {
|
|
125
|
+
const d = max - min;
|
|
126
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
127
|
+
switch (max) {
|
|
128
|
+
case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
|
|
129
|
+
case g: h = ((b - r) / d + 2) / 6; break;
|
|
130
|
+
case b: h = ((r - g) / d + 4) / 6; break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return [Math.round(h * 360), Math.round(s * 100), Math.round(l * 100)];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function hslToHex(h: number, s: number, l: number): string {
|
|
137
|
+
s /= 100; l /= 100;
|
|
138
|
+
const a = s * Math.min(l, 1 - l);
|
|
139
|
+
const f = (n: number) => {
|
|
140
|
+
const k = (n + h / 30) % 12;
|
|
141
|
+
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
142
|
+
return Math.round(255 * color).toString(16).padStart(2, '0');
|
|
143
|
+
};
|
|
144
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface ColorPalette {
|
|
148
|
+
50: string;
|
|
149
|
+
100: string;
|
|
150
|
+
200: string;
|
|
151
|
+
300: string;
|
|
152
|
+
400: string;
|
|
153
|
+
500: string;
|
|
154
|
+
600: string;
|
|
155
|
+
700: string;
|
|
156
|
+
800: string;
|
|
157
|
+
900: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function generatePalette(hex: string): ColorPalette {
|
|
161
|
+
const [h, s] = hexToHSL(hex);
|
|
162
|
+
return {
|
|
163
|
+
50: hslToHex(h, Math.min(s, 30), 96),
|
|
164
|
+
100: hslToHex(h, Math.min(s, 40), 90),
|
|
165
|
+
200: hslToHex(h, Math.min(s, 50), 80),
|
|
166
|
+
300: hslToHex(h, s, 70),
|
|
167
|
+
400: hslToHex(h, s, 60),
|
|
168
|
+
500: hex,
|
|
169
|
+
600: hslToHex(h, s, 45),
|
|
170
|
+
700: hslToHex(h, s, 35),
|
|
171
|
+
800: hslToHex(h, s, 25),
|
|
172
|
+
900: hslToHex(h, s, 15),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ── Typography Scale ────────────────────────────────────────────────────────
|
|
177
|
+
|
|
178
|
+
export const typography = {
|
|
179
|
+
xs: { fontSize: '0.75rem', lineHeight: '1rem' },
|
|
180
|
+
sm: { fontSize: '0.875rem', lineHeight: '1.25rem' },
|
|
181
|
+
base: { fontSize: '1rem', lineHeight: '1.5rem' },
|
|
182
|
+
lg: { fontSize: '1.125rem', lineHeight: '1.75rem' },
|
|
183
|
+
xl: { fontSize: '1.25rem', lineHeight: '1.75rem' },
|
|
184
|
+
'2xl': { fontSize: '1.5rem', lineHeight: '2rem' },
|
|
185
|
+
'3xl': { fontSize: '1.875rem', lineHeight: '2.25rem' },
|
|
186
|
+
'4xl': { fontSize: '2.25rem', lineHeight: '2.5rem' },
|
|
187
|
+
'5xl': { fontSize: '3rem', lineHeight: '1.15' },
|
|
188
|
+
} as const;
|
|
189
|
+
|
|
190
|
+
// ── Spacing Scale ───────────────────────────────────────────────────────────
|
|
191
|
+
|
|
192
|
+
export const spacing = {
|
|
193
|
+
0: '0px',
|
|
194
|
+
0.5: '2px',
|
|
195
|
+
1: '4px',
|
|
196
|
+
1.5: '6px',
|
|
197
|
+
2: '8px',
|
|
198
|
+
2.5: '10px',
|
|
199
|
+
3: '12px',
|
|
200
|
+
4: '16px',
|
|
201
|
+
5: '20px',
|
|
202
|
+
6: '24px',
|
|
203
|
+
8: '32px',
|
|
204
|
+
10: '40px',
|
|
205
|
+
12: '48px',
|
|
206
|
+
16: '64px',
|
|
207
|
+
20: '80px',
|
|
208
|
+
24: '96px',
|
|
209
|
+
} as const;
|
|
210
|
+
|
|
211
|
+
// ── Breakpoints ─────────────────────────────────────────────────────────────
|
|
212
|
+
|
|
213
|
+
export const breakpoints = {
|
|
214
|
+
sm: 640,
|
|
215
|
+
md: 768,
|
|
216
|
+
lg: 1024,
|
|
217
|
+
xl: 1280,
|
|
218
|
+
'2xl': 1536,
|
|
219
|
+
} as const;
|
|
220
|
+
|
|
221
|
+
// ── Shadows ─────────────────────────────────────────────────────────────────
|
|
222
|
+
|
|
223
|
+
export const shadows = {
|
|
224
|
+
none: 'none',
|
|
225
|
+
xs: '0 1px 2px 0 rgba(0,0,0,0.05)',
|
|
226
|
+
sm: '0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)',
|
|
227
|
+
md: '0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)',
|
|
228
|
+
lg: '0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)',
|
|
229
|
+
xl: '0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)',
|
|
230
|
+
'2xl': '0 25px 50px -12px rgba(0,0,0,0.25)',
|
|
231
|
+
inner: 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
|
|
232
|
+
} as const;
|
|
233
|
+
|
|
234
|
+
// ── Z-Index Scale ───────────────────────────────────────────────────────────
|
|
235
|
+
|
|
236
|
+
export const zIndex = {
|
|
237
|
+
hide: -1,
|
|
238
|
+
base: 0,
|
|
239
|
+
dropdown: 1000,
|
|
240
|
+
sticky: 1100,
|
|
241
|
+
fixed: 1200,
|
|
242
|
+
overlay: 1300,
|
|
243
|
+
modal: 1400,
|
|
244
|
+
popover: 1500,
|
|
245
|
+
tooltip: 1600,
|
|
246
|
+
toast: 1700,
|
|
247
|
+
max: 9999,
|
|
248
|
+
} as const;
|
|
249
|
+
|
|
250
|
+
// ── Radius ──────────────────────────────────────────────────────────────────
|
|
251
|
+
|
|
252
|
+
export const radii = {
|
|
253
|
+
none: '0',
|
|
254
|
+
sm: '4px',
|
|
255
|
+
md: '6px',
|
|
256
|
+
lg: '8px',
|
|
257
|
+
xl: '12px',
|
|
258
|
+
'2xl': '16px',
|
|
259
|
+
full: '9999px',
|
|
260
|
+
} as const;
|