paradiego

This commit is contained in:
2024-09-18 13:34:19 -03:00
commit 3f0e204289
12510 changed files with 1486101 additions and 0 deletions

View File

@@ -0,0 +1 @@
export { default } from './useScrollTrigger';

1
node_modules/@mui/material/useScrollTrigger/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export { default } from "./useScrollTrigger.js";

View File

@@ -0,0 +1,6 @@
{
"sideEffects": false,
"module": "./index.js",
"main": "../node/useScrollTrigger/index.js",
"types": "./index.d.ts"
}

View File

@@ -0,0 +1,7 @@
export interface UseScrollTriggerOptions {
disableHysteresis?: boolean;
target?: Node | Window;
threshold?: number;
}
export default function useScrollTrigger(options?: UseScrollTriggerOptions): boolean;

View File

@@ -0,0 +1,51 @@
'use client';
import * as React from 'react';
function defaultTrigger(store, options) {
const {
disableHysteresis = false,
threshold = 100,
target
} = options;
const previous = store.current;
if (target) {
// Get vertical scroll
store.current = target.pageYOffset !== undefined ? target.pageYOffset : target.scrollTop;
}
if (!disableHysteresis && previous !== undefined) {
if (store.current < previous) {
return false;
}
}
return store.current > threshold;
}
const defaultTarget = typeof window !== 'undefined' ? window : null;
export default function useScrollTrigger(options = {}) {
const {
getTrigger = defaultTrigger,
target = defaultTarget,
...other
} = options;
const store = React.useRef();
const [trigger, setTrigger] = React.useState(() => getTrigger(store, other));
React.useEffect(() => {
const handleScroll = () => {
setTrigger(getTrigger(store, {
target,
...other
}));
};
handleScroll(); // Re-evaluate trigger when dependencies change
target.addEventListener('scroll', handleScroll, {
passive: true
});
return () => {
target.removeEventListener('scroll', handleScroll, {
passive: true
});
};
// See Option 3. https://github.com/facebook/react/issues/14476#issuecomment-471199055
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [target, getTrigger, JSON.stringify(other)]);
return trigger;
}