@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-types/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ReactNode, ForwardRefExoticComponent, RefAttributes, Ref, AriaAttributes, MouseEventHandler, FocusEventHandler,
|
|
2
|
+
import { ReactNode, ForwardRefExoticComponent, RefAttributes, Ref, AriaAttributes, MouseEventHandler, FocusEventHandler, HTMLAttributes, ComponentType, ReactElement, MouseEvent, Key, CSSProperties, ReactChild } from 'react';
|
|
3
3
|
import { CSSTransition } from 'react-transition-group';
|
|
4
4
|
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
5
5
|
import { SpaceProp, NegativeSpaceProp, ResponsiveProp, ColorProp } from '@superdispatch/ui';
|
|
6
6
|
import { Property } from 'csstype';
|
|
7
|
-
import { ButtonBaseProps, TooltipProps } from '@material-ui/core';
|
|
7
|
+
import { ButtonBaseProps, AvatarProps, TooltipProps } from '@material-ui/core';
|
|
8
8
|
import { FileRejection } from 'react-dropzone';
|
|
9
|
+
import { StyledComponent, DefaultTheme } from 'styled-components';
|
|
9
10
|
|
|
10
11
|
declare type AlertSeverityProp = 'positive' | 'info' | 'caution' | 'critical';
|
|
11
12
|
interface AlertProps {
|
|
@@ -117,6 +118,13 @@ interface AnchorButtonProps extends BaseButtonProps<HTMLAnchorElement> {
|
|
|
117
118
|
}
|
|
118
119
|
declare const AnchorButton: ForwardRefExoticComponent<AnchorButtonProps & RefAttributes<HTMLAnchorElement>>;
|
|
119
120
|
|
|
121
|
+
declare type ContainerProps = HTMLAttributes<HTMLDivElement> & {
|
|
122
|
+
fullViewportHeight?: boolean;
|
|
123
|
+
};
|
|
124
|
+
declare const Container: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
125
|
+
fullViewportHeight?: boolean | undefined;
|
|
126
|
+
} & RefAttributes<HTMLDivElement>>;
|
|
127
|
+
|
|
120
128
|
interface DescriptionItemProps {
|
|
121
129
|
id?: string;
|
|
122
130
|
'aria-label'?: string;
|
|
@@ -155,6 +163,94 @@ interface FileListItemProps {
|
|
|
155
163
|
}
|
|
156
164
|
declare const FileListItem: ForwardRefExoticComponent<FileListItemProps & RefAttributes<HTMLDivElement>>;
|
|
157
165
|
|
|
166
|
+
interface NavbarBottomBarItem {
|
|
167
|
+
active?: boolean;
|
|
168
|
+
value: string;
|
|
169
|
+
hasBadge?: boolean;
|
|
170
|
+
label: ReactNode;
|
|
171
|
+
icon: ReactNode;
|
|
172
|
+
onClick?: () => void;
|
|
173
|
+
component?: ComponentType<HTMLAttributes<HTMLElement>>;
|
|
174
|
+
}
|
|
175
|
+
interface NavbarBottomBarProps {
|
|
176
|
+
items: NavbarBottomBarItem[];
|
|
177
|
+
hasMenuBadge?: boolean;
|
|
178
|
+
}
|
|
179
|
+
declare function NavbarBottomBar({ items, hasMenuBadge, }: NavbarBottomBarProps): ReactElement;
|
|
180
|
+
|
|
181
|
+
declare const NavbarBadge: StyledComponent<"span", DefaultTheme, {}, never>;
|
|
182
|
+
declare const NavbarLabel: StyledComponent<"span", DefaultTheme, {}, never>;
|
|
183
|
+
interface NavbarItemProps {
|
|
184
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
185
|
+
component?: ComponentType<HTMLAttributes<HTMLElement>>;
|
|
186
|
+
label: ReactNode;
|
|
187
|
+
icon?: ReactNode;
|
|
188
|
+
badge?: ReactNode;
|
|
189
|
+
ident?: number;
|
|
190
|
+
gutter?: boolean;
|
|
191
|
+
variant?: 'danger' | 'primary';
|
|
192
|
+
}
|
|
193
|
+
declare function NavbarItem({ label, gutter, badge, icon, component, onClick, variant, ident, }: NavbarItemProps): ReactElement;
|
|
194
|
+
|
|
195
|
+
interface NavbarMenuItemProps {
|
|
196
|
+
icon?: ReactNode;
|
|
197
|
+
label: ReactNode;
|
|
198
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
199
|
+
component?: ComponentType<HTMLAttributes<HTMLElement>>;
|
|
200
|
+
}
|
|
201
|
+
declare function NavbarMenuItem({ label, icon, onClick, component, }: NavbarMenuItemProps): ReactElement;
|
|
202
|
+
interface NavbarItemOptions extends NavbarItemProps {
|
|
203
|
+
key: Key;
|
|
204
|
+
groupKey?: Key;
|
|
205
|
+
hide?: boolean;
|
|
206
|
+
}
|
|
207
|
+
interface NavbarListProps {
|
|
208
|
+
header: ReactNode;
|
|
209
|
+
items: NavbarItemOptions[];
|
|
210
|
+
footer?: ReactNode;
|
|
211
|
+
}
|
|
212
|
+
declare function NavbarList({ header, items, footer, }: NavbarListProps): ReactElement;
|
|
213
|
+
|
|
214
|
+
interface NavbarProps {
|
|
215
|
+
containerStyle?: CSSProperties;
|
|
216
|
+
children: ReactNode;
|
|
217
|
+
header?: ReactNode;
|
|
218
|
+
items: NavbarItemOptions[];
|
|
219
|
+
bottomItems: NavbarBottomBarItem[];
|
|
220
|
+
footer?: ReactNode;
|
|
221
|
+
hasExtraBadge?: boolean;
|
|
222
|
+
}
|
|
223
|
+
declare function Navbar({ footer, items, header, bottomItems, children, containerStyle, hasExtraBadge, }: NavbarProps): ReactElement;
|
|
224
|
+
|
|
225
|
+
interface NavbarAvatarProps extends Omit<AvatarProps, 'title'> {
|
|
226
|
+
title: ReactNode;
|
|
227
|
+
subtitle: ReactNode;
|
|
228
|
+
children: ReactNode;
|
|
229
|
+
}
|
|
230
|
+
declare function NavbarAvatar({ title, subtitle, children, ...props }: NavbarAvatarProps): ReactElement;
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
interface NavbarContextType {
|
|
234
|
+
isDrawerOpen: boolean;
|
|
235
|
+
isExpanded: boolean;
|
|
236
|
+
setIsExpanded: (value: boolean) => void;
|
|
237
|
+
setDrawerOpen: (value: boolean) => void;
|
|
238
|
+
}
|
|
239
|
+
declare function useNavbarContext(): NavbarContextType;
|
|
240
|
+
|
|
241
|
+
interface NavbarMenuItemOption {
|
|
242
|
+
key: Key;
|
|
243
|
+
icon: ReactNode;
|
|
244
|
+
label: ReactNode;
|
|
245
|
+
visible?: boolean;
|
|
246
|
+
onClick: () => void;
|
|
247
|
+
}
|
|
248
|
+
interface NavbarMenuProps {
|
|
249
|
+
children: ReactNode;
|
|
250
|
+
items: NavbarMenuItemOption[];
|
|
251
|
+
}
|
|
252
|
+
declare function NavbarMenu({ items, children }: NavbarMenuProps): ReactElement;
|
|
253
|
+
|
|
158
254
|
interface SidebarProps {
|
|
159
255
|
id?: string;
|
|
160
256
|
title?: ReactNode;
|
|
@@ -226,4 +322,4 @@ interface TextBoxProps {
|
|
|
226
322
|
}
|
|
227
323
|
declare const TextBox: ForwardRefExoticComponent<TextBoxProps & RefAttributes<HTMLElement>>;
|
|
228
324
|
|
|
229
|
-
export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, MarginProp, Sidebar, SidebarContainer, SidebarContainerProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes };
|
|
325
|
+
export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, Container, ContainerProps, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, MarginProp, Navbar, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarBottomBarItem, NavbarItem, NavbarItemOptions, NavbarItemProps, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, NavbarMenuItemOption, Sidebar, SidebarContainer, SidebarContainerProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes, useNavbarContext };
|
package/dist-web/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { CheckCircle, Info, Error, Image, Refresh, Delete, OpenInNew } from '@material-ui/icons';
|
|
1
|
+
import { CheckCircle, Info, Error, Image, Refresh, Delete, Menu, MenuOpen, OpenInNew } from '@material-ui/icons';
|
|
2
2
|
import { Alert as Alert$1 } from '@material-ui/lab';
|
|
3
|
-
import { Color, parseResponsiveProp, isColorProp, parseSpaceProp, Stack, useUID, isEmptyReactNode, Columns, Column, Inline, CardButton, useResponsiveValue } from '@superdispatch/ui';
|
|
4
|
-
import { forwardRef, useState, useEffect, Suspense, memo, useContext, createContext, useMemo,
|
|
3
|
+
import { Color, parseResponsiveProp, isColorProp, parseSpaceProp, Stack, mergeRefs, useUID, isEmptyReactNode, Columns, Column, Inline, CardButton, useResponsiveValue } from '@superdispatch/ui';
|
|
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,
|
|
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';
|
|
11
11
|
import { mdiUpload, mdiFilePdfBox, mdiTextBox } from '@mdi/js';
|
|
12
12
|
import Dropzone from 'react-dropzone';
|
|
13
|
+
import { noop } from 'lodash';
|
|
13
14
|
|
|
14
15
|
function colorMixin(textColor, backgroundColor, buttonHoverColor) {
|
|
15
16
|
return css(["color:", ";background-color:", ";& .MuiAlert-icon{color:", ";}& .MuiAlert-action{& .MuiIconButton-root{&:hover,&:active{color:", ";}}}"], textColor, backgroundColor, textColor, buttonHoverColor);
|
|
@@ -521,6 +522,45 @@ var AnchorButton = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
521
522
|
});
|
|
522
523
|
if (process.env.NODE_ENV !== "production") AnchorButton.displayName = "AnchorButton";
|
|
523
524
|
|
|
525
|
+
var _excluded$3 = ["fullViewportHeight"];
|
|
526
|
+
var Container = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
527
|
+
var {
|
|
528
|
+
fullViewportHeight
|
|
529
|
+
} = _ref,
|
|
530
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
531
|
+
|
|
532
|
+
var nodeRef = useRef(null);
|
|
533
|
+
useLayoutEffect(() => {
|
|
534
|
+
if (!fullViewportHeight) {
|
|
535
|
+
if (nodeRef.current) {
|
|
536
|
+
nodeRef.current.style.removeProperty('height');
|
|
537
|
+
nodeRef.current.style.removeProperty('--vh');
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function updateHeight() {
|
|
544
|
+
if (nodeRef.current) {
|
|
545
|
+
// https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
546
|
+
nodeRef.current.style.setProperty('height', 'calc(var(--vh, 1vh) * 100)');
|
|
547
|
+
nodeRef.current.style.setProperty('--vh', "".concat(window.innerHeight * 0.01, "px"));
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
updateHeight();
|
|
552
|
+
window.addEventListener('resize', updateHeight);
|
|
553
|
+
return () => {
|
|
554
|
+
window.removeEventListener('resize', updateHeight);
|
|
555
|
+
};
|
|
556
|
+
}, [fullViewportHeight]);
|
|
557
|
+
return /*#__PURE__*/jsx("div", _objectSpread({
|
|
558
|
+
ref: mergeRefs(ref, nodeRef)
|
|
559
|
+
}, props));
|
|
560
|
+
});
|
|
561
|
+
if (process.env.NODE_ENV !== "production") Container.displayName = "Container";
|
|
562
|
+
Container.displayName = 'Container';
|
|
563
|
+
|
|
524
564
|
function mergeStyles(styles) {
|
|
525
565
|
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
526
566
|
sources[_key - 1] = arguments[_key];
|
|
@@ -546,7 +586,7 @@ function mergeStyles(styles) {
|
|
|
546
586
|
return styles;
|
|
547
587
|
}
|
|
548
588
|
|
|
549
|
-
var _excluded$
|
|
589
|
+
var _excluded$4 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
|
|
550
590
|
var normalizeTextColor = /*#__PURE__*/createRuleNormalizer({
|
|
551
591
|
inherit: 'inherit',
|
|
552
592
|
primary: Color.Dark500,
|
|
@@ -648,7 +688,7 @@ var TextBox = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
648
688
|
noWrap = false,
|
|
649
689
|
wrapOverflow = false
|
|
650
690
|
} = _ref3,
|
|
651
|
-
props = _objectWithoutProperties(_ref3, _excluded$
|
|
691
|
+
props = _objectWithoutProperties(_ref3, _excluded$4);
|
|
652
692
|
|
|
653
693
|
var $align = parseResponsiveProp(align);
|
|
654
694
|
var $color = parseResponsiveProp(color);
|
|
@@ -729,7 +769,7 @@ var DescriptionItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
729
769
|
});
|
|
730
770
|
if (process.env.NODE_ENV !== "production") DescriptionItem.displayName = "DescriptionItem";
|
|
731
771
|
|
|
732
|
-
var _excluded$
|
|
772
|
+
var _excluded$5 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
|
|
733
773
|
function toBytes(input, unit) {
|
|
734
774
|
if (unit === 'gb') return input * (1 << 30);
|
|
735
775
|
if (unit === 'mb') return input * (1 << 20);
|
|
@@ -800,7 +840,7 @@ var FileDropZone = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
800
840
|
onDropRejected: _onDropRejected,
|
|
801
841
|
onDropAccepted: _onDropAccepted
|
|
802
842
|
} = props,
|
|
803
|
-
dropzoneProps = _objectWithoutProperties(props, _excluded$
|
|
843
|
+
dropzoneProps = _objectWithoutProperties(props, _excluded$5);
|
|
804
844
|
|
|
805
845
|
return /*#__PURE__*/jsx(Suspense, {
|
|
806
846
|
fallback: fallback,
|
|
@@ -965,6 +1005,432 @@ var FileListItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
965
1005
|
});
|
|
966
1006
|
if (process.env.NODE_ENV !== "production") FileListItem.displayName = "FileListItem";
|
|
967
1007
|
|
|
1008
|
+
var NavbarContext = /*#__PURE__*/createContext({
|
|
1009
|
+
isDrawerOpen: false,
|
|
1010
|
+
isExpanded: false,
|
|
1011
|
+
setIsExpanded: noop,
|
|
1012
|
+
setDrawerOpen: noop
|
|
1013
|
+
});
|
|
1014
|
+
function useNavbarContext() {
|
|
1015
|
+
return useContext(NavbarContext);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
var StyledBottomNavigation = /*#__PURE__*/styled(BottomNavigation).withConfig({
|
|
1019
|
+
displayName: "NavbarBottomBar__StyledBottomNavigation",
|
|
1020
|
+
componentId: "SD__sc-9z6v3k-0"
|
|
1021
|
+
})(["background:", ";"], Color.Dark500);
|
|
1022
|
+
var StyledBottomNavigationAction = /*#__PURE__*/styled(BottomNavigationAction).withConfig({
|
|
1023
|
+
displayName: "NavbarBottomBar__StyledBottomNavigationAction",
|
|
1024
|
+
componentId: "SD__sc-9z6v3k-1"
|
|
1025
|
+
})(["&&{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;}}"], Color.Silver500, Color.White);
|
|
1026
|
+
var IconWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
1027
|
+
displayName: "NavbarBottomBar__IconWrapper",
|
|
1028
|
+
componentId: "SD__sc-9z6v3k-2"
|
|
1029
|
+
})(["position:relative;"]);
|
|
1030
|
+
var IconLabel = /*#__PURE__*/styled.div.withConfig({
|
|
1031
|
+
displayName: "NavbarBottomBar__IconLabel",
|
|
1032
|
+
componentId: "SD__sc-9z6v3k-3"
|
|
1033
|
+
})(["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;"], Color.White, Color.Red300);
|
|
1034
|
+
function NavbarBottomBar(_ref) {
|
|
1035
|
+
var {
|
|
1036
|
+
items,
|
|
1037
|
+
hasMenuBadge
|
|
1038
|
+
} = _ref;
|
|
1039
|
+
var {
|
|
1040
|
+
isDrawerOpen,
|
|
1041
|
+
setDrawerOpen
|
|
1042
|
+
} = useNavbarContext();
|
|
1043
|
+
var activeItem = useMemo(() => items.find(item => item.active), [items]);
|
|
1044
|
+
return /*#__PURE__*/jsxs(StyledBottomNavigation, {
|
|
1045
|
+
value: activeItem === null || activeItem === void 0 ? void 0 : activeItem.value,
|
|
1046
|
+
showLabels: true,
|
|
1047
|
+
onChange: (_event, newValue) => {
|
|
1048
|
+
if (newValue) {
|
|
1049
|
+
if (newValue === 'menu') {
|
|
1050
|
+
setDrawerOpen(!isDrawerOpen);
|
|
1051
|
+
} else {
|
|
1052
|
+
setDrawerOpen(false);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
},
|
|
1056
|
+
children: [items.map(item => /*#__PURE__*/createElement(StyledBottomNavigationAction, _objectSpread(_objectSpread({}, item), {}, {
|
|
1057
|
+
key: item.value,
|
|
1058
|
+
icon: item.hasBadge ? /*#__PURE__*/jsxs(IconWrapper, {
|
|
1059
|
+
children: [/*#__PURE__*/jsx(IconLabel, {}), item.icon]
|
|
1060
|
+
}) : item.icon
|
|
1061
|
+
}))), /*#__PURE__*/jsx(StyledBottomNavigationAction, {
|
|
1062
|
+
value: "menu",
|
|
1063
|
+
label: "Menu",
|
|
1064
|
+
icon: hasMenuBadge ? /*#__PURE__*/jsxs(IconWrapper, {
|
|
1065
|
+
children: [/*#__PURE__*/jsx(IconLabel, {}), /*#__PURE__*/jsx(Menu, {
|
|
1066
|
+
fontSize: "small"
|
|
1067
|
+
})]
|
|
1068
|
+
}) : /*#__PURE__*/jsx(Menu, {
|
|
1069
|
+
fontSize: "small"
|
|
1070
|
+
})
|
|
1071
|
+
})]
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
var NavbarBadge = /*#__PURE__*/styled.span.withConfig({
|
|
1076
|
+
displayName: "NavbarItem__NavbarBadge",
|
|
1077
|
+
componentId: "SD__sc-1pvzq3w-0"
|
|
1078
|
+
})(["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:", ";}"], Color.White, Color.Blue300, Color.White, Color.Red500);
|
|
1079
|
+
var NavbarLabel = /*#__PURE__*/styled.span.withConfig({
|
|
1080
|
+
displayName: "NavbarItem__NavbarLabel",
|
|
1081
|
+
componentId: "SD__sc-1pvzq3w-1"
|
|
1082
|
+
})(["flex-grow:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"]);
|
|
1083
|
+
var NavbarItemRoot = /*#__PURE__*/styled.div.withConfig({
|
|
1084
|
+
displayName: "NavbarItem__NavbarItemRoot",
|
|
1085
|
+
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);
|
|
1087
|
+
var IconWrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
1088
|
+
displayName: "NavbarItem__IconWrapper",
|
|
1089
|
+
componentId: "SD__sc-1pvzq3w-3"
|
|
1090
|
+
})(["width:24px;margin-right:8px;& svg{font-size:24px;}"]);
|
|
1091
|
+
function NavbarItem(_ref) {
|
|
1092
|
+
var {
|
|
1093
|
+
label,
|
|
1094
|
+
gutter,
|
|
1095
|
+
badge,
|
|
1096
|
+
icon,
|
|
1097
|
+
component,
|
|
1098
|
+
onClick,
|
|
1099
|
+
variant,
|
|
1100
|
+
ident = 0
|
|
1101
|
+
} = _ref;
|
|
1102
|
+
var uid = useUID();
|
|
1103
|
+
return /*#__PURE__*/jsxs(NavbarItemRoot, {
|
|
1104
|
+
as: component,
|
|
1105
|
+
onClick: onClick,
|
|
1106
|
+
"aria-labelledby": uid,
|
|
1107
|
+
style: {
|
|
1108
|
+
marginTop: gutter ? '16px' : '0',
|
|
1109
|
+
paddingLeft: (ident + 1) * 20
|
|
1110
|
+
},
|
|
1111
|
+
children: [/*#__PURE__*/jsx(IconWrapper$1, {
|
|
1112
|
+
children: icon
|
|
1113
|
+
}), /*#__PURE__*/jsx(NavbarLabel, {
|
|
1114
|
+
id: uid,
|
|
1115
|
+
children: label
|
|
1116
|
+
}), badge != null && /*#__PURE__*/jsx(NavbarBadge, {
|
|
1117
|
+
"data-variant": variant,
|
|
1118
|
+
children: badge
|
|
1119
|
+
})]
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
var Header = /*#__PURE__*/styled.div.withConfig({
|
|
1124
|
+
displayName: "NavbarList__Header",
|
|
1125
|
+
componentId: "SD__sc-19zrmxc-0"
|
|
1126
|
+
})(["margin:0 16px 8px;display:flex;flex-shrink:0;align-items:center;justify-content:space-between;position:sticky;"]);
|
|
1127
|
+
var Wrapper = /*#__PURE__*/styled.div.withConfig({
|
|
1128
|
+
displayName: "NavbarList__Wrapper",
|
|
1129
|
+
componentId: "SD__sc-19zrmxc-1"
|
|
1130
|
+
})(["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 => {
|
|
1131
|
+
var {
|
|
1132
|
+
isMobile
|
|
1133
|
+
} = _ref;
|
|
1134
|
+
return isMobile ? '280px' : 'initial';
|
|
1135
|
+
}, _ref2 => {
|
|
1136
|
+
var {
|
|
1137
|
+
isMobile
|
|
1138
|
+
} = _ref2;
|
|
1139
|
+
return isMobile ? '280px' : '240px';
|
|
1140
|
+
}, _ref3 => {
|
|
1141
|
+
var {
|
|
1142
|
+
isMobile
|
|
1143
|
+
} = _ref3;
|
|
1144
|
+
return isMobile ? '280px' : '72px';
|
|
1145
|
+
}, Header);
|
|
1146
|
+
var ExpandIconButton = /*#__PURE__*/styled(IconButton).withConfig({
|
|
1147
|
+
displayName: "NavbarList__ExpandIconButton",
|
|
1148
|
+
componentId: "SD__sc-19zrmxc-2"
|
|
1149
|
+
})(["color:", ";&&:focus{background-color:inherit;}"], Color.Silver500);
|
|
1150
|
+
var Footer = /*#__PURE__*/styled.div.withConfig({
|
|
1151
|
+
displayName: "NavbarList__Footer",
|
|
1152
|
+
componentId: "SD__sc-19zrmxc-3"
|
|
1153
|
+
})(["flex-grow:1;display:flex;align-items:flex-end;margin:16px 0 8px;position:sticky;"]);
|
|
1154
|
+
var Root = /*#__PURE__*/styled.div.withConfig({
|
|
1155
|
+
displayName: "NavbarList__Root",
|
|
1156
|
+
componentId: "SD__sc-19zrmxc-4"
|
|
1157
|
+
})(["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:", ";}"], Color.Dark100);
|
|
1158
|
+
function NavbarMenuItem(_ref4) {
|
|
1159
|
+
var {
|
|
1160
|
+
label,
|
|
1161
|
+
icon,
|
|
1162
|
+
onClick,
|
|
1163
|
+
component
|
|
1164
|
+
} = _ref4;
|
|
1165
|
+
return /*#__PURE__*/jsx(Root, {
|
|
1166
|
+
as: component,
|
|
1167
|
+
onClick: onClick,
|
|
1168
|
+
children: /*#__PURE__*/jsxs(Inline, {
|
|
1169
|
+
space: "xsmall",
|
|
1170
|
+
verticalAlign: "center",
|
|
1171
|
+
children: [icon, /*#__PURE__*/jsx(NavbarLabel, {
|
|
1172
|
+
children: label
|
|
1173
|
+
})]
|
|
1174
|
+
})
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
var Content = /*#__PURE__*/styled.div.withConfig({
|
|
1178
|
+
displayName: "NavbarList__Content",
|
|
1179
|
+
componentId: "SD__sc-19zrmxc-5"
|
|
1180
|
+
})(["height:100%;min-height:50px;overflow:scroll;&[aria-expanded='false']{", ",", "{visibility:hidden;}}"], NavbarBadge, NavbarLabel);
|
|
1181
|
+
function NavbarList(_ref5) {
|
|
1182
|
+
var {
|
|
1183
|
+
header,
|
|
1184
|
+
items,
|
|
1185
|
+
footer
|
|
1186
|
+
} = _ref5;
|
|
1187
|
+
var platform = useResponsiveValue('mobile', 'tablet', 'desktop');
|
|
1188
|
+
var isMobile = platform === 'mobile';
|
|
1189
|
+
var {
|
|
1190
|
+
isExpanded,
|
|
1191
|
+
isDrawerOpen,
|
|
1192
|
+
setDrawerOpen,
|
|
1193
|
+
setIsExpanded
|
|
1194
|
+
} = useNavbarContext();
|
|
1195
|
+
var isSidebarOpened = isMobile ? isDrawerOpen : isExpanded;
|
|
1196
|
+
var filteredItems = useMemo(() => items.filter(item => {
|
|
1197
|
+
return !item.hide && (isSidebarOpened || !!item.icon);
|
|
1198
|
+
}).map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
1199
|
+
menuGroupKey: item.groupKey
|
|
1200
|
+
})), [items, isSidebarOpened]);
|
|
1201
|
+
return /*#__PURE__*/jsxs(Wrapper, {
|
|
1202
|
+
isMobile: isMobile,
|
|
1203
|
+
"data-expanded": isSidebarOpened,
|
|
1204
|
+
children: [/*#__PURE__*/jsxs(Header, {
|
|
1205
|
+
children: [isSidebarOpened && header, !isMobile && /*#__PURE__*/jsx(ExpandIconButton, {
|
|
1206
|
+
disableRipple: true,
|
|
1207
|
+
style: isExpanded ? {
|
|
1208
|
+
paddingRight: 0
|
|
1209
|
+
} : {},
|
|
1210
|
+
onClick: () => {
|
|
1211
|
+
setIsExpanded(!isExpanded);
|
|
1212
|
+
},
|
|
1213
|
+
children: isExpanded ? /*#__PURE__*/jsx(MenuOpen, {}) : /*#__PURE__*/jsx(Menu, {})
|
|
1214
|
+
})]
|
|
1215
|
+
}), /*#__PURE__*/jsx(Content, {
|
|
1216
|
+
"aria-expanded": isSidebarOpened,
|
|
1217
|
+
children: filteredItems.map(item => {
|
|
1218
|
+
var index = filteredItems.indexOf(item);
|
|
1219
|
+
var prev = filteredItems[index - 1];
|
|
1220
|
+
return /*#__PURE__*/createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
|
|
1221
|
+
key: item.key,
|
|
1222
|
+
gutter: prev && prev.groupKey !== item.groupKey,
|
|
1223
|
+
onClick: event => {
|
|
1224
|
+
var _item$onClick;
|
|
1225
|
+
|
|
1226
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
|
|
1227
|
+
|
|
1228
|
+
if (!event.isDefaultPrevented()) {
|
|
1229
|
+
setDrawerOpen(false);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}));
|
|
1233
|
+
})
|
|
1234
|
+
}), /*#__PURE__*/jsx(Footer, {
|
|
1235
|
+
children: footer
|
|
1236
|
+
})]
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
var Aside = /*#__PURE__*/styled.aside.withConfig({
|
|
1241
|
+
displayName: "Navbar__Aside",
|
|
1242
|
+
componentId: "SD__sc-1oiqig8-0"
|
|
1243
|
+
})(["display:flex;flex-direction:column;overflow:auto;"]);
|
|
1244
|
+
var Main = /*#__PURE__*/styled.main.withConfig({
|
|
1245
|
+
displayName: "Navbar__Main",
|
|
1246
|
+
componentId: "SD__sc-1oiqig8-1"
|
|
1247
|
+
})(["flex:1;display:flex;flex-direction:column;overflow:scroll;"]);
|
|
1248
|
+
function Navbar(_ref) {
|
|
1249
|
+
var {
|
|
1250
|
+
footer,
|
|
1251
|
+
items,
|
|
1252
|
+
header,
|
|
1253
|
+
bottomItems,
|
|
1254
|
+
children,
|
|
1255
|
+
containerStyle,
|
|
1256
|
+
hasExtraBadge
|
|
1257
|
+
} = _ref;
|
|
1258
|
+
var theme = useTheme();
|
|
1259
|
+
var [isDrawerOpen, setDrawerOpen] = useState(false);
|
|
1260
|
+
var platform = useResponsiveValue('mobile', 'tablet', 'desktop');
|
|
1261
|
+
var isMobile = platform === 'mobile';
|
|
1262
|
+
var matches = useMediaQuery(theme.breakpoints.up('md'), {
|
|
1263
|
+
noSsr: true
|
|
1264
|
+
});
|
|
1265
|
+
var [isExpanded, setIsExpanded] = useState(matches);
|
|
1266
|
+
var hasBadge = hasExtraBadge || items.some(item => item.badge);
|
|
1267
|
+
var ctx = useMemo(() => ({
|
|
1268
|
+
isDrawerOpen,
|
|
1269
|
+
isExpanded,
|
|
1270
|
+
setIsExpanded,
|
|
1271
|
+
setDrawerOpen
|
|
1272
|
+
}), [isDrawerOpen, isExpanded, setIsExpanded, setDrawerOpen]);
|
|
1273
|
+
return /*#__PURE__*/jsx(NavbarContext.Provider, {
|
|
1274
|
+
value: ctx,
|
|
1275
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
1276
|
+
style: _objectSpread({
|
|
1277
|
+
display: 'flex',
|
|
1278
|
+
height: '100%',
|
|
1279
|
+
flexDirection: isMobile ? 'column' : 'row'
|
|
1280
|
+
}, containerStyle),
|
|
1281
|
+
children: [!isMobile && /*#__PURE__*/jsx(Aside, {
|
|
1282
|
+
children: /*#__PURE__*/jsx(NavbarList, {
|
|
1283
|
+
header: header,
|
|
1284
|
+
items: items,
|
|
1285
|
+
footer: footer
|
|
1286
|
+
})
|
|
1287
|
+
}), /*#__PURE__*/jsx(Main, {
|
|
1288
|
+
children: children
|
|
1289
|
+
}), isMobile && /*#__PURE__*/jsx(NavbarBottomBar, {
|
|
1290
|
+
items: bottomItems,
|
|
1291
|
+
hasMenuBadge: hasBadge
|
|
1292
|
+
}), /*#__PURE__*/jsx(Drawer, {
|
|
1293
|
+
open: isDrawerOpen,
|
|
1294
|
+
anchor: "right",
|
|
1295
|
+
onClose: () => {
|
|
1296
|
+
setDrawerOpen(false);
|
|
1297
|
+
},
|
|
1298
|
+
PaperProps: {
|
|
1299
|
+
style: {
|
|
1300
|
+
width: '280px',
|
|
1301
|
+
minWidth: '280px'
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
children: /*#__PURE__*/jsx(NavbarList, {
|
|
1305
|
+
header: header,
|
|
1306
|
+
items: items,
|
|
1307
|
+
footer: footer
|
|
1308
|
+
})
|
|
1309
|
+
})]
|
|
1310
|
+
})
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
var _excluded$6 = ["title", "subtitle", "children"];
|
|
1315
|
+
var StyledTypography = /*#__PURE__*/styled(Typography).withConfig({
|
|
1316
|
+
displayName: "NavbarAvatar__StyledTypography",
|
|
1317
|
+
componentId: "SD__sc-19q2zd0-0"
|
|
1318
|
+
})(["color:", ";text-overflow:ellipsis;white-space:nowrap;overflow:hidden;&:hover{color:", ";}"], Color.Silver500, Color.White);
|
|
1319
|
+
function NavbarAvatar(_ref) {
|
|
1320
|
+
var {
|
|
1321
|
+
title,
|
|
1322
|
+
subtitle,
|
|
1323
|
+
children
|
|
1324
|
+
} = _ref,
|
|
1325
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1326
|
+
|
|
1327
|
+
var {
|
|
1328
|
+
isExpanded,
|
|
1329
|
+
isDrawerOpen
|
|
1330
|
+
} = useNavbarContext();
|
|
1331
|
+
|
|
1332
|
+
if (isExpanded || isDrawerOpen) {
|
|
1333
|
+
return /*#__PURE__*/jsxs(Columns, {
|
|
1334
|
+
space: "xsmall",
|
|
1335
|
+
align: "center",
|
|
1336
|
+
children: [/*#__PURE__*/jsx(Column, {
|
|
1337
|
+
width: "content",
|
|
1338
|
+
children: /*#__PURE__*/jsx(Avatar, _objectSpread(_objectSpread({}, props), {}, {
|
|
1339
|
+
children: children
|
|
1340
|
+
}))
|
|
1341
|
+
}), /*#__PURE__*/jsx(Column, {
|
|
1342
|
+
children: /*#__PURE__*/jsxs(Stack, {
|
|
1343
|
+
space: "none",
|
|
1344
|
+
children: [/*#__PURE__*/jsx(StyledTypography, {
|
|
1345
|
+
variant: "caption",
|
|
1346
|
+
children: title
|
|
1347
|
+
}), /*#__PURE__*/jsx(StyledTypography, {
|
|
1348
|
+
variant: "caption",
|
|
1349
|
+
children: subtitle
|
|
1350
|
+
})]
|
|
1351
|
+
})
|
|
1352
|
+
})]
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
return /*#__PURE__*/jsx(Avatar, _objectSpread(_objectSpread({}, props), {}, {
|
|
1357
|
+
children: children
|
|
1358
|
+
}));
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
var Divider = /*#__PURE__*/styled.div.withConfig({
|
|
1362
|
+
displayName: "NavbarMenu__Divider",
|
|
1363
|
+
componentId: "SD__sc-1c8icpt-0"
|
|
1364
|
+
})(["border-bottom:1px solid ", ";margin:8px -16px;"], Color.Silver400);
|
|
1365
|
+
var StyledMenuItem = /*#__PURE__*/styled(MenuItem).withConfig({
|
|
1366
|
+
displayName: "NavbarMenu__StyledMenuItem",
|
|
1367
|
+
componentId: "SD__sc-1c8icpt-1"
|
|
1368
|
+
})(["& svg{font-size:24px;color:", ";}"], Color.Dark100);
|
|
1369
|
+
var Wrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
1370
|
+
displayName: "NavbarMenu__Wrapper",
|
|
1371
|
+
componentId: "SD__sc-1c8icpt-2"
|
|
1372
|
+
})(["width:100%;padding:8px 16px;cursor:pointer;background:", ";border-left:4px solid ", ";&:hover{border-left-color:", ";background:", ";}"], Color.Dark400, _ref => {
|
|
1373
|
+
var {
|
|
1374
|
+
active
|
|
1375
|
+
} = _ref;
|
|
1376
|
+
return active ? Color.Blue300 : 'transparent';
|
|
1377
|
+
}, Color.Blue300, Color.Dark400);
|
|
1378
|
+
function NavbarMenu(_ref2) {
|
|
1379
|
+
var {
|
|
1380
|
+
items,
|
|
1381
|
+
children
|
|
1382
|
+
} = _ref2;
|
|
1383
|
+
var {
|
|
1384
|
+
setDrawerOpen
|
|
1385
|
+
} = useNavbarContext();
|
|
1386
|
+
var [anchor, setAnchor] = useState(null);
|
|
1387
|
+
|
|
1388
|
+
function showProfileMenu(event) {
|
|
1389
|
+
setAnchor(event.currentTarget);
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
function hideProfileMenu() {
|
|
1393
|
+
setAnchor(null);
|
|
1394
|
+
setDrawerOpen(false);
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
1398
|
+
children: [/*#__PURE__*/jsx(Wrapper$1, {
|
|
1399
|
+
onClick: showProfileMenu,
|
|
1400
|
+
active: !!anchor,
|
|
1401
|
+
children: children
|
|
1402
|
+
}), /*#__PURE__*/jsx(Menu$1, {
|
|
1403
|
+
open: !!anchor,
|
|
1404
|
+
anchorEl: anchor,
|
|
1405
|
+
onClose: hideProfileMenu,
|
|
1406
|
+
onClick: hideProfileMenu,
|
|
1407
|
+
anchorOrigin: {
|
|
1408
|
+
vertical: 'top',
|
|
1409
|
+
horizontal: 'center'
|
|
1410
|
+
},
|
|
1411
|
+
transformOrigin: {
|
|
1412
|
+
vertical: 'bottom',
|
|
1413
|
+
horizontal: 'center'
|
|
1414
|
+
},
|
|
1415
|
+
children: items.filter(item => item.visible !== false).flatMap((item, index, arr) => {
|
|
1416
|
+
return [/*#__PURE__*/jsx(StyledMenuItem, {
|
|
1417
|
+
onClick: item.onClick,
|
|
1418
|
+
children: /*#__PURE__*/jsxs(Inline, {
|
|
1419
|
+
space: "small",
|
|
1420
|
+
verticalAlign: "center",
|
|
1421
|
+
children: [item.icon, /*#__PURE__*/jsx(Typography, {
|
|
1422
|
+
style: {
|
|
1423
|
+
color: Color.Dark500
|
|
1424
|
+
},
|
|
1425
|
+
children: item.label
|
|
1426
|
+
})]
|
|
1427
|
+
})
|
|
1428
|
+
}, item.key), index !== arr.length - 1 && /*#__PURE__*/jsx(Divider, {}, "".concat(item.key, "-divider"))];
|
|
1429
|
+
})
|
|
1430
|
+
})]
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
|
|
968
1434
|
var SidebarRoot = /*#__PURE__*/styled.aside.withConfig({
|
|
969
1435
|
displayName: "Sidebar__SidebarRoot",
|
|
970
1436
|
componentId: "SD__sc-b77o22-0"
|
|
@@ -1049,7 +1515,7 @@ var SidebarDividerRoot = /*#__PURE__*/styled.div.withConfig({
|
|
|
1049
1515
|
var SidebarDivider = /*#__PURE__*/forwardRef((_, ref) => {
|
|
1050
1516
|
return /*#__PURE__*/jsx(SidebarDividerRoot, {
|
|
1051
1517
|
ref: ref,
|
|
1052
|
-
children: /*#__PURE__*/jsx(Divider, {})
|
|
1518
|
+
children: /*#__PURE__*/jsx(Divider$1, {})
|
|
1053
1519
|
});
|
|
1054
1520
|
});
|
|
1055
1521
|
if (process.env.NODE_ENV !== "production") SidebarDivider.displayName = "SidebarDivider";
|
|
@@ -1287,5 +1753,5 @@ var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
1287
1753
|
});
|
|
1288
1754
|
if (process.env.NODE_ENV !== "production") SidebarSubheader.displayName = "SidebarSubheader";
|
|
1289
1755
|
|
|
1290
|
-
export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, DescriptionItem, FileDropZone, FileListItem, Sidebar, SidebarContainer, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes };
|
|
1756
|
+
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 };
|
|
1291
1757
|
//# sourceMappingURL=index.js.map
|