Annotations: Allow addition of custom values whilst tags are loading (#40702)

This commit is contained in:
Ashley Harrison 2021-10-21 14:55:02 +01:00 committed by GitHub
parent 740444680c
commit 447a088750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 0 deletions

View File

@ -88,6 +88,7 @@ const CustomControl = (props: any) => {
export function SelectBase<T>({
allowCustomValue = false,
allowCreateWhileLoading = false,
'aria-label': ariaLabel,
autoFocus = false,
backspaceRemovesValue = true,
@ -227,6 +228,7 @@ export function SelectBase<T>({
if (allowCustomValue) {
ReactSelectComponent = Creatable as any;
creatableProps.allowCreateWhileLoading = allowCreateWhileLoading;
creatableProps.formatCreateLabel = formatCreateLabel ?? ((input: string) => `Create: ${input}`);
creatableProps.onCreateOption = onCreateOption;
creatableProps.isValidNewOption = isValidNewOption;

View File

@ -9,6 +9,7 @@ export type InputActionMeta = {
export interface SelectCommonProps<T> {
/** Aria label applied to the input field */
['aria-label']?: string;
allowCreateWhileLoading?: boolean;
allowCustomValue?: boolean;
/** Focus is set to the Select when rendered*/
autoFocus?: boolean;

View File

@ -68,6 +68,7 @@ export const TagFilter: FC<Props> = ({
const value = tags.map((tag) => ({ value: tag, label: tag, count: 0 }));
const selectOptions = {
allowCreateWhileLoading: true,
allowCustomValue,
formatCreateLabel,
defaultOptions: true,