Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuka-carousel

Package Overview
Dependencies
Maintainers
25
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuka-carousel - npm Package Compare versions

Comparing version 5.0.6 to 5.0.7

25

es-v5/carousel.js

@@ -20,3 +20,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; }

/* eslint-disable complexity */
import React, { useEffect, useState, useRef } from 'react';
import React, { useEffect, useState, useRef, useCallback } from 'react';
import Slide from './slide';

@@ -75,10 +75,23 @@ import { getSliderListStyles } from './slider-list';

var carouselRef = props.innerRef || carouselEl;
var getNextIndex = useCallback(function (to) {
var index = to !== null && to !== void 0 ? to : currentSlide;
if (index < 0) {
return index + count;
}
if (index === count) {
return 0;
}
return index;
}, [count, currentSlide]);
var moveSlide = function moveSlide(to) {
var _getIndexes = getIndexes(currentSlide, currentSlide - slidesToScroll, count),
_getIndexes2 = _slicedToArray(_getIndexes, 2),
slide = _getIndexes2[0],
endSlide = _getIndexes2[1];
_getIndexes2 = _slicedToArray(_getIndexes, 1),
slide = _getIndexes2[0];
to && props.beforeSlide(slide, endSlide);
var nextIndex = getNextIndex(to);
typeof to === 'number' && props.beforeSlide(slide, nextIndex);
!props.disableAnimation && setAnimation(true);

@@ -88,3 +101,3 @@ setCurrentSlide(to !== null && to !== void 0 ? to : currentSlide);

if (!isMounted.current) return;
to && props.afterSlide(currentSlide);
typeof to === 'number' && props.afterSlide(nextIndex);
!props.disableAnimation && setAnimation(false);

@@ -91,0 +104,0 @@ }, !props.disableAnimation ? props.speed || 500 : 40); // if animation is disabled decrease the speed to 40

@@ -95,10 +95,23 @@ "use strict";

var carouselRef = props.innerRef || carouselEl;
var getNextIndex = (0, _react.useCallback)(function (to) {
var index = to !== null && to !== void 0 ? to : currentSlide;
if (index < 0) {
return index + count;
}
if (index === count) {
return 0;
}
return index;
}, [count, currentSlide]);
var moveSlide = function moveSlide(to) {
var _getIndexes = (0, _utils.getIndexes)(currentSlide, currentSlide - slidesToScroll, count),
_getIndexes2 = _slicedToArray(_getIndexes, 2),
slide = _getIndexes2[0],
endSlide = _getIndexes2[1];
_getIndexes2 = _slicedToArray(_getIndexes, 1),
slide = _getIndexes2[0];
to && props.beforeSlide(slide, endSlide);
var nextIndex = getNextIndex(to);
typeof to === 'number' && props.beforeSlide(slide, nextIndex);
!props.disableAnimation && setAnimation(true);

@@ -108,3 +121,3 @@ setCurrentSlide(to !== null && to !== void 0 ? to : currentSlide);

if (!isMounted.current) return;
to && props.afterSlide(currentSlide);
typeof to === 'number' && props.afterSlide(nextIndex);
!props.disableAnimation && setAnimation(false);

@@ -111,0 +124,0 @@ }, !props.disableAnimation ? props.speed || 500 : 40); // if animation is disabled decrease the speed to 40

{
"name": "nuka-carousel",
"version": "5.0.6",
"version": "5.0.7",
"description": "Pure React Carousel",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc