@superdispatch/ui-lab 0.17.1 → 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.
@@ -17,6 +17,7 @@ var reactTransitionGroup = require('react-transition-group');
17
17
  var core = require('@material-ui/core');
18
18
  var js = require('@mdi/js');
19
19
  var Dropzone = _interopDefault(require('react-dropzone'));
20
+ var lodash = require('lodash');
20
21
 
21
22
  function colorMixin(textColor, backgroundColor, buttonHoverColor) {
22
23
  return styled.css(["color:", ";background-color:", ";& .MuiAlert-icon{color:", ";}& .MuiAlert-action{& .MuiIconButton-root{&:hover,&:active{color:", ";}}}"], textColor, backgroundColor, textColor, buttonHoverColor);
@@ -528,6 +529,45 @@ var AnchorButton = /*#__PURE__*/react.forwardRef((_ref5, ref) => {
528
529
  });
529
530
  if (process.env.NODE_ENV !== "production") AnchorButton.displayName = "AnchorButton";
530
531
 
532
+ var _excluded$3 = ["fullViewportHeight"];
533
+ var Container = /*#__PURE__*/react.forwardRef((_ref, ref) => {
534
+ var {
535
+ fullViewportHeight
536
+ } = _ref,
537
+ props = _objectWithoutProperties(_ref, _excluded$3);
538
+
539
+ var nodeRef = react.useRef(null);
540
+ react.useLayoutEffect(() => {
541
+ if (!fullViewportHeight) {
542
+ if (nodeRef.current) {
543
+ nodeRef.current.style.removeProperty('height');
544
+ nodeRef.current.style.removeProperty('--vh');
545
+ }
546
+
547
+ return;
548
+ }
549
+
550
+ function updateHeight() {
551
+ if (nodeRef.current) {
552
+ // https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
553
+ nodeRef.current.style.setProperty('height', 'calc(var(--vh, 1vh) * 100)');
554
+ nodeRef.current.style.setProperty('--vh', "".concat(window.innerHeight * 0.01, "px"));
555
+ }
556
+ }
557
+
558
+ updateHeight();
559
+ window.addEventListener('resize', updateHeight);
560
+ return () => {
561
+ window.removeEventListener('resize', updateHeight);
562
+ };
563
+ }, [fullViewportHeight]);
564
+ return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread({
565
+ ref: ui.mergeRefs(ref, nodeRef)
566
+ }, props));
567
+ });
568
+ if (process.env.NODE_ENV !== "production") Container.displayName = "Container";
569
+ Container.displayName = 'Container';
570
+
531
571
  function mergeStyles(styles) {
532
572
  for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
533
573
  sources[_key - 1] = arguments[_key];
@@ -553,7 +593,7 @@ function mergeStyles(styles) {
553
593
  return styles;
554
594
  }
555
595
 
556
- var _excluded$3 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
596
+ var _excluded$4 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
557
597
  var normalizeTextColor = /*#__PURE__*/createRuleNormalizer({
558
598
  inherit: 'inherit',
559
599
  primary: ui.Color.Dark500,
@@ -655,7 +695,7 @@ var TextBox = /*#__PURE__*/react.forwardRef((_ref3, ref) => {
655
695
  noWrap = false,
656
696
  wrapOverflow = false
657
697
  } = _ref3,
658
- props = _objectWithoutProperties(_ref3, _excluded$3);
698
+ props = _objectWithoutProperties(_ref3, _excluded$4);
659
699
 
660
700
  var $align = ui.parseResponsiveProp(align);
661
701
  var $color = ui.parseResponsiveProp(color);
@@ -736,7 +776,7 @@ var DescriptionItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
736
776
  });
737
777
  if (process.env.NODE_ENV !== "production") DescriptionItem.displayName = "DescriptionItem";
738
778
 
739
- var _excluded$4 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
779
+ var _excluded$5 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
740
780
  function toBytes(input, unit) {
741
781
  if (unit === 'gb') return input * (1 << 30);
742
782
  if (unit === 'mb') return input * (1 << 20);
@@ -807,7 +847,7 @@ var FileDropZone = /*#__PURE__*/react.forwardRef((props, ref) => {
807
847
  onDropRejected: _onDropRejected,
808
848
  onDropAccepted: _onDropAccepted
809
849
  } = props,
810
- dropzoneProps = _objectWithoutProperties(props, _excluded$4);
850
+ dropzoneProps = _objectWithoutProperties(props, _excluded$5);
811
851
 
812
852
  return /*#__PURE__*/jsxRuntime.jsx(react.Suspense, {
813
853
  fallback: fallback,
@@ -972,6 +1012,449 @@ var FileListItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
972
1012
  });
973
1013
  if (process.env.NODE_ENV !== "production") FileListItem.displayName = "FileListItem";
974
1014
 
1015
+ var NavbarContext = /*#__PURE__*/react.createContext({
1016
+ isDrawerOpen: false,
1017
+ isExpanded: false,
1018
+ setIsExpanded: lodash.noop,
1019
+ setDrawerOpen: lodash.noop
1020
+ });
1021
+ function useNavbarContext() {
1022
+ return react.useContext(NavbarContext);
1023
+ }
1024
+
1025
+ var StyledBottomNavigation = /*#__PURE__*/styled__default(core.BottomNavigation).withConfig({
1026
+ displayName: "NavbarBottomBar__StyledBottomNavigation",
1027
+ componentId: "SD__sc-9z6v3k-0"
1028
+ })(["background:", ";"], ui.Color.Dark500);
1029
+ var StyledBottomNavigationAction = /*#__PURE__*/styled__default(core.BottomNavigationAction).withConfig({
1030
+ displayName: "NavbarBottomBar__StyledBottomNavigationAction",
1031
+ componentId: "SD__sc-9z6v3k-1"
1032
+ })(["&&{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;}}"], ui.Color.Silver500, ui.Color.White);
1033
+ var IconWrapper = /*#__PURE__*/styled__default.div.withConfig({
1034
+ displayName: "NavbarBottomBar__IconWrapper",
1035
+ componentId: "SD__sc-9z6v3k-2"
1036
+ })(["position:relative;"]);
1037
+ var IconLabel = /*#__PURE__*/styled__default.div.withConfig({
1038
+ displayName: "NavbarBottomBar__IconLabel",
1039
+ componentId: "SD__sc-9z6v3k-3"
1040
+ })(["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;"], ui.Color.White, ui.Color.Red300);
1041
+ function NavbarBottomBar(_ref) {
1042
+ var {
1043
+ items,
1044
+ hasMenuBadge
1045
+ } = _ref;
1046
+ var {
1047
+ isDrawerOpen,
1048
+ setDrawerOpen
1049
+ } = useNavbarContext();
1050
+ var activeItem = react.useMemo(() => items.find(item => item.active), [items]);
1051
+ return /*#__PURE__*/jsxRuntime.jsxs(StyledBottomNavigation, {
1052
+ value: activeItem === null || activeItem === void 0 ? void 0 : activeItem.value,
1053
+ showLabels: true,
1054
+ onChange: (_event, newValue) => {
1055
+ if (newValue) {
1056
+ if (newValue === 'menu') {
1057
+ setDrawerOpen(!isDrawerOpen);
1058
+ } else {
1059
+ setDrawerOpen(false);
1060
+ }
1061
+ }
1062
+ },
1063
+ children: [items.map(item => /*#__PURE__*/react.createElement(StyledBottomNavigationAction, _objectSpread(_objectSpread({}, item), {}, {
1064
+ key: item.value,
1065
+ icon: item.hasBadge ? /*#__PURE__*/jsxRuntime.jsxs(IconWrapper, {
1066
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconLabel, {}), item.icon]
1067
+ }) : item.icon
1068
+ }))), /*#__PURE__*/jsxRuntime.jsx(StyledBottomNavigationAction, {
1069
+ value: "menu",
1070
+ label: "Menu",
1071
+ icon: hasMenuBadge ? /*#__PURE__*/jsxRuntime.jsxs(IconWrapper, {
1072
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconLabel, {}), /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {
1073
+ fontSize: "small"
1074
+ })]
1075
+ }) : /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {
1076
+ fontSize: "small"
1077
+ })
1078
+ })]
1079
+ });
1080
+ }
1081
+
1082
+ var NavbarBadge = /*#__PURE__*/styled__default.span.withConfig({
1083
+ displayName: "NavbarItem__NavbarBadge",
1084
+ componentId: "SD__sc-1pvzq3w-0"
1085
+ })(["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:", ";}"], ui.Color.White, ui.Color.Blue300, ui.Color.White, ui.Color.Red500);
1086
+ var NavbarLabel = /*#__PURE__*/styled__default.span.withConfig({
1087
+ displayName: "NavbarItem__NavbarLabel",
1088
+ componentId: "SD__sc-1pvzq3w-1"
1089
+ })(["flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"]);
1090
+ var NavbarItemRoot = /*#__PURE__*/styled__default.div.withConfig({
1091
+ displayName: "NavbarItem__NavbarItemRoot",
1092
+ componentId: "SD__sc-1pvzq3w-2"
1093
+ })(["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:", ";}"], ui.Color.White, ui.Color.Blue300);
1094
+ var IconWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
1095
+ displayName: "NavbarItem__IconWrapper",
1096
+ componentId: "SD__sc-1pvzq3w-3"
1097
+ })(["width:24px;margin-right:8px;& svg{font-size:24px;}"]);
1098
+ function NavbarItem(_ref) {
1099
+ var {
1100
+ label,
1101
+ gutter,
1102
+ badge,
1103
+ icon,
1104
+ component,
1105
+ onClick,
1106
+ variant,
1107
+ ident = 0
1108
+ } = _ref;
1109
+ var uid = ui.useUID();
1110
+ return /*#__PURE__*/jsxRuntime.jsxs(NavbarItemRoot, {
1111
+ as: component,
1112
+ onClick: onClick,
1113
+ "aria-labelledby": uid,
1114
+ style: {
1115
+ marginTop: gutter ? '16px' : '0',
1116
+ paddingLeft: (ident + 1) * 20
1117
+ },
1118
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconWrapper$1, {
1119
+ children: icon
1120
+ }), /*#__PURE__*/jsxRuntime.jsx(NavbarLabel, {
1121
+ id: uid,
1122
+ children: label
1123
+ }), badge != null && /*#__PURE__*/jsxRuntime.jsx(NavbarBadge, {
1124
+ "data-variant": variant,
1125
+ children: badge
1126
+ })]
1127
+ });
1128
+ }
1129
+
1130
+ var Header = /*#__PURE__*/styled__default.div.withConfig({
1131
+ displayName: "NavbarList__Header",
1132
+ componentId: "SD__sc-19zrmxc-0"
1133
+ })(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;"]);
1134
+ var Wrapper = /*#__PURE__*/styled__default.div.withConfig({
1135
+ displayName: "NavbarList__Wrapper",
1136
+ componentId: "SD__sc-19zrmxc-1"
1137
+ })(["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 => {
1138
+ var {
1139
+ isMobile
1140
+ } = _ref;
1141
+ return isMobile ? '280px' : 'initial';
1142
+ }, _ref2 => {
1143
+ var {
1144
+ isMobile
1145
+ } = _ref2;
1146
+ return isMobile ? '280px' : '240px';
1147
+ }, _ref3 => {
1148
+ var {
1149
+ isMobile
1150
+ } = _ref3;
1151
+ return isMobile ? '280px' : '72px';
1152
+ }, Header);
1153
+ var ExpandIconButton = /*#__PURE__*/styled__default(core.IconButton).withConfig({
1154
+ displayName: "NavbarList__ExpandIconButton",
1155
+ componentId: "SD__sc-19zrmxc-2"
1156
+ })(["color:", ";&&:focus{background-color:inherit;}"], ui.Color.Silver500);
1157
+ var Footer = /*#__PURE__*/styled__default.div.withConfig({
1158
+ displayName: "NavbarList__Footer",
1159
+ componentId: "SD__sc-19zrmxc-3"
1160
+ })(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;"]);
1161
+ var Root = /*#__PURE__*/styled__default.div.withConfig({
1162
+ displayName: "NavbarList__Root",
1163
+ componentId: "SD__sc-19zrmxc-4"
1164
+ })(["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:", ";}"], ui.Color.Dark100);
1165
+ function NavbarMenuItem(_ref4) {
1166
+ var {
1167
+ label,
1168
+ icon,
1169
+ onClick,
1170
+ component
1171
+ } = _ref4;
1172
+ return /*#__PURE__*/jsxRuntime.jsx(Root, {
1173
+ as: component,
1174
+ onClick: onClick,
1175
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Inline, {
1176
+ space: "xsmall",
1177
+ verticalAlign: "center",
1178
+ children: [icon, /*#__PURE__*/jsxRuntime.jsx(NavbarLabel, {
1179
+ children: label
1180
+ })]
1181
+ })
1182
+ });
1183
+ }
1184
+ var Content = /*#__PURE__*/styled__default.div.withConfig({
1185
+ displayName: "NavbarList__Content",
1186
+ componentId: "SD__sc-19zrmxc-5"
1187
+ })(["height:100%;min-height:50px;&[aria-expanded='false']{", ",", "{visibility:hidden;}}"], NavbarBadge, NavbarLabel);
1188
+ function NavbarList(_ref5) {
1189
+ var {
1190
+ header,
1191
+ items,
1192
+ footer
1193
+ } = _ref5;
1194
+ var platform = ui.useResponsiveValue('mobile', 'tablet', 'desktop');
1195
+ var isMobile = platform === 'mobile';
1196
+ var {
1197
+ isExpanded,
1198
+ isDrawerOpen,
1199
+ setDrawerOpen,
1200
+ setIsExpanded
1201
+ } = useNavbarContext();
1202
+ var isSidebarOpened = isMobile ? isDrawerOpen : isExpanded;
1203
+ var filteredItems = react.useMemo(() => items.filter(item => {
1204
+ return !item.hide && (isSidebarOpened || !!item.icon);
1205
+ }).map(item => _objectSpread(_objectSpread({}, item), {}, {
1206
+ menuGroupKey: item.groupKey
1207
+ })), [items, isSidebarOpened]);
1208
+ return /*#__PURE__*/jsxRuntime.jsxs(Wrapper, {
1209
+ isMobile: isMobile,
1210
+ "data-expanded": isSidebarOpened,
1211
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Header, {
1212
+ children: [isSidebarOpened && header, !isMobile && /*#__PURE__*/jsxRuntime.jsx(ExpandIconButton, {
1213
+ disableRipple: true,
1214
+ style: isExpanded ? {
1215
+ paddingRight: 0
1216
+ } : {},
1217
+ onClick: () => {
1218
+ setIsExpanded(!isExpanded);
1219
+ },
1220
+ children: isExpanded ? /*#__PURE__*/jsxRuntime.jsx(icons.MenuOpen, {}) : /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {})
1221
+ })]
1222
+ }), /*#__PURE__*/jsxRuntime.jsx(Content, {
1223
+ "aria-expanded": isSidebarOpened,
1224
+ children: /*#__PURE__*/jsxRuntime.jsx(ui.AdaptiveVerticalToolbar, {
1225
+ disableGutters: true,
1226
+ items: filteredItems,
1227
+ renderItem: item => {
1228
+ var navbarItem = item;
1229
+ var index = filteredItems.indexOf(navbarItem);
1230
+ var prev = filteredItems[index - 1];
1231
+ return /*#__PURE__*/jsxRuntime.jsx(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
1232
+ gutter: prev && prev.groupKey !== navbarItem.groupKey,
1233
+ onClick: event => {
1234
+ var _item$onClick;
1235
+
1236
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
1237
+
1238
+ if (!event.isDefaultPrevented()) {
1239
+ setDrawerOpen(false);
1240
+ }
1241
+ }
1242
+ }));
1243
+ },
1244
+ renderMenuItem: item => /*#__PURE__*/jsxRuntime.jsx(NavbarMenuItem, _objectSpread(_objectSpread({}, item), {}, {
1245
+ onClick: event => {
1246
+ var _item$onClick2;
1247
+
1248
+ (_item$onClick2 = item.onClick) === null || _item$onClick2 === void 0 ? void 0 : _item$onClick2.call(item, event);
1249
+
1250
+ if (!event.isDefaultPrevented()) {
1251
+ setDrawerOpen(false);
1252
+ }
1253
+ }
1254
+ })),
1255
+ moreElement: /*#__PURE__*/jsxRuntime.jsx(NavbarItem, {
1256
+ icon: /*#__PURE__*/jsxRuntime.jsx(icons.MoreHoriz, {}),
1257
+ label: "More"
1258
+ })
1259
+ })
1260
+ }), /*#__PURE__*/jsxRuntime.jsx(Footer, {
1261
+ children: footer
1262
+ })]
1263
+ });
1264
+ }
1265
+
1266
+ var Aside = /*#__PURE__*/styled__default.aside.withConfig({
1267
+ displayName: "Navbar__Aside",
1268
+ componentId: "SD__sc-1oiqig8-0"
1269
+ })(["display:flex;flex-direction:column;overflow:auto;"]);
1270
+ var Main = /*#__PURE__*/styled__default.main.withConfig({
1271
+ displayName: "Navbar__Main",
1272
+ componentId: "SD__sc-1oiqig8-1"
1273
+ })(["flex:1;display:flex;flex-direction:column;overflow:auto;"]);
1274
+ function Navbar(_ref) {
1275
+ var {
1276
+ footer,
1277
+ items,
1278
+ header,
1279
+ bottomItems,
1280
+ children,
1281
+ containerStyle,
1282
+ hasExtraBadge
1283
+ } = _ref;
1284
+ var theme = core.useTheme();
1285
+ var [isDrawerOpen, setDrawerOpen] = react.useState(false);
1286
+ var platform = ui.useResponsiveValue('mobile', 'tablet', 'desktop');
1287
+ var isMobile = platform === 'mobile';
1288
+ var matches = core.useMediaQuery(theme.breakpoints.up('md'), {
1289
+ noSsr: true
1290
+ });
1291
+ var [isExpanded, setIsExpanded] = react.useState(matches);
1292
+ var hasBadge = hasExtraBadge || items.some(item => item.badge);
1293
+ var ctx = react.useMemo(() => ({
1294
+ isDrawerOpen,
1295
+ isExpanded,
1296
+ setIsExpanded,
1297
+ setDrawerOpen
1298
+ }), [isDrawerOpen, isExpanded, setIsExpanded, setDrawerOpen]);
1299
+ return /*#__PURE__*/jsxRuntime.jsx(NavbarContext.Provider, {
1300
+ value: ctx,
1301
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
1302
+ style: _objectSpread({
1303
+ display: 'flex',
1304
+ height: '100%',
1305
+ flexDirection: isMobile ? 'column' : 'row'
1306
+ }, containerStyle),
1307
+ children: [!isMobile && /*#__PURE__*/jsxRuntime.jsx(Aside, {
1308
+ children: /*#__PURE__*/jsxRuntime.jsx(NavbarList, {
1309
+ header: header,
1310
+ items: items,
1311
+ footer: footer
1312
+ })
1313
+ }), /*#__PURE__*/jsxRuntime.jsx(Main, {
1314
+ children: children
1315
+ }), isMobile && /*#__PURE__*/jsxRuntime.jsx(NavbarBottomBar, {
1316
+ items: bottomItems,
1317
+ hasMenuBadge: hasBadge
1318
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Drawer, {
1319
+ open: isDrawerOpen,
1320
+ anchor: "right",
1321
+ onClose: () => {
1322
+ setDrawerOpen(false);
1323
+ },
1324
+ PaperProps: {
1325
+ style: {
1326
+ width: '280px',
1327
+ minWidth: '280px'
1328
+ }
1329
+ },
1330
+ children: /*#__PURE__*/jsxRuntime.jsx(NavbarList, {
1331
+ header: header,
1332
+ items: items,
1333
+ footer: footer
1334
+ })
1335
+ })]
1336
+ })
1337
+ });
1338
+ }
1339
+
1340
+ var _excluded$6 = ["title", "subtitle", "children"];
1341
+ var StyledTypography = /*#__PURE__*/styled__default(core.Typography).withConfig({
1342
+ displayName: "NavbarAvatar__StyledTypography",
1343
+ componentId: "SD__sc-19q2zd0-0"
1344
+ })(["color:", ";text-overflow:ellipsis;white-space:nowrap;overflow:hidden;&:hover{color:", ";}"], ui.Color.Silver500, ui.Color.White);
1345
+ function NavbarAvatar(_ref) {
1346
+ var {
1347
+ title,
1348
+ subtitle,
1349
+ children
1350
+ } = _ref,
1351
+ props = _objectWithoutProperties(_ref, _excluded$6);
1352
+
1353
+ var {
1354
+ isExpanded,
1355
+ isDrawerOpen
1356
+ } = useNavbarContext();
1357
+
1358
+ if (isExpanded || isDrawerOpen) {
1359
+ return /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1360
+ space: "xsmall",
1361
+ align: "center",
1362
+ children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1363
+ width: "content",
1364
+ children: /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1365
+ children: children
1366
+ }))
1367
+ }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1368
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Stack, {
1369
+ space: "none",
1370
+ children: [/*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1371
+ children: title
1372
+ }), /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1373
+ children: subtitle
1374
+ })]
1375
+ })
1376
+ })]
1377
+ });
1378
+ }
1379
+
1380
+ return /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1381
+ children: children
1382
+ }));
1383
+ }
1384
+
1385
+ var Divider = /*#__PURE__*/styled__default.div.withConfig({
1386
+ displayName: "NavbarMenu__Divider",
1387
+ componentId: "SD__sc-1c8icpt-0"
1388
+ })(["border-bottom:1px solid ", ";margin:8px -16px;"], ui.Color.Silver400);
1389
+ var StyledMenuItem = /*#__PURE__*/styled__default(core.MenuItem).withConfig({
1390
+ displayName: "NavbarMenu__StyledMenuItem",
1391
+ componentId: "SD__sc-1c8icpt-1"
1392
+ })(["& svg{font-size:24px;color:", ";}"], ui.Color.Dark100);
1393
+ var Wrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
1394
+ displayName: "NavbarMenu__Wrapper",
1395
+ componentId: "SD__sc-1c8icpt-2"
1396
+ })(["width:100%;padding:8px 16px;cursor:pointer;background:", ";border-left:4px solid ", ";&:hover{border-left-color:", ";background:", ";}"], ui.Color.Dark400, _ref => {
1397
+ var {
1398
+ active
1399
+ } = _ref;
1400
+ return active ? ui.Color.Blue300 : 'transparent';
1401
+ }, ui.Color.Blue300, ui.Color.Dark400);
1402
+ function NavbarMenu(_ref2) {
1403
+ var {
1404
+ items,
1405
+ children
1406
+ } = _ref2;
1407
+ var {
1408
+ setDrawerOpen
1409
+ } = useNavbarContext();
1410
+ var [anchor, setAnchor] = react.useState(null);
1411
+
1412
+ function showProfileMenu(event) {
1413
+ setAnchor(event.currentTarget);
1414
+ }
1415
+
1416
+ function hideProfileMenu() {
1417
+ setAnchor(null);
1418
+ setDrawerOpen(false);
1419
+ }
1420
+
1421
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1422
+ children: [/*#__PURE__*/jsxRuntime.jsx(Wrapper$1, {
1423
+ onClick: showProfileMenu,
1424
+ active: !!anchor,
1425
+ children: children
1426
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Menu, {
1427
+ open: !!anchor,
1428
+ anchorEl: anchor,
1429
+ onClose: hideProfileMenu,
1430
+ onClick: hideProfileMenu,
1431
+ anchorOrigin: {
1432
+ vertical: 'top',
1433
+ horizontal: 'center'
1434
+ },
1435
+ transformOrigin: {
1436
+ vertical: 'bottom',
1437
+ horizontal: 'center'
1438
+ },
1439
+ children: items.filter(item => item.visible !== false).flatMap((item, index, arr) => {
1440
+ return [/*#__PURE__*/jsxRuntime.jsx(StyledMenuItem, {
1441
+ onClick: item.onClick,
1442
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Inline, {
1443
+ space: "small",
1444
+ verticalAlign: "center",
1445
+ children: [item.icon, /*#__PURE__*/jsxRuntime.jsx(core.Typography, {
1446
+ style: {
1447
+ color: ui.Color.Dark500
1448
+ },
1449
+ children: item.label
1450
+ })]
1451
+ })
1452
+ }, item.key), index !== arr.length - 1 && /*#__PURE__*/jsxRuntime.jsx(Divider, {}, "".concat(item.key, "-divider"))];
1453
+ })
1454
+ })]
1455
+ });
1456
+ }
1457
+
975
1458
  var SidebarRoot = /*#__PURE__*/styled__default.aside.withConfig({
976
1459
  displayName: "Sidebar__SidebarRoot",
977
1460
  componentId: "SD__sc-b77o22-0"
@@ -1300,9 +1783,19 @@ exports.Banner = Banner;
1300
1783
  exports.Box = Box;
1301
1784
  exports.Button = Button;
1302
1785
  exports.ButtonArea = ButtonArea;
1786
+ exports.Container = Container;
1303
1787
  exports.DescriptionItem = DescriptionItem;
1304
1788
  exports.FileDropZone = FileDropZone;
1305
1789
  exports.FileListItem = FileListItem;
1790
+ exports.Navbar = Navbar;
1791
+ exports.NavbarAvatar = NavbarAvatar;
1792
+ exports.NavbarBadge = NavbarBadge;
1793
+ exports.NavbarBottomBar = NavbarBottomBar;
1794
+ exports.NavbarItem = NavbarItem;
1795
+ exports.NavbarLabel = NavbarLabel;
1796
+ exports.NavbarList = NavbarList;
1797
+ exports.NavbarMenu = NavbarMenu;
1798
+ exports.NavbarMenuItem = NavbarMenuItem;
1306
1799
  exports.Sidebar = Sidebar;
1307
1800
  exports.SidebarContainer = SidebarContainer;
1308
1801
  exports.SidebarDivider = SidebarDivider;
@@ -1313,4 +1806,5 @@ exports.SidebarSubheader = SidebarSubheader;
1313
1806
  exports.TextBox = TextBox;
1314
1807
  exports.formatBytes = formatBytes;
1315
1808
  exports.toBytes = toBytes;
1809
+ exports.useNavbarContext = useNavbarContext;
1316
1810
  //# sourceMappingURL=index.js.map