Skip to content

Commit 062221d

Browse files
authored
Merge pull request #10996 from marmelab/chore/core-react-node
[Chore]: Update react-admin to use ReactNode instead of ReactElement where applicable
2 parents 1b98ce6 + 324c0d7 commit 062221d

File tree

68 files changed

+177
-196
lines changed

Some content is hidden

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

68 files changed

+177
-196
lines changed

docs/AutocompleteInput.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The form value for the source must be the selected value, e.g.
7070
| `offline` | Optional | `ReactNode` | - | What to render when there is no network connectivity when fetching the choices |
7171
| `onChange` | Optional | `Function` | `-` | A function called with the new value, along with the selected record, when the input value changes |
7272
| `onCreate` | Optional | `Function` | `-` | A function called with the current filter value when users choose to create a new choice. |
73-
| `optionText` | Optional | `string` | `Function` | `Component` | `undefined` | `record Representation` | Field name of record to display in the suggestion item or function using the choice object as argument |
73+
| `optionText` | Optional | `function` | `ReactNode` | `undefined` | `record Representation` | Field name of record to display in the suggestion item or function using the choice object as argument |
7474
| `optionValue` | Optional | `string` | `id` | Field name of record containing the value to use as input value |
7575
| `setFilter` | Optional | `Function` | `null` | A callback to inform the `searchText` has changed and new `choices` can be retrieved based on this `searchText`. Signature `searchText => void`. This function is automatically set up when using `ReferenceInput`. |
7676
| `shouldRender Suggestions` | Optional | `Function` | `() => true` | A function that returns a `boolean` to determine whether or not suggestions are rendered. |

docs/CheckForApplicationUpdate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const App = () => (
4646
| --------------- | -------- | -------------- | ------------------ |-------------------------------------------------------------------- |
4747
| `interval` | Optional | `number` | `3600000` (1 hour) | The interval in milliseconds between two checks |
4848
| `disabled` | Optional | `boolean` | `false` | Whether the automatic check is disabled |
49-
| `notification` | Optional | `ReactElement` | | The notification to display to the user when an update is available |
49+
| `notification` | Optional | `ReactNode` | | The notification to display to the user when an update is available |
5050
| `onNewVersion Available` | Optional | `function` | | The effect to execute when a new version is detected. |
5151
| `url` | Optional | `string` | Current URL | The URL to download to check for code update |
5252
| `fetchOptions` | Optional | `RequestInit | undefined` | `undefined` | The options passed to `fetch` when checking for an update |

docs/Create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ You can customize the `<Create>` component using the following props:
7171
| `redirect` | Optional | `string`/`function` | `'edit'` | Change the redirect location after successful creation |
7272
| `resource` | Optional | `string` | From URL | Override the name of the resource to create |
7373
| `sx` | Optional | `object` | - | Override the styles |
74-
| `title` | Optional | `string`/`ReactNode` | Translation | Override the page title |
74+
| `title` | Optional | `ReactNode` / `string` / `false` | Translation | Override the page title |
7575
| `transform` | Optional | `function` | - | Transform the form data before calling `dataProvider.create()` |
7676

7777
`*` You must provide either `children` or `render`.

docs/Datagrid.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ Both are [Enterprise Edition](https://react-admin-ee.marmelab.com) components.
5050

5151
| Prop | Required | Type | Default | Description |
5252
| -------------------- | -------- | ----------------------- | --------------------- | ------------------------------------------------------------- |
53-
| `children` | Required | Element | n/a | The list of `<Field>` components to render as columns. |
54-
| `body` | Optional | Element | `<Datagrid Body>` | The component used to render the body of the table. |
55-
| `bulkActionButtons` | Optional | Element | `<BulkDelete Button>` | The component used to render the bulk action buttons. |
56-
| `empty` | Optional | Element | `<Empty>` | The component used to render the empty table. |
57-
| `expand` | Optional | Element | | The component used to render the expand panel for each row. |
53+
| `children` | Required | `ReactNode` | n/a | The list of `<Field>` components to render as columns. |
54+
| `body` | Optional | `ReactNode` | `<Datagrid Body>` | The component used to render the body of the table. |
55+
| `bulkActionButtons` | Optional | `ReactNode` | `<BulkDelete Button>` | The component used to render the bulk action buttons. |
56+
| `empty` | Optional | `ReactNode` | `<Empty>` | The component used to render the empty table. |
57+
| `expand` | Optional | `ReactNode` | | The component used to render the expand panel for each row. |
5858
| `expandSingle` | Optional | Boolean | `false` | Whether to allow only one expanded row at a time. |
59-
| `header` | Optional | Element | `<Datagrid Header>` | The component used to render the table header. |
59+
| `header` | Optional | `ReactNode` | `<Datagrid Header>` | The component used to render the table header. |
6060
| `hover` | Optional | Boolean | `true` | Whether to highlight the row under the mouse. |
6161
| `isRowExpandable` | Optional | Function | `() => true` | A function that returns whether a row is expandable. |
6262
| `isRowSelectable` | Optional | Function | `() => true` | A function that returns whether a row is selectable. |

docs/Edit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ You can customize the `<Edit>` component using the following props:
8484
| `redirect` | Optional | `'list'` &#124; `'show'` &#124; `false` &#124; `function` | `'list'` | Change the redirect location after successful update |
8585
| `resource` | Optional | `string` | - | Override the name of the resource to edit |
8686
| `sx` | Optional | `object` | - | Override the styles |
87-
| `title` | Optional | `string` &#124; `ReactNode` &#124; `false` | - | Override the page title |
87+
| `title` | Optional | `ReactNode` / `string` / `false` | - | Override the page title |
8888
| `redirectOnError` | Optional | `'list'` &#124; `false` &#124; `function` | `'list'` | The page to redirect to when an error occurs |
8989
| `transform` | Optional | `function` | - | Transform the form data before calling `dataProvider.update()` |
9090

docs/FilterList.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ A more sophisticated example is the filter sidebar for the visitors list visible
7777
|------|----------|------|---------|-------------|
7878
| [`children`](#children) | Required | node | | The children of `<FilterList>` must be a list of `<FilterListItem>` components. |
7979
| [`icon`](#icon) | Optional | element | | When set, the `<FilterList icon>` prop appears on the left side of the filter label. |
80-
| [`label`](#label) | Optional | string | | React-admin renders the `<FilterList label>` on top of the child filter items. The string is passed through the `useTranslate` hook, and therefore can be translated. |
80+
| [`label`](#label) | Optional | `ReactNode` | | React-admin renders the `<FilterList label>` on top of the child filter items. The string is passed through the `useTranslate` hook, and therefore can be translated. |
8181

8282
## `children`
8383

@@ -274,7 +274,7 @@ The children of `<FilterList>` must be a list of `<FilterListItem>` components.
274274

275275
| Prop | Required | Type | Default | Description |
276276
|------|----------|------|---------|-------------|
277-
| `label` | Required | string | | The label of the filter item. It is passed through the `useTranslate` hook, and therefore can be translated. |
277+
| `label` | Required | `ReactNode` | | The label of the filter item. It is passed through the `useTranslate` hook, and therefore can be translated. |
278278
| `value` | Required | object | | The value of the filter item. It is merged with the current filter value when enabled by the user. |
279279
| `icon` | Optional | `ReactElement` | | When set, the icon appears to the left of the item label. |
280280
| `isSelected` | Optional | function | | A function that receives the item value and the currently applied filters. It must return a boolean. |
@@ -372,4 +372,4 @@ export const BookList = () => (
372372

373373
![FilterLiveForm](./img/FilterLiveForm.png)
374374

375-
Check out the [`<FilterLiveForm>` documentation](./FilterLiveForm.md) for more information.
375+
Check out the [`<FilterLiveForm>` documentation](./FilterLiveForm.md) for more information.

docs/InfiniteList.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ The props are the same as [the `<List>` component](./List.md):
6161
| `children` | Required if no render | `ReactNode` | - | The component to use to render the list of records. |
6262
| `render` | Required if no children | `ReactNode` | - | A function that render the list of records, receives the list context as argument. |
6363
| `actions` | Optional | `ReactElement` | - | The actions to display in the toolbar. |
64-
| `aside` | Optional | `(listContext) => ReactElement` | - | The component to display on the side of the list. |
64+
| `aside` | Optional | `(listContext) => ReactNode` | - | The component to display on the side of the list. |
6565
| `authLoading` | Optional | `ReactNode` | - | The component to render while checking for authentication and permissions. |
6666
| `component` | Optional | `Component` | `Card` | The component to render as the root element. |
6767
| `debounce` | Optional | `number` | `500` | The debounce delay in milliseconds to apply when users change the sort or filter parameters. |
6868
| `disable Authentication` | Optional | `boolean` | `false` | Set to `true` to disable the authentication check. |
6969
| `disable SyncWithLocation` | Optional | `boolean` | `false` | Set to `true` to disable the synchronization of the list parameters with the URL. |
70-
| `empty` | Optional | `ReactElement` | - | The component to display when the list is empty. |
70+
| `empty` | Optional | `ReactNode` | - | The component to display when the list is empty. |
7171
| `empty WhileLoading` | Optional | `boolean` | `false` | Set to `true` to return `null` while the list is loading. |
7272
| `error` | Optional | `ReactNode` | - | The component to render when failing to load the list of records. |
7373
| `exporter` | Optional | `function` | - | The function to call to export the list. |
@@ -76,13 +76,13 @@ The props are the same as [the `<List>` component](./List.md):
7676
| `filter DefaultValues` | Optional | `object` | - | The default filter values. |
7777
| `loading` | Optional | `ReactNode` | - | The component to render while loading the list of records. |
7878
| `offline` | Optional | `ReactNode` | `<Offline>` | The component to render when there is no connectivity and there is no data in the cache |
79-
| `pagination` | Optional | `ReactElement` | `<Infinite Pagination>` | The pagination component to use. |
79+
| `pagination` | Optional | `ReactNode` | `<Infinite Pagination>` | The pagination component to use. |
8080
| `perPage` | Optional | `number` | `10` | The number of records to fetch per page. |
8181
| `queryOptions` | Optional | `object` | - | The options to pass to the `useQuery` hook. |
8282
| `resource` | Optional | `string` | - | The resource name, e.g. `posts`. |
8383
| `sort` | Optional | `object` | - | The initial sort parameters. |
8484
| `storeKey` | Optional | `string` | - | The key to use to store the current filter & sort. |
85-
| `title` | Optional | `string` | - | The title to display in the App Bar. |
85+
| `title` | Optional | `ReactNode` / `string` / `false` | - | The title to display in the App Bar. |
8686
| `sx` | Optional | `object` | - | The CSS styles to apply to the component. |
8787

8888
Check the [`<List>` component](./List.md) for details about each prop.

0 commit comments

Comments
 (0)