@evoke-platform/ui-components 1.0.0-dev.209 → 1.0.0-dev.211
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/published/components/core/Alert/Alert.js +50 -2
- package/dist/published/components/core/AlertTitle/AlertTitle.d.ts +4 -0
- package/dist/published/components/core/AlertTitle/AlertTitle.js +8 -0
- package/dist/published/components/core/AlertTitle/index.d.ts +2 -0
- package/dist/published/components/core/AlertTitle/index.js +2 -0
- package/dist/published/components/core/Snackbar/Snackbar.js +8 -34
- package/dist/published/components/core/index.d.ts +1 -0
- package/dist/published/components/core/index.js +1 -0
- package/dist/published/components/custom/DataGrid/DataGrid.d.ts +1 -0
- package/dist/published/components/custom/DataGrid/DataGrid.js +2 -1
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +1 -0
- package/dist/published/components/custom/DataGrid/Toolbar.js +2 -3
- package/dist/published/stories/Alert.stories.js +12 -1
- package/dist/published/stories/AlertTitle.stories.d.ts +6 -0
- package/dist/published/stories/AlertTitle.stories.js +10 -0
- package/package.json +1 -1
@@ -1,8 +1,56 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { Alert as MUIAlert } from '@mui/material';
|
3
|
+
import { CheckCircle, Close, ErrorRounded, InfoRounded, WarningRounded } from '@mui/icons-material';
|
4
|
+
import Box from '../../layout/Box';
|
5
|
+
import IconButton from '../IconButton';
|
6
|
+
import Typography from '../Typography';
|
3
7
|
import UIThemeProvider from '../../../theme';
|
8
|
+
const styles = {
|
9
|
+
container: {
|
10
|
+
display: 'flex',
|
11
|
+
backgroundColor: 'white',
|
12
|
+
minHeight: '40px',
|
13
|
+
width: '400px',
|
14
|
+
padding: '7px',
|
15
|
+
border: '1px solid #919EAB7A',
|
16
|
+
borderRadius: '8px',
|
17
|
+
boxShadow: '0px 8px 16px 0px rgba(0, 0, 0, 0.12)',
|
18
|
+
alignItems: 'center',
|
19
|
+
},
|
20
|
+
icon: {
|
21
|
+
padding: 0,
|
22
|
+
width: '25px',
|
23
|
+
},
|
24
|
+
};
|
25
|
+
const colorMap = {
|
26
|
+
error: '#A22723',
|
27
|
+
success: '#229A16',
|
28
|
+
info: '#0C53B7',
|
29
|
+
warning: '#B78103',
|
30
|
+
};
|
4
31
|
const Alert = (props) => {
|
5
|
-
|
6
|
-
|
32
|
+
const { children, action, severity, onClose, color } = props;
|
33
|
+
const getIcon = () => {
|
34
|
+
var _a;
|
35
|
+
const iconColor = color ? (_a = colorMap[color]) !== null && _a !== void 0 ? _a : color : severity ? colorMap[severity] : colorMap['success'];
|
36
|
+
switch (severity) {
|
37
|
+
case 'error':
|
38
|
+
return React.createElement(ErrorRounded, { sx: Object.assign(Object.assign({}, styles.icon), { color: iconColor }) });
|
39
|
+
case 'success':
|
40
|
+
return React.createElement(CheckCircle, { sx: Object.assign(Object.assign({}, styles.icon), { color: iconColor }) });
|
41
|
+
case 'info':
|
42
|
+
return React.createElement(InfoRounded, { sx: Object.assign(Object.assign({}, styles.icon), { color: iconColor }) });
|
43
|
+
case 'warning':
|
44
|
+
return React.createElement(WarningRounded, { sx: Object.assign(Object.assign({}, styles.icon), { color: iconColor }) });
|
45
|
+
default:
|
46
|
+
return React.createElement(CheckCircle, { sx: Object.assign(Object.assign({}, styles.icon), { color: iconColor }) });
|
47
|
+
}
|
48
|
+
};
|
49
|
+
return (React.createElement(UIThemeProvider, null, props.variant === 'outlined' ? (React.createElement(Box, { sx: Object.assign(Object.assign({}, styles.container), props.sx) },
|
50
|
+
React.createElement(Box, { margin: '5px', marginRight: '10px' }, getIcon()),
|
51
|
+
React.createElement(Typography, { fontSize: '14px', fontWeight: 400, sx: { marginRight: '3px' } }, children),
|
52
|
+
action,
|
53
|
+
React.createElement(IconButton, { size: "small", "aria-label": "close", color: "inherit", sx: { marginLeft: 'auto', marginRight: '15px' }, onClick: (event) => onClose && onClose(event) },
|
54
|
+
React.createElement(Close, { fontSize: "small" })))) : (React.createElement(MUIAlert, Object.assign({}, props)))));
|
7
55
|
};
|
8
56
|
export default Alert;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { AlertTitle as MUIAlertTitle } from '@mui/material';
|
3
|
+
import UIThemeProvider from '../../../theme';
|
4
|
+
const AlertTitle = (props) => {
|
5
|
+
return (React.createElement(UIThemeProvider, null,
|
6
|
+
React.createElement(MUIAlertTitle, Object.assign({}, props))));
|
7
|
+
};
|
8
|
+
export default AlertTitle;
|
@@ -1,40 +1,14 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { Snackbar as MUISnackbar } from '@mui/material';
|
3
3
|
import UIThemeProvider from '../../../theme';
|
4
|
-
import
|
5
|
-
import { CheckCircle, Close, InfoRounded } from '@mui/icons-material';
|
6
|
-
import Box from '../../layout/Box';
|
7
|
-
import Typography from '../Typography';
|
8
|
-
const styles = {
|
9
|
-
container: {
|
10
|
-
display: 'flex',
|
11
|
-
backgroundColor: 'white',
|
12
|
-
minHeight: '40px',
|
13
|
-
width: '400px',
|
14
|
-
padding: '7px',
|
15
|
-
border: '1px solid #919EAB7A',
|
16
|
-
borderRadius: '8px',
|
17
|
-
boxShadow: '0px 8px 16px 0px rgba(0, 0, 0, 0.12)',
|
18
|
-
alignItems: 'center',
|
19
|
-
},
|
20
|
-
icon: {
|
21
|
-
padding: 0,
|
22
|
-
width: '25px',
|
23
|
-
},
|
24
|
-
};
|
4
|
+
import { Alert } from '../Alert';
|
25
5
|
export const Snackbar = (props) => {
|
26
|
-
const { handleClose, error, message, autoHideDuration, action } = props;
|
27
|
-
return (React.createElement(UIThemeProvider, null,
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
React.createElement("
|
33
|
-
React.createElement(Box, { sx: styles.container },
|
34
|
-
React.createElement(Box, { margin: '5px', marginRight: '10px' }, error ? (React.createElement(InfoRounded, { sx: Object.assign(Object.assign({}, styles.icon), { color: '#A22723' }) })) : (React.createElement(CheckCircle, { sx: Object.assign(Object.assign({}, styles.icon), { color: '#229A16' }) }))),
|
35
|
-
React.createElement(Typography, { fontSize: '14px', fontWeight: 400, sx: { marginRight: '3px' } }, message !== null && message !== void 0 ? message : ''),
|
36
|
-
action,
|
37
|
-
React.createElement(IconButton, { size: "small", "aria-label": "close", color: "inherit", sx: { marginLeft: 'auto', marginRight: '15px' }, onClick: () => handleClose() },
|
38
|
-
React.createElement(Close, { fontSize: "small" })))))));
|
6
|
+
const { handleClose, error, message, autoHideDuration, action, children } = props;
|
7
|
+
return (React.createElement(UIThemeProvider, null, children ? (React.createElement(MUISnackbar, Object.assign({}, props))) : (React.createElement(MUISnackbar, Object.assign({ autoHideDuration: autoHideDuration !== null && autoHideDuration !== void 0 ? autoHideDuration : 6000, onClose: () => handleClose(), anchorOrigin: {
|
8
|
+
vertical: 'bottom',
|
9
|
+
horizontal: 'center',
|
10
|
+
} }, props),
|
11
|
+
React.createElement("div", null,
|
12
|
+
React.createElement(Alert, { variant: "outlined", severity: error ? 'error' : 'success', onClose: () => handleClose(), action: action }, message))))));
|
39
13
|
};
|
40
14
|
export default Snackbar;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export { Accordion, AccordionDetails, AccordionActions, AccordionSummary } from './Accordion';
|
2
2
|
export { AppBar } from './AppBar';
|
3
3
|
export { Alert } from './Alert';
|
4
|
+
export { AlertTitle } from './AlertTitle';
|
4
5
|
export { Autocomplete } from './Autocomplete';
|
5
6
|
export { Avatar } from './Avatar';
|
6
7
|
export { Backdrop } from './Backdrop';
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export { Accordion, AccordionDetails, AccordionActions, AccordionSummary } from './Accordion';
|
2
2
|
export { AppBar } from './AppBar';
|
3
3
|
export { Alert } from './Alert';
|
4
|
+
export { AlertTitle } from './AlertTitle';
|
4
5
|
export { Autocomplete } from './Autocomplete';
|
5
6
|
export { Avatar } from './Avatar';
|
6
7
|
export { Backdrop } from './Backdrop';
|
@@ -15,5 +15,6 @@ export declare type DataGridProps<T extends GridValidRowModel> = MuiDataGridProp
|
|
15
15
|
mode: 'client' | 'server';
|
16
16
|
maxRows?: number;
|
17
17
|
};
|
18
|
+
hideSearchbar?: boolean;
|
18
19
|
};
|
19
20
|
export default function <T extends GridValidRowModel>(props: DataGridProps<T>): JSX.Element;
|
@@ -16,7 +16,7 @@ import UIThemeProvider from '../../../theme';
|
|
16
16
|
import { Box, Typography } from '@mui/material';
|
17
17
|
export default function (props) {
|
18
18
|
var _a;
|
19
|
-
const { onRefresh, loading, theme, title, bulkAction, filterSettings, columns, rows } = props, rest = __rest(props, ["onRefresh", "loading", "theme", "title", "bulkAction", "filterSettings", "columns", "rows"]);
|
19
|
+
const { onRefresh, loading, theme, title, bulkAction, filterSettings, columns, rows, hideSearchbar } = props, rest = __rest(props, ["onRefresh", "loading", "theme", "title", "bulkAction", "filterSettings", "columns", "rows", "hideSearchbar"]);
|
20
20
|
const [anchorEl, setAnchorEl] = useState();
|
21
21
|
const addColumnFilterOperators = (columns) => {
|
22
22
|
return (filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.mode) === 'server'
|
@@ -70,6 +70,7 @@ export default function (props) {
|
|
70
70
|
theme,
|
71
71
|
title,
|
72
72
|
bulkAction,
|
73
|
+
hideSearchbar,
|
73
74
|
},
|
74
75
|
panel: {
|
75
76
|
anchorEl: anchorEl,
|
@@ -7,7 +7,7 @@ import UIThemeProvider from '../../../theme';
|
|
7
7
|
import { Typography } from '@mui/material';
|
8
8
|
function Toolbar(props) {
|
9
9
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
10
|
-
const { onRefresh, setAnchorEl, loading, theme, title, bulkAction } = props;
|
10
|
+
const { onRefresh, setAnchorEl, loading, theme, title, bulkAction, hideSearchbar } = props;
|
11
11
|
const styles = {
|
12
12
|
container: { display: 'flex', justifyContent: 'space-between', margin: '0 0 15px 0' },
|
13
13
|
iconButton: {
|
@@ -48,8 +48,7 @@ function Toolbar(props) {
|
|
48
48
|
React.createElement(Grid, { container: true, sx: styles.container },
|
49
49
|
title && (React.createElement(Grid, { xs: 12, sx: { marginBottom: '15px' } },
|
50
50
|
React.createElement(Typography, { sx: { fontSize: '20px', fontWeight: 700 } }, title))),
|
51
|
-
React.createElement(Grid, { item: true, xs: 6 },
|
52
|
-
React.createElement(GridToolbarQuickFilter, { variant: "outlined", size: "small", sx: styles.quickFilter })),
|
51
|
+
React.createElement(Grid, { item: true, xs: 6 }, !hideSearchbar && (React.createElement(GridToolbarQuickFilter, { variant: "outlined", size: "small", sx: styles.quickFilter }))),
|
53
52
|
!bulkAction ? (React.createElement(Grid, { item: true },
|
54
53
|
React.createElement(Grid, { container: true, spacing: 1, sx: styles.icon },
|
55
54
|
React.createElement(Grid, { item: true, sx: { paddingRight: '15px' } },
|
@@ -3,6 +3,17 @@ import { Alert as CustomAlert } from '../index';
|
|
3
3
|
export default {
|
4
4
|
title: 'Data Display/Alert',
|
5
5
|
component: CustomAlert,
|
6
|
+
argTypes: {
|
7
|
+
severity: {
|
8
|
+
control: {
|
9
|
+
type: 'radio',
|
10
|
+
options: ['error', 'success', 'info', 'warning'],
|
11
|
+
},
|
12
|
+
},
|
13
|
+
},
|
6
14
|
};
|
7
|
-
const AlertTemplate = (args) => (React.createElement(CustomAlert, Object.assign({
|
15
|
+
const AlertTemplate = (args) => (React.createElement(CustomAlert, Object.assign({}, args), "This is an alert \u2014 check it out!"));
|
8
16
|
export const Alert = AlertTemplate.bind({});
|
17
|
+
Alert.args = {
|
18
|
+
severity: 'error',
|
19
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
3
|
+
import { AlertTitleProps } from '@mui/material';
|
4
|
+
declare const _default: ComponentMeta<(props: AlertTitleProps) => JSX.Element>;
|
5
|
+
export default _default;
|
6
|
+
export declare const AlertTitle: ComponentStory<(props: AlertTitleProps) => JSX.Element>;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Alert, AlertTitle as CustomAlertTitle } from '../index';
|
3
|
+
export default {
|
4
|
+
title: 'Data Display/Alert Title',
|
5
|
+
component: CustomAlertTitle,
|
6
|
+
};
|
7
|
+
const AlertTitleTemplate = (args) => (React.createElement(Alert, { severity: "error" },
|
8
|
+
React.createElement(CustomAlertTitle, Object.assign({}, args), "Success"),
|
9
|
+
"Your data was successfully submitted."));
|
10
|
+
export const AlertTitle = AlertTitleTemplate.bind({});
|