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