diff --git a/src/Select/Select.tsx b/src/Select/Select.tsx index 6df598995..c2cd40a17 100644 --- a/src/Select/Select.tsx +++ b/src/Select/Select.tsx @@ -1,6 +1,6 @@ import React, { forwardRef, ReactNode, MutableRefObject } from "react"; import Select from "react-select/base"; -import WindowedSelect, { GroupBase } from "react-windowed-select"; +import WindowedSelect from "react-windowed-select"; import type { Props as SelectProps } from "react-select"; import { useTranslation } from "react-i18next"; import { useTheme } from "styled-components"; @@ -10,7 +10,6 @@ import { MaybeFieldLabel } from "../FieldLabel"; import { InlineValidation } from "../Validation"; import customStyles from "../Select/customReactSelectStyles"; import { getSubset } from "../utils/subset"; -import { SelectControl } from "../AsyncSelect/AsyncSelectComponents"; import { ComponentSize, useComponentSize } from "../NDSProvider/ComponentSizeContext"; import { SelectMultiValue, @@ -19,37 +18,37 @@ import { SelectInput, SelectDropdownIndicator, SelectMenu, + SelectControl, } from "./SelectComponents"; import { SelectOption } from "./SelectOption"; -interface WindowedSelectProps> - extends SelectProps { +interface WindowedSelectProps extends SelectProps { windowThreshold: number; } -type CustomProps> = { - autocomplete?: WindowedSelectProps["isSearchable"]; +type CustomProps = { + autocomplete?: WindowedSelectProps["isSearchable"]; labelText?: string; size?: ComponentSize; requirementText?: string; helpText?: ReactNode; - disabled?: WindowedSelectProps["isDisabled"]; + disabled?: WindowedSelectProps["isDisabled"]; errorMessage?: string; errorList?: string[]; - initialIsOpen?: WindowedSelectProps["defaultMenuIsOpen"]; - multiselect?: WindowedSelectProps["isMulti"]; + initialIsOpen?: WindowedSelectProps["defaultMenuIsOpen"]; + multiselect?: WindowedSelectProps["isMulti"]; maxHeight?: string; - defaultValue?: WindowedSelectProps["defaultInputValue"]; + defaultValue?: WindowedSelectProps["defaultInputValue"]; }; -export type NDSSelectProps> = Omit< - WindowedSelectProps, +export type NDSSelectProps = Omit< + WindowedSelectProps, "isSearchable" | "isDisabled" | "isMulti" | "defaultMenuIsOpen" | "defaultInputValue" > & - CustomProps; + CustomProps; const NDSSelect = forwardRef( - >( + ( { size, autocomplete, @@ -84,11 +83,8 @@ const NDSSelect = forwardRef( "aria-label": ariaLabel, windowThreshold = 100, ...props - }: NDSSelectProps, - ref: - | ((instance: Select | null) => void) - | MutableRefObject | null> - | null + }: NDSSelectProps, + ref: ((instance: Select | null) => void) | MutableRefObject