import "./components/ui/tidal.css"; import { useId, useLayoutEffect, useMemo, useRef, useState } from "react"; import { Columns3, RotateCcw } from "lucide-react"; import { TidalKanbanBoard, type TidalKanbanCard, type TidalKanbanColumn, type TidalKanbanMoveRequest } from "./components/ui/kanban-board"; import "./components/ui/kanban-board.css"; const tidalExampleStyles = ".tidal-scope .kanban-demo,\n.tidal-scope .kanban-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .kanban-demo {\n width: 100%;\n max-width: 1220px;\n min-width: 0;\n overflow: hidden;\n border: 1px solid var(--t-border);\n border-radius: 22px;\n background: var(--t-surface);\n color: var(--t-ink);\n box-shadow: 0 34px 72px -56px #0000008f;\n container: kanban-demo / inline-size;\n}\n\n.tidal-scope .kanban-demo-toolbar {\n display: flex;\n min-width: 0;\n align-items: center;\n justify-content: space-between;\n gap: 22px;\n padding: 17px 20px;\n border-bottom: 1px solid var(--t-border);\n background: var(--t-ink);\n color: var(--t-surface);\n}\n\n\n.tidal-scope .kanban-demo-summary,\n.tidal-scope .kanban-demo-summary > span {\n display: flex;\n align-items: center;\n}\n\n.tidal-scope .kanban-demo-kicker {\n display: block;\n color: var(--t-muted);\n font-size: 11px;\n font-weight: 690;\n letter-spacing: 0.11em;\n line-height: 1.4;\n text-transform: uppercase;\n}\n\n.tidal-scope .kanban-demo-toolbar .kanban-demo-kicker {\n color: color-mix(in srgb, var(--t-surface) 66%, var(--t-ink));\n}\n\n.tidal-scope .kanban-demo-summary {\n flex: none;\n gap: 7px;\n}\n\n.tidal-scope .kanban-demo-summary > span {\n min-height: 32px;\n gap: 5px;\n padding: 6px 9px;\n border: 1px solid color-mix(in srgb, var(--t-surface) 22%, transparent);\n border-radius: 10px;\n color: color-mix(in srgb, var(--t-surface) 70%, var(--t-ink));\n font-size: 11px;\n line-height: 1.2;\n}\n\n.tidal-scope .kanban-demo-summary strong {\n color: var(--t-surface);\n font-weight: 700;\n font-variant-numeric: tabular-nums;\n}\n\n.tidal-scope .kanban-demo-summary button {\n display: inline-flex;\n min-width: 44px;\n min-height: 44px;\n align-items: center;\n justify-content: center;\n gap: 7px;\n padding: 8px 11px;\n border: 1px solid color-mix(in srgb, var(--t-surface) 28%, transparent);\n border-radius: 10px;\n background: var(--t-surface);\n color: var(--t-ink);\n font: inherit;\n font-size: 11px;\n font-weight: 650;\n cursor: pointer;\n transition: transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .kanban-demo-summary button:active {\n transform: scale(0.96);\n}\n\n.tidal-scope .kanban-demo-summary button:focus-visible {\n outline: 2px solid var(--t-surface);\n outline-offset: 3px;\n}\n\n.tidal-scope .kanban-demo-stage {\n display: grid;\n gap: 13px;\n min-width: 0;\n padding: 18px;\n background:\n linear-gradient(var(--t-border) 1px, transparent 1px),\n linear-gradient(90deg, var(--t-border) 1px, transparent 1px),\n var(--t-subtle);\n background-size: 22px 22px;\n}\n\n.tidal-scope .kanban-demo-detail {\n display: grid;\n min-width: 0;\n grid-template-columns: 46px minmax(0, 1fr) auto;\n align-items: center;\n gap: 13px;\n padding: 14px;\n border: 1px solid var(--t-border);\n border-radius: 18px;\n background: var(--t-surface);\n}\n\n.tidal-scope .kanban-demo-detail-icon {\n display: grid;\n width: 46px;\n height: 46px;\n place-items: center;\n border-radius: 10px;\n background: var(--t-ink);\n color: var(--t-surface);\n}\n\n.tidal-scope .kanban-demo-detail > div:nth-child(2) {\n min-width: 0;\n}\n\n.tidal-scope .kanban-demo-detail h3 {\n margin: 5px 0 0;\n font-size: 14px;\n font-weight: 650;\n letter-spacing: -0.025em;\n line-height: 1.3;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .kanban-demo-detail p {\n margin: 4px 0 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.5;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .kanban-demo-detail dl {\n display: flex;\n gap: 8px;\n margin: 0;\n}\n\n.tidal-scope .kanban-demo-detail dl > div {\n min-width: 92px;\n padding: 8px 10px;\n border: 1px solid var(--t-border);\n border-radius: 10px;\n background: var(--t-subtle);\n}\n\n.tidal-scope .kanban-demo-detail dt,\n.tidal-scope .kanban-demo-detail dd {\n margin: 0;\n font-size: 11px;\n line-height: 1.35;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .kanban-demo-detail dt {\n color: var(--t-muted);\n}\n\n.tidal-scope .kanban-demo-detail dd {\n margin-top: 3px;\n color: var(--t-ink);\n font-weight: 650;\n}\n\n.tidal-scope .kanban-demo-status {\n min-height: 34px;\n margin: 0;\n padding: 9px 12px;\n border-inline-start: 2px solid var(--t-ink);\n background: var(--t-surface);\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.55;\n overflow-wrap: anywhere;\n}\n\n@container kanban-demo (max-width: 720px) {\n .tidal-scope .kanban-demo-toolbar {\n align-items: flex-start;\n padding: 14px;\n }\n\n .tidal-scope .kanban-demo-summary > span {\n display: none;\n }\n\n .tidal-scope .kanban-demo-stage {\n padding: 12px;\n }\n\n .tidal-scope .kanban-demo-detail {\n grid-template-columns: 46px minmax(0, 1fr);\n }\n\n .tidal-scope .kanban-demo-detail dl {\n grid-column: 1 / -1;\n }\n}\n\n@container kanban-demo (max-width: 390px) {\n\n .tidal-scope .kanban-demo-summary button {\n width: 44px;\n padding: 0;\n font-size: 0;\n }\n\n .tidal-scope .kanban-demo-detail {\n grid-template-columns: 1fr;\n }\n\n .tidal-scope .kanban-demo-detail-icon {\n display: none;\n }\n\n .tidal-scope .kanban-demo-detail dl {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n\n .tidal-scope .kanban-demo-detail dl > div {\n min-width: 0;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .kanban-demo-summary button {\n transition-duration: 0.01ms;\n }\n}"; type ColumnId = "backlog" | "progress" | "review"; type CardId = "brief" | "empty" | "navigation" | "tokens" | "qa"; const COLUMN_DEFINITIONS: readonly { id: ColumnId; title: string; description: string; }[] = [ { id: "backlog", title: "Backlog", description: "Ready to start" }, { id: "progress", title: "In progress", description: "Active local work" }, { id: "review", title: "Review", description: "Waiting for a read" }, ]; const CARD_LIBRARY: Record> = { brief: { id: "brief", title: "Confirm the page brief", accessibleName: "Confirm the page brief", eyebrow: "PLAN-12", description: "Resolve the final section order before implementation.", tags: ["Brief", "Structure"], meta: "Owner: Rowan · Sample priority: standard", }, empty: { id: "empty", title: "Write the empty state", accessibleName: "Write the empty state", eyebrow: "COPY-08", description: "Draft concise local copy for the zero-item view.", tags: ["Copy"], meta: "Owner: Mina · One sample note", }, navigation: { id: "navigation", title: "Build mobile navigation", accessibleName: "Build mobile navigation", eyebrow: "BUILD-24", description: "Keep every destination available at compact widths.", tags: ["Mobile", "Navigation"], meta: "Owner: Jules · Sample viewport: 390px", }, tokens: { id: "tokens", title: "Reconcile spacing tokens", accessibleName: "Reconcile spacing tokens", eyebrow: "SYSTEM-06", description: "Compare component spacing with the neutral token scale.", tags: ["System"], meta: "Owner: Rowan · Local reference only", }, qa: { id: "qa", title: "Review keyboard movement", accessibleName: "Review keyboard movement", eyebrow: "QA-19", description: "Exercise both native move buttons and the status update.", tags: ["Keyboard", "Review"], meta: "Owner: Mina · No device claim", }, }; const INITIAL_BOARD: Record = { backlog: ["brief", "empty"], progress: ["navigation", "tokens"], review: ["qa"], }; export function KanbanBoardDemo() { const generatedId = useId().replace(/:/g, ""); const detailTitleId = `kanban-demo-${generatedId}-detail-title`; const [board, setBoard] = useState(INITIAL_BOARD); const [selectedId, setSelectedId] = useState("navigation"); const [message, setMessage] = useState( "Use a card's arrow buttons to move it between adjacent columns.", ); const resetRef = useRef(null); const cardNodes = useRef(new Map()); const moveFocus = useRef<{ id: CardId; direction: "previous" | "next"; } | null>(null); useLayoutEffect(() => { const intent = moveFocus.current; if (!intent) return; moveFocus.current = null; const card = cardNodes.current.get(intent.id); const target = card?.querySelector( `button[data-direction="${intent.direction}"]:not(:disabled)`, ) ?? card?.querySelector("button:not(:disabled)"); target?.focus({ preventScroll: true }); }, [board]); const columns = useMemo( () => COLUMN_DEFINITIONS.map((definition) => ({ ...definition, accessibleName: definition.title, cards: board[definition.id].map((cardId) => { const card = CARD_LIBRARY[cardId]; return { ...card, cardRef: (node) => { if (node) cardNodes.current.set(cardId, node); else cardNodes.current.delete(cardId); }, footer: ( ), }; }), })), [board, selectedId], ); function moveCard(request: TidalKanbanMoveRequest) { const fromId = request.fromColumn.id as ColumnId; const toId = request.toColumn.id as ColumnId; const cardId = request.card.id as CardId; moveFocus.current = { id: cardId, direction: request.direction }; setBoard((current) => ({ ...current, [fromId]: current[fromId].filter((id) => id !== cardId), [toId]: [...current[toId], cardId], })); setSelectedId(cardId); setMessage( `${request.card.accessibleName} moved to ${request.toColumn.accessibleName} in this local preview.`, ); } function resetBoard() { moveFocus.current = null; setBoard(INITIAL_BOARD); setSelectedId("navigation"); setMessage("The local sample board was reset."); resetRef.current?.focus({ preventScroll: true }); } const selectedCard = CARD_LIBRARY[selectedId]; const selectedColumn = COLUMN_DEFINITIONS.find((column) => board[column.id].includes(selectedId), ); const totalCards = Object.values(board).reduce( (count, cardIds) => count + cardIds.length, 0, ); return (
{totalCards} cards {columns.length} columns
Fictional local data. Moving a card changes only this rendered React state. } />

{message}

); } export default function AgentExample() { return (
); }