@object-ui/plugin-kanban 3.1.5 → 3.3.1

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 (77) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +24 -0
  3. package/dist/{KanbanEnhanced-CvxO2soF.js → KanbanEnhanced-Do9ZB1Mh.js} +36 -33
  4. package/dist/{KanbanImpl-ii52_k8g.js → KanbanImpl-BdocXM5T.js} +2 -2
  5. package/dist/{chevron-down-DpXJN6OX.js → chevron-down-C0JUlGjk.js} +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +35 -26
  8. package/dist/index.umd.cjs +4 -4
  9. package/dist/packages/plugin-kanban/src/CardTemplates.d.ts.map +1 -0
  10. package/dist/packages/plugin-kanban/src/InlineQuickAdd.d.ts.map +1 -0
  11. package/dist/packages/plugin-kanban/src/KanbanEnhanced.d.ts.map +1 -0
  12. package/dist/packages/plugin-kanban/src/KanbanImpl.d.ts.map +1 -0
  13. package/dist/packages/plugin-kanban/src/ObjectKanban.EdgeCases.stories.d.ts.map +1 -0
  14. package/dist/packages/plugin-kanban/src/ObjectKanban.d.ts.map +1 -0
  15. package/dist/packages/plugin-kanban/src/ObjectKanban.stories.d.ts.map +1 -0
  16. package/dist/packages/plugin-kanban/src/index.d.ts.map +1 -0
  17. package/dist/packages/plugin-kanban/src/types.d.ts.map +1 -0
  18. package/dist/packages/plugin-kanban/src/useColumnWidths.d.ts.map +1 -0
  19. package/dist/packages/plugin-kanban/src/useCrossSwimlaneMove.d.ts.map +1 -0
  20. package/dist/packages/plugin-kanban/src/useQuickAddReorder.d.ts.map +1 -0
  21. package/dist/{plus-CAtTu4zt.js → plus-CHsXVJSY.js} +39 -36
  22. package/dist/{sortable.esm-DzUCoMzQ.js → sortable.esm-LJG1TjKd.js} +4 -4
  23. package/package.json +35 -12
  24. package/.turbo/turbo-build.log +0 -32
  25. package/dist/src/CardTemplates.d.ts.map +0 -1
  26. package/dist/src/InlineQuickAdd.d.ts.map +0 -1
  27. package/dist/src/KanbanEnhanced.d.ts.map +0 -1
  28. package/dist/src/KanbanImpl.d.ts.map +0 -1
  29. package/dist/src/ObjectKanban.EdgeCases.stories.d.ts.map +0 -1
  30. package/dist/src/ObjectKanban.d.ts.map +0 -1
  31. package/dist/src/ObjectKanban.stories.d.ts.map +0 -1
  32. package/dist/src/index.d.ts.map +0 -1
  33. package/dist/src/types.d.ts.map +0 -1
  34. package/dist/src/useColumnWidths.d.ts.map +0 -1
  35. package/dist/src/useCrossSwimlaneMove.d.ts.map +0 -1
  36. package/dist/src/useQuickAddReorder.d.ts.map +0 -1
  37. package/src/CardTemplates.tsx +0 -123
  38. package/src/InlineQuickAdd.tsx +0 -189
  39. package/src/KanbanEnhanced.tsx +0 -525
  40. package/src/KanbanImpl.tsx +0 -597
  41. package/src/ObjectKanban.EdgeCases.stories.tsx +0 -168
  42. package/src/ObjectKanban.msw.test.tsx +0 -91
  43. package/src/ObjectKanban.stories.tsx +0 -152
  44. package/src/ObjectKanban.tsx +0 -262
  45. package/src/__tests__/KanbanEnhanced.test.tsx +0 -260
  46. package/src/__tests__/KanbanGrouping.test.tsx +0 -164
  47. package/src/__tests__/KanbanSwimlanes.test.tsx +0 -194
  48. package/src/__tests__/ObjectKanbanTitle.test.tsx +0 -93
  49. package/src/__tests__/SwimlanePersistence.test.tsx +0 -159
  50. package/src/__tests__/accessibility.test.tsx +0 -296
  51. package/src/__tests__/dnd-undo-integration.test.tsx +0 -525
  52. package/src/__tests__/performance-benchmark.test.tsx +0 -306
  53. package/src/__tests__/phase13-features.test.tsx +0 -387
  54. package/src/__tests__/view-states.test.tsx +0 -403
  55. package/src/index.test.ts +0 -112
  56. package/src/index.tsx +0 -327
  57. package/src/registration.test.tsx +0 -26
  58. package/src/types.ts +0 -185
  59. package/src/useColumnWidths.ts +0 -125
  60. package/src/useCrossSwimlaneMove.ts +0 -116
  61. package/src/useQuickAddReorder.ts +0 -107
  62. package/tsconfig.json +0 -19
  63. package/vite.config.ts +0 -61
  64. package/vitest.config.ts +0 -12
  65. package/vitest.setup.ts +0 -1
  66. /package/dist/{src → packages/plugin-kanban/src}/CardTemplates.d.ts +0 -0
  67. /package/dist/{src → packages/plugin-kanban/src}/InlineQuickAdd.d.ts +0 -0
  68. /package/dist/{src → packages/plugin-kanban/src}/KanbanEnhanced.d.ts +0 -0
  69. /package/dist/{src → packages/plugin-kanban/src}/KanbanImpl.d.ts +0 -0
  70. /package/dist/{src → packages/plugin-kanban/src}/ObjectKanban.EdgeCases.stories.d.ts +0 -0
  71. /package/dist/{src → packages/plugin-kanban/src}/ObjectKanban.d.ts +0 -0
  72. /package/dist/{src → packages/plugin-kanban/src}/ObjectKanban.stories.d.ts +0 -0
  73. /package/dist/{src → packages/plugin-kanban/src}/index.d.ts +0 -0
  74. /package/dist/{src → packages/plugin-kanban/src}/types.d.ts +0 -0
  75. /package/dist/{src → packages/plugin-kanban/src}/useColumnWidths.d.ts +0 -0
  76. /package/dist/{src → packages/plugin-kanban/src}/useCrossSwimlaneMove.d.ts +0 -0
  77. /package/dist/{src → packages/plugin-kanban/src}/useQuickAddReorder.d.ts +0 -0
@@ -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,61 +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
- include: ['src'],
20
- exclude: ['**/*.test.ts', '**/*.test.tsx', 'node_modules'],
21
- skipDiagnostics: true,
22
- }),
23
- ],
24
- resolve: {
25
- alias: {
26
- '@': resolve(__dirname, './src'),
27
- '@object-ui/core': resolve(__dirname, '../core/src'),
28
- '@object-ui/types': resolve(__dirname, '../types/src'),
29
- '@object-ui/react': resolve(__dirname, '../react/src'),
30
- '@object-ui/components': resolve(__dirname, '../components/src'),
31
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
32
- '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
33
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
34
- },
35
- },
36
- build: {
37
- lib: {
38
- entry: resolve(__dirname, 'src/index.tsx'),
39
- name: 'ObjectUIPluginKanban',
40
- fileName: 'index',
41
- },
42
- rollupOptions: {
43
- external: ['react', 'react-dom', '@object-ui/components', '@object-ui/core', '@object-ui/react'],
44
- output: {
45
- globals: {
46
- react: 'React',
47
- 'react-dom': 'ReactDOM',
48
- '@object-ui/components': 'ObjectUIComponents',
49
- '@object-ui/core': 'ObjectUICore',
50
- '@object-ui/react': 'ObjectUIReact',
51
- },
52
- },
53
- },
54
- },
55
- test: {
56
- globals: true,
57
- environment: 'happy-dom',
58
- setupFiles: ['../../vitest.setup.tsx'],
59
- passWithNoTests: true,
60
- },
61
- });
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';