import React, { forwardRef } from "react";
import { useForkRef } from "../../../hooks";
import { base, CarouselWrapper, CarouselTrack } from "./Carousel.styles";
import { useCarousel } from "./useCarousel";
import { useDragScroll } from "./useDragScroll";
/**
 * Компонент для создания списков с прокруткой.
 */ export const carouselRoot = (Root)=>/*#__PURE__*/ forwardRef(({ index = 0, scrollSnapType = 'mandatory', scrollAlign, detectActive, detectThreshold, scaleCallback, scaleResetCallback, onIndexChange, paddingStart, paddingEnd, children, ariaLive = 'off', isDragScrollDisabled = false, ...rest }, ref)=>{
        const axis = 'x';
        const { scrollRef, trackRef } = useCarousel({
            index,
            axis,
            scrollAlign,
            detectActive,
            detectThreshold,
            scaleCallback,
            scaleResetCallback,
            onIndexChange
        });
        const handleRef = useForkRef(scrollRef, ref);
        useDragScroll(scrollRef, isDragScrollDisabled);
        return /*#__PURE__*/ React.createElement(Root, {
            index: index
        }, /*#__PURE__*/ React.createElement(CarouselWrapper, {
            ref: handleRef,
            scrollSnapType: scrollSnapType,
            ...rest
        }, /*#__PURE__*/ React.createElement(CarouselTrack, {
            ref: trackRef,
            paddingStart: paddingStart,
            paddingEnd: paddingEnd,
            "aria-live": ariaLive
        }, children)));
    });
export const carouselConfig = {
    name: 'Carousel',
    tag: 'div',
    layout: carouselRoot,
    base,
    variations: {},
    defaults: {}
};
