@superdispatch/ui 0.15.0 → 0.16.0-alpha.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 (73) hide show
  1. package/dist-node/index.js +4032 -490
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/index.js +3 -1
  4. package/dist-src/v5/adaptive-toolbar/AdaptiveToolbar.js +146 -0
  5. package/dist-src/v5/app-bar/AppBarOverrides.js +9 -0
  6. package/dist-src/v5/autocomplete/AutocompleteOverrides.js +63 -0
  7. package/dist-src/v5/avatar/AvatarOverrides.js +21 -0
  8. package/dist-src/v5/avatar-button/AvatarButton.js +146 -0
  9. package/dist-src/v5/button/Button.js +32 -0
  10. package/dist-src/v5/button/ButtonOverrides.js +238 -0
  11. package/dist-src/v5/card/CardOverrides.js +16 -0
  12. package/dist-src/v5/card-button/CardButton.js +135 -0
  13. package/dist-src/v5/checkbox/CheckboxField.js +37 -0
  14. package/dist-src/v5/checkbox/CheckboxGroudField.js +32 -0
  15. package/dist-src/v5/checkbox/CheckboxOverrides.js +71 -0
  16. package/dist-src/v5/chip/ChipOverrides.js +106 -0
  17. package/dist-src/v5/columns/Column.js +75 -0
  18. package/dist-src/v5/columns/Columns.js +28 -0
  19. package/dist-src/v5/description-list/DescriptionList.js +114 -0
  20. package/dist-src/v5/dialog/DialogOverrides.js +43 -0
  21. package/dist-src/v5/drawer/DrawerActions.js +69 -0
  22. package/dist-src/v5/drawer/DrawerContent.js +15 -0
  23. package/dist-src/v5/drawer/DrawerList.js +31 -0
  24. package/dist-src/v5/drawer/DrawerOverrides.js +17 -0
  25. package/dist-src/v5/drawer/DrawerTitle.js +119 -0
  26. package/dist-src/v5/grid/GridStack.js +33 -0
  27. package/dist-src/v5/grid/InlineGrid.js +34 -0
  28. package/dist-src/v5/icon-button/IconButtonOverrides.js +60 -0
  29. package/dist-src/v5/index.js +38 -0
  30. package/dist-src/v5/info-card/InfoCard.js +59 -0
  31. package/dist-src/v5/inline/Inline.js +56 -0
  32. package/dist-src/v5/link/LinkOverrides.js +46 -0
  33. package/dist-src/v5/list/ListOverrides.js +16 -0
  34. package/dist-src/v5/menu/MenuOverrides.js +34 -0
  35. package/dist-src/v5/overflow-text/OverflowText.js +84 -0
  36. package/dist-src/v5/pagination/PaginationOverrides.js +35 -0
  37. package/dist-src/v5/paper/PaperOverrides.js +13 -0
  38. package/dist-src/v5/props/AlignProps.js +15 -0
  39. package/dist-src/v5/props/CollapseProp.js +3 -0
  40. package/dist-src/v5/props/ResponsiveProp.js +42 -0
  41. package/dist-src/v5/props/SpaceProp.js +28 -0
  42. package/dist-src/v5/radio/RadioField.js +36 -0
  43. package/dist-src/v5/radio/RadioGroupField.js +38 -0
  44. package/dist-src/v5/radio/RadioOverrides.js +49 -0
  45. package/dist-src/v5/responsive/CollapseBreakpoint.js +15 -0
  46. package/dist-src/v5/responsive/ResponsiveContext.js +31 -0
  47. package/dist-src/v5/snackbar/Snackbar.js +53 -0
  48. package/dist-src/v5/snackbar/SnackbarContent.js +105 -0
  49. package/dist-src/v5/snackbar/SnackbarOverrides.js +35 -0
  50. package/dist-src/v5/snackbar/SnackbarStack.js +113 -0
  51. package/dist-src/v5/stack/Stack.js +43 -0
  52. package/dist-src/v5/svg-icon/SvgIconOverrides.js +33 -0
  53. package/dist-src/v5/switch/SwitchOverrides.js +88 -0
  54. package/dist-src/v5/tabs/TabsOverrides.js +45 -0
  55. package/dist-src/v5/tag/Tag.js +118 -0
  56. package/dist-src/v5/text-field/TextFieldOverrides.js +205 -0
  57. package/dist-src/v5/theme/Color.js +77 -0
  58. package/dist-src/v5/theme/CssBaselineOverrides.js +8 -0
  59. package/dist-src/v5/theme/SuperDispatchTheme.js +2 -0
  60. package/dist-src/v5/theme/ThemeProvider.js +142 -0
  61. package/dist-src/v5/tiles/Tiles.js +94 -0
  62. package/dist-src/v5/toolbar/ToolbarOverrides.js +15 -0
  63. package/dist-src/v5/tooltip/TooltipOverrides.js +42 -0
  64. package/dist-src/v5/typography/TypographyOverrides.js +121 -0
  65. package/dist-src/v5/utils/VisibilityObserver.js +53 -0
  66. package/dist-src/v5/utils/isEmptyReactNode.js +3 -0
  67. package/dist-src/v5/utils/mergeRefs.js +20 -0
  68. package/dist-src/v5/utils/renderChildren.js +8 -0
  69. package/dist-src/v5/utils/useUID.js +6 -0
  70. package/dist-types/index.d.ts +642 -37
  71. package/dist-web/index.js +4195 -654
  72. package/dist-web/index.js.map +1 -1
  73. package/package.json +8 -2
package/dist-src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as v5 from "./v5/index.js";
1
2
  export * from "./adaptive-toolbar/AdaptiveToolbar.js";
2
3
  export * from "./avatar-button/AvatarButton.js";
3
4
  export * from "./button/Button.js";
@@ -37,4 +38,5 @@ export * from "./utils/isEmptyReactNode.js";
37
38
  export * from "./utils/mergeRefs.js";
38
39
  export * from "./utils/renderChildren.js";
39
40
  export * from "./utils/useUID.js";
40
- export * from "./utils/VisibilityObserver.js";
41
+ export * from "./utils/VisibilityObserver.js";
42
+ export { v5 };
@@ -0,0 +1,146 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
+ var _excluded = ["items"];
5
+
6
+ var _templateObject;
7
+
8
+ import { ResizeObserver } from '@juggle/resize-observer';
9
+ import { MoreHoriz } from '@mui/icons-material';
10
+ import { Grid, Menu, MenuItem, styled, Toolbar, Typography } from '@mui/material';
11
+ import { useEventHandler } from '@superdispatch/hooks';
12
+ import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
13
+ import { Button } from "../button/Button.js";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
+
17
+ function useResizeObserver(node, observer) {
18
+ var handler = useEventHandler(observer);
19
+ useLayoutEffect(() => {
20
+ if (!node) {
21
+ return;
22
+ }
23
+
24
+ var resizeObserver = new ResizeObserver(() => {
25
+ handler(node);
26
+ });
27
+ resizeObserver.observe(node);
28
+ handler(node);
29
+ return () => {
30
+ resizeObserver.disconnect();
31
+ };
32
+ }, [node, handler]);
33
+ }
34
+
35
+ var GridActionsItem = /*#__PURE__*/styled(Grid, {
36
+ name: 'SD-AdaptiveToolbar'
37
+ })(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteral(["\n overflow: hidden;\n"])));
38
+ export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
39
+ var {
40
+ items
41
+ } = _ref,
42
+ props = _objectWithoutProperties(_ref, _excluded);
43
+
44
+ var itemNodes = useRef([]);
45
+ var optionsButtonRef = useRef(null);
46
+ var [firstHiddenIdx, setFirstHiddenIdx] = useState(-1);
47
+ var menuItems = firstHiddenIdx === -1 ? [] : items.slice(firstHiddenIdx);
48
+ var [menuButtonNode, setMenuButtonRef] = useState();
49
+ var [rootNode, setRootNode] = useState(null);
50
+ useResizeObserver(rootNode, node => {
51
+ var _optionsButtonRef$cur;
52
+
53
+ var rootRect = node.getBoundingClientRect();
54
+ var rootWidth = rootRect.left + rootRect.width;
55
+ var optionsButtonRect = (_optionsButtonRef$cur = optionsButtonRef.current) === null || _optionsButtonRef$cur === void 0 ? void 0 : _optionsButtonRef$cur.getBoundingClientRect();
56
+ var optionsButtonWidth = (optionsButtonRect === null || optionsButtonRect === void 0 ? void 0 : optionsButtonRect.width) || 0;
57
+ var maxRightPosition = rootWidth - optionsButtonWidth;
58
+ var mountedNodes = itemNodes.current.filter(x => x != null);
59
+ var hiddenIdx = mountedNodes.findIndex((itemNode, idx) => {
60
+ itemNode.removeAttribute('hidden');
61
+ var itemRect = itemNode.getBoundingClientRect();
62
+ var itemRightPosition = itemRect.left + itemRect.width; // Ignore options button width when checking last item.
63
+
64
+ if (idx === mountedNodes.length - 1) {
65
+ return itemRightPosition > rootWidth;
66
+ }
67
+
68
+ return itemRightPosition > maxRightPosition;
69
+ });
70
+
71
+ if (hiddenIdx !== -1) {
72
+ mountedNodes.slice(hiddenIdx).forEach(itemNode => {
73
+ itemNode.setAttribute('hidden', 'true');
74
+ });
75
+ }
76
+
77
+ setFirstHiddenIdx(hiddenIdx);
78
+ });
79
+ return /*#__PURE__*/_jsx(Toolbar, _objectSpread(_objectSpread({}, props), {}, {
80
+ ref: ref,
81
+ children: /*#__PURE__*/_jsxs(Grid, {
82
+ container: true,
83
+ spacing: 1,
84
+ wrap: "nowrap",
85
+ ref: setRootNode,
86
+ children: [/*#__PURE__*/_jsx(GridActionsItem, {
87
+ item: true,
88
+ children: /*#__PURE__*/_jsx(Grid, {
89
+ container: true,
90
+ spacing: 1,
91
+ wrap: "nowrap",
92
+ component: "div",
93
+ children: items.map((item, idx) => /*#__PURE__*/_jsx(Grid, {
94
+ item: true,
95
+ ref: node => {
96
+ itemNodes.current[idx] = node;
97
+ },
98
+ children: /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
99
+ type: "button",
100
+ color: "primary",
101
+ variant: "outlined",
102
+ onClick: item.onClick
103
+ }, item.ButtonProps), {}, {
104
+ children: /*#__PURE__*/_jsx(Typography, {
105
+ noWrap: true,
106
+ variant: "inherit",
107
+ children: item.label
108
+ })
109
+ }))
110
+ }, item.key))
111
+ })
112
+ }), menuItems.length > 0 && /*#__PURE__*/_jsxs(Grid, {
113
+ item: true,
114
+ ref: optionsButtonRef,
115
+ component: "div",
116
+ children: [/*#__PURE__*/_jsx(Button, {
117
+ type: "button",
118
+ variant: "outlined",
119
+ onClick: _ref2 => {
120
+ var {
121
+ currentTarget
122
+ } = _ref2;
123
+ setMenuButtonRef(currentTarget);
124
+ },
125
+ children: /*#__PURE__*/_jsx(MoreHoriz, {})
126
+ }), /*#__PURE__*/_jsx(Menu, {
127
+ open: !!menuButtonNode,
128
+ anchorEl: menuButtonNode,
129
+ onClose: () => {
130
+ setMenuButtonRef(undefined);
131
+ },
132
+ children: menuItems.map(item => /*#__PURE__*/_jsx(MenuItem, {
133
+ onClick: event => {
134
+ var _item$onClick;
135
+
136
+ (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
137
+ setMenuButtonRef(undefined);
138
+ },
139
+ children: item.label
140
+ }, item.key))
141
+ })]
142
+ })]
143
+ })
144
+ }));
145
+ });
146
+ if (process.env.NODE_ENV !== "production") AdaptiveToolbar.displayName = "AdaptiveToolbar";
@@ -0,0 +1,9 @@
1
+ export function overrideAppBar(theme) {
2
+ theme.components.MuiAppBar = {
3
+ defaultProps: {
4
+ elevation: 0,
5
+ color: 'inherit',
6
+ position: 'static'
7
+ }
8
+ };
9
+ }
@@ -0,0 +1,63 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import { autocompleteClasses, SvgIcon } from '@mui/material';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export function overrideAutocomplete(theme) {
5
+ var sm = theme.breakpoints.up('sm');
6
+ theme.components.MuiAutocomplete = {
7
+ defaultProps: {
8
+ popupIcon: /*#__PURE__*/_jsx(SvgIcon, {
9
+ children: /*#__PURE__*/_jsx("path", {
10
+ d: "M12 16.5L6 9h12l-6 7.5z",
11
+ fill: "currentColor"
12
+ })
13
+ })
14
+ },
15
+ styleOverrides: {
16
+ paper: _objectSpread({}, theme.typography.body2),
17
+ tag: {
18
+ margin: '4px',
19
+ [sm]: {
20
+ margin: '2px'
21
+ }
22
+ },
23
+ endAdornment: {
24
+ top: 0,
25
+ bottom: 0,
26
+ display: 'flex',
27
+ alignItems: 'center'
28
+ },
29
+ popupIndicator: {
30
+ '& .MuiSvgIcon-root': {
31
+ fontSize: '24px',
32
+ [sm]: {
33
+ fontSize: '16px'
34
+ }
35
+ }
36
+ },
37
+ inputRoot: {
38
+ '&[class*="MuiOutlinedInput-root"]': {
39
+ padding: '6px 8px',
40
+ ["& .".concat(autocompleteClasses.input)]: {
41
+ width: '144px',
42
+ padding: '4px'
43
+ },
44
+ ["& .".concat(autocompleteClasses.input, ":first-child")]: {
45
+ paddingLeft: 'unset'
46
+ },
47
+ ["& .".concat(autocompleteClasses.endAdornment)]: {
48
+ right: '12px'
49
+ },
50
+ [sm]: {
51
+ padding: theme.spacing(0.5, 0.75),
52
+ ["& .".concat(autocompleteClasses.input)]: {
53
+ padding: '2px'
54
+ },
55
+ ["& .".concat(autocompleteClasses.endAdornment)]: {
56
+ right: '8px'
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ };
63
+ }
@@ -0,0 +1,21 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import { Color } from "../theme/Color.js";
3
+ export function overrideAvatar(theme) {
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
18
+ }
19
+ }
20
+ };
21
+ }
@@ -0,0 +1,146 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
+ var _excluded = ["size", "icon", "isLoading", "disabled", "avatarRef", "alt", "imgProps", "sizes", "src", "srcSet", "variant", "children"];
4
+ import { Avatar, ButtonBase, CircularProgress, styled } from '@mui/material';
5
+ import { forwardRef } from 'react';
6
+ import { Color } from "../theme/Color.js";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ var Overlay = /*#__PURE__*/styled('div')(_ref => {
10
+ var {
11
+ theme
12
+ } = _ref;
13
+ var sm = theme.breakpoints.up('sm');
14
+ return {
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)
33
+ }
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
64
+ }
65
+ },
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
+ }
77
+ }
78
+ },
79
+ '&[data-size-large="true"]': {
80
+ '& > .MuiAvatar-root': _objectSpread(_objectSpread({}, theme.typography.h2), {}, {
81
+ width: theme.spacing(7),
82
+ height: theme.spacing(7),
83
+ [sm]: {
84
+ width: theme.spacing(8),
85
+ height: theme.spacing(8)
86
+ }
87
+ }),
88
+ ["& > ".concat(Overlay)]: {
89
+ ["& > ".concat(StyledProgress)]: {
90
+ fontSize: theme.spacing(7),
91
+ [sm]: {
92
+ fontSize: theme.spacing(8)
93
+ }
94
+ },
95
+ '& > svg': {
96
+ fontSize: theme.spacing(4),
97
+ [sm]: {
98
+ fontSize: theme.spacing(3)
99
+ }
100
+ }
101
+ }
102
+ }
103
+ };
104
+ });
105
+ export var AvatarButton = /*#__PURE__*/forwardRef((_ref4, ref) => {
106
+ var {
107
+ size,
108
+ icon,
109
+ isLoading = false,
110
+ disabled = false,
111
+ avatarRef,
112
+ alt,
113
+ imgProps,
114
+ sizes,
115
+ src,
116
+ srcSet,
117
+ variant,
118
+ children
119
+ } = _ref4,
120
+ props = _objectWithoutProperties(_ref4, _excluded);
121
+
122
+ return /*#__PURE__*/_jsxs(StyledButton, _objectSpread(_objectSpread({}, props), {}, {
123
+ ref: ref,
124
+ "aria-busy": isLoading,
125
+ "aria-disabled": disabled,
126
+ disabled: disabled || isLoading,
127
+ "data-with-icon": !!icon,
128
+ "data-size-large": size === 'large',
129
+ children: [/*#__PURE__*/_jsx(Avatar, {
130
+ ref: avatarRef,
131
+ variant: variant,
132
+ alt: alt,
133
+ src: src,
134
+ sizes: sizes,
135
+ srcSet: srcSet,
136
+ imgProps: imgProps,
137
+ children: children
138
+ }), /*#__PURE__*/_jsxs(Overlay, {
139
+ children: [icon, isLoading && /*#__PURE__*/_jsx(StyledProgress, {
140
+ size: "1em",
141
+ thickness: size === 'large' ? 2.5 : 1.5
142
+ })]
143
+ })]
144
+ }));
145
+ });
146
+ if (process.env.NODE_ENV !== "production") AvatarButton.displayName = "AvatarButton";
@@ -0,0 +1,32 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["size", "children", "isActive", "isLoading", "color"];
4
+ import { LoadingButton } from '@mui/lab';
5
+ import { CircularProgress } from '@mui/material';
6
+ import { forwardRef } from 'react';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ export var Button = /*#__PURE__*/forwardRef((_ref, ref) => {
9
+ var {
10
+ size,
11
+ children,
12
+ isActive,
13
+ isLoading,
14
+ color = 'primary'
15
+ } = _ref,
16
+ props = _objectWithoutProperties(_ref, _excluded);
17
+
18
+ return /*#__PURE__*/_jsx(LoadingButton, _objectSpread(_objectSpread({}, props), {}, {
19
+ ref: ref,
20
+ size: size,
21
+ "data-color": color,
22
+ loading: isLoading,
23
+ "aria-expanded": isActive,
24
+ color: color === 'primary' ? color : 'inherit',
25
+ loadingIndicator: /*#__PURE__*/_jsx(CircularProgress, {
26
+ size: "1em",
27
+ color: "inherit"
28
+ }),
29
+ children: children
30
+ }));
31
+ });
32
+ if (process.env.NODE_ENV !== "production") Button.displayName = "Button";
@@ -0,0 +1,238 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import { loadingButtonClasses } from '@mui/lab';
3
+ import { buttonClasses } from '@mui/material';
4
+ import { Color } from "../theme/Color.js";
5
+
6
+ function outlineShadow() {
7
+ var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
8
+ var color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Color.Transparent;
9
+ return "0 0 0 ".concat(size, "px ").concat(color);
10
+ }
11
+
12
+ function textVariant(text, outline, background, progress) {
13
+ return {
14
+ '&': {
15
+ color: text,
16
+ boxShadow: outlineShadow(),
17
+ backgroundColor: Color.Transparent
18
+ },
19
+ '&:hover': {
20
+ backgroundColor: background
21
+ },
22
+ '&[aria-expanded="true"]': {
23
+ backgroundColor: background
24
+ },
25
+ '&:focus': {
26
+ backgroundColor: background,
27
+ boxShadow: outlineShadow(2, outline)
28
+ },
29
+ ["&.".concat(buttonClasses.disabled)]: {
30
+ color: outline,
31
+ boxShadow: outlineShadow(),
32
+ backgroundColor: Color.Transparent,
33
+ ["& .".concat(loadingButtonClasses.loadingIndicator)]: {
34
+ color: progress
35
+ }
36
+ }
37
+ };
38
+ }
39
+
40
+ function outlinedBorder(borderColor) {
41
+ var outlineColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Color.Transparent;
42
+ return "inset 0 0 0 1px ".concat(borderColor, ", 0 0 0 2px ").concat(outlineColor);
43
+ }
44
+
45
+ function outlinedVariant(staleText, staleBorder, disabledText, disabledBorder, activeText, activeBorder, activeOutline, activeBackground, progress, backgroundColor) {
46
+ return {
47
+ backgroundColor,
48
+ color: staleText,
49
+ border: 0,
50
+ boxShadow: outlinedBorder(staleBorder),
51
+ '&:hover': {
52
+ color: activeText,
53
+ border: 0,
54
+ backgroundColor: activeBackground,
55
+ boxShadow: outlinedBorder(activeBorder)
56
+ },
57
+ '&[aria-expanded="true"]': {
58
+ color: activeText,
59
+ backgroundColor: activeBackground,
60
+ boxShadow: outlinedBorder(activeBorder)
61
+ },
62
+ '&:focus': {
63
+ boxShadow: outlinedBorder(activeBorder, activeOutline)
64
+ },
65
+ ["&.".concat(buttonClasses.disabled)]: {
66
+ backgroundColor,
67
+ color: disabledText,
68
+ boxShadow: outlinedBorder(disabledBorder),
69
+ ["& .".concat(loadingButtonClasses.loadingIndicator)]: {
70
+ color: progress
71
+ }
72
+ }
73
+ };
74
+ }
75
+
76
+ function containedVariant(text, backgroundColor, outline, active, disabledText, disabledBackground) {
77
+ return {
78
+ color: text,
79
+ backgroundColor,
80
+ boxShadow: outlineShadow(),
81
+ '&:hover': {
82
+ backgroundColor: active
83
+ },
84
+ '&[aria-expanded="true"]': {
85
+ backgroundColor: active
86
+ },
87
+ '&:focus': {
88
+ boxShadow: outlineShadow(3, outline)
89
+ },
90
+ ["&.".concat(buttonClasses.disabled)]: {
91
+ color: disabledText,
92
+ boxShadow: outlineShadow(),
93
+ backgroundColor: disabledBackground,
94
+ ["& .".concat(loadingButtonClasses.loadingIndicator)]: {
95
+ color: disabledText
96
+ }
97
+ }
98
+ };
99
+ }
100
+
101
+ function sizeSmall(theme) {
102
+ var sm = theme.breakpoints.up('sm');
103
+ return _objectSpread(_objectSpread({}, theme.typography.button), {}, {
104
+ padding: theme.spacing(0.5, 3),
105
+ [sm]: {
106
+ padding: theme.spacing(0.25, 2)
107
+ }
108
+ });
109
+ }
110
+
111
+ function sizeLarge(theme) {
112
+ var sm = theme.breakpoints.up('sm');
113
+ return _objectSpread(_objectSpread({}, theme.typography.button), {}, {
114
+ fontSize: '18px',
115
+ lineHeight: '28px',
116
+ padding: theme.spacing(1.75, 8),
117
+ [sm]: {
118
+ fontSize: '16px',
119
+ lineHeight: '24px',
120
+ padding: theme.spacing(1, 4)
121
+ }
122
+ });
123
+ }
124
+
125
+ export function overrideButton(theme) {
126
+ var sm = theme.breakpoints.up('sm');
127
+ theme.components.MuiLoadingButton = {
128
+ defaultProps: {
129
+ variant: 'outlined'
130
+ },
131
+ styleOverrides: {
132
+ loadingIndicator: {
133
+ color: 'inherit',
134
+ fontSize: theme.spacing(2),
135
+ [".".concat(buttonClasses.sizeLarge, " &")]: {
136
+ fontSize: theme.spacing(3)
137
+ }
138
+ }
139
+ }
140
+ };
141
+ theme.components.MuiButton = {
142
+ defaultProps: {
143
+ color: 'primary',
144
+ variant: 'outlined',
145
+ disableFocusRipple: true
146
+ },
147
+ styleOverrides: {
148
+ root: {
149
+ minWidth: theme.spacing(6),
150
+ transition: theme.transitions.create(['color', 'border', 'box-shadow', 'background-color']),
151
+ padding: theme.spacing(1.25, 3),
152
+ [sm]: {
153
+ padding: theme.spacing(0.75, 2)
154
+ },
155
+ '&:hover': {
156
+ backgroundColor: 'initial',
157
+ ["&.".concat(buttonClasses.disabled)]: {
158
+ backgroundColor: 'initial'
159
+ },
160
+ '@media (hover: none)': {
161
+ backgroundColor: 'initial'
162
+ }
163
+ },
164
+ ["&.".concat(buttonClasses.disabled)]: {
165
+ color: 'initial'
166
+ },
167
+ '& > .MuiSvgIcon-root': {
168
+ fontSize: '24px',
169
+ [sm]: {
170
+ fontSize: '20px'
171
+ },
172
+ [".".concat(buttonClasses.sizeLarge, "&")]: {
173
+ fontSize: '28px',
174
+ [sm]: {
175
+ fontSize: '24px'
176
+ }
177
+ }
178
+ }
179
+ },
180
+ sizeSmall: sizeSmall(theme),
181
+ sizeLarge: sizeLarge(theme),
182
+ text: {
183
+ padding: 'initial',
184
+ '&[data-color="error"]': textVariant(Color.Red300, Color.Red100, Color.Red50, Color.Red200),
185
+ '&[data-color="success"]': textVariant(Color.Green300, Color.Green100, Color.Green50, Color.Green200),
186
+ '&[data-color="white"]': textVariant(Color.White, Color.White50, Color.White10, Color.White50)
187
+ },
188
+ textPrimary: textVariant(Color.Blue300, Color.Blue100, Color.Blue50, Color.Blue200),
189
+ textSizeSmall: sizeSmall(theme),
190
+ textSizeLarge: sizeLarge(theme),
191
+ outlined: {
192
+ border: 'none',
193
+ padding: 'initial',
194
+ ["&.".concat(buttonClasses.disabled)]: {
195
+ border: 'none'
196
+ },
197
+ '&[data-color="error"]': outlinedVariant(Color.Red300, Color.Red300, Color.Red100, Color.Red100, Color.Red300, Color.Red300, Color.Red100, Color.Red50, Color.Red300, Color.White),
198
+ '&[data-color="success"]': outlinedVariant(Color.Green300, Color.Green300, Color.Green100, Color.Green100, Color.Green300, Color.Green300, Color.Green100, Color.Green50, Color.Green300, Color.White),
199
+ '&[data-color="white"]': outlinedVariant(Color.White, Color.White50, Color.White50, Color.White40, Color.White, Color.White50, Color.White40, Color.White10, Color.White50, Color.Transparent)
200
+ },
201
+ outlinedPrimary: outlinedVariant(Color.Dark500, Color.Silver500, Color.Silver500, Color.Silver400, Color.Blue300, Color.Blue300, Color.Blue100, Color.Blue50, Color.Dark200, Color.White),
202
+ outlinedSizeSmall: sizeSmall(theme),
203
+ outlinedSizeLarge: sizeLarge(theme),
204
+ contained: {
205
+ boxShadow: 'none',
206
+ backgroundColor: 'initial',
207
+ '&:hover': {
208
+ boxShadow: 'none',
209
+ backgroundColor: 'initial',
210
+ ["&.".concat(buttonClasses.disabled)]: {
211
+ backgroundColor: 'none'
212
+ },
213
+ '@media (hover: none)': {
214
+ boxShadow: 'none',
215
+ backgroundColor: 'none'
216
+ }
217
+ },
218
+ '&:active': {
219
+ boxShadow: 'none'
220
+ },
221
+ ["&.".concat(buttonClasses.focusVisible)]: {
222
+ boxShadow: 'none'
223
+ },
224
+ ["&.".concat(buttonClasses.disabled)]: {
225
+ color: 'initial',
226
+ boxShadow: 'none',
227
+ backgroundColor: 'initial'
228
+ },
229
+ '&[data-color="error"]': containedVariant(Color.White, Color.Red300, Color.Red100, Color.Red500, Color.White, Color.Red100),
230
+ '&[data-color="success"]': containedVariant(Color.White, Color.Green300, Color.Green100, Color.Green500, Color.White, Color.Green100),
231
+ '&[data-color="white"]': containedVariant(Color.White, Color.White20, Color.White40, Color.White40, Color.White50, Color.White08)
232
+ },
233
+ containedPrimary: containedVariant(Color.White, Color.Blue300, Color.Blue100, Color.Blue500, Color.White, Color.Blue100),
234
+ containedSizeSmall: sizeSmall(theme),
235
+ containedSizeLarge: sizeLarge(theme)
236
+ }
237
+ };
238
+ }
@@ -0,0 +1,16 @@
1
+ export function overrideCard(theme) {
2
+ theme.components.MuiCard = {
3
+ defaultProps: {
4
+ variant: 'outlined'
5
+ }
6
+ };
7
+ theme.components.MuiCardContent = {
8
+ styleOverrides: {
9
+ root: {
10
+ '&:last-child': {
11
+ paddingBottom: '16px'
12
+ }
13
+ }
14
+ }
15
+ };
16
+ }