import { type ComponentPropsWithoutRef, type ReactNode } from 'react'; import { type VariantProps } from 'class-variance-authority'; export type PatientSearchVariant = 'who-where' | 'who-where-when' | 'faceted' | 'discovery'; export type WhenFilter = 'today' | 'tomorrow' | 'this_week' | 'anytime'; /** Result from `loadObjects` — a profession, specialty, operator, or practice. */ export interface PatientSearchObject { /** Stable opaque key, e.g. `"profession:dentista"` or `"operator:mario-rossi-9001"`. */ value: string; label: string; description?: string; /** Opaque consumer payload — used in `onObjectSelect` to route. */ __payload?: unknown; } /** Selected place, geolocation result, or opted-in typed address. */ export interface PatientSearchPlace { /** Provider value, `geo:,`, or `text:` with `allowTypedPlace`. */ value: string; /** Display label, e.g. `"Milano, Italia"`. */ label: string; lat?: number; lng?: number; } /** Curated card for the `discovery` variant. */ export interface DiscoveryCard { id: string; label: string; description?: string; href: string; icon?: ReactNode; /** * Accent token. `auto` rotates through the brand palette by row index. * Defaults to `auto`. */ accent?: 'violet' | 'purple' | 'magenta' | 'blue' | 'auto'; badge?: string; } export interface FacetOption { value: string; label: string; } export interface FacetGroup { /** Stable key — e.g. `"insurance"`, `"language"`. */ key: string; /** Display label, e.g. `"Convenzione"`. */ label: string; /** Empty array = boolean toggle chip. Non-empty = dropdown chip. */ options: FacetOption[]; /** Whether multiple options can be selected. Default false. */ multi?: boolean; } export interface SearchValue { object?: PatientSearchObject; place?: PatientSearchPlace; when?: WhenFilter; facets?: Record; geo?: { lat: number; lng: number; radiusKm: number; label?: string; }; } /** Curated imperative handle — used by the agent adapter. */ export interface PatientSearchHandle { getVariant: () => PatientSearchVariant; reset: () => void; /** Move focus to the most-relevant field for the current variant. */ focusPrimary: () => void; } declare const rootVariants: (props?: ({ variant?: "who-where" | "who-where-when" | "faceted" | "discovery" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; export interface PatientSearchProps extends Omit, 'aria-label' | 'onChange' | 'onSubmit'>, VariantProps { variant: PatientSearchVariant; loadObjects: (query: string, ctx: { signal: AbortSignal; }) => Promise; loadPlaces: (query: string, ctx: { signal: AbortSignal; }) => Promise; onObjectSelect?: (option: PatientSearchObject) => void; onPlaceSelect?: (place: PatientSearchPlace) => void; facets?: FacetGroup[]; /** Default radius in km when geolocation is granted. Snaps to the nearest preset. */ defaultRadiusKm?: number; /** Reverse-geocode lat/lng → human label. Optional. */ reverseGeocode?: (lat: number, lng: number) => Promise; discoveryCards?: DiscoveryCard[]; /** * Heading level (`h2`, `h3` or `h4`) of the discovery section title. * Pick the level that follows the heading above the search on the host * page, so the page keeps a correct heading order. Used by the * `discovery` variant only. * @default 3 */ discoveryHeadingLevel?: 2 | 3 | 4; /** Forwarded to the consumer's loaders if they want to constrain by country. */ countryCode?: 'it' | 'de' | string; value: SearchValue; onChange: (next: SearchValue) => void; onSubmit: (value: SearchValue) => void | Promise; submitting?: boolean; /** * Record unselected, trimmed WHERE text in `value.place` as * `{ value: 'text:' + typed, label: typed }`, without coordinates. * Empty text clears the place. Applies to every variant. * @default false */ allowTypedPlace?: boolean; /** Custom CTA label override; defaults to `ui.patientSearch.submit.cta`. */ submitLabel?: string; /** * @default false * By default the kit disables the submit button until at least one * search dimension is set (object, place, geo, non-anytime when, or * a facet). Set to `true` to allow an empty submit — useful for * "browse all" patterns where the consumer wants to show all results * with no initial filter. */ allowEmptySubmit?: boolean; 'aria-label'?: string; /** Agent-readiness instance id. */ id?: string; } export declare const PatientSearch: import("react").ForwardRefExoticComponent>; export {}; //# sourceMappingURL=patient-search.d.ts.map