
import { BaseProps, OuterStyleProps, Styles } from "@tenphi/tasty";
import { ReactNode } from "react";
import { Key as Key$1 } from "@react-types/shared";

//#region src/components/content/Tree/types.d.ts
/** Selection cardinality, mirroring React Aria/Stately's `selectionMode`. */
type TreeSelectionMode = 'none' | 'single' | 'multiple';
/**
 * A single node in the `treeData` array.
 *
 * Mirrors AntD's `DataNode` shape but renames boolean flags to the
 * `is*` convention used throughout `@cube-dev/ui-kit`.
 */
interface CubeTreeNodeData {
  /** Unique identifier of the node. */
  key: string;
  /** Visible label (any `ReactNode`). */
  title: ReactNode;
  /** Children. Pass `undefined` together with `isLeaf={false}` for lazy nodes. */
  children?: CubeTreeNodeData[];
  /** Force leaf rendering (no expand toggle, no `loadData` call). */
  isLeaf?: boolean;
  /** Disable interactions on this row (focus / select / expand / check). */
  isDisabled?: boolean;
  /** Disable only the checkbox of this row. */
  isCheckboxDisabled?: boolean;
  /**
   * Per-node `isCheckable` override.
   *
   * - `undefined` (default): inherits the tree-level `isCheckable`.
   * - `false`: hide the checkbox for this row even when the tree is `isCheckable`.
   */
  isCheckable?: boolean;
}
/** Info passed as the second argument to `onCheck`. */
interface TreeOnCheckInfo {
  /** Whether the toggled node ended up checked. */
  checked: boolean;
  /** The toggled node. */
  node: CubeTreeNodeData;
  /** All currently checked nodes (flat). */
  checkedNodes: CubeTreeNodeData[];
  /** Keys of nodes in indeterminate state. */
  halfCheckedKeys: Key$1[];
}
/** Info passed as the second argument to `onExpand`. */
interface TreeOnExpandInfo {
  /** Whether the toggled node ended up expanded. */
  expanded: boolean;
  /** The toggled node. */
  node: CubeTreeNodeData;
}
/** Info passed as the second argument to `onSelect`. */
interface TreeOnSelectInfo {
  /** Whether the toggled node ended up selected. */
  selected: boolean;
  /** The toggled node. */
  node: CubeTreeNodeData;
  /** All currently selected nodes (flat). */
  selectedNodes: CubeTreeNodeData[];
}
/** Argument shape for the `loadData` callback. */
interface TreeLoadDataNode {
  key: Key$1;
  children?: CubeTreeNodeData[];
}
/**
 * Public props for the `Tree` component.
 *
 * Designed to be a drop-in (modulo `is*` renames) for the AntD `Tree`
 * `treeData` API, scoped to the v1 feature set.
 */
interface CubeTreeProps extends BaseProps, OuterStyleProps {
  /** Hierarchical data describing the tree. */
  treeData: CubeTreeNodeData[];
  /** Render a checkbox in front of every (eligible) row. */
  isCheckable?: boolean;
  /** Allow row selection. Sugar for `selectionMode="none"` when `false`. */
  isSelectable?: boolean;
  /** Selection cardinality. Defaults to `'single'`. */
  selectionMode?: TreeSelectionMode;
  /** Stretch each row to the full width of the container. */
  blockNode?: boolean;
  /** Disable the entire tree. */
  isDisabled?: boolean;
  /** Default expanded keys (uncontrolled). */
  defaultExpandedKeys?: string[];
  /** Controlled expanded keys. */
  expandedKeys?: string[];
  /**
   * Auto-expand parents of currently expanded keys.
   *
   * Useful while filtering: passing matched leaf keys with this flag will
   * keep their parents expanded as well.
   */
  autoExpandParent?: boolean;
  /** Default checked keys (uncontrolled). */
  defaultCheckedKeys?: string[];
  /**
   * Controlled checked keys.
   *
   * Accepts either an array of keys or AntD's `{ checked, halfChecked }` shape.
   */
  checkedKeys?: string[] | {
    checked: string[];
    halfChecked?: string[];
  };
  /** Default selected keys (uncontrolled). */
  defaultSelectedKeys?: string[];
  /** Controlled selected keys. */
  selectedKeys?: string[];
  /**
   * Fixed height in pixels. When omitted, the tree fills the available
   * vertical space and scrolls internally.
   */
  height?: number;
  /**
   * Async loader called the first time a non-leaf node with no `children`
   * is expanded. The consumer is expected to merge new children into
   * `treeData` (typical AntD pattern).
   */
  loadData?: (node: TreeLoadDataNode) => Promise<void>;
  /** Called when a node is expanded or collapsed. */
  onExpand?: (expandedKeys: Key$1[], info: TreeOnExpandInfo) => void;
  /**
   * Called when a node is checked or unchecked.
   *
   * The first argument is `Key[]` by default; pass `checkedKeys` as
   * `{ checked, halfChecked }` to receive the same shape back.
   */
  onCheck?: (checked: Key$1[] | {
    checked: Key$1[];
    halfChecked: Key$1[];
  }, info: TreeOnCheckInfo) => void;
  /** Called when row selection changes. */
  onSelect?: (selectedKeys: Key$1[], info: TreeOnSelectInfo) => void;
  /** Override styles for `[data-element="Row"]` (per-row root). */
  rowStyles?: Styles;
  /** QA selector. */
  qa?: string;
}
//#endregion
export { CubeTreeNodeData, CubeTreeProps, TreeLoadDataNode, TreeOnCheckInfo, TreeOnExpandInfo, TreeOnSelectInfo, TreeSelectionMode };
//# sourceMappingURL=types.d.ts.map