@superdispatch/ui-lab 0.20.1 → 0.20.4

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.
@@ -1137,7 +1137,7 @@ var NavbarLabel = /*#__PURE__*/styled__default.span.withConfig({
1137
1137
  var NavbarItemRoot = /*#__PURE__*/styled__default.div.withConfig({
1138
1138
  displayName: "NavbarItem__NavbarItemRoot",
1139
1139
  componentId: "SD__sc-1pvzq3w-2"
1140
- })(["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:", ";}"], ui.Color.White, ui.Color.Blue300, ui.Color.Blue300);
1140
+ })(["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],&[data-active='true']{color:", ";background-color:#2f394a;border-left-color:", ";}"], ui.Color.White, ui.Color.Blue300);
1141
1141
  var IconWrapper$1 = /*#__PURE__*/styled__default.div.withConfig({
1142
1142
  displayName: "NavbarItem__IconWrapper",
1143
1143
  componentId: "SD__sc-1pvzq3w-3"
@@ -1187,12 +1187,12 @@ var NavbarAccordionRoot = /*#__PURE__*/styled__default(core.Accordion).withConfi
1187
1187
  var {
1188
1188
  gutter
1189
1189
  } = _ref;
1190
- return styled.css(["width:100%;color:#c2c4c9;font-size:14px;font-weight:400;line-height:20px;text-decoration:none;outline:none;cursor:pointer;background-color:#1b2638;margin-top:", ";&:hover,&[aria-current]{background-color:#2f394a;color:", ";}&.MuiAccordion-root:before{background-color:#1b2638;}&.MuiPaper-elevation0{border:0px;}&&.MuiAccordionSummary-root.Mui-expanded{margin-top:", ";max-height:40px;min-height:40px;}"], gutter ? '16px' : '0', ui.Color.White, gutter ? '16px' : '0');
1190
+ return styled.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', ui.Color.White, gutter ? '16px' : '0');
1191
1191
  });
1192
1192
  var NavbarAccordionSummary = /*#__PURE__*/styled__default(core.AccordionSummary).withConfig({
1193
1193
  displayName: "NavbarAccordion__NavbarAccordionSummary",
1194
1194
  componentId: "SD__sc-1s7g3kw-2"
1195
- })(["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;}}"], ui.Color.Blue300);
1195
+ })(["border-left:4px solid transparent;padding-left:20px;&.MuiAccordionSummary-root{max-height:40px;min-height:40px;}&.MuiAccordionSummary-content{align-items:center;}&:hover,&[aria-current],&[data-active='true']{color:", ";background-color:#2f394a;border-left-color:", ";}&[data-expanded='false']{.MuiAccordionSummary-expandIcon{display:none;}}"], ui.Color.White, ui.Color.Blue300);
1196
1196
  var IconWrapper$2 = /*#__PURE__*/styled__default.div.withConfig({
1197
1197
  displayName: "NavbarAccordion__IconWrapper",
1198
1198
  componentId: "SD__sc-1s7g3kw-3"
@@ -1243,9 +1243,12 @@ function NavbarAccordion(_ref2) {
1243
1243
  }), items.map(item => {
1244
1244
  var index = items.indexOf(item);
1245
1245
  var prev = items[index - 1];
1246
+ var {
1247
+ ident = 0
1248
+ } = item;
1246
1249
  return /*#__PURE__*/react.createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
1247
1250
  key: item.key,
1248
- ident: 1,
1251
+ ident: ident + 1,
1249
1252
  active: item.active,
1250
1253
  gutter: prev && prev.groupKey !== item.groupKey,
1251
1254
  onClick: event => {
@@ -1734,6 +1737,10 @@ var SidebarAppBar = /*#__PURE__*/styled__default(core.AppBar).withConfig({
1734
1737
  } = _ref;
1735
1738
  return styled.css(["", "{&&{border-left:transparent;}}"], theme.breakpoints.up('sm'));
1736
1739
  });
1740
+ var ToolbarContent = /*#__PURE__*/styled__default.div.withConfig({
1741
+ displayName: "SidebarContent__ToolbarContent",
1742
+ componentId: "SD__sc-zpgf61-1"
1743
+ })(["flex:1;padding:16px;"]);
1737
1744
  function SidebarContent(_ref2) {
1738
1745
  var {
1739
1746
  dense,
@@ -1778,23 +1785,34 @@ function SidebarContent(_ref2) {
1778
1785
  space: "none",
1779
1786
  children: [/*#__PURE__*/jsxRuntime.jsx(SidebarAppBar, {
1780
1787
  children: /*#__PURE__*/jsxRuntime.jsx(core.Toolbar, {
1781
- children: /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1782
- align: "center",
1783
- space: "small",
1784
- children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1785
- width: "content",
1786
- children: /*#__PURE__*/jsxRuntime.jsx(SidebarBackButton, {
1787
- onClick: onBack
1788
- })
1789
- }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1790
- children: /*#__PURE__*/jsxRuntime.jsx(TextBox, {
1791
- variant: "heading-2",
1792
- children: title
1793
- })
1794
- }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1795
- width: "content",
1796
- children: action
1797
- })]
1788
+ disableGutters: true,
1789
+ children: /*#__PURE__*/jsxRuntime.jsx(ToolbarContent, {
1790
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1791
+ align: ['top', 'center'],
1792
+ space: "small",
1793
+ children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1794
+ width: "content",
1795
+ children: /*#__PURE__*/jsxRuntime.jsx(SidebarBackButton, {
1796
+ onClick: onBack
1797
+ })
1798
+ }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1799
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1800
+ space: "small",
1801
+ collapseBelow: "tablet",
1802
+ reverse: [true, false],
1803
+ align: ['bottom', 'center'],
1804
+ children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1805
+ children: /*#__PURE__*/jsxRuntime.jsx(TextBox, {
1806
+ variant: "heading-2",
1807
+ children: title
1808
+ })
1809
+ }), action && /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1810
+ width: "content",
1811
+ children: action
1812
+ })]
1813
+ })
1814
+ })]
1815
+ })
1798
1816
  })
1799
1817
  })
1800
1818
  }), /*#__PURE__*/jsxRuntime.jsx(Box, {
@@ -1868,26 +1886,40 @@ var SidebarMenuItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
1868
1886
  openContentOnClick
1869
1887
  } = _ref2;
1870
1888
  var [hovered, setHovered] = react.useState(false);
1889
+ var rootRef = react.useRef(null);
1871
1890
  var actionsRef = react.useRef(null);
1872
1891
  var actionsPlaceholderRef = react.useRef(null);
1873
1892
  var {
1874
1893
  openSidebarContent
1875
1894
  } = useSidebarContext();
1895
+ var {
1896
+ matches: isHoverSupported
1897
+ } = matchMedia('(hover: hover)');
1876
1898
  react.useLayoutEffect(() => {
1877
1899
  if (actionsRef.current && actionsPlaceholderRef.current) {
1878
1900
  actionsPlaceholderRef.current.style.width = "".concat(Math.max(0, actionsRef.current.offsetWidth - 8), "px");
1879
1901
  }
1880
1902
  });
1903
+ react.useLayoutEffect(() => {
1904
+ var rootNode = rootRef.current;
1905
+
1906
+ if (rootNode) {
1907
+ if (isHoverSupported) {
1908
+ rootNode.addEventListener('mouseenter', () => {
1909
+ setHovered(true);
1910
+ });
1911
+ rootNode.addEventListener('mouseleave', () => {
1912
+ setHovered(false);
1913
+ });
1914
+ } else {
1915
+ setHovered(true);
1916
+ }
1917
+ }
1918
+ }, [isHoverSupported]);
1881
1919
  var badge = !badgeProp || !Number.isFinite(badgeProp) ? null : badgeProp > 999 ? '999+' : badgeProp;
1882
1920
  return /*#__PURE__*/jsxRuntime.jsxs(SidebarMenuItemRoot, {
1883
- ref: ref,
1921
+ ref: ui.mergeRefs(ref, rootRef),
1884
1922
  hasAvatar: !!avatar,
1885
- onMouseEnter: () => {
1886
- setHovered(true);
1887
- },
1888
- onMouseLeave: () => {
1889
- setHovered(false);
1890
- },
1891
1923
  children: [/*#__PURE__*/jsxRuntime.jsx(core.ButtonBase, {
1892
1924
  disabled: disabled,
1893
1925
  "aria-current": selected,