@superdispatch/ui-lab 0.20.5 → 0.21.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.
@@ -163,7 +163,8 @@ function parseMargin(input) {
163
163
 
164
164
  var normalizeBorderRadius = /*#__PURE__*/createRuleNormalizer({
165
165
  none: 0,
166
- small: 4
166
+ small: 4,
167
+ medium: 8
167
168
  });
168
169
  var normalizeBorderWidth = /*#__PURE__*/createRuleNormalizer({
169
170
  none: 0,
@@ -929,6 +930,7 @@ var FileListItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
929
930
  url,
930
931
  name,
931
932
  status,
933
+ canDelete = true,
932
934
  onRetry,
933
935
  onDelete
934
936
  } = _ref2;
@@ -944,6 +946,7 @@ var FileListItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
944
946
  onMouseLeave: () => {
945
947
  setIsHovered(false);
946
948
  },
949
+ "aria-label": "file-list-item",
947
950
  children: /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
948
951
  align: "center",
949
952
  space: "xsmall",
@@ -994,19 +997,22 @@ var FileListItem = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
994
997
  children: /*#__PURE__*/jsxRuntime.jsx(FileListItemProgress, {
995
998
  size: "1em"
996
999
  })
997
- }) : /*#__PURE__*/jsxRuntime.jsx(core.Tooltip, {
1000
+ }) : !isHovered && status === 'success' ? /*#__PURE__*/jsxRuntime.jsx(core.IconButton, {
1001
+ size: "small",
1002
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.CheckCircle, {
1003
+ fontSize: "small",
1004
+ htmlColor: ui.Color.Green300
1005
+ })
1006
+ }) : canDelete ? /*#__PURE__*/jsxRuntime.jsx(core.Tooltip, {
998
1007
  title: "Delete",
999
1008
  children: /*#__PURE__*/jsxRuntime.jsx(core.IconButton, {
1000
1009
  size: "small",
1001
1010
  onClick: onDelete,
1002
- children: !isHovered && status === 'success' ? /*#__PURE__*/jsxRuntime.jsx(icons.CheckCircle, {
1003
- fontSize: "small",
1004
- htmlColor: ui.Color.Green300
1005
- }) : /*#__PURE__*/jsxRuntime.jsx(icons.Delete, {
1011
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.Delete, {
1006
1012
  fontSize: "small"
1007
1013
  })
1008
1014
  })
1009
- })
1015
+ }) : null
1010
1016
  })]
1011
1017
  })
1012
1018
  });
@@ -1061,8 +1067,9 @@ MultilineText.displayName = 'MultilineText';
1061
1067
 
1062
1068
  var NavbarContext = /*#__PURE__*/react.createContext({
1063
1069
  isDrawerOpen: false,
1064
- isExpanded: false,
1065
- setIsExpanded: lodash.noop,
1070
+ isMenuExpanded: false,
1071
+ isNavbarExpanded: false,
1072
+ setMenuExpanded: lodash.noop,
1066
1073
  setDrawerOpen: lodash.noop
1067
1074
  });
1068
1075
  function useNavbarContext() {
@@ -1207,37 +1214,35 @@ function NavbarAccordion(_ref2) {
1207
1214
  } = _ref2;
1208
1215
  var uid = ui.useUID();
1209
1216
  var {
1210
- isExpanded: isMenuExpanded,
1211
- isDrawerOpen,
1212
- setDrawerOpen
1217
+ setDrawerOpen,
1218
+ isNavbarExpanded
1213
1219
  } = useNavbarContext();
1214
- var [isExpanded, setExpanded] = react.useState(false);
1220
+ var [isExpanded, setExpanded] = react.useState(true); // sync accordion state with Desktop menu state
1221
+
1215
1222
  react.useEffect(() => {
1216
- if (!isMenuExpanded) {
1217
- setExpanded(false);
1218
- }
1219
- }, [isMenuExpanded]);
1223
+ setExpanded(isNavbarExpanded);
1224
+ }, [isNavbarExpanded]);
1220
1225
  return /*#__PURE__*/jsxRuntime.jsxs(NavbarAccordionRoot, {
1221
- "aria-labelledby": uid,
1226
+ square: true,
1222
1227
  gutter: !!gutter,
1228
+ "aria-labelledby": uid,
1223
1229
  expanded: isExpanded,
1224
1230
  onClick: event => {
1225
- if (isMenuExpanded || isDrawerOpen) {
1231
+ _onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
1232
+
1233
+ if (isNavbarExpanded) {
1226
1234
  setExpanded(!isExpanded);
1227
1235
  }
1228
-
1229
- _onClick(event);
1230
1236
  },
1231
- square: true,
1232
1237
  children: [/*#__PURE__*/jsxRuntime.jsxs(NavbarAccordionSummary, {
1233
1238
  "data-active": !isExpanded && items.some(item => item.active),
1234
- "data-expanded": isMenuExpanded || isDrawerOpen,
1239
+ "data-expanded": isNavbarExpanded,
1235
1240
  expandIcon: /*#__PURE__*/jsxRuntime.jsx(icons.ExpandMore, {}),
1236
1241
  children: [/*#__PURE__*/jsxRuntime.jsx(IconWrapper$2, {
1237
1242
  children: icon
1238
1243
  }), /*#__PURE__*/jsxRuntime.jsx(NavbarAccordionLabel, {
1239
1244
  id: uid,
1240
- "data-expanded": isMenuExpanded || isDrawerOpen,
1245
+ "data-expanded": isNavbarExpanded,
1241
1246
  children: label
1242
1247
  })]
1243
1248
  }), items.map(item => {
@@ -1333,12 +1338,12 @@ function NavbarList(_ref5) {
1333
1338
  var platform = ui.useResponsiveValue('mobile', 'tablet', 'desktop');
1334
1339
  var isMobile = platform === 'mobile';
1335
1340
  var {
1336
- isExpanded,
1341
+ isMenuExpanded,
1337
1342
  isDrawerOpen,
1338
1343
  setDrawerOpen,
1339
- setIsExpanded
1344
+ setMenuExpanded
1340
1345
  } = useNavbarContext();
1341
- var isSidebarOpened = isMobile ? isDrawerOpen : isExpanded;
1346
+ var isSidebarOpened = isMobile ? isDrawerOpen : isMenuExpanded;
1342
1347
  var filteredItems = react.useMemo(() => items.filter(item => {
1343
1348
  return !item.hide && (isSidebarOpened || !!item.icon);
1344
1349
  }).map(item => _objectSpread(_objectSpread({}, item), {}, {
@@ -1350,13 +1355,13 @@ function NavbarList(_ref5) {
1350
1355
  children: [/*#__PURE__*/jsxRuntime.jsxs(Header, {
1351
1356
  children: [isSidebarOpened && header, !isMobile && /*#__PURE__*/jsxRuntime.jsx(ExpandIconButton, {
1352
1357
  disableRipple: true,
1353
- style: isExpanded ? {
1358
+ style: isMenuExpanded ? {
1354
1359
  paddingRight: 0
1355
1360
  } : {},
1356
1361
  onClick: () => {
1357
- setIsExpanded(!isExpanded);
1362
+ setMenuExpanded(!isMenuExpanded);
1358
1363
  },
1359
- children: isExpanded ? /*#__PURE__*/jsxRuntime.jsx(icons.MenuOpen, {}) : /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {})
1364
+ children: isMenuExpanded ? /*#__PURE__*/jsxRuntime.jsx(icons.MenuOpen, {}) : /*#__PURE__*/jsxRuntime.jsx(icons.Menu, {})
1360
1365
  })]
1361
1366
  }), /*#__PURE__*/jsxRuntime.jsx(Content, {
1362
1367
  "aria-expanded": isSidebarOpened,
@@ -1417,14 +1422,15 @@ function Navbar(_ref) {
1417
1422
  var matches = core.useMediaQuery(theme.breakpoints.up('md'), {
1418
1423
  noSsr: true
1419
1424
  });
1420
- var [isExpanded, setIsExpanded] = react.useState(matches);
1425
+ var [isMenuExpanded, setMenuExpanded] = react.useState(matches);
1421
1426
  var hasBadge = hasExtraBadge || items.some(item => item.badge);
1422
1427
  var ctx = react.useMemo(() => ({
1423
1428
  isDrawerOpen,
1424
- isExpanded,
1425
- setIsExpanded,
1426
- setDrawerOpen
1427
- }), [isDrawerOpen, isExpanded, setIsExpanded, setDrawerOpen]);
1429
+ isMenuExpanded,
1430
+ setDrawerOpen,
1431
+ setMenuExpanded,
1432
+ isNavbarExpanded: isMenuExpanded || isDrawerOpen
1433
+ }), [isDrawerOpen, isMenuExpanded, setMenuExpanded, setDrawerOpen]);
1428
1434
  return /*#__PURE__*/jsxRuntime.jsx(NavbarContext.Provider, {
1429
1435
  value: ctx,
1430
1436
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -1480,37 +1486,36 @@ function NavbarAvatar(_ref) {
1480
1486
  props = _objectWithoutProperties(_ref, _excluded$7);
1481
1487
 
1482
1488
  var {
1483
- isExpanded,
1484
- isDrawerOpen
1489
+ isNavbarExpanded
1485
1490
  } = useNavbarContext();
1486
1491
 
1487
- if (isExpanded || isDrawerOpen) {
1488
- return /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1489
- space: "xsmall",
1490
- align: "center",
1491
- children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1492
- width: "content",
1493
- children: /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1494
- children: children
1495
- }))
1496
- }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1497
- children: /*#__PURE__*/jsxRuntime.jsxs(ui.Stack, {
1498
- space: "none",
1499
- children: [/*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1500
- variant: "caption",
1501
- children: title
1502
- }), /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1503
- variant: "caption",
1504
- children: subtitle
1505
- })]
1506
- })
1507
- })]
1508
- });
1492
+ if (!isNavbarExpanded) {
1493
+ return /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1494
+ children: children
1495
+ }));
1509
1496
  }
1510
1497
 
1511
- return /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1512
- children: children
1513
- }));
1498
+ return /*#__PURE__*/jsxRuntime.jsxs(ui.Columns, {
1499
+ space: "xsmall",
1500
+ align: "center",
1501
+ children: [/*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1502
+ width: "content",
1503
+ children: /*#__PURE__*/jsxRuntime.jsx(core.Avatar, _objectSpread(_objectSpread({}, props), {}, {
1504
+ children: children
1505
+ }))
1506
+ }), /*#__PURE__*/jsxRuntime.jsx(ui.Column, {
1507
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Stack, {
1508
+ space: "none",
1509
+ children: [/*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1510
+ variant: "caption",
1511
+ children: title
1512
+ }), /*#__PURE__*/jsxRuntime.jsx(StyledTypography, {
1513
+ variant: "caption",
1514
+ children: subtitle
1515
+ })]
1516
+ })
1517
+ })]
1518
+ });
1514
1519
  }
1515
1520
 
1516
1521
  var Divider = /*#__PURE__*/styled__default.div.withConfig({