nuka-carousel
Advanced tools
Comparing version 5.0.5 to 5.0.6
@@ -92,3 +92,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
var nextSlide = function nextSlide() { | ||
if (props.wrapAround || currentSlide <= count) { | ||
if (props.wrapAround || currentSlide < count - props.slidesToScroll) { | ||
moveSlide(currentSlide + slidesToScroll); | ||
@@ -242,5 +242,6 @@ } else { | ||
var handleDragEnd = function handleDragEnd() { | ||
var handleDragEnd = function handleDragEnd(e) { | ||
if (!props.dragging || !dragging) return; | ||
setDragging(false); | ||
props.onDragEnd(e); | ||
@@ -264,3 +265,3 @@ if (Math.abs(move) <= dragThreshold) { | ||
var onTouchStart = function onTouchStart() { | ||
var onTouchStart = function onTouchStart(e) { | ||
if (!props.swiping) { | ||
@@ -271,2 +272,3 @@ return; | ||
setDragging(true); | ||
props.onDragStart(e); | ||
}; | ||
@@ -307,6 +309,7 @@ | ||
if (!props.dragging) return; | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
carouselRef === null || carouselRef === void 0 ? void 0 : (_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 ? void 0 : _carouselRef$current.focus(); | ||
if (!props.dragging) return; | ||
setDragging(true); | ||
props.onDragStart(e); | ||
}; | ||
@@ -318,3 +321,3 @@ | ||
if (!props.dragging || !dragging) return; | ||
props.onDragStart(e); | ||
props.onDrag(e); | ||
var offsetX = e.clientX - (((_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 ? void 0 : _carouselRef$current2.getBoundingClientRect().left) || 0); | ||
@@ -327,3 +330,3 @@ var moveValue = ((carouselWidth === null || carouselWidth === void 0 ? void 0 : carouselWidth.current) || 0) - offsetX; | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
handleDragEnd(); | ||
handleDragEnd(e); | ||
}; | ||
@@ -372,4 +375,3 @@ | ||
style: { | ||
position: 'relative', | ||
padding: props.withoutControls ? 0 : '0 60px 50px' | ||
position: 'relative' | ||
}, | ||
@@ -392,3 +394,3 @@ onMouseEnter: onMouseEnter, | ||
}, props.style), | ||
"aria-label": "carousel-slider", | ||
"aria-label": props.frameAriaLabel, | ||
role: "region", | ||
@@ -395,0 +397,0 @@ tabIndex: 0, |
@@ -23,2 +23,3 @@ import React from 'react'; | ||
enableKeyboardControls: false, | ||
frameAriaLabel: 'carousel-slider', | ||
getControlsContainerStyles: function getControlsContainerStyles() { | ||
@@ -36,2 +37,6 @@ return {}; | ||
}, | ||
onDrag: function onDrag() {// do nothing | ||
}, | ||
onDragEnd: function onDragEnd() {// do nothing | ||
}, | ||
pauseOnHover: true, | ||
@@ -38,0 +43,0 @@ renderAnnounceSlideMessage: defaultRenderAnnounceSlideMessage, |
@@ -85,3 +85,3 @@ import React, { useRef, useEffect } from 'react'; | ||
ref: slideRef, | ||
className: "slide ".concat(typeOfSlide || '', " ").concat(isVisible ? 'slide-visible' : ''), | ||
className: "slide".concat(typeOfSlide ? " ".concat(typeOfSlide) : '').concat(isVisible ? ' slide-visible' : ''), | ||
style: getSlideStyles(count, isCurrentSlide, isVisible, wrapAround, cellSpacing, animation, speed, zoomScale) | ||
@@ -88,0 +88,0 @@ }, children); |
@@ -113,3 +113,3 @@ "use strict"; | ||
var nextSlide = function nextSlide() { | ||
if (props.wrapAround || currentSlide <= count) { | ||
if (props.wrapAround || currentSlide < count - props.slidesToScroll) { | ||
moveSlide(currentSlide + slidesToScroll); | ||
@@ -263,5 +263,6 @@ } else { | ||
var handleDragEnd = function handleDragEnd() { | ||
var handleDragEnd = function handleDragEnd(e) { | ||
if (!props.dragging || !dragging) return; | ||
setDragging(false); | ||
props.onDragEnd(e); | ||
@@ -285,3 +286,3 @@ if (Math.abs(move) <= dragThreshold) { | ||
var onTouchStart = function onTouchStart() { | ||
var onTouchStart = function onTouchStart(e) { | ||
if (!props.swiping) { | ||
@@ -292,2 +293,3 @@ return; | ||
setDragging(true); | ||
props.onDragStart(e); | ||
}; | ||
@@ -328,6 +330,7 @@ | ||
if (!props.dragging) return; | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
carouselRef === null || carouselRef === void 0 ? void 0 : (_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 ? void 0 : _carouselRef$current.focus(); | ||
if (!props.dragging) return; | ||
setDragging(true); | ||
props.onDragStart(e); | ||
}; | ||
@@ -339,3 +342,3 @@ | ||
if (!props.dragging || !dragging) return; | ||
props.onDragStart(e); | ||
props.onDrag(e); | ||
var offsetX = e.clientX - (((_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 ? void 0 : _carouselRef$current2.getBoundingClientRect().left) || 0); | ||
@@ -348,3 +351,3 @@ var moveValue = ((carouselWidth === null || carouselWidth === void 0 ? void 0 : carouselWidth.current) || 0) - offsetX; | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
handleDragEnd(); | ||
handleDragEnd(e); | ||
}; | ||
@@ -394,4 +397,3 @@ | ||
style: { | ||
position: 'relative', | ||
padding: props.withoutControls ? 0 : '0 60px 50px' | ||
position: 'relative' | ||
}, | ||
@@ -414,3 +416,3 @@ onMouseEnter: onMouseEnter, | ||
}, props.style), | ||
"aria-label": "carousel-slider", | ||
"aria-label": props.frameAriaLabel, | ||
role: "region", | ||
@@ -417,0 +419,0 @@ tabIndex: 0, |
@@ -36,2 +36,3 @@ "use strict"; | ||
enableKeyboardControls: false, | ||
frameAriaLabel: 'carousel-slider', | ||
getControlsContainerStyles: function getControlsContainerStyles() { | ||
@@ -49,2 +50,6 @@ return {}; | ||
}, | ||
onDrag: function onDrag() {// do nothing | ||
}, | ||
onDragEnd: function onDragEnd() {// do nothing | ||
}, | ||
pauseOnHover: true, | ||
@@ -51,0 +56,0 @@ renderAnnounceSlideMessage: _announceSlide.defaultRenderAnnounceSlideMessage, |
@@ -99,3 +99,3 @@ "use strict"; | ||
ref: slideRef, | ||
className: "slide ".concat(typeOfSlide || '', " ").concat(isVisible ? 'slide-visible' : ''), | ||
className: "slide".concat(typeOfSlide ? " ".concat(typeOfSlide) : '').concat(isVisible ? ' slide-visible' : ''), | ||
style: getSlideStyles(count, isCurrentSlide, isVisible, wrapAround, cellSpacing, animation, speed, zoomScale) | ||
@@ -102,0 +102,0 @@ }, children); |
{ | ||
"name": "nuka-carousel", | ||
"version": "5.0.5", | ||
"version": "5.0.6", | ||
"description": "Pure React Carousel", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,3 @@ [![Maintenance Status][maintenance-image]](#maintenance-status) | ||
> :warning: nuka-carousel v5 beta is published and you can install it like this `npm install nuka-carousel@5.0.5`. Please check the [v5 documentation](https://github.com/FormidableLabs/nuka-carousel/tree/main/src-v5) for more details. | ||
> :warning: nuka-carousel v5 beta is published and you can install it like this `npm install nuka-carousel@5.0.6`. Please check the [v5 documentation](https://github.com/FormidableLabs/nuka-carousel/tree/main/src-v5) for more details. | ||
@@ -296,1 +296,2 @@ A Pure ReactJS Carousel Component | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154443
2574
296