/** * This reducer manages a collection of items that represent the content of an overflowable container. * The items are mostly content configured by the caller of the container, either data passed though * the source prop or as child elements. We also support 'injected' items. These allow for additional UI * controls to be inserted into the container, eg an 'Add Item' button. */ import { type ReactElement, type ReactNode, type Reducer } from "react"; import type { OverflowCollectionOptions, OverflowItem, OverflowItems, OverflowSource } from "./overflowTypes"; interface InitAction { type: "init"; overflowItems?: OverflowItem[]; } interface SourceAction { type: "add-source-item"; idRoot: string; source: any; } interface AddChildAction { type: "add-child-item"; idRoot: string; indexPosition?: number; element: ReactElement; } interface RemoveItemAction { type: "remove-item"; indexPosition: number; } interface MultiItemAction { type: "update-items" | "update-items-remove-overflow-indicator"; overflowItems: (Partial> & Pick)[]; } interface SingleItemAction { type: "add-overflow-indicator" | "replace-item" | "collapsing-item" | "uncollapse-dynamic-item" | "collapse-instant-item"; overflowItem: OverflowItem; } interface CombinedItemAction { type: "update-items-add-overflow-indicator"; overflowItem: OverflowItem; overflowItems: OverflowItem[]; } interface EmptyPayloadAction { type: "restore-collapsing-item"; } interface DynamicCollapseAction extends Omit { type: "collapse-dynamic-item"; collapsedSize: number; minSize: number; } export type OverflowAction = AddChildAction | CombinedItemAction | DynamicCollapseAction | EmptyPayloadAction | InitAction | MultiItemAction | RemoveItemAction | SingleItemAction | SourceAction; export type OverflowReducer = Reducer; export type OverflowReducerInitialisationProps = { children?: ReactNode; source?: OverflowSource[]; injectedItems?: any[]; idRoot: string; options?: OverflowCollectionOptions; }; export declare const reducerInitialiser: (props: OverflowReducerInitialisationProps) => OverflowItems; export declare const overflowReducer: OverflowReducer; export {};