@applica-software-guru/react-admin 1.5.353 → 1.5.355

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.353"
111
+ "version": "1.5.355"
112
112
  }
@@ -117,7 +117,7 @@ function Empty({
117
117
  const translate = useTranslate();
118
118
  const getResourceLabel = useGetResourceLabel();
119
119
  const resourceName = resource
120
- ? translate(`resources.${resource}.forcedCaseName`, {
120
+ ? translate(`resources.${resource}.name`, {
121
121
  smart_count: 0,
122
122
  _: getResourceLabel(resource, 0)
123
123
  })
@@ -1,4 +1,5 @@
1
- import { Tab, Tabs } from '@mui/material';
1
+ import { Box, Tab, Tabs } from '@mui/material';
2
+ import { useTheme } from '@mui/material/styles';
2
3
  import { useListContext, useResourceContext } from 'react-admin';
3
4
  import { ReactElement, useCallback, useEffect, useMemo, useRef } from 'react';
4
5
  import { useListViewContext } from './ListViewProvider';
@@ -23,6 +24,7 @@ function ListTabsToolbar(props: ListTabsToolbarProps) {
23
24
  const defaultTabIndex = useMemo(() => tabs.findIndex((tab) => tab.default) ?? 0, [tabs]);
24
25
  const { setCurrentTabKey } = useListViewContext();
25
26
  const resource = useResourceContext();
27
+ const theme = useTheme();
26
28
 
27
29
  const [searchParams, setSearchParams] = useSearchParams();
28
30
 
@@ -89,13 +91,43 @@ function ListTabsToolbar(props: ListTabsToolbarProps) {
89
91
  [buildFilters, setCurrentTab]
90
92
  );
91
93
 
92
- return tabs.length > 0 ? (
93
- <Tabs value={Number(currentTab)} onChange={handleChange}>
94
- {tabs.map((tab) => (
95
- <Tab icon={tab.icon} key={tab.key} label={tab.label} />
96
- ))}
97
- </Tabs>
98
- ) : null;
94
+ return (
95
+ <Box sx={{ width: '100%' }}>
96
+ {tabs.length > 0 ? (
97
+ <Tabs
98
+ value={Number(currentTab)}
99
+ onChange={handleChange}
100
+ allowScrollButtonsMobile
101
+ variant="scrollable"
102
+ scrollButtons="auto"
103
+ sx={{
104
+ width: '100%',
105
+ '.MuiTabs-scrollButtons.Mui-disabled': {
106
+ opacity: 0.2
107
+ }
108
+ }}
109
+ >
110
+ {tabs.map((tab) => (
111
+ <Tab
112
+ icon={tab.icon}
113
+ key={tab.key}
114
+ label={tab.label}
115
+ sx={{
116
+ flex: '0 0 auto',
117
+ lineHeight: 1,
118
+ whiteSpace: 'nowrap',
119
+ overflow: 'hidden',
120
+ textOverflow: 'ellipsis',
121
+ '& .MuiTab-iconWrapper': {
122
+ marginRight: theme.spacing(0.5)
123
+ }
124
+ }}
125
+ />
126
+ ))}
127
+ </Tabs>
128
+ ) : null}
129
+ </Box>
130
+ );
99
131
  }
100
132
 
101
133
  export { type ListTabToolbarConfig, ListTabsToolbar };
@@ -1,3 +1,4 @@
1
+ // ListToolbar.tsx
1
2
  import React, { ReactElement, memo } from 'react';
2
3
  import { styled, useTheme } from '@mui/material/styles';
3
4
  import PropTypes from 'prop-types';
@@ -27,17 +28,19 @@ function ListToolbarComp(props: ListToolbarPropsExtended): ReactElement | null {
27
28
  <FilterSidebarContext.Provider value={{ hasFilterSidebar }}>
28
29
  <FilterContext.Provider value={filters}>
29
30
  <Root className={className}>
30
- <Box sx={{ display: 'flex', flex: 1, flexDirection: 'column', gap: 2 }}>
31
+ <Box sx={{ display: 'flex', flex: 1, flexDirection: 'column', gap: 2, width: '100%' }}>
31
32
  {tabs ? <ListTabsToolbar tabs={tabs} /> : null}
32
33
  <Box
33
34
  sx={{
34
35
  display: 'flex',
35
36
  flexDirection: 'row',
36
37
  alignItems: 'center',
38
+ justifyContent: 'flex-end',
37
39
  gap: 2,
38
40
  p: hasTabs ? 0 : theme.spacing(2.5),
39
41
  px: theme.spacing(2.5),
40
- pb: theme.spacing(2.5)
42
+ pb: theme.spacing(2.5),
43
+ width: '100%'
41
44
  }}
42
45
  >
43
46
  {isMobile && hasFilterSidebar ? (
@@ -70,17 +73,19 @@ function ListToolbarComp(props: ListToolbarPropsExtended): ReactElement | null {
70
73
  </FilterSidebarContext.Provider>
71
74
  ) : (
72
75
  <Root className={className}>
73
- <Box sx={{ display: 'flex', flex: 1, flexDirection: 'column', gap: 2 }}>
76
+ <Box sx={{ display: 'flex', flex: 1, flexDirection: 'column', gap: 2, width: '100%' }}>
74
77
  {tabs ? <ListTabsToolbar tabs={tabs} /> : null}
75
78
  <Box
76
79
  sx={{
77
80
  display: 'flex',
78
81
  flexDirection: 'row',
79
82
  alignItems: 'center',
83
+ justifyContent: 'flex-end',
80
84
  gap: 2,
81
85
  p: hasTabs ? 0 : theme.spacing(2.5),
82
86
  px: theme.spacing(2.5),
83
- pb: theme.spacing(2.5)
87
+ pb: theme.spacing(2.5),
88
+ width: '100%'
84
89
  }}
85
90
  >
86
91
  {filters