Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export AutoCompleteArrayInput Props Interface #5990

Merged
merged 1 commit into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {
useCallback,
useEffect,
useRef,
FunctionComponent,
useMemo,
isValidElement,
} from 'react';
Expand All @@ -25,11 +24,6 @@ import AutocompleteSuggestionList from './AutocompleteSuggestionList';
import AutocompleteSuggestionItem from './AutocompleteSuggestionItem';
import { AutocompleteInputLoader } from './AutocompleteInputLoader';

interface Options {
suggestionsContainerProps?: any;
labelProps?: any;
}

/**
* An Input component for an autocomplete field, using an array of objects for the options
*
Expand Down Expand Up @@ -92,10 +86,7 @@ interface Options {
* @example
* <AutocompleteArrayInput source="author_id" options={{ color: 'secondary' }} />
*/
const AutocompleteArrayInput: FunctionComponent<
ChoicesInputProps<TextFieldProps & Options> &
Omit<DownshiftProps<any>, 'onChange'>
> = props => {
const AutocompleteArrayInput = (props: AutocompleteArrayInputProps) => {
const {
allowDuplicates,
allowEmpty,
Expand Down Expand Up @@ -543,4 +534,13 @@ const useStyles = makeStyles(
{ name: 'RaAutocompleteArrayInput' }
);

interface Options {
suggestionsContainerProps?: any;
labelProps?: any;
}

export interface AutocompleteArrayInputProps
extends ChoicesInputProps<TextFieldProps & Options>,
Omit<DownshiftProps<any>, 'onChange'> {}

export default AutocompleteArrayInput;
6 changes: 4 additions & 2 deletions packages/ra-ui-materialui/src/input/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import ArrayInput from './ArrayInput';
import AutocompleteArrayInput from './AutocompleteArrayInput';
import AutocompleteArrayInput, {
AutocompleteArrayInputProps,
} from './AutocompleteArrayInput';
import AutocompleteInput, { AutocompleteInputProps } from './AutocompleteInput';
import BooleanInput from './BooleanInput';
import CheckboxGroupInput from './CheckboxGroupInput';
Expand Down Expand Up @@ -54,4 +56,4 @@ export {
sanitizeInputRestProps,
};

export type { AutocompleteInputProps };
export type { AutocompleteInputProps, AutocompleteArrayInputProps };