@superdispatch/ui-lab 0.18.0 → 0.20.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 reactAnchorme = require('react-anchorme');
20
21
  var lodash = require('lodash');
21
22
 
22
23
  function colorMixin(textColor, backgroundColor, buttonHoverColor) {
@@ -1012,6 +1013,52 @@ var FileListItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
1012
1013
  });
1013
1014
  if (process.env.NODE_ENV !== "production") FileListItem.displayName = "FileListItem";
1014
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
+
1015
1062
  var NavbarContext = /*#__PURE__*/react.createContext({
1016
1063
  isDrawerOpen: false,
1017
1064
  isExpanded: false,
@@ -1090,7 +1137,7 @@ var NavbarLabel = /*#__PURE__*/styled__default.span.withConfig({
1090
1137
  var NavbarItemRoot = /*#__PURE__*/styled__default.div.withConfig({
1091
1138
  displayName: "NavbarItem__NavbarItemRoot",
1092
1139
  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);
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);
1094
1141
  var IconWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
1095
1142
  displayName: "NavbarItem__IconWrapper",
1096
1143
  componentId: "SD__sc-1pvzq3w-3"
@@ -1104,13 +1151,15 @@ function NavbarItem(_ref) {
1104
1151
  component,
1105
1152
  onClick,
1106
1153
  variant,
1107
- ident = 0
1154
+ ident = 0,
1155
+ active
1108
1156
  } = _ref;
1109
1157
  var uid = ui.useUID();
1110
1158
  return /*#__PURE__*/jsxRuntime.jsxs(NavbarItemRoot, {
1111
1159
  as: component,
1112
1160
  onClick: onClick,
1113
1161
  "aria-labelledby": uid,
1162
+ "data-active": active,
1114
1163
  style: {
1115
1164
  marginTop: gutter ? '16px' : '0',
1116
1165
  paddingLeft: (ident + 1) * 20
@@ -1127,10 +1176,97 @@ function NavbarItem(_ref) {
1127
1176
  });
1128
1177
  }
1129
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
+
1130
1266
  var Header = /*#__PURE__*/styled__default.div.withConfig({
1131
1267
  displayName: "NavbarList__Header",
1132
1268
  componentId: "SD__sc-19zrmxc-0"
1133
- })(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;"]);
1269
+ })(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;position:sticky;"]);
1134
1270
  var Wrapper = /*#__PURE__*/styled__default.div.withConfig({
1135
1271
  displayName: "NavbarList__Wrapper",
1136
1272
  componentId: "SD__sc-19zrmxc-1"
@@ -1157,7 +1293,7 @@ var ExpandIconButton = /*#__PURE__*/styled__default(core.IconButton).withConfig(
1157
1293
  var Footer = /*#__PURE__*/styled__default.div.withConfig({
1158
1294
  displayName: "NavbarList__Footer",
1159
1295
  componentId: "SD__sc-19zrmxc-3"
1160
- })(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;"]);
1296
+ })(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;position:sticky;"]);
1161
1297
  var Root = /*#__PURE__*/styled__default.div.withConfig({
1162
1298
  displayName: "NavbarList__Root",
1163
1299
  componentId: "SD__sc-19zrmxc-4"
@@ -1184,7 +1320,7 @@ function NavbarMenuItem(_ref4) {
1184
1320
  var Content = /*#__PURE__*/styled__default.div.withConfig({
1185
1321
  displayName: "NavbarList__Content",
1186
1322
  componentId: "SD__sc-19zrmxc-5"
1187
- })(["height:100%;min-height:50px;&[aria-expanded='false']{", ",", "{visibility:hidden;}}"], NavbarBadge, NavbarLabel);
1323
+ })(["height:100%;min-height:50px;overflow-y:auto;overflow-x:hidden;&[aria-expanded='false']{", ",", "{display:none;}}"], NavbarBadge, NavbarLabel);
1188
1324
  function NavbarList(_ref5) {
1189
1325
  var {
1190
1326
  header,
@@ -1221,41 +1357,31 @@ function NavbarList(_ref5) {
1221
1357
  })]
1222
1358
  }), /*#__PURE__*/jsxRuntime.jsx(Content, {
1223
1359
  "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
- }
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
1242
1369
  }));
1243
- },
1244
- renderMenuItem: item => /*#__PURE__*/jsxRuntime.jsx(NavbarMenuItem, _objectSpread(_objectSpread({}, item), {}, {
1370
+ }
1371
+
1372
+ return /*#__PURE__*/react.createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
1373
+ key: item.key,
1374
+ gutter: prev && prev.groupKey !== item.groupKey,
1245
1375
  onClick: event => {
1246
- var _item$onClick2;
1376
+ var _item$onClick;
1247
1377
 
1248
- (_item$onClick2 = item.onClick) === null || _item$onClick2 === void 0 ? void 0 : _item$onClick2.call(item, event);
1378
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
1249
1379
 
1250
1380
  if (!event.isDefaultPrevented()) {
1251
1381
  setDrawerOpen(false);
1252
1382
  }
1253
1383
  }
1254
- })),
1255
- moreElement: /*#__PURE__*/jsxRuntime.jsx(NavbarItem, {
1256
- icon: /*#__PURE__*/jsxRuntime.jsx(icons.MoreHoriz, {}),
1257
- label: "More"
1258
- })
1384
+ }));
1259
1385
  })
1260
1386
  }), /*#__PURE__*/jsxRuntime.jsx(Footer, {
1261
1387
  children: footer
@@ -1270,7 +1396,7 @@ var Aside = /*#__PURE__*/styled__default.aside.withConfig({
1270
1396
  var Main = /*#__PURE__*/styled__default.main.withConfig({
1271
1397
  displayName: "Navbar__Main",
1272
1398
  componentId: "SD__sc-1oiqig8-1"
1273
- })(["flex:1;display:flex;flex-direction:column;overflow:auto;"]);
1399
+ })(["flex:1;display:flex;flex-direction:column;overflow:scroll;"]);
1274
1400
  function Navbar(_ref) {
1275
1401
  var {
1276
1402
  footer,
@@ -1337,7 +1463,7 @@ function Navbar(_ref) {
1337
1463
  });
1338
1464
  }
1339
1465
 
1340
- var _excluded$6 = ["title", "subtitle", "children"];
1466
+ var _excluded$7 = ["title", "subtitle", "children"];
1341
1467
  var StyledTypography = /*#__PURE__*/styled__default(core.Typography).withConfig({
1342
1468
  displayName: "NavbarAvatar__StyledTypography",
1343
1469
  componentId: "SD__sc-19q2zd0-0"
@@ -1348,7 +1474,7 @@ function NavbarAvatar(_ref) {
1348
1474
  subtitle,
1349
1475
  children
1350
1476
  } = _ref,
1351
- props = _objectWithoutProperties(_ref, _excluded$6);
1477
+ props = _objectWithoutProperties(_ref, _excluded$7);
1352
1478
 
1353
1479
  var {
1354
1480
  isExpanded,
@@ -1368,8 +1494,10 @@ function NavbarAvatar(_ref) {
1368
1494
  children: /*#__PURE__*/jsxRuntime.jsxs(ui.Stack, {
1369
1495
  space: "none",
1370
1496
  children: [/*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1497
+ variant: "caption",
1371
1498
  children: title
1372
1499
  }), /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1500
+ variant: "caption",
1373
1501
  children: subtitle
1374
1502
  })]
1375
1503
  })
@@ -1458,7 +1586,7 @@ function NavbarMenu(_ref2) {
1458
1586
  var SidebarRoot = /*#__PURE__*/styled__default.aside.withConfig({
1459
1587
  displayName: "Sidebar__SidebarRoot",
1460
1588
  componentId: "SD__sc-b77o22-0"
1461
- })(["top:0;position:sticky;overflow-y:auto;overflow-x:hidden;width:240px;height:100vh;background-color:", ";border-right:1px solid ", ";"], ui.Color.White, ui.Color.Silver400);
1589
+ })(["top:0;position:sticky;overflow-y:auto;overflow-x:hidden;height:100vh;background-color:", ";border-right:1px solid ", ";"], ui.Color.White, ui.Color.Silver400);
1462
1590
  var SidebarHeader = /*#__PURE__*/styled__default.div.withConfig({
1463
1591
  displayName: "Sidebar__SidebarHeader",
1464
1592
  componentId: "SD__sc-b77o22-1"
@@ -1510,28 +1638,172 @@ var Sidebar = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1510
1638
  });
1511
1639
  if (process.env.NODE_ENV !== "production") Sidebar.displayName = "Sidebar";
1512
1640
 
1513
- var SidebarContainerRoot = /*#__PURE__*/styled__default.div.withConfig({
1514
- displayName: "SidebarContainer__SidebarContainerRoot",
1641
+ var Context = /*#__PURE__*/react.createContext(null);
1642
+ function useSidebarContext() {
1643
+ var context = react.useContext(Context);
1644
+
1645
+ if (!context) {
1646
+ throw new Error('SidebarContext is used outside Provider');
1647
+ }
1648
+
1649
+ return context;
1650
+ }
1651
+ var SidebarContainerSidebar = /*#__PURE__*/styled__default.div.withConfig({
1652
+ displayName: "SidebarContainer__SidebarContainerSidebar",
1515
1653
  componentId: "SD__sc-uibj1m-0"
1516
- })(["display:flex;height:inherit;max-height:inherit;min-height:inherit;"]);
1654
+ })(["height:inherit;max-height:inherit;min-height:inherit;width:240px;"]);
1517
1655
  var SidebarContainerContent = /*#__PURE__*/styled__default.div.withConfig({
1518
1656
  displayName: "SidebarContainer__SidebarContainerContent",
1519
1657
  componentId: "SD__sc-uibj1m-1"
1520
- })(["height:inherit;max-height:inherit;min-height:inherit;width:calc(100% - 240px);min-width:calc(100% - 240px);max-width:calc(100% - 240px);"]);
1658
+ })(["height:inherit;max-height:inherit;min-height:inherit;"]);
1659
+ var SidebarContainerRoot = /*#__PURE__*/styled__default.div.withConfig({
1660
+ displayName: "SidebarContainer__SidebarContainerRoot",
1661
+ componentId: "SD__sc-uibj1m-2"
1662
+ })(["display:flex;height:inherit;max-height:inherit;min-height:inherit;& ", "{width:calc(100% - 240px);min-width:calc(100% - 240px);max-width:calc(100% - 240px);}&[data-visibility='sidebar'] ", "{width:100%;}&[data-visibility='sidebar'] ", "{display:none;}&[data-visibility='content'] ", "{display:none;}&[data-visibility='content'] ", "{width:100%;max-width:unset;}"], SidebarContainerContent, SidebarContainerSidebar, SidebarContainerContent, SidebarContainerSidebar, SidebarContainerContent);
1521
1663
  var SidebarContainer = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1522
1664
  var {
1523
1665
  sidebar,
1524
1666
  children
1525
1667
  } = _ref;
1526
- return /*#__PURE__*/jsxRuntime.jsxs(SidebarContainerRoot, {
1527
- ref: ref,
1528
- children: [sidebar, /*#__PURE__*/jsxRuntime.jsx(SidebarContainerContent, {
1529
- children: children
1530
- })]
1668
+ var isCollapsed = ui.useCollapseBreakpoint('sm');
1669
+ var [visibilityState, setVisibilityState] = react.useState('sidebar');
1670
+ var visibility = isCollapsed ? visibilityState : 'both';
1671
+ var context = react.useMemo(() => {
1672
+ return {
1673
+ openSidebar: () => {
1674
+ setVisibilityState('sidebar');
1675
+ },
1676
+ openSidebarContent: () => {
1677
+ setVisibilityState('content');
1678
+ }
1679
+ };
1680
+ }, []);
1681
+ return /*#__PURE__*/jsxRuntime.jsx(Context.Provider, {
1682
+ value: context,
1683
+ children: /*#__PURE__*/jsxRuntime.jsxs(SidebarContainerRoot, {
1684
+ ref: ref,
1685
+ "data-visibility": visibility,
1686
+ children: [/*#__PURE__*/jsxRuntime.jsx(SidebarContainerSidebar, {
1687
+ children: sidebar
1688
+ }), /*#__PURE__*/jsxRuntime.jsx(SidebarContainerContent, {
1689
+ children: children
1690
+ })]
1691
+ })
1531
1692
  });
1532
1693
  });
1533
1694
  if (process.env.NODE_ENV !== "production") SidebarContainer.displayName = "SidebarContainer";
1534
1695
 
1696
+ var _excluded$8 = ["onClick", "children"];
1697
+ function SidebarBackButton(_ref) {
1698
+ var {
1699
+ onClick: _onClick,
1700
+ children = /*#__PURE__*/jsxRuntime.jsx(icons.ArrowBack, {
1701
+ fontSize: "small"
1702
+ })
1703
+ } = _ref,
1704
+ props = _objectWithoutProperties(_ref, _excluded$8);
1705
+
1706
+ var isCollapsed = ui.useCollapseBreakpoint('sm');
1707
+ var {
1708
+ openSidebar
1709
+ } = useSidebarContext();
1710
+
1711
+ if (!isCollapsed) {
1712
+ return null;
1713
+ }
1714
+
1715
+ return /*#__PURE__*/jsxRuntime.jsx(core.IconButton, _objectSpread(_objectSpread({}, props), {}, {
1716
+ size: "small",
1717
+ onClick: event => {
1718
+ _onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
1719
+
1720
+ if (!event.isDefaultPrevented()) {
1721
+ openSidebar();
1722
+ }
1723
+ },
1724
+ children: children
1725
+ }));
1726
+ }
1727
+
1728
+ var SidebarAppBar = /*#__PURE__*/styled__default(core.AppBar).withConfig({
1729
+ displayName: "SidebarContent__SidebarAppBar",
1730
+ componentId: "SD__sc-zpgf61-0"
1731
+ })(_ref => {
1732
+ var {
1733
+ theme
1734
+ } = _ref;
1735
+ return styled.css(["", "{&&{border-left:transparent;}}"], theme.breakpoints.up('sm'));
1736
+ });
1737
+ function SidebarContent(_ref2) {
1738
+ var {
1739
+ dense,
1740
+ action,
1741
+ title,
1742
+ children,
1743
+ onBack,
1744
+ openOnMount,
1745
+ closeOnUnmount
1746
+ } = _ref2;
1747
+ var isOpenedOnMount = react.useRef(false);
1748
+ var isClosedOnMount = react.useRef(false);
1749
+ var {
1750
+ openSidebarContent,
1751
+ openSidebar
1752
+ } = useSidebarContext();
1753
+ react.useLayoutEffect(() => {
1754
+ if (openOnMount) {
1755
+ if (isOpenedOnMount.current) {
1756
+ // eslint-disable-next-line no-console
1757
+ console.warn('[SidebarContent]: "openOnMount" should not change during lifecycle of the component.');
1758
+ } else {
1759
+ isOpenedOnMount.current = true;
1760
+ openSidebarContent();
1761
+ }
1762
+ }
1763
+ }, [openOnMount, openSidebarContent]);
1764
+ react.useLayoutEffect(() => {
1765
+ return () => {
1766
+ if (closeOnUnmount) {
1767
+ if (isClosedOnMount.current) {
1768
+ // eslint-disable-next-line no-console
1769
+ console.warn('[SidebarContent]: "closeOnUnmount" should not change during lifecycle of the component.');
1770
+ } else {
1771
+ isClosedOnMount.current = true;
1772
+ openSidebar();
1773
+ }
1774
+ }
1775
+ };
1776
+ }, [openSidebar, closeOnUnmount]);
1777
+ return /*#__PURE__*/jsxRuntime.jsxs(ui.Stack, {
1778
+ space: "none",
1779
+ children: [/*#__PURE__*/jsxRuntime.jsx(SidebarAppBar, {
1780
+ children: /*#__PURE__*/jsxRuntime.jsx(core.Toolbar, {
1781
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1782
+ align: "center",
1783
+ space: "small",
1784
+ children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1785
+ width: "content",
1786
+ children: /*#__PURE__*/jsxRuntime.jsx(SidebarBackButton, {
1787
+ onClick: onBack
1788
+ })
1789
+ }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1790
+ children: /*#__PURE__*/jsxRuntime.jsx(TextBox, {
1791
+ variant: "heading-2",
1792
+ children: title
1793
+ })
1794
+ }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1795
+ width: "content",
1796
+ children: action
1797
+ })]
1798
+ })
1799
+ })
1800
+ }), /*#__PURE__*/jsxRuntime.jsx(Box, {
1801
+ padding: dense ? 'none' : 'medium',
1802
+ children: children
1803
+ })]
1804
+ });
1805
+ }
1806
+
1535
1807
  var SidebarDividerRoot = /*#__PURE__*/styled__default.div.withConfig({
1536
1808
  displayName: "SidebarDivider__SidebarDividerRoot",
1537
1809
  componentId: "SD__sc-5lwi2i-0"
@@ -1586,17 +1858,21 @@ var SidebarMenuItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
1586
1858
  var {
1587
1859
  action,
1588
1860
  avatar,
1589
- onClick,
1861
+ onClick: _onClick,
1590
1862
  external,
1591
1863
  children,
1592
1864
  disabled,
1593
1865
  selected,
1594
1866
  secondaryActions,
1595
- badge: badgeProp
1867
+ badge: badgeProp,
1868
+ openContentOnClick
1596
1869
  } = _ref2;
1597
1870
  var [hovered, setHovered] = react.useState(false);
1598
1871
  var actionsRef = react.useRef(null);
1599
1872
  var actionsPlaceholderRef = react.useRef(null);
1873
+ var {
1874
+ openSidebarContent
1875
+ } = useSidebarContext();
1600
1876
  react.useLayoutEffect(() => {
1601
1877
  if (actionsRef.current && actionsPlaceholderRef.current) {
1602
1878
  actionsPlaceholderRef.current.style.width = "".concat(Math.max(0, actionsRef.current.offsetWidth - 8), "px");
@@ -1613,9 +1889,15 @@ var SidebarMenuItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
1613
1889
  setHovered(false);
1614
1890
  },
1615
1891
  children: [/*#__PURE__*/jsxRuntime.jsx(core.ButtonBase, {
1616
- onClick: onClick,
1617
1892
  disabled: disabled,
1618
1893
  "aria-current": selected,
1894
+ onClick: event => {
1895
+ _onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
1896
+
1897
+ if (!event.isDefaultPrevented() && openContentOnClick) {
1898
+ openSidebarContent();
1899
+ }
1900
+ },
1619
1901
  children: /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1620
1902
  align: "center",
1621
1903
  space: "xsmall",
@@ -1728,6 +2010,7 @@ var SidebarMenuItemAvatar = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1728
2010
  color: "primary",
1729
2011
  checked: value,
1730
2012
  disabled: disabled,
2013
+ onClick: stopPropagation,
1731
2014
  onMouseDown: stopPropagation,
1732
2015
  onTouchStart: stopPropagation,
1733
2016
  onChange: (_, checked) => {
@@ -1787,6 +2070,8 @@ exports.Container = Container;
1787
2070
  exports.DescriptionItem = DescriptionItem;
1788
2071
  exports.FileDropZone = FileDropZone;
1789
2072
  exports.FileListItem = FileListItem;
2073
+ exports.LinkedText = LinkedText;
2074
+ exports.MultilineText = MultilineText;
1790
2075
  exports.Navbar = Navbar;
1791
2076
  exports.NavbarAvatar = NavbarAvatar;
1792
2077
  exports.NavbarBadge = NavbarBadge;
@@ -1797,7 +2082,9 @@ exports.NavbarList = NavbarList;
1797
2082
  exports.NavbarMenu = NavbarMenu;
1798
2083
  exports.NavbarMenuItem = NavbarMenuItem;
1799
2084
  exports.Sidebar = Sidebar;
2085
+ exports.SidebarBackButton = SidebarBackButton;
1800
2086
  exports.SidebarContainer = SidebarContainer;
2087
+ exports.SidebarContent = SidebarContent;
1801
2088
  exports.SidebarDivider = SidebarDivider;
1802
2089
  exports.SidebarMenuItem = SidebarMenuItem;
1803
2090
  exports.SidebarMenuItemAction = SidebarMenuItemAction;
@@ -1807,4 +2094,5 @@ exports.TextBox = TextBox;
1807
2094
  exports.formatBytes = formatBytes;
1808
2095
  exports.toBytes = toBytes;
1809
2096
  exports.useNavbarContext = useNavbarContext;
2097
+ exports.useSidebarContext = useSidebarContext;
1810
2098
  //# sourceMappingURL=index.js.map