neogestify-ui-components 1.1.0 → 1.1.2
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/components/html/index.d.mts +10 -1
- package/dist/components/html/index.d.ts +10 -1
- package/dist/components/html/index.js +91 -0
- package/dist/components/html/index.js.map +1 -1
- package/dist/components/html/index.mjs +91 -1
- package/dist/components/html/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/html/Input.tsx +33 -0
- package/src/components/html/Loading.tsx +104 -0
- package/src/components/html/index.ts +2 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
|
|
3
|
+
interface LoadingProps {
|
|
4
|
+
variant?: 'spinner' | 'dots' | 'pulse' | 'bars' | 'ring' | 'cube';
|
|
5
|
+
size?: 'small' | 'medium' | 'large' | 'xl';
|
|
6
|
+
color?: 'primary' | 'white' | 'gray' | 'success' | 'danger' | 'warning';
|
|
7
|
+
label?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Loading: FC<LoadingProps> = ({
|
|
12
|
+
variant = 'spinner',
|
|
13
|
+
size = 'medium',
|
|
14
|
+
color = 'primary',
|
|
15
|
+
label,
|
|
16
|
+
className = '',
|
|
17
|
+
}) => {
|
|
18
|
+
const sizeClasses = {
|
|
19
|
+
small: 'h-4 w-4',
|
|
20
|
+
medium: 'h-8 w-8',
|
|
21
|
+
large: 'h-12 w-12',
|
|
22
|
+
xl: 'h-16 w-16',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const colorClasses = {
|
|
26
|
+
primary: 'text-indigo-600 dark:text-indigo-400',
|
|
27
|
+
white: 'text-white',
|
|
28
|
+
gray: 'text-gray-500 dark:text-gray-400',
|
|
29
|
+
success: 'text-green-600 dark:text-green-400',
|
|
30
|
+
danger: 'text-red-600 dark:text-red-400',
|
|
31
|
+
warning: 'text-yellow-600 dark:text-yellow-400',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const renderIcon = () => {
|
|
35
|
+
const commonClass = `${sizeClasses[size]} ${colorClasses[color]}`;
|
|
36
|
+
|
|
37
|
+
switch (variant) {
|
|
38
|
+
case 'dots':
|
|
39
|
+
const dotSize = size === 'small' ? 'h-1 w-1' : size === 'medium' ? 'h-2 w-2' : size === 'large' ? 'h-3 w-3' : 'h-4 w-4';
|
|
40
|
+
return (
|
|
41
|
+
<div className={`flex space-x-1 ${colorClasses[color]}`}>
|
|
42
|
+
<div className={`rounded-full bg-current animate-bounce ${dotSize}`} style={{ animationDelay: '0s' }}></div>
|
|
43
|
+
<div className={`rounded-full bg-current animate-bounce ${dotSize}`} style={{ animationDelay: '0.15s' }}></div>
|
|
44
|
+
<div className={`rounded-full bg-current animate-bounce ${dotSize}`} style={{ animationDelay: '0.3s' }}></div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
case 'bars':
|
|
49
|
+
return (
|
|
50
|
+
<div className={`flex items-end space-x-1 ${sizeClasses[size]} ${colorClasses[color]}`}>
|
|
51
|
+
<div className="w-1/4 bg-current animate-[pulse_1s_ease-in-out_infinite]" style={{ height: '60%', animationDelay: '0s' }}></div>
|
|
52
|
+
<div className="w-1/4 bg-current animate-[pulse_1s_ease-in-out_infinite]" style={{ height: '100%', animationDelay: '0.2s' }}></div>
|
|
53
|
+
<div className="w-1/4 bg-current animate-[pulse_1s_ease-in-out_infinite]" style={{ height: '60%', animationDelay: '0.4s' }}></div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
case 'pulse':
|
|
58
|
+
return (
|
|
59
|
+
<span className={`relative flex ${commonClass}`}>
|
|
60
|
+
<span className="animate-ping absolute inline-flex h-full w-full rounded-full opacity-75 bg-current"></span>
|
|
61
|
+
<span className="relative inline-flex rounded-full h-full w-full bg-current"></span>
|
|
62
|
+
</span>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
case 'cube':
|
|
66
|
+
return (
|
|
67
|
+
<div className={`${commonClass} grid grid-cols-2 gap-1`}>
|
|
68
|
+
<div className="bg-current animate-[pulse_2s_ease-in-out_infinite]" style={{ animationDelay: '0s' }}></div>
|
|
69
|
+
<div className="bg-current animate-[pulse_2s_ease-in-out_infinite]" style={{ animationDelay: '0.5s' }}></div>
|
|
70
|
+
<div className="bg-current animate-[pulse_2s_ease-in-out_infinite]" style={{ animationDelay: '1.5s' }}></div>
|
|
71
|
+
<div className="bg-current animate-[pulse_2s_ease-in-out_infinite]" style={{ animationDelay: '1s' }}></div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
case 'ring':
|
|
76
|
+
return (
|
|
77
|
+
<svg className={`${commonClass} animate-spin`} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
78
|
+
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
|
|
79
|
+
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
80
|
+
</svg>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
case 'spinner':
|
|
84
|
+
default:
|
|
85
|
+
return (
|
|
86
|
+
<svg className={`${commonClass} animate-spin`} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
87
|
+
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
|
|
88
|
+
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"></path>
|
|
89
|
+
</svg>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div className={`flex flex-col items-center justify-center w-full h-full min-h-[inherit] ${className}`} role="status">
|
|
96
|
+
{renderIcon()}
|
|
97
|
+
{label && (
|
|
98
|
+
<span className={`mt-3 text-sm font-medium ${colorClasses[color]}`}>
|
|
99
|
+
{label}
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
@@ -4,4 +4,5 @@ export { TextArea } from './TextArea';
|
|
|
4
4
|
export { Form } from './Form';
|
|
5
5
|
export { Select } from './Select';
|
|
6
6
|
export { Table } from './Table';
|
|
7
|
-
export { Modal, type ModalRef } from './Modal';
|
|
7
|
+
export { Modal, type ModalRef } from './Modal';
|
|
8
|
+
export { Loading } from './Loading';
|