@etsoo/materialui 1.2.2 → 1.2.4
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/lib/ScrollTopFab.d.ts +1 -1
- package/lib/ScrollTopFab.js +5 -5
- package/lib/SearchBar.js +1 -1
- package/package.json +3 -3
- package/src/ScrollTopFab.tsx +26 -24
- package/src/SearchBar.tsx +1 -1
package/lib/ScrollTopFab.d.ts
CHANGED
package/lib/ScrollTopFab.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Fab, useScrollTrigger, Zoom } from
|
|
3
|
-
import VerticalAlignTopIcon from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Fab, useScrollTrigger, Zoom } from "@mui/material";
|
|
3
|
+
import VerticalAlignTopIcon from "@mui/icons-material/VerticalAlignTop";
|
|
4
4
|
/**
|
|
5
5
|
* Scroll to top fab
|
|
6
6
|
* @returns Component
|
|
@@ -19,7 +19,7 @@ export function ScrollTopFab(props) {
|
|
|
19
19
|
const handleClick = () => {
|
|
20
20
|
target.scrollTo({ top: 0 });
|
|
21
21
|
};
|
|
22
|
-
return (React.createElement(Zoom, { in: trigger },
|
|
22
|
+
return trigger ? (React.createElement(Zoom, { in: trigger },
|
|
23
23
|
React.createElement(Fab, { color: color, size: size, title: title, onClick: handleClick },
|
|
24
|
-
React.createElement(VerticalAlignTopIcon, null))));
|
|
24
|
+
React.createElement(VerticalAlignTopIcon, null)))) : (React.createElement(React.Fragment, null));
|
|
25
25
|
}
|
package/lib/SearchBar.js
CHANGED
|
@@ -244,7 +244,7 @@ export function SearchBar(props) {
|
|
|
244
244
|
React.createElement(IconButton, { title: labels.more, size: "medium", sx: { height: "40px" }, onClick: handleMore },
|
|
245
245
|
React.createElement(MoreHorizIcon, null)),
|
|
246
246
|
React.createElement(Button, { variant: "contained", size: "medium", ref: resetButtonRef, onClick: handleReset }, labels.reset))),
|
|
247
|
-
hasMoreItems && (React.createElement(Drawer, { anchor: "right", sx: { minWidth: "
|
|
247
|
+
hasMoreItems && (React.createElement(Drawer, { anchor: "right", sx: { minWidth: "180px" }, ModalProps: {
|
|
248
248
|
keepMounted: true
|
|
249
249
|
}, open: open, onClose: () => updateOpen(false) },
|
|
250
250
|
React.createElement("form", { onChange: moreFormChange, ref: (form) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@emotion/css": "^11.10.6",
|
|
51
51
|
"@emotion/react": "^11.10.6",
|
|
52
52
|
"@emotion/styled": "^11.10.6",
|
|
53
|
-
"@etsoo/appscript": "^1.3.
|
|
53
|
+
"@etsoo/appscript": "^1.3.92",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.24",
|
|
55
55
|
"@etsoo/react": "^1.6.67",
|
|
56
|
-
"@etsoo/shared": "^1.2.
|
|
56
|
+
"@etsoo/shared": "^1.2.1",
|
|
57
57
|
"@mui/icons-material": "^5.11.16",
|
|
58
58
|
"@mui/material": "^5.12.0",
|
|
59
59
|
"@mui/x-data-grid": "^6.2.0",
|
package/src/ScrollTopFab.tsx
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Fab, useScrollTrigger, Zoom } from
|
|
3
|
-
import VerticalAlignTopIcon from
|
|
4
|
-
import { CustomFabProps } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Fab, useScrollTrigger, Zoom } from "@mui/material";
|
|
3
|
+
import VerticalAlignTopIcon from "@mui/icons-material/VerticalAlignTop";
|
|
4
|
+
import { CustomFabProps } from "./CustomFabProps";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Scroll to top fab
|
|
8
8
|
* @returns Component
|
|
9
9
|
*/
|
|
10
10
|
export function ScrollTopFab(props: CustomFabProps) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Destruct
|
|
12
|
+
const { color, size, target, title } = props;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
// Scroll trigger
|
|
15
|
+
const trigger = useScrollTrigger({
|
|
16
|
+
target,
|
|
17
|
+
disableHysteresis: true,
|
|
18
|
+
threshold: 120
|
|
19
|
+
});
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// Icon click handler
|
|
22
|
+
// behavior: 'smooth'
|
|
23
|
+
const handleClick = () => {
|
|
24
|
+
target.scrollTo({ top: 0 });
|
|
25
|
+
};
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
return trigger ? (
|
|
28
|
+
<Zoom in={trigger}>
|
|
29
|
+
<Fab color={color} size={size} title={title} onClick={handleClick}>
|
|
30
|
+
<VerticalAlignTopIcon />
|
|
31
|
+
</Fab>
|
|
32
|
+
</Zoom>
|
|
33
|
+
) : (
|
|
34
|
+
<React.Fragment />
|
|
35
|
+
);
|
|
34
36
|
}
|