@baseplate-dev/react-generators 0.2.5 → 0.2.6
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.
|
@@ -3,15 +3,38 @@
|
|
|
3
3
|
import type React from 'react';
|
|
4
4
|
|
|
5
5
|
import { cn } from '$cn';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
interface LoaderProps {
|
|
8
9
|
className?: string;
|
|
10
|
+
delay?: number;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Loader component that displays a 3-dot loading animation.
|
|
15
|
+
* Only shows after the specified delay (default: 300ms) to prevent flashing for quick operations.
|
|
13
16
|
*/
|
|
14
|
-
function Loader({ className }: LoaderProps): React.ReactElement {
|
|
17
|
+
function Loader({ className, delay = 300 }: LoaderProps): React.ReactElement {
|
|
18
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const timer = setTimeout(() => {
|
|
22
|
+
setIsVisible(true);
|
|
23
|
+
}, delay);
|
|
24
|
+
|
|
25
|
+
return () => {
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
};
|
|
28
|
+
}, [delay]);
|
|
29
|
+
|
|
30
|
+
if (!isVisible) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
className={cn('flex h-full items-center justify-center', className)}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
15
38
|
return (
|
|
16
39
|
<div
|
|
17
40
|
className={cn('flex h-full items-center justify-center', className)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baseplate-dev/react-generators",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "React Generators for Baseplate",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"inflection": "3.0.0",
|
|
38
38
|
"prettier-plugin-tailwindcss": "0.6.11",
|
|
39
39
|
"zod": "3.24.1",
|
|
40
|
-
"@baseplate-dev/core-generators": "0.2.
|
|
41
|
-
"@baseplate-dev/sync": "0.2.
|
|
42
|
-
"@baseplate-dev/utils": "0.2.
|
|
40
|
+
"@baseplate-dev/core-generators": "0.2.6",
|
|
41
|
+
"@baseplate-dev/sync": "0.2.6",
|
|
42
|
+
"@baseplate-dev/utils": "0.2.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^22.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"eslint": "9.26.0",
|
|
49
49
|
"prettier": "3.5.3",
|
|
50
50
|
"typescript": "5.7.3",
|
|
51
|
-
"@baseplate-dev/tools": "0.2.
|
|
51
|
+
"@baseplate-dev/tools": "0.2.6"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": "^22.0.0"
|