@xylabs/react-scroll-to-top 7.1.16 → 7.1.20

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 CHANGED
@@ -1,67 +1,27 @@
1
- [![logo][]](https://xylabs.com)
2
-
3
1
  # @xylabs/react-scroll-to-top
4
2
 
5
- [![npm-badge][]][npm-link]
6
- [![npm-downloads-badge][]][npm-link]
7
- [![jsdelivr-badge][]][jsdelivr-link]
8
- [![npm-license-badge][]](LICENSE)
9
-
10
- > XY Labs generalized React library
11
-
12
- ## Table of Contents
3
+ [![npm][npm-badge]][npm-link]
13
4
 
14
- - [Description](#description)
15
- - [Install](#install)
16
- - [Maintainers](#maintainers)
17
- - [License](#license)
18
- - [Credits](#credits)
19
-
20
- ## Description
21
-
22
- Common React code that is used throughout XYO projects that use React.
5
+ > Common React library for all XY Labs projects that use React
23
6
 
24
7
  ## Install
25
8
 
26
- Using npm:
27
-
28
9
  ```sh
29
- npm i --save @xylabs/react-scroll-to-top
10
+ npm install {{name}}
30
11
  ```
31
12
 
32
- Using yarn:
13
+ or
33
14
 
34
15
  ```sh
35
- yarn add @xylabs/react-scroll-to-top
16
+ yarn add {{name}}
36
17
  ```
37
18
 
38
- ## Documentation
39
- [Developer Reference](https://xylabs.github.io/sdk-react)
40
-
41
- [Storybook](https://xylabs.github.io/sdk-react/storybook)
42
-
43
- ## Maintainers
44
-
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)
49
19
 
50
20
  ## License
51
21
 
52
- See the [LICENSE](LICENSE) file for license details
22
+ See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
53
23
 
54
- ## Credits
55
24
 
56
- [Made with 🔥and ❄️ by XY Labs](https://xylabs.com)
57
-
58
- [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
59
25
 
60
26
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/react-scroll-to-top.svg
61
27
  [npm-link]: https://www.npmjs.com/package/@xylabs/react-scroll-to-top
62
-
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
65
-
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/react-scroll-to-top",
3
- "version": "7.1.16",
3
+ "version": "7.1.20",
4
4
  "description": "Common React library for all XY Labs projects that use React",
5
5
  "keywords": [
6
6
  "utility",
@@ -27,34 +27,35 @@
27
27
  "exports": {
28
28
  ".": {
29
29
  "types": "./dist/browser/index.d.ts",
30
+ "import": "./dist/browser/index.mjs",
30
31
  "default": "./dist/browser/index.mjs"
31
32
  },
32
33
  "./package.json": "./package.json"
33
34
  },
34
- "module": "./dist/browser/index.mjs",
35
35
  "types": "dist/browser/index.d.ts",
36
36
  "files": [
37
37
  "dist",
38
- "src"
38
+ "README.md"
39
39
  ],
40
+ "dependencies": {
41
+ "@mui/material": "~7.3.9",
42
+ "react-router-dom": "~7.14.0"
43
+ },
40
44
  "devDependencies": {
41
- "@types/react": "^19.2.10",
42
- "@xylabs/ts-scripts-yarn3": "~7.3.2",
43
- "@xylabs/tsconfig": "~7.3.2",
44
- "@xylabs/tsconfig-dom": "~7.3.2",
45
- "@xylabs/tsconfig-react": "~7.3.2",
45
+ "@types/react": "^19.2.14",
46
+ "@xylabs/ts-scripts-common": "~7.8.5",
47
+ "@xylabs/ts-scripts-pnpm": "~7.8.5",
48
+ "@xylabs/tsconfig": "~7.8",
49
+ "@xylabs/tsconfig-dom": "~7.8.5",
50
+ "@xylabs/tsconfig-react": "~7.8.5",
46
51
  "react": "^19.2.4",
47
52
  "react-dom": "^19.2.4",
48
- "react-router-dom": "^7.13.0",
49
53
  "typescript": "^5.9.3"
50
54
  },
51
55
  "peerDependencies": {
52
- "@mui/material": ">=6 <8",
53
- "react": "^19",
54
- "react-dom": "^19",
55
- "react-router-dom": "^7"
56
+ "react": "^19"
56
57
  },
57
58
  "publishConfig": {
58
59
  "access": "public"
59
60
  }
60
- }
61
+ }
@@ -1,13 +0,0 @@
1
- import { useEffect } from 'react'
2
- import { useLocation } from 'react-router-dom'
3
-
4
- // The point of this component it to return to the top of the page on any router navigate
5
-
6
- export const ScrollToTop = () => {
7
- const { pathname } = useLocation()
8
- useEffect(() => {
9
- window.scrollTo(0, 0)
10
- }, [pathname])
11
-
12
- return null
13
- }
@@ -1,37 +0,0 @@
1
- import type { ZoomProps } from '@mui/material'
2
- import {
3
- Box, useScrollTrigger, useTheme, Zoom,
4
- } from '@mui/material'
5
- import React from 'react'
6
-
7
- export interface ScrollToTopButtonProps extends ZoomProps {
8
- anchorId: string
9
- }
10
-
11
- export const ScrollToTopButton: React.FC<ScrollToTopButtonProps> = ({
12
- children, anchorId, ...props
13
- }) => {
14
- const trigger = useScrollTrigger({
15
- disableHysteresis: true,
16
- threshold: 100,
17
- })
18
-
19
- const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {
20
- const divElement = event.target as HTMLElement
21
- const anchor = (divElement.ownerDocument ?? document).querySelector(`#${anchorId}`)
22
-
23
- if (anchor) {
24
- anchor.scrollIntoView({ behavior: 'smooth', block: 'center' })
25
- }
26
- }
27
-
28
- const theme = useTheme()
29
-
30
- return (
31
- <Zoom in={trigger} {...props}>
32
- <Box zIndex={10} position="fixed" right={theme.spacing(2)} bottom={theme.spacing(2)} onClick={handleClick} role="presentation">
33
- {children}
34
- </Box>
35
- </Zoom>
36
- )
37
- }
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './ScrollToTop.tsx'
2
- export * from './ScrollToTopButton.tsx'