umwd-components 0.1.233 → 0.1.234

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.
@@ -182,7 +182,13 @@ function SideNav(_ref) {
182
182
  }
183
183
  }, /*#__PURE__*/React__namespace.createElement(material.IconButton, {
184
184
  onClick: handleDrawerClose
185
- }, theme.direction === "rtl" ? /*#__PURE__*/React__namespace.createElement(iconsMaterial.ChevronRight, null) : /*#__PURE__*/React__namespace.createElement(iconsMaterial.ChevronLeft, null))), /*#__PURE__*/React__namespace.createElement(material.Divider, null), sections.map((section, index) => /*#__PURE__*/React__namespace.createElement(Link, {
185
+ }, theme.direction === "rtl" ? /*#__PURE__*/React__namespace.createElement(iconsMaterial.ChevronRight, null) : /*#__PURE__*/React__namespace.createElement(iconsMaterial.ChevronLeft, null))), /*#__PURE__*/React__namespace.createElement(material.Divider, null), sections.map((section, index) => /*#__PURE__*/React__namespace.createElement(material.Box, {
186
+ sx: {
187
+ display: "flex",
188
+ flexDirection: "column",
189
+ alignItems: "flex-start"
190
+ }
191
+ }, /*#__PURE__*/React__namespace.createElement(Link, {
186
192
  key: index,
187
193
  href: section.link,
188
194
  passHref: true
@@ -194,11 +200,30 @@ function SideNav(_ref) {
194
200
  p: 1,
195
201
  cursor: "pointer"
196
202
  }
197
- }, section.icon, open && /*#__PURE__*/React__namespace.createElement(material.Typography, {
203
+ }, section.icon, !open && section.subSections && /*#__PURE__*/React__namespace.createElement(material.Typography, null, "..."), open && /*#__PURE__*/React__namespace.createElement(material.Typography, {
198
204
  sx: {
199
205
  pl: 2
200
206
  }
201
- }, section.title))))), /*#__PURE__*/React__namespace.createElement(material.Box, {
207
+ }, section.title))), section.subSections && open && section.subSections.map((subSection, index) => {
208
+ return /*#__PURE__*/React__namespace.createElement(Link, {
209
+ key: index,
210
+ href: subSection.link,
211
+ passHref: true
212
+ }, /*#__PURE__*/React__namespace.createElement(material.Box, {
213
+ sx: {
214
+ display: "flex",
215
+ alignItems: "center",
216
+ justifyContent: "center",
217
+ p: 1,
218
+ cursor: "pointer"
219
+ }
220
+ }, /*#__PURE__*/React__namespace.createElement(material.Typography, {
221
+ variant: "body2",
222
+ sx: {
223
+ pl: 4
224
+ }
225
+ }, subSection.title)));
226
+ })))), /*#__PURE__*/React__namespace.createElement(material.Box, {
202
227
  component: "main",
203
228
  sx: {
204
229
  flexGrow: 1,
@@ -159,7 +159,13 @@ function SideNav(_ref) {
159
159
  }
160
160
  }, /*#__PURE__*/React.createElement(IconButton, {
161
161
  onClick: handleDrawerClose
162
- }, theme.direction === "rtl" ? /*#__PURE__*/React.createElement(ChevronRight, null) : /*#__PURE__*/React.createElement(ChevronLeft, null))), /*#__PURE__*/React.createElement(Divider, null), sections.map((section, index) => /*#__PURE__*/React.createElement(Link, {
162
+ }, theme.direction === "rtl" ? /*#__PURE__*/React.createElement(ChevronRight, null) : /*#__PURE__*/React.createElement(ChevronLeft, null))), /*#__PURE__*/React.createElement(Divider, null), sections.map((section, index) => /*#__PURE__*/React.createElement(Box, {
163
+ sx: {
164
+ display: "flex",
165
+ flexDirection: "column",
166
+ alignItems: "flex-start"
167
+ }
168
+ }, /*#__PURE__*/React.createElement(Link, {
163
169
  key: index,
164
170
  href: section.link,
165
171
  passHref: true
@@ -171,11 +177,30 @@ function SideNav(_ref) {
171
177
  p: 1,
172
178
  cursor: "pointer"
173
179
  }
174
- }, section.icon, open && /*#__PURE__*/React.createElement(Typography, {
180
+ }, section.icon, !open && section.subSections && /*#__PURE__*/React.createElement(Typography, null, "..."), open && /*#__PURE__*/React.createElement(Typography, {
175
181
  sx: {
176
182
  pl: 2
177
183
  }
178
- }, section.title))))), /*#__PURE__*/React.createElement(Box, {
184
+ }, section.title))), section.subSections && open && section.subSections.map((subSection, index) => {
185
+ return /*#__PURE__*/React.createElement(Link, {
186
+ key: index,
187
+ href: subSection.link,
188
+ passHref: true
189
+ }, /*#__PURE__*/React.createElement(Box, {
190
+ sx: {
191
+ display: "flex",
192
+ alignItems: "center",
193
+ justifyContent: "center",
194
+ p: 1,
195
+ cursor: "pointer"
196
+ }
197
+ }, /*#__PURE__*/React.createElement(Typography, {
198
+ variant: "body2",
199
+ sx: {
200
+ pl: 4
201
+ }
202
+ }, subSection.title)));
203
+ })))), /*#__PURE__*/React.createElement(Box, {
179
204
  component: "main",
180
205
  sx: {
181
206
  flexGrow: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.233",
3
+ "version": "0.1.234",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -14,6 +14,7 @@ import {
14
14
  SpeedDialAction,
15
15
  Drawer,
16
16
  AppBar,
17
+ Stack,
17
18
  } from "@mui/material";
18
19
  import {} from "@mui/material";
19
20
  import {
@@ -31,6 +32,10 @@ interface SideNavProps {
31
32
  title: string;
32
33
  icon: React.ReactNode;
33
34
  link: string;
35
+ subSections?: Array<{
36
+ title: string;
37
+ link: string;
38
+ }>;
34
39
  }>;
35
40
  actions: Array<{
36
41
  icon: React.ReactNode;
@@ -216,20 +221,52 @@ function SideNav({
216
221
  </Box>
217
222
  <Divider />
218
223
  {sections.map((section, index) => (
219
- <Link key={index} href={section.link} passHref>
220
- <Box
221
- sx={{
222
- display: "flex",
223
- alignItems: "center",
224
- justifyContent: "center",
225
- p: 1,
226
- cursor: "pointer",
227
- }}
228
- >
229
- {section.icon}
230
- {open && <Typography sx={{ pl: 2 }}>{section.title}</Typography>}
231
- </Box>
232
- </Link>
224
+ <Box
225
+ sx={{
226
+ display: "flex",
227
+ flexDirection: "column",
228
+ alignItems: "flex-start",
229
+ }}
230
+ >
231
+ <Link key={index} href={section.link} passHref>
232
+ <Box
233
+ sx={{
234
+ display: "flex",
235
+ alignItems: "center",
236
+ justifyContent: "center",
237
+ p: 1,
238
+ cursor: "pointer",
239
+ }}
240
+ >
241
+ {section.icon}
242
+ {!open && section.subSections && <Typography>...</Typography>}
243
+ {open && (
244
+ <Typography sx={{ pl: 2 }}>{section.title}</Typography>
245
+ )}
246
+ </Box>
247
+ </Link>
248
+ {section.subSections &&
249
+ open &&
250
+ section.subSections.map((subSection, index) => {
251
+ return (
252
+ <Link key={index} href={subSection.link} passHref>
253
+ <Box
254
+ sx={{
255
+ display: "flex",
256
+ alignItems: "center",
257
+ justifyContent: "center",
258
+ p: 1,
259
+ cursor: "pointer",
260
+ }}
261
+ >
262
+ <Typography variant={"body2"} sx={{ pl: 4 }}>
263
+ {subSection.title}
264
+ </Typography>
265
+ </Box>
266
+ </Link>
267
+ );
268
+ })}
269
+ </Box>
233
270
  ))}
234
271
  </Drawer>
235
272
 
@@ -32,6 +32,16 @@ HelloWorld.args = {
32
32
  title: "My Account",
33
33
  icon: <AccountBoxIcon />,
34
34
  link: "/account",
35
+ subSections: [
36
+ {
37
+ title: "Dashboard",
38
+ link: "/account/dashboard",
39
+ },
40
+ {
41
+ title: "Settings",
42
+ link: "/account/settings",
43
+ },
44
+ ],
35
45
  },
36
46
  ],
37
47
  };