{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/select/types.tsx"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type ReactNode } from 'react';\nimport { type GroupBase, type Props } from 'react-select';\nimport { type AsyncProps } from 'react-select/async';\nimport { type CreatableProps } from 'react-select/creatable';\n\nexport type SelectCommonProps = {\n  /** Error message, if it exists the select will be in error state */\n  errorText?: string | ReactNode;\n  /** Help text of the select component */\n  helpText?: string | ReactNode;\n  /** Size of the component */\n  size?: 'small' | 'medium' | 'large';\n  /** Whether the select component is fluid */\n  isFluid?: boolean;\n  /** 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. */\n  isClean?: boolean;\n  /** Whether the select component is disabled */\n  isDisabled?: boolean;\n  /**\n   * Whether a value is required. Sets `aria-required` and enables native form validation.\n   * @default false\n   */\n  isRequired?: boolean;\n  /**\n   * Whether Required or Optional is shown at the end of the label row, based on the `isRequired` prop\n   * @default false\n   */\n  hasRequiredIndicator?: boolean;\n  /** Additional class name */\n  className?: string;\n  /** Additional style */\n  style?: React.CSSProperties;\n} & (\n  | {\n      // Deprecated, so this keeps its aria label union even though naming a\n      // control is spelled differently on every form component. Combobox, its\n      // replacement, requires the label and clips it with\n      // `hasVisuallyHiddenLabel` instead.\n      /** Label of the select component. If not provided, please provide an ariaLabel. */\n      label?: undefined;\n      /** Aria label of the select component */\n      ariaLabel: string;\n    }\n  | {\n      label: React.ReactNode;\n      ariaLabel?: string;\n    }\n);\n\ntype ReactSelectProps<\n  OptionType,\n  IsMulti extends boolean = false,\n  GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n  /** Type of the select component */\n  type: 'select';\n  /** Props of the select component, based of React Select props */\n  selectProps: Props<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\ntype ReactSelectAsyncProps<\n  OptionType,\n  IsMulti extends boolean = false,\n  GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n  /** Type of the select component */\n  type: 'async';\n  /** Props of the select component, based of React Select props */\n  selectProps: AsyncProps<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\ntype ReactSelectCreatableProps<\n  OptionType,\n  IsMulti extends boolean = false,\n  GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = {\n  /** Type of the select component */\n  type: 'creatable';\n  /** Props of the select component, based of React Select props */\n  selectProps: CreatableProps<OptionType, IsMulti, GroupType>;\n} & SelectCommonProps;\n\n/**\n * We will provide a wrapper to the three distinct select components\n * the library provides:\n * 1. Select (the most simple component)\n * 2. Creatable (for creating new values in our options)\n * 3. Async for fetching while typing, useful for cases that we avoid storing things\n * in browser\n */\n/**\n * @remarks\n * The `type` prop is used to specify the type of select component to render, which will be passed to the underlying React Select component.\n *\n * @remarks\n * The `selectProps` prop is dynamically typed based on the `type` prop and can be one of the following: `StateManagerProps`, `CreatableProps`, `AsyncProps`. All select variants will have the `SelectProps` base type from React Select. For more information on the available props, see the [React Select documentation](https://react-select.com/props).\n */\nexport type SelectProps<\n  OptionType,\n  IsMulti extends boolean = false,\n  GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> =\n  | ReactSelectProps<OptionType, IsMulti, GroupType>\n  | ReactSelectCreatableProps<OptionType, IsMulti, GroupType>\n  | ReactSelectAsyncProps<OptionType, IsMulti, GroupType>;\n\nexport type SelectOverrideCustomProps<\n  OptionType,\n  IsMulti extends boolean = false,\n  GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n> = Pick<SelectProps<OptionType, IsMulti, GroupType>, 'size' | 'isClean'>;\n"],"mappings":""}