@superdispatch/ui-lab 0.50.3 → 0.50.5
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/.babelrc.js +5 -0
- package/package.json +38 -13
- package/pkg/README.md +10 -0
- package/{dist-node → pkg/dist-node}/index.js +52 -40
- package/pkg/dist-node/index.js.map +1 -0
- package/{dist-src → pkg/dist-src}/email-autocomplate/EmailAutocomplete.js +3 -3
- package/{dist-src → pkg/dist-src}/file-drop-zone/FileDropZone.js +2 -2
- package/{dist-src → pkg/dist-src}/flag-list/FlagListItem.js +11 -19
- package/{dist-src → pkg/dist-src}/index.js +1 -0
- package/{dist-src → pkg/dist-src}/navbar/Navbar.js +13 -4
- package/{dist-src → pkg/dist-src}/navbar/NavbarAccordion.js +18 -9
- package/{dist-src → pkg/dist-src}/navbar/NavbarList.js +1 -1
- package/{dist-src → pkg/dist-src}/sidebar/SidebarBackButton.js +1 -1
- package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItem.js +1 -1
- package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAvatar.js +1 -1
- package/{dist-types → pkg/dist-types}/index.d.ts +8 -2
- package/{dist-web → pkg/dist-web}/index.js +52 -42
- package/pkg/dist-web/index.js.map +1 -0
- package/pkg/package.json +41 -0
- package/playroom.ts +24 -0
- package/src/alert/Alert.stories.tsx +162 -0
- package/src/alert/Alert.tsx +135 -0
- package/src/banner/Banner.stories.tsx +64 -0
- package/src/banner/Banner.tsx +120 -0
- package/src/box/Box.stories.tsx +20 -0
- package/src/box/Box.tsx +257 -0
- package/src/button/Button.stories.tsx +739 -0
- package/src/button/Button.tsx +498 -0
- package/src/button-area/ButtonArea.stories.tsx +65 -0
- package/src/button-area/ButtonArea.tsx +90 -0
- package/src/chat/Chat.stories.tsx +130 -0
- package/src/chat/Chat.tsx +57 -0
- package/src/chat/ChatMessage.tsx +45 -0
- package/src/chat/README.MD +7 -0
- package/src/chat/__tests__/Chat.spec.tsx +29 -0
- package/src/chat/__tests__/ChatMessage.spec.tsx +39 -0
- package/src/container/Container.tsx +48 -0
- package/src/description-item/DescriptionItem.stories.tsx +163 -0
- package/src/description-item/DescriptionItem.tsx +104 -0
- package/src/description-line-item/DescriptionLineItem.stories.tsx +23 -0
- package/src/description-line-item/DescriptionLineItem.tsx +29 -0
- package/src/email-autocomplate/CloseIcon.tsx +20 -0
- package/src/email-autocomplate/EmailAutocomplete.stories.tsx +47 -0
- package/src/email-autocomplate/EmailAutocomplete.tsx +138 -0
- package/src/file-drop-zone/FileDropZone.stories.tsx +44 -0
- package/src/file-drop-zone/FileDropZone.tsx +170 -0
- package/src/file-list-item/FileListItem.stories.tsx +37 -0
- package/src/file-list-item/FileListItem.tsx +148 -0
- package/src/file-list-item/__tests__/FileListItem.spec.tsx +339 -0
- package/src/flag-list/FlagList.stories.tsx +72 -0
- package/src/flag-list/FlagList.tsx +54 -0
- package/src/flag-list/FlagListItem.tsx +126 -0
- package/src/index.spec.ts +53 -0
- package/src/index.ts +36 -0
- package/src/linked-text/LinkeText.stories.tsx +42 -0
- package/src/linked-text/LinkedText.tsx +47 -0
- package/src/multiline-text/MultilineText.stories.tsx +30 -0
- package/src/multiline-text/MultilineText.ts +16 -0
- package/src/navbar/Navbar.stories.tsx +137 -0
- package/src/navbar/Navbar.tsx +132 -0
- package/src/navbar/NavbarAccordion.tsx +195 -0
- package/src/navbar/NavbarAvatar.tsx +51 -0
- package/src/navbar/NavbarBottomBar.tsx +135 -0
- package/src/navbar/NavbarContext.tsx +22 -0
- package/src/navbar/NavbarItem.tsx +125 -0
- package/src/navbar/NavbarList.tsx +247 -0
- package/src/navbar/NavbarMenu.tsx +102 -0
- package/src/passwordStepper/PasswordStrength.stories.tsx +95 -0
- package/src/passwordStepper/PasswordStrength.tsx +107 -0
- package/src/passwordStepper/PasswordUtils.tsx +42 -0
- package/src/passwordStepper/PasswordValidationComponents.tsx +95 -0
- package/src/sidebar/Sidebar.stories.tsx +376 -0
- package/src/sidebar/Sidebar.tsx +75 -0
- package/src/sidebar/SidebarBackButton.tsx +33 -0
- package/src/sidebar/SidebarContainer.tsx +114 -0
- package/src/sidebar/SidebarContent.tsx +119 -0
- package/src/sidebar/SidebarDivider.tsx +15 -0
- package/src/sidebar/SidebarMenuItem.tsx +196 -0
- package/src/sidebar/SidebarMenuItemAction.tsx +27 -0
- package/src/sidebar/SidebarMenuItemAvatar.tsx +59 -0
- package/src/sidebar/SidebarMenuItemContext.tsx +33 -0
- package/src/sidebar/SidebarSubheader.tsx +38 -0
- package/src/styled.d.ts +12 -0
- package/src/text-box/TextBox.stories.tsx +114 -0
- package/src/text-box/TextBox.tsx +238 -0
- package/src/utils/RuleNormalizer.ts +24 -0
- package/src/utils/mergeStyles.ts +28 -0
- package/tsconfig.json +19 -0
- package/LICENSE +0 -21
- package/dist-node/index.js.map +0 -1
- package/dist-web/index.js.map +0 -1
- /package/{dist-src → pkg/dist-src}/alert/Alert.js +0 -0
- /package/{dist-src → pkg/dist-src}/banner/Banner.js +0 -0
- /package/{dist-src → pkg/dist-src}/box/Box.js +0 -0
- /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
- /package/{dist-src → pkg/dist-src}/button-area/ButtonArea.js +0 -0
- /package/{dist-src → pkg/dist-src}/chat/Chat.js +0 -0
- /package/{dist-src → pkg/dist-src}/chat/ChatMessage.js +0 -0
- /package/{dist-src → pkg/dist-src}/container/Container.js +0 -0
- /package/{dist-src → pkg/dist-src}/description-item/DescriptionItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/description-line-item/DescriptionLineItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/email-autocomplate/CloseIcon.js +0 -0
- /package/{dist-src → pkg/dist-src}/file-list-item/FileListItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/flag-list/FlagList.js +0 -0
- /package/{dist-src → pkg/dist-src}/linked-text/LinkedText.js +0 -0
- /package/{dist-src → pkg/dist-src}/multiline-text/MultilineText.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarAvatar.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarBottomBar.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarContext.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarMenu.js +0 -0
- /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordStrength.js +0 -0
- /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordUtils.js +0 -0
- /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordValidationComponents.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/Sidebar.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarContainer.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarContent.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarDivider.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarSubheader.js +0 -0
- /package/{dist-src → pkg/dist-src}/text-box/TextBox.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/RuleNormalizer.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/mergeStyles.js +0 -0
|
@@ -32,46 +32,38 @@ var EndActions = /*#__PURE__*/styled.div.withConfig({
|
|
|
32
32
|
} = _ref2;
|
|
33
33
|
return theme.breakpoints.down('xs');
|
|
34
34
|
});
|
|
35
|
-
var BannerListItemDanger = /*#__PURE__*/css(["& ", "{background:", ";color:", ";}&:hover{background:", ";}"], IconContainer, ColorDynamic.Red50, ColorDynamic.Red300, ColorDynamic.Red50);
|
|
36
35
|
var BannerListItemStandalone = /*#__PURE__*/css(["background:", ";"], ColorDynamic.Silver200);
|
|
37
36
|
var BannerListContainer = /*#__PURE__*/styled.div.withConfig({
|
|
38
37
|
displayName: "FlagListItem__BannerListContainer",
|
|
39
38
|
componentId: "SD__sc-o5bqru-4"
|
|
40
|
-
})(["display:flex;align-items:center;gap:8px;padding:8px 16px 8px 12px;border:1px solid ", ";background:", ";cursor:default;transition:", ";& + &{border-top:none;}&:last-child{border-radius:0 0 4px 4px;}&:hover{background:", ";& ", "{background:", ";}
|
|
39
|
+
})(["display:flex;align-items:center;gap:8px;padding:8px 16px 8px 12px;border:1px solid ", ";background:", ";cursor:default;transition:", ";& + &{border-top:none;}&:last-child{border-radius:0 0 4px 4px;}&:hover{background:", ";& ", "{background:", ";}}[data-variant='standalone'] &:not(:hover){", "}", "{flex-direction:column;align-items:flex-start;}"], ColorDynamic.Silver400, ColorDynamic.White, _ref3 => {
|
|
41
40
|
var {
|
|
42
41
|
theme
|
|
43
42
|
} = _ref3;
|
|
44
43
|
return theme.transitions.create(['color', 'background-color']);
|
|
45
|
-
}, ColorDynamic.
|
|
46
|
-
var {
|
|
47
|
-
$variant
|
|
48
|
-
} = _ref4;
|
|
49
|
-
return $variant === 'danger' ? ColorDynamic.Red300 : ColorDynamic.Blue300;
|
|
50
|
-
}, BannerListItemStandalone, _ref5 => {
|
|
51
|
-
var {
|
|
52
|
-
$variant
|
|
53
|
-
} = _ref5;
|
|
54
|
-
return $variant === 'danger' ? BannerListItemDanger : null;
|
|
55
|
-
}, _ref6 => {
|
|
44
|
+
}, ColorDynamic.Silver200, IconContainer, ColorDynamic.White, BannerListItemStandalone, _ref4 => {
|
|
56
45
|
var {
|
|
57
46
|
theme
|
|
58
|
-
} =
|
|
47
|
+
} = _ref4;
|
|
59
48
|
return theme.breakpoints.down('xs');
|
|
60
49
|
});
|
|
61
|
-
export var FlagListItem = /*#__PURE__*/forwardRef((
|
|
50
|
+
export var FlagListItem = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
62
51
|
var {
|
|
63
52
|
variant = 'primary',
|
|
64
53
|
showHelpIcon,
|
|
65
54
|
endAction,
|
|
66
55
|
children
|
|
67
|
-
} =
|
|
68
|
-
rest = _objectWithoutProperties(
|
|
56
|
+
} = _ref5,
|
|
57
|
+
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
69
58
|
return /*#__PURE__*/_jsxs(BannerListContainer, _objectSpread(_objectSpread({}, rest), {}, {
|
|
70
59
|
ref: ref,
|
|
71
|
-
$variant: variant,
|
|
72
60
|
children: [/*#__PURE__*/_jsxs(Content, {
|
|
73
61
|
children: [/*#__PURE__*/_jsx(IconContainer, {
|
|
74
|
-
children: variant === 'danger' ? /*#__PURE__*/_jsx(Error, {
|
|
62
|
+
children: variant === 'danger' ? /*#__PURE__*/_jsx(Error, {
|
|
63
|
+
htmlColor: ColorDynamic.Red300
|
|
64
|
+
}) : variant === 'warning' ? /*#__PURE__*/_jsx(Warning, {
|
|
65
|
+
htmlColor: ColorDynamic.Yellow300
|
|
66
|
+
}) : /*#__PURE__*/_jsx(Flag, {})
|
|
75
67
|
}), children, /*#__PURE__*/_jsx(HelpIcon, {
|
|
76
68
|
children: showHelpIcon && /*#__PURE__*/_jsx(Help, {})
|
|
77
69
|
})]
|
|
@@ -16,6 +16,7 @@ export * from "./flag-list/FlagListItem.js";
|
|
|
16
16
|
export * from "./linked-text/LinkedText.js";
|
|
17
17
|
export * from "./multiline-text/MultilineText.js";
|
|
18
18
|
export * from "./navbar/Navbar.js";
|
|
19
|
+
export * from "./navbar/NavbarAccordion.js";
|
|
19
20
|
export * from "./navbar/NavbarAvatar.js";
|
|
20
21
|
export * from "./navbar/NavbarBottomBar.js";
|
|
21
22
|
export { useNavbarContext } from "./navbar/NavbarContext.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import { Drawer, useMediaQuery, useTheme } from '@material-ui/core';
|
|
3
3
|
import { ColorDynamic, useResponsiveValue } from '@superdispatch/ui';
|
|
4
|
-
import { useMemo, useState } from 'react';
|
|
4
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { NavbarBottomBar } from "./NavbarBottomBar.js";
|
|
7
7
|
import { NavbarContext } from "./NavbarContext.js";
|
|
@@ -23,7 +23,9 @@ export function Navbar(_ref) {
|
|
|
23
23
|
bottomItems,
|
|
24
24
|
children,
|
|
25
25
|
containerStyle,
|
|
26
|
-
hasExtraBadge
|
|
26
|
+
hasExtraBadge,
|
|
27
|
+
isMenuExpanded: controlledIsMenuExpanded,
|
|
28
|
+
onMenuExpandedChange
|
|
27
29
|
} = _ref;
|
|
28
30
|
var theme = useTheme();
|
|
29
31
|
var [isDrawerOpen, setDrawerOpen] = useState(false);
|
|
@@ -32,7 +34,14 @@ export function Navbar(_ref) {
|
|
|
32
34
|
var matches = useMediaQuery(theme.breakpoints.up('md'), {
|
|
33
35
|
noSsr: true
|
|
34
36
|
});
|
|
35
|
-
var [
|
|
37
|
+
var [internalIsMenuExpanded, setInternalMenuExpanded] = useState(matches);
|
|
38
|
+
var isMenuExpanded = controlledIsMenuExpanded !== undefined ? controlledIsMenuExpanded : internalIsMenuExpanded;
|
|
39
|
+
var setMenuExpanded = useCallback(value => {
|
|
40
|
+
if (controlledIsMenuExpanded === undefined) {
|
|
41
|
+
setInternalMenuExpanded(value);
|
|
42
|
+
}
|
|
43
|
+
onMenuExpandedChange === null || onMenuExpandedChange === void 0 || onMenuExpandedChange(value);
|
|
44
|
+
}, [controlledIsMenuExpanded, onMenuExpandedChange]);
|
|
36
45
|
var hasBadge = hasExtraBadge || items.some(item => item.badge);
|
|
37
46
|
var ctx = useMemo(() => ({
|
|
38
47
|
isDrawerOpen,
|
|
@@ -40,7 +49,7 @@ export function Navbar(_ref) {
|
|
|
40
49
|
setDrawerOpen,
|
|
41
50
|
setMenuExpanded,
|
|
42
51
|
isNavbarExpanded: isMenuExpanded || isDrawerOpen
|
|
43
|
-
}), [isDrawerOpen, isMenuExpanded,
|
|
52
|
+
}), [isDrawerOpen, isMenuExpanded, setDrawerOpen, setMenuExpanded]);
|
|
44
53
|
return /*#__PURE__*/_jsx(NavbarContext.Provider, {
|
|
45
54
|
value: ctx,
|
|
46
55
|
children: /*#__PURE__*/_jsxs("div", {
|
|
@@ -34,19 +34,28 @@ export function NavbarAccordion(_ref2) {
|
|
|
34
34
|
icon,
|
|
35
35
|
gutter,
|
|
36
36
|
items,
|
|
37
|
-
onClick: _onClick
|
|
37
|
+
onClick: _onClick,
|
|
38
|
+
isExpanded: controlledIsExpanded,
|
|
39
|
+
onExpandedChange
|
|
38
40
|
} = _ref2;
|
|
39
41
|
var uid = useUID();
|
|
40
42
|
var {
|
|
41
43
|
setDrawerOpen,
|
|
42
44
|
isNavbarExpanded
|
|
43
45
|
} = useNavbarContext();
|
|
44
|
-
var [
|
|
45
|
-
|
|
46
|
-
// sync accordion state with Desktop menu state
|
|
46
|
+
var [internalIsExpanded, setInternalExpanded] = useState(true);
|
|
47
47
|
useEffect(() => {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (controlledIsExpanded === undefined) {
|
|
49
|
+
setInternalExpanded(isNavbarExpanded);
|
|
50
|
+
}
|
|
51
|
+
}, [isNavbarExpanded, controlledIsExpanded]);
|
|
52
|
+
var isExpanded = controlledIsExpanded !== undefined ? controlledIsExpanded : internalIsExpanded;
|
|
53
|
+
function setExpanded(value) {
|
|
54
|
+
if (controlledIsExpanded === undefined) {
|
|
55
|
+
setInternalExpanded(value);
|
|
56
|
+
}
|
|
57
|
+
onExpandedChange === null || onExpandedChange === void 0 || onExpandedChange(value);
|
|
58
|
+
}
|
|
50
59
|
var filteredItems = useMemo(() => items.filter(item => !item.hide), [items]);
|
|
51
60
|
return /*#__PURE__*/_jsxs(NavbarAccordionRoot, {
|
|
52
61
|
square: true,
|
|
@@ -54,8 +63,8 @@ export function NavbarAccordion(_ref2) {
|
|
|
54
63
|
"aria-labelledby": uid,
|
|
55
64
|
expanded: isExpanded,
|
|
56
65
|
onClick: event => {
|
|
57
|
-
_onClick === null || _onClick === void 0
|
|
58
|
-
if (isNavbarExpanded) {
|
|
66
|
+
_onClick === null || _onClick === void 0 || _onClick(event);
|
|
67
|
+
if (controlledIsExpanded !== undefined || isNavbarExpanded) {
|
|
59
68
|
setExpanded(!isExpanded);
|
|
60
69
|
}
|
|
61
70
|
},
|
|
@@ -84,7 +93,7 @@ export function NavbarAccordion(_ref2) {
|
|
|
84
93
|
onClick: event => {
|
|
85
94
|
var _item$onClick;
|
|
86
95
|
event.stopPropagation();
|
|
87
|
-
(_item$onClick = item.onClick) === null || _item$onClick === void 0
|
|
96
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item, event);
|
|
88
97
|
if (!event.isDefaultPrevented()) {
|
|
89
98
|
setDrawerOpen(false);
|
|
90
99
|
}
|
|
@@ -122,7 +122,7 @@ export function NavbarList(_ref6) {
|
|
|
122
122
|
gutter: prev && prev.groupKey !== item.groupKey,
|
|
123
123
|
onClick: event => {
|
|
124
124
|
var _item$onClick;
|
|
125
|
-
(_item$onClick = item.onClick) === null || _item$onClick === void 0
|
|
125
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item, event);
|
|
126
126
|
if (!event.isDefaultPrevented()) {
|
|
127
127
|
setDrawerOpen(false);
|
|
128
128
|
}
|
|
@@ -24,7 +24,7 @@ export function SidebarBackButton(_ref) {
|
|
|
24
24
|
return /*#__PURE__*/_jsx(IconButton, _objectSpread(_objectSpread({}, props), {}, {
|
|
25
25
|
size: "small",
|
|
26
26
|
onClick: event => {
|
|
27
|
-
_onClick === null || _onClick === void 0
|
|
27
|
+
_onClick === null || _onClick === void 0 || _onClick(event);
|
|
28
28
|
if (!event.isDefaultPrevented()) {
|
|
29
29
|
openSidebar();
|
|
30
30
|
}
|
|
@@ -68,7 +68,7 @@ export var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
68
68
|
disabled: disabled,
|
|
69
69
|
"aria-current": selected,
|
|
70
70
|
onClick: event => {
|
|
71
|
-
_onClick === null || _onClick === void 0
|
|
71
|
+
_onClick === null || _onClick === void 0 || _onClick(event);
|
|
72
72
|
if (!event.isDefaultPrevented() && openContentOnClick) {
|
|
73
73
|
openSidebarContent();
|
|
74
74
|
}
|
|
@@ -36,7 +36,7 @@ export var SidebarMenuItemAvatar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
36
36
|
onMouseDown: stopPropagation,
|
|
37
37
|
onTouchStart: stopPropagation,
|
|
38
38
|
onChange: (_, checked) => {
|
|
39
|
-
_onChange === null || _onChange === void 0
|
|
39
|
+
_onChange === null || _onChange === void 0 || _onChange(checked);
|
|
40
40
|
}
|
|
41
41
|
})
|
|
42
42
|
});
|
|
@@ -252,13 +252,17 @@ interface NavbarBottomBarProps {
|
|
|
252
252
|
}
|
|
253
253
|
declare function NavbarBottomBar({ items, hasMenuBadge, }: NavbarBottomBarProps): ReactElement;
|
|
254
254
|
|
|
255
|
+
declare const NavbarAccordionLabel: StyledComponent<"span", DefaultTheme, {}, never>;
|
|
255
256
|
interface NavbarAccordionProps {
|
|
256
257
|
label: ReactNode;
|
|
257
258
|
icon?: ReactNode;
|
|
258
259
|
gutter?: boolean;
|
|
259
260
|
items: Array<Omit<NavbarItemOptions, 'icon'>>;
|
|
260
261
|
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
262
|
+
isExpanded?: boolean;
|
|
263
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
261
264
|
}
|
|
265
|
+
declare function NavbarAccordion({ label, icon, gutter, items, onClick, isExpanded: controlledIsExpanded, onExpandedChange, }: NavbarAccordionProps): ReactElement;
|
|
262
266
|
|
|
263
267
|
declare const NavbarBadge: StyledComponent<"span", DefaultTheme, {}, never>;
|
|
264
268
|
declare const NavbarLabel: StyledComponent<"span", DefaultTheme, {}, never>;
|
|
@@ -307,8 +311,10 @@ interface NavbarProps {
|
|
|
307
311
|
bottomItems: NavbarBottomBarItem[];
|
|
308
312
|
footer?: ReactNode;
|
|
309
313
|
hasExtraBadge?: boolean;
|
|
314
|
+
isMenuExpanded?: boolean;
|
|
315
|
+
onMenuExpandedChange?: (isExpanded: boolean) => void;
|
|
310
316
|
}
|
|
311
|
-
declare function Navbar({ footer, items, header, bottomItems, children, containerStyle, hasExtraBadge, }: NavbarProps): ReactElement;
|
|
317
|
+
declare function Navbar({ footer, items, header, bottomItems, children, containerStyle, hasExtraBadge, isMenuExpanded: controlledIsMenuExpanded, onMenuExpandedChange, }: NavbarProps): ReactElement;
|
|
312
318
|
|
|
313
319
|
interface NavbarAvatarProps extends Omit<AvatarProps, 'title'> {
|
|
314
320
|
title: ReactNode;
|
|
@@ -435,4 +441,4 @@ interface TextBoxProps {
|
|
|
435
441
|
}
|
|
436
442
|
declare const TextBox: ForwardRefExoticComponent<TextBoxProps & RefAttributes<HTMLElement>>;
|
|
437
443
|
|
|
438
|
-
export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, Chat, ChatMessage, Container, ContainerProps, DescriptionItem, DescriptionItemProps, DescriptionLineItem, DottedLine, EmailAutocomplete, EmailAutocompleteProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, FlagList, FlagListItem, LinkComponentProps, LinkedText, LinkedTextProps, MarginProp, MultilineText, MultilineTextProps, Navbar, NavbarAccordionOptions, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarBottomBarItem, NavbarItem, NavbarItemOptions, NavbarItemProps, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, NavbarMenuItemOption, PasswordStrength, Sidebar, SidebarBackButton, SidebarContainer, SidebarContainerProps, SidebarContent, SidebarContentProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes, useNavbarContext, useSidebarContext };
|
|
444
|
+
export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, Chat, ChatMessage, Container, ContainerProps, DescriptionItem, DescriptionItemProps, DescriptionLineItem, DottedLine, EmailAutocomplete, EmailAutocompleteProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, FlagList, FlagListItem, LinkComponentProps, LinkedText, LinkedTextProps, MarginProp, MultilineText, MultilineTextProps, Navbar, NavbarAccordion, NavbarAccordionLabel, NavbarAccordionOptions, NavbarAccordionProps, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarBottomBarItem, NavbarItem, NavbarItemOptions, NavbarItemProps, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, NavbarMenuItemOption, PasswordStrength, Sidebar, SidebarBackButton, SidebarContainer, SidebarContainerProps, SidebarContent, SidebarContentProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes, useNavbarContext, useSidebarContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CheckCircle, Info, Error as Error$1, WarningRounded, Image, Refresh, Delete, Warning, Flag, Help, Menu, ExpandMore, MenuOpen, Check, ArrowBack, OpenInNew } from '@material-ui/icons';
|
|
2
2
|
import { Alert as Alert$1, Autocomplete } from '@material-ui/lab';
|
|
3
3
|
import { ColorDynamic, parseResponsiveProp, isColorDynamicProp, parseSpaceProp, Stack, Color, Inline, mergeRefs, useUID, isEmptyReactNode, Columns, Column, Tag, CardButton, useResponsiveValue, ColorDark, useCollapseBreakpoint } from '@superdispatch/ui';
|
|
4
|
-
import { forwardRef, useState, useEffect, Children, useRef, useLayoutEffect, Suspense, memo, useContext, createContext, useMemo, createElement } from 'react';
|
|
4
|
+
import { forwardRef, useState, useEffect, Children, useRef, useLayoutEffect, Suspense, memo, useContext, createContext, useMemo, createElement, useCallback } 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';
|
|
@@ -902,7 +902,7 @@ var EmailAutocomplete = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
902
902
|
},
|
|
903
903
|
onChange: (_event, selectedValue, reason) => {
|
|
904
904
|
var emails = selectedValue.flatMap(item => item.split(',')).map(item => item.trim());
|
|
905
|
-
_onChange === null || _onChange === void 0
|
|
905
|
+
_onChange === null || _onChange === void 0 || _onChange(emails, reason);
|
|
906
906
|
},
|
|
907
907
|
renderTags: items => {
|
|
908
908
|
return /*#__PURE__*/jsx(Inline, {
|
|
@@ -937,13 +937,13 @@ var EmailAutocomplete = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
937
937
|
var text = event.target.value.replace(/,/g, '');
|
|
938
938
|
var hasCommaOrSpace = /,|\s/.test(event.target.value);
|
|
939
939
|
if (hasCommaOrSpace && text.trim() !== '') {
|
|
940
|
-
_onChange === null || _onChange === void 0
|
|
940
|
+
_onChange === null || _onChange === void 0 || _onChange([...(value || []), text.trim()], 'select-option');
|
|
941
941
|
}
|
|
942
942
|
},
|
|
943
943
|
onBlur: event => {
|
|
944
944
|
var text = event.target.value;
|
|
945
945
|
if (text.trim() !== '') {
|
|
946
|
-
_onChange === null || _onChange === void 0
|
|
946
|
+
_onChange === null || _onChange === void 0 || _onChange([...(value || []), text.trim()], 'select-option');
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
949
|
}))
|
|
@@ -1030,10 +1030,10 @@ var FileDropZone = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1030
1030
|
maxFiles: maxFiles,
|
|
1031
1031
|
disabled: disabled,
|
|
1032
1032
|
onDropAccepted: files => {
|
|
1033
|
-
_onDropAccepted === null || _onDropAccepted === void 0
|
|
1033
|
+
_onDropAccepted === null || _onDropAccepted === void 0 || _onDropAccepted(files);
|
|
1034
1034
|
},
|
|
1035
1035
|
onDropRejected: fileRejections => {
|
|
1036
|
-
_onDropRejected === null || _onDropRejected === void 0
|
|
1036
|
+
_onDropRejected === null || _onDropRejected === void 0 || _onDropRejected(fileRejections);
|
|
1037
1037
|
},
|
|
1038
1038
|
children: _ref3 => {
|
|
1039
1039
|
var {
|
|
@@ -1245,46 +1245,38 @@ var EndActions = /*#__PURE__*/styled.div.withConfig({
|
|
|
1245
1245
|
} = _ref2;
|
|
1246
1246
|
return theme.breakpoints.down('xs');
|
|
1247
1247
|
});
|
|
1248
|
-
var BannerListItemDanger = /*#__PURE__*/css(["& ", "{background:", ";color:", ";}&:hover{background:", ";}"], IconContainer, ColorDynamic.Red50, ColorDynamic.Red300, ColorDynamic.Red50);
|
|
1249
1248
|
var BannerListItemStandalone = /*#__PURE__*/css(["background:", ";"], ColorDynamic.Silver200);
|
|
1250
1249
|
var BannerListContainer = /*#__PURE__*/styled.div.withConfig({
|
|
1251
1250
|
displayName: "FlagListItem__BannerListContainer",
|
|
1252
1251
|
componentId: "SD__sc-o5bqru-4"
|
|
1253
|
-
})(["display:flex;align-items:center;gap:8px;padding:8px 16px 8px 12px;border:1px solid ", ";background:", ";cursor:default;transition:", ";& + &{border-top:none;}&:last-child{border-radius:0 0 4px 4px;}&:hover{background:", ";& ", "{background:", ";}
|
|
1252
|
+
})(["display:flex;align-items:center;gap:8px;padding:8px 16px 8px 12px;border:1px solid ", ";background:", ";cursor:default;transition:", ";& + &{border-top:none;}&:last-child{border-radius:0 0 4px 4px;}&:hover{background:", ";& ", "{background:", ";}}[data-variant='standalone'] &:not(:hover){", "}", "{flex-direction:column;align-items:flex-start;}"], ColorDynamic.Silver400, ColorDynamic.White, _ref3 => {
|
|
1254
1253
|
var {
|
|
1255
1254
|
theme
|
|
1256
1255
|
} = _ref3;
|
|
1257
1256
|
return theme.transitions.create(['color', 'background-color']);
|
|
1258
|
-
}, ColorDynamic.
|
|
1259
|
-
var {
|
|
1260
|
-
$variant
|
|
1261
|
-
} = _ref4;
|
|
1262
|
-
return $variant === 'danger' ? ColorDynamic.Red300 : ColorDynamic.Blue300;
|
|
1263
|
-
}, BannerListItemStandalone, _ref5 => {
|
|
1264
|
-
var {
|
|
1265
|
-
$variant
|
|
1266
|
-
} = _ref5;
|
|
1267
|
-
return $variant === 'danger' ? BannerListItemDanger : null;
|
|
1268
|
-
}, _ref6 => {
|
|
1257
|
+
}, ColorDynamic.Silver200, IconContainer, ColorDynamic.White, BannerListItemStandalone, _ref4 => {
|
|
1269
1258
|
var {
|
|
1270
1259
|
theme
|
|
1271
|
-
} =
|
|
1260
|
+
} = _ref4;
|
|
1272
1261
|
return theme.breakpoints.down('xs');
|
|
1273
1262
|
});
|
|
1274
|
-
var FlagListItem = /*#__PURE__*/forwardRef((
|
|
1263
|
+
var FlagListItem = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
1275
1264
|
var {
|
|
1276
1265
|
variant = 'primary',
|
|
1277
1266
|
showHelpIcon,
|
|
1278
1267
|
endAction,
|
|
1279
1268
|
children
|
|
1280
|
-
} =
|
|
1281
|
-
rest = _objectWithoutProperties(
|
|
1269
|
+
} = _ref5,
|
|
1270
|
+
rest = _objectWithoutProperties(_ref5, _excluded$7);
|
|
1282
1271
|
return /*#__PURE__*/jsxs(BannerListContainer, _objectSpread(_objectSpread({}, rest), {}, {
|
|
1283
1272
|
ref: ref,
|
|
1284
|
-
$variant: variant,
|
|
1285
1273
|
children: [/*#__PURE__*/jsxs(Content, {
|
|
1286
1274
|
children: [/*#__PURE__*/jsx(IconContainer, {
|
|
1287
|
-
children: variant === 'danger' ? /*#__PURE__*/jsx(Error$1, {
|
|
1275
|
+
children: variant === 'danger' ? /*#__PURE__*/jsx(Error$1, {
|
|
1276
|
+
htmlColor: ColorDynamic.Red300
|
|
1277
|
+
}) : variant === 'warning' ? /*#__PURE__*/jsx(Warning, {
|
|
1278
|
+
htmlColor: ColorDynamic.Yellow300
|
|
1279
|
+
}) : /*#__PURE__*/jsx(Flag, {})
|
|
1288
1280
|
}), children, /*#__PURE__*/jsx(HelpIcon, {
|
|
1289
1281
|
children: showHelpIcon && /*#__PURE__*/jsx(Help, {})
|
|
1290
1282
|
})]
|
|
@@ -1491,19 +1483,28 @@ function NavbarAccordion(_ref2) {
|
|
|
1491
1483
|
icon,
|
|
1492
1484
|
gutter,
|
|
1493
1485
|
items,
|
|
1494
|
-
onClick: _onClick
|
|
1486
|
+
onClick: _onClick,
|
|
1487
|
+
isExpanded: controlledIsExpanded,
|
|
1488
|
+
onExpandedChange
|
|
1495
1489
|
} = _ref2;
|
|
1496
1490
|
var uid = useUID();
|
|
1497
1491
|
var {
|
|
1498
1492
|
setDrawerOpen,
|
|
1499
1493
|
isNavbarExpanded
|
|
1500
1494
|
} = useNavbarContext();
|
|
1501
|
-
var [
|
|
1502
|
-
|
|
1503
|
-
// sync accordion state with Desktop menu state
|
|
1495
|
+
var [internalIsExpanded, setInternalExpanded] = useState(true);
|
|
1504
1496
|
useEffect(() => {
|
|
1505
|
-
|
|
1506
|
-
|
|
1497
|
+
if (controlledIsExpanded === undefined) {
|
|
1498
|
+
setInternalExpanded(isNavbarExpanded);
|
|
1499
|
+
}
|
|
1500
|
+
}, [isNavbarExpanded, controlledIsExpanded]);
|
|
1501
|
+
var isExpanded = controlledIsExpanded !== undefined ? controlledIsExpanded : internalIsExpanded;
|
|
1502
|
+
function setExpanded(value) {
|
|
1503
|
+
if (controlledIsExpanded === undefined) {
|
|
1504
|
+
setInternalExpanded(value);
|
|
1505
|
+
}
|
|
1506
|
+
onExpandedChange === null || onExpandedChange === void 0 || onExpandedChange(value);
|
|
1507
|
+
}
|
|
1507
1508
|
var filteredItems = useMemo(() => items.filter(item => !item.hide), [items]);
|
|
1508
1509
|
return /*#__PURE__*/jsxs(NavbarAccordionRoot, {
|
|
1509
1510
|
square: true,
|
|
@@ -1511,8 +1512,8 @@ function NavbarAccordion(_ref2) {
|
|
|
1511
1512
|
"aria-labelledby": uid,
|
|
1512
1513
|
expanded: isExpanded,
|
|
1513
1514
|
onClick: event => {
|
|
1514
|
-
_onClick === null || _onClick === void 0
|
|
1515
|
-
if (isNavbarExpanded) {
|
|
1515
|
+
_onClick === null || _onClick === void 0 || _onClick(event);
|
|
1516
|
+
if (controlledIsExpanded !== undefined || isNavbarExpanded) {
|
|
1516
1517
|
setExpanded(!isExpanded);
|
|
1517
1518
|
}
|
|
1518
1519
|
},
|
|
@@ -1541,7 +1542,7 @@ function NavbarAccordion(_ref2) {
|
|
|
1541
1542
|
onClick: event => {
|
|
1542
1543
|
var _item$onClick;
|
|
1543
1544
|
event.stopPropagation();
|
|
1544
|
-
(_item$onClick = item.onClick) === null || _item$onClick === void 0
|
|
1545
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item, event);
|
|
1545
1546
|
if (!event.isDefaultPrevented()) {
|
|
1546
1547
|
setDrawerOpen(false);
|
|
1547
1548
|
}
|
|
@@ -1665,7 +1666,7 @@ function NavbarList(_ref6) {
|
|
|
1665
1666
|
gutter: prev && prev.groupKey !== item.groupKey,
|
|
1666
1667
|
onClick: event => {
|
|
1667
1668
|
var _item$onClick;
|
|
1668
|
-
(_item$onClick = item.onClick) === null || _item$onClick === void 0
|
|
1669
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 || _item$onClick.call(item, event);
|
|
1669
1670
|
if (!event.isDefaultPrevented()) {
|
|
1670
1671
|
setDrawerOpen(false);
|
|
1671
1672
|
}
|
|
@@ -1694,7 +1695,9 @@ function Navbar(_ref) {
|
|
|
1694
1695
|
bottomItems,
|
|
1695
1696
|
children,
|
|
1696
1697
|
containerStyle,
|
|
1697
|
-
hasExtraBadge
|
|
1698
|
+
hasExtraBadge,
|
|
1699
|
+
isMenuExpanded: controlledIsMenuExpanded,
|
|
1700
|
+
onMenuExpandedChange
|
|
1698
1701
|
} = _ref;
|
|
1699
1702
|
var theme = useTheme();
|
|
1700
1703
|
var [isDrawerOpen, setDrawerOpen] = useState(false);
|
|
@@ -1703,7 +1706,14 @@ function Navbar(_ref) {
|
|
|
1703
1706
|
var matches = useMediaQuery(theme.breakpoints.up('md'), {
|
|
1704
1707
|
noSsr: true
|
|
1705
1708
|
});
|
|
1706
|
-
var [
|
|
1709
|
+
var [internalIsMenuExpanded, setInternalMenuExpanded] = useState(matches);
|
|
1710
|
+
var isMenuExpanded = controlledIsMenuExpanded !== undefined ? controlledIsMenuExpanded : internalIsMenuExpanded;
|
|
1711
|
+
var setMenuExpanded = useCallback(value => {
|
|
1712
|
+
if (controlledIsMenuExpanded === undefined) {
|
|
1713
|
+
setInternalMenuExpanded(value);
|
|
1714
|
+
}
|
|
1715
|
+
onMenuExpandedChange === null || onMenuExpandedChange === void 0 || onMenuExpandedChange(value);
|
|
1716
|
+
}, [controlledIsMenuExpanded, onMenuExpandedChange]);
|
|
1707
1717
|
var hasBadge = hasExtraBadge || items.some(item => item.badge);
|
|
1708
1718
|
var ctx = useMemo(() => ({
|
|
1709
1719
|
isDrawerOpen,
|
|
@@ -1711,7 +1721,7 @@ function Navbar(_ref) {
|
|
|
1711
1721
|
setDrawerOpen,
|
|
1712
1722
|
setMenuExpanded,
|
|
1713
1723
|
isNavbarExpanded: isMenuExpanded || isDrawerOpen
|
|
1714
|
-
}), [isDrawerOpen, isMenuExpanded,
|
|
1724
|
+
}), [isDrawerOpen, isMenuExpanded, setDrawerOpen, setMenuExpanded]);
|
|
1715
1725
|
return /*#__PURE__*/jsx(NavbarContext.Provider, {
|
|
1716
1726
|
value: ctx,
|
|
1717
1727
|
children: /*#__PURE__*/jsxs("div", {
|
|
@@ -2162,7 +2172,7 @@ function SidebarBackButton(_ref) {
|
|
|
2162
2172
|
return /*#__PURE__*/jsx(IconButton, _objectSpread(_objectSpread({}, props), {}, {
|
|
2163
2173
|
size: "small",
|
|
2164
2174
|
onClick: event => {
|
|
2165
|
-
_onClick === null || _onClick === void 0
|
|
2175
|
+
_onClick === null || _onClick === void 0 || _onClick(event);
|
|
2166
2176
|
if (!event.isDefaultPrevented()) {
|
|
2167
2177
|
openSidebar();
|
|
2168
2178
|
}
|
|
@@ -2358,7 +2368,7 @@ var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
2358
2368
|
disabled: disabled,
|
|
2359
2369
|
"aria-current": selected,
|
|
2360
2370
|
onClick: event => {
|
|
2361
|
-
_onClick === null || _onClick === void 0
|
|
2371
|
+
_onClick === null || _onClick === void 0 || _onClick(event);
|
|
2362
2372
|
if (!event.isDefaultPrevented() && openContentOnClick) {
|
|
2363
2373
|
openSidebarContent();
|
|
2364
2374
|
}
|
|
@@ -2472,7 +2482,7 @@ var SidebarMenuItemAvatar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
2472
2482
|
onMouseDown: stopPropagation,
|
|
2473
2483
|
onTouchStart: stopPropagation,
|
|
2474
2484
|
onChange: (_, checked) => {
|
|
2475
|
-
_onChange === null || _onChange === void 0
|
|
2485
|
+
_onChange === null || _onChange === void 0 || _onChange(checked);
|
|
2476
2486
|
}
|
|
2477
2487
|
})
|
|
2478
2488
|
});
|
|
@@ -2517,5 +2527,5 @@ var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
2517
2527
|
});
|
|
2518
2528
|
if (process.env.NODE_ENV !== "production") SidebarSubheader.displayName = "SidebarSubheader";
|
|
2519
2529
|
|
|
2520
|
-
export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, Chat, ChatMessage, Container, DescriptionItem, DescriptionLineItem, DottedLine, EmailAutocomplete, FileDropZone, FileListItem, FlagList, FlagListItem, LinkedText, MultilineText, Navbar, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarItem, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, PasswordStrength, Sidebar, SidebarBackButton, SidebarContainer, SidebarContent, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes, useNavbarContext, useSidebarContext };
|
|
2530
|
+
export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, Chat, ChatMessage, Container, DescriptionItem, DescriptionLineItem, DottedLine, EmailAutocomplete, FileDropZone, FileListItem, FlagList, FlagListItem, LinkedText, MultilineText, Navbar, NavbarAccordion, NavbarAccordionLabel, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarItem, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, PasswordStrength, Sidebar, SidebarBackButton, SidebarContainer, SidebarContent, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes, useNavbarContext, useSidebarContext };
|
|
2521
2531
|
//# sourceMappingURL=index.js.map
|