@molecule/app-kanban-board-react 1.0.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/LICENSE ADDED
@@ -0,0 +1,115 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship.
43
+
44
+ "Contribution" shall mean any work of authorship, including the
45
+ original version of the Work and any modifications or additions
46
+ to that Work, that is intentionally submitted to the Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or
48
+ Legal Entity authorized to submit on behalf of the copyright owner.
49
+
50
+ "Contributor" shall mean Licensor and any individual or Legal Entity
51
+ on behalf of whom a Contribution has been received by the Licensor and
52
+ subsequently incorporated within the Work.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ patent license to make, have made, use, offer to sell, sell, import,
65
+ and otherwise transfer the Work.
66
+
67
+ 4. Redistribution. You may reproduce and distribute copies of the
68
+ Work or Derivative Works thereof in any medium, with or without
69
+ modifications, and in Source or Object form, provided that You
70
+ meet the following conditions:
71
+
72
+ (a) You must give any other recipients of the Work or
73
+ Derivative Works a copy of this License; and
74
+
75
+ (b) You must cause any modified files to carry prominent notices
76
+ stating that You changed the files; and
77
+
78
+ (c) You must retain, in the Source form of any Derivative Works
79
+ that You distribute, all copyright, patent, trademark, and
80
+ attribution notices from the Source form of the Work,
81
+ excluding those notices that do not pertain to any part of
82
+ the Derivative Works; and
83
+
84
+ (d) If the Work includes a "NOTICE" text file as part of its
85
+ distribution, then any Derivative Works that You distribute must
86
+ include a readable copy of the attribution notices contained
87
+ within such NOTICE file.
88
+
89
+ 5. Submission of Contributions.
90
+
91
+ 6. Trademarks. This License does not grant permission to use the trade
92
+ names, trademarks, service marks, or product names of the Licensor.
93
+
94
+ 7. Disclaimer of Warranty. Unless required by applicable law or
95
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
+
98
+ 8. Limitation of Liability. In no event and under no legal theory shall
99
+ any Contributor be liable to You for damages.
100
+
101
+ 9. Accepting Warranty or Additional Liability.
102
+
103
+ Copyright 2026 Molecule Dev, Inc.
104
+
105
+ Licensed under the Apache License, Version 2.0 (the "License");
106
+ you may not use this file except in compliance with the License.
107
+ You may obtain a copy of the License at
108
+
109
+ http://www.apache.org/licenses/LICENSE-2.0
110
+
111
+ Unless required by applicable law or agreed to in writing, software
112
+ distributed under the License is distributed on an "AS IS" BASIS,
113
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ See the License for the specific language governing permissions and
115
+ limitations under the License.
@@ -0,0 +1,38 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { KanbanCardData, KanbanColumnData } from './types.js';
3
+ /** Props for {@link KanbanBoard}. */
4
+ export interface KanbanBoardProps {
5
+ columns: KanbanColumnData[];
6
+ /** Called when a card moves from one column to another. */
7
+ onCardMove?: (cardId: string, fromColumnId: string, toColumnId: string) => void;
8
+ /** Called when a card is clicked. */
9
+ onCardClick?: (card: KanbanCardData, column: KanbanColumnData) => void;
10
+ /** Optional per-column header action renderer. */
11
+ renderHeaderActions?: (column: KanbanColumnData) => ReactNode;
12
+ /** Optional per-column footer renderer (e.g. "+ Add card"). */
13
+ renderFooter?: (column: KanbanColumnData) => ReactNode;
14
+ /** Extra classes on the outer board wrapper. */
15
+ className?: string;
16
+ }
17
+ /**
18
+ * Kanban board with HTML5 drag-drop between columns.
19
+ *
20
+ * Pure UI — consumers own the card data and call back on `onCardMove`
21
+ * to persist reorder. For fancier drag experiences, wire
22
+ * `@molecule/app-drag-drop` at the column level instead.
23
+ *
24
+ * @param props - Component props (see {@link KanbanBoardProps}).
25
+ * @example
26
+ * ```tsx
27
+ * <KanbanBoard
28
+ * columns={[
29
+ * { id: 'todo', title: 'To do', cards: [...] },
30
+ * { id: 'doing', title: 'In progress', cards: [...] },
31
+ * { id: 'done', title: 'Done', cards: [...] },
32
+ * ]}
33
+ * onCardMove={(cardId, from, to) => moveCard(cardId, to)}
34
+ * />
35
+ * ```
36
+ */
37
+ export declare function KanbanBoard({ columns, onCardMove, onCardClick, renderHeaderActions, renderFooter, className, }: KanbanBoardProps): JSX.Element;
38
+ //# sourceMappingURL=KanbanBoard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KanbanBoard.d.ts","sourceRoot":"","sources":["../src/KanbanBoard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAK3C,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElE,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/E,qCAAqC;IACrC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACtE,kDAAkD;IAClD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,SAAS,CAAA;IAC7D,+DAA+D;IAC/D,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,SAAS,CAAA;IACtD,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,SAAS,GACV,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAyDhC"}
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ import { KanbanColumn } from './KanbanColumn.js';
4
+ /**
5
+ * Kanban board with HTML5 drag-drop between columns.
6
+ *
7
+ * Pure UI — consumers own the card data and call back on `onCardMove`
8
+ * to persist reorder. For fancier drag experiences, wire
9
+ * `@molecule/app-drag-drop` at the column level instead.
10
+ *
11
+ * @param props - Component props (see {@link KanbanBoardProps}).
12
+ * @example
13
+ * ```tsx
14
+ * <KanbanBoard
15
+ * columns={[
16
+ * { id: 'todo', title: 'To do', cards: [...] },
17
+ * { id: 'doing', title: 'In progress', cards: [...] },
18
+ * { id: 'done', title: 'Done', cards: [...] },
19
+ * ]}
20
+ * onCardMove={(cardId, from, to) => moveCard(cardId, to)}
21
+ * />
22
+ * ```
23
+ */
24
+ export function KanbanBoard({ columns, onCardMove, onCardClick, renderHeaderActions, renderFooter, className, }) {
25
+ const cm = getClassMap();
26
+ /**
27
+ * Stores card identity in the drag payload so the drop handler knows the source column.
28
+ * @param card
29
+ * @param column
30
+ * @param e
31
+ */
32
+ function onCardDragStart(card, column, e) {
33
+ e.dataTransfer.setData('text/molecule-kanban', JSON.stringify({ cardId: card.id, fromColumnId: column.id }));
34
+ e.dataTransfer.effectAllowed = 'move';
35
+ }
36
+ /**
37
+ * Handles a card drop onto a column, parsing the drag payload and invoking onCardMove.
38
+ * @param column
39
+ * @param e
40
+ */
41
+ function onDrop(column, e) {
42
+ e.preventDefault();
43
+ const payload = e.dataTransfer.getData('text/molecule-kanban');
44
+ if (!payload || !onCardMove)
45
+ return;
46
+ try {
47
+ const { cardId, fromColumnId } = JSON.parse(payload);
48
+ if (fromColumnId !== column.id)
49
+ onCardMove(cardId, fromColumnId, column.id);
50
+ }
51
+ catch (_error) {
52
+ // Safe to ignore: dataTransfer payload is untrusted/malformed — we simply cancel the drop.
53
+ }
54
+ }
55
+ return (_jsx("div", { className: cm.cn(cm.flex({ align: 'start', gap: 'md' }), className), children: columns.map((col) => (_jsx("div", { className: cm.flex1, children: _jsx(KanbanColumn, { column: col, onCardClick: onCardClick, onDrop: onCardMove ? onDrop : undefined, onCardDragStart: onCardDragStart, headerActions: renderHeaderActions?.(col), footer: renderFooter?.(col) }) }, col.id))) }));
56
+ }
@@ -0,0 +1,23 @@
1
+ import type { DragEvent, JSX } from 'react';
2
+ import type { KanbanCardData } from './types.js';
3
+ /** Props for {@link KanbanCard}. */
4
+ export interface KanbanCardProps {
5
+ card: KanbanCardData;
6
+ /** Called when the card is clicked (e.g. open detail modal). */
7
+ onClick?: (card: KanbanCardData) => void;
8
+ /** HTML5 drag start — integrate with `@molecule/app-drag-drop` bond. */
9
+ onDragStart?: (card: KanbanCardData, e: DragEvent<HTMLDivElement>) => void;
10
+ /** Extra classes. */
11
+ className?: string;
12
+ }
13
+ /**
14
+ * Single card inside a Kanban column. Drag-drop is opt-in via the
15
+ * `onDragStart` prop — wire it to the `@molecule/app-drag-drop` bond or
16
+ * HTML5 drag-drop directly.
17
+ *
18
+ * The outer `<div>` wrapper carries the drag handlers so we don't rely
19
+ * on `<Card>` forwarding drag events (which it doesn't).
20
+ * @param props - Component props (see {@link KanbanCardProps}).
21
+ */
22
+ export declare function KanbanCard({ card, onClick, onDragStart, className, }: KanbanCardProps): JSX.Element;
23
+ //# sourceMappingURL=KanbanCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KanbanCard.d.ts","sourceRoot":"","sources":["../src/KanbanCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAa,MAAM,OAAO,CAAA;AAKtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAA;IACpB,gEAAgE;IAChE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;IACxC,wEAAwE;IACxE,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IAC1E,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,WAAW,EACX,SAAS,GACV,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAsB/B"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ import { Card } from '@molecule/app-ui-react';
4
+ /**
5
+ * Single card inside a Kanban column. Drag-drop is opt-in via the
6
+ * `onDragStart` prop — wire it to the `@molecule/app-drag-drop` bond or
7
+ * HTML5 drag-drop directly.
8
+ *
9
+ * The outer `<div>` wrapper carries the drag handlers so we don't rely
10
+ * on `<Card>` forwarding drag events (which it doesn't).
11
+ * @param props - Component props (see {@link KanbanCardProps}).
12
+ */
13
+ export function KanbanCard({ card, onClick, onDragStart, className, }) {
14
+ const cm = getClassMap();
15
+ const body = (_jsx(Card, { className: cm.cn(cm.cursorPointer, className), onClick: onClick ? () => onClick(card) : undefined, children: _jsxs("div", { className: cm.stack(2), children: [_jsx("h4", { className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: card.title }), card.body && _jsx("div", { className: cm.textSize('sm'), children: card.body }), card.footer && (_jsx("div", { className: cm.flex({ align: 'center', gap: 'sm' }), children: card.footer }))] }) }));
16
+ if (!onDragStart)
17
+ return _jsx(_Fragment, { children: body });
18
+ return (_jsx("div", { draggable: true, onDragStart: (e) => onDragStart(card, e), children: body }));
19
+ }
@@ -0,0 +1,24 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { KanbanCardData, KanbanColumnData } from './types.js';
3
+ /** Props for {@link KanbanColumn}. */
4
+ export interface KanbanColumnProps {
5
+ column: KanbanColumnData;
6
+ /** Called when a card is clicked. */
7
+ onCardClick?: (card: KanbanCardData, column: KanbanColumnData) => void;
8
+ /** Called when a card is dragged into this column. */
9
+ onDrop?: (column: KanbanColumnData, e: React.DragEvent) => void;
10
+ /** Called when a card drag-start fires. */
11
+ onCardDragStart?: (card: KanbanCardData, column: KanbanColumnData, e: React.DragEvent) => void;
12
+ /** Optional header actions. */
13
+ headerActions?: ReactNode;
14
+ /** Optional footer (e.g. "Add card" button). */
15
+ footer?: ReactNode;
16
+ /** Extra classes. */
17
+ className?: string;
18
+ }
19
+ /**
20
+ * One Kanban column — sticky header + scrollable card list + optional footer.
21
+ * @param props - Component props (see {@link KanbanColumnProps}).
22
+ */
23
+ export declare function KanbanColumn({ column, onCardClick, onDrop, onCardDragStart, headerActions, footer, className, }: KanbanColumnProps): JSX.Element;
24
+ //# sourceMappingURL=KanbanColumn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KanbanColumn.d.ts","sourceRoot":"","sources":["../src/KanbanColumn.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAM3C,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElE,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,gBAAgB,CAAA;IACxB,qCAAqC;IACrC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACtE,sDAAsD;IACtD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAA;IAC/D,2CAA2C;IAC3C,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAA;IAC9F,+BAA+B;IAC/B,aAAa,CAAC,EAAE,SAAS,CAAA;IACzB,gDAAgD;IAChD,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,WAAW,EACX,MAAM,EACN,eAAe,EACf,aAAa,EACb,MAAM,EACN,SAAS,GACV,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CA0BjC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ import { KanbanCard } from './KanbanCard.js';
4
+ import { KanbanColumnHeader } from './KanbanColumnHeader.js';
5
+ /**
6
+ * One Kanban column — sticky header + scrollable card list + optional footer.
7
+ * @param props - Component props (see {@link KanbanColumnProps}).
8
+ */
9
+ export function KanbanColumn({ column, onCardClick, onDrop, onCardDragStart, headerActions, footer, className, }) {
10
+ const cm = getClassMap();
11
+ return (_jsxs("section", { className: cm.cn(cm.stack(2), className), onDragOver: onDrop ? (e) => e.preventDefault() : undefined, onDrop: onDrop ? (e) => onDrop(column, e) : undefined, children: [_jsx(KanbanColumnHeader, { title: column.title, count: column.cards.length, actions: headerActions }), _jsx("div", { className: cm.stack(2), children: column.cards.map((card) => (_jsx(KanbanCard, { card: card, onClick: onCardClick ? (c) => onCardClick(c, column) : undefined, onDragStart: onCardDragStart ? (c, e) => onCardDragStart(c, column, e) : undefined }, card.id))) }), footer] }));
12
+ }
@@ -0,0 +1,17 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ /** Props for {@link KanbanColumnHeader}. */
3
+ export interface KanbanColumnHeaderProps {
4
+ title: ReactNode;
5
+ /** Card count shown in parentheses. */
6
+ count?: number;
7
+ /** Optional right-side actions (add card button, menu). */
8
+ actions?: ReactNode;
9
+ /** Extra classes. */
10
+ className?: string;
11
+ }
12
+ /**
13
+ * Kanban column heading row — title + count + right actions.
14
+ * @param props - Component props (see {@link KanbanColumnHeaderProps}).
15
+ */
16
+ export declare function KanbanColumnHeader({ title, count, actions, className, }: KanbanColumnHeaderProps): JSX.Element;
17
+ //# sourceMappingURL=KanbanColumnHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KanbanColumnHeader.d.ts","sourceRoot":"","sources":["../src/KanbanColumnHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,SAAS,CAAA;IAChB,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,GACV,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAiBvC"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getClassMap } from '@molecule/app-ui';
3
+ /**
4
+ * Kanban column heading row — title + count + right actions.
5
+ * @param props - Component props (see {@link KanbanColumnHeaderProps}).
6
+ */
7
+ export function KanbanColumnHeader({ title, count, actions, className, }) {
8
+ const cm = getClassMap();
9
+ return (_jsxs("header", { className: cm.cn(cm.flex({ align: 'center', justify: 'between', gap: 'sm' }), cm.sp('pb', 2), className), children: [_jsxs("div", { className: cm.flex({ align: 'center', gap: 'xs' }), children: [_jsx("span", { className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: title }), typeof count === 'number' && _jsxs("span", { className: cm.textSize('xs'), children: ["(", count, ")"] })] }), actions] }));
10
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * React Kanban board primitives (pure presentational — you own the data).
3
+ *
4
+ * Exports:
5
+ * - `<KanbanBoard>` — columns side-by-side with HTML5 drag-drop between columns.
6
+ * Props: `columns`, `onCardMove?(cardId, fromColumnId, toColumnId)`,
7
+ * `onCardClick?(card, column)`, `renderHeaderActions?(column)`,
8
+ * `renderFooter?(column)`, `className?`.
9
+ * - `<KanbanColumn>` / `<KanbanColumnHeader>` / `<KanbanCard>` — the building blocks,
10
+ * usable standalone for custom board layouts.
11
+ * - `KanbanColumnData` (`{ id, title, accent?, cards }`), `KanbanCardData`
12
+ * (`{ id, title, body?, footer? }`) types.
13
+ *
14
+ * This package is standalone UI: it does NOT use the headless
15
+ * `@molecule/app-kanban` core or the `app-kanban-default` bond. Reach for those
16
+ * when you want board STATE management (move/add/remove logic) behind a bond;
17
+ * use this package when you just need the rendered board and will persist moves
18
+ * yourself in `onCardMove`.
19
+ *
20
+ * @remarks
21
+ * - Drag-drop is native HTML5 DnD: it does not fire on touch devices — provide
22
+ * an alternate affordance (e.g. a move menu in `renderHeaderActions`) for mobile.
23
+ * - `onCardMove` fires only when a card is dropped on a DIFFERENT column, and no
24
+ * insertion index is reported — same-column reordering is not supported; movers
25
+ * can only append to the target column.
26
+ * - Consumers own the data: update your `columns` state in `onCardMove` or the
27
+ * board will snap back on re-render.
28
+ * - `accent` on a column is currently cosmetic metadata only.
29
+ * - Styling resolves through `getClassMap()`; `<KanbanCard>` uses `<Card>` from
30
+ * `@molecule/app-ui-react` — wire a ClassMap bond first.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * import { KanbanBoard } from '@molecule/app-kanban-board-react'
35
+ *
36
+ * <KanbanBoard
37
+ * columns={[
38
+ * { id: 'todo', title: 'To Do', cards: [{ id: 'c1', title: 'Research API' }] },
39
+ * { id: 'doing', title: 'In Progress', accent: 'primary', cards: [{ id: 'c2', title: 'Build UI' }] },
40
+ * { id: 'done', title: 'Done', accent: 'success', cards: [] },
41
+ * ]}
42
+ * onCardMove={(cardId, fromColumnId, toColumnId) => moveCard(cardId, toColumnId)}
43
+ * onCardClick={(card, column) => openCardDetail(card.id)}
44
+ * />
45
+ * ```
46
+ * @module
47
+ */
48
+ export * from './KanbanBoard.js';
49
+ export * from './KanbanCard.js';
50
+ export * from './KanbanColumn.js';
51
+ export * from './KanbanColumnHeader.js';
52
+ export * from './types.js';
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * React Kanban board primitives (pure presentational — you own the data).
3
+ *
4
+ * Exports:
5
+ * - `<KanbanBoard>` — columns side-by-side with HTML5 drag-drop between columns.
6
+ * Props: `columns`, `onCardMove?(cardId, fromColumnId, toColumnId)`,
7
+ * `onCardClick?(card, column)`, `renderHeaderActions?(column)`,
8
+ * `renderFooter?(column)`, `className?`.
9
+ * - `<KanbanColumn>` / `<KanbanColumnHeader>` / `<KanbanCard>` — the building blocks,
10
+ * usable standalone for custom board layouts.
11
+ * - `KanbanColumnData` (`{ id, title, accent?, cards }`), `KanbanCardData`
12
+ * (`{ id, title, body?, footer? }`) types.
13
+ *
14
+ * This package is standalone UI: it does NOT use the headless
15
+ * `@molecule/app-kanban` core or the `app-kanban-default` bond. Reach for those
16
+ * when you want board STATE management (move/add/remove logic) behind a bond;
17
+ * use this package when you just need the rendered board and will persist moves
18
+ * yourself in `onCardMove`.
19
+ *
20
+ * @remarks
21
+ * - Drag-drop is native HTML5 DnD: it does not fire on touch devices — provide
22
+ * an alternate affordance (e.g. a move menu in `renderHeaderActions`) for mobile.
23
+ * - `onCardMove` fires only when a card is dropped on a DIFFERENT column, and no
24
+ * insertion index is reported — same-column reordering is not supported; movers
25
+ * can only append to the target column.
26
+ * - Consumers own the data: update your `columns` state in `onCardMove` or the
27
+ * board will snap back on re-render.
28
+ * - `accent` on a column is currently cosmetic metadata only.
29
+ * - Styling resolves through `getClassMap()`; `<KanbanCard>` uses `<Card>` from
30
+ * `@molecule/app-ui-react` — wire a ClassMap bond first.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * import { KanbanBoard } from '@molecule/app-kanban-board-react'
35
+ *
36
+ * <KanbanBoard
37
+ * columns={[
38
+ * { id: 'todo', title: 'To Do', cards: [{ id: 'c1', title: 'Research API' }] },
39
+ * { id: 'doing', title: 'In Progress', accent: 'primary', cards: [{ id: 'c2', title: 'Build UI' }] },
40
+ * { id: 'done', title: 'Done', accent: 'success', cards: [] },
41
+ * ]}
42
+ * onCardMove={(cardId, fromColumnId, toColumnId) => moveCard(cardId, toColumnId)}
43
+ * onCardClick={(card, column) => openCardDetail(card.id)}
44
+ * />
45
+ * ```
46
+ * @module
47
+ */
48
+ export * from './KanbanBoard.js';
49
+ export * from './KanbanCard.js';
50
+ export * from './KanbanColumn.js';
51
+ export * from './KanbanColumnHeader.js';
52
+ export * from './types.js';
@@ -0,0 +1,28 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Kanban board types.
4
+ *
5
+ * @module
6
+ */
7
+ export interface KanbanCardData {
8
+ /** Card id. */
9
+ id: string;
10
+ /** Title / summary. */
11
+ title: ReactNode;
12
+ /** Optional body / description. */
13
+ body?: ReactNode;
14
+ /** Optional footer row (avatars, tags, timestamps). */
15
+ footer?: ReactNode;
16
+ }
17
+ /** Data for a single kanban column, including its heading, optional accent, and ordered card list. */
18
+ export interface KanbanColumnData {
19
+ /** Column id. */
20
+ id: string;
21
+ /** Column heading. */
22
+ title: ReactNode;
23
+ /** Optional accent color token. */
24
+ accent?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
25
+ /** Cards in the column, in display order. */
26
+ cards: KanbanCardData[];
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,eAAe;IACf,EAAE,EAAE,MAAM,CAAA;IACV,uBAAuB;IACvB,KAAK,EAAE,SAAS,CAAA;IAChB,mCAAmC;IACnC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,sGAAsG;AACtG,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,sBAAsB;IACtB,KAAK,EAAE,SAAS,CAAA;IAChB,mCAAmC;IACnC,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IACzE,6CAA6C;IAC7C,KAAK,EAAE,cAAc,EAAE,CAAA;CACxB"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@molecule/app-kanban-board-react",
3
+ "version": "1.0.0",
4
+ "description": "React Kanban board, column, and card primitives",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "keywords": [
23
+ "molecule",
24
+ "kanban-board",
25
+ "react"
26
+ ],
27
+ "license": "Apache-2.0",
28
+ "peerDependencies": {
29
+ "@molecule/app-react": "^1.0.0",
30
+ "@molecule/app-ui": "^1.0.0",
31
+ "@molecule/app-ui-react": "^1.0.0",
32
+ "react": "^18.0.0 || ^19.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@molecule/app-react": "1.0.0",
36
+ "@molecule/app-ui": "1.0.0",
37
+ "@molecule/app-ui-react": "1.0.0",
38
+ "@types/node": "26.1.2",
39
+ "@types/react": "19.2.17",
40
+ "@types/react-dom": "19.2.3",
41
+ "react": "19.2.8",
42
+ "react-dom": "19.2.8",
43
+ "typescript": "6.0.3",
44
+ "vitest": "4.1.10"
45
+ }
46
+ }