@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.
@@ -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
- * Minimize hanlder
23
+ * Is open or not
30
24
  */
31
- onMinimize?: () => void;
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?: (() => void) | undefined;
54
- } & {
55
- children?: React.ReactNode;
56
- } & React.RefAttributes<LeftDrawerMethods>>;
29
+ onMinimize?: () => void;
30
+ }>;
31
+ export declare function LeftDrawer(props: React.PropsWithChildren<LeftDrawerProps>): JSX.Element;
@@ -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 const LeftDrawer = React.forwardRef((props, ref) => {
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 [open, setOpen] = React.useState();
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(mdUp);
25
- }, [mdUp]);
26
- return (React.createElement(Drawer, { sx: {
27
- width: open ? width : 0,
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: open ? width : 0,
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
+ }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -293,7 +293,7 @@ export function OptionGroup<
293
293
  }}
294
294
  />
295
295
  )}
296
- <Box paddingLeft={2} paddingY="7px">
296
+ <Box paddingLeft={2} paddingY="7px" position="absolute">
297
297
  {group}
298
298
  </Box>
299
299
  </FormControl>
@@ -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 const LeftDrawer = React.forwardRef<
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 [open, setOpen] = React.useState<boolean>();
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(mdUp);
81
- }, [mdUp]);
70
+ setOpen(open);
71
+ }, [open]);
82
72
 
83
73
  return (
84
74
  <Drawer
75
+ hidden={!openLocal}
85
76
  sx={{
86
- width: open ? width : 0,
77
+ width,
87
78
  flexShrink: 0,
88
79
  "& .MuiDrawer-paper": {
89
- width: open ? width : 0,
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
+ }
@@ -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