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

@maxweek/react-scroller

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maxweek/react-scroller - npm Package Compare versions

Comparing version 1.1.25 to 1.1.27

373

dist/react-scroller.js

@@ -1,3 +0,3 @@

import We, { forwardRef as fr, useRef as ee, useState as dr, useEffect as U, useImperativeHandle as vr } from "react";
var ve = { exports: {} }, V = {};
import We, { forwardRef as fr, useRef as ae, useState as dr, useEffect as B, useImperativeHandle as vr } from "react";
var me = { exports: {} }, q = {};
/**

@@ -15,8 +15,8 @@ * @license React

if (Ye)
return V;
return q;
Ye = 1;
var o = We, w = Symbol.for("react.element"), t = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, x = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, R = { key: !0, ref: !0, __self: !0, __source: !0 };
function k(_, g, T) {
var m, y = {}, S = null, D = null;
T !== void 0 && (S = "" + T), g.key !== void 0 && (S = "" + g.key), g.ref !== void 0 && (D = g.ref);
var o = We, P = Symbol.for("react.element"), t = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, k = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, R = { key: !0, ref: !0, __self: !0, __source: !0 };
function F(_, g, T) {
var m, y = {}, S = null, A = null;
T !== void 0 && (S = "" + T), g.key !== void 0 && (S = "" + g.key), g.ref !== void 0 && (A = g.ref);
for (m in g)

@@ -27,7 +27,7 @@ l.call(g, m) && !R.hasOwnProperty(m) && (y[m] = g[m]);

y[m] === void 0 && (y[m] = g[m]);
return { $$typeof: w, type: _, key: S, ref: D, props: y, _owner: x.current };
return { $$typeof: P, type: _, key: S, ref: A, props: y, _owner: k.current };
}
return V.Fragment = t, V.jsx = k, V.jsxs = k, V;
return q.Fragment = t, q.jsx = F, q.jsxs = F, q;
}
var B = {};
var J = {};
/**

@@ -45,10 +45,10 @@ * @license React

return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() {
var o = We, w = Symbol.for("react.element"), t = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), _ = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), N = Symbol.iterator, q = "@@iterator";
function J(e) {
var o = We, P = Symbol.for("react.element"), t = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), F = Symbol.for("react.provider"), _ = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), M = Symbol.iterator, G = "@@iterator";
function K(e) {
if (e === null || typeof e != "object")
return null;
var r = N && e[N] || e[q];
var r = M && e[M] || e[G];
return typeof r == "function" ? r : null;
}
var C = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
var x = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function b(e) {

@@ -58,8 +58,8 @@ {

n[i - 1] = arguments[i];
ne("error", e, n);
le("error", e, n);
}
}
function ne(e, r, n) {
function le(e, r, n) {
{
var i = C.ReactDebugCurrentFrame, c = i.getStackAddendum();
var i = x.ReactDebugCurrentFrame, c = i.getStackAddendum();
c !== "" && (r += "%s", n = n.concat([c]));

@@ -72,6 +72,6 @@ var f = n.map(function(s) {

}
var L = !1, Y = !1, F = !1, ae = !1, a = !1, d;
var $ = !1, W = !1, Y = !1, ue = !1, a = !1, d;
d = Symbol.for("react.module.reference");
function A(e) {
return !!(typeof e == "string" || typeof e == "function" || e === l || e === R || a || e === x || e === T || e === m || ae || e === D || L || Y || F || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === y || e.$$typeof === k || e.$$typeof === _ || e.$$typeof === g || // This needs to include all possible module reference object
function C(e) {
return !!(typeof e == "string" || typeof e == "function" || e === l || e === R || a || e === k || e === T || e === m || ue || e === A || $ || W || Y || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === y || e.$$typeof === F || e.$$typeof === _ || e.$$typeof === g || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since

@@ -82,3 +82,3 @@ // we don't know which Flight build this will end up being used

}
function z(e, r, n) {
function D(e, r, n) {
var i = e.displayName;

@@ -90,6 +90,6 @@ if (i)

}
function he(e) {
function X(e) {
return e.displayName || "Context";
}
function O(e) {
function w(e) {
if (e == null)

@@ -108,3 +108,3 @@ return null;

return "Profiler";
case x:
case k:
return "StrictMode";

@@ -120,15 +120,15 @@ case T:

var r = e;
return he(r) + ".Consumer";
case k:
return X(r) + ".Consumer";
case F:
var n = e;
return he(n._context) + ".Provider";
return X(n._context) + ".Provider";
case g:
return z(e, e.render, "ForwardRef");
return D(e, e.render, "ForwardRef");
case y:
var i = e.displayName || null;
return i !== null ? i : O(e.type) || "Memo";
return i !== null ? i : w(e.type) || "Memo";
case S: {
var c = e, f = c._payload, s = c._init;
try {
return O(s(f));
return w(s(f));
} catch {

@@ -141,3 +141,3 @@ return null;

}
var $ = Object.assign, M = 0, ge, be, me, Ee, Re, _e, ye;
var O = Object.assign, I = 0, H, Z, U, Ee, Re, _e, ye;
function pe() {

@@ -148,4 +148,4 @@ }

{
if (M === 0) {
ge = console.log, be = console.info, me = console.warn, Ee = console.error, Re = console.group, _e = console.groupCollapsed, ye = console.groupEnd;
if (I === 0) {
H = console.log, Z = console.info, U = console.warn, Ee = console.error, Re = console.group, _e = console.groupCollapsed, ye = console.groupEnd;
var e = {

@@ -167,3 +167,3 @@ configurable: !0,

}
M++;
I++;
}

@@ -173,3 +173,3 @@ }

{
if (M--, M === 0) {
if (I--, I === 0) {
var e = {

@@ -181,21 +181,21 @@ configurable: !0,

Object.defineProperties(console, {
log: $({}, e, {
value: ge
log: O({}, e, {
value: H
}),
info: $({}, e, {
value: be
info: O({}, e, {
value: Z
}),
warn: $({}, e, {
value: me
warn: O({}, e, {
value: U
}),
error: $({}, e, {
error: O({}, e, {
value: Ee
}),
group: $({}, e, {
group: O({}, e, {
value: Re
}),
groupCollapsed: $({}, e, {
groupCollapsed: O({}, e, {
value: _e
}),
groupEnd: $({}, e, {
groupEnd: O({}, e, {
value: ye

@@ -205,9 +205,9 @@ })

}
M < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
I < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var oe = C.ReactCurrentDispatcher, ie;
function G(e, r, n) {
var se = x.ReactCurrentDispatcher, ce;
function Q(e, r, n) {
{
if (ie === void 0)
if (ce === void 0)
try {

@@ -217,18 +217,18 @@ throw Error();

var i = c.stack.trim().match(/\n( *(at )?)/);
ie = i && i[1] || "";
ce = i && i[1] || "";
}
return `
` + ie + e;
` + ce + e;
}
}
var le = !1, K;
var fe = !1, ee;
{
var Me = typeof WeakMap == "function" ? WeakMap : Map;
K = new Me();
ee = new Me();
}
function we(e, r) {
if (!e || le)
if (!e || fe)
return "";
{
var n = K.get(e);
var n = ee.get(e);
if (n !== void 0)

@@ -238,7 +238,7 @@ return n;

var i;
le = !0;
fe = !0;
var c = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var f;
f = oe.current, oe.current = null, Ne();
f = se.current, se.current = null, Ne();
try {

@@ -256,4 +256,4 @@ if (r) {

Reflect.construct(s, []);
} catch (P) {
i = P;
} catch (j) {
i = j;
}

@@ -264,4 +264,4 @@ Reflect.construct(e, [], s);

s.call();
} catch (P) {
i = P;
} catch (j) {
i = j;
}

@@ -273,10 +273,10 @@ e.call(s.prototype);

throw Error();
} catch (P) {
i = P;
} catch (j) {
i = j;
}
e();
}
} catch (P) {
if (P && i && typeof P.stack == "string") {
for (var u = P.stack.split(`
} catch (j) {
if (j && i && typeof j.stack == "string") {
for (var u = j.stack.split(`
`), E = i.stack.split(`

@@ -292,3 +292,3 @@ `), v = u.length - 1, h = E.length - 1; v >= 1 && h >= 0 && u[v] !== E[h]; )

` + u[v].replace(" at new ", " at ");
return e.displayName && p.includes("<anonymous>") && (p = p.replace("<anonymous>", e.displayName)), typeof e == "function" && K.set(e, p), p;
return e.displayName && p.includes("<anonymous>") && (p = p.replace("<anonymous>", e.displayName)), typeof e == "function" && ee.set(e, p), p;
}

@@ -300,6 +300,6 @@ while (v >= 1 && h >= 0);

} finally {
le = !1, oe.current = f, ze(), Error.prepareStackTrace = c;
fe = !1, se.current = f, ze(), Error.prepareStackTrace = c;
}
var W = e ? e.displayName || e.name : "", $e = W ? G(W) : "";
return typeof e == "function" && K.set(e, $e), $e;
var z = e ? e.displayName || e.name : "", $e = z ? Q(z) : "";
return typeof e == "function" && ee.set(e, $e), $e;
}

@@ -313,3 +313,3 @@ function He(e, r, n) {

}
function X(e, r, n) {
function re(e, r, n) {
if (e == null)

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

if (typeof e == "string")
return G(e);
return Q(e);
switch (e) {
case T:
return G("Suspense");
return Q("Suspense");
case m:
return G("SuspenseList");
return Q("SuspenseList");
}

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

case y:
return X(e.type, r, n);
return re(e.type, r, n);
case S: {
var i = e, c = i._payload, f = i._init;
try {
return X(f(c), r, n);
return re(f(c), r, n);
} catch {

@@ -345,6 +345,6 @@ }

}
var Z = Object.prototype.hasOwnProperty, Te = {}, Se = C.ReactDebugCurrentFrame;
function Q(e) {
var te = Object.prototype.hasOwnProperty, Te = {}, Se = x.ReactDebugCurrentFrame;
function ne(e) {
if (e) {
var r = e._owner, n = X(e.type, e._source, r ? r.type : null);
var r = e._owner, n = re(e.type, e._source, r ? r.type : null);
Se.setExtraStackFrame(n);

@@ -356,3 +356,3 @@ } else

{
var f = Function.call.bind(Z);
var f = Function.call.bind(te);
for (var s in e)

@@ -370,3 +370,3 @@ if (f(e, s)) {

}
u && !(u instanceof Error) && (Q(c), b("%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).", i || "React class", n, s, typeof u), Q(null)), u instanceof Error && !(u.message in Te) && (Te[u.message] = !0, Q(c), b("Failed %s type: %s", n, u.message), Q(null));
u && !(u instanceof Error) && (ne(c), b("%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).", i || "React class", n, s, typeof u), ne(null)), u instanceof Error && !(u.message in Te) && (Te[u.message] = !0, ne(c), b("Failed %s type: %s", n, u.message), ne(null));
}

@@ -376,3 +376,3 @@ }

var Be = Array.isArray;
function ue(e) {
function de(e) {
return Be(e);

@@ -400,3 +400,3 @@ }

}
var H = C.ReactCurrentOwner, Ge = {
var V = x.ReactCurrentOwner, Ge = {
key: !0,

@@ -406,6 +406,6 @@ ref: !0,

__source: !0
}, Pe, xe, se;
se = {};
}, Pe, xe, ve;
ve = {};
function Ke(e) {
if (Z.call(e, "ref")) {
if (te.call(e, "ref")) {
var r = Object.getOwnPropertyDescriptor(e, "ref").get;

@@ -418,3 +418,3 @@ if (r && r.isReactWarning)

function Xe(e) {
if (Z.call(e, "key")) {
if (te.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;

@@ -427,5 +427,5 @@ if (r && r.isReactWarning)

function Ze(e, r) {
if (typeof e.ref == "string" && H.current && r && H.current.stateNode !== r) {
var n = O(H.current.type);
se[n] || (b('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', O(H.current.type), e.ref), se[n] = !0);
if (typeof e.ref == "string" && V.current && r && V.current.stateNode !== r) {
var n = w(V.current.type);
ve[n] || (b('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', w(V.current.type), e.ref), ve[n] = !0);
}

@@ -458,3 +458,3 @@ }

// This tag allows us to uniquely identify this as a React Element
$$typeof: w,
$$typeof: P,
// Built-in properties that belong on the element

@@ -490,3 +490,3 @@ type: e,

for (f in r)
Z.call(r, f) && !Ge.hasOwnProperty(f) && (s[f] = r[f]);
te.call(r, f) && !Ge.hasOwnProperty(f) && (s[f] = r[f]);
if (e && e.defaultProps) {

@@ -501,9 +501,9 @@ var v = e.defaultProps;

}
return rr(e, u, E, c, i, H.current, s);
return rr(e, u, E, c, i, V.current, s);
}
}
var ce = C.ReactCurrentOwner, je = C.ReactDebugCurrentFrame;
function I(e) {
var he = x.ReactCurrentOwner, je = x.ReactDebugCurrentFrame;
function N(e) {
if (e) {
var r = e._owner, n = X(e.type, e._source, r ? r.type : null);
var r = e._owner, n = re(e.type, e._source, r ? r.type : null);
je.setExtraStackFrame(n);

@@ -513,11 +513,11 @@ } else

}
var fe;
fe = !1;
function de(e) {
return typeof e == "object" && e !== null && e.$$typeof === w;
var ge;
ge = !1;
function be(e) {
return typeof e == "object" && e !== null && e.$$typeof === P;
}
function ke() {
{
if (ce.current) {
var e = O(ce.current.type);
if (he.current) {
var e = w(he.current.type);
if (e)

@@ -565,3 +565,3 @@ return `

var i = "";
e && e._owner && e._owner !== ce.current && (i = " It was passed a child from " + O(e._owner.type) + "."), I(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, i), I(null);
e && e._owner && e._owner !== he.current && (i = " It was passed a child from " + w(e._owner.type) + "."), N(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, i), N(null);
}

@@ -573,14 +573,14 @@ }

return;
if (ue(e))
if (de(e))
for (var n = 0; n < e.length; n++) {
var i = e[n];
de(i) && Le(i, r);
be(i) && Le(i, r);
}
else if (de(e))
else if (be(e))
e._store && (e._store.validated = !0);
else if (e) {
var c = J(e);
var c = K(e);
if (typeof c == "function" && c !== e.entries)
for (var f = c.call(e), s; !(s = f.next()).done; )
de(s.value) && Le(s.value, r);
be(s.value) && Le(s.value, r);
}

@@ -604,7 +604,7 @@ }

if (n) {
var i = O(r);
var i = w(r);
Ve(n, e.props, "prop", i, e);
} else if (r.PropTypes !== void 0 && !fe) {
fe = !0;
var c = O(r);
} else if (r.PropTypes !== void 0 && !ge) {
ge = !0;
var c = w(r);
b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", c || "Unknown");

@@ -620,7 +620,7 @@ }

if (i !== "children" && i !== "key") {
I(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", i), I(null);
N(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", i), N(null);
break;
}
}
e.ref !== null && (I(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), I(null));
e.ref !== null && (N(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), N(null));
}

@@ -630,3 +630,3 @@ }

{
var s = A(e);
var s = C(e);
if (!s) {

@@ -638,3 +638,3 @@ var u = "";

var v;
e === null ? v = "null" : ue(e) ? v = "array" : e !== void 0 && e.$$typeof === w ? (v = "<" + (O(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : v = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, u);
e === null ? v = "null" : de(e) ? v = "array" : e !== void 0 && e.$$typeof === P ? (v = "<" + (w(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : v = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, u);
}

@@ -648,5 +648,5 @@ var h = tr(e, r, n, c, f);

if (i)
if (ue(p)) {
for (var W = 0; W < p.length; W++)
Fe(p[W], e);
if (de(p)) {
for (var z = 0; z < p.length; z++)
Fe(p[z], e);
Object.freeze && Object.freeze(p);

@@ -668,15 +668,15 @@ } else

var sr = ur, cr = lr;
B.Fragment = l, B.jsx = sr, B.jsxs = cr;
}()), B;
J.Fragment = l, J.jsx = sr, J.jsxs = cr;
}()), J;
}
process.env.NODE_ENV === "production" ? ve.exports = hr() : ve.exports = gr();
var re = ve.exports;
function j(o, w, t = "") {
return o ? `__${w}` : t ? `__${t}` : "";
process.env.NODE_ENV === "production" ? me.exports = hr() : me.exports = gr();
var oe = me.exports;
function L(o, P, t = "") {
return o ? `__${P}` : t ? `__${t}` : "";
}
function te(o) {
function ie(o) {
return o || "";
}
const mr = fr((o, w) => {
const t = ee({
const mr = fr((o, P) => {
const t = ae({
height: 0,

@@ -700,7 +700,7 @@ top: 0,

}
}).current, l = ee(null), x = ee(null), R = ee(null), [k, _] = dr(!1);
U(() => {
}).current, l = ae(null), k = ae(null), R = ae(null), [F, _] = dr(!1);
B(() => {
window.addEventListener("pointerup", m), window.addEventListener("pointermove", S), window.addEventListener("touchmove", y, { passive: !1 });
const a = new ResizeObserver((d) => {
t.inited && (L(), F());
t.inited && ($(), Y());
});

@@ -711,42 +711,45 @@ if (l.current)

};
}, []), U(() => {
}, []), B(() => {
let a = l.current;
if (a)
return o.horizontal && a.addEventListener("wheel", J), a.addEventListener("scroll", C), o.grab && a.addEventListener("pointerdown", D), () => {
a && (a.removeEventListener("scroll", C), o.horizontal && a.removeEventListener("wheel", J), o.grab && a.removeEventListener("pointerdown", D));
return o.horizontal && a.addEventListener("wheel", K), a.addEventListener("scroll", x), o.grab && a.addEventListener("pointerdown", A), () => {
a && (a.removeEventListener("scroll", x), o.horizontal && a.removeEventListener("wheel", K), o.grab && a.removeEventListener("pointerdown", A));
};
}, [l.current]), U(() => {
}, [l.current]), B(() => {
let a = R.current;
if (a)
return a.addEventListener("pointerdown", N), () => {
a && a.removeEventListener("pointerdown", N);
return a.addEventListener("pointerdown", M), () => {
a && a.removeEventListener("pointerdown", M);
};
}, [R.current]), U(() => {
let a = x.current;
}, [R.current]), B(() => {
let a = k.current;
if (a)
return a.addEventListener("wheel", q), () => {
a && a.removeEventListener("wheel", q);
return a.addEventListener("wheel", G), () => {
a && a.removeEventListener("wheel", G);
};
}, [x.current]), U(() => {
L(), F();
}, [k.current]), B(() => {
$(), Y();
}, [o.children]);
const g = () => {
L(), F();
}, T = (a) => {
$(), Y();
}, T = (a, d = 300) => {
if (!l.current)
return;
let d = {
behavior: "smooth"
const C = o.horizontal, D = C ? l.current.scrollLeft : l.current.scrollTop, X = a - D, w = performance.now(), O = (I) => {
if (!l.current)
return;
const H = I - w, Z = Math.min(H / d, 1), U = D + X * Z;
C ? l.current.scrollLeft = U : l.current.scrollTop = U, H < d && requestAnimationFrame(O);
};
o.horizontal ? d.left = a : d.top = a, l.current.scrollTo(d);
requestAnimationFrame(O);
};
vr(w, () => (console.log(w, "TEST"), {
scrollTo: (a) => {
T(a);
vr(P, () => ({
scrollTo: (a, d) => {
T(a, d);
},
scrollToStart: () => {
T(0);
scrollToStart: (a) => {
T(0, a);
},
scrollToEnd: () => {
T(t.height);
scrollToEnd: (a) => {
T(t.height, a);
},

@@ -765,24 +768,24 @@ update: () => {

}, S = (a) => {
l.current && (t.bar.clicked && (t.bar.offset = Y(a), t.bar.offsetDelta = t.bar.offsetStart - t.bar.offset, o.horizontal ? l.current.scrollLeft = t.scrollStart + -t.bar.offsetDelta / t.boxHeight * t.height : l.current.scrollTop = t.scrollStart + -t.bar.offsetDelta / t.boxHeight * t.height), t.grab && (t.grabOffset = Y(a), t.grabDelta = t.grabStart - t.grabOffset, o.horizontal ? l.current.scrollLeft = t.scrollStart + t.grabDelta : l.current.scrollTop = t.scrollStart + t.grabDelta));
}, D = (a) => {
l.current && (t.bar.clicked || (t.grab = !0, t.grabStart = Y(a), o.horizontal ? t.scrollStart = l.current.scrollLeft : t.scrollStart = l.current.scrollTop, l.current.classList.add("__grabbing")));
}, N = (a) => {
l.current && (t.bar.clicked = !0, t.bar.offsetStart = Y(a), o.horizontal ? t.scrollStart = l.current.scrollLeft : t.scrollStart = l.current.scrollTop);
}, q = (a) => {
l.current && (t.bar.clicked && (t.bar.offset = W(a), t.bar.offsetDelta = t.bar.offsetStart - t.bar.offset, o.horizontal ? l.current.scrollLeft = t.scrollStart + -t.bar.offsetDelta / t.boxHeight * t.height : l.current.scrollTop = t.scrollStart + -t.bar.offsetDelta / t.boxHeight * t.height), t.grab && (t.grabOffset = W(a), t.grabDelta = t.grabStart - t.grabOffset, o.horizontal ? l.current.scrollLeft = t.scrollStart + t.grabDelta : l.current.scrollTop = t.scrollStart + t.grabDelta));
}, A = (a) => {
l.current && (t.bar.clicked || (t.grab = !0, t.grabStart = W(a), o.horizontal ? t.scrollStart = l.current.scrollLeft : t.scrollStart = l.current.scrollTop, l.current.classList.add("__grabbing")));
}, M = (a) => {
l.current && (t.bar.clicked = !0, t.bar.offsetStart = W(a), o.horizontal ? t.scrollStart = l.current.scrollLeft : t.scrollStart = l.current.scrollTop);
}, G = (a) => {
a.preventDefault(), l.current && (o.horizontal ? l.current.scrollLeft += a.deltaX : l.current.scrollTop += a.deltaY);
}, J = (a) => {
}, K = (a) => {
let d = a;
if (d.shiftKey || !l.current || o.horizontal && !o.horizontalScroll)
return;
let A = d.wheelDeltaY, z = !1;
A ? A === d.deltaY * -3 && (z = !0) : d.deltaMode === 0 && (z = !0), z || (d.preventDefault(), l.current.scrollLeft += d.deltaY / 4), L(), F();
}, C = (a) => {
a.stopPropagation(), L(), F();
let C = d.wheelDeltaY, D = !1;
C ? C === d.deltaY * -3 && (D = !0) : d.deltaMode === 0 && (D = !0), D || (d.preventDefault(), l.current.scrollLeft += d.deltaY / 4), $(), Y();
}, x = (a) => {
a.stopPropagation(), $(), Y();
}, b = () => {
(o.showWhenMinimal || t.height > t.boxHeight) && (t.hovered = !0, _(!0));
}, ne = () => {
}, le = () => {
t.hovered = !1, !t.grab && (t.bar.clicked || _(!1));
}, L = () => {
}, $ = () => {
l.current && (o.horizontal ? (t.height = l.current.scrollWidth, t.top = l.current.scrollLeft, t.boxHeight = l.current.clientWidth) : (t.height = l.current.scrollHeight, t.top = l.current.scrollTop, t.boxHeight = l.current.clientHeight), t.progress = t.top / (t.height - t.boxHeight), t.inited = !0);
}, Y = (a) => {
}, W = (a) => {
if ("x" in a)

@@ -794,20 +797,20 @@ return o.horizontal ? a.x : a.y;

}
}, F = () => {
var a, d, A;
R.current && (t.bar.height = 100 / (t.height / t.boxHeight), o.horizontal ? (R.current.style.width = `${t.bar.height}%`, R.current.style.left = `${t.progress * 100 - t.progress * t.bar.height}%`) : (R.current.style.height = `${t.bar.height}%`, R.current.style.top = `${t.progress * 100 - t.progress * t.bar.height}%`), t.progress === 0 && ((a = o.onReachStart) == null || a.call(o)), t.progress === 1 && ((d = o.onReachEnd) == null || d.call(o)), (A = o.onScroll) == null || A.call(o, t.progress));
}, ae = [
}, Y = () => {
var a, d, C;
R.current && (t.bar.height = 100 / (t.height / t.boxHeight), o.horizontal ? (R.current.style.width = `${t.bar.height}%`, R.current.style.left = `${t.progress * 100 - t.progress * t.bar.height}%`) : (R.current.style.height = `${t.bar.height}%`, R.current.style.top = `${t.progress * 100 - t.progress * t.bar.height}%`), t.progress === 0 && ((a = o.onReachStart) == null || a.call(o)), t.progress === 1 && ((d = o.onReachEnd) == null || d.call(o)), (C = o.onScroll) == null || C.call(o, t.progress));
}, ue = [
"scroller",
te(o.className),
j(o.horizontal, "horizontal"),
j(o.needBar, "bar"),
j(o.grabCursor, "grab"),
j(o.autoHide, "autoHide"),
j(o.barAltPosition, "barAlt"),
j(o.borderPadding, "borderPadding"),
j(o.borderFade, "borderFade"),
j(k, "hovered")
ie(o.className),
L(o.horizontal, "horizontal"),
L(o.needBar, "bar"),
L(o.grabCursor, "grab"),
L(o.autoHide, "autoHide"),
L(o.barAltPosition, "barAlt"),
L(o.borderPadding, "borderPadding"),
L(o.borderFade, "borderFade"),
L(F, "hovered")
].join(" ");
return /* @__PURE__ */ re.jsxs("div", { className: ae, onPointerEnter: b, onPointerLeave: ne, children: [
o.needBar && /* @__PURE__ */ re.jsx("div", { className: `scroller__bar ${te(o.barClassName)}`, ref: x, children: /* @__PURE__ */ re.jsx("div", { className: `scroller__bar_roller ${te(o.barRollerClassName)}`, ref: R }) }),
/* @__PURE__ */ re.jsx("div", { className: `scroller__content ${te(o.contentClassName)}`, ref: l, children: o.children })
return /* @__PURE__ */ oe.jsxs("div", { className: ue, onPointerEnter: b, onPointerLeave: le, children: [
o.needBar && /* @__PURE__ */ oe.jsx("div", { className: `scroller__bar ${ie(o.barClassName)}`, ref: k, children: /* @__PURE__ */ oe.jsx("div", { className: `scroller__bar_roller ${ie(o.barRollerClassName)}`, ref: R }) }),
/* @__PURE__ */ oe.jsx("div", { className: `scroller__content ${ie(o.contentClassName)}`, ref: l, children: o.children })
] });

@@ -814,0 +817,0 @@ });

@@ -1,4 +0,4 @@

/// <reference types="react" />
import React from "react";
import "./styles.scss";
import { IScroller, IScrollerRef } from ".";
export declare const Scroller: import("react").ForwardRefExoticComponent<IScroller & import("react").RefAttributes<IScrollerRef>>;
export declare const Scroller: React.ForwardRefExoticComponent<IScroller & React.RefAttributes<IScrollerRef>>;
{
"name": "@maxweek/react-scroller",
"description": "Make your blocks scrolling easy, with a custom scroll-bar, based on native browser scroll",
"version": "1.1.25",
"version": "1.1.27",
"type": "module",

@@ -6,0 +6,0 @@ "author": "Max Nedelko",

@@ -39,2 +39,3 @@ # React-scroller

- [x] ResizeObserver
- [x] Scrolling Duration
- [ ] More Methods

@@ -111,5 +112,5 @@ - [ ] More Events

contentClassName={'your-scroller-content-class'}
onScroll={(progress: number) => console.log(`scroll progress ${progress}`)}
onReachStart={() => console.log('reach start')}
onReachEnd={() => console.log('reach end')}
onScroll={(progress: number, duration?: number) => console.log(`scroll progress ${progress}`)}
onReachStart={(duration?: number) => console.log('reach start')}
onReachEnd={(duration?: number) => console.log('reach end')}
>

@@ -192,9 +193,9 @@ {/* Your content */}

const scrollToStart = () => {
scrollerRef.current?.scrollToStart() // scroll to start
scrollerRef.current?.scrollToStart(2000) // scroll to start
}
const scrollToEnd = () => {
scrollerRef.current?.scrollToEnd() // scroll to end
scrollerRef.current?.scrollToEnd(2000) // scroll to end
}
const scrollTo = () => {
scrollerRef.current?.scrollTo(100) // scroll to 100px
scrollerRef.current?.scrollTo(100, 2000) // scroll to 100px
}

@@ -201,0 +202,0 @@ const update = () => {

Sorry, the diff of this file is not supported yet

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