Skip to content

Commit 14e9c3d

Browse files
committed
Merge branch 'master' into next
2 parents 1298e69 + 259b46e commit 14e9c3d

382 files changed

Lines changed: 2984 additions & 994 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For code issues please include:
1616
* React-admin version
1717
* React version
1818
* Browser version
19-
* A code example or link to a repo, gist or running site. (hint: fork [this sandbox](https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple) to create a reproducible version of your bug)
19+
* A code example or link to a repo, gist or running site. (hint: fork [this sandbox](https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple) to create a reproducible version of your bug)
2020

2121
For visual or layout problems, images or animated gifs can help explain your issue.
2222
It's even better with a live reproduction test case.

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ about: Something isn't working as expected. Please tell us!
2121
**Related code:**
2222
<!-- If you are able to illustrate the bug or feature request with an example, please provide a sample application via one of the following means: -->
2323

24-
* Preferably, a CodeSandbox forked from
25-
- https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple (v4)
26-
- https://codesandbox.io/s/github/marmelab/react-admin/tree/3.x/examples/simple (v3)
27-
* A StackBlitz forked from
24+
* Preferably, a sandbox forked from
2825
- https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple (v4)
26+
- https://codesandbox.io/s/github/marmelab/react-admin/tree/3.x/examples/simple (v3)
2927
* A link to a GitHub repo with the minimal codebase to reproduce the issue
3028

3129

.github/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
changelog:
2+
categories:
3+
- title: Breaking Changes
4+
labels:
5+
- "breaking change"
6+
- title: Fixes
7+
labels:
8+
- "fix"
9+
- title: Documentation
10+
labels:
11+
- "documentation"
12+
- title: TypeScript
13+
labels:
14+
- "TypeScript"

CHANGELOG.md

Lines changed: 55 additions & 12 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ A frontend Framework for building data-driven applications running in the browse
2222

2323
* ☂️ **Opt-In Types**: Develop either in TypeScript or JavaScript
2424

25-
* 👨‍👩‍👧‍👦 Powered by [MUI](https://mui.com/), [react-hook-form](https://react-hook-form.com), [react-router](https://reacttraining.com/react-router/), [react-query](https://react-query-v3.tanstack.com/), [TypeScript](https://www.typescriptlang.org/) and a few more
25+
* 👨‍👩‍👧‍👦 Powered by [Material UI](https://mui.com/material-ui/getting-started/overview/), [react-hook-form](https://react-hook-form.com), [react-router](https://reacttraining.com/react-router/), [react-query](https://react-query-v3.tanstack.com/), [TypeScript](https://www.typescriptlang.org/) and a few more
2626

2727
## Installation
2828

@@ -58,7 +58,7 @@ render(
5858
);
5959
```
6060

61-
The `<Resource>` component is a configuration component that allows you to define sub components for each of the admin view: `list`, `edit`, and `create`. These components use MUI and custom components from react-admin:
61+
The `<Resource>` component is a configuration component that allows you to define sub components for each of the admin view: `list`, `edit`, and `create`. These components use Material UI and custom components from react-admin:
6262

6363
```jsx
6464
// in posts.js
@@ -130,11 +130,11 @@ React-admin is designed as a library of loosely coupled React components and hoo
130130

131131
There are several examples inside the `examples` folder:
132132

133-
* `simple` ([CodeSandbox](https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple), [StackBlitz](https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple?file=src%2Findex.tsx)): a simple blog with posts, comments and users that we use for our e2e tests.
133+
* `simple` ([StackBlitz](https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple?file=src%2Findex.tsx)): a simple blog with posts, comments and users that we use for our e2e tests.
134134
* `e-commerce`: ([demo](https://marmelab.com/react-admin-demo/), [source](https://github.com/marmelab/react-admin/tree/master/examples/demo)) A fictional poster shop admin, serving as the official react-admin demo.
135135
* `CRM`: ([demo](https://marmelab.com/react-admin-crm/), [source](https://github.com/marmelab/react-admin/tree/master/examples/crm)) A customer relationship management application
136136
* `helpdesk`: ([demo](https://marmelab.com/react-admin-helpdesk/), [source](https://github.com/marmelab/react-admin-helpdesk)) A ticketing application with realtime locks and notifications
137-
* `tutorial` ([CodeSandbox](https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/tutorial)): the application built while following the [tutorial](https://marmelab.com/react-admin/Tutorial.html).
137+
* `tutorial` ([Stackblitz](https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/tutorial)): the application built while following the [tutorial](https://marmelab.com/react-admin/Tutorial.html).
138138

139139
You can run those example applications by calling:
140140

@@ -199,7 +199,7 @@ You can use Gitpod (an open source, online VS Code-like IDE) for working on issu
199199

200200
### Testing Your Changes In The Example Apps
201201

202-
When developing, most of the time we use the **simple example** to do visual check. It's the same application that we use in CodeSandbox to reproduce errors (see https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple). The source is located under `examples/simple/`. Call `make run` to launch that example on port 8080 (http://localhost:8080). This command includes a `watch` on the react-admin source, so any of the changes you make to the react-admin packages triggers a live update of the simple example in your browser.
202+
When developing, most of the time we use the **simple example** to do visual check. It's the same application that we use in Stackblitz to reproduce errors (see https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple). The source is located under `examples/simple/`. Call `make run` to launch that example on port 8080 (http://localhost:8080). This command includes a `watch` on the react-admin source, so any of the changes you make to the react-admin packages triggers a live update of the simple example in your browser.
203203

204204
However, the simple example is sometimes too limited. You can use the **demo example** (the source for https://marmelab.com/react-admin-demo/), which is more complete. The source is located under `examples/demo/`. Call `make run-demo` to launch the demo example with a REST dataProvider, or `make run-graphql-demo` to run it with a GraphQL dataProvider. Unfortunately, due to the fact that we use Create React App for this demo, these commands don't watch the changes made in the packages. You'll have to rebuild the react-admin packages after a change (using `make build`, or the more targeted `make build-ra-core`, `make build-ra-ui-materialui`, etc.) to see the effect in the demo app.
205205

docs/Admin.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const App = () => (
209209

210210
## `dashboard`
211211

212-
By default, the homepage of an admin app is the `list` of the first child `<Resource>`. But you can also specify a custom component instead. To fit in the general design, use MUI's `<Card>` component, and [react-admin's `<Title>` component](./Title.md) to set the title in the AppBar:
212+
By default, the homepage of an admin app is the `list` of the first child `<Resource>`. But you can also specify a custom component instead. To fit in the general design, use Material UI's `<Card>` component, and [react-admin's `<Title>` component](./Title.md) to set the title in the AppBar:
213213

214214
```jsx
215215
// in src/Dashboard.js
@@ -270,7 +270,7 @@ When users type URLs that don't match any of the children `<Resource>` component
270270

271271
![Not Found](./img/not-found.png)
272272

273-
You can customize this page to use the component of your choice by passing it as the `catchAll` prop. To fit in the general design, use MUI's `<Card>` component, and [react-admin's `<Title>` component](./Title.md):
273+
You can customize this page to use the component of your choice by passing it as the `catchAll` prop. To fit in the general design, use Material UI's `<Card>` component, and [react-admin's `<Title>` component](./Title.md):
274274

275275
```jsx
276276
// in src/NotFound.js
@@ -342,7 +342,7 @@ export const MyMenu = () => {
342342
};
343343
```
344344

345-
**Tip**: `<Menu.Item>` must be used to avoid unwanted side effects in mobile views. It supports a custom text and icon (which must be a MUI `<SvgIcon>`).
345+
**Tip**: `<Menu.Item>` must be used to avoid unwanted side effects in mobile views. It supports a custom text and icon (which must be a Material UI `<SvgIcon>`).
346346

347347
Then, pass it to the `<Admin>` component as the `menu` prop:
348348

@@ -361,7 +361,7 @@ See the [Theming documentation](./Theming.md#using-a-custom-menu) for more detai
361361

362362
## `theme`
363363

364-
MUI supports [theming](https://mui.com/customization/themes). This lets you customize the look and feel of an admin by overriding fonts, colors, and spacing. You can provide a custom MUI theme by using the `theme` prop:
364+
Material UI supports [theming](https://mui.com/material-ui/customization/theming/). This lets you customize the look and feel of an admin by overriding fonts, colors, and spacing. You can provide a custom Material UI theme by using the `theme` prop:
365365

366366
```jsx
367367
import { defaultTheme } from 'react-admin';
@@ -450,7 +450,7 @@ You can also disable it completely along with the `/login` route by passing `fal
450450

451451
See The [Authentication documentation](./Authentication.md#customizing-the-login-component) for more details.
452452

453-
**Tip**: Before considering writing your own login page component, please take a look at how to change the default [background image](./Theming.md#using-a-custom-login-page) or the [MUI theme](#theme). See the [Authentication documentation](./Authentication.md#customizing-the-login-component) for more details.
453+
**Tip**: Before considering writing your own login page component, please take a look at how to change the default [background image](./Theming.md#using-a-custom-login-page) or the [Material UI theme](#theme). See the [Authentication documentation](./Authentication.md#customizing-the-login-component) for more details.
454454

455455
## `authCallbackPage`
456456

docs/AdvancedTutorials.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ This article shows how you can customize many parts of the framework without rep
6868

6969
## Changing The Look And Feel Of React-Admin Without JSX
7070

71-
This article shows how to customize react-admin look and feel using only the MUI theme.
71+
This article shows how to customize react-admin look and feel using only the Material UI theme.
7272

7373
![Screencast](https://marmelab.com/097bee867a1d1dc55dec5456732fe94a/screencast.gif)
7474

docs/AppBar.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: "The AppBar Component"
88
The default react-admin layout renders a horizontal app bar at the top, which is rendered by the `<AppBar>` component.
99

1010
<video controls autoplay muted loop width="100%">
11-
<source src="./img/AppBar.webm" type="video/webm">
11+
<source src="./img/AppBar.webm" type="video/webm" />
1212
Your browser does not support the video tag.
1313
</video>
1414

@@ -22,7 +22,7 @@ By default, the `<AppBar>` component displays:
2222

2323
You can customize the App Bar by creating a custom component based on `<AppBar>`, with different props.
2424

25-
**Tip**: Don't mix react-admin's `<AppBar>` component with [MUI's `<AppBar>` component](https://mui.com/material-ui/api/app-bar/). The first one leverages the second but adds some react-admin-specific features.
25+
**Tip**: Don't mix react-admin's `<AppBar>` component with [Material UI's `<AppBar>` component](https://mui.com/material-ui/api/app-bar/). The first one leverages the second but adds some react-admin-specific features.
2626

2727
## Usage
2828

@@ -70,7 +70,7 @@ const App = () => (
7070
| `toolbar` | Optional | `ReactElement` | - | The content of the toolbar |
7171
| `userMenu` | Optional | `ReactElement` | - | The content of the dropdown user menu |
7272

73-
Additional props are passed to [the underlying MUI `<AppBar>` element](https://mui.com/material-ui/api/app-bar/).
73+
Additional props are passed to [the underlying Material UI `<AppBar>` element](https://mui.com/material-ui/api/app-bar/).
7474

7575
## `children`
7676

@@ -121,7 +121,7 @@ const MyAppBar = () => (
121121

122122
## `color`
123123

124-
React-admin's `<AppBar>` renders an MUI `<AppBar>`, which supports a `color` prop to set the app bar color depending on the theme. By default, the app bar color is set to the `secondary` theme color.
124+
React-admin's `<AppBar>` renders an Material UI `<AppBar>`, which supports a `color` prop to set the app bar color depending on the theme. By default, the app bar color is set to the `secondary` theme color.
125125

126126
This means you can set the app bar color to 'default', 'inherit', 'primary', 'secondary', 'transparent', or any string.
127127

@@ -162,7 +162,7 @@ This property accepts the following subclasses:
162162
| `& .RaAppBar-menuButton` | Applied to the hamburger icon |
163163
| `& .RaAppBar-title` | Applied to the title portal |
164164

165-
To override the style of `<AppBar>` using the [MUI style overrides](https://mui.com/customization/theme-components/), use the `RaAppBar` key.
165+
To override the style of `<AppBar>` using the [Material UI style overrides](https://mui.com/material-ui/customization/theme-components/#theme-style-overrides), use the `RaAppBar` key.
166166

167167
## `toolbar`
168168

@@ -216,7 +216,7 @@ export const MyAppBar = () => (
216216
If your app uses [authentication](./Authentication.md), the `<AppBar>` component displays a button to display the user menu on the right side. By default, the user menu only contains a logout button.
217217

218218
<video controls autoplay muted loop width="100%">
219-
<source src="./img/AppBar-user-menu.webm" type="video/webm">
219+
<source src="./img/AppBar-user-menu.webm" type="video/webm"/>
220220
Your browser does not support the video tag.
221221
</video>
222222

@@ -226,21 +226,29 @@ The content of the user menu depends on the return value of `authProvider.getIde
226226
You can customize the user menu by passing a `userMenu` prop to the `<AppBar>` component.
227227

228228
```jsx
229+
import * as React from 'react';
229230
import { AppBar, UserMenu, useUserMenu } from 'react-admin';
230231
import { MenuItem, ListItemIcon, ListItemText } from '@mui/material';
231232
import SettingsIcon from '@mui/icons-material/Settings';
232233

233-
const SettingsMenuItem = () => {
234+
// It's important to pass the ref to allow Material UI to manage the keyboard navigation
235+
const SettingsMenuItem = React.forwardRef((props, ref) => {
236+
// We are not using MenuItemLink so we retrieve the onClose function from the UserContext
234237
const { onClose } = useUserMenu();
235238
return (
236-
<MenuItem onClick={onClose}>
239+
<MenuItem
240+
onClick={onClose}
241+
ref={ref}
242+
// It's important to pass the props to allow Material UI to manage the keyboard navigation
243+
{...props}
244+
>
237245
<ListItemIcon>
238246
<SettingsIcon fontSize="small" />
239247
</ListItemIcon>
240248
<ListItemText>Customize</ListItemText>
241249
</MenuItem>
242250
);
243-
};
251+
});
244252

245253
const MyAppBar = () => (
246254
<AppBar
@@ -384,7 +392,7 @@ export const MyAppbar = () => (
384392

385393
## Building Your Own AppBar
386394

387-
If react-admin's `<AppBar>` component doesn't meet your needs, you can build your own component using MUI's `<AppBar>`. Here is an example:
395+
If react-admin's `<AppBar>` component doesn't meet your needs, you can build your own component using Material UI's `<AppBar>`. Here is an example:
388396

389397
```jsx
390398
// in src/MyAppBar.js
@@ -420,7 +428,7 @@ export const MyLayout = (props) => (
420428
By default, users can override the page title [in configurable mode](./Features.md#configurable-ui).
421429

422430
<video controls autoplay muted loop width="100%">
423-
<source src="./img/TitleConfigurable.webm" type="video/webm">
431+
<source src="./img/TitleConfigurable.webm" type="video/webm"/>
424432
Your browser does not support the video tag.
425433
</video>
426434

docs/Architecture.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,17 @@ React-admin has two sets of users:
9999

100100
For each feature, we design the User Experience (UX) and the Developer Experience (DX) carefully.
101101

102-
For the visual part, react-admin builds upon MUI, which is the implementation of the Material Design System. It's a great help to build usable, consistent user interfaces, but it's not enough.
102+
For the visual part, react-admin builds upon Material UI, which is the implementation of the Material Design System. It's a great help to build usable, consistent user interfaces, but it's not enough.
103103

104104
We spend a great deal of time refining the UI to make it as intuitive as possible. We pay attention to small alignment glitches, screen flashes, and color inconsistencies. We iterate with every customer feedback, to remove visual and animation problems that occur in real-life applications.
105105

106106
React-admin produces a user interface that is voluntarily bland by default because we want to emphasize content rather than chrome.
107107

108-
![Sort Button](./img/sort-button.gif)
108+
<video controls autoplay muted loop>
109+
<source src="./img/sort-button.webm" type="video/webm"/>
110+
Your browser does not support the video tag.
111+
</video>
112+
109113

110114
As for the developer experience, react-admin is constantly evolving to find the sweet spot between an intuitive API, power user features, not too much magic, and just enough documentation. The core team are the first testers of react-admin, and pay attention to the productivity, debuggability, discoverability, performance, and robustness of all the hooks and components.
111115

@@ -115,7 +119,7 @@ Many excellent open-source libraries already address partial requirements of B2B
115119

116120
Rather than reinventing the wheel, react-admin uses the best tools in each category (in terms of features, developer experience, active maintenance, documentation, user base), and provides a glue around these libraries.
117121

118-
In react-admin v4, these libraries are called react-query, react-router, react-hook-form, MUI, testing-library, date-fns, and lodash.
122+
In react-admin v4, these libraries are called react-query, react-router, react-hook-form, Material UI, testing-library, date-fns, and lodash.
119123

120124
When a new requirement arises, the react-admin teams always looks for an existing solution, and prefers integrating it rather than redeveloping it.
121125

@@ -172,7 +176,7 @@ const MyRefreshButton = () => {
172176

173177
Before adding a new hook or a new prop to an existing component, we always check if there isn't a simple way to implement the feature in pure React. If it's the case, then we don't add the new prop. We prefer to keep the react-admin API, code, test, and documentation simple. This choice is crucial to keep the learning curve acceptable, and maintenance burden low.
174178

175-
For instance, the `<SimpleShowLayout>` component displays Field elements in a column. How can you put two fields in a single column? We could add a specific syntax allowing to specify the number of elements per column and per line. This would complicate the usage and documentation for simple use cases. Besides, it's doable in pure React, without any change in the react-admin core, e.g. by leveraging MUI's `<Stack>` component:
179+
For instance, the `<SimpleShowLayout>` component displays Field elements in a column. How can you put two fields in a single column? We could add a specific syntax allowing to specify the number of elements per column and per line. This would complicate the usage and documentation for simple use cases. Besides, it's doable in pure React, without any change in the react-admin core, e.g. by leveraging Material UI's `<Stack>` component:
176180

177181
```jsx
178182
import * as React from 'react';
@@ -224,7 +228,7 @@ Every time we implemented child inspection, we regretted it afterward. We tend t
224228
React-admin is a *distribution* of several packages, each of which handles a specific feature. The packages are all located in the `packages/` directory. The most notable packages are:
225229

226230
* `ra-core`: The core react-admin logic, without any UI.
227-
* `ra-ui-materialui`: The MUI skin for react-admin.
231+
* `ra-ui-materialui`: The Material UI skin for react-admin.
228232
* `ra-data-*`: Data providers for various data backends.
229233
* `ra-language-*`: Interface translations for various languages.
230234
* `react-admin`: the standard distribution of react-admin

0 commit comments

Comments
 (0)