@superdispatch/ui-lab 0.17.1 → 0.19.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,8 @@ 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 reactAnchorme = require('react-anchorme');
21
+ var lodash = require('lodash');
20
22
 
21
23
  function colorMixin(textColor, backgroundColor, buttonHoverColor) {
22
24
  return styled.css(["color:", ";background-color:", ";& .MuiAlert-icon{color:", ";}& .MuiAlert-action{& .MuiIconButton-root{&:hover,&:active{color:", ";}}}"], textColor, backgroundColor, textColor, buttonHoverColor);
@@ -528,6 +530,45 @@ var AnchorButton = /*#__PURE__*/react.forwardRef((_ref5, ref) => {
528
530
  });
529
531
  if (process.env.NODE_ENV !== "production") AnchorButton.displayName = "AnchorButton";
530
532
 
533
+ var _excluded$3 = ["fullViewportHeight"];
534
+ var Container = /*#__PURE__*/react.forwardRef((_ref, ref) => {
535
+ var {
536
+ fullViewportHeight
537
+ } = _ref,
538
+ props = _objectWithoutProperties(_ref, _excluded$3);
539
+
540
+ var nodeRef = react.useRef(null);
541
+ react.useLayoutEffect(() => {
542
+ if (!fullViewportHeight) {
543
+ if (nodeRef.current) {
544
+ nodeRef.current.style.removeProperty('height');
545
+ nodeRef.current.style.removeProperty('--vh');
546
+ }
547
+
548
+ return;
549
+ }
550
+
551
+ function updateHeight() {
552
+ if (nodeRef.current) {
553
+ // https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
554
+ nodeRef.current.style.setProperty('height', 'calc(var(--vh, 1vh) * 100)');
555
+ nodeRef.current.style.setProperty('--vh', "".concat(window.innerHeight * 0.01, "px"));
556
+ }
557
+ }
558
+
559
+ updateHeight();
560
+ window.addEventListener('resize', updateHeight);
561
+ return () => {
562
+ window.removeEventListener('resize', updateHeight);
563
+ };
564
+ }, [fullViewportHeight]);
565
+ return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread({
566
+ ref: ui.mergeRefs(ref, nodeRef)
567
+ }, props));
568
+ });
569
+ if (process.env.NODE_ENV !== "production") Container.displayName = "Container";
570
+ Container.displayName = 'Container';
571
+
531
572
  function mergeStyles(styles) {
532
573
  for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
533
574
  sources[_key - 1] = arguments[_key];
@@ -553,7 +594,7 @@ function mergeStyles(styles) {
553
594
  return styles;
554
595
  }
555
596
 
556
- var _excluded$3 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
597
+ var _excluded$4 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
557
598
  var normalizeTextColor = /*#__PURE__*/createRuleNormalizer({
558
599
  inherit: 'inherit',
559
600
  primary: ui.Color.Dark500,
@@ -655,7 +696,7 @@ var TextBox = /*#__PURE__*/react.forwardRef((_ref3, ref) => {
655
696
  noWrap = false,
656
697
  wrapOverflow = false
657
698
  } = _ref3,
658
- props = _objectWithoutProperties(_ref3, _excluded$3);
699
+ props = _objectWithoutProperties(_ref3, _excluded$4);
659
700
 
660
701
  var $align = ui.parseResponsiveProp(align);
661
702
  var $color = ui.parseResponsiveProp(color);
@@ -736,7 +777,7 @@ var DescriptionItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
736
777
  });
737
778
  if (process.env.NODE_ENV !== "production") DescriptionItem.displayName = "DescriptionItem";
738
779
 
739
- var _excluded$4 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
780
+ var _excluded$5 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
740
781
  function toBytes(input, unit) {
741
782
  if (unit === 'gb') return input * (1 << 30);
742
783
  if (unit === 'mb') return input * (1 << 20);
@@ -807,7 +848,7 @@ var FileDropZone = /*#__PURE__*/react.forwardRef((props, ref) => {
807
848
  onDropRejected: _onDropRejected,
808
849
  onDropAccepted: _onDropAccepted
809
850
  } = props,
810
- dropzoneProps = _objectWithoutProperties(props, _excluded$4);
851
+ dropzoneProps = _objectWithoutProperties(props, _excluded$5);
811
852
 
812
853
  return /*#__PURE__*/jsxRuntime.jsx(react.Suspense, {
813
854
  fallback: fallback,
@@ -972,6 +1013,576 @@ var FileListItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
972
1013
  });
973
1014
  if (process.env.NODE_ENV !== "production") FileListItem.displayName = "FileListItem";
974
1015
 
1016
+ var _excluded$6 = ["color", "target", "rel"],
1017
+ _excluded2$2 = ["children", "linkComponent"];
1018
+ var DefaultLinkComponent = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1019
+ var {
1020
+ color,
1021
+ target = '_blank',
1022
+ rel = 'noreferrer noopener'
1023
+ } = _ref,
1024
+ props = _objectWithoutProperties(_ref, _excluded$6);
1025
+
1026
+ return /*#__PURE__*/jsxRuntime.jsx(core.Link, _objectSpread(_objectSpread({}, props), {}, {
1027
+ ref: ref,
1028
+ rel: rel,
1029
+ target: target
1030
+ }));
1031
+ });
1032
+ if (process.env.NODE_ENV !== "production") DefaultLinkComponent.displayName = "DefaultLinkComponent";
1033
+ DefaultLinkComponent.displayName = 'DefaultLinkComponent';
1034
+ function LinkedText(_ref2) {
1035
+ var {
1036
+ children,
1037
+ linkComponent = DefaultLinkComponent
1038
+ } = _ref2,
1039
+ props = _objectWithoutProperties(_ref2, _excluded2$2);
1040
+
1041
+ if (!children) {
1042
+ return null;
1043
+ }
1044
+
1045
+ return /*#__PURE__*/jsxRuntime.jsx(reactAnchorme.Anchorme, _objectSpread(_objectSpread({}, props), {}, {
1046
+ linkComponent: linkComponent,
1047
+ children: children
1048
+ }));
1049
+ }
1050
+
1051
+ var MultilineText = /*#__PURE__*/styled__default.span.withConfig({
1052
+ displayName: "MultilineText",
1053
+ componentId: "SD__sc-34heyp-0"
1054
+ })(["white-space:pre-wrap;overflow-wrap:", ";"], _ref => {
1055
+ var {
1056
+ overflowWrap = 'normal'
1057
+ } = _ref;
1058
+ return overflowWrap;
1059
+ });
1060
+ MultilineText.displayName = 'MultilineText';
1061
+
1062
+ var NavbarContext = /*#__PURE__*/react.createContext({
1063
+ isDrawerOpen: false,
1064
+ isExpanded: false,
1065
+ setIsExpanded: lodash.noop,
1066
+ setDrawerOpen: lodash.noop
1067
+ });
1068
+ function useNavbarContext() {
1069
+ return react.useContext(NavbarContext);
1070
+ }
1071
+
1072
+ var StyledBottomNavigation = /*#__PURE__*/styled__default(core.BottomNavigation).withConfig({
1073
+ displayName: "NavbarBottomBar__StyledBottomNavigation",
1074
+ componentId: "SD__sc-9z6v3k-0"
1075
+ })(["background:", ";"], ui.Color.Dark500);
1076
+ var StyledBottomNavigationAction = /*#__PURE__*/styled__default(core.BottomNavigationAction).withConfig({
1077
+ displayName: "NavbarBottomBar__StyledBottomNavigationAction",
1078
+ componentId: "SD__sc-9z6v3k-1"
1079
+ })(["&&{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);
1080
+ var IconWrapper = /*#__PURE__*/styled__default.div.withConfig({
1081
+ displayName: "NavbarBottomBar__IconWrapper",
1082
+ componentId: "SD__sc-9z6v3k-2"
1083
+ })(["position:relative;"]);
1084
+ var IconLabel = /*#__PURE__*/styled__default.div.withConfig({
1085
+ displayName: "NavbarBottomBar__IconLabel",
1086
+ componentId: "SD__sc-9z6v3k-3"
1087
+ })(["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);
1088
+ function NavbarBottomBar(_ref) {
1089
+ var {
1090
+ items,
1091
+ hasMenuBadge
1092
+ } = _ref;
1093
+ var {
1094
+ isDrawerOpen,
1095
+ setDrawerOpen
1096
+ } = useNavbarContext();
1097
+ var activeItem = react.useMemo(() => items.find(item => item.active), [items]);
1098
+ return /*#__PURE__*/jsxRuntime.jsxs(StyledBottomNavigation, {
1099
+ value: activeItem === null || activeItem === void 0 ? void 0 : activeItem.value,
1100
+ showLabels: true,
1101
+ onChange: (_event, newValue) => {
1102
+ if (newValue) {
1103
+ if (newValue === 'menu') {
1104
+ setDrawerOpen(!isDrawerOpen);
1105
+ } else {
1106
+ setDrawerOpen(false);
1107
+ }
1108
+ }
1109
+ },
1110
+ children: [items.map(item => /*#__PURE__*/react.createElement(StyledBottomNavigationAction, _objectSpread(_objectSpread({}, item), {}, {
1111
+ key: item.value,
1112
+ icon: item.hasBadge ? /*#__PURE__*/jsxRuntime.jsxs(IconWrapper, {
1113
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconLabel, {}), item.icon]
1114
+ }) : item.icon
1115
+ }))), /*#__PURE__*/jsxRuntime.jsx(StyledBottomNavigationAction, {
1116
+ value: "menu",
1117
+ label: "Menu",
1118
+ icon: hasMenuBadge ? /*#__PURE__*/jsxRuntime.jsxs(IconWrapper, {
1119
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconLabel, {}), /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {
1120
+ fontSize: "small"
1121
+ })]
1122
+ }) : /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {
1123
+ fontSize: "small"
1124
+ })
1125
+ })]
1126
+ });
1127
+ }
1128
+
1129
+ var NavbarBadge = /*#__PURE__*/styled__default.span.withConfig({
1130
+ displayName: "NavbarItem__NavbarBadge",
1131
+ componentId: "SD__sc-1pvzq3w-0"
1132
+ })(["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);
1133
+ var NavbarLabel = /*#__PURE__*/styled__default.span.withConfig({
1134
+ displayName: "NavbarItem__NavbarLabel",
1135
+ componentId: "SD__sc-1pvzq3w-1"
1136
+ })(["flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"]);
1137
+ var NavbarItemRoot = /*#__PURE__*/styled__default.div.withConfig({
1138
+ displayName: "NavbarItem__NavbarItemRoot",
1139
+ componentId: "SD__sc-1pvzq3w-2"
1140
+ })(["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:", ";}&[data-active='true']{border-left-color:", ";}"], ui.Color.White, ui.Color.Blue300, ui.Color.Blue300);
1141
+ var IconWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
1142
+ displayName: "NavbarItem__IconWrapper",
1143
+ componentId: "SD__sc-1pvzq3w-3"
1144
+ })(["width:24px;margin-right:8px;& svg{font-size:24px;}"]);
1145
+ function NavbarItem(_ref) {
1146
+ var {
1147
+ label,
1148
+ gutter,
1149
+ badge,
1150
+ icon,
1151
+ component,
1152
+ onClick,
1153
+ variant,
1154
+ ident = 0,
1155
+ active
1156
+ } = _ref;
1157
+ var uid = ui.useUID();
1158
+ return /*#__PURE__*/jsxRuntime.jsxs(NavbarItemRoot, {
1159
+ as: component,
1160
+ onClick: onClick,
1161
+ "aria-labelledby": uid,
1162
+ "data-active": active,
1163
+ style: {
1164
+ marginTop: gutter ? '16px' : '0',
1165
+ paddingLeft: (ident + 1) * 20
1166
+ },
1167
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconWrapper$1, {
1168
+ children: icon
1169
+ }), /*#__PURE__*/jsxRuntime.jsx(NavbarLabel, {
1170
+ id: uid,
1171
+ children: label
1172
+ }), badge != null && /*#__PURE__*/jsxRuntime.jsx(NavbarBadge, {
1173
+ "data-variant": variant,
1174
+ children: badge
1175
+ })]
1176
+ });
1177
+ }
1178
+
1179
+ var NavbarAccordionLabel = /*#__PURE__*/styled__default.span.withConfig({
1180
+ displayName: "NavbarAccordion__NavbarAccordionLabel",
1181
+ componentId: "SD__sc-1s7g3kw-0"
1182
+ })(["flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;&[data-expanded='false']{display:none;}"]);
1183
+ var NavbarAccordionRoot = /*#__PURE__*/styled__default(core.Accordion).withConfig({
1184
+ displayName: "NavbarAccordion__NavbarAccordionRoot",
1185
+ componentId: "SD__sc-1s7g3kw-1"
1186
+ })(_ref => {
1187
+ var {
1188
+ gutter
1189
+ } = _ref;
1190
+ return styled.css(["width:100%;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;background-color:#1b2638;margin-top:", ";&:hover,&[aria-current]{background-color:#2f394a;color:", ";}&.MuiAccordion-root:before{background-color:#1b2638;}&.MuiPaper-elevation0{border:0px;}&&.MuiAccordionSummary-root.Mui-expanded{margin-top:", ";max-height:40px;min-height:40px;}"], gutter ? '16px' : '0', ui.Color.White, gutter ? '16px' : '0');
1191
+ });
1192
+ var NavbarAccordionSummary = /*#__PURE__*/styled__default(core.AccordionSummary).withConfig({
1193
+ displayName: "NavbarAccordion__NavbarAccordionSummary",
1194
+ componentId: "SD__sc-1s7g3kw-2"
1195
+ })(["border-left:4px solid transparent;padding-left:20px;&.MuiAccordionSummary-root{max-height:40px;min-height:40px;}&:hover,&[data-active='true']{border-left-color:", ";}&[data-expanded='false']{.MuiAccordionSummary-expandIcon{display:none;}}"], ui.Color.Blue300);
1196
+ var IconWrapper$2 = /*#__PURE__*/styled__default.div.withConfig({
1197
+ displayName: "NavbarAccordion__IconWrapper",
1198
+ componentId: "SD__sc-1s7g3kw-3"
1199
+ })(["width:24px;margin-right:8px;& svg{font-size:24px;}"]);
1200
+ function NavbarAccordion(_ref2) {
1201
+ var {
1202
+ label,
1203
+ icon,
1204
+ gutter,
1205
+ items,
1206
+ onClick: _onClick
1207
+ } = _ref2;
1208
+ var uid = ui.useUID();
1209
+ var {
1210
+ isExpanded: isMenuExpanded,
1211
+ isDrawerOpen,
1212
+ setDrawerOpen
1213
+ } = useNavbarContext();
1214
+ var [isExpanded, setExpanded] = react.useState(false);
1215
+ react.useEffect(() => {
1216
+ if (!isMenuExpanded) {
1217
+ setExpanded(false);
1218
+ }
1219
+ }, [isMenuExpanded]);
1220
+ return /*#__PURE__*/jsxRuntime.jsxs(NavbarAccordionRoot, {
1221
+ "aria-labelledby": uid,
1222
+ gutter: !!gutter,
1223
+ expanded: isExpanded,
1224
+ onClick: event => {
1225
+ if (isMenuExpanded || isDrawerOpen) {
1226
+ setExpanded(!isExpanded);
1227
+ }
1228
+
1229
+ _onClick(event);
1230
+ },
1231
+ square: true,
1232
+ children: [/*#__PURE__*/jsxRuntime.jsxs(NavbarAccordionSummary, {
1233
+ "data-active": !isExpanded && items.some(item => item.active),
1234
+ "data-expanded": isMenuExpanded || isDrawerOpen,
1235
+ expandIcon: /*#__PURE__*/jsxRuntime.jsx(icons.ExpandMore, {}),
1236
+ children: [/*#__PURE__*/jsxRuntime.jsx(IconWrapper$2, {
1237
+ children: icon
1238
+ }), /*#__PURE__*/jsxRuntime.jsx(NavbarAccordionLabel, {
1239
+ id: uid,
1240
+ "data-expanded": isMenuExpanded || isDrawerOpen,
1241
+ children: label
1242
+ })]
1243
+ }), items.map(item => {
1244
+ var index = items.indexOf(item);
1245
+ var prev = items[index - 1];
1246
+ return /*#__PURE__*/react.createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
1247
+ key: item.key,
1248
+ ident: 1,
1249
+ active: item.active,
1250
+ gutter: prev && prev.groupKey !== item.groupKey,
1251
+ onClick: event => {
1252
+ var _item$onClick;
1253
+
1254
+ event.stopPropagation();
1255
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
1256
+
1257
+ if (!event.isDefaultPrevented()) {
1258
+ setDrawerOpen(false);
1259
+ }
1260
+ }
1261
+ }));
1262
+ })]
1263
+ });
1264
+ }
1265
+
1266
+ var Header = /*#__PURE__*/styled__default.div.withConfig({
1267
+ displayName: "NavbarList__Header",
1268
+ componentId: "SD__sc-19zrmxc-0"
1269
+ })(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;position:sticky;"]);
1270
+ var Wrapper = /*#__PURE__*/styled__default.div.withConfig({
1271
+ displayName: "NavbarList__Wrapper",
1272
+ componentId: "SD__sc-19zrmxc-1"
1273
+ })(["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 => {
1274
+ var {
1275
+ isMobile
1276
+ } = _ref;
1277
+ return isMobile ? '280px' : 'initial';
1278
+ }, _ref2 => {
1279
+ var {
1280
+ isMobile
1281
+ } = _ref2;
1282
+ return isMobile ? '280px' : '240px';
1283
+ }, _ref3 => {
1284
+ var {
1285
+ isMobile
1286
+ } = _ref3;
1287
+ return isMobile ? '280px' : '72px';
1288
+ }, Header);
1289
+ var ExpandIconButton = /*#__PURE__*/styled__default(core.IconButton).withConfig({
1290
+ displayName: "NavbarList__ExpandIconButton",
1291
+ componentId: "SD__sc-19zrmxc-2"
1292
+ })(["color:", ";&&:focus{background-color:inherit;}"], ui.Color.Silver500);
1293
+ var Footer = /*#__PURE__*/styled__default.div.withConfig({
1294
+ displayName: "NavbarList__Footer",
1295
+ componentId: "SD__sc-19zrmxc-3"
1296
+ })(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;position:sticky;"]);
1297
+ var Root = /*#__PURE__*/styled__default.div.withConfig({
1298
+ displayName: "NavbarList__Root",
1299
+ componentId: "SD__sc-19zrmxc-4"
1300
+ })(["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);
1301
+ function NavbarMenuItem(_ref4) {
1302
+ var {
1303
+ label,
1304
+ icon,
1305
+ onClick,
1306
+ component
1307
+ } = _ref4;
1308
+ return /*#__PURE__*/jsxRuntime.jsx(Root, {
1309
+ as: component,
1310
+ onClick: onClick,
1311
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Inline, {
1312
+ space: "xsmall",
1313
+ verticalAlign: "center",
1314
+ children: [icon, /*#__PURE__*/jsxRuntime.jsx(NavbarLabel, {
1315
+ children: label
1316
+ })]
1317
+ })
1318
+ });
1319
+ }
1320
+ var Content = /*#__PURE__*/styled__default.div.withConfig({
1321
+ displayName: "NavbarList__Content",
1322
+ componentId: "SD__sc-19zrmxc-5"
1323
+ })(["height:100%;min-height:50px;overflow-y:auto;overflow-x:hidden;&[aria-expanded='false']{", ",", "{display:none;}}"], NavbarBadge, NavbarLabel);
1324
+ function NavbarList(_ref5) {
1325
+ var {
1326
+ header,
1327
+ items,
1328
+ footer
1329
+ } = _ref5;
1330
+ var platform = ui.useResponsiveValue('mobile', 'tablet', 'desktop');
1331
+ var isMobile = platform === 'mobile';
1332
+ var {
1333
+ isExpanded,
1334
+ isDrawerOpen,
1335
+ setDrawerOpen,
1336
+ setIsExpanded
1337
+ } = useNavbarContext();
1338
+ var isSidebarOpened = isMobile ? isDrawerOpen : isExpanded;
1339
+ var filteredItems = react.useMemo(() => items.filter(item => {
1340
+ return !item.hide && (isSidebarOpened || !!item.icon);
1341
+ }).map(item => _objectSpread(_objectSpread({}, item), {}, {
1342
+ menuGroupKey: item.groupKey
1343
+ })), [items, isSidebarOpened]);
1344
+ return /*#__PURE__*/jsxRuntime.jsxs(Wrapper, {
1345
+ isMobile: isMobile,
1346
+ "data-expanded": isSidebarOpened,
1347
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Header, {
1348
+ children: [isSidebarOpened && header, !isMobile && /*#__PURE__*/jsxRuntime.jsx(ExpandIconButton, {
1349
+ disableRipple: true,
1350
+ style: isExpanded ? {
1351
+ paddingRight: 0
1352
+ } : {},
1353
+ onClick: () => {
1354
+ setIsExpanded(!isExpanded);
1355
+ },
1356
+ children: isExpanded ? /*#__PURE__*/jsxRuntime.jsx(icons.MenuOpen, {}) : /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {})
1357
+ })]
1358
+ }), /*#__PURE__*/jsxRuntime.jsx(Content, {
1359
+ "aria-expanded": isSidebarOpened,
1360
+ children: filteredItems.map(item => {
1361
+ var index = filteredItems.indexOf(item);
1362
+ var prev = filteredItems[index - 1];
1363
+
1364
+ if ('items' in item) {
1365
+ return /*#__PURE__*/react.createElement(NavbarAccordion, _objectSpread(_objectSpread({}, item), {}, {
1366
+ key: item.key,
1367
+ gutter: prev && prev.groupKey !== item.groupKey,
1368
+ onClick: item.onClick
1369
+ }));
1370
+ }
1371
+
1372
+ return /*#__PURE__*/react.createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
1373
+ key: item.key,
1374
+ gutter: prev && prev.groupKey !== item.groupKey,
1375
+ onClick: event => {
1376
+ var _item$onClick;
1377
+
1378
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
1379
+
1380
+ if (!event.isDefaultPrevented()) {
1381
+ setDrawerOpen(false);
1382
+ }
1383
+ }
1384
+ }));
1385
+ })
1386
+ }), /*#__PURE__*/jsxRuntime.jsx(Footer, {
1387
+ children: footer
1388
+ })]
1389
+ });
1390
+ }
1391
+
1392
+ var Aside = /*#__PURE__*/styled__default.aside.withConfig({
1393
+ displayName: "Navbar__Aside",
1394
+ componentId: "SD__sc-1oiqig8-0"
1395
+ })(["display:flex;flex-direction:column;overflow:auto;"]);
1396
+ var Main = /*#__PURE__*/styled__default.main.withConfig({
1397
+ displayName: "Navbar__Main",
1398
+ componentId: "SD__sc-1oiqig8-1"
1399
+ })(["flex:1;display:flex;flex-direction:column;overflow:scroll;"]);
1400
+ function Navbar(_ref) {
1401
+ var {
1402
+ footer,
1403
+ items,
1404
+ header,
1405
+ bottomItems,
1406
+ children,
1407
+ containerStyle,
1408
+ hasExtraBadge
1409
+ } = _ref;
1410
+ var theme = core.useTheme();
1411
+ var [isDrawerOpen, setDrawerOpen] = react.useState(false);
1412
+ var platform = ui.useResponsiveValue('mobile', 'tablet', 'desktop');
1413
+ var isMobile = platform === 'mobile';
1414
+ var matches = core.useMediaQuery(theme.breakpoints.up('md'), {
1415
+ noSsr: true
1416
+ });
1417
+ var [isExpanded, setIsExpanded] = react.useState(matches);
1418
+ var hasBadge = hasExtraBadge || items.some(item => item.badge);
1419
+ var ctx = react.useMemo(() => ({
1420
+ isDrawerOpen,
1421
+ isExpanded,
1422
+ setIsExpanded,
1423
+ setDrawerOpen
1424
+ }), [isDrawerOpen, isExpanded, setIsExpanded, setDrawerOpen]);
1425
+ return /*#__PURE__*/jsxRuntime.jsx(NavbarContext.Provider, {
1426
+ value: ctx,
1427
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
1428
+ style: _objectSpread({
1429
+ display: 'flex',
1430
+ height: '100%',
1431
+ flexDirection: isMobile ? 'column' : 'row'
1432
+ }, containerStyle),
1433
+ children: [!isMobile && /*#__PURE__*/jsxRuntime.jsx(Aside, {
1434
+ children: /*#__PURE__*/jsxRuntime.jsx(NavbarList, {
1435
+ header: header,
1436
+ items: items,
1437
+ footer: footer
1438
+ })
1439
+ }), /*#__PURE__*/jsxRuntime.jsx(Main, {
1440
+ children: children
1441
+ }), isMobile && /*#__PURE__*/jsxRuntime.jsx(NavbarBottomBar, {
1442
+ items: bottomItems,
1443
+ hasMenuBadge: hasBadge
1444
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Drawer, {
1445
+ open: isDrawerOpen,
1446
+ anchor: "right",
1447
+ onClose: () => {
1448
+ setDrawerOpen(false);
1449
+ },
1450
+ PaperProps: {
1451
+ style: {
1452
+ width: '280px',
1453
+ minWidth: '280px'
1454
+ }
1455
+ },
1456
+ children: /*#__PURE__*/jsxRuntime.jsx(NavbarList, {
1457
+ header: header,
1458
+ items: items,
1459
+ footer: footer
1460
+ })
1461
+ })]
1462
+ })
1463
+ });
1464
+ }
1465
+
1466
+ var _excluded$7 = ["title", "subtitle", "children"];
1467
+ var StyledTypography = /*#__PURE__*/styled__default(core.Typography).withConfig({
1468
+ displayName: "NavbarAvatar__StyledTypography",
1469
+ componentId: "SD__sc-19q2zd0-0"
1470
+ })(["color:", ";text-overflow:ellipsis;white-space:nowrap;overflow:hidden;&:hover{color:", ";}"], ui.Color.Silver500, ui.Color.White);
1471
+ function NavbarAvatar(_ref) {
1472
+ var {
1473
+ title,
1474
+ subtitle,
1475
+ children
1476
+ } = _ref,
1477
+ props = _objectWithoutProperties(_ref, _excluded$7);
1478
+
1479
+ var {
1480
+ isExpanded,
1481
+ isDrawerOpen
1482
+ } = useNavbarContext();
1483
+
1484
+ if (isExpanded || isDrawerOpen) {
1485
+ return /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1486
+ space: "xsmall",
1487
+ align: "center",
1488
+ children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1489
+ width: "content",
1490
+ children: /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1491
+ children: children
1492
+ }))
1493
+ }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1494
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Stack, {
1495
+ space: "none",
1496
+ children: [/*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1497
+ variant: "caption",
1498
+ children: title
1499
+ }), /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1500
+ variant: "caption",
1501
+ children: subtitle
1502
+ })]
1503
+ })
1504
+ })]
1505
+ });
1506
+ }
1507
+
1508
+ return /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1509
+ children: children
1510
+ }));
1511
+ }
1512
+
1513
+ var Divider = /*#__PURE__*/styled__default.div.withConfig({
1514
+ displayName: "NavbarMenu__Divider",
1515
+ componentId: "SD__sc-1c8icpt-0"
1516
+ })(["border-bottom:1px solid ", ";margin:8px -16px;"], ui.Color.Silver400);
1517
+ var StyledMenuItem = /*#__PURE__*/styled__default(core.MenuItem).withConfig({
1518
+ displayName: "NavbarMenu__StyledMenuItem",
1519
+ componentId: "SD__sc-1c8icpt-1"
1520
+ })(["& svg{font-size:24px;color:", ";}"], ui.Color.Dark100);
1521
+ var Wrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
1522
+ displayName: "NavbarMenu__Wrapper",
1523
+ componentId: "SD__sc-1c8icpt-2"
1524
+ })(["width:100%;padding:8px 16px;cursor:pointer;background:", ";border-left:4px solid ", ";&:hover{border-left-color:", ";background:", ";}"], ui.Color.Dark400, _ref => {
1525
+ var {
1526
+ active
1527
+ } = _ref;
1528
+ return active ? ui.Color.Blue300 : 'transparent';
1529
+ }, ui.Color.Blue300, ui.Color.Dark400);
1530
+ function NavbarMenu(_ref2) {
1531
+ var {
1532
+ items,
1533
+ children
1534
+ } = _ref2;
1535
+ var {
1536
+ setDrawerOpen
1537
+ } = useNavbarContext();
1538
+ var [anchor, setAnchor] = react.useState(null);
1539
+
1540
+ function showProfileMenu(event) {
1541
+ setAnchor(event.currentTarget);
1542
+ }
1543
+
1544
+ function hideProfileMenu() {
1545
+ setAnchor(null);
1546
+ setDrawerOpen(false);
1547
+ }
1548
+
1549
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1550
+ children: [/*#__PURE__*/jsxRuntime.jsx(Wrapper$1, {
1551
+ onClick: showProfileMenu,
1552
+ active: !!anchor,
1553
+ children: children
1554
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Menu, {
1555
+ open: !!anchor,
1556
+ anchorEl: anchor,
1557
+ onClose: hideProfileMenu,
1558
+ onClick: hideProfileMenu,
1559
+ anchorOrigin: {
1560
+ vertical: 'top',
1561
+ horizontal: 'center'
1562
+ },
1563
+ transformOrigin: {
1564
+ vertical: 'bottom',
1565
+ horizontal: 'center'
1566
+ },
1567
+ children: items.filter(item => item.visible !== false).flatMap((item, index, arr) => {
1568
+ return [/*#__PURE__*/jsxRuntime.jsx(StyledMenuItem, {
1569
+ onClick: item.onClick,
1570
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Inline, {
1571
+ space: "small",
1572
+ verticalAlign: "center",
1573
+ children: [item.icon, /*#__PURE__*/jsxRuntime.jsx(core.Typography, {
1574
+ style: {
1575
+ color: ui.Color.Dark500
1576
+ },
1577
+ children: item.label
1578
+ })]
1579
+ })
1580
+ }, item.key), index !== arr.length - 1 && /*#__PURE__*/jsxRuntime.jsx(Divider, {}, "".concat(item.key, "-divider"))];
1581
+ })
1582
+ })]
1583
+ });
1584
+ }
1585
+
975
1586
  var SidebarRoot = /*#__PURE__*/styled__default.aside.withConfig({
976
1587
  displayName: "Sidebar__SidebarRoot",
977
1588
  componentId: "SD__sc-b77o22-0"
@@ -1300,9 +1911,21 @@ exports.Banner = Banner;
1300
1911
  exports.Box = Box;
1301
1912
  exports.Button = Button;
1302
1913
  exports.ButtonArea = ButtonArea;
1914
+ exports.Container = Container;
1303
1915
  exports.DescriptionItem = DescriptionItem;
1304
1916
  exports.FileDropZone = FileDropZone;
1305
1917
  exports.FileListItem = FileListItem;
1918
+ exports.LinkedText = LinkedText;
1919
+ exports.MultilineText = MultilineText;
1920
+ exports.Navbar = Navbar;
1921
+ exports.NavbarAvatar = NavbarAvatar;
1922
+ exports.NavbarBadge = NavbarBadge;
1923
+ exports.NavbarBottomBar = NavbarBottomBar;
1924
+ exports.NavbarItem = NavbarItem;
1925
+ exports.NavbarLabel = NavbarLabel;
1926
+ exports.NavbarList = NavbarList;
1927
+ exports.NavbarMenu = NavbarMenu;
1928
+ exports.NavbarMenuItem = NavbarMenuItem;
1306
1929
  exports.Sidebar = Sidebar;
1307
1930
  exports.SidebarContainer = SidebarContainer;
1308
1931
  exports.SidebarDivider = SidebarDivider;
@@ -1313,4 +1936,5 @@ exports.SidebarSubheader = SidebarSubheader;
1313
1936
  exports.TextBox = TextBox;
1314
1937
  exports.formatBytes = formatBytes;
1315
1938
  exports.toBytes = toBytes;
1939
+ exports.useNavbarContext = useNavbarContext;
1316
1940
  //# sourceMappingURL=index.js.map