awesome-ring-carousel 0.1.0 → 0.1.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 +67 -67
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,14 +4,14 @@ A beautiful, interactive 3D ring carousel component for React with smooth animat
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
- **3D Ring Carousel** - Visually stunning 3D perspective effects
|
|
8
|
+
- **4 Built-in Themes** - Dark, Light, Neon, and Glass themes
|
|
9
|
+
- **Multiple Control Methods** - Mouse drag, keyboard arrows, touch & programmatic
|
|
10
|
+
- **Auto-Rotate** - Automatic carousel rotation with customizable speed
|
|
11
|
+
- **Responsive** - Works seamlessly on different screen sizes
|
|
12
|
+
- **Smooth Physics** - Realistic inertia and friction animations
|
|
13
|
+
- **Glow Effects** - Beautiful focus glow for the active item
|
|
14
|
+
- **Highly Customizable** - Full control over speed, friction, perspective, and more
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -55,18 +55,18 @@ export default function App() {
|
|
|
55
55
|
|
|
56
56
|
Each item in the carousel requires the following structure:
|
|
57
57
|
|
|
58
|
-
```js
|
|
59
|
-
const slide = {
|
|
60
|
-
title: 'Slide 1', // Required: Title displayed on the card
|
|
61
|
-
description: 'First slide', // Optional: Subtitle or description
|
|
62
|
-
image: 'url1.jpg', // Optional: Image URL
|
|
63
|
-
tag: 'Featured', // Optional: Tag label
|
|
64
|
-
color: '#ff6b6b', // Optional: Background color (hex)
|
|
65
|
-
onClick: () => {}, // Optional: Click handler
|
|
66
|
-
};
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
For TypeScript users, this object shape maps directly to the `SlideData` type exported by the package.
|
|
58
|
+
```js
|
|
59
|
+
const slide = {
|
|
60
|
+
title: 'Slide 1', // Required: Title displayed on the card
|
|
61
|
+
description: 'First slide', // Optional: Subtitle or description
|
|
62
|
+
image: 'url1.jpg', // Optional: Image URL
|
|
63
|
+
tag: 'Featured', // Optional: Tag label
|
|
64
|
+
color: '#ff6b6b', // Optional: Background color (hex)
|
|
65
|
+
onClick: () => {}, // Optional: Click handler
|
|
66
|
+
};
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For TypeScript users, this object shape maps directly to the `SlideData` type exported by the package.
|
|
70
70
|
|
|
71
71
|
## Component Props
|
|
72
72
|
|
|
@@ -119,11 +119,11 @@ Frosted glass effect with semi-transparent cards. Modern and elegant for premium
|
|
|
119
119
|
Use hardcoded data directly in your component:
|
|
120
120
|
|
|
121
121
|
```jsx
|
|
122
|
-
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
123
|
-
import 'awesome-ring-carousel/dist/style.css';
|
|
124
|
-
|
|
125
|
-
export default function StaticDataExample() {
|
|
126
|
-
const staticSlides = [
|
|
122
|
+
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
123
|
+
import 'awesome-ring-carousel/dist/style.css';
|
|
124
|
+
|
|
125
|
+
export default function StaticDataExample() {
|
|
126
|
+
const staticSlides = [
|
|
127
127
|
{
|
|
128
128
|
title: 'Product A',
|
|
129
129
|
description: 'Premium quality product',
|
|
@@ -174,14 +174,14 @@ export default function StaticDataExample() {
|
|
|
174
174
|
Load carousel data from a JSON file:
|
|
175
175
|
|
|
176
176
|
```jsx
|
|
177
|
-
import { useEffect, useState } from 'react';
|
|
178
|
-
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
179
|
-
import 'awesome-ring-carousel/dist/style.css';
|
|
180
|
-
|
|
181
|
-
export default function JSONDataExample() {
|
|
182
|
-
const [slides, setSlides] = useState([]);
|
|
183
|
-
const [loading, setLoading] = useState(true);
|
|
184
|
-
const [error, setError] = useState(null);
|
|
177
|
+
import { useEffect, useState } from 'react';
|
|
178
|
+
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
179
|
+
import 'awesome-ring-carousel/dist/style.css';
|
|
180
|
+
|
|
181
|
+
export default function JSONDataExample() {
|
|
182
|
+
const [slides, setSlides] = useState([]);
|
|
183
|
+
const [loading, setLoading] = useState(true);
|
|
184
|
+
const [error, setError] = useState(null);
|
|
185
185
|
|
|
186
186
|
useEffect(() => {
|
|
187
187
|
// Load slides from JSON file in public folder
|
|
@@ -190,10 +190,10 @@ export default function JSONDataExample() {
|
|
|
190
190
|
if (!response.ok) throw new Error('Failed to load data');
|
|
191
191
|
return response.json();
|
|
192
192
|
})
|
|
193
|
-
.then((data) => {
|
|
194
|
-
setSlides(data);
|
|
195
|
-
setLoading(false);
|
|
196
|
-
})
|
|
193
|
+
.then((data) => {
|
|
194
|
+
setSlides(data);
|
|
195
|
+
setLoading(false);
|
|
196
|
+
})
|
|
197
197
|
.catch((err) => {
|
|
198
198
|
setError(err.message);
|
|
199
199
|
setLoading(false);
|
|
@@ -260,15 +260,15 @@ export default function JSONDataExample() {
|
|
|
260
260
|
Fetch carousel data from a REST API:
|
|
261
261
|
|
|
262
262
|
```jsx
|
|
263
|
-
import { useEffect, useState } from 'react';
|
|
264
|
-
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
265
|
-
import 'awesome-ring-carousel/dist/style.css';
|
|
266
|
-
|
|
267
|
-
export default function RESTAPIExample() {
|
|
268
|
-
const [slides, setSlides] = useState([]);
|
|
269
|
-
const [loading, setLoading] = useState(true);
|
|
270
|
-
const [error, setError] = useState(null);
|
|
271
|
-
const [focusedItem, setFocusedItem] = useState(null);
|
|
263
|
+
import { useEffect, useState } from 'react';
|
|
264
|
+
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
265
|
+
import 'awesome-ring-carousel/dist/style.css';
|
|
266
|
+
|
|
267
|
+
export default function RESTAPIExample() {
|
|
268
|
+
const [slides, setSlides] = useState([]);
|
|
269
|
+
const [loading, setLoading] = useState(true);
|
|
270
|
+
const [error, setError] = useState(null);
|
|
271
|
+
const [focusedItem, setFocusedItem] = useState(null);
|
|
272
272
|
|
|
273
273
|
useEffect(() => {
|
|
274
274
|
// Fetch from a REST API endpoint
|
|
@@ -279,10 +279,10 @@ export default function RESTAPIExample() {
|
|
|
279
279
|
})
|
|
280
280
|
.then((data) => {
|
|
281
281
|
// Transform API response to match SlideData format
|
|
282
|
-
const transformedData = data.map((item) => ({
|
|
283
|
-
title: item.name || item.title,
|
|
284
|
-
description: item.summary || item.description,
|
|
285
|
-
image: item.thumbnail || item.image,
|
|
282
|
+
const transformedData = data.map((item) => ({
|
|
283
|
+
title: item.name || item.title,
|
|
284
|
+
description: item.summary || item.description,
|
|
285
|
+
image: item.thumbnail || item.image,
|
|
286
286
|
tag: item.category || item.type,
|
|
287
287
|
color: item.accentColor,
|
|
288
288
|
onClick: () => console.log(`Clicked: ${item.id}`)
|
|
@@ -296,10 +296,10 @@ export default function RESTAPIExample() {
|
|
|
296
296
|
});
|
|
297
297
|
}, []);
|
|
298
298
|
|
|
299
|
-
const handleFocusChange = (index) => {
|
|
300
|
-
setFocusedItem(slides[index] || null);
|
|
301
|
-
console.log(`Focused on: ${slides[index]?.title}`);
|
|
302
|
-
};
|
|
299
|
+
const handleFocusChange = (index) => {
|
|
300
|
+
setFocusedItem(slides[index] || null);
|
|
301
|
+
console.log(`Focused on: ${slides[index]?.title}`);
|
|
302
|
+
};
|
|
303
303
|
|
|
304
304
|
if (loading) {
|
|
305
305
|
return (
|
|
@@ -398,18 +398,18 @@ export default function CustomizedCarousel() {
|
|
|
398
398
|
### Controlled Carousel with External Controls
|
|
399
399
|
|
|
400
400
|
```jsx
|
|
401
|
-
import { useRef, useState } from 'react';
|
|
402
|
-
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
403
|
-
import 'awesome-ring-carousel/dist/style.css';
|
|
404
|
-
|
|
405
|
-
export default function ControlledCarousel() {
|
|
406
|
-
const carouselRef = useRef(null);
|
|
407
|
-
const [focusedIndex, setFocusedIndex] = useState(0);
|
|
408
|
-
|
|
409
|
-
const slides = [
|
|
410
|
-
{ title: 'Slide 1', description: 'First', image: 'url1.jpg' },
|
|
411
|
-
{ title: 'Slide 2', description: 'Second', image: 'url2.jpg' },
|
|
412
|
-
{ title: 'Slide 3', description: 'Third', image: 'url3.jpg' },
|
|
401
|
+
import { useRef, useState } from 'react';
|
|
402
|
+
import { AwesomeRingCarousel } from 'awesome-ring-carousel';
|
|
403
|
+
import 'awesome-ring-carousel/dist/style.css';
|
|
404
|
+
|
|
405
|
+
export default function ControlledCarousel() {
|
|
406
|
+
const carouselRef = useRef(null);
|
|
407
|
+
const [focusedIndex, setFocusedIndex] = useState(0);
|
|
408
|
+
|
|
409
|
+
const slides = [
|
|
410
|
+
{ title: 'Slide 1', description: 'First', image: 'url1.jpg' },
|
|
411
|
+
{ title: 'Slide 2', description: 'Second', image: 'url2.jpg' },
|
|
412
|
+
{ title: 'Slide 3', description: 'Third', image: 'url3.jpg' },
|
|
413
413
|
];
|
|
414
414
|
|
|
415
415
|
return (
|
|
@@ -552,4 +552,4 @@ Custom CSS class applied to the carousel container for additional customization.
|
|
|
552
552
|
### Performance issues on mobile
|
|
553
553
|
- Reduce the number of images or use smaller dimensions
|
|
554
554
|
- Set `autoRotate={false}` if performance is critical
|
|
555
|
-
- Use optimized/compressed images
|
|
555
|
+
- Use optimized/compressed images
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "awesome-ring-carousel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A beautiful, interactive 3D ring carousel component for React with smooth animations, multiple themes, and flexible data handling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/index.
|
|
7
|
+
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
|
-
"import": "./dist/index.
|
|
16
|
-
"require": "./dist/index.
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.umd.cjs"
|
|
17
17
|
},
|
|
18
18
|
"./dist/style.css": "./dist/style.css"
|
|
19
19
|
},
|