react-instantsearch
Version:
⚡ Lightning-fast search for React, by Algolia
29 lines (25 loc) • 1.24 kB
JavaScript
;
var _object_spread = require('@swc/helpers/_/_object_spread');
var _sliced_to_array = require('@swc/helpers/_/_sliced_to_array');
var instantsearchUiComponents = require('instantsearch-ui-components');
var React = require('react');
var CarouselUiComponent = instantsearchUiComponents.createCarouselComponent({
createElement: React.createElement,
Fragment: React.Fragment
});
function Carousel(props) {
var _useState = _sliced_to_array._(React.useState(false), 2), canScrollLeft = _useState[0], setCanScrollLeft = _useState[1];
var _useState1 = _sliced_to_array._(React.useState(true), 2), canScrollRight = _useState1[0], setCanScrollRight = _useState1[1];
var carouselRefs = {
listRef: React.useRef(null),
nextButtonRef: React.useRef(null),
previousButtonRef: React.useRef(null),
carouselIdRef: React.useRef(instantsearchUiComponents.generateCarouselId()),
canScrollLeft: canScrollLeft,
canScrollRight: canScrollRight,
setCanScrollLeft: setCanScrollLeft,
setCanScrollRight: setCanScrollRight
};
return /*#__PURE__*/ React.createElement(CarouselUiComponent, _object_spread._({}, carouselRefs, props));
}
exports.Carousel = Carousel;