/** * Disabling react/prop-types as this hook has a lot of guards against runtime errors. * Maybe we can try to refactor this in the future? */ import { CommonProps } from "@trackunit/react-components"; import { ReactNode } from "react"; import { type FormatOptionLabelMeta, type SelectComponentsConfig, GroupBase } from "react-select"; import { FormComponentSizes } from "../../types"; import { LockedForReasons } from "../BaseInput/InputLockReasonTooltip"; import type { MenuGeometry } from "./utils/computeMenuGeometry"; interface CustomComponentsProps extends CommonProps { disabled: boolean | LockedForReasons; className?: string; readOnly: boolean | LockedForReasons; "data-testid": string; prefix?: ReactNode; hasError?: boolean; fieldSize?: FormComponentSizes; getOptionLabelDescription?: (option: TOption) => string | undefined; getOptionPrefix?: (option: TOption) => ReactNode; isMulti: boolean; autoComplete?: "off" | "on" | "no"; formatOptionLabel?: (data: TOption, meta: FormatOptionLabelMeta) => ReactNode; /** * Returns the latest edge-aware menu geometry (alignment + min/max-width), computed from the * control's rect via `styles.menuPortal` in useSelect.ts. Read directly here (not through * react-select's own `styles.menu`, which this file disables via `getStyles={getNoStyles}` * in favor of Tailwind classes) and applied as inline styles on the actual menu element. */ getMenuGeometry: () => MenuGeometry | null; } /** * A hook to retrieve components override object. * This complex object includes all the compositional components that are used in react-select. If you wish to overwrite a component, pass in an object with the appropriate namespace. * * @template TOption * @template TIsMulti * @template TGroup * @param {CustomComponentsProps} props - The custom components props * @returns {SelectComponentsConfig} components object to override react-select default components */ export declare const useCustomComponents: = GroupBase>({ disabled, readOnly, "data-testid": dataTestId, prefix, hasError, fieldSize, getOptionLabelDescription, getOptionPrefix, className, isMulti, autoComplete, formatOptionLabel, getMenuGeometry, }: CustomComponentsProps) => SelectComponentsConfig; export {};