@superdispatch/ui-lab 0.18.3 → 0.20.1
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.
- package/dist-node/index.js +323 -18
- package/dist-node/index.js.map +1 -1
- package/dist-src/index.js +4 -0
- package/dist-src/multiline-text/MultilineText.js +11 -0
- package/dist-src/navbar/NavbarAccordion.js +97 -0
- package/dist-src/navbar/NavbarItem.js +4 -2
- package/dist-src/navbar/NavbarList.js +11 -1
- package/dist-src/sidebar/Sidebar.js +1 -1
- package/dist-src/sidebar/SidebarBackButton.js +38 -0
- package/dist-src/sidebar/SidebarContainer.js +44 -10
- package/dist-src/sidebar/SidebarContent.js +88 -0
- package/dist-src/sidebar/SidebarMenuItem.js +14 -3
- package/dist-src/sidebar/SidebarMenuItemAvatar.js +1 -0
- package/dist-types/index.d.ts +53 -5
- package/dist-web/index.js +325 -25
- package/dist-web/index.js.map +1 -1
- package/package.json +3 -3
package/dist-node/index.js
CHANGED
|
@@ -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,6 +1176,93 @@ 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"
|
|
@@ -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;overflow:
|
|
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,
|
|
@@ -1224,6 +1360,15 @@ function NavbarList(_ref5) {
|
|
|
1224
1360
|
children: filteredItems.map(item => {
|
|
1225
1361
|
var index = filteredItems.indexOf(item);
|
|
1226
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
|
+
|
|
1227
1372
|
return /*#__PURE__*/react.createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
|
|
1228
1373
|
key: item.key,
|
|
1229
1374
|
gutter: prev && prev.groupKey !== item.groupKey,
|
|
@@ -1318,7 +1463,7 @@ function Navbar(_ref) {
|
|
|
1318
1463
|
});
|
|
1319
1464
|
}
|
|
1320
1465
|
|
|
1321
|
-
var _excluded$
|
|
1466
|
+
var _excluded$7 = ["title", "subtitle", "children"];
|
|
1322
1467
|
var StyledTypography = /*#__PURE__*/styled__default(core.Typography).withConfig({
|
|
1323
1468
|
displayName: "NavbarAvatar__StyledTypography",
|
|
1324
1469
|
componentId: "SD__sc-19q2zd0-0"
|
|
@@ -1329,7 +1474,7 @@ function NavbarAvatar(_ref) {
|
|
|
1329
1474
|
subtitle,
|
|
1330
1475
|
children
|
|
1331
1476
|
} = _ref,
|
|
1332
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1477
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1333
1478
|
|
|
1334
1479
|
var {
|
|
1335
1480
|
isExpanded,
|
|
@@ -1441,7 +1586,7 @@ function NavbarMenu(_ref2) {
|
|
|
1441
1586
|
var SidebarRoot = /*#__PURE__*/styled__default.aside.withConfig({
|
|
1442
1587
|
displayName: "Sidebar__SidebarRoot",
|
|
1443
1588
|
componentId: "SD__sc-b77o22-0"
|
|
1444
|
-
})(["top:0;position:sticky;overflow-y:auto;overflow-x:hidden;
|
|
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);
|
|
1445
1590
|
var SidebarHeader = /*#__PURE__*/styled__default.div.withConfig({
|
|
1446
1591
|
displayName: "Sidebar__SidebarHeader",
|
|
1447
1592
|
componentId: "SD__sc-b77o22-1"
|
|
@@ -1493,28 +1638,172 @@ var Sidebar = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
1493
1638
|
});
|
|
1494
1639
|
if (process.env.NODE_ENV !== "production") Sidebar.displayName = "Sidebar";
|
|
1495
1640
|
|
|
1496
|
-
var
|
|
1497
|
-
|
|
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",
|
|
1498
1653
|
componentId: "SD__sc-uibj1m-0"
|
|
1499
|
-
})(["
|
|
1654
|
+
})(["height:inherit;max-height:inherit;min-height:inherit;width:240px;"]);
|
|
1500
1655
|
var SidebarContainerContent = /*#__PURE__*/styled__default.div.withConfig({
|
|
1501
1656
|
displayName: "SidebarContainer__SidebarContainerContent",
|
|
1502
1657
|
componentId: "SD__sc-uibj1m-1"
|
|
1503
|
-
})(["height:inherit;max-height:inherit;min-height:inherit;
|
|
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);
|
|
1504
1663
|
var SidebarContainer = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
1505
1664
|
var {
|
|
1506
1665
|
sidebar,
|
|
1507
1666
|
children
|
|
1508
1667
|
} = _ref;
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
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
|
+
})
|
|
1514
1692
|
});
|
|
1515
1693
|
});
|
|
1516
1694
|
if (process.env.NODE_ENV !== "production") SidebarContainer.displayName = "SidebarContainer";
|
|
1517
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' : ['small', 'medium'],
|
|
1802
|
+
children: children
|
|
1803
|
+
})]
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1518
1807
|
var SidebarDividerRoot = /*#__PURE__*/styled__default.div.withConfig({
|
|
1519
1808
|
displayName: "SidebarDivider__SidebarDividerRoot",
|
|
1520
1809
|
componentId: "SD__sc-5lwi2i-0"
|
|
@@ -1569,17 +1858,21 @@ var SidebarMenuItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
1569
1858
|
var {
|
|
1570
1859
|
action,
|
|
1571
1860
|
avatar,
|
|
1572
|
-
onClick,
|
|
1861
|
+
onClick: _onClick,
|
|
1573
1862
|
external,
|
|
1574
1863
|
children,
|
|
1575
1864
|
disabled,
|
|
1576
1865
|
selected,
|
|
1577
1866
|
secondaryActions,
|
|
1578
|
-
badge: badgeProp
|
|
1867
|
+
badge: badgeProp,
|
|
1868
|
+
openContentOnClick
|
|
1579
1869
|
} = _ref2;
|
|
1580
1870
|
var [hovered, setHovered] = react.useState(false);
|
|
1581
1871
|
var actionsRef = react.useRef(null);
|
|
1582
1872
|
var actionsPlaceholderRef = react.useRef(null);
|
|
1873
|
+
var {
|
|
1874
|
+
openSidebarContent
|
|
1875
|
+
} = useSidebarContext();
|
|
1583
1876
|
react.useLayoutEffect(() => {
|
|
1584
1877
|
if (actionsRef.current && actionsPlaceholderRef.current) {
|
|
1585
1878
|
actionsPlaceholderRef.current.style.width = "".concat(Math.max(0, actionsRef.current.offsetWidth - 8), "px");
|
|
@@ -1596,9 +1889,15 @@ var SidebarMenuItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
1596
1889
|
setHovered(false);
|
|
1597
1890
|
},
|
|
1598
1891
|
children: [/*#__PURE__*/jsxRuntime.jsx(core.ButtonBase, {
|
|
1599
|
-
onClick: onClick,
|
|
1600
1892
|
disabled: disabled,
|
|
1601
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
|
+
},
|
|
1602
1901
|
children: /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
|
|
1603
1902
|
align: "center",
|
|
1604
1903
|
space: "xsmall",
|
|
@@ -1711,6 +2010,7 @@ var SidebarMenuItemAvatar = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
1711
2010
|
color: "primary",
|
|
1712
2011
|
checked: value,
|
|
1713
2012
|
disabled: disabled,
|
|
2013
|
+
onClick: stopPropagation,
|
|
1714
2014
|
onMouseDown: stopPropagation,
|
|
1715
2015
|
onTouchStart: stopPropagation,
|
|
1716
2016
|
onChange: (_, checked) => {
|
|
@@ -1770,6 +2070,8 @@ exports.Container = Container;
|
|
|
1770
2070
|
exports.DescriptionItem = DescriptionItem;
|
|
1771
2071
|
exports.FileDropZone = FileDropZone;
|
|
1772
2072
|
exports.FileListItem = FileListItem;
|
|
2073
|
+
exports.LinkedText = LinkedText;
|
|
2074
|
+
exports.MultilineText = MultilineText;
|
|
1773
2075
|
exports.Navbar = Navbar;
|
|
1774
2076
|
exports.NavbarAvatar = NavbarAvatar;
|
|
1775
2077
|
exports.NavbarBadge = NavbarBadge;
|
|
@@ -1780,7 +2082,9 @@ exports.NavbarList = NavbarList;
|
|
|
1780
2082
|
exports.NavbarMenu = NavbarMenu;
|
|
1781
2083
|
exports.NavbarMenuItem = NavbarMenuItem;
|
|
1782
2084
|
exports.Sidebar = Sidebar;
|
|
2085
|
+
exports.SidebarBackButton = SidebarBackButton;
|
|
1783
2086
|
exports.SidebarContainer = SidebarContainer;
|
|
2087
|
+
exports.SidebarContent = SidebarContent;
|
|
1784
2088
|
exports.SidebarDivider = SidebarDivider;
|
|
1785
2089
|
exports.SidebarMenuItem = SidebarMenuItem;
|
|
1786
2090
|
exports.SidebarMenuItemAction = SidebarMenuItemAction;
|
|
@@ -1790,4 +2094,5 @@ exports.TextBox = TextBox;
|
|
|
1790
2094
|
exports.formatBytes = formatBytes;
|
|
1791
2095
|
exports.toBytes = toBytes;
|
|
1792
2096
|
exports.useNavbarContext = useNavbarContext;
|
|
2097
|
+
exports.useSidebarContext = useSidebarContext;
|
|
1793
2098
|
//# sourceMappingURL=index.js.map
|