Skip to content

Commit ef34b42

Browse files
authored
Merge pull request #10873 from marmelab/feat/move-array-input-context
[chore] Move `ArrayInputContext` to `ra-core`
2 parents a3db27c + 5107951 commit ef34b42

File tree

8 files changed

+11
-6
lines changed

8 files changed

+11
-6
lines changed

packages/ra-ui-materialui/src/input/ArrayInput/ArrayInputContext.ts renamed to packages/ra-core/src/controller/input/ArrayInputContext.ts

File renamed without changes.

packages/ra-core/src/controller/input/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export * from './useReferenceArrayInputController';
88
export * from './useReferenceInputController';
99
export * from './ReferenceInputBase';
1010
export * from './ReferenceArrayInputBase';
11+
export * from './ArrayInputContext';
12+
export * from './useArrayInput';
1113

1214
export {
1315
getStatusForInput,

packages/ra-ui-materialui/src/input/ArrayInput/useArrayInput.ts renamed to packages/ra-core/src/controller/input/useArrayInput.ts

File renamed without changes.

packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
RecordContextProvider,
66
ResourceContextProvider,
77
testDataProvider,
8+
useArrayInput,
89
} from 'ra-core';
910

1011
import { AdminContext } from '../../AdminContext';
@@ -25,7 +26,6 @@ import {
2526
Focus,
2627
Reset,
2728
} from './ArrayInput.stories';
28-
import { useArrayInput } from './useArrayInput';
2929

3030
describe('<ArrayInput />', () => {
3131
it('should pass array functions to child', async () => {

packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import type { CommonInputProps } from '../CommonInputProps';
3030
import { InputHelperText } from '../InputHelperText';
3131
import { sanitizeInputRestProps } from '../sanitizeInputRestProps';
3232
import { Labeled } from '../../Labeled';
33-
import { ArrayInputContext } from './ArrayInputContext';
33+
import { ArrayInputContext } from 'ra-core';
3434

3535
/**
3636
* To edit arrays of data embedded inside a record, <ArrayInput> creates a list of sub-forms.

packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import {
2121
FormDataConsumer,
2222
type RaRecord,
2323
useRecordContext,
24+
useArrayInput,
2425
useTranslate,
2526
useWrappedSource,
2627
} from 'ra-core';
2728
import { type UseFieldArrayReturn, useFormContext } from 'react-hook-form';
2829

29-
import { useArrayInput } from './useArrayInput';
3030
import {
3131
SimpleFormIteratorClasses,
3232
SimpleFormIteratorPrefix as PREFIX,

packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIteratorItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ReactElement, ReactNode, useMemo } from 'react';
33
import { Typography, Stack } from '@mui/material';
44
import clsx from 'clsx';
55
import {
6+
ArrayInputContextValue,
67
RaRecord,
78
RecordContextProvider,
89
SourceContextProvider,
@@ -12,7 +13,6 @@ import {
1213

1314
import { SimpleFormIteratorClasses } from './useSimpleFormIteratorStyles';
1415
import { useSimpleFormIterator } from './useSimpleFormIterator';
15-
import { ArrayInputContextValue } from './ArrayInputContext';
1616
import {
1717
SimpleFormIteratorItemContext,
1818
SimpleFormIteratorItemContextValue,
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
export * from './ArrayInput';
2-
export * from './ArrayInputContext';
32
export * from './SimpleFormIterator';
43
export * from './SimpleFormIteratorContext';
54
export * from './SimpleFormIteratorItem';
65
export * from './SimpleFormIteratorItemContext';
7-
export * from './useArrayInput';
86
export * from './useSimpleFormIterator';
97
export * from './useSimpleFormIteratorItem';
108
export * from './useSimpleFormIteratorStyles';
119
export * from './AddItemButton';
1210
export * from './RemoveItemButton';
1311
export * from './ReOrderButtons';
12+
13+
/**
14+
* @deprecated Import from `ra-core` or `react-admin` instead
15+
*/
16+
export { ArrayInputContext, useArrayInput } from 'ra-core';

0 commit comments

Comments
 (0)