@xylabs/react-scroll-to-top 3.0.17 → 3.0.19
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/README.md +20 -49
- package/package.json +4 -4
- package/dist/browser/ScrollToTop.cjs +0 -35
- package/dist/browser/ScrollToTop.cjs.map +0 -1
- package/dist/browser/ScrollToTop.js +0 -14
- package/dist/browser/ScrollToTop.js.map +0 -1
- package/dist/browser/ScrollToTopButton.cjs +0 -42
- package/dist/browser/ScrollToTopButton.cjs.map +0 -1
- package/dist/browser/ScrollToTopButton.js +0 -21
- package/dist/browser/ScrollToTopButton.js.map +0 -1
- package/dist/node/ScrollToTop.cjs +0 -39
- package/dist/node/ScrollToTop.cjs.map +0 -1
- package/dist/node/ScrollToTop.js +0 -14
- package/dist/node/ScrollToTop.js.map +0 -1
- package/dist/node/ScrollToTopButton.cjs +0 -46
- package/dist/node/ScrollToTopButton.cjs.map +0 -1
- package/dist/node/ScrollToTopButton.js +0 -21
- package/dist/node/ScrollToTopButton.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
[![logo][]](https://xylabs.com)
|
|
2
2
|
|
|
3
|
-
# @xylabs/
|
|
3
|
+
# @xylabs/react-scroll-to-top
|
|
4
4
|
|
|
5
|
-
[![main-build][]][main-build-link]
|
|
6
|
-
[![beta-build][]][beta-build-link]
|
|
7
5
|
[![npm-badge][]][npm-link]
|
|
8
|
-
[![
|
|
9
|
-
[![
|
|
10
|
-
[![
|
|
11
|
-
[![snyk-badge][]][snyk-link]
|
|
6
|
+
[![npm-downloads-badge][]][npm-link]
|
|
7
|
+
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
|
+
[![npm-license-badge][]](LICENSE)
|
|
12
9
|
|
|
13
10
|
> XY Labs generalized React library
|
|
14
11
|
|
|
@@ -16,53 +13,39 @@
|
|
|
16
13
|
|
|
17
14
|
- [Description](#description)
|
|
18
15
|
- [Install](#install)
|
|
19
|
-
- [Scripts](#scripts)
|
|
20
16
|
- [Maintainers](#maintainers)
|
|
21
17
|
- [License](#license)
|
|
22
18
|
- [Credits](#credits)
|
|
23
19
|
|
|
24
20
|
## Description
|
|
25
21
|
|
|
26
|
-
Common React code that is used
|
|
22
|
+
Common React code that is used throughout XYO projects that use React.
|
|
27
23
|
|
|
28
24
|
## Install
|
|
29
25
|
|
|
30
26
|
Using npm:
|
|
31
27
|
|
|
32
28
|
```sh
|
|
33
|
-
npm i --save @xylabs/
|
|
29
|
+
npm i --save @xylabs/react-scroll-to-top
|
|
34
30
|
```
|
|
35
31
|
|
|
36
32
|
Using yarn:
|
|
37
33
|
|
|
38
34
|
```sh
|
|
39
|
-
yarn add @xylabs/
|
|
35
|
+
yarn add @xylabs/react-scroll-to-top
|
|
40
36
|
```
|
|
41
37
|
|
|
42
|
-
##
|
|
38
|
+
## Documentation
|
|
39
|
+
[Developer Reference](https://xylabs.github.io/sdk-react)
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
list of shared scripts. The below scripts are custom scripts for this repo.
|
|
46
|
-
|
|
47
|
-
### Build (Storybook)
|
|
48
|
-
|
|
49
|
-
Build the static Storybook site
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
yarn build-storybook
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Start
|
|
56
|
-
|
|
57
|
-
Starts the project in the browser for testing, with auto reload using Storybook
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
yarn start
|
|
61
|
-
```
|
|
41
|
+
[Storybook](https://xylabs.github.io/sdk-react/storybook)
|
|
62
42
|
|
|
63
43
|
## Maintainers
|
|
64
44
|
|
|
65
|
-
- [Arie Trouw](https://github.com/arietrouw) [arietrouw.com](https://arietrouw.com)
|
|
45
|
+
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
46
|
+
- [Matt Jones](https://github.com/jonesmac)
|
|
47
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
48
|
+
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
66
49
|
|
|
67
50
|
## License
|
|
68
51
|
|
|
@@ -74,23 +57,11 @@ See the [LICENSE](LICENSE) file for license details
|
|
|
74
57
|
|
|
75
58
|
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
76
59
|
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
|
|
80
|
-
[beta-build]: https://github.com/xylabs/sdk-react/actions/workflows/build-beta.yml/badge.svg
|
|
81
|
-
[beta-build-link]: https://github.com/xylabs/sdk-react/actions/workflows/build-beta.yml
|
|
82
|
-
|
|
83
|
-
[npm-badge]: https://img.shields.io/npm/v/@xylabs/sdk-react.svg
|
|
84
|
-
[npm-link]: https://www.npmjs.com/package/@xylabs/sdk-react
|
|
85
|
-
|
|
86
|
-
[bch-badge]: https://bettercodehub.com/edge/badge/xylabs/sdk-react?branch=main
|
|
87
|
-
[bch-link]: https://bettercodehub.com/results/xylabs/sdk-react
|
|
88
|
-
|
|
89
|
-
[codacy-badge]: https://app.codacy.com/project/badge/Grade/c2a69d4530ed4b7da6ddb070169dd339
|
|
90
|
-
[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-react/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-react&utm_campaign=Badge_Grade
|
|
60
|
+
[npm-badge]: https://img.shields.io/npm/v/@xylabs/react-scroll-to-top.svg
|
|
61
|
+
[npm-link]: https://www.npmjs.com/package/@xylabs/react-scroll-to-top
|
|
91
62
|
|
|
92
|
-
[
|
|
93
|
-
[
|
|
63
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/react-scroll-to-top
|
|
64
|
+
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/react-scroll-to-top
|
|
94
65
|
|
|
95
|
-
[
|
|
96
|
-
[
|
|
66
|
+
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/react-scroll-to-top/badge
|
|
67
|
+
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/react-scroll-to-top
|
package/package.json
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
],
|
|
15
15
|
"description": "Common React library for all XY Labs projects that use React",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@mui/material": "^5.14.
|
|
18
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
19
|
-
"@xylabs/tsconfig-react": "^3.
|
|
17
|
+
"@mui/material": "^5.14.13",
|
|
18
|
+
"@xylabs/ts-scripts-yarn3": "^3.1.9",
|
|
19
|
+
"@xylabs/tsconfig-react": "^3.1.9",
|
|
20
20
|
"react": "^18.2.0",
|
|
21
21
|
"react-dom": "^18.2.0",
|
|
22
22
|
"react-router-dom": "^6.16.0",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"url": "https://github.com/xylabs/sdk-react.git"
|
|
74
74
|
},
|
|
75
75
|
"sideEffects": false,
|
|
76
|
-
"version": "3.0.
|
|
76
|
+
"version": "3.0.19",
|
|
77
77
|
"type": "module"
|
|
78
78
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,14 +0,0 @@
|
|
|
1
|
-
// src/ScrollToTop.tsx
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { useLocation } from "react-router-dom";
|
|
4
|
-
var ScrollToTop = () => {
|
|
5
|
-
const { pathname } = useLocation();
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
window.scrollTo(0, 0);
|
|
8
|
-
}, [pathname]);
|
|
9
|
-
return null;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
ScrollToTop
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=ScrollToTop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1,42 +0,0 @@
|
|
|
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/ScrollToTopButton.tsx
|
|
21
|
-
var ScrollToTopButton_exports = {};
|
|
22
|
-
__export(ScrollToTopButton_exports, {
|
|
23
|
-
ScrollToTopButton: () => ScrollToTopButton
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ScrollToTopButton_exports);
|
|
26
|
-
var import_material = require("@mui/material");
|
|
27
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var ScrollToTopButton = ({ children, anchorId, ...props }) => {
|
|
29
|
-
const trigger = (0, import_material.useScrollTrigger)({
|
|
30
|
-
disableHysteresis: true,
|
|
31
|
-
threshold: 100
|
|
32
|
-
});
|
|
33
|
-
const handleClick = (event) => {
|
|
34
|
-
const anchor = (event.target.ownerDocument || document).querySelector(`#${anchorId}`);
|
|
35
|
-
if (anchor) {
|
|
36
|
-
anchor.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const theme = (0, import_material.useTheme)();
|
|
40
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Zoom, { in: trigger, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Box, { zIndex: 10, position: "fixed", right: theme.spacing(2), bottom: theme.spacing(2), onClick: handleClick, role: "presentation", children }) });
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=ScrollToTopButton.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ScrollToTopButton.tsx"],"sourcesContent":["import { Box, useScrollTrigger, useTheme, Zoom, ZoomProps } from '@mui/material'\nimport React from 'react'\n\nexport interface ScrollToTopButtonProps extends ZoomProps {\n anchorId: string\n}\n\nexport const ScrollToTopButton: React.FC<ScrollToTopButtonProps> = ({ children, anchorId, ...props }) => {\n const trigger = useScrollTrigger({\n disableHysteresis: true,\n threshold: 100,\n })\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const anchor = ((event.target as HTMLDivElement).ownerDocument || document).querySelector(`#${anchorId}`)\n\n if (anchor) {\n anchor.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }\n }\n\n const theme = useTheme()\n\n return (\n <Zoom in={trigger} {...props}>\n <Box zIndex={10} position=\"fixed\" right={theme.spacing(2)} bottom={theme.spacing(2)} onClick={handleClick} role=\"presentation\">\n {children}\n </Box>\n </Zoom>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAiE;AAyB3D;AAlBC,IAAM,oBAAsD,CAAC,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AACvG,QAAM,cAAU,kCAAiB;AAAA,IAC/B,mBAAmB;AAAA,IACnB,WAAW;AAAA,EACb,CAAC;AAED,QAAM,cAAc,CAAC,UAA4C;AAC/D,UAAM,UAAW,MAAM,OAA0B,iBAAiB,UAAU,cAAc,IAAI,QAAQ,EAAE;AAExG,QAAI,QAAQ;AACV,aAAO,eAAe,EAAE,UAAU,UAAU,OAAO,SAAS,CAAC;AAAA,IAC/D;AAAA,EACF;AAEA,QAAM,YAAQ,0BAAS;AAEvB,SACE,4CAAC,wBAAK,IAAI,SAAU,GAAG,OACrB,sDAAC,uBAAI,QAAQ,IAAI,UAAS,SAAQ,OAAO,MAAM,QAAQ,CAAC,GAAG,QAAQ,MAAM,QAAQ,CAAC,GAAG,SAAS,aAAa,MAAK,gBAC7G,UACH,GACF;AAEJ;","names":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// src/ScrollToTopButton.tsx
|
|
2
|
-
import { Box, useScrollTrigger, useTheme, Zoom } from "@mui/material";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
var ScrollToTopButton = ({ children, anchorId, ...props }) => {
|
|
5
|
-
const trigger = useScrollTrigger({
|
|
6
|
-
disableHysteresis: true,
|
|
7
|
-
threshold: 100
|
|
8
|
-
});
|
|
9
|
-
const handleClick = (event) => {
|
|
10
|
-
const anchor = (event.target.ownerDocument || document).querySelector(`#${anchorId}`);
|
|
11
|
-
if (anchor) {
|
|
12
|
-
anchor.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const theme = useTheme();
|
|
16
|
-
return /* @__PURE__ */ jsx(Zoom, { in: trigger, ...props, children: /* @__PURE__ */ jsx(Box, { zIndex: 10, position: "fixed", right: theme.spacing(2), bottom: theme.spacing(2), onClick: handleClick, role: "presentation", children }) });
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
ScrollToTopButton
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=ScrollToTopButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ScrollToTopButton.tsx"],"sourcesContent":["import { Box, useScrollTrigger, useTheme, Zoom, ZoomProps } from '@mui/material'\nimport React from 'react'\n\nexport interface ScrollToTopButtonProps extends ZoomProps {\n anchorId: string\n}\n\nexport const ScrollToTopButton: React.FC<ScrollToTopButtonProps> = ({ children, anchorId, ...props }) => {\n const trigger = useScrollTrigger({\n disableHysteresis: true,\n threshold: 100,\n })\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const anchor = ((event.target as HTMLDivElement).ownerDocument || document).querySelector(`#${anchorId}`)\n\n if (anchor) {\n anchor.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }\n }\n\n const theme = useTheme()\n\n return (\n <Zoom in={trigger} {...props}>\n <Box zIndex={10} position=\"fixed\" right={theme.spacing(2)} bottom={theme.spacing(2)} onClick={handleClick} role=\"presentation\">\n {children}\n </Box>\n </Zoom>\n )\n}\n"],"mappings":";AAAA,SAAS,KAAK,kBAAkB,UAAU,YAAuB;AAyB3D;AAlBC,IAAM,oBAAsD,CAAC,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AACvG,QAAM,UAAU,iBAAiB;AAAA,IAC/B,mBAAmB;AAAA,IACnB,WAAW;AAAA,EACb,CAAC;AAED,QAAM,cAAc,CAAC,UAA4C;AAC/D,UAAM,UAAW,MAAM,OAA0B,iBAAiB,UAAU,cAAc,IAAI,QAAQ,EAAE;AAExG,QAAI,QAAQ;AACV,aAAO,eAAe,EAAE,UAAU,UAAU,OAAO,SAAS,CAAC;AAAA,IAC/D;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS;AAEvB,SACE,oBAAC,QAAK,IAAI,SAAU,GAAG,OACrB,8BAAC,OAAI,QAAQ,IAAI,UAAS,SAAQ,OAAO,MAAM,QAAQ,CAAC,GAAG,QAAQ,MAAM,QAAQ,CAAC,GAAG,SAAS,aAAa,MAAK,gBAC7G,UACH,GACF;AAEJ;","names":[]}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
ScrollToTop
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=ScrollToTop.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
package/dist/node/ScrollToTop.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// src/ScrollToTop.tsx
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { useLocation } from "react-router-dom";
|
|
4
|
-
var ScrollToTop = () => {
|
|
5
|
-
const { pathname } = useLocation();
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
window.scrollTo(0, 0);
|
|
8
|
-
}, [pathname]);
|
|
9
|
-
return null;
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
ScrollToTop
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=ScrollToTop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
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/ScrollToTopButton.tsx
|
|
21
|
-
var ScrollToTopButton_exports = {};
|
|
22
|
-
__export(ScrollToTopButton_exports, {
|
|
23
|
-
ScrollToTopButton: () => ScrollToTopButton
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ScrollToTopButton_exports);
|
|
26
|
-
var import_material = require("@mui/material");
|
|
27
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var ScrollToTopButton = ({ children, anchorId, ...props }) => {
|
|
29
|
-
const trigger = (0, import_material.useScrollTrigger)({
|
|
30
|
-
disableHysteresis: true,
|
|
31
|
-
threshold: 100
|
|
32
|
-
});
|
|
33
|
-
const handleClick = (event) => {
|
|
34
|
-
const anchor = (event.target.ownerDocument || document).querySelector(`#${anchorId}`);
|
|
35
|
-
if (anchor) {
|
|
36
|
-
anchor.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const theme = (0, import_material.useTheme)();
|
|
40
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Zoom, { in: trigger, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Box, { zIndex: 10, position: "fixed", right: theme.spacing(2), bottom: theme.spacing(2), onClick: handleClick, role: "presentation", children }) });
|
|
41
|
-
};
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
ScrollToTopButton
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=ScrollToTopButton.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ScrollToTopButton.tsx"],"sourcesContent":["import { Box, useScrollTrigger, useTheme, Zoom, ZoomProps } from '@mui/material'\nimport React from 'react'\n\nexport interface ScrollToTopButtonProps extends ZoomProps {\n anchorId: string\n}\n\nexport const ScrollToTopButton: React.FC<ScrollToTopButtonProps> = ({ children, anchorId, ...props }) => {\n const trigger = useScrollTrigger({\n disableHysteresis: true,\n threshold: 100,\n })\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const anchor = ((event.target as HTMLDivElement).ownerDocument || document).querySelector(`#${anchorId}`)\n\n if (anchor) {\n anchor.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }\n }\n\n const theme = useTheme()\n\n return (\n <Zoom in={trigger} {...props}>\n <Box zIndex={10} position=\"fixed\" right={theme.spacing(2)} bottom={theme.spacing(2)} onClick={handleClick} role=\"presentation\">\n {children}\n </Box>\n </Zoom>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAiE;AAyB3D;AAlBC,IAAM,oBAAsD,CAAC,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AACvG,QAAM,cAAU,kCAAiB;AAAA,IAC/B,mBAAmB;AAAA,IACnB,WAAW;AAAA,EACb,CAAC;AAED,QAAM,cAAc,CAAC,UAA4C;AAC/D,UAAM,UAAW,MAAM,OAA0B,iBAAiB,UAAU,cAAc,IAAI,QAAQ,EAAE;AAExG,QAAI,QAAQ;AACV,aAAO,eAAe,EAAE,UAAU,UAAU,OAAO,SAAS,CAAC;AAAA,IAC/D;AAAA,EACF;AAEA,QAAM,YAAQ,0BAAS;AAEvB,SACE,4CAAC,wBAAK,IAAI,SAAU,GAAG,OACrB,sDAAC,uBAAI,QAAQ,IAAI,UAAS,SAAQ,OAAO,MAAM,QAAQ,CAAC,GAAG,QAAQ,MAAM,QAAQ,CAAC,GAAG,SAAS,aAAa,MAAK,gBAC7G,UACH,GACF;AAEJ;","names":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// src/ScrollToTopButton.tsx
|
|
2
|
-
import { Box, useScrollTrigger, useTheme, Zoom } from "@mui/material";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
var ScrollToTopButton = ({ children, anchorId, ...props }) => {
|
|
5
|
-
const trigger = useScrollTrigger({
|
|
6
|
-
disableHysteresis: true,
|
|
7
|
-
threshold: 100
|
|
8
|
-
});
|
|
9
|
-
const handleClick = (event) => {
|
|
10
|
-
const anchor = (event.target.ownerDocument || document).querySelector(`#${anchorId}`);
|
|
11
|
-
if (anchor) {
|
|
12
|
-
anchor.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const theme = useTheme();
|
|
16
|
-
return /* @__PURE__ */ jsx(Zoom, { in: trigger, ...props, children: /* @__PURE__ */ jsx(Box, { zIndex: 10, position: "fixed", right: theme.spacing(2), bottom: theme.spacing(2), onClick: handleClick, role: "presentation", children }) });
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
ScrollToTopButton
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=ScrollToTopButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ScrollToTopButton.tsx"],"sourcesContent":["import { Box, useScrollTrigger, useTheme, Zoom, ZoomProps } from '@mui/material'\nimport React from 'react'\n\nexport interface ScrollToTopButtonProps extends ZoomProps {\n anchorId: string\n}\n\nexport const ScrollToTopButton: React.FC<ScrollToTopButtonProps> = ({ children, anchorId, ...props }) => {\n const trigger = useScrollTrigger({\n disableHysteresis: true,\n threshold: 100,\n })\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const anchor = ((event.target as HTMLDivElement).ownerDocument || document).querySelector(`#${anchorId}`)\n\n if (anchor) {\n anchor.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }\n }\n\n const theme = useTheme()\n\n return (\n <Zoom in={trigger} {...props}>\n <Box zIndex={10} position=\"fixed\" right={theme.spacing(2)} bottom={theme.spacing(2)} onClick={handleClick} role=\"presentation\">\n {children}\n </Box>\n </Zoom>\n )\n}\n"],"mappings":";AAAA,SAAS,KAAK,kBAAkB,UAAU,YAAuB;AAyB3D;AAlBC,IAAM,oBAAsD,CAAC,EAAE,UAAU,UAAU,GAAG,MAAM,MAAM;AACvG,QAAM,UAAU,iBAAiB;AAAA,IAC/B,mBAAmB;AAAA,IACnB,WAAW;AAAA,EACb,CAAC;AAED,QAAM,cAAc,CAAC,UAA4C;AAC/D,UAAM,UAAW,MAAM,OAA0B,iBAAiB,UAAU,cAAc,IAAI,QAAQ,EAAE;AAExG,QAAI,QAAQ;AACV,aAAO,eAAe,EAAE,UAAU,UAAU,OAAO,SAAS,CAAC;AAAA,IAC/D;AAAA,EACF;AAEA,QAAM,QAAQ,SAAS;AAEvB,SACE,oBAAC,QAAK,IAAI,SAAU,GAAG,OACrB,8BAAC,OAAI,QAAQ,IAAI,UAAS,SAAQ,OAAO,MAAM,QAAQ,CAAC,GAAG,QAAQ,MAAM,QAAQ,CAAC,GAAG,SAAS,aAAa,MAAK,gBAC7G,UACH,GACF;AAEJ;","names":[]}
|