@applica-software-guru/react-admin 1.5.346 → 1.5.348

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/package.json CHANGED
@@ -108,5 +108,5 @@
108
108
  "type": "module",
109
109
  "types": "dist/index.d.ts",
110
110
  "typings": "dist/index.d.ts",
111
- "version": "1.5.346"
111
+ "version": "1.5.348"
112
112
  }
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable filenames/match-regex */
2
- import { DropboxOutlined } from '@ant-design/icons';
3
2
  import { Box, SxProps, Typography, styled } from '@mui/material';
4
3
  import { useGetResourceLabel, useResourceContext, useResourceDefinition, useTranslate } from 'ra-core';
5
4
  import * as React from 'react';
6
5
  import { CreateButton } from '@/components/ra-buttons';
7
6
  import clsx from 'clsx';
7
+ import { EmptyIcon, NotFoundIcon } from './icons';
8
8
 
9
9
  type EmptyProps = {
10
10
  /**
@@ -72,25 +72,31 @@ const Root = styled('span', {
72
72
  height: 'calc(100vh - 200px)',
73
73
  [`& .${EmptyClasses.message}`]: {
74
74
  textAlign: 'center',
75
- opacity: theme.palette.mode === 'light' ? 0.5 : 0.8,
75
+ opacity: theme.palette.mode === 'light' ? 1 : 0.8,
76
76
  margin: '0 1em',
77
77
  color: theme.palette.mode === 'light' ? 'inherit' : theme.palette.text.primary
78
78
  },
79
-
80
79
  [`& .${EmptyClasses.icon}`]: {
81
80
  fontSize: '9em',
82
81
  marginTop: '16px',
83
82
  marginBottom: '16px'
84
83
  },
85
-
86
84
  [`& .${EmptyClasses.toolbar}`]: {
87
85
  textAlign: 'center'
88
86
  }
89
87
  }));
90
88
 
89
+ function getEmptyIcon({ icon, className }: { icon?: React.ReactNode; className?: string }) {
90
+ if (icon !== undefined) return icon;
91
+ if (className?.includes('RaList-noResults')) {
92
+ return <NotFoundIcon className={EmptyClasses.icon} />;
93
+ }
94
+ return <EmptyIcon className={EmptyClasses.icon} />;
95
+ }
96
+
91
97
  /**
92
- * The Empty component is used to display a message when the list is empty.
93
- * This component can be used only inside a List component.
98
+ * Mostra una pagina vuota per le liste senza risultati o senza dati.
99
+ * Da usare solo all'interno di un componente List.
94
100
  *
95
101
  * @example
96
102
  * <List empty={<Empty actions={<Button label="Add" onClick={add} />} />} />
@@ -98,19 +104,17 @@ const Root = styled('span', {
98
104
  function Empty({
99
105
  actions,
100
106
  className,
101
- hasCreate: _hasCreate,
102
- icon = <DropboxOutlined className={EmptyClasses.icon} />,
107
+ hasCreate: hasCreateProp,
108
+ icon,
103
109
  title,
104
110
  subtitle,
105
111
  sx,
106
112
  ...props
107
113
  }: EmptyProps): JSX.Element {
108
114
  const { hasCreate } = useResourceDefinition(props);
109
- const canCreate = _hasCreate !== undefined ? _hasCreate : hasCreate;
115
+ const canCreate = hasCreateProp !== undefined ? hasCreateProp : hasCreate;
110
116
  const resource = useResourceContext(props);
111
-
112
117
  const translate = useTranslate();
113
-
114
118
  const getResourceLabel = useGetResourceLabel();
115
119
  const resourceName = resource
116
120
  ? translate(`resources.${resource}.forcedCaseName`, {
@@ -118,14 +122,13 @@ function Empty({
118
122
  _: getResourceLabel(resource, 0)
119
123
  })
120
124
  : translate('ra.empty.no_resource');
121
-
122
125
  const emptyMessage = translate('ra.page.empty', { name: resourceName });
123
126
  const inviteMessage = translate('ra.page.invite');
124
127
 
125
128
  return (
126
129
  <Root className={clsx(`${PREFIX}-root`, className)} sx={sx}>
127
130
  <Box className={EmptyClasses.message}>
128
- {icon}
131
+ {getEmptyIcon({ icon, className })}
129
132
  <Typography variant="h4" paragraph>
130
133
  {title ||
131
134
  translate(`resources.${resource}.empty`, {
@@ -142,7 +145,7 @@ function Empty({
142
145
  ) : null)}
143
146
  </Box>
144
147
  <StyledToolbar className={EmptyClasses.toolbar}>
145
- {actions || (canCreate ? <CreateButton disableFloatingButton /> : null)}
148
+ {actions || (canCreate ? <CreateButton variant="contained" size="medium" disableFloatingButton /> : null)}
146
149
  </StyledToolbar>
147
150
  </Root>
148
151
  );
@@ -121,10 +121,15 @@ const StyledList = styled(RaList, { slot: 'root' })(({ theme }) => ({
121
121
  '& .MuiButton-root': {
122
122
  margin: 0
123
123
  },
124
+
124
125
  '& .RaList-actions': {
125
126
  minHeight: 80,
126
127
  alignItems: 'center',
127
128
  padding: theme.spacing(2.5),
129
+ borderTopLeftRadius: `${theme.shape.borderRadius}px`,
130
+ borderTopRightRadius: `${theme.shape.borderRadius}px`,
131
+ borderBottomLeftRadius: 0,
132
+ borderBottomRightRadius: 0,
128
133
  [theme.breakpoints.down('sm')]: {
129
134
  flexDirection: 'row'
130
135
  },
@@ -193,10 +198,23 @@ const StyledList = styled(RaList, { slot: 'root' })(({ theme }) => ({
193
198
  flexDirection: 'column',
194
199
  justifyContent: 'center',
195
200
  alignItems: 'center',
196
- height: 'calc(100vh - 260px)'
201
+ height: 'calc(100vh - 260px)',
202
+ backgroundColor: theme.palette.background.paper,
203
+ border: '1px solid',
204
+ borderTop: 'none',
205
+ borderColor: theme.palette.mode === 'dark' ? theme.palette.divider : theme.palette.grey.A800,
206
+ borderBottomLeftRadius: `${theme.shape.borderRadius}px`,
207
+ borderBottomRightRadius: `${theme.shape.borderRadius}px`
197
208
  }
198
209
  },
199
210
 
211
+ '& .RaList-noResults': {
212
+ backgroundColor: theme.palette.background.paper,
213
+ border: '1px solid',
214
+ borderColor: theme.palette.mode === 'dark' ? theme.palette.divider : theme.palette.grey.A800,
215
+ borderRadius: `${theme.shape.borderRadius}px`
216
+ },
217
+
200
218
  '& .RaEmpty-toolbar': {
201
219
  margin: theme.spacing(2)
202
220
  }