@xylabs/react-scroll-to-top 3.0.2 → 3.0.3

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.
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/ScrollToTop.tsx
21
+ var ScrollToTop_exports = {};
22
+ __export(ScrollToTop_exports, {
23
+ ScrollToTop: () => ScrollToTop
24
+ });
25
+ module.exports = __toCommonJS(ScrollToTop_exports);
26
+ var import_react = require("react");
27
+ var import_react_router_dom = require("react-router-dom");
28
+ var ScrollToTop = () => {
29
+ const { pathname } = (0, import_react_router_dom.useLocation)();
30
+ (0, import_react.useEffect)(() => {
31
+ window.scrollTo(0, 0);
32
+ }, [pathname]);
33
+ return null;
34
+ };
35
+ //# sourceMappingURL=ScrollToTop.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ScrollToTop.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\n// The point of this component it to return to the top of the page on any router navigate\n\nexport const ScrollToTop = () => {\n const { pathname } = useLocation()\n useEffect(() => {\n window.scrollTo(0, 0)\n }, [pathname])\n\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAC1B,8BAA4B;AAIrB,IAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,SAAS,QAAI,qCAAY;AACjC,8BAAU,MAAM;AACd,WAAO,SAAS,GAAG,CAAC;AAAA,EACtB,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AACT;","names":[]}
@@ -1,6 +1,7 @@
1
+ // src/ScrollToTop.tsx
1
2
  import { useEffect } from "react";
2
3
  import { useLocation } from "react-router-dom";
3
- const ScrollToTop = () => {
4
+ var ScrollToTop = () => {
4
5
  const { pathname } = useLocation();
5
6
  useEffect(() => {
6
7
  window.scrollTo(0, 0);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ScrollToTop.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\n// The point of this component it to return to the top of the page on any router navigate\n\nexport const ScrollToTop = () => {\n const { pathname } = useLocation()\n useEffect(() => {\n window.scrollTo(0, 0)\n }, [pathname])\n\n return null\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAIrB,MAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,SAAS,IAAI,YAAY;AACjC,YAAU,MAAM;AACd,WAAO,SAAS,GAAG,CAAC;AAAA,EACtB,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/ScrollToTop.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\n// The point of this component it to return to the top of the page on any router navigate\n\nexport const ScrollToTop = () => {\n const { pathname } = useLocation()\n useEffect(() => {\n window.scrollTo(0, 0)\n }, [pathname])\n\n return null\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAIrB,IAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,SAAS,IAAI,YAAY;AACjC,YAAU,MAAM;AACd,WAAO,SAAS,GAAG,CAAC;AAAA,EACtB,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AACT;","names":[]}