
import { LayoutConstraint, LayoutItem, ResizeHandleAxis } from "./grid-core/types.js";
import { CubeBoardWidgetProps } from "./Widget.js";
import { AllBaseProps, ContainerStyleProps } from "@tenphi/tasty";
import { ReactNode } from "react";

//#region src/components/layout/Board/Board.d.ts
type BoardCompactType = 'vertical' | 'horizontal' | 'free' | null;
/**
 * Payload passed to the drag/resize lifecycle callbacks. `layout` is the board's
 * current layout at the moment the callback fires, `item` is the affected item
 * (falls back to `oldItem` if the item just left this board via a cross-board
 * transfer), `oldItem` is that item as it was when the gesture started, and
 * `placeholder` is the current drop-slot preview (if any).
 */
interface BoardInteractionInfo {
  layout: LayoutItem[];
  item: LayoutItem;
  oldItem: LayoutItem;
  placeholder: LayoutItem | null;
}
/** Visibility of the internal grid-line overlay. */
type BoardGridLines = boolean | 'drag';
/**
 * The subset of `Board.Widget` props a `Board` can set as defaults for every
 * widget it hosts (via `widgetProps`). Excludes `id`/`children`, which are
 * per-widget. Per-widget `Board.Widget` props override these.
 */
type CubeBoardWidgetDefaults = Omit<CubeBoardWidgetProps, 'id' | 'children'>;
interface CubeBoardProps extends Omit<AllBaseProps, 'children' | 'onDragStart' | 'onDrag' | 'onResize'>, Omit<ContainerStyleProps, 'margin'> {
  /** Stable board id (used for cross-board drag). Auto-generated if omitted. */
  id?: string;
  /** Controlled layout. */
  layout?: LayoutItem[];
  /** Initial layout for uncontrolled usage. */
  defaultLayout?: LayoutItem[];
  onLayoutChange?: (layout: LayoutItem[]) => void;
  /** Called when a drag gesture starts. */
  onDragStart?: (info: BoardInteractionInfo) => void;
  /** Called on every step of a drag gesture. */
  onDrag?: (info: BoardInteractionInfo) => void;
  /** Called when a drag gesture ends (after the layout is committed). */
  onDragStop?: (info: BoardInteractionInfo) => void;
  /** Called when a resize gesture starts. */
  onResizeStart?: (info: BoardInteractionInfo) => void;
  /** Called on every step of a resize gesture. */
  onResize?: (info: BoardInteractionInfo) => void;
  /** Called when a resize gesture ends (after the layout is committed). */
  onResizeStop?: (info: BoardInteractionInfo) => void;
  /** Number of columns. @default 12 */
  cols?: number;
  /** Row height in pixels. @default 100 */
  rowHeight?: number;
  /** [horizontal, vertical] margin between widgets in pixels. @default [8, 8] */
  margin?: [number, number];
  /**
   * [horizontal, vertical] padding inside the board. Defaults to `margin`, or
   * to `[0, 0]` for an aligned nested board (`isAligned`) so its grid lines up
   * with the ancestor board's.
   */
  containerPadding?: [number, number];
  /** Maximum number of rows. @default Infinity */
  maxRows?: number;
  /**
   * Compaction behavior. `'vertical'` / `'horizontal'` reflow widgets to remove
   * gaps; `'free'` places each widget exactly where dropped and never pushes its
   * neighbours (pair with `allowOverlap` to let widgets stack, otherwise moving
   * onto an occupied cell is blocked); `null` disables compaction but still
   * resolves collisions the legacy react-grid-layout way. @default 'vertical'
   */
  compact?: BoardCompactType;
  /** Allow widgets to overlap. @default false */
  allowOverlap?: boolean;
  /** Block movement into occupied cells instead of pushing. @default false */
  preventCollision?: boolean;
  /** Enable dragging for all widgets. @default true */
  isDraggable?: boolean;
  /** Enable resizing for all widgets. @default true */
  isResizable?: boolean;
  /** Whether this board accepts widgets dropped from other boards. @default true */
  isDroppable?: boolean;
  /** Which resize handles to show. @default ['se'] */
  resizeHandles?: ResizeHandleAxis[];
  /**
   * CSS selector for elements that must not start a pointer drag (e.g. form
   * controls inside a widget: `"input,textarea,button,a,.no-drag"`). Does not
   * affect keyboard moves — those only run when the widget host itself is
   * focused. Can be overridden per widget on `Board.Widget`.
   */
  dragCancel?: string;
  /**
   * CSS selector for the only elements from which a pointer drag may start.
   * Can be overridden per widget on `Board.Widget`.
   */
  dragHandle?: string;
  /**
   * Show grid lines behind the widgets. `true` always shows them, `'drag'`
   * shows them only while a widget is being dragged or resized, `false` never.
   * @default false
   */
  showGridLines?: BoardGridLines;
  /**
   * Align this board's grid with an ancestor `Board`'s layout. Only takes
   * effect when the board is nested inside another `Board`'s widget. When set,
   * every cell matches the parent's cell size exactly: the board inherits the
   * parent's column pitch (deriving its own column count from its measured
   * width) and uses the parent's row height verbatim. It never shrinks rows to
   * fit; pair it with an `isAutoHeight` container so the widget grows to fit its
   * rows at that height. @default false
   */
  isAligned?: boolean;
  /** Grid/item layout constraints. */
  constraints?: LayoutConstraint[];
  /**
   * Explicit container width in pixels. When provided, disables automatic width
   * measurement (useful for SSR and tests).
   */
  width?: number;
  /**
   * Default props applied to every widget this board hosts. Per-widget
   * `Board.Widget` props override these. Use it to add a card border to every
   * widget (`widgetProps={{ isCard: true }}`) or set shared sizing/`styles`
   * defaults without repeating them on each `Board.Widget`.
   */
  widgetProps?: Partial<CubeBoardWidgetDefaults>;
  children?: ReactNode;
}
//#endregion
export { BoardCompactType, BoardGridLines, BoardInteractionInfo, CubeBoardProps };
//# sourceMappingURL=Board.d.ts.map