@superdispatch/ui-lab 0.20.1 → 0.20.2
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 +56 -27
- package/dist-node/index.js.map +1 -1
- package/dist-src/navbar/NavbarAccordion.js +2 -2
- package/dist-src/navbar/NavbarItem.js +1 -1
- package/dist-src/sidebar/SidebarContent.js +32 -17
- package/dist-src/sidebar/SidebarMenuItem.js +22 -8
- package/dist-web/index.js +56 -27
- package/dist-web/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,12 +20,12 @@ var NavbarAccordionRoot = /*#__PURE__*/styled(Accordion).withConfig({
|
|
|
20
20
|
var {
|
|
21
21
|
gutter
|
|
22
22
|
} = _ref;
|
|
23
|
-
return css(["width:100%;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;background-color:#1b2638;margin-top:", "
|
|
23
|
+
return css(["width:100%;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;background-color:#1b2638;margin-top:", ";&[aria-current]{background-color:#2f394a;color:", ";}&.MuiAccordion-root:before{background-color:#1b2638;}&.MuiPaper-elevation0{border:0px;}&.MuiAccordion-root.Mui-expanded{margin-top:", ";}"], gutter ? '16px' : '0', Color.White, gutter ? '16px' : '0');
|
|
24
24
|
});
|
|
25
25
|
var NavbarAccordionSummary = /*#__PURE__*/styled(AccordionSummary).withConfig({
|
|
26
26
|
displayName: "NavbarAccordion__NavbarAccordionSummary",
|
|
27
27
|
componentId: "SD__sc-1s7g3kw-2"
|
|
28
|
-
})(["border-left:4px solid transparent;padding-left:20px;&.MuiAccordionSummary-root{max-height:40px;min-height:40px;}&:hover,&[data-active='true']{border-left-color:", ";}&[data-expanded='false']{.MuiAccordionSummary-expandIcon{display:none;}}"], Color.Blue300);
|
|
28
|
+
})(["border-left:4px solid transparent;padding-left:20px;&.MuiAccordionSummary-root{max-height:40px;min-height:40px;}&:hover,&[data-active='true']{background-color:#2f394a;border-left-color:", ";}&[data-expanded='false']{.MuiAccordionSummary-expandIcon{display:none;}}"], Color.Blue300);
|
|
29
29
|
var IconWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
30
30
|
displayName: "NavbarAccordion__IconWrapper",
|
|
31
31
|
componentId: "SD__sc-1s7g3kw-3"
|
|
@@ -13,7 +13,7 @@ export var NavbarLabel = /*#__PURE__*/styled.span.withConfig({
|
|
|
13
13
|
var NavbarItemRoot = /*#__PURE__*/styled.div.withConfig({
|
|
14
14
|
displayName: "NavbarItem__NavbarItemRoot",
|
|
15
15
|
componentId: "SD__sc-1pvzq3w-2"
|
|
16
|
-
})(["width:100%;display:flex;align-items:center;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;padding:8px 16px;border-left:4px solid transparent;&:hover,&[aria-current]{background-color:#2f394a;color:", ";border-left-color:", ";}&[data-active='true']{border-left-color:", ";}"], Color.White, Color.Blue300, Color.Blue300);
|
|
16
|
+
})(["width:100%;display:flex;align-items:center;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;padding:8px 16px;border-left:4px solid transparent;&:hover,&[aria-current]{background-color:#2f394a;color:", ";border-left-color:", ";}&[data-active='true']{background-color:#2f394a;border-left-color:", ";}"], Color.White, Color.Blue300, Color.Blue300);
|
|
17
17
|
var IconWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
18
18
|
displayName: "NavbarItem__IconWrapper",
|
|
19
19
|
componentId: "SD__sc-1pvzq3w-3"
|
|
@@ -17,6 +17,10 @@ var SidebarAppBar = /*#__PURE__*/styled(AppBar).withConfig({
|
|
|
17
17
|
} = _ref;
|
|
18
18
|
return css(["", "{&&{border-left:transparent;}}"], theme.breakpoints.up('sm'));
|
|
19
19
|
});
|
|
20
|
+
var ToolbarContent = /*#__PURE__*/styled.div.withConfig({
|
|
21
|
+
displayName: "SidebarContent__ToolbarContent",
|
|
22
|
+
componentId: "SD__sc-zpgf61-1"
|
|
23
|
+
})(["flex:1;padding:16px;"]);
|
|
20
24
|
export function SidebarContent(_ref2) {
|
|
21
25
|
var {
|
|
22
26
|
dense,
|
|
@@ -61,23 +65,34 @@ export function SidebarContent(_ref2) {
|
|
|
61
65
|
space: "none",
|
|
62
66
|
children: [/*#__PURE__*/_jsx(SidebarAppBar, {
|
|
63
67
|
children: /*#__PURE__*/_jsx(Toolbar, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
children: /*#__PURE__*/_jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
children:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
disableGutters: true,
|
|
69
|
+
children: /*#__PURE__*/_jsx(ToolbarContent, {
|
|
70
|
+
children: /*#__PURE__*/_jsxs(Columns, {
|
|
71
|
+
align: ['top', 'center'],
|
|
72
|
+
space: "small",
|
|
73
|
+
children: [/*#__PURE__*/_jsx(Column, {
|
|
74
|
+
width: "content",
|
|
75
|
+
children: /*#__PURE__*/_jsx(SidebarBackButton, {
|
|
76
|
+
onClick: onBack
|
|
77
|
+
})
|
|
78
|
+
}), /*#__PURE__*/_jsx(Column, {
|
|
79
|
+
children: /*#__PURE__*/_jsxs(Columns, {
|
|
80
|
+
space: "small",
|
|
81
|
+
collapseBelow: "tablet",
|
|
82
|
+
reverse: [true, false],
|
|
83
|
+
align: ['bottom', 'center'],
|
|
84
|
+
children: [/*#__PURE__*/_jsx(Column, {
|
|
85
|
+
children: /*#__PURE__*/_jsx(TextBox, {
|
|
86
|
+
variant: "heading-2",
|
|
87
|
+
children: title
|
|
88
|
+
})
|
|
89
|
+
}), action && /*#__PURE__*/_jsx(Column, {
|
|
90
|
+
width: "content",
|
|
91
|
+
children: action
|
|
92
|
+
})]
|
|
93
|
+
})
|
|
94
|
+
})]
|
|
95
|
+
})
|
|
81
96
|
})
|
|
82
97
|
})
|
|
83
98
|
}), /*#__PURE__*/_jsx(Box, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonBase } from '@material-ui/core';
|
|
2
2
|
import { OpenInNew } from '@material-ui/icons';
|
|
3
|
-
import { Color, Column, Columns, Inline } from '@superdispatch/ui';
|
|
3
|
+
import { Color, Column, Columns, Inline, mergeRefs } from '@superdispatch/ui';
|
|
4
4
|
import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import { TextBox } from "../text-box/TextBox.js";
|
|
@@ -40,26 +40,40 @@ export var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
40
40
|
openContentOnClick
|
|
41
41
|
} = _ref2;
|
|
42
42
|
var [hovered, setHovered] = useState(false);
|
|
43
|
+
var rootRef = useRef(null);
|
|
43
44
|
var actionsRef = useRef(null);
|
|
44
45
|
var actionsPlaceholderRef = useRef(null);
|
|
45
46
|
var {
|
|
46
47
|
openSidebarContent
|
|
47
48
|
} = useSidebarContext();
|
|
49
|
+
var {
|
|
50
|
+
matches: isHoverSupported
|
|
51
|
+
} = matchMedia('(hover: hover)');
|
|
48
52
|
useLayoutEffect(() => {
|
|
49
53
|
if (actionsRef.current && actionsPlaceholderRef.current) {
|
|
50
54
|
actionsPlaceholderRef.current.style.width = "".concat(Math.max(0, actionsRef.current.offsetWidth - 8), "px");
|
|
51
55
|
}
|
|
52
56
|
});
|
|
57
|
+
useLayoutEffect(() => {
|
|
58
|
+
var rootNode = rootRef.current;
|
|
59
|
+
|
|
60
|
+
if (rootNode) {
|
|
61
|
+
if (isHoverSupported) {
|
|
62
|
+
rootNode.addEventListener('mouseenter', () => {
|
|
63
|
+
setHovered(true);
|
|
64
|
+
});
|
|
65
|
+
rootNode.addEventListener('mouseleave', () => {
|
|
66
|
+
setHovered(false);
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
setHovered(true);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, [isHoverSupported]);
|
|
53
73
|
var badge = !badgeProp || !Number.isFinite(badgeProp) ? null : badgeProp > 999 ? '999+' : badgeProp;
|
|
54
74
|
return /*#__PURE__*/_jsxs(SidebarMenuItemRoot, {
|
|
55
|
-
ref: ref,
|
|
75
|
+
ref: mergeRefs(ref, rootRef),
|
|
56
76
|
hasAvatar: !!avatar,
|
|
57
|
-
onMouseEnter: () => {
|
|
58
|
-
setHovered(true);
|
|
59
|
-
},
|
|
60
|
-
onMouseLeave: () => {
|
|
61
|
-
setHovered(false);
|
|
62
|
-
},
|
|
63
77
|
children: [/*#__PURE__*/_jsx(ButtonBase, {
|
|
64
78
|
disabled: disabled,
|
|
65
79
|
"aria-current": selected,
|
package/dist-web/index.js
CHANGED
|
@@ -1130,7 +1130,7 @@ var NavbarLabel = /*#__PURE__*/styled.span.withConfig({
|
|
|
1130
1130
|
var NavbarItemRoot = /*#__PURE__*/styled.div.withConfig({
|
|
1131
1131
|
displayName: "NavbarItem__NavbarItemRoot",
|
|
1132
1132
|
componentId: "SD__sc-1pvzq3w-2"
|
|
1133
|
-
})(["width:100%;display:flex;align-items:center;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;padding:8px 16px;border-left:4px solid transparent;&:hover,&[aria-current]{background-color:#2f394a;color:", ";border-left-color:", ";}&[data-active='true']{border-left-color:", ";}"], Color.White, Color.Blue300, Color.Blue300);
|
|
1133
|
+
})(["width:100%;display:flex;align-items:center;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;padding:8px 16px;border-left:4px solid transparent;&:hover,&[aria-current]{background-color:#2f394a;color:", ";border-left-color:", ";}&[data-active='true']{background-color:#2f394a;border-left-color:", ";}"], Color.White, Color.Blue300, Color.Blue300);
|
|
1134
1134
|
var IconWrapper$1 = /*#__PURE__*/styled.div.withConfig({
|
|
1135
1135
|
displayName: "NavbarItem__IconWrapper",
|
|
1136
1136
|
componentId: "SD__sc-1pvzq3w-3"
|
|
@@ -1180,12 +1180,12 @@ var NavbarAccordionRoot = /*#__PURE__*/styled(Accordion).withConfig({
|
|
|
1180
1180
|
var {
|
|
1181
1181
|
gutter
|
|
1182
1182
|
} = _ref;
|
|
1183
|
-
return css(["width:100%;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;background-color:#1b2638;margin-top:", "
|
|
1183
|
+
return css(["width:100%;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;background-color:#1b2638;margin-top:", ";&[aria-current]{background-color:#2f394a;color:", ";}&.MuiAccordion-root:before{background-color:#1b2638;}&.MuiPaper-elevation0{border:0px;}&.MuiAccordion-root.Mui-expanded{margin-top:", ";}"], gutter ? '16px' : '0', Color.White, gutter ? '16px' : '0');
|
|
1184
1184
|
});
|
|
1185
1185
|
var NavbarAccordionSummary = /*#__PURE__*/styled(AccordionSummary).withConfig({
|
|
1186
1186
|
displayName: "NavbarAccordion__NavbarAccordionSummary",
|
|
1187
1187
|
componentId: "SD__sc-1s7g3kw-2"
|
|
1188
|
-
})(["border-left:4px solid transparent;padding-left:20px;&.MuiAccordionSummary-root{max-height:40px;min-height:40px;}&:hover,&[data-active='true']{border-left-color:", ";}&[data-expanded='false']{.MuiAccordionSummary-expandIcon{display:none;}}"], Color.Blue300);
|
|
1188
|
+
})(["border-left:4px solid transparent;padding-left:20px;&.MuiAccordionSummary-root{max-height:40px;min-height:40px;}&:hover,&[data-active='true']{background-color:#2f394a;border-left-color:", ";}&[data-expanded='false']{.MuiAccordionSummary-expandIcon{display:none;}}"], Color.Blue300);
|
|
1189
1189
|
var IconWrapper$2 = /*#__PURE__*/styled.div.withConfig({
|
|
1190
1190
|
displayName: "NavbarAccordion__IconWrapper",
|
|
1191
1191
|
componentId: "SD__sc-1s7g3kw-3"
|
|
@@ -1727,6 +1727,10 @@ var SidebarAppBar = /*#__PURE__*/styled(AppBar).withConfig({
|
|
|
1727
1727
|
} = _ref;
|
|
1728
1728
|
return css(["", "{&&{border-left:transparent;}}"], theme.breakpoints.up('sm'));
|
|
1729
1729
|
});
|
|
1730
|
+
var ToolbarContent = /*#__PURE__*/styled.div.withConfig({
|
|
1731
|
+
displayName: "SidebarContent__ToolbarContent",
|
|
1732
|
+
componentId: "SD__sc-zpgf61-1"
|
|
1733
|
+
})(["flex:1;padding:16px;"]);
|
|
1730
1734
|
function SidebarContent(_ref2) {
|
|
1731
1735
|
var {
|
|
1732
1736
|
dense,
|
|
@@ -1771,23 +1775,34 @@ function SidebarContent(_ref2) {
|
|
|
1771
1775
|
space: "none",
|
|
1772
1776
|
children: [/*#__PURE__*/jsx(SidebarAppBar, {
|
|
1773
1777
|
children: /*#__PURE__*/jsx(Toolbar, {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
children: /*#__PURE__*/jsx(
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
children:
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1778
|
+
disableGutters: true,
|
|
1779
|
+
children: /*#__PURE__*/jsx(ToolbarContent, {
|
|
1780
|
+
children: /*#__PURE__*/jsxs(Columns, {
|
|
1781
|
+
align: ['top', 'center'],
|
|
1782
|
+
space: "small",
|
|
1783
|
+
children: [/*#__PURE__*/jsx(Column, {
|
|
1784
|
+
width: "content",
|
|
1785
|
+
children: /*#__PURE__*/jsx(SidebarBackButton, {
|
|
1786
|
+
onClick: onBack
|
|
1787
|
+
})
|
|
1788
|
+
}), /*#__PURE__*/jsx(Column, {
|
|
1789
|
+
children: /*#__PURE__*/jsxs(Columns, {
|
|
1790
|
+
space: "small",
|
|
1791
|
+
collapseBelow: "tablet",
|
|
1792
|
+
reverse: [true, false],
|
|
1793
|
+
align: ['bottom', 'center'],
|
|
1794
|
+
children: [/*#__PURE__*/jsx(Column, {
|
|
1795
|
+
children: /*#__PURE__*/jsx(TextBox, {
|
|
1796
|
+
variant: "heading-2",
|
|
1797
|
+
children: title
|
|
1798
|
+
})
|
|
1799
|
+
}), action && /*#__PURE__*/jsx(Column, {
|
|
1800
|
+
width: "content",
|
|
1801
|
+
children: action
|
|
1802
|
+
})]
|
|
1803
|
+
})
|
|
1804
|
+
})]
|
|
1805
|
+
})
|
|
1791
1806
|
})
|
|
1792
1807
|
})
|
|
1793
1808
|
}), /*#__PURE__*/jsx(Box, {
|
|
@@ -1861,26 +1876,40 @@ var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
1861
1876
|
openContentOnClick
|
|
1862
1877
|
} = _ref2;
|
|
1863
1878
|
var [hovered, setHovered] = useState(false);
|
|
1879
|
+
var rootRef = useRef(null);
|
|
1864
1880
|
var actionsRef = useRef(null);
|
|
1865
1881
|
var actionsPlaceholderRef = useRef(null);
|
|
1866
1882
|
var {
|
|
1867
1883
|
openSidebarContent
|
|
1868
1884
|
} = useSidebarContext();
|
|
1885
|
+
var {
|
|
1886
|
+
matches: isHoverSupported
|
|
1887
|
+
} = matchMedia('(hover: hover)');
|
|
1869
1888
|
useLayoutEffect(() => {
|
|
1870
1889
|
if (actionsRef.current && actionsPlaceholderRef.current) {
|
|
1871
1890
|
actionsPlaceholderRef.current.style.width = "".concat(Math.max(0, actionsRef.current.offsetWidth - 8), "px");
|
|
1872
1891
|
}
|
|
1873
1892
|
});
|
|
1893
|
+
useLayoutEffect(() => {
|
|
1894
|
+
var rootNode = rootRef.current;
|
|
1895
|
+
|
|
1896
|
+
if (rootNode) {
|
|
1897
|
+
if (isHoverSupported) {
|
|
1898
|
+
rootNode.addEventListener('mouseenter', () => {
|
|
1899
|
+
setHovered(true);
|
|
1900
|
+
});
|
|
1901
|
+
rootNode.addEventListener('mouseleave', () => {
|
|
1902
|
+
setHovered(false);
|
|
1903
|
+
});
|
|
1904
|
+
} else {
|
|
1905
|
+
setHovered(true);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}, [isHoverSupported]);
|
|
1874
1909
|
var badge = !badgeProp || !Number.isFinite(badgeProp) ? null : badgeProp > 999 ? '999+' : badgeProp;
|
|
1875
1910
|
return /*#__PURE__*/jsxs(SidebarMenuItemRoot, {
|
|
1876
|
-
ref: ref,
|
|
1911
|
+
ref: mergeRefs(ref, rootRef),
|
|
1877
1912
|
hasAvatar: !!avatar,
|
|
1878
|
-
onMouseEnter: () => {
|
|
1879
|
-
setHovered(true);
|
|
1880
|
-
},
|
|
1881
|
-
onMouseLeave: () => {
|
|
1882
|
-
setHovered(false);
|
|
1883
|
-
},
|
|
1884
1913
|
children: [/*#__PURE__*/jsx(ButtonBase, {
|
|
1885
1914
|
disabled: disabled,
|
|
1886
1915
|
"aria-current": selected,
|