@superdispatch/ui-lab 0.25.3 → 0.26.0

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.
Files changed (35) hide show
  1. package/dist-node/index.js +118 -201
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/alert/Alert.js +0 -4
  4. package/dist-src/banner/Banner.js +11 -14
  5. package/dist-src/box/Box.js +18 -19
  6. package/dist-src/button/Button.js +22 -37
  7. package/dist-src/button-area/ButtonArea.js +9 -11
  8. package/dist-src/chat/Chat.js +0 -2
  9. package/dist-src/chat/ChatMessage.js +1 -2
  10. package/dist-src/container/Container.js +3 -7
  11. package/dist-src/description-item/DescriptionItem.js +1 -4
  12. package/dist-src/description-line-item/DescriptionLineItem.js +1 -2
  13. package/dist-src/file-drop-zone/FileDropZone.js +26 -31
  14. package/dist-src/file-list-item/FileListItem.js +1 -4
  15. package/dist-src/linked-text/LinkedText.js +10 -13
  16. package/dist-src/navbar/Navbar.js +1 -2
  17. package/dist-src/navbar/NavbarAccordion.js +4 -8
  18. package/dist-src/navbar/NavbarAvatar.js +6 -10
  19. package/dist-src/navbar/NavbarBottomBar.js +6 -9
  20. package/dist-src/navbar/NavbarItem.js +1 -2
  21. package/dist-src/navbar/NavbarList.js +2 -8
  22. package/dist-src/navbar/NavbarMenu.js +1 -6
  23. package/dist-src/sidebar/Sidebar.js +1 -2
  24. package/dist-src/sidebar/SidebarBackButton.js +6 -10
  25. package/dist-src/sidebar/SidebarContainer.js +1 -4
  26. package/dist-src/sidebar/SidebarContent.js +1 -2
  27. package/dist-src/sidebar/SidebarMenuItem.js +1 -4
  28. package/dist-src/sidebar/SidebarMenuItemAvatar.js +0 -4
  29. package/dist-src/sidebar/SidebarSubheader.js +1 -2
  30. package/dist-src/text-box/TextBox.js +9 -23
  31. package/dist-src/utils/RuleNormalizer.js +0 -3
  32. package/dist-src/utils/mergeStyles.js +0 -3
  33. package/dist-web/index.js +118 -201
  34. package/dist-web/index.js.map +1 -1
  35. package/package.json +3 -3
@@ -5,30 +5,26 @@ import { Avatar, Typography } from '@material-ui/core';
5
5
  import { Color, Column, Columns, Stack } from '@superdispatch/ui';
6
6
  import styled from 'styled-components';
7
7
  import { useNavbarContext } from "./NavbarContext.js";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
9
  var StyledTypography = /*#__PURE__*/styled(Typography).withConfig({
11
10
  displayName: "NavbarAvatar__StyledTypography",
12
11
  componentId: "SD__sc-19q2zd0-0"
13
12
  })(["color:", ";text-overflow:ellipsis;white-space:nowrap;overflow:hidden;&:hover{color:", ";}"], Color.Silver500, Color.White);
14
13
  export function NavbarAvatar(_ref) {
15
14
  var {
16
- title,
17
- subtitle,
18
- children
19
- } = _ref,
20
- props = _objectWithoutProperties(_ref, _excluded);
21
-
15
+ title,
16
+ subtitle,
17
+ children
18
+ } = _ref,
19
+ props = _objectWithoutProperties(_ref, _excluded);
22
20
  var {
23
21
  isNavbarExpanded
24
22
  } = useNavbarContext();
25
-
26
23
  if (!isNavbarExpanded) {
27
24
  return /*#__PURE__*/_jsx(Avatar, _objectSpread(_objectSpread({}, props), {}, {
28
25
  children: children
29
26
  }));
30
27
  }
31
-
32
28
  return /*#__PURE__*/_jsxs(Columns, {
33
29
  space: "xsmall",
34
30
  align: "center",
@@ -4,12 +4,10 @@ var _excluded = ["active", "hasBadge"];
4
4
  import { BottomNavigation, BottomNavigationAction } from '@material-ui/core';
5
5
  import { Menu } from '@material-ui/icons';
6
6
  import { Color } from '@superdispatch/ui';
7
- import { useMemo } from 'react';
7
+ import { useMemo, createElement as _createElement } from 'react';
8
8
  import styled from 'styled-components';
9
9
  import { useNavbarContext } from "./NavbarContext.js";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { jsxs as _jsxs } from "react/jsx-runtime";
12
- import { createElement as _createElement } from "react";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
11
  var StyledBottomNavigation = /*#__PURE__*/styled(BottomNavigation).withConfig({
14
12
  displayName: "NavbarBottomBar__StyledBottomNavigation",
15
13
  componentId: "SD__sc-9z6v3k-0"
@@ -50,11 +48,10 @@ export function NavbarBottomBar(_ref) {
50
48
  },
51
49
  children: [items.map(_ref2 => {
52
50
  var {
53
- active,
54
- hasBadge
55
- } = _ref2,
56
- item = _objectWithoutProperties(_ref2, _excluded);
57
-
51
+ active,
52
+ hasBadge
53
+ } = _ref2,
54
+ item = _objectWithoutProperties(_ref2, _excluded);
58
55
  return /*#__PURE__*/_createElement(StyledBottomNavigationAction, _objectSpread(_objectSpread({}, item), {}, {
59
56
  key: item.value,
60
57
  icon: hasBadge ? /*#__PURE__*/_jsxs(IconWrapper, {
@@ -1,7 +1,6 @@
1
1
  import { Color, useUID } from '@superdispatch/ui';
2
2
  import styled from 'styled-components';
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
4
  export var NavbarBadge = /*#__PURE__*/styled.span.withConfig({
6
5
  displayName: "NavbarItem__NavbarBadge",
7
6
  componentId: "SD__sc-1pvzq3w-0"
@@ -2,14 +2,12 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
2
  import { IconButton } from '@material-ui/core';
3
3
  import { Menu as MenuIcon, MenuOpen } from '@material-ui/icons';
4
4
  import { Color, Inline, useResponsiveValue } from '@superdispatch/ui';
5
- import { useMemo } from 'react';
5
+ import { useMemo, createElement as _createElement } from 'react';
6
6
  import styled from 'styled-components';
7
7
  import { NavbarAccordion } from "./NavbarAccordion.js";
8
8
  import { useNavbarContext } from "./NavbarContext.js";
9
9
  import { NavbarBadge, NavbarItem, NavbarLabel } from "./NavbarItem.js";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { jsxs as _jsxs } from "react/jsx-runtime";
12
- import { createElement as _createElement } from "react";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
11
  var Header = /*#__PURE__*/styled.div.withConfig({
14
12
  displayName: "NavbarList__Header",
15
13
  componentId: "SD__sc-19zrmxc-0"
@@ -107,7 +105,6 @@ export function NavbarList(_ref5) {
107
105
  children: filteredItems.map(item => {
108
106
  var index = filteredItems.indexOf(item);
109
107
  var prev = filteredItems[index - 1];
110
-
111
108
  if ('items' in item) {
112
109
  return /*#__PURE__*/_createElement(NavbarAccordion, _objectSpread(_objectSpread({}, item), {}, {
113
110
  key: item.key,
@@ -115,15 +112,12 @@ export function NavbarList(_ref5) {
115
112
  onClick: item.onClick
116
113
  }));
117
114
  }
118
-
119
115
  return /*#__PURE__*/_createElement(NavbarItem, _objectSpread(_objectSpread({}, item), {}, {
120
116
  key: item.key,
121
117
  gutter: prev && prev.groupKey !== item.groupKey,
122
118
  onClick: event => {
123
119
  var _item$onClick;
124
-
125
120
  (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
126
-
127
121
  if (!event.isDefaultPrevented()) {
128
122
  setDrawerOpen(false);
129
123
  }
@@ -3,9 +3,7 @@ import { Color, Inline } from '@superdispatch/ui';
3
3
  import { useState } from 'react';
4
4
  import styled from 'styled-components';
5
5
  import { useNavbarContext } from "./NavbarContext.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- import { jsxs as _jsxs } from "react/jsx-runtime";
8
- import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
7
  var Divider = /*#__PURE__*/styled.div.withConfig({
10
8
  displayName: "NavbarMenu__Divider",
11
9
  componentId: "SD__sc-1c8icpt-0"
@@ -32,16 +30,13 @@ export function NavbarMenu(_ref2) {
32
30
  setDrawerOpen
33
31
  } = useNavbarContext();
34
32
  var [anchor, setAnchor] = useState(null);
35
-
36
33
  function showProfileMenu(event) {
37
34
  setAnchor(event.currentTarget);
38
35
  }
39
-
40
36
  function hideProfileMenu() {
41
37
  setAnchor(null);
42
38
  setDrawerOpen(false);
43
39
  }
44
-
45
40
  return /*#__PURE__*/_jsxs(_Fragment, {
46
41
  children: [/*#__PURE__*/_jsx(Wrapper, {
47
42
  onClick: showProfileMenu,
@@ -2,8 +2,7 @@ import { Color, Column, Columns, useUID } from '@superdispatch/ui';
2
2
  import { forwardRef } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { TextBox } from "../text-box/TextBox.js";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
6
  var SidebarRoot = /*#__PURE__*/styled.aside.withConfig({
8
7
  displayName: "Sidebar__SidebarRoot",
9
8
  componentId: "SD__sc-b77o22-0"
@@ -8,27 +8,23 @@ import { useSidebarContext } from "./SidebarContainer.js";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  export function SidebarBackButton(_ref) {
10
10
  var {
11
- onClick: _onClick,
12
- children = /*#__PURE__*/_jsx(ArrowBack, {
13
- fontSize: "small"
14
- })
15
- } = _ref,
16
- props = _objectWithoutProperties(_ref, _excluded);
17
-
11
+ onClick: _onClick,
12
+ children = /*#__PURE__*/_jsx(ArrowBack, {
13
+ fontSize: "small"
14
+ })
15
+ } = _ref,
16
+ props = _objectWithoutProperties(_ref, _excluded);
18
17
  var isCollapsed = useCollapseBreakpoint('sm');
19
18
  var {
20
19
  openSidebar
21
20
  } = useSidebarContext();
22
-
23
21
  if (!isCollapsed) {
24
22
  return null;
25
23
  }
26
-
27
24
  return /*#__PURE__*/_jsx(IconButton, _objectSpread(_objectSpread({}, props), {}, {
28
25
  size: "small",
29
26
  onClick: event => {
30
27
  _onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
31
-
32
28
  if (!event.isDefaultPrevented()) {
33
29
  openSidebar();
34
30
  }
@@ -1,16 +1,13 @@
1
1
  import { useCollapseBreakpoint } from '@superdispatch/ui';
2
2
  import { createContext, forwardRef, useContext, useMemo, useState } from 'react';
3
3
  import styled from 'styled-components';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
5
  var Context = /*#__PURE__*/createContext(null);
7
6
  export function useSidebarContext() {
8
7
  var context = useContext(Context);
9
-
10
8
  if (!context) {
11
9
  throw new Error('SidebarContext is used outside Provider');
12
10
  }
13
-
14
11
  return context;
15
12
  }
16
13
  var SidebarContainerSidebar = /*#__PURE__*/styled.div.withConfig({
@@ -6,8 +6,7 @@ import { Box } from "../box/Box.js";
6
6
  import { TextBox } from "../text-box/TextBox.js";
7
7
  import { SidebarBackButton } from "./SidebarBackButton.js";
8
8
  import { useSidebarContext } from "./SidebarContainer.js";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
10
  var SidebarAppBar = /*#__PURE__*/styled(AppBar).withConfig({
12
11
  displayName: "SidebarContent__SidebarAppBar",
13
12
  componentId: "SD__sc-zpgf61-0"
@@ -6,8 +6,7 @@ import styled, { css } from 'styled-components';
6
6
  import { TextBox } from "../text-box/TextBox.js";
7
7
  import { useSidebarContext } from "./SidebarContainer.js";
8
8
  import { SidebarMenuItemContextProvider } from "./SidebarMenuItemContext.js";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
10
  var SidebarMenuItemRoot = /*#__PURE__*/styled.div.withConfig({
12
11
  displayName: "SidebarMenuItem__SidebarMenuItemRoot",
13
12
  componentId: "SD__sc-1sb5zqa-0"
@@ -56,7 +55,6 @@ export var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
56
55
  });
57
56
  useLayoutEffect(() => {
58
57
  var rootNode = rootRef.current;
59
-
60
58
  if (rootNode) {
61
59
  if (isHoverSupported) {
62
60
  rootNode.addEventListener('mouseenter', () => {
@@ -79,7 +77,6 @@ export var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
79
77
  "aria-current": selected,
80
78
  onClick: event => {
81
79
  _onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
82
-
83
80
  if (!event.isDefaultPrevented() && openContentOnClick) {
84
81
  openSidebarContent();
85
82
  }
@@ -3,11 +3,9 @@ import { forwardRef, useMemo } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { useSidebarMenuItemContext } from "./SidebarMenuItemContext.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
-
7
6
  function stopPropagation(event) {
8
7
  event.stopPropagation();
9
8
  }
10
-
11
9
  var SidebarMenuItemAvatarCheckbox = /*#__PURE__*/styled.div.withConfig({
12
10
  displayName: "SidebarMenuItemAvatar__SidebarMenuItemAvatarCheckbox",
13
11
  componentId: "SD__sc-17mkvc7-0"
@@ -28,7 +26,6 @@ export var SidebarMenuItemAvatar = /*#__PURE__*/forwardRef((_ref, ref) => {
28
26
  var last = matches.pop() || '';
29
27
  return (first + last).toUpperCase();
30
28
  }, [children]);
31
-
32
29
  if (value === true || hovered && value != null) {
33
30
  return /*#__PURE__*/_jsx(SidebarMenuItemAvatarCheckbox, {
34
31
  children: /*#__PURE__*/_jsx(Checkbox, {
@@ -44,7 +41,6 @@ export var SidebarMenuItemAvatar = /*#__PURE__*/forwardRef((_ref, ref) => {
44
41
  })
45
42
  });
46
43
  }
47
-
48
44
  return /*#__PURE__*/_jsx(Avatar, {
49
45
  ref: ref,
50
46
  "aria-hidden": true,
@@ -2,8 +2,7 @@ import { Column, Columns } from '@superdispatch/ui';
2
2
  import { forwardRef } from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { TextBox } from "../text-box/TextBox.js";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
6
  var SidebarSubheaderRoot = /*#__PURE__*/styled.div.withConfig({
8
7
  displayName: "SidebarSubheader__SidebarSubheaderRoot",
9
8
  componentId: "SD__sc-1r0xx76-0"
@@ -31,36 +31,27 @@ var VARIANT_TYPE_MAPPING = {
31
31
  'body-semibold': 'span',
32
32
  caption: 'span'
33
33
  };
34
-
35
34
  function variantMixin(_ref, variant) {
36
35
  var {
37
36
  typography,
38
37
  breakpoints
39
38
  } = _ref;
40
-
41
39
  switch (variant) {
42
40
  case 'heading-1':
43
41
  return typography.h1;
44
-
45
42
  case 'heading-2':
46
43
  return typography.h2;
47
-
48
44
  case 'heading-3':
49
45
  return typography.h3;
50
-
51
46
  case 'heading-4':
52
47
  return typography.h4;
53
-
54
48
  case 'heading-5':
55
49
  return typography.h5;
56
-
57
50
  case 'heading-6':
58
51
  return typography.h6;
59
-
60
52
  case 'body':
61
53
  default:
62
54
  return typography.body2;
63
-
64
55
  case 'body-block':
65
56
  {
66
57
  return mergeStyles({}, typography.body2, {
@@ -70,19 +61,15 @@ function variantMixin(_ref, variant) {
70
61
  }
71
62
  });
72
63
  }
73
-
74
64
  case 'body-semibold':
75
65
  return typography.body1;
76
-
77
66
  case 'caption':
78
67
  return typography.caption;
79
68
  }
80
69
  }
81
-
82
70
  function textBoxMixin(noWrap, align, color, display, wrapOverflow) {
83
71
  return css(["text-align:", ";color:", ";display:", ";overflow:", ";white-space:", ";overflow-wrap:", ";"], align, normalizeTextColor(color), display === 'initial' && (noWrap || align !== 'left') ? 'block' : display, noWrap ? 'hidden' : 'visible', noWrap ? 'nowrap' : 'normal', wrapOverflow ? 'break-word' : 'normal');
84
72
  }
85
-
86
73
  var TextBoxRoot = /*#__PURE__*/styled.span.withConfig({
87
74
  displayName: "TextBox__TextBoxRoot",
88
75
  componentId: "SD__sc-9mywck-0"
@@ -100,16 +87,15 @@ var TextBoxRoot = /*#__PURE__*/styled.span.withConfig({
100
87
  });
101
88
  export var TextBox = /*#__PURE__*/forwardRef((_ref3, ref) => {
102
89
  var {
103
- variant: $variant = 'body',
104
- as = VARIANT_TYPE_MAPPING[$variant],
105
- align = 'left',
106
- color = 'primary',
107
- display = 'initial',
108
- noWrap = false,
109
- wrapOverflow = false
110
- } = _ref3,
111
- props = _objectWithoutProperties(_ref3, _excluded);
112
-
90
+ variant: $variant = 'body',
91
+ as = VARIANT_TYPE_MAPPING[$variant],
92
+ align = 'left',
93
+ color = 'primary',
94
+ display = 'initial',
95
+ noWrap = false,
96
+ wrapOverflow = false
97
+ } = _ref3,
98
+ props = _objectWithoutProperties(_ref3, _excluded);
113
99
  var $align = parseResponsiveProp(align);
114
100
  var $color = parseResponsiveProp(color);
115
101
  var $noWrap = parseResponsiveProp(noWrap);
@@ -2,16 +2,13 @@ export function createRuleNormalizer(rules) {
2
2
  return input => {
3
3
  if (typeof input == 'string') {
4
4
  var value = rules[input];
5
-
6
5
  if (typeof value == 'number') {
7
6
  return "".concat(value, "px");
8
7
  }
9
-
10
8
  if (typeof value == 'string') {
11
9
  return value;
12
10
  }
13
11
  }
14
-
15
12
  return undefined;
16
13
  };
17
14
  }
@@ -2,14 +2,12 @@ export function mergeStyles(styles) {
2
2
  for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3
3
  sources[_key - 1] = arguments[_key];
4
4
  }
5
-
6
5
  for (var source of sources) {
7
6
  if (source) {
8
7
  for (var key in source) {
9
8
  if (Object.prototype.hasOwnProperty.call(source, key)) {
10
9
  var stylesValue = styles[key];
11
10
  var sourceValue = source[key];
12
-
13
11
  if (typeof stylesValue == 'object' && typeof sourceValue == 'object') {
14
12
  mergeStyles(stylesValue, sourceValue);
15
13
  } else {
@@ -19,6 +17,5 @@ export function mergeStyles(styles) {
19
17
  }
20
18
  }
21
19
  }
22
-
23
20
  return styles;
24
21
  }