import { ReactNode } from 'react'; import { FlexProps } from '../Flex'; import { GapSize } from '../../types'; import { DndSortZoneAdvancedRenderer } from './types'; /** * Common properties shared by all zone types */ type CommonZoneProps = { /** * Array of accepted types for the drop zone. Items with matching types can be dropped here. */ acceptedTypes?: string[]; /** * The content to be rendered inside the drop zone. */ children?: ReactNode; /** * Whether the drop zone is disabled and cannot accept drops. */ disabled?: boolean; /** * Unique identifier for the drop zone. */ id: string | number; /** * Label for the drop zone, used for accessibility. */ label: string; /** * Function to render the drop zone using internal state parameters. */ advancedRenderer?: DndSortZoneAdvancedRenderer; /** * Function to validate the drop action. Returns true for valid drops, false for invalid drops. */ validator?: (id: string | number) => boolean; }; /** * Properties for sortable zones that can reorder items */ type SortableZoneProps = CommonZoneProps & { /** * Indicates this zone can sort and reorder items. */ sortable: true; /** * Array of sorted IDs for the items in the zone, must match render order. */ sortedIds: (string | number)[]; /** * Determines where an item will be placed when dropped loosely in a zone. * @default "end" */ defaultDropPosition?: "start" | "end"; /** * Gap size between items in the drop zone, necessary for the placement of the drop line. * Must reserve space for the drop line. */ gap?: Exclude; /** * Orientation of the items in the drop zone. */ orientation: "horizontal" | "vertical"; }; /** * Properties for non-sortable zones that only accept drops */ type NonSortableZoneProps = CommonZoneProps & { /** * Indicates this zone cannot sort items. * @default false */ sortable?: false; /** * Not available for non-sortable zones. */ sortedIds?: never; /** * Not available for non-sortable zones. */ defaultDropPosition?: never; /** * Gap size between items in the drop zone. */ gap?: GapSize; /** * Orientation of the items in the drop zone. */ orientation?: "horizontal" | "vertical"; }; /** * Props for the DndSortZone component */ export type DndSortZoneProps = SortableZoneProps | NonSortableZoneProps; /** * Props for the DndSortZone component with Flex layout support * @extends Omit * @extends DndSortZoneProps */ export type DndSortZonePropsWithFlexLayout = Omit & DndSortZoneProps; /** * A drop zone component for drag and drop sorting functionality. * * Features: * - Configurable as sortable or non-sortable zones * - Type-based validation for accepted items * - Custom validation functions * - Visual feedback during drag operations * - Flexible layout with horizontal/vertical orientation * - Advanced rendering with state parameters * - Accessible with proper ARIA attributes * - Extends Flex component functionality * - Automatic drop line positioning * - Support for custom gap sizing * * @example * * Content * Content * */ export default function DndSortZone(props: DndSortZonePropsWithFlexLayout): import("react/jsx-runtime").JSX.Element; export {};