overlapping-cards-scroll 0.1.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/LICENSE +21 -0
- package/README.md +119 -0
- package/dist/index.cjs +716 -0
- package/dist/index.js +704 -0
- package/dist/react-native-web.cjs +762 -0
- package/dist/react-native-web.js +752 -0
- package/dist/react-native.cjs +488 -0
- package/dist/react-native.js +477 -0
- package/dist/styles.css +191 -0
- package/dist/types/lib/OverlappingCardsScroll.d.ts +79 -0
- package/dist/types/lib/index.d.ts +2 -0
- package/dist/types/rn/OverlappingCardsScrollRN.native.d.ts +26 -0
- package/dist/types/rn/OverlappingCardsScrollRN.web.d.ts +18 -0
- package/package.json +117 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brian Ephraim
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# overlapping-cards-scroll
|
|
2
|
+
|
|
3
|
+
Reusable overlapping-cards scroll component for React, React Native, and React Native Web.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install overlapping-cards-scroll
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies:
|
|
12
|
+
|
|
13
|
+
- `react` `^18 || ^19`
|
|
14
|
+
- `react-dom` `^18 || ^19` (optional)
|
|
15
|
+
- `react-native` `>=0.73` (optional)
|
|
16
|
+
- `react-native-web` `>=0.19` (optional)
|
|
17
|
+
|
|
18
|
+
## Web Usage
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import 'overlapping-cards-scroll/styles.css'
|
|
22
|
+
import {
|
|
23
|
+
OverlappingCardsScroll,
|
|
24
|
+
OverlappingCardsScrollFocusTrigger,
|
|
25
|
+
} from 'overlapping-cards-scroll'
|
|
26
|
+
|
|
27
|
+
export function Example({ cards }) {
|
|
28
|
+
return (
|
|
29
|
+
<OverlappingCardsScroll cardHeight={280} showPageDots pageDotsPosition="below">
|
|
30
|
+
{cards.map((card) => (
|
|
31
|
+
<article key={card.id}>
|
|
32
|
+
<h3>{card.title}</h3>
|
|
33
|
+
<OverlappingCardsScrollFocusTrigger>
|
|
34
|
+
Make principal
|
|
35
|
+
</OverlappingCardsScrollFocusTrigger>
|
|
36
|
+
</article>
|
|
37
|
+
))}
|
|
38
|
+
</OverlappingCardsScroll>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## React Native Usage
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import {
|
|
47
|
+
OverlappingCardsScrollRN,
|
|
48
|
+
OverlappingCardsScrollRNFocusTrigger,
|
|
49
|
+
} from 'overlapping-cards-scroll/react-native'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`/react-native` resolves to:
|
|
53
|
+
|
|
54
|
+
- native build for React Native runtimes
|
|
55
|
+
- web adapter build for non-native runtimes
|
|
56
|
+
|
|
57
|
+
You can also target explicit builds:
|
|
58
|
+
|
|
59
|
+
- `overlapping-cards-scroll/react-native/native`
|
|
60
|
+
- `overlapping-cards-scroll/react-native/web`
|
|
61
|
+
|
|
62
|
+
For web adapter usage, import package styles:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import 'overlapping-cards-scroll/styles.css'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Props
|
|
69
|
+
|
|
70
|
+
- `children`: card nodes
|
|
71
|
+
- `cardHeight` (`number | string`, default `300`)
|
|
72
|
+
- `cardWidth` (`number | string`) accepts px number (e.g. `250`) or percent string (e.g. `'50%'`)
|
|
73
|
+
- `cardWidthRatio` (`number`, default `1 / 3`)
|
|
74
|
+
- `basePeek` (`number`, default `64`)
|
|
75
|
+
- `minPeek` (`number`, default `10`)
|
|
76
|
+
- `maxPeek` (`number`, default `84`)
|
|
77
|
+
- `showPageDots` (`boolean`, default `false`) renders clickable page dots
|
|
78
|
+
- `pageDotsPosition` (`'above' | 'below' | 'overlay'`, default `'below'`)
|
|
79
|
+
- `pageDotsOffset` (`number | string`, default `10`) distance from stage
|
|
80
|
+
- `pageDotsBehavior` (`'smooth' | 'auto'`, web only, default `'smooth'`)
|
|
81
|
+
- `snapToCardOnRelease` (`boolean`, default `true`) web/RN-web uses idle + mousemove snap, RN native uses `snapToInterval` on iOS
|
|
82
|
+
- `snapReleaseDelay` (`number`, default `800`) web/RN-web debounce before auto-snap
|
|
83
|
+
- `snapDecelerationRate` (`'normal' | 'fast' | number`, RN native only, default `'normal'`) controls fling feel while snapping
|
|
84
|
+
- `snapDisableIntervalMomentum` (`boolean`, RN native only, default `false`) keep `false` for stronger momentum across multiple cards
|
|
85
|
+
- `focusTransitionDuration` (`number`, default `420`) duration for click-triggered "single swoop" focus transitions
|
|
86
|
+
- `className` (`string`)
|
|
87
|
+
- `ariaLabel` (`string`)
|
|
88
|
+
|
|
89
|
+
## Local Development
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm install
|
|
93
|
+
npm run dev
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Vite demos:
|
|
97
|
+
|
|
98
|
+
- `#basic` foundation demo
|
|
99
|
+
- `#content` rich-content demo
|
|
100
|
+
- `#stress` many-card stress demo
|
|
101
|
+
- `#rnweb` React Native Web demo
|
|
102
|
+
|
|
103
|
+
Expo development:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm run dev:expo
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Build package artifacts:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm run build
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Build demo site:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm run build:demo
|
|
119
|
+
```
|