react-dragdrop-kit 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +289 -196
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kanban.esm.js +2 -0
- package/dist/kanban.esm.js.map +1 -0
- package/dist/kanban.js +2 -0
- package/dist/kanban.js.map +1 -0
- package/dist/src/components/DragDropList.d.ts +1 -1
- package/dist/src/components/DraggableItemWrapper.d.ts +1 -1
- package/dist/src/hooks/useDragDropMonitor.d.ts +5 -2
- package/dist/src/kanban/a11y/Announcer.d.ts +37 -0
- package/dist/src/kanban/a11y/useLiveRegion.d.ts +17 -0
- package/dist/src/kanban/components/KanbanBoard.d.ts +8 -0
- package/dist/src/kanban/components/KanbanCardView.d.ts +8 -0
- package/dist/src/kanban/components/KanbanColumnView.d.ts +8 -0
- package/dist/src/kanban/context.d.ts +13 -0
- package/dist/src/kanban/hooks/useAutoscroll.d.ts +10 -0
- package/dist/src/kanban/hooks/useKanbanDnd.d.ts +16 -0
- package/dist/src/kanban/index.d.ts +15 -0
- package/dist/src/kanban/types.d.ts +187 -0
- package/dist/src/kanban/utils/dndMath.d.ts +61 -0
- package/dist/src/kanban/utils/dom.d.ts +62 -0
- package/dist/src/kanban/utils/reorder.d.ts +38 -0
- package/dist/src/types/index.d.ts +5 -0
- package/dist/src/utils/order.d.ts +7 -0
- package/package.json +7 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kanban.js","sources":["../src/kanban/context.ts","../src/kanban/components/KanbanColumnView.tsx","../src/kanban/components/KanbanCardView.tsx","../src/kanban/utils/reorder.ts","../src/kanban/hooks/useKanbanDnd.ts","../src/kanban/hooks/useAutoscroll.ts","../src/kanban/a11y/Announcer.tsx","../src/kanban/components/KanbanBoard.tsx","../src/kanban/utils/dom.ts","../src/kanban/utils/dndMath.ts"],"sourcesContent":["/**\r\n * Kanban Board Context\r\n *\r\n * Internal context for sharing board state between components.\r\n */\r\n\r\nimport { createContext, useContext } from 'react';\r\nimport type { KanbanBoardState, KanbanDragState } from './types';\r\n\r\nexport interface KanbanContextValue {\r\n state: KanbanBoardState;\r\n dragState: KanbanDragState;\r\n isDragDisabled?: (id: string, type: 'CARD' | 'COLUMN') => boolean;\r\n}\r\n\r\nexport const KanbanContext = createContext<KanbanContextValue | null>(null);\r\n\r\nexport function useKanbanContext(): KanbanContextValue {\r\n const context = useContext(KanbanContext);\r\n if (!context) {\r\n throw new Error('Kanban components must be used within KanbanBoard');\r\n }\r\n return context;\r\n}\r\n","/**\r\n * Kanban Column View (Headless)\r\n *\r\n * Headless component for rendering draggable columns with drop zones.\r\n */\r\n\r\nimport React, { useRef, useEffect, useState, useCallback } from 'react';\nimport { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\r\nimport type { KanbanColumnViewProps, DragProvided, DragSnapshot } from '../types';\r\n\r\nconst KANBAN_COLUMN = 'kanban-column';\r\nconst KANBAN_COLUMN_DROP_ZONE = 'kanban-column-drop-zone';\r\n\r\nexport function KanbanColumnView({\n column,\n cardIds,\n children,\n isDragDisabled = false,\n index,\r\n}: KanbanColumnViewProps) {\r\n const columnRef = useRef<HTMLDivElement>(null);\r\n const dropZoneRef = useRef<HTMLDivElement>(null);\r\n const [isDragging, setIsDragging] = useState(false);\r\n const [isDraggingOver, setIsDraggingOver] = useState(false);\r\n\r\n // Make column header draggable\r\n const createDraggableColumn = useCallback(\r\n (element: HTMLElement) => {\r\n if (isDragDisabled) return () => {};\r\n\r\n return draggable({\r\n element,\r\n getInitialData: () => ({\r\n type: KANBAN_COLUMN,\r\n id: column.id,\r\n index,\r\n }),\r\n onDragStart: () => setIsDragging(true),\r\n onDrop: () => setIsDragging(false),\r\n });\r\n },\r\n [column.id, index, isDragDisabled]\r\n );\r\n\r\n // Make column header a drop target for column reordering\r\n const createColumnDropTarget = useCallback(\r\n (element: HTMLElement) => {\r\n if (isDragDisabled) return () => {};\r\n\r\n return dropTargetForElements({\r\n element,\r\n getData: ({ input, element }) => {\r\n const data = { type: KANBAN_COLUMN, id: column.id, index };\r\n return attachClosestEdge(data, { input, element, allowedEdges: ['left', 'right'] });\r\n },\r\n canDrop: ({ source }) => source.data.type === KANBAN_COLUMN && source.data.id !== column.id,\r\n });\r\n },\r\n [column.id, index, isDragDisabled]\r\n );\r\n\r\n // Make card list area a drop zone for cards\r\n const createCardDropZone = useCallback(\r\n (element: HTMLElement) => {\r\n return dropTargetForElements({\r\n element,\r\n getData: () => ({\r\n type: KANBAN_COLUMN_DROP_ZONE,\r\n columnId: column.id,\r\n }),\r\n canDrop: ({ source }) => source.data.type === 'kanban-card',\r\n onDragEnter: () => setIsDraggingOver(true),\r\n onDragLeave: () => setIsDraggingOver(false),\r\n onDrop: () => setIsDraggingOver(false),\r\n });\r\n },\r\n [column.id]\r\n );\r\n\r\n useEffect(() => {\r\n const columnElement = columnRef.current;\r\n const dropZoneElement = dropZoneRef.current;\r\n if (!columnElement || !dropZoneElement) return;\r\n\r\n const cleanups = [\r\n createDraggableColumn(columnElement),\r\n createColumnDropTarget(columnElement),\r\n createCardDropZone(dropZoneElement),\r\n ];\r\n\r\n return () => {\r\n cleanups.forEach((cleanup) => cleanup());\r\n };\r\n }, [createDraggableColumn, createColumnDropTarget, createCardDropZone]);\r\n\r\n const provided: DragProvided = {\r\n draggableProps: {\r\n 'data-draggable-id': column.id,\r\n 'data-draggable-type': 'COLUMN',\r\n style: isDragging ? { opacity: 0.5 } : undefined,\r\n },\r\n dragHandleProps: {\n tabIndex: 0,\n role: 'button',\n 'aria-roledescription': 'draggable column',\n 'aria-label': `${column.title}, ${cardIds.length} cards, press space to pick up`,\n },\n innerRef: columnRef,\n dropZoneRef,\n };\n\r\n const snapshot: DragSnapshot = {\r\n isDragging,\r\n isDraggingOver,\r\n };\r\n\r\n // Pass both refs through provided\r\n return <>{children(provided, snapshot)}</>;\n}\n","/**\r\n * Kanban Card View (Headless)\r\n *\r\n * Headless component for rendering draggable cards.\r\n */\r\n\r\nimport React, { useRef, useEffect, useState, useCallback } from 'react';\r\nimport { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';\r\nimport { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\r\nimport { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\r\nimport type { KanbanCardViewProps, DragProvided, DragSnapshot } from '../types';\r\n\r\nconst KANBAN_CARD = 'kanban-card';\r\n\r\nexport function KanbanCardView({\r\n card,\r\n children,\r\n isDragDisabled = false,\r\n index,\r\n columnId,\r\n}: KanbanCardViewProps) {\r\n const cardRef = useRef<HTMLDivElement>(null);\r\n const [isDragging, setIsDragging] = useState(false);\r\n const [isDraggingOver, setIsDraggingOver] = useState(false);\r\n\r\n const createDraggable = useCallback(\r\n (element: HTMLElement) => {\r\n if (isDragDisabled) return () => {};\r\n\r\n return draggable({\r\n element,\r\n getInitialData: () => ({\r\n type: KANBAN_CARD,\r\n id: card.id,\r\n index,\r\n columnId,\r\n }),\r\n onDragStart: () => setIsDragging(true),\r\n onDrop: () => setIsDragging(false),\r\n });\r\n },\r\n [card.id, index, columnId, isDragDisabled]\r\n );\r\n\r\n const createDropTarget = useCallback(\r\n (element: HTMLElement) => {\r\n if (isDragDisabled) return () => {};\r\n\r\n return dropTargetForElements({\r\n element,\r\n getData: ({ input, element }) => {\r\n const data = { type: KANBAN_CARD, id: card.id, index, columnId };\r\n return attachClosestEdge(data, { input, element, allowedEdges: ['top', 'bottom'] });\r\n },\r\n canDrop: ({ source }) => source.data.type === KANBAN_CARD && source.data.id !== card.id,\r\n onDragEnter: () => setIsDraggingOver(true),\r\n onDragLeave: () => setIsDraggingOver(false),\r\n onDrop: () => setIsDraggingOver(false),\r\n });\r\n },\r\n [card.id, index, columnId, isDragDisabled]\r\n );\r\n\r\n useEffect(() => {\r\n const element = cardRef.current;\r\n if (!element || isDragDisabled) return;\r\n\r\n return combine(createDraggable(element), createDropTarget(element));\r\n }, [createDraggable, createDropTarget, isDragDisabled]);\r\n\r\n const provided: DragProvided = {\r\n draggableProps: {\r\n 'data-draggable-id': card.id,\r\n 'data-draggable-type': 'CARD',\r\n style: isDragging ? { opacity: 0.5 } : undefined,\r\n },\r\n dragHandleProps: {\n tabIndex: 0,\n role: 'button',\n 'aria-roledescription': 'draggable card',\n 'aria-label': `${card.title}, press space to pick up`,\n },\n innerRef: cardRef,\n };\n\r\n const snapshot: DragSnapshot = {\r\n isDragging,\r\n isDraggingOver,\r\n };\r\n\r\n return <>{children(provided, snapshot)}</>;\r\n}\r\n","/**\r\n * Kanban Reorder Utilities\r\n *\r\n * Functions for reordering cards and columns in a Kanban board.\r\n */\r\n\r\nimport type { KanbanBoardState, DragLocation } from '../types';\n\r\n/**\r\n * Reorder an array by moving an item from one index to another\r\n */\r\nexport function reorderArray<T>(list: T[], startIndex: number, endIndex: number): T[] {\n const result = Array.from(list);\n const [removed] = result.splice(startIndex, 1);\n result.splice(endIndex, 0, removed);\n return result;\n}\n\nexport function normalizeReorderDestinationIndex(params: {\n itemCount: number;\n sourceIndex: number;\n rawDestinationIndex: number;\n isSameList: boolean;\n}): number {\n const { itemCount, sourceIndex, rawDestinationIndex, isSameList } = params;\n\n if (itemCount <= 0) return 0;\n\n const maxRaw = itemCount;\n const clampedRaw = Math.max(0, Math.min(rawDestinationIndex, maxRaw));\n const adjusted = isSameList && sourceIndex < clampedRaw ? clampedRaw - 1 : clampedRaw;\n const maxFinal = isSameList ? itemCount - 1 : itemCount;\n\n return Math.max(0, Math.min(adjusted, maxFinal));\n}\n\r\n/**\r\n * Move a card within the same column\r\n */\r\nexport function reorderCardInColumn(\r\n state: KanbanBoardState,\r\n columnId: string,\r\n startIndex: number,\r\n endIndex: number\r\n): KanbanBoardState {\r\n const column = state.columns.find((col) => col.id === columnId);\r\n if (!column) return state;\r\n\r\n const newCardIds = reorderArray(column.cardIds, startIndex, endIndex);\r\n\r\n return {\r\n ...state,\r\n columns: state.columns.map((col) =>\r\n col.id === columnId ? { ...col, cardIds: newCardIds } : col\r\n ),\r\n };\r\n}\r\n\r\n/**\r\n * Move a card from one column to another\r\n */\r\nexport function moveCardBetweenColumns(\r\n state: KanbanBoardState,\r\n source: DragLocation,\r\n destination: DragLocation,\r\n cardId: string\r\n): KanbanBoardState {\r\n const sourceColumn = state.columns.find((col) => col.id === source.columnId);\r\n const destColumn = state.columns.find((col) => col.id === destination.columnId);\r\n\r\n if (!sourceColumn || !destColumn) return state;\r\n\r\n // Remove from source\r\n const newSourceCardIds = [...sourceColumn.cardIds];\r\n newSourceCardIds.splice(source.index, 1);\r\n\r\n // Add to destination\r\n const newDestCardIds = [...destColumn.cardIds];\r\n newDestCardIds.splice(destination.index, 0, cardId);\r\n\r\n return {\r\n ...state,\r\n columns: state.columns.map((col) => {\r\n if (col.id === source.columnId) {\r\n return { ...col, cardIds: newSourceCardIds };\r\n }\r\n if (col.id === destination.columnId) {\r\n return { ...col, cardIds: newDestCardIds };\r\n }\r\n return col;\r\n }),\r\n };\r\n}\r\n\r\n/**\r\n * Reorder columns\r\n */\r\nexport function reorderColumns(\r\n state: KanbanBoardState,\r\n startIndex: number,\r\n endIndex: number\r\n): KanbanBoardState {\r\n return {\r\n ...state,\r\n columns: reorderArray(state.columns, startIndex, endIndex),\r\n };\r\n}\r\n\r\n/**\r\n * Apply a drag result to the board state\r\n * This is a convenience function that handles all reorder cases\r\n */\r\nexport function applyDragResult(\r\n state: KanbanBoardState,\r\n result: {\r\n type: 'CARD' | 'COLUMN';\r\n source: DragLocation;\r\n destination?: DragLocation;\r\n draggableId: string;\r\n }\r\n): KanbanBoardState {\r\n // No destination = drag canceled\r\n if (!result.destination) {\r\n return state;\r\n }\r\n\r\n const { source, destination, type } = result;\r\n\r\n // Column reorder\r\n if (type === 'COLUMN') {\r\n if (source.index === destination.index) {\r\n return state; // No change\r\n }\r\n return reorderColumns(state, source.index, destination.index);\r\n }\r\n\r\n // Card reorder\r\n if (type === 'CARD') {\r\n // Same column\r\n if (source.columnId === destination.columnId) {\r\n if (source.index === destination.index) {\r\n return state; // No change\r\n }\r\n return reorderCardInColumn(\r\n state,\r\n source.columnId!,\r\n source.index,\r\n destination.index\r\n );\r\n }\r\n\r\n // Different columns\r\n return moveCardBetweenColumns(state, source, destination, result.draggableId);\r\n }\r\n\r\n return state;\r\n}\r\n","/**\r\n * Core Kanban DnD Hook\r\n *\r\n * Main hook that manages drag-and-drop state for the Kanban board.\r\n */\r\n\r\nimport { useState, useEffect } from 'react';\nimport { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';\nimport { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';\nimport type { KanbanDragState, DropResult, DragLocation, KanbanBoardState } from '../types';\nimport { normalizeReorderDestinationIndex } from '../utils/reorder';\n\r\nconst KANBAN_CARD = 'kanban-card';\r\nconst KANBAN_COLUMN = 'kanban-column';\r\n\r\nexport interface UseKanbanDndOptions {\r\n onDragStart?: (draggable: { id: string; type: 'CARD' | 'COLUMN' }) => void;\r\n onDragEnd: (result: DropResult, stateBefore: KanbanBoardState) => void;\r\n state: KanbanBoardState;\r\n disabled?: boolean;\r\n}\r\n\r\nexport function useKanbanDnd({ onDragStart, onDragEnd, state, disabled }: UseKanbanDndOptions) {\r\n const [dragState, setDragState] = useState<KanbanDragState>({\r\n draggingId: null,\r\n draggingType: null,\r\n source: null,\r\n destination: null,\r\n });\r\n\r\n useEffect(() => {\r\n if (disabled) return;\r\n\r\n const cleanup = monitorForElements({\r\n onDragStart({ source }) {\r\n const typeRaw = source.data.type as string;\r\n const id = source.data.id as string;\r\n const columnId = source.data.columnId as string | undefined;\r\n const index = source.data.index as number;\r\n\r\n const type: 'CARD' | 'COLUMN' = typeRaw === KANBAN_CARD ? 'CARD' : 'COLUMN';\r\n\r\n const sourceLocation: DragLocation = {\r\n columnId: type === 'CARD' ? columnId : undefined,\r\n index,\r\n };\r\n\r\n setDragState({\r\n draggingId: id,\r\n draggingType: type,\r\n source: sourceLocation,\r\n destination: sourceLocation,\r\n });\r\n\r\n onDragStart?.({ id, type });\r\n },\r\n\r\n onDrop({ source, location }) {\n const sourceType = source.data.type as string;\n const sourceId = source.data.id as string;\n const sourceIndex = source.data.index as number;\n const sourceColumnId = source.data.columnId as string | undefined;\n\r\n // Find the drop target\r\n const dropTargets = location.current.dropTargets;\r\n\r\n let destination: DragLocation | undefined;\r\n\r\n if (sourceType === KANBAN_CARD) {\n // Card drop - find column drop target\n const columnTarget = dropTargets.find((target) =>\n target.data.type === 'kanban-column-drop-zone'\n );\n\n if (columnTarget) {\n const destColumnId = columnTarget.data.columnId as string;\n const sourceColumn = state.columns.find((column) => column.id === sourceColumnId);\n const destColumn = state.columns.find((column) => column.id === destColumnId);\n if (sourceColumn && destColumn) {\n const cardTarget = dropTargets.find((target) =>\n target.data.type === KANBAN_CARD && target.data.id !== sourceId\n );\n\n let rawDestinationIndex = destColumn.cardIds.length;\n if (cardTarget) {\n // Dropping on another card\n const destIndex = cardTarget.data.index as number;\n const edge = extractClosestEdge(cardTarget.data);\n rawDestinationIndex = edge === 'bottom' ? destIndex + 1 : destIndex;\n }\n\n const isSameColumn = sourceColumnId === destColumnId;\n const normalizedIndex = normalizeReorderDestinationIndex({\n itemCount: isSameColumn ? sourceColumn.cardIds.length : destColumn.cardIds.length,\n sourceIndex,\n rawDestinationIndex,\n isSameList: isSameColumn,\n });\n\n destination = {\n columnId: destColumnId,\n index: normalizedIndex,\n };\n }\n }\n } else if (sourceType === KANBAN_COLUMN) {\n // Column drop\n const columnTarget = dropTargets.find((target) =>\n target.data.type === KANBAN_COLUMN && target.data.id !== sourceId\n );\n\n if (columnTarget) {\n const destIndex = columnTarget.data.index as number;\n const edge = extractClosestEdge(columnTarget.data);\n const rawDestinationIndex =\n edge === 'bottom' || edge === 'right' ? destIndex + 1 : destIndex;\n\n destination = {\n index: normalizeReorderDestinationIndex({\n itemCount: state.columns.length,\n sourceIndex,\n rawDestinationIndex,\n isSameList: true,\n }),\n };\n }\n }\n\r\n const result: DropResult = {\r\n type: sourceType === KANBAN_CARD ? 'CARD' : 'COLUMN',\r\n source: {\r\n columnId: sourceColumnId,\r\n index: sourceIndex,\r\n },\r\n destination,\r\n draggableId: sourceId,\r\n };\r\n\r\n setDragState({\r\n draggingId: null,\r\n draggingType: null,\r\n source: null,\r\n destination: null,\r\n });\r\n\r\n onDragEnd(result, state);\r\n },\r\n });\r\n\r\n return cleanup;\r\n }, [disabled, onDragStart, onDragEnd, state]);\r\n\r\n return dragState;\r\n}\r\n","/**\r\n * Autoscroll Hook\r\n *\r\n * Automatically scrolls containers when dragging near edges.\r\n */\r\n\r\nimport { useEffect, useRef, useCallback } from 'react';\r\nimport type { AutoscrollConfig } from '../types';\r\nimport { isNearEdge, calculateScrollSpeed } from '../utils/dndMath';\r\nimport { getScrollParent, scrollBy, isScrollable } from '../utils/dom';\r\n\r\nconst DEFAULT_CONFIG: AutoscrollConfig = {\r\n threshold: 50, // px from edge\r\n maxSpeed: 20, // px per frame\r\n enabled: true,\r\n};\r\n\r\n/**\r\n * Hook for autoscrolling containers during drag\r\n */\r\nexport function useAutoscroll(\r\n containerRef: React.RefObject<HTMLElement>,\r\n isDragging: boolean,\r\n config: Partial<AutoscrollConfig> = {}\r\n) {\r\n const { threshold, maxSpeed, enabled } = { ...DEFAULT_CONFIG, ...config };\r\n const rafRef = useRef<number>();\r\n const lastMousePosRef = useRef<{ x: number; y: number } | null>(null);\r\n\r\n const handleMouseMove = useCallback(\r\n (event: MouseEvent) => {\r\n lastMousePosRef.current = { x: event.clientX, y: event.clientY };\r\n },\r\n []\r\n );\r\n\r\n const performScroll = useCallback(() => {\r\n if (!enabled || !isDragging || !containerRef.current || !lastMousePosRef.current) {\r\n return;\r\n }\r\n\r\n const container = containerRef.current;\r\n const scrollParent = getScrollParent(container);\r\n if (!scrollParent) return;\r\n\r\n const rect = scrollParent.getBoundingClientRect();\r\n const mousePos = lastMousePosRef.current;\r\n const scrollability = isScrollable(scrollParent);\r\n\r\n const nearEdge = isNearEdge(mousePos, rect, threshold);\r\n\r\n if (nearEdge.edge) {\r\n const speed = calculateScrollSpeed(nearEdge.distance, threshold, maxSpeed);\r\n\r\n const delta = { x: 0, y: 0 };\r\n\r\n if (scrollability.vertical) {\r\n if (nearEdge.edge === 'top') {\r\n delta.y = -speed;\r\n } else if (nearEdge.edge === 'bottom') {\r\n delta.y = speed;\r\n }\r\n }\r\n\r\n if (scrollability.horizontal) {\r\n if (nearEdge.edge === 'left') {\r\n delta.x = -speed;\r\n } else if (nearEdge.edge === 'right') {\r\n delta.x = speed;\r\n }\r\n }\r\n\r\n if (delta.x !== 0 || delta.y !== 0) {\r\n scrollBy(scrollParent, delta);\r\n }\r\n }\r\n\r\n rafRef.current = requestAnimationFrame(performScroll);\r\n }, [enabled, isDragging, containerRef, threshold, maxSpeed]);\r\n\r\n useEffect(() => {\r\n if (!enabled || !isDragging) {\r\n if (rafRef.current) {\r\n cancelAnimationFrame(rafRef.current);\r\n rafRef.current = undefined;\r\n }\r\n lastMousePosRef.current = null;\r\n return;\r\n }\r\n\r\n window.addEventListener('mousemove', handleMouseMove);\r\n rafRef.current = requestAnimationFrame(performScroll);\r\n\r\n return () => {\r\n window.removeEventListener('mousemove', handleMouseMove);\r\n if (rafRef.current) {\r\n cancelAnimationFrame(rafRef.current);\r\n }\r\n };\r\n }, [enabled, isDragging, handleMouseMove, performScroll]);\r\n}\r\n","/**\r\n * Announcer Component\r\n *\r\n * Provides screen reader announcements for drag-and-drop operations.\r\n */\r\n\r\nimport React, { createContext, useContext, useEffect, useRef } from 'react';\r\n\r\ninterface AnnouncerContextValue {\r\n announce: (message: string, politeness?: 'polite' | 'assertive') => void;\r\n}\r\n\r\nconst AnnouncerContext = createContext<AnnouncerContextValue | null>(null);\r\n\r\n/**\r\n * Hook to access the announcer context\r\n */\r\nexport function useAnnouncer(): AnnouncerContextValue {\r\n const context = useContext(AnnouncerContext);\r\n if (!context) {\r\n throw new Error('useAnnouncer must be used within AnnouncerProvider');\r\n }\r\n return context;\r\n}\r\n\r\n/**\r\n * Props for AnnouncerProvider\r\n */\r\nexport interface AnnouncerProviderProps {\r\n /** Child components */\r\n children: React.ReactNode;\r\n /** Default politeness level */\r\n politeness?: 'polite' | 'assertive';\r\n}\r\n\r\n/**\r\n * Provider component that creates a live region for screen reader announcements\r\n */\r\nexport function AnnouncerProvider({\r\n children,\r\n politeness = 'polite',\r\n}: AnnouncerProviderProps) {\r\n const politeRef = useRef<HTMLDivElement>(null);\r\n const assertiveRef = useRef<HTMLDivElement>(null);\r\n const timeoutRef = useRef<NodeJS.Timeout>();\r\n\r\n const announce = (message: string, announcePoliteness: 'polite' | 'assertive' = politeness) => {\r\n const regionRef = announcePoliteness === 'assertive' ? assertiveRef : politeRef;\r\n\r\n if (!regionRef.current) return;\r\n\r\n // Clear existing timeout\r\n if (timeoutRef.current) {\r\n clearTimeout(timeoutRef.current);\r\n }\r\n\r\n // Clear the region first\r\n regionRef.current.textContent = '';\r\n\r\n // Set the new message after a brief delay to ensure screen readers pick it up\r\n timeoutRef.current = setTimeout(() => {\r\n if (regionRef.current) {\r\n regionRef.current.textContent = message;\r\n }\r\n }, 100);\r\n };\r\n\r\n useEffect(() => {\r\n return () => {\r\n if (timeoutRef.current) {\r\n clearTimeout(timeoutRef.current);\r\n }\r\n };\r\n }, []);\r\n\r\n const value: AnnouncerContextValue = {\r\n announce,\r\n };\r\n\r\n return (\r\n <AnnouncerContext.Provider value={value}>\r\n {children}\r\n {/* Polite live region */}\r\n <div\r\n ref={politeRef}\r\n role=\"status\"\r\n aria-live=\"polite\"\r\n aria-atomic=\"true\"\r\n style={{\r\n position: 'absolute',\r\n width: '1px',\r\n height: '1px',\r\n padding: '0',\r\n margin: '-1px',\r\n overflow: 'hidden',\r\n clip: 'rect(0, 0, 0, 0)',\r\n whiteSpace: 'nowrap',\r\n border: '0',\r\n }}\r\n />\r\n {/* Assertive live region */}\r\n <div\r\n ref={assertiveRef}\r\n role=\"alert\"\r\n aria-live=\"assertive\"\r\n aria-atomic=\"true\"\r\n style={{\r\n position: 'absolute',\r\n width: '1px',\r\n height: '1px',\r\n padding: '0',\r\n margin: '-1px',\r\n overflow: 'hidden',\r\n clip: 'rect(0, 0, 0, 0)',\r\n whiteSpace: 'nowrap',\r\n border: '0',\r\n }}\r\n />\r\n </AnnouncerContext.Provider>\r\n );\r\n}\r\n\r\n/**\r\n * Generate announcement messages for different drag events\r\n */\r\nexport const announcements = {\r\n onDragStart: (itemName: string, position: number, totalItems: number): string =>\r\n `Picked up ${itemName}. Position ${position + 1} of ${totalItems}.`,\r\n\r\n onDragMove: (itemName: string, newPosition: number, totalItems: number): string =>\r\n `${itemName} moved to position ${newPosition + 1} of ${totalItems}.`,\r\n\r\n onDragEnd: (itemName: string, from: string, to: string, position: number): string =>\r\n from === to\r\n ? `${itemName} dropped. Position ${position + 1} in ${to}.`\r\n : `${itemName} moved from ${from} to ${to}. Position ${position + 1}.`,\r\n\r\n onDragCancel: (itemName: string, column: string): string =>\r\n `Drag cancelled. ${itemName} returned to ${column}.`,\r\n\r\n onColumnMove: (columnName: string, position: number, totalColumns: number): string =>\r\n `${columnName} moved to position ${position + 1} of ${totalColumns}.`,\r\n};\r\n","/**\r\n * Kanban Board Component\r\n *\r\n * High-level component that composes the Kanban board with all features.\r\n */\r\n\r\nimport React, { useMemo } from 'react';\nimport type { KanbanBoardProps, KanbanCard, KanbanColumn } from '../types';\nimport { KanbanContext } from '../context';\r\nimport { KanbanColumnView } from './KanbanColumnView';\r\nimport { KanbanCardView } from './KanbanCardView';\r\nimport { useKanbanDnd } from '../hooks/useKanbanDnd';\r\n\r\nexport function KanbanBoard({\r\n state,\r\n onDragEnd,\r\n onDragStart,\r\n renderColumn,\r\n renderCard,\r\n getCardKey,\r\n getColumnKey,\r\n isDragDisabled,\r\n className,\r\n style,\r\n}: KanbanBoardProps) {\r\n const dragState = useKanbanDnd({\r\n state,\r\n onDragEnd,\r\n onDragStart,\r\n disabled: false,\r\n });\r\n\r\n const contextValue = useMemo(\r\n () => ({\r\n state,\r\n dragState,\r\n isDragDisabled,\r\n }),\r\n [state, dragState, isDragDisabled]\r\n );\r\n\r\n const defaultGetCardKey = (card: KanbanCard) => card.id;\n const defaultGetColumnKey = (column: KanbanColumn) => column.id;\n\r\n const cardKeyExtractor = getCardKey || defaultGetCardKey;\r\n const columnKeyExtractor = getColumnKey || defaultGetColumnKey;\r\n\r\n return (\r\n <KanbanContext.Provider value={contextValue}>\r\n <div\r\n className={className}\r\n style={{\r\n display: 'flex',\r\n gap: '16px',\r\n ...style,\r\n }}\r\n >\r\n {state.columns.map((column, columnIndex) => (\r\n <KanbanColumnView\r\n key={columnKeyExtractor(column)}\r\n column={column}\r\n cardIds={column.cardIds}\r\n index={columnIndex}\r\n isDragDisabled={isDragDisabled?.(column.id, 'COLUMN')}\r\n >\r\n {(columnProvided, columnSnapshot) => (\r\n <div\n ref={columnProvided.innerRef}\n {...columnProvided.draggableProps}\n style={{\n minWidth: '250px',\n display: 'flex',\r\n flexDirection: 'column',\r\n ...columnProvided.draggableProps.style,\r\n }}\r\n >\r\n {/* Column header (draggable) */}\r\n <div {...columnProvided.dragHandleProps}>\r\n {renderColumn(column, columnProvided, columnSnapshot)}\r\n </div>\r\n\r\n {/* Card drop zone */}\r\n <div\n ref={columnProvided.dropZoneRef}\n style={{\n flex: 1,\n minHeight: '100px',\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '8px',\r\n }}\r\n >\r\n {column.cardIds.map((cardId, cardIndex) => {\r\n const card = state.cards[cardId];\r\n if (!card) return null;\r\n\r\n return (\r\n <KanbanCardView\r\n key={cardKeyExtractor(card)}\r\n card={card}\r\n index={cardIndex}\r\n columnId={column.id}\r\n isDragDisabled={isDragDisabled?.(card.id, 'CARD')}\r\n >\r\n {(cardProvided, cardSnapshot) => (\n <div\n ref={cardProvided.innerRef}\n {...cardProvided.draggableProps}\n {...cardProvided.dragHandleProps}\n >\n {renderCard(card, cardProvided, cardSnapshot)}\r\n </div>\r\n )}\r\n </KanbanCardView>\r\n );\r\n })}\r\n </div>\r\n </div>\r\n )}\r\n </KanbanColumnView>\r\n ))}\r\n </div>\r\n </KanbanContext.Provider>\r\n );\r\n}\r\n","/**\r\n * DOM Utilities\r\n *\r\n * Helper functions for DOM measurements and manipulation.\r\n */\r\n\r\n/**\r\n * Safely get bounding client rect for an element\r\n */\r\nexport function getBoundingRect(element: HTMLElement | null): DOMRect | null {\r\n if (!element) return null;\r\n return element.getBoundingClientRect();\r\n}\r\n\r\n/**\r\n * Get scrollable parent of an element\r\n */\r\nexport function getScrollParent(element: HTMLElement | null): HTMLElement | null {\r\n if (!element) return null;\r\n\r\n let parent = element.parentElement;\r\n\r\n while (parent) {\r\n const { overflow, overflowY } = window.getComputedStyle(parent);\r\n if (/(auto|scroll)/.test(overflow + overflowY)) {\r\n return parent;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n\r\n return document.documentElement as HTMLElement;\r\n}\r\n\r\n/**\r\n * Scroll an element by a delta\r\n */\r\nexport function scrollBy(\r\n element: HTMLElement,\r\n delta: { x?: number; y?: number }\r\n): void {\r\n if (delta.x) {\r\n element.scrollLeft += delta.x;\r\n }\r\n if (delta.y) {\r\n element.scrollTop += delta.y;\r\n }\r\n}\r\n\r\n/**\r\n * Check if an element is scrollable\r\n */\r\nexport function isScrollable(element: HTMLElement): {\r\n vertical: boolean;\r\n horizontal: boolean;\r\n} {\r\n const { overflow, overflowY, overflowX } = window.getComputedStyle(element);\r\n\r\n const hasVerticalScroll = /(auto|scroll)/.test(overflow + overflowY);\r\n const hasHorizontalScroll = /(auto|scroll)/.test(overflow + overflowX);\r\n\r\n return {\r\n vertical: hasVerticalScroll && element.scrollHeight > element.clientHeight,\r\n horizontal: hasHorizontalScroll && element.scrollWidth > element.clientWidth,\r\n };\r\n}\r\n\r\n/**\r\n * Get element's scroll position\r\n */\r\nexport function getScrollPosition(element: HTMLElement): { x: number; y: number } {\r\n if (element === document.documentElement) {\r\n return {\r\n x: window.pageXOffset || document.documentElement.scrollLeft,\r\n y: window.pageYOffset || document.documentElement.scrollTop,\r\n };\r\n }\r\n\r\n return {\r\n x: element.scrollLeft,\r\n y: element.scrollTop,\r\n };\r\n}\r\n\r\n/**\r\n * Get maximum scroll for an element\r\n */\r\nexport function getMaxScroll(element: HTMLElement): { x: number; y: number } {\r\n return {\r\n x: element.scrollWidth - element.clientWidth,\r\n y: element.scrollHeight - element.clientHeight,\r\n };\r\n}\r\n\r\n/**\r\n * Clamp scroll position to valid range\r\n */\r\nexport function clampScroll(\r\n scroll: { x: number; y: number },\r\n maxScroll: { x: number; y: number }\r\n): { x: number; y: number } {\r\n return {\r\n x: Math.max(0, Math.min(scroll.x, maxScroll.x)),\r\n y: Math.max(0, Math.min(scroll.y, maxScroll.y)),\r\n };\r\n}\r\n\r\n/**\r\n * Get all data attributes from an element as an object\r\n */\r\nexport function getDataAttributes(element: HTMLElement): Record<string, string> {\r\n const data: Record<string, string> = {};\r\n for (const key in element.dataset) {\r\n data[key] = element.dataset[key] || '';\r\n }\r\n return data;\r\n}\r\n\r\n/**\r\n * Find closest ancestor with a data attribute\r\n */\r\nexport function findClosestWithData(\r\n element: HTMLElement | null,\r\n dataKey: string\r\n): HTMLElement | null {\r\n let current = element;\r\n while (current) {\r\n if (current.dataset[dataKey]) {\r\n return current;\r\n }\r\n current = current.parentElement;\r\n }\r\n return null;\r\n}\r\n","/**\r\n * DnD Math Utilities\r\n *\r\n * Helper functions for collision detection and positioning calculations.\r\n */\r\n\r\n/**\r\n * Calculate the distance from a point to a rectangle's edges\r\n */\r\nexport function distanceToEdge(\r\n point: { x: number; y: number },\r\n rect: DOMRect\r\n): {\r\n top: number;\r\n right: number;\r\n bottom: number;\r\n left: number;\r\n} {\r\n return {\r\n top: point.y - rect.top,\r\n right: rect.right - point.x,\r\n bottom: rect.bottom - point.y,\r\n left: point.x - rect.left,\r\n };\r\n}\r\n\r\n/**\r\n * Get the closest edge of a rectangle to a point\r\n */\r\nexport function getClosestEdge(\r\n point: { x: number; y: number },\r\n rect: DOMRect\r\n): 'top' | 'right' | 'bottom' | 'left' {\r\n const distances = distanceToEdge(point, rect);\r\n const entries = Object.entries(distances) as Array<[keyof typeof distances, number]>;\r\n const sorted = entries.sort((a, b) => a[1] - b[1]);\r\n return sorted[0][0];\r\n}\r\n\r\n/**\r\n * Check if a point is within a threshold distance from an edge\r\n */\r\nexport function isNearEdge(\r\n point: { x: number; y: number },\r\n rect: DOMRect,\r\n threshold: number\r\n): { edge: 'top' | 'right' | 'bottom' | 'left' | null; distance: number } {\r\n const distances = distanceToEdge(point, rect);\r\n\r\n for (const [edge, distance] of Object.entries(distances)) {\r\n if (distance < threshold) {\r\n return {\r\n edge: edge as 'top' | 'right' | 'bottom' | 'left',\r\n distance,\r\n };\r\n }\r\n }\r\n\r\n return { edge: null, distance: Infinity };\r\n}\r\n\r\n/**\r\n * Calculate scroll speed based on distance from edge\r\n * Closer to edge = faster scroll\r\n */\r\nexport function calculateScrollSpeed(\r\n distance: number,\r\n threshold: number,\r\n maxSpeed: number\r\n): number {\r\n if (distance >= threshold) return 0;\r\n const ratio = (threshold - distance) / threshold;\r\n return ratio * maxSpeed;\r\n}\r\n\r\n/**\r\n * Check if a point is inside a rectangle\r\n */\r\nexport function isPointInRect(point: { x: number; y: number }, rect: DOMRect): boolean {\r\n return (\r\n point.x >= rect.left &&\r\n point.x <= rect.right &&\r\n point.y >= rect.top &&\r\n point.y <= rect.bottom\r\n );\r\n}\r\n\r\n/**\r\n * Calculate the center point of a rectangle\r\n */\r\nexport function getRectCenter(rect: DOMRect): { x: number; y: number } {\r\n return {\r\n x: rect.left + rect.width / 2,\r\n y: rect.top + rect.height / 2,\r\n };\r\n}\r\n\r\n/**\r\n * Calculate vertical drop position based on mouse Y relative to element center\r\n */\r\nexport function getVerticalDropPosition(\r\n mouseY: number,\r\n elementRect: DOMRect\r\n): 'top' | 'bottom' {\r\n const center = getRectCenter(elementRect);\r\n return mouseY < center.y ? 'top' : 'bottom';\r\n}\r\n\r\n/**\r\n * Calculate horizontal drop position based on mouse X relative to element center\r\n */\r\nexport function getHorizontalDropPosition(\r\n mouseX: number,\r\n elementRect: DOMRect\r\n): 'left' | 'right' {\r\n const center = getRectCenter(elementRect);\r\n return mouseX < center.x ? 'left' : 'right';\r\n}\r\n"],"names":["KanbanContext","createContext","KANBAN_COLUMN","KanbanColumnView","column","cardIds","children","isDragDisabled","index","columnRef","useRef","dropZoneRef","isDragging","setIsDragging","useState","isDraggingOver","setIsDraggingOver","createDraggableColumn","useCallback","element","draggable","getInitialData","type","id","onDragStart","onDrop","createColumnDropTarget","dropTargetForElements","getData","input","data","attachClosestEdge","allowedEdges","canDrop","source","createCardDropZone","columnId","onDragEnter","onDragLeave","useEffect","columnElement","current","dropZoneElement","cleanups","forEach","cleanup","provided","draggableProps","style","opacity","undefined","dragHandleProps","tabIndex","role","title","length","innerRef","snapshot","React","createElement","Fragment","KANBAN_CARD","KanbanCardView","card","cardRef","createDraggable","createDropTarget","combine","reorderArray","list","startIndex","endIndex","result","Array","from","removed","splice","normalizeReorderDestinationIndex","params","itemCount","sourceIndex","rawDestinationIndex","isSameList","maxRaw","clampedRaw","Math","max","min","adjusted","maxFinal","useKanbanDnd","onDragEnd","state","disabled","dragState","setDragState","draggingId","draggingType","destination","monitorForElements","typeRaw","sourceLocation","location","sourceType","sourceId","sourceColumnId","dropTargets","columnTarget","find","target","destColumnId","sourceColumn","columns","destColumn","cardTarget","destIndex","extractClosestEdge","isSameColumn","normalizedIndex","edge","draggableId","DEFAULT_CONFIG","threshold","maxSpeed","enabled","AnnouncerContext","politeness","politeRef","assertiveRef","timeoutRef","clearTimeout","value","announce","message","announcePoliteness","regionRef","textContent","setTimeout","Provider","ref","position","width","height","padding","margin","overflow","clip","whiteSpace","border","renderColumn","renderCard","getCardKey","getColumnKey","className","contextValue","useMemo","cardKeyExtractor","columnKeyExtractor","Object","assign","display","gap","map","columnIndex","key","columnProvided","columnSnapshot","minWidth","flexDirection","flex","minHeight","cardId","cardIndex","cards","cardProvided","cardSnapshot","itemName","totalItems","onDragMove","newPosition","to","onDragCancel","onColumnMove","columnName","totalColumns","reorderColumns","col","newCardIds","reorderCardInColumn","newSourceCardIds","newDestCardIds","moveCardBetweenColumns","context","useContext","Error","containerRef","config","rafRef","lastMousePosRef","handleMouseMove","event","x","clientX","y","clientY","performScroll","scrollParent","parent","parentElement","overflowY","window","getComputedStyle","test","document","documentElement","getScrollParent","rect","getBoundingClientRect","mousePos","scrollability","overflowX","hasVerticalScroll","hasHorizontalScroll","vertical","scrollHeight","clientHeight","horizontal","scrollWidth","clientWidth","isScrollable","nearEdge","point","distances","top","right","bottom","left","distanceToEdge","distance","entries","Infinity","isNearEdge","speed","calculateScrollSpeed","delta","scrollLeft","scrollTop","scrollBy","requestAnimationFrame","addEventListener","removeEventListener","cancelAnimationFrame"],"mappings":"6NAeO,MAAMA,EAAgBC,EAAaA,cAA4B,MCJhEC,EAAgB,gBAGN,SAAAC,GAAiBC,OAC/BA,EAAMC,QACNA,EAAOC,SACPA,EAAQC,eACRA,GAAiB,EAAKC,MACtBA,IAEA,MAAMC,EAAYC,SAAuB,MACnCC,EAAcD,SAAuB,OACpCE,EAAYC,GAAiBC,EAAQA,UAAC,IACtCC,EAAgBC,GAAqBF,EAAQA,UAAC,GAG/CG,EAAwBC,cAC3BC,GACKZ,EAAuB,OAEpBa,YAAU,CACfD,UACAE,eAAgB,KAAO,CACrBC,KAAMpB,EACNqB,GAAInB,EAAOmB,GACXf,UAEFgB,YAAa,IAAMX,GAAc,GACjCY,OAAQ,IAAMZ,GAAc,KAGhC,CAACT,EAAOmB,GAAIf,EAAOD,IAIfmB,EAAyBR,cAC5BC,GACKZ,EAAuB,OAEpBoB,wBAAsB,CAC3BR,UACAS,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xL,EACAiO,GAEIA,EAAM3C,IACRtL,EAAQkO,YAAcD,EAAM3C,GAE1B2C,EAAMzC,IACRxL,EAAQmO,WAAaF,EAAMzC,EAE/B,CH2BQ4C,CAASzC,EAAcsC,EAE1B,CAED/C,EAAO5J,QAAU+M,sBAAsB3C,IACtC,CAACjF,EAAShH,EAAYuL,EAAczE,EAAWC,IAElDpF,EAAAA,UAAU,IACHqF,GAAYhH,GASjBsM,OAAOuC,iBAAiB,YAAalD,GACrCF,EAAO5J,QAAU+M,sBAAsB3C,GAEhC,KACLK,OAAOwC,oBAAoB,YAAanD,GACpCF,EAAO5J,SACTkN,qBAAqBtD,EAAO5J,YAd1B4J,EAAO5J,UACTkN,qBAAqBtD,EAAO5J,SAC5B4J,EAAO5J,aAAUS,QAEnBoJ,EAAgB7J,QAAU,OAa3B,CAACmF,EAAShH,EAAY2L,EAAiBM,GAC5C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DragDropListProps, DraggableItem } from "../types";
|
|
3
|
-
export declare function DragDropList<T extends DraggableItem>({ items, onReorder, renderItem, containerClassName, containerStyle, itemClassName, itemStyle, dragPreviewClassName, dragPreviewStyle, onDragStart, onDragEnd, disabled, gap, direction, showDropIndicator, dropIndicatorClassName, dropIndicatorStyle, dropIndicatorPosition, }: DragDropListProps<T>): React.JSX.Element;
|
|
3
|
+
export declare function DragDropList<T extends DraggableItem>({ items, onReorder, renderItem, containerClassName, containerStyle, itemClassName, itemStyle, dragPreviewClassName, dragPreviewStyle, onDragStart, onDragEnd, disabled, gap, direction, showDropIndicator, dropIndicatorClassName, dropIndicatorStyle, dropIndicatorPosition, dragHandle, selectedIds, multiDragEnabled, }: DragDropListProps<T>): React.JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DraggableItemWrapperProps, DraggableItem } from "../types";
|
|
3
|
-
export declare function DraggableItemWrapper<T extends DraggableItem>({ item, index, children, className, style, dragPreviewClassName, dragPreviewStyle, onDragStart, onDragEnd, disabled, showDropIndicator, dropIndicatorClassName, dropIndicatorStyle, dropIndicatorPosition, }: DraggableItemWrapperProps<T>): React.JSX.Element;
|
|
3
|
+
export declare function DraggableItemWrapper<T extends DraggableItem>({ item, index, children, className, style, dragPreviewClassName, dragPreviewStyle, onDragStart, onDragEnd, disabled, showDropIndicator, dropIndicatorClassName, dropIndicatorStyle, dropIndicatorPosition, direction, dragHandle, }: DraggableItemWrapperProps<T>): React.JSX.Element;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { DraggableItem, OrderUpdate } from "../types";
|
|
2
|
-
export declare function useDragDropMonitor<T extends DraggableItem>({ items, onReorder, disabled, }: {
|
|
2
|
+
export declare function useDragDropMonitor<T extends DraggableItem>({ items, onReorder, disabled, direction, selectedIds, multiDragEnabled, }: {
|
|
3
3
|
items: T[];
|
|
4
4
|
onReorder: (newItems: T[], orderUpdates: OrderUpdate[]) => void;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
|
|
6
|
+
direction?: "vertical" | "horizontal";
|
|
7
|
+
selectedIds?: string[];
|
|
8
|
+
multiDragEnabled?: boolean;
|
|
9
|
+
}): () => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Announcer Component
|
|
3
|
+
*
|
|
4
|
+
* Provides screen reader announcements for drag-and-drop operations.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
interface AnnouncerContextValue {
|
|
8
|
+
announce: (message: string, politeness?: 'polite' | 'assertive') => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hook to access the announcer context
|
|
12
|
+
*/
|
|
13
|
+
export declare function useAnnouncer(): AnnouncerContextValue;
|
|
14
|
+
/**
|
|
15
|
+
* Props for AnnouncerProvider
|
|
16
|
+
*/
|
|
17
|
+
export interface AnnouncerProviderProps {
|
|
18
|
+
/** Child components */
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/** Default politeness level */
|
|
21
|
+
politeness?: 'polite' | 'assertive';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Provider component that creates a live region for screen reader announcements
|
|
25
|
+
*/
|
|
26
|
+
export declare function AnnouncerProvider({ children, politeness, }: AnnouncerProviderProps): React.JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Generate announcement messages for different drag events
|
|
29
|
+
*/
|
|
30
|
+
export declare const announcements: {
|
|
31
|
+
onDragStart: (itemName: string, position: number, totalItems: number) => string;
|
|
32
|
+
onDragMove: (itemName: string, newPosition: number, totalItems: number) => string;
|
|
33
|
+
onDragEnd: (itemName: string, from: string, to: string, position: number) => string;
|
|
34
|
+
onDragCancel: (itemName: string, column: string) => string;
|
|
35
|
+
onColumnMove: (columnName: string, position: number, totalColumns: number) => string;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live Region Hook
|
|
3
|
+
*
|
|
4
|
+
* Hook for announcing messages to screen readers.
|
|
5
|
+
*/
|
|
6
|
+
export interface LiveRegionOptions {
|
|
7
|
+
/** Politeness level for announcements */
|
|
8
|
+
politeness?: 'polite' | 'assertive';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hook to announce messages to screen readers via live region
|
|
12
|
+
*/
|
|
13
|
+
export declare function useLiveRegion(options?: LiveRegionOptions): {
|
|
14
|
+
announce: (message: string, announcePoliteness?: "polite" | "assertive") => void;
|
|
15
|
+
clear: () => void;
|
|
16
|
+
cleanup: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanban Board Component
|
|
3
|
+
*
|
|
4
|
+
* High-level component that composes the Kanban board with all features.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { KanbanBoardProps } from '../types';
|
|
8
|
+
export declare function KanbanBoard({ state, onDragEnd, onDragStart, renderColumn, renderCard, getCardKey, getColumnKey, isDragDisabled, className, style, }: KanbanBoardProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanban Card View (Headless)
|
|
3
|
+
*
|
|
4
|
+
* Headless component for rendering draggable cards.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { KanbanCardViewProps } from '../types';
|
|
8
|
+
export declare function KanbanCardView({ card, children, isDragDisabled, index, columnId, }: KanbanCardViewProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanban Column View (Headless)
|
|
3
|
+
*
|
|
4
|
+
* Headless component for rendering draggable columns with drop zones.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { KanbanColumnViewProps } from '../types';
|
|
8
|
+
export declare function KanbanColumnView({ column, cardIds, children, isDragDisabled, index, }: KanbanColumnViewProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanban Board Context
|
|
3
|
+
*
|
|
4
|
+
* Internal context for sharing board state between components.
|
|
5
|
+
*/
|
|
6
|
+
import type { KanbanBoardState, KanbanDragState } from './types';
|
|
7
|
+
export interface KanbanContextValue {
|
|
8
|
+
state: KanbanBoardState;
|
|
9
|
+
dragState: KanbanDragState;
|
|
10
|
+
isDragDisabled?: (id: string, type: 'CARD' | 'COLUMN') => boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const KanbanContext: import("react").Context<KanbanContextValue | null>;
|
|
13
|
+
export declare function useKanbanContext(): KanbanContextValue;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autoscroll Hook
|
|
3
|
+
*
|
|
4
|
+
* Automatically scrolls containers when dragging near edges.
|
|
5
|
+
*/
|
|
6
|
+
import type { AutoscrollConfig } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Hook for autoscrolling containers during drag
|
|
9
|
+
*/
|
|
10
|
+
export declare function useAutoscroll(containerRef: React.RefObject<HTMLElement>, isDragging: boolean, config?: Partial<AutoscrollConfig>): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Kanban DnD Hook
|
|
3
|
+
*
|
|
4
|
+
* Main hook that manages drag-and-drop state for the Kanban board.
|
|
5
|
+
*/
|
|
6
|
+
import type { KanbanDragState, DropResult, KanbanBoardState } from '../types';
|
|
7
|
+
export interface UseKanbanDndOptions {
|
|
8
|
+
onDragStart?: (draggable: {
|
|
9
|
+
id: string;
|
|
10
|
+
type: 'CARD' | 'COLUMN';
|
|
11
|
+
}) => void;
|
|
12
|
+
onDragEnd: (result: DropResult, stateBefore: KanbanBoardState) => void;
|
|
13
|
+
state: KanbanBoardState;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function useKanbanDnd({ onDragStart, onDragEnd, state, disabled }: UseKanbanDndOptions): KanbanDragState;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanban Board Module
|
|
3
|
+
*
|
|
4
|
+
* A headless, accessible Kanban board implementation for React.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export type { Id, KanbanCard, KanbanColumn, KanbanBoardState, DragLocation, DropResult, DragProvided, DragSnapshot, KanbanBoardProps, KanbanColumnViewProps, KanbanCardViewProps, AutoscrollConfig, LiveAnnouncement, } from './types';
|
|
9
|
+
export { KanbanBoard } from './components/KanbanBoard';
|
|
10
|
+
export { KanbanColumnView } from './components/KanbanColumnView';
|
|
11
|
+
export { KanbanCardView } from './components/KanbanCardView';
|
|
12
|
+
export { useKanbanDnd } from './hooks/useKanbanDnd';
|
|
13
|
+
export { useAutoscroll } from './hooks/useAutoscroll';
|
|
14
|
+
export { AnnouncerProvider, useAnnouncer, announcements } from './a11y/Announcer';
|
|
15
|
+
export { applyDragResult, reorderArray } from './utils/reorder';
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanban Board Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the Kanban board feature.
|
|
5
|
+
* Follows a normalized state pattern for efficient cross-column operations.
|
|
6
|
+
*/
|
|
7
|
+
import type React from 'react';
|
|
8
|
+
export type Id = string;
|
|
9
|
+
/**
|
|
10
|
+
* Represents a single card in the Kanban board
|
|
11
|
+
*/
|
|
12
|
+
export interface KanbanCard {
|
|
13
|
+
/** Unique identifier for the card */
|
|
14
|
+
id: Id;
|
|
15
|
+
/** Card title */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Additional custom fields */
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Represents a column in the Kanban board
|
|
22
|
+
*/
|
|
23
|
+
export interface KanbanColumn {
|
|
24
|
+
/** Unique identifier for the column */
|
|
25
|
+
id: Id;
|
|
26
|
+
/** Column title */
|
|
27
|
+
title: string;
|
|
28
|
+
/** Ordered list of card IDs in this column */
|
|
29
|
+
cardIds: Id[];
|
|
30
|
+
/** Additional custom fields */
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Normalized state structure for the Kanban board
|
|
35
|
+
* Separates column ordering from card data for efficient updates
|
|
36
|
+
*/
|
|
37
|
+
export interface KanbanBoardState {
|
|
38
|
+
/** Ordered list of columns */
|
|
39
|
+
columns: KanbanColumn[];
|
|
40
|
+
/** Flat lookup object for all cards (by ID) */
|
|
41
|
+
cards: Record<Id, KanbanCard>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Location within the Kanban board
|
|
45
|
+
*/
|
|
46
|
+
export interface DragLocation {
|
|
47
|
+
/** Column ID (undefined for column reorder operations) */
|
|
48
|
+
columnId?: Id;
|
|
49
|
+
/** Index within the column or board */
|
|
50
|
+
index: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Result of a drag-and-drop operation
|
|
54
|
+
* Similar to react-beautiful-dnd's DropResult for migration compatibility
|
|
55
|
+
*/
|
|
56
|
+
export interface DropResult {
|
|
57
|
+
/** Type of draggable that was moved */
|
|
58
|
+
type: 'CARD' | 'COLUMN';
|
|
59
|
+
/** Source location before drag */
|
|
60
|
+
source: DragLocation;
|
|
61
|
+
/** Destination location after drop (undefined if canceled) */
|
|
62
|
+
destination?: DragLocation;
|
|
63
|
+
/** ID of the dragged item */
|
|
64
|
+
draggableId: Id;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Props provided to render functions with drag-and-drop state and handlers
|
|
68
|
+
*/
|
|
69
|
+
export interface DragProvided {
|
|
70
|
+
/** Props to spread on the draggable element */
|
|
71
|
+
draggableProps: React.HTMLAttributes<HTMLElement> & {
|
|
72
|
+
'data-draggable-id': Id;
|
|
73
|
+
'data-draggable-type': 'CARD' | 'COLUMN';
|
|
74
|
+
};
|
|
75
|
+
/** Props to spread on the drag handle element (can be same as draggable) */
|
|
76
|
+
dragHandleProps: React.HTMLAttributes<HTMLElement> & {
|
|
77
|
+
tabIndex: number;
|
|
78
|
+
role: string;
|
|
79
|
+
'aria-roledescription': string;
|
|
80
|
+
};
|
|
81
|
+
/** Ref to attach to the draggable element */
|
|
82
|
+
innerRef: React.RefObject<HTMLDivElement>;
|
|
83
|
+
/** Optional drop zone ref (used by column containers) */
|
|
84
|
+
dropZoneRef?: React.RefObject<HTMLDivElement>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Snapshot of current drag state
|
|
88
|
+
*/
|
|
89
|
+
export interface DragSnapshot {
|
|
90
|
+
/** Whether this element is currently being dragged */
|
|
91
|
+
isDragging: boolean;
|
|
92
|
+
/** Whether a drag is happening over this drop zone */
|
|
93
|
+
isDraggingOver?: boolean;
|
|
94
|
+
/** ID of the item being dragged (if any) */
|
|
95
|
+
draggingId?: Id;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Props for KanbanBoard component
|
|
99
|
+
*/
|
|
100
|
+
export interface KanbanBoardProps {
|
|
101
|
+
/** Current board state (controlled) */
|
|
102
|
+
state: KanbanBoardState;
|
|
103
|
+
/** Callback fired when drag ends */
|
|
104
|
+
onDragEnd: (result: DropResult, stateBefore: KanbanBoardState) => void;
|
|
105
|
+
/** Callback fired when drag starts (optional) */
|
|
106
|
+
onDragStart?: (draggable: {
|
|
107
|
+
id: Id;
|
|
108
|
+
type: 'CARD' | 'COLUMN';
|
|
109
|
+
}) => void;
|
|
110
|
+
/** Render function for a column */
|
|
111
|
+
renderColumn: (column: KanbanColumn, provided: DragProvided, snapshot: DragSnapshot) => React.ReactNode;
|
|
112
|
+
/** Render function for a card */
|
|
113
|
+
renderCard: (card: KanbanCard, provided: DragProvided, snapshot: DragSnapshot) => React.ReactNode;
|
|
114
|
+
/** Custom key extractor for cards (default: card.id) */
|
|
115
|
+
getCardKey?: (card: KanbanCard) => string;
|
|
116
|
+
/** Custom key extractor for columns (default: column.id) */
|
|
117
|
+
getColumnKey?: (column: KanbanColumn) => string;
|
|
118
|
+
/** Callback to determine if a drag should be disabled */
|
|
119
|
+
isDragDisabled?: (id: Id, type: 'CARD' | 'COLUMN') => boolean;
|
|
120
|
+
/** Class name for the board container */
|
|
121
|
+
className?: string;
|
|
122
|
+
/** Inline styles for the board container */
|
|
123
|
+
style?: React.CSSProperties;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Props for KanbanColumnView (headless)
|
|
127
|
+
*/
|
|
128
|
+
export interface KanbanColumnViewProps {
|
|
129
|
+
/** Column data */
|
|
130
|
+
column: KanbanColumn;
|
|
131
|
+
/** Card IDs in this column */
|
|
132
|
+
cardIds: Id[];
|
|
133
|
+
/** Render prop with provided props and snapshot */
|
|
134
|
+
children: (provided: DragProvided, snapshot: DragSnapshot) => React.ReactNode;
|
|
135
|
+
/** Whether column dragging is disabled */
|
|
136
|
+
isDragDisabled?: boolean;
|
|
137
|
+
/** Column index in the board */
|
|
138
|
+
index: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Props for KanbanCardView (headless)
|
|
142
|
+
*/
|
|
143
|
+
export interface KanbanCardViewProps {
|
|
144
|
+
/** Card data */
|
|
145
|
+
card: KanbanCard;
|
|
146
|
+
/** Render prop with provided props and snapshot */
|
|
147
|
+
children: (provided: DragProvided, snapshot: DragSnapshot) => React.ReactNode;
|
|
148
|
+
/** Whether card dragging is disabled */
|
|
149
|
+
isDragDisabled?: boolean;
|
|
150
|
+
/** Card index within its column */
|
|
151
|
+
index: number;
|
|
152
|
+
/** Parent column ID */
|
|
153
|
+
columnId: Id;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Internal drag state managed by useKanbanDnd
|
|
157
|
+
*/
|
|
158
|
+
export interface KanbanDragState {
|
|
159
|
+
/** Currently dragging item ID */
|
|
160
|
+
draggingId: Id | null;
|
|
161
|
+
/** Type of item being dragged */
|
|
162
|
+
draggingType: 'CARD' | 'COLUMN' | null;
|
|
163
|
+
/** Source location */
|
|
164
|
+
source: DragLocation | null;
|
|
165
|
+
/** Current destination (updates during drag) */
|
|
166
|
+
destination: DragLocation | null;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Autoscroll configuration
|
|
170
|
+
*/
|
|
171
|
+
export interface AutoscrollConfig {
|
|
172
|
+
/** Distance from edge to trigger autoscroll (px) */
|
|
173
|
+
threshold: number;
|
|
174
|
+
/** Maximum scroll speed (px per frame) */
|
|
175
|
+
maxSpeed: number;
|
|
176
|
+
/** Whether autoscroll is enabled */
|
|
177
|
+
enabled: boolean;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Live region announcement
|
|
181
|
+
*/
|
|
182
|
+
export interface LiveAnnouncement {
|
|
183
|
+
/** Message to announce */
|
|
184
|
+
message: string;
|
|
185
|
+
/** Politeness level */
|
|
186
|
+
politeness: 'polite' | 'assertive';
|
|
187
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DnD Math Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for collision detection and positioning calculations.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Calculate the distance from a point to a rectangle's edges
|
|
8
|
+
*/
|
|
9
|
+
export declare function distanceToEdge(point: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}, rect: DOMRect): {
|
|
13
|
+
top: number;
|
|
14
|
+
right: number;
|
|
15
|
+
bottom: number;
|
|
16
|
+
left: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Get the closest edge of a rectangle to a point
|
|
20
|
+
*/
|
|
21
|
+
export declare function getClosestEdge(point: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
}, rect: DOMRect): 'top' | 'right' | 'bottom' | 'left';
|
|
25
|
+
/**
|
|
26
|
+
* Check if a point is within a threshold distance from an edge
|
|
27
|
+
*/
|
|
28
|
+
export declare function isNearEdge(point: {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}, rect: DOMRect, threshold: number): {
|
|
32
|
+
edge: 'top' | 'right' | 'bottom' | 'left' | null;
|
|
33
|
+
distance: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Calculate scroll speed based on distance from edge
|
|
37
|
+
* Closer to edge = faster scroll
|
|
38
|
+
*/
|
|
39
|
+
export declare function calculateScrollSpeed(distance: number, threshold: number, maxSpeed: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Check if a point is inside a rectangle
|
|
42
|
+
*/
|
|
43
|
+
export declare function isPointInRect(point: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}, rect: DOMRect): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate the center point of a rectangle
|
|
49
|
+
*/
|
|
50
|
+
export declare function getRectCenter(rect: DOMRect): {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Calculate vertical drop position based on mouse Y relative to element center
|
|
56
|
+
*/
|
|
57
|
+
export declare function getVerticalDropPosition(mouseY: number, elementRect: DOMRect): 'top' | 'bottom';
|
|
58
|
+
/**
|
|
59
|
+
* Calculate horizontal drop position based on mouse X relative to element center
|
|
60
|
+
*/
|
|
61
|
+
export declare function getHorizontalDropPosition(mouseX: number, elementRect: DOMRect): 'left' | 'right';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for DOM measurements and manipulation.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Safely get bounding client rect for an element
|
|
8
|
+
*/
|
|
9
|
+
export declare function getBoundingRect(element: HTMLElement | null): DOMRect | null;
|
|
10
|
+
/**
|
|
11
|
+
* Get scrollable parent of an element
|
|
12
|
+
*/
|
|
13
|
+
export declare function getScrollParent(element: HTMLElement | null): HTMLElement | null;
|
|
14
|
+
/**
|
|
15
|
+
* Scroll an element by a delta
|
|
16
|
+
*/
|
|
17
|
+
export declare function scrollBy(element: HTMLElement, delta: {
|
|
18
|
+
x?: number;
|
|
19
|
+
y?: number;
|
|
20
|
+
}): void;
|
|
21
|
+
/**
|
|
22
|
+
* Check if an element is scrollable
|
|
23
|
+
*/
|
|
24
|
+
export declare function isScrollable(element: HTMLElement): {
|
|
25
|
+
vertical: boolean;
|
|
26
|
+
horizontal: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Get element's scroll position
|
|
30
|
+
*/
|
|
31
|
+
export declare function getScrollPosition(element: HTMLElement): {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Get maximum scroll for an element
|
|
37
|
+
*/
|
|
38
|
+
export declare function getMaxScroll(element: HTMLElement): {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Clamp scroll position to valid range
|
|
44
|
+
*/
|
|
45
|
+
export declare function clampScroll(scroll: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
}, maxScroll: {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}): {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Get all data attributes from an element as an object
|
|
57
|
+
*/
|
|
58
|
+
export declare function getDataAttributes(element: HTMLElement): Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* Find closest ancestor with a data attribute
|
|
61
|
+
*/
|
|
62
|
+
export declare function findClosestWithData(element: HTMLElement | null, dataKey: string): HTMLElement | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kanban Reorder Utilities
|
|
3
|
+
*
|
|
4
|
+
* Functions for reordering cards and columns in a Kanban board.
|
|
5
|
+
*/
|
|
6
|
+
import type { KanbanBoardState, DragLocation } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Reorder an array by moving an item from one index to another
|
|
9
|
+
*/
|
|
10
|
+
export declare function reorderArray<T>(list: T[], startIndex: number, endIndex: number): T[];
|
|
11
|
+
export declare function normalizeReorderDestinationIndex(params: {
|
|
12
|
+
itemCount: number;
|
|
13
|
+
sourceIndex: number;
|
|
14
|
+
rawDestinationIndex: number;
|
|
15
|
+
isSameList: boolean;
|
|
16
|
+
}): number;
|
|
17
|
+
/**
|
|
18
|
+
* Move a card within the same column
|
|
19
|
+
*/
|
|
20
|
+
export declare function reorderCardInColumn(state: KanbanBoardState, columnId: string, startIndex: number, endIndex: number): KanbanBoardState;
|
|
21
|
+
/**
|
|
22
|
+
* Move a card from one column to another
|
|
23
|
+
*/
|
|
24
|
+
export declare function moveCardBetweenColumns(state: KanbanBoardState, source: DragLocation, destination: DragLocation, cardId: string): KanbanBoardState;
|
|
25
|
+
/**
|
|
26
|
+
* Reorder columns
|
|
27
|
+
*/
|
|
28
|
+
export declare function reorderColumns(state: KanbanBoardState, startIndex: number, endIndex: number): KanbanBoardState;
|
|
29
|
+
/**
|
|
30
|
+
* Apply a drag result to the board state
|
|
31
|
+
* This is a convenience function that handles all reorder cases
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyDragResult(state: KanbanBoardState, result: {
|
|
34
|
+
type: 'CARD' | 'COLUMN';
|
|
35
|
+
source: DragLocation;
|
|
36
|
+
destination?: DragLocation;
|
|
37
|
+
draggableId: string;
|
|
38
|
+
}): KanbanBoardState;
|