@etsoo/materialui 1.1.15 → 1.1.17
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/OptionGroup.js +1 -1
- package/lib/pages/LeftDrawer.d.ts +5 -30
- package/lib/pages/LeftDrawer.js +9 -14
- package/lib/pages/UserMenu.d.ts +6 -0
- package/package.json +1 -1
- package/src/OptionGroup.tsx +1 -1
- package/src/pages/LeftDrawer.tsx +14 -23
- package/src/pages/UserMenu.tsx +7 -0
package/lib/OptionGroup.js
CHANGED
|
@@ -99,6 +99,6 @@ export function OptionGroup(props) {
|
|
|
99
99
|
borderRadius: theme.shape.borderRadius,
|
|
100
100
|
width: fullWidth ? "100%" : "auto"
|
|
101
101
|
} })),
|
|
102
|
-
React.createElement(Box, { paddingLeft: 2, paddingY: "7px" }, group)),
|
|
102
|
+
React.createElement(Box, { paddingLeft: 2, paddingY: "7px", position: "absolute" }, group)),
|
|
103
103
|
helperText && React.createElement(FormHelperText, null, helperText)));
|
|
104
104
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Left drawer methods
|
|
4
|
-
*/
|
|
5
|
-
export interface LeftDrawerMethods {
|
|
6
|
-
open(): void;
|
|
7
|
-
}
|
|
8
2
|
/**
|
|
9
3
|
* Left drawer props
|
|
10
4
|
*/
|
|
@@ -26,31 +20,12 @@ export type LeftDrawerProps = React.PropsWithRef<{
|
|
|
26
20
|
*/
|
|
27
21
|
appName?: string;
|
|
28
22
|
/**
|
|
29
|
-
*
|
|
23
|
+
* Is open or not
|
|
30
24
|
*/
|
|
31
|
-
|
|
32
|
-
}>;
|
|
33
|
-
export declare const LeftDrawer: React.ForwardRefExoticComponent<{
|
|
34
|
-
/**
|
|
35
|
-
* Show when md up
|
|
36
|
-
*/
|
|
37
|
-
mdUp: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Organization
|
|
40
|
-
*/
|
|
41
|
-
organization?: number | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Width
|
|
44
|
-
*/
|
|
45
|
-
width: number;
|
|
46
|
-
/**
|
|
47
|
-
* Application name
|
|
48
|
-
*/
|
|
49
|
-
appName?: string | undefined;
|
|
25
|
+
open?: boolean;
|
|
50
26
|
/**
|
|
51
27
|
* Minimize hanlder
|
|
52
28
|
*/
|
|
53
|
-
onMinimize?: (
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
} & React.RefAttributes<LeftDrawerMethods>>;
|
|
29
|
+
onMinimize?: () => void;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function LeftDrawer(props: React.PropsWithChildren<LeftDrawerProps>): JSX.Element;
|
package/lib/pages/LeftDrawer.js
CHANGED
|
@@ -3,31 +3,26 @@ import React from "react";
|
|
|
3
3
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
4
4
|
import { DrawerHeader } from "./DrawerHeader";
|
|
5
5
|
import { globalApp } from "../app/ReactApp";
|
|
6
|
-
export
|
|
6
|
+
export function LeftDrawer(props) {
|
|
7
7
|
var _a;
|
|
8
8
|
// Destruct
|
|
9
|
-
const { mdUp, width, appName = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("appName"), onMinimize, children } = props;
|
|
9
|
+
const { mdUp, width, appName = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("appName"), onMinimize, open = mdUp, children } = props;
|
|
10
10
|
// Menu open/close state
|
|
11
|
-
const [
|
|
11
|
+
const [openLocal, setOpen] = React.useState();
|
|
12
12
|
const handleDrawerClose = () => {
|
|
13
13
|
if (onMinimize)
|
|
14
14
|
onMinimize();
|
|
15
15
|
setOpen(false);
|
|
16
16
|
};
|
|
17
|
-
React.useImperativeHandle(ref, () => ({
|
|
18
|
-
open() {
|
|
19
|
-
setOpen(true);
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
17
|
// Ready
|
|
23
18
|
React.useEffect(() => {
|
|
24
|
-
setOpen(
|
|
25
|
-
}, [
|
|
26
|
-
return (React.createElement(Drawer, { sx: {
|
|
27
|
-
width
|
|
19
|
+
setOpen(open);
|
|
20
|
+
}, [open]);
|
|
21
|
+
return (React.createElement(Drawer, { hidden: !openLocal, sx: {
|
|
22
|
+
width,
|
|
28
23
|
flexShrink: 0,
|
|
29
24
|
"& .MuiDrawer-paper": {
|
|
30
|
-
width
|
|
25
|
+
width,
|
|
31
26
|
boxSizing: "border-box"
|
|
32
27
|
}
|
|
33
28
|
}, anchor: "left", variant: mdUp ? "persistent" : "temporary", open: open, onClose: mdUp ? undefined : handleDrawerClose, ModalProps: {
|
|
@@ -41,4 +36,4 @@ export const LeftDrawer = React.forwardRef((props, ref) => {
|
|
|
41
36
|
React.createElement(ChevronLeftIcon, null))),
|
|
42
37
|
React.createElement(Divider, null),
|
|
43
38
|
React.createElement(List, { onClick: mdUp ? undefined : handleDrawerClose }, children)));
|
|
44
|
-
}
|
|
39
|
+
}
|
package/lib/pages/UserMenu.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ export interface UserMenuProps {
|
|
|
21
21
|
*/
|
|
22
22
|
children(handleMenuClose: () => void): React.ReactNode;
|
|
23
23
|
}
|
|
24
|
+
export interface UserMenuLocalProps extends Omit<UserMenuProps, "children"> {
|
|
25
|
+
/**
|
|
26
|
+
* Current screen size is down sm
|
|
27
|
+
*/
|
|
28
|
+
smDown: boolean;
|
|
29
|
+
}
|
|
24
30
|
/**
|
|
25
31
|
* User menu
|
|
26
32
|
* @param props Props
|
package/package.json
CHANGED
package/src/OptionGroup.tsx
CHANGED
package/src/pages/LeftDrawer.tsx
CHANGED
|
@@ -11,13 +11,6 @@ import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
|
11
11
|
import { DrawerHeader } from "./DrawerHeader";
|
|
12
12
|
import { globalApp } from "../app/ReactApp";
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Left drawer methods
|
|
16
|
-
*/
|
|
17
|
-
export interface LeftDrawerMethods {
|
|
18
|
-
open(): void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
14
|
/**
|
|
22
15
|
* Left drawer props
|
|
23
16
|
*/
|
|
@@ -42,51 +35,49 @@ export type LeftDrawerProps = React.PropsWithRef<{
|
|
|
42
35
|
*/
|
|
43
36
|
appName?: string;
|
|
44
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Is open or not
|
|
40
|
+
*/
|
|
41
|
+
open?: boolean;
|
|
42
|
+
|
|
45
43
|
/**
|
|
46
44
|
* Minimize hanlder
|
|
47
45
|
*/
|
|
48
46
|
onMinimize?: () => void;
|
|
49
47
|
}>;
|
|
50
48
|
|
|
51
|
-
export
|
|
52
|
-
LeftDrawerMethods,
|
|
53
|
-
React.PropsWithChildren<LeftDrawerProps>
|
|
54
|
-
>((props, ref) => {
|
|
49
|
+
export function LeftDrawer(props: React.PropsWithChildren<LeftDrawerProps>) {
|
|
55
50
|
// Destruct
|
|
56
51
|
const {
|
|
57
52
|
mdUp,
|
|
58
53
|
width,
|
|
59
54
|
appName = globalApp?.get("appName"),
|
|
60
55
|
onMinimize,
|
|
56
|
+
open = mdUp,
|
|
61
57
|
children
|
|
62
58
|
} = props;
|
|
63
59
|
|
|
64
60
|
// Menu open/close state
|
|
65
|
-
const [
|
|
61
|
+
const [openLocal, setOpen] = React.useState<boolean>();
|
|
66
62
|
|
|
67
63
|
const handleDrawerClose = () => {
|
|
68
64
|
if (onMinimize) onMinimize();
|
|
69
65
|
setOpen(false);
|
|
70
66
|
};
|
|
71
67
|
|
|
72
|
-
React.useImperativeHandle(ref, () => ({
|
|
73
|
-
open() {
|
|
74
|
-
setOpen(true);
|
|
75
|
-
}
|
|
76
|
-
}));
|
|
77
|
-
|
|
78
68
|
// Ready
|
|
79
69
|
React.useEffect(() => {
|
|
80
|
-
setOpen(
|
|
81
|
-
}, [
|
|
70
|
+
setOpen(open);
|
|
71
|
+
}, [open]);
|
|
82
72
|
|
|
83
73
|
return (
|
|
84
74
|
<Drawer
|
|
75
|
+
hidden={!openLocal}
|
|
85
76
|
sx={{
|
|
86
|
-
width
|
|
77
|
+
width,
|
|
87
78
|
flexShrink: 0,
|
|
88
79
|
"& .MuiDrawer-paper": {
|
|
89
|
-
width
|
|
80
|
+
width,
|
|
90
81
|
boxSizing: "border-box"
|
|
91
82
|
}
|
|
92
83
|
}}
|
|
@@ -122,4 +113,4 @@ export const LeftDrawer = React.forwardRef<
|
|
|
122
113
|
<List onClick={mdUp ? undefined : handleDrawerClose}>{children}</List>
|
|
123
114
|
</Drawer>
|
|
124
115
|
);
|
|
125
|
-
}
|
|
116
|
+
}
|
package/src/pages/UserMenu.tsx
CHANGED
|
@@ -28,6 +28,13 @@ export interface UserMenuProps {
|
|
|
28
28
|
children(handleMenuClose: () => void): React.ReactNode;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
export interface UserMenuLocalProps extends Omit<UserMenuProps, "children"> {
|
|
32
|
+
/**
|
|
33
|
+
* Current screen size is down sm
|
|
34
|
+
*/
|
|
35
|
+
smDown: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
/**
|
|
32
39
|
* User menu
|
|
33
40
|
* @param props Props
|