@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.
- package/dist-node/index.js +336 -48
- package/dist-node/index.js.map +1 -1
- package/dist-src/index.js +4 -0
- package/dist-src/linked-text/LinkedText.js +40 -0
- package/dist-src/multiline-text/MultilineText.js +11 -0
- package/dist-src/navbar/Navbar.js +1 -1
- package/dist-src/navbar/NavbarAccordion.js +97 -0
- package/dist-src/navbar/NavbarAvatar.js +2 -0
- package/dist-src/navbar/NavbarItem.js +4 -2
- package/dist-src/navbar/NavbarList.js +23 -31
- 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 +338 -55
- package/dist-web/index.js.map +1 -1
- package/package.json +4 -3
package/dist-web/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { CheckCircle, Info, Error, Image, Refresh, Delete, Menu, MenuOpen,
|
|
1
|
+
import { CheckCircle, Info, Error as Error$1, Image, Refresh, Delete, Menu, ExpandMore, MenuOpen, ArrowBack, OpenInNew } from '@material-ui/icons';
|
|
2
2
|
import { Alert as Alert$1 } from '@material-ui/lab';
|
|
3
|
-
import { Color, parseResponsiveProp, isColorProp, parseSpaceProp, Stack, mergeRefs, useUID, isEmptyReactNode, Columns, Column, Inline, CardButton, useResponsiveValue,
|
|
3
|
+
import { Color, parseResponsiveProp, isColorProp, parseSpaceProp, Stack, mergeRefs, useUID, isEmptyReactNode, Columns, Column, Inline, CardButton, useResponsiveValue, useCollapseBreakpoint } from '@superdispatch/ui';
|
|
4
4
|
import { forwardRef, useState, useEffect, useRef, useLayoutEffect, Suspense, memo, useContext, createContext, useMemo, createElement } from 'react';
|
|
5
5
|
import styled, { css, keyframes } from 'styled-components';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
8
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
9
9
|
import { CSSTransition } from 'react-transition-group';
|
|
10
|
-
import { ButtonBase, Typography, CircularProgress, SvgIcon, Link, Tooltip, IconButton, BottomNavigation, BottomNavigationAction, useTheme, useMediaQuery, Drawer, Avatar, MenuItem, Menu as Menu$1, Divider as Divider$1, Checkbox } from '@material-ui/core';
|
|
10
|
+
import { ButtonBase, Typography, CircularProgress, SvgIcon, Link, Tooltip, IconButton, BottomNavigation, BottomNavigationAction, AccordionSummary, Accordion, useTheme, useMediaQuery, Drawer, Avatar, MenuItem, Menu as Menu$1, Toolbar, AppBar, Divider as Divider$1, Checkbox } from '@material-ui/core';
|
|
11
11
|
import { mdiUpload, mdiFilePdfBox, mdiTextBox } from '@mdi/js';
|
|
12
12
|
import Dropzone from 'react-dropzone';
|
|
13
|
+
import { Anchorme } from 'react-anchorme';
|
|
13
14
|
import { noop } from 'lodash';
|
|
14
15
|
|
|
15
16
|
function colorMixin(textColor, backgroundColor, buttonHoverColor) {
|
|
@@ -28,7 +29,7 @@ function toMaterialSeverity(severity) {
|
|
|
28
29
|
var iconMapping = {
|
|
29
30
|
success: /*#__PURE__*/jsx(CheckCircle, {}),
|
|
30
31
|
info: /*#__PURE__*/jsx(Info, {}),
|
|
31
|
-
error: /*#__PURE__*/jsx(Error, {})
|
|
32
|
+
error: /*#__PURE__*/jsx(Error$1, {})
|
|
32
33
|
};
|
|
33
34
|
var Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
34
35
|
var {
|
|
@@ -806,7 +807,7 @@ function UploadRejection(_ref2) {
|
|
|
806
807
|
align: "center",
|
|
807
808
|
children: [/*#__PURE__*/jsx(Column, {
|
|
808
809
|
width: "content",
|
|
809
|
-
children: /*#__PURE__*/jsx(Error, {})
|
|
810
|
+
children: /*#__PURE__*/jsx(Error$1, {})
|
|
810
811
|
}), /*#__PURE__*/jsx(Column, {
|
|
811
812
|
children: error.code === 'file-too-large' ? maxSize == null ? 'Attachment size is too large' : "Attachment size should be less than ".concat(formatBytes(maxSize)) : error.message
|
|
812
813
|
})]
|
|
@@ -941,7 +942,7 @@ var FileListItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
941
942
|
space: "xsmall",
|
|
942
943
|
children: [/*#__PURE__*/jsx(Column, {
|
|
943
944
|
width: "content",
|
|
944
|
-
children: status === 'error' ? /*#__PURE__*/jsx(Error, {
|
|
945
|
+
children: status === 'error' ? /*#__PURE__*/jsx(Error$1, {
|
|
945
946
|
color: "error",
|
|
946
947
|
fontSize: "small"
|
|
947
948
|
}) : fileType === 'pdf' ? /*#__PURE__*/jsx(PdfIcon, {
|
|
@@ -1005,6 +1006,52 @@ var FileListItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
1005
1006
|
});
|
|
1006
1007
|
if (process.env.NODE_ENV !== "production") FileListItem.displayName = "FileListItem";
|
|
1007
1008
|
|
|
1009
|
+
var _excluded$6 = ["color", "target", "rel"],
|
|
1010
|
+
_excluded2$2 = ["children", "linkComponent"];
|
|
1011
|
+
var DefaultLinkComponent = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
1012
|
+
var {
|
|
1013
|
+
color,
|
|
1014
|
+
target = '_blank',
|
|
1015
|
+
rel = 'noreferrer noopener'
|
|
1016
|
+
} = _ref,
|
|
1017
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1018
|
+
|
|
1019
|
+
return /*#__PURE__*/jsx(Link, _objectSpread(_objectSpread({}, props), {}, {
|
|
1020
|
+
ref: ref,
|
|
1021
|
+
rel: rel,
|
|
1022
|
+
target: target
|
|
1023
|
+
}));
|
|
1024
|
+
});
|
|
1025
|
+
if (process.env.NODE_ENV !== "production") DefaultLinkComponent.displayName = "DefaultLinkComponent";
|
|
1026
|
+
DefaultLinkComponent.displayName = 'DefaultLinkComponent';
|
|
1027
|
+
function LinkedText(_ref2) {
|
|
1028
|
+
var {
|
|
1029
|
+
children,
|
|
1030
|
+
linkComponent = DefaultLinkComponent
|
|
1031
|
+
} = _ref2,
|
|
1032
|
+
props = _objectWithoutProperties(_ref2, _excluded2$2);
|
|
1033
|
+
|
|
1034
|
+
if (!children) {
|
|
1035
|
+
return null;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
return /*#__PURE__*/jsx(Anchorme, _objectSpread(_objectSpread({}, props), {}, {
|
|
1039
|
+
linkComponent: linkComponent,
|
|
1040
|
+
children: children
|
|
1041
|
+
}));
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
var MultilineText = /*#__PURE__*/styled.span.withConfig({
|
|
1045
|
+
displayName: "MultilineText",
|
|
1046
|
+
componentId: "SD__sc-34heyp-0"
|
|
1047
|
+
})(["white-space:pre-wrap;overflow-wrap:", ";"], _ref => {
|
|
1048
|
+
var {
|
|
1049
|
+
overflowWrap = 'normal'
|
|
1050
|
+
} = _ref;
|
|
1051
|
+
return overflowWrap;
|
|
1052
|
+
});
|
|
1053
|
+
MultilineText.displayName = 'MultilineText';
|
|
1054
|
+
|
|
1008
1055
|
var NavbarContext = /*#__PURE__*/createContext({
|
|
1009
1056
|
isDrawerOpen: false,
|
|
1010
1057
|
isExpanded: false,
|
|
@@ -1083,7 +1130,7 @@ var NavbarLabel = /*#__PURE__*/styled.span.withConfig({
|
|
|
1083
1130
|
var NavbarItemRoot = /*#__PURE__*/styled.div.withConfig({
|
|
1084
1131
|
displayName: "NavbarItem__NavbarItemRoot",
|
|
1085
1132
|
componentId: "SD__sc-1pvzq3w-2"
|
|
1086
|
-
})(["width:100%;display:flex;align-items:center;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;padding:8px 16px;border-left:4px solid transparent;&:hover,&[aria-current]{background-color:#2f394a;color:", ";border-left-color:", ";}"], Color.White, Color.Blue300);
|
|
1133
|
+
})(["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:", ";}"], Color.White, Color.Blue300, Color.Blue300);
|
|
1087
1134
|
var IconWrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
1088
1135
|
displayName: "NavbarItem__IconWrapper",
|
|
1089
1136
|
componentId: "SD__sc-1pvzq3w-3"
|
|
@@ -1097,13 +1144,15 @@ function NavbarItem(_ref) {
|
|
|
1097
1144
|
component,
|
|
1098
1145
|
onClick,
|
|
1099
1146
|
variant,
|
|
1100
|
-
ident = 0
|
|
1147
|
+
ident = 0,
|
|
1148
|
+
active
|
|
1101
1149
|
} = _ref;
|
|
1102
1150
|
var uid = useUID();
|
|
1103
1151
|
return /*#__PURE__*/jsxs(NavbarItemRoot, {
|
|
1104
1152
|
as: component,
|
|
1105
1153
|
onClick: onClick,
|
|
1106
1154
|
"aria-labelledby": uid,
|
|
1155
|
+
"data-active": active,
|
|
1107
1156
|
style: {
|
|
1108
1157
|
marginTop: gutter ? '16px' : '0',
|
|
1109
1158
|
paddingLeft: (ident + 1) * 20
|
|
@@ -1120,10 +1169,97 @@ function NavbarItem(_ref) {
|
|
|
1120
1169
|
});
|
|
1121
1170
|
}
|
|
1122
1171
|
|
|
1172
|
+
var NavbarAccordionLabel = /*#__PURE__*/styled.span.withConfig({
|
|
1173
|
+
displayName: "NavbarAccordion__NavbarAccordionLabel",
|
|
1174
|
+
componentId: "SD__sc-1s7g3kw-0"
|
|
1175
|
+
})(["flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;&[data-expanded='false']{display:none;}"]);
|
|
1176
|
+
var NavbarAccordionRoot = /*#__PURE__*/styled(Accordion).withConfig({
|
|
1177
|
+
displayName: "NavbarAccordion__NavbarAccordionRoot",
|
|
1178
|
+
componentId: "SD__sc-1s7g3kw-1"
|
|
1179
|
+
})(_ref => {
|
|
1180
|
+
var {
|
|
1181
|
+
gutter
|
|
1182
|
+
} = _ref;
|
|
1183
|
+
return 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', Color.White, gutter ? '16px' : '0');
|
|
1184
|
+
});
|
|
1185
|
+
var NavbarAccordionSummary = /*#__PURE__*/styled(AccordionSummary).withConfig({
|
|
1186
|
+
displayName: "NavbarAccordion__NavbarAccordionSummary",
|
|
1187
|
+
componentId: "SD__sc-1s7g3kw-2"
|
|
1188
|
+
})(["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;}}"], Color.Blue300);
|
|
1189
|
+
var IconWrapper$2 = /*#__PURE__*/styled.div.withConfig({
|
|
1190
|
+
displayName: "NavbarAccordion__IconWrapper",
|
|
1191
|
+
componentId: "SD__sc-1s7g3kw-3"
|
|
1192
|
+
})(["width:24px;margin-right:8px;& svg{font-size:24px;}"]);
|
|
1193
|
+
function NavbarAccordion(_ref2) {
|
|
1194
|
+
var {
|
|
1195
|
+
label,
|
|
1196
|
+
icon,
|
|
1197
|
+
gutter,
|
|
1198
|
+
items,
|
|
1199
|
+
onClick: _onClick
|
|
1200
|
+
} = _ref2;
|
|
1201
|
+
var uid = useUID();
|
|
1202
|
+
var {
|
|
1203
|
+
isExpanded: isMenuExpanded,
|
|
1204
|
+
isDrawerOpen,
|
|
1205
|
+
setDrawerOpen
|
|
1206
|
+
} = useNavbarContext();
|
|
1207
|
+
var [isExpanded, setExpanded] = useState(false);
|
|
1208
|
+
useEffect(() => {
|
|
1209
|
+
if (!isMenuExpanded) {
|
|
1210
|
+
setExpanded(false);
|
|
1211
|
+
}
|
|
1212
|
+
}, [isMenuExpanded]);
|
|
1213
|
+
return /*#__PURE__*/jsxs(NavbarAccordionRoot, {
|
|
1214
|
+
"aria-labelledby": uid,
|
|
1215
|
+
gutter: !!gutter,
|
|
1216
|
+
expanded: isExpanded,
|
|
1217
|
+
onClick: event => {
|
|
1218
|
+
if (isMenuExpanded || isDrawerOpen) {
|
|
1219
|
+
setExpanded(!isExpanded);
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
_onClick(event);
|
|
1223
|
+
},
|
|
1224
|
+
square: true,
|
|
1225
|
+
children: [/*#__PURE__*/jsxs(NavbarAccordionSummary, {
|
|
1226
|
+
"data-active": !isExpanded && items.some(item => item.active),
|
|
1227
|
+
"data-expanded": isMenuExpanded || isDrawerOpen,
|
|
1228
|
+
expandIcon: /*#__PURE__*/jsx(ExpandMore, {}),
|
|
1229
|
+
children: [/*#__PURE__*/jsx(IconWrapper$2, {
|
|
1230
|
+
children: icon
|
|
1231
|
+
}), /*#__PURE__*/jsx(NavbarAccordionLabel, {
|
|
1232
|
+
id: uid,
|
|
1233
|
+
"data-expanded": isMenuExpanded || isDrawerOpen,
|
|
1234
|
+
children: label
|
|
1235
|
+
})]
|
|
1236
|
+
}), items.map(item => {
|
|
1237
|
+
var index = items.indexOf(item);
|
|
1238
|
+
var prev = items[index - 1];
|
|
1239
|
+
return /*#__PURE__*/createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
|
|
1240
|
+
key: item.key,
|
|
1241
|
+
ident: 1,
|
|
1242
|
+
active: item.active,
|
|
1243
|
+
gutter: prev && prev.groupKey !== item.groupKey,
|
|
1244
|
+
onClick: event => {
|
|
1245
|
+
var _item$onClick;
|
|
1246
|
+
|
|
1247
|
+
event.stopPropagation();
|
|
1248
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
|
|
1249
|
+
|
|
1250
|
+
if (!event.isDefaultPrevented()) {
|
|
1251
|
+
setDrawerOpen(false);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}));
|
|
1255
|
+
})]
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1123
1259
|
var Header = /*#__PURE__*/styled.div.withConfig({
|
|
1124
1260
|
displayName: "NavbarList__Header",
|
|
1125
1261
|
componentId: "SD__sc-19zrmxc-0"
|
|
1126
|
-
})(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;"]);
|
|
1262
|
+
})(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;position:sticky;"]);
|
|
1127
1263
|
var Wrapper = /*#__PURE__*/styled.div.withConfig({
|
|
1128
1264
|
displayName: "NavbarList__Wrapper",
|
|
1129
1265
|
componentId: "SD__sc-19zrmxc-1"
|
|
@@ -1150,7 +1286,7 @@ var ExpandIconButton = /*#__PURE__*/styled(IconButton).withConfig({
|
|
|
1150
1286
|
var Footer = /*#__PURE__*/styled.div.withConfig({
|
|
1151
1287
|
displayName: "NavbarList__Footer",
|
|
1152
1288
|
componentId: "SD__sc-19zrmxc-3"
|
|
1153
|
-
})(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;"]);
|
|
1289
|
+
})(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;position:sticky;"]);
|
|
1154
1290
|
var Root = /*#__PURE__*/styled.div.withConfig({
|
|
1155
1291
|
displayName: "NavbarList__Root",
|
|
1156
1292
|
componentId: "SD__sc-19zrmxc-4"
|
|
@@ -1177,7 +1313,7 @@ function NavbarMenuItem(_ref4) {
|
|
|
1177
1313
|
var Content = /*#__PURE__*/styled.div.withConfig({
|
|
1178
1314
|
displayName: "NavbarList__Content",
|
|
1179
1315
|
componentId: "SD__sc-19zrmxc-5"
|
|
1180
|
-
})(["height:100%;min-height:50px;&[aria-expanded='false']{", ",", "{
|
|
1316
|
+
})(["height:100%;min-height:50px;overflow-y:auto;overflow-x:hidden;&[aria-expanded='false']{", ",", "{display:none;}}"], NavbarBadge, NavbarLabel);
|
|
1181
1317
|
function NavbarList(_ref5) {
|
|
1182
1318
|
var {
|
|
1183
1319
|
header,
|
|
@@ -1214,41 +1350,31 @@ function NavbarList(_ref5) {
|
|
|
1214
1350
|
})]
|
|
1215
1351
|
}), /*#__PURE__*/jsx(Content, {
|
|
1216
1352
|
"aria-expanded": isSidebarOpened,
|
|
1217
|
-
children:
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
onClick: event => {
|
|
1227
|
-
var _item$onClick;
|
|
1228
|
-
|
|
1229
|
-
(_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
|
|
1230
|
-
|
|
1231
|
-
if (!event.isDefaultPrevented()) {
|
|
1232
|
-
setDrawerOpen(false);
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1353
|
+
children: filteredItems.map(item => {
|
|
1354
|
+
var index = filteredItems.indexOf(item);
|
|
1355
|
+
var prev = filteredItems[index - 1];
|
|
1356
|
+
|
|
1357
|
+
if ('items' in item) {
|
|
1358
|
+
return /*#__PURE__*/createElement(NavbarAccordion, _objectSpread(_objectSpread({}, item), {}, {
|
|
1359
|
+
key: item.key,
|
|
1360
|
+
gutter: prev && prev.groupKey !== item.groupKey,
|
|
1361
|
+
onClick: item.onClick
|
|
1235
1362
|
}));
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
return /*#__PURE__*/createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
|
|
1366
|
+
key: item.key,
|
|
1367
|
+
gutter: prev && prev.groupKey !== item.groupKey,
|
|
1238
1368
|
onClick: event => {
|
|
1239
|
-
var _item$
|
|
1369
|
+
var _item$onClick;
|
|
1240
1370
|
|
|
1241
|
-
(_item$
|
|
1371
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
|
|
1242
1372
|
|
|
1243
1373
|
if (!event.isDefaultPrevented()) {
|
|
1244
1374
|
setDrawerOpen(false);
|
|
1245
1375
|
}
|
|
1246
1376
|
}
|
|
1247
|
-
}))
|
|
1248
|
-
moreElement: /*#__PURE__*/jsx(NavbarItem, {
|
|
1249
|
-
icon: /*#__PURE__*/jsx(MoreHoriz, {}),
|
|
1250
|
-
label: "More"
|
|
1251
|
-
})
|
|
1377
|
+
}));
|
|
1252
1378
|
})
|
|
1253
1379
|
}), /*#__PURE__*/jsx(Footer, {
|
|
1254
1380
|
children: footer
|
|
@@ -1263,7 +1389,7 @@ var Aside = /*#__PURE__*/styled.aside.withConfig({
|
|
|
1263
1389
|
var Main = /*#__PURE__*/styled.main.withConfig({
|
|
1264
1390
|
displayName: "Navbar__Main",
|
|
1265
1391
|
componentId: "SD__sc-1oiqig8-1"
|
|
1266
|
-
})(["flex:1;display:flex;flex-direction:column;overflow:
|
|
1392
|
+
})(["flex:1;display:flex;flex-direction:column;overflow:scroll;"]);
|
|
1267
1393
|
function Navbar(_ref) {
|
|
1268
1394
|
var {
|
|
1269
1395
|
footer,
|
|
@@ -1330,7 +1456,7 @@ function Navbar(_ref) {
|
|
|
1330
1456
|
});
|
|
1331
1457
|
}
|
|
1332
1458
|
|
|
1333
|
-
var _excluded$
|
|
1459
|
+
var _excluded$7 = ["title", "subtitle", "children"];
|
|
1334
1460
|
var StyledTypography = /*#__PURE__*/styled(Typography).withConfig({
|
|
1335
1461
|
displayName: "NavbarAvatar__StyledTypography",
|
|
1336
1462
|
componentId: "SD__sc-19q2zd0-0"
|
|
@@ -1341,7 +1467,7 @@ function NavbarAvatar(_ref) {
|
|
|
1341
1467
|
subtitle,
|
|
1342
1468
|
children
|
|
1343
1469
|
} = _ref,
|
|
1344
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1470
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1345
1471
|
|
|
1346
1472
|
var {
|
|
1347
1473
|
isExpanded,
|
|
@@ -1361,8 +1487,10 @@ function NavbarAvatar(_ref) {
|
|
|
1361
1487
|
children: /*#__PURE__*/jsxs(Stack, {
|
|
1362
1488
|
space: "none",
|
|
1363
1489
|
children: [/*#__PURE__*/jsx(StyledTypography, {
|
|
1490
|
+
variant: "caption",
|
|
1364
1491
|
children: title
|
|
1365
1492
|
}), /*#__PURE__*/jsx(StyledTypography, {
|
|
1493
|
+
variant: "caption",
|
|
1366
1494
|
children: subtitle
|
|
1367
1495
|
})]
|
|
1368
1496
|
})
|
|
@@ -1451,7 +1579,7 @@ function NavbarMenu(_ref2) {
|
|
|
1451
1579
|
var SidebarRoot = /*#__PURE__*/styled.aside.withConfig({
|
|
1452
1580
|
displayName: "Sidebar__SidebarRoot",
|
|
1453
1581
|
componentId: "SD__sc-b77o22-0"
|
|
1454
|
-
})(["top:0;position:sticky;overflow-y:auto;overflow-x:hidden;
|
|
1582
|
+
})(["top:0;position:sticky;overflow-y:auto;overflow-x:hidden;height:100vh;background-color:", ";border-right:1px solid ", ";"], Color.White, Color.Silver400);
|
|
1455
1583
|
var SidebarHeader = /*#__PURE__*/styled.div.withConfig({
|
|
1456
1584
|
displayName: "Sidebar__SidebarHeader",
|
|
1457
1585
|
componentId: "SD__sc-b77o22-1"
|
|
@@ -1503,28 +1631,172 @@ var Sidebar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
1503
1631
|
});
|
|
1504
1632
|
if (process.env.NODE_ENV !== "production") Sidebar.displayName = "Sidebar";
|
|
1505
1633
|
|
|
1506
|
-
var
|
|
1507
|
-
|
|
1634
|
+
var Context = /*#__PURE__*/createContext(null);
|
|
1635
|
+
function useSidebarContext() {
|
|
1636
|
+
var context = useContext(Context);
|
|
1637
|
+
|
|
1638
|
+
if (!context) {
|
|
1639
|
+
throw new Error('SidebarContext is used outside Provider');
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
return context;
|
|
1643
|
+
}
|
|
1644
|
+
var SidebarContainerSidebar = /*#__PURE__*/styled.div.withConfig({
|
|
1645
|
+
displayName: "SidebarContainer__SidebarContainerSidebar",
|
|
1508
1646
|
componentId: "SD__sc-uibj1m-0"
|
|
1509
|
-
})(["
|
|
1647
|
+
})(["height:inherit;max-height:inherit;min-height:inherit;width:240px;"]);
|
|
1510
1648
|
var SidebarContainerContent = /*#__PURE__*/styled.div.withConfig({
|
|
1511
1649
|
displayName: "SidebarContainer__SidebarContainerContent",
|
|
1512
1650
|
componentId: "SD__sc-uibj1m-1"
|
|
1513
|
-
})(["height:inherit;max-height:inherit;min-height:inherit;
|
|
1651
|
+
})(["height:inherit;max-height:inherit;min-height:inherit;"]);
|
|
1652
|
+
var SidebarContainerRoot = /*#__PURE__*/styled.div.withConfig({
|
|
1653
|
+
displayName: "SidebarContainer__SidebarContainerRoot",
|
|
1654
|
+
componentId: "SD__sc-uibj1m-2"
|
|
1655
|
+
})(["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);
|
|
1514
1656
|
var SidebarContainer = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
1515
1657
|
var {
|
|
1516
1658
|
sidebar,
|
|
1517
1659
|
children
|
|
1518
1660
|
} = _ref;
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1661
|
+
var isCollapsed = useCollapseBreakpoint('sm');
|
|
1662
|
+
var [visibilityState, setVisibilityState] = useState('sidebar');
|
|
1663
|
+
var visibility = isCollapsed ? visibilityState : 'both';
|
|
1664
|
+
var context = useMemo(() => {
|
|
1665
|
+
return {
|
|
1666
|
+
openSidebar: () => {
|
|
1667
|
+
setVisibilityState('sidebar');
|
|
1668
|
+
},
|
|
1669
|
+
openSidebarContent: () => {
|
|
1670
|
+
setVisibilityState('content');
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
}, []);
|
|
1674
|
+
return /*#__PURE__*/jsx(Context.Provider, {
|
|
1675
|
+
value: context,
|
|
1676
|
+
children: /*#__PURE__*/jsxs(SidebarContainerRoot, {
|
|
1677
|
+
ref: ref,
|
|
1678
|
+
"data-visibility": visibility,
|
|
1679
|
+
children: [/*#__PURE__*/jsx(SidebarContainerSidebar, {
|
|
1680
|
+
children: sidebar
|
|
1681
|
+
}), /*#__PURE__*/jsx(SidebarContainerContent, {
|
|
1682
|
+
children: children
|
|
1683
|
+
})]
|
|
1684
|
+
})
|
|
1524
1685
|
});
|
|
1525
1686
|
});
|
|
1526
1687
|
if (process.env.NODE_ENV !== "production") SidebarContainer.displayName = "SidebarContainer";
|
|
1527
1688
|
|
|
1689
|
+
var _excluded$8 = ["onClick", "children"];
|
|
1690
|
+
function SidebarBackButton(_ref) {
|
|
1691
|
+
var {
|
|
1692
|
+
onClick: _onClick,
|
|
1693
|
+
children = /*#__PURE__*/jsx(ArrowBack, {
|
|
1694
|
+
fontSize: "small"
|
|
1695
|
+
})
|
|
1696
|
+
} = _ref,
|
|
1697
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
1698
|
+
|
|
1699
|
+
var isCollapsed = useCollapseBreakpoint('sm');
|
|
1700
|
+
var {
|
|
1701
|
+
openSidebar
|
|
1702
|
+
} = useSidebarContext();
|
|
1703
|
+
|
|
1704
|
+
if (!isCollapsed) {
|
|
1705
|
+
return null;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
return /*#__PURE__*/jsx(IconButton, _objectSpread(_objectSpread({}, props), {}, {
|
|
1709
|
+
size: "small",
|
|
1710
|
+
onClick: event => {
|
|
1711
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
|
|
1712
|
+
|
|
1713
|
+
if (!event.isDefaultPrevented()) {
|
|
1714
|
+
openSidebar();
|
|
1715
|
+
}
|
|
1716
|
+
},
|
|
1717
|
+
children: children
|
|
1718
|
+
}));
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
var SidebarAppBar = /*#__PURE__*/styled(AppBar).withConfig({
|
|
1722
|
+
displayName: "SidebarContent__SidebarAppBar",
|
|
1723
|
+
componentId: "SD__sc-zpgf61-0"
|
|
1724
|
+
})(_ref => {
|
|
1725
|
+
var {
|
|
1726
|
+
theme
|
|
1727
|
+
} = _ref;
|
|
1728
|
+
return css(["", "{&&{border-left:transparent;}}"], theme.breakpoints.up('sm'));
|
|
1729
|
+
});
|
|
1730
|
+
function SidebarContent(_ref2) {
|
|
1731
|
+
var {
|
|
1732
|
+
dense,
|
|
1733
|
+
action,
|
|
1734
|
+
title,
|
|
1735
|
+
children,
|
|
1736
|
+
onBack,
|
|
1737
|
+
openOnMount,
|
|
1738
|
+
closeOnUnmount
|
|
1739
|
+
} = _ref2;
|
|
1740
|
+
var isOpenedOnMount = useRef(false);
|
|
1741
|
+
var isClosedOnMount = useRef(false);
|
|
1742
|
+
var {
|
|
1743
|
+
openSidebarContent,
|
|
1744
|
+
openSidebar
|
|
1745
|
+
} = useSidebarContext();
|
|
1746
|
+
useLayoutEffect(() => {
|
|
1747
|
+
if (openOnMount) {
|
|
1748
|
+
if (isOpenedOnMount.current) {
|
|
1749
|
+
// eslint-disable-next-line no-console
|
|
1750
|
+
console.warn('[SidebarContent]: "openOnMount" should not change during lifecycle of the component.');
|
|
1751
|
+
} else {
|
|
1752
|
+
isOpenedOnMount.current = true;
|
|
1753
|
+
openSidebarContent();
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}, [openOnMount, openSidebarContent]);
|
|
1757
|
+
useLayoutEffect(() => {
|
|
1758
|
+
return () => {
|
|
1759
|
+
if (closeOnUnmount) {
|
|
1760
|
+
if (isClosedOnMount.current) {
|
|
1761
|
+
// eslint-disable-next-line no-console
|
|
1762
|
+
console.warn('[SidebarContent]: "closeOnUnmount" should not change during lifecycle of the component.');
|
|
1763
|
+
} else {
|
|
1764
|
+
isClosedOnMount.current = true;
|
|
1765
|
+
openSidebar();
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
};
|
|
1769
|
+
}, [openSidebar, closeOnUnmount]);
|
|
1770
|
+
return /*#__PURE__*/jsxs(Stack, {
|
|
1771
|
+
space: "none",
|
|
1772
|
+
children: [/*#__PURE__*/jsx(SidebarAppBar, {
|
|
1773
|
+
children: /*#__PURE__*/jsx(Toolbar, {
|
|
1774
|
+
children: /*#__PURE__*/jsxs(Columns, {
|
|
1775
|
+
align: "center",
|
|
1776
|
+
space: "small",
|
|
1777
|
+
children: [/*#__PURE__*/jsx(Column, {
|
|
1778
|
+
width: "content",
|
|
1779
|
+
children: /*#__PURE__*/jsx(SidebarBackButton, {
|
|
1780
|
+
onClick: onBack
|
|
1781
|
+
})
|
|
1782
|
+
}), /*#__PURE__*/jsx(Column, {
|
|
1783
|
+
children: /*#__PURE__*/jsx(TextBox, {
|
|
1784
|
+
variant: "heading-2",
|
|
1785
|
+
children: title
|
|
1786
|
+
})
|
|
1787
|
+
}), /*#__PURE__*/jsx(Column, {
|
|
1788
|
+
width: "content",
|
|
1789
|
+
children: action
|
|
1790
|
+
})]
|
|
1791
|
+
})
|
|
1792
|
+
})
|
|
1793
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
1794
|
+
padding: dense ? 'none' : 'medium',
|
|
1795
|
+
children: children
|
|
1796
|
+
})]
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1528
1800
|
var SidebarDividerRoot = /*#__PURE__*/styled.div.withConfig({
|
|
1529
1801
|
displayName: "SidebarDivider__SidebarDividerRoot",
|
|
1530
1802
|
componentId: "SD__sc-5lwi2i-0"
|
|
@@ -1579,17 +1851,21 @@ var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
1579
1851
|
var {
|
|
1580
1852
|
action,
|
|
1581
1853
|
avatar,
|
|
1582
|
-
onClick,
|
|
1854
|
+
onClick: _onClick,
|
|
1583
1855
|
external,
|
|
1584
1856
|
children,
|
|
1585
1857
|
disabled,
|
|
1586
1858
|
selected,
|
|
1587
1859
|
secondaryActions,
|
|
1588
|
-
badge: badgeProp
|
|
1860
|
+
badge: badgeProp,
|
|
1861
|
+
openContentOnClick
|
|
1589
1862
|
} = _ref2;
|
|
1590
1863
|
var [hovered, setHovered] = useState(false);
|
|
1591
1864
|
var actionsRef = useRef(null);
|
|
1592
1865
|
var actionsPlaceholderRef = useRef(null);
|
|
1866
|
+
var {
|
|
1867
|
+
openSidebarContent
|
|
1868
|
+
} = useSidebarContext();
|
|
1593
1869
|
useLayoutEffect(() => {
|
|
1594
1870
|
if (actionsRef.current && actionsPlaceholderRef.current) {
|
|
1595
1871
|
actionsPlaceholderRef.current.style.width = "".concat(Math.max(0, actionsRef.current.offsetWidth - 8), "px");
|
|
@@ -1606,9 +1882,15 @@ var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
1606
1882
|
setHovered(false);
|
|
1607
1883
|
},
|
|
1608
1884
|
children: [/*#__PURE__*/jsx(ButtonBase, {
|
|
1609
|
-
onClick: onClick,
|
|
1610
1885
|
disabled: disabled,
|
|
1611
1886
|
"aria-current": selected,
|
|
1887
|
+
onClick: event => {
|
|
1888
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
|
|
1889
|
+
|
|
1890
|
+
if (!event.isDefaultPrevented() && openContentOnClick) {
|
|
1891
|
+
openSidebarContent();
|
|
1892
|
+
}
|
|
1893
|
+
},
|
|
1612
1894
|
children: /*#__PURE__*/jsxs(Columns, {
|
|
1613
1895
|
align: "center",
|
|
1614
1896
|
space: "xsmall",
|
|
@@ -1721,6 +2003,7 @@ var SidebarMenuItemAvatar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
1721
2003
|
color: "primary",
|
|
1722
2004
|
checked: value,
|
|
1723
2005
|
disabled: disabled,
|
|
2006
|
+
onClick: stopPropagation,
|
|
1724
2007
|
onMouseDown: stopPropagation,
|
|
1725
2008
|
onTouchStart: stopPropagation,
|
|
1726
2009
|
onChange: (_, checked) => {
|
|
@@ -1770,5 +2053,5 @@ var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
1770
2053
|
});
|
|
1771
2054
|
if (process.env.NODE_ENV !== "production") SidebarSubheader.displayName = "SidebarSubheader";
|
|
1772
2055
|
|
|
1773
|
-
export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, Container, DescriptionItem, FileDropZone, FileListItem, Navbar, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarItem, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, Sidebar, SidebarContainer, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes, useNavbarContext };
|
|
2056
|
+
export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, Container, DescriptionItem, FileDropZone, FileListItem, LinkedText, MultilineText, Navbar, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarItem, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, Sidebar, SidebarBackButton, SidebarContainer, SidebarContent, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes, useNavbarContext, useSidebarContext };
|
|
1774
2057
|
//# sourceMappingURL=index.js.map
|