@tapcart/mobile-components 0.12.11 → 0.12.12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scroll-direction.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-scroll-direction.ts"],"names":[],"mappings":"AAGA,KAAK,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;AAE3C,UAAU,UAAU;IAClB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,iBAAS,kBAAkB,CAAC,SAAS,GAAE,MAAY,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"use-scroll-direction.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-scroll-direction.ts"],"names":[],"mappings":"AAGA,KAAK,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;AAE3C,UAAU,UAAU;IAClB,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,iBAAS,kBAAkB,CAAC,SAAS,GAAE,MAAY,GAAG,UAAU,CA8E/D;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -10,6 +10,7 @@ function useScrollDirection(threshold = 100) {
|
|
|
10
10
|
const hasScrollListener = useRef(false);
|
|
11
11
|
const lastScrollY = useRef(0);
|
|
12
12
|
const isBouncing = useRef(false);
|
|
13
|
+
const rafId = useRef(null);
|
|
13
14
|
useEffect(() => {
|
|
14
15
|
var _a;
|
|
15
16
|
if (typeof window === "undefined" || React.version === "17.0.2") {
|
|
@@ -45,16 +46,28 @@ function useScrollDirection(threshold = 100) {
|
|
|
45
46
|
if (!scrollElement.current) {
|
|
46
47
|
scrollElement.current = document.getElementById("tc-vgsl");
|
|
47
48
|
}
|
|
49
|
+
const handleScroll = () => {
|
|
50
|
+
if (rafId.current !== null)
|
|
51
|
+
return;
|
|
52
|
+
rafId.current = requestAnimationFrame(() => {
|
|
53
|
+
rafId.current = null;
|
|
54
|
+
updateScrollDirection();
|
|
55
|
+
});
|
|
56
|
+
};
|
|
48
57
|
if (!hasScrollListener.current) {
|
|
49
|
-
(_a = scrollElement.current) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll",
|
|
58
|
+
(_a = scrollElement.current) === null || _a === void 0 ? void 0 : _a.addEventListener("scroll", handleScroll, {
|
|
50
59
|
passive: true,
|
|
51
60
|
});
|
|
52
61
|
hasScrollListener.current = true;
|
|
53
62
|
}
|
|
54
63
|
return () => {
|
|
55
64
|
var _a;
|
|
56
|
-
(_a = scrollElement.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("scroll",
|
|
65
|
+
(_a = scrollElement.current) === null || _a === void 0 ? void 0 : _a.removeEventListener("scroll", handleScroll);
|
|
57
66
|
hasScrollListener.current = false;
|
|
67
|
+
if (rafId.current !== null) {
|
|
68
|
+
cancelAnimationFrame(rafId.current);
|
|
69
|
+
rafId.current = null;
|
|
70
|
+
}
|
|
58
71
|
};
|
|
59
72
|
}, [threshold]);
|
|
60
73
|
return scrollData;
|
package/dist/styles.css
CHANGED
|
@@ -695,6 +695,9 @@ video {
|
|
|
695
695
|
.invisible {
|
|
696
696
|
visibility: hidden;
|
|
697
697
|
}
|
|
698
|
+
.collapse {
|
|
699
|
+
visibility: collapse;
|
|
700
|
+
}
|
|
698
701
|
.static {
|
|
699
702
|
position: static;
|
|
700
703
|
}
|
|
@@ -979,6 +982,9 @@ video {
|
|
|
979
982
|
.inline-flex {
|
|
980
983
|
display: inline-flex;
|
|
981
984
|
}
|
|
985
|
+
.table {
|
|
986
|
+
display: table;
|
|
987
|
+
}
|
|
982
988
|
.grid {
|
|
983
989
|
display: grid;
|
|
984
990
|
}
|
|
@@ -1420,6 +1426,9 @@ video {
|
|
|
1420
1426
|
.touch-none {
|
|
1421
1427
|
touch-action: none;
|
|
1422
1428
|
}
|
|
1429
|
+
.touch-manipulation {
|
|
1430
|
+
touch-action: manipulation;
|
|
1431
|
+
}
|
|
1423
1432
|
.select-none {
|
|
1424
1433
|
-webkit-user-select: none;
|
|
1425
1434
|
-moz-user-select: none;
|
|
@@ -1563,6 +1572,11 @@ video {
|
|
|
1563
1572
|
margin-right: calc(0.5rem * var(--tw-space-x-reverse));
|
|
1564
1573
|
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
1565
1574
|
}
|
|
1575
|
+
.space-x-3 > :not([hidden]) ~ :not([hidden]) {
|
|
1576
|
+
--tw-space-x-reverse: 0;
|
|
1577
|
+
margin-right: calc(0.75rem * var(--tw-space-x-reverse));
|
|
1578
|
+
margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
|
|
1579
|
+
}
|
|
1566
1580
|
.space-x-4 > :not([hidden]) ~ :not([hidden]) {
|
|
1567
1581
|
--tw-space-x-reverse: 0;
|
|
1568
1582
|
margin-right: calc(1rem * var(--tw-space-x-reverse));
|
|
@@ -1583,6 +1597,11 @@ video {
|
|
|
1583
1597
|
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
1584
1598
|
margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
|
|
1585
1599
|
}
|
|
1600
|
+
.space-y-3 > :not([hidden]) ~ :not([hidden]) {
|
|
1601
|
+
--tw-space-y-reverse: 0;
|
|
1602
|
+
margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));
|
|
1603
|
+
margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));
|
|
1604
|
+
}
|
|
1586
1605
|
.space-y-4 > :not([hidden]) ~ :not([hidden]) {
|
|
1587
1606
|
--tw-space-y-reverse: 0;
|
|
1588
1607
|
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
|