@superdispatch/ui 0.13.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.
- package/dist-node/index.js +4051 -508
- package/dist-node/index.js.map +1 -1
- package/dist-src/dialog/DialogOverrides.js +8 -0
- package/dist-src/index.js +3 -1
- package/dist-src/info-card/InfoCard.js +1 -11
- package/dist-src/utils/mergeRefs.js +10 -7
- package/dist-src/v5/adaptive-toolbar/AdaptiveToolbar.js +146 -0
- package/dist-src/v5/app-bar/AppBarOverrides.js +9 -0
- package/dist-src/v5/autocomplete/AutocompleteOverrides.js +63 -0
- package/dist-src/v5/avatar/AvatarOverrides.js +21 -0
- package/dist-src/v5/avatar-button/AvatarButton.js +146 -0
- package/dist-src/v5/button/Button.js +32 -0
- package/dist-src/v5/button/ButtonOverrides.js +238 -0
- package/dist-src/v5/card/CardOverrides.js +16 -0
- package/dist-src/v5/card-button/CardButton.js +135 -0
- package/dist-src/v5/checkbox/CheckboxField.js +37 -0
- package/dist-src/v5/checkbox/CheckboxGroudField.js +32 -0
- package/dist-src/v5/checkbox/CheckboxOverrides.js +71 -0
- package/dist-src/v5/chip/ChipOverrides.js +106 -0
- package/dist-src/v5/columns/Column.js +75 -0
- package/dist-src/v5/columns/Columns.js +28 -0
- package/dist-src/v5/description-list/DescriptionList.js +114 -0
- package/dist-src/v5/dialog/DialogOverrides.js +43 -0
- package/dist-src/v5/drawer/DrawerActions.js +69 -0
- package/dist-src/v5/drawer/DrawerContent.js +15 -0
- package/dist-src/v5/drawer/DrawerList.js +31 -0
- package/dist-src/v5/drawer/DrawerOverrides.js +17 -0
- package/dist-src/v5/drawer/DrawerTitle.js +119 -0
- package/dist-src/v5/grid/GridStack.js +33 -0
- package/dist-src/v5/grid/InlineGrid.js +34 -0
- package/dist-src/v5/icon-button/IconButtonOverrides.js +60 -0
- package/dist-src/v5/index.js +38 -0
- package/dist-src/v5/info-card/InfoCard.js +59 -0
- package/dist-src/v5/inline/Inline.js +56 -0
- package/dist-src/v5/link/LinkOverrides.js +46 -0
- package/dist-src/v5/list/ListOverrides.js +16 -0
- package/dist-src/v5/menu/MenuOverrides.js +34 -0
- package/dist-src/v5/overflow-text/OverflowText.js +84 -0
- package/dist-src/v5/pagination/PaginationOverrides.js +35 -0
- package/dist-src/v5/paper/PaperOverrides.js +13 -0
- package/dist-src/v5/props/AlignProps.js +15 -0
- package/dist-src/v5/props/CollapseProp.js +3 -0
- package/dist-src/v5/props/ResponsiveProp.js +42 -0
- package/dist-src/v5/props/SpaceProp.js +28 -0
- package/dist-src/v5/radio/RadioField.js +36 -0
- package/dist-src/v5/radio/RadioGroupField.js +38 -0
- package/dist-src/v5/radio/RadioOverrides.js +49 -0
- package/dist-src/v5/responsive/CollapseBreakpoint.js +15 -0
- package/dist-src/v5/responsive/ResponsiveContext.js +31 -0
- package/dist-src/v5/snackbar/Snackbar.js +53 -0
- package/dist-src/v5/snackbar/SnackbarContent.js +105 -0
- package/dist-src/v5/snackbar/SnackbarOverrides.js +35 -0
- package/dist-src/v5/snackbar/SnackbarStack.js +113 -0
- package/dist-src/v5/stack/Stack.js +43 -0
- package/dist-src/v5/svg-icon/SvgIconOverrides.js +33 -0
- package/dist-src/v5/switch/SwitchOverrides.js +88 -0
- package/dist-src/v5/tabs/TabsOverrides.js +45 -0
- package/dist-src/v5/tag/Tag.js +118 -0
- package/dist-src/v5/text-field/TextFieldOverrides.js +205 -0
- package/dist-src/v5/theme/Color.js +77 -0
- package/dist-src/v5/theme/CssBaselineOverrides.js +8 -0
- package/dist-src/v5/theme/SuperDispatchTheme.js +2 -0
- package/dist-src/v5/theme/ThemeProvider.js +142 -0
- package/dist-src/v5/tiles/Tiles.js +94 -0
- package/dist-src/v5/toolbar/ToolbarOverrides.js +15 -0
- package/dist-src/v5/tooltip/TooltipOverrides.js +42 -0
- package/dist-src/v5/typography/TypographyOverrides.js +121 -0
- package/dist-src/v5/utils/VisibilityObserver.js +53 -0
- package/dist-src/v5/utils/isEmptyReactNode.js +3 -0
- package/dist-src/v5/utils/mergeRefs.js +20 -0
- package/dist-src/v5/utils/renderChildren.js +8 -0
- package/dist-src/v5/utils/useUID.js +6 -0
- package/dist-types/index.d.ts +643 -37
- package/dist-web/index.js +4214 -673
- package/dist-web/index.js.map +1 -1
- package/package.json +9 -3
|
@@ -6,6 +6,14 @@ export function overrideDialog(theme) {
|
|
|
6
6
|
theme.overrides.MuiDialog = {
|
|
7
7
|
paper: {
|
|
8
8
|
margin: theme.spacing(3)
|
|
9
|
+
},
|
|
10
|
+
paperWidthXs: {
|
|
11
|
+
maxWidth: Math.max(theme.breakpoints.values.xs, 360),
|
|
12
|
+
'&$paperScrollBody': {
|
|
13
|
+
[theme.breakpoints.down(Math.max(theme.breakpoints.values.xs, 360) + 32 * 2)]: {
|
|
14
|
+
maxWidth: 'calc(100% - 64px)'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
9
17
|
}
|
|
10
18
|
};
|
|
11
19
|
theme.overrides.MuiDialogTitle = {
|
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 };
|
|
@@ -6,18 +6,8 @@ import { Card, CardContent } from '@material-ui/core';
|
|
|
6
6
|
import { makeStyles } from '@material-ui/styles';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { forwardRef, useState } from 'react';
|
|
9
|
+
import { assignRef } from "../utils/mergeRefs.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
|
|
11
|
-
function assignRef(ref, value) {
|
|
12
|
-
if (ref) {
|
|
13
|
-
if (typeof ref === 'object') {
|
|
14
|
-
ref.current = value;
|
|
15
|
-
} else {
|
|
16
|
-
ref(value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
11
|
var useStyles = /*#__PURE__*/makeStyles(theme => ({
|
|
22
12
|
root: {
|
|
23
13
|
'&$fullWidth': {
|
|
@@ -5,13 +5,16 @@ export function mergeRefs() {
|
|
|
5
5
|
|
|
6
6
|
return node => {
|
|
7
7
|
refs.forEach(ref => {
|
|
8
|
-
|
|
9
|
-
if (typeof ref === 'function') {
|
|
10
|
-
ref(node);
|
|
11
|
-
} else {
|
|
12
|
-
ref.current = node;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
8
|
+
assignRef(ref, node);
|
|
15
9
|
});
|
|
16
10
|
};
|
|
11
|
+
}
|
|
12
|
+
export function assignRef(ref, value) {
|
|
13
|
+
if (ref) {
|
|
14
|
+
if (typeof ref === 'function') {
|
|
15
|
+
ref(value);
|
|
16
|
+
} else {
|
|
17
|
+
ref.current = value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
17
20
|
}
|
|
@@ -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,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";
|