@superdispatch/ui 0.14.0 → 0.16.0-alpha.1

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 (56) hide show
  1. package/dist-node/index.js +1436 -1382
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/adaptive-toolbar/AdaptiveToolbar.js +12 -12
  4. package/dist-src/app-bar/AppBarOverrides.js +6 -4
  5. package/dist-src/autocomplete/AutocompleteOverrides.js +13 -16
  6. package/dist-src/avatar/AvatarOverrides.js +14 -12
  7. package/dist-src/avatar-button/AvatarButton.js +78 -92
  8. package/dist-src/button/Button.js +11 -15
  9. package/dist-src/button/ButtonOverrides.js +147 -149
  10. package/dist-src/card/CardOverrides.js +10 -6
  11. package/dist-src/card-button/CardButton.js +78 -75
  12. package/dist-src/checkbox/CheckboxField.js +1 -1
  13. package/dist-src/checkbox/CheckboxGroudField.js +1 -1
  14. package/dist-src/checkbox/CheckboxOverrides.js +60 -50
  15. package/dist-src/chip/ChipOverrides.js +88 -85
  16. package/dist-src/description-list/DescriptionList.js +58 -55
  17. package/dist-src/dialog/DialogOverrides.js +31 -25
  18. package/dist-src/drawer/DrawerActions.js +32 -34
  19. package/dist-src/drawer/DrawerContent.js +10 -26
  20. package/dist-src/drawer/DrawerList.js +8 -27
  21. package/dist-src/drawer/DrawerOverrides.js +12 -10
  22. package/dist-src/drawer/DrawerTitle.js +46 -40
  23. package/dist-src/grid/GridStack.js +1 -1
  24. package/dist-src/grid/InlineGrid.js +2 -2
  25. package/dist-src/icon-button/IconButtonOverrides.js +48 -32
  26. package/dist-src/index.js +0 -2
  27. package/dist-src/info-card/InfoCard.js +28 -48
  28. package/dist-src/link/LinkOverrides.js +29 -26
  29. package/dist-src/list/ListOverrides.js +10 -7
  30. package/dist-src/menu/MenuOverrides.js +28 -14
  31. package/dist-src/overflow-text/OverflowText.js +35 -34
  32. package/dist-src/pagination/PaginationOverrides.js +27 -32
  33. package/dist-src/paper/PaperOverrides.js +8 -6
  34. package/dist-src/radio/RadioField.js +1 -1
  35. package/dist-src/radio/RadioGroupField.js +1 -1
  36. package/dist-src/radio/RadioOverrides.js +38 -36
  37. package/dist-src/responsive/ResponsiveContext.js +1 -1
  38. package/dist-src/snackbar/Snackbar.js +1 -1
  39. package/dist-src/snackbar/SnackbarContent.js +3 -3
  40. package/dist-src/snackbar/SnackbarOverrides.js +28 -18
  41. package/dist-src/svg-icon/SvgIconOverrides.js +26 -18
  42. package/dist-src/switch/SwitchOverrides.js +72 -71
  43. package/dist-src/tabs/TabsOverrides.js +34 -30
  44. package/dist-src/tag/Tag.js +2 -2
  45. package/dist-src/text-field/TextFieldOverrides.js +158 -137
  46. package/dist-src/theme/CssBaselineOverrides.js +8 -0
  47. package/dist-src/theme/ThemeProvider.js +25 -28
  48. package/dist-src/tiles/Tiles.js +4 -3
  49. package/dist-src/toolbar/ToolbarOverrides.js +10 -8
  50. package/dist-src/tooltip/TooltipOverrides.js +33 -30
  51. package/dist-src/typography/TypographyOverrides.js +14 -2
  52. package/dist-src/utils/mergeRefs.js +10 -7
  53. package/dist-types/index.d.ts +31 -39
  54. package/dist-web/index.js +1387 -1331
  55. package/dist-web/index.js.map +1 -1
  56. package/package.json +9 -3
@@ -1,10 +1,13 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
4
  var _excluded = ["items"];
5
+
6
+ var _templateObject;
7
+
4
8
  import { ResizeObserver } from '@juggle/resize-observer';
5
- import { Grid, Menu, MenuItem, Toolbar, Typography } from '@material-ui/core';
6
- import { MoreHoriz } from '@material-ui/icons';
7
- import { makeStyles } from '@material-ui/styles';
9
+ import { MoreHoriz } from '@mui/icons-material';
10
+ import { Grid, Menu, MenuItem, styled, Toolbar, Typography } from '@mui/material';
8
11
  import { useEventHandler } from '@superdispatch/hooks';
9
12
  import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
10
13
  import { Button } from "../button/Button.js";
@@ -29,20 +32,15 @@ function useResizeObserver(node, observer) {
29
32
  }, [node, handler]);
30
33
  }
31
34
 
32
- var useStyles = /*#__PURE__*/makeStyles({
33
- actions: {
34
- overflow: 'hidden'
35
- }
36
- }, {
35
+ var GridActionsItem = /*#__PURE__*/styled(Grid, {
37
36
  name: 'SD-AdaptiveToolbar'
38
- });
37
+ })(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteral(["\n overflow: hidden;\n"])));
39
38
  export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
40
39
  var {
41
40
  items
42
41
  } = _ref,
43
42
  props = _objectWithoutProperties(_ref, _excluded);
44
43
 
45
- var styles = useStyles();
46
44
  var itemNodes = useRef([]);
47
45
  var optionsButtonRef = useRef(null);
48
46
  var [firstHiddenIdx, setFirstHiddenIdx] = useState(-1);
@@ -85,9 +83,8 @@ export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
85
83
  spacing: 1,
86
84
  wrap: "nowrap",
87
85
  ref: setRootNode,
88
- children: [/*#__PURE__*/_jsx(Grid, {
86
+ children: [/*#__PURE__*/_jsx(GridActionsItem, {
89
87
  item: true,
90
- className: styles.actions,
91
88
  children: /*#__PURE__*/_jsx(Grid, {
92
89
  container: true,
93
90
  spacing: 1,
@@ -100,6 +97,8 @@ export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
100
97
  },
101
98
  children: /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
102
99
  type: "button",
100
+ color: "primary",
101
+ variant: "outlined",
103
102
  onClick: item.onClick
104
103
  }, item.ButtonProps), {}, {
105
104
  children: /*#__PURE__*/_jsx(Typography, {
@@ -116,6 +115,7 @@ export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
116
115
  component: "div",
117
116
  children: [/*#__PURE__*/_jsx(Button, {
118
117
  type: "button",
118
+ variant: "outlined",
119
119
  onClick: _ref2 => {
120
120
  var {
121
121
  currentTarget
@@ -1,7 +1,9 @@
1
1
  export function overrideAppBar(theme) {
2
- theme.props.MuiAppBar = {
3
- elevation: 0,
4
- color: 'inherit',
5
- position: 'static'
2
+ theme.components.MuiAppBar = {
3
+ defaultProps: {
4
+ elevation: 0,
5
+ color: 'inherit',
6
+ position: 'static'
7
+ }
6
8
  };
7
9
  }
@@ -1,21 +1,18 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import { SvgIcon } from '@material-ui/core';
2
+ import { autocompleteClasses, SvgIcon } from '@mui/material';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  export function overrideAutocomplete(theme) {
5
- var sm = theme.breakpoints.up('sm'); // Remove `Object.assign` after official release of `Autocomplete`.
6
-
7
- Object.assign(theme.props, {
8
- MuiAutocomplete: {
5
+ var sm = theme.breakpoints.up('sm');
6
+ theme.components.MuiAutocomplete = {
7
+ defaultProps: {
9
8
  popupIcon: /*#__PURE__*/_jsx(SvgIcon, {
10
9
  children: /*#__PURE__*/_jsx("path", {
11
10
  d: "M12 16.5L6 9h12l-6 7.5z",
12
11
  fill: "currentColor"
13
12
  })
14
13
  })
15
- }
16
- });
17
- Object.assign(theme.overrides, {
18
- MuiAutocomplete: {
14
+ },
15
+ styleOverrides: {
19
16
  paper: _objectSpread({}, theme.typography.body2),
20
17
  tag: {
21
18
  margin: '4px',
@@ -40,27 +37,27 @@ export function overrideAutocomplete(theme) {
40
37
  inputRoot: {
41
38
  '&[class*="MuiOutlinedInput-root"]': {
42
39
  padding: '6px 8px',
43
- '& $input': {
40
+ ["& .".concat(autocompleteClasses.input)]: {
44
41
  width: '144px',
45
42
  padding: '4px'
46
43
  },
47
- '& $input:first-child': {
48
- paddingLeft: undefined
44
+ ["& .".concat(autocompleteClasses.input, ":first-child")]: {
45
+ paddingLeft: 'unset'
49
46
  },
50
- '& $endAdornment': {
47
+ ["& .".concat(autocompleteClasses.endAdornment)]: {
51
48
  right: '12px'
52
49
  },
53
50
  [sm]: {
54
51
  padding: theme.spacing(0.5, 0.75),
55
- '& $input': {
52
+ ["& .".concat(autocompleteClasses.input)]: {
56
53
  padding: '2px'
57
54
  },
58
- '& $endAdornment': {
55
+ ["& .".concat(autocompleteClasses.endAdornment)]: {
59
56
  right: '8px'
60
57
  }
61
58
  }
62
59
  }
63
60
  }
64
61
  }
65
- });
62
+ };
66
63
  }
@@ -1,19 +1,21 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
2
  import { Color } from "../theme/Color.js";
3
3
  export function overrideAvatar(theme) {
4
- theme.overrides.MuiAvatar = {
5
- root: _objectSpread(_objectSpread({}, theme.typography.h5), {}, {
6
- textTransform: 'uppercase',
7
- width: theme.spacing(5),
8
- height: theme.spacing(5),
9
- [theme.breakpoints.up('sm')]: {
10
- width: theme.spacing(4),
11
- height: theme.spacing(4)
4
+ theme.components.MuiAvatar = {
5
+ styleOverrides: {
6
+ root: _objectSpread(_objectSpread({}, theme.typography.h5), {}, {
7
+ textTransform: 'uppercase',
8
+ width: theme.spacing(5),
9
+ height: theme.spacing(5),
10
+ [theme.breakpoints.up('sm')]: {
11
+ width: theme.spacing(4),
12
+ height: theme.spacing(4)
13
+ }
14
+ }),
15
+ colorDefault: {
16
+ color: Color.Dark300,
17
+ backgroundColor: Color.Silver300
12
18
  }
13
- }),
14
- colorDefault: {
15
- color: Color.Dark300,
16
- backgroundColor: Color.Silver300
17
19
  }
18
20
  };
19
21
  }
@@ -1,72 +1,83 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
- var _excluded = ["size", "icon", "isLoading", "classes", "disabled", "avatarRef", "className", "alt", "imgProps", "sizes", "src", "srcSet", "variant", "children"],
4
- _excluded2 = ["button", "overlay", "progress", "withIcon", "sizeLarge"];
5
- import { Avatar, ButtonBase, CircularProgress } from '@material-ui/core';
6
- import { makeStyles } from '@material-ui/styles';
7
- import clsx from 'clsx';
3
+ var _excluded = ["size", "icon", "isLoading", "disabled", "avatarRef", "alt", "imgProps", "sizes", "src", "srcSet", "variant", "children"];
4
+ import { Avatar, ButtonBase, CircularProgress, styled } from '@mui/material';
8
5
  import { forwardRef } from 'react';
9
6
  import { Color } from "../theme/Color.js";
10
7
  import { jsx as _jsx } from "react/jsx-runtime";
11
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
- var useStyles = /*#__PURE__*/makeStyles(theme => {
9
+ var Overlay = /*#__PURE__*/styled('div')(_ref => {
10
+ var {
11
+ theme
12
+ } = _ref;
13
13
  var sm = theme.breakpoints.up('sm');
14
14
  return {
15
- button: {
16
- borderRadius: '50%',
17
- '&[disabled], &[aria-busy="true"]': {
18
- '& > $overlay': {
19
- backgroundColor: Color.White50
20
- }
21
- },
22
- '&:not([disabled])[aria-busy="false"]': {
23
- '&:hover, &:focus': {
24
- '&$withIcon > $overlay': {
25
- backgroundColor: Color.Black50,
26
- '& > svg': {
27
- opacity: 1
28
- }
29
- },
30
- '&:not($withIcon) > $overlay': {
31
- backgroundColor: Color.Black20
32
- }
33
- }
15
+ top: 0,
16
+ left: 0,
17
+ right: 0,
18
+ bottom: 0,
19
+ position: 'absolute',
20
+ display: 'flex',
21
+ alignItems: 'center',
22
+ justifyContent: 'center',
23
+ borderRadius: '50%',
24
+ backgroundColor: Color.Transparent,
25
+ transition: theme.transitions.create('background-color'),
26
+ '& > svg': {
27
+ opacity: 0,
28
+ color: Color.White,
29
+ transition: theme.transitions.create('opacity'),
30
+ fontSize: theme.spacing(3),
31
+ [sm]: {
32
+ fontSize: theme.spacing(2)
34
33
  }
35
- },
36
- overlay: {
37
- top: 0,
38
- left: 0,
39
- right: 0,
40
- bottom: 0,
41
- position: 'absolute',
42
- display: 'flex',
43
- alignItems: 'center',
44
- justifyContent: 'center',
45
- borderRadius: '50%',
46
- backgroundColor: Color.Transparent,
47
- transition: theme.transitions.create('background-color'),
48
- '& > svg': {
49
- opacity: 0,
50
- color: Color.White,
51
- transition: theme.transitions.create('opacity'),
52
- fontSize: theme.spacing(3),
53
- [sm]: {
54
- fontSize: theme.spacing(2)
55
- }
34
+ }
35
+ };
36
+ });
37
+ var StyledProgress = /*#__PURE__*/styled(CircularProgress)(_ref2 => {
38
+ var {
39
+ theme
40
+ } = _ref2;
41
+ var sm = theme.breakpoints.up('sm');
42
+ return {
43
+ top: 0,
44
+ left: 0,
45
+ position: 'absolute',
46
+ fontSize: theme.spacing(5),
47
+ [sm]: {
48
+ fontSize: theme.spacing(4)
49
+ }
50
+ };
51
+ });
52
+ var StyledButton = /*#__PURE__*/styled(ButtonBase, {
53
+ name: 'SD-AvatarButton'
54
+ })(_ref3 => {
55
+ var {
56
+ theme
57
+ } = _ref3;
58
+ var sm = theme.breakpoints.up('sm');
59
+ return {
60
+ borderRadius: '50%',
61
+ '&[disabled], &[aria-busy="true"]': {
62
+ ["& > ".concat(Overlay)]: {
63
+ backgroundColor: Color.White50
56
64
  }
57
65
  },
58
- progress: {
59
- top: 0,
60
- left: 0,
61
- position: 'absolute',
62
- fontSize: theme.spacing(5),
63
- [sm]: {
64
- fontSize: theme.spacing(4)
66
+ '&:not([disabled])[aria-busy="false"]': {
67
+ '&:hover, &:focus': {
68
+ ["&[data-with-icon=\"true\"] > ".concat(Overlay)]: {
69
+ backgroundColor: Color.Black50,
70
+ '& > svg': {
71
+ opacity: 1
72
+ }
73
+ },
74
+ ["&:not([data-with-icon=\"true\"]) > ".concat(Overlay)]: {
75
+ backgroundColor: Color.Black20
76
+ }
65
77
  }
66
78
  },
67
- withIcon: {},
68
- sizeLarge: {
69
- '& > $root': _objectSpread(_objectSpread({}, theme.typography.h2), {}, {
79
+ '&[data-size-large="true"]': {
80
+ '& > .MuiAvatar-root': _objectSpread(_objectSpread({}, theme.typography.h2), {}, {
70
81
  width: theme.spacing(7),
71
82
  height: theme.spacing(7),
72
83
  [sm]: {
@@ -74,8 +85,8 @@ var useStyles = /*#__PURE__*/makeStyles(theme => {
74
85
  height: theme.spacing(8)
75
86
  }
76
87
  }),
77
- '& > $overlay': {
78
- '& > $progress': {
88
+ ["& > ".concat(Overlay)]: {
89
+ ["& > ".concat(StyledProgress)]: {
79
90
  fontSize: theme.spacing(7),
80
91
  [sm]: {
81
92
  fontSize: theme.spacing(8)
@@ -88,27 +99,16 @@ var useStyles = /*#__PURE__*/makeStyles(theme => {
88
99
  }
89
100
  }
90
101
  }
91
- },
92
- root: {},
93
- colorDefault: {},
94
- circular: {},
95
- rounded: {},
96
- square: {},
97
- img: {},
98
- fallback: {}
102
+ }
99
103
  };
100
- }, {
101
- name: 'SD-AvatarButton'
102
104
  });
103
- export var AvatarButton = /*#__PURE__*/forwardRef((_ref, ref) => {
105
+ export var AvatarButton = /*#__PURE__*/forwardRef((_ref4, ref) => {
104
106
  var {
105
107
  size,
106
108
  icon,
107
109
  isLoading = false,
108
- classes,
109
110
  disabled = false,
110
111
  avatarRef,
111
- className,
112
112
  alt,
113
113
  imgProps,
114
114
  sizes,
@@ -116,30 +116,18 @@ export var AvatarButton = /*#__PURE__*/forwardRef((_ref, ref) => {
116
116
  srcSet,
117
117
  variant,
118
118
  children
119
- } = _ref,
120
- props = _objectWithoutProperties(_ref, _excluded);
121
-
122
- var _useStyles = useStyles({
123
- classes
124
- }),
125
- {
126
- button: buttonClassName,
127
- overlay: overlayClassName,
128
- progress: progressClassName,
129
- withIcon: withIconClassName,
130
- sizeLarge: sizeLargeClassName
131
- } = _useStyles,
132
- avatarClasses = _objectWithoutProperties(_useStyles, _excluded2);
119
+ } = _ref4,
120
+ props = _objectWithoutProperties(_ref4, _excluded);
133
121
 
134
- return /*#__PURE__*/_jsxs(ButtonBase, _objectSpread(_objectSpread({}, props), {}, {
122
+ return /*#__PURE__*/_jsxs(StyledButton, _objectSpread(_objectSpread({}, props), {}, {
135
123
  ref: ref,
136
124
  "aria-busy": isLoading,
137
125
  "aria-disabled": disabled,
138
126
  disabled: disabled || isLoading,
139
- className: clsx(className, buttonClassName, !!icon && withIconClassName, size === 'large' && sizeLargeClassName),
127
+ "data-with-icon": !!icon,
128
+ "data-size-large": size === 'large',
140
129
  children: [/*#__PURE__*/_jsx(Avatar, {
141
130
  ref: avatarRef,
142
- classes: avatarClasses,
143
131
  variant: variant,
144
132
  alt: alt,
145
133
  src: src,
@@ -147,11 +135,9 @@ export var AvatarButton = /*#__PURE__*/forwardRef((_ref, ref) => {
147
135
  srcSet: srcSet,
148
136
  imgProps: imgProps,
149
137
  children: children
150
- }), /*#__PURE__*/_jsxs("div", {
151
- className: overlayClassName,
152
- children: [icon, isLoading && /*#__PURE__*/_jsx(CircularProgress, {
138
+ }), /*#__PURE__*/_jsxs(Overlay, {
139
+ children: [icon, isLoading && /*#__PURE__*/_jsx(StyledProgress, {
153
140
  size: "1em",
154
- className: progressClassName,
155
141
  thickness: size === 'large' ? 2.5 : 1.5
156
142
  })]
157
143
  })]
@@ -1,36 +1,32 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["size", "children", "disabled", "isActive", "isLoading", "color"];
4
- import { Button as MaterialButton, CircularProgress } from '@material-ui/core';
3
+ var _excluded = ["size", "children", "isActive", "isLoading", "color"];
4
+ import { LoadingButton } from '@mui/lab';
5
+ import { CircularProgress } from '@mui/material';
5
6
  import { forwardRef } from 'react';
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
- import { Fragment as _Fragment } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
8
  export var Button = /*#__PURE__*/forwardRef((_ref, ref) => {
10
9
  var {
11
10
  size,
12
11
  children,
13
- disabled,
14
12
  isActive,
15
13
  isLoading,
16
14
  color = 'primary'
17
15
  } = _ref,
18
16
  props = _objectWithoutProperties(_ref, _excluded);
19
17
 
20
- return /*#__PURE__*/_jsx(MaterialButton, _objectSpread(_objectSpread({}, props), {}, {
18
+ return /*#__PURE__*/_jsx(LoadingButton, _objectSpread(_objectSpread({}, props), {}, {
21
19
  ref: ref,
22
20
  size: size,
23
21
  "data-color": color,
24
- "aria-busy": isLoading,
22
+ loading: isLoading,
25
23
  "aria-expanded": isActive,
26
- disabled: disabled || isLoading,
27
- color: color === 'primary' ? color : 'default',
28
- children: !isLoading ? children : /*#__PURE__*/_jsxs(_Fragment, {
29
- children: [children, /*#__PURE__*/_jsx(CircularProgress, {
30
- size: "1em",
31
- color: "inherit"
32
- })]
33
- })
24
+ color: color === 'primary' ? color : 'inherit',
25
+ loadingIndicator: /*#__PURE__*/_jsx(CircularProgress, {
26
+ size: "1em",
27
+ color: "inherit"
28
+ }),
29
+ children: children
34
30
  }));
35
31
  });
36
32
  if (process.env.NODE_ENV !== "production") Button.displayName = "Button";