import type * as React from 'react'; /** * One action for `ActionBar` (and, in S-4, the output of `useActionItems`). * * Rules the bar enforces: * - Only one `primary` is rendered as primary; any later `primary` is demoted * to `secondary` (same rule as `splitActionsByPriority`). * - `destructive` items never render inline: they go last in the overflow * menu/sheet, after a divider, in the destructive colour, and ask for * confirmation unless `confirm: false`. * - `overflow` items always live in the overflow menu. */ export interface ActionItem { key: string; label: string; /** Icon node (e.g. ``). String icon names are resolved by adapters (runtime-react), not here. */ icon?: React.ReactNode; /** Default `secondary`. */ priority?: 'primary' | 'secondary' | 'overflow'; destructive?: boolean; disabled?: boolean; /** Why it is disabled. Implies `disabled`; shown as tooltip (desktop) or text (menu/sheet). */ disabledReason?: string; /** External busy flag. The bar also shows a spinner while `run`'s promise is pending. */ loading?: boolean; hidden?: boolean; /** * Confirmation before `run`. Destructive items confirm by default with a * generic copy; pass an object to customise it or `false` when the host * already confirms on its own (e.g. a CRUD delete dialog). */ confirm?: ActionConfirm | false; run: () => void | Promise; } export interface ActionConfirm { title?: string; description?: string; confirmLabel?: string; cancelLabel?: string; } export interface ActionBarPlan { primary?: ActionItem; /** Secondary actions rendered inline, in order. */ inline: ActionItem[]; /** Non-destructive actions in the overflow menu, in order. */ overflow: ActionItem[]; /** Destructive actions, always last in the overflow menu. */ destructive: ActionItem[]; } export interface PlanOptions { /** Upper bound of inline buttons, primary included. */ maxVisible: number; /** Width of the bar's box (px). Omit to plan by `maxVisible` only. */ containerWidth?: number; /** Natural width (px) of each rendered button, by `key`. */ widths?: Record; /** Width (px) of the «⋯» trigger. */ overflowTriggerWidth?: number; /** Gap between buttons (px). */ gap?: number; } export declare function isDisabled(item: ActionItem): boolean; export declare function needsConfirm(item: ActionItem): boolean; /** * Splits `items` into primary / inline / overflow / destructive. * * Collapse order: inline secondaries leave from the end (the last declared * is the least important) until primary + inline + «⋯» fit in * `containerWidth`. The primary never collapses. */ export declare function planActionBar(items: ActionItem[], options: PlanOptions): ActionBarPlan; export type MaxVisible = number | Partial>; /** Tailwind breakpoints (px), evaluated against the viewport. */ export declare const ACTION_BAR_BREAKPOINTS: { readonly sm: 640; readonly md: 768; readonly lg: 1024; }; export declare const DEFAULT_MAX_VISIBLE: Readonly>>; /** Resolves a responsive `maxVisible` for a viewport width (mobile-first, like Tailwind). */ export declare function resolveMaxVisible(value: MaxVisible | undefined, viewportWidth: number): number; //# sourceMappingURL=action-bar-plan.d.ts.map