UNPKG

@commercetools-uikit/select-utils

Version:

Utilities for working with select components.

22 lines (21 loc) 1.39 kB
import { type JSX } from 'react'; import { type SingleValueProps, type PlaceholderProps } from 'react-select'; import { TSelectInputCustomComponentProps } from "../types.js"; export type TSingleValueWrapperWithIconProps = { type: 'singleValue'; } & TSelectInputCustomComponentProps<SingleValueProps>; export type TPlaceholderWrapperWithIconProps = { type: 'placeholder'; } & TSelectInputCustomComponentProps<PlaceholderProps>; export type TWrapperWithIconProps<Type extends 'singleValue' | 'placeholder'> = Type extends 'singleValue' ? TSingleValueWrapperWithIconProps : Type extends 'placeholder' ? TPlaceholderWrapperWithIconProps : never; export type TDefaultComponent<Type extends 'singleValue' | 'placeholder'> = (props: Type extends 'singleValue' ? SingleValueProps : Type extends 'placeholder' ? PlaceholderProps : never) => JSX.Element; declare const WrapperWithIcon: { <Type extends "singleValue" | "placeholder">(props: TWrapperWithIconProps<Type>): import("@emotion/react/jsx-runtime").JSX.Element | null; displayName: string; }; export default WrapperWithIcon; declare const customComponents: { SingleValue: (props: TWrapperWithIconProps<"singleValue">) => import("@emotion/react/jsx-runtime").JSX.Element; Placeholder: (props: TWrapperWithIconProps<"placeholder">) => import("@emotion/react/jsx-runtime").JSX.Element; }; export { customComponents };