All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.3.1 - 2023-02-14
options.initialPages
to allow SSR to render pages when known up front (e.g. there is only 1 item per page).
0.3.0 - 2023-02-14
- Support for scroll padding & scroll margin #3
0.2.0 - 2023-02-02
-
Snap point CSS declarations (
scroll-snap-align: start
) are no longer applied automatically. This means by default, a carousel will not snap to a page. #6-
Instead a
Set
of item indexes calledsnapPointIndexes
is provided to allow carousels to render snap points themselves. This change was necessary to ensure DOM updates are only performed by React.const Carousel = () => { const { scrollRef } = useSnapCarousel(); return ( <ul ref={scrollRef}> {Array.from({ length: 16 }).map((item) => ( <li>{item}</li> ))} </ul> ); };
const Carousel = () => { const { scrollRef, snapPointIndexes } = useSnapCarousel(); return ( <ul ref={scrollRef}> {Array.from({ length: 16 }).map((item, i) => ( <li style={{ scrollSnapAlign: snapPointIndexes.has(i) ? 'start' : '' }} > {item} </li> ))} </ul> ); };
-
options.snapPointClassName
has been removed as it's no longer needed.
0.1.0 - 2023-01-13
- Refactor pages algorithm, ensuring pages are correctly calculated. #1
0.0.3 - 2022-12-20
- Support for vertical axis carousels
0.0.2 - 2022-12-19
- Debug code
0.0.1 - 2022-12-19
- Initial implementation ported from internal project