@superdispatch/ui-lab 0.15.0 → 0.18.0

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.
@@ -0,0 +1,43 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["fullViewportHeight"];
4
+ import { mergeRefs } from '@superdispatch/ui';
5
+ import { forwardRef, useLayoutEffect, useRef } from 'react';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export var Container = /*#__PURE__*/forwardRef((_ref, ref) => {
8
+ var {
9
+ fullViewportHeight
10
+ } = _ref,
11
+ props = _objectWithoutProperties(_ref, _excluded);
12
+
13
+ var nodeRef = useRef(null);
14
+ useLayoutEffect(() => {
15
+ if (!fullViewportHeight) {
16
+ if (nodeRef.current) {
17
+ nodeRef.current.style.removeProperty('height');
18
+ nodeRef.current.style.removeProperty('--vh');
19
+ }
20
+
21
+ return;
22
+ }
23
+
24
+ function updateHeight() {
25
+ if (nodeRef.current) {
26
+ // https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
27
+ nodeRef.current.style.setProperty('height', 'calc(var(--vh, 1vh) * 100)');
28
+ nodeRef.current.style.setProperty('--vh', "".concat(window.innerHeight * 0.01, "px"));
29
+ }
30
+ }
31
+
32
+ updateHeight();
33
+ window.addEventListener('resize', updateHeight);
34
+ return () => {
35
+ window.removeEventListener('resize', updateHeight);
36
+ };
37
+ }, [fullViewportHeight]);
38
+ return /*#__PURE__*/_jsx("div", _objectSpread({
39
+ ref: mergeRefs(ref, nodeRef)
40
+ }, props));
41
+ });
42
+ if (process.env.NODE_ENV !== "production") Container.displayName = "Container";
43
+ Container.displayName = 'Container';
package/dist-src/index.js CHANGED
@@ -3,9 +3,17 @@ export * from "./banner/Banner.js";
3
3
  export * from "./box/Box.js";
4
4
  export * from "./button-area/ButtonArea.js";
5
5
  export * from "./button/Button.js";
6
+ export * from "./container/Container.js";
6
7
  export * from "./description-item/DescriptionItem.js";
7
8
  export * from "./file-drop-zone/FileDropZone.js";
8
9
  export * from "./file-list-item/FileListItem.js";
10
+ export * from "./navbar/Navbar.js";
11
+ export * from "./navbar/NavbarAvatar.js";
12
+ export * from "./navbar/NavbarBottomBar.js";
13
+ export { useNavbarContext } from "./navbar/NavbarContext.js";
14
+ export * from "./navbar/NavbarItem.js";
15
+ export * from "./navbar/NavbarList.js";
16
+ export * from "./navbar/NavbarMenu.js";
9
17
  export * from "./sidebar/Sidebar.js";
10
18
  export * from "./sidebar/SidebarContainer.js";
11
19
  export * from "./sidebar/SidebarDivider.js";
@@ -0,0 +1,83 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import { Drawer, useMediaQuery, useTheme } from '@material-ui/core';
3
+ import { useResponsiveValue } from '@superdispatch/ui';
4
+ import { useMemo, useState } from 'react';
5
+ import styled from 'styled-components';
6
+ import { NavbarBottomBar } from "./NavbarBottomBar.js";
7
+ import { NavbarContext } from "./NavbarContext.js";
8
+ import { NavbarList } from "./NavbarList.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var Aside = /*#__PURE__*/styled.aside.withConfig({
12
+ displayName: "Navbar__Aside",
13
+ componentId: "SD__sc-1oiqig8-0"
14
+ })(["display:flex;flex-direction:column;overflow:auto;"]);
15
+ var Main = /*#__PURE__*/styled.main.withConfig({
16
+ displayName: "Navbar__Main",
17
+ componentId: "SD__sc-1oiqig8-1"
18
+ })(["flex:1;display:flex;flex-direction:column;overflow:auto;"]);
19
+ export function Navbar(_ref) {
20
+ var {
21
+ footer,
22
+ items,
23
+ header,
24
+ bottomItems,
25
+ children,
26
+ containerStyle,
27
+ hasExtraBadge
28
+ } = _ref;
29
+ var theme = useTheme();
30
+ var [isDrawerOpen, setDrawerOpen] = useState(false);
31
+ var platform = useResponsiveValue('mobile', 'tablet', 'desktop');
32
+ var isMobile = platform === 'mobile';
33
+ var matches = useMediaQuery(theme.breakpoints.up('md'), {
34
+ noSsr: true
35
+ });
36
+ var [isExpanded, setIsExpanded] = useState(matches);
37
+ var hasBadge = hasExtraBadge || items.some(item => item.badge);
38
+ var ctx = useMemo(() => ({
39
+ isDrawerOpen,
40
+ isExpanded,
41
+ setIsExpanded,
42
+ setDrawerOpen
43
+ }), [isDrawerOpen, isExpanded, setIsExpanded, setDrawerOpen]);
44
+ return /*#__PURE__*/_jsx(NavbarContext.Provider, {
45
+ value: ctx,
46
+ children: /*#__PURE__*/_jsxs("div", {
47
+ style: _objectSpread({
48
+ display: 'flex',
49
+ height: '100%',
50
+ flexDirection: isMobile ? 'column' : 'row'
51
+ }, containerStyle),
52
+ children: [!isMobile && /*#__PURE__*/_jsx(Aside, {
53
+ children: /*#__PURE__*/_jsx(NavbarList, {
54
+ header: header,
55
+ items: items,
56
+ footer: footer
57
+ })
58
+ }), /*#__PURE__*/_jsx(Main, {
59
+ children: children
60
+ }), isMobile && /*#__PURE__*/_jsx(NavbarBottomBar, {
61
+ items: bottomItems,
62
+ hasMenuBadge: hasBadge
63
+ }), /*#__PURE__*/_jsx(Drawer, {
64
+ open: isDrawerOpen,
65
+ anchor: "right",
66
+ onClose: () => {
67
+ setDrawerOpen(false);
68
+ },
69
+ PaperProps: {
70
+ style: {
71
+ width: '280px',
72
+ minWidth: '280px'
73
+ }
74
+ },
75
+ children: /*#__PURE__*/_jsx(NavbarList, {
76
+ header: header,
77
+ items: items,
78
+ footer: footer
79
+ })
80
+ })]
81
+ })
82
+ });
83
+ }
@@ -0,0 +1,52 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "subtitle", "children"];
4
+ import { Avatar, Typography } from '@material-ui/core';
5
+ import { Color, Column, Columns, Stack } from '@superdispatch/ui';
6
+ import styled from 'styled-components';
7
+ import { useNavbarContext } from "./NavbarContext.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ var StyledTypography = /*#__PURE__*/styled(Typography).withConfig({
11
+ displayName: "NavbarAvatar__StyledTypography",
12
+ componentId: "SD__sc-19q2zd0-0"
13
+ })(["color:", ";text-overflow:ellipsis;white-space:nowrap;overflow:hidden;&:hover{color:", ";}"], Color.Silver500, Color.White);
14
+ export function NavbarAvatar(_ref) {
15
+ var {
16
+ title,
17
+ subtitle,
18
+ children
19
+ } = _ref,
20
+ props = _objectWithoutProperties(_ref, _excluded);
21
+
22
+ var {
23
+ isExpanded,
24
+ isDrawerOpen
25
+ } = useNavbarContext();
26
+
27
+ if (isExpanded || isDrawerOpen) {
28
+ return /*#__PURE__*/_jsxs(Columns, {
29
+ space: "xsmall",
30
+ align: "center",
31
+ children: [/*#__PURE__*/_jsx(Column, {
32
+ width: "content",
33
+ children: /*#__PURE__*/_jsx(Avatar, _objectSpread(_objectSpread({}, props), {}, {
34
+ children: children
35
+ }))
36
+ }), /*#__PURE__*/_jsx(Column, {
37
+ children: /*#__PURE__*/_jsxs(Stack, {
38
+ space: "none",
39
+ children: [/*#__PURE__*/_jsx(StyledTypography, {
40
+ children: title
41
+ }), /*#__PURE__*/_jsx(StyledTypography, {
42
+ children: subtitle
43
+ })]
44
+ })
45
+ })]
46
+ });
47
+ }
48
+
49
+ return /*#__PURE__*/_jsx(Avatar, _objectSpread(_objectSpread({}, props), {}, {
50
+ children: children
51
+ }));
52
+ }
@@ -0,0 +1,66 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
3
+ import { Menu } from '@material-ui/icons';
4
+ import { Color } from '@superdispatch/ui';
5
+ import { useMemo } from 'react';
6
+ import styled from 'styled-components';
7
+ import { useNavbarContext } from "./NavbarContext.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ import { createElement as _createElement } from "react";
11
+ var StyledBottomNavigation = /*#__PURE__*/styled(BottomNavigation).withConfig({
12
+ displayName: "NavbarBottomBar__StyledBottomNavigation",
13
+ componentId: "SD__sc-9z6v3k-0"
14
+ })(["background:", ";"], Color.Dark500);
15
+ var StyledBottomNavigationAction = /*#__PURE__*/styled(BottomNavigationAction).withConfig({
16
+ displayName: "NavbarBottomBar__StyledBottomNavigationAction",
17
+ componentId: "SD__sc-9z6v3k-1"
18
+ })(["&&{background:#1b2638;color:", ";padding:6px 0 8px;line-height:20px;}&:first-child{padding-left:12px;}&:last-child{padding-right:12px;}&.Mui-selected{color:", ";.MuiBottomNavigationAction-label{font-size:0.75rem;}}"], Color.Silver500, Color.White);
19
+ var IconWrapper = /*#__PURE__*/styled.div.withConfig({
20
+ displayName: "NavbarBottomBar__IconWrapper",
21
+ componentId: "SD__sc-9z6v3k-2"
22
+ })(["position:relative;"]);
23
+ var IconLabel = /*#__PURE__*/styled.div.withConfig({
24
+ displayName: "NavbarBottomBar__IconLabel",
25
+ componentId: "SD__sc-9z6v3k-3"
26
+ })(["display:flex;align-items:center;justify-content:center;font-size:12px;border-radius:50%;color:", ";background:", ";position:absolute;top:0;right:0;width:8px;height:8px;"], Color.White, Color.Red300);
27
+ export function NavbarBottomBar(_ref) {
28
+ var {
29
+ items,
30
+ hasMenuBadge
31
+ } = _ref;
32
+ var {
33
+ isDrawerOpen,
34
+ setDrawerOpen
35
+ } = useNavbarContext();
36
+ var activeItem = useMemo(() => items.find(item => item.active), [items]);
37
+ return /*#__PURE__*/_jsxs(StyledBottomNavigation, {
38
+ value: activeItem === null || activeItem === void 0 ? void 0 : activeItem.value,
39
+ showLabels: true,
40
+ onChange: (_event, newValue) => {
41
+ if (newValue) {
42
+ if (newValue === 'menu') {
43
+ setDrawerOpen(!isDrawerOpen);
44
+ } else {
45
+ setDrawerOpen(false);
46
+ }
47
+ }
48
+ },
49
+ children: [items.map(item => /*#__PURE__*/_createElement(StyledBottomNavigationAction, _objectSpread(_objectSpread({}, item), {}, {
50
+ key: item.value,
51
+ icon: item.hasBadge ? /*#__PURE__*/_jsxs(IconWrapper, {
52
+ children: [/*#__PURE__*/_jsx(IconLabel, {}), item.icon]
53
+ }) : item.icon
54
+ }))), /*#__PURE__*/_jsx(StyledBottomNavigationAction, {
55
+ value: "menu",
56
+ label: "Menu",
57
+ icon: hasMenuBadge ? /*#__PURE__*/_jsxs(IconWrapper, {
58
+ children: [/*#__PURE__*/_jsx(IconLabel, {}), /*#__PURE__*/_jsx(Menu, {
59
+ fontSize: "small"
60
+ })]
61
+ }) : /*#__PURE__*/_jsx(Menu, {
62
+ fontSize: "small"
63
+ })
64
+ })]
65
+ });
66
+ }
@@ -0,0 +1,11 @@
1
+ import { noop } from 'lodash';
2
+ import { createContext, useContext } from 'react';
3
+ export var NavbarContext = /*#__PURE__*/createContext({
4
+ isDrawerOpen: false,
5
+ isExpanded: false,
6
+ setIsExpanded: noop,
7
+ setDrawerOpen: noop
8
+ });
9
+ export function useNavbarContext() {
10
+ return useContext(NavbarContext);
11
+ }
@@ -0,0 +1,51 @@
1
+ import { Color, useUID } from '@superdispatch/ui';
2
+ import styled from 'styled-components';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ export var NavbarBadge = /*#__PURE__*/styled.span.withConfig({
6
+ displayName: "NavbarItem__NavbarBadge",
7
+ componentId: "SD__sc-1pvzq3w-0"
8
+ })(["flex-shrink:0;padding:4px 6px;min-width:20px;line-height:12px;font-size:12px;font-weight:400;border-radius:10px;text-align:center;background:#131c2a;&[data-variant='primary']{color:", ";background:", ";}&[data-variant='danger']{color:", ";background:", ";}"], Color.White, Color.Blue300, Color.White, Color.Red500);
9
+ export var NavbarLabel = /*#__PURE__*/styled.span.withConfig({
10
+ displayName: "NavbarItem__NavbarLabel",
11
+ componentId: "SD__sc-1pvzq3w-1"
12
+ })(["flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"]);
13
+ var NavbarItemRoot = /*#__PURE__*/styled.div.withConfig({
14
+ displayName: "NavbarItem__NavbarItemRoot",
15
+ componentId: "SD__sc-1pvzq3w-2"
16
+ })(["width:100%;display:flex;align-items:center;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;padding:8px 16px;border-left:4px solid transparent;&:hover,&[aria-current]{background-color:#2f394a;color:", ";border-left-color:", ";}"], Color.White, Color.Blue300);
17
+ var IconWrapper = /*#__PURE__*/styled.div.withConfig({
18
+ displayName: "NavbarItem__IconWrapper",
19
+ componentId: "SD__sc-1pvzq3w-3"
20
+ })(["width:24px;margin-right:8px;& svg{font-size:24px;}"]);
21
+ export function NavbarItem(_ref) {
22
+ var {
23
+ label,
24
+ gutter,
25
+ badge,
26
+ icon,
27
+ component,
28
+ onClick,
29
+ variant,
30
+ ident = 0
31
+ } = _ref;
32
+ var uid = useUID();
33
+ return /*#__PURE__*/_jsxs(NavbarItemRoot, {
34
+ as: component,
35
+ onClick: onClick,
36
+ "aria-labelledby": uid,
37
+ style: {
38
+ marginTop: gutter ? '16px' : '0',
39
+ paddingLeft: (ident + 1) * 20
40
+ },
41
+ children: [/*#__PURE__*/_jsx(IconWrapper, {
42
+ children: icon
43
+ }), /*#__PURE__*/_jsx(NavbarLabel, {
44
+ id: uid,
45
+ children: label
46
+ }), badge != null && /*#__PURE__*/_jsx(NavbarBadge, {
47
+ "data-variant": variant,
48
+ children: badge
49
+ })]
50
+ });
51
+ }
@@ -0,0 +1,145 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import { IconButton } from '@material-ui/core';
3
+ import { Menu as MenuIcon, MenuOpen, MoreHoriz } from '@material-ui/icons';
4
+ import { AdaptiveVerticalToolbar, Color, Inline, useResponsiveValue } from '@superdispatch/ui';
5
+ import { useMemo } from 'react';
6
+ import styled from 'styled-components';
7
+ import { useNavbarContext } from "./NavbarContext.js";
8
+ import { NavbarBadge, NavbarItem, NavbarLabel } from "./NavbarItem.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var Header = /*#__PURE__*/styled.div.withConfig({
12
+ displayName: "NavbarList__Header",
13
+ componentId: "SD__sc-19zrmxc-0"
14
+ })(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;"]);
15
+ var Wrapper = /*#__PURE__*/styled.div.withConfig({
16
+ displayName: "NavbarList__Wrapper",
17
+ componentId: "SD__sc-19zrmxc-1"
18
+ })(["display:flex;flex:1;flex-direction:column;overflow:hidden;padding-top:16px;background:#1b2638;transition:width 0.3s linear;height:100%;width:", ";&[data-expanded='true']{width:", ";}&[data-expanded='false']{width:", ";& > ", "{justify-content:center;}}"], _ref => {
19
+ var {
20
+ isMobile
21
+ } = _ref;
22
+ return isMobile ? '280px' : 'initial';
23
+ }, _ref2 => {
24
+ var {
25
+ isMobile
26
+ } = _ref2;
27
+ return isMobile ? '280px' : '240px';
28
+ }, _ref3 => {
29
+ var {
30
+ isMobile
31
+ } = _ref3;
32
+ return isMobile ? '280px' : '72px';
33
+ }, Header);
34
+ var ExpandIconButton = /*#__PURE__*/styled(IconButton).withConfig({
35
+ displayName: "NavbarList__ExpandIconButton",
36
+ componentId: "SD__sc-19zrmxc-2"
37
+ })(["color:", ";&&:focus{background-color:inherit;}"], Color.Silver500);
38
+ var Footer = /*#__PURE__*/styled.div.withConfig({
39
+ displayName: "NavbarList__Footer",
40
+ componentId: "SD__sc-19zrmxc-3"
41
+ })(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;"]);
42
+ var Root = /*#__PURE__*/styled.div.withConfig({
43
+ displayName: "NavbarList__Root",
44
+ componentId: "SD__sc-19zrmxc-4"
45
+ })(["color:inherit;background-color:unset;border-left:unset;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;padding:8px 16px;svg{font-size:24px;color:", ";}"], Color.Dark100);
46
+ export function NavbarMenuItem(_ref4) {
47
+ var {
48
+ label,
49
+ icon,
50
+ onClick,
51
+ component
52
+ } = _ref4;
53
+ return /*#__PURE__*/_jsx(Root, {
54
+ as: component,
55
+ onClick: onClick,
56
+ children: /*#__PURE__*/_jsxs(Inline, {
57
+ space: "xsmall",
58
+ verticalAlign: "center",
59
+ children: [icon, /*#__PURE__*/_jsx(NavbarLabel, {
60
+ children: label
61
+ })]
62
+ })
63
+ });
64
+ }
65
+ var Content = /*#__PURE__*/styled.div.withConfig({
66
+ displayName: "NavbarList__Content",
67
+ componentId: "SD__sc-19zrmxc-5"
68
+ })(["height:100%;min-height:50px;&[aria-expanded='false']{", ",", "{visibility:hidden;}}"], NavbarBadge, NavbarLabel);
69
+ export function NavbarList(_ref5) {
70
+ var {
71
+ header,
72
+ items,
73
+ footer
74
+ } = _ref5;
75
+ var platform = useResponsiveValue('mobile', 'tablet', 'desktop');
76
+ var isMobile = platform === 'mobile';
77
+ var {
78
+ isExpanded,
79
+ isDrawerOpen,
80
+ setDrawerOpen,
81
+ setIsExpanded
82
+ } = useNavbarContext();
83
+ var isSidebarOpened = isMobile ? isDrawerOpen : isExpanded;
84
+ var filteredItems = useMemo(() => items.filter(item => {
85
+ return !item.hide && (isSidebarOpened || !!item.icon);
86
+ }).map(item => _objectSpread(_objectSpread({}, item), {}, {
87
+ menuGroupKey: item.groupKey
88
+ })), [items, isSidebarOpened]);
89
+ return /*#__PURE__*/_jsxs(Wrapper, {
90
+ isMobile: isMobile,
91
+ "data-expanded": isSidebarOpened,
92
+ children: [/*#__PURE__*/_jsxs(Header, {
93
+ children: [isSidebarOpened && header, !isMobile && /*#__PURE__*/_jsx(ExpandIconButton, {
94
+ disableRipple: true,
95
+ style: isExpanded ? {
96
+ paddingRight: 0
97
+ } : {},
98
+ onClick: () => {
99
+ setIsExpanded(!isExpanded);
100
+ },
101
+ children: isExpanded ? /*#__PURE__*/_jsx(MenuOpen, {}) : /*#__PURE__*/_jsx(MenuIcon, {})
102
+ })]
103
+ }), /*#__PURE__*/_jsx(Content, {
104
+ "aria-expanded": isSidebarOpened,
105
+ children: /*#__PURE__*/_jsx(AdaptiveVerticalToolbar, {
106
+ disableGutters: true,
107
+ items: filteredItems,
108
+ renderItem: item => {
109
+ var navbarItem = item;
110
+ var index = filteredItems.indexOf(navbarItem);
111
+ var prev = filteredItems[index - 1];
112
+ return /*#__PURE__*/_jsx(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
113
+ gutter: prev && prev.groupKey !== navbarItem.groupKey,
114
+ onClick: event => {
115
+ var _item$onClick;
116
+
117
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
118
+
119
+ if (!event.isDefaultPrevented()) {
120
+ setDrawerOpen(false);
121
+ }
122
+ }
123
+ }));
124
+ },
125
+ renderMenuItem: item => /*#__PURE__*/_jsx(NavbarMenuItem, _objectSpread(_objectSpread({}, item), {}, {
126
+ onClick: event => {
127
+ var _item$onClick2;
128
+
129
+ (_item$onClick2 = item.onClick) === null || _item$onClick2 === void 0 ? void 0 : _item$onClick2.call(item, event);
130
+
131
+ if (!event.isDefaultPrevented()) {
132
+ setDrawerOpen(false);
133
+ }
134
+ }
135
+ })),
136
+ moreElement: /*#__PURE__*/_jsx(NavbarItem, {
137
+ icon: /*#__PURE__*/_jsx(MoreHoriz, {}),
138
+ label: "More"
139
+ })
140
+ })
141
+ }), /*#__PURE__*/_jsx(Footer, {
142
+ children: footer
143
+ })]
144
+ });
145
+ }
@@ -0,0 +1,80 @@
1
+ import { Menu, MenuItem, Typography } from '@material-ui/core';
2
+ import { Color, Inline } from '@superdispatch/ui';
3
+ import { useState } from 'react';
4
+ import styled from 'styled-components';
5
+ import { useNavbarContext } from "./NavbarContext.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ var Divider = /*#__PURE__*/styled.div.withConfig({
10
+ displayName: "NavbarMenu__Divider",
11
+ componentId: "SD__sc-1c8icpt-0"
12
+ })(["border-bottom:1px solid ", ";margin:8px -16px;"], Color.Silver400);
13
+ var StyledMenuItem = /*#__PURE__*/styled(MenuItem).withConfig({
14
+ displayName: "NavbarMenu__StyledMenuItem",
15
+ componentId: "SD__sc-1c8icpt-1"
16
+ })(["& svg{font-size:24px;color:", ";}"], Color.Dark100);
17
+ var Wrapper = /*#__PURE__*/styled.div.withConfig({
18
+ displayName: "NavbarMenu__Wrapper",
19
+ componentId: "SD__sc-1c8icpt-2"
20
+ })(["width:100%;padding:8px 16px;cursor:pointer;background:", ";border-left:4px solid ", ";&:hover{border-left-color:", ";background:", ";}"], Color.Dark400, _ref => {
21
+ var {
22
+ active
23
+ } = _ref;
24
+ return active ? Color.Blue300 : 'transparent';
25
+ }, Color.Blue300, Color.Dark400);
26
+ export function NavbarMenu(_ref2) {
27
+ var {
28
+ items,
29
+ children
30
+ } = _ref2;
31
+ var {
32
+ setDrawerOpen
33
+ } = useNavbarContext();
34
+ var [anchor, setAnchor] = useState(null);
35
+
36
+ function showProfileMenu(event) {
37
+ setAnchor(event.currentTarget);
38
+ }
39
+
40
+ function hideProfileMenu() {
41
+ setAnchor(null);
42
+ setDrawerOpen(false);
43
+ }
44
+
45
+ return /*#__PURE__*/_jsxs(_Fragment, {
46
+ children: [/*#__PURE__*/_jsx(Wrapper, {
47
+ onClick: showProfileMenu,
48
+ active: !!anchor,
49
+ children: children
50
+ }), /*#__PURE__*/_jsx(Menu, {
51
+ open: !!anchor,
52
+ anchorEl: anchor,
53
+ onClose: hideProfileMenu,
54
+ onClick: hideProfileMenu,
55
+ anchorOrigin: {
56
+ vertical: 'top',
57
+ horizontal: 'center'
58
+ },
59
+ transformOrigin: {
60
+ vertical: 'bottom',
61
+ horizontal: 'center'
62
+ },
63
+ children: items.filter(item => item.visible !== false).flatMap((item, index, arr) => {
64
+ return [/*#__PURE__*/_jsx(StyledMenuItem, {
65
+ onClick: item.onClick,
66
+ children: /*#__PURE__*/_jsxs(Inline, {
67
+ space: "small",
68
+ verticalAlign: "center",
69
+ children: [item.icon, /*#__PURE__*/_jsx(Typography, {
70
+ style: {
71
+ color: Color.Dark500
72
+ },
73
+ children: item.label
74
+ })]
75
+ })
76
+ }, item.key), index !== arr.length - 1 && /*#__PURE__*/_jsx(Divider, {}, "".concat(item.key, "-divider"))];
77
+ })
78
+ })]
79
+ });
80
+ }