/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import { type ReactNode } from 'react';
import { type GroupBase, type Props } from 'react-select';
import { type AsyncProps } from 'react-select/async';
import { type CreatableProps } from 'react-select/creatable';
export type SelectCommonProps = {
/** Error message, if it exists the select will be in error state */
errorText?: string | ReactNode;
/** Help text of the select component */
helpText?: string | ReactNode;
/** Size of the component */
size?: 'small' | 'medium' | 'large';
/** Whether the select component is fluid */
isFluid?: boolean;
/** Whether the select component is clean. If true, the select component will have a transparent background, no border and be hug the width of the content. */
isClean?: boolean;
/** Whether the select component is disabled */
isDisabled?: boolean;
/** Additional class name */
className?: string;
/** Additional style */
style?: React.CSSProperties;
} & ({
/** Label of the select component. If not provided, please provide an ariaLabel. */
label?: undefined;
/** Aria label of the select component */
ariaLabel: string;
} | {
label: React.ReactNode;
ariaLabel?: string;
});
type ReactSelectProps = GroupBase> = {
/** Type of the select component */
type: 'select';
/** Props of the select component, based of React Select props */
selectProps: Props;
} & SelectCommonProps;
type ReactSelectAsyncProps = GroupBase> = {
/** Type of the select component */
type: 'async';
/** Props of the select component, based of React Select props */
selectProps: AsyncProps;
} & SelectCommonProps;
type ReactSelectCreatableProps = GroupBase> = {
/** Type of the select component */
type: 'creatable';
/** Props of the select component, based of React Select props */
selectProps: CreatableProps;
} & SelectCommonProps;
/**
* We will provide a wrapper to the three distinct select components
* the library provides:
* 1. Select (the most simple component)
* 2. Creatable (for creating new values in our options)
* 3. Async for fetching while typing, useful for cases that we avoid storing things
* in browser
*/
export type SelectProps = GroupBase> = ReactSelectProps | ReactSelectCreatableProps | ReactSelectAsyncProps;
export type SelectOverrideCustomProps = GroupBase> = Pick, 'size' | 'errorText' | 'helpText' | 'isClean'> & {
errorTextId?: string;
helpTextId?: string;
};
export {};
//# sourceMappingURL=types.d.ts.map