@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
@@ -0,0 +1,84 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
+ var _excluded = ["title", "enterDelay"],
4
+ _excluded2 = ["onClick", "children", "disableUnderline", "TooltipProps"];
5
+ import { styled, Tooltip, Typography } from '@mui/material';
6
+ import { forwardRef, useState } from 'react';
7
+ import { Color } from "../theme/Color.js";
8
+ import { VisibilityObserver } from "../utils/VisibilityObserver.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var Root = /*#__PURE__*/styled(Typography, {
12
+ name: 'SD-OverflowText',
13
+ shouldForwardProp: prop => prop !== 'truncated'
14
+ })(_ref => {
15
+ var {
16
+ truncated,
17
+ theme
18
+ } = _ref;
19
+ return _objectSpread({
20
+ marginBottom: -1,
21
+ borderBottom: '1px dashed transparent',
22
+ transition: theme.transitions.create('border')
23
+ }, truncated && {
24
+ cursor: 'pointer',
25
+ borderBottomColor: Color.Silver500
26
+ });
27
+ });
28
+ var Sential = /*#__PURE__*/styled('span', {
29
+ name: 'SD-OverflowText',
30
+ slot: 'Sential'
31
+ })({
32
+ width: 1,
33
+ height: '100%',
34
+ display: 'inline-block'
35
+ });
36
+ export var OverflowText = /*#__PURE__*/forwardRef((_ref2, rootRef) => {
37
+ var {
38
+ onClick: _onClick,
39
+ children,
40
+ disableUnderline,
41
+ TooltipProps: {
42
+ title = children,
43
+ enterDelay = 1000
44
+ } = {}
45
+ } = _ref2,
46
+ tooltipProps = _objectWithoutProperties(_ref2.TooltipProps, _excluded),
47
+ props = _objectWithoutProperties(_ref2, _excluded2);
48
+
49
+ var [isOpen, setIsOpen] = useState(false);
50
+ return /*#__PURE__*/_jsx(VisibilityObserver, {
51
+ render: _ref3 => {
52
+ var {
53
+ ref,
54
+ visibility
55
+ } = _ref3;
56
+ var isTooltipEnabled = !!children && visibility === 'invisible';
57
+ return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
58
+ enterDelay: 1000,
59
+ title: title || '',
60
+ disableFocusListener: true,
61
+ open: isOpen && isTooltipEnabled,
62
+ onOpen: () => {
63
+ setIsOpen(true);
64
+ },
65
+ onClose: () => {
66
+ setIsOpen(false);
67
+ },
68
+ children: /*#__PURE__*/_jsxs(Root, _objectSpread(_objectSpread({}, props), {}, {
69
+ ref: rootRef,
70
+ noWrap: true,
71
+ truncated: !disableUnderline && visibility === 'invisible',
72
+ onClick: event => {
73
+ setIsOpen(true);
74
+ _onClick === null || _onClick === void 0 ? void 0 : _onClick(event);
75
+ },
76
+ children: [children, !!children && /*#__PURE__*/_jsx(Sential, {
77
+ ref: ref
78
+ })]
79
+ }))
80
+ }));
81
+ }
82
+ });
83
+ });
84
+ if (process.env.NODE_ENV !== "production") OverflowText.displayName = "OverflowText";
@@ -0,0 +1,35 @@
1
+ import { paginationItemClasses } from '@mui/material';
2
+ import { Color } from "../theme/Color.js";
3
+ export function overridePagination(theme) {
4
+ theme.components.MuiPaginationItem = {
5
+ styleOverrides: {
6
+ root: {
7
+ color: Color.Dark400
8
+ },
9
+ page: {
10
+ '&:hover': {
11
+ backgroundColor: Color.Silver200
12
+ },
13
+ ["&.".concat(paginationItemClasses.focusVisible)]: {
14
+ borderRadius: 4,
15
+ backgroundColor: Color.White,
16
+ border: "1px solid ".concat(Color.Blue100)
17
+ },
18
+ ["&.".concat(paginationItemClasses.selected)]: {
19
+ backgroundColor: Color.Silver400,
20
+ ["&:hover, &.".concat(paginationItemClasses.focusVisible)]: {
21
+ backgroundColor: Color.Silver400
22
+ },
23
+ ["&.".concat(paginationItemClasses.disabled)]: {
24
+ color: Color.Dark100,
25
+ backgroundColor: Color.Silver400
26
+ }
27
+ },
28
+ ["&.".concat(paginationItemClasses.disabled)]: {
29
+ opacity: 1,
30
+ color: Color.Dark100
31
+ }
32
+ }
33
+ }
34
+ };
35
+ }
@@ -0,0 +1,13 @@
1
+ import { Color } from "../theme/Color.js";
2
+ export function overridePaper(theme) {
3
+ theme.components.MuiPaper = {
4
+ defaultProps: {
5
+ elevation: 0
6
+ },
7
+ styleOverrides: {
8
+ elevation0: {
9
+ border: "1px solid ".concat(Color.Silver400)
10
+ }
11
+ }
12
+ };
13
+ }
@@ -0,0 +1,15 @@
1
+ export function parseAlignProp(align) {
2
+ switch (align) {
3
+ case 'top':
4
+ case 'left':
5
+ default:
6
+ return 'initial';
7
+
8
+ case 'center':
9
+ return 'center';
10
+
11
+ case 'right':
12
+ case 'bottom':
13
+ return 'flex-end';
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ export function parseCollapsedBelow(collapsedBelow) {
2
+ return [collapsedBelow === 'tablet' || collapsedBelow === 'desktop', collapsedBelow === 'desktop', false];
3
+ }
@@ -0,0 +1,42 @@
1
+ import { useDeepEqualValue } from '@superdispatch/hooks';
2
+ import { useResponsiveContext } from "../responsive/ResponsiveContext.js";
3
+ export function parseResponsiveProp(prop) {
4
+ var _tablet, _desktop;
5
+
6
+ if (typeof prop != 'object') return [prop, prop, prop];
7
+ var [mobile, tablet, desktop] = prop;
8
+ (_tablet = tablet) !== null && _tablet !== void 0 ? _tablet : tablet = mobile;
9
+ (_desktop = desktop) !== null && _desktop !== void 0 ? _desktop : desktop = tablet;
10
+ return [mobile, tablet, desktop];
11
+ }
12
+ export function useResponsiveProp(prop) {
13
+ return useDeepEqualValue(parseResponsiveProp(prop));
14
+ }
15
+ export function useResponsiveValue(xs, sm) {
16
+ var md = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : sm;
17
+ var lg = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : md;
18
+ var xl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : lg;
19
+ var {
20
+ breakpoint = 'xs'
21
+ } = useResponsiveContext();
22
+ return {
23
+ xs,
24
+ sm,
25
+ md,
26
+ lg,
27
+ xl
28
+ }[breakpoint];
29
+ }
30
+ export function useResponsivePropRecord(prop) {
31
+ if (typeof prop != 'object') prop = {
32
+ xs: prop
33
+ };
34
+ var {
35
+ xs,
36
+ sm,
37
+ md,
38
+ lg,
39
+ xl
40
+ } = prop;
41
+ return useResponsiveValue(xs, sm !== null && sm !== void 0 ? sm : xs, md, lg, xl);
42
+ }
@@ -0,0 +1,28 @@
1
+ export function parseSpaceProp(prop) {
2
+ switch (prop) {
3
+ case 'none':
4
+ default:
5
+ return 0;
6
+
7
+ case 'xxsmall':
8
+ return 4;
9
+
10
+ case 'xsmall':
11
+ return 8;
12
+
13
+ case 'small':
14
+ return 16;
15
+
16
+ case 'medium':
17
+ return 24;
18
+
19
+ case 'large':
20
+ return 32;
21
+
22
+ case 'xlarge':
23
+ return 40;
24
+
25
+ case 'xxlarge':
26
+ return 48;
27
+ }
28
+ }
@@ -0,0 +1,36 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["label", "error", "checked", "onBlur", "onChange", "helperText", "FormControlLabelProps"];
4
+ import { FormControl, FormControlLabel, FormHelperText, Radio } from '@mui/material';
5
+ import { forwardRef } from 'react';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ export var RadioField = /*#__PURE__*/forwardRef((_ref, ref) => {
9
+ var {
10
+ label,
11
+ error,
12
+ checked,
13
+ onBlur,
14
+ onChange,
15
+ helperText,
16
+ FormControlLabelProps: formControlLabelProps
17
+ } = _ref,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+
20
+ return /*#__PURE__*/_jsxs(FormControl, {
21
+ error: error,
22
+ children: [/*#__PURE__*/_jsx(FormControlLabel, _objectSpread(_objectSpread({}, formControlLabelProps), {}, {
23
+ label: label,
24
+ checked: checked,
25
+ onBlur: onBlur,
26
+ onChange: onChange,
27
+ control: /*#__PURE__*/_jsx(Radio, _objectSpread({
28
+ ref: ref,
29
+ color: "primary"
30
+ }, props))
31
+ })), helperText && /*#__PURE__*/_jsx(FormHelperText, {
32
+ children: helperText
33
+ })]
34
+ });
35
+ });
36
+ if (process.env.NODE_ENV !== "production") RadioField.displayName = "RadioField";
@@ -0,0 +1,38 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["name", "value", "onChange", "RadioGroupProps", "label", "FormLabelProps", "helperText", "FormHelperTextProps", "children"];
4
+ import { FormControl, FormHelperText, FormLabel, RadioGroup } from '@mui/material';
5
+ import { forwardRef } from 'react';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ export var RadioGroupField = /*#__PURE__*/forwardRef((_ref, ref) => {
9
+ var {
10
+ name,
11
+ value = '',
12
+ onChange,
13
+ RadioGroupProps: radioGroupProps,
14
+ label,
15
+ FormLabelProps: formLabelProps,
16
+ helperText,
17
+ FormHelperTextProps: formHelperTextProps,
18
+ children
19
+ } = _ref,
20
+ formControlProps = _objectWithoutProperties(_ref, _excluded);
21
+
22
+ return /*#__PURE__*/_jsxs(FormControl, _objectSpread(_objectSpread({}, formControlProps), {}, {
23
+ hiddenLabel: !label,
24
+ children: [!!label && /*#__PURE__*/_jsx(FormLabel, _objectSpread(_objectSpread({}, formLabelProps), {}, {
25
+ children: label
26
+ })), /*#__PURE__*/_jsx(RadioGroup, _objectSpread(_objectSpread({
27
+ ref: ref
28
+ }, radioGroupProps), {}, {
29
+ name: name,
30
+ value: value,
31
+ onChange: onChange,
32
+ children: children
33
+ })), !!helperText && /*#__PURE__*/_jsx(FormHelperText, _objectSpread(_objectSpread({}, formHelperTextProps), {}, {
34
+ children: helperText
35
+ }))]
36
+ }));
37
+ });
38
+ if (process.env.NODE_ENV !== "production") RadioGroupField.displayName = "RadioGroupField";
@@ -0,0 +1,49 @@
1
+ import { radioClasses, SvgIcon } from '@mui/material';
2
+ import { Color } from "../theme/Color.js";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ export function overrideRadio(theme) {
6
+ theme.components.MuiRadio = {
7
+ defaultProps: {
8
+ color: 'primary',
9
+ icon: /*#__PURE__*/_jsx(SvgIcon, {
10
+ children: /*#__PURE__*/_jsx("circle", {
11
+ cx: "12",
12
+ cy: "12",
13
+ r: "8.5",
14
+ fill: Color.White,
15
+ stroke: "currentColor"
16
+ })
17
+ }),
18
+ checkedIcon: /*#__PURE__*/_jsxs(SvgIcon, {
19
+ children: [/*#__PURE__*/_jsx("circle", {
20
+ cx: "12",
21
+ cy: "12",
22
+ r: "8.5",
23
+ fill: "currentColor",
24
+ stroke: "currentColor"
25
+ }), /*#__PURE__*/_jsx("circle", {
26
+ cx: "12",
27
+ cy: "12",
28
+ r: "4",
29
+ fill: Color.White
30
+ })]
31
+ })
32
+ },
33
+ styleOverrides: {
34
+ root: {
35
+ color: Color.Dark100,
36
+ marginTop: theme.spacing(-0.625),
37
+ marginBottom: theme.spacing(-0.625)
38
+ },
39
+ colorPrimary: {
40
+ ["&.".concat(radioClasses.disabled, ".").concat(radioClasses.checked)]: {
41
+ color: Color.Silver500
42
+ },
43
+ ["&:hover:not(.".concat(radioClasses.checked, ")")]: {
44
+ color: Color.Dark100
45
+ }
46
+ }
47
+ }
48
+ };
49
+ }
@@ -0,0 +1,15 @@
1
+ import { useResponsiveContext } from "./ResponsiveContext.js";
2
+ var BREAKPOINTS = ['xs', 'sm', 'md', 'lg', 'xl'];
3
+ export function useCollapseBreakpoint(collapseBreakpoint) {
4
+ var {
5
+ breakpoint = 'xs'
6
+ } = useResponsiveContext();
7
+
8
+ if (collapseBreakpoint == null) {
9
+ return false;
10
+ }
11
+
12
+ var breakpointIDX = BREAKPOINTS.indexOf(breakpoint);
13
+ var collapseBreakpointIDX = BREAKPOINTS.indexOf(collapseBreakpoint);
14
+ return breakpointIDX < collapseBreakpointIDX;
15
+ }
@@ -0,0 +1,31 @@
1
+ import { useMediaQuery } from '@mui/material';
2
+ import { createContext, useContext, useMemo } from 'react';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ var Context = /*#__PURE__*/createContext({});
5
+
6
+ function useBreakpoint(breakpoint) {
7
+ return useMediaQuery(theme => theme.breakpoints.only(breakpoint));
8
+ }
9
+
10
+ export function ResponsiveContextProvider(_ref) {
11
+ var {
12
+ children,
13
+ defaultBreakpoint
14
+ } = _ref;
15
+ var isXS = useBreakpoint('xs');
16
+ var isSM = useBreakpoint('sm');
17
+ var isMD = useBreakpoint('md');
18
+ var isLG = useBreakpoint('lg');
19
+ var isXL = useBreakpoint('xl');
20
+ var breakpoint = isXS ? 'xs' : isSM ? 'sm' : isMD ? 'md' : isLG ? 'lg' : isXL ? 'xl' : defaultBreakpoint;
21
+ var ctx = useMemo(() => ({
22
+ breakpoint
23
+ }), [breakpoint]);
24
+ return /*#__PURE__*/_jsx(Context.Provider, {
25
+ value: ctx,
26
+ children: children
27
+ });
28
+ }
29
+ export function useResponsiveContext() {
30
+ return useContext(Context);
31
+ }
@@ -0,0 +1,53 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
+ var _excluded = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
4
+ import { Portal, Slide, Snackbar as MaterialSnackbar } from '@mui/material';
5
+ import { forwardRef } from 'react';
6
+ import { SnackbarContent } from "./SnackbarContent.js";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+
9
+ function SlideTransition(props) {
10
+ return /*#__PURE__*/_jsx(Slide, _objectSpread(_objectSpread({}, props), {}, {
11
+ direction: "up"
12
+ }));
13
+ }
14
+
15
+ export var Snackbar = /*#__PURE__*/forwardRef((_ref, ref) => {
16
+ var {
17
+ open,
18
+ action,
19
+ variant,
20
+ onClose,
21
+ children,
22
+ ContentProps,
23
+ hasCloseButton = onClose != null,
24
+ TransitionComponent = SlideTransition
25
+ } = _ref,
26
+ props = _objectWithoutProperties(_ref, _excluded);
27
+
28
+ function handleClose(reason) {
29
+ if (reason !== 'clickaway') {
30
+ onClose === null || onClose === void 0 ? void 0 : onClose(reason === 'timeout' ? 'timeout' : 'explicit');
31
+ }
32
+ }
33
+
34
+ return /*#__PURE__*/_jsx(Portal, {
35
+ children: /*#__PURE__*/_jsx(MaterialSnackbar, _objectSpread(_objectSpread({}, props), {}, {
36
+ ref: ref,
37
+ open: open,
38
+ TransitionComponent: TransitionComponent,
39
+ onClose: (_, reason) => {
40
+ handleClose(reason);
41
+ },
42
+ children: /*#__PURE__*/_jsx(SnackbarContent, _objectSpread(_objectSpread({}, ContentProps), {}, {
43
+ action: action,
44
+ variant: variant,
45
+ onClose: !hasCloseButton ? undefined : () => {
46
+ handleClose('explicit');
47
+ },
48
+ children: children
49
+ }))
50
+ }))
51
+ });
52
+ });
53
+ if (process.env.NODE_ENV !== "production") Snackbar.displayName = "Snackbar";
@@ -0,0 +1,105 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["action", "children", "onClose", "className", "classes", "variant"],
4
+ _excluded2 = ["icon", "closeButton", "variantError", "variantSuccess"];
5
+ import { CheckCircle, Close, Warning } from '@mui/icons-material';
6
+ import { Grid, IconButton, SnackbarContent as MuiSnackbarContent } from '@mui/material';
7
+ import { makeStyles } from '@mui/styles';
8
+ import clsx from 'clsx';
9
+ import { forwardRef } from 'react';
10
+ import { Color } from "../theme/Color.js";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ var useStyles = /*#__PURE__*/makeStyles(theme => ({
15
+ root: {
16
+ color: Color.White,
17
+ backgroundColor: Color.Dark500,
18
+ '&$variantError': {
19
+ color: Color.White,
20
+ backgroundColor: Color.Red500
21
+ }
22
+ },
23
+ action: {
24
+ paddingLeft: theme.spacing(1)
25
+ },
26
+ message: {
27
+ alignItems: 'center',
28
+ [theme.breakpoints.down('xs')]: {
29
+ fontSize: theme.spacing(2)
30
+ }
31
+ },
32
+ icon: {
33
+ marginRight: theme.spacing(1),
34
+ fontSize: theme.spacing(3)
35
+ },
36
+ closeButton: {
37
+ color: Color.White40,
38
+ '&:hover, &:focus': {
39
+ backgroundColor: Color.White08,
40
+ color: Color.White40
41
+ }
42
+ },
43
+ variantError: {},
44
+ variantSuccess: {}
45
+ }), {
46
+ name: 'SD-SnackbarContent'
47
+ });
48
+ export var SnackbarContent = /*#__PURE__*/forwardRef((_ref, ref) => {
49
+ var {
50
+ action,
51
+ children,
52
+ onClose,
53
+ className,
54
+ classes,
55
+ variant = 'default'
56
+ } = _ref,
57
+ props = _objectWithoutProperties(_ref, _excluded);
58
+
59
+ var _useStyles = useStyles({
60
+ classes
61
+ }),
62
+ {
63
+ icon,
64
+ closeButton,
65
+ variantError,
66
+ variantSuccess
67
+ } = _useStyles,
68
+ styles = _objectWithoutProperties(_useStyles, _excluded2);
69
+
70
+ var Icon = variant === 'error' ? Warning : variant === 'success' ? CheckCircle : undefined;
71
+ return /*#__PURE__*/_jsx(MuiSnackbarContent, _objectSpread(_objectSpread({}, props), {}, {
72
+ ref: ref,
73
+ classes: styles,
74
+ className: clsx(className, {
75
+ 'error': variantError,
76
+ 'success': variantSuccess
77
+ }[variant]),
78
+ message: /*#__PURE__*/_jsxs(_Fragment, {
79
+ children: [Icon && /*#__PURE__*/_jsx(Icon, {
80
+ className: icon
81
+ }), children]
82
+ }),
83
+ action: !action && !onClose ? null : /*#__PURE__*/_jsxs(Grid, {
84
+ container: true,
85
+ spacing: 1,
86
+ alignItems: "center",
87
+ wrap: "nowrap",
88
+ children: [!!action && /*#__PURE__*/_jsx(Grid, {
89
+ item: true,
90
+ children: action
91
+ }), onClose && /*#__PURE__*/_jsx(Grid, {
92
+ item: true,
93
+ children: /*#__PURE__*/_jsx(IconButton, {
94
+ "aria-label": "close",
95
+ onClick: onClose,
96
+ className: closeButton,
97
+ children: /*#__PURE__*/_jsx(Close, {
98
+ fontSize: "small"
99
+ })
100
+ })
101
+ })]
102
+ })
103
+ }));
104
+ });
105
+ if (process.env.NODE_ENV !== "production") SnackbarContent.displayName = "SnackbarContent";
@@ -0,0 +1,35 @@
1
+ export function overrideSnackbar(theme) {
2
+ theme.components.MuiSnackbar = {
3
+ defaultProps: {
4
+ anchorOrigin: {
5
+ vertical: 'bottom',
6
+ horizontal: 'center'
7
+ }
8
+ },
9
+ styleOverrides: {
10
+ anchorOriginBottomCenter: {
11
+ left: 0,
12
+ right: 0,
13
+ bottom: 0
14
+ }
15
+ }
16
+ };
17
+ theme.components.MuiSnackbarContent = {
18
+ styleOverrides: {
19
+ root: {
20
+ width: '100%',
21
+ borderRadius: 0,
22
+ minHeight: theme.spacing(7.5),
23
+ [theme.breakpoints.up('sm')]: {
24
+ width: theme.spacing(54),
25
+ maxWidth: theme.spacing(54),
26
+ borderRadius: theme.spacing(0.5)
27
+ }
28
+ },
29
+ message: {
30
+ flex: 1,
31
+ display: 'flex'
32
+ }
33
+ }
34
+ };
35
+ }