Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(databases): fix styling and align kanban components and usage (#8049)
dev-rb43f0450dc62f
diff --git a/apps/web/src/components/kanban/kanban-board-content.tsx b/apps/web/src/components/kanban/kanban-board-content.tsxnew file mode 100644index 0000000000..8fcd335994--- /dev/null+++ b/apps/web/src/components/kanban/kanban-board-content.tsx@@ -0,0 +1,76 @@+import { cn } from '@ui';+import type { JSX } from 'solid-js';++export function ColumnLabel(props: { title: string; children: JSX.Element }) {+ return (+ <h2+ class="min-w-0 truncate text-sm font-medium text-ink"+ title={props.title}+ >+ {props.children}+ </h2>+ );+}++export function ColumnCount(props: { count: number; 'aria-label'?: string }) {+ return (+ <span+ class="shrink-0 text-xs tabular-nums text-ink-muted"+ aria-label={props['aria-label']}+ >+ {props.count}+ </span>+ );+}++export function CardHeader(props: { class?: string; children: JSX.Element }) {+ return (+ <div+ class={cn(+ 'grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 p-3 pb-2 last:pb-3 [&_[data-cell-display]]:min-h-6 [&_[data-cell-display]]:p-0 [&_[data-cell-display]]:text-sm [&_[data-cell-display]]:leading-6 [&_[data-cell-display]>span:last-child]:break-words [&_[data-cell-display]>span:last-child]:whitespace-normal',+ props.class+ )}+ >+ {props.children}+ </div>+ );+}++export function CardFields(props: { class?: string; children: JSX.Element }) {+ return (+ <div+ class={cn(+ 'flex flex-wrap items-center gap-1 px-3 pb-3 text-xs text-ink-muted [&_[data-cell-display]]:min-h-6 [&_[data-cell-display]]:p-0 [&_[data-cell-display]]:text-xs',+ props.class+ )}+ >+ {props.children}+ </div>+ );+}++export function CardActions(props: { children: JSX.Element }) {+ return (+ <div+ data-kanban-no-drag+ class="flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100"+ >+ {props.children}+ </div>+ );+}++/** Dashed end-of-board panel for an action beyond the existing lanes. */+export function ColumnPlaceholder(props: {+ 'aria-label': string;+ children: JSX.Element;+}) {+ return (+ <section+ aria-label={props['aria-label']}+ class="flex h-full min-h-40 w-full flex-col items-center gap-3 rounded-xl border border-dashed border-ink-extra-muted/25 p-4 pt-8 text-ink-muted"+ >+ {props.children}+ </section>+ );+}diff --git a/apps/web/src/components/kanban/kanban-board-types.ts b/apps/web/src/components/kanban/kanban-board-types.tsnew file mode 100644index 0000000000..9b82e8e6e7--- /dev/null+++ b/apps/web/src/components/kanban/kanban-board-types.ts@@ -0,0 +1,12 @@+/** Query-free column identity and the host-ordered item IDs. */+export type KanbanBoardColumn = {+ id: string;+ label: string;+ itemIds: readonly string[];+};++/** Reveal virtualized columns and creation controls without owning host drafts. */+export type KanbanBoardControls = {+ revealColumn(id: string): void;+ revealFooter(id: string): void;+};diff --git a/apps/web/src/components/kanban/kanban-board.tsx b/apps/web/src/components/kanban/kanban-board.tsxnew file mode 100644index 0000000000..ca833465e1--- /dev/null+++ b/apps/web/src/components/kanban/kanban-board.tsx@@ -0,0 +1,634 @@+import { Key } from '@solid-primitives/keyed';+import { Scroll } from '@ui/components/Scroll';+import {+ type Accessor,+ createContext,+ createEffect,+ createMemo,+ createSignal,+ createUniqueId,+ type JSX,+ on,+ onCleanup,+ Show,+ useContext,+} from 'solid-js';+import {+ Kanban,+ KanbanCard,+ KanbanCardInsertion,+ type KanbanDrop,+ type KanbanDropVisual,+ KanbanLane,+ useKanbanDropTarget,+} from './kanban';+import {+ createKanbanAnimation,+ type KanbanAnimationItem,+} from './kanban-animation';+import {+ CardActions,+ CardFields,+ CardHeader,+ ColumnCount,+ ColumnLabel,+ ColumnPlaceholder,+} from './kanban-board-content';+import type {+ KanbanBoardColumn,+ KanbanBoardControls,+} from './kanban-board-types';+import {+ createKanbanVirtualizer,+ type KanbanScrollSnapshot,+} from './kanban-virtualizer';+import { createKanbanWheelScroll } from './kanban-wheel-scroll';++const END_COLUMN_KEY = -1;++type Reveal = { toLane: string; scope?: string } & (+ | { kind: 'card'; id: string }+ | { kind: 'column' | 'footer' }+);++type BoardContextValue = {+ columns: Accessor<readonly KanbanBoardColumn[]>;+ animationScope: Accessor<string | undefined>;+ reveal: Accessor<Reveal | undefined>;+ onRevealed(request: Reveal): void;+ attachViewport(element: HTMLDivElement): () => void;+};++type ColumnContextValue = {+ column: Accessor<KanbanBoardColumn>;+ headerId: string;+ snapshot?: KanbanScrollSnapshot;+ onSnapshot(snapshot: KanbanScrollSnapshot): void;+};++const BoardContext = createContext<BoardContextValue>();+const ColumnContext = createContext<ColumnContextValue>();+const ColumnHoverContext = createContext<Accessor<boolean>>();++function useBoardContext() {+ const context = useContext(BoardContext);+ if (!context) throw new Error('KanbanBoard.Root is required');+ return context;+}++function useColumnContext() {+ const context = useContext(ColumnContext);+ if (!context) throw new Error('KanbanBoard.Columns is required');+ return context;+}++/** Shared board layout and drag lifecycle; hosts own item content and writes. */+function Root(props: {+ columns: readonly KanbanBoardColumn[];+ animationScope?: string;+ mode?: 'ordered' | 'cross-column';+ canMove?: (drop: Extract<KanbanDrop, { kind: 'card' }>) => boolean;+ onDrop(drop: KanbanDrop): void | boolean | Promise<void | boolean>;+ controlsRef?: (controls: KanbanBoardControls) => void;+ ref?: (element: HTMLDivElement) => void;+ children: JSX.Element;+}) {+ let viewport: HTMLDivElement | undefined;+ let revealGeneration = 0;+ const [reveal, setReveal] = createSignal<Reveal>();+ let disposed = false;+ props.controlsRef?.({+ revealColumn: (id) => requestReveal(id, 'column'),+ revealFooter: (id) => requestReveal(id, 'footer'),+ });+ function requestReveal(toLane: string, kind: 'column' | 'footer') {+ if (disposed) return;+ revealGeneration += 1;+ setReveal({ kind, toLane, scope: props.animationScope });+ }+ const motion = createKanbanAnimation({+ viewport: () => viewport,+ items: () => {+ if (!viewport) {+ return [];+ }++ const items: KanbanAnimationItem[] = [];++ for (const layout of viewport.querySelectorAll<HTMLElement>(+ '[data-kanban-board-column]'+ )) {+ const element = layout.firstElementChild;++ if (!(element instanceof HTMLElement)) {+ continue;+ }++ const key = JSON.stringify([+ 'column',+ layout.dataset.kanbanBoardColumn,+ ]);+ items.push({ key, element, layout });++ for (const card of element.querySelectorAll<HTMLElement>(+ '[data-kanban-card]'+ )) {+ const row = card.parentElement;++ if (!row) {+ continue;+ }++ items.push({+ key: JSON.stringify([key, card.dataset.kanbanCard]),+ identity: card.dataset.kanbanCard,+ parentKey: key,+ element: card,+ layout: row,+ });+ }+ }++ return items;+ },+ });++ let finishHover: (() => void) | undefined;+ const endHover = () => {+ finishHover?.();+ finishHover = undefined;+ document.removeEventListener('mouseup', endHover);+ };+ const startHover = (event: MouseEvent) => {+ if (+ !(event.target instanceof Element) ||+ !event.target.closest('[data-kanban-card]')+ ) {+ return;+ }++ endHover();+ finishHover = motion.beginHover();+ document.addEventListener('mouseup', endHover);+ };++ createEffect(+ on(+ () => props.animationScope,+ () => {+ revealGeneration += 1;+ setReveal(undefined);+ motion.cancel();+ }+ )+ );+ onCleanup(() => {+ disposed = true;+ viewport?.removeEventListener('mousedown', startHover);+ endHover();+ motion.cancel();+ });++ const context: BoardContextValue = {+ columns: () => props.columns,+ animationScope: () => props.animationScope,+ reveal,+ onRevealed: (request) =>+ setReveal((current) => (current === request ? undefined : current)),+ attachViewport: (element) => {+ viewport?.removeEventListener('mousedown', startHover);+ viewport = element;+ viewport.addEventListener('mousedown', startHover);+ props.ref?.(element);++ return () => {+ if (viewport !== element) return;+ element.removeEventListener('mousedown', startHover);+ viewport = undefined;+ revealGeneration += 1;+ setReveal(undefined);+ endHover();+ motion.cancel();+ };+ },+ };++ const canDropCard = (drop: Extract<KanbanDrop, { kind: 'card' }>) =>+ props.canMove?.(drop) ?? true;++ function commitDrop(drop: KanbanDrop, visual?: KanbanDropVisual) {+ if (drop.kind === 'lane') {+ void props.onDrop(drop);+ return;+ }+ if (!canDropCard(drop)) return;+ const sourceParentKey = JSON.stringify(['column', drop.fromLane]);+ const finish = motion.begin(+ drop.id,+ JSON.stringify(['column', drop.toLane]),+ visual+ ? {+ ...visual,+ key: JSON.stringify([sourceParentKey, drop.id]),+ parentKey: sourceParentKey,+ }+ : undefined+ );+ const scope = props.animationScope;+ const generation = ++revealGeneration;+ setReveal(undefined);+ async function saveAndReveal() {+ try {+ const moved = await props.onDrop(drop);+ if (+ moved !== false &&+ generation === revealGeneration &&+ props.animationScope === scope+ ) {+ setReveal({ kind: 'card', id: drop.id, toLane: drop.toLane, scope });+ }+ } finally {+ finish();+ }+ }+ void saveAndReveal();+ }++ const dragProps =+ props.mode === 'cross-column'+ ? {+ mode: 'cross-column' as const,+ targetActivationSpeed: 600,+ canDropCard,+ onDrop: commitDrop,+ }+ : {+ mode: 'ordered' as const,+ pointerPlacement: true,+ canDropCard,+ onDrop: commitDrop,+ };+ return (+ <BoardContext.Provider value={context}>+ <Kanban {...dragProps} getViewport={() => viewport}>+ {props.children}+ </Kanban>+ </BoardContext.Provider>+ );+}++/** Virtualizes columns and an optional final column supplied by the caller. */+function Columns(props: {+ children(column: Accessor<KanbanBoardColumn>): JSX.Element;+ endColumn?: () => JSX.Element;+ /** The board's accessible name; boards of other items name their own. */+ 'aria-label'?: string;+}) {+ const board = useBoardContext();+ let viewport: HTMLDivElement | undefined;+ let releaseViewport: (() => void) | undefined;+ const scrollSnapshots = new Map<string, KanbanScrollSnapshot>();+ const wheel = createKanbanWheelScroll({+ viewport: () => viewport,+ verticalViewport: (target) =>+ target.closest<HTMLElement>('[data-kanban-board-scroll]') ??+ target+ .closest('[data-kanban-lane]')+ ?.querySelector<HTMLElement>('[data-kanban-board-scroll]') ??+ null,+ });+ onCleanup(() => {+ wheel.reset();+ releaseViewport?.();+ });+ createEffect(on(board.animationScope, wheel.reset));+ const columnsById = createMemo(+ () => new Map(board.columns().map((column) => [column.id, column]))+ );+ const virtualizer = createKanbanVirtualizer({+ direction: 'horizontal',+ keys: () => {+ const keys: (string | number)[] = board+ .columns()+ .map((column) => column.id);++ if (props.endColumn) {+ keys.push(END_COLUMN_KEY);+ }++ return keys;+ },+ getScrollElement: () => viewport,+ estimateSize: 336,+ gap: 16,+ overscan: 1,+ paddingStart: 16,+ paddingEnd: 16,+ });+ const virtualItems = createMemo(() =>+ virtualizer.getVirtualItems().map((item) => ({ ...item }))+ );+ createEffect(() => {+ const request = board.reveal();+ const columns = board.columns();+ if (!request || request.scope !== board.animationScope()) return;+ const index = columns.findIndex((column) => column.id === request.toLane);+ if (index < 0) return;+ if (request.kind === 'card' && !columns[index].itemIds.includes(request.id))+ return;+ virtualizer.scrollToIndex(index, { align: 'auto' });+ if (request.kind === 'column') board.onRevealed(request);+ });++ return (+ <Scroll+ orientation="horizontal"+ scrollbars="horizontal"+ autoHide={false}+ scrollRef={(element) => {+ releaseViewport?.();+ viewport = element;+ releaseViewport = board.attachViewport(element);+ }}+ onWheel={wheel.onWheel}+ class="ph-no-capture min-h-0 min-w-0 w-full flex-1"+ viewportProps={{+ tabindex: -1,+ role: 'region',+ 'aria-label': props['aria-label'] ?? 'Kanban board',+ 'data-kanban-board-viewport': '',+ class: 'pt-1 pb-4 outline-none',+ }}+ contentProps={{ style: { height: '100%' } }}+ >+ <div+ class="relative h-full min-w-full"+ data-kanban-board-columns+ style={{ width: `${virtualizer.getTotalSize()}px` }}+ >+ <Key each={virtualItems()} by="key">+ {(item) => {+ const key = item().key;+ return (+ <div+ class="absolute top-0 h-full"+ data-kanban-board-column={key}+ style={{+ left: `${item().start}px`,+ width: `${item().size}px`,+ }}+ >+ <Show when={key === END_COLUMN_KEY}>{props.endColumn?.()}</Show>+ <Show when={columnsById().get(String(key))}>+ {(column) => {+ // Cleanup runs after Show invalidates its column accessor.+ const columnId = column().id;+ const context: ColumnContextValue = {+ column,+ headerId: createUniqueId(),+ snapshot: scrollSnapshots.get(columnId),+ onSnapshot: (snapshot) => {+ scrollSnapshots.set(columnId, snapshot);+ },+ };++ return (+ <ColumnContext.Provider value={context}>+ {props.children(column)}+ </ColumnContext.Provider>+ );+ }}+ </Show>+ </div>+ );+ }}+ </Key>+ </div>+ </Scroll>+ );+}++function Column(props: {+ canReorder?: boolean;+ onKeyDown?: JSX.EventHandlerUnion<HTMLElement, KeyboardEvent>;+ children: JSX.Element;+}) {+ const { column, headerId } = useColumnContext();+ const [hovered, setHovered] = createSignal(false);++ return (+ <ColumnHoverContext.Provider value={hovered}>+ <KanbanLane+ id={column().id}+ label={column().label}+ canReorder={props.canReorder}+ onKeyDown={props.onKeyDown}+ aria-labelledby={headerId}+ class="max-h-full min-h-0 w-84"+ onPointerEnter={() => setHovered(true)}+ onPointerLeave={() => setHovered(false)}+ >+ {props.children}+ </KanbanLane>+ </ColumnHoverContext.Provider>+ );+}++function Header(props: { children: JSX.Element }) {+ const { headerId } = useColumnContext();++ return (+ <header+ id={headerId}+ class="flex min-w-0 shrink-0 items-center gap-2 px-2 pt-1 pb-2"+ >+ {props.children}+ </header>+ );+}++function DropOverlay(props: { children: JSX.Element }) {+ const { column } = useColumnContext();+ const target = useKanbanDropTarget();++ return (+ <Show when={target()?.kind === 'card' && target()?.toLane === column().id}>+ <div+ aria-hidden="true"+ class="pointer-events-none absolute inset-2 z-20 flex items-center justify-center rounded-lg bg-surface-0/95 p-4 text-center text-sm font-medium text-ink"+ >+ {props.children}+ </div>+ </Show>+ );+}++/** Owns the vertical viewport and row measurements; card content stays with the caller. */+function Cards(props: {+ children(id: string): JSX.Element;+ empty?: JSX.Element;+ footer?: JSX.Element;+ /** What the cards are, for each column's accessible name. */+ itemsLabel?: string;+}) {+ const board = useBoardContext();+ const lane = useColumnContext();+ const hovered = useContext(ColumnHoverContext);+ if (!hovered) throw new Error('KanbanBoard.Column is required');+ let viewport: HTMLDivElement | undefined;+ const rows = () => lane.column().itemIds;+ const virtualizer = createKanbanVirtualizer({+ direction: 'vertical',+ laneId: () => lane.column().id,+ keys: rows,+ getScrollElement: () => viewport,+ estimateSize: 104,+ gap: 12,+ overscan: 3,+ // Keep the before-first-card marker inside the lane's scroll clip.+ paddingStart: 8,+ snapshot: lane.snapshot,+ });+ const virtualItems = createMemo(() =>+ virtualizer.getVirtualItems().map((item) => ({ ...item }))+ );++ createEffect(() => {+ const request = board.reveal();+ const mountedRows = virtualItems();+ const scrollElement = virtualizer.scrollElement;+ if (+ !request ||+ request.scope !== board.animationScope() ||+ request.toLane !== lane.column().id ||+ !scrollElement?.isConnected+ )+ return;+ if (request.kind === 'footer') {+ queueMicrotask(() => {+ if (board.reveal() !== request || !scrollElement.isConnected) return;+ scrollElement.scrollTop = scrollElement.scrollHeight;+ board.onRevealed(request);+ });+ return;+ }+ if (request.kind !== 'card' || !mountedRows.length) return;+ const row = rows().indexOf(request.id);+ if (row < 0) return;+ virtualizer.scrollToIndex(row, { align: 'auto' });+ queueMicrotask(() => board.onRevealed(request));+ });++ onCleanup(() => {+ lane.onSnapshot({+ offset: viewport?.scrollTop ?? 0,+ measurements: virtualizer.takeSnapshot(),+ });+ });++ return (+ <Scroll+ orientation="vertical"+ scrollbars="vertical"+ autoHide+ autoHideDelay={200}+ revealOn="hover"+ hovered={hovered()}+ fill={false}+ scrollRef={(element) => {+ viewport = element;+ }}+ class="min-h-0 flex-auto"+ viewportProps={{+ role: 'region',+ 'aria-label': `${lane.column().label} ${props.itemsLabel ?? 'items'}`,+ 'aria-labelledby': lane.headerId,+ tabindex: 0,+ 'data-kanban-board-scroll': lane.column().id,+ 'data-kanban-scroll': '',+ style: { 'overflow-anchor': 'none' },+ }}+ >+ <div+ class="relative w-full"+ data-kanban-board-rows+ style={{ height: `${virtualizer.getTotalSize()}px` }}+ >+ <Key each={virtualItems()} by="key">+ {(item) => {+ const key = String(item().key);+ let row: HTMLDivElement | undefined;++ createEffect(+ on(+ () => item().index,+ () => {+ // Measure after content mounts, and again if a stable key moves.+ queueMicrotask(() => {+ if (row?.isConnected) {+ virtualizer.measureElement(row);+ }+ });+ }+ )+ );++ return (+ <div+ ref={row}+ data-index={item().index}+ data-kanban-card-layout+ data-kanban-next-id={rows()[item().index + 1]}+ class="absolute left-0 top-0 w-full"+ style={{ transform: `translateY(${item().start}px)` }}+ >+ {props.children(key)}+ </div>+ );+ }}+ </Key>+ <KanbanCardInsertion laneId={lane.column().id} />+ </div>+ <Show when={rows().length === 0}>{props.empty}</Show>+ {props.footer}+ </Scroll>+ );+}++function Card(props: {+ id: string;+ canDrag: boolean;+ pending?: boolean;+ onClick?: JSX.EventHandler<HTMLElement, MouseEvent>;+ children: JSX.Element;+}) {+ const { column } = useColumnContext();++ return (+ <KanbanCard+ id={props.id}+ laneId={column().id}+ canDrag={props.canDrag}+ pending={props.pending}+ onClick={props.onClick}+ >+ {props.children}+ </KanbanCard>+ );+}++export const KanbanBoard = {+ Root,+ Columns,+ Column,+ Header,+ ColumnLabel,+ ColumnCount,+ ColumnPlaceholder,+ CardHeader,+ CardFields,+ CardActions,+ DropOverlay,+ Cards,+ Card,+};diff --git a/apps/web/src/components/kanban/kanban-virtualizer.test.ts b/apps/web/src/components/kanban/kanban-virtualizer.test.tsnew file mode 100644index 0000000000..34beb0512b--- /dev/null+++ b/apps/web/src/components/kanban/kanban-virtualizer.test.ts@@ -0,0 +1,89 @@+import type { Range } from '@tanstack/solid-virtual';+import { createRoot } from 'solid-js';+import { afterEach, expect, it, vi } from 'vitest';+import { createKanbanVirtualizer } from './kanban-virtualizer';++type DragSource = { kind: 'card' | 'lane'; laneId: string; itemId: string };+const drag = vi.hoisted(() => ({+ source: undefined as DragSource | undefined,+}));+const captured = vi.hoisted(() => ({+ options: undefined as { rangeExtractor(range: Range): number[] } | undefined,+}));++vi.mock('@thisbeyond/solid-dnd', () => ({+ useDragDropContext: () => [+ {+ active: {+ get draggable() {+ return drag.source ? { data: drag.source } : undefined;+ },+ },+ },+ { detectCollisions: vi.fn() },+ ],+}));+vi.mock('@tanstack/solid-virtual', async (importOriginal) => ({+ ...(await importOriginal<typeof import('@tanstack/solid-virtual')>()),+ createVirtualizer: (options: { rangeExtractor(range: Range): number[] }) => {+ captured.options = options;+ return { getVirtualItems: () => [] };+ },+}));++afterEach(() => {+ drag.source = undefined;+ captured.options = undefined;+});++function range(direction: 'horizontal' | 'vertical', laneId = 'lane-0') {+ return createRoot((dispose) => {+ const options = {+ keys: () =>+ Array.from(+ { length: 10 },+ (_, index) =>+ `${direction === 'horizontal' ? 'lane' : 'card'}-${index}`+ ),+ getScrollElement: () => undefined,+ estimateSize: 100,+ gap: 12,+ overscan: 1,+ };+ createKanbanVirtualizer(+ direction === 'horizontal'+ ? { ...options, direction }+ : { ...options, direction, laneId: () => laneId }+ );+ const indices = captured.options!.rangeExtractor({+ startIndex: 3,+ endIndex: 5,+ overscan: 1,+ count: 10,+ });+ dispose();+ return indices;+ });+}++it('keeps a dragged lane mounted when horizontal scrolling moves the lane offscreen', () => {+ drag.source = { kind: 'lane', laneId: 'lane-0', itemId: 'lane-0' };+ expect(range('horizontal')).toEqual([0, 2, 3, 4, 5, 6]);+});++it('keeps a card source lane mounted when horizontal scrolling moves the lane offscreen', () => {+ drag.source = { kind: 'card', laneId: 'lane-0', itemId: 'card-0' };+ expect(range('horizontal')).toEqual([0, 2, 3, 4, 5, 6]);+});++it('pins a dragged card only within its own vertical lane', () => {+ drag.source = { kind: 'card', laneId: 'lane-0', itemId: 'card-0' };+ expect(range('vertical')).toEqual([0, 2, 3, 4, 5, 6]);+ expect(range('vertical', 'lane-1')).toEqual([2, 3, 4, 5, 6]);+});++it('does not pin a card for a lane drag or duplicate an already visible source lane', () => {+ drag.source = { kind: 'lane', laneId: 'lane-3', itemId: 'lane-3' };+ expect(range('horizontal')).toEqual([2, 3, 4, 5, 6]);+ expect(range('vertical')).toEqual([2, 3, 4, 5, 6]);+});diff --git a/apps/web/src/components/kanban/kanban-virtualizer.ts b/apps/web/src/components/kanban/kanban-virtualizer.tsindex 6ae2816e32..9d943dbb82 100644--- a/apps/web/src/components/kanban/kanban-virtualizer.ts+++ b/apps/web/src/components/kanban/kanban-virtualizer.ts@@ -68,15 +68,13 @@ export function createKanbanVirtualizer(options: KanbanVirtualizerOptions) {const pinnedIndex = () => {const source = state.active.draggable?.data;- if (source?.kind !== 'card') {- return -1;- }-if (options.direction === 'horizontal') {- return options.keys().indexOf(source.laneId);+ return source?.kind === 'card' || source?.kind === 'lane'+ ? options.keys().indexOf(source.laneId)+ : -1;}- if (source.laneId !== options.laneId()) {+ if (source?.kind !== 'card' || source.laneId !== options.laneId()) {return -1;}diff --git a/apps/web/src/components/kanban/kanban.tsx b/apps/web/src/components/kanban/kanban.tsxindex b58fe38d4a..0ccdafe151 100644--- a/apps/web/src/components/kanban/kanban.tsx+++ b/apps/web/src/components/kanban/kanban.tsx@@ -1,3 +1,4 @@+import { autoUpdate } from '@floating-ui/dom';import {type CollisionDetector,createDraggable,@@ -11,9 +12,11 @@ import {createSignal,type JSX,onCleanup,+ onMount,Show,useContext,} from 'solid-js';+import { Portal } from 'solid-js/web';import { cloneDragPreview } from '../drag-drop/drag-preview';import { DragSessionSensors } from '../drag-drop/drag-session-sensors';import { findKanbanCollision, LANE_INSERTION_INSET } from './kanban-collision';@@ -294,20 +297,74 @@ export function KanbanCardInsertion(props: {return (<Show when={active()}>+ <CardInsertionMarker {...props} />+ </Show>+ );+}++/** Paint above the drag preview without escaping either board scroll clip. */+function CardInsertionMarker(props: { laneId: string; beforeId?: string }) {+ let anchor!: HTMLSpanElement;+ let marker!: HTMLSpanElement;+ onMount(() => {+ const update = () => {+ const rect = anchor.getBoundingClientRect();+ let left = 0;+ let right = 0;+ let top = -1;+ let bottom = -1;+ for (const viewport of [+ anchor.closest('[data-kanban-scroll]'),+ anchor.closest('[data-kanban-board-viewport]'),+ ]) {+ if (!viewport) continue;+ const clip = viewport.getBoundingClientRect();+ left = Math.max(left, clip.left - rect.left);+ right = Math.max(right, rect.right - clip.right);+ top = Math.max(top, clip.top - rect.top);+ bottom = Math.max(bottom, rect.bottom - clip.bottom);+ }+ marker.style.left = `${rect.left}px`;+ marker.style.top = `${rect.top}px`;+ marker.style.width = `${rect.width}px`;+ marker.style.height = `${rect.height}px`;+ marker.style.clipPath = `inset(${top}px ${right}px ${bottom}px ${left}px)`;+ marker.style.setProperty(+ '--color-accent',+ getComputedStyle(anchor).backgroundColor+ );+ marker.style.visibility =+ left + right < rect.width && top + bottom < rect.height+ ? 'visible'+ : 'hidden';+ };+ onCleanup(autoUpdate(anchor, marker, update));+ });+ return (+ <><span+ ref={anchor}aria-hidden="true"- data-kanban-insertion="card"- data-lane-id={props.laneId}- data-before-row-id={props.beforeId}class={cn(- 'pointer-events-none absolute -inset-x-2 z-10 h-0.5 rounded-full bg-accent',+ 'pointer-events-none invisible absolute -inset-x-2 h-0.5 bg-accent',props.beforeId ? '-top-1.5' : '-bottom-1.5')}- >- <span class="absolute top-1/2 left-0 size-1 -translate-y-1/2 rounded-full bg-accent" />- <span class="absolute top-1/2 right-0 size-1 -translate-y-1/2 rounded-full bg-accent" />- </span>- </Show>+ />+ <Portal>+ <span+ ref={marker}+ aria-hidden="true"+ data-kanban-insertion="card"+ data-lane-id={props.laneId}+ data-before-row-id={props.beforeId}+ class="pointer-events-none fixed z-[1001] rounded-full bg-accent"+ style={{ visibility: 'hidden' }}+ >+ <span class="absolute top-1/2 left-0 size-1 -translate-y-1/2 rounded-full bg-accent" />+ <span class="absolute top-1/2 right-0 size-1 -translate-y-1/2 rounded-full bg-accent" />+ </span>+ </Portal>+ </>);}@@ -370,7 +427,7 @@ export function KanbanLane(props: {droppable.ref(node);}}class={cn(- 'relative flex w-72 shrink-0 flex-col rounded-xl border border-transparent bg-surface-1 p-2 transition-colors',+ 'relative flex w-72 shrink-0 flex-col rounded-xl border border-edge-frame bg-[color-mix(in_oklch,var(--color-panel)_94%,var(--color-ink))] p-2 transition-colors',draggable.isActiveDraggable && 'opacity-35',highlighted() && 'ring-2 ring-accent',props.classdiff --git a/apps/web/src/components/ui/components/DeleteDialog.tsx b/apps/web/src/components/ui/components/DeleteDialog.tsxindex e5cd62b05f..0894222583 100644--- a/apps/web/src/components/ui/components/DeleteDialog.tsx+++ b/apps/web/src/components/ui/components/DeleteDialog.tsx@@ -102,7 +102,7 @@ export function DeleteDialog(props: DeleteDialogProps) {</Button><Buttontype="button"- variant="strong"+ variant="danger"depth={2}disabled={!canDelete()}onClick={deleteItem}diff --git a/apps/web/src/features/database/components/board-lane-header.tsx b/apps/web/src/features/database/components/board-lane-header.tsxnew file mode 100644index 0000000000..2ca8c2c494--- /dev/null+++ b/apps/web/src/features/database/components/board-lane-header.tsx@@ -0,0 +1,311 @@+import { Popover } from '@kobalte/core/popover';+import DotsIcon from '@phosphor/dots-three.svg';+import PlusIcon from '@phosphor/plus.svg';+import TrashIcon from '@phosphor/trash.svg';+import { ColorSwatches } from '@property/tags/components/color-swatches';+import { Button } from '@ui/components/Button';+import { DeleteDialog } from '@ui/components/DeleteDialog';+import { Dropdown } from '@ui/components/Dropdown';+import { createSignal, createUniqueId, type JSX, Show } from 'solid-js';+import { KanbanBoard } from '../../../components/kanban/kanban-board';+import { toast } from '../../../lib/core/component/Toast/Toast';+import {+ type OptionEditing,+ useOptionEditing,+} from '../context/option-editing';+import { inferDatabaseNumber } from '../core/column-inference';+import type { DatabaseOption, DatabaseViewColumn } from '../core/database-view';+import { isDatabaseNameTaken } from '../core/property-creation';+import { databaseOpMessage } from '../core/write-failure';+import { createInlineRename } from './inline-rename';++type EditableOption = {+ column: DatabaseViewColumn;+ option: DatabaseOption;+ editing: OptionEditing;+};++/** Option edits live on the dot and name; lane actions share one menu. */+export function BoardLaneHeader(props: {+ column: DatabaseViewColumn;+ option: DatabaseOption | null;+ label: string;+ count: number;+ canEdit: boolean;+ icon: JSX.Element;+ children: JSX.Element;+ onHide?: () => void;+ onAdd?: () => void;+}) {+ const editing = useOptionEditing();+ const editable = (): EditableOption | undefined =>+ props.canEdit && props.column.writable && props.option && editing+ ? { column: props.column, option: props.option, editing }+ : undefined;+ return (+ <>+ <Show when={editable()} fallback={props.icon}>+ {(option) => <LaneColor option={option()}>{props.icon}</LaneColor>}+ </Show>+ <Show when={editable()} fallback={props.children}>+ {(option) => <LaneName option={option()} />}+ </Show>+ <KanbanBoard.ColumnCount+ count={props.count}+ aria-label={`${props.count} records`}+ />+ <span+ class="ml-auto flex shrink-0 items-center gap-0.5"+ data-kanban-no-drag+ >+ <Show when={props.onHide || editable()}>+ <LaneMenu+ label={props.label}+ option={editable()}+ onHide={props.onHide}+ />+ </Show>+ <Show when={props.onAdd}>+ <Button+ size="icon-xs"+ label={`Add record to ${props.label}`}+ tooltipDisabled+ title={`Add record to ${props.label}`}+ onClick={props.onAdd}+ >+ <PlusIcon class="size-3.5" />+ </Button>+ </Show>+ </span>+ </>+ );+}++function LaneName(props: { option: EditableOption }) {+ const errorId = createUniqueId();+ let input: HTMLInputElement | undefined;+ let trigger: HTMLButtonElement | undefined;+ const rename = createInlineRename({+ name: (current: EditableOption) => current.option.label,+ rename: (current, label) =>+ current.editing.update(current.column.id, current.option.id, { label }),+ failureMessage: (failure) => databaseOpMessage(failure, 'this group'),+ emptyName: { message: 'Enter a group name.', onBlur: 'cancel' },+ validate: (label, current) => {+ if (+ isDatabaseNameTaken(+ label,+ current.column.options+ .filter((entry) => entry.id !== current.option.id)+ .map((entry) => entry.label)+ )+ )+ return 'Another option already has this name.';+ if (+ current.column.dataType === 'SELECT_NUMBER' &&+ inferDatabaseNumber(label) === undefined+ )+ return 'Enter a number.';+ },+ input: () => input,+ restoreFocus: () => trigger?.focus(),+ });+ return (+ <div class="relative min-w-0" data-kanban-no-drag>+ {/* Keep the title in flow so the field starts at the same size. */}+ <KanbanBoard.ColumnLabel title={props.option.option.label}>+ <button+ ref={trigger}+ type="button"+ class="block max-w-full truncate rounded text-left outline-none hover:bg-hover focus-visible:ring-2 focus-visible:ring-ink/50"+ classList={{ invisible: !!rename.target() }}+ aria-hidden={rename.target() ? true : undefined}+ tabIndex={rename.target() ? -1 : 0}+ aria-label={`Rename ${props.option.option.label}`}+ onClick={() => rename.begin(props.option)}+ >+ {rename.target()+ ? rename.draft() || '\u00a0'+ : props.option.option.label}+ </button>+ </KanbanBoard.ColumnLabel>+ <Show when={rename.target()}>+ <input+ ref={input}+ value={rename.draft()}+ maxlength={200}+ aria-label="Group name"+ aria-invalid={!!rename.error()}+ aria-describedby={rename.error() ? errorId : undefined}+ readOnly={rename.pending()}+ class="absolute inset-0 h-full min-w-0 w-full rounded border-0 bg-input p-0 text-sm font-medium text-ink outline-none focus:ring-2 focus:ring-ink/50"+ onFocus={(event) => {+ const field = event.currentTarget;+ // Run after inline rename selects the name, which scrolls long inputs.+ queueMicrotask(() => {+ if (+ field.selectionStart === 0 &&+ field.selectionEnd === field.value.length+ )+ field.scrollLeft = 0;+ });+ }}+ onInput={(event) => rename.setDraft(event.currentTarget.value)}+ onBlur={() => void rename.save(false)}+ onKeyDown={(event) => {+ if (event.isComposing) return;+ if (event.key === 'Escape') {+ event.preventDefault();+ event.stopPropagation();+ rename.cancel(true);+ } else if (event.key === 'Enter') {+ event.preventDefault();+ event.stopPropagation();+ void rename.save(true);+ }+ }}+ />+ <Show when={rename.error()}>+ <p+ id={errorId}+ role="alert"+ class="absolute top-full left-0 z-action-menu mt-1 w-56 rounded-md border border-edge-muted bg-panel p-2 text-xs text-failure-ink shadow-sm"+ >+ {rename.error()}+ </p>+ </Show>+ </Show>+ </div>+ );+}++function LaneColor(props: { option: EditableOption; children: JSX.Element }) {+ const [error, setError] = createSignal('');+ return (+ <Popover+ placement="bottom-start"+ gutter={6}+ onOpenChange={() => setError('')}+ >+ <Popover.Trigger+ as={Button}+ size="icon-xs"+ label={`Change ${props.option.option.label} color`}+ tooltipDisabled+ data-kanban-no-drag+ >+ {props.children}+ </Popover.Trigger>+ <Popover.Portal>+ <Popover.Content class="menu-surface z-action-menu w-56 p-2.5 text-xs outline-none">+ <Popover.Title class="mb-2 font-medium">Group color</Popover.Title>+ <ColorSwatches+ size="sm"+ value={props.option.option.color}+ onChange={(color) =>+ void props.option.editing+ .update(props.option.column.id, props.option.option.id, {+ color: color.color,+ })+ .mapErr((failure) =>+ setError(databaseOpMessage(failure, 'this group'))+ )+ }+ />+ <Show when={props.option.column.sharedOutsideDatabase}>+ <p class="mt-2 text-ink-muted">+ Changes everywhere this property is used.+ </p>+ </Show>+ <Show when={error()}>+ <p role="alert" class="mt-2 text-failure-ink">+ {error()}+ </p>+ </Show>+ </Popover.Content>+ </Popover.Portal>+ </Popover>+ );+}++function LaneMenu(props: {+ label: string;+ option?: EditableOption;+ onHide?: () => void;+}) {+ const [confirming, setConfirming] = createSignal(false);+ const [pending, setPending] = createSignal(false);+ let deleteRequested = false;+ function finishMenuClose() {+ if (!deleteRequested) return;+ deleteRequested = false;+ // Let the menu release its modal state and restore focus before the dialog opens.+ queueMicrotask(() => setConfirming(true));+ }+ async function remove() {+ const option = props.option;+ if (!option || pending()) return;+ setPending(true);+ const result = await option.editing.remove(+ option.column.id,+ option.option.id+ );+ setPending(false);+ result.match(+ () => setConfirming(false),+ (failure) => toast.failure(databaseOpMessage(failure, 'this group'))+ );+ }+ return (+ <>+ <Dropdown>+ <Dropdown.Trigger+ variant="ghost"+ size="icon-xs"+ aria-label={`${props.label} lane menu`}+ >+ <DotsIcon class="size-4" />+ </Dropdown.Trigger>+ <Dropdown.Content class="min-w-44" onCloseAutoFocus={finishMenuClose}>+ <Dropdown.Group>+ <Show when={props.onHide}>+ <Dropdown.Item onSelect={props.onHide}>Hide lane</Dropdown.Item>+ </Show>+ <Show when={props.option}>+ <Dropdown.Item+ class="text-failure-ink"+ onSelect={() => {+ deleteRequested = true;+ }}+ >+ <TrashIcon class="size-3.5" />+ Delete group+ </Dropdown.Item>+ </Show>+ </Dropdown.Group>+ </Dropdown.Content>+ </Dropdown>+ <DeleteDialog+ open={confirming()}+ onOpenChange={setConfirming}+ pending={pending()}+ title={`Delete “${props.label}”?`}+ deleteLabel={pending() ? 'Deleting…' : 'Delete group'}+ onDelete={() => void remove()}+ body={+ <>+ <p>+ Cells using “{props.label}” will be cleared. Records will not be+ deleted.+ </p>+ <Show when={props.option?.column.sharedOutsideDatabase}>+ <p class="mt-2">+ This change affects everywhere this property is used.+ </p>+ </Show>+ </>+ }+ />+ </>+ );+}diff --git a/apps/web/src/features/database/components/board-menu.tsx b/apps/web/src/features/database/components/board-menu.tsxindex cc92fb4d19..87f1680ff8 100644--- a/apps/web/src/features/database/components/board-menu.tsx+++ b/apps/web/src/features/database/components/board-menu.tsx@@ -21,7 +21,7 @@ type BoardMenuItemProps = {export function BoardMenu(props: BoardMenuItemProps) {return (<Dropdown>- <Dropdown.Trigger variant="ghost" size="icon-sm" aria-label="Board menu">+ <Dropdown.Trigger variant="ghost" size="md" square label="Board menu"><DotsIcon class="size-4" /></Dropdown.Trigger><Dropdown.Content class="min-w-48">@@ -108,12 +108,16 @@ function HideEmptyLanesItem(props: BoardMenuItemProps) {return (<Dropdown.CheckboxItemchecked={props.layout.hideEmptyLanes}+ indicator={false}onChange={(hideEmptyLanes) =>props.onChange({ ...props.layout, hideEmptyLanes })}closeOnSelect={false}>- Hide empty lanes+ <span class="flex-1">Hide empty lanes</span>+ <Dropdown.ItemIndicator>+ <CheckIcon class="size-3.5" />+ </Dropdown.ItemIndicator></Dropdown.CheckboxItem>);}diff --git a/apps/web/src/features/database/components/database-board.drag.test.tsx b/apps/web/src/features/database/components/database-board.drag.test.tsxindex a4c64cd54f..e560cb952f 100644--- a/apps/web/src/features/database/components/database-board.drag.test.tsx+++ b/apps/web/src/features/database/components/database-board.drag.test.tsx@@ -1,3 +1,4 @@+import '../tests/board-layout';import {cleanup,fireEvent,@@ -18,17 +19,21 @@ beforeEach(() => {vi.spyOn(window, 'scrollTo').mockImplementation(() => {});vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (this: HTMLElement) {- if (this.classList.contains('overflow-auto'))+ if (this.hasAttribute('data-kanban-board-viewport'))return new DOMRect(0, 0, 880, 500);const lane = this.closest('[data-kanban-lane]');const label = lane?.getAttribute('aria-label');const x =(label === 'To do lane' ? 300 : label === 'Later lane' ? 600 : 0) -scrollOffset;+ const card = this.hasAttribute('data-kanban-card-layout')+ ? this.querySelector('[data-kanban-card]')+ : this;const cardIndex = lane- ? Array.from(lane.querySelectorAll('[data-kanban-card]')).indexOf(this)+ ? Array.from(lane.querySelectorAll('[data-kanban-card]')).indexOf(card!): 0;- return this.hasAttribute('data-row-id')+ return this.hasAttribute('data-row-id') ||+ this.hasAttribute('data-kanban-card-layout')? new DOMRect(x + 8, 60 + Math.max(0, cardIndex) * 100, 264, 80): new DOMRect(x, 0, 280, 500);}@@ -338,7 +343,7 @@ describe('board card drag', () => {/>));fireEvent.mouseDown(- screen.getByRole('button', { name: 'Open Last card' }),+ screen.getByRole('button', { name: 'Drag Last card' }),{button: 0,clientX: 40,@@ -349,6 +354,8 @@ describe('board card drag', () => {expect(marker()).toBeNull();movePointer(40, 70);expect(marker()?.dataset.beforeRowId).toBe('first');+ // The marker escapes the virtual row's stacking context above the preview.+ expect(marker()?.closest('[data-kanban-lane]')).toBeNull();dropPointer(40, 70);await waitFor(() =>expect(onMove).toHaveBeenCalledWith(@@ -704,7 +711,7 @@ describe('board lane drag', () => {);movePointer(560, 20);scrollOffset = 300;- fireEvent.scroll(document.querySelector('.overflow-auto')!);+ fireEvent.scroll(document.querySelector('[data-kanban-board-viewport]')!);expect(marker()?.closest('[data-kanban-lane]')?.getAttribute('aria-label')).toBe('Later lane');diff --git a/apps/web/src/features/database/components/database-board.test.tsx b/apps/web/src/features/database/components/database-board.test.tsxindex 77208aeac7..b94f6256c7 100644--- a/apps/web/src/features/database/components/database-board.test.tsx+++ b/apps/web/src/features/database/components/database-board.test.tsx@@ -7,20 +7,34 @@ import {waitFor,within,} from '@solidjs/testing-library';-import { err, ok, okAsync, type Result } from 'neverthrow';+import userEvent from '@testing-library/user-event';+import { err, ok, okAsync, type Result, ResultAsync } from 'neverthrow';import { createSignal } from 'solid-js';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import type { LaneKey } from '../../../lib/core/database-sql/generated/types';-import { OptionEditingContext } from '../context/option-editing';+import {+ type OptionEditing,+ OptionEditingContext,+} from '../context/option-editing';import type { DatabaseViewColumn } from '../core/database-view';import type { DatabaseRow } from '../core/table';+import { boardLane } from '../tests/board-layout';+import { BoardLaneHeader } from './board-lane-header';import { DatabaseBoard } from './database-board';+import { GridCell } from './grid-cell';+let menuStyles: HTMLStyleElement;beforeEach(() => {vi.spyOn(window, 'scrollTo').mockImplementation(() => {});+ // JSDOM reports an empty animation name; presence expects CSS's default none.+ menuStyles = document.createElement('style');+ // Include the dialog overlay so its presence also finishes on close.+ menuStyles.textContent = '* { animation-name: none; }';+ document.head.append(menuStyles);});afterEach(() => {cleanup();+ menuStyles.remove();vi.restoreAllMocks();});@@ -91,6 +105,7 @@ describe('database board', () => {expect(screen.getAllByRole('region')+ .filter((lane) => lane.hasAttribute('data-kanban-lane')).map((lane) => lane.getAttribute('aria-label'))).toEqual(['[email protected] lane', '[email protected] lane']);expect(screen.queryByRole('button', { name: 'New group' })).toBeNull();@@ -182,6 +197,7 @@ describe('database board', () => {expect(screen.getAllByRole('region')+ .filter((lane) => lane.hasAttribute('data-kanban-lane')).map((lane) => lane.getAttribute('aria-label'))).toEqual(['Done lane', 'To do lane']);expect(@@ -191,9 +207,7 @@ describe('database board', () => {screen.queryByRole('button', { name: 'Open Old record' })).toBeNull();expect(- within(screen.getByRole('region', { name: 'Done lane' })).getByText(- 'Drop a record here'- )+ within(boardLane('Done lane')).getByText('Drop a record here')).toBeTruthy();});@@ -300,6 +314,242 @@ describe('database board', () => {).toEqual(['Notes: Bring draft', 'Owner: Ada']);});+ it.each(['STRING', 'NUMBER'] as const)(+ 'reserves usable editor space for empty %s card fields',+ async (dataType) => {+ const title: DatabaseViewColumn = {+ id: 'title',+ name: 'Name',+ dataType: 'STRING',+ isMultiSelect: false,+ options: [],+ writable: true,+ };+ const status: DatabaseViewColumn = {+ ...title,+ id: 'status',+ name: 'Status',+ dataType: 'SELECT_STRING',+ options: [{ id: 'todo', label: 'To do', color: null }],+ };+ const value: DatabaseViewColumn = {+ ...title,+ id: 'value',+ name: 'Value',+ dataType,+ };+ const onWrite = vi.fn(async () => true);+ render(() => (+ <DatabaseBoard+ rows={[+ {+ rowId: 'record',+ cells: { title: 'Empty field', status: 'To do', value: null },+ },+ ]}+ columns={[title, status, value]}+ groupColumn={status}+ board={{+ lanes: [+ {+ key: { kind: 'option', id: 'todo' },+ hidden: false,+ cards: ['record'],+ },+ ],+ }}+ layout={{+ kind: 'board',+ title: 'title',+ groupBy: 'status',+ lanes: [],+ cardFields: ['value'],+ hideEmptyLanes: false,+ }}+ canEdit+ rowPending={() => false}+ onOpen={vi.fn()}+ onCreate={vi.fn(async () => true)}+ renderCell={(row, column, options) => (+ <GridCell+ {...options}+ column={column()}+ value={row().cells[column().id]}+ canEdit+ onWrite={onWrite}+ onAddOption={vi.fn(async () => true)}+ />+ )}+ />+ ));+ const field = screen.getByLabelText('Value');+ expect(field.classList.contains('min-w-16')).toBe(true);+ const display = within(field).getByRole('button', {+ name: 'Value: Empty. Click to edit',+ });+ // JSDOM has no layout; the board's reserved display area is 64 by 24.+ vi.spyOn(display, 'getBoundingClientRect').mockReturnValue(+ new DOMRect(0, 0, 64, 24)+ );+ fireEvent.click(display);+ const editor = within(field).getByRole('textbox', { name: 'Edit Value' });+ const cell = field.firstElementChild as HTMLDivElement;+ expect(cell.style.width).toBe('64px');+ expect(cell.style.height).toBe('24px');+ fireEvent.input(editor, {+ target: { value: dataType === 'NUMBER' ? '123.45' : 'Readable' },+ });+ expect(cell.style.width).toBe('64px');+ fireEvent.keyDown(editor, { key: 'Enter' });+ await waitFor(() =>+ expect(onWrite).toHaveBeenCalledExactlyOnceWith(+ dataType === 'NUMBER' ? 123.45 : 'Readable'+ )+ );+ expect(cell.style.width).toBe('');+ expect(field.classList.contains('min-w-16')).toBe(true);+ }+ );++ it.each([false, true])(+ 'keeps an invalid card-field draft after another field saves (refresh columns: %s)',+ async (refreshColumns) => {+ const title: DatabaseViewColumn = {+ id: 'title',+ name: 'Name',+ dataType: 'STRING',+ isMultiSelect: false,+ options: [],+ writable: true,+ };+ const [columns, setColumns] = createSignal<DatabaseViewColumn[]>([+ title,+ {+ ...title,+ id: 'status',+ name: 'Status',+ dataType: 'SELECT_STRING',+ options: [{ id: 'todo', label: 'To do', color: null }],+ },+ { ...title, id: 'amount', name: 'Amount', dataType: 'NUMBER' },+ { ...title, id: 'notes', name: 'Notes' },+ ]);+ const [rows, setRows] = createSignal<DatabaseRow[]>([+ {+ rowId: 'record',+ cells: {+ title: 'Keep my draft',+ status: 'To do',+ amount: 12,+ notes: 'Original notes',+ },+ },+ ]);+ const onWrite = vi.fn(+ async (+ rowId: string,+ columnId: string,+ value: DatabaseRow['cells'][string]+ ) => {+ setRows((current) =>+ current.map((row) => ({+ ...row,+ cells: {+ ...row.cells,+ ...(row.rowId === rowId ? { [columnId]: value } : {}),+ },+ }))+ );+ if (refreshColumns)+ setColumns((current) =>+ current.map((column) => ({+ ...column,+ options: column.options.map((option) => ({ ...option })),+ }))+ );+ return true;+ }+ );+ render(() => (+ <DatabaseBoard+ rows={rows()}+ columns={columns()}+ groupColumn={columns()[1]}+ board={{+ lanes: [+ {+ key: { kind: 'option', id: 'todo' },+ hidden: false,+ cards: ['record'],+ },+ ],+ }}+ layout={{+ kind: 'board',+ title: 'title',+ groupBy: 'status',+ lanes: [],+ cardFields: ['amount', 'notes'],+ hideEmptyLanes: false,+ }}+ canEdit+ rowPending={() => false}+ onOpen={vi.fn()}+ onCreate={vi.fn(async () => true)}+ renderCell={(row, column, options) => (+ <GridCell+ {...options}+ column={column()}+ value={row().cells[column().id]}+ canEdit+ onWrite={(value) => onWrite(row().rowId, column().id, value)}+ onAddOption={vi.fn(async () => true)}+ />+ )}+ />+ ));+ await userEvent.click(+ screen.getByRole('button', { name: /^Amount: 12\./ })+ );+ const invalidInput = screen.getByRole('textbox', { name: 'Edit Amount' });+ await userEvent.clear(invalidInput);+ await userEvent.type(invalidInput, 'invalid{Enter}');+ expect(invalidInput.getAttribute('aria-invalid')).toBe('true');+ await userEvent.click(+ screen.getByRole('button', { name: /^Notes: Original notes\./ })+ );+ const notesInput = screen.getByRole('textbox', { name: 'Edit Notes' });+ await userEvent.clear(notesInput);+ await userEvent.type(notesInput, 'Saved notes{Enter}');+ await waitFor(() =>+ expect(onWrite).toHaveBeenCalledExactlyOnceWith(+ 'record',+ 'notes',+ 'Saved notes'+ )+ );+ expect(+ screen.getByRole('button', { name: /^Notes: Saved notes\./ })+ ).toBeTruthy();+ expect(screen.getByRole('textbox', { name: 'Edit Amount' })).toBe(+ invalidInput+ );+ expect((invalidInput as HTMLInputElement).value).toBe('invalid');+ expect(invalidInput.getAttribute('aria-invalid')).toBe('true');+ expect(screen.queryByRole('alert')).toBeNull();+ invalidInput.focus();+ expect(screen.getByRole('alert').textContent).toBe(+ 'Enter a valid number'+ );+ await userEvent.clear(invalidInput);+ await userEvent.type(invalidInput, '24{Enter}');+ await waitFor(() =>+ expect(onWrite).toHaveBeenLastCalledWith('record', 'amount', 24)+ );+ expect(onWrite).toHaveBeenCalledTimes(2);+ }+ );+it('heads each card with its title column, an entity as its chip, never repeated among the fields', () => {const status: DatabaseViewColumn = {id: 'status',@@ -449,7 +699,7 @@ describe('database board', () => {onCreate={onCreate}/>));- const lane = screen.getByRole('region', { name: 'To do lane' });+ const lane = boardLane('To do lane');fireEvent.click(within(lane).getByRole('button', { name: 'New record' }));expect(within(lane).queryByRole('textbox')).toBeNull();fireEvent.click(within(lane).getByRole('button', { name: 'Add record' }));@@ -608,64 +858,6 @@ describe('database board', () => {).toBeNull();});- it('turns hiding empty lanes on from a lane menu, checked as the layout has it', async () => {- const status: DatabaseViewColumn = {- id: 'status',- name: 'Status',- dataType: 'SELECT_STRING',- isMultiSelect: false,- options: [{ id: 'todo', label: 'To do', color: null }],- writable: true,- };- const onHideEmptyLanes = vi.fn();- render(() => (- <DatabaseBoard- rows={[]}- columns={[- {- id: 'title',- name: 'Name',- dataType: 'STRING',- isMultiSelect: false,- options: [],- writable: true,- },- status,- ]}- board={{- lanes: [- { key: { kind: 'option', id: 'todo' }, hidden: false, cards: [] },- ],- }}- layout={{- kind: 'board',- title: 'title',- groupBy: 'status',- lanes: [],- cardFields: [],- hideEmptyLanes: false,- }}- groupColumn={status}- canEdit- rowPending={() => false}- onOpen={vi.fn()}- onMove={vi.fn()}- onHideEmptyLanes={onHideEmptyLanes}- onCreate={vi.fn(async () => true)}- />- ));- const menu = screen.getByRole('button', { name: 'To do lane menu' });- menu.focus();- fireEvent.keyDown(menu, { key: 'Enter' });- const toggle = await screen.findByRole('menuitemcheckbox', {- name: 'Hide empty lanes',- });- expect(toggle.getAttribute('aria-checked')).toBe('false');- expect(screen.queryByRole('menuitem', { name: 'Hide lane' })).toBeNull();- fireEvent.keyDown(toggle, { key: 'Enter' });- await waitFor(() => expect(onHideEmptyLanes).toHaveBeenCalledWith(true));- });-it('has no lane menu when the view cannot change', () => {const status: DatabaseViewColumn = {id: 'status',@@ -772,14 +964,16 @@ describe('database board', () => {</OptionEditingContext.Provider>));expect(- within(screen.getByRole('region', { name: 'To do lane' })).getByRole(- 'button',- { name: 'Edit To do' }- )+ within(boardLane('To do lane')).getByRole('button', {+ name: 'Rename To do',+ })).toBeTruthy();expect(screen.queryByRole('region', { name: 'No status lane' })).toBeNull();setCanEdit(false);- expect(screen.queryByRole('button', { name: 'Edit To do' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'Rename To do' })).toBeNull();+ expect(+ screen.queryByRole('button', { name: 'Change To do color' })+ ).toBeNull();});it('has no option editor without option editing', () => {@@ -826,7 +1020,10 @@ describe('database board', () => {onCreate={vi.fn(async () => true)}/>));- expect(screen.queryByRole('button', { name: 'Edit To do' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'Rename To do' })).toBeNull();+ expect(+ screen.queryByRole('button', { name: 'Change To do color' })+ ).toBeNull();});it('reorders lanes with Alt+Arrow, naming every lane in the new order', () => {@@ -1202,7 +1399,7 @@ describe('database board', () => {onCreate={onCreate}/>));- const lane = screen.getByRole('region', { name: 'Done lane' });+ const lane = boardLane('Done lane');fireEvent.click(within(lane).getByRole('button', { name: 'New record' }));const first = within(lane).getByRole('textbox', {name: 'New record title',@@ -1229,11 +1426,7 @@ describe('database board', () => {expect.any(String));expect(onCreate).toHaveBeenCalledTimes(2);- expect(- within(screen.getByRole('region', { name: 'To do lane' })).queryByRole(- 'textbox'- )- ).toBeNull();+ expect(within(boardLane('To do lane')).queryByRole('textbox')).toBeNull();});it('creates a card in the lane without an option with no option', () => {@@ -1333,7 +1526,7 @@ describe('database board', () => {onCreate={onCreate}/>));- const lane = screen.getByRole('region', { name: 'Done lane' });+ const lane = boardLane('Done lane');fireEvent.click(within(lane).getByRole('button', { name: 'New record' }));const input = within(lane).getByRole('textbox');fireEvent.input(input, { target: { value: 'Needs detail' } });@@ -1392,7 +1585,7 @@ describe('database board', () => {onCreate={onCreate}/>));- const lane = screen.getByRole('region', { name: 'Done lane' });+ const lane = boardLane('Done lane');fireEvent.click(within(lane).getByRole('button', { name: 'New record' }));const input = within(lane).getByRole('textbox', {name: 'New record title',@@ -1451,7 +1644,7 @@ describe('database board', () => {onCreate={onCreate}/>));- const lane = screen.getByRole('region', { name: 'Done lane' });+ const lane = boardLane('Done lane');fireEvent.click(within(lane).getByRole('button', { name: 'New record' }));fireEvent.blur(within(lane).getByRole('textbox'));expect(within(lane).queryByRole('textbox')).toBeNull();@@ -1525,7 +1718,7 @@ describe('database board', () => {onCreate={vi.fn(async () => true)}/>));- const todo = screen.getByRole('region', { name: 'To do lane' });+ const todo = boardLane('To do lane');const card = within(todo).getByRole('button', {name: 'Open Launch project',});@@ -1535,7 +1728,7 @@ describe('database board', () => {within(todo).getByRole('textbox', { name: 'New record title' }));fireEvent.keyDown(document.activeElement!, { key: 'Escape' });- const done = screen.getByRole('region', { name: 'Done lane' });+ const done = boardLane('Done lane');const header = within(done).getByRole('button', { name: 'Done lane' });header.focus();fireEvent.keyDown(header, { key: 'Enter' });@@ -1691,7 +1884,7 @@ describe('database board', () => {onCreate={onCreate}/>));- const lane = screen.getByRole('region', { name: 'Done lane' });+ const lane = boardLane('Done lane');fireEvent.click(within(lane).getByRole('button', { name: 'New record' }));const input = screen.getByRole('textbox', { name: 'New record title' });fireEvent.input(input, { target: { value: 'First idea' } });@@ -1771,10 +1964,9 @@ describe('database board', () => {));expect(addCard()).toBe(true);expect(- within(screen.getByRole('region', { name: 'Done lane' })).getByRole(- 'textbox',- { name: 'New record title' }- )+ within(boardLane('Done lane')).getByRole('textbox', {+ name: 'New record title',+ })).toBeTruthy();});@@ -1849,10 +2041,153 @@ describe('database board', () => {screen.queryByRole('button', { name: 'Add record to Done' })).toBeNull();expect(screen.queryByRole('button', { name: 'New group' })).toBeNull();- expect(- within(screen.getByRole('region', { name: 'Done lane' })).getByText(- 'No records'+ expect(within(boardLane('Done lane')).getByText('No records')).toBeTruthy();+ });+});++describe('board lane header', () => {+ const column: DatabaseViewColumn = {+ id: 'status',+ name: 'Status',+ dataType: 'SELECT_STRING',+ isMultiSelect: false,+ options: [+ { id: 'todo', label: 'To do', color: null },+ { id: 'done', label: 'Done', color: null },+ ],+ writable: true,+ };+ function renderHeader(editing: OptionEditing, groupColumn = column) {+ return render(() => (+ <OptionEditingContext.Provider value={editing}>+ <BoardLaneHeader+ column={groupColumn}+ option={groupColumn.options[0]}+ label={groupColumn.options[0].label}+ count={2}+ canEdit+ icon={<span />}+ onHide={vi.fn()}+ >+ {groupColumn.options[0].label}+ </BoardLaneHeader>+ </OptionEditingContext.Provider>+ ));+ }++ it('saves a rename once across Enter and blur, then restores name focus', async () => {+ let complete!: () => void;+ const saved = new Promise<void>((resolve) => {+ complete = resolve;+ });+ const editing = {+ update: vi.fn(() => ResultAsync.fromSafePromise(saved)),+ remove: vi.fn(() => okAsync(undefined)),+ };+ renderHeader(editing);+ await userEvent.click(screen.getByRole('button', { name: 'Rename To do' }));+ const input = screen.getByRole('textbox', { name: 'Group name' });+ expect(document.activeElement).toBe(input);+ fireEvent.input(input, { target: { value: 'In progress' } });+ fireEvent.keyDown(input, { key: 'Enter' });+ fireEvent.blur(input);+ expect(editing.update).toHaveBeenCalledExactlyOnceWith('status', 'todo', {+ label: 'In progress',+ });+ expect((input as HTMLInputElement).readOnly).toBe(true);+ complete();+ await waitFor(() =>+ expect(document.activeElement).toBe(+ screen.getByRole('button', { name: 'Rename To do' }))- ).toBeTruthy();+ );+ });++ it('cancels a rename with Escape without saving on blur', async () => {+ const editing = {+ update: vi.fn(() => okAsync(undefined)),+ remove: vi.fn(() => okAsync(undefined)),+ };+ renderHeader(editing);+ const trigger = screen.getByRole('button', { name: 'Rename To do' });+ await userEvent.click(trigger);+ expect(trigger.isConnected).toBe(true);+ expect(trigger.getAttribute('aria-hidden')).toBe('true');+ expect(trigger.tabIndex).toBe(-1);+ const input = screen.getByRole('textbox', { name: 'Group name' });+ fireEvent.input(input, { target: { value: 'Discarded' } });+ fireEvent.keyDown(input, { key: 'Escape' });+ fireEvent.blur(input);+ await waitFor(() => expect(document.activeElement).toBe(trigger));+ expect(trigger.hasAttribute('aria-hidden')).toBe(false);+ expect(trigger.tabIndex).toBe(0);+ expect(editing.update).not.toHaveBeenCalled();+ });++ it.each([+ ['SELECT_STRING', 'DONE', 'Another option already has this name.'],+ ['SELECT_NUMBER', 'not a number', 'Enter a number.'],+ ] as const)(+ 'keeps invalid %s names in the editor without writing',+ async (dataType, name, message) => {+ const editing = {+ update: vi.fn(() => okAsync(undefined)),+ remove: vi.fn(() => okAsync(undefined)),+ };+ renderHeader(editing, { ...column, dataType });+ await userEvent.click(+ screen.getByRole('button', { name: 'Rename To do' })+ );+ const input = screen.getByRole('textbox', { name: 'Group name' });+ fireEvent.input(input, { target: { value: name } });+ fireEvent.keyDown(input, { key: 'Enter' });+ expect(screen.getByRole('alert').textContent).toBe(message);+ expect((input as HTMLInputElement).value).toBe(name);+ expect(editing.update).not.toHaveBeenCalled();+ }+ );++ it('requires delete confirmation, supports cancellation and reopening, and blocks repeat deletion', async () => {+ let complete!: () => void;+ const deleted = new Promise<void>((resolve) => {+ complete = resolve;+ });+ const editing = {+ update: vi.fn(() => okAsync(undefined)),+ remove: vi.fn(() => ResultAsync.fromSafePromise(deleted)),+ };+ renderHeader(editing);+ const openConfirmation = async () => {+ await userEvent.click(+ screen.getByRole('button', { name: 'To do lane menu' })+ );+ await userEvent.click(+ await screen.findByRole('menuitem', { name: 'Delete group' })+ );+ return screen.findByRole('dialog', { name: 'Delete “To do”?' });+ };+ const dialog = await openConfirmation();+ expect(dialog.textContent).toContain('Records will not be deleted.');+ expect(editing.remove).not.toHaveBeenCalled();+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Cancel' })+ );+ const reopened = await openConfirmation();+ await userEvent.click(+ within(reopened).getByRole('button', { name: 'Delete group' })+ );+ expect(editing.remove).toHaveBeenCalledExactlyOnceWith('status', 'todo');+ expect(+ within(reopened)+ .getByRole('button', { name: 'Deleting…' })+ .hasAttribute('disabled')+ ).toBe(true);+ expect(+ within(reopened)+ .getByRole('button', { name: 'Cancel' })+ .hasAttribute('disabled')+ ).toBe(true);+ complete();+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());});});diff --git a/apps/web/src/features/database/components/database-board.tsx b/apps/web/src/features/database/components/database-board.tsxindex f0e8bc3513..c82d483b79 100644--- a/apps/web/src/features/database/components/database-board.tsx+++ b/apps/web/src/features/database/components/database-board.tsx@@ -1,9 +1,10 @@-import OpenIcon from '@phosphor/arrow-square-out.svg';-import CaretDownIcon from '@phosphor/caret-down.svg';+import OpenIcon from '@phosphor/arrows-out-simple.svg';import CheckIcon from '@phosphor/check.svg';+import EmptyIcon from '@phosphor/circle-dashed.svg';import GripIcon from '@phosphor/dots-six-vertical.svg';import DotsIcon from '@phosphor/dots-three.svg';import PlusIcon from '@phosphor/plus.svg';+import { TagDot } from '@property/tags/TagDot';import type { DatabaseOpsError } from '@service-storage/databases';import type { ViewLayout } from '@service-storage/generated/schemas/viewLayout';import { Key } from '@solid-primitives/keyed';@@ -19,31 +20,21 @@ import {onCleanup,Show,} from 'solid-js';-import {- Kanban,- KanbanCard,- KanbanCardInsertion,- KanbanHandle,- KanbanLane,-} from '../../../components/kanban/kanban';+import { KanbanHandle } from '../../../components/kanban/kanban';+import { KanbanBoard } from '../../../components/kanban/kanban-board';+import type { KanbanBoardColumn } from '../../../components/kanban/kanban-board-types';import type {Board,LaneKey,} from '../../../lib/core/database-sql/generated/types';import { isEditableInput } from '../../../lib/core/util/isEditableInput';-import { useOptionEditing } from '../context/option-editing';-import {- type DatabaseEntityType,- inferDatabaseNumber,-} from '../core/column-inference';-import { columnSchemaMessage } from '../core/column-schema';+import type { DatabaseEntityType } from '../core/column-inference';import {type DatabaseOption,type DatabaseViewColumn,databaseCellValues,isOptionColumn,} from '../core/database-view';-import { isDatabaseNameTaken } from '../core/property-creation';import {cellTitle,type DatabaseRow,@@ -52,8 +43,9 @@ import {rowValue,} from '../core/table';import { cardTitleColumn, laneId, laneLabel } from '../core/views';+import { BoardLaneHeader } from './board-lane-header';import type { DatabaseTableProps } from './database-table';-import { OptionEditor } from './option-editor';+import { NewBoardGroup } from './new-board-group';import { PropertyIcon } from './property-icon';import { SelectPill } from './select-pill';@@ -91,7 +83,6 @@ type DatabaseBoardProps = {/** The lanes, every one, in their new order. */onLaneOrderChange?: (order: LaneKey[]) => void;onHideLane?: (lane: LaneKey) => void;- onHideEmptyLanes?: (hide: boolean) => void;/** Resolves whether the record was saved. `open` asks to show it once it is. */onCreate: (lane: LaneKey,@@ -121,7 +112,10 @@ type CardDraft = {type DraftSubmission = 'next' | 'open' | 'stay';export function DatabaseBoard(props: DatabaseBoardProps) {- let viewport: HTMLDivElement | undefined;+ let boardControls:+ | { revealColumn: (id: string) => void; revealFooter: (id: string) => void }+ | undefined;+ let focusDraft: string | undefined;const lanes = createMemo((): BoardGroup[] => {const rows = new Map(props.rows.map((row) => [row.rowId, row]));return props.board.lanes@@ -145,6 +139,16 @@ export function DatabaseBoard(props: DatabaseBoardProps) {};});});+ const columns = createMemo((): KanbanBoardColumn[] =>+ lanes().map((group) => ({+ id: group.key,+ label: `${group.label} lane`,+ itemIds: group.rows.map((row) => row.rowId),+ }))+ );+ const groupsById = createMemo(+ () => new Map(lanes().map((group) => [group.key, group]))+ );const laneOf = (key: string): LaneKey =>lanes().find((lane) => lane.key === key)?.lane ?? { kind: 'none' };const [announcement, setAnnouncement] = createSignal('');@@ -168,6 +172,7 @@ export function DatabaseBoard(props: DatabaseBoardProps) {drafts.map((draft) => (draft.id === id ? { ...draft, ...change } : draft)));const removeDraft = (id: string) => {+ if (focusDraft === id) focusDraft = undefined;draftElements.delete(id);setDrafts((drafts) => drafts.filter((draft) => draft.id !== id));};@@ -176,12 +181,19 @@ export function DatabaseBoard(props: DatabaseBoardProps) {(draft) => !isSaving(draft) && !draft.title.trim());const id = open?.id ?? `${draftPrefix}:${++draftSequence}`;+ focusDraft = id;if (!open)setDrafts((drafts) => [...drafts.filter((draft) => !props.createComplete?.(draft.id)),{ id, lane, title: '', saving: false },]);- draftElements.get(id)?.focus();+ boardControls?.revealFooter(lane);+ const element = draftElements.get(id);+ if (element?.isConnected) {+ focusDraft = undefined;+ element.focus();+ element.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });+ }}function cancelDraft(id: string, returnFocus: boolean) {const draft = drafts().find((draft) => draft.id === id);@@ -251,16 +263,22 @@ export function DatabaseBoard(props: DatabaseBoardProps) {);}return (- <div- ref={viewport}- class="min-h-0 flex-1 overflow-auto px-5 py-5 [&_button:focus-visible]:ring-2 [&_button:focus-visible]:ring-ink/50"- >+ <div class="flex min-h-0 min-w-0 flex-1 flex-col [&_button:focus-visible]:ring-2 [&_button:focus-visible]:ring-ink/50"><p class="sr-only" role="status" aria-live="polite">{announcement()}</p>- <Kanban- getViewport={() => viewport}- canDropCard={(drop) =>+ <KanbanBoard.Root+ mode="ordered"+ columns={columns()}+ animationScope={JSON.stringify([+ props.groupColumn.id,+ props.layout.title,+ props.layout.cardFields,+ ])}+ controlsRef={(controls) => {+ boardControls = controls;+ }}+ canMove={(drop) =>props.rows.some((row) => row.rowId === drop.id) &&lanes().some((lane) => lane.key === drop.toLane) &&canMove()@@ -274,53 +292,68 @@ export function DatabaseBoard(props: DatabaseBoardProps) {if (target) move(drop.id, target, drop.beforeId);}}>- <div- class="flex min-h-full min-w-fit items-start gap-4 pb-4"+ <KanbanBoard.Columnsaria-label={`Board grouped by ${props.groupColumn.name}`}+ endColumn={+ props.canEdit && props.groupColumn.writable && props.onAddGroup+ ? () => (+ <NewBoardGroup+ column={props.groupColumn}+ onSave={props.onAddGroup!}+ />+ )+ : undefined+ }>- <Key each={lanes()} by="key">- {(group) => (- <BoardLane- group={group()}- {...props}- groups={lanes()}- drafts={laneDrafts(group().key)}- canSetTitle={canSetTitle()}- titlePlaceholder={titleField()?.name ?? 'Record title'}- acceptsRecords={canMove()}- canMove={canMove()}- isSaving={isSaving}- onStartDraft={() => startDraft(group().key)}- onDraftInput={(id, title) => updateDraft(id, { title })}- onSubmitDraft={(id, submission) =>- void submitDraft(id, submission)- }- onCancelDraft={cancelDraft}- draftRef={(id, element) => draftElements.set(id, element)}- newButtonRef={(element) => newButtons.set(group().key, element)}- onMoveCard={(rowId, lane) => move(rowId, lane)}- onReorder={(direction) => {- const index = lanes().findIndex(- (item) => item.key === group().key- );- const target =- lanes()[index + (direction === 'left' ? -1 : 1)];- if (target) reorder(group().key, target.key);- }}- />- )}- </Key>- <Show- when={- props.canEdit && props.groupColumn.writable && props.onAddGroup- }- >- {(addGroup) => (- <NewBoardGroup column={props.groupColumn} onSave={addGroup()} />- )}- </Show>- </div>- </Kanban>+ {(column) => (+ <Show when={groupsById().get(column().id)}>+ {(group) => (+ <BoardLane+ group={group()}+ {...props}+ groups={lanes()}+ drafts={laneDrafts(group().key)}+ canSetTitle={canSetTitle()}+ titlePlaceholder={titleField()?.name ?? 'Record title'}+ acceptsRecords={canMove()}+ canMove={canMove()}+ isSaving={isSaving}+ onStartDraft={() => startDraft(group().key)}+ onDraftInput={(id, title) => updateDraft(id, { title })}+ onSubmitDraft={(id, submission) =>+ void submitDraft(id, submission)+ }+ onCancelDraft={cancelDraft}+ draftRef={(id, element) => {+ draftElements.set(id, element);+ queueMicrotask(() => {+ if (focusDraft !== id || !element.isConnected) return;+ focusDraft = undefined;+ element.focus();+ element.scrollIntoView?.({+ block: 'nearest',+ inline: 'nearest',+ });+ });+ }}+ newButtonRef={(element) =>+ newButtons.set(group().key, element)+ }+ onMoveCard={(rowId, lane) => move(rowId, lane)}+ onReorder={(direction) => {+ const index = lanes().findIndex(+ (item) => item.key === group().key+ );+ const target =+ lanes()[index + (direction === 'left' ? -1 : 1)];+ if (target) reorder(group().key, target.key);+ }}+ />+ )}+ </Show>+ )}+ </KanbanBoard.Columns>+ </KanbanBoard.Root></div>);}@@ -345,14 +378,11 @@ function BoardLane(onMoveCard: (rowId: string, lane: BoardGroup) => void;}) {- const editing = useOptionEditing();const hasOpenDraft = () =>props.drafts.some((draft) => !props.isSaving(draft));const savingCount = () => props.drafts.filter(props.isSaving).length;return (- <KanbanLane- id={props.group.key}- label={`${props.group.label} lane`}+ <KanbanBoard.ColumncanReorder={!!props.onLaneOrderChange}onKeyDown={(event) => {// "n" adds a card to the lane holding focus, as Enter does on its header.@@ -372,99 +402,107 @@ function BoardLane(props.onStartDraft();}}>- <KanbanHandle- label={- props.onLaneOrderChange- ? `Reorder ${props.group.label} lane`- : `${props.group.label} lane`- }- class="mb-2 flex min-h-9 items-center gap-1.5 rounded px-1.5 outline-none focus-visible:ring-2 focus-visible:ring-ink/50"- onKeyDown={- props.onLaneOrderChange || props.acceptsRecords- ? (event) => {- if (event.target !== event.currentTarget) return;- if (- props.onLaneOrderChange &&- event.altKey &&- (event.key === 'ArrowLeft' || event.key === 'ArrowRight')- ) {- event.preventDefault();- event.stopPropagation();- props.onReorder(event.key === 'ArrowLeft' ? 'left' : 'right');- } else if (props.acceptsRecords && event.key === 'Enter') {- event.preventDefault();- props.onStartDraft();+ <KanbanBoard.Header>+ <KanbanHandle+ label={+ props.onLaneOrderChange+ ? `Reorder ${props.group.label} lane`+ : `${props.group.label} lane`+ }+ class="flex min-h-7 min-w-0 w-full items-center gap-2 rounded outline-none focus-visible:ring-2 focus-visible:ring-ink/50"+ onKeyDown={+ props.onLaneOrderChange || props.acceptsRecords+ ? (event) => {+ if (event.target !== event.currentTarget) return;+ if (+ props.onLaneOrderChange &&+ event.altKey &&+ (event.key === 'ArrowLeft' || event.key === 'ArrowRight')+ ) {+ event.preventDefault();+ event.stopPropagation();+ props.onReorder(+ event.key === 'ArrowLeft' ? 'left' : 'right'+ );+ } else if (props.acceptsRecords && event.key === 'Enter') {+ event.preventDefault();+ props.onStartDraft();+ }}- }- : undefined- }- >- <LanePill- group={props.group}- column={props.groupColumn}- renderMentionValue={props.renderMentionValue}- />- <span class="text-xs tabular-nums text-ink-placeholder">- {props.group.rows.length + savingCount()}- </span>- <span class="ml-auto flex items-center" data-kanban-no-drag>- <Show when={editing}>- {(optionEditing) => (- <Show when={props.canEdit && props.group.option}>- {(option) => (- <OptionEditor- column={props.groupColumn}- option={option()}- editing={optionEditing()}- />- )}- </Show>- )}+ : undefined+ }+ >+ <BoardLaneHeader+ column={props.groupColumn}+ option={props.group.option}+ label={props.group.label}+ count={props.group.rows.length + savingCount()}+ canEdit={props.canEdit}+ icon={<LaneIcon group={props.group} column={props.groupColumn} />}+ onHide={+ props.onHideLane+ ? () => props.onHideLane?.(props.group.lane)+ : undefined+ }+ onAdd={props.acceptsRecords ? props.onStartDraft : undefined}+ >+ <LaneHeading+ group={props.group}+ renderMentionValue={props.renderMentionValue}+ />+ </BoardLaneHeader>+ </KanbanHandle>+ </KanbanBoard.Header>+ <KanbanBoard.Cards+ itemsLabel="records"+ empty={+ <Show when={!props.drafts.length}>+ <p class="px-2 py-6 text-center text-xs text-ink-extra-muted">+ {props.acceptsRecords ? 'Drop a record here' : 'No records'}+ </p></Show>- <Show when={props.onHideLane || props.onHideEmptyLanes}>- <Dropdown>- <Dropdown.Trigger+ }+ footer={+ <div class="flex flex-col gap-3 pt-3">+ <Key each={props.drafts} by="id">+ {(draft) => (+ <NewBoardCard+ title={draft().title}+ titlePlaceholder={props.titlePlaceholder}+ icon={+ <LaneIcon group={props.group} column={props.groupColumn} />+ }+ canSetTitle={props.canSetTitle}+ saving={props.isSaving(draft())}+ ref={(element) => props.draftRef(draft().id, element)}+ onInput={(title) => props.onDraftInput(draft().id, title)}+ onSubmit={(submission) =>+ props.onSubmitDraft(draft().id, submission)+ }+ onCancel={(returnFocus) =>+ props.onCancelDraft(draft().id, returnFocus)+ }+ />+ )}+ </Key>+ <Show when={props.acceptsRecords && !hasOpenDraft()}>+ <Button+ ref={props.newButtonRef}variant="ghost"- size="icon-xs"- aria-label={`${props.group.label} lane menu`}+ size="lg"+ aria-label="New record"+ class="justify-start rounded-md text-sm text-ink-placeholder"+ onClick={props.onStartDraft}>- <CaretDownIcon class="size-3" />- </Dropdown.Trigger>- <Dropdown.Content class="min-w-44">- <Show when={props.onHideLane}>- <Dropdown.Item- onSelect={() => props.onHideLane?.(props.group.lane)}- >- Hide lane- </Dropdown.Item>- </Show>- <Show when={props.onHideEmptyLanes}>- <Dropdown.CheckboxItem- checked={props.layout.hideEmptyLanes}- onChange={(checked) => props.onHideEmptyLanes?.(checked)}- >- Hide empty lanes- </Dropdown.CheckboxItem>- </Show>- </Dropdown.Content>- </Dropdown>- </Show>- <Show when={props.acceptsRecords}>- <Button- size="icon-xs"- label={`Add record to ${props.group.label}`}- tooltipDisabled- title={`Add record to ${props.group.label}`}- onClick={props.onStartDraft}- >- <PlusIcon class="size-3.5" />- </Button>- </Show>- </span>- </KanbanHandle>- <div class="flex min-h-10 flex-col gap-2">- <div class="relative flex flex-col gap-2">- <Key each={props.group.rows} by="rowId">+ <PlusIcon class="size-3.5" />+ New+ </Button>+ </Show>+ </div>+ }+ >+ {(id) => (+ <Show when={props.group.rows.find((row) => row.rowId === id)}>{(row) => (<BoardCardrow={row()}@@ -483,47 +521,58 @@ function BoardLane(onMove={props.onMoveCard}/>)}- </Key>- <KanbanCardInsertion laneId={props.group.key} />- </div>- <Show when={props.group.rows.length === 0 && !props.drafts.length}>- <div class="flex min-h-20 items-center justify-center rounded-lg border border-dashed border-edge-muted/70 px-4 text-xs text-ink-placeholder">- {props.acceptsRecords ? 'Drop a record here' : 'No records'}- </div>- </Show>- <Key each={props.drafts} by="id">- {(draft) => (- <NewBoardCard- title={draft().title}- titlePlaceholder={props.titlePlaceholder}- canSetTitle={props.canSetTitle}- saving={props.isSaving(draft())}- ref={(element) => props.draftRef(draft().id, element)}- onInput={(title) => props.onDraftInput(draft().id, title)}- onSubmit={(submission) =>- props.onSubmitDraft(draft().id, submission)- }- onCancel={(returnFocus) =>- props.onCancelDraft(draft().id, returnFocus)- }+ </Show>+ )}+ </KanbanBoard.Cards>+ </KanbanBoard.Column>+ );+}++function LaneIcon(props: { group: BoardGroup; column: DatabaseViewColumn }) {+ return (+ <span+ aria-hidden="true"+ class="flex size-4 shrink-0 items-center justify-center"+ >+ <Show+ when={props.group.lane.kind !== 'none'}+ fallback={<EmptyIcon class="size-4 text-ink-muted" />}+ >+ <Show+ when={props.group.option || props.column.dataType === 'TAG'}+ fallback={+ <PropertyIcon+ type={props.column.dataType}+ entityType={props.column.specificEntityType}+ class="size-4 text-ink-muted"/>- )}- </Key>- <Show when={props.acceptsRecords && !hasOpenDraft()}>- <Button- ref={props.newButtonRef}- variant="ghost"- size="xs"- aria-label="New record"- class="h-7 justify-start gap-1.5 rounded-md px-1.5 text-ink-placeholder"- onClick={props.onStartDraft}- >- <PlusIcon class="size-3.5" />- New- </Button>+ }+ >+ <TagDot+ color={props.group.option?.color ?? undefined}+ class="size-2.5"+ /></Show>- </div>- </KanbanLane>+ </Show>+ </span>+ );+}++function LaneHeading(props: {+ group: BoardGroup;+ renderMentionValue?: (id: string, type: DatabaseEntityType) => JSX.Element;+}) {+ const person = () => {+ const lane = props.group.lane;+ const render = props.renderMentionValue;+ return lane.kind === 'user' && render ? { id: lane.id, render } : undefined;+ };+ return (+ <KanbanBoard.ColumnLabel title={props.group.label}>+ <Show when={person()} fallback={props.group.label}>+ {(shown) => shown().render(shown().id, 'USER')}+ </Show>+ </KanbanBoard.ColumnLabel>);}@@ -558,127 +607,6 @@ function LanePill(props: {);}-function NewBoardGroup(props: {- column: DatabaseViewColumn;- onSave: (label: string) => Promise<DatabaseGroupAdded>;-}) {- const [adding, setAdding] = createSignal(false);- const [draft, setDraft] = createSignal('');- const [pending, setPending] = createSignal(false);- const [error, setError] = createSignal('');- let input: HTMLInputElement | undefined;- const cancel = () => {- if (!pending()) {- setAdding(false);- setError('');- }- };- async function save(event: SubmitEvent) {- event.preventDefault();- const entered = draft().trim();- if (!entered || pending()) return;- const number =- props.column.dataType === 'SELECT_NUMBER'- ? inferDatabaseNumber(entered)- : undefined;- if (props.column.dataType === 'SELECT_NUMBER' && number === undefined) {- setError('Enter a valid number for this group.');- return;- }- const label = number === undefined ? entered : String(number);- if (- isDatabaseNameTaken(- label,- props.column.options.map((option) => option.label)- )- ) {- setError('A group with this name already exists.');- return;- }- setPending(true);- setError('');- const added = await props.onSave(label);- setPending(false);- added.match(- () => {- setAdding(false);- setDraft('');- },- (error) => setError(columnSchemaMessage(error))- );- }- return (- <div class="w-64 shrink-0 pt-2">- <Show- when={adding()}- fallback={- <Button- size="xs"- class="gap-2"- onClick={() => {- setDraft('');- setAdding(true);- queueMicrotask(() => input?.focus());- }}- >- <PlusIcon class="size-3.5" />- New group- </Button>- }- >- <form- class="rounded-xl border border-edge-muted bg-panel p-3 shadow-sm"- onSubmit={(event) => void save(event)}- >- <p class="mb-2 block text-xs font-medium text-ink-muted">- New {props.column.name.toLowerCase()} group- </p>- <input- ref={input}- value={draft()}- maxlength={200}- aria-label="New group name"- placeholder={- props.column.dataType === 'SELECT_NUMBER'- ? 'Enter a number…'- : 'Group name…'- }- readOnly={pending()}- class="w-full rounded-md border border-edge-muted bg-input px-2.5 py-2 text-xs outline-none focus:border-ink/50"- onInput={(event) => {- setDraft(event.currentTarget.value);- setError('');- }}- onKeyDown={(event) => {- if (event.key === 'Escape') {- event.preventDefault();- cancel();- }- }}- />- <Show when={error()}>- <p role="alert" class="mt-2 text-xs leading-5 text-failure-ink">- {error()}- </p>- </Show>- <div class="mt-3 flex items-center gap-2">- <Button- size="sm"- type="submit"- disabled={pending() || !draft().trim()}- >- {pending() ? 'Adding…' : 'Add group'}- </Button>- <Button size="xs" disabled={pending()} onClick={cancel}>- Cancel- </Button>- </div>- </form>- </Show>- </div>- );-}-function BoardCard(props: {row: DatabaseRow;laneId: string;@@ -723,67 +651,145 @@ function BoardCard(props: {: [];});return (- <KanbanCard+ <KanbanBoard.Cardid={props.row.rowId}- laneId={props.laneId}canDrag={props.canEdit}pending={props.pending}>- <div class="min-w-0 rounded-lg p-3">- <Show- when={props.renderCell && props.titleColumn}- fallback={- <button- type="button"- class="block w-full text-left"- onClick={() => props.onOpen(props.row.rowId)}- aria-label={`Open ${title()}`}- >- <span- role="heading"- aria-level={3}- class="block break-words pr-10 text-sm font-semibold leading-5 text-ink"+ <div+ class="grid grid-cols-[1.5rem_minmax(0,1fr)_auto] gap-x-2 p-3"+ data-card-grid+ >+ <KanbanBoard.CardHeader class="col-span-full grid-cols-subgrid p-0 last:pb-0">+ <Show+ when={props.canEdit}+ fallback={<span aria-hidden="true" class="size-6" />}+ >+ <KanbanHandle label={`Drag ${title()}`}>+ <Button+ size="icon-xs"+ label={`Drag ${title()}`}+ tooltipDisabled+ class="size-6 touch-none text-ink-muted"+ title="Drag to another group, or use the Move menu"+ tabindex={-1}>- {renderedTitle()}- </span>- </button>- }- >- {(column) => (- <div- class="min-w-0 pr-16 text-sm font-semibold"- data-kanban-no-drag- >- {props.renderCell?.(() => props.row, column)}- </div>- )}- </Show>+ <GripIcon class="size-4" />+ </Button>+ </KanbanHandle>+ </Show>+ <Show+ when={props.renderCell && props.titleColumn}+ fallback={+ <button+ type="button"+ class="min-w-0 break-words text-left text-sm font-medium leading-6 text-ink hover:underline"+ onClick={() => props.onOpen(props.row.rowId)}+ aria-label={`Open ${title()}`}+ >+ <span role="heading" aria-level={3}>+ {renderedTitle()}+ </span>+ </button>+ }+ >+ {(column) => (+ <div+ class="min-w-0 text-sm font-medium leading-6 text-ink [&_[data-cell-text-editor]]:min-h-6 [&_[data-cell-text-editor]]:break-words [&_[data-cell-text-editor]]:border-0 [&_[data-cell-text-editor]]:bg-transparent [&_[data-cell-text-editor]]:p-0 [&_[data-cell-text-editor]]:text-sm [&_[data-cell-text-editor]]:font-medium [&_[data-cell-text-editor]]:leading-6 [&_[data-cell-text-editor]]:ring-0 [&_[data-cell-text-editor][aria-invalid=true]]:ring-1 [&_[data-cell-text-editor][aria-invalid=true]]:ring-failure"+ data-kanban-no-drag+ >+ {props.renderCell?.(() => props.row, column)}+ </div>+ )}+ </Show>+ <KanbanBoard.CardActions>+ <Show when={props.renderCell}>+ <Button+ size="icon-xs"+ label={`Open ${title()}`}+ tooltipDisabled+ title="Open record details"+ onClick={() => props.onOpen(props.row.rowId)}+ >+ <OpenIcon class="size-3.5" />+ </Button>+ </Show>+ <Show when={props.canEdit}>+ <Dropdown>+ <Dropdown.Trigger+ variant="ghost"+ size="icon-xs"+ aria-label={`Move ${title()}`}+ title="Move to another group"+ >+ <DotsIcon class="size-4" />+ </Dropdown.Trigger>+ <Dropdown.Content class="min-w-44">+ <Dropdown.Group>+ <Dropdown.GroupLabel>Move to</Dropdown.GroupLabel>+ <For each={props.groups}>+ {(group) => (+ <Dropdown.Item+ disabled={group.key === props.laneId}+ onSelect={() => props.onMove(props.row.rowId, group)}+ >+ <span class="flex-1">+ <LanePill+ group={group}+ column={props.groupColumn}+ renderMentionValue={props.renderMentionValue}+ />+ </span>+ <Show when={group.key === props.laneId}>+ <CheckIcon class="size-3.5" />+ </Show>+ </Dropdown.Item>+ )}+ </For>+ </Dropdown.Group>+ </Dropdown.Content>+ </Dropdown>+ </Show>+ </KanbanBoard.CardActions>+ </KanbanBoard.CardHeader><Show when={metadata().length}>- <div class="mt-3 flex flex-col gap-2 border-t border-edge-muted/50 pt-2.5">- <For each={metadata()}>+ <KanbanBoard.CardFields class="col-start-2 col-span-2 p-0 pt-2">+ <Key each={metadata()} by="id">{(column) => (<div- class="flex min-w-0 items-center gap-2"+ class="flex min-h-6 min-w-0 max-w-40 items-center gap-2 rounded pl-1.5 hover:bg-hover has-[[aria-invalid=true]]:ring-1 has-[[aria-invalid=true]]:ring-failure"data-card-field- title={`${column.name}: ${formatCellValue(column, rowValue(props.row, column.id))}`}+ title={`${column().name}: ${formatCellValue(column(), rowValue(props.row, column().id))}`}data-kanban-no-drag={props.renderCell ? '' : undefined}><PropertyIcon- type={column.dataType}- relation={!!column.relation}- class="size-3 shrink-0 text-ink-placeholder"+ type={column().dataType}+ entityType={column().specificEntityType}+ relation={!!column().relation}+ class="size-3.5 shrink-0 text-ink-placeholder"/>- <div class="min-w-0 flex-1" aria-label={column.name}>+ <div+ class="min-w-0 flex-1 [&_[data-cell-text-editor]]:h-6 [&_[data-cell-text-editor]]:min-h-6 [&_[data-cell-text-editor]]:max-h-6 [&_[data-cell-text-editor]]:overflow-auto [&_[data-cell-text-editor]]:whitespace-pre [&_[data-cell-text-editor]]:[scrollbar-width:none] [&_[data-cell-text-editor]]:border-0 [&_[data-cell-text-editor]]:bg-transparent [&_[data-cell-text-editor]]:px-0 [&_[data-cell-text-editor]]:py-0.5 [&_[data-cell-text-editor]]:text-xs [&_[data-cell-text-editor]]:[font-weight:inherit] [&_[data-cell-text-editor]]:leading-5 [&_[data-cell-text-editor]]:ring-0"+ classList={{+ 'font-medium': column().dataType === 'STRING',+ // Reserve usable editor space even when the value is empty.+ 'min-w-16':+ !!props.renderCell &&+ (column().dataType === 'STRING' ||+ column().dataType === 'NUMBER'),+ }}+ aria-label={column().name}+ ><Showwhen={props.renderCell}fallback={<Show- when={isOptionColumn(column)}+ when={isOptionColumn(column())}fallback={- <span class="truncate text-xs text-ink-muted">+ <span class="block truncate text-xs text-ink-muted">{formatCellValue(- column,- rowValue(props.row, column.id)+ column(),+ rowValue(props.row, column().id))}</span>}@@ -791,14 +797,14 @@ function BoardCard(props: {<span class="flex min-w-0 flex-wrap gap-1"><Foreach={databaseCellValues(- rowValue(props.row, column.id),- column+ rowValue(props.row, column().id),+ column())}>{(value) => (<SelectPilllabel={String(value)}- column={column}+ column={column()}/>)}</For>@@ -807,90 +813,26 @@ function BoardCard(props: {}>{(render) =>- render()(- () => props.row,- () => column- )+ render()(() => props.row, column, {+ preserveSize: true,+ })}</Show></div></div>)}- </For>- </div>+ </Key>+ </KanbanBoard.CardFields></Show></div>- <Show when={props.renderCell}>- <Button- size="icon-xs"- label={`Open ${title()}`}- tooltipDisabled- class="absolute top-3 right-13"- data-kanban-no-drag- onClick={() => props.onOpen(props.row.rowId)}- >- <OpenIcon class="size-3.5" />- </Button>- </Show>- <Show when={props.canEdit}>- <div class="absolute top-3 right-2 flex items-start gap-0.5">- <KanbanHandle label={`Drag ${title()}`}>- <Button- size="icon-xs"- label={`Drag ${title()}`}- tooltipDisabled- class="touch-none opacity-60 group-hover:opacity-100 focus-visible:opacity-100"- title="Drag to another group, or use the Move menu"- tabindex={-1}- >- <GripIcon class="size-4" />- </Button>- </KanbanHandle>- <Dropdown>- <Dropdown.Trigger- variant="ghost"- size="icon-xs"- class="size-5 rounded text-ink-muted"- aria-label={`Move ${title()}`}- data-kanban-no-drag- title="Move to another group"- >- <DotsIcon class="size-4" />- </Dropdown.Trigger>- <Dropdown.Content class="min-w-44">- <Dropdown.Group>- <Dropdown.GroupLabel>Move to</Dropdown.GroupLabel>- <For each={props.groups}>- {(group) => (- <Dropdown.Item- disabled={group.key === props.laneId}- onSelect={() => props.onMove(props.row.rowId, group)}- >- <span class="flex-1">- <LanePill- group={group}- column={props.groupColumn}- renderMentionValue={props.renderMentionValue}- />- </span>- <Show when={group.key === props.laneId}>- <CheckIcon class="size-3.5" />- </Show>- </Dropdown.Item>- )}- </For>- </Dropdown.Group>- </Dropdown.Content>- </Dropdown>- </div>- </Show>- </KanbanCard>+ </KanbanBoard.Card>);}/** A card-shaped title field: Enter saves it, Escape or leaving it empty drops it. */function NewBoardCard(props: {title: string;+ icon: JSX.Element;titlePlaceholder: string;canSetTitle: boolean;saving: boolean;@@ -910,54 +852,59 @@ function NewBoardCard(props: {}};return (- <div class="rounded-lg border border-edge-muted bg-surface-3 p-3 shadow-sm">- <Show- when={!props.saving}- fallback={- <div role="status" aria-label="Saving new record">- <p class="break-words text-[13px] font-medium leading-5 text-ink opacity-70">- {props.title.trim() || 'Unnamed'}- </p>- </div>- }- >+ <div class="rounded-lg border border-edge-muted bg-surface-3 shadow-sm">+ <KanbanBoard.CardHeader>+ <span class="flex size-6 items-center justify-center">+ {props.icon}+ </span><Show- when={props.canSetTitle}+ when={!props.saving}fallback={- <button- ref={props.ref}- type="button"- class="w-full text-left text-[13px] leading-5 text-ink-placeholder outline-none"- onClick={() => props.onSubmit('open')}- onKeyDown={(event) => {- if (event.key === 'Escape') onKeyDown(event);- }}- onBlur={() => props.onCancel(false)}- >- Add record- </button>+ <div role="status" aria-label="Saving new record">+ <p class="break-words text-[13px] font-medium leading-5 text-ink opacity-70">+ {props.title.trim() || 'Unnamed'}+ </p>+ </div>}>- <textarea- ref={props.ref}- rows={1}- aria-label="New record title"- aria-description="Enter to add, Shift+Enter to add and open, Escape to cancel"- placeholder={`${props.titlePlaceholder}…`}- value={props.title}- maxlength={2000}- class="block w-full resize-none bg-transparent text-[13px] font-medium leading-5 text-ink outline-none field-sizing-content placeholder:font-normal placeholder:text-ink-placeholder"- onInput={(event) => props.onInput(event.currentTarget.value)}- onKeyDown={onKeyDown}- onBlur={() => {- // Switching windows is not leaving the card.- if (!document.hasFocus()) return;- if (props.title.trim()) props.onSubmit('stay');- else props.onCancel(false);- }}- />+ <Show+ when={props.canSetTitle}+ fallback={+ <button+ ref={props.ref}+ type="button"+ class="w-full text-left text-[13px] leading-5 text-ink-placeholder outline-none"+ onClick={() => props.onSubmit('open')}+ onKeyDown={(event) => {+ if (event.key === 'Escape') onKeyDown(event);+ }}+ onBlur={() => props.onCancel(false)}+ >+ Add record+ </button>+ }+ >+ <textarea+ ref={props.ref}+ rows={1}+ aria-label="New record title"+ aria-description="Enter to add, Shift+Enter to add and open, Escape to cancel"+ placeholder={`${props.titlePlaceholder}…`}+ value={props.title}+ maxlength={2000}+ class="block w-full resize-none bg-transparent text-[13px] font-medium leading-5 text-ink outline-none field-sizing-content placeholder:font-normal placeholder:text-ink-placeholder"+ onInput={(event) => props.onInput(event.currentTarget.value)}+ onKeyDown={onKeyDown}+ onBlur={() => {+ // Switching windows is not leaving the card.+ if (!document.hasFocus()) return;+ if (props.title.trim()) props.onSubmit('stay');+ else props.onCancel(false);+ }}+ />+ </Show></Show>- </Show>+ </KanbanBoard.CardHeader></div>);}diff --git a/apps/web/src/features/database/components/database-editor-toolbar.tsx b/apps/web/src/features/database/components/database-editor-toolbar.tsxindex 2267ad79e6..74373e9576 100644--- a/apps/web/src/features/database/components/database-editor-toolbar.tsx+++ b/apps/web/src/features/database/components/database-editor-toolbar.tsx@@ -42,45 +42,47 @@ export function DatabaseEditorToolbar(props: {<div class="flex min-w-0 flex-1 items-center gap-0.5 @max-[520px]/view-toolbar:basis-full">{props.selection}</div>- <div class="flex shrink-0 items-center gap-0.5 @max-[520px]/view-toolbar:w-full @max-[520px]/view-toolbar:justify-end">+ <div class="flex shrink-0 items-center gap-2 @max-[520px]/view-toolbar:w-full @max-[520px]/view-toolbar:flex-wrap @max-[520px]/view-toolbar:justify-end"><Show when={props.canChangeView !== false}><Show when={board()}>{(current) => (<Dropdown placement="bottom-start"><Dropdown.Trigger- aria-label="Group board by"- title="Group by"- size="icon-md"+ label="Group board by"+ tooltip="Group by"+ size="md"+ squarevariant="ghost"- class="h-8 w-auto rounded-md px-2 text-ink-muted hover:bg-hover data-expanded:bg-hover"><StackIcon class="size-3.5" /></Dropdown.Trigger><Dropdown.Content class="min-w-48">- <Dropdown.RadioGroup- value={current().groupBy}- onChange={(columnId) => {- if (columnId !== current().groupBy)- props.onChangeView({- layout: {- ...current(),- groupBy: columnId,- lanes: [],- },- });- }}- >- <For each={groupColumns()}>- {(column) => (- <Dropdown.RadioItem closeOnSelect value={column.id}>- <span class="flex-1">{column.name}</span>- <Dropdown.ItemIndicator>- <CheckIcon class="size-3.5 text-accent" />- </Dropdown.ItemIndicator>- </Dropdown.RadioItem>- )}- </For>- </Dropdown.RadioGroup>+ <Dropdown.Group>+ <Dropdown.RadioGroup+ value={current().groupBy}+ onChange={(columnId) => {+ if (columnId !== current().groupBy)+ props.onChangeView({+ layout: {+ ...current(),+ groupBy: columnId,+ lanes: [],+ },+ });+ }}+ >+ <For each={groupColumns()}>+ {(column) => (+ <Dropdown.RadioItem closeOnSelect value={column.id}>+ <span class="flex-1">{column.name}</span>+ <Dropdown.ItemIndicator>+ <CheckIcon class="size-3.5 text-accent" />+ </Dropdown.ItemIndicator>+ </Dropdown.RadioItem>+ )}+ </For>+ </Dropdown.RadioGroup>+ </Dropdown.Group></Dropdown.Content></Dropdown>)}@@ -116,12 +118,11 @@ export function DatabaseEditorToolbar(props: {</ToolbarPopover></Show>{props.search}- <div class="ml-1 flex shrink-0 items-center">+ <div class="flex shrink-0 items-center gap-2"><Show when={props.onCreateRecord}><Button- size="sm"+ size="md"variant="outline"- class="h-8 gap-1.5 px-2.5 text-xs"aria-label={props.creating? 'Saving record'diff --git a/apps/web/src/features/database/components/database-search.tsx b/apps/web/src/features/database/components/database-search.tsxindex 69d2332d0b..70d579fb46 100644--- a/apps/web/src/features/database/components/database-search.tsx+++ b/apps/web/src/features/database/components/database-search.tsx@@ -1,5 +1,6 @@import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';import XIcon from '@phosphor/x.svg';+import { Button } from '@ui/components/Button';import { InputGroup } from '@ui/components/InputGroup';import {createMemo,@@ -67,17 +68,19 @@ export function DatabaseSearch(props: {<Showwhen={props.isOpen}fallback={- <button+ <Buttonref={searchButton}type="button"- aria-label="Search"+ variant="ghost"+ size="md"+ square+ label="Search"aria-keyshortcuts="Control+F Meta+F"- title="Search every table"+ tooltip="Search every table"onClick={() => props.onOpen()}- class="flex size-8 shrink-0 items-center justify-center rounded-md text-ink-muted outline-none hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-ink/50"><MagnifyingGlassIcon class="size-3.5" />- </button>+ </Button>}><div@@ -89,7 +92,7 @@ export function DatabaseSearch(props: {props.onClose(false);}}>- <InputGroup size="sm" class="w-40 @min-[640px]/view-toolbar:w-56">+ <InputGroup size="md" class="w-40 @min-[640px]/view-toolbar:w-56"><InputGroup.Addon align="inline-start"><MagnifyingGlassIcon class="size-3.5" /></InputGroup.Addon>diff --git a/apps/web/src/features/database/components/database-table.test.tsx b/apps/web/src/features/database/components/database-table.test.tsxindex e64ecb3cb9..55fddae941 100644--- a/apps/web/src/features/database/components/database-table.test.tsx+++ b/apps/web/src/features/database/components/database-table.test.tsx@@ -494,15 +494,24 @@ describe('spreadsheet interactions', () => {expect(onWrite).toHaveBeenLastCalledWith('one', 'notes', 'High');});- it('keeps invalid numeric edits in place and permits arrow navigation after Escape', async () => {+ it('keeps invalid numeric drafts while allowing arrow navigation to another row', async () => {const { setColumns, onWrite } = setup();setColumns([{ ...name, dataType: 'NUMBER' }, notes]);screen.getByRole('button', { name: /Name: First\./ }).focus();- await userEvent.keyboard('invalid{Enter}{ArrowDown}');+ await userEvent.keyboard('invalid{Enter}');const input = screen.getByRole('textbox', { name: 'Edit Name' });expect(document.activeElement).toBe(input);expect(screen.getByRole('alert').textContent).toBe('Enter a valid number');+ await userEvent.keyboard('{ArrowDown}');+ const next = screen+ .getAllByRole('textbox', { name: 'Edit Name' })+ .find((element) => element !== input);+ expect(document.activeElement).toBe(next);+ expect((input as HTMLInputElement).value).toBe('invalid');+ expect(input.getAttribute('aria-invalid')).toBe('true');+ expect(screen.queryByRole('alert')).toBeNull();expect(onWrite).not.toHaveBeenCalled();+ input.focus();await userEvent.keyboard('{Escape}{ArrowDown}');expect(document.activeElement).toBe(screen.getByRole('button', { name: /Name: Second\./ })diff --git a/apps/web/src/features/database/components/database-toolbar.tsx b/apps/web/src/features/database/components/database-toolbar.tsxindex 41f1ee265f..cfa70ca15e 100644--- a/apps/web/src/features/database/components/database-toolbar.tsx+++ b/apps/web/src/features/database/components/database-toolbar.tsx@@ -11,6 +11,7 @@ import {DragDropSensors,SortableProvider,} from '@thisbeyond/solid-dnd';+import { Button } from '@ui/components/Button';import { DeleteDialog } from '@ui/components/DeleteDialog';import { Dropdown } from '@ui/components/Dropdown';import { Tooltip } from '@ui/components/Tooltip';@@ -152,15 +153,17 @@ export function DatabaseToolbar(props: DatabaseToolbarProps) {class="flex min-w-0 items-center gap-0.5 overflow-x-auto"aria-label="Views">- <button+ <Buttonref={allRecordsButton}type="button"+ variant="ghost"+ size="md"aria-pressed={!props.selectedViewId}onClick={() => props.onSelectView()}- class="flex h-8 max-w-40 shrink-0 items-center gap-1.5 rounded-full border border-transparent aria-pressed:border-edge-frame aria-pressed:bg-active aria-pressed:text-ink px-4 text-xs font-medium text-ink-extra-muted outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-edge-focus transition-colors duration-120 motion-reduce:transition-none"+ class="max-w-40 px-4 aria-pressed:border-edge-frame aria-pressed:bg-active aria-pressed:text-ink"><span class="truncate">All records</span>- </button>+ </Button><DragDropProvidercollisionDetector={closestCenter}onDragEnd={({ draggable, droppable }) => {@@ -216,9 +219,10 @@ export function DatabaseToolbar(props: DatabaseToolbarProps) {<Show when={props.canEdit}><Dropdown placement="bottom-start"><Dropdown.Trigger- size="icon-sm"+ size="md"+ squarevariant="ghost"- aria-label="New view"+ label="New view"class="ml-2 shrink-0"disabled={creating()}>@@ -327,7 +331,7 @@ function ViewTab(props: {maxlength={100}value={props.renameDraft}readOnly={props.renamePending}- class="h-8 w-36 rounded-md border border-ink/40 bg-input px-2 text-xs text-ink outline-none focus:ring-2 focus:ring-ink/10"+ class="h-8 w-36 rounded-md border border-ink/40 bg-input px-2 text-sm text-ink outline-none focus:ring-2 focus:ring-ink/10"onInput={(event) =>props.onRenameInput(event.currentTarget.value)}@@ -345,7 +349,10 @@ function ViewTab(props: {<ContextMenu><Tooltip label={props.view.name}><ContextMenu.Trigger- as="button"+ as={Button}+ variant="ghost"+ size="md"+ tooltipDisabledtype="button"{...(props.canReorder ? sortable.dragActivators : {})}data-view-id={props.view.id}@@ -362,7 +369,7 @@ function ViewTab(props: {props.onRename();}}}- class="flex h-8 max-w-40 items-center gap-1.5 rounded-full border border-transparent aria-pressed:border-edge-frame aria-pressed:bg-active aria-pressed:text-ink px-4 text-xs font-medium text-ink-extra-muted outline-none hover:text-ink focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-edge-focus transition-colors duration-120 motion-reduce:transition-none"+ class="max-w-40 px-4 aria-pressed:border-edge-frame aria-pressed:bg-active aria-pressed:text-ink"><span class="truncate">{props.view.name}</span></ContextMenu.Trigger>diff --git a/apps/web/src/features/database/components/grid-cell.test.tsx b/apps/web/src/features/database/components/grid-cell.test.tsxindex 765e8b54ef..78a5c25f07 100644--- a/apps/web/src/features/database/components/grid-cell.test.tsx+++ b/apps/web/src/features/database/components/grid-cell.test.tsx@@ -83,6 +83,42 @@ function MentionPicker(props: DatabaseMentionPickerProps) {}describe('grid cell', () => {+ it.each([true, false])(+ 'preserves inline editor bounds only when requested (%s)',+ async (preserveSize) => {+ let width = 54;+ vi.spyOn(+ HTMLButtonElement.prototype,+ 'getBoundingClientRect'+ ).mockImplementation(() => new DOMRect(0, 0, width, 24));+ const { container } = render(() => (+ <GridCell+ column={column}+ value="Original"+ canEdit+ preserveSize={preserveSize}+ onWrite={vi.fn(async () => true)}+ onAddOption={vi.fn(async () => true)}+ />+ ));+ const cell = container.firstElementChild as HTMLDivElement;+ fireEvent.click(screen.getByRole('button', { name: /Name: Original/ }));+ expect(cell.style.width).toBe(preserveSize ? '54px' : '');+ expect(cell.style.height).toBe(preserveSize ? '24px' : '');+ fireEvent.keyDown(screen.getByRole('textbox'), { key: 'Escape' });+ await waitFor(() => expect(cell.style.width).toBe(''));+ expect(cell.style.height).toBe('');+ width = 72;+ fireEvent.keyDown(+ screen.getByRole('button', { name: /Name: Original/ }),+ {+ key: 'F2',+ }+ );+ expect(cell.style.width).toBe(preserveSize ? '72px' : '');+ fireEvent.keyDown(screen.getByRole('textbox'), { key: 'Escape' });+ }+ );it.each(['STRING', 'SELECT_STRING'] as const)('lets Tab leave a %s editor at a grid boundary',async (dataType) => {@@ -806,30 +842,177 @@ describe('grid cell', () => {);});- it('keeps an invalid numeric draft focused instead of navigating on Tab', () => {+ it.each([1, -1] as const)(+ 'lets Tab leave an invalid number in direction %s without saving',+ async (direction) => {+ const onWrite = vi.fn(async () => true);+ render(() => (+ <>+ <button type="button">Before grid</button>+ <GridCell+ column={{ ...column, dataType: 'NUMBER' }}+ value={12}+ canEdit+ onWrite={onWrite}+ onAddOption={vi.fn(async () => true)}+ />+ <button type="button">After grid</button>+ </>+ ));+ fireEvent.keyDown(screen.getByRole('button', { name: /Name: 12/ }), {+ key: 'x',+ });+ const input = screen.getByRole('textbox', { name: 'Edit Name' });+ await userEvent.tab({ shift: direction === -1 });+ expect(document.activeElement).toBe(+ screen.getByRole('button', {+ name: direction === -1 ? 'Before grid' : 'After grid',+ })+ );+ expect(screen.queryByRole('alert')).toBeNull();+ expect(input.getAttribute('aria-invalid')).toBe('true');+ expect((input as HTMLInputElement).value).toBe('x');+ expect(onWrite).not.toHaveBeenCalled();+ }+ );++ it('hides validation on blur but keeps the draft invalid and allows another field to save', async () => {+ const writeNumber = vi.fn(async () => true);+ const writeNotes = vi.fn(async () => true);+ render(() => (+ <>+ <GridCell+ column={{ ...column, dataType: 'NUMBER' }}+ value={12}+ canEdit+ onWrite={writeNumber}+ onAddOption={vi.fn(async () => true)}+ />+ <GridCell+ column={{ ...column, id: 'notes', name: 'Notes' }}+ value="Original"+ canEdit+ onWrite={writeNotes}+ onAddOption={vi.fn(async () => true)}+ />+ </>+ ));+ await userEvent.click(screen.getByRole('button', { name: /Name: 12/ }));+ const input = screen.getByRole('textbox', {+ name: 'Edit Name',+ }) as HTMLInputElement;+ fireEvent.input(input, { target: { value: 'invalid' } });+ fireEvent.keyDown(input, { key: 'Enter' });+ expect(screen.getByRole('alert').textContent).toBe('Enter a valid number');+ expect(input.getAttribute('aria-invalid')).toBe('true');+ await userEvent.click(+ screen.getByRole('button', { name: /Notes: Original/ })+ );+ const notes = screen.getByRole('textbox', { name: 'Edit Notes' });+ expect(document.activeElement).toBe(notes);+ expect(screen.queryByRole('alert')).toBeNull();+ expect(input.value).toBe('invalid');+ expect(input.getAttribute('aria-invalid')).toBe('true');+ expect(+ document.getElementById(input.getAttribute('aria-errormessage')!)+ ?.textContent+ ).toBe('Enter a valid number');+ fireEvent.input(notes, { target: { value: 'Updated notes' } });+ fireEvent.keyDown(notes, { key: 'Enter' });+ await waitFor(() =>+ expect(writeNotes).toHaveBeenCalledExactlyOnceWith('Updated notes')+ );+ expect(writeNumber).not.toHaveBeenCalled();+ await userEvent.click(input);+ expect(screen.getByRole('alert').textContent).toBe('Enter a valid number');+ fireEvent.input(input, { target: { value: 'still invalid' } });+ expect(input.getAttribute('aria-invalid')).toBe('true');+ fireEvent.input(input, { target: { value: '24' } });+ expect(input.getAttribute('aria-invalid')).toBe('false');+ expect(screen.queryByRole('alert')).toBeNull();+ fireEvent.keyDown(input, { key: 'Enter' });+ await waitFor(() =>+ expect(writeNumber).toHaveBeenCalledExactlyOnceWith(24)+ );+ });++ it('validates on blur without reopening the hint or taking focus back', async () => {const onWrite = vi.fn(async () => true);- const onNavigate = vi.fn(() => true);render(() => (- <GridCell- column={{ ...column, dataType: 'NUMBER' }}- value={12}- canEdit- onWrite={onWrite}- onAddOption={vi.fn(async () => true)}- onNavigate={onNavigate}- />+ <>+ <GridCell+ column={{ ...column, dataType: 'NUMBER' }}+ value={12}+ canEdit+ onWrite={onWrite}+ onAddOption={vi.fn(async () => true)}+ />+ <button type="button">Another control</button>+ </>));- fireEvent.keyDown(screen.getByRole('button', { name: /Name: 12/ }), {- key: 'x',- });+ await userEvent.click(screen.getByRole('button', { name: /Name: 12/ }));const input = screen.getByRole('textbox', { name: 'Edit Name' });- fireEvent.keyDown(input, { key: 'Tab' });+ fireEvent.input(input, { target: { value: 'invalid' } });+ const outside = screen.getByRole('button', { name: 'Another control' });+ await userEvent.click(outside);+ expect(document.activeElement).toBe(outside);+ expect(input.getAttribute('aria-invalid')).toBe('true');+ expect(screen.queryByRole('alert')).toBeNull();+ await userEvent.click(input);expect(screen.getByRole('alert').textContent).toBe('Enter a valid number');- expect(document.activeElement).toBe(input);- expect(onNavigate).not.toHaveBeenCalled();+ await userEvent.keyboard('{Escape}');+ expect(screen.queryByRole('textbox')).toBeNull();+ expect(screen.queryByRole('alert')).toBeNull();expect(onWrite).not.toHaveBeenCalled();});+ it.each(['Tab', 'ArrowDown', 'ArrowUp'])(+ 'navigates from an invalid number to another grid editor with %s',+ async (key) => {+ const onWrite = vi.fn(async () => true);+ let next: GridCellControl | undefined;+ const navigate = vi.fn(() => {+ next?.edit();+ return Boolean(next);+ });+ render(() => (+ <>+ <GridCell+ column={{ ...column, dataType: 'NUMBER' }}+ value={12}+ canEdit+ onWrite={onWrite}+ onAddOption={vi.fn(async () => true)}+ onNavigate={navigate}+ onNavigateRow={navigate}+ />+ <GridCell+ column={{ ...column, id: 'notes', name: 'Notes' }}+ value="Original"+ canEdit+ onWrite={onWrite}+ onAddOption={vi.fn(async () => true)}+ onReady={(control) => {+ next = control;+ }}+ />+ </>+ ));+ fireEvent.keyDown(screen.getByRole('button', { name: /Name: 12/ }), {+ key: 'x',+ });+ const input = screen.getByRole('textbox', { name: 'Edit Name' });+ fireEvent.keyDown(input, { key });+ expect(navigate).toHaveBeenCalledWith(key === 'ArrowUp' ? -1 : 1);+ expect(document.activeElement).toBe(+ screen.getByRole('textbox', { name: 'Edit Notes' })+ );+ expect(input.getAttribute('aria-invalid')).toBe('true');+ expect(screen.queryByRole('alert')).toBeNull();+ expect(onWrite).not.toHaveBeenCalled();+ }+ );+it.each(['9007199254740993', '-9007199254740993', '0x10', '1e309'])('keeps the numeric draft %s instead of silently coercing it on save',(draft) => {@@ -929,8 +1112,8 @@ describe('grid cell', () => {name: 'Search Status options',});await waitFor(() => expect(document.activeElement).toBe(search));- // The rows are Clear value, To do, then Done.- await userEvent.keyboard('{ArrowDown}{ArrowDown}{ArrowDown}');+ // Clear value is a footer button; only To do and Done are list options.+ await userEvent.keyboard('{ArrowDown}{ArrowDown}');expect(search.getAttribute('aria-activedescendant')).toBe(option.id);expect(document.activeElement).toBe(search);await userEvent.tab();diff --git a/apps/web/src/features/database/components/grid-cell.tsx b/apps/web/src/features/database/components/grid-cell.tsxindex 62449ccefa..7b4d998aeb 100644--- a/apps/web/src/features/database/components/grid-cell.tsx+++ b/apps/web/src/features/database/components/grid-cell.tsx@@ -1,4 +1,5 @@import { Popover } from '@kobalte/core/popover';+import { Tooltip } from '@kobalte/core/tooltip';import CaretDownIcon from '@phosphor/caret-down.svg';import { PropertyDateSelector } from '@property/editors/selectors/PropertyDateSelector';import { Checkbox } from '@ui/components/Checkbox';@@ -6,6 +7,7 @@ import { Dropdown } from '@ui/components/Dropdown';import {createMemo,createSignal,+ createUniqueId,For,type JSX,Match,@@ -175,6 +177,16 @@ export function GridCell(props: GridCellProps) {let booleanWrapper: HTMLDivElement | undefined;let focusEditor: (() => void) | undefined;let popupControl: GridCellControl | undefined;+ const [editorSize, setEditorSize] = createSignal<{+ width: number;+ height: number;+ }>();+ const editorStyle = () => {+ const size = props.preserveSize && editing() ? editorSize() : undefined;+ return size+ ? { width: `${size.width}px`, height: `${size.height}px` }+ : undefined;+ };const updateEditor = (seed?: string) => {if (!editable()) return;setSelectedMention(undefined);@@ -206,6 +218,10 @@ export function GridCell(props: GridCellProps) {};const beginEdit = (seed?: string, event?: Event) => {if (!editable()) return;+ if (props.preserveSize && !editing() && trigger) {+ const { width, height } = trigger.getBoundingClientRect();+ setEditorSize({ width, height });+ }opening.measure(() => updateEditor(seed), event, !editing());};const updateDraft = (value: string) => {@@ -317,7 +333,12 @@ export function GridCell(props: GridCellProps) {document.activeElement === document.body ||document.activeElement === trigger)- focusAdjacent(trigger, direction);+ focusAdjacent(+ editing() && previousFocus instanceof HTMLElement+ ? previousFocus+ : trigger,+ direction+ );});return true;}}@@ -325,7 +346,7 @@ export function GridCell(props: GridCellProps) {);return (- <div ref={cell} class="relative min-w-0">+ <div ref={cell} class="relative min-w-0" style={editorStyle()}><Switch><Match when={cellKind() === 'editing'}>{renderEditor()}</Match><Match when={cellKind() === 'boolean'}>@@ -367,6 +388,7 @@ export function GridCell(props: GridCellProps) {trigger = element;}}tabindex={-1}+ data-cell-displayclass="px-2.5 py-1.5 outline-none focus-visible:ring-2 focus-visible:ring-ink/50"><Show when={props.value !== null}>@@ -473,6 +495,7 @@ function BooleanCell(props: {props.wrapperRef(element);}}tabindex={props.editable ? undefined : -1}+ data-cell-displayclass="flex min-h-9 items-center px-3 outline-none focus-visible:ring-2 focus-visible:ring-ink/50"checked={Boolean(props.value)}disabled={!props.editable}@@ -518,6 +541,7 @@ function TextCell(props: {<buttonref={props.ref}type="button"+ data-cell-displayclass="flex min-h-9 w-full min-w-0 items-center rounded px-2.5 py-1.5 text-left text-[13px] leading-5 outline-none hover:bg-hover focus-visible:ring-2 focus-visible:ring-ink/50"classList={{'text-ink-muted': !props.editable,@@ -648,6 +672,8 @@ function InlineEditor(props: {let input: HTMLInputElement | undefined;let textFocus: (() => void) | undefined;const [error, setError] = createSignal('');+ const [focused, setFocused] = createSignal(false);+ const errorId = createUniqueId();let finishing = false;const showingReference = () =>props.column.dataType === 'ENTITY' &&@@ -660,7 +686,7 @@ function InlineEditor(props: {textFocus();return;}- input?.focus();+ input?.focus({ preventScroll: true });if (props.selectAll) input?.select();else if (input?.type === 'text')input.setSelectionRange(input.value.length, input.value.length);@@ -684,7 +710,6 @@ function InlineEditor(props: {: props.draft;if (value === undefined) {setError('Enter a valid number');- input?.focus();return false;}finishing = true;@@ -711,9 +736,8 @@ function InlineEditor(props: {props.onClose();}if (event.key === 'Tab') {- if (!commit(false)) event.preventDefault();- else if (props.onNavigate?.(event.shiftKey ? -1 : 1))- event.preventDefault();+ commit(false);+ if (props.onNavigate?.(event.shiftKey ? -1 : 1)) event.preventDefault();}if ((event.key === 'ArrowDown' || event.key === 'ArrowUp') &&@@ -724,82 +748,105 @@ function InlineEditor(props: {const direction = event.key === 'ArrowDown' ? 1 : -1;if (!caretOnEdgeLine(event.currentTarget, direction)) return;event.preventDefault();- if (commit(false)) props.onNavigateRow(direction);+ commit(false);+ props.onNavigateRow(direction);}};return (- <div class="relative min-w-0">- <Show- when={props.column.dataType === 'STRING' && props.renderTextEditor}- fallback={- <input- ref={(element) => {- input = element;- props.onEditorReady?.(focus);- }}- type="text"- placeholder={showingReference() ? undefined : props.emptyLabel}- inputmode={- props.column.dataType === 'NUMBER' ? 'decimal' : undefined- }- aria-label={`Edit ${props.column.name}`}- aria-invalid={Boolean(error())}- title={error() || undefined}- value={props.draft}- onInput={(event) => {- props.onDraft(event.currentTarget.value);- setError('');- }}- onBlur={() => {- if (!props.mentionOpen) commit(false);- }}- onKeyDown={onKeyDown}- class="min-h-9 w-full min-w-0 rounded border border-ink/40 px-2.5 py-1.5 text-[13px] text-ink outline-none ring-2 ring-ink/10"- classList={{- 'bg-input-focus': !showingReference(),- 'bg-transparent caret-transparent': showingReference(),- }}- />- }- >- {(render) =>- render()({- label: `Edit ${props.column.name}`,- get value() {- return props.draft;- },- class:- 'min-h-9 w-full min-w-0 rounded border border-ink/40 bg-input-focus px-2.5 py-1.5 text-[13px] text-ink outline-none ring-2 ring-ink/10',- autoFocus: true,- selectAll: props.selectAll,- inferType: props.column.inferType,- onInferMention: (mention) => {- // Removing a focused editor can synchronously blur it. The typed- // reference write owns this commit; do not also save the @ draft.- finishing = true;- props.onInferMention?.(mention);- },- onInput: props.onDraft,- onKeyDown,- onBlur: () => {- if (!props.mentionOpen) commit(false);- },- onReady: (focus) => {- textFocus = focus;- props.onEditorReady?.(focus);- },- })- }- </Show>- <Show when={error()}>- <span- class="absolute left-0 top-full z-10 rounded bg-menu px-2 py-1 text-xs text-failure-ink shadow-menu"- role="alert"+ <Tooltip+ open={Boolean(error()) && focused()}+ triggerOnFocusOnly+ placement="bottom-start"+ gutter={4}+ overflowPadding={16}+ fitViewport+ >+ <Tooltip.Trigger as="div" tabindex={-1} class="relative min-w-0">+ <Show+ when={props.column.dataType === 'STRING' && props.renderTextEditor}+ fallback={+ <input+ ref={(element) => {+ input = element;+ props.onEditorReady?.(focus);+ }}+ type="text"+ data-cell-text-editor+ placeholder={showingReference() ? undefined : props.emptyLabel}+ inputmode={+ props.column.dataType === 'NUMBER' ? 'decimal' : undefined+ }+ aria-label={`Edit ${props.column.name}`}+ aria-invalid={Boolean(error())}+ aria-errormessage={error() ? errorId : undefined}+ value={props.draft}+ onInput={(event) => {+ props.onDraft(event.currentTarget.value);+ if (+ event.currentTarget.value.trim() === '' ||+ inferDatabaseNumber(event.currentTarget.value) !== undefined+ )+ setError('');+ }}+ onFocus={() => setFocused(true)}+ onBlur={() => {+ setFocused(false);+ if (!props.mentionOpen) commit(false);+ }}+ onKeyDown={onKeyDown}+ class="min-h-9 w-full min-w-0 rounded border border-ink/40 px-2.5 py-1.5 text-[13px] text-ink outline-none ring-2 ring-ink/10 aria-invalid:border-failure aria-invalid:ring-failure"+ classList={{+ 'bg-input-focus': !showingReference(),+ 'bg-transparent caret-transparent': showingReference(),+ }}+ />+ }>- {error()}- </span>+ {(render) =>+ render()({+ label: `Edit ${props.column.name}`,+ get value() {+ return props.draft;+ },+ class:+ 'min-h-9 w-full min-w-0 rounded border border-ink/40 bg-input-focus px-2.5 py-1.5 text-[13px] text-ink outline-none ring-2 ring-ink/10',+ autoFocus: true,+ selectAll: props.selectAll,+ inferType: props.column.inferType,+ onInferMention: (mention) => {+ // Removing a focused editor can synchronously blur it. The typed+ // reference write owns this commit; do not also save the @ draft.+ finishing = true;+ props.onInferMention?.(mention);+ },+ onInput: props.onDraft,+ onKeyDown,+ onBlur: () => {+ if (!props.mentionOpen) commit(false);+ },+ onReady: (focus) => {+ textFocus = focus;+ props.onEditorReady?.(focus);+ },+ })+ }+ </Show>+ <Show when={error() && !focused()}>+ <span id={errorId} class="sr-only">+ {error()}+ </span>+ </Show>+ </Tooltip.Trigger>+ <Show when={error() && focused()}>+ <Tooltip.Portal>+ <Tooltip.Content class="pointer-events-none z-tool-tip w-max max-w-[min(24rem,calc(100vw-32px))] rounded-lg border border-edge bg-tooltip px-2 py-1 text-xs text-failure-ink shadow-md wrap-break-word">+ <span id={errorId} role="alert">+ {error()}+ </span>+ </Tooltip.Content>+ </Tooltip.Portal></Show>- </div>+ </Tooltip>);}@@ -907,6 +954,7 @@ function SelectCell(props: GridCellProps) {} else setOpen(false);}const trigger = {+ 'data-cell-display': '',onPointerDown: (event: PointerEvent) => {openingEvent = event;},@@ -1049,6 +1097,7 @@ function DateCell(props: GridCellProps) {onMount(() => props.onReady?.({ focus: keys.focus, edit }));onCleanup(() => props.onReady?.(undefined));const trigger = {+ 'data-cell-display': '',onPointerDown: (event: PointerEvent) => {openingEvent = event;},diff --git a/apps/web/src/features/database/components/new-board-group.tsx b/apps/web/src/features/database/components/new-board-group.tsxnew file mode 100644index 0000000000..8a07212f71--- /dev/null+++ b/apps/web/src/features/database/components/new-board-group.tsx@@ -0,0 +1,137 @@+import EmptyStateNoFilterMatchGraphic from '@design/empty-state-no-filter-match.svg';+import PlusIcon from '@phosphor/plus.svg';+import type { DatabaseOpsError } from '@service-storage/databases';+import { Button } from '@ui/components/Button';+import type { Result } from 'neverthrow';+import { createSignal, Show } from 'solid-js';+import { KanbanBoard } from '../../../components/kanban/kanban-board';+import { inferDatabaseNumber } from '../core/column-inference';+import { columnSchemaMessage } from '../core/column-schema';+import type { DatabaseViewColumn } from '../core/database-view';+import { isDatabaseNameTaken } from '../core/property-creation';++export function NewBoardGroup(props: {+ column: DatabaseViewColumn;+ onSave: (label: string) => Promise<Result<void, DatabaseOpsError>>;+}) {+ const [adding, setAdding] = createSignal(false);+ const [draft, setDraft] = createSignal('');+ const [pending, setPending] = createSignal(false);+ const [error, setError] = createSignal('');+ let input: HTMLInputElement | undefined;+ const cancel = () => {+ if (!pending()) {+ setAdding(false);+ setError('');+ }+ };+ async function save(event: SubmitEvent) {+ event.preventDefault();+ const entered = draft().trim();+ if (!entered || pending()) return;+ const number =+ props.column.dataType === 'SELECT_NUMBER'+ ? inferDatabaseNumber(entered)+ : undefined;+ if (props.column.dataType === 'SELECT_NUMBER' && number === undefined) {+ setError('Enter a valid number for this group.');+ return;+ }+ const label = number === undefined ? entered : String(number);+ if (+ isDatabaseNameTaken(+ label,+ props.column.options.map((option) => option.label)+ )+ ) {+ setError('A group with this name already exists.');+ return;+ }+ setPending(true);+ setError('');+ const added = await props.onSave(label);+ setPending(false);+ added.match(+ () => {+ setAdding(false);+ setDraft('');+ },+ (error) => setError(columnSchemaMessage(error))+ );+ }+ return (+ <KanbanBoard.ColumnPlaceholder aria-label="New group">+ <div aria-hidden="true" class="h-20 w-32 shrink-0 text-ink-extra-muted">+ <EmptyStateNoFilterMatchGraphic class="size-full" />+ </div>+ <Show+ when={adding()}+ fallback={+ <>+ <h2 class="text-sm font-medium">Create a group</h2>+ <Button+ size="sm"+ variant="outline"+ class="gap-2"+ onClick={() => {+ setDraft('');+ setAdding(true);+ queueMicrotask(() => input?.focus());+ }}+ >+ <PlusIcon class="size-3.5" />+ New group+ </Button>+ </>+ }+ >+ <form class="w-full text-left" onSubmit={(event) => void save(event)}>+ <p class="mb-2 block text-xs font-medium text-ink-muted">+ New {props.column.name.toLowerCase()} group+ </p>+ <input+ ref={input}+ value={draft()}+ maxlength={200}+ aria-label="New group name"+ placeholder={+ props.column.dataType === 'SELECT_NUMBER'+ ? 'Enter a number…'+ : 'Group name…'+ }+ readOnly={pending()}+ class="w-full rounded-md border border-edge-muted bg-input px-2.5 py-2 text-xs outline-none focus:border-ink/50"+ onInput={(event) => {+ setDraft(event.currentTarget.value);+ setError('');+ }}+ onKeyDown={(event) => {+ if (event.key === 'Escape') {+ event.preventDefault();+ cancel();+ }+ }}+ />+ <Show when={error()}>+ <p role="alert" class="mt-2 text-xs leading-5 text-failure-ink">+ {error()}+ </p>+ </Show>+ <div class="mt-3 flex items-center justify-end gap-2">+ <Button size="sm" disabled={pending()} onClick={cancel}>+ Cancel+ </Button>+ <Button+ size="sm"+ type="submit"+ variant="cta"+ disabled={pending() || !draft().trim()}+ >+ {pending() ? 'Adding…' : 'Add group'}+ </Button>+ </div>+ </form>+ </Show>+ </KanbanBoard.ColumnPlaceholder>+ );+}diff --git a/apps/web/src/features/database/components/option-picker.test.tsx b/apps/web/src/features/database/components/option-picker.test.tsxindex 5ae50d1288..4acd61bf4a 100644--- a/apps/web/src/features/database/components/option-picker.test.tsx+++ b/apps/web/src/features/database/components/option-picker.test.tsx@@ -248,10 +248,11 @@ describe('option picker', () => {expect(onCreate).not.toHaveBeenCalled();});- it('offers Clear value only while something is selected and nothing is typed', async () => {+ it('clears the selected value from a keyboard-accessible footer outside the option list', async () => {const onClear = vi.fn();render(() => {const [search, setSearch] = createSignal('');+ const [selected, setSelected] = createSignal(['Done']);return (<OptionPickercolumn={{@@ -265,17 +266,20 @@ describe('option picker', () => {],writable: true,}}- selected={['Done']}+ selected={selected()}search={search()}onSearch={setSearch}onPick={vi.fn()}- onClear={onClear}+ onClear={() => {+ onClear();+ setSelected([]);+ }}onCreate={vi.fn()}/>);});expect(screen.getAllByRole('option').map((row) => row.textContent)).toEqual(- ['Clear value', 'To do', 'Done']+ ['To do', 'Done']);expect(screen.getByRole('option', { name: 'Done' }).getAttribute('aria-selected')@@ -284,10 +288,21 @@ describe('option picker', () => {name: 'Search Status options',});await userEvent.type(search, 'd');- expect(screen.queryByRole('option', { name: 'Clear value' })).toBeNull();+ const clear = screen.getByRole('button', { name: 'Clear value' });+ expect(clear.closest('[role="listbox"]')).toBeNull();await userEvent.clear(search);- await userEvent.click(screen.getByRole('option', { name: 'Clear value' }));+ await userEvent.tab();+ expect(document.activeElement).toBe(clear);+ await userEvent.keyboard('{ArrowUp}');+ expect(document.activeElement).toBe(search);+ expect(search.getAttribute('aria-activedescendant')).toBe(+ screen.getByRole('option', { name: 'Done' }).id+ );+ await userEvent.keyboard('{ArrowDown}');+ expect(document.activeElement).toBe(clear);+ await userEvent.keyboard('{Enter}');expect(onClear).toHaveBeenCalledOnce();+ expect(screen.queryByRole('button', { name: 'Clear value' })).toBeNull();});it('hands Tab to its owner with the option it would choose', async () => {diff --git a/apps/web/src/features/database/components/option-picker.tsx b/apps/web/src/features/database/components/option-picker.tsxindex cab02868d0..ac218f9572 100644--- a/apps/web/src/features/database/components/option-picker.tsx+++ b/apps/web/src/features/database/components/option-picker.tsx@@ -1,6 +1,7 @@import CheckIcon from '@phosphor/check.svg';import PlusIcon from '@phosphor/plus.svg';import { Key } from '@solid-primitives/keyed';+import { Button } from '@ui/components/Button';import {createMemo,createSignal,@@ -17,7 +18,6 @@ import { OptionEditor } from './option-editor';import { OptionPill } from './select-pill';type PickerRow =- | { kind: 'clear' }| { kind: 'option'; option: DatabaseOption }| { kind: 'create'; label: string };@@ -62,6 +62,8 @@ export function OptionPicker(props: {}) {const listId = createUniqueId();const [active, setActive] = createSignal(-1);+ let input: HTMLInputElement | undefined;+ let clearButton: HTMLButtonElement | undefined;const matches = () => {const term = props.search.trim().toLocaleLowerCase();return props.column.options.filter((option) =>@@ -81,9 +83,6 @@ export function OptionPicker(props: {const rows = createMemo((): PickerRow[] => {const created = creatable();return [- ...(props.selected.length && !props.search.trim()- ? [{ kind: 'clear' } as const]- : []),...matches().map((option) => ({ kind: 'option', option }) as const),...(created !== undefined? [{ kind: 'create', label: created } as const]@@ -104,12 +103,22 @@ export function OptionPicker(props: {const activate = (row: PickerRow | undefined) =>match(row).with(undefined, () => undefined)- .with({ kind: 'clear' }, () => props.onClear()).with({ kind: 'option' }, ({ option }) => props.onPick(option.label)).with({ kind: 'create' }, ({ label }) => props.onCreate(label)).exhaustive();const move = (step: 1 | -1) => {const count = rows().length;+ if (+ step === 1 &&+ clearButton &&+ props.selected.length &&+ !props.search.trim() &&+ active() === count - 1+ ) {+ setActive(-1);+ clearButton.focus();+ return;+ }if (!count) return;setActive((current) =>current < 0@@ -122,7 +131,10 @@ export function OptionPicker(props: {return (<div class="flex w-56 flex-col"><input- ref={props.inputRef}+ ref={(element) => {+ input = element;+ props.inputRef?.(element);+ }}role="combobox"aria-label={`Search ${props.column.name} options`}aria-expanded="true"@@ -171,9 +183,6 @@ export function OptionPicker(props: {onClick={() => activate(row())}><Switch>- <Match when={row().kind === 'clear'}>- <span class="flex-1 text-ink-muted">Clear value</span>- </Match><Match when={createdOf(row())}>{(label) => (<>@@ -218,6 +227,33 @@ export function OptionPicker(props: {<p class="px-1.5 py-1 text-xs text-ink-placeholder">No options</p></Show></div>+ <Show when={props.selected.length}>+ <div class="mt-2 flex items-center justify-end border-t border-edge-divider pt-2 pb-2">+ <Button+ type="button"+ variant="ghost"+ size="sm"+ ref={clearButton}+ onClick={props.onClear}+ onKeyDown={(event) => {+ if (event.isComposing || event.keyCode === 229) return;+ if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {+ event.preventDefault();+ setActive(+ event.key === 'ArrowUp'+ ? rows().length - 1+ : rows().length+ ? 0+ : -1+ );+ input?.focus();+ } else props.onKeyDown?.(event, undefined);+ }}+ >+ Clear value+ </Button>+ </div>+ </Show><Show when={props.error}><p role="alert" class="px-1.5 pt-1 text-xs text-failure-ink">{props.error}diff --git a/apps/web/src/features/database/components/view-control-popover.tsx b/apps/web/src/features/database/components/view-control-popover.tsxindex e2ed415479..84e834d0b1 100644--- a/apps/web/src/features/database/components/view-control-popover.tsx+++ b/apps/web/src/features/database/components/view-control-popover.tsx@@ -1,5 +1,6 @@import { Popover } from '@kobalte/core/popover';import XIcon from '@phosphor/x.svg';+import { Button } from '@ui/components/Button';import { type JSX, Show } from 'solid-js';export function ToolbarPopover(props: {@@ -18,14 +19,13 @@ export function ToolbarPopover(props: {overflowPadding={8}><Popover.Trigger- class="flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-xs outline-none hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-ink/50 data-expanded:bg-hover [&>svg]:shrink-0"- classList={{- 'text-accent': !!props.count,- 'text-ink-muted': !props.count,- 'justify-center px-2': props.compact,- }}- aria-label={`${props.label}${props.count ? ` ${props.count}` : ''}`}- title={props.label}+ as={Button}+ variant="ghost"+ size="md"+ square={props.compact && !props.count}+ class={props.count ? 'text-accent' : undefined}+ label={`${props.label}${props.count ? ` ${props.count}` : ''}`}+ tooltip={props.label}>{props.icon}<Show when={!props.compact}>{props.label}</Show>diff --git a/apps/web/src/features/database/core/grid-cell-editor.ts b/apps/web/src/features/database/core/grid-cell-editor.tsindex 343794af2c..4eca6b61fc 100644--- a/apps/web/src/features/database/core/grid-cell-editor.ts+++ b/apps/web/src/features/database/core/grid-cell-editor.ts@@ -5,6 +5,8 @@ export type GridCellControl = {export type GridCellEditorOptions = {initialEdit?: boolean;+ /** Keeps an inline editor within the displayed value's bounds. */+ preserveSize?: boolean;onEditorReady?: (focus: () => void) => void;onReady?: (control: GridCellControl | undefined) => void;onNavigate?: (direction: 1 | -1) => boolean;diff --git a/apps/web/src/features/database/tests/board-layout.ts b/apps/web/src/features/database/tests/board-layout.tsnew file mode 100644index 0000000000..e857410794--- /dev/null+++ b/apps/web/src/features/database/tests/board-layout.ts@@ -0,0 +1,45 @@+import type { Accessor } from 'solid-js';+import { afterEach, beforeEach, vi } from 'vitest';++// JSDOM has no layout. Render all IDs while retaining the real drag surface.+vi.mock('@app/components/kanban/kanban-virtualizer', () => ({+ createKanbanVirtualizer: (options: {+ keys: Accessor<readonly (string | number)[]>;+ getScrollElement: () => HTMLDivElement | undefined;+ }) => ({+ get scrollElement() {+ return options.getScrollElement();+ },+ getVirtualItems: () =>+ options.keys().map((key, index) => ({+ key,+ index,+ start: index * 100,+ size: 100,+ })),+ getTotalSize: () => options.keys().length * 100,+ scrollToIndex: vi.fn(),+ measureElement: vi.fn(),+ takeSnapshot: () => [],+ }),+}));++beforeEach(() => {+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe = vi.fn();+ unobserve = vi.fn();+ disconnect = vi.fn();+ }+ );+});+afterEach(() => vi.unstubAllGlobals());++export function boardLane(label: string): HTMLElement {+ const lane = Array.from(+ document.querySelectorAll<HTMLElement>('[data-kanban-lane]')+ ).find((lane) => lane.getAttribute('aria-label') === label);+ if (!lane) throw new Error(`Missing board lane: ${label}`);+ return lane;+}diff --git a/apps/web/src/features/database/views/database-board-view.test.tsx b/apps/web/src/features/database/views/database-board-view.test.tsxindex 837b7e219b..acb4b89a33 100644--- a/apps/web/src/features/database/views/database-board-view.test.tsx+++ b/apps/web/src/features/database/views/database-board-view.test.tsx@@ -1,3 +1,4 @@+import '../tests/board-layout';import type { CardPosition } from '@service-storage/generated/schemas/cardPosition';import type { DatabaseView } from '@service-storage/generated/schemas/databaseView';import {@@ -54,14 +55,18 @@ beforeEach(() => {vi.spyOn(window, 'scrollTo').mockImplementation(() => {});vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (this: HTMLElement) {- if (this.classList.contains('overflow-auto'))+ if (this.hasAttribute('data-kanban-board-viewport'))return new DOMRect(0, 0, 880, 500);const lane = this.closest('[data-kanban-lane]');const x = lane?.getAttribute('aria-label') === 'To do lane' ? 300 : 0;+ const card = this.hasAttribute('data-kanban-card-layout')+ ? this.querySelector('[data-kanban-card]')+ : this;const cardIndex = lane- ? Array.from(lane.querySelectorAll('[data-kanban-card]')).indexOf(this)+ ? Array.from(lane.querySelectorAll('[data-kanban-card]')).indexOf(card!): 0;- return this.hasAttribute('data-row-id')+ return this.hasAttribute('data-row-id') ||+ this.hasAttribute('data-kanban-card-layout')? new DOMRect(x + 8, 60 + Math.max(0, cardIndex) * 100, 264, 80): new DOMRect(x, 0, 280, 500);}diff --git a/apps/web/src/features/database/views/database-board-view.tsx b/apps/web/src/features/database/views/database-board-view.tsxindex 9788082793..0e62c202aa 100644--- a/apps/web/src/features/database/views/database-board-view.tsx+++ b/apps/web/src/features/database/views/database-board-view.tsx@@ -355,12 +355,6 @@ function GroupedBoard(changeLayout(withLaneHidden(props.layout, lane, true)): undefined}- onHideEmptyLanes={- props.onViewChange- ? (hideEmptyLanes) =>- changeLayout({ ...props.layout, hideEmptyLanes })- : undefined- }onCreate={create}onAddGroup={addGroup()}controlsRef={props.controlsRef}diff --git a/apps/web/src/features/database/views/database-records-view.test.tsx b/apps/web/src/features/database/views/database-records-view.test.tsxindex 67a81eba97..0df1607aa8 100644--- a/apps/web/src/features/database/views/database-records-view.test.tsx+++ b/apps/web/src/features/database/views/database-records-view.test.tsx@@ -29,6 +29,7 @@ import type { DatabaseViewColumn } from '../core/database-view';import type { ViewChange } from '../core/view-state';import { allRecordsView } from '../core/views';import type { DatabaseWriteFailure } from '../core/write-failure';+import { boardLane } from '../tests/board-layout';import { createFakeRowsSource, titleContains } from '../tests/fake-rows-source';import type { BoardPositions } from './database-board-view';import {@@ -515,7 +516,7 @@ describe('database table view', () => {});fireEvent.input(input, { target: { value: 'Invalid number' } });fireEvent.keyDown(input, { key: 'Enter' });- expect(within(dialog).getByRole('alert').textContent).toBe(+ expect(screen.getByRole('alert').textContent).toBe('Enter a valid number');}@@ -529,7 +530,7 @@ describe('database table view', () => {expect(within(dialog).queryByRole('textbox', { name: 'Edit Amount' })).toBeNull();- expect(within(dialog).queryByRole('alert')).toBeNull();+ expect(screen.queryByRole('alert')).toBeNull();const title = within(dialog).getByRole('textbox', {name: 'Edit Name',}) as HTMLInputElement;@@ -1725,9 +1726,11 @@ describe('database table view', () => {)}/>));- await screen.findByRole('region', { name: 'Done lane' });+ await waitFor(() => expect(boardLane('Done lane')).toBeTruthy());fireEvent.click(screen.getByText('New record', { selector: 'button' }));- const lanes = screen.getAllByRole('region');+ const lanes = screen+ .getAllByRole('region')+ .filter((lane) => lane.hasAttribute('data-kanban-lane'));expect(lanes[0].getAttribute('aria-label')).toBe('Done lane');const draft = within(lanes[0]).getByRole('textbox', {name: 'New record title',diff --git a/apps/web/src/features/tasks-view/components/task-board-composition.test.ts b/apps/web/src/features/tasks-view/components/task-board-composition.test.tsindex 0ae2dad44f..7490370fc0 100644--- a/apps/web/src/features/tasks-view/components/task-board-composition.test.ts+++ b/apps/web/src/features/tasks-view/components/task-board-composition.test.ts@@ -1,7 +1,4 @@-import type {- Kanban,- KanbanCrossColumnDrop,-} from '@app/components/kanban/kanban';+import type { Kanban, KanbanDrop } from '@app/components/kanban/kanban';import { cleanup, render } from '@solidjs/testing-library';import {type Accessor,@@ -17,7 +14,7 @@ import type { TaskBoardColumn, TaskBoardTask } from '../core/task-board';import { TaskBoard } from './task-board';const drag = vi.hoisted(() => ({- drop: undefined as ((drop: KanbanCrossColumnDrop) => void) | undefined,+ drop: undefined as ((drop: KanbanDrop) => void) | undefined,}));const scrolled = vi.hoisted(() => vi.fn());const visibility = vi.hoisted(() => ({ end: (): boolean => true }));@@ -29,7 +26,10 @@ vi.mock('@app/components/kanban/kanban', async (importOriginal) => {return {...original,Kanban: (props: ComponentProps<typeof Kanban>) => {- if (props.mode === 'cross-column') drag.drop = props.onDrop;+ drag.drop = (drop) => {+ if (props.mode !== 'cross-column') props.onDrop(drop);+ else if (drop.kind === 'card') props.onDrop(drop);+ };return original.Kanban(props);},};@@ -39,7 +39,11 @@ vi.mock('@app/components/kanban/kanban-virtualizer', () => ({createKanbanVirtualizer: (options: {direction: string;keys: Accessor<readonly (string | number)[]>;+ getScrollElement: () => HTMLDivElement | undefined;}) => ({+ get scrollElement() {+ return options.getScrollElement();+ },getVirtualItems: () =>options.keys()@@ -183,14 +187,14 @@ it('preserves reactive card content and column ownership across regrouping and fexpect(document.getElementById(labelId ?? '')?.textContent).toBe('alice');expect(lane- ?.querySelector('[data-task-board-scroll]')+ ?.querySelector('[data-kanban-board-scroll]')?.getAttribute('aria-labelledby')).toBe(labelId);setHidden(false);expect(view.queryByText('Hidden')).toBeNull();await Promise.resolve();- const spacer = view.container.querySelector('[data-task-board-rows]');+ const spacer = view.container.querySelector('[data-kanban-board-rows]');expect(spacer?.nextElementSibling?.textContent).toBe('alice paging');});diff --git a/apps/web/src/features/tasks-view/components/task-board.tsx b/apps/web/src/features/tasks-view/components/task-board.tsxindex 7a87667161..f69faca4b0 100644--- a/apps/web/src/features/tasks-view/components/task-board.tsx+++ b/apps/web/src/features/tasks-view/components/task-board.tsx@@ -1,78 +1,25 @@-import {- Kanban,- KanbanCard,- KanbanLane,- useKanbanDropTarget,-} from '@app/components/kanban/kanban';-import {- createKanbanAnimation,- type KanbanAnimationItem,-} from '@app/components/kanban/kanban-animation';-import {- createKanbanVirtualizer,- type KanbanScrollSnapshot,-} from '@app/components/kanban/kanban-virtualizer';-import { createKanbanWheelScroll } from '@app/components/kanban/kanban-wheel-scroll';import EmptyStateNoFilterMatchGraphic from '@design/empty-state-no-filter-match.svg';-import { Key } from '@solid-primitives/keyed';import { Button } from '@ui/components/Button';-import { Scroll } from '@ui/components/Scroll';import {type Accessor,createContext,- createEffect,createMemo,- createSignal,- createUniqueId,type JSX,- on,- onCleanup,Show,useContext,} from 'solid-js';+import { KanbanBoard } from '../../../components/kanban/kanban-board';import type {TaskBoardColumn,TaskBoardMove,TaskBoardTask,} from '../core/task-board';-import { taskBoardRevealIndices } from '../core/task-board-reveal';--const END_COLUMN_KEY = -1;--type Reveal = { id: string; toLane: string; scope?: string };--type BoardContextValue = {- columns: Accessor<readonly TaskBoardColumn[]>;- animationScope: Accessor<string | undefined>;- reveal: Accessor<Reveal | undefined>;- onRevealed(request: Reveal): void;- attachViewport(element: HTMLDivElement): () => void;-};--type ColumnContextValue = {- column: Accessor<TaskBoardColumn>;- headerId: string;- snapshot?: KanbanScrollSnapshot;- onSnapshot(snapshot: KanbanScrollSnapshot): void;-};--const BoardContext = createContext<BoardContextValue>();-const ColumnContext = createContext<ColumnContextValue>();-const ColumnHoverContext = createContext<Accessor<boolean>>();-function useBoardContext() {- const context = useContext(BoardContext);- if (!context) throw new Error('TaskBoard.Root is required');- return context;-}--function useColumnContext() {- const context = useContext(ColumnContext);- if (!context) throw new Error('TaskBoard.Columns is required');- return context;-}+const TaskColumnsContext =+ createContext<Accessor<readonly TaskBoardColumn[]>>();+const TaskColumnContext = createContext<Accessor<TaskBoardColumn>>();-/** Owns drag motion and reveal requests, without task queries or property rendering. */+/** Tasks own their entity data; the shared board owns layout and dragging. */function Root(props: {columns: readonly TaskBoardColumn[];animationScope?: string;@@ -81,470 +28,78 @@ function Root(props: {ref?: (element: HTMLDivElement) => void;children: JSX.Element;}) {- let viewport: HTMLDivElement | undefined;- let revealGeneration = 0;- const [reveal, setReveal] = createSignal<Reveal>();- const motion = createKanbanAnimation({- viewport: () => viewport,- items: () => {- if (!viewport) {- return [];- }-- const items: KanbanAnimationItem[] = [];-- for (const layout of viewport.querySelectorAll<HTMLElement>(- '[data-task-board-column]'- )) {- const element = layout.firstElementChild;-- if (!(element instanceof HTMLElement)) {- continue;- }-- const key = JSON.stringify(['column', layout.dataset.taskBoardColumn]);- items.push({ key, element, layout });-- for (const card of element.querySelectorAll<HTMLElement>(- '[data-kanban-card]'- )) {- const row = card.parentElement;-- if (!row) {- continue;- }-- items.push({- key: JSON.stringify([key, card.dataset.kanbanCard]),- identity: card.dataset.kanbanCard,- parentKey: key,- element: card,- layout: row,- });- }- }-- return items;- },- });-- let finishHover: (() => void) | undefined;- const endHover = () => {- finishHover?.();- finishHover = undefined;- document.removeEventListener('mouseup', endHover);- };- const startHover = (event: MouseEvent) => {- if (- !(event.target instanceof Element) ||- !event.target.closest('[data-kanban-card]')- ) {- return;- }-- endHover();- finishHover = motion.beginHover();- document.addEventListener('mouseup', endHover);- };-- createEffect(- on(- () => props.animationScope,- () => {- revealGeneration += 1;- setReveal(undefined);- motion.cancel();- }- )+ const columns = createMemo(() =>+ props.columns.map((column) => ({+ id: column.id,+ label: column.label,+ itemIds: column.tasks.map((task) => task.id),+ })));- onCleanup(() => {- viewport?.removeEventListener('mousedown', startHover);- endHover();- motion.cancel();- });-- const context: BoardContextValue = {- columns: () => props.columns,- animationScope: () => props.animationScope,- reveal,- onRevealed: (request) =>- setReveal((current) => (current === request ? undefined : current)),- attachViewport: (element) => {- viewport?.removeEventListener('mousedown', startHover);- viewport = element;- viewport.addEventListener('mousedown', startHover);- props.ref?.(element);-- return () => {- if (viewport !== element) return;- element.removeEventListener('mousedown', startHover);- viewport = undefined;- revealGeneration += 1;- setReveal(undefined);- endHover();- motion.cancel();- };- },- };-return (- <BoardContext.Provider value={context}>- <Kanban- getViewport={() => viewport}- canDropCard={props.canMove}+ <TaskColumnsContext.Provider value={() => props.columns}>+ <KanbanBoard.Rootmode="cross-column"- targetActivationSpeed={600}- onDrop={(drop, visual) => {- if (!props.canMove(drop)) {- return;- }-- const sourceParentKey = JSON.stringify(['column', drop.fromLane]);- const finish = motion.begin(- drop.id,- JSON.stringify(['column', drop.toLane]),- visual- ? {- ...visual,- key: JSON.stringify([sourceParentKey, drop.id]),- parentKey: sourceParentKey,- }- : undefined- );- const scope = props.animationScope;- const generation = ++revealGeneration;- setReveal(undefined);- const saveAndReveal = async () => {- try {- const moved = await props.onMove(drop);- if (- moved &&- generation === revealGeneration &&- props.animationScope === scope- ) {- setReveal({ id: drop.id, toLane: drop.toLane, scope });- }- } finally {- finish();- }- };- void saveAndReveal();- }}+ columns={columns()}+ animationScope={props.animationScope}+ canMove={props.canMove}+ onDrop={props.onMove}+ ref={props.ref}>{props.children}- </Kanban>- </BoardContext.Provider>+ </KanbanBoard.Root>+ </TaskColumnsContext.Provider>);}-/** Virtualizes columns and an optional final column supplied by the caller. */function Columns(props: {children(column: Accessor<TaskBoardColumn>): JSX.Element;endColumn?: () => JSX.Element;- /** The board's accessible name; boards of other items name their own. */'aria-label'?: string;}) {- const board = useBoardContext();- let viewport: HTMLDivElement | undefined;- let releaseViewport: (() => void) | undefined;- const scrollSnapshots = new Map<string, KanbanScrollSnapshot>();- const wheel = createKanbanWheelScroll({- viewport: () => viewport,- verticalViewport: (target) =>- target.closest<HTMLElement>('[data-task-board-scroll]') ??- target- .closest('[data-kanban-lane]')- ?.querySelector<HTMLElement>('[data-task-board-scroll]') ??- null,- });- onCleanup(() => {- wheel.reset();- releaseViewport?.();- });- createEffect(on(board.animationScope, wheel.reset));+ const columns = useContext(TaskColumnsContext);+ if (!columns) throw new Error('TaskBoard.Root is required');const columnsById = createMemo(- () => new Map(board.columns().map((column) => [column.id, column]))- );- const virtualizer = createKanbanVirtualizer({- direction: 'horizontal',- keys: () => {- const keys: (string | number)[] = board- .columns()- .map((column) => column.id);-- if (props.endColumn) {- keys.push(END_COLUMN_KEY);- }-- return keys;- },- getScrollElement: () => viewport,- estimateSize: 336,- gap: 16,- overscan: 1,- paddingStart: 16,- paddingEnd: 16,- });- const virtualItems = createMemo(() =>- virtualizer.getVirtualItems().map((item) => ({ ...item }))- );- createEffect(- on(board.reveal, (request) => {- if (!request || request.scope !== board.animationScope()) {- return;- }-- const indices = taskBoardRevealIndices(- board.columns(),- request.toLane,- request.id- );- if (indices) {- virtualizer.scrollToIndex(indices.column, { align: 'auto' });- }- })- );-- return (- <Scroll- orientation="horizontal"- scrollbars="horizontal"- autoHide={false}- scrollRef={(element) => {- releaseViewport?.();- viewport = element;- releaseViewport = board.attachViewport(element);- }}- onWheel={wheel.onWheel}- class="ph-no-capture min-h-0 min-w-0 w-full flex-1"- viewportProps={{- tabindex: -1,- role: 'region',- 'aria-label': props['aria-label'] ?? 'Task board',- class: 'pt-1 pb-4 outline-none',- }}- contentProps={{ style: { height: '100%' } }}- >- <div- class="relative h-full min-w-full"- data-task-board-columns- style={{ width: `${virtualizer.getTotalSize()}px` }}- >- <Key each={virtualItems()} by="key">- {(item) => {- const key = item().key;- return (- <div- class="absolute top-0 h-full"- data-task-board-column={key}- style={{- left: `${item().start}px`,- width: `${item().size}px`,- }}- >- <Show when={key === END_COLUMN_KEY}>{props.endColumn?.()}</Show>- <Show when={columnsById().get(String(key))}>- {(column) => {- // Cleanup runs after Show invalidates its column accessor.- const columnId = column().id;- const context: ColumnContextValue = {- column,- headerId: createUniqueId(),- snapshot: scrollSnapshots.get(columnId),- onSnapshot: (snapshot) => {- scrollSnapshots.set(columnId, snapshot);- },- };-- return (- <ColumnContext.Provider value={context}>- {props.children(column)}- </ColumnContext.Provider>- );- }}- </Show>- </div>- );- }}- </Key>- </div>- </Scroll>- );-}--function Column(props: { children: JSX.Element }) {- const { column, headerId } = useColumnContext();- const [hovered, setHovered] = createSignal(false);-- return (- <ColumnHoverContext.Provider value={hovered}>- <KanbanLane- id={column().id}- label={column().label}- aria-labelledby={headerId}- class="max-h-full min-h-0 w-84"- onPointerEnter={() => setHovered(true)}- onPointerLeave={() => setHovered(false)}- >- {props.children}- </KanbanLane>- </ColumnHoverContext.Provider>+ () => new Map(columns().map((column) => [column.id, column])));-}--function Header(props: { children: JSX.Element }) {- const { headerId } = useColumnContext();-return (- <header- id={headerId}- class="flex min-w-0 shrink-0 items-center gap-2 px-2 pt-1 pb-2"+ <KanbanBoard.Columns+ endColumn={props.endColumn}+ aria-label={props['aria-label'] ?? 'Task board'}>- {props.children}- </header>+ {(column) => (+ <Show when={columnsById().get(column().id)}>+ {(taskColumn) => (+ <TaskColumnContext.Provider value={taskColumn}>+ {props.children(taskColumn)}+ </TaskColumnContext.Provider>+ )}+ </Show>+ )}+ </KanbanBoard.Columns>);}-function DropOverlay(props: { children: JSX.Element }) {- const { column } = useColumnContext();- const target = useKanbanDropTarget();-- return (- <Show when={target()?.kind === 'card' && target()?.toLane === column().id}>- <div- aria-hidden="true"- class="pointer-events-none absolute inset-2 z-20 flex items-center justify-center rounded-lg bg-surface-0/95 p-4 text-center text-sm font-medium text-ink"- >- {props.children}- </div>- </Show>- );-}--/** Owns the vertical viewport and row measurements; card content stays with the caller. */function Cards(props: {children(task: Accessor<TaskBoardTask>): JSX.Element;empty?: JSX.Element;footer?: JSX.Element;- /** What the cards are, for each column's accessible name. */itemsLabel?: string;}) {- const board = useBoardContext();- const lane = useColumnContext();- const hovered = useContext(ColumnHoverContext);- if (!hovered) throw new Error('TaskBoard.Column is required');- let viewport: HTMLDivElement | undefined;- const rows = () => lane.column().tasks;- const rowsById = createMemo(- () => new Map(rows().map((task) => [task.id, task]))- );- const virtualizer = createKanbanVirtualizer({- direction: 'vertical',- laneId: () => lane.column().id,- keys: () => rows().map((task) => task.id),- getScrollElement: () => viewport,- estimateSize: 104,- gap: 12,- overscan: 3,- snapshot: lane.snapshot,- });- const virtualItems = createMemo(() =>- virtualizer.getVirtualItems().map((item) => ({ ...item }))+ const column = useContext(TaskColumnContext);+ if (!column) throw new Error('TaskBoard.Columns is required');+ const tasksById = createMemo(+ () => new Map(column().tasks.map((task) => [task.id, task])));-- createEffect(() => {- const request = board.reveal();- // Wait for the horizontal lane and vertical viewport to mount.- const mountedRows = virtualItems();- if (- !request ||- request.scope !== board.animationScope() ||- request.toLane !== lane.column().id ||- !viewport?.isConnected ||- mountedRows.length === 0- ) {- return;- }-- const row = rows().findIndex((task) => task.id === request.id);- if (row < 0) return;- virtualizer.scrollToIndex(row, { align: 'auto' });- board.onRevealed(request);- });-- onCleanup(() => {- lane.onSnapshot({- offset: viewport?.scrollTop ?? 0,- measurements: virtualizer.takeSnapshot(),- });- });-return (- <Scroll- orientation="vertical"- scrollbars="vertical"- autoHide- autoHideDelay={200}- revealOn="hover"- hovered={hovered()}- fill={false}- scrollRef={(element) => {- viewport = element;- }}- class="min-h-0 flex-auto"- viewportProps={{- role: 'region',- 'aria-label': `${lane.column().label} ${props.itemsLabel ?? 'tasks'}`,- 'aria-labelledby': lane.headerId,- tabindex: 0,- 'data-task-board-scroll': lane.column().id,- 'data-kanban-scroll': '',- style: { 'overflow-anchor': 'none' },- }}+ <KanbanBoard.Cards+ empty={props.empty}+ footer={props.footer}+ itemsLabel={props.itemsLabel ?? 'tasks'}>- <div- class="relative w-full"- data-task-board-rows- style={{ height: `${virtualizer.getTotalSize()}px` }}- >- <Key each={virtualItems()} by="key">- {(item) => {- const key = String(item().key);- let row: HTMLDivElement | undefined;-- createEffect(- on(- () => item().index,- () => {- // Measure after content mounts, and again if a stable key moves.- queueMicrotask(() => {- if (row?.isConnected) {- virtualizer.measureElement(row);- }- });- }- )- );-- return (- <div- ref={row}- data-index={item().index}- data-kanban-card-layout- class="absolute left-0 top-0 w-full"- style={{ transform: `translateY(${item().start}px)` }}- >- <Show when={rowsById().get(key)}>- {(task) => props.children(task)}- </Show>- </div>- );- }}- </Key>- </div>- <Show when={rows().length === 0}>{props.empty}</Show>- {props.footer}- </Scroll>+ {(id) => (+ <Show when={tasksById().get(id)}>{(task) => props.children(task)}</Show>+ )}+ </KanbanBoard.Cards>);}@@ -555,24 +110,18 @@ function Card(props: {onOpen(task: TaskBoardTask, event: MouseEvent): void;children: JSX.Element;}) {- const { column } = useColumnContext();-return (- <KanbanCard+ <KanbanBoard.Cardid={props.task.id}- laneId={column().id}canDrag={props.canDrag}pending={props.pending}onClick={(event) => {- if (event.target.closest('[data-kanban-no-drag], button')) {- return;- }-+ if (event.target.closest('[data-kanban-no-drag], button')) return;props.onOpen(props.task, event);}}>{props.children}- </KanbanCard>+ </KanbanBoard.Card>);}@@ -582,10 +131,7 @@ function HiddenColumns(props: {onReveal(): void;}) {return (- <section- aria-label="Hidden columns"- class="flex h-full min-h-40 w-full flex-col items-center gap-3 rounded-xl border border-dashed border-ink-extra-muted/25 p-4 pt-8 text-ink-muted"- >+ <KanbanBoard.ColumnPlaceholder aria-label="Hidden columns"><div aria-hidden="true" class="h-20 w-32 shrink-0 text-ink-extra-muted"><EmptyStateNoFilterMatchGraphic class="size-full" /></div>@@ -601,16 +147,20 @@ function HiddenColumns(props: {<Button size="sm" variant="outline" onClick={props.onReveal}>Reveal hidden columns</Button>- </section>+ </KanbanBoard.ColumnPlaceholder>);}export const TaskBoard = {Root,Columns,- Column,- Header,- DropOverlay,+ Column: KanbanBoard.Column,+ Header: KanbanBoard.Header,+ ColumnLabel: KanbanBoard.ColumnLabel,+ ColumnCount: KanbanBoard.ColumnCount,+ CardHeader: KanbanBoard.CardHeader,+ CardFields: KanbanBoard.CardFields,+ DropOverlay: KanbanBoard.DropOverlay,Cards,Card,HiddenColumns,diff --git a/apps/web/src/features/tasks-view/views/task-board-view.tsx b/apps/web/src/features/tasks-view/views/task-board-view.tsxindex d8c87a0170..d2047e5da8 100644--- a/apps/web/src/features/tasks-view/views/task-board-view.tsx+++ b/apps/web/src/features/tasks-view/views/task-board-view.tsx@@ -142,7 +142,7 @@ export function TaskBoardView(props: {readOnly: Accessor<boolean>) => (<>- <div class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 p-3 pb-2">+ <TaskBoard.CardHeader><div data-kanban-no-drag class="flex shrink-0 items-center">{renderProperty(task, readOnly, SYSTEM_PROPERTY_IDS.STATUS, true)}</div>@@ -162,8 +162,8 @@ export function TaskBoardView(props: {<div data-kanban-no-drag class="flex shrink-0 items-center">{renderProperty(task, readOnly, SYSTEM_PROPERTY_IDS.ASSIGNEES, true)}</div>- </div>- <div class="flex flex-wrap items-center gap-1 px-3 pb-3 text-xs text-ink-muted">+ </TaskBoard.CardHeader>+ <TaskBoard.CardFields><div data-kanban-no-drag class="contents"><For each={cardPropertyIds()}>{(id) => {@@ -174,7 +174,7 @@ export function TaskBoardView(props: {}}</For></div>- </div>+ </TaskBoard.CardFields></>);@@ -310,9 +310,9 @@ function TaskBoardColumnHeader(props: {createAssigneeName: TaskBoardData['createAssigneeName'];}) {const label = () => (- <h2 class="truncate text-sm font-medium" title={props.column.label}>+ <TaskBoard.ColumnLabel title={props.column.label}>{props.column.label}- </h2>+ </TaskBoard.ColumnLabel>);const countLabel = () => {const loaded = props.column.tasks.length;@@ -346,12 +346,10 @@ function TaskBoardColumnHeader(props: {/></Suspense></Show>- <span- class="ml-auto shrink-0 text-xs text-ink-muted"+ <TaskBoard.ColumnCount+ count={props.column.count ?? props.column.tasks.length}aria-label={countLabel()}- >- {props.column.count ?? props.column.tasks.length}- </span>+ /></>);}@@ -364,9 +362,5 @@ function AssigneeColumnLabel(props: {const resolvedName = props.createAssigneeName(() => props.id);const name = () => resolvedName() || props.fallback;- return (- <h2 class="truncate text-sm font-medium" title={name()}>- {name()}- </h2>- );+ return <TaskBoard.ColumnLabel title={name()}>{name()}</TaskBoard.ColumnLabel>;}diff --git a/docs/AGENT_GUIDE/databases.md b/docs/AGENT_GUIDE/databases.mdindex a40633681a..cd42e893ff 100644--- a/docs/AGENT_GUIDE/databases.md+++ b/docs/AGENT_GUIDE/databases.md@@ -205,9 +205,12 @@ A select or multi-select cell opens a compact option picker with its search fielfocused (**Search or create…**). Typing filters the options; when the typed name isnot an option yet, a **Create “…”** row adds it, picks it, and keeps focus (on thecell for a single select, in the search for a multi-select, which stays open). Arrow-keys move through the rows and Enter picks; **Clear value** empties the cell.-From a freshly opened picker, Down starts at the first row and Up starts at the-last; both wrap around at the ends.+keys move through the rows and Enter picks. The **Clear value** Button sits on the+right of a separate, bottom-padded footer below the option list. It sizes to its+label and empties the cell; it stays available while searching.+From a freshly opened picker, Down starts at the first option and Up starts at the+last. With no search text, Down after the last option focuses **Clear value** when present; Enter clears.+From that button, Up returns to the last option and Down returns to the first.Multi-select pickers toggle each option and keep the others.Each option row has a **⋯** button (`Edit <option>`) that opens the option editor:@@ -216,8 +219,8 @@ picker tags use) recolour it, and **Delete option** asks for confirmation ("Cellusing “X” will be cleared.") before removing it and clearing it from every cell.When the column's property is used outside this database, the editor says**Changes everywhere this property is used.** The same editor opens from a column-header's **Edit options** menu item and from a board lane header. Changes show at-once and are rolled back if the server refuses them.+header's **Edit options** menu item. Board lanes expose name and color editing+directly in the header. Changes show at once and roll back if the server refuses them.**+ → New table**, at the right edge of the table selector in the split header,adds an inline name field to the tab strip and focuses it immediately. Enter a@@ -253,8 +256,11 @@ directly. Type on a selected select cell to search its options; Enter chooses amatch, and Tab chooses the highlighted option or typed match before moving on.Number cells display thousands separators (for example, `100,000`); opening aneditor shows the raw number for editing. Invalid numbers and integers outside the-safe integer range stay in the editor with **Enter a valid number** instead of-saving a rounded value. Signed decimals and scientific notation remain supported.+safe integer range stay in the editor with a failure outline instead of saving a+rounded value. **Enter a valid number** appears in an opaque, focus-only hint. Leaving+the field hides the hint but keeps the draft and outline; other fields remain+editable, including through Tab or Shift+Tab. Correct the value or press Escape to+cancel. Signed decimals and scientific notation remain supported.Date cells open Macro's date selector (the one tasks use): type a date or phrasesuch as `tomorrow`, `3d`, or `feb 17` and press Enter, or pick **Custom date...**@@ -383,28 +389,66 @@ column each card is headed by, the table's first by default), the **Card fields*a card shows, **Hide empty lanes**, and **Hidden lanes**, whose **Show …** itemsbring a hidden lane back.+Boards use the Tasks board layout, with virtualized lanes and cards. Scroll+horizontally to reach more lanes; each lane scrolls vertically on its own. A card+or lane being dragged stays mounted while scrolling. After a card move, its+destination is revealed. Starting a new card reveals the lane's draft at the+bottom and focuses its title, including after the lane was offscreen.++Lane headers show a color or type icon, a name, and an adjacent record count.+Cards use the Tasks board's header and compact, wrapping property layout rather than+stacked field rows. Cards without fields do not render an empty property area.+Title editing keeps the displayed title's typography, wrapping, and spacing.+Cards have a six-dot drag handle; their custom fields share a CSS grid with the title+and align below its left edge. **Open record details** (the expand+icon) and **Move** controls appear on hover or keyboard focus and stay visible on touch+screens. Lane fills contrast with the surrounding panel in light and dark themes,+with a subtle outline.+The Group by, Filter, Sort, Search, and Board menu controls use the same rounded+medium-size icon buttons as Drive. View tabs and New use the shared Button styling.+A board has a lane per option (or person). Records without a grouping value arecurrently omitted from the board; they remain available in the table. Drag a card withina lane or into another lane; it moves at once, and moving it to another lane alsosets its Select value. The order is saved for everyone and survives a reload. Asorted board keeps the sort's order, so dragging a card asks **Remove sort toarrange cards manually?**; **Remove sort** clears the sort and then places the-card. Drag a lane header to reorder lanes. A lane header shows the option's **⋯**-editor and a lane menu with **Hide lane** and **Hide empty lanes**. The card's-**Move …** menu offers the same moves without dragging. Click a card’s title or-field to edit it in place using the same editors as the table. Empty configured-fields are editable too. Use the card’s **Open** icon to open the full record;+card. The insertion marker stays visible above the first card when reordering+within a lane. Drag a lane header to reorder lanes. Click an editable option lane's name to+rename it in place; the field keeps the title's typography, height, and position,+and grows with the draft up to the available header width. Enter or leaving the+field saves, and Escape cancels and returns focus to the name. Click its dot to+pick a color. The lane's **⋯** menu contains **Hide lane** and **Delete group**.+Deletion opens a confirmation dialog explaining that cells using the option will+be cleared, but records will not be deleted; **Delete group** uses danger styling.+**Hide empty lanes** remains only in the board's **Board menu**, with a right-side+checkmark when enabled. The card's **Move …** menu offers the same moves without+dragging. Click a card’s title or field to edit it in place using the same editors+as the table. Card-field inline editors fill the value area beside their icon and+keep its width, height, and typography; longer drafts scroll inside rather than+pushing neighboring fields.+Inline field edits save on Enter or leaving the field. Each save changes only that+field. Invalid drafts stay local, and saving another field or refreshing column+snapshots keeps their draft and failure outline until corrected or cancelled. Card+field inputs have no separate outline; validation outlines the entire field pill,+including its icon, and remains visible after blur.+Empty configured fields are editable too. Text and number fields reserve a small+minimum width so empty editors do not shrink to the dash. Use the card’s expand+icon to open the record-details dialog with all fields and previous/next controls;field controls do not start a card drag.-**+ New** at the bottom of a lane (or the lane header's **+**) puts an empty,+The taller **+ New** button at the bottom of a lane (or the lane header's **+**) puts an empty,focused card title in that lane; nothing opens. Enter creates the card with thelane's value and opens another empty card below it, so several can be typed in arow; each appears in place while it saves. Shift+Enter creates the card and opensits record. Escape, or leaving an empty title, cancels; leaving a typed titlesaves it. From the keyboard, press **n** with focus on any card or control in alane, or Enter on a focused lane header, to start a card there. The toolbar's-**New** starts one in the first lane. **New group** at the end of a board adds-another option and lane, coloured with the next palette colour.+**New** starts one in the first lane. The dashed **New group** panel at the end+of the board matches Tasks' hidden-lanes panel. Its **New group** button opens a+name field. Its right-aligned actions show **Cancel** followed by a filled **Add+group** button, which adds another option and lane with the next palette colour.+Escape cancels; validation and save failures keep the draft for retry.Creating or changing a record can make it fall outside the currentfilters. A saved-record notice offers **Open record** to inspect it without