@koine/react 1.1.4 → 1.1.5

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,2 +1,2 @@
1
- export declare function useSmoothScroll(): (to?: number | string, offset?: number, callback?: () => void, fallbackTimeout?: number, behavior?: ScrollBehavior) => void;
1
+ export declare function useSmoothScroll(disregardFixedOffset?: boolean): (to?: number | string, offset?: number, callback?: () => void, fallbackTimeout?: number, behavior?: ScrollBehavior) => void;
2
2
  export default useSmoothScroll;
@@ -2,7 +2,7 @@ import { useCallback } from "react";
2
2
  import { isNumber } from "@koine/utils";
3
3
  import { scrollTo } from "@koine/dom";
4
4
  import { useFixedOffset } from "./useFixedOffset";
5
- export function useSmoothScroll() {
5
+ export function useSmoothScroll(disregardFixedOffset) {
6
6
  var fixedOffset = useFixedOffset();
7
7
  var scroll = useCallback(function (to, offset, callback, fallbackTimeout, behavior) {
8
8
  if (offset === void 0) { offset = 0; }
@@ -17,10 +17,10 @@ export function useSmoothScroll() {
17
17
  }
18
18
  }
19
19
  if (isNumber(top)) {
20
- top = top + window.scrollY - (fixedOffset.current + offset);
20
+ top = top + offset + (disregardFixedOffset ? 0 : fixedOffset.current);
21
21
  scrollTo(top, callback, fallbackTimeout, behavior);
22
22
  }
23
- }, [fixedOffset]);
23
+ }, [disregardFixedOffset, fixedOffset]);
24
24
  return scroll;
25
25
  }
26
26
  export default useSmoothScroll;
@@ -5,7 +5,7 @@ var react_1 = require("react");
5
5
  var utils_1 = require("@koine/utils");
6
6
  var dom_1 = require("@koine/dom");
7
7
  var useFixedOffset_1 = require("./useFixedOffset");
8
- function useSmoothScroll() {
8
+ function useSmoothScroll(disregardFixedOffset) {
9
9
  var fixedOffset = (0, useFixedOffset_1.useFixedOffset)();
10
10
  var scroll = (0, react_1.useCallback)(function (to, offset, callback, fallbackTimeout, behavior) {
11
11
  if (offset === void 0) { offset = 0; }
@@ -20,10 +20,10 @@ function useSmoothScroll() {
20
20
  }
21
21
  }
22
22
  if ((0, utils_1.isNumber)(top)) {
23
- top = top + window.scrollY - (fixedOffset.current + offset);
23
+ top = top + offset + (disregardFixedOffset ? 0 : fixedOffset.current);
24
24
  (0, dom_1.scrollTo)(top, callback, fallbackTimeout, behavior);
25
25
  }
26
- }, [fixedOffset]);
26
+ }, [disregardFixedOffset, fixedOffset]);
27
27
  return scroll;
28
28
  }
29
29
  exports.useSmoothScroll = useSmoothScroll;
package/package.json CHANGED
@@ -44,6 +44,26 @@
44
44
  },
45
45
  "main": "./node/index.js",
46
46
  "types": "./index.d.ts",
47
- "version": "1.1.4",
47
+ "dependencies": {},
48
+ "peerDependencies": {
49
+ "styled-components": "5.3.6",
50
+ "framer-motion": "8.5.5",
51
+ "react": "18.2.0",
52
+ "@mui/base": "5.0.0-alpha.115",
53
+ "@koine/utils": "1.1.5",
54
+ "ts-debounce": "4.0.0",
55
+ "type-fest": "3.5.3",
56
+ "react-icons": "4.7.1",
57
+ "date-fns": "2.29.3",
58
+ "react-swipeable": "7.0.0",
59
+ "@tiptap/react": "2.0.0-beta.209",
60
+ "@tiptap/starter-kit": "2.0.0-beta.209",
61
+ "@kuus/yup": "1.0.0-beta.7",
62
+ "react-hook-form": "7.42.1",
63
+ "@koine/dom": "1.1.5",
64
+ "react-popper": "2.3.0",
65
+ "tslib": "2.5.0"
66
+ },
67
+ "version": "1.1.5",
48
68
  "module": "./index.js"
49
69
  }