@object-ui/plugin-kanban 3.3.0 → 3.3.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +24 -0
  3. package/dist/{KanbanEnhanced-TdUe0kQH.js → KanbanEnhanced-Do9ZB1Mh.js} +35 -32
  4. package/dist/{KanbanImpl-BtlPa7GE.js → KanbanImpl-BdocXM5T.js} +1 -1
  5. package/dist/{chevron-down-B6UH8BbF.js → chevron-down-C0JUlGjk.js} +1 -1
  6. package/dist/index.js +3 -3
  7. package/dist/index.umd.cjs +2 -2
  8. package/dist/{plus-BTqoaaEC.js → plus-CHsXVJSY.js} +1 -1
  9. package/package.json +34 -11
  10. package/.turbo/turbo-build.log +0 -32
  11. package/src/CardTemplates.tsx +0 -123
  12. package/src/InlineQuickAdd.tsx +0 -189
  13. package/src/KanbanEnhanced.tsx +0 -525
  14. package/src/KanbanImpl.tsx +0 -597
  15. package/src/ObjectKanban.EdgeCases.stories.tsx +0 -168
  16. package/src/ObjectKanban.msw.test.tsx +0 -95
  17. package/src/ObjectKanban.stories.tsx +0 -152
  18. package/src/ObjectKanban.tsx +0 -276
  19. package/src/__tests__/KanbanEnhanced.test.tsx +0 -260
  20. package/src/__tests__/KanbanGrouping.test.tsx +0 -164
  21. package/src/__tests__/KanbanSwimlanes.test.tsx +0 -194
  22. package/src/__tests__/ObjectKanbanTitle.test.tsx +0 -93
  23. package/src/__tests__/SwimlanePersistence.test.tsx +0 -159
  24. package/src/__tests__/accessibility.test.tsx +0 -296
  25. package/src/__tests__/dnd-undo-integration.test.tsx +0 -525
  26. package/src/__tests__/performance-benchmark.test.tsx +0 -306
  27. package/src/__tests__/phase13-features.test.tsx +0 -387
  28. package/src/__tests__/view-states.test.tsx +0 -403
  29. package/src/index.test.ts +0 -112
  30. package/src/index.tsx +0 -327
  31. package/src/registration.test.tsx +0 -26
  32. package/src/types.ts +0 -185
  33. package/src/useColumnWidths.ts +0 -125
  34. package/src/useCrossSwimlaneMove.ts +0 -116
  35. package/src/useQuickAddReorder.ts +0 -107
  36. package/tsconfig.json +0 -19
  37. package/vite.config.ts +0 -62
  38. package/vitest.config.ts +0 -12
  39. package/vitest.setup.ts +0 -1
@@ -1,116 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { useState, useCallback, useMemo } from "react"
10
-
11
- export interface Swimlane {
12
- /** Unique identifier for the swimlane row */
13
- id: string
14
- /** Display label */
15
- title: string
16
- /** Optional list of swimlane IDs this lane accepts cards from. Omit for unrestricted. */
17
- acceptFrom?: string[]
18
- }
19
-
20
- export interface CrossSwimlaneMoveEvent {
21
- cardId: string
22
- fromSwimlane: string
23
- toSwimlane: string
24
- columnId: string
25
- }
26
-
27
- export interface UseCrossSwimlaneOptions {
28
- /** Swimlane definitions */
29
- swimlanes: Swimlane[]
30
- /** Callback executed after a successful cross-swimlane move */
31
- onCardMove?: (event: CrossSwimlaneMoveEvent) => void
32
- }
33
-
34
- export interface UseCrossSwimlaneMoveReturn {
35
- /** Execute a cross-swimlane move. Returns true if the move was allowed. */
36
- handleCrossSwimlaneMove: (
37
- cardId: string,
38
- fromSwimlane: string,
39
- toSwimlane: string,
40
- columnId: string,
41
- ) => boolean
42
- /** Whether a card is currently being dragged across swimlanes */
43
- isDraggingAcrossSwimlanes: boolean
44
- /** Start tracking a cross-swimlane drag */
45
- startCrossSwimlaneDrag: (fromSwimlane: string) => void
46
- /** End the cross-swimlane drag */
47
- endCrossSwimlaneDrag: () => void
48
- /** Check whether a card may be moved into the target swimlane */
49
- canMoveTo: (fromSwimlane: string, toSwimlane: string) => boolean
50
- }
51
-
52
- /**
53
- * Hook for managing cross-swimlane card movements.
54
- * Validates movement constraints (acceptFrom rules) and tracks drag state.
55
- */
56
- export function useCrossSwimlaneMove({
57
- swimlanes,
58
- onCardMove,
59
- }: UseCrossSwimlaneOptions): UseCrossSwimlaneMoveReturn {
60
- const [dragSource, setDragSource] = useState<string | null>(null)
61
-
62
- const swimlaneMap = useMemo(() => {
63
- const map = new Map<string, Swimlane>()
64
- for (const lane of swimlanes) {
65
- map.set(lane.id, lane)
66
- }
67
- return map
68
- }, [swimlanes])
69
-
70
- const canMoveTo = useCallback(
71
- (fromSwimlane: string, toSwimlane: string): boolean => {
72
- if (fromSwimlane === toSwimlane) return true
73
- const target = swimlaneMap.get(toSwimlane)
74
- if (!target) return false
75
- // When acceptFrom is not specified the lane is unrestricted
76
- if (!target.acceptFrom) return true
77
- return target.acceptFrom.includes(fromSwimlane)
78
- },
79
- [swimlaneMap],
80
- )
81
-
82
- const handleCrossSwimlaneMove = useCallback(
83
- (
84
- cardId: string,
85
- fromSwimlane: string,
86
- toSwimlane: string,
87
- columnId: string,
88
- ): boolean => {
89
- if (!canMoveTo(fromSwimlane, toSwimlane)) return false
90
- onCardMove?.({ cardId, fromSwimlane, toSwimlane, columnId })
91
- setDragSource(null)
92
- return true
93
- },
94
- [canMoveTo, onCardMove],
95
- )
96
-
97
- const startCrossSwimlaneDrag = useCallback((fromSwimlane: string) => {
98
- setDragSource(fromSwimlane)
99
- }, [])
100
-
101
- const endCrossSwimlaneDrag = useCallback(() => {
102
- setDragSource(null)
103
- }, [])
104
-
105
- const isDraggingAcrossSwimlanes = dragSource !== null
106
-
107
- return {
108
- handleCrossSwimlaneMove,
109
- isDraggingAcrossSwimlanes,
110
- startCrossSwimlaneDrag,
111
- endCrossSwimlaneDrag,
112
- canMoveTo,
113
- }
114
- }
115
-
116
- export default useCrossSwimlaneMove
@@ -1,107 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { useState, useCallback } from "react"
10
- import type { KanbanCard } from "./types"
11
-
12
- export interface UseQuickAddReorderOptions {
13
- /** Initial set of cards in the column */
14
- cards: KanbanCard[]
15
- /** Called when the user finishes reordering */
16
- onReorderComplete?: (reorderedCards: KanbanCard[]) => void
17
- }
18
-
19
- export interface UseQuickAddReorderReturn {
20
- /** Cards in their current (possibly reordered) order */
21
- reorderedCards: KanbanCard[]
22
- /** Move a card from one index to another within the list */
23
- onReorder: (fromIndex: number, toIndex: number) => void
24
- /** Whether a card is currently being dragged for reorder */
25
- isDragging: boolean
26
- /** Signal the start of a drag-to-reorder interaction */
27
- startDrag: () => void
28
- /** Signal the end of a drag-to-reorder interaction */
29
- endDrag: () => void
30
- /** Reset reordered state back to the source cards */
31
- reset: () => void
32
- }
33
-
34
- /**
35
- * Hook for drag-to-reorder of quick-add cards within a single column.
36
- * Manages local ordering state and exposes drag lifecycle helpers.
37
- */
38
- export function useQuickAddReorder({
39
- cards,
40
- onReorderComplete,
41
- }: UseQuickAddReorderOptions): UseQuickAddReorderReturn {
42
- const [reorderedCards, setReorderedCards] = useState<KanbanCard[]>(cards)
43
- const [isDragging, setIsDragging] = useState(false)
44
-
45
- // Keep reorderedCards in sync when the source cards change externally
46
- // (e.g. when a new card is added via quick-add)
47
- if (!cardsMatch(reorderedCards, cards) && !isDragging) {
48
- setReorderedCards(cards)
49
- }
50
-
51
- const reset = useCallback(() => {
52
- setReorderedCards(cards)
53
- setIsDragging(false)
54
- }, [cards])
55
-
56
- const onReorder = useCallback(
57
- (fromIndex: number, toIndex: number) => {
58
- setReorderedCards(prev => {
59
- if (
60
- fromIndex < 0 ||
61
- toIndex < 0 ||
62
- fromIndex >= prev.length ||
63
- toIndex >= prev.length
64
- ) {
65
- return prev
66
- }
67
- const next = [...prev]
68
- const [moved] = next.splice(fromIndex, 1)
69
- next.splice(toIndex, 0, moved)
70
- return next
71
- })
72
- },
73
- [],
74
- )
75
-
76
- const startDrag = useCallback(() => {
77
- setIsDragging(true)
78
- }, [])
79
-
80
- const endDrag = useCallback(() => {
81
- setIsDragging(false)
82
- setReorderedCards(current => {
83
- onReorderComplete?.(current)
84
- return current
85
- })
86
- }, [onReorderComplete])
87
-
88
- return {
89
- reorderedCards,
90
- onReorder,
91
- isDragging,
92
- startDrag,
93
- endDrag,
94
- reset,
95
- }
96
- }
97
-
98
- /** Shallow check that two card arrays contain the same IDs in the same order. */
99
- function cardsMatch(a: KanbanCard[], b: KanbanCard[]): boolean {
100
- if (a.length !== b.length) return false
101
- for (let i = 0; i < a.length; i++) {
102
- if (a[i].id !== b[i].id) return false
103
- }
104
- return true
105
- }
106
-
107
- export default useQuickAddReorder
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "jsx": "react-jsx",
6
- "baseUrl": ".",
7
- "paths": {
8
- "@/*": ["src/*"]
9
- },
10
- // Removed rootDir to prevent file not under rootDir errors when importing from workspace dependencies
11
- "noEmit": false,
12
- "declaration": true,
13
- "composite": true,
14
- "declarationMap": true,
15
- "skipLibCheck": true
16
- },
17
- "include": ["src"],
18
- "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
19
- }
package/vite.config.ts DELETED
@@ -1,62 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { defineConfig } from 'vite';
10
- import react from '@vitejs/plugin-react';
11
- import dts from 'vite-plugin-dts';
12
- import { resolve } from 'path';
13
-
14
- export default defineConfig({
15
- plugins: [
16
- react(),
17
- dts({
18
- insertTypesEntry: true,
19
- compilerOptions: { rootDir: resolve(__dirname, '../..') },
20
- include: ['src'],
21
- exclude: ['**/*.test.ts', '**/*.test.tsx', 'node_modules'],
22
- skipDiagnostics: true,
23
- }),
24
- ],
25
- resolve: {
26
- alias: {
27
- '@': resolve(__dirname, './src'),
28
- '@object-ui/core': resolve(__dirname, '../core/src'),
29
- '@object-ui/types': resolve(__dirname, '../types/src'),
30
- '@object-ui/react': resolve(__dirname, '../react/src'),
31
- '@object-ui/components': resolve(__dirname, '../components/src'),
32
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
33
- '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
34
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
35
- },
36
- },
37
- build: {
38
- lib: {
39
- entry: resolve(__dirname, 'src/index.tsx'),
40
- name: 'ObjectUIPluginKanban',
41
- fileName: 'index',
42
- },
43
- rollupOptions: {
44
- external: ['react', 'react-dom', '@object-ui/components', '@object-ui/core', '@object-ui/react'],
45
- output: {
46
- globals: {
47
- react: 'React',
48
- 'react-dom': 'ReactDOM',
49
- '@object-ui/components': 'ObjectUIComponents',
50
- '@object-ui/core': 'ObjectUICore',
51
- '@object-ui/react': 'ObjectUIReact',
52
- },
53
- },
54
- },
55
- },
56
- test: {
57
- globals: true,
58
- environment: 'happy-dom',
59
- setupFiles: ['../../vitest.setup.tsx'],
60
- passWithNoTests: true,
61
- },
62
- });
package/vitest.config.ts DELETED
@@ -1,12 +0,0 @@
1
- /// <reference types="vitest" />
2
- import { defineConfig } from 'vite';
3
- import react from '@vitejs/plugin-react';
4
-
5
- export default defineConfig({
6
- plugins: [react()],
7
- test: {
8
- environment: 'happy-dom',
9
- globals: true,
10
- setupFiles: ['./vitest.setup.ts'],
11
- },
12
- });
package/vitest.setup.ts DELETED
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';