@procore/core-react
Version:
React library of Procore Design Guidelines
31 lines (30 loc) • 2.26 kB
TypeScript
import type { SuperSelectConfig, SuperSelectOptgroup, SuperSelectOption, SuperSelectValue, SuperSelectValuePrimitive } from './SuperSelect.types';
export declare const getGroupNameIsValid: (groupName: unknown) => boolean;
export declare const getOptionsSortingAlgorithm: ({ getOptionIsBatch, getOptionLabel, }: {
getOptionIsBatch: NonNullable<SuperSelectConfig['getOptionIsBatch']>;
getOptionLabel: NonNullable<SuperSelectConfig['getOptionLabel']>;
}) => (a: SuperSelectOption, b: SuperSelectOption) => number;
export declare const getBatchOptionFormatter: ({ value, multiple, getOptionIsBatch, getOptionValue, }: {
value: SuperSelectConfig['value'];
multiple: NonNullable<SuperSelectConfig['multiple']>;
getOptionIsBatch: NonNullable<SuperSelectConfig['getOptionIsBatch']>;
getOptionValue: NonNullable<SuperSelectConfig['getOptionValue']>;
}) => (option: SuperSelectOption) => any;
export declare const RESERVED_UNGROUPED_OPTGROUP_NAME = "RESERVED_UNGROUPED_OPTGROUP_NAME";
export declare const collectGroupsInOrderOfOccurrence: (opts: SuperSelectOption[], getOptionGroup: NonNullable<SuperSelectConfig['getOptionGroup']>) => {
groups: string[];
groupedOptions: Record<string, SuperSelectOption[]>;
};
export declare function reorder(options: SuperSelectOption[], startIndex: number, endIndex: number): {
nextOptions: any[];
prevGroup: string;
nextGroup: string;
};
export declare function isMultiple<T>(multiple: boolean, value: T | T[]): value is T[];
export declare const getOptionIsOptgroup: (item: SuperSelectOption) => item is SuperSelectOptgroup;
export declare const getOptionIsOptSelectAll: (item: SuperSelectOption) => item is SuperSelectOptgroup;
export declare const sortOptgroups: (groupA: string, groupB: string) => number;
export declare function getIsAllOptionsUngrouped(groups: string[]): boolean;
export declare function createOptgroup(groupName: string, groupOptions: SuperSelectOption[]): any[];
export declare function removeEmptyOptGroups(options: SuperSelectOption[]): any[];
export declare function defaultOnUnselectAll(value: SuperSelectValue, options: SuperSelectOption[], searchValue: string, getValue: (opt: SuperSelectOption) => Array<SuperSelectValuePrimitive>): SuperSelectValue;