@sikka/hawa 0.0.35 → 0.0.38
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/.github/workflows/hawa-publish-push.yml +2 -1
- package/README.md +11 -0
- package/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +10 -9
- package/src/elements/DragDropImages.js +55 -72
- package/src/elements/HawaSelectInput.js +30 -0
- package/src/elements/HawaSnackbar.js +35 -3
- package/src/elements/PinInput.js +141 -0
- package/src/index.js +1 -0
- package/src/layout/HawaAppLayout.js +197 -173
- package/src/layout/HawaAppLayout2.js +260 -0
- package/src/styles.css +4 -0
- package/src/styles.scss +3 -1
- package/src/theme/HawaTheme.js +921 -0
- package/src/theme/index.js +2 -0
- package/src/util.js +11 -1
- package/storybook-static/0.a2c13f8ca8477800b11f.manager.bundle.js +2 -0
- package/storybook-static/{0.0d994c92.iframe.bundle.js.LICENSE.txt → 0.a2c13f8ca8477800b11f.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/0.d94b248f.iframe.bundle.js +3 -0
- package/storybook-static/{4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt → 0.d94b248f.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/0.d94b248f.iframe.bundle.js.map +1 -0
- package/storybook-static/1.37f89487.iframe.bundle.js +1 -0
- package/storybook-static/1.d522251f2377f7751924.manager.bundle.js +1 -0
- package/storybook-static/{2.430bf1e3.iframe.bundle.js → 2.89943a03.iframe.bundle.js} +1 -1
- package/storybook-static/5.a331b0a36ded1c541923.manager.bundle.js +2 -0
- package/storybook-static/5.a331b0a36ded1c541923.manager.bundle.js.LICENSE.txt +31 -0
- package/storybook-static/6.3a1fb0c3.iframe.bundle.js +3 -0
- package/storybook-static/6.3a1fb0c3.iframe.bundle.js.LICENSE.txt +31 -0
- package/storybook-static/6.3a1fb0c3.iframe.bundle.js.map +1 -0
- package/storybook-static/6.aee6c4935c69d480fc0d.manager.bundle.js +1 -0
- package/storybook-static/7.5b8a4de4b5fa42d8de02.manager.bundle.js +1 -0
- package/storybook-static/7.f33530b1.iframe.bundle.js +1 -0
- package/storybook-static/8.a3dec9c37e8951a17939.manager.bundle.js +2 -0
- package/storybook-static/{6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt → 8.a3dec9c37e8951a17939.manager.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/8.b569e86b.iframe.bundle.js +1 -0
- package/storybook-static/{8.76c3cbf398692028e834.manager.bundle.js → 9.d04fdaada645cd23cb4b.manager.bundle.js} +1 -1
- package/storybook-static/9.f9db5c90.iframe.bundle.js +3 -0
- package/storybook-static/{7.9ce807e3.iframe.bundle.js.LICENSE.txt → 9.f9db5c90.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/9.f9db5c90.iframe.bundle.js.map +1 -0
- package/storybook-static/iframe.html +19 -3
- package/storybook-static/index.html +2 -2
- package/storybook-static/main.2a7fa838.iframe.bundle.js +1 -0
- package/storybook-static/main.750dea0e0e515fd26844.manager.bundle.js +1 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/runtime~main.1bd817501fb34a0cb56b.manager.bundle.js +1 -0
- package/storybook-static/runtime~main.9be73be4.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.826e89a1.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.07e1611f.iframe.bundle.js.LICENSE.txt → vendors~main.826e89a1.iframe.bundle.js.LICENSE.txt} +15 -0
- package/storybook-static/vendors~main.826e89a1.iframe.bundle.js.map +1 -0
- package/storybook-static/vendors~main.ed8bc18573e141ab3b26.manager.bundle.js +2 -0
- package/storybook-static/{vendors~main.11281b487bf96f5ff19e.manager.bundle.js.LICENSE.txt → vendors~main.ed8bc18573e141ab3b26.manager.bundle.js.LICENSE.txt} +18 -18
- package/storybook-static/0.0d994c92.iframe.bundle.js +0 -3
- package/storybook-static/0.0d994c92.iframe.bundle.js.map +0 -1
- package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +0 -1
- package/storybook-static/1.aabc3f3a.iframe.bundle.js +0 -1
- package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +0 -2
- package/storybook-static/5.63ab4f94d50a3acf080d.manager.bundle.js +0 -1
- package/storybook-static/6.13a534cb.iframe.bundle.js +0 -1
- package/storybook-static/6.a6d45262f7e98f3f18d3.manager.bundle.js +0 -2
- package/storybook-static/7.097710753af9a1c41b80.manager.bundle.js +0 -1
- package/storybook-static/7.9ce807e3.iframe.bundle.js +0 -3
- package/storybook-static/7.9ce807e3.iframe.bundle.js.map +0 -1
- package/storybook-static/8.1bf48ea7.iframe.bundle.js +0 -1
- package/storybook-static/main.6eab4ef6.iframe.bundle.js +0 -1
- package/storybook-static/main.9d5968bcf15d21f5487c.manager.bundle.js +0 -1
- package/storybook-static/runtime~main.708d7ac1.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.c8dac23bc753439736f0.manager.bundle.js +0 -1
- package/storybook-static/vendors~main.07e1611f.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.07e1611f.iframe.bundle.js.map +0 -1
- package/storybook-static/vendors~main.11281b487bf96f5ff19e.manager.bundle.js +0 -2
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { styled, useTheme } from "@mui/material/styles";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import MuiDrawer from "@mui/material/Drawer";
|
|
5
|
+
import MuiAppBar from "@mui/material/AppBar";
|
|
6
|
+
import Toolbar from "@mui/material/Toolbar";
|
|
7
|
+
import List from "@mui/material/List";
|
|
8
|
+
import Typography from "@mui/material/Typography";
|
|
9
|
+
// import Divider from "@mui/material/Divider";
|
|
10
|
+
import IconButton from "@mui/material/IconButton";
|
|
11
|
+
import MenuIcon from "@mui/icons-material/Menu";
|
|
12
|
+
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
13
|
+
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
14
|
+
import ListItemButton from "@mui/material/ListItemButton";
|
|
15
|
+
import ListItemText from "@mui/material/ListItemText";
|
|
16
|
+
import Avatar from "@mui/material/Avatar";
|
|
17
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
18
|
+
import { HawaPopMenu } from "../elements/HawaPopMenu";
|
|
19
|
+
|
|
20
|
+
const drawerWidth = 200;
|
|
21
|
+
|
|
22
|
+
const openedMixin = (theme) => ({
|
|
23
|
+
width: drawerWidth,
|
|
24
|
+
transition: theme.transitions.create("width", {
|
|
25
|
+
easing: theme.transitions.easing.sharp,
|
|
26
|
+
duration: theme.transitions.duration.enteringScreen
|
|
27
|
+
}),
|
|
28
|
+
overflowX: "hidden"
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const closedMixin = (theme) => ({
|
|
32
|
+
transition: theme.transitions.create("width", {
|
|
33
|
+
easing: theme.transitions.easing.sharp,
|
|
34
|
+
duration: theme.transitions.duration.leavingScreen
|
|
35
|
+
}),
|
|
36
|
+
overflowX: "hidden",
|
|
37
|
+
width: `calc(${theme.spacing(0)} + 1px)`,
|
|
38
|
+
[theme.breakpoints.up("sm")]: {
|
|
39
|
+
width: `calc(${theme.spacing(8)} + 1px)`
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const DrawerHeader = styled("div")(({ theme, direction }) => ({
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: direction === "rtl" ? "flex-start" : "flex-end",
|
|
47
|
+
padding: theme.spacing(0, 1),
|
|
48
|
+
// necessary for content to be below app bar
|
|
49
|
+
...theme.mixins.toolbar
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
const AppBar = styled(MuiAppBar, {
|
|
53
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
54
|
+
})(({ theme, open, direction }) => ({
|
|
55
|
+
zIndex: theme.zIndex.drawer + 1,
|
|
56
|
+
transition: theme.transitions.create(["width", "margin"], {
|
|
57
|
+
easing: theme.transitions.easing.sharp,
|
|
58
|
+
duration: theme.transitions.duration.leavingScreen
|
|
59
|
+
}),
|
|
60
|
+
|
|
61
|
+
...(open && {
|
|
62
|
+
marginLeft: direction === "rtl" ? 0 : drawerWidth,
|
|
63
|
+
marginRight: direction === "rtl" ? drawerWidth : 0,
|
|
64
|
+
width: `calc(100% - ${drawerWidth}px)`,
|
|
65
|
+
transition: theme.transitions.create(["width", "margin"], {
|
|
66
|
+
easing: theme.transitions.easing.sharp,
|
|
67
|
+
duration: theme.transitions.duration.enteringScreen
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
const Drawer = styled(MuiDrawer, {
|
|
73
|
+
shouldForwardProp: (prop) => prop !== "open"
|
|
74
|
+
})(({ theme, open }) => ({
|
|
75
|
+
width: drawerWidth,
|
|
76
|
+
flexShrink: 0,
|
|
77
|
+
whiteSpace: "nowrap",
|
|
78
|
+
boxSizing: "border-box",
|
|
79
|
+
...(open && {
|
|
80
|
+
...openedMixin(theme),
|
|
81
|
+
"& .MuiDrawer-paper": openedMixin(theme)
|
|
82
|
+
}),
|
|
83
|
+
...(!open && {
|
|
84
|
+
...closedMixin(theme),
|
|
85
|
+
"& .MuiDrawer-paper": closedMixin(theme)
|
|
86
|
+
})
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
export function HawaAppLayout(props) {
|
|
90
|
+
const theme = useTheme();
|
|
91
|
+
const [open, setOpen] = React.useState(true);
|
|
92
|
+
const isArabic = props.lang === "ar";
|
|
93
|
+
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
94
|
+
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
|
95
|
+
|
|
96
|
+
const handleOpenNavMenu = (event) => setAnchorElNav(event.currentTarget);
|
|
97
|
+
const handleOpenUserMenu = (event) => setAnchorElUser(event.currentTarget);
|
|
98
|
+
const handleCloseNavMenu = () => setAnchorElNav(null);
|
|
99
|
+
const handleCloseUserMenu = () => setAnchorElUser(null);
|
|
100
|
+
const handleDrawerOpen = () => setOpen(true);
|
|
101
|
+
const handleDrawerClose = () => setOpen(false);
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setOpen(!open);
|
|
105
|
+
}, []);
|
|
106
|
+
return (
|
|
107
|
+
<Box sx={{ display: "flex", direction: isArabic ? "rtl" : "ltr" }}>
|
|
108
|
+
<AppBar
|
|
109
|
+
variant="appbar"
|
|
110
|
+
position="fixed"
|
|
111
|
+
open={open}
|
|
112
|
+
direction={isArabic ? "rtl" : "ltr"}
|
|
113
|
+
>
|
|
114
|
+
<Toolbar
|
|
115
|
+
variant="appbar"
|
|
116
|
+
sx={{ paddingLeft: { xs: 3 }, paddingRight: { xs: 3 } }}
|
|
117
|
+
>
|
|
118
|
+
<IconButton
|
|
119
|
+
color="inherit"
|
|
120
|
+
aria-label="open drawer"
|
|
121
|
+
onClick={handleDrawerOpen}
|
|
122
|
+
edge="start"
|
|
123
|
+
s
|
|
124
|
+
sx={{
|
|
125
|
+
marginRight: 5,
|
|
126
|
+
...(open && { display: "none" })
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
<MenuIcon />
|
|
130
|
+
</IconButton>
|
|
131
|
+
|
|
132
|
+
<div
|
|
133
|
+
style={{
|
|
134
|
+
display: "flex",
|
|
135
|
+
flexDirection: "row",
|
|
136
|
+
justifyContent: "space-between",
|
|
137
|
+
alignItems: "center",
|
|
138
|
+
width: "100%",
|
|
139
|
+
margin: 0
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
<Typography
|
|
143
|
+
variant="h6"
|
|
144
|
+
noWrap
|
|
145
|
+
component="div"
|
|
146
|
+
sx={{
|
|
147
|
+
display: {
|
|
148
|
+
xs: open ? "none" : "flex",
|
|
149
|
+
sm: "flex"
|
|
150
|
+
}
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{props.pageTitle}
|
|
154
|
+
</Typography>
|
|
155
|
+
|
|
156
|
+
<Box style={{ position: "absolute", right: 10 }}>
|
|
157
|
+
<Tooltip title="Open settings">
|
|
158
|
+
<IconButton
|
|
159
|
+
onClick={handleOpenUserMenu}
|
|
160
|
+
// sx={{ p: 0 }}
|
|
161
|
+
size="small"
|
|
162
|
+
>
|
|
163
|
+
<Avatar
|
|
164
|
+
style={{ width: 30, height: 30 }}
|
|
165
|
+
fontSize="inherit"
|
|
166
|
+
/>
|
|
167
|
+
</IconButton>
|
|
168
|
+
</Tooltip>
|
|
169
|
+
<HawaPopMenu
|
|
170
|
+
menuItems={props.accountMenu}
|
|
171
|
+
anchor={anchorElUser}
|
|
172
|
+
handleClose={handleCloseUserMenu}
|
|
173
|
+
/>
|
|
174
|
+
</Box>
|
|
175
|
+
</div>
|
|
176
|
+
</Toolbar>
|
|
177
|
+
</AppBar>
|
|
178
|
+
|
|
179
|
+
<Drawer
|
|
180
|
+
// anchor="left"
|
|
181
|
+
|
|
182
|
+
variant="permanent"
|
|
183
|
+
open={open}
|
|
184
|
+
// sx={{ display: { xs: open ? "flex" : "none", md: "flex" } }}
|
|
185
|
+
>
|
|
186
|
+
<DrawerHeader direction={isArabic ? "rtl" : "ltr"}>
|
|
187
|
+
{props.logo}
|
|
188
|
+
<IconButton onClick={handleDrawerClose}>
|
|
189
|
+
{theme.direction === "rtl" ? (
|
|
190
|
+
<ChevronRightIcon />
|
|
191
|
+
) : (
|
|
192
|
+
<ChevronLeftIcon />
|
|
193
|
+
)}
|
|
194
|
+
</IconButton>
|
|
195
|
+
</DrawerHeader>
|
|
196
|
+
{/* <Divider /> */}
|
|
197
|
+
<List
|
|
198
|
+
// sx={{
|
|
199
|
+
// display: {
|
|
200
|
+
// xs: open ? "flex" : "none",
|
|
201
|
+
// sm: open ? "flex" : "none",
|
|
202
|
+
// md: "flex"
|
|
203
|
+
// },
|
|
204
|
+
// flexDirection: "column",
|
|
205
|
+
// padding: 0
|
|
206
|
+
// }}
|
|
207
|
+
>
|
|
208
|
+
{props.pages.map((p, jk) => {
|
|
209
|
+
return (
|
|
210
|
+
<Tooltip
|
|
211
|
+
title={p.text}
|
|
212
|
+
key={jk}
|
|
213
|
+
placement={"right"}
|
|
214
|
+
arrow={true}
|
|
215
|
+
PopperProps={{ style: { opacity: open ? 0 : 1 } }}
|
|
216
|
+
>
|
|
217
|
+
<ListItemButton
|
|
218
|
+
variant={
|
|
219
|
+
props.pageName?.toLowerCase() === p.slug?.toLowerCase() &&
|
|
220
|
+
"clicked"
|
|
221
|
+
}
|
|
222
|
+
onClick={p.action}
|
|
223
|
+
key={p.text}
|
|
224
|
+
sx={{
|
|
225
|
+
minHeight: 48,
|
|
226
|
+
justifyContent: open ? "initial" : "center",
|
|
227
|
+
px: 2.5
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
<p.icon />
|
|
231
|
+
<div style={{ width: 20 }} />
|
|
232
|
+
<ListItemText
|
|
233
|
+
primary={p.text}
|
|
234
|
+
sx={{ opacity: open ? 1 : 0 }}
|
|
235
|
+
/>
|
|
236
|
+
</ListItemButton>
|
|
237
|
+
</Tooltip>
|
|
238
|
+
);
|
|
239
|
+
})}
|
|
240
|
+
</List>
|
|
241
|
+
</Drawer>
|
|
242
|
+
<Box
|
|
243
|
+
onClick={open && (() => setOpen(false))}
|
|
244
|
+
sx={{
|
|
245
|
+
flexGrow: 1,
|
|
246
|
+
p: 3,
|
|
247
|
+
position: "absolute",
|
|
248
|
+
left: {
|
|
249
|
+
xs: open ? 4 : 4,
|
|
250
|
+
sm: open ? drawerWidth + 4 : 70
|
|
251
|
+
},
|
|
252
|
+
right: { xs: 4 }
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
<DrawerHeader />
|
|
256
|
+
<div style={{ marginTop: -10 }}>{props.children}</div>
|
|
257
|
+
</Box>
|
|
258
|
+
</Box>
|
|
259
|
+
);
|
|
260
|
+
}
|
package/src/styles.css
CHANGED