import React, { type FC, type ReactNode } from 'react'; import { type ScreenReaderInstructions, type KeyboardCoordinateGetter, type Collision, type DndContextProps, type Active, type Over } from '@dnd-kit/core'; import useSortable, { type UseSortableRenderProps } from '../hooks/useSortable'; import type { Styles, SortableId, IdsMap, SortableVariant, GroupsData, GroupData } from '../types'; export type { UseSortableRenderProps, SortableId }; export { useSortable }; type DragStartEvent = { active: Active; }; type DragOverEvent = { active: Active; over: Over | null; }; type DragEndEvent = { active: Active; over: Over | null; }; type DragCancelEvent = { active: Active; over: Over | null; }; type EventMetadata = { idsMap: IdsMap; groupsData: GroupsData; }; type CollisionDetectionArgs = Parameters>[0]; export interface SortableBaseProps { value?: T; onChange?: (value: T, meta: { from: number; to: number; }) => void; disabled?: boolean; children: ReactNode; restrictAxis?: boolean; screenReaderInstructions?: ScreenReaderInstructions; accessibilityContainer?: HTMLElement; variant?: SortableVariant; disableDragOverlay?: boolean; dragPlaceholderStyle?: Styles; dragOverlay?: FC<{ children: ReactNode; }>; onDragStart?: (event: DragStartEvent, metadata: EventMetadata) => void; onDragOver?: (event: DragOverEvent, metadata: EventMetadata) => void; onDragEnd?: (event: DragEndEvent, metadata: EventMetadata) => void; onDragCancel?: (event: DragCancelEvent, metadata: EventMetadata) => void; sortableKeyboardCoordinates?: (event: Parameters[0], args: Parameters[1], idsMap: IdsMap) => ReturnType; collisionDetection?: (args: CollisionDetectionArgs, metadata: EventMetadata) => Collision[]; getIdsMap: (ids: T) => IdsMap; validateUniqueIds: (ids: T) => boolean; } type SortableItemRender = (props: UseSortableRenderProps) => ReactNode; type ItemsRegistration = { register: (id: SortableId, render: SortableItemRender) => void; unregister: (id: SortableId) => void; }; type GroupsRegistration = { register: (id: SortableId, data: GroupData) => void; unregister: (id: SortableId) => void; }; type SortableConfig = Pick & { disabled: boolean; ids: unknown; idsMap: IdsMap; isDragOverlay: boolean; itemsRegistration: ItemsRegistration; groupsRegistration: GroupsRegistration; defaultGroupId: SortableId; }; declare const SortableBase: ({ value: ids, children, disabled, variant, restrictAxis, screenReaderInstructions, accessibilityContainer, disableDragOverlay, dragPlaceholderStyle: inDragPlaceholderStyle, onDragStart, onDragOver, onDragEnd, onDragCancel, dragOverlay, collisionDetection, sortableKeyboardCoordinates: customSortableKeyboardCoordinates, getIdsMap, validateUniqueIds, }: SortableBaseProps) => React.JSX.Element; export default SortableBase; export declare function useInternalSortableConfig(): SortableConfig;