Socket
Socket
Sign inDemoInstall

react-touch-drag-slider

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-touch-drag-slider - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

96

dist/lib.es.js
import We, { useRef as $, useState as lr, useCallback as Fe, useEffect as $e, useLayoutEffect as dr } from "react";
var Ne = { exports: {} }, V = {};
var Ye = { exports: {} }, V = {};
/**

@@ -132,3 +132,3 @@ * @license React

Ee.__reactDisabledLog = !0;
function Ye() {
function Ne() {
{

@@ -192,3 +192,3 @@ if (M === 0) {

var te = R.ReactCurrentDispatcher, ne;
function X(e, r, t) {
function H(e, r, t) {
{

@@ -206,6 +206,6 @@ if (ne === void 0)

}
var ae = !1, K;
var ae = !1, X;
{
var Ue = typeof WeakMap == "function" ? WeakMap : Map;
K = new Ue();
X = new Ue();
}

@@ -216,3 +216,3 @@ function be(e, r) {

{
var t = K.get(e);
var t = X.get(e);
if (t !== void 0)

@@ -226,3 +226,3 @@ return t;

var u;
u = te.current, te.current = null, Ye();
u = te.current, te.current = null, Ne();
try {

@@ -273,3 +273,3 @@ if (r) {

` + a[c].replace(" at new ", " at ");
return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && K.set(e, O), O;
return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && X.set(e, O), O;
}

@@ -283,4 +283,4 @@ while (c >= 1 && f >= 0);

}
var N = e ? e.displayName || e.name : "", Ae = N ? X(N) : "";
return typeof e == "function" && K.set(e, Ae), Ae;
var Y = e ? e.displayName || e.name : "", Ae = Y ? H(Y) : "";
return typeof e == "function" && X.set(e, Ae), Ae;
}

@@ -294,3 +294,3 @@ function Ve(e, r, t) {

}
function H(e, r, t) {
function K(e, r, t) {
if (e == null)

@@ -301,8 +301,8 @@ return "";

if (typeof e == "string")
return X(e);
return H(e);
switch (e) {
case T:
return X("Suspense");
return H("Suspense");
case h:
return X("SuspenseList");
return H("SuspenseList");
}

@@ -314,7 +314,7 @@ if (typeof e == "object")

case E:
return H(e.type, r, t);
return K(e.type, r, t);
case C: {
var n = e, o = n._payload, u = n._init;
try {
return H(u(o), r, t);
return K(u(o), r, t);
} catch {

@@ -329,3 +329,3 @@ }

if (e) {
var r = e._owner, t = H(e.type, e._source, r ? r.type : null);
var r = e._owner, t = K(e.type, e._source, r ? r.type : null);
_e.setExtraStackFrame(t);

@@ -378,3 +378,3 @@ } else

}
var U = R.ReactCurrentOwner, Xe = {
var U = R.ReactCurrentOwner, He = {
key: !0,

@@ -386,3 +386,3 @@ ref: !0,

oe = {};
function Ke(e) {
function Xe(e) {
if (Z.call(e, "ref")) {

@@ -395,3 +395,3 @@ var r = Object.getOwnPropertyDescriptor(e, "ref").get;

}
function He(e) {
function Ke(e) {
if (Z.call(e, "key")) {

@@ -461,5 +461,5 @@ var r = Object.getOwnPropertyDescriptor(e, "key").get;

var u, i = {}, a = null, b = null;
t !== void 0 && (Pe(t), a = "" + t), He(r) && (Pe(r.key), a = "" + r.key), Ke(r) && (b = r.ref, Ze(r, o));
t !== void 0 && (Pe(t), a = "" + t), Ke(r) && (Pe(r.key), a = "" + r.key), Xe(r) && (b = r.ref, Ze(r, o));
for (u in r)
Z.call(r, u) && !Xe.hasOwnProperty(u) && (i[u] = r[u]);
Z.call(r, u) && !He.hasOwnProperty(u) && (i[u] = r[u]);
if (e && e.defaultProps) {

@@ -480,3 +480,3 @@ var c = e.defaultProps;

if (e) {
var r = e._owner, t = H(e.type, e._source, r ? r.type : null);
var r = e._owner, t = K(e.type, e._source, r ? r.type : null);
Ce.setExtraStackFrame(t);

@@ -613,4 +613,4 @@ } else

if (ie(O)) {
for (var N = 0; N < O.length; N++)
ke(O[N], e);
for (var Y = 0; Y < O.length; Y++)
ke(O[Y], e);
Object.freeze && Object.freeze(O);

@@ -637,4 +637,4 @@ } else

process.env.NODE_ENV === "production" ? p.exports = vr() : p.exports = pr();
})(Ne);
const Y = Ne.exports.jsx;
})(Ye);
const N = Ye.exports.jsx;
function hr({

@@ -651,11 +651,19 @@ child: p,

};
return /* @__PURE__ */ Y("div", {
return /* @__PURE__ */ N("div", {
ref: P,
style: {
width: `${m}px`,
height: `${_}px`
height: `${_}px`,
transition: "transform 0.2s ease-out"
},
className: "rtds-single-slide-styles",
children: /* @__PURE__ */ Y("div", {
className: "slide-inner",
children: /* @__PURE__ */ N("div", {
style: {
padding: "1rem",
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
userSelect: "none"
},
onPointerDown: D,

@@ -740,8 +748,23 @@ onPointerUp: j,

}
return /* @__PURE__ */ Y("div", {
return /* @__PURE__ */ N("div", {
className: "rtds-slider-wrapper",
children: /* @__PURE__ */ Y("div", {
style: {
overflow: "hidden",
width: "100%",
height: "100%",
maxHeight: "100vh"
},
children: /* @__PURE__ */ N("div", {
ref: d,
className: "rtds-slider-styles",
children: p.map((g, x) => /* @__PURE__ */ Y("div", {
style: {
all: "initial",
width: "100%",
height: "100%",
maxHeight: "100vh",
display: "inline-flex",
willChange: "transform, scale",
cursor: "grab"
},
children: p.map((g, x) => /* @__PURE__ */ N("div", {
onPointerDown: ee(x),

@@ -757,3 +780,6 @@ onPointerMove: re,

className: "slide-outer",
children: /* @__PURE__ */ Y(hr, {
style: {
touchAction: "none"
},
children: /* @__PURE__ */ N(hr, {
child: g,

@@ -760,0 +786,0 @@ sliderWidth: y.width,

@@ -1,2 +0,2 @@

(function(l,J){typeof exports=="object"&&typeof module<"u"?module.exports=J(require("react")):typeof define=="function"&&define.amd?define(["react"],J):(l=typeof globalThis<"u"?globalThis:l||self,l["react-touch-drag-slider"]=J(l.React))})(this,function(l){"use strict";const de=(s=>s&&typeof s=="object"&&"default"in s?s:{default:s})(l),pr="";var ve={exports:{}},U={};/**
(function(l,J){typeof exports=="object"&&typeof module<"u"?module.exports=J(require("react")):typeof define=="function"&&define.amd?define(["react"],J):(l=typeof globalThis<"u"?globalThis:l||self,l["react-touch-drag-slider"]=J(l.React))})(this,function(l){"use strict";const de=(s=>s&&typeof s=="object"&&"default"in s?s:{default:s})(l);var ve={exports:{}},U={};/**
* @license React

@@ -9,3 +9,3 @@ * react-jsx-runtime.production.min.js

* LICENSE file in the root directory of this source tree.
*/var pe;function Ye(){if(pe)return U;pe=1;var s=de.default,m=Symbol.for("react.element"),w=Symbol.for("react.fragment"),T=Object.prototype.hasOwnProperty,P=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,A={key:!0,ref:!0,__self:!0,__source:!0};function k(R,v,O){var g,E={},x=null,c=null;O!==void 0&&(x=""+O),v.key!==void 0&&(x=""+v.key),v.ref!==void 0&&(c=v.ref);for(g in v)T.call(v,g)&&!A.hasOwnProperty(g)&&(E[g]=v[g]);if(R&&R.defaultProps)for(g in v=R.defaultProps,v)E[g]===void 0&&(E[g]=v[g]);return{$$typeof:m,type:R,key:x,ref:c,props:E,_owner:P.current}}return U.Fragment=w,U.jsx=k,U.jsxs=k,U}var V={};/**
*/var pe;function Ne(){if(pe)return U;pe=1;var s=de.default,m=Symbol.for("react.element"),w=Symbol.for("react.fragment"),T=Object.prototype.hasOwnProperty,P=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,A={key:!0,ref:!0,__self:!0,__source:!0};function k(R,v,O){var g,E={},x=null,c=null;O!==void 0&&(x=""+O),v.key!==void 0&&(x=""+v.key),v.ref!==void 0&&(c=v.ref);for(g in v)T.call(v,g)&&!A.hasOwnProperty(g)&&(E[g]=v[g]);if(R&&R.defaultProps)for(g in v=R.defaultProps,v)E[g]===void 0&&(E[g]=v[g]);return{$$typeof:m,type:R,key:x,ref:c,props:E,_owner:P.current}}return U.Fragment=w,U.jsx=k,U.jsxs=k,U}var V={};/**
* @license React

@@ -18,7 +18,7 @@ * react-jsx-runtime.development.js

* LICENSE file in the root directory of this source tree.
*/var he;function Me(){return he||(he=1,process.env.NODE_ENV!=="production"&&function(){var s=de.default,m=Symbol.for("react.element"),w=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),R=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),c=Symbol.for("react.offscreen"),p=Symbol.iterator,G="@@iterator";function D(e){if(e===null||typeof e!="object")return null;var r=p&&e[p]||e[G];return typeof r=="function"?r:null}var _=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];te("error",e,t)}}function te(e,r,t){{var n=_.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",t=t.concat([o]));var u=t.map(function(i){return String(i)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var ne=!1,X=!1,K=!1,H=!1,y=!1,S;S=Symbol.for("react.module.reference");function j(e){return!!(typeof e=="string"||typeof e=="function"||e===T||e===A||y||e===P||e===O||e===g||H||e===c||ne||X||K||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===E||e.$$typeof===k||e.$$typeof===R||e.$$typeof===v||e.$$typeof===S||e.getModuleId!==void 0))}function I(e,r,t){var n=e.displayName;if(n)return n;var o=r.displayName||r.name||"";return o!==""?t+"("+o+")":t}function ge(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case w:return"Portal";case A:return"Profiler";case P:return"StrictMode";case O:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R:var r=e;return ge(r)+".Consumer";case k:var t=e;return ge(t._context)+".Provider";case v:return I(e,e.render,"ForwardRef");case E:var n=e.displayName||null;return n!==null?n:F(e.type)||"Memo";case x:{var o=e,u=o._payload,i=o._init;try{return F(i(u))}catch{return null}}}return null}var W=Object.assign,B=0,ye,me,Re,Ee,be,_e,we;function Te(){}Te.__reactDisabledLog=!0;function Be(){{if(B===0){ye=console.log,me=console.info,Re=console.warn,Ee=console.error,be=console.group,_e=console.groupCollapsed,we=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}B++}}function ze(){{if(B--,B===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:ye}),info:W({},e,{value:me}),warn:W({},e,{value:Re}),error:W({},e,{value:Ee}),group:W({},e,{value:be}),groupCollapsed:W({},e,{value:_e}),groupEnd:W({},e,{value:we})})}B<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=_.ReactCurrentDispatcher,ie;function Z(e,r,t){{if(ie===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);ie=n&&n[1]||""}return`
*/var he;function Me(){return he||(he=1,process.env.NODE_ENV!=="production"&&function(){var s=de.default,m=Symbol.for("react.element"),w=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),R=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),c=Symbol.for("react.offscreen"),p=Symbol.iterator,G="@@iterator";function D(e){if(e===null||typeof e!="object")return null;var r=p&&e[p]||e[G];return typeof r=="function"?r:null}var _=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];te("error",e,t)}}function te(e,r,t){{var n=_.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",t=t.concat([o]));var u=t.map(function(i){return String(i)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var ne=!1,H=!1,X=!1,K=!1,y=!1,S;S=Symbol.for("react.module.reference");function j(e){return!!(typeof e=="string"||typeof e=="function"||e===T||e===A||y||e===P||e===O||e===g||K||e===c||ne||H||X||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===E||e.$$typeof===k||e.$$typeof===R||e.$$typeof===v||e.$$typeof===S||e.getModuleId!==void 0))}function I(e,r,t){var n=e.displayName;if(n)return n;var o=r.displayName||r.name||"";return o!==""?t+"("+o+")":t}function ge(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case w:return"Portal";case A:return"Profiler";case P:return"StrictMode";case O:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R:var r=e;return ge(r)+".Consumer";case k:var t=e;return ge(t._context)+".Provider";case v:return I(e,e.render,"ForwardRef");case E:var n=e.displayName||null;return n!==null?n:F(e.type)||"Memo";case x:{var o=e,u=o._payload,i=o._init;try{return F(i(u))}catch{return null}}}return null}var W=Object.assign,B=0,ye,me,Re,Ee,be,_e,we;function Te(){}Te.__reactDisabledLog=!0;function Be(){{if(B===0){ye=console.log,me=console.info,Re=console.warn,Ee=console.error,be=console.group,_e=console.groupCollapsed,we=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Te,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}B++}}function ze(){{if(B--,B===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:ye}),info:W({},e,{value:me}),warn:W({},e,{value:Re}),error:W({},e,{value:Ee}),group:W({},e,{value:be}),groupCollapsed:W({},e,{value:_e}),groupEnd:W({},e,{value:we})})}B<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=_.ReactCurrentDispatcher,ie;function Z(e,r,t){{if(ie===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);ie=n&&n[1]||""}return`
`+ie+e}}var oe=!1,$;{var Je=typeof WeakMap=="function"?WeakMap:Map;$=new Je}function Pe(e,r){if(!e||oe)return"";{var t=$.get(e);if(t!==void 0)return t}var n;oe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=ae.current,ae.current=null,Be();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(L){n=L}Reflect.construct(e,[],i)}else{try{i.call()}catch(L){n=L}e.call(i.prototype)}}else{try{throw Error()}catch(L){n=L}e()}}catch(L){if(L&&n&&typeof L.stack=="string"){for(var a=L.stack.split(`
`),b=n.stack.split(`
`),f=a.length-1,d=b.length-1;f>=1&&d>=0&&a[f]!==b[d];)d--;for(;f>=1&&d>=0;f--,d--)if(a[f]!==b[d]){if(f!==1||d!==1)do if(f--,d--,d<0||a[f]!==b[d]){var C=`
`+a[f].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&$.set(e,C),C}while(f>=1&&d>=0);break}}}finally{oe=!1,ae.current=u,ze(),Error.prepareStackTrace=o}var M=e?e.displayName||e.name:"",Ne=M?Z(M):"";return typeof e=="function"&&$.set(e,Ne),Ne}function Ge(e,r,t){return Pe(e,!1)}function Xe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Q(e,r,t){if(e==null)return"";if(typeof e=="function")return Pe(e,Xe(e));if(typeof e=="string")return Z(e);switch(e){case O:return Z("Suspense");case g:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Ge(e.render);case E:return Q(e.type,r,t);case x:{var n=e,o=n._payload,u=n._init;try{return Q(u(o),r,t)}catch{}}}return""}var q=Object.prototype.hasOwnProperty,Oe={},Ce=_.ReactDebugCurrentFrame;function ee(e){if(e){var r=e._owner,t=Q(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(t)}else Ce.setExtraStackFrame(null)}function Ke(e,r,t,n,o){{var u=Function.call.bind(q);for(var i in e)if(u(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var b=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(f){a=f}a&&!(a instanceof Error)&&(ee(o),h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),ee(null)),a instanceof Error&&!(a.message in Oe)&&(Oe[a.message]=!0,ee(o),h("Failed %s type: %s",t,a.message),ee(null))}}}var He=Array.isArray;function ue(e){return He(e)}function Ze(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function $e(e){try{return xe(e),!1}catch{return!0}}function xe(e){return""+e}function Se(e){if($e(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ze(e)),xe(e)}var z=_.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},je,ke,se;se={};function qe(e){if(q.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function er(e){if(q.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function rr(e,r){if(typeof e.ref=="string"&&z.current&&r&&z.current.stateNode!==r){var t=F(z.current.type);se[t]||(h('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(z.current.type),e.ref),se[t]=!0)}}function tr(e,r){{var t=function(){je||(je=!0,h("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function nr(e,r){{var t=function(){ke||(ke=!0,h("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ar=function(e,r,t,n,o,u,i){var a={$$typeof:m,type:e,key:r,ref:t,props:i,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ir(e,r,t,n,o){{var u,i={},a=null,b=null;t!==void 0&&(Se(t),a=""+t),er(r)&&(Se(r.key),a=""+r.key),qe(r)&&(b=r.ref,rr(r,o));for(u in r)q.call(r,u)&&!Qe.hasOwnProperty(u)&&(i[u]=r[u]);if(e&&e.defaultProps){var f=e.defaultProps;for(u in f)i[u]===void 0&&(i[u]=f[u])}if(a||b){var d=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&tr(i,d),b&&nr(i,d)}return ar(e,a,b,o,n,z.current,i)}}var ce=_.ReactCurrentOwner,De=_.ReactDebugCurrentFrame;function Y(e){if(e){var r=e._owner,t=Q(e.type,e._source,r?r.type:null);De.setExtraStackFrame(t)}else De.setExtraStackFrame(null)}var fe;fe=!1;function le(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}function Ae(){{if(ce.current){var e=F(ce.current.type);if(e)return`
`+a[f].replace(" at new "," at ");return e.displayName&&C.includes("<anonymous>")&&(C=C.replace("<anonymous>",e.displayName)),typeof e=="function"&&$.set(e,C),C}while(f>=1&&d>=0);break}}}finally{oe=!1,ae.current=u,ze(),Error.prepareStackTrace=o}var M=e?e.displayName||e.name:"",Ye=M?Z(M):"";return typeof e=="function"&&$.set(e,Ye),Ye}function Ge(e,r,t){return Pe(e,!1)}function He(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Q(e,r,t){if(e==null)return"";if(typeof e=="function")return Pe(e,He(e));if(typeof e=="string")return Z(e);switch(e){case O:return Z("Suspense");case g:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Ge(e.render);case E:return Q(e.type,r,t);case x:{var n=e,o=n._payload,u=n._init;try{return Q(u(o),r,t)}catch{}}}return""}var q=Object.prototype.hasOwnProperty,Oe={},Ce=_.ReactDebugCurrentFrame;function ee(e){if(e){var r=e._owner,t=Q(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(t)}else Ce.setExtraStackFrame(null)}function Xe(e,r,t,n,o){{var u=Function.call.bind(q);for(var i in e)if(u(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var b=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(f){a=f}a&&!(a instanceof Error)&&(ee(o),h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),ee(null)),a instanceof Error&&!(a.message in Oe)&&(Oe[a.message]=!0,ee(o),h("Failed %s type: %s",t,a.message),ee(null))}}}var Ke=Array.isArray;function ue(e){return Ke(e)}function Ze(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function $e(e){try{return xe(e),!1}catch{return!0}}function xe(e){return""+e}function Se(e){if($e(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ze(e)),xe(e)}var z=_.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},je,ke,se;se={};function qe(e){if(q.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function er(e){if(q.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function rr(e,r){if(typeof e.ref=="string"&&z.current&&r&&z.current.stateNode!==r){var t=F(z.current.type);se[t]||(h('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(z.current.type),e.ref),se[t]=!0)}}function tr(e,r){{var t=function(){je||(je=!0,h("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function nr(e,r){{var t=function(){ke||(ke=!0,h("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ar=function(e,r,t,n,o,u,i){var a={$$typeof:m,type:e,key:r,ref:t,props:i,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ir(e,r,t,n,o){{var u,i={},a=null,b=null;t!==void 0&&(Se(t),a=""+t),er(r)&&(Se(r.key),a=""+r.key),qe(r)&&(b=r.ref,rr(r,o));for(u in r)q.call(r,u)&&!Qe.hasOwnProperty(u)&&(i[u]=r[u]);if(e&&e.defaultProps){var f=e.defaultProps;for(u in f)i[u]===void 0&&(i[u]=f[u])}if(a||b){var d=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&tr(i,d),b&&nr(i,d)}return ar(e,a,b,o,n,z.current,i)}}var ce=_.ReactCurrentOwner,De=_.ReactDebugCurrentFrame;function N(e){if(e){var r=e._owner,t=Q(e.type,e._source,r?r.type:null);De.setExtraStackFrame(t)}else De.setExtraStackFrame(null)}var fe;fe=!1;function le(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}function Ae(){{if(ce.current){var e=F(ce.current.type);if(e)return`

@@ -29,2 +29,2 @@ Check the render method of \``+e+"`."}return""}}function or(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`

Check the top-level render call using <`+t+">.")}return r}}function Le(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ur(r);if(Fe[t])return;Fe[t]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+F(e._owner.type)+"."),Y(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),Y(null)}}function Ie(e,r){{if(typeof e!="object")return;if(ue(e))for(var t=0;t<e.length;t++){var n=e[t];le(n)&&Le(n,r)}else if(le(e))e._store&&(e._store.validated=!0);else if(e){var o=D(e);if(typeof o=="function"&&o!==e.entries)for(var u=o.call(e),i;!(i=u.next()).done;)le(i.value)&&Le(i.value,r)}}}function sr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===v||r.$$typeof===E))t=r.propTypes;else return;if(t){var n=F(r);Ke(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!fe){fe=!0;var o=F(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){Y(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Y(null);break}}e.ref!==null&&(Y(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),Y(null))}}function We(e,r,t,n,o,u){{var i=j(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var b=or(o);b?a+=b:a+=Ae();var f;e===null?f="null":ue(e)?f="array":e!==void 0&&e.$$typeof===m?(f="<"+(F(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):f=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",f,a)}var d=ir(e,r,t,o,u);if(d==null)return d;if(i){var C=r.children;if(C!==void 0)if(n)if(ue(C)){for(var M=0;M<C.length;M++)Ie(C[M],e);Object.freeze&&Object.freeze(C)}else h("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ie(C,e)}return e===T?cr(d):sr(d),d}}function fr(e,r,t){return We(e,r,t,!0)}function lr(e,r,t){return We(e,r,t,!1)}var dr=lr,vr=fr;V.Fragment=T,V.jsx=dr,V.jsxs=vr}()),V}(function(s){process.env.NODE_ENV==="production"?s.exports=Ye():s.exports=Me()})(ve);const N=ve.exports.jsx;function Ue({child:s,sliderWidth:m,sliderHeight:w,scaleOnDrag:T=!1}){const P=l.useRef(null),A=()=>{T&&P.current&&(P.current.style.transform="scale(0.9)")},k=()=>{T&&P.current&&(P.current.style.transform="scale(1)")};return N("div",{ref:P,style:{width:`${m}px`,height:`${w}px`},className:"rtds-single-slide-styles",children:N("div",{className:"slide-inner",onPointerDown:A,onPointerUp:k,onPointerLeave:k,onDragStart:R=>(R.preventDefault(),R.stopPropagation(),!1),children:s})})}function re(s){const m=s.clientWidth,w=s.clientHeight;return{width:m,height:w}}const hr="";function Ve({children:s,onSlideComplete:m,onSlideStart:w,activeIndex:T=null,threshHold:P=100,transition:A=.3,scaleOnDrag:k=!1}){const[R,v]=l.useState({width:0,height:0}),O=l.useRef(!1),g=l.useRef(0),E=l.useRef(0),x=l.useRef(0),c=l.useRef(0),p=l.useRef(null),G=l.useRef(null),D=l.useCallback((y=R.width)=>{E.current=c.current*-y,x.current=E.current,H()},[R.width]),_=l.useCallback(()=>{p.current&&(p.current.style.transition=`transform ${A}s ease-out`)},[A]),h=()=>{p.current&&(p.current.style.transition="none")};l.useEffect(()=>{T!==c.current&&(_(),c.current=T,D())},[T,D,_]),l.useLayoutEffect(()=>{p.current&&(h(),v(re(p.current)),D(re(p.current).width))},[D]),l.useEffect(()=>{const y=()=>{if(h(),p.current){const{width:j,height:I}=re(p.current);v({width:j,height:I}),D(j)}},S=({key:j})=>{const I=["ArrowRight","ArrowLeft"].includes(j);I&&_(),I&&w&&w(c.current),j==="ArrowRight"&&c.current<s.length-1&&(c.current+=1),j==="ArrowLeft"&&c.current>0&&(c.current-=1),I&&m&&m(c.current),D()};return window.addEventListener("resize",y),window.addEventListener("keydown",S),()=>{window.removeEventListener("resize",y),window.removeEventListener("keydown",S)}},[s.length,D,m,w,_]);function te(y){return function(S){_(),c.current=y,g.current=S.pageX,O.current=!0,G.current=requestAnimationFrame(K),p.current&&(p.current.style.cursor="grabbing"),w&&w(c.current)}}function ne(y){if(O.current){const S=y.pageX;E.current=x.current+S-g.current}}function X(){_(),cancelAnimationFrame(G.current),O.current=!1;const y=E.current-x.current;y<-P&&c.current<s.length-1&&(c.current+=1),y>P&&c.current>0&&(c.current-=1),_(),D(),p.current.style.cursor="grab",m&&m(c.current)}function K(){H(),O.current&&requestAnimationFrame(K)}function H(){!p.current||(p.current.style.transform=`translateX(${E.current}px)`)}return N("div",{className:"rtds-slider-wrapper",children:N("div",{ref:p,className:"rtds-slider-styles",children:s.map((y,S)=>N("div",{onPointerDown:te(S),onPointerMove:ne,onPointerUp:X,onPointerLeave:()=>{O.current&&X()},onContextMenu:j=>{j.preventDefault(),j.stopPropagation()},className:"slide-outer",children:N(Ue,{child:y,sliderWidth:R.width,sliderHeight:R.height,scaleOnDrag:k})},y.key))})})}return Ve});
Check the top-level render call using <`+t+">.")}return r}}function Le(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ur(r);if(Fe[t])return;Fe[t]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+F(e._owner.type)+"."),N(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),N(null)}}function Ie(e,r){{if(typeof e!="object")return;if(ue(e))for(var t=0;t<e.length;t++){var n=e[t];le(n)&&Le(n,r)}else if(le(e))e._store&&(e._store.validated=!0);else if(e){var o=D(e);if(typeof o=="function"&&o!==e.entries)for(var u=o.call(e),i;!(i=u.next()).done;)le(i.value)&&Le(i.value,r)}}}function sr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===v||r.$$typeof===E))t=r.propTypes;else return;if(t){var n=F(r);Xe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!fe){fe=!0;var o=F(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){N(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),N(null);break}}e.ref!==null&&(N(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),N(null))}}function We(e,r,t,n,o,u){{var i=j(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var b=or(o);b?a+=b:a+=Ae();var f;e===null?f="null":ue(e)?f="array":e!==void 0&&e.$$typeof===m?(f="<"+(F(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):f=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",f,a)}var d=ir(e,r,t,o,u);if(d==null)return d;if(i){var C=r.children;if(C!==void 0)if(n)if(ue(C)){for(var M=0;M<C.length;M++)Ie(C[M],e);Object.freeze&&Object.freeze(C)}else h("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ie(C,e)}return e===T?cr(d):sr(d),d}}function fr(e,r,t){return We(e,r,t,!0)}function lr(e,r,t){return We(e,r,t,!1)}var dr=lr,vr=fr;V.Fragment=T,V.jsx=dr,V.jsxs=vr}()),V}(function(s){process.env.NODE_ENV==="production"?s.exports=Ne():s.exports=Me()})(ve);const Y=ve.exports.jsx;function Ue({child:s,sliderWidth:m,sliderHeight:w,scaleOnDrag:T=!1}){const P=l.useRef(null),A=()=>{T&&P.current&&(P.current.style.transform="scale(0.9)")},k=()=>{T&&P.current&&(P.current.style.transform="scale(1)")};return Y("div",{ref:P,style:{width:`${m}px`,height:`${w}px`,transition:"transform 0.2s ease-out"},className:"rtds-single-slide-styles",children:Y("div",{style:{padding:"1rem",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},onPointerDown:A,onPointerUp:k,onPointerLeave:k,onDragStart:R=>(R.preventDefault(),R.stopPropagation(),!1),children:s})})}function re(s){const m=s.clientWidth,w=s.clientHeight;return{width:m,height:w}}function Ve({children:s,onSlideComplete:m,onSlideStart:w,activeIndex:T=null,threshHold:P=100,transition:A=.3,scaleOnDrag:k=!1}){const[R,v]=l.useState({width:0,height:0}),O=l.useRef(!1),g=l.useRef(0),E=l.useRef(0),x=l.useRef(0),c=l.useRef(0),p=l.useRef(null),G=l.useRef(null),D=l.useCallback((y=R.width)=>{E.current=c.current*-y,x.current=E.current,K()},[R.width]),_=l.useCallback(()=>{p.current&&(p.current.style.transition=`transform ${A}s ease-out`)},[A]),h=()=>{p.current&&(p.current.style.transition="none")};l.useEffect(()=>{T!==c.current&&(_(),c.current=T,D())},[T,D,_]),l.useLayoutEffect(()=>{p.current&&(h(),v(re(p.current)),D(re(p.current).width))},[D]),l.useEffect(()=>{const y=()=>{if(h(),p.current){const{width:j,height:I}=re(p.current);v({width:j,height:I}),D(j)}},S=({key:j})=>{const I=["ArrowRight","ArrowLeft"].includes(j);I&&_(),I&&w&&w(c.current),j==="ArrowRight"&&c.current<s.length-1&&(c.current+=1),j==="ArrowLeft"&&c.current>0&&(c.current-=1),I&&m&&m(c.current),D()};return window.addEventListener("resize",y),window.addEventListener("keydown",S),()=>{window.removeEventListener("resize",y),window.removeEventListener("keydown",S)}},[s.length,D,m,w,_]);function te(y){return function(S){_(),c.current=y,g.current=S.pageX,O.current=!0,G.current=requestAnimationFrame(X),p.current&&(p.current.style.cursor="grabbing"),w&&w(c.current)}}function ne(y){if(O.current){const S=y.pageX;E.current=x.current+S-g.current}}function H(){_(),cancelAnimationFrame(G.current),O.current=!1;const y=E.current-x.current;y<-P&&c.current<s.length-1&&(c.current+=1),y>P&&c.current>0&&(c.current-=1),_(),D(),p.current.style.cursor="grab",m&&m(c.current)}function X(){K(),O.current&&requestAnimationFrame(X)}function K(){!p.current||(p.current.style.transform=`translateX(${E.current}px)`)}return Y("div",{className:"rtds-slider-wrapper",style:{overflow:"hidden",width:"100%",height:"100%",maxHeight:"100vh"},children:Y("div",{ref:p,className:"rtds-slider-styles",style:{all:"initial",width:"100%",height:"100%",maxHeight:"100vh",display:"inline-flex",willChange:"transform, scale",cursor:"grab"},children:s.map((y,S)=>Y("div",{onPointerDown:te(S),onPointerMove:ne,onPointerUp:H,onPointerLeave:()=>{O.current&&H()},onContextMenu:j=>{j.preventDefault(),j.stopPropagation()},className:"slide-outer",style:{touchAction:"none"},children:Y(Ue,{child:y,sliderWidth:R.width,sliderHeight:R.height,scaleOnDrag:k})},y.key))})})}return Ve});
{
"name": "react-touch-drag-slider",
"version": "2.2.0",
"version": "2.2.1",
"description": "Touch and drag slider carousel component for React",

@@ -5,0 +5,0 @@ "author": "bushblade",

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