@primer/react 0.0.0-20260219201217 → 0.0.0-20260219220240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/Autocomplete/Autocomplete.js +76 -159
- package/dist/Autocomplete/AutocompleteMenu.js +128 -333
- package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
- package/dist/Banner/Banner.js +64 -238
- package/dist/Button/Button.js +11 -34
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/Checkbox/Checkbox.js +55 -163
- package/dist/Dialog/Dialog.js +105 -347
- package/dist/PageLayout/PageLayout.js +622 -1560
- package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
- package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
- package/dist/hooks/useScrollFlash.js +12 -25
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import { useEffect } from 'react';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -6,30 +5,18 @@ import { useEffect } from 'react';
|
|
|
6
5
|
* @param scrollContainerRef The ref of the scrollable content
|
|
7
6
|
*/
|
|
8
7
|
function useScrollFlash(scrollContainerRef) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
scrollContainer.scrollTop = altScroll;
|
|
22
|
-
scrollContainer.scrollTop = currentScroll;
|
|
23
|
-
};
|
|
24
|
-
t1 = [scrollContainerRef];
|
|
25
|
-
$[0] = scrollContainerRef;
|
|
26
|
-
$[1] = t0;
|
|
27
|
-
$[2] = t1;
|
|
28
|
-
} else {
|
|
29
|
-
t0 = $[1];
|
|
30
|
-
t1 = $[2];
|
|
31
|
-
}
|
|
32
|
-
useEffect(t0, t1);
|
|
8
|
+
// https://adxlv.computer/projects/flash-scrollers/
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const scrollContainer = scrollContainerRef.current;
|
|
11
|
+
if (!scrollContainer) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const currentScroll = scrollContainer.scrollTop;
|
|
15
|
+
const maxScroll = scrollContainer.scrollHeight;
|
|
16
|
+
const altScroll = currentScroll < Math.min(1, maxScroll) ? currentScroll + 1 : currentScroll - 1;
|
|
17
|
+
scrollContainer.scrollTop = altScroll;
|
|
18
|
+
scrollContainer.scrollTop = currentScroll;
|
|
19
|
+
}, [scrollContainerRef]);
|
|
33
20
|
}
|
|
34
21
|
|
|
35
22
|
export { useScrollFlash as default };
|
package/package.json
CHANGED