@k8slens/lds-carousel 0.23.0 → 0.24.0
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 +42 -19
- package/llms.txt +68 -0
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @k8slens/lds-carousel
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Carousel component for the Lens Design System – auto-playing slide carousel with dot navigation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @k8slens/lds-carousel @k8slens/lds-tokens
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
5
12
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
```tsx
|
|
14
|
+
import "@k8slens/lds-tokens/lib/electron/font-face.css";
|
|
15
|
+
import "@k8slens/lds/lib/es/index.css";
|
|
16
|
+
import "@k8slens/lds-carousel/lib/es/index.css";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
12
20
|
|
|
13
21
|
```tsx
|
|
14
22
|
import Carousel from "@k8slens/lds-carousel";
|
|
@@ -22,9 +30,12 @@ export const Component = () => (
|
|
|
22
30
|
);
|
|
23
31
|
```
|
|
24
32
|
|
|
25
|
-
### Autoplay
|
|
33
|
+
### Video Autoplay
|
|
34
|
+
|
|
35
|
+
To autoplay a video on the first slide:
|
|
36
|
+
|
|
26
37
|
```tsx
|
|
27
|
-
import Carousel from "@k8slens/lds-carousel";
|
|
38
|
+
import { Carousel } from "@k8slens/lds-carousel";
|
|
28
39
|
|
|
29
40
|
export const Component = () => {
|
|
30
41
|
const videoRef = React.useRef<HTMLVideoElement>(null);
|
|
@@ -34,19 +45,17 @@ export const Component = () => {
|
|
|
34
45
|
|
|
35
46
|
useEffect(() => {
|
|
36
47
|
if (videoRef?.current && playing && !isVideoPlaying) {
|
|
37
|
-
videoRef.current.play().catch(
|
|
38
|
-
console.log(e);
|
|
39
|
-
});
|
|
48
|
+
videoRef.current.play().catch(console.log);
|
|
40
49
|
}
|
|
41
50
|
}, [videoRef, playing, isVideoPlaying]);
|
|
42
51
|
|
|
43
52
|
return (
|
|
44
|
-
<Carousel>
|
|
53
|
+
<Carousel isVideoPlaying={isVideoPlaying} setVideoPlaying={setVideoPlaying}>
|
|
45
54
|
<video
|
|
46
|
-
key="video-1" // Key
|
|
55
|
+
key="video-1" // Key must include "video"
|
|
47
56
|
ref={videoRef}
|
|
48
57
|
autoPlay={playing}
|
|
49
|
-
src="
|
|
58
|
+
src="video.mp4"
|
|
50
59
|
muted // Mute video to avoid autoplay issues
|
|
51
60
|
onPlay={() => setIsVideoPlaying(true)}
|
|
52
61
|
onPause={() => setIsVideoPlaying(false)}
|
|
@@ -57,5 +66,19 @@ export const Component = () => {
|
|
|
57
66
|
<img src="src" alt="Alt text" />
|
|
58
67
|
</Carousel>
|
|
59
68
|
);
|
|
60
|
-
}
|
|
61
|
-
```
|
|
69
|
+
};
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Browse examples at [lens-design-system.k8slens.dev](https://lens-design-system.k8slens.dev/?path=/docs/carousel).
|
|
75
|
+
|
|
76
|
+
## AI Assistance
|
|
77
|
+
|
|
78
|
+
This package includes an `llms.txt` file with API documentation optimized for LLMs. Add to your project's AI configuration (e.g., `AGENTS.md` or `CLAUDE.md`):
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
Read node_modules/@k8slens/lds-carousel/llms.txt for carousel API reference.
|
|
82
|
+
|
|
83
|
+
Use the LDS Carousel component instead of custom implementations.
|
|
84
|
+
```
|
package/llms.txt
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @k8slens/lds-carousel
|
|
2
|
+
|
|
3
|
+
> Carousel component for the Lens Design System - auto-playing slide carousel with dot navigation.
|
|
4
|
+
|
|
5
|
+
Built on Embla Carousel with autoplay support.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @k8slens/lds-carousel @k8slens/lds-tokens
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Peer Dependencies
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install react react-dom clsx
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
Import required styles in your app entry point:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import "@k8slens/lds-tokens/lib/electron/font-face.css";
|
|
25
|
+
import "@k8slens/lds/lib/es/index.css";
|
|
26
|
+
import "@k8slens/lds-carousel/lib/es/index.css";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Carousel } from "@k8slens/lds-carousel";
|
|
33
|
+
|
|
34
|
+
<Carousel>
|
|
35
|
+
<div>Slide 1</div>
|
|
36
|
+
<div>Slide 2</div>
|
|
37
|
+
<div>Slide 3</div>
|
|
38
|
+
</Carousel>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
| Prop | Type | Description |
|
|
44
|
+
|------|------|-------------|
|
|
45
|
+
| `isVideoPlaying` | `boolean` | Control video autoplay state |
|
|
46
|
+
| `setVideoPlaying` | `(playing: boolean) => void` | Callback for video state changes |
|
|
47
|
+
| `className` | `string` | Additional CSS classes |
|
|
48
|
+
| `children` | `ReactNode` | Slide content |
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- Auto-advances every 8 seconds
|
|
53
|
+
- Loop navigation
|
|
54
|
+
- Dot indicators
|
|
55
|
+
- Stops on user interaction
|
|
56
|
+
- Video autoplay integration
|
|
57
|
+
|
|
58
|
+
## Dependencies
|
|
59
|
+
|
|
60
|
+
This package depends on `@k8slens/lds` core components and Embla Carousel.
|
|
61
|
+
|
|
62
|
+
## Documentation
|
|
63
|
+
|
|
64
|
+
- [Lens Design System](https://lens-design-system.k8slens.dev/)
|
|
65
|
+
|
|
66
|
+
## Optional
|
|
67
|
+
|
|
68
|
+
- [npm Package](https://www.npmjs.com/package/@k8slens/lds-carousel)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k8slens/lds-carousel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Lens Design System – React Carousel component",
|
|
5
5
|
"author": "Mirantis Inc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"types": "./lib/es/index.d.ts",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"files": [
|
|
18
|
-
"lib/"
|
|
18
|
+
"lib/",
|
|
19
|
+
"llms.txt"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
22
|
"start": "npm run rollup-watch",
|
|
@@ -23,16 +24,16 @@
|
|
|
23
24
|
"rollup-watch": "rollup -c --watch --waitForBundleInput",
|
|
24
25
|
"rollup": "rollup -c",
|
|
25
26
|
"clean": "rimraf lib",
|
|
26
|
-
"lint": "
|
|
27
|
-
"format": "
|
|
27
|
+
"lint": "oxlint .",
|
|
28
|
+
"format": "oxlint --fix . && prettier --write ."
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@k8slens/lds": "^0.
|
|
31
|
+
"@k8slens/lds": "^0.58.0",
|
|
31
32
|
"embla-carousel-autoplay": "8.0.0-rc11",
|
|
32
33
|
"embla-carousel-react": "8.0.0-rc11"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@k8slens/lds-tokens": "^0.
|
|
36
|
+
"@k8slens/lds-tokens": "^0.59.0",
|
|
36
37
|
"@rollup/plugin-node-resolve": "15.0.2",
|
|
37
38
|
"@storybook/react": "6.5.16",
|
|
38
39
|
"@testing-library/react": "14.0.0",
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
"\\.svg": "<rootDir>/../../__mocks__/SVGStub.js"
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "e41693e45edd36a94e34ab286d4ededba24f5daf"
|
|
59
60
|
}
|