@ebay/ui-core-react
Version:
Skin components build off React
29 lines • 1.75 kB
TypeScript
import React from "react";
import { ReactElement, ReactNode, RefObject } from "react";
import { ListItemRef, MovementDirection, RelativeRect } from "./types";
export declare function getRelativeRects(el: Element): RelativeRect;
export declare const isNativeScrolling: (el: Element) => boolean;
export declare const getMaxOffset: (items: ListItemRef[], slideWidth: number) => number;
export declare const getOffset: (items: ListItemRef[], index: number, slideWidth: number) => number;
export declare const alterChildren: (children: ReactNode, itemsRef: RefObject<Array<ListItemRef | null>>, itemsPerSlide?: number, slideWidth?: number, offset?: number, gap?: number) => ReactElement[];
/**
* Gets the slide for a given index.
* Defaults to the current index if none provided.
*/
export declare const getSlide: (activeIndex: number, itemsPerSlide?: number, nextIndex?: number) => undefined | number;
export declare const getNextIndex: (direction: MovementDirection, activeIndex: number, items?: ListItemRef[], slideWidth?: number, itemsPerSlide?: number) => number;
export declare const getClosestIndex: (scrollLeft: number, items: ListItemRef[], slideWidth: number, itemsPerSlide?: number, gap?: number) => number;
/**
* This function will animate the carousel to loop back to the first slide and vice versa
*/
export declare function animateCarouselLoop({ direction, nextIndex, currentIndex, itemsRef, slideWidth, gap, onAnimationStart, onAnimationEnd, }: {
direction: "RIGHT" | "LEFT";
nextIndex: number;
currentIndex: number;
itemsRef: React.MutableRefObject<ListItemRef[]>;
slideWidth: number;
gap: number;
onAnimationStart: () => void;
onAnimationEnd: () => void;
}): void;
//# sourceMappingURL=helpers.d.ts.map