@evoke-platform/ui-components 1.0.0-dev.211 → 1.0.0-dev.213

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.
@@ -39,7 +39,7 @@ const Autocomplete = (props) => {
39
39
  return (React.createElement(UIThemeProvider, null,
40
40
  React.createElement(InputLabel, { htmlFor: (_a = props.id) !== null && _a !== void 0 ? _a : '', sx: { display: 'flex', paddingBottom: '0px', fontSize: '14px' } }, (_b = props.label) !== null && _b !== void 0 ? _b : '',
41
41
  ' ',
42
- props.required ? (React.createElement(Typography, { sx: { color: 'red', fontSize: '14px' }, component: 'span' }, "*")) : null,
42
+ props.required ? (React.createElement(Typography, { sx: { color: 'red', fontSize: '14px', marginLeft: '4px', alignSelf: 'flex-start' } }, "*")) : null,
43
43
  props.tooltip && (React.createElement(Tooltip, { title: props.tooltip, placement: "right" },
44
44
  React.createElement(InfoRounded, { sx: {
45
45
  fontSize: '14px',
@@ -36,6 +36,12 @@ const DatePicker = (props) => {
36
36
  handleChange(newValue, keyboardInputValue);
37
37
  };
38
38
  return (React.createElement(UIThemeProvider, null,
39
- React.createElement(MUIDatePicker, Object.assign({ value: value, onChange: onChange, renderInput: (params) => React.createElement(TextField, Object.assign({}, params)) }, rest))));
39
+ React.createElement(MUIDatePicker, Object.assign({ value: value, onChange: onChange, renderInput: (params) => React.createElement(TextField, Object.assign({}, params)), PaperProps: {
40
+ sx: {
41
+ '&.MuiPickersPopper-paper': {
42
+ borderRadius: '12px',
43
+ },
44
+ },
45
+ } }, rest))));
40
46
  };
41
47
  export default DatePicker;
@@ -4,8 +4,8 @@ import { InfoRounded } from '@mui/icons-material';
4
4
  const FieldError = (props) => {
5
5
  var _a;
6
6
  const label = (_a = props.label) !== null && _a !== void 0 ? _a : (props.required ? 'Required Field' : '');
7
- return label ? (React.createElement(Box, { display: 'flex' },
8
- React.createElement(InfoRounded, { color: 'error', sx: { fontSize: '12px', paddingRight: '3px', paddingTop: '5px' } }),
7
+ return label ? (React.createElement(Box, { display: 'flex', alignItems: 'center' },
8
+ React.createElement(InfoRounded, { color: 'error', sx: { fontSize: '.75rem', marginRight: '3px' } }),
9
9
  React.createElement(Typography, { fontSize: '12px', color: 'error' }, label))) : null;
10
10
  };
11
11
  export default FieldError;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { LoadingButtonProps } from '@mui/lab';
3
+ declare const LoadingButton: (props: LoadingButtonProps) => JSX.Element;
4
+ export default LoadingButton;
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { LoadingButton as MUILoadingButton } from '@mui/lab';
3
+ import UIThemeProvider from '../../../theme';
4
+ const LoadingButton = (props) => {
5
+ return (React.createElement(UIThemeProvider, null,
6
+ React.createElement(MUILoadingButton, Object.assign({}, props, { sx: Object.assign({ borderRadius: '8px', boxShadow: 'none', '&:hover': { boxShadow: 'none' } }, props.sx) }), props === null || props === void 0 ? void 0 : props.children)));
7
+ };
8
+ export default LoadingButton;
@@ -0,0 +1,3 @@
1
+ import LoadingButton from './LoadingButton';
2
+ export default LoadingButton;
3
+ export { LoadingButton };
@@ -0,0 +1,3 @@
1
+ import LoadingButton from './LoadingButton';
2
+ export default LoadingButton;
3
+ export { LoadingButton };
@@ -23,7 +23,11 @@ const TextField = (props) => {
23
23
  ' ',
24
24
  props.required ? (React.createElement(Typography, { sx: { color: 'red', fontSize: '14px' }, component: 'span' }, "*")) : null),
25
25
  instructionText && React.createElement(Typography, { variant: 'caption' }, instructionText),
26
- React.createElement(MUITextField, Object.assign({}, props, { label: null, inputProps: { readOnly: readOnly, 'aria-readonly': !!readOnly, 'data-testid': 'label-outside' }, sx: readOnly
26
+ React.createElement(MUITextField, Object.assign({ inputProps: {
27
+ readOnly: readOnly,
28
+ 'aria-readonly': !!readOnly,
29
+ 'data-testid': 'label-outside',
30
+ } }, props, { label: null, sx: readOnly
27
31
  ? Object.assign(Object.assign({}, readOnlyStyles), props.sx) : Object.assign({ '& fieldset': { borderRadius: '8px' } }, props.sx) })),
28
32
  error && React.createElement(FieldError, { required: required, label: errorMessage }))) : (React.createElement(React.Fragment, null,
29
33
  React.createElement(MUITextField, Object.assign({ inputProps: { readOnly: readOnly, 'aria-readonly': !!readOnly, 'data-testid': 'label-inside' } }, props, { sx: readOnly
@@ -18,6 +18,7 @@ export { Drawer } from './Drawer';
18
18
  export { LinearProgress } from './LinearProgress';
19
19
  export { Link } from './Link';
20
20
  export * from './LocalizationProvider';
21
+ export { LoadingButton } from './LoadingButton';
21
22
  export { Menu, MenuItem } from './Menu';
22
23
  export { Skeleton } from './Skeleton';
23
24
  export { Snackbar } from './Snackbar';
@@ -45,8 +46,8 @@ export { Step, StepLabel, Stepper, StepContent, StepButton, StepIcon, StepConnec
45
46
  export { Popover } from './Popover';
46
47
  export { Popper } from './Popper';
47
48
  export { SvgIcon, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, ListItemButton, ListItemText, CardActions, CardActionArea, CardContent, CardMedia, CardHeader, Input, InputLabel, InputAdornment, } from '@mui/material';
48
- export { LoadingButton, TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
49
+ export { TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
49
50
  export { useGridApiRef } from '@mui/x-data-grid';
50
51
  export type { GridSize } from '@mui/material';
51
52
  export type { AutocompleteOption } from './Autocomplete/Autocomplete';
52
- export type { GridCellParams, GridColDef, GridFilterModel, GridValueFormatterParams, GridValueGetterParams, GridEventListener, } from '@mui/x-data-grid';
53
+ export type { GridCellParams, GridColDef, GridRowParams, GridFilterModel, GridValueFormatterParams, GridValueGetterParams, GridEventListener, GridInitialState, } from '@mui/x-data-grid';
@@ -18,6 +18,7 @@ export { Drawer } from './Drawer';
18
18
  export { LinearProgress } from './LinearProgress';
19
19
  export { Link } from './Link';
20
20
  export * from './LocalizationProvider';
21
+ export { LoadingButton } from './LoadingButton';
21
22
  export { Menu, MenuItem } from './Menu';
22
23
  export { Skeleton } from './Skeleton';
23
24
  export { Snackbar } from './Snackbar';
@@ -46,5 +47,5 @@ export { Popover } from './Popover';
46
47
  export { Popper } from './Popper';
47
48
  //TODO: Review following components. They also need theme control:
48
49
  export { SvgIcon, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, ListItemButton, ListItemText, CardActions, CardActionArea, CardContent, CardMedia, CardHeader, Input, InputLabel, InputAdornment, } from '@mui/material';
49
- export { LoadingButton, TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
50
+ export { TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
50
51
  export { useGridApiRef } from '@mui/x-data-grid';
@@ -5,18 +5,22 @@ export declare type GridAction = {
5
5
  label: string;
6
6
  onClick: () => void;
7
7
  isHidden?: boolean;
8
+ variant?: 'text' | 'outlined' | 'contained';
8
9
  };
9
10
  export declare type BuilderGridProps<T extends GridValidRowModel> = MuiDataGridProps<T> & {
10
- action?: GridAction;
11
+ actions?: GridAction[];
11
12
  item?: string;
12
13
  initialSort?: GridSortItem;
13
14
  emptyContentSelectOptions?: EmptyContentSelectOptions;
15
+ emptyContentActionIndex?: number;
14
16
  title?: string;
17
+ subtitle?: string;
15
18
  disablePagination?: boolean;
16
19
  hideEmptyContent?: boolean;
17
20
  hideToolbar?: boolean;
18
21
  noRowsOverlay?: React.ReactElement;
19
22
  filterComponent?: React.ReactElement;
23
+ error?: number;
20
24
  };
21
25
  declare const BuilderGrid: <T extends GridValidRowModel>(props: BuilderGridProps<T>) => JSX.Element;
22
26
  export default BuilderGrid;
@@ -15,11 +15,12 @@ import React, { useMemo, useState } from 'react';
15
15
  import UIThemeProvider from '../../../theme';
16
16
  import BuilderGridToolbar from './BuilderGridToolbar';
17
17
  import { EmptyContent } from './EmptyContent';
18
+ import ErrorComponent from '../ErrorComponent';
18
19
  const BuilderGrid = (props) => {
19
- var _a, _b;
20
- const { loading, action, item, rows, initialSort, emptyContentSelectOptions, title, disablePagination, hideEmptyContent, hideToolbar, noRowsOverlay, filterComponent } = props, rest = __rest(props, ["loading", "action", "item", "rows", "initialSort", "emptyContentSelectOptions", "title", "disablePagination", "hideEmptyContent", "hideToolbar", "noRowsOverlay", "filterComponent"]);
20
+ var _a, _b, _c, _d, _e;
21
+ const { loading, actions, item, rows, initialSort, emptyContentSelectOptions, emptyContentActionIndex, title, subtitle, disablePagination, hideEmptyContent, hideToolbar, noRowsOverlay, filterComponent, error } = props, rest = __rest(props, ["loading", "actions", "item", "rows", "initialSort", "emptyContentSelectOptions", "emptyContentActionIndex", "title", "subtitle", "disablePagination", "hideEmptyContent", "hideToolbar", "noRowsOverlay", "filterComponent", "error"]);
21
22
  const [anchorEl, setAnchorEl] = useState();
22
- const toolbar = useMemo(() => () => React.createElement(BuilderGridToolbar, { loading: loading, action: action, title: title, filter: filterComponent }), [loading, action]);
23
+ const toolbar = useMemo(() => () => (React.createElement(BuilderGridToolbar, { loading: loading, actions: actions, title: title, subtitle: subtitle, filter: filterComponent })), [loading, actions]);
23
24
  return (React.createElement(UIThemeProvider, null, loading || rows.length || hideEmptyContent ? (React.createElement(Box, { sx: {
24
25
  backgroundColor: '#fff',
25
26
  borderRadius: '6px',
@@ -84,15 +85,26 @@ const BuilderGrid = (props) => {
84
85
  noRowsOverlay: () => {
85
86
  return noRowsOverlay ? noRowsOverlay : null;
86
87
  },
87
- }, rowHeight: 60, columnHeaderHeight: 62 })))) : (React.createElement(React.Fragment, null, rows && !rows.length && (React.createElement(Box, { sx: {
88
+ }, rowHeight: 60, columnHeaderHeight: 62 })))) : (React.createElement(React.Fragment, null, error ? (React.createElement(Box, { sx: {
88
89
  backgroundColor: '#fff',
89
90
  borderRadius: '6px',
90
91
  display: 'flex',
91
92
  alignItems: 'center',
92
93
  justifyContent: 'center',
93
94
  boxShadow: '0px 24px 48px rgba(145, 158, 171, 0.4)',
95
+ width: '100%',
94
96
  height: (_b = (_a = rest.sx) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 'calc(100vh - 240px)',
95
97
  } },
96
- React.createElement(EmptyContent, { item: item, onClick: action === null || action === void 0 ? void 0 : action.onClick, selectOptions: emptyContentSelectOptions })))))));
98
+ React.createElement(ErrorComponent, { code: error === 403 ? 'AccessDenied' : error === 404 ? 'NotFound' : 'Misconfigured', styles: { boxShadow: 'none' } }))) : rows && !rows.length ? (React.createElement(Box, { sx: {
99
+ backgroundColor: '#fff',
100
+ borderRadius: '6px',
101
+ display: 'flex',
102
+ alignItems: 'center',
103
+ justifyContent: 'center',
104
+ boxShadow: '0px 24px 48px rgba(145, 158, 171, 0.4)',
105
+ width: '100%',
106
+ height: (_d = (_c = rest.sx) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 'calc(100vh - 240px)',
107
+ } },
108
+ React.createElement(EmptyContent, { item: item, onClick: (_e = actions === null || actions === void 0 ? void 0 : actions[emptyContentActionIndex !== null && emptyContentActionIndex !== void 0 ? emptyContentActionIndex : 0]) === null || _e === void 0 ? void 0 : _e.onClick, selectOptions: emptyContentSelectOptions }))) : (React.createElement(React.Fragment, null))))));
97
109
  };
98
110
  export default BuilderGrid;
@@ -2,8 +2,9 @@ import { GridToolbarProps as MuiGridToolbarProps } from '@mui/x-data-grid';
2
2
  import React from 'react';
3
3
  import { GridAction } from './BuilderGrid';
4
4
  export declare type BuilderGridToolbar = MuiGridToolbarProps & {
5
- action?: GridAction;
5
+ actions?: GridAction[];
6
6
  title?: string;
7
+ subtitle?: string;
7
8
  filter?: React.ReactElement;
8
9
  };
9
10
  declare function BuilderGridToolbar(props: BuilderGridToolbar): JSX.Element;
@@ -1,12 +1,12 @@
1
- import { Typography } from '@mui/material';
1
+ import { Box, Typography } from '@mui/material';
2
2
  import { GridToolbarContainer, GridToolbarQuickFilter, } from '@mui/x-data-grid';
3
3
  import React from 'react';
4
4
  import UIThemeProvider from '../../../theme';
5
- import { Button } from '../../core';
6
5
  import { Grid } from '../../layout';
6
+ import { ToolbarActions } from './ToolbarActions';
7
7
  function BuilderGridToolbar(props) {
8
8
  var _a, _b, _c;
9
- const { theme, action, title, filter } = props;
9
+ const { theme, actions, title, subtitle, filter } = props;
10
10
  const styles = {
11
11
  container: {
12
12
  display: 'flex',
@@ -42,22 +42,19 @@ function BuilderGridToolbar(props) {
42
42
  };
43
43
  return (React.createElement(UIThemeProvider, { args: { theme: theme } },
44
44
  React.createElement(GridToolbarContainer, { sx: { padding: '0' } },
45
- title && (React.createElement(Typography, { sx: { fontSize: '18px', fontWeight: 700, marginBottom: '6px', marginTop: '6px' } }, title)),
45
+ title && (React.createElement(React.Fragment, null,
46
+ React.createElement(Box, { display: subtitle ? 'flex' : 'block', justifyContent: 'space-between', width: '100%' },
47
+ React.createElement(Box, null,
48
+ React.createElement(Typography, { sx: { fontSize: '18px', fontWeight: 700, marginBottom: '6px', marginTop: '6px' } }, title),
49
+ subtitle && React.createElement(Typography, { sx: { fontSize: '14px' } }, subtitle)),
50
+ React.createElement(ToolbarActions, { actions: actions })))),
46
51
  React.createElement(Grid, { container: true, sx: styles.container },
47
- React.createElement(Grid, { item: true, xs: filter ? 3 : 6, sx: {
52
+ !subtitle && (React.createElement(Grid, { item: true, xs: filter ? 3 : 6, sx: {
48
53
  display: 'flex',
49
54
  alignItems: 'center',
50
55
  } },
51
- React.createElement(GridToolbarQuickFilter, { variant: "outlined", size: "small", sx: Object.assign(Object.assign({}, styles.quickFilter), { flex: filter ? 1 : 0 }) })),
56
+ React.createElement(GridToolbarQuickFilter, { variant: "outlined", size: "small", sx: Object.assign(Object.assign({}, styles.quickFilter), { flex: filter ? 1 : 0 }) }))),
52
57
  filter && (React.createElement(Grid, { xs: 6, item: true, sx: { display: 'flex' } }, filter)),
53
- action && !action.isHidden && (React.createElement(Grid, { item: true, xs: filter ? 3 : 6, display: 'flex', alignItems: 'center', justifyContent: 'flex-end' },
54
- React.createElement(Button, { sx: {
55
- fontWeight: 700,
56
- height: '36px',
57
- padding: '0px 14px',
58
- '&:hover': {
59
- boxShadow: 'none',
60
- },
61
- }, onClick: action.onClick, variant: 'contained' }, action.label)))))));
58
+ !title && React.createElement(ToolbarActions, { actions: actions })))));
62
59
  }
63
60
  export default BuilderGridToolbar;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { GridAction } from './BuilderGrid';
3
+ declare type ToolbarActionsProps = {
4
+ filter?: React.ReactElement;
5
+ actions?: GridAction[];
6
+ };
7
+ export declare const ToolbarActions: (props: ToolbarActionsProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { Button } from '../../core';
3
+ import { Grid } from '../../layout';
4
+ export const ToolbarActions = (props) => {
5
+ const { filter, actions } = props;
6
+ return (React.createElement(Grid, { item: true, container: true, xs: filter ? 3 : 6, display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }, actions === null || actions === void 0 ? void 0 : actions.filter((a) => !a.isHidden).map((action, index) => (React.createElement(Grid, { item: true, display: 'flex', alignItems: 'center', justifyContent: 'flex-end' },
7
+ React.createElement(Button, { sx: {
8
+ fontWeight: 700,
9
+ height: '36px',
10
+ padding: '0px 14px',
11
+ '&:hover': {
12
+ boxShadow: 'none',
13
+ },
14
+ marginRight: index === actions.length - 1 ? '0px' : '16px',
15
+ }, onClick: action.onClick, variant: action.variant || 'contained' }, action.label))))));
16
+ };
@@ -41,7 +41,7 @@ export default function ErrorComponent(props) {
41
41
  return React.createElement(WarningRounded, { sx: { color: '#ef8228' } });
42
42
  }
43
43
  };
44
- return (React.createElement(Grid, { item: true, xs: colspan !== null && colspan !== void 0 ? colspan : 12, sm: 12, sx: Object.assign({ background: 'white', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', boxShadow: '0px 8px 16px 0px rgba(145, 158, 171, 0.12)', borderRadius: '6px', height: 200 }, styles) },
44
+ return (React.createElement(Grid, { item: true, xs: colspan !== null && colspan !== void 0 ? colspan : 12, sm: colspan !== null && colspan !== void 0 ? colspan : 12, sx: Object.assign({ background: 'white', display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', boxShadow: '0px 8px 16px 0px rgba(145, 158, 171, 0.12)', borderRadius: '6px', height: 200 }, styles) },
45
45
  React.createElement(Box, { sx: {
46
46
  padding: '8px',
47
47
  height: '36px',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.0.0-dev.211",
3
+ "version": "1.0.0-dev.213",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",