Files
klz-cables.com/.pnpm-store/v10/files/12/d3d6228776fa427d673efcf36deb98769e15fc5f3cdb0cb797294ec45e327469d72c286171c695f8d1faf18e7ae3b856a0e062ffe8f2a8adb4853977826385
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

42 lines
2.3 KiB
Plaintext

import { ReactNode } from 'react';
import { PublicBaseSelectProps } from './Select';
import { GetOptionLabel, GetOptionValue, GroupBase, Options, OptionsOrGroups } from './types';
export interface Accessors<Option> {
getOptionValue: GetOptionValue<Option>;
getOptionLabel: GetOptionLabel<Option>;
}
export interface CreatableAdditionalProps<Option, Group extends GroupBase<Option>> {
/**
* Allow options to be created while the `isLoading` prop is true. Useful to
* prevent the "create new ..." option being displayed while async results are
* still being loaded.
*/
allowCreateWhileLoading?: boolean;
/** Sets the position of the createOption element in your options list. Defaults to 'last' */
createOptionPosition?: 'first' | 'last';
/**
* Gets the label for the "create new ..." option in the menu. Is given the
* current input value.
*/
formatCreateLabel?: (inputValue: string) => ReactNode;
/**
* Determines whether the "create new ..." option should be displayed based on
* the current input value, select value and options array.
*/
isValidNewOption?: (inputValue: string, value: Options<Option>, options: OptionsOrGroups<Option, Group>, accessors: Accessors<Option>) => boolean;
/**
* Returns the data for the new option when it is created. Used to display the
* value, and is passed to `onChange`.
*/
getNewOptionData?: (inputValue: string, optionLabel: ReactNode) => Option;
/**
* If provided, this will be called with the input value when a new option is
* created, and `onChange` will **not** be called. Use this when you need more
* control over what happens when new options are created.
*/
onCreateOption?: (inputValue: string) => void;
}
declare type BaseCreatableProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = PublicBaseSelectProps<Option, IsMulti, Group> & CreatableAdditionalProps<Option, Group>;
export default function useCreatable<Option, IsMulti extends boolean, Group extends GroupBase<Option>>({ allowCreateWhileLoading, createOptionPosition, formatCreateLabel, isValidNewOption, getNewOptionData, onCreateOption, options: propsOptions, onChange: propsOnChange, ...restSelectProps }: BaseCreatableProps<Option, IsMulti, Group>): PublicBaseSelectProps<Option, IsMulti, Group>;
export {};