react-touch-drag-slider
Advanced tools
Comparing version 2.2.5 to 2.2.6
@@ -1,6 +0,6 @@ | ||
import Ye, { useRef as $, useState as fr, useCallback as $e, useEffect as Ie, useLayoutEffect as dr } from "react"; | ||
var re = { exports: {} }, V = {}; | ||
import Ye, { useRef as I, useState as lr, useCallback as $e, useEffect as Ie, useLayoutEffect as dr } from "react"; | ||
var le = { exports: {} }, V = {}; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.production.min.js | ||
* react-jsx-runtime.development.js | ||
* | ||
@@ -14,62 +14,38 @@ * Copyright (c) Facebook, Inc. and its affiliates. | ||
function vr() { | ||
if (Le) | ||
return V; | ||
Le = 1; | ||
var f = Ye, h = Symbol.for("react.element"), y = Symbol.for("react.fragment"), w = Object.prototype.hasOwnProperty, P = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, D = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function j(E, d, T) { | ||
var g, b = {}, O = null, u = null; | ||
T !== void 0 && (O = "" + T), d.key !== void 0 && (O = "" + d.key), d.ref !== void 0 && (u = d.ref); | ||
for (g in d) | ||
w.call(d, g) && !D.hasOwnProperty(g) && (b[g] = d[g]); | ||
if (E && E.defaultProps) | ||
for (g in d = E.defaultProps, d) | ||
b[g] === void 0 && (b[g] = d[g]); | ||
return { $$typeof: h, type: E, key: O, ref: u, props: b, _owner: P.current }; | ||
} | ||
return V.Fragment = y, V.jsx = j, V.jsxs = j, V; | ||
} | ||
var q = {}; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var We; | ||
function pr() { | ||
return We || (We = 1, process.env.NODE_ENV !== "production" && function() { | ||
var f = Ye, h = Symbol.for("react.element"), y = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), j = Symbol.for("react.provider"), E = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), u = Symbol.for("react.offscreen"), v = Symbol.iterator, B = "@@iterator"; | ||
return Le || (Le = 1, process.env.NODE_ENV !== "production" && function() { | ||
var m = Ye, p = Symbol.for("react.element"), y = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), E = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), s = Symbol.for("react.offscreen"), d = Symbol.iterator, B = "@@iterator"; | ||
function k(e) { | ||
if (e === null || typeof e != "object") | ||
return null; | ||
var r = v && e[v] || e[B]; | ||
var r = d && e[d] || e[B]; | ||
return typeof r == "function" ? r : null; | ||
} | ||
var _ = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function p(e) { | ||
var _ = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; | ||
function v(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); | ||
re("error", e, t); | ||
} | ||
} | ||
function te(e, r, t) { | ||
function re(e, r, t) { | ||
{ | ||
var n = _.ReactDebugCurrentFrame, o = n.getStackAddendum(); | ||
o !== "" && (r += "%s", t = t.concat([o])); | ||
var s = t.map(function(i) { | ||
var u = t.map(function(i) { | ||
return String(i); | ||
}); | ||
s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s); | ||
u.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, u); | ||
} | ||
} | ||
var ne = !1, z = !1, G = !1, J = !1, m = !1, C; | ||
var te = !1, z = !1, G = !1, J = !1, g = !1, C; | ||
C = Symbol.for("react.module.reference"); | ||
function S(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === w || e === D || m || e === P || e === T || e === g || J || e === u || ne || z || G || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === b || e.$$typeof === j || e.$$typeof === E || e.$$typeof === d || e.$$typeof === C || e.getModuleId !== void 0)); | ||
function j(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === w || e === D || g || e === P || e === T || e === h || J || e === s || te || z || G || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === b || e.$$typeof === S || e.$$typeof === E || e.$$typeof === l || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
// we don't know which Flight build this will end up being used | ||
// with. | ||
e.$$typeof === C || e.getModuleId !== void 0)); | ||
} | ||
function I(e, r, t) { | ||
function L(e, r, t) { | ||
var n = e.displayName; | ||
@@ -87,3 +63,3 @@ if (n) | ||
return null; | ||
if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function") | ||
if (typeof e.tag == "number" && v("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; | ||
@@ -103,3 +79,3 @@ if (typeof e == "string") | ||
return "Suspense"; | ||
case g: | ||
case h: | ||
return "SuspenseList"; | ||
@@ -112,7 +88,7 @@ } | ||
return de(r) + ".Consumer"; | ||
case j: | ||
case S: | ||
var t = e; | ||
return de(t._context) + ".Provider"; | ||
case d: | ||
return I(e, e.render, "ForwardRef"); | ||
case l: | ||
return L(e, e.render, "ForwardRef"); | ||
case b: | ||
@@ -122,5 +98,5 @@ var n = e.displayName || null; | ||
case O: { | ||
var o = e, s = o._payload, i = o._init; | ||
var o = e, u = o._payload, i = o._init; | ||
try { | ||
return A(i(s)); | ||
return A(i(u)); | ||
} catch { | ||
@@ -133,3 +109,3 @@ return null; | ||
} | ||
var L = Object.assign, M = 0, ve, pe, he, ge, me, ye, Ee; | ||
var W = Object.assign, M = 0, ve, pe, he, ge, me, ye, Ee; | ||
function be() { | ||
@@ -170,21 +146,21 @@ } | ||
Object.defineProperties(console, { | ||
log: L({}, e, { | ||
log: W({}, e, { | ||
value: ve | ||
}), | ||
info: L({}, e, { | ||
info: W({}, e, { | ||
value: pe | ||
}), | ||
warn: L({}, e, { | ||
warn: W({}, e, { | ||
value: he | ||
}), | ||
error: L({}, e, { | ||
error: W({}, e, { | ||
value: ge | ||
}), | ||
group: L({}, e, { | ||
group: W({}, e, { | ||
value: me | ||
}), | ||
groupCollapsed: L({}, e, { | ||
groupCollapsed: W({}, e, { | ||
value: ye | ||
}), | ||
groupEnd: L({}, e, { | ||
groupEnd: W({}, e, { | ||
value: Ee | ||
@@ -194,9 +170,9 @@ }) | ||
} | ||
M < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
M < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue."); | ||
} | ||
} | ||
var ae = _.ReactCurrentDispatcher, ie; | ||
var ne = _.ReactCurrentDispatcher, ae; | ||
function H(e, r, t) { | ||
{ | ||
if (ie === void 0) | ||
if (ae === void 0) | ||
try { | ||
@@ -206,9 +182,9 @@ throw Error(); | ||
var n = o.stack.trim().match(/\n( *(at )?)/); | ||
ie = n && n[1] || ""; | ||
ae = n && n[1] || ""; | ||
} | ||
return ` | ||
` + ie + e; | ||
` + ae + e; | ||
} | ||
} | ||
var oe = !1, X; | ||
var ie = !1, X; | ||
{ | ||
@@ -219,3 +195,3 @@ var Ue = typeof WeakMap == "function" ? WeakMap : Map; | ||
function Re(e, r) { | ||
if (!e || oe) | ||
if (!e || ie) | ||
return ""; | ||
@@ -228,7 +204,7 @@ { | ||
var n; | ||
oe = !0; | ||
ie = !0; | ||
var o = Error.prepareStackTrace; | ||
Error.prepareStackTrace = void 0; | ||
var s; | ||
s = ae.current, ae.current = null, Ne(); | ||
var u; | ||
u = ne.current, ne.current = null, Ne(); | ||
try { | ||
@@ -270,9 +246,9 @@ if (r) { | ||
`), R = n.stack.split(` | ||
`), c = a.length - 1, l = R.length - 1; c >= 1 && l >= 0 && a[c] !== R[l]; ) | ||
l--; | ||
for (; c >= 1 && l >= 0; c--, l--) | ||
if (a[c] !== R[l]) { | ||
if (c !== 1 || l !== 1) | ||
`), c = a.length - 1, f = R.length - 1; c >= 1 && f >= 0 && a[c] !== R[f]; ) | ||
f--; | ||
for (; c >= 1 && f >= 0; c--, f--) | ||
if (a[c] !== R[f]) { | ||
if (c !== 1 || f !== 1) | ||
do | ||
if (c--, l--, l < 0 || a[c] !== R[l]) { | ||
if (c--, f--, f < 0 || a[c] !== R[f]) { | ||
var x = ` | ||
@@ -282,3 +258,3 @@ ` + a[c].replace(" at new ", " at "); | ||
} | ||
while (c >= 1 && l >= 0); | ||
while (c >= 1 && f >= 0); | ||
break; | ||
@@ -288,3 +264,3 @@ } | ||
} finally { | ||
oe = !1, ae.current = s, Me(), Error.prepareStackTrace = o; | ||
ie = !1, ne.current = u, Me(), Error.prepareStackTrace = o; | ||
} | ||
@@ -311,3 +287,3 @@ var N = e ? e.displayName || e.name : "", Fe = N ? H(N) : ""; | ||
return H("Suspense"); | ||
case g: | ||
case h: | ||
return H("SuspenseList"); | ||
@@ -317,3 +293,3 @@ } | ||
switch (e.$$typeof) { | ||
case d: | ||
case l: | ||
return Ve(e.render); | ||
@@ -323,5 +299,5 @@ case b: | ||
case O: { | ||
var n = e, o = n._payload, s = n._init; | ||
var n = e, o = n._payload, u = n._init; | ||
try { | ||
return K(s(o), r, t); | ||
return K(u(o), r, t); | ||
} catch { | ||
@@ -343,5 +319,5 @@ } | ||
{ | ||
var s = Function.call.bind(Z); | ||
var u = Function.call.bind(Z); | ||
for (var i in e) | ||
if (s(e, i)) { | ||
if (u(e, i)) { | ||
var a = void 0; | ||
@@ -357,3 +333,3 @@ try { | ||
} | ||
a && !(a instanceof Error) && (Q(o), p("%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), Q(null)), a instanceof Error && !(a.message in _e) && (_e[a.message] = !0, Q(o), p("Failed %s type: %s", t, a.message), Q(null)); | ||
a && !(a instanceof Error) && (Q(o), v("%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), Q(null)), a instanceof Error && !(a.message in _e) && (_e[a.message] = !0, Q(o), v("Failed %s type: %s", t, a.message), Q(null)); | ||
} | ||
@@ -363,3 +339,3 @@ } | ||
var ze = Array.isArray; | ||
function se(e) { | ||
function oe(e) { | ||
return ze(e); | ||
@@ -385,3 +361,3 @@ } | ||
if (Je(e)) | ||
return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ge(e)), Pe(e); | ||
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ge(e)), Pe(e); | ||
} | ||
@@ -414,3 +390,3 @@ var U = _.ReactCurrentOwner, He = { | ||
var t = A(U.current.type); | ||
ue[t] || (p('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', A(U.current.type), e.ref), ue[t] = !0); | ||
ue[t] || (v('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', A(U.current.type), e.ref), ue[t] = !0); | ||
} | ||
@@ -421,3 +397,3 @@ } | ||
var t = function() { | ||
xe || (xe = !0, p("%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)); | ||
xe || (xe = !0, v("%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)); | ||
}; | ||
@@ -433,3 +409,3 @@ t.isReactWarning = !0, Object.defineProperty(e, "key", { | ||
var t = function() { | ||
Oe || (Oe = !0, p("%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)); | ||
Oe || (Oe = !0, v("%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)); | ||
}; | ||
@@ -442,5 +418,7 @@ t.isReactWarning = !0, Object.defineProperty(e, "ref", { | ||
} | ||
var rr = function(e, r, t, n, o, s, i) { | ||
var rr = function(e, r, t, n, o, u, i) { | ||
var a = { | ||
$$typeof: h, | ||
// This tag allows us to uniquely identify this as a React Element | ||
$$typeof: p, | ||
// Built-in properties that belong on the element | ||
type: e, | ||
@@ -450,3 +428,4 @@ key: r, | ||
props: i, | ||
_owner: s | ||
// Record the component responsible for creating this element. | ||
_owner: u | ||
}; | ||
@@ -472,14 +451,14 @@ return a._store = {}, Object.defineProperty(a._store, "validated", { | ||
{ | ||
var s, i = {}, a = null, R = null; | ||
var u, i = {}, a = null, R = null; | ||
t !== void 0 && (Te(t), a = "" + t), Ke(r) && (Te(r.key), a = "" + r.key), Xe(r) && (R = r.ref, Ze(r, o)); | ||
for (s in r) | ||
Z.call(r, s) && !He.hasOwnProperty(s) && (i[s] = r[s]); | ||
for (u in r) | ||
Z.call(r, u) && !He.hasOwnProperty(u) && (i[u] = r[u]); | ||
if (e && e.defaultProps) { | ||
var c = e.defaultProps; | ||
for (s in c) | ||
i[s] === void 0 && (i[s] = c[s]); | ||
for (u in c) | ||
i[u] === void 0 && (i[u] = c[u]); | ||
} | ||
if (a || R) { | ||
var l = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
a && Qe(i, l), R && er(i, l); | ||
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
a && Qe(i, f), R && er(i, f); | ||
} | ||
@@ -489,3 +468,3 @@ return rr(e, a, R, o, n, U.current, i); | ||
} | ||
var ce = _.ReactCurrentOwner, Ce = _.ReactDebugCurrentFrame; | ||
var se = _.ReactCurrentOwner, Ce = _.ReactDebugCurrentFrame; | ||
function Y(e) { | ||
@@ -498,11 +477,11 @@ if (e) { | ||
} | ||
var le; | ||
le = !1; | ||
var ce; | ||
ce = !1; | ||
function fe(e) { | ||
return typeof e == "object" && e !== null && e.$$typeof === h; | ||
return typeof e == "object" && e !== null && e.$$typeof === p; | ||
} | ||
function Se() { | ||
function je() { | ||
{ | ||
if (ce.current) { | ||
var e = A(ce.current.type); | ||
if (se.current) { | ||
var e = A(se.current.type); | ||
if (e) | ||
@@ -527,6 +506,6 @@ return ` | ||
} | ||
var je = {}; | ||
var Se = {}; | ||
function ar(e) { | ||
{ | ||
var r = Se(); | ||
var r = je(); | ||
if (!r) { | ||
@@ -547,7 +526,7 @@ var t = typeof e == "string" ? e : e.displayName || e.name; | ||
var t = ar(r); | ||
if (je[t]) | ||
if (Se[t]) | ||
return; | ||
je[t] = !0; | ||
Se[t] = !0; | ||
var n = ""; | ||
e && e._owner && e._owner !== ce.current && (n = " It was passed a child from " + A(e._owner.type) + "."), Y(e), p('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); | ||
e && e._owner && e._owner !== se.current && (n = " It was passed a child from " + A(e._owner.type) + "."), Y(e), v('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); | ||
} | ||
@@ -559,3 +538,3 @@ } | ||
return; | ||
if (se(e)) | ||
if (oe(e)) | ||
for (var t = 0; t < e.length; t++) { | ||
@@ -570,3 +549,3 @@ var n = e[t]; | ||
if (typeof o == "function" && o !== e.entries) | ||
for (var s = o.call(e), i; !(i = s.next()).done; ) | ||
for (var u = o.call(e), i; !(i = u.next()).done; ) | ||
fe(i.value) && ke(i.value, r); | ||
@@ -584,3 +563,5 @@ } | ||
t = r.propTypes; | ||
else if (typeof r == "object" && (r.$$typeof === d || r.$$typeof === b)) | ||
else if (typeof r == "object" && (r.$$typeof === l || // Note: Memo only checks outer props here. | ||
// Inner props are checked in the reconciler. | ||
r.$$typeof === b)) | ||
t = r.propTypes; | ||
@@ -592,8 +573,8 @@ else | ||
Be(t, e.props, "prop", n, e); | ||
} else if (r.PropTypes !== void 0 && !le) { | ||
le = !0; | ||
} else if (r.PropTypes !== void 0 && !ce) { | ||
ce = !0; | ||
var o = A(r); | ||
p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", o || "Unknown"); | ||
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", o || "Unknown"); | ||
} | ||
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); | ||
} | ||
@@ -606,12 +587,12 @@ } | ||
if (n !== "children" && n !== "key") { | ||
Y(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), Y(null); | ||
Y(e), v("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), p("Invalid attribute `ref` supplied to `React.Fragment`."), Y(null)); | ||
e.ref !== null && (Y(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), Y(null)); | ||
} | ||
} | ||
function Ae(e, r, t, n, o, s) { | ||
function Ae(e, r, t, n, o, u) { | ||
{ | ||
var i = S(e); | ||
var i = j(e); | ||
if (!i) { | ||
@@ -621,9 +602,9 @@ var a = ""; | ||
var R = nr(o); | ||
R ? a += R : a += Se(); | ||
R ? a += R : a += je(); | ||
var c; | ||
e === null ? c = "null" : se(e) ? c = "array" : e !== void 0 && e.$$typeof === h ? (c = "<" + (A(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : c = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", c, a); | ||
e === null ? c = "null" : oe(e) ? c = "array" : e !== void 0 && e.$$typeof === p ? (c = "<" + (A(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : c = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", c, a); | ||
} | ||
var l = tr(e, r, t, o, s); | ||
if (l == null) | ||
return l; | ||
var f = tr(e, r, t, o, u); | ||
if (f == null) | ||
return f; | ||
if (i) { | ||
@@ -633,3 +614,3 @@ var x = r.children; | ||
if (n) | ||
if (se(x)) { | ||
if (oe(x)) { | ||
for (var N = 0; N < x.length; N++) | ||
@@ -639,37 +620,63 @@ De(x[N], e); | ||
} else | ||
p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); | ||
v("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 | ||
De(x, e); | ||
} | ||
return e === w ? or(l) : ir(l), l; | ||
return e === w ? or(f) : ir(f), f; | ||
} | ||
} | ||
function sr(e, r, t) { | ||
function ur(e, r, t) { | ||
return Ae(e, r, t, !0); | ||
} | ||
function ur(e, r, t) { | ||
function sr(e, r, t) { | ||
return Ae(e, r, t, !1); | ||
} | ||
var cr = ur, lr = sr; | ||
q.Fragment = w, q.jsx = cr, q.jsxs = lr; | ||
}()), q; | ||
var cr = sr, fr = ur; | ||
V.Fragment = w, V.jsx = cr, V.jsxs = fr; | ||
}()), V; | ||
} | ||
(function(f) { | ||
process.env.NODE_ENV === "production" ? f.exports = vr() : f.exports = pr(); | ||
})(re); | ||
const hr = re.exports.Fragment, W = re.exports.jsx, gr = re.exports.jsxs, mr = String.raw; | ||
function yr({ | ||
child: f, | ||
sliderWidth: h, | ||
var q = {}; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var We; | ||
function pr() { | ||
if (We) | ||
return q; | ||
We = 1; | ||
var m = Ye, p = Symbol.for("react.element"), y = Symbol.for("react.fragment"), w = Object.prototype.hasOwnProperty, P = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, D = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function S(E, l, T) { | ||
var h, b = {}, O = null, s = null; | ||
T !== void 0 && (O = "" + T), l.key !== void 0 && (O = "" + l.key), l.ref !== void 0 && (s = l.ref); | ||
for (h in l) | ||
w.call(l, h) && !D.hasOwnProperty(h) && (b[h] = l[h]); | ||
if (E && E.defaultProps) | ||
for (h in l = E.defaultProps, l) | ||
b[h] === void 0 && (b[h] = l[h]); | ||
return { $$typeof: p, type: E, key: O, ref: s, props: b, _owner: P.current }; | ||
} | ||
return q.Fragment = y, q.jsx = S, q.jsxs = S, q; | ||
} | ||
process.env.NODE_ENV === "production" ? le.exports = pr() : le.exports = vr(); | ||
var $ = le.exports; | ||
const hr = String.raw; | ||
function gr({ | ||
child: m, | ||
sliderWidth: p, | ||
sliderHeight: y, | ||
scaleOnDrag: w = !1 | ||
}) { | ||
const P = $(null), D = () => { | ||
const P = I(null), D = () => { | ||
w && P.current && (P.current.style.transform = "scale(0.9)"); | ||
}, j = () => { | ||
}, S = () => { | ||
w && P.current && (P.current.style.transform = "scale(1)"); | ||
}; | ||
return /* @__PURE__ */ gr(hr, { | ||
children: [/* @__PURE__ */ W("style", { | ||
children: mr` | ||
return /* @__PURE__ */ $.jsxs($.Fragment, { children: [ | ||
/* @__PURE__ */ $.jsx("style", { children: hr` | ||
.rtds-single-slide-styles img { | ||
@@ -679,37 +686,43 @@ max-width: 100%; | ||
} | ||
` | ||
}), /* @__PURE__ */ W("div", { | ||
ref: P, | ||
style: { | ||
width: `${h}px`, | ||
height: `${y}px`, | ||
transition: "transform 0.2s ease-out" | ||
}, | ||
className: "rtds-single-slide-styles", | ||
children: /* @__PURE__ */ W("div", { | ||
` }), | ||
/* @__PURE__ */ $.jsx( | ||
"div", | ||
{ | ||
ref: P, | ||
style: { | ||
padding: "1rem", | ||
height: "100%", | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
userSelect: "none" | ||
width: `${p}px`, | ||
height: `${y}px`, | ||
transition: "transform 0.2s ease-out" | ||
}, | ||
onPointerDown: D, | ||
onPointerUp: j, | ||
onPointerLeave: j, | ||
onDragStart: (E) => (E.preventDefault(), E.stopPropagation(), !1), | ||
children: f | ||
}) | ||
})] | ||
}); | ||
className: "rtds-single-slide-styles", | ||
children: /* @__PURE__ */ $.jsx( | ||
"div", | ||
{ | ||
style: { | ||
padding: "1rem", | ||
height: "100%", | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
userSelect: "none" | ||
}, | ||
onPointerDown: D, | ||
onPointerUp: S, | ||
onPointerLeave: S, | ||
onDragStart: (E) => (E.preventDefault(), E.stopPropagation(), !1), | ||
children: m | ||
} | ||
) | ||
} | ||
) | ||
] }); | ||
} | ||
function ee(f) { | ||
const h = f.clientWidth, y = f.clientHeight; | ||
return { width: h, height: y }; | ||
function ee(m) { | ||
const p = m.clientWidth, y = m.clientHeight; | ||
return { width: p, height: y }; | ||
} | ||
if (import.meta.vitest) { | ||
const { it: f, expect: h } = import.meta.vitest, y = document.createElement("div"); | ||
f("Gets an elements dimensions", () => { | ||
h(ee(y)).toStrictEqual({ | ||
const { it: m, expect: p } = import.meta.vitest, y = document.createElement("div"); | ||
m("Gets an elements dimensions", () => { | ||
p(ee(y)).toStrictEqual({ | ||
width: 0, | ||
@@ -720,5 +733,5 @@ height: 0 | ||
} | ||
function br({ | ||
children: f, | ||
onSlideComplete: h, | ||
function yr({ | ||
children: m, | ||
onSlideComplete: p, | ||
onSlideStart: y, | ||
@@ -728,49 +741,47 @@ activeIndex: w = null, | ||
transition: D = 0.3, | ||
scaleOnDrag: j = !1 | ||
scaleOnDrag: S = !1 | ||
}) { | ||
const [E, d] = fr({ | ||
width: 0, | ||
height: 0 | ||
}), T = $(!1), g = $(0), b = $(0), O = $(0), u = $(0), v = $(null), B = $(null), k = $e((m = E.width) => { | ||
b.current = u.current * -m, O.current = b.current, J(); | ||
}, [E.width]), _ = $e(() => { | ||
v.current && (v.current.style.transition = `transform ${D}s ease-out`); | ||
}, [D]), p = () => { | ||
v.current && (v.current.style.transition = "none"); | ||
const [E, l] = lr({ width: 0, height: 0 }), T = I(!1), h = I(0), b = I(0), O = I(0), s = I(0), d = I(null), B = I(null), k = $e( | ||
(g = E.width) => { | ||
b.current = s.current * -g, O.current = b.current, J(); | ||
}, | ||
[E.width] | ||
), _ = $e(() => { | ||
d.current && (d.current.style.transition = `transform ${D}s ease-out`); | ||
}, [D]), v = () => { | ||
d.current && (d.current.style.transition = "none"); | ||
}; | ||
Ie(() => { | ||
w !== u.current && (_(), u.current = w, k()); | ||
w !== s.current && (_(), s.current = w, k()); | ||
}, [w, k, _]), dr(() => { | ||
v.current && (p(), d(ee(v.current)), k(ee(v.current).width)); | ||
d.current && (v(), l(ee(d.current)), k(ee(d.current).width)); | ||
}, [k]), Ie(() => { | ||
const m = () => { | ||
if (p(), v.current) { | ||
const { | ||
width: S, | ||
height: I | ||
} = ee(v.current); | ||
d({ | ||
width: S, | ||
height: I | ||
}), k(S); | ||
const g = () => { | ||
if (v(), d.current) { | ||
const { width: j, height: L } = ee(d.current); | ||
l({ width: j, height: L }), k(j); | ||
} | ||
}, C = ({ | ||
key: S | ||
}) => { | ||
const I = ["ArrowRight", "ArrowLeft"].includes(S); | ||
I && _(), I && y && y(u.current), S === "ArrowRight" && u.current < f.length - 1 && (u.current += 1), S === "ArrowLeft" && u.current > 0 && (u.current -= 1), I && h && h(u.current), k(); | ||
}, C = ({ key: j }) => { | ||
const L = ["ArrowRight", "ArrowLeft"].includes(j); | ||
L && _(), L && y && y(s.current), j === "ArrowRight" && s.current < m.length - 1 && (s.current += 1), j === "ArrowLeft" && s.current > 0 && (s.current -= 1), L && p && p(s.current), k(); | ||
}; | ||
return window.addEventListener("resize", m), window.addEventListener("keydown", C), () => { | ||
window.removeEventListener("resize", m), window.removeEventListener("keydown", C); | ||
return window.addEventListener("resize", g), window.addEventListener("keydown", C), () => { | ||
window.removeEventListener("resize", g), window.removeEventListener("keydown", C); | ||
}; | ||
}, [f.length, k, h, y, _]); | ||
function te(m) { | ||
}, [ | ||
m.length, | ||
k, | ||
p, | ||
y, | ||
_ | ||
]); | ||
function re(g) { | ||
return function(C) { | ||
_(), u.current = m, g.current = C.pageX, T.current = !0, B.current = requestAnimationFrame(G), v.current && (v.current.style.cursor = "grabbing"), y && y(u.current); | ||
_(), s.current = g, h.current = C.pageX, T.current = !0, B.current = requestAnimationFrame(G), d.current && (d.current.style.cursor = "grabbing"), y && y(s.current); | ||
}; | ||
} | ||
function ne(m) { | ||
function te(g) { | ||
if (T.current) { | ||
const C = m.pageX; | ||
b.current = O.current + C - g.current; | ||
const C = g.pageX; | ||
b.current = O.current + C - h.current; | ||
} | ||
@@ -780,4 +791,4 @@ } | ||
_(), cancelAnimationFrame(B.current), T.current = !1; | ||
const m = b.current - O.current; | ||
m < -P && u.current < f.length - 1 && (u.current += 1), m > P && u.current > 0 && (u.current -= 1), _(), k(), v.current.style.cursor = "grab", h && h(u.current); | ||
const g = b.current - O.current; | ||
g < -P && s.current < m.length - 1 && (s.current += 1), g > P && s.current > 0 && (s.current -= 1), _(), k(), d.current.style.cursor = "grab", p && p(s.current); | ||
} | ||
@@ -788,51 +799,62 @@ function G() { | ||
function J() { | ||
!v.current || (v.current.style.transform = `translateX(${b.current}px)`); | ||
d.current && (d.current.style.transform = `translateX(${b.current}px)`); | ||
} | ||
return /* @__PURE__ */ W("div", { | ||
className: "rtds-slider-wrapper", | ||
style: { | ||
overflow: "hidden", | ||
width: "100%", | ||
height: "100%", | ||
maxHeight: "100vh" | ||
}, | ||
children: /* @__PURE__ */ W("div", { | ||
"data-testid": "slider", | ||
ref: v, | ||
className: "rtds-slider-styles", | ||
return /* @__PURE__ */ $.jsx( | ||
"div", | ||
{ | ||
style: { | ||
all: "initial", | ||
overflow: "hidden", | ||
width: "100%", | ||
height: "100%", | ||
maxHeight: "100vh", | ||
display: "inline-flex", | ||
willChange: "transform, scale", | ||
cursor: "grab" | ||
maxHeight: "100vh" | ||
}, | ||
children: f.map((m, C) => /* @__PURE__ */ W("div", { | ||
onPointerDown: te(C), | ||
onPointerMove: ne, | ||
onPointerUp: z, | ||
onPointerLeave: () => { | ||
T.current && z(); | ||
}, | ||
onContextMenu: (S) => { | ||
S.preventDefault(), S.stopPropagation(); | ||
}, | ||
className: "slide-outer", | ||
style: { | ||
touchAction: "none" | ||
}, | ||
children: /* @__PURE__ */ W(yr, { | ||
child: m, | ||
sliderWidth: E.width, | ||
sliderHeight: E.height, | ||
scaleOnDrag: j | ||
}) | ||
}, m.key)) | ||
}) | ||
}); | ||
children: /* @__PURE__ */ $.jsx( | ||
"div", | ||
{ | ||
"data-testid": "slider", | ||
ref: d, | ||
style: { | ||
all: "initial", | ||
width: "100%", | ||
height: "100%", | ||
maxHeight: "100vh", | ||
display: "inline-flex", | ||
willChange: "transform, scale", | ||
cursor: "grab" | ||
}, | ||
children: m.map((g, C) => /* @__PURE__ */ $.jsx( | ||
"div", | ||
{ | ||
onPointerDown: re(C), | ||
onPointerMove: te, | ||
onPointerUp: z, | ||
onPointerLeave: () => { | ||
T.current && z(); | ||
}, | ||
onContextMenu: (j) => { | ||
j.preventDefault(), j.stopPropagation(); | ||
}, | ||
className: "slide-outer", | ||
style: { | ||
touchAction: "none" | ||
}, | ||
children: /* @__PURE__ */ $.jsx( | ||
gr, | ||
{ | ||
child: g, | ||
sliderWidth: E.width, | ||
sliderHeight: E.height, | ||
scaleOnDrag: S | ||
} | ||
) | ||
}, | ||
g.key | ||
)) | ||
} | ||
) | ||
} | ||
); | ||
} | ||
export { | ||
br as default | ||
yr as default | ||
}; |
@@ -1,4 +0,4 @@ | ||
(function(l,G){typeof exports=="object"&&typeof module<"u"?module.exports=G(require("react")):typeof define=="function"&&define.amd?define(["react"],G):(l=typeof globalThis<"u"?globalThis:l||self,l["react-touch-drag-slider"]=G(l.React))})(this,function(l){"use strict";const ve=(u=>u&&typeof u=="object"&&"default"in u?u:{default:u})(l);var J={exports:{}},U={};/** | ||
(function(u,W){typeof exports=="object"&&typeof module<"u"?module.exports=W(require("react")):typeof define=="function"&&define.amd?define(["react"],W):(u=typeof globalThis<"u"?globalThis:u||self,u["react-touch-drag-slider"]=W(u.React))})(this,function(u){"use strict";var W={exports:{}},V={};/** | ||
* @license React | ||
* react-jsx-runtime.production.min.js | ||
* react-jsx-runtime.development.js | ||
* | ||
@@ -9,5 +9,15 @@ * Copyright (c) Facebook, Inc. and its affiliates. | ||
* LICENSE file in the root directory of this source tree. | ||
*/var pe;function Ne(){if(pe)return U;pe=1;var u=ve.default,g=Symbol.for("react.element"),_=Symbol.for("react.fragment"),T=Object.prototype.hasOwnProperty,P=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,A={key:!0,ref:!0,__self:!0,__source:!0};function k(E,v,x){var m,R={},C=null,c=null;x!==void 0&&(C=""+x),v.key!==void 0&&(C=""+v.key),v.ref!==void 0&&(c=v.ref);for(m in v)T.call(v,m)&&!A.hasOwnProperty(m)&&(R[m]=v[m]);if(E&&E.defaultProps)for(m in v=E.defaultProps,v)R[m]===void 0&&(R[m]=v[m]);return{$$typeof:g,type:E,key:C,ref:c,props:R,_owner:P.current}}return U.Fragment=_,U.jsx=k,U.jsxs=k,U}var V={};/** | ||
*/var de;function We(){return de||(de=1,process.env.NODE_ENV!=="production"&&function(){var b=u,h=Symbol.for("react.element"),_=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),y=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),c=Symbol.for("react.offscreen"),v=Symbol.iterator,J="@@iterator";function D(e){if(e===null||typeof e!="object")return null;var r=v&&e[v]||e[J];return typeof r=="function"?r:null}var w=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(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=w.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",t=t.concat([o]));var s=t.map(function(i){return String(i)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var ne=!1,H=!1,X=!1,K=!1,m=!1,j;j=Symbol.for("react.module.reference");function S(e){return!!(typeof e=="string"||typeof e=="function"||e===T||e===F||m||e===P||e===x||e===g||K||e===c||ne||H||X||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===E||e.$$typeof===k||e.$$typeof===y||e.$$typeof===d||e.$$typeof===j||e.getModuleId!==void 0))}function Y(e,r,t){var n=e.displayName;if(n)return n;var o=r.displayName||r.name||"";return o!==""?t+"("+o+")":t}function pe(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&p("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 _:return"Portal";case F:return"Profiler";case P:return"StrictMode";case x:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case y:var r=e;return pe(r)+".Consumer";case k:var t=e;return pe(t._context)+".Provider";case d:return Y(e,e.render,"ForwardRef");case E:var n=e.displayName||null;return n!==null?n:I(e.type)||"Memo";case C:{var o=e,s=o._payload,i=o._init;try{return I(i(s))}catch{return null}}}return null}var N=Object.assign,z=0,he,ge,me,ye,Ee,Re,be;function _e(){}_e.__reactDisabledLog=!0;function Ve(){{if(z===0){he=console.log,ge=console.info,me=console.warn,ye=console.error,Ee=console.group,Re=console.groupCollapsed,be=console.groupEnd;var e={configurable:!0,enumerable:!0,value:_e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function Be(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:he}),info:N({},e,{value:ge}),warn:N({},e,{value:me}),error:N({},e,{value:ye}),group:N({},e,{value:Ee}),groupCollapsed:N({},e,{value:Re}),groupEnd:N({},e,{value:be})})}z<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=w.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,Q;{var ze=typeof WeakMap=="function"?WeakMap:Map;Q=new ze}function we(e,r){if(!e||oe)return"";{var t=Q.get(e);if(t!==void 0)return t}var n;oe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=ae.current,ae.current=null,Ve();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(` | ||
`),R=n.stack.split(` | ||
`),f=a.length-1,l=R.length-1;f>=1&&l>=0&&a[f]!==R[l];)l--;for(;f>=1&&l>=0;f--,l--)if(a[f]!==R[l]){if(f!==1||l!==1)do if(f--,l--,l<0||a[f]!==R[l]){var O=` | ||
`+a[f].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&Q.set(e,O),O}while(f>=1&&l>=0);break}}}finally{oe=!1,ae.current=s,Be(),Error.prepareStackTrace=o}var U=e?e.displayName||e.name:"",Le=U?Z(U):"";return typeof e=="function"&&Q.set(e,Le),Le}function Ge(e,r,t){return we(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function $(e,r,t){if(e==null)return"";if(typeof e=="function")return we(e,Je(e));if(typeof e=="string")return Z(e);switch(e){case x:return Z("Suspense");case g:return Z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Ge(e.render);case E:return $(e.type,r,t);case C:{var n=e,o=n._payload,s=n._init;try{return $(s(o),r,t)}catch{}}}return""}var q=Object.prototype.hasOwnProperty,Te={},Pe=w.ReactDebugCurrentFrame;function ee(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}function He(e,r,t,n,o){{var s=Function.call.bind(q);for(var i in e)if(s(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var R=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 R.name="Invariant Violation",R}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),p("%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 Te)&&(Te[a.message]=!0,ee(o),p("Failed %s type: %s",t,a.message),ee(null))}}}var Xe=Array.isArray;function se(e){return Xe(e)}function Ke(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Ze(e){try{return xe(e),!1}catch{return!0}}function xe(e){return""+e}function Oe(e){if(Ze(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ke(e)),xe(e)}var G=w.ReactCurrentOwner,Qe={key:!0,ref:!0,__self:!0,__source:!0},Ce,je,ue;ue={};function $e(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 qe(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 er(e,r){if(typeof e.ref=="string"&&G.current&&r&&G.current.stateNode!==r){var t=I(G.current.type);ue[t]||(p('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',I(G.current.type),e.ref),ue[t]=!0)}}function rr(e,r){{var t=function(){Ce||(Ce=!0,p("%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 tr(e,r){{var t=function(){je||(je=!0,p("%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 nr=function(e,r,t,n,o,s,i){var a={$$typeof:h,type:e,key:r,ref:t,props:i,_owner:s};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 ar(e,r,t,n,o){{var s,i={},a=null,R=null;t!==void 0&&(Oe(t),a=""+t),qe(r)&&(Oe(r.key),a=""+r.key),$e(r)&&(R=r.ref,er(r,o));for(s in r)q.call(r,s)&&!Qe.hasOwnProperty(s)&&(i[s]=r[s]);if(e&&e.defaultProps){var f=e.defaultProps;for(s in f)i[s]===void 0&&(i[s]=f[s])}if(a||R){var l=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&rr(i,l),R&&tr(i,l)}return nr(e,a,R,o,n,G.current,i)}}var ce=w.ReactCurrentOwner,Se=w.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=$(e.type,e._source,r?r.type:null);Se.setExtraStackFrame(t)}else Se.setExtraStackFrame(null)}var fe;fe=!1;function le(e){return typeof e=="object"&&e!==null&&e.$$typeof===h}function ke(){{if(ce.current){var e=I(ce.current.type);if(e)return` | ||
Check the render method of \``+e+"`."}return""}}function ir(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` | ||
Check your code at `+r+":"+t+"."}return""}}var De={};function or(e){{var r=ke();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` | ||
Check the top-level render call using <`+t+">.")}return r}}function Ae(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(De[t])return;De[t]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+I(e._owner.type)+"."),M(e),p('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),M(null)}}function Fe(e,r){{if(typeof e!="object")return;if(se(e))for(var t=0;t<e.length;t++){var n=e[t];le(n)&&Ae(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 s=o.call(e),i;!(i=s.next()).done;)le(i.value)&&Ae(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===d||r.$$typeof===E))t=r.propTypes;else return;if(t){var n=I(r);He(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!fe){fe=!0;var o=I(r);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ur(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){M(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),M(null);break}}e.ref!==null&&(M(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}function Ie(e,r,t,n,o,s){{var i=S(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 R=ir(o);R?a+=R:a+=ke();var f;e===null?f="null":se(e)?f="array":e!==void 0&&e.$$typeof===h?(f="<"+(I(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):f=typeof e,p("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 l=ar(e,r,t,o,s);if(l==null)return l;if(i){var O=r.children;if(O!==void 0)if(n)if(se(O)){for(var U=0;U<O.length;U++)Fe(O[U],e);Object.freeze&&Object.freeze(O)}else p("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 Fe(O,e)}return e===T?ur(l):sr(l),l}}function cr(e,r,t){return Ie(e,r,t,!0)}function fr(e,r,t){return Ie(e,r,t,!1)}var lr=fr,dr=cr;V.Fragment=T,V.jsx=lr,V.jsxs=dr}()),V}var B={};/** | ||
* @license React | ||
* react-jsx-runtime.development.js | ||
* react-jsx-runtime.production.min.js | ||
* | ||
@@ -18,13 +28,3 @@ * Copyright (c) Facebook, Inc. and its affiliates. | ||
* 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 u=ve.default,g=Symbol.for("react.element"),_=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"),E=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),c=Symbol.for("react.offscreen"),p=Symbol.iterator,H="@@iterator";function D(e){if(e===null||typeof e!="object")return null;var r=p&&e[p]||e[H];return typeof r=="function"?r:null}var w=u.__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];ne("error",e,t)}}function ne(e,r,t){{var n=w.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",t=t.concat([o]));var s=t.map(function(i){return String(i)});s.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,s)}}var ae=!1,X=!1,K=!1,Z=!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===x||e===m||Z||e===c||ae||X||K||typeof e=="object"&&e!==null&&(e.$$typeof===C||e.$$typeof===R||e.$$typeof===k||e.$$typeof===E||e.$$typeof===v||e.$$typeof===S||e.getModuleId!==void 0))}function W(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 _:return"Portal";case A:return"Profiler";case P:return"StrictMode";case x:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case E:var r=e;return ge(r)+".Consumer";case k:var t=e;return ge(t._context)+".Provider";case v:return W(e,e.render,"ForwardRef");case R:var n=e.displayName||null;return n!==null?n:F(e.type)||"Memo";case C:{var o=e,s=o._payload,i=o._init;try{return F(i(s))}catch{return null}}}return null}var Y=Object.assign,B=0,me,ye,Ee,Re,be,_e,we;function Te(){}Te.__reactDisabledLog=!0;function Je(){{if(B===0){me=console.log,ye=console.info,Ee=console.warn,Re=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 He(){{if(B--,B===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},e,{value:me}),info:Y({},e,{value:ye}),warn:Y({},e,{value:Ee}),error:Y({},e,{value:Re}),group:Y({},e,{value:be}),groupCollapsed:Y({},e,{value:_e}),groupEnd:Y({},e,{value:we})})}B<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ie=w.ReactCurrentDispatcher,oe;function $(e,r,t){{if(oe===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);oe=n&&n[1]||""}return` | ||
`+oe+e}}var se=!1,Q;{var Xe=typeof WeakMap=="function"?WeakMap:Map;Q=new Xe}function Pe(e,r){if(!e||se)return"";{var t=Q.get(e);if(t!==void 0)return t}var n;se=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var s;s=ie.current,ie.current=null,Je();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 O=` | ||
`+a[f].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&Q.set(e,O),O}while(f>=1&&d>=0);break}}}finally{se=!1,ie.current=s,He(),Error.prepareStackTrace=o}var M=e?e.displayName||e.name:"",Ye=M?$(M):"";return typeof e=="function"&&Q.set(e,Ye),Ye}function Ke(e,r,t){return Pe(e,!1)}function Ze(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,Ze(e));if(typeof e=="string")return $(e);switch(e){case x:return $("Suspense");case m:return $("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Ke(e.render);case R:return q(e.type,r,t);case C:{var n=e,o=n._payload,s=n._init;try{return q(s(o),r,t)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,xe={},Oe=w.ReactDebugCurrentFrame;function re(e){if(e){var r=e._owner,t=q(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}function $e(e,r,t,n,o){{var s=Function.call.bind(ee);for(var i in e)if(s(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)&&(re(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),re(null)),a instanceof Error&&!(a.message in xe)&&(xe[a.message]=!0,re(o),h("Failed %s type: %s",t,a.message),re(null))}}}var Qe=Array.isArray;function ue(e){return Qe(e)}function qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function er(e){try{return Ce(e),!1}catch{return!0}}function Ce(e){return""+e}function Se(e){if(er(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(e)),Ce(e)}var z=w.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0},je,ke,ce;ce={};function tr(e){if(ee.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function nr(e){if(ee.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ar(e,r){if(typeof e.ref=="string"&&z.current&&r&&z.current.stateNode!==r){var t=F(z.current.type);ce[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),ce[t]=!0)}}function ir(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 or(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 sr=function(e,r,t,n,o,s,i){var a={$$typeof:g,type:e,key:r,ref:t,props:i,_owner:s};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 ur(e,r,t,n,o){{var s,i={},a=null,b=null;t!==void 0&&(Se(t),a=""+t),nr(r)&&(Se(r.key),a=""+r.key),tr(r)&&(b=r.ref,ar(r,o));for(s in r)ee.call(r,s)&&!rr.hasOwnProperty(s)&&(i[s]=r[s]);if(e&&e.defaultProps){var f=e.defaultProps;for(s in f)i[s]===void 0&&(i[s]=f[s])}if(a||b){var d=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ir(i,d),b&&or(i,d)}return sr(e,a,b,o,n,z.current,i)}}var fe=w.ReactCurrentOwner,De=w.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 le;le=!1;function de(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}function Ae(){{if(fe.current){var e=F(fe.current.type);if(e)return` | ||
Check the render method of \``+e+"`."}return""}}function cr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` | ||
Check your code at `+r+":"+t+"."}return""}}var Fe={};function fr(e){{var r=Ae();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` | ||
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=fr(r);if(Fe[t])return;Fe[t]=!0;var n="";e&&e._owner&&e._owner!==fe.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];de(n)&&Le(n,r)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var o=D(e);if(typeof o=="function"&&o!==e.entries)for(var s=o.call(e),i;!(i=s.next()).done;)de(i.value)&&Le(i.value,r)}}}function lr(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===R))t=r.propTypes;else return;if(t){var n=F(r);$e(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!le){le=!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 dr(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,s){{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=cr(o);b?a+=b:a+=Ae();var f;e===null?f="null":ue(e)?f="array":e!==void 0&&e.$$typeof===g?(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=ur(e,r,t,o,s);if(d==null)return d;if(i){var O=r.children;if(O!==void 0)if(n)if(ue(O)){for(var M=0;M<O.length;M++)Ie(O[M],e);Object.freeze&&Object.freeze(O)}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(O,e)}return e===T?dr(d):lr(d),d}}function vr(e,r,t){return We(e,r,t,!0)}function pr(e,r,t){return We(e,r,t,!1)}var hr=pr,gr=vr;V.Fragment=T,V.jsx=hr,V.jsxs=gr}()),V}(function(u){process.env.NODE_ENV==="production"?u.exports=Ne():u.exports=Me()})(J);const Ue=J.exports.Fragment,I=J.exports.jsx,Ve=J.exports.jsxs,Be=String.raw;function ze({child:u,sliderWidth:g,sliderHeight:_,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 Ve(Ue,{children:[I("style",{children:Be` | ||
*/var ve;function Ye(){if(ve)return B;ve=1;var b=u,h=Symbol.for("react.element"),_=Symbol.for("react.fragment"),T=Object.prototype.hasOwnProperty,P=b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,F={key:!0,ref:!0,__self:!0,__source:!0};function k(y,d,x){var g,E={},C=null,c=null;x!==void 0&&(C=""+x),d.key!==void 0&&(C=""+d.key),d.ref!==void 0&&(c=d.ref);for(g in d)T.call(d,g)&&!F.hasOwnProperty(g)&&(E[g]=d[g]);if(y&&y.defaultProps)for(g in d=y.defaultProps,d)E[g]===void 0&&(E[g]=d[g]);return{$$typeof:h,type:y,key:C,ref:c,props:E,_owner:P.current}}return B.Fragment=_,B.jsx=k,B.jsxs=k,B}process.env.NODE_ENV==="production"?W.exports=Ye():W.exports=We();var A=W.exports;const Ne=String.raw;function Me({child:b,sliderWidth:h,sliderHeight:_,scaleOnDrag:T=!1}){const P=u.useRef(null),F=()=>{T&&P.current&&(P.current.style.transform="scale(0.9)")},k=()=>{T&&P.current&&(P.current.style.transform="scale(1)")};return A.jsxs(A.Fragment,{children:[A.jsx("style",{children:Ne` | ||
.rtds-single-slide-styles img { | ||
@@ -34,2 +34,2 @@ max-width: 100%; | ||
} | ||
`}),I("div",{ref:P,style:{width:`${g}px`,height:`${_}px`,transition:"transform 0.2s ease-out"},className:"rtds-single-slide-styles",children:I("div",{style:{padding:"1rem",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},onPointerDown:A,onPointerUp:k,onPointerLeave:k,onDragStart:E=>(E.preventDefault(),E.stopPropagation(),!1),children:u})})]})}function te(u){const g=u.clientWidth,_=u.clientHeight;return{width:g,height:_}}function Ge({children:u,onSlideComplete:g,onSlideStart:_,activeIndex:T=null,threshHold:P=100,transition:A=.3,scaleOnDrag:k=!1}){const[E,v]=l.useState({width:0,height:0}),x=l.useRef(!1),m=l.useRef(0),R=l.useRef(0),C=l.useRef(0),c=l.useRef(0),p=l.useRef(null),H=l.useRef(null),D=l.useCallback((y=E.width)=>{R.current=c.current*-y,C.current=R.current,Z()},[E.width]),w=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&&(w(),c.current=T,D())},[T,D,w]),l.useLayoutEffect(()=>{p.current&&(h(),v(te(p.current)),D(te(p.current).width))},[D]),l.useEffect(()=>{const y=()=>{if(h(),p.current){const{width:j,height:W}=te(p.current);v({width:j,height:W}),D(j)}},S=({key:j})=>{const W=["ArrowRight","ArrowLeft"].includes(j);W&&w(),W&&_&&_(c.current),j==="ArrowRight"&&c.current<u.length-1&&(c.current+=1),j==="ArrowLeft"&&c.current>0&&(c.current-=1),W&&g&&g(c.current),D()};return window.addEventListener("resize",y),window.addEventListener("keydown",S),()=>{window.removeEventListener("resize",y),window.removeEventListener("keydown",S)}},[u.length,D,g,_,w]);function ne(y){return function(S){w(),c.current=y,m.current=S.pageX,x.current=!0,H.current=requestAnimationFrame(K),p.current&&(p.current.style.cursor="grabbing"),_&&_(c.current)}}function ae(y){if(x.current){const S=y.pageX;R.current=C.current+S-m.current}}function X(){w(),cancelAnimationFrame(H.current),x.current=!1;const y=R.current-C.current;y<-P&&c.current<u.length-1&&(c.current+=1),y>P&&c.current>0&&(c.current-=1),w(),D(),p.current.style.cursor="grab",g&&g(c.current)}function K(){Z(),x.current&&requestAnimationFrame(K)}function Z(){!p.current||(p.current.style.transform=`translateX(${R.current}px)`)}return I("div",{className:"rtds-slider-wrapper",style:{overflow:"hidden",width:"100%",height:"100%",maxHeight:"100vh"},children:I("div",{"data-testid":"slider",ref:p,className:"rtds-slider-styles",style:{all:"initial",width:"100%",height:"100%",maxHeight:"100vh",display:"inline-flex",willChange:"transform, scale",cursor:"grab"},children:u.map((y,S)=>I("div",{onPointerDown:ne(S),onPointerMove:ae,onPointerUp:X,onPointerLeave:()=>{x.current&&X()},onContextMenu:j=>{j.preventDefault(),j.stopPropagation()},className:"slide-outer",style:{touchAction:"none"},children:I(ze,{child:y,sliderWidth:E.width,sliderHeight:E.height,scaleOnDrag:k})},y.key))})})}return Ge}); | ||
`}),A.jsx("div",{ref:P,style:{width:`${h}px`,height:`${_}px`,transition:"transform 0.2s ease-out"},className:"rtds-single-slide-styles",children:A.jsx("div",{style:{padding:"1rem",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},onPointerDown:F,onPointerUp:k,onPointerLeave:k,onDragStart:y=>(y.preventDefault(),y.stopPropagation(),!1),children:b})})]})}function re(b){const h=b.clientWidth,_=b.clientHeight;return{width:h,height:_}}function Ue({children:b,onSlideComplete:h,onSlideStart:_,activeIndex:T=null,threshHold:P=100,transition:F=.3,scaleOnDrag:k=!1}){const[y,d]=u.useState({width:0,height:0}),x=u.useRef(!1),g=u.useRef(0),E=u.useRef(0),C=u.useRef(0),c=u.useRef(0),v=u.useRef(null),J=u.useRef(null),D=u.useCallback((m=y.width)=>{E.current=c.current*-m,C.current=E.current,K()},[y.width]),w=u.useCallback(()=>{v.current&&(v.current.style.transition=`transform ${F}s ease-out`)},[F]),p=()=>{v.current&&(v.current.style.transition="none")};u.useEffect(()=>{T!==c.current&&(w(),c.current=T,D())},[T,D,w]),u.useLayoutEffect(()=>{v.current&&(p(),d(re(v.current)),D(re(v.current).width))},[D]),u.useEffect(()=>{const m=()=>{if(p(),v.current){const{width:S,height:Y}=re(v.current);d({width:S,height:Y}),D(S)}},j=({key:S})=>{const Y=["ArrowRight","ArrowLeft"].includes(S);Y&&w(),Y&&_&&_(c.current),S==="ArrowRight"&&c.current<b.length-1&&(c.current+=1),S==="ArrowLeft"&&c.current>0&&(c.current-=1),Y&&h&&h(c.current),D()};return window.addEventListener("resize",m),window.addEventListener("keydown",j),()=>{window.removeEventListener("resize",m),window.removeEventListener("keydown",j)}},[b.length,D,h,_,w]);function te(m){return function(j){w(),c.current=m,g.current=j.pageX,x.current=!0,J.current=requestAnimationFrame(X),v.current&&(v.current.style.cursor="grabbing"),_&&_(c.current)}}function ne(m){if(x.current){const j=m.pageX;E.current=C.current+j-g.current}}function H(){w(),cancelAnimationFrame(J.current),x.current=!1;const m=E.current-C.current;m<-P&&c.current<b.length-1&&(c.current+=1),m>P&&c.current>0&&(c.current-=1),w(),D(),v.current.style.cursor="grab",h&&h(c.current)}function X(){K(),x.current&&requestAnimationFrame(X)}function K(){v.current&&(v.current.style.transform=`translateX(${E.current}px)`)}return A.jsx("div",{style:{overflow:"hidden",width:"100%",height:"100%",maxHeight:"100vh"},children:A.jsx("div",{"data-testid":"slider",ref:v,style:{all:"initial",width:"100%",height:"100%",maxHeight:"100vh",display:"inline-flex",willChange:"transform, scale",cursor:"grab"},children:b.map((m,j)=>A.jsx("div",{onPointerDown:te(j),onPointerMove:ne,onPointerUp:H,onPointerLeave:()=>{x.current&&H()},onContextMenu:S=>{S.preventDefault(),S.stopPropagation()},className:"slide-outer",style:{touchAction:"none"},children:A.jsx(Me,{child:m,sliderWidth:y.width,sliderHeight:y.height,scaleOnDrag:k})},m.key))})})}return Ue}); |
@@ -7,3 +7,3 @@ interface SlideProps { | ||
} | ||
declare function Slide({ child, sliderWidth, sliderHeight, scaleOnDrag, }: SlideProps): JSX.Element; | ||
declare function Slide({ child, sliderWidth, sliderHeight, scaleOnDrag, }: SlideProps): import("react/jsx-runtime").JSX.Element; | ||
export default Slide; |
@@ -26,3 +26,3 @@ interface SliderProps { | ||
*/ | ||
declare function Slider({ children, onSlideComplete, onSlideStart, activeIndex, threshHold, transition, scaleOnDrag, }: SliderProps): JSX.Element; | ||
declare function Slider({ children, onSlideComplete, onSlideStart, activeIndex, threshHold, transition, scaleOnDrag, }: SliderProps): import("react/jsx-runtime").JSX.Element; | ||
export default Slider; |
{ | ||
"name": "react-touch-drag-slider", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"description": "Touch and drag slider carousel component for React", | ||
@@ -20,2 +20,9 @@ "author": "bushblade", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite --host", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview", | ||
"test": "vitest", | ||
"test:ui": "vitest --ui" | ||
}, | ||
"dependencies": { | ||
@@ -30,19 +37,19 @@ "react": "^18.2.0", | ||
"devDependencies": { | ||
"@testing-library/react": "^13.4.0", | ||
"@types/jsdom": "^20.0.0", | ||
"@types/react": "^18.0.21", | ||
"@types/react-dom": "^18.0.6", | ||
"@typescript-eslint/eslint-plugin": "^5.38.0", | ||
"@typescript-eslint/parser": "^5.38.0", | ||
"@vitejs/plugin-react": "^2.1.0", | ||
"@vitest/ui": "^0.23.4", | ||
"eslint": "^8.24.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-react": "^7.31.8", | ||
"@testing-library/react": "^14.1.2", | ||
"@types/jsdom": "^21.1.6", | ||
"@types/react": "^18.2.43", | ||
"@types/react-dom": "^18.2.17", | ||
"@typescript-eslint/eslint-plugin": "^6.14.0", | ||
"@typescript-eslint/parser": "^6.14.0", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
"@vitest/ui": "^1.0.4", | ||
"eslint": "^8.55.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"jsdom": "^20.0.0", | ||
"typescript": "^4.8.3", | ||
"vite": "^3.1.3", | ||
"vite-plugin-dts": "^1.5.0", | ||
"vitest": "^0.23.4" | ||
"jsdom": "^23.0.1", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.0.8", | ||
"vite-plugin-dts": "^3.6.4", | ||
"vitest": "^1.0.4" | ||
}, | ||
@@ -60,10 +67,3 @@ "files": [ | ||
} | ||
}, | ||
"scripts": { | ||
"dev": "vite --host", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview", | ||
"test": "vitest", | ||
"test:ui": "vitest --ui" | ||
} | ||
} | ||
} |
@@ -12,3 +12,3 @@ # react-touch-drag-slider | ||
- Sizes to any size parent container | ||
- small bundle size with minimal dependencies | ||
- small bundle size with zero dependencies | ||
@@ -28,3 +28,5 @@ ## Install | ||
// here we are importing some images | ||
// but the Slider children can be an array of any element nodes, or your own components | ||
// but the Slider children can be an array of any element nodes, | ||
// or your own components | ||
import images from './images' | ||
@@ -31,0 +33,0 @@ |
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
50666
13
954
78