react-loadly 1.0.0 → 1.0.1
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/README.md +142 -34
- package/dist/{index.js → index.cjs.js} +660 -367
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +84 -30
- package/dist/index.esm.js +644 -352
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/types/@types/interfaces/IBaseLoaderProps.d.ts +10 -0
- package/dist/types/@types/interfaces/IBaseLoaderProps.d.ts.map +1 -1
- package/dist/types/@types/interfaces/IElementLoaderProps.d.ts +11 -0
- package/dist/types/@types/interfaces/IElementLoaderProps.d.ts.map +1 -0
- package/dist/types/@types/interfaces/IFallbackLoaderProps.d.ts +2 -1
- package/dist/types/@types/interfaces/IFallbackLoaderProps.d.ts.map +1 -1
- package/dist/types/@types/interfaces/ILogoLoaderProps.d.ts +1 -1
- package/dist/types/@types/interfaces/ILogoLoaderProps.d.ts.map +1 -1
- package/dist/types/@types/interfaces/ITextLoaderProps.d.ts +1 -2
- package/dist/types/@types/interfaces/ITextLoaderProps.d.ts.map +1 -1
- package/dist/types/__tests__/ElementLoader.example.d.ts +4 -0
- package/dist/types/__tests__/ElementLoader.example.d.ts.map +1 -0
- package/dist/types/components/atoms/Circle.d.ts +2 -1
- package/dist/types/components/atoms/Circle.d.ts.map +1 -1
- package/dist/types/components/atoms/Dot.d.ts +1 -1
- package/dist/types/components/atoms/Dot.d.ts.map +1 -1
- package/dist/types/components/atoms/Line.d.ts +1 -1
- package/dist/types/components/atoms/Line.d.ts.map +1 -1
- package/dist/types/components/atoms/Rectangle.d.ts +1 -0
- package/dist/types/components/atoms/Rectangle.d.ts.map +1 -1
- package/dist/types/components/molecules/DotCluster.d.ts +1 -0
- package/dist/types/components/molecules/DotCluster.d.ts.map +1 -1
- package/dist/types/components/molecules/LineGroup.d.ts +1 -0
- package/dist/types/components/molecules/LineGroup.d.ts.map +1 -1
- package/dist/types/components/molecules/ShapeGroup.d.ts +1 -0
- package/dist/types/components/molecules/ShapeGroup.d.ts.map +1 -1
- package/dist/types/components/organisms/BarsLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/BlobLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/BounceLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/DotsLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/ElementLoader.d.ts +27 -0
- package/dist/types/components/organisms/ElementLoader.d.ts.map +1 -0
- package/dist/types/components/organisms/FallbackLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/FlowLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/GridLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/LiquidLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/LogoSpinLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/PulseLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/RingLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/RotateLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/SpinLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/TypingLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/WaveLoader.d.ts.map +1 -1
- package/dist/types/components/organisms/index.d.ts +6 -5
- package/dist/types/components/organisms/index.d.ts.map +1 -1
- package/dist/types/hooks/useLoaderState.d.ts.map +1 -1
- package/package.json +11 -21
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
A professional, high-performance, and accessible collection of **React loader components**. Built with **TypeScript** and optimized for a great user and developer experience.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/react-loadly)
|
|
6
|
-
[](https://
|
|
7
|
-
[](https://
|
|
8
|
-
[](https://github.com/react-loaders/react-loaders/blob/main/LICENSE)
|
|
9
|
-
|
|
10
|
-
---
|
|
5
|
+
[](https://www.npmjs.com/package/react-loadly)
|
|
6
|
+
[](https://bundlephobia.com/result?p=react-loadly)
|
|
7
|
+
[](https://github.com/Mostafashadow1/react-loadly/blob/main/LICENSE)
|
|
11
8
|
|
|
12
9
|
## ✨ Key Features
|
|
13
10
|
|
|
@@ -18,6 +15,7 @@ A professional, high-performance, and accessible collection of **React loader co
|
|
|
18
15
|
- **Tree-Shakable**: Supports modern bundlers to only include what you use.
|
|
19
16
|
- **Reduced Motion**: Respects the user's `prefers-reduced-motion` settings.
|
|
20
17
|
- **SSR Compatible**: Works out-of-the-box with frameworks like **Next.js**.
|
|
18
|
+
- **Fullscreen Support**: Display loaders in fullscreen mode with customizable backgrounds.
|
|
21
19
|
|
|
22
20
|
---
|
|
23
21
|
|
|
@@ -80,6 +78,116 @@ function App() {
|
|
|
80
78
|
| `TypingLoader` | | A loader that simulates typing or processing text. |
|
|
81
79
|
| `DotsLoader` | | The familiar three-dot animation, perfect for text. |
|
|
82
80
|
|
|
81
|
+
### Flexible Loaders
|
|
82
|
+
|
|
83
|
+
| Component | Description |
|
|
84
|
+
| --------------- | --------------------------------------------------------- |
|
|
85
|
+
| `ElementLoader` | A flexible loader that can display any React element with various animation effects. |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🧩 ElementLoader Component
|
|
90
|
+
|
|
91
|
+
The `ElementLoader` is a versatile component that can wrap any React element and apply various loading animations to it. Unlike other loaders that are pre-designed with specific visuals, the ElementLoader allows you to use your own elements (icons, divs, images, etc.) as the loading indicator.
|
|
92
|
+
|
|
93
|
+
### Basic Usage
|
|
94
|
+
|
|
95
|
+
```jsx
|
|
96
|
+
import { ElementLoader } from "react-loadly";
|
|
97
|
+
|
|
98
|
+
function App() {
|
|
99
|
+
return (
|
|
100
|
+
<ElementLoader>
|
|
101
|
+
<div style={{ width: '40px', height: '40px', backgroundColor: 'blue' }} />
|
|
102
|
+
</ElementLoader>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Animation Types
|
|
108
|
+
|
|
109
|
+
The ElementLoader supports multiple animation types:
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
// Spin animation (default)
|
|
113
|
+
<ElementLoader animationType="spin">
|
|
114
|
+
<YourIconComponent />
|
|
115
|
+
</ElementLoader>
|
|
116
|
+
|
|
117
|
+
// Pulse animation
|
|
118
|
+
<ElementLoader animationType="pulse">
|
|
119
|
+
<YourIconComponent />
|
|
120
|
+
</ElementLoader>
|
|
121
|
+
|
|
122
|
+
// Glow animation
|
|
123
|
+
<ElementLoader animationType="glow">
|
|
124
|
+
<YourIconComponent />
|
|
125
|
+
</ElementLoader>
|
|
126
|
+
|
|
127
|
+
// Bounce animation
|
|
128
|
+
<ElementLoader animationType="bounce">
|
|
129
|
+
<YourIconComponent />
|
|
130
|
+
</ElementLoader>
|
|
131
|
+
|
|
132
|
+
// Flip animation
|
|
133
|
+
<ElementLoader animationType="flip">
|
|
134
|
+
<YourIconComponent />
|
|
135
|
+
</ElementLoader>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Customization Options
|
|
139
|
+
|
|
140
|
+
```jsx
|
|
141
|
+
<ElementLoader
|
|
142
|
+
size={80}
|
|
143
|
+
color="#ff6b6b"
|
|
144
|
+
speed={1.5}
|
|
145
|
+
glowIntensity={0.5}
|
|
146
|
+
showText
|
|
147
|
+
loadingText="Loading..."
|
|
148
|
+
>
|
|
149
|
+
<YourCustomElement />
|
|
150
|
+
</ElementLoader>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Fullscreen Mode
|
|
154
|
+
|
|
155
|
+
Like other loaders, ElementLoader supports fullscreen mode:
|
|
156
|
+
|
|
157
|
+
```jsx
|
|
158
|
+
<ElementLoader
|
|
159
|
+
fullscreen
|
|
160
|
+
loaderCenter
|
|
161
|
+
screenBackground="rgba(0, 0, 0, 0.5)"
|
|
162
|
+
>
|
|
163
|
+
<YourIconComponent />
|
|
164
|
+
</ElementLoader>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Props
|
|
168
|
+
|
|
169
|
+
| Prop | Type | Default | Description |
|
|
170
|
+
| --------------- | ------------------------------- | ----------- | --------------------------------------------------- |
|
|
171
|
+
| `children` | ReactNode | undefined | The React element to apply loading animation to |
|
|
172
|
+
| `animationType` | "spin" \| "pulse" \| "glow" \| "bounce" \| "flip" | "spin" | Type of animation to apply |
|
|
173
|
+
| `glowIntensity` | number (0-1) | 0.3 | Intensity of the glow effect |
|
|
174
|
+
| `size` | number \| string | 60 | Size of the loader |
|
|
175
|
+
| `width` | number \| string | undefined | Width of the loader (overrides size) |
|
|
176
|
+
| `height` | number \| string | undefined | Height of the loader (overrides size) |
|
|
177
|
+
| `color` | string | "var(--react-loadly-color)" | Primary color of the loader |
|
|
178
|
+
| `speed` | number | 1 | Animation speed multiplier |
|
|
179
|
+
| `loading` | boolean | true | Whether the loader is active |
|
|
180
|
+
| `className` | string | undefined | Custom CSS class name |
|
|
181
|
+
| `style` | CSSProperties | undefined | Custom inline styles |
|
|
182
|
+
| `aria-label` | string | "Loading..."| Accessibility label for screen readers |
|
|
183
|
+
| `showText` | boolean | false | Whether to show loading text |
|
|
184
|
+
| `loadingText` | string | undefined | Custom loading text |
|
|
185
|
+
| `fullscreen` | boolean | false | Enable fullscreen mode |
|
|
186
|
+
| `screenWidth` | number \| string | undefined | Screen width for fullscreen mode |
|
|
187
|
+
| `screenHeight` | number \| string | undefined | Screen height for fullscreen mode |
|
|
188
|
+
| `loaderCenter` | boolean | false | Center the loader in fullscreen mode |
|
|
189
|
+
| `screenBackground` | string | undefined | Background color for fullscreen mode |
|
|
190
|
+
|
|
83
191
|
---
|
|
84
192
|
|
|
85
193
|
## ♿ Accessibility
|
|
@@ -131,9 +239,37 @@ interface BaseLoaderProps {
|
|
|
131
239
|
style?: React.CSSProperties;
|
|
132
240
|
showText?: boolean;
|
|
133
241
|
loadingText?: string;
|
|
242
|
+
// Fullscreen props
|
|
243
|
+
fullscreen?: boolean;
|
|
244
|
+
screenWidth?: number | string;
|
|
245
|
+
screenHeight?: number | string;
|
|
246
|
+
loaderCenter?: boolean;
|
|
247
|
+
screenBackground?: string;
|
|
134
248
|
}
|
|
135
249
|
```
|
|
136
250
|
|
|
251
|
+
### Fullscreen Mode
|
|
252
|
+
|
|
253
|
+
Display any loader in fullscreen mode with customizable dimensions and background:
|
|
254
|
+
|
|
255
|
+
```jsx
|
|
256
|
+
// Fullscreen loader covering entire viewport
|
|
257
|
+
<SpinLoader
|
|
258
|
+
fullscreen={true}
|
|
259
|
+
loaderCenter={true}
|
|
260
|
+
screenBackground="#f0f0f0"
|
|
261
|
+
/>
|
|
262
|
+
|
|
263
|
+
// Fullscreen loader with custom dimensions
|
|
264
|
+
<PulseLoader
|
|
265
|
+
fullscreen={true}
|
|
266
|
+
screenWidth={800}
|
|
267
|
+
screenHeight={600}
|
|
268
|
+
loaderCenter={true}
|
|
269
|
+
screenBackground="rgba(0, 0, 0, 0.5)"
|
|
270
|
+
/>
|
|
271
|
+
```
|
|
272
|
+
|
|
137
273
|
---
|
|
138
274
|
|
|
139
275
|
## 🧩 Advanced Usage
|
|
@@ -189,32 +325,4 @@ A component to gracefully handle and display errors, timeouts, or network issues
|
|
|
189
325
|
import { FallbackLoader } from "react-loadly";
|
|
190
326
|
|
|
191
327
|
function ErrorBoundary({ error, retry }) {
|
|
192
|
-
return (
|
|
193
|
-
<FallbackLoader
|
|
194
|
-
error={error.message}
|
|
195
|
-
onRetry={retry}
|
|
196
|
-
type="error" // 'error' | 'network' | 'timeout'
|
|
197
|
-
/>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
328
|
```
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## 🤝 Contributing
|
|
205
|
-
|
|
206
|
-
Contributions are welcome\! Please see our [CONTRIBUTING.md](https://www.google.com/search?q=CONTRIBUTING.md) guide for details.
|
|
207
|
-
|
|
208
|
-
1. Fork the repository.
|
|
209
|
-
2. Create your feature branch (`git checkout -b feature/my-new-feature`).
|
|
210
|
-
3. Commit your changes (`git commit -m 'feat: add a new loader component'`).
|
|
211
|
-
4. Push to the branch (`git push origin feature/my-new-feature`).
|
|
212
|
-
5. Open a pull request.
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## 📄 License
|
|
217
|
-
|
|
218
|
-
This project is licensed under the **MIT License**.
|
|
219
|
-
|
|
220
|
-
\<p align="center"\>Made with ❤️ by the React community.\</p\>
|