geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
49 lines (48 loc) • 2.83 kB
TypeScript
import { PopoverContent } from '../../unstyled/popover/popover-components';
import { default as React } from 'react';
export type CreatableOption = {
id: string;
name: string;
disabled?: boolean;
icon?: React.ReactElement;
};
export type PopoverContentProps = React.ComponentPropsWithoutRef<typeof PopoverContent>;
/** Replaces {{fieldId}} in URL with urlTemplateData[fieldId] */
export declare function interpolateUrl(url: string, data: Record<string, unknown>): string;
export type CreatableMultiComboboxPropsType = {
/** API URL to fetch options (POST). Supports {{fieldId}} for form value interpolation. Ignored if fetchOptions provided */
optionsUrl?: string;
/** API URL to create new option (POST). Supports {{fieldId}} for form value interpolation. Ignored if createOption provided */
createOptionUrl?: string;
/** Override: custom fetch for options. When provided, optionsUrl is ignored */
fetchOptions?: () => Promise<CreatableOption[]>;
/** Override: custom create handler. When provided, createOptionUrl is ignored */
createOption?: (value: string) => Promise<CreatableOption>;
/** Headers to include in API requests (e.g. Authorization from cookie). Can be sync or async */
requestHeaders?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
/** Request body for fetch options API. When provided, overrides default { ...urlTemplateData, fieldId } */
optionsRequestBody?: Record<string, unknown>;
/** Request body for create/upsert option API. Merged with { [createOptionValueKey]: value }. E.g. { type: "zone" } */
createOptionRequestBody?: Record<string, unknown>;
/** Key for the typed value in create body. Default "value". Use "email" if API expects that key */
createOptionValueKey?: string;
/** Extra body fields for create (e.g. { email: userEmail } from cookie). Merged last */
createOptionExtraBody?: Record<string, unknown> | (() => Record<string, unknown> | Promise<Record<string, unknown>>);
/** When true, createOptionExtraBody is not merged (use when value key is "email" and extra would conflict) */
skipCreateOptionExtraBody?: boolean;
/** Form values for URL interpolation (e.g. {{country}} -> values.country) */
urlTemplateData?: Record<string, unknown>;
value: string[];
fieldId: string;
placeholder?: string;
searchPlaceholder?: string;
emptyMessage?: string;
addCustomMessage?: (typedValue: string) => string;
/** Minimum number of values that must be selected */
minSelected?: number;
/** Maximum number of values that can be selected */
maxSelected?: number;
onChange: (value: string[]) => void;
container?: Element | null | undefined;
};
//# sourceMappingURL=creatable-multi-combobox.types.d.ts.map