gridsmith-ui 0.31.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -1
- package/README.md +4 -2
- package/dist/charts.d.ts +111 -31
- package/dist/charts.js +288 -148
- package/dist/charts.js.map +1 -1
- package/dist/chat.js +6 -6
- package/dist/{chunk-EZ3ZGFGA.js → chunk-2724SJO2.js} +12 -4
- package/dist/chunk-2724SJO2.js.map +1 -0
- package/dist/{chunk-I6JJ7KKP.js → chunk-6NRLTG5W.js} +16 -11
- package/dist/chunk-6NRLTG5W.js.map +1 -0
- package/dist/{chunk-BHTAVJIG.js → chunk-6XCWKLJZ.js} +41 -6
- package/dist/chunk-6XCWKLJZ.js.map +1 -0
- package/dist/{chunk-TH272DIC.js → chunk-AB4UQ4G5.js} +125 -235
- package/dist/chunk-AB4UQ4G5.js.map +1 -0
- package/dist/{chunk-IOHGE4EW.js → chunk-AVSP6NDX.js} +8 -8
- package/dist/chunk-AVSP6NDX.js.map +1 -0
- package/dist/chunk-F2XMZOUP.js +81 -0
- package/dist/chunk-F2XMZOUP.js.map +1 -0
- package/dist/{chunk-HQFTP7Y5.js → chunk-FF57N3P7.js} +10 -8
- package/dist/chunk-FF57N3P7.js.map +1 -0
- package/dist/chunk-GIA4BMGI.js +18 -0
- package/dist/chunk-GIA4BMGI.js.map +1 -0
- package/dist/{chunk-DR6WEI3A.js → chunk-HCEHTJ5E.js} +3 -3
- package/dist/{chunk-DR6WEI3A.js.map → chunk-HCEHTJ5E.js.map} +1 -1
- package/dist/{chunk-IZW5XHKA.js → chunk-OWGF362U.js} +10 -8
- package/dist/chunk-OWGF362U.js.map +1 -0
- package/dist/chunk-P3NUUIL6.js +9 -0
- package/dist/chunk-P3NUUIL6.js.map +1 -0
- package/dist/{chunk-W3GY5ROH.js → chunk-R2IAK3J3.js} +3 -3
- package/dist/{chunk-W3GY5ROH.js.map → chunk-R2IAK3J3.js.map} +1 -1
- package/dist/chunk-R7FG4ZQ5.js +16 -0
- package/dist/chunk-R7FG4ZQ5.js.map +1 -0
- package/dist/{chunk-V73LHNRL.js → chunk-RS624TD5.js} +29 -10
- package/dist/chunk-RS624TD5.js.map +1 -0
- package/dist/{chunk-DBHVJ7Z3.js → chunk-SS3C24IJ.js} +3 -2
- package/dist/chunk-SS3C24IJ.js.map +1 -0
- package/dist/{chunk-K3NAFQ4S.js → chunk-TMPPBXX3.js} +3 -3
- package/dist/{chunk-K3NAFQ4S.js.map → chunk-TMPPBXX3.js.map} +1 -1
- package/dist/{chunk-NDL2JGQ7.js → chunk-UBLBVCQN.js} +5 -5
- package/dist/{chunk-NDL2JGQ7.js.map → chunk-UBLBVCQN.js.map} +1 -1
- package/dist/{chunk-2TCCSKL3.js → chunk-WD6T57ZJ.js} +5 -5
- package/dist/{chunk-2TCCSKL3.js.map → chunk-WD6T57ZJ.js.map} +1 -1
- package/dist/{chunk-SLGGZ3MU.js → chunk-WSKPESAX.js} +12 -10
- package/dist/chunk-WSKPESAX.js.map +1 -0
- package/dist/chunk-ZQV26NND.js +213 -0
- package/dist/chunk-ZQV26NND.js.map +1 -0
- package/dist/dashboard.d.ts +207 -0
- package/dist/dashboard.js +1210 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/data-grid.js +11 -10
- package/dist/data-grid.js.map +1 -1
- package/dist/editor-mentions.js +2 -2
- package/dist/editor.js +3 -2
- package/dist/editor.js.map +1 -1
- package/dist/index.d.ts +94 -12
- package/dist/index.js +601 -316
- package/dist/index.js.map +1 -1
- package/dist/kanban.js +9 -9
- package/dist/resizable.d.ts +11 -2
- package/dist/resizable.js +97 -22
- package/dist/resizable.js.map +1 -1
- package/dist/roots.css +2 -2
- package/dist/tokens.css +6 -6
- package/dist/utils.d.ts +51 -1
- package/dist/utils.js +55 -4
- package/dist/utils.js.map +1 -1
- package/dist/virtualized.js +9 -8
- package/dist/virtualized.js.map +1 -1
- package/dist-static/tokens.css +6 -6
- package/package.json +6 -1
- package/dist/chunk-BHTAVJIG.js.map +0 -1
- package/dist/chunk-DBHVJ7Z3.js.map +0 -1
- package/dist/chunk-EZ3ZGFGA.js.map +0 -1
- package/dist/chunk-HQFTP7Y5.js.map +0 -1
- package/dist/chunk-I6JJ7KKP.js.map +0 -1
- package/dist/chunk-IOHGE4EW.js.map +0 -1
- package/dist/chunk-IZW5XHKA.js.map +0 -1
- package/dist/chunk-KSJTMSYA.js +0 -71
- package/dist/chunk-KSJTMSYA.js.map +0 -1
- package/dist/chunk-LJYSVZMI.js +0 -25
- package/dist/chunk-LJYSVZMI.js.map +0 -1
- package/dist/chunk-SLGGZ3MU.js.map +0 -1
- package/dist/chunk-TH272DIC.js.map +0 -1
- package/dist/chunk-V73LHNRL.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../showcase/src/lib/cell-frame-scroll.ts","../../../showcase/src/lib/dashboard-layout.ts","../../../showcase/src/components/DashboardGrid.tsx","../../../showcase/src/components/DashboardPalette.tsx","../../../showcase/src/lib/use-draft-history.ts"],"names":["item","row","col","clamp","useRef","useEffect","Fragment","index","plain","isThenable","useContext","useId","jsxs","jsx","ROW","useCallback","useDraggable","useLayoutEffect","useState","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA,IAAM,OAAA,GAAU,mBAAA;AAChB,IAAM,SAAA,GAAY,CAAC,EAAA,KAAoB,UAAA,CAAW,EAAE,KAAK,CAAC,CAAC,EAAA,CAAG,aAAA,CAAc,OAAO,CAAA;AAkB5E,SAAS,kBAAA,CAAmB,SAAwC,KAAA,EAAqB;AAC9F,EAAA,MAAM,IAAA,GAAO,OAA2B,IAAI,CAAA;AAC5C,EAAA,cAAA,CAAe,IAAI,CAAA;AACnB,EAAA,MAAM,QAAA,GAAW,UAAU,KAAK,CAAA;AAChC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,UAAU,OAAA,CAAQ,OAAA;AACxB,IAAA,IAAI,CAAC,OAAA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AA,CAAM,MAAA,CAAO,MAAA,GAAS,CAAA;AAItC,EAAAV,UAAU,MAAM;AACd,IAAA,IAAI,CAAC,SAAA,IAAa,OAAO,QAAA,KAAa,WAAA,EAAa;AACnD,IAAA,MAAM,SAAA,GAAY,CAAC,CAAA,KAAqB;AACtC,MAAA,IAAI,EAAE,gBAAA,IAAoB,CAAA,CAAE,MAAA,IAAU,EAAE,EAAE,OAAA,IAAW,CAAA,CAAE,OAAA,CAAA,IAAY,CAAA,CAAE,IAAI,WAAA,EAAY,KAAM,OAAO,SAAA,CAAU,CAAA,CAAE,MAAM,CAAA,EAAG;AACvH,MAAA,IAAI,CAAA,CAAE,QAAA,GAAW,CAAC,OAAA,GAAU,CAAC,OAAA,EAAS;AACtC,MAAA,CAAA,CAAE,cAAA,EAAe;AACjB,MAAA,IAAI,CAAA,CAAE,UAAU,IAAA,EAAK;AAAA,WAChB,IAAA,EAAK;AAAA,IACZ,CAAA;AACA,IAAA,QAAA,CAAS,gBAAA,CAAiB,WAAW,SAAS,CAAA;AAC9C,IAAA,OAAO,MAAM,QAAA,CAAS,mBAAA,CAAoB,SAAA,EAAW,SAAS,CAAA;AAAA,EAChE,GAAG,CAAC,SAAA,EAAW,SAAS,OAAA,EAAS,IAAA,EAAM,IAAI,CAAC,CAAA;AAE5C,EAAA,MAAM,KAAA,GAAQc,OAAAA,CAAQ,MAAM,CAAC,KAAK,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,KAAK,GAAG,CAAC,KAAA,CAAM,OAAA,EAAS,KAAA,CAAM,KAAK,CAAC,CAAA;AAC3F,EAAA,OAAO,EAAE,KAAA,EAAO,KAAA,CAAM,OAAA,EAAS,GAAA,EAAK,MAAM,IAAA,EAAM,OAAA,EAAS,OAAA,EAAS,KAAA,EAAO,KAAA,EAAmC;AAC9G","file":"dashboard.js","sourcesContent":["import { useEffect, useRef, type RefObject } from \"react\";\nimport { hasTabStop } from \"./focus\";\nimport { useRevealFocus } from \"./reveal-focus\";\nimport { keyboardScroll } from \"./use-keyboard-scroll\";\nimport { useLatest } from \"./use-latest\";\nimport { warnOnce } from \"./dev-warn\";\n\n/** A drawing's surface the keyboard reaches (Recharts' accessibility layer): a Tab stop the library's helper doesn't count. */\nconst SURFACE = 'svg[tabindex=\"0\"]';\nconst holdsStop = (el: HTMLElement) => hasTabStop(el) || !!el.querySelector(SURFACE);\n\n/**\n * Sprint 32 (F10): what the frames do in a dashboard's cell that a class name can't, run from the cell (the dashboard\n * entry), so the main entry's frames carry only their class names and the clickable Card's role. The cell's frame is the\n * content wrapper's one child (`[data-dashboard-content] > *`), and each part is found in it by its own mark, read again\n * when the frame changes (content arriving after it loads, a Table changing form, a title edited), once a frame at most\n * (a chart's tooltip changes the page at every move of the pointer):\n * - a Card's body (its own CardContent, `[data-card-content]`) scrolls in the card, the title staying put: a Tab stop\n * named by the card's title while it scrolls with nothing in it to Tab to (useKeyboardScroll's rule). In a card that is\n * a button it's none, as no stop sits inside a stop (F9), and a development warning asks for the CardTitle that would\n * carry the card's action;\n * - a StatsCard scrolls as a whole (F4): a plain one is such a stop, named by its label; a clickable one is a stop and a\n * button already, and scrolls as itself, its role and its name its own;\n * - a Table's scroll area (a paged Table's too) is its own Tab stop while it scrolls, as anywhere.\n * In each, what the keyboard focuses is brought into view whole (useRevealFocus), into the 4 px of scroll padding each\n * part keeps in a cell. A drawing's surface counts as a stop inside a part (F1).\n */\nexport function useCellFrameScroll(content: RefObject<HTMLElement | null>, label: string): void {\n const part = useRef<HTMLElement | null>(null);\n useRevealFocus(part);\n const labelRef = useLatest(label);\n useEffect(() => {\n const wrapper = content.current;\n if (!wrapper || typeof MutationObserver === \"undefined\") return;\n let held: { el: HTMLElement; scroll: ReturnType<typeof keyboardScroll> } | null = null;\n let queued = 0;\n const read = () => {\n queued = 0;\n const frame = wrapper.firstElementChild;\n const button = frame?.getAttribute(\"role\") === \"button\";\n let stop: HTMLElement | null = null;\n let name = () => \"\";\n if (frame instanceof HTMLElement && frame.hasAttribute(\"data-stats-card\")) {\n part.current = frame;\n if (!button) {\n stop = frame;\n name = () => frame.querySelector(\"span\")?.textContent?.trim() || labelRef.current;\n }\n } else if (frame?.matches(\"[data-card]:not([data-gs])\")) {\n const body = frame.querySelector<HTMLElement>(\":scope > [data-card-content]\");\n part.current = body;\n if (button) warnOnce(\"DashboardGrid\", `the widget \"${labelRef.current}\" is a clickable Card with no CardTitle, so it stays a button and its content can't scroll by keyboard: give it a CardHeader with a CardTitle (every widget needs a title), which then carries the card's action.`);\n else if (body) {\n stop = body;\n name = () => frame.querySelector(\":scope > [data-card-header] [data-card-title]\")?.textContent?.trim() || \"Card content\";\n }\n } else {\n const table = frame?.matches('[data-gs=\"table\"]') ? frame : frame?.matches(\"[data-gs-paged]\") ? frame.querySelector(':scope > [data-gs=\"table\"]') : null;\n part.current = table?.querySelector<HTMLElement>(\":scope > [data-table-scroll]\") ?? null;\n }\n if (held && held.el !== stop) {\n held.scroll?.end();\n held = null;\n }\n if (held) held.scroll?.update();\n else if (stop) held = { el: stop, scroll: keyboardScroll(stop, name, \"y\", holdsStop) };\n };\n read();\n // a role among the attributes: a stat or a card the page makes clickable, or not, is read again as such\n const observer = new MutationObserver(() => { if (!queued) queued = requestAnimationFrame(read); });\n observer.observe(wrapper, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: [\"role\"] });\n return () => {\n observer.disconnect();\n cancelAnimationFrame(queued);\n held?.scroll?.end();\n part.current = null;\n };\n }, [content, labelRef]);\n}\n","/**\n * Sprint 32 (A2) — a dashboard's layout, as plain data: its widgets in reading order, each with a width in columns of 12\n * and a height in rows of a fixed height. The grid lays them out as text is laid out: left to right, then the next row,\n * each taking the first space after the one before that fits it (CSS grid's sparse auto-placement, never `dense`), so\n * what's on screen, what a screen reader reads and where Tab goes are one order by construction.\n *\n * Server-safe: no React and no browser, so `gridsmith-ui/utils` exports the helpers (normaliseLayout, moveItem,\n * resizeItem, addItem, removeItem) and a page that only adds a widget, or a test that checks a layout, needs no drag\n * code. The rest is the grid's own: where widgets land (`placeLayout`, a copy of the browser's placement rule, held equal\n * to Chrome's by a Chrome test), where a key or a pointer would take one (`stepTarget`, `nearestIndex`) and the words a\n * screen reader hears for a size. Where things land is worked out here, from the layout, never measured from the\n * screen: measuring a preview feeds back into it, the flicker sortable grids are known for.\n */\n\nexport interface DashboardLayoutItem {\n id: string;\n /** Its width, in columns of 12. */\n w: number;\n /** Its height, in rows. */\n h: number;\n /** The narrowest it may be made, in columns (default 3, a quarter of the width; a widget is never narrower). */\n minW?: number;\n /** The shortest it may be made, in rows (default 2). */\n minH?: number;\n /** The widest it may be made, in columns (default 12). */\n maxW?: number;\n /** The tallest it may be made, in rows. */\n maxH?: number;\n}\n\nexport type DashboardLayout = DashboardLayoutItem[];\n\n/** The grid's columns. */\nexport const DASHBOARD_COLUMNS = 12;\n/**\n * The narrowest a widget is, whatever a page passes: three columns, a quarter of the width, the narrowest the Size menu\n * offers (the owner's answer, 20 October 2026). A saved layout with a narrower widget draws it at three.\n */\nconst MIN_W = 3;\n/** By default every widget is at least 2 rows tall (A2). */\nconst DEFAULT_MIN_H = 2;\n/** The tallest a widget can be, whatever a page passes: a sanity bound, far past any screen (100 rows is over 6,000 px). */\nexport const DASHBOARD_MAX_ROWS = 100;\n\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\n/** A whole number from what a page passed: a number rounded, anything else (NaN, a string, nothing) the fallback. */\nconst whole = (value: unknown, fallback: number) => (typeof value === \"number\" && Number.isFinite(value) ? Math.round(value) : fallback);\n\n/** The limits a widget's size is held to: its own, inside the grid's 12 columns, at least three columns and a row. */\nexport function sizeLimits(item: Partial<DashboardLayoutItem>): { minW: number; maxW: number; minH: number; maxH: number } {\n const minW = clamp(whole(item.minW, MIN_W), MIN_W, DASHBOARD_COLUMNS);\n const maxW = clamp(whole(item.maxW, DASHBOARD_COLUMNS), minW, DASHBOARD_COLUMNS);\n const minH = clamp(whole(item.minH, DEFAULT_MIN_H), 1, DASHBOARD_MAX_ROWS);\n const maxH = clamp(whole(item.maxH, DASHBOARD_MAX_ROWS), minH, DASHBOARD_MAX_ROWS);\n return { minW, maxW, minH, maxH };\n}\n\n/** One widget's entry made valid: whole sizes within its limits. The limits it was given are kept, made valid too. */\nfunction normaliseItem<T extends DashboardLayoutItem>(item: T): T {\n const limits = sizeLimits(item);\n const next = { ...item, w: clamp(whole(item.w, limits.minW), limits.minW, limits.maxW), h: clamp(whole(item.h, limits.minH), limits.minH, limits.maxH) };\n for (const key of [\"minW\", \"maxW\", \"minH\", \"maxH\"] as const) if (item[key] !== undefined) next[key] = limits[key];\n return next;\n}\n\n/**\n * The layout the grid draws (A2, \"always valid\"): whatever a page passes (a width past 12, a size under its minimum, a\n * repeated id, an entry with no id), each widget once, in order, with whole sizes inside its limits and the 12 columns.\n * Fields of the page's own on an entry are kept. Normalising twice changes nothing.\n */\nexport function normaliseLayout(layout: readonly DashboardLayoutItem[] | null | undefined): DashboardLayout {\n const seen = new Set<string>();\n const out: DashboardLayout = [];\n for (const item of Array.isArray(layout) ? layout : []) {\n if (!item || typeof item.id !== \"string\" || item.id === \"\" || seen.has(item.id)) continue;\n seen.add(item.id);\n out.push(normaliseItem(item));\n }\n return out;\n}\n\n/** The layout with a widget moved to a place in the order (from 0; past either end, to that end). */\nexport function moveItem(layout: readonly DashboardLayoutItem[], id: string, toIndex: number): DashboardLayout {\n const items = normaliseLayout(layout);\n const from = items.findIndex((item) => item.id === id);\n if (from < 0) return items;\n const [item] = items.splice(from, 1);\n items.splice(clamp(whole(toIndex, from), 0, items.length), 0, item);\n return items;\n}\n\n/** The layout with a widget given a new width, height or both, held to its limits. */\nexport function resizeItem(layout: readonly DashboardLayoutItem[], id: string, size: { w?: number; h?: number }): DashboardLayout {\n return normaliseLayout(layout).map((item) => (item.id === id ? normaliseItem({ ...item, ...(size.w !== undefined ? { w: size.w } : {}), ...(size.h !== undefined ? { h: size.h } : {}) }) : item));\n}\n\n/**\n * The layout with a widget added at a place in the order (from 0), else at the end. An id already in the layout isn't\n * added again: ids are unique, and the widget there keeps its place.\n */\nexport function addItem(layout: readonly DashboardLayoutItem[], item: DashboardLayoutItem, index?: number): DashboardLayout {\n const items = normaliseLayout(layout);\n if (!item || typeof item.id !== \"string\" || item.id === \"\" || items.some((it) => it.id === item.id)) return items;\n items.splice(clamp(whole(index, items.length), 0, items.length), 0, normaliseItem(item));\n return items;\n}\n\n/** The layout without a widget; the rest flow up to fill its place. */\nexport function removeItem(layout: readonly DashboardLayoutItem[], id: string): DashboardLayout {\n return normaliseLayout(layout).filter((item) => item.id !== id);\n}\n\n/** Where a widget is drawn: its first column and row (from 0, the column from the inline start) and its span. */\nexport interface DashboardPlacement {\n id: string;\n col: number;\n row: number;\n w: number;\n h: number;\n}\n\n/**\n * Where the browser puts each widget (A2): CSS grid's auto-placement, sparse (`grid-auto-flow: row`), copied from the\n * algorithm in CSS Grid Layout §8.5. A cursor starts at the first row and column; for each widget in order, it moves\n * along the row until the widget's area overlaps nothing placed, or the widget would run past the last column, in which\n * case it moves to the start of the next row and goes on. The widget goes where it stops, and the next one starts\n * looking there: the cursor never goes back, so a gap left earlier is never filled by a later widget. A widget wider than\n * the columns is taken as their width (the grid draws it so: `normaliseLayout` holds widths to 12, and a stacked grid\n * spans each widget across its one column). The items are taken as they are: normalise first.\n */\nexport function placeLayout(items: readonly Pick<DashboardLayoutItem, \"id\" | \"w\" | \"h\">[], columns: number = DASHBOARD_COLUMNS): DashboardPlacement[] {\n const taken: boolean[][] = [];\n const free = (row: number, col: number, w: number, h: number) => {\n for (let r = row; r < row + h; r++) for (let c = col; c < col + w; c++) if (taken[r]?.[c]) return false;\n return true;\n };\n const out: DashboardPlacement[] = [];\n let row = 0;\n let col = 0;\n for (const item of items) {\n const w = clamp(item.w, 1, columns);\n const h = Math.max(1, item.h);\n for (;;) {\n if (col + w > columns) { row++; col = 0; continue; }\n if (free(row, col, w, h)) break;\n col++;\n }\n for (let r = row; r < row + h; r++) {\n taken[r] ??= [];\n for (let c = col; c < col + w; c++) taken[r][c] = true;\n }\n out.push({ id: item.id, col, row, w, h });\n }\n return out;\n}\n\n/** Where a widget lands when it is put at `index` among the others (the layout without it). */\nfunction landingAt(others: readonly DashboardLayoutItem[], item: DashboardLayoutItem, index: number, columns: number): DashboardPlacement {\n return placeLayout([...others.slice(0, index), item, ...others.slice(index)], columns)[index];\n}\n\n/** A step a key asks of a widget being moved (A5): Left and Right are earlier and later, swapped in a right-to-left page. */\nexport type DashboardStep = \"earlier\" | \"later\" | \"up\" | \"down\" | \"first\" | \"last\";\n\n/** Where a step takes a widget: a new place in the order, or why it can't move that way. */\nexport type DashboardStepResult = { index: number } | { blocked: \"first\" | \"last\" | \"top\" | \"bottom\" };\n\n/**\n * Where a key moves a widget (A5), on the layout as it is now (the widget at its current place): earlier and later one\n * place in the order, first and last to either end; up and down to the place whose landing is in the nearest row above or\n * below it on screen, and among those the one nearest its column (then the nearest in the order), the others flowing\n * round it. Every step moves it, or says why it can't. None moves it the other way on screen: a later place never lands\n * it earlier in reading order (the cursor never goes back, and what's placed before it only grows), and up and down\n * choose only among rows above or below.\n */\nexport function stepTarget(layout: readonly DashboardLayoutItem[], id: string, step: DashboardStep, columns: number = DASHBOARD_COLUMNS): DashboardStepResult {\n const at = layout.findIndex((item) => item.id === id);\n const last = layout.length - 1;\n if (at < 0) return { blocked: \"first\" };\n switch (step) {\n case \"earlier\": return at > 0 ? { index: at - 1 } : { blocked: \"first\" };\n case \"later\": return at < last ? { index: at + 1 } : { blocked: \"last\" };\n case \"first\": return at > 0 ? { index: 0 } : { blocked: \"first\" };\n case \"last\": return at < last ? { index: last } : { blocked: \"last\" };\n }\n const item = layout[at];\n const others = layout.filter((_, i) => i !== at);\n const here = placeLayout(layout, columns)[at];\n let best: { index: number; rows: number; cols: number; steps: number } | null = null;\n for (let index = 0; index <= others.length; index++) {\n if (index === at) continue;\n const p = landingAt(others, item, index, columns);\n if (step === \"down\" ? p.row <= here.row : p.row >= here.row) continue;\n const rows = Math.abs(p.row - here.row);\n const cols = Math.abs(p.col - here.col);\n const steps = Math.abs(index - at);\n if (!best || rows < best.rows || (rows === best.rows && (cols < best.cols || (cols === best.cols && steps < best.steps)))) best = { index, rows, cols, steps };\n }\n return best ? { index: best.index } : { blocked: step === \"up\" ? \"top\" : \"bottom\" };\n}\n\n/**\n * Where a pointer drop puts a widget (A2, A5): the place in the order whose landing is nearest the point the person holds\n * it at (the lifted copy's top-start corner, in grid units: a column from the inline start and a row from the top), each\n * landing worked out on the layout without the widget, in code, so what's shown never feeds back into it. Distances are\n * in px, by the grid's pitch. A point over a gap the widget fits takes the place after the widget the gap follows, where\n * the browser would put it. Ties go to the earlier place.\n */\nexport function nearestIndex(\n others: readonly DashboardLayoutItem[],\n item: DashboardLayoutItem,\n point: { col: number; row: number },\n pitch: { col: number; row: number },\n columns: number = DASHBOARD_COLUMNS,\n): number {\n let best = 0;\n let bestDistance = Infinity;\n for (let index = 0; index <= others.length; index++) {\n const p = landingAt(others, item, index, columns);\n const distance = Math.hypot((p.col - point.col) * pitch.col, (p.row - point.row) * pitch.row);\n if (distance < bestDistance - 0.001) { best = index; bestDistance = distance; }\n }\n return best;\n}\n\n/** The widths the Size menu offers, in pairs that fill a row (A2): a quarter with three quarters, a third with two thirds, half with half. */\nexport const DASHBOARD_WIDTHS: ReadonlyArray<{ w: number; label: string; words: string }> = [\n { w: 3, label: \"A quarter of the width\", words: \"a quarter of the width\" },\n { w: 4, label: \"A third of the width\", words: \"a third of the width\" },\n { w: 6, label: \"Half the width\", words: \"half the width\" },\n { w: 8, label: \"Two thirds of the width\", words: \"two thirds of the width\" },\n { w: 9, label: \"Three quarters of the width\", words: \"three quarters of the width\" },\n { w: 12, label: \"The full width\", words: \"the full width\" },\n];\n\n/**\n * The heights the Size menu offers, in rows (A4): short holds a headline number; medium holds a chart at its floor (12 rem\n * of plot with its frame's padding, title and legend, about 290 px at the default density); tall about twice that.\n */\nexport const DASHBOARD_HEIGHTS: ReadonlyArray<{ h: number; label: string }> = [\n { h: 2, label: \"Short\" },\n { h: 5, label: \"Medium\" },\n { h: 8, label: \"Tall\" },\n];\n\n/** A width as a screen reader hears it: \"half the width\", else \"7 columns wide\". */\nexport const widthWords = (w: number) => DASHBOARD_WIDTHS.find((option) => option.w === w)?.words ?? `${w} ${w === 1 ? \"column\" : \"columns\"} wide`;\n\n/** A size as a screen reader hears it (A7): \"half the width, 4 rows tall\". */\nexport const sizeWords = (w: number, h: number) => `${widthWords(w)}, ${h} ${h === 1 ? \"row\" : \"rows\"} tall`;\n","import { Children, Fragment, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent as ReactKeyboardEvent, type ReactNode, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n DndContext,\n DragOverlay,\n MouseSensor,\n TouchSensor,\n useDraggable,\n useSensor,\n useSensors,\n type Active,\n type Announcements,\n type CollisionDetection,\n type DragMoveEvent,\n} from \"@dnd-kit/core\";\nimport { cn, FOCUS_RING, GLASS_DROPDOWN } from \"../lib/utils\";\nimport { Icon, type IconName } from \"../lib/icons\";\nimport { AutoTooltip } from \"./Tooltip\";\nimport { DropdownMenu, type DropdownMenuDivider, type DropdownMenuEntry, type DropdownMenuItem } from \"./DropdownMenu\";\nimport { DashboardCellContext, type DashboardCellValue } from \"../lib/dashboard-cell\";\nimport { FillContext } from \"../lib/use-fill-height\";\nimport { useCellFrameScroll } from \"../lib/cell-frame-scroll\";\nimport { useCompact } from \"../lib/use-compact\";\nimport { useHydrated } from \"../lib/hydrated\";\nimport { useLatest } from \"../lib/use-latest\";\nimport { focusAfterSelfRemoval } from \"../lib/focus\";\nimport { warnOnce } from \"../lib/dev-warn\";\nimport { elementType } from \"../lib/element-type\";\nimport {\n DASHBOARD_COLUMNS,\n DASHBOARD_HEIGHTS,\n DASHBOARD_WIDTHS,\n addItem,\n moveItem,\n nearestIndex,\n normaliseLayout,\n placeLayout,\n resizeItem,\n sizeLimits,\n sizeWords,\n stepTarget,\n type DashboardLayout,\n type DashboardLayoutItem,\n type DashboardStep,\n} from \"../lib/dashboard-layout\";\n\n/**\n * Sprint 32 (A1–A13) — the dashboard grid: a dashboard the people using the app arrange themselves. Its widgets sit in a\n * reading order on 12 columns (lib/dashboard-layout.ts), each one of the library's titled frames, which the grid only\n * places: no frame of its own, so never a card in a card (A3). In the view it is an ordinary page (custom_interaction#20):\n * nothing drags, and a widget's own links and clicks work as anywhere else. In its edit mode, entered on purpose, each\n * widget gets three controls beside its frame, never inside it (A4): a move handle, a ⋯ menu (Set up, Move, Size and the\n * page's own actions) and a resize grip. Every drag has a keyboard way and a plain click way (accessibility#26), and\n * everything is said in the grid's own polite live region, with the widget's name, never its id (A7).\n *\n * The pointer and touch go through dnd-kit 6.3.1, the Kanban's: the mouse sensor after 5 px and the touch sensor after a\n * hold (never the pointer sensor, which also answers touch and would start on a 5 px swipe), its auto-scroll for the page,\n * and nothing of its own said. The keyboard's moves are the grid's own state, never dnd-kit's keyboard sensor (A5).\n */\n\n/** A kind of widget the palette offers (A8): its name, an optional description and icon, and the size it starts at. */\nexport interface DashboardWidgetKind {\n id: string;\n name: string;\n description?: string;\n icon?: IconName;\n /** Its starting width, in columns of 12. A chart's kind starts tall enough to hold the chart's floor (5 rows). */\n w: number;\n /** Its starting height, in rows. */\n h: number;\n}\n\nexport interface DashboardItemProps {\n /** The widget's id, as its layout entry has it. */\n id: string;\n /**\n * The widget's name, its frame's title on screen (\"Cash balance\"): what a screen reader hears on the grid's controls\n * (\"Move Cash balance\") and in what the grid says (\"Cash balance, position 3 of 8\"). In development a label that\n * differs from the frame's title is warned about.\n */\n label: string;\n /** The widget: one of the library's titled frames (a ChartContainer, a StatsCard, a titled Table, a Card with a CardHeader). */\n children: ReactNode;\n}\n\nexport interface DashboardGridProps {\n /**\n * The widgets in reading order, each with a width in columns of 12 and a height in rows: plain data the page saves as it\n * likes. Authoritative: the grid draws what it's given, normalised (normaliseLayout), each widget once, in this order.\n */\n layout: readonly DashboardLayoutItem[];\n /** The layout after a change the person made: once per change kept (a drop, a menu choice, a keyboard drop, a resize kept). */\n onLayoutChange?: (layout: DashboardLayout) => void;\n /**\n * The edit mode, entered on purpose (custom_interaction#20): handles, grips and the column guides, and each widget's\n * content inert, so a press on a chart never opens its report mid-edit. Off, the dashboard is an ordinary page.\n */\n editing?: boolean;\n /**\n * Edit mode only: the person chose a widget to set up, from its ⋯ menu's Set up or by a click on the widget (one that\n * began on it, never the end of a drag or a resize). Show its settings in the page's side panel.\n */\n onSelect?: (id: string) => void;\n /**\n * A widget's own entries for its ⋯ menu (Duplicate, Remove…), after the grid's Set up, Move and Size, as a Kanban card's\n * cardActions. A Remove that takes the widget out puts focus on the same control in the widget before, else after.\n */\n itemActions?: (id: string) => DropdownMenuEntry[];\n /**\n * A widget of this kind added from the palette, by a click on its row (at the end) or a drop (where it lands): add the\n * page's widget and its layout entry (addItem), and return the new widget's id, or a promise of it for an id the server\n * makes. Focus goes to the new widget's move handle (its ⋯ on a stacked grid).\n */\n onAdd?: (kind: DashboardWidgetKind, index: number) => string | PromiseLike<string>;\n /** The widgets, each a DashboardItem: an array or a fragment of them. */\n children?: ReactNode;\n /**\n * The name of the widgets' group while editing, as a screen reader hears it, and where focus goes when the last widget\n * is removed. Default \"Dashboard widgets\".\n */\n \"aria-label\"?: string;\n className?: string;\n}\n\n/** Sprint 32 (A3): the gap between widgets is CardGrid's, and a row's height scales with the theme's density. */\nconst GAP = \"var(--ds-space-4)\";\nconst ROW = \"var(--ds-space-12)\";\n/**\n * While editing, the grid is at least four rows tall, by its own rows and gaps (so it follows the density), under its\n * column guides: an empty dashboard, a new one or a new tab, has somewhere to drop a widget, and a short one room below.\n */\nconst FLOOR = `calc(4 * ${ROW} + 3 * ${GAP})`;\n/** A widget a page left out of the layout is drawn after the rest at this size (a development warning says so). */\nconst UNLISTED = { w: 4, h: 4 };\n/** How long focus waits for a widget to appear, or a removal to show, as the library's removal watches do. */\nconst WATCH_MS = 10_000;\n/** The id the palette's drop shows its place under: never a page's (ids are the page's strings, never with a NUL). */\nconst NEW_ID = \"\\u0000new\";\n/** Told apart from the words it follows, so the same words said twice in a row are said twice. */\nconst NO_BREAK_SPACE = String.fromCharCode(160);\n/** The lifted copy's layer (dnd-kit's DragOverlay, fixed over the page): what's under a drop is read past it (G18). */\nconst LIFTED_LAYER = \"ds-dashboard-lifted-layer\";\n/** A widget's frame, the cell's one child: one of the library's (F5). A paged Table's wrapper holds its table. */\nconst FRAMES = '[data-card], [data-gs=\"table\"], [data-gs-paged], [data-gs=\"chart\"], [data-stats-card]';\n/** How long what a widget shows first may stay before it's judged no frame (F5): a Suspense fallback's wait, generously. */\nconst SETTLE_MS = 10_000;\n\n/**\n * The grid's controls (A4): the library's quiet icon button, as a Card's ⋯ is drawn, laid over the frame's header band at\n * CardHeader's inset, centred on its title's first line. A StatsCard pads less (p-ds-3, sm:p-ds-5), and on one they\n * centre on its label's line (a text-xs line: 4/3 of its size). In a narrow cell (under 13rem: the cell is a named\n * container) they sit in a band at the frame's top instead, at its own top inset, the handle at the band's start and the\n * ⋯ at its end, and the frame moves its first line down below the band (lib/dashboard-frame.ts): beside them, a title\n * would be left no room. Each stays far enough in for its whole focus outline.\n */\nconst CONTROL = cn(\n \"absolute z-[1] inline-flex items-center justify-center h-[var(--ds-control-height-sm)] w-[var(--ds-control-height-sm)]\",\n \"rounded-[var(--ds-radius-md)] text-[var(--ds-text-muted)] hover:text-[var(--ds-text-primary)] hover:bg-[var(--ds-bg-muted)]\",\n \"transition-colors duration-[var(--ds-transition-speed)]\",\n FOCUS_RING,\n);\nconst PLACE_TOP = [\n \"top-[calc(var(--ds-space-4)+(var(--ds-font-size-lg)*var(--ds-line-height-lg)-var(--ds-control-height-sm))/2)]\",\n \"[:has(>[data-dashboard-content]>[data-stats-card])>&]:top-[calc(var(--ds-space-3)+(var(--ds-font-size-xs)*4/3-var(--ds-control-height-sm))/2)]\",\n \"sm:[:has(>[data-dashboard-content]>[data-stats-card])>&]:top-[calc(var(--ds-space-5)+(var(--ds-font-size-xs)*4/3-var(--ds-control-height-sm))/2)]\",\n \"@max-[13rem]/dashboard-cell:top-ds-4\",\n \"@max-[13rem]/dashboard-cell:[:has(>[data-dashboard-content]>[data-stats-card])>&]:top-ds-3\",\n \"sm:@max-[13rem]/dashboard-cell:[:has(>[data-dashboard-content]>[data-stats-card])>&]:top-ds-5\",\n].join(\" \");\nconst PLACE_START = \"start-ds-5 [:has(>[data-dashboard-content]>[data-stats-card])>&]:start-ds-3 sm:[:has(>[data-dashboard-content]>[data-stats-card])>&]:start-ds-5\";\nconst PLACE_END = \"end-ds-5 [:has(>[data-dashboard-content]>[data-stats-card])>&]:end-ds-3 sm:[:has(>[data-dashboard-content]>[data-stats-card])>&]:end-ds-5\";\n/** The resize grip (A4): a 24 px target at the bottom corner on the end side, 4 px in, so its outline stays in the cell. */\nconst GRIP = cn(\n \"absolute bottom-[4px] end-[4px] z-[1] inline-flex h-6 w-6 items-center justify-center rounded-[var(--ds-radius-sm)]\",\n \"text-[var(--ds-text-muted)] hover:text-[var(--ds-text-primary)] hover:bg-[var(--ds-bg-muted)]\",\n \"cursor-nwse-resize rtl:cursor-nesw-resize touch-manipulation select-none [-webkit-touch-callout:none]\",\n FOCUS_RING,\n);\n/** The size while resizing (A6, custom_interaction#7), beside the grip, in a tooltip's look; the live region says it. */\nconst READOUT = cn(\n \"pointer-events-none absolute end-[4px] bottom-[calc(4px+1.5rem+var(--ds-space-1))] z-[2] whitespace-nowrap px-ds-2 py-ds-1 text-xs tabular-nums\",\n \"bg-[var(--ds-bg-surface-elevated)] text-[var(--ds-text-primary)] border-[length:var(--ds-border-width)] border-[var(--ds-border-default)] rounded-[var(--ds-radius-sm)]\",\n GLASS_DROPDOWN,\n);\n/** Where a widget will land while it's dragged (A5): the accent's outline over its 10% tint, the tint the rail's selected item takes. */\nconst PLACEHOLDER = \"rounded-[var(--ds-radius-md)] border-2 border-dashed border-[var(--ds-accent-primary)] bg-[var(--ds-accent-subtle)]\";\n/** A widget the keyboard has picked up lifts where it is: the theme's raised shadow, and the placeholder's outline. */\nconst LIFTED = \"rounded-[var(--ds-radius-md)] shadow-[var(--ds-shadow-lg)] outline-2 outline-dashed outline-offset-2 outline-[var(--ds-accent-primary)]\";\n\n/** What dnd-kit says: nothing. Its words name ids and always render; the grid says everything in its own region (A7). */\nconst SILENT: Announcements = { onDragStart: () => undefined, onDragOver: () => undefined, onDragEnd: () => undefined, onDragCancel: () => undefined };\n/** The mouse sensor after 5 px, the touch sensor after a short hold, so a tap still taps and a swipe still scrolls (A1). */\nconst MOUSE = { activationConstraint: { distance: 5 } };\nconst TOUCH = { activationConstraint: { delay: 250, tolerance: 5 } };\n\n/** Right to left: by the page's `dir`, else the computed direction. Left and Right swap there, and the grip sits on the left. */\nfunction isRtl(el: Element): boolean {\n const dir = el.closest(\"[dir]\")?.getAttribute(\"dir\")?.toLowerCase();\n if (dir === \"rtl\" || dir === \"ltr\") return dir === \"rtl\";\n return typeof getComputedStyle === \"function\" && getComputedStyle(el).direction === \"rtl\";\n}\n\n/** The theme's transition speed in ms (`--ds-transition-speed`), which it sets to nothing when the person asks for less motion. */\nfunction speedOf(el: Element): number {\n const raw = getComputedStyle(el).getPropertyValue(\"--ds-transition-speed\").trim();\n const n = parseFloat(raw);\n if (!Number.isFinite(n)) return 0;\n return raw.endsWith(\"ms\") ? n : raw.endsWith(\"s\") ? n * 1000 : n;\n}\n\n/** The grid's pitch, read from its own box and styles (never from a widget): a column and its gap, a row and its gap, in px. */\nfunction pitchOf(cells: HTMLElement, columns: number): { col: number; row: number; rtl: boolean } {\n const style = getComputedStyle(cells);\n const colGap = parseFloat(style.columnGap) || 0;\n const rowGap = parseFloat(style.rowGap) || 0;\n const row = parseFloat(style.gridAutoRows) || 0;\n return { col: (cells.clientWidth + colGap) / columns, row: row + rowGap, rtl: isRtl(cells) };\n}\n\n/** One of a cell's parts by its mark and the widget's id, inside the grid. */\nfunction partOf(root: HTMLElement | null, attr: string, id: string): HTMLElement | null {\n return [...(root?.querySelectorAll<HTMLElement>(`[${attr}]`) ?? [])].find((el) => el.getAttribute(attr) === id) ?? null;\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> => value != null && typeof (value as { then?: unknown }).then === \"function\";\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\n\n/* ── The drag the palette and the grid share ───────────────────────────────────────────────────────────────────── */\n\n/** What a drag carries (useDraggable's data): a widget moved by its handle, resized by its grip, or a kind from the palette. */\nexport type DashboardDrag =\n | { type: \"move\"; id: string; picture: () => HTMLElement | null }\n | { type: \"resize\"; id: string; picture: () => HTMLElement | null }\n | { type: \"kind\"; kind: DashboardWidgetKind; picture: () => HTMLElement | null };\n\n/** A point on the page, in the viewport's pixels. */\ninterface Point { x: number; y: number }\n\n/** The grid's side of a drag, read at each event; `point` is where the pointer or finger was last seen. */\ninterface GridDrags {\n start(drag: DashboardDrag): void;\n move(drag: DashboardDrag, event: DragMoveEvent, point: Point | null): void;\n /** Whether a drop at this point goes back (G18): a kind not over the grid, or a widget let go under what covers it. */\n refuses(drag: DashboardDrag, point: Point | null): boolean;\n end(drag: DashboardDrag): void;\n cancel(drag: DashboardDrag): void;\n}\n\n/** The grid as the palette sees it: whether it stacks or edits, and its Add (`then` runs once the page has said the new id). */\nexport interface DashboardGridHandle {\n stacked: boolean;\n editing: boolean;\n add(kind: DashboardWidgetKind, then?: () => void): PromiseLike<unknown> | void;\n}\n\ninterface DashboardArena {\n /** The grid's drag handlers, connected once, and what it tells the palette: one grid to an editor. */\n connect(drags: RefObject<GridDrags>): () => void;\n publish(grid: DashboardGridHandle | null): void;\n grid: DashboardGridHandle | null;\n /** A drag going on, by what it carries: every control's tooltip steps aside meanwhile (A6, one tooltip at a time). */\n dragging: DashboardDrag[\"type\"] | null;\n}\n\n/** The drag the palette and the grid share (A8): DashboardEditor's, else the grid's own. */\nexport const DashboardArenaCtx = createContext<DashboardArena | null>(null);\n\n/** The lifted copy (A5): a picture of what's dragged, taken as it lifts (no second widget, no second fetch), never a control. */\nfunction Lifted({ picture, surface }: { picture: HTMLElement; surface: boolean }) {\n const host = useRef<HTMLDivElement>(null);\n useLayoutEffect(() => {\n host.current?.replaceChildren(picture);\n }, [picture]);\n return (\n <div\n ref={host}\n aria-hidden=\"true\"\n data-dashboard-lifted=\"\"\n className={cn(\n \"h-full w-full rounded-[var(--ds-radius-md)] shadow-[var(--ds-shadow-lg)]\",\n surface && \"overflow-hidden bg-[var(--ds-bg-surface)] border-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)]\",\n )}\n />\n );\n}\n\n/** A copy of what lifts, as a picture: inert, unnamed, filling the lifted box, with no id of the page's twice. */\nfunction pictureOf(el: HTMLElement | null): HTMLElement | null {\n if (!el) return null;\n const copy = el.cloneNode(true) as HTMLElement;\n copy.removeAttribute(\"role\");\n copy.removeAttribute(\"aria-label\");\n copy.removeAttribute(\"id\");\n for (const named of copy.querySelectorAll(\"[id]\")) named.removeAttribute(\"id\");\n copy.setAttribute(\"inert\", \"\");\n copy.style.width = \"100%\";\n copy.style.height = \"100%\";\n return copy;\n}\n\n/**\n * The drag the palette and the grid share: dnd-kit's context with the grid's sensors, its auto-scroll, and nothing said\n * of its own; its focus restore off (it acts only after a drag the keyboard started, which never happens here). The lifted\n * copy is portalled to the page's body, so no transformed or filtered box around the grid shifts it.\n */\nfunction DragArena({ children }: { children: ReactNode }) {\n const drags = useRef<RefObject<GridDrags> | null>(null);\n const [grid, setGrid] = useState<DashboardGridHandle | null>(null);\n const [lifted, setLifted] = useState<{ type: DashboardDrag[\"type\"]; picture: HTMLElement | null } | null>(null);\n // the last drag's kind and the theme's speed, for its drop: only a moved widget's copy settles into its new place\n const [settle, setSettle] = useState<{ type: DashboardDrag[\"type\"]; speed: number; rtl: boolean } | null>(null);\n const hydrated = useHydrated();\n const sensors = useSensors(useSensor(MouseSensor, MOUSE), useSensor(TouchSensor, TOUCH));\n const api = useMemo(() => ({\n connect: (handlers: RefObject<GridDrags>) => {\n // G11: one grid to an editor; a second would take every drag, and its removal would cut the first off\n if (drags.current && drags.current !== handlers) warnOnce(\"DashboardGrid\", \"one DashboardGrid at a time in a DashboardEditor: show one tab's grid at a time.\");\n drags.current = handlers;\n return () => { if (drags.current === handlers) drags.current = null; };\n },\n publish: setGrid,\n }), []);\n const value = useMemo<DashboardArena>(() => ({ ...api, grid, dragging: lifted?.type ?? null }), [api, grid, lifted]);\n const dragOf = (active: Active) => active.data.current as DashboardDrag | undefined;\n // G18: where the pointer or the finger was last seen (dnd-kit's own, which only its collision check is given). The grid\n // reads what's on top there, which no rectangle tells: a drawer over the page covers the grid without changing its box.\n // A drop is decided at this point, since a move's `over` is one check behind it.\n const point = useRef<Point | null>(null);\n const collisionDetection = useCallback<CollisionDetection>(({ pointerCoordinates }) => {\n point.current = pointerCoordinates;\n return [];\n }, []);\n // While a pointer's drag is on, Escape is its own (dnd-kit's sensor cancels it from the window): claimed first, so the\n // panel or drawer around the palette, where a pressed row put focus, stays open (the look fixes, D5)\n const dragOn = lifted !== null;\n useEffect(() => {\n if (!dragOn) return;\n const claim = (e: KeyboardEvent) => { if (e.key === \"Escape\") e.preventDefault(); };\n document.addEventListener(\"keydown\", claim, true);\n return () => document.removeEventListener(\"keydown\", claim, true);\n }, [dragOn]);\n\n return (\n <DndContext\n sensors={sensors}\n accessibility={{ announcements: SILENT, screenReaderInstructions: { draggable: \"\" }, restoreFocus: false, container: hydrated ? document.body : undefined }}\n collisionDetection={collisionDetection}\n cancelDrop={({ active }) => {\n const drag = dragOf(active);\n return !!drag && !!drags.current?.current.refuses(drag, point.current);\n }}\n onDragStart={({ active }) => {\n const drag = dragOf(active);\n if (!drag) return;\n const node = drag.picture();\n setSettle({ type: drag.type, speed: speedOf(node ?? document.documentElement), rtl: !!node && isRtl(node) });\n setLifted({ type: drag.type, picture: drag.type === \"resize\" ? null : pictureOf(node) });\n drags.current?.current.start(drag);\n }}\n onDragMove={(event) => {\n const drag = dragOf(event.active);\n if (drag) drags.current?.current.move(drag, event, point.current);\n }}\n onDragEnd={({ active }) => {\n const drag = dragOf(active);\n setLifted(null);\n if (drag) drags.current?.current.end(drag);\n }}\n onDragCancel={({ active }) => {\n const drag = dragOf(active);\n setLifted(null);\n if (drag) drags.current?.current.cancel(drag);\n }}\n >\n <DashboardArenaCtx value={value}>{children}</DashboardArenaCtx>\n {hydrated && createPortal(\n <DragOverlay\n // marked, so what's under a drop is read past it (G18)\n className={LIFTED_LAYER}\n // a moved widget's copy settles into its new place at the theme's speed (none when the person asks for less\n // motion); a kind from the palette becomes its widget where it's dropped\n dropAnimation={settle?.type === \"move\" && settle.speed > 0 ? { duration: settle.speed, easing: \"ease\" } : null}\n // the copy is under the pointer: it carries the cursor (custom_interaction#6)\n style={{ cursor: settle?.type === \"resize\" ? (settle.rtl ? \"nesw-resize\" : \"nwse-resize\") : \"grabbing\" }}\n >\n {lifted?.picture ? <Lifted picture={lifted.picture} surface={lifted.type === \"kind\"} /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n}\n\n/**\n * Sprint 32 (A8): the palette and the grid share one drag, so a widget library's kind can be dragged onto the grid. A\n * page that uses both wraps them in a DashboardEditor (anywhere above both: the side panel and the page's content); a\n * grid alone needs none. One grid to an editor: each tab's grid in turn, as only the open tab's is drawn.\n */\nexport function DashboardEditor({ children }: { children: ReactNode }) {\n return <DragArena>{children}</DragArena>;\n}\n\n/* ── The grid ──────────────────────────────────────────────────────────────────────────────────────────────────── */\n\n/**\n * One widget on a DashboardGrid (A3). The grid reads its props and draws it in a cell of its own, in the layout's order;\n * on its own it draws its children.\n */\nexport function DashboardItem({ children }: DashboardItemProps) {\n return <>{children}</>;\n}\n\ninterface GridItem {\n id: string;\n label: string;\n content: ReactNode;\n}\n\n/**\n * The grid's widgets, from its children: each DashboardItem once, by its id, fragments opened. What it leaves out (a child\n * that isn't a DashboardItem, an id given twice or not at all) is counted, for the development warning.\n */\nfunction itemsOf(children: ReactNode): { items: GridItem[]; strays: number; repeated: string[] } {\n const items: GridItem[] = [];\n const repeated: string[] = [];\n let strays = 0;\n const seen = new Set<string>();\n const open = (node: ReactNode) => Children.forEach(node, (child) => {\n if (!isValidElement(child)) return;\n if (child.type === Fragment) { open((child.props as { children?: ReactNode }).children); return; }\n if (elementType(child.type) !== DashboardItem) { strays++; return; }\n const { id, label, children: content } = child.props as DashboardItemProps;\n if (typeof id !== \"string\" || id === \"\" || seen.has(id)) { repeated.push(String(id)); return; }\n seen.add(id);\n items.push({ id, label: typeof label === \"string\" && label ? label : id, content });\n });\n open(children);\n return { items, strays, repeated };\n}\n\n/** The layout drawn: the page's, normalised, for the widgets there are; a widget it leaves out goes at the end. */\nfunction drawnLayout(layout: readonly DashboardLayoutItem[], ids: string[]): DashboardLayout {\n const present = new Set(ids);\n const known = normaliseLayout(layout).filter((item) => present.has(item.id));\n const listed = new Set(known.map((item) => item.id));\n return [...known, ...ids.filter((id) => !listed.has(id)).map((id) => ({ id, ...UNLISTED }))];\n}\n\n/** What the grid previews while something moves or resizes: the layout is the page's until a change is kept. */\ntype Preview =\n // `covered`: held where something covers the grid (G18), so shown back at its place\n | { type: \"move\"; id: string; index: number; from: number; by: \"pointer\" | \"keyboard\"; covered?: boolean }\n | { type: \"resize\"; id: string; w: number; h: number; from: { w: number; h: number }; by: \"pointer\" | \"keyboard\" }\n | { type: \"add\"; kind: DashboardWidgetKind; index: number };\n\nfunction applyPreview(committed: DashboardLayout, preview: Preview | null): DashboardLayout {\n if (!preview) return committed;\n if (preview.type === \"move\") return moveItem(committed, preview.id, preview.index);\n if (preview.type === \"resize\") return resizeItem(committed, preview.id, { w: preview.w, h: preview.h });\n return addItem(committed, { id: NEW_ID, w: preview.kind.w, h: preview.kind.h }, preview.index);\n}\n\n/** Why a key can't move a widget further (A5): every press moves it or says why not. */\nconst BLOCKED: Record<\"first\" | \"last\" | \"top\" | \"bottom\", (name: string) => string> = {\n first: (name) => `${name} is first.`,\n last: (name) => `${name} is last.`,\n top: (name) => `${name} is in the top row.`,\n bottom: (name) => `${name} is in the bottom row.`,\n};\n\n/** A menu's entries with no divider at either end and none twice over. */\nfunction tidy(entries: DropdownMenuEntry[]): DropdownMenuEntry[] {\n const isDivider = (e: DropdownMenuEntry | undefined) => !!e && \"type\" in e && e.type === \"divider\";\n return entries\n .reduce<DropdownMenuEntry[]>((acc, e) => (isDivider(e) && (acc.length === 0 || isDivider(acc[acc.length - 1])) ? acc : [...acc, e]), [])\n .filter((e, i, all) => !(isDivider(e) && i === all.length - 1));\n}\n\n/** What a widget's ⋯ menu does, the grid's: its moves and sizes, a page's action chosen (A9's watch), and the page's own. */\ninterface MenuActions {\n moveTo: (id: string, index: number) => void;\n sizeTo: (id: string, size: { w?: number; h?: number }) => void;\n chose: (id: string) => void;\n onSelect?: (id: string) => void;\n itemActions?: (id: string) => DropdownMenuEntry[];\n}\n\n/**\n * A widget's ⋯ menu (A4): Set up (onSelect), then Move (to the start, earlier, later, to the end: what it can do from\n * where it is) and Size (the widths in pairs that fill a row, then short, medium or tall, within its limits; none on a\n * stacked grid), then the page's own actions. The menu lists what can be done, so the size it has is left out.\n */\nfunction menuEntries(item: DashboardLayoutItem, at: number, total: number, stacked: boolean, actions: MenuActions): DropdownMenuEntry[] {\n const { id } = item;\n const last = total - 1;\n const moves: DropdownMenuItem[] = [\n ...(at > 1 ? [{ label: \"Move to the start\", onClick: () => actions.moveTo(id, 0) }] : []),\n ...(at > 0 ? [{ label: \"Move earlier\", onClick: () => actions.moveTo(id, at - 1) }] : []),\n ...(at < last ? [{ label: \"Move later\", onClick: () => actions.moveTo(id, at + 1) }] : []),\n ...(at < last - 1 ? [{ label: \"Move to the end\", onClick: () => actions.moveTo(id, last) }] : []),\n ];\n const limits = sizeLimits(item);\n const widths: DropdownMenuItem[] = DASHBOARD_WIDTHS.filter((o) => o.w !== item.w && o.w >= limits.minW && o.w <= limits.maxW).map((o) => ({ label: o.label, onClick: () => actions.sizeTo(id, { w: o.w }) }));\n const heights: DropdownMenuItem[] = DASHBOARD_HEIGHTS.filter((o) => o.h !== item.h && o.h >= limits.minH && o.h <= limits.maxH).map((o) => ({ label: o.label, onClick: () => actions.sizeTo(id, { h: o.h }) }));\n const divider: DropdownMenuDivider = { type: \"divider\" };\n const size = widths.length && heights.length ? [...widths, divider, ...heights] : [...widths, ...heights];\n // a page's action starts the removal watch as it's chosen (A9), before it runs\n const watched = (entry: DropdownMenuItem): DropdownMenuItem => ({ ...entry, onClick: () => { actions.chose(id); entry.onClick(); } });\n const own = (actions.itemActions?.(id) ?? []).map((entry): DropdownMenuEntry =>\n \"type\" in entry ? entry : \"items\" in entry ? { ...entry, items: entry.items.map((sub) => (\"type\" in sub ? sub : watched(sub))) } : watched(entry));\n const select = actions.onSelect;\n return tidy([\n ...(select ? [{ label: \"Set up\", onClick: () => select(id) }] : []),\n ...(moves.length ? [{ label: \"Move\", items: moves }] : []),\n // A12: a stacked grid has no resizing; its widgets keep their rows, and their widths don't show\n ...(!stacked && size.length ? [{ label: \"Size\", items: size }] : []),\n divider,\n ...own,\n ]);\n}\n\n/** The grid drawn in a drag arena: an editor's, else one of its own (a grid alone needs no editor). */\nexport function DashboardGrid(props: DashboardGridProps) {\n const arena = useContext(DashboardArenaCtx);\n return arena ? <Grid {...props} arena={arena} /> : <DragArena><OwnArenaGrid {...props} /></DragArena>;\n}\n\nfunction OwnArenaGrid(props: DashboardGridProps) {\n const arena = useContext(DashboardArenaCtx);\n return arena ? <Grid {...props} arena={arena} /> : null;\n}\n\ntype Part = \"handle\" | \"menu\" | \"grip\";\nconst PART_ATTR: Record<Part, string> = { handle: \"data-dashboard-handle\", menu: \"data-dashboard-menu\", grip: \"data-dashboard-resize\" };\n\nfunction Grid({ layout, onLayoutChange, editing = false, onSelect, itemActions, onAdd, children, \"aria-label\": ariaLabel = \"Dashboard widgets\", className, arena }: DashboardGridProps & { arena: DashboardArena }) {\n const prefix = useId();\n const { items, strays, repeated } = itemsOf(children);\n const byId = new Map(items.map((item) => [item.id, item]));\n const committed = drawnLayout(layout, items.map((item) => item.id));\n // the widgets in order, for what reads them after a render (a removal said once it shows)\n const committedIds = committed.map((item) => item.id).join(\"\\n\");\n const nameOf = (id: string) => byId.get(id)?.label ?? id;\n\n const rootRef = useRef<HTMLDivElement>(null);\n const cellsRef = useRef<HTMLDivElement | null>(null);\n // A3: one column below 40rem of the grid's own width (a side panel takes room), measured on the grid itself\n const stacked = useCompact(rootRef, \"sm\", 16);\n const columns = stacked ? 1 : DASHBOARD_COLUMNS;\n\n // The preview lives in a ref as well, so an event in the same tick as the last change reads it (as the Kanban's does).\n const [preview, setPreviewState] = useState<Preview | null>(null);\n const previewRef = useRef<Preview | null>(null);\n const setPreview = (next: Preview | null) => { previewRef.current = next; setPreviewState(next); };\n // edit mode left, or the widget gone (another change arriving), ends what was going on\n if (preview && (!editing || (preview.type !== \"add\" && !committed.some((item) => item.id === preview.id)))) setPreviewState(null);\n useLayoutEffect(() => { previewRef.current = preview; }, [preview]);\n const shown = applyPreview(committed, preview);\n const busy = preview !== null || arena.dragging !== null;\n\n // A7: the grid's own polite live region; the same words twice are said twice (a space that isn't one tells them apart)\n const [notice, setNotice] = useState(\"\");\n const say = useCallback((text: string) => setNotice((was) => (was === text ? text + NO_BREAK_SPACE : text)), []);\n\n // Focus to put back once the page has drawn a change: on the handle after a drop, on the ⋯ after a menu's move, on the\n // new widget's handle (its ⋯ on a stacked grid) once the page has drawn it. Chrome drops focus from an element the page\n // moves, and React moves a reordered widget's nodes; React's own commit gives focus back to a node it moved (Chrome 155,\n // React 19.2), and this holds where it can't: a widget whose element the page draws anew, and a new one.\n const refocus = useRef<{ id: string; part: Part; added?: boolean } | null>(null);\n const [, setTick] = useState(0);\n const removing = useRef<{ id: string; name: string } | null>(null);\n // a widget that never arrives (a page that didn't add it after all) is given up after WATCH_MS\n const focusLater = (target: { id: string; part: Part; added?: boolean }) => {\n refocus.current = target;\n setTimeout(() => { if (refocus.current === target) refocus.current = null; }, WATCH_MS);\n };\n\n const commit = (next: DashboardLayout) => onLayoutChange?.(next);\n\n /* ── Moving (A5) ── */\n const pickUp = (id: string, by: \"pointer\" | \"keyboard\") => {\n const at = committed.findIndex((item) => item.id === id);\n if (at < 0) return;\n setPreview({ type: \"move\", id, index: at, from: at, by });\n say(`Picked up ${nameOf(id)}, position ${at + 1} of ${committed.length}.`);\n };\n const stepMove = (step: DashboardStep) => {\n const p = previewRef.current;\n if (p?.type !== \"move\") return;\n const result = stepTarget(shown, p.id, step, columns);\n if (\"blocked\" in result) { say(BLOCKED[result.blocked](nameOf(p.id))); return; }\n setPreview({ ...p, index: result.index });\n say(`${nameOf(p.id)}, position ${result.index + 1} of ${committed.length}.`);\n };\n const dropMove = () => {\n const p = previewRef.current;\n if (p?.type !== \"move\") return;\n setPreview(null);\n say(`Dropped ${nameOf(p.id)} at position ${p.index + 1} of ${committed.length}.`);\n if (p.index === p.from) return;\n commit(moveItem(committed, p.id, p.index));\n focusLater({ id: p.id, part: \"handle\" });\n };\n const cancelMove = () => {\n const p = previewRef.current;\n if (p?.type !== \"move\") return;\n setPreview(null);\n say(`Move cancelled. ${nameOf(p.id)} is back at position ${p.from + 1} of ${committed.length}.`);\n };\n\n /* ── Resizing (A6) ── */\n const startResize = (id: string, by: \"pointer\" | \"keyboard\") => {\n const item = committed.find((it) => it.id === id);\n if (!item) return;\n setPreview({ type: \"resize\", id, w: item.w, h: item.h, from: { w: item.w, h: item.h }, by });\n say(`Resizing ${nameOf(id)}, ${sizeWords(item.w, item.h)}.`);\n };\n const resizeTo = (w: number, h: number) => {\n const p = previewRef.current;\n const item = p?.type === \"resize\" ? committed.find((it) => it.id === p.id) : undefined;\n if (p?.type !== \"resize\" || !item) return null;\n const limits = sizeLimits(item);\n const next = { w: clamp(w, limits.minW, limits.maxW), h: clamp(h, limits.minH, limits.maxH) };\n if (next.w !== p.w || next.h !== p.h) setPreview({ ...p, ...next });\n return next;\n };\n const stepResize = (dw: number, dh: number) => {\n const p = previewRef.current;\n if (p?.type !== \"resize\") return;\n const next = resizeTo(p.w + dw, p.h + dh);\n if (!next) return;\n const name = nameOf(p.id);\n if (next.w === p.w && next.h === p.h) {\n say(dw > 0 ? `${name} is at its widest.` : dw < 0 ? `${name} is at its narrowest.` : dh > 0 ? `${name} is at its tallest.` : `${name} is at its shortest.`);\n return;\n }\n say(`${name}, ${sizeWords(next.w, next.h)}.`);\n };\n const keepResize = () => {\n const p = previewRef.current;\n if (p?.type !== \"resize\") return;\n setPreview(null);\n const name = nameOf(p.id);\n if (p.w === p.from.w && p.h === p.from.h) { say(`${name} is still ${sizeWords(p.w, p.h)}.`); return; }\n commit(resizeItem(committed, p.id, { w: p.w, h: p.h }));\n say(`Resized ${name} to ${sizeWords(p.w, p.h)}.`);\n };\n const cancelResize = () => {\n const p = previewRef.current;\n if (p?.type !== \"resize\") return;\n setPreview(null);\n say(`Resize cancelled. ${nameOf(p.id)} is back to ${sizeWords(p.from.w, p.from.h)}.`);\n };\n\n /* ── The ⋯ menu (A4, A5, A6, A9): every drag's plain click way ── */\n const moveTo = (id: string, index: number) => {\n const at = committed.findIndex((item) => item.id === id);\n if (at < 0 || index === at) return;\n commit(moveItem(committed, id, index));\n // the menu put focus back on its ⋯, which moves with the widget: it goes back there, in the widget's new place\n focusLater({ id, part: \"menu\" });\n say(`Moved ${nameOf(id)} to position ${index + 1} of ${committed.length}.`);\n };\n const sizeTo = (id: string, size: { w?: number; h?: number }) => {\n const next = resizeItem(committed, id, size);\n const item = next.find((it) => it.id === id);\n if (!item) return;\n commit(next);\n say(`Resized ${nameOf(id)} to ${sizeWords(item.w, item.h)}.`);\n };\n /**\n * A9: a page's action may take the widget away (Remove). Its watch starts as the action is chosen, since the menu has\n * handed focus back to a ⋯ that's about to go: focus then goes to the same control in the widget before, else in the one\n * after (the library's rule for an item leaving a group), and the region says it's gone.\n */\n const watchRemoval = (id: string) => {\n const cells = cellsRef.current;\n const trigger = partOf(cells, PART_ATTR.menu, id);\n const cell = partOf(cells, \"data-dashboard-cell\", id);\n const entry = { id, name: nameOf(id) };\n removing.current = entry;\n // an action that took nothing away (Duplicate) is forgotten once a removal would have shown\n setTimeout(() => { if (removing.current === entry) removing.current = null; }, WATCH_MS);\n if (trigger && cell && cells) focusAfterSelfRemoval(trigger, { item: cell, group: cells });\n };\n const menuActions: MenuActions = { moveTo, sizeTo, chose: watchRemoval, onSelect, itemActions };\n\n /* ── Adding (A8) ── */\n const add = (kind: DashboardWidgetKind, index?: number, then?: () => void): PromiseLike<unknown> | void => {\n if (!onAdd) {\n warnOnce(\"DashboardGrid\", \"a widget was added from the palette, but the grid has no onAdd: give it one that adds the page's widget and its layout entry (addItem) and returns the new widget's id.\");\n return;\n }\n // G16: a failed add is said where the person is told everything else; the page says why (a toast)\n const failed = (why: string, error: unknown) => {\n console.error(`DashboardGrid: ${why}, so nothing was added.`, error);\n say(`Couldn't add ${kind.name}.`);\n };\n let result: string | PromiseLike<string>;\n try {\n result = onAdd(kind, index ?? committed.length);\n } catch (error) {\n failed(\"onAdd threw\", error);\n return;\n }\n const land = (id: unknown) => {\n if (typeof id !== \"string\" || id === \"\") {\n warnOnce(\"DashboardGrid\", \"onAdd returned no id: return the new widget's id (or a promise of it), so focus can go to it.\");\n return;\n }\n focusLater({ id, part: \"handle\", added: true });\n setTick((n) => n + 1);\n then?.();\n };\n if (isThenable(result)) return result.then(land, (error: unknown) => failed(\"onAdd's promise was rejected\", error));\n land(result);\n };\n const addLatest = useLatest(add);\n const handle = useMemo<DashboardGridHandle>(() => ({ stacked, editing, add: (kind, then) => addLatest.current(kind, undefined, then) }), [stacked, editing, addLatest]);\n const { publish, connect } = arena;\n useLayoutEffect(() => {\n publish(handle);\n return () => publish(null);\n }, [publish, handle]);\n\n /* ── The pointer's drags, through the arena ── */\n const pitch = useRef<{ col: number; row: number; rtl: boolean } | null>(null);\n /** Where the lifted copy's top-start corner is, in grid units (a column from the inline start, a row from the top). */\n const pointOf = (event: DragMoveEvent) => {\n const cells = cellsRef.current;\n const p = pitch.current;\n const rect = event.active.rect.current.translated;\n if (!cells || !p || !rect || p.col <= 0 || p.row <= 0) return null;\n const box = cells.getBoundingClientRect();\n return { col: (p.rtl ? box.right - rect.right : rect.left - box.left) / p.col, row: (rect.top - box.top) / p.row };\n };\n /**\n * G18: where a point is, for a drop. Over the grid: inside its box with the grid on top there, the lifted copy and its\n * layer aside. Covered: inside the box under something else (the widget library's drawer over the page), where a drop\n * goes back, since the person never left what covers it. Else away (beside the grid, below its last widget).\n */\n const whereIs = (point: Point | null): \"over\" | \"covered\" | \"away\" => {\n const box = cellsRef.current?.getBoundingClientRect();\n if (!editing || !box || !point || point.x < box.left || point.x > box.right || point.y < box.top || point.y > box.bottom) return \"away\";\n // a page that can't say what's on top (jsdom) has the box alone\n if (typeof document.elementsFromPoint !== \"function\") return \"over\";\n const top = document.elementsFromPoint(point.x, point.y).find((el) => !el.closest(`.${LIFTED_LAYER}`));\n if (!top) return \"away\";\n return rootRef.current?.contains(top) ? \"over\" : \"covered\";\n };\n const drags: GridDrags = {\n start(drag) {\n pitch.current = cellsRef.current ? pitchOf(cellsRef.current, columns) : null;\n if (drag.type === \"move\") pickUp(drag.id, \"pointer\");\n else if (drag.type === \"resize\") startResize(drag.id, \"pointer\");\n else say(`Picked up ${drag.kind.name}.`);\n },\n move(drag, event, at) {\n const p = previewRef.current;\n const g = pitch.current;\n if (drag.type === \"resize\") {\n if (p?.type !== \"resize\" || !g || g.col <= 0 || g.row <= 0) return;\n const dx = g.rtl ? -event.delta.x : event.delta.x;\n resizeTo(p.from.w + Math.round(dx / g.col), p.from.h + Math.round(event.delta.y / g.row));\n return;\n }\n const point = pointOf(event);\n if (drag.type === \"move\") {\n const item = committed.find((it) => it.id === drag.id);\n if (p?.type !== \"move\" || !point || !g || !item) return;\n // held over what covers the grid, it shows back at its place, as a drop there would leave it\n if (whereIs(at) === \"covered\") {\n if (p.covered) return;\n setPreview({ ...p, index: p.from, covered: true });\n say(`${nameOf(drag.id)} is not over the dashboard.`);\n return;\n }\n const index = nearestIndex(committed.filter((it) => it.id !== drag.id), item, point, g, columns);\n if (index === p.index && !p.covered) return;\n setPreview({ ...p, index, covered: false });\n say(`${nameOf(drag.id)}, position ${index + 1} of ${committed.length}.`);\n return;\n }\n if (!point || !g || whereIs(at) !== \"over\") {\n if (p?.type === \"add\") { setPreview(null); say(`${drag.kind.name} is not over the dashboard.`); }\n return;\n }\n const [item] = normaliseLayout([{ id: NEW_ID, w: drag.kind.w, h: drag.kind.h }]);\n const index = nearestIndex(committed, item, point, g, columns);\n if (p?.type === \"add\" && p.index === index) return;\n setPreview({ type: \"add\", kind: drag.kind, index });\n say(`${drag.kind.name}, position ${index + 1} of ${committed.length + 1}.`);\n },\n refuses(drag, at) {\n const where = whereIs(at);\n return drag.type === \"kind\" ? where !== \"over\" : drag.type === \"move\" && where === \"covered\";\n },\n end(drag) {\n const p = previewRef.current;\n if (drag.type === \"move\") dropMove();\n else if (drag.type === \"resize\") keepResize();\n else {\n setPreview(null);\n if (p?.type === \"add\") add(drag.kind, p.index);\n else say(`${drag.kind.name} not added.`);\n }\n },\n cancel(drag) {\n if (drag.type === \"move\") cancelMove();\n else if (drag.type === \"resize\") cancelResize();\n else { setPreview(null); say(`${drag.kind.name} not added.`); }\n },\n };\n const dragsRef = useLatest(drags);\n useLayoutEffect(() => connect(dragsRef), [connect, dragsRef]);\n\n /* ── The keyboard (A5, A6), on the handle and the grip ── */\n const onHandleKey = (id: string, e: ReactKeyboardEvent<HTMLElement>) => {\n const p = previewRef.current;\n const key = e.key;\n const plain = !e.ctrlKey && !e.metaKey && !e.altKey;\n if (!(p?.type === \"move\" && p.by === \"keyboard\" && p.id === id)) {\n // the Kanban keeps Enter for opening a card; this handle has nothing else to open, so both keys start a move\n if ((key === \" \" || key === \"Enter\") && plain && !e.repeat && !p) { e.preventDefault(); pickUp(id, \"keyboard\"); }\n return;\n }\n if (key === \" \" || key === \"Enter\") { e.preventDefault(); if (!e.repeat) dropMove(); return; }\n if (key === \"Escape\") { e.preventDefault(); cancelMove(); return; }\n const rtl = isRtl(e.currentTarget);\n const step: DashboardStep | null = key === \"ArrowLeft\" ? (rtl ? \"later\" : \"earlier\")\n : key === \"ArrowRight\" ? (rtl ? \"earlier\" : \"later\")\n : key === \"ArrowUp\" ? \"up\"\n : key === \"ArrowDown\" ? \"down\"\n : key === \"Home\" ? \"first\"\n : key === \"End\" ? \"last\"\n : null;\n if (step && plain) { e.preventDefault(); stepMove(step); return; }\n // the page's Undo waits: the move isn't a change yet\n if ((e.ctrlKey || e.metaKey) && key.toLowerCase() === \"z\") e.preventDefault();\n };\n const onGripKey = (id: string, e: ReactKeyboardEvent<HTMLElement>) => {\n const p = previewRef.current;\n const key = e.key;\n const plain = !e.ctrlKey && !e.metaKey && !e.altKey;\n if (!(p?.type === \"resize\" && p.by === \"keyboard\" && p.id === id)) {\n if ((key === \" \" || key === \"Enter\") && plain && !e.repeat && !p) { e.preventDefault(); startResize(id, \"keyboard\"); }\n return;\n }\n if (key === \" \" || key === \"Enter\") { e.preventDefault(); if (!e.repeat) keepResize(); return; }\n if (key === \"Escape\") { e.preventDefault(); cancelResize(); return; }\n // the grip sits on the end side: the arrow towards it widens the widget, so Left and Right swap right to left\n const rtl = isRtl(e.currentTarget);\n const change = key === (rtl ? \"ArrowLeft\" : \"ArrowRight\") ? [1, 0]\n : key === (rtl ? \"ArrowRight\" : \"ArrowLeft\") ? [-1, 0]\n : key === \"ArrowDown\" ? [0, 1]\n : key === \"ArrowUp\" ? [0, -1]\n : null;\n if (change && plain) { e.preventDefault(); stepResize(change[0], change[1]); return; }\n if ((e.ctrlKey || e.metaKey) && key.toLowerCase() === \"z\") e.preventDefault();\n };\n // focus leaving mid-move or mid-resize (Tab, a press elsewhere) puts the widget back\n const onControlBlur = (id: string, part: \"handle\" | \"grip\") => {\n const p = previewRef.current;\n if (part === \"handle\" && p?.type === \"move\" && p.by === \"keyboard\" && p.id === id) cancelMove();\n if (part === \"grip\" && p?.type === \"resize\" && p.by === \"keyboard\" && p.id === id) cancelResize();\n };\n\n // Focus put back, or given to a new widget, once the page has drawn the change (every render: a widget a page adds\n // after its promise settles arrives in a render of its own)\n useLayoutEffect(() => {\n const target = refocus.current;\n if (!target) return;\n const cells = cellsRef.current;\n const part: Part = target.added && stacked ? \"menu\" : target.part;\n const el = partOf(cells, PART_ATTR[part], target.id);\n if (!el) return;\n refocus.current = null;\n if (target.added) {\n const at = committed.findIndex((item) => item.id === target.id);\n // the new widget takes focus from the palette, from the grid or from nowhere: never from where the person has gone on to\n const active = document.activeElement;\n const free = !active || active === document.body || !active.isConnected || !!rootRef.current?.contains(active) || !!active.closest(\"[data-dashboard-palette]\");\n if (free) el.focus();\n say(`Added ${byId.get(target.id)?.label ?? target.id} at position ${at + 1} of ${committed.length}.`);\n return;\n }\n el.focus();\n });\n\n // A9: a widget its menu's action took away is said gone, once the page has drawn the layout without it\n useLayoutEffect(() => {\n const r = removing.current;\n if (!r || committedIds.split(\"\\n\").includes(r.id)) return;\n removing.current = null;\n say(`Removed ${r.name}.`);\n }, [committedIds, say]);\n\n // A5: each keyboard step brings the widget into view, since the browser doesn't follow a focused element that moves\n useLayoutEffect(() => {\n if (preview?.type !== \"move\" || preview.by !== \"keyboard\") return;\n partOf(cellsRef.current, \"data-dashboard-cell\", preview.id)?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" });\n }, [preview]);\n\n // A13: a moved widget's neighbours slide to their new places at the theme's speed (none when the person asks for less\n // motion). Their places come from the layout, as everything else does: what moved, and by how much, is worked out in\n // grid units and drawn as a transform that eases back to nothing. The widget being moved has no transform of its own.\n const shownKey = shown.map((item) => `${item.id}:${item.w}x${item.h}`).join(\",\");\n const places = useRef<{ columns: number; at: Map<string, { col: number; row: number }> } | null>(null);\n const movingId = preview && preview.type !== \"add\" ? preview.id : null;\n useLayoutEffect(() => {\n const cells = cellsRef.current;\n const at = new Map(placeLayout(shown, columns).map((p) => [p.id, { col: p.col, row: p.row }]));\n const was = places.current;\n places.current = { columns, at };\n if (!cells || !was || was.columns !== columns) return;\n const speed = speedOf(cells);\n if (speed <= 0) return;\n const g = pitchOf(cells, columns);\n for (const el of Array.from(cells.children)) {\n const id = el.getAttribute(\"data-dashboard-cell\");\n if (!id || id === movingId || typeof (el as HTMLElement).animate !== \"function\") continue;\n const from = was.at.get(id);\n const to = at.get(id);\n if (!from || !to || (from.col === to.col && from.row === to.row)) continue;\n const dx = (from.col - to.col) * g.col * (g.rtl ? -1 : 1);\n const dy = (from.row - to.row) * g.row;\n (el as HTMLElement).animate([{ transform: `translate(${dx}px, ${dy}px)` }, { transform: \"none\" }], { duration: speed, easing: \"ease\" });\n }\n // shownKey stands for `shown`: the same widgets in the same places draw nothing new\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [shownKey, columns]);\n\n // Development: the page's layout and its widgets should agree (A2: the grid still draws what's there)\n useEffect(() => {\n if (strays) warnOnce(\"DashboardGrid\", \"its children are DashboardItems (an array or a fragment of them): anything else isn't drawn. Put each widget in a DashboardItem with its id and label.\");\n if (repeated.length) warnOnce(\"DashboardGrid\", `two DashboardItems share an id, or one has none (${repeated.map((id) => `\"${id}\"`).join(\", \")}): only the first of each id is drawn.`);\n const ids = new Set(items.map((item) => item.id));\n const listed = new Set(normaliseLayout(layout).map((item) => item.id));\n const missing = items.filter((item) => !listed.has(item.id)).map((item) => item.id);\n const orphans = [...listed].filter((id) => !ids.has(id));\n if (missing.length) warnOnce(\"DashboardGrid\", `the layout has no entry for ${missing.map((id) => `\"${id}\"`).join(\", \")}: it's drawn after the rest at ${UNLISTED.w} columns by ${UNLISTED.h} rows. Add each widget's entry (addItem).`);\n if (orphans.length) warnOnce(\"DashboardGrid\", `the layout has entries with no DashboardItem (${orphans.map((id) => `\"${id}\"`).join(\", \")}): they aren't drawn, and a change of layout leaves them out.`);\n if (editing && !onLayoutChange) warnOnce(\"DashboardGrid\", \"it's editing with no onLayoutChange, so a move or a size the person chooses isn't kept: keep the layout it passes.\");\n });\n\n const shownAt = new Map(shown.map((item, i) => [item.id, i]));\n const adding = preview?.type === \"add\" ? shown.find((item) => item.id === NEW_ID) : undefined;\n\n return (\n <div ref={rootRef} data-dashboard-grid=\"\" data-editing={editing ? \"\" : undefined} data-stacked={stacked ? \"\" : undefined} className={cn(\"relative min-w-0\", className)}>\n {/* A12: a narrow grid is one column, in the same order; its widgets move from their ⋯ menus */}\n {editing && stacked && <p data-dashboard-narrow=\"\" className=\"mb-ds-3 text-xs text-[var(--ds-text-muted)]\">Drag and resize on a larger screen</p>}\n {/* G1, G9: while editing, a named group at least four rows tall, so an empty grid takes a drop and the last widget's\n removal leaves focus somewhere with a name; the view of an empty grid draws nothing (the page's EmptyState says\n what to do) */}\n <div\n ref={cellsRef}\n data-dashboard-cells=\"\"\n role={editing ? \"group\" : undefined}\n aria-label={editing ? ariaLabel : undefined}\n className=\"relative isolate grid grid-flow-row\"\n style={{ gridTemplateColumns: stacked ? \"minmax(0, 1fr)\" : `repeat(${DASHBOARD_COLUMNS}, minmax(0, 1fr))`, gridAutoRows: ROW, gap: GAP, minHeight: editing ? FLOOR : undefined }}\n >\n {/* A4: the edit mode's column guides, behind the widgets. The look fixes (D4): each column a 1 px outline of the\n text colour at a low strength, with no fill, so no theme can take one for a card (a muted fill was drawn\n lighter than the ground in the dark themes, beside cards of nearly its colour, and faded into the ground in\n the light ones). Measured in the 26 preset-modes: ΔE 5.9 to 10.6 from the ground, past the 3 a guide needs\n and under the drop outline's (the accent's, 29 to 58); a Chrome test keeps both. */}\n {editing && !stacked && (\n <div aria-hidden=\"true\" data-dashboard-guides=\"\" className=\"pointer-events-none absolute inset-0 -z-10 grid grid-cols-12\" style={{ gap: GAP }}>\n {Array.from({ length: DASHBOARD_COLUMNS }, (_, i) => <div key={i} className=\"rounded-[var(--ds-radius-sm)] border border-[color-mix(in_srgb,var(--ds-text-primary)_10%,transparent)]\" />)}\n </div>\n )}\n {committed.map((item, at) => {\n const drawn = shown[shownAt.get(item.id) ?? 0] ?? item;\n const own = byId.get(item.id);\n if (!own) return null;\n const state = preview?.type === \"move\" && preview.id === item.id ? (preview.by === \"pointer\" ? \"placeholder\" : \"lifted\")\n : preview?.type === \"resize\" && preview.id === item.id ? \"resizing\"\n : null;\n return (\n <Cell\n key={item.id}\n prefix={prefix}\n id={item.id}\n label={own.label}\n w={drawn.w}\n h={drawn.h}\n order={shownAt.get(item.id) ?? 0}\n editing={editing}\n stacked={stacked}\n busy={busy}\n state={state}\n item={item}\n at={at}\n total={committed.length}\n actions={menuActions}\n onSelect={onSelect}\n onHandleKey={onHandleKey}\n onGripKey={onGripKey}\n onControlBlur={onControlBlur}\n >\n {own.content}\n </Cell>\n );\n })}\n {adding && (\n <div\n aria-hidden=\"true\"\n data-dashboard-placeholder=\"\"\n className={PLACEHOLDER}\n style={{ gridColumn: stacked ? \"1 / -1\" : `span ${adding.w}`, gridRow: `span ${adding.h}`, order: shownAt.get(NEW_ID) ?? 0 }}\n />\n )}\n </div>\n <div role=\"status\" className=\"sr-only\">{notice}</div>\n </div>\n );\n}\n\ninterface CellProps {\n prefix: string;\n id: string;\n label: string;\n w: number;\n h: number;\n order: number;\n editing: boolean;\n stacked: boolean;\n busy: boolean;\n /** Being dragged by the pointer (its place shown), picked up by the keyboard (lifted where it is), or resized. */\n state: \"placeholder\" | \"lifted\" | \"resizing\" | null;\n /** Its entry in the page's layout, its place there and how many there are: what its ⋯ menu offers. */\n item: DashboardLayoutItem;\n at: number;\n total: number;\n actions: MenuActions;\n onSelect?: (id: string) => void;\n onHandleKey: (id: string, e: ReactKeyboardEvent<HTMLElement>) => void;\n onGripKey: (id: string, e: ReactKeyboardEvent<HTMLElement>) => void;\n onControlBlur: (id: string, part: \"handle\" | \"grip\") => void;\n children: ReactNode;\n}\n\n/** The grip's mark: two strokes in the corner, mirrored right to left with the grip. */\nfunction GripMark() {\n return (\n <svg aria-hidden=\"true\" viewBox=\"0 0 12 12\" width=\"12\" height=\"12\" className=\"rtl:-scale-x-100\">\n <path d=\"M11 4.5L4.5 11M11 8L8 11\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" fill=\"none\" />\n </svg>\n );\n}\n\n/**\n * A widget's cell (A4): holding the frame in one wrapper (inert while editing: no Tab stops and no clicks in it, and\n * hidden from a screen reader, so the controls' names carry the widget's name) and, as that wrapper's siblings, the three\n * controls, since `inert` can't be lifted for a child. While editing it is a group named by its label, the controls'\n * widget; in the view it's nothing of its own, so a screen reader meets the frame's own title first (G14). The wrapper is\n * a flex column with the cell's height, its one child stretched to it, so the frame takes the widget's whole height; the\n * cell gives it the cell's context and the fill context, so a chart fills it and a board takes its height, never the\n * page's. The cell is a named container (`dashboard-cell`), so a frame and the controls can tell a narrow cell.\n */\nfunction Cell({ prefix, id, label, w, h, order, editing, stacked, busy, state, item, at, total, actions, onSelect, onHandleKey, onGripKey, onControlBlur, children }: CellProps) {\n const cellRef = useRef<HTMLDivElement | null>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const instructions = useId();\n const gripInstructions = useId();\n const draggable = editing && !stacked;\n const picture = useCallback(() => cellRef.current, []);\n const { setNodeRef, setActivatorNodeRef, listeners } = useDraggable({ id: `${prefix}move:${id}`, data: { type: \"move\", id, picture }, disabled: !draggable });\n const { setNodeRef: setGripRef, listeners: gripListeners } = useDraggable({ id: `${prefix}resize:${id}`, data: { type: \"resize\", id, picture }, disabled: !draggable });\n const setCell = useCallback((el: HTMLDivElement | null) => {\n cellRef.current = el;\n setNodeRef(el);\n }, [setNodeRef]);\n const value = useMemo<DashboardCellValue>(() => ({ label, editing }), [label, editing]);\n useCellFrameScroll(contentRef, label);\n // A4: a click selects the widget only when the press began on it (not on one of its controls): a resize that starts on\n // the grip and ends over the widget never opens its settings\n const pressed = useRef(false);\n\n // Development (A4, A7): every widget has a title on screen, and the label a screen reader hears is that title\n useEffect(() => {\n const frame = contentRef.current?.firstElementChild;\n if (!frame) return;\n const title = (frame.hasAttribute(\"data-stats-card\") ? frame.querySelector(\"span\") : frame.querySelector(\"h1, h2, h3, h4, h5, h6\"))?.textContent?.trim();\n if (!title) warnOnce(\"DashboardGrid\", `the widget \"${label}\" has no title on screen: give its frame one (ChartContainer's or Table's title, a CardHeader with a CardTitle, a StatsCard's label), as every widget needs one.`);\n else if (title !== label.trim()) warnOnce(\"DashboardGrid\", `the widget \"${id}\" is labelled \"${label}\", but its frame's title is \"${title}\": give its DashboardItem the frame's title as its label, so what a screen reader hears (\"Move ${label}\") names the widget people see.`);\n });\n\n // Development (F5): the frame is the item's one child, since the cell sizes its one child only: a wrapper of the page's\n // round the frame, or a second child, spills over the widgets beside it. Read again as the content changes; what shows\n // first while it loads (a Skeleton, a Suspense fallback) is no misuse, so a child that holds no frame is judged only\n // once it has stayed.\n useEffect(() => {\n const content = contentRef.current;\n if (!content || typeof MutationObserver === \"undefined\") return;\n const misused = (what: string) => warnOnce(\"DashboardGrid\", `the widget \"${label}\" ${what}: put its frame (a ChartContainer, a StatsCard, a titled Table or a Card) straight in its DashboardItem, alone, since the grid sizes the item's one child and anything else spills over the widgets beside it.`);\n let timer: ReturnType<typeof setTimeout> | undefined;\n const read = () => {\n clearTimeout(timer);\n // a Suspense boundary hides what it suspended (display: none) beside its fallback\n const shown = [...content.children].filter((el) => !(el instanceof HTMLElement && el.style.display === \"none\"));\n const [child] = shown;\n if (shown.length > 1) return misused(\"holds more than one child\");\n if (!child || child.matches(FRAMES) || child.matches('[data-gs=\"skeleton\"]')) return;\n if (child.querySelector(FRAMES)) return misused(\"has a wrapper round its frame\");\n timer = setTimeout(() => { if (child.parentElement === content) misused(\"isn't one of the library's frames\"); }, SETTLE_MS);\n };\n read();\n const observer = new MutationObserver(read);\n observer.observe(content, { childList: true });\n return () => { observer.disconnect(); clearTimeout(timer); };\n }, [label]);\n\n const placeholder = state === \"placeholder\";\n const hidden = placeholder ? \"opacity-0\" : undefined;\n return (\n <div\n ref={setCell}\n data-dashboard-cell={id}\n data-editing={editing ? \"\" : undefined}\n data-stacked={editing && stacked ? \"\" : undefined}\n role={editing ? \"group\" : undefined}\n aria-label={editing ? label : undefined}\n className={cn(\"@container/dashboard-cell relative flex min-h-0 min-w-0 flex-col\", editing && onSelect && \"cursor-pointer\")}\n style={{ gridColumn: stacked ? \"1 / -1\" : `span ${w}`, gridRow: `span ${h}`, order }}\n onPointerDown={editing ? (e) => {\n const target = e.target as Element;\n pressed.current = e.currentTarget.contains(target) && !target.closest(\"[data-dashboard-control]\");\n } : undefined}\n onClick={editing && onSelect ? (e) => {\n const target = e.target as Element;\n const began = pressed.current;\n pressed.current = false;\n if (!began || !e.currentTarget.contains(target) || target.closest(\"[data-dashboard-control]\")) return;\n onSelect(id);\n } : undefined}\n >\n <div\n ref={contentRef}\n data-dashboard-content=\"\"\n inert={editing}\n className={cn(\"flex min-h-0 flex-1 flex-col *:min-h-0 *:flex-auto\", state === \"lifted\" && LIFTED, hidden)}\n >\n <DashboardCellContext value={value}>\n <FillContext value={true}>{children}</FillContext>\n </DashboardCellContext>\n </div>\n {placeholder && <div aria-hidden=\"true\" data-dashboard-place=\"\" className={cn(\"pointer-events-none absolute inset-0\", PLACEHOLDER)} />}\n {editing && (\n <>\n {draggable && (\n <AutoTooltip content={`Move ${label}`} disabled={busy}>\n <button\n type=\"button\"\n ref={setActivatorNodeRef}\n {...listeners}\n data-dashboard-handle={id}\n data-dashboard-control=\"\"\n aria-label={`Move ${label}`}\n aria-describedby={instructions}\n onKeyDown={(e) => onHandleKey(id, e)}\n onBlur={() => onControlBlur(id, \"handle\")}\n className={cn(CONTROL, PLACE_TOP, PLACE_START, \"cursor-grab active:cursor-grabbing touch-manipulation select-none [-webkit-touch-callout:none]\", hidden)}\n >\n <Icon name=\"grip-vertical\" size={16} />\n </button>\n </AutoTooltip>\n )}\n <DropdownMenu\n items={menuEntries(item, at, total, stacked, actions)}\n trigger={\n <AutoTooltip content={`${label} options`} disabled={busy}>\n <button type=\"button\" data-dashboard-menu={id} data-dashboard-control=\"\" aria-label={`${label} options`} className={cn(CONTROL, PLACE_TOP, PLACE_END, hidden)}>\n <Icon name=\"more-horizontal\" size={16} />\n </button>\n </AutoTooltip>\n }\n />\n {draggable && (\n <AutoTooltip content={`Resize ${label}`} disabled={busy}>\n <button\n type=\"button\"\n ref={setGripRef}\n {...gripListeners}\n data-dashboard-resize={id}\n data-dashboard-control=\"\"\n aria-label={`Resize ${label}`}\n aria-describedby={gripInstructions}\n onKeyDown={(e) => onGripKey(id, e)}\n onBlur={() => onControlBlur(id, \"grip\")}\n className={cn(GRIP, hidden)}\n >\n <GripMark />\n </button>\n </AutoTooltip>\n )}\n {state === \"resizing\" && <span aria-hidden=\"true\" data-dashboard-size=\"\" className={READOUT}>{`${w} × ${h}`}</span>}\n {draggable && (\n <>\n <span id={instructions} hidden>{`Press Space to pick up ${label}, use the arrow keys to move it, and press Space again to drop it, or Escape to cancel.`}</span>\n <span id={gripInstructions} hidden>{`Press Space to resize ${label}, use the arrow keys to change its width and height, and press Space again to keep it, or Escape to cancel.`}</span>\n </>\n )}\n </>\n )}\n </div>\n );\n}\n","import { useCallback, useContext, useEffect, useId, useLayoutEffect, useRef, useState, type MouseEvent } from \"react\";\nimport { useDraggable } from \"@dnd-kit/core\";\nimport { cn, FOCUS_RING } from \"../lib/utils\";\nimport { Icon } from \"../lib/icons\";\nimport { warnOnce } from \"../lib/dev-warn\";\nimport { Spinner } from \"./Spinner\";\nimport { OverlayCloseCtx } from \"./DiscardConfirm\";\nimport { DashboardArenaCtx, type DashboardGridHandle, type DashboardWidgetKind } from \"./DashboardGrid\";\n\nexport interface DashboardPaletteProps {\n /** The kinds of widget the page offers (headline number, line chart, table, text note, image…), in the order listed. */\n kinds: DashboardWidgetKind[];\n /** The list's name, as a screen reader hears it. Default \"Widget library\". */\n label?: string;\n /**\n * The line above the list that says what a row does: by default \"Select or drag to add\" while the rows drag,\n * and \"Select a widget to add it\" where they don't (a grid stacked at a narrow width); none while the grid isn't\n * editing. A function gives other words for each case (it's told whether the rows drag); false draws none.\n */\n hint?: false | ((rowsDrag: boolean) => string);\n className?: string;\n}\n\n/** The palette's own words for its line (the look plan's §11, S4), each short enough for one line at the panel's width. */\nconst HINT = (rowsDrag: boolean) => (rowsDrag ? \"Select or drag to add\" : \"Select a widget to add it\");\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> => value != null && typeof (value as { then?: unknown }).then === \"function\";\n\n/**\n * Sprint 32 (A8): the widget library the briefs ask for, a list of the kinds of widget a page offers, each with its name,\n * an optional description and icon. Each kind is one control, a button named \"Add {kind}\" (the look fixes, D5): a click,\n * Enter or Space adds the widget at the end (the plain click way, accessibility#26), and a pointer's drag of the row\n * places it where it's dropped (the grid's sensors tell the two apart: 5 px of movement for a mouse, a 250 ms press for a\n * finger). The grid asks the page for the widget (its onAdd), focus goes to the new widget's move handle, and the grid's\n * live region says where it went. It reaches the grid through the DashboardEditor round them both.\n *\n * Where it sits, so the grid keeps its width (the guidance's composition): in an AsidePanel with `width=\"312px\"\n * collapseBelow=\"xl\" resizable={false}`, docked beside the grid from 1280 px and a drawer over the page below, its body\n * padded as the panel's heading is (each row's hover tint and focus outline reach 8 px into that padding). An Add closes\n * the overlay the panel has become, wherever it opens over the page (the drawer, or the phone's sheet), so the new widget\n * isn't left under it; docked beside the grid, the panel stays open. Wherever the grid is stacked (narrower than 40rem)\n * nothing drags, and focus goes to the new widget's ⋯, since a stacked grid has no handle. Adding and dragging are off\n * while the grid isn't editing.\n *\n * A line above the list says what a row does (the owner's look at the second sheet: the rows drag, so say so), as visible\n * text before the list rather than its description, which screen readers read unreliably: its words follow whether the\n * rows drag (`hint`), and there are none while the grid isn't editing, outside a DashboardEditor, or with no kinds. The\n * list keeps its name, its data attribute and the className, so the line is the list's sibling, not its wrapper.\n */\nexport function DashboardPalette({ kinds, label = \"Widget library\", hint = HINT, className }: DashboardPaletteProps) {\n const arena = useContext(DashboardArenaCtx);\n // the overlay the palette sits in, when the side panel has become one (the Drawer's, or the phone's sheet); none when\n // it's docked, as the docked column provides none\n const close = useContext(OverlayCloseCtx);\n const prefix = useId();\n const grid = arena?.grid ?? null;\n useEffect(() => {\n if (!arena) warnOnce(\"DashboardPalette\", \"it adds widgets to a DashboardGrid through a DashboardEditor round them both: wrap the palette and the grid in one DashboardEditor.\");\n }, [arena]);\n const draggable = !!grid && grid.editing && !grid.stacked;\n const words = grid?.editing && kinds.length > 0 && hint ? hint(draggable) : null;\n return (\n <>\n {words && <p data-dashboard-palette-hint=\"\" className=\"mb-ds-2 text-sm text-[var(--ds-text-secondary)]\">{words}</p>}\n <ul data-dashboard-palette=\"\" aria-label={label} className={cn(\"flex flex-col\", className)}>\n {kinds.map((kind) => (\n <PaletteKind key={kind.id} prefix={prefix} kind={kind} grid={grid?.editing ? grid : null} draggable={draggable} close={close} />\n ))}\n </ul>\n </>\n );\n}\n\n/**\n * The row: a list row's look, as a menu's item is drawn (DropdownMenu's ITEM: its corner, its focus outline, a hover tint\n * a step past the kind's muted tile). It reaches 8 px into the panel's padding each side, its separator with it, so its\n * words line up with the panel's heading while its tint and outline have room. Unavailable while the grid isn't editing,\n * it's drawn so, as a Button with aria-disabled is (the end review, R13); a row waiting for a server's id is busy, its\n * spinner its look, as a busy Button's is.\n */\nconst ROW = cn(\n \"flex flex-1 min-w-0 items-center gap-ds-3 py-ds-3 px-ds-2 text-start rounded-[var(--ds-radius-sm)]\",\n \"transition-colors duration-[var(--ds-transition-speed)] hover:bg-[var(--ds-bg-emphasis)]\",\n \"aria-disabled:cursor-not-allowed aria-disabled:not-aria-busy:opacity-disabled aria-busy:cursor-wait\",\n FOCUS_RING,\n);\n\nfunction PaletteKind({ prefix, kind, grid, draggable, close }: {\n prefix: string;\n kind: DashboardWidgetKind;\n /** The grid that takes an Add: none while it isn't editing (adding is off then), or with no grid to add to. */\n grid: DashboardGridHandle | null;\n draggable: boolean;\n /** Closes the overlay the palette sits in (a drawer or a sheet), once the page has said the new widget's id. */\n close: ((then?: () => void) => void) | null;\n}) {\n const rowRef = useRef<HTMLButtonElement | null>(null);\n const picture = useCallback(() => rowRef.current, []);\n const { setNodeRef, setActivatorNodeRef, listeners, isDragging } = useDraggable({ id: `${prefix}kind:${kind.id}`, data: { type: \"kind\", kind, picture }, disabled: !draggable });\n // the row is what drags and what's lifted: dnd-kit's listeners on it, never its attributes (a role and \"draggable\")\n const setRow = useCallback((el: HTMLButtonElement | null) => {\n rowRef.current = el;\n setNodeRef(el);\n setActivatorNodeRef(el);\n }, [setNodeRef, setActivatorNodeRef]);\n const describedBy = useId();\n // A drag of this kind ended by Escape and let go over the row would end in a click on it (a dropped drag's click\n // dnd-kit suppresses itself): from the drag's start, the next pointer click (detail > 0) is ignored, and the next\n // press clears that, so a keyboard Enter (detail 0) always adds\n const dragged = useRef(false);\n useLayoutEffect(() => { if (isDragging) dragged.current = true; }, [isDragging]);\n // an id the server makes: the row waits for it, busy as a Button is, so it isn't pressed twice; focus stays on it\n const [adding, setAdding] = useState(false);\n const unavailable = !grid || adding;\n const onAdd = (e: MouseEvent<HTMLButtonElement>) => {\n if ((dragged.current && e.detail > 0) || !grid || adding) return;\n const result = grid.add(kind, close ? () => close() : undefined);\n if (!isThenable(result)) return;\n setAdding(true);\n result.then(() => setAdding(false), () => setAdding(false));\n };\n return (\n <li className=\"flex -mx-ds-2 border-b-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)] last:border-b-0\">\n <button\n type=\"button\"\n ref={setRow}\n {...listeners}\n onPointerDown={(e) => { dragged.current = false; listeners?.onPointerDown?.(e); }}\n onClick={onAdd}\n data-dashboard-kind={kind.id}\n // the row a pointer drags (none on a stacked grid, or while it isn't editing)\n data-dashboard-kind-draggable={draggable ? \"\" : undefined}\n // named for what a press does, its words on screen in the name (WCAG 2.5.3); the description follows it\n aria-label={`Add ${kind.name}`}\n aria-describedby={kind.description ? describedBy : undefined}\n aria-busy={adding || undefined}\n aria-disabled={unavailable || undefined}\n className={cn(ROW, draggable ? \"cursor-grab active:cursor-grabbing touch-manipulation select-none [-webkit-touch-callout:none]\" : \"cursor-pointer\")}\n >\n {kind.icon && (\n // a StatsCard's tile\n <span aria-hidden=\"true\" className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-[var(--ds-radius-sm)] bg-[var(--ds-bg-muted)]\">\n <Icon name={kind.icon} size={16} className=\"text-[var(--ds-text-muted)]\" />\n </span>\n )}\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"text-sm font-medium text-[var(--ds-text-primary)] break-words\">{kind.name}</span>\n {kind.description && <span id={describedBy} className=\"text-xs text-[var(--ds-text-muted)] break-words\">{kind.description}</span>}\n </span>\n {/* what a press does; the row's name says it */}\n <span aria-hidden=\"true\" className=\"flex shrink-0 items-center text-[var(--ds-text-muted)]\">\n {adding ? <Spinner size=\"sm\" color=\"inherit\" /> : <Icon name=\"plus\" size={16} />}\n </span>\n </button>\n </li>\n );\n}\n","import { useCallback, useEffect, useMemo, useState } from \"react\";\n\n/**\n * Sprint 32 (A10): a draft the person edits and then saves or cancels as a whole: a dashboard's tabs (added, renamed,\n * reordered, removed), each tab's layout and each widget's settings, in whatever shape the page gives it. Every change can be\n * undone and redone (custom_interaction#26), from the page's visible Undo and Redo buttons and from the keyboard:\n * Ctrl+Z or ⌘Z undoes, with Shift it redoes, outside text fields only, so a field's own undo keeps working.\n */\nexport interface DraftHistory<T> {\n /** The draft now. */\n value: T;\n /**\n * Changes the draft: a new value, or a function of the one before. Each change is a step that Undo takes back, and a\n * change after an Undo drops what Redo had. Pass `merge` (a field's name, say) for a run of changes that is one step:\n * each keystroke in a widget's title field, so Undo takes back the edit, not a letter. A change to the same value\n * adds no step.\n */\n set: (next: T | ((prev: T) => T), merge?: string) => void;\n undo: () => void;\n redo: () => void;\n canUndo: boolean;\n canRedo: boolean;\n /**\n * The draft differs from what was last saved (the first value, or the last `reset`): `dirty` enables Save. Cancel always\n * goes back to the view, calling `reset(saved)` first, so it's never disabled.\n */\n dirty: boolean;\n /**\n * Starts again from a saved value, with no steps to undo: after Save, `reset()` takes the draft as saved; Cancel\n * passes the saved value back, `reset(saved)`, and the draft is that. A value loaded after the first render is passed\n * here too.\n */\n reset: (next?: T) => void;\n}\n\nexport interface DraftHistoryOptions {\n /** Ctrl+Z, ⌘Z and their Shift forms on the page. Default true; off where two drafts share a page, or a dialog has its own. */\n shortcuts?: boolean;\n}\n\ninterface Store<T> {\n past: T[];\n present: T;\n future: T[];\n saved: T;\n /** The `merge` of the last change: a change with the same one replaces it rather than adding a step. */\n merge: string | null;\n}\n\n/** An array, or an object made as `{…}` (or with no prototype): data whose own keys are all it holds. */\nfunction plain(value: unknown): value is object {\n if (Array.isArray(value)) return true;\n if (typeof value !== \"object\" || value === null) return false;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\n/**\n * Plain data compared by what it holds (plain objects, arrays, dates and primitives): an edit typed back is not a\n * change. Anything else (a Map, a Set, a class's instance) compares by identity, since its own keys don't show what it\n * holds: a change inside a Map is a new Map, as React's state wants it anyway.\n */\nfunction same(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();\n if (!plain(a) || !plain(b) || Array.isArray(a) !== Array.isArray(b)) return false;\n const ak = Object.keys(a);\n const bk = Object.keys(b);\n return ak.length === bk.length && ak.every((k) => Object.prototype.hasOwnProperty.call(b, k) && same((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k]));\n}\n\n/** Where keys type text, so Ctrl+Z is the field's own undo: an editor's content included (a rich text field's paragraph). */\nfunction typesText(target: EventTarget | null): boolean {\n if (!(target instanceof Element)) return false;\n if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || (target as HTMLElement).isContentEditable) return true;\n if (target.closest('[contenteditable]:not([contenteditable=\"false\"])')) return true;\n if (target instanceof HTMLInputElement) return !/^(?:checkbox|radio|button|submit|reset|range|color|file|image)$/.test(target.type);\n return /^(?:textbox|searchbox|combobox|spinbutton)$/.test(target.getAttribute(\"role\") ?? \"\");\n}\n\n/**\n * A draft held whole until it's saved, with undo and redo: a dashboard's tabs, each tab's layout and each widget's\n * settings in one value, or anything else a page edits before Save. `set` changes it, one step Undo takes back; `dirty`\n * says it differs from what was last saved, and enables Save; Cancel always goes back to the view, calling\n * `reset(saved)` first; `reset()` after Save. Ctrl+Z or ⌘Z undoes and with Shift redoes, outside text fields, unless\n * `shortcuts` is false.\n */\nexport function useDraftHistory<T>(initial: T | (() => T), { shortcuts = true }: DraftHistoryOptions = {}): DraftHistory<T> {\n const [store, setStore] = useState<Store<T>>(() => {\n const first = typeof initial === \"function\" ? (initial as () => T)() : initial;\n return { past: [], present: first, future: [], saved: first, merge: null };\n });\n\n const set = useCallback((next: T | ((prev: T) => T), merge?: string) => {\n setStore((s) => {\n const value = typeof next === \"function\" ? (next as (prev: T) => T)(s.present) : next;\n if (Object.is(value, s.present)) return s;\n const key = merge ?? null;\n // a run of changes with one merge key is one step: the step before it stays the one Undo goes back to\n const past = key !== null && key === s.merge && s.future.length === 0 ? s.past : [...s.past, s.present];\n return { ...s, past, present: value, future: [], merge: key };\n });\n }, []);\n const undo = useCallback(() => {\n setStore((s) => (s.past.length === 0 ? s : { ...s, past: s.past.slice(0, -1), present: s.past[s.past.length - 1], future: [s.present, ...s.future], merge: null }));\n }, []);\n const redo = useCallback(() => {\n setStore((s) => (s.future.length === 0 ? s : { ...s, past: [...s.past, s.present], present: s.future[0], future: s.future.slice(1), merge: null }));\n }, []);\n const reset = useCallback((...args: [] | [T]) => {\n setStore((s) => {\n const value = args.length > 0 ? (args[0] as T) : s.present;\n return { past: [], present: value, future: [], saved: value, merge: null };\n });\n }, []);\n\n const canUndo = store.past.length > 0;\n const canRedo = store.future.length > 0;\n\n // Ctrl+Z / ⌘Z undoes and Ctrl+Shift+Z / ⇧⌘Z redoes, anywhere on the page but in a text field (whose own undo it is),\n // and not when something else has handled the key already\n useEffect(() => {\n if (!shortcuts || typeof document === \"undefined\") return;\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.defaultPrevented || e.altKey || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== \"z\" || typesText(e.target)) return;\n if (e.shiftKey ? !canRedo : !canUndo) return;\n e.preventDefault();\n if (e.shiftKey) redo();\n else undo();\n };\n document.addEventListener(\"keydown\", onKeyDown);\n return () => document.removeEventListener(\"keydown\", onKeyDown);\n }, [shortcuts, canUndo, canRedo, undo, redo]);\n\n const dirty = useMemo(() => !same(store.present, store.saved), [store.present, store.saved]);\n return { value: store.present, set, undo, redo, canUndo, canRedo, dirty, reset: reset as (next?: T) => void };\n}\n"]}
|
package/dist/data-grid.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCardsSwitch, CARDS_BELOW, inferColumnKinds, CardValue, SortIndicator, CutCell, CutEmail, dayKey, DatePicker, Checkbox } from './chunk-
|
|
3
|
-
import { usePagination, useWholeListCheck, pagerPart, Pagination, NumberInput } from './chunk-
|
|
2
|
+
import { useCardsSwitch, CARDS_BELOW, inferColumnKinds, CardValue, SortIndicator, CutCell, CutEmail, dayKey, DatePicker, Checkbox } from './chunk-6NRLTG5W.js';
|
|
3
|
+
import { usePagination, useWholeListCheck, pagerPart, Pagination, NumberInput } from './chunk-AVSP6NDX.js';
|
|
4
4
|
import { useShellPreferences } from './chunk-QOMP4D6V.js';
|
|
5
|
-
import './chunk-
|
|
6
|
-
import { Dropdown, Field, Input } from './chunk-
|
|
5
|
+
import './chunk-R7FG4ZQ5.js';
|
|
6
|
+
import { Dropdown, Field, Input } from './chunk-OWGF362U.js';
|
|
7
7
|
import './chunk-7QLXYRPD.js';
|
|
8
|
+
import { useFramesItself, TableCardCtx, RowsCtx } from './chunk-RS624TD5.js';
|
|
9
|
+
import './chunk-R2IAK3J3.js';
|
|
10
|
+
import './chunk-GIA4BMGI.js';
|
|
8
11
|
import { FormChangeCtx } from './chunk-72SDAX54.js';
|
|
9
|
-
import
|
|
10
|
-
import './chunk-HQFTP7Y5.js';
|
|
12
|
+
import './chunk-FF57N3P7.js';
|
|
11
13
|
import { useBreakpoint } from './chunk-ZHUVLBCC.js';
|
|
12
14
|
import './chunk-7RKC5C7G.js';
|
|
13
|
-
import './chunk-
|
|
14
|
-
import { useRevealFocus } from './chunk-DR6WEI3A.js';
|
|
15
|
+
import { useRevealFocus } from './chunk-HCEHTJ5E.js';
|
|
15
16
|
import { Icon, warnOnce } from './chunk-53F7GVBQ.js';
|
|
16
|
-
import { cn, useGridKeyboard, FOCUS_INSET, FOCUS_RING, useFocusLeave, focusInitial } from './chunk-
|
|
17
|
+
import { cn, useGridKeyboard, FOCUS_INSET, FOCUS_RING, useFocusLeave, focusInitial } from './chunk-2724SJO2.js';
|
|
17
18
|
import { useState, useMemo, useCallback, useRef, useEffect, useLayoutEffect } from 'react';
|
|
18
19
|
import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
19
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -385,7 +386,7 @@ function DataGrid({
|
|
|
385
386
|
);
|
|
386
387
|
};
|
|
387
388
|
return withControl(
|
|
388
|
-
/* @__PURE__ */ jsxs("div", { "data-ds-list": "", className: "min-w-0", children: [
|
|
389
|
+
/* @__PURE__ */ jsxs("div", { "data-ds-list": "", "data-wide-control": "", className: "min-w-0", children: [
|
|
389
390
|
/* @__PURE__ */ jsx(
|
|
390
391
|
"div",
|
|
391
392
|
{
|