import { ReactNode } from '../../../node_modules/react'; import { BackgroundProps, ColorMode, MiniMapProps, NodeTypes, ReactFlowProps } from '@xyflow/react'; import { FlowDirection } from './tokens'; import { FlowNodeRegistry } from './nodeRegistry'; import { IconName } from '../Icon'; export interface GroupNodeData extends Record { label: string; } export type FlowBuilderNodeData = GroupNodeData | Record; export interface ConditionalEdgeData extends Record { label?: string; condition?: string; } /** `data` shape for `FlowButtonEdge` — a hover-revealed action button (e.g. delete) at the path midpoint. */ export interface FlowButtonEdgeData extends Record { onButtonClick?: () => void; /** @default 'x' */ buttonIconName?: IconName; label?: string; } export interface FlowBuilderProps extends Omit { /** Required — the design system ships NO built-in node types. */ nodeTypes: NodeTypes; /** Omit to follow `useThemeMode()`. Pass only to pin a canvas against the app theme. */ colorMode?: ColorMode; /** Direction dagre lays nodes out in. @default 'LR' */ layoutDirection?: FlowDirection; /** Drives `panOnDrag` / `selectionOnDrag` as a pair. @default 'select' */ interactionMode?: 'select' | 'pan'; /** @default true */ showBackground?: boolean; /** @default false — matches CJO, where the toolbar toggles it on. */ showMinimap?: boolean; /** Overrides merged over the Figma-verified defaults. */ backgroundProps?: Partial; /** Overrides merged over the Figma-verified defaults. */ minimapProps?: Partial; /** * Optional kind → definition lookup, provided to descendants via * `FlowNodeRegistryContext` / `useFlowNodeRegistry()`. `FlowBuilder` does not * render, validate, or otherwise act on it — it is a pure pass-through so a * node component nested inside the canvas can resolve its own `kind`. */ nodeRegistry?: FlowNodeRegistry; /** `` children — toolbar, pills, app chrome. */ children?: ReactNode; }