import type { ReactNode } from 'react'; import type { Contact } from './contact.types'; import type { Fetcher, LookupFieldCreateHelpers } from '@components/LookupField'; export interface CatalogItem { id: string; name: string; } export interface LookupEntityConfig { entity: string; displayFields: string[]; searchFields?: string[]; displayTemplate?: string; /** * Optional inline "+" create-new capability for this lookup — same contract as * LookupField's own `onCreateNew`: render the host's create form/popup, call * `onCreated(record)` when it succeeds (LookupField selects it automatically) or * `onCancel()` to close without changing the selection. Omit to leave this lookup * without a create button, same as today. */ onCreateNew?: (helpers: LookupFieldCreateHelpers) => ReactNode; /** Label/tooltip for the "+" button. Defaults to LookupField's own "Create new". */ createButtonLabel?: string; /** * Title shown in the create popup's own header bar. Set this whenever `onCreateNew` * is provided — otherwise the popup falls back to LookupField's generic (English) * "Create new" title. The render function passed to `onCreateNew` should NOT render * its own duplicate heading; the popup's header already covers it — unless you set * `createShowHeader: false` (see below), in which case your content owns the header. */ createTitle?: string; /** * Whether the popup renders its own header (icon + title + close button) — same * contract as LookupField's own `createShowHeader`. Defaults to `false`, since * `onCreateNew` almost always renders a complete header of its own — set to `true` * only when its render function is genuinely headerless and should rely on the * popup's native header (using `createTitle`) instead. */ createShowHeader?: boolean; /** * Custom "create new" popup width — same contract as LookupField's own `createWidth`. * Any valid CSS size; use relative units (`vw`, `%`, `min(...)`) so it holds up across * screen sizes, never a raw `px` value. Use this for a form big enough to need real * room. Omit for the compact default (`32rem` for `'modal'`, `28rem` for `'sidebar'`). */ createWidth?: string; /** * Maximum "create new" popup height — same rules as `createWidth` (relative units * only). Omit for the compact default (`85vh` for `'modal'`, full height for * `'sidebar'`). Always a CAP, never a fixed height — the panel shrinks to fit its * content and only grows up to this value. */ createHeight?: string; } export interface LookupConfig { fetcher: Fetcher; socialNetworkTypes: LookupEntityConfig; countries: LookupEntityConfig; states?: LookupEntityConfig; cities?: LookupEntityConfig; neighborhoods?: LookupEntityConfig; } export interface IContactServiceAdapter { getByRecordId(recordId: string): Promise; save(recordId: string, contacts: Contact[]): Promise; getClassifications?(): Promise; lookupConfig: LookupConfig; } //# sourceMappingURL=adapter.types.d.ts.map