neogestify-ui-components 1.1.1 → 1.1.3
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 +68 -0
- package/dist/components/html/index.js.map +1 -1
- package/dist/components/html/index.mjs +68 -1
- package/dist/components/html/index.mjs.map +1 -1
- package/dist/components/icons/index.js +2 -2
- package/dist/components/icons/index.js.map +1 -1
- package/dist/components/icons/index.mjs +2 -2
- package/dist/components/icons/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +70 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/html/Loading.tsx +104 -0
- package/src/components/html/index.ts +2 -1
- package/src/components/icons/icons.tsx +2 -6
|
@@ -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';
|
|
@@ -468,9 +468,7 @@ export function FacturacionIcon({ className }: Props) {
|
|
|
468
468
|
|
|
469
469
|
export function WhatsAppIcon({ className }: Props) {
|
|
470
470
|
return (
|
|
471
|
-
<svg className={className} viewBox="0 0 24 24"
|
|
472
|
-
<path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893A11.821 11.821 0 0020.465 3.488" />
|
|
473
|
-
</svg>
|
|
471
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" className={className} viewBox="0 0 24 24"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52s.198-.298.298-.497c.099-.198.05-.371-.025-.52s-.669-1.612-.916-2.207c-.242-.579-.487-.5-.669-.51a13 13 0 0 0-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074s2.096 3.2 5.077 4.487c.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413s.248-1.289.173-1.413c-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.82 9.82 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.82 11.82 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.9 11.9 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.82 11.82 0 0 0-3.478-8.413" /></svg>
|
|
474
472
|
)
|
|
475
473
|
}
|
|
476
474
|
|
|
@@ -500,9 +498,7 @@ export function PasteIcon({ className }: Props) {
|
|
|
500
498
|
|
|
501
499
|
export function RestaurantMenuIcon({ className }: Props) {
|
|
502
500
|
return (
|
|
503
|
-
<svg className={className}
|
|
504
|
-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 3v18h18V3H3zm16 16H5V5h14v14zM7 8h10v2H7V8zm0 4h10v2H7v-2zm0 4h7v2H7v-2z" />
|
|
505
|
-
</svg>
|
|
501
|
+
<svg xmlns="http://www.w3.org/2000/svg" className={className} viewBox="0 0 24 24"><path fill="currentColor" d="M6 22q-.825 0-1.412-.587T4 20v-2q-.425 0-.712-.288T3 17t.288-.712T4 16v-3q-.425 0-.712-.288T3 12t.288-.712T4 11V8q-.425 0-.712-.288T3 7t.288-.712T4 6V4q0-.825.588-1.412T6 2h12q.825 0 1.413.588T20 4v16q0 .825-.587 1.413T18 22zm0-2h12V4H6v2q.425 0 .713.288T7 7t-.288.713T6 8v3q.425 0 .713.288T7 12t-.288.713T6 13v3q.425 0 .713.288T7 17t-.288.713T6 18zm3.5-7v3.25q0 .325.213.538t.537.212.538-.213.212-.537V13q.65-.175 1.075-.712t.425-1.213V7.5q0-.2-.15-.35T12 7t-.35.15-.15.35v3.275h-.75V7.5q0-.2-.15-.35T10.25 7t-.35.15-.15.35v3.275H9V7.5q0-.2-.15-.35T8.5 7t-.35.15T8 7.5v3.575q0 .675.425 1.213T9.5 13m5.5 0v3.25q0 .325.213.538t.537.212.538-.213.212-.537V7.575q0-.275-.187-.425T15.825 7q-.325 0-.712.175t-.738.525q-.425.425-.65.963T13.5 9.825V12q0 .425.288.713T14.5 13zm-9 7V4z"/></svg>
|
|
506
502
|
)
|
|
507
503
|
}
|
|
508
504
|
|