@echothink-ui/todo 0.1.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 ADDED
@@ -0,0 +1,5 @@
1
+ # @echothink-ui/todo
2
+
3
+ Todo package for EchoThink app-domain websites.
4
+
5
+ This package is part of the EchoThink-UI app-domain library. It is designed for normal website app domains rendered inside EchoThink Studio's Chromium shell, not for implementing the studio browser chrome itself.
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import type { KanbanColumnModel } from "../types";
3
+ export interface KanbanBoardProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ columns?: KanbanColumnModel[];
5
+ onCardMove?: (cardId: string, fromColumn: string, toColumn: string, index: number) => void;
6
+ onAddCard?: (columnId: string) => void;
7
+ }
8
+ export declare function KanbanBoard({ columns, onCardMove, onAddCard, className, ...props }: KanbanBoardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import type { KanbanColumnModel } from "../types";
3
+ export interface KanbanColumnProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ column: KanbanColumnModel;
5
+ children?: React.ReactNode;
6
+ onAddCard?: (columnId: string) => void;
7
+ }
8
+ export declare function KanbanColumn({ column, children, onAddCard, className, "aria-label": ariaLabel, ...props }: KanbanColumnProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import type { KanbanCard } from "../types";
3
+ export interface TaskCardProps extends React.HTMLAttributes<HTMLElement> {
4
+ card: KanbanCard;
5
+ }
6
+ export declare function TaskCard({ card, className, ...props }: TaskCardProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import type { TaskDependency } from "../types";
3
+ export interface TaskDependencyListProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ dependencies?: TaskDependency[];
5
+ }
6
+ export declare function TaskDependencyList({ dependencies, className, ...props }: TaskDependencyListProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import type { TaskRowActions, TaskTableTask } from "../types";
3
+ export interface TaskTableProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ tasks?: TaskTableTask[];
5
+ density?: "compact" | "default" | "comfortable";
6
+ selectable?: boolean;
7
+ rowActions?: TaskRowActions;
8
+ }
9
+ export declare function TaskTable({ tasks, density, selectable, rowActions, className, ...props }: TaskTableProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import type { TaskTimelineEvent } from "../types";
3
+ export interface TaskTimelineProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ events?: TaskTimelineEvent[];
5
+ }
6
+ export declare function TaskTimeline({ events, className, ...props }: TaskTimelineProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import type { TodoTaskItem } from "../types";
3
+ export interface TodoItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onToggle"> {
4
+ item: TodoTaskItem;
5
+ onToggle?: (id: string) => void;
6
+ }
7
+ export declare function TodoItem({ item, onToggle, className, ...props }: TodoItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import type { TodoTaskItem } from "../types";
3
+ export interface TodoListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onToggle"> {
4
+ items?: TodoTaskItem[];
5
+ onToggle?: (id: string) => void;
6
+ onAdd?: (label: string) => void;
7
+ }
8
+ export declare function TodoList({ items, onToggle, onAdd, className, ...props }: TodoListProps): import("react/jsx-runtime").JSX.Element;
package/dist/index.cjs ADDED
@@ -0,0 +1,590 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ KanbanBoard: () => KanbanBoard,
34
+ KanbanColumn: () => KanbanColumn,
35
+ TaskCard: () => TaskCard,
36
+ TaskDependencyList: () => TaskDependencyList,
37
+ TaskTable: () => TaskTable,
38
+ TaskTimeline: () => TaskTimeline,
39
+ TodoComponentNames: () => TodoComponentNames,
40
+ TodoItem: () => TodoItem,
41
+ TodoList: () => TodoList
42
+ });
43
+ module.exports = __toCommonJS(index_exports);
44
+
45
+ // src/components/TodoList.tsx
46
+ var React = __toESM(require("react"), 1);
47
+ var import_core2 = require("@echothink-ui/core");
48
+ var import_icons = require("@echothink-ui/icons");
49
+
50
+ // src/components/TodoItem.tsx
51
+ var import_core = require("@echothink-ui/core");
52
+
53
+ // src/utils.ts
54
+ function formatDateTime(value) {
55
+ if (!value) return "";
56
+ const date = new Date(value);
57
+ if (Number.isNaN(date.getTime())) return value;
58
+ return new Intl.DateTimeFormat(void 0, {
59
+ month: "short",
60
+ day: "numeric",
61
+ hour: "numeric",
62
+ minute: "2-digit"
63
+ }).format(date);
64
+ }
65
+ function priorityLabel(priority) {
66
+ return priority ?? "normal";
67
+ }
68
+ function prioritySeverity(priority) {
69
+ const normalized = priority?.toLowerCase();
70
+ if (normalized === "urgent" || normalized === "critical" || normalized === "high")
71
+ return "danger";
72
+ if (normalized === "medium") return "warning";
73
+ if (normalized === "low") return "info";
74
+ return "neutral";
75
+ }
76
+
77
+ // src/components/TodoItem.tsx
78
+ var import_jsx_runtime = require("react/jsx-runtime");
79
+ function validDateTimeAttribute(value) {
80
+ if (!value) return void 0;
81
+ return Number.isNaN(new Date(value).getTime()) ? void 0 : value;
82
+ }
83
+ function TodoItem({ item, onToggle, className, ...props }) {
84
+ const hasMeta = Boolean(item.assignee || item.priority || item.dueAt);
85
+ const dueDateTime = validDateTimeAttribute(item.dueAt);
86
+ const itemClassName = [
87
+ "eth-todo-item",
88
+ hasMeta ? "eth-todo-item--has-meta" : "",
89
+ item.done ? "eth-todo-item--done" : "",
90
+ className ?? ""
91
+ ].filter(Boolean).join(" ");
92
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
93
+ "div",
94
+ {
95
+ ...props,
96
+ className: itemClassName,
97
+ "data-priority": item.priority,
98
+ "data-state": item.done ? "done" : "open",
99
+ "data-eth-component": "TodoItem",
100
+ children: [
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "eth-todo-item__content eth-todo-item__primary", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ import_core.Checkbox,
103
+ {
104
+ checked: item.done,
105
+ className: "eth-todo-item__checkbox",
106
+ label: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "eth-todo-item__label", children: item.label }),
107
+ onChange: () => onToggle?.(item.id)
108
+ }
109
+ ) }),
110
+ hasMeta ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "eth-todo-item__meta", role: "group", "aria-label": "Task details", children: [
111
+ item.priority ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Badge, { className: "eth-todo-item__tag", severity: prioritySeverity(item.priority), children: priorityLabel(item.priority) }) : null,
112
+ item.assignee ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Tag, { className: "eth-todo-item__tag", children: item.assignee }) : null,
113
+ item.dueAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "eth-todo-item__due", children: [
114
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "eth-todo-item__due-label", children: "Due" }),
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", { dateTime: dueDateTime, children: formatDateTime(item.dueAt) })
116
+ ] }) : null
117
+ ] }) : null
118
+ ]
119
+ }
120
+ );
121
+ }
122
+
123
+ // src/components/TodoList.tsx
124
+ var import_jsx_runtime2 = require("react/jsx-runtime");
125
+ function TodoList({ items = [], onToggle, onAdd, className, ...props }) {
126
+ const [label, setLabel] = React.useState("");
127
+ const completedCount = items.filter((item) => item.done).length;
128
+ const openCount = items.length - completedCount;
129
+ const summary = items.length ? `${openCount} open / ${completedCount} done` : "No tasks yet";
130
+ const submit = (event) => {
131
+ event.preventDefault();
132
+ if (!label.trim() || !onAdd) return;
133
+ onAdd(label.trim());
134
+ setLabel("");
135
+ };
136
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
137
+ import_core2.Panel,
138
+ {
139
+ ...props,
140
+ className: `eth-todo-list ${className ?? ""}`,
141
+ title: "To-do",
142
+ subtitle: summary,
143
+ "data-eth-component": "TodoList",
144
+ children: [
145
+ items.length ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
146
+ "div",
147
+ {
148
+ className: "eth-todo-list__items",
149
+ role: "list",
150
+ "aria-label": "Tasks",
151
+ children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TodoItem, { item, onToggle, role: "listitem" }, item.id))
152
+ }
153
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "eth-todo-list__empty", children: "No tasks have been added." }),
154
+ onAdd ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { className: "eth-todo-list__add", "aria-label": "Add task", onSubmit: submit, children: [
155
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
156
+ import_core2.TextInput,
157
+ {
158
+ value: label,
159
+ labelText: "New task",
160
+ hideLabel: true,
161
+ placeholder: "Add a task",
162
+ onChange: (event) => setLabel(event.currentTarget.value)
163
+ }
164
+ ),
165
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.Button, { type: "submit", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.PlusIcon, {}), disabled: !label.trim(), children: "Add" })
166
+ ] }) : null
167
+ ]
168
+ }
169
+ );
170
+ }
171
+
172
+ // src/components/KanbanBoard.tsx
173
+ var React3 = __toESM(require("react"), 1);
174
+
175
+ // src/components/KanbanColumn.tsx
176
+ var React2 = __toESM(require("react"), 1);
177
+ var import_core3 = require("@echothink-ui/core");
178
+ var import_jsx_runtime3 = require("react/jsx-runtime");
179
+ function KanbanColumn({
180
+ column,
181
+ children,
182
+ onAddCard,
183
+ className,
184
+ "aria-label": ariaLabel,
185
+ ...props
186
+ }) {
187
+ const itemCount = column.items.length;
188
+ const taskLabel = `${itemCount} ${itemCount === 1 ? "task" : "tasks"}`;
189
+ const wipLimit = column.wipLimit;
190
+ const hasWipLimit = typeof wipLimit === "number";
191
+ const overLimit = hasWipLimit ? itemCount > wipLimit : false;
192
+ const atLimit = hasWipLimit ? itemCount === wipLimit : false;
193
+ const hasRenderedChildren = React2.Children.count(children) > 0;
194
+ const titleId = React2.useId();
195
+ const { "aria-labelledby": ariaLabelledBy, ...sectionProps } = props;
196
+ let wipPercent = 0;
197
+ let wipStatusLabel = "";
198
+ let wipSeverity = "neutral";
199
+ if (hasWipLimit) {
200
+ wipPercent = wipLimit > 0 ? Math.min(100, itemCount / wipLimit * 100) : itemCount > 0 ? 100 : 0;
201
+ const remaining = wipLimit - itemCount;
202
+ wipStatusLabel = overLimit ? `${Math.abs(remaining)} over limit` : remaining === 0 ? "At limit" : `${remaining} ${remaining === 1 ? "slot" : "slots"} open`;
203
+ if (overLimit) wipSeverity = "danger";
204
+ else if (atLimit) wipSeverity = "warning";
205
+ }
206
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
207
+ "section",
208
+ {
209
+ ...sectionProps,
210
+ "aria-label": ariaLabel,
211
+ "aria-labelledby": ariaLabel ? void 0 : ariaLabelledBy ?? titleId,
212
+ className: `eth-kanban-column ${overLimit ? "eth-kanban-column--over-limit" : ""} ${className ?? ""}`,
213
+ "data-eth-component": "KanbanColumn",
214
+ children: [
215
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "eth-kanban-column__header", children: [
216
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "eth-kanban-column__header-main", children: [
217
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "eth-kanban-column__heading", children: [
218
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { id: titleId, children: column.title }),
219
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "eth-kanban-column__count", children: taskLabel })
220
+ ] }),
221
+ onAddCard ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "eth-kanban-column__actions", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
222
+ import_core3.IconButton,
223
+ {
224
+ className: "eth-kanban-column__add",
225
+ intent: "ghost",
226
+ density: "compact",
227
+ label: `Add task to ${column.title}`,
228
+ icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "eth-kanban-column__add-glyph", "aria-hidden": "true", children: "+" }),
229
+ onClick: () => onAddCard(column.id)
230
+ }
231
+ ) }) : null
232
+ ] }),
233
+ hasWipLimit ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "eth-kanban-column__metrics", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
234
+ "div",
235
+ {
236
+ className: "eth-kanban-column__limit",
237
+ "aria-label": `Work in progress ${itemCount} of ${wipLimit}`,
238
+ children: [
239
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "eth-kanban-column__limit-row", children: [
240
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core3.Badge, { severity: wipSeverity, children: [
241
+ "WIP ",
242
+ itemCount,
243
+ "/",
244
+ wipLimit
245
+ ] }),
246
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "eth-kanban-column__limit-note", children: wipStatusLabel })
247
+ ] }),
248
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "eth-kanban-column__meter", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { inlineSize: `${wipPercent}%` } }) })
249
+ ]
250
+ }
251
+ ) }) : null
252
+ ] }),
253
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "eth-kanban-column__body", role: "list", "aria-label": `${column.title} tasks`, children: hasRenderedChildren ? children : itemCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "eth-kanban-column__empty", children: "No tasks in this column" }) : null })
254
+ ]
255
+ }
256
+ );
257
+ }
258
+
259
+ // src/components/TaskCard.tsx
260
+ var import_core4 = require("@echothink-ui/core");
261
+ var import_jsx_runtime4 = require("react/jsx-runtime");
262
+ var operationalStatuses = /* @__PURE__ */ new Set([
263
+ "queued",
264
+ "running",
265
+ "paused",
266
+ "blocked",
267
+ "failed",
268
+ "succeeded",
269
+ "warning",
270
+ "stale",
271
+ "synced",
272
+ "pending-approval",
273
+ "approval-required",
274
+ "in-progress",
275
+ "not-started",
276
+ "completed",
277
+ "active",
278
+ "inactive"
279
+ ]);
280
+ function isOperationalStatus(status) {
281
+ return Boolean(status && operationalStatuses.has(status));
282
+ }
283
+ function statusLabel(status) {
284
+ return status.replace(/-/g, " ");
285
+ }
286
+ function TaskCard({ card, className, ...props }) {
287
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
288
+ import_core4.Surface,
289
+ {
290
+ ...props,
291
+ className: `eth-todo-task-card ${className ?? ""}`,
292
+ "data-priority": card.priority,
293
+ "data-status": card.status,
294
+ "data-eth-component": "TaskCard",
295
+ children: [
296
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "eth-todo-task-card__header", children: [
297
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: card.title }),
298
+ card.priority ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.Badge, { severity: prioritySeverity(card.priority), children: priorityLabel(card.priority) }) : null
299
+ ] }),
300
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "eth-todo-task-card__meta", children: [
301
+ card.assignee ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.Tag, { children: card.assignee }) : null,
302
+ isOperationalStatus(card.status) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.StatusDot, { status: card.status, label: statusLabel(card.status) }) : card.status ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.Tag, { children: card.status }) : null,
303
+ card.dueAt ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { className: "eth-todo-task-card__due", dateTime: card.dueAt, children: formatDateTime(card.dueAt) }) : null
304
+ ] }),
305
+ card.labels?.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "eth-todo-task-card__labels", children: card.labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.Tag, { children: label }, label)) }) : null
306
+ ]
307
+ }
308
+ );
309
+ }
310
+
311
+ // src/components/KanbanBoard.tsx
312
+ var import_jsx_runtime5 = require("react/jsx-runtime");
313
+ function KanbanBoard({
314
+ columns: columns2 = [],
315
+ onCardMove,
316
+ onAddCard,
317
+ className,
318
+ ...props
319
+ }) {
320
+ const [announcement, setAnnouncement] = React3.useState("");
321
+ const [lifted, setLifted] = React3.useState(null);
322
+ const findCard = (cardId) => {
323
+ for (const column of columns2) {
324
+ const index = column.items.findIndex((item) => item.id === cardId);
325
+ if (index >= 0) return { column, index, card: column.items[index] };
326
+ }
327
+ return void 0;
328
+ };
329
+ const announce = (message) => setAnnouncement(message);
330
+ const moveLifted = (direction) => {
331
+ if (!lifted) return;
332
+ const currentColumnIndex = columns2.findIndex((column) => column.id === lifted.toColumn);
333
+ if (currentColumnIndex < 0) return;
334
+ if (direction === "left" || direction === "right") {
335
+ const offset = direction === "left" ? -1 : 1;
336
+ const nextColumn = columns2[currentColumnIndex + offset];
337
+ if (!nextColumn) return;
338
+ const nextIndex2 = Math.min(lifted.index, Math.max(0, nextColumn.items.length));
339
+ setLifted({ ...lifted, toColumn: nextColumn.id, index: nextIndex2 });
340
+ announce(`Moved ${lifted.cardId} to ${nextColumn.title}, position ${nextIndex2 + 1}`);
341
+ return;
342
+ }
343
+ const currentColumn = columns2[currentColumnIndex];
344
+ const maxIndex = Math.max(0, currentColumn.items.length - 1);
345
+ const nextIndex = direction === "up" ? Math.max(0, lifted.index - 1) : Math.min(maxIndex, lifted.index + 1);
346
+ setLifted({ ...lifted, index: nextIndex });
347
+ announce(`Moved ${lifted.cardId} to position ${nextIndex + 1}`);
348
+ };
349
+ const handleCardKeyDown = (event, card, column, index) => {
350
+ if (event.key === " ") {
351
+ event.preventDefault();
352
+ setLifted({ cardId: card.id, fromColumn: column.id, toColumn: column.id, index });
353
+ announce(`Lifted ${card.title}`);
354
+ return;
355
+ }
356
+ if (!lifted) return;
357
+ if (event.key === "ArrowLeft") {
358
+ event.preventDefault();
359
+ moveLifted("left");
360
+ }
361
+ if (event.key === "ArrowRight") {
362
+ event.preventDefault();
363
+ moveLifted("right");
364
+ }
365
+ if (event.key === "ArrowUp") {
366
+ event.preventDefault();
367
+ moveLifted("up");
368
+ }
369
+ if (event.key === "ArrowDown") {
370
+ event.preventDefault();
371
+ moveLifted("down");
372
+ }
373
+ if (event.key === "Enter") {
374
+ event.preventDefault();
375
+ onCardMove?.(lifted.cardId, lifted.fromColumn, lifted.toColumn, lifted.index);
376
+ announce(`Dropped ${lifted.cardId}`);
377
+ setLifted(null);
378
+ }
379
+ if (event.key === "Escape") {
380
+ event.preventDefault();
381
+ announce(`Cancelled move for ${lifted.cardId}`);
382
+ setLifted(null);
383
+ }
384
+ };
385
+ const handleDrop = (event, toColumn, index) => {
386
+ event.preventDefault();
387
+ const cardId = event.dataTransfer.getData("text/plain");
388
+ const source = findCard(cardId);
389
+ if (!source) return;
390
+ onCardMove?.(cardId, source.column.id, toColumn.id, index);
391
+ announce(`Moved ${source.card.title} to ${toColumn.title}`);
392
+ };
393
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
394
+ "div",
395
+ {
396
+ ...props,
397
+ className: `eth-kanban-board ${className ?? ""}`,
398
+ "data-eth-component": "KanbanBoard",
399
+ children: [
400
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "eth-kanban-board__columns", role: "list", "aria-label": "Kanban columns", children: columns2.map((column) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
401
+ KanbanColumn,
402
+ {
403
+ column,
404
+ role: "listitem",
405
+ onAddCard,
406
+ onDragOver: (event) => event.preventDefault(),
407
+ onDrop: (event) => handleDrop(event, column, column.items.length),
408
+ children: column.items.map((card, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
409
+ "div",
410
+ {
411
+ className: `eth-kanban-card-shell ${lifted?.cardId === card.id ? "eth-kanban-card-shell--lifted" : ""}`,
412
+ draggable: true,
413
+ tabIndex: 0,
414
+ role: "listitem",
415
+ "aria-label": `${card.title}, ${column.title}, position ${index + 1} of ${column.items.length}`,
416
+ "aria-grabbed": lifted?.cardId === card.id,
417
+ "aria-roledescription": "Draggable task card",
418
+ "aria-keyshortcuts": "Space ArrowLeft ArrowRight ArrowUp ArrowDown Enter Escape",
419
+ onDragStart: (event) => {
420
+ event.dataTransfer.setData("text/plain", card.id);
421
+ event.dataTransfer.effectAllowed = "move";
422
+ },
423
+ onDragOver: (event) => event.preventDefault(),
424
+ onDrop: (event) => handleDrop(event, column, index),
425
+ onKeyDown: (event) => handleCardKeyDown(event, card, column, index),
426
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TaskCard, { card })
427
+ },
428
+ card.id
429
+ ))
430
+ },
431
+ column.id
432
+ )) }),
433
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "eth-kanban-board__live", "aria-live": "polite", "aria-atomic": "true", children: announcement })
434
+ ]
435
+ }
436
+ );
437
+ }
438
+
439
+ // src/components/TaskTable.tsx
440
+ var import_core5 = require("@echothink-ui/core");
441
+ var import_data = require("@echothink-ui/data");
442
+ var import_jsx_runtime6 = require("react/jsx-runtime");
443
+ var columns = [
444
+ {
445
+ key: "title",
446
+ header: "Task",
447
+ render: (task) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "eth-todo-task-table__title", children: [
448
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: task.title }),
449
+ task.labels?.map((label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core5.Tag, { children: label }, label))
450
+ ] })
451
+ },
452
+ {
453
+ key: "status",
454
+ header: "Status",
455
+ render: (task) => task.status ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core5.StatusDot, { status: task.status, label: task.status }) : null
456
+ },
457
+ { key: "assignee", header: "Assignee" },
458
+ {
459
+ key: "priority",
460
+ header: "Priority",
461
+ render: (task) => task.priority ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core5.Badge, { children: task.priority }) : null
462
+ },
463
+ {
464
+ key: "dueAt",
465
+ header: "Due",
466
+ render: (task) => task.dueAt ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("time", { dateTime: task.dueAt, children: formatDateTime(task.dueAt) }) : null
467
+ }
468
+ ];
469
+ function TaskTable({
470
+ tasks = [],
471
+ density = "default",
472
+ selectable,
473
+ rowActions,
474
+ className,
475
+ ...props
476
+ }) {
477
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
478
+ "div",
479
+ {
480
+ ...props,
481
+ className: `eth-todo-task-table ${className ?? ""}`,
482
+ "data-eth-component": "TaskTable",
483
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
484
+ import_data.DataTable,
485
+ {
486
+ rows: tasks,
487
+ columns,
488
+ rowKey: "id",
489
+ density,
490
+ selectable,
491
+ rowActions
492
+ }
493
+ )
494
+ }
495
+ );
496
+ }
497
+
498
+ // src/components/TaskDependencyList.tsx
499
+ var import_core6 = require("@echothink-ui/core");
500
+ var import_jsx_runtime7 = require("react/jsx-runtime");
501
+ function TaskDependencyList({
502
+ dependencies = [],
503
+ className,
504
+ ...props
505
+ }) {
506
+ const groups = {
507
+ "blocked-by": dependencies.filter((dependency) => dependency.relation === "blocked-by"),
508
+ blocks: dependencies.filter((dependency) => dependency.relation === "blocks")
509
+ };
510
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
511
+ import_core6.Panel,
512
+ {
513
+ ...props,
514
+ className: `eth-todo-dependencies ${className ?? ""}`,
515
+ title: "Dependencies",
516
+ "data-eth-component": "TaskDependencyList",
517
+ children: [
518
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DependencyGroup, { title: "Blocked by", dependencies: groups["blocked-by"] }),
519
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DependencyGroup, { title: "Blocks", dependencies: groups.blocks })
520
+ ]
521
+ }
522
+ );
523
+ }
524
+ function DependencyGroup({
525
+ title,
526
+ dependencies
527
+ }) {
528
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "eth-todo-dependencies__group", children: [
529
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: title }),
530
+ dependencies.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { children: dependencies.map((dependency) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { children: [
531
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: dependency.title }),
532
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_core6.Badge, { children: dependency.status })
533
+ ] }, dependency.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "None" })
534
+ ] });
535
+ }
536
+
537
+ // src/components/TaskTimeline.tsx
538
+ var React4 = __toESM(require("react"), 1);
539
+ var import_core7 = require("@echothink-ui/core");
540
+ var import_jsx_runtime8 = require("react/jsx-runtime");
541
+ function TaskTimeline({ events = [], className, ...props }) {
542
+ const sortedEvents = React4.useMemo(
543
+ () => [...events].sort(
544
+ (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime()
545
+ ),
546
+ [events]
547
+ );
548
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
549
+ import_core7.Panel,
550
+ {
551
+ ...props,
552
+ className: `eth-todo-timeline ${className ?? ""}`,
553
+ title: "Task timeline",
554
+ "data-eth-component": "TaskTimeline",
555
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ol", { className: "eth-todo-timeline__events", children: sortedEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { className: "eth-todo-timeline__event", children: [
556
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("time", { dateTime: event.timestamp, children: formatDateTime(event.timestamp) }),
557
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
558
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_core7.Tag, { children: event.kind }),
559
+ event.actor ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: event.actor }) : null,
560
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: event.summary })
561
+ ] })
562
+ ] }, event.id)) })
563
+ }
564
+ );
565
+ }
566
+
567
+ // src/index.tsx
568
+ var TodoComponentNames = [
569
+ "TodoList",
570
+ "TodoItem",
571
+ "KanbanBoard",
572
+ "KanbanColumn",
573
+ "TaskCard",
574
+ "TaskTable",
575
+ "TaskDependencyList",
576
+ "TaskTimeline"
577
+ ];
578
+ // Annotate the CommonJS export names for ESM import in node:
579
+ 0 && (module.exports = {
580
+ KanbanBoard,
581
+ KanbanColumn,
582
+ TaskCard,
583
+ TaskDependencyList,
584
+ TaskTable,
585
+ TaskTimeline,
586
+ TodoComponentNames,
587
+ TodoItem,
588
+ TodoList
589
+ });
590
+ //# sourceMappingURL=index.cjs.map