import React, { useEffect, useMemo, useState } from "react"; import Select, { ValueType, Styles, OptionProps, components as reactSelectComponents, GroupedOptionsType, OptionsType, } from "react-select"; import CreatableSelect from "react-select/creatable"; import { debounce } from "lodash"; import * as GQL from "src/core/generated-graphql"; import { useAllTagsForFilter, useAllMoviesForFilter, useAllStudiosForFilter, useAllPerformersForFilter, useMarkerStrings, useTagCreate, useStudioCreate, usePerformerCreate, } from "src/core/StashService"; import { useToast } from "src/hooks"; import { TextUtils } from "src/utils"; import { SelectComponents } from "react-select/src/components"; export type ValidTypes = | GQL.SlimPerformerDataFragment | GQL.SlimTagDataFragment | GQL.SlimStudioDataFragment | GQL.SlimMovieDataFragment; type Option = { value: string; label: string }; interface ITypeProps { type?: | "performers" | "studios" | "parent_studios" | "tags" | "sceneTags" | "performerTags" | "movies"; } interface IFilterProps { ids?: string[]; initialIds?: string[]; onSelect?: (item: ValidTypes[]) => void; noSelectionString?: string; className?: string; isMulti?: boolean; isClearable?: boolean; isDisabled?: boolean; creatable?: boolean; menuPortalTarget?: HTMLElement | null; } interface ISelectProps { className?: string; items: Option[]; selectedOptions?: ValueType; creatable?: boolean; onCreateOption?: (value: string) => void; isLoading: boolean; isDisabled?: boolean; onChange: (item: ValueType) => void; initialIds?: string[]; isMulti: T; isClearable?: boolean; onInputChange?: (input: string) => void; components?: Partial>; filterOption?: (option: Option, rawInput: string) => boolean; isValidNewOption?: ( inputValue: string, value: ValueType, options: OptionsType