import React, { useMemo, useState } from "react"; import Select, { OnChangeValue, StylesConfig, OptionProps, components as reactSelectComponents, Options, MenuListProps, GroupBase, OptionsOrGroups, DropdownIndicatorProps, } from "react-select"; import CreatableSelect from "react-select/creatable"; import * as GQL from "src/core/generated-graphql"; import { useMarkerStrings } from "src/core/StashService"; import { SelectComponents } from "react-select/dist/declarations/src/components"; import { ConfigurationContext } from "src/hooks/Config"; import { objectTitle } from "src/core/files"; import { defaultMaxOptionsShown } from "src/core/config"; import { useDebounce } from "src/hooks/debounce"; import { Placement } from "react-bootstrap/esm/Overlay"; import { PerformerIDSelect } from "../Performers/PerformerSelect"; import { Icon } from "./Icon"; import { faTableColumns } from "@fortawesome/free-solid-svg-icons"; import { TagIDSelect } from "../Tags/TagSelect"; import { StudioIDSelect } from "../Studios/StudioSelect"; import { GalleryIDSelect } from "../Galleries/GallerySelect"; import { GroupIDSelect } from "../Movies/MovieSelect"; import { SceneIDSelect } from "../Scenes/SceneSelect"; export type SelectObject = { id: string; name?: string | null; title?: string | null; }; type Option = { value: string; label: string }; interface ITypeProps { type?: | "performers" | "studios" | "tags" | "scene_tags" | "performer_tags" | "scenes" | "groups" | "galleries"; } interface IFilterProps { ids?: string[]; initialIds?: string[]; onSelect?: (item: SelectObject[]) => void; noSelectionString?: string; className?: string; isMulti?: boolean; isClearable?: boolean; isDisabled?: boolean; creatable?: boolean; menuPortalTarget?: HTMLElement | null; } interface ISelectProps { className?: string; items: Option[]; selectedOptions?: OnChangeValue; creatable?: boolean; onCreateOption?: (value: string) => void; isLoading: boolean; isDisabled?: boolean; onChange: (item: OnChangeValue) => void; initialIds?: string[]; isMulti: T; isClearable?: boolean; onInputChange?: (input: string) => void; components?: Partial>>; filterOption?: (option: Option, rawInput: string) => boolean; isValidNewOption?: ( inputValue: string, value: Options