@kumix/ui 0.3.14 → 0.3.16

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.
Files changed (78) hide show
  1. package/README.md +15 -15
  2. package/dist/components/motion/animated-toast-stack.js +4 -3
  3. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  4. package/dist/components/motion/command-palette.d.ts.map +1 -1
  5. package/dist/components/motion/command-palette.js +2 -21
  6. package/dist/components/motion/command-palette.js.map +1 -1
  7. package/dist/components/motion/tabs.js +1 -1
  8. package/dist/components/motion/tabs.js.map +1 -1
  9. package/dist/components/motion/tooltip-surface.d.ts +12 -0
  10. package/dist/components/motion/tooltip-surface.d.ts.map +1 -0
  11. package/dist/components/motion/tooltip-surface.js +97 -0
  12. package/dist/components/motion/tooltip-surface.js.map +1 -0
  13. package/dist/components/motion/tooltip.d.ts +13 -3
  14. package/dist/components/motion/tooltip.d.ts.map +1 -1
  15. package/dist/components/motion/tooltip.js +74 -103
  16. package/dist/components/motion/tooltip.js.map +1 -1
  17. package/dist/components/reui/alert.d.ts +1 -1
  18. package/dist/components/reui/autocomplete.d.ts +1 -1
  19. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  20. package/dist/components/reui/autocomplete.js +1 -1
  21. package/dist/components/reui/autocomplete.js.map +1 -1
  22. package/dist/components/reui/badge.d.ts +2 -2
  23. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
  24. package/dist/components/reui/cascader/cascader-virtual.js +2 -0
  25. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
  26. package/dist/components/reui/data-grid/data-grid-pagination.d.ts +2 -0
  27. package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
  28. package/dist/components/reui/data-grid/data-grid-pagination.js +103 -42
  29. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  30. package/dist/components/reui/data-grid/data-grid-table.js +1 -1
  31. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  32. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  33. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  34. package/dist/components/reui/event-calendar/event-calendar-resource-view.d.ts.map +1 -1
  35. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +3 -4
  36. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  37. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts +9 -1
  38. package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
  39. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +11 -4
  40. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  41. package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
  42. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  43. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  44. package/dist/components/reui/filters/filters-builder.js +1 -1
  45. package/dist/components/reui/filters/filters-editors.js +1 -1
  46. package/dist/components/reui/filters/filters-types.d.ts +8 -0
  47. package/dist/components/reui/filters/filters-types.d.ts.map +1 -1
  48. package/dist/components/reui/frame.d.ts +6 -12
  49. package/dist/components/reui/frame.d.ts.map +1 -1
  50. package/dist/components/reui/frame.js +9 -16
  51. package/dist/components/reui/frame.js.map +1 -1
  52. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  53. package/dist/components/reui/gantt/gantt.js.map +1 -1
  54. package/dist/components/reui/icon-tile.d.ts +2 -2
  55. package/dist/components/reui/number-field.d.ts +3 -3
  56. package/dist/components/reui/number-field.d.ts.map +1 -1
  57. package/dist/components/reui/number-field.js +3 -3
  58. package/dist/components/reui/number-field.js.map +1 -1
  59. package/dist/components/reui/rating.d.ts +1 -1
  60. package/dist/components/ui/attachment.d.ts +2 -2
  61. package/dist/components/ui/badge.d.ts +1 -1
  62. package/dist/components/ui/bubble.d.ts +1 -1
  63. package/dist/components/ui/button-group.d.ts +1 -1
  64. package/dist/components/ui/button.d.ts +2 -2
  65. package/dist/components/ui/field.d.ts +1 -1
  66. package/dist/components/ui/item.d.ts +3 -3
  67. package/dist/components/ui/marker.d.ts +1 -1
  68. package/dist/components/ui/sidebar.d.ts +2 -2
  69. package/dist/components/ui/tabs.d.ts +1 -1
  70. package/dist/components/ui/toggle.d.ts +2 -2
  71. package/dist/hooks/use-dismiss.d.ts +1 -1
  72. package/dist/hooks/use-dismiss.d.ts.map +1 -1
  73. package/dist/hooks/use-dismiss.js.map +1 -1
  74. package/dist/lib/command-search.d.ts +10 -0
  75. package/dist/lib/command-search.d.ts.map +1 -0
  76. package/dist/lib/command-search.js +52 -0
  77. package/dist/lib/command-search.js.map +1 -0
  78. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid.tsx"],"mappings":";;;;;;;;;;;;;;;;;iBAiEiB,uBAAuB;;;;;;EAMtC,uBAAuB,KAAK;;;;;;;EAO5B,SAAS,aAAa,KAAK;;EAE3B,UAAU,gBAAgB,KAAK;;EAE/B;;;;;;;;EAQA;;iBAGe,mBAAmB;EAClC;EACA;EACA;EACA,WAAW;EACX,mBAAmB,KAAK,UAAU;EAClC;EACA,WAAW,uBAAuB;;;;;;;;EAQlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA8BW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+CD,0BAA0B;;;;;;;;;;;YAY1B,sBAAsB,wBAAwB,WAAW,kBAAkB;;wBAGvE,qBAAqB,cAAc,SAAS,QAC1D,QAAQ,OAAO,kBAAkB,OAAO;;;;;;;wBAe1B,kCAAkC,sBAChD,MAAM,KAAK,kBAAkB;EAE7B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;qBAyBW;YAoFD;EACV;EACA;EACA,UAAU;EACV,UAAU;EACV;;YAGU,oBAAoB;EAC9B,MAAM;EACN;EACA;IACE;IACA;;;;;;;;YASQ,oBAAoB,wBAAwB,KACtD,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;;;IAMA;;IAEA;;IAEA;;;;;;;;;iBAcK,YAEP,+BACG,qBAAqB;iBAQjB,iBAAiB,wBACxB,UACA,UACG,SACF,oBAAoB;EACrB,OAAO,sBAAsB;EAC7B,WAAW;oBACZ,IAAA;iBA4GQ,SAAS,kBAAkB,eAAe,wBACjD,UACA,UACG,SACF,cAAc,WAAW,yBAAM,IAAA;iBAyEzB,oBACP,UACA;EAEA,UAAU;EACV;;EAEA;oBACD,IAAA"}
1
+ {"version":3,"file":"data-grid.d.ts","names":[],"sources":["../../../../src/components/reui/data-grid/data-grid.tsx"],"mappings":";;;;;;;;;;;;;;;;;iBAiEiB,uBAAuB;;;;;;EAMtC,uBAAuB,KAAK;;;;;;;EAO5B,SAAS,aAAa,KAAK;;EAE3B,UAAU,gBAAgB,KAAK;;EAE/B;;;;;;;;EAQA;;iBAGe,mBAAmB;EAClC;EACA;EACA;EACA,WAAW;EACX,mBAAmB,KAAK,UAAU;EAClC;EACA,WAAW,uBAAuB;;;;;;;;EAQlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA8BW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA+CD,0BAA0B;;;;;;;;;;;YAY1B,sBAAsB,wBAAwB,WAAW,kBAAkB;;wBAGvE,qBAAqB,cAAc,SAAS,QAC1D,QAAQ,OAAO,kBAAkB,OAAO;;;;;;;wBAe1B,kCAAkC,sBAChD,MAAM,KAAK,kBAAkB;EAE7B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;qBAyBW;YAoFD;EACV;EACA;EACA,UAAU;EACV,UAAU;EACV;;YAGU,oBAAoB;EAC9B,MAAM;EACN;EACA;IACE;IACA;;;;;;;;YASQ,oBAAoB,wBAAwB,KACtD,cAAc,eAAe;iBAId,qBAAqB;EACpC,OAAO,oBAAoB;EAC3B,OAAO,sBAAsB;EAC7B;EACA;;EAEA;;EAEA,MAAM;;;;;EAKN,WAAW;;;;;;;wBAQG,gBAAgB;YAIpB;;;;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AA;iBA4GQ,SAAS,kBAAkB,eAAe,wBACjD,UACA,UACG,SACF,cAAc,WAAW,yBAAM,IAAA;iBAyEzB,oBACP,UACA;EAEA,UAAU;EACV;;EAEA;oBACD,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid.js","names":["internalTable","internalProps"],"sources":["../../../../src/components/reui/data-grid/data-grid.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { createContext, useContext, useEffect, useId, useMemo, useRef } from \"react\";\nimport type {\n Cell,\n Column,\n ColumnFiltersState,\n ReactTable,\n RowData,\n SortingState,\n Table,\n TableFeatures,\n} from \"@tanstack/react-table\";\nimport {\n cellSelectionFeature,\n columnFacetingFeature,\n columnFilteringFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n createExpandedRowModel,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n globalFilteringFeature,\n metaHelper,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n sortFn_alphanumeric,\n sortFn_alphanumericCaseSensitive,\n sortFn_basic,\n sortFn_datetime,\n sortFn_text,\n sortFn_textCaseSensitive,\n tableFeatures,\n} from \"@tanstack/react-table\";\n\nimport { cn } from \"@kumix/utils\";\nimport {\n type DataGridI18nConfig,\n type DataGridI18nOverrides,\n mergeDataGridI18n,\n} from \"./data-grid-i18n\";\n\n/**\n * Per-column extras the grid reads off `columnDef.meta`.\n *\n * TanStack v9 resolves this through the `columnMeta` slot on the feature\n * bundle below instead of a global `declare module` augmentation, so\n * installing the data grid no longer widens `ColumnMeta` for every other\n * table in the consuming app.\n */\n/**\n * Per-column write contract for the spreadsheet operations (paste, fill,\n * clear, cut). Presence marks the column writable; every write still flows\n * through `onCellsChange`, so the consumer's state stays the only data owner.\n */\nexport interface DataGridColumnCellEdit<TData> {\n /**\n * Set false for a column that formats clipboard output but is never\n * written; a function decides per row, so locked rows (archived, another\n * user's, a totals row) reject like any read-only cell. Defaults to true.\n */\n editable?: boolean | ((row: TData) => boolean);\n /**\n * Clipboard or fill string to typed value. Return undefined to reject the\n * cell into `rejected`. Without it the raw string passes through unchanged -\n * a deliberate non-coercion, so a number column receives strings only when\n * the consumer chose not to parse.\n */\n parse?: (raw: string, row: TData) => unknown;\n /** Typed value to clipboard string. Fallback: String(value ?? \"\"). */\n format?: (value: unknown, row: TData) => string;\n /** Value dispatched by Delete/Backspace and cut. Defaults to null. */\n clearValue?: unknown;\n /**\n * Opt into the grid's built-in free-text editor: an overlay input (or\n * auto-growing textarea) flush over the focused cell, opened by Enter, F2,\n * typing, or double-click, committing through `onCellsChange` as source\n * `\"edit\"` with `parse` applied. Columns without it stay consumer-edited\n * via `onCellEditRequest` or their own cell renderers.\n */\n control?: \"text\" | \"textarea\";\n}\n\nexport interface DataGridColumnMeta<TData> {\n headerTitle?: string;\n headerClassName?: string;\n cellClassName?: string;\n skeleton?: ReactNode;\n expandedContent?: (row: TData) => ReactNode;\n autoSize?: boolean;\n cellEdit?: DataGridColumnCellEdit<TData>;\n /**\n * Under `columnsResizable`, this column absorbs the free space the filler\n * strip would otherwise hold, so the grid always reads full-width and the\n * built-in editor covers the whole cell. One column per grid; while free\n * space remains, manual resizing of this column is visually a no-op (the\n * absorbed space compensates), the flex-column trade-off.\n */\n fillWidth?: boolean;\n}\n\n/**\n * The batteries-included feature bundle every ReUI data-grid example builds\n * on. v9 requires each table to declare its features up front, and the grid's\n * render path needs the ones registered here: `columnVisibilityFeature` alone\n * gates `row.getVisibleCells()`, so even a grid that never hides a column\n * needs it to render at all.\n *\n * Pass it straight through for the full grid:\n *\n * ```tsx\n * const table = useTable({ features: dataGridFeatures, columns, data })\n * ```\n *\n * Extend it when a grid needs more, keeping each prerequisite feature ahead of\n * the slot that depends on it:\n *\n * ```tsx\n * const features = tableFeatures({\n * ...dataGridFeatures,\n * columnGroupingFeature,\n * groupedRowModel: createGroupedRowModel(),\n * })\n * ```\n *\n * Or drop it entirely and hand `<DataGrid>` a leaner table - the components\n * accept any bundle, so you keep full ownership of the TanStack core.\n */\nexport const dataGridFeatures = tableFeatures({\n columnVisibilityFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnSizingFeature,\n // columnResizingFeature requires columnSizingFeature, declared above.\n columnResizingFeature,\n columnFilteringFeature,\n // Powers DataGridColumnFilter's column.getFacetedUniqueValues(). On v8 an\n // unregistered facet silently returned an empty map; on v9 the method would\n // not exist at all, so the faceted row models below are required, not\n // optional.\n columnFacetingFeature,\n // globalFilteringFeature requires columnFilteringFeature, declared above.\n globalFilteringFeature,\n rowSortingFeature,\n rowPaginationFeature,\n rowSelectionFeature,\n rowExpandingFeature,\n rowPinningFeature,\n // Registration alone is inert: it seeds a `cellSelection: []` slice and\n // prototype methods but binds no DOM handlers, so grids without\n // `tableLayout.cellSelection` render and behave exactly as before.\n cellSelectionFeature,\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n expandedRowModel: createExpandedRowModel(),\n facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(),\n // Every built-in v9 ships. A string `sortFn` resolves against this map\n // alone, and `sortFn: \"auto\"` infers a name (\"alphanumeric\", \"text\" or\n // \"datetime\") from the first row's value - so a partial map makes auto\n // sorting warn and silently fall back on ordinary string columns.\n sortFns: {\n alphanumeric: sortFn_alphanumeric,\n alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n textCaseSensitive: sortFn_textCaseSensitive,\n },\n // biome-ignore lint/suspicious/noExplicitAny: <>\n columnMeta: metaHelper<DataGridColumnMeta<any>>(),\n});\n\n/** The feature set `dataGridFeatures` registers. */\nexport type DataGridFeatures = typeof dataGridFeatures;\n\n/**\n * The grid's internal view of the table.\n *\n * `TFeatures` is invariant in v9 and an unresolved generic one collapses to a\n * union that includes the bare core arm, so no generic signature can call\n * `getVisibleCells()`, `getStartVisibleLeafColumns()` and friends. The public\n * components stay generic so consumers can pass any bundle they like; the\n * table is widened to this concrete type exactly once, on the way into\n * context, and every internal component reads it from there.\n */\nexport type DataGridTableInstance<TData extends object> = ReactTable<DataGridFeatures, TData>;\n\n/** Label for headers / column visibility: `meta.headerTitle`, string `columnDef.header`, or `column.id`. */\nexport function getColumnHeaderLabel<TData extends RowData, TValue>(\n column: Column<DataGridFeatures, TData, TValue>,\n): string {\n const meta = column.columnDef.meta as { headerTitle?: string } | undefined;\n if (typeof meta?.headerTitle === \"string\") return meta.headerTitle;\n const defHeader = column.columnDef.header;\n if (typeof defHeader === \"string\") return defHeader;\n return String(column.id);\n}\n\n/**\n * The td contract for spreadsheet selection. Call inside a\n * `Subscribe source={table.atoms.cellSelection}` render only: the reads are\n * builder calls whose state dependency React Compiler cannot see, exactly the\n * trap the row-selection checkbox documents.\n */\nexport function getDataGridCellSelectionCellAttrs<TData extends object>(\n cell: Cell<DataGridFeatures, TData, unknown>,\n): {\n \"aria-selected\": boolean;\n \"data-col-id\": string;\n \"data-cell-selected\": true | undefined;\n \"data-cell-focused\": true | undefined;\n \"data-cell-edge-top\": true | undefined;\n \"data-cell-edge-right\": true | undefined;\n \"data-cell-edge-bottom\": true | undefined;\n \"data-cell-edge-left\": true | undefined;\n} {\n const selected = cell.getIsSelected();\n const edges = cell.getSelectionEdges();\n return {\n \"aria-selected\": selected,\n \"data-col-id\": cell.column.id,\n \"data-cell-selected\": selected || undefined,\n \"data-cell-focused\": cell.getIsFocused() || undefined,\n \"data-cell-edge-top\": edges.top || undefined,\n \"data-cell-edge-right\": edges.right || undefined,\n \"data-cell-edge-bottom\": edges.bottom || undefined,\n \"data-cell-edge-left\": edges.left || undefined,\n };\n}\n\n/**\n * Selection chrome for a body td, activated by the data attributes above plus\n * the imperatively toggled `data-cell-fill-target` (fill-drag preview, written\n * outside React like the resize indicator). A ::before overlay, not outline\n * or box-shadow: an outline ring hugs the cell box and cannot line up with\n * the gridlines the perimeter paints on, and the pinned-column dividers\n * already own the cell's shadow slot (tailwind-merge would collapse a second\n * shadow-[...] into it).\n */\nexport const dataGridCellSelectionCellClasses = cn(\n \"relative select-none\",\n // A light tint: the selection must read as a range without drowning the\n // gridlines under a heavy fill. The focused cell stays unfilled. Pinned\n // cells must stay OPAQUE (they hide scrolled content), so they get the\n // tint pre-mixed over the background, and the focused pinned cell keeps\n // a solid background instead of turning transparent.\n \"data-[cell-selected]:bg-primary/4\",\n \"data-[cell-selected]:data-pinned:bg-[color-mix(in_oklab,var(--primary)_4%,var(--background))]\",\n \"data-[cell-focused]:bg-transparent!\",\n \"data-[cell-focused]:data-pinned:bg-background!\",\n // Every selection line is one layout-free ::before overlay per cell. It\n // reaches 1px BEYOND the cell so each line paints exactly ON the shared\n // gridline it replaces: the range perimeter and the interior dividers\n // share this geometry, so where they meet they coincide instead of\n // stacking into a wider edge, every side stays exactly 1px, and\n // selecting never adds real borders that shift layout. At the table's\n // own boundary there is no shared gridline and the overshoot leaves the\n // scrollable content box, where it is CLIPPED - the perimeter simply\n // vanished on the first column, last column and last row. So every\n // overshoot that can hit a boundary goes through a variable the\n // boundary cells zero out. Longhand inset utilities only, logical\n // start/end\n // so RTL mirrors for free; a separate override rule cannot do this,\n // equal-specificity variants leave shorthand-vs-longhand to sort order.\n \"data-[cell-selected]:before:pointer-events-none data-[cell-selected]:before:absolute data-[cell-selected]:before:start-[var(--data-grid-overlay-start,-1px)] data-[cell-selected]:before:end-[var(--data-grid-overlay-end,-1px)] data-[cell-selected]:before:top-[var(--data-grid-overlay-top,-1px)] data-[cell-selected]:before:bottom-[var(--data-grid-overlay-bottom,-1px)] data-[cell-selected]:before:border-primary data-[cell-selected]:before:content-['']\",\n \"data-[cell-focused]:before:pointer-events-none data-[cell-focused]:before:absolute data-[cell-focused]:before:start-[var(--data-grid-overlay-start,-1px)] data-[cell-focused]:before:end-[var(--data-grid-overlay-end,-1px)] data-[cell-focused]:before:top-[var(--data-grid-overlay-top,-1px)] data-[cell-focused]:before:bottom-[var(--data-grid-overlay-bottom,-1px)] data-[cell-focused]:before:border-primary data-[cell-focused]:before:content-['']\",\n // Interior dividers: selected cells repaint their own end and bottom\n // gridlines on the overlay, so gridline-less grids still divide a range.\n // The gray color is guarded by not- variants (higher specificity), so a\n // side that belongs to the range perimeter deterministically stays\n // primary.\n \"data-[cell-selected]:before:border-e data-[cell-selected]:before:border-b\",\n \"data-[cell-selected]:not-data-[cell-edge-right]:before:border-e-border\",\n \"data-[cell-selected]:not-data-[cell-edge-bottom]:before:border-b-border\",\n // The Sheets model: a single selected cell IS its own range, so the four\n // edge attributes below already draw its full primary box; inside a\n // larger range the anchor reads by its unfilled background alone. The\n // explicit ring only covers a focused cell with no selection at all.\n // Edge sides are logical (border-e/border-s): the feature derives edges\n // from display-order column indexes, which mirror in RTL.\n \"data-[cell-focused]:not-data-[cell-selected]:before:border\",\n \"data-[cell-edge-left]:before:border-s data-[cell-edge-right]:before:border-e data-[cell-edge-top]:before:border-t data-[cell-edge-bottom]:before:border-b\",\n // While a fill drag is live the preview border is the ONE painter for\n // the whole pending region, so the source cells' own chrome rests -\n // otherwise its lines double against the region border at every shared\n // edge. display is the no-cascade-fight switch (see below).\n \"in-data-[cell-filling]:data-[cell-selected]:before:hidden\",\n \"in-data-[cell-filling]:data-[cell-focused]:before:hidden\",\n // While the built-in editor is open its outline is the one border; the\n // edited cell's own overlay chrome hides so nothing peeks around the\n // flush editor. display is the switch because no other before: rule\n // sets it, so there is no cascade order to lose.\n \"in-data-[cell-editing]:data-[cell-focused]:before:hidden\",\n // Clamped to the cell edge at the grid's own boundary, the overlay's\n // lines sit flush against the container border instead of being clipped\n // away outside the scrollable content. A custom property has no cascade\n // fight to lose. First/last-child cover the boundary columns: when a\n // filler td follows the last data column, that cell's overshoot lands\n // INSIDE the table and needs no clamp, and the td:first/last-child of a\n // row are its logical start/end in RTL too.\n \"in-[tr:last-child]:[--data-grid-overlay-bottom:0px]\",\n // The top overshoot lands under a sticky header, which is positioned and\n // paints over it - so the first row's perimeter lost its top line. Clamp\n // inside the cell there, exactly like the other three boundaries.\n \"in-[tr:first-child]:[--data-grid-overlay-top:0px]\",\n \"first:[--data-grid-overlay-start:0px]\",\n \"last:[--data-grid-overlay-end:0px]\",\n // A pinned column is a boundary like the grid's own edges: the sticky\n // neighbor would cover an on-gridline overlay line, and re-painting it\n // from the pinned side doubles into a 2px blur whenever subpixel\n // positions disagree (browser zoom, fractional fill widths). One\n // painter instead: the overlay clamps inside its own cell there, the\n // same custom-property clamp the first and last cells use.\n \"[&:has(+td[data-pinned])]:[--data-grid-overlay-end:0px]\",\n \"[&:has(+[data-slot=data-grid-table-fill-body-cell]:last-child)]:[--data-grid-overlay-end:0px]\",\n \"[&:has(+[data-slot=data-grid-table-fill-body-cell]+td[data-pinned])]:[--data-grid-overlay-end:0px]\",\n \"[td[data-pinned]+&]:[--data-grid-overlay-start:0px]\",\n // Tint only: the dashed region outline is one overlay element drawn by\n // the fill session, so neighboring target cells never double their edges.\n \"data-[cell-fill-target]:bg-primary/4\",\n \"data-[cell-fill-target]:data-pinned:bg-[color-mix(in_oklab,var(--primary)_4%,var(--background))]\",\n);\n\nexport type DataGridApiFetchParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n filters?: ColumnFiltersState;\n searchQuery?: string;\n};\n\nexport type DataGridApiResponse<T> = {\n data: T[];\n empty: boolean;\n pagination: {\n total: number;\n page: number;\n };\n};\n\n/**\n * Everything `<DataGrid>` accepts except the two props the provider consumes\n * itself. Kept feature-agnostic: layout and messaging never depend on which\n * TanStack features the consumer registered.\n */\nexport type DataGridLayoutProps<TData extends object> = Omit<\n DataGridProps<TableFeatures, TData>,\n \"table\" | \"children\"\n>;\n\nexport interface DataGridContextProps<TData extends object> {\n props: DataGridLayoutProps<TData>;\n table: DataGridTableInstance<TData>;\n recordCount: number;\n isLoading: boolean;\n /** Stable per-grid prefix for the DOM ids ARIA relations point at. */\n gridId: string;\n /** The merged label set; components read `i18n.labels.<key>`. */\n i18n: DataGridI18nConfig;\n /**\n * Internal coordinator for `meta.autoSize` columns. Lives at the core level\n * so every table variant and viewport instance shares one application state.\n */\n autoSize?: DataGridAutoSizeController;\n}\n\n/**\n * Row and column ids are consumer strings; DOM ids cannot carry spaces or\n * quotes. One shared sanitizer so `aria-activedescendant` writers and the id\n * renderers always agree on the same encoding.\n */\nexport function toDataGridDomId(value: string): string {\n return value.replace(/[^\\w-]/g, \"_\");\n}\n\nexport type DataGridAutoSizeController = {\n /**\n * Feeds the controller one viewport measurement: the SIGNED free space\n * between the scroll container and the table, negative while the table\n * overflows. The first sight of a `meta.autoSize` column absorbs the\n * free space into its width; after that, every measurement REFLOWS the\n * same growth - a wider window widens the column, a narrower one gives\n * the space back down to the column's `minSize` (or its starting width\n * when none is set) - so the grid tracks its container live. Commits\n * are coalesced for performance: sub-pixel deltas are dropped, a\n * streaming resize gets one leading commit plus one trailing commit at\n * settle, and a width the user dragged is never touched. Safe to call\n * from every viewport measurement; returns true when a sizing update\n * was dispatched.\n */\n apply: (freeSpace: number) => boolean;\n};\n\ntype DataGridAutoSizeReflowState = {\n applied: { columnId: string; base: number; grown: number } | null;\n settleTimer: ReturnType<typeof setTimeout> | null;\n pendingFreeSpace: number;\n lastCommitAt: number;\n};\n\n/**\n * Bookkeeping keyed on the TABLE STORE, never on a React instance: dev\n * StrictMode double-mounts the tree, so two controller instances serve one\n * page and only the first would remember what it absorbed - the second\n * reads the grown width as a user drag and freezes the column. The store\n * object is the one identity that provably survives that dance (the\n * absorbed sizing rides inside it), and the WeakMap lets a discarded\n * table take its bookkeeping with it.\n */\nconst dataGridAutoSizeStates = new WeakMap<object, DataGridAutoSizeReflowState>();\n\nfunction getDataGridAutoSizeState(store: object): DataGridAutoSizeReflowState {\n let state = dataGridAutoSizeStates.get(store);\n if (!state) {\n state = {\n applied: null,\n settleTimer: null,\n pendingFreeSpace: 0,\n lastCommitAt: 0,\n };\n dataGridAutoSizeStates.set(store, state);\n }\n return state;\n}\n\nfunction createDataGridAutoSizeController<TData extends object>(\n /**\n * A getter, not the table itself.\n *\n * v8 handed back one stable table whose state mutated in place, so a\n * controller could close over it. v9 returns a NEW table wrapper on every\n * state change, and a captured one keeps reporting the state it was built\n * with - here that meant `columnSizing` looked permanently empty, the\n * applied-once guard re-armed on every measurement, and the fill overwrote\n * whatever width the user had just dragged the column to.\n */\n getTable: () => DataGridTableInstance<TData>,\n): DataGridAutoSizeController {\n // Reflow coalescing: a live window drag streams a measurement per frame,\n // and every accepted commit re-renders the table. One leading commit\n // keeps single snaps (a maximize) instant; the rest of the stream parks\n // its latest value behind one trailing timer, so a continuous drag costs\n // two commits instead of sixty a second. The trailing timer may fire\n // after the grid unmounts; it re-reads the table then, and a sizing\n // write to the consumer's store is inert once nothing renders it.\n const SETTLE_MS = 150;\n\n const reflow = (freeSpace: number): boolean => {\n const table = getTable();\n const state = getDataGridAutoSizeState(table.store);\n // LIVE state, never the render snapshot: a measurement can run between\n // our own sizing commit and React's re-render, and the stale snapshot\n // would hide the width this controller just wrote.\n const columnSizing = table.atoms.columnSizing?.get() ?? table.state.columnSizing;\n if (!state.applied) return false;\n const autoSizeColumn = table\n .getVisibleLeafColumns()\n .find((column) => column.columnDef.meta?.autoSize && column.getCanResize());\n if (!autoSizeColumn || autoSizeColumn.id !== state.applied.columnId) return false;\n // A width this coordinator did not write belongs to the user's drag;\n // reflow stands down until a reset re-arms the column.\n const currentSize = columnSizing[state.applied.columnId];\n if (currentSize !== undefined && currentSize !== state.applied.grown) {\n return false;\n }\n // The free space as it would measure with our growth removed; the\n // target re-absorbs exactly that, floored at minSize so a narrow\n // window hands space back without ever crushing the column (no\n // explicit minSize floors at the starting width instead).\n const freeAtBase = freeSpace + (state.applied.grown - state.applied.base);\n const floor = autoSizeColumn.columnDef.minSize ?? state.applied.base;\n const target = Math.max(floor, state.applied.base + freeAtBase);\n if (Math.abs(target - state.applied.grown) < 1) return false;\n state.applied = { ...state.applied, grown: target };\n table.setColumnSizing((old) => ({\n ...old,\n [state.applied!.columnId]: target,\n }));\n return true;\n };\n\n return {\n apply(freeSpace: number) {\n const table = getTable();\n const state = getDataGridAutoSizeState(table.store);\n // Same live read as `reflow`; the snapshot race is what made the\n // re-arm check clear the bookkeeping right after the first absorb.\n const columnSizing = table.atoms.columnSizing?.get() ?? table.state.columnSizing;\n\n // Re-arm after reset flows (double-click resetSize, resetColumnSizing,\n // controlled state replacement) so the column re-fills instead of\n // leaving a dead blank strip.\n if (state.applied && columnSizing[state.applied.columnId] === undefined) {\n state.applied = null;\n }\n\n const autoSizeColumn = table\n .getVisibleLeafColumns()\n .find((column) => column.columnDef.meta?.autoSize && column.getCanResize());\n\n if (autoSizeColumn && state.applied?.columnId === autoSizeColumn.id) {\n state.pendingFreeSpace = freeSpace;\n const now = Date.now();\n if (now - state.lastCommitAt > SETTLE_MS) {\n state.lastCommitAt = now;\n return reflow(freeSpace);\n }\n if (state.settleTimer !== null) clearTimeout(state.settleTimer);\n state.settleTimer = setTimeout(() => {\n state.settleTimer = null;\n state.lastCommitAt = Date.now();\n reflow(state.pendingFreeSpace);\n }, SETTLE_MS);\n return false;\n }\n\n const fillWidth = Math.max(0, freeSpace);\n if (fillWidth <= 0) return false;\n\n if (!autoSizeColumn) {\n return false;\n }\n\n // A width this coordinator did not write belongs to someone else -\n // almost always the user, who just dragged the column's resize handle.\n // Filling over it is what made a `meta.autoSize` column look\n // un-resizable: the drag committed, the next viewport measurement\n // stamped the fill back on top, and the column snapped to its old width.\n //\n // Deliberately keyed on observed state rather than on `state.applied`, which\n // is per-coordinator memory: anything that rebuilds the coordinator\n // (a remount, a new table store) forgets what it did, and the guard has\n // to survive that. An explicit reset clears the entry and re-arms the\n // fill, which is what makes double-click-to-reset still work.\n const currentSize = columnSizing[autoSizeColumn.id];\n if (currentSize !== undefined && currentSize !== state.applied?.grown) {\n return false;\n }\n\n // Candidate switched (e.g. the grown column was hidden and another\n // meta.autoSize column took over): revert the previous growth if the\n // user hasn't manually resized that column since, so visibility\n // toggles cannot ratchet the table wider than its container forever.\n const revert =\n state.applied && columnSizing[state.applied.columnId] === state.applied.grown\n ? state.applied\n : null;\n const base = columnSizing[autoSizeColumn.id] ?? autoSizeColumn.getSize();\n const grown = base + fillWidth;\n\n state.applied = { columnId: autoSizeColumn.id, base, grown };\n table.setColumnSizing((old) => {\n const next = { ...old, [autoSizeColumn.id]: grown };\n if (revert && next[revert.columnId] === revert.grown) {\n next[revert.columnId] = revert.base;\n }\n return next;\n });\n\n return true;\n },\n };\n}\n\nexport type DataGridRequestParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n columnFilters?: ColumnFiltersState;\n};\n\n/** Which spreadsheet operation produced a cell change batch. */\nexport type DataGridCellsChangeSource = \"paste\" | \"cut\" | \"clear\" | \"fill\" | \"edit\";\n\nexport interface DataGridCellChange<TData> {\n rowId: string;\n columnId: string;\n /** The consumer's row object, so immutable write-back needs no second lookup. */\n row: TData;\n /** Accessor value at dispatch time; enables consumer-side undo stacks. */\n previousValue: unknown;\n /** Typed value produced by `meta.cellEdit.parse`, or `clearValue` for clear/cut. */\n value: unknown;\n}\n\n/** What onCellsCopy receives after the grid writes the clipboard. */\nexport interface DataGridCopyDetails {\n /** The TSV text that reached the clipboard. */\n text: string;\n /** The same content as a row-major grid of formatted fields. */\n grid: string[][];\n /** True when the write came from a cut, which clears the region next. */\n cut: boolean;\n}\n\n/** One resolved positive region, in pre-paginated display indexes. */\nexport interface DataGridCellSelectionBound {\n minRowIndex: number;\n maxRowIndex: number;\n minColumnIndex: number;\n maxColumnIndex: number;\n}\n\n/** What onCellSelectionChange receives, resolved from the live selection. */\nexport interface DataGridCellSelectionSnapshot {\n /** The virtually focused cell, the active range's anchor. Null when clear. */\n focused: { rowId: string; columnId: string } | null;\n /** Every positive region, geometric order. */\n bounds: DataGridCellSelectionBound[];\n /** The most recent region, the one copy and paste act on. */\n activeBound: DataGridCellSelectionBound | null;\n /**\n * Cells of the selection the view can show - the count that matches the\n * painted range and what a batch will touch.\n */\n visibleCellCount: number;\n}\n\nexport interface DataGridCellRejection {\n rowId: string;\n columnId: string;\n raw: string;\n reason: \"readonly\" | \"invalid\";\n}\n\n/**\n * Lifecycle of a row for the optional CRUD indications: \"new\" and \"dirty\"\n * tint the row, \"deleted\" mutes and strikes it. Purely presentational - the\n * consumer's state stays the only owner of what the statuses mean.\n */\nexport type DataGridRowStatus = \"new\" | \"dirty\" | \"deleted\";\n\n/**\n * Lifecycle of a cell for the optional CRUD indications: a corner mark in\n * the amber tone for \"dirty\", the destructive tone for \"invalid\".\n */\nexport type DataGridCellStatus = \"dirty\" | \"invalid\";\n\n/**\n * Asks the consumer to open its editor for the focused cell: Enter or F2, or\n * a typed printable character (then `initialText` carries it, the\n * Notion/Airtable type-to-replace flow). Dispatched only for cells whose\n * column is writable via `meta.cellEdit`.\n */\nexport interface DataGridCellEditRequest<TData> {\n rowId: string;\n columnId: string;\n row: TData;\n previousValue: unknown;\n /** The typed character that started the edit; absent for Enter and F2. */\n initialText?: string;\n}\n\n/**\n * One batch per operation, however many cells it spans: a 10k-cell paste is\n * one callback, one consumer setState, one table rebuild. The grid never\n * writes data itself.\n */\nexport interface DataGridCellsChangeDetails<TData> {\n source: DataGridCellsChangeSource;\n changes: DataGridCellChange<TData>[];\n rejected: DataGridCellRejection[];\n}\n\nexport interface DataGridProps<TFeatures extends TableFeatures, TData extends object> {\n className?: string;\n table?: Table<TFeatures, TData>;\n recordCount: number;\n children?: ReactNode;\n onRowClick?: (row: TData) => void;\n /**\n * Receives every spreadsheet write batch (paste, cut, clear, fill, edit).\n * Served through the props getter like `onRowClick`, so an inline identity\n * never republishes the context. Absent: copy still works, writes no-op.\n */\n onCellsChange?: (details: DataGridCellsChangeDetails<TData>) => void;\n /**\n * Opens the consumer's editor from the keyboard: Enter, F2, or typing on\n * the focused cell. Absent: Enter keeps moving down, typing does nothing.\n */\n onCellEditRequest?: (request: DataGridCellEditRequest<TData>) => void;\n /**\n * Fires on every cell-selection change (focus moves, ranges grow or\n * clear) with a resolved snapshot, so a selection count, formula bar or\n * context panel needs no reach into TanStack internals.\n */\n onCellSelectionChange?: (snapshot: DataGridCellSelectionSnapshot) => void;\n /**\n * Fires after the grid writes the clipboard (Cmd/Ctrl+C or X, or the\n * native copy and cut events), e.g. to confirm with a toast.\n */\n onCellsCopy?: (details: DataGridCopyDetails) => void;\n /**\n * Renders an \"Add row\" affordance as the table body's last row; clicking\n * it is the consumer's cue to start creating a row. Absent: no row.\n */\n onRowCreate?: () => void;\n /** Label of the onRowCreate affordance. Defaults to \"Add row\". */\n rowCreateLabel?: ReactNode;\n /**\n * Rendered inside the table body after the data rows: the slot a DRAFT\n * row lives in while it is being created, before it joins `data` and the\n * pagination math. Supply a `<tr>` of cells; the colgroup sizes them.\n */\n appendRow?: ReactNode;\n /**\n * Optional CRUD indication per row. Return undefined for no indication;\n * omit the prop entirely to render none anywhere.\n */\n getRowStatus?: (row: TData) => DataGridRowStatus | undefined;\n /**\n * Optional CRUD indication per cell: the classic corner mark on cells the\n * consumer tracks as edited or invalid.\n */\n getCellStatus?: (row: TData, columnId: string) => DataGridCellStatus | undefined;\n isLoading?: boolean;\n /**\n * Overrides for every built-in string: menu items, aria labels,\n * pagination copy, state messages. Merged over the defaults; a more\n * specific component prop (`rowCreateLabel`, `loadingMessage`, the\n * pagination label props) still wins over its `i18n` counterpart.\n */\n i18n?: DataGridI18nOverrides;\n loadingMode?: \"skeleton\" | \"spinner\";\n loadingMessage?: ReactNode | string;\n fetchingMoreMessage?: ReactNode | string;\n allRowsLoadedMessage?: ReactNode | string;\n emptyMessage?: ReactNode | string;\n tableLayout?: {\n dense?: boolean;\n cellBorder?: boolean;\n rowBorder?: boolean;\n rowRounded?: boolean;\n stripped?: boolean;\n headerBackground?: boolean;\n footerBackground?: boolean;\n headerBorder?: boolean;\n headerSticky?: boolean;\n width?: \"auto\" | \"fixed\";\n columnsVisibility?: boolean;\n columnsResizable?: boolean;\n columnsResizeMode?: \"onChange\" | \"onEnd\";\n columnsPinnable?: boolean;\n columnsMovable?: boolean;\n columnsDraggable?: boolean;\n rowsDraggable?: boolean;\n rowsPinnable?: boolean;\n /** Spreadsheet cell range selection: mouse ranges, keyboard, clipboard chrome. */\n cellSelection?: boolean;\n /**\n * \"range\" (default): drag, Shift and Ctrl/Cmd gestures and Shift+keys\n * grow multi-cell regions. \"single\": one focused cell only - every\n * gesture collapses to it and Ctrl/Cmd+A is inert.\n */\n cellSelectionMode?: \"single\" | \"range\";\n /** Drag-to-fill handle on the selection corner. Requires cellSelection. */\n cellFillHandle?: boolean;\n /**\n * How a cell opens its editor from the mouse: \"dblclick\" (default,\n * the spreadsheet standard - first click focuses, second edits) or\n * \"click\", opening the editor as soon as a plain click lands on the\n * focused cell; modifier clicks and drags still select.\n */\n cellEditMode?: \"dblclick\" | \"click\";\n /**\n * When true, committing an edit with Enter moves focus down (Shift+Enter\n * up), the Sheets and Excel convention. Off by default: the commit keeps\n * focus on the edited cell. Tab always commits and moves across.\n */\n cellEditEnterAdvance?: boolean;\n /**\n * The handle's look: \"dot\" is a solid primary dot kept inside the\n * cell corner; \"ring\" is the Sheets-style hollow circle riding the\n * corner point, clamped at the grid's own boundary; \"square\" is the\n * Excel-style solid square inside the corner. Default \"dot\".\n */\n cellFillHandleVariant?: \"dot\" | \"ring\" | \"square\";\n };\n tableClassNames?: {\n base?: string;\n header?: string;\n headerRow?: string;\n headerSticky?: string;\n body?: string;\n bodyRow?: string;\n footer?: string;\n edgeCell?: string;\n /** Override the getRowStatus tints; defaults are the warning-muted set. */\n rowNew?: string;\n rowDirty?: string;\n rowDeleted?: string;\n /**\n * Override the pinned-row chrome (muted tint, boundary shadow). A grid\n * that pins a draft row for quick-create wants it to read as an active\n * row, not a muted one.\n */\n rowPinned?: string;\n /** The onRowCreate affordance row, e.g. to match the grid's row height. */\n rowCreate?: string;\n /** The fill handle, e.g. to restyle or resize it beyond the built-in variants. */\n cellFillHandle?: string;\n };\n}\n\nconst DataGridContext = createContext<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n DataGridContextProps<any> | undefined>(undefined);\n\n/**\n * Reads the grid context. Pass `TData` from the calling component when the\n * table, a row or a cell is handed on to something typed against that row\n * shape: v9 declares `TData` invariant, so the default `any` no longer\n * unifies with a concrete row type the way it did on v8.\n */\nfunction useDataGrid<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n TData extends object = any,\n>(): DataGridContextProps<TData> {\n const context = useContext(DataGridContext) as DataGridContextProps<TData> | undefined;\n if (!context) {\n throw new Error(\"useDataGrid must be used within a DataGridProvider\");\n }\n return context;\n}\n\nfunction DataGridProvider<TData extends object>({\n children,\n table,\n ...props\n}: DataGridLayoutProps<TData> & {\n table: DataGridTableInstance<TData>;\n children?: ReactNode;\n}) {\n // Latest-props ref: context reads always resolve fresh props through the\n // getter below without the memoized context value depending on unstable\n // Stable for the grid's lifetime; ARIA ids and relations hang off it.\n const gridId = useId();\n // ReactNode/function prop identities (inline emptyMessage/onRowClick would\n // otherwise publish a new context value on every consumer render - at\n // mousemove rate during a resize drag, piercing the body-rows memo).\n const propsRef = useRef(props);\n propsRef.current = props;\n const i18n = mergeDataGridI18n(props.i18n);\n const i18nRef = useRef(i18n);\n i18nRef.current = i18n;\n\n // Same treatment for the table itself, which v9 - unlike v8 - re-creates on\n // every state change. Depending on it directly would republish the context\n // on each resize tick, which is exactly what the memo below exists to\n // prevent; the getter still hands every consumer the current instance.\n const tableRef = useRef(table);\n tableRef.current = table;\n\n // Re-assert an explicit tableLayout resize mode so consumer-level useTable\n // options cannot flip it back between drags. v9 makes `table.options`\n // readonly, so this goes through setOptions in an effect rather than a\n // render-phase mutation. Without an explicit mode, the consumer's own\n // tanstack columnResizeMode (default \"onEnd\") is honored.\n const resizeMode =\n props.tableLayout?.columnsResizable && props.tableLayout.columnsResizeMode\n ? props.tableLayout.columnsResizeMode\n : undefined;\n\n useEffect(() => {\n if (!resizeMode) return;\n if (table.options.columnResizeMode === resizeMode) return;\n table.setOptions((old) => ({ ...old, columnResizeMode: resizeMode }));\n }, [table, resizeMode]);\n\n // With the selection UI on, every paste/fill/clear batch replaces `data`,\n // and the feature's default autoResetCellSelection would wipe the selection\n // after each write. Ranges are row-id based and unresolvable ids drop out\n // of the bounds safely, so keeping state across data edits is the correct\n // default here.\n const cellSelectionOn = !!props.tableLayout?.cellSelection;\n useEffect(() => {\n if (!cellSelectionOn || table.atoms.cellSelection == null) return;\n if (table.options.autoResetCellSelection === false) return;\n table.setOptions((old) => ({ ...old, autoResetCellSelection: false }));\n }, [table, cellSelectionOn]);\n\n // Rendered row indexes re-base per page, so a range kept across a page flip\n // re-lights the same positions over different rows. A page change clears\n // the selection instead - the rule Excel-family grids apply to paginated\n // range selection.\n const pageKey = `${table.state.pagination?.pageIndex}:${table.state.pagination?.pageSize}`;\n const previousPageKeyRef = useRef(pageKey);\n useEffect(() => {\n if (previousPageKeyRef.current === pageKey) return;\n previousPageKeyRef.current = pageKey;\n if (!cellSelectionOn || table.atoms.cellSelection == null) return;\n tableRef.current.resetCellSelection(true);\n }, [pageKey, cellSelectionOn, table.atoms.cellSelection]);\n\n // One autoSize coordinator per table instance so split header/body viewports\n // cannot apply the growth twice. Keyed on `table.store`, which v9 keeps\n // stable for the life of the table, rather than on `table` itself: the\n // wrapper is re-created on every state change, and re-creating the\n // controller with it would reset its applied-once bookkeeping mid-drag.\n const autoSize = useMemo(() => createDataGridAutoSizeController(() => tableRef.current), []);\n\n // Memoize context value so consumers don't re-render during column resize.\n // Column sizing state is intentionally excluded from deps -- CSS variables\n // on the <table> element handle width updates without React re-renders.\n // ReactNode/function props (messages, onRowClick) are also excluded: they\n // are served fresh through the props getter, so unstable inline identities\n // cannot invalidate the context value.\n // `cellSelection` state is excluded on purpose too: a drag writes it once\n // per cell crossed, and nothing reads it through context - cells and the\n // selection bar subscribe to `table.atoms.cellSelection` directly.\n const value = useMemo(\n () => ({\n get props() {\n return propsRef.current;\n },\n get table() {\n return tableRef.current;\n },\n get i18n() {\n return i18nRef.current;\n },\n recordCount: props.recordCount,\n isLoading: props.isLoading || false,\n gridId,\n autoSize,\n }),\n [autoSize, props.recordCount, props.isLoading, gridId],\n );\n\n return (\n // One React context serves every TData, but v9 declares both TFeatures and\n // TData invariant, so a `DataGridContextProps<any>` context cannot accept a\n // `DataGridContextProps<TData>` value structurally. The erasure happens\n // here and is undone by the TData generic on each consumer component.\n <DataGridContext.Provider value={value as unknown as DataGridContextProps<TData>}>\n {children}\n </DataGridContext.Provider>\n );\n}\n\nfunction DataGrid<TFeatures extends TableFeatures, TData extends object>({\n children,\n table,\n ...props\n}: DataGridProps<TFeatures, TData>) {\n const defaultProps: Partial<DataGridProps<TFeatures, TData>> = {\n loadingMode: \"skeleton\",\n tableLayout: {\n dense: false,\n cellBorder: false,\n rowBorder: true,\n rowRounded: false,\n stripped: false,\n headerSticky: false,\n headerBackground: false,\n footerBackground: false,\n headerBorder: true,\n width: \"fixed\",\n columnsVisibility: false,\n columnsResizable: false,\n // columnsResizeMode has no default on purpose: when unset, the\n // consumer's tanstack columnResizeMode (default \"onEnd\") is honored.\n columnsPinnable: false,\n columnsMovable: false,\n columnsDraggable: false,\n rowsDraggable: false,\n rowsPinnable: false,\n cellSelection: false,\n cellFillHandle: false,\n },\n tableClassNames: {\n base: \"\",\n header: \"\",\n headerRow: \"\",\n // z-40 keeps the sticky header above pinned body cells (zIndex 30 in\n // getPinningStyles), which would otherwise paint over it while\n // scrolling vertically with columnsPinnable enabled.\n headerSticky: \"sticky top-0 z-40 bg-background/90 backdrop-blur-xs\",\n body: \"\",\n bodyRow: \"\",\n footer: \"\",\n edgeCell: \"\",\n },\n };\n\n const mergedProps: DataGridProps<TFeatures, TData> = {\n ...defaultProps,\n ...props,\n tableLayout: {\n ...defaultProps.tableLayout,\n ...(props.tableLayout || {}),\n },\n tableClassNames: {\n ...defaultProps.tableClassNames,\n ...(props.tableClassNames || {}),\n },\n };\n\n // Ensure table is provided\n if (!table) {\n throw new Error('DataGrid requires a \"table\" prop');\n }\n\n // The single widening point. Consumers own the TanStack core and may hand\n // over any feature bundle; internals need a concrete one to resolve the\n // feature-gated APIs they call, and v9's invariant TFeatures rules out\n // expressing that with a generic constraint.\n const internalTable = table as unknown as DataGridTableInstance<TData>;\n const internalProps = mergedProps as unknown as DataGridLayoutProps<TData>;\n\n return (\n <DataGridProvider table={internalTable} {...internalProps}>\n {children}\n </DataGridProvider>\n );\n}\n\nfunction DataGridContainer({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n /** Accepted for backwards compatibility; currently has no effect. */\n border?: boolean;\n}) {\n return (\n <div\n data-slot=\"data-grid\"\n // relative: anchors floating chrome composed inside the container,\n // like the fill-drag preview outline.\n className={cn(\"relative w-full overflow-hidden\", className)}\n >\n {children}\n </div>\n );\n}\n\nexport { DataGrid, DataGridContainer, DataGridProvider, useDataGrid };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0IA,MAAa,mBAAmB,cAAc;CAC5C;CACA;CACA;CACA;CAEA;CACA;CAKA;CAEA;CACA;CACA;CACA;CACA;CACA;CAIA;CACA,gBAAgB,qBAAqB;CACrC,kBAAkB,uBAAuB;CACzC,mBAAmB,wBAAwB;CAC3C,kBAAkB,uBAAuB;CACzC,iBAAiB,sBAAsB;CACvC,qBAAqB,0BAA0B;CAK/C,SAAS;EACP,cAAc;EACd,2BAA2B;EAC3B,OAAO;EACP,UAAU;EACV,MAAM;EACN,mBAAmB;CACrB;CAEA,YAAY,WAAoC;AAClD,CAAC;;AAkBD,SAAgB,qBACd,QACQ;CACR,MAAM,OAAO,OAAO,UAAU;CAC9B,IAAI,OAAO,MAAM,gBAAgB,UAAU,OAAO,KAAK;CACvD,MAAM,YAAY,OAAO,UAAU;CACnC,IAAI,OAAO,cAAc,UAAU,OAAO;CAC1C,OAAO,OAAO,OAAO,EAAE;AACzB;;;;;;;AAQA,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AClB,kBAAkB;GAClB,cAAc;GACd,OAAO;GACP,mBAAmB;GACnB,kBAAkB;GAGlB,iBAAiB;GACjB,gBAAgB;GAChB,kBAAkB;GAClB,eAAe;GACf,cAAc;GACd,eAAe;GACf,gBAAgB;EAClB;EACA,iBAAiB;GACf,MAAM;GACN,QAAQ;GACR,WAAW;GAIX,cAAc;GACd,MAAM;GACN,SAAS;GACT,QAAQ;GACR,UAAU;EACZ;CACF;CAEA,MAAM,cAA+C;EACnD,GAAG;EACH,GAAG;EACH,aAAa;GACX,GAAG,aAAa;GAChB,GAAI,MAAM,eAAe,CAAC;EAC5B;EACA,iBAAiB;GACf,GAAG,aAAa;GAChB,GAAI,MAAM,mBAAmB,CAAC;EAChC;CACF;CAGA,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,oCAAkC;CAUpD,OACE,oBAAC,kBAAD;EAAyBA;EAAe,GAAIC;EACzC;CACe,CAAA;AAEtB;AAEA,SAAS,kBAAkB,EACzB,UACA,aAMC;CACD,OACE,oBAAC,OAAD;EACE,aAAU;EAGV,WAAW,GAAG,mCAAmC,SAAS;EAEzD;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"data-grid.js","names":["internalTable","internalProps"],"sources":["../../../../src/components/reui/data-grid/data-grid.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { createContext, useContext, useEffect, useId, useMemo, useRef } from \"react\";\nimport type {\n Cell,\n Column,\n ColumnFiltersState,\n ReactTable,\n RowData,\n SortingState,\n Table,\n TableFeatures,\n} from \"@tanstack/react-table\";\nimport {\n cellSelectionFeature,\n columnFacetingFeature,\n columnFilteringFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnResizingFeature,\n columnSizingFeature,\n columnVisibilityFeature,\n createExpandedRowModel,\n createFacetedRowModel,\n createFacetedUniqueValues,\n createFilteredRowModel,\n createPaginatedRowModel,\n createSortedRowModel,\n globalFilteringFeature,\n metaHelper,\n rowExpandingFeature,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n sortFn_alphanumeric,\n sortFn_alphanumericCaseSensitive,\n sortFn_basic,\n sortFn_datetime,\n sortFn_text,\n sortFn_textCaseSensitive,\n tableFeatures,\n} from \"@tanstack/react-table\";\n\nimport { cn } from \"@kumix/utils\";\nimport {\n type DataGridI18nConfig,\n type DataGridI18nOverrides,\n mergeDataGridI18n,\n} from \"./data-grid-i18n\";\n\n/**\n * Per-column extras the grid reads off `columnDef.meta`.\n *\n * TanStack v9 resolves this through the `columnMeta` slot on the feature\n * bundle below instead of a global `declare module` augmentation, so\n * installing the data grid no longer widens `ColumnMeta` for every other\n * table in the consuming app.\n */\n/**\n * Per-column write contract for the spreadsheet operations (paste, fill,\n * clear, cut). Presence marks the column writable; every write still flows\n * through `onCellsChange`, so the consumer's state stays the only data owner.\n */\nexport interface DataGridColumnCellEdit<TData> {\n /**\n * Set false for a column that formats clipboard output but is never\n * written; a function decides per row, so locked rows (archived, another\n * user's, a totals row) reject like any read-only cell. Defaults to true.\n */\n editable?: boolean | ((row: TData) => boolean);\n /**\n * Clipboard or fill string to typed value. Return undefined to reject the\n * cell into `rejected`. Without it the raw string passes through unchanged -\n * a deliberate non-coercion, so a number column receives strings only when\n * the consumer chose not to parse.\n */\n parse?: (raw: string, row: TData) => unknown;\n /** Typed value to clipboard string. Fallback: String(value ?? \"\"). */\n format?: (value: unknown, row: TData) => string;\n /** Value dispatched by Delete/Backspace and cut. Defaults to null. */\n clearValue?: unknown;\n /**\n * Opt into the grid's built-in free-text editor: an overlay input (or\n * auto-growing textarea) flush over the focused cell, opened by Enter, F2,\n * typing, or double-click, committing through `onCellsChange` as source\n * `\"edit\"` with `parse` applied. Columns without it stay consumer-edited\n * via `onCellEditRequest` or their own cell renderers.\n */\n control?: \"text\" | \"textarea\";\n}\n\nexport interface DataGridColumnMeta<TData> {\n headerTitle?: string;\n headerClassName?: string;\n cellClassName?: string;\n skeleton?: ReactNode;\n expandedContent?: (row: TData) => ReactNode;\n autoSize?: boolean;\n cellEdit?: DataGridColumnCellEdit<TData>;\n /**\n * Under `columnsResizable`, this column absorbs the free space the filler\n * strip would otherwise hold, so the grid always reads full-width and the\n * built-in editor covers the whole cell. One column per grid; while free\n * space remains, manual resizing of this column is visually a no-op (the\n * absorbed space compensates), the flex-column trade-off.\n */\n fillWidth?: boolean;\n}\n\n/**\n * The batteries-included feature bundle every ReUI data-grid example builds\n * on. v9 requires each table to declare its features up front, and the grid's\n * render path needs the ones registered here: `columnVisibilityFeature` alone\n * gates `row.getVisibleCells()`, so even a grid that never hides a column\n * needs it to render at all.\n *\n * Pass it straight through for the full grid:\n *\n * ```tsx\n * const table = useTable({ features: dataGridFeatures, columns, data })\n * ```\n *\n * Extend it when a grid needs more, keeping each prerequisite feature ahead of\n * the slot that depends on it:\n *\n * ```tsx\n * const features = tableFeatures({\n * ...dataGridFeatures,\n * columnGroupingFeature,\n * groupedRowModel: createGroupedRowModel(),\n * })\n * ```\n *\n * Or drop it entirely and hand `<DataGrid>` a leaner table - the components\n * accept any bundle, so you keep full ownership of the TanStack core.\n */\nexport const dataGridFeatures = tableFeatures({\n columnVisibilityFeature,\n columnOrderingFeature,\n columnPinningFeature,\n columnSizingFeature,\n // columnResizingFeature requires columnSizingFeature, declared above.\n columnResizingFeature,\n columnFilteringFeature,\n // Powers DataGridColumnFilter's column.getFacetedUniqueValues(). On v8 an\n // unregistered facet silently returned an empty map; on v9 the method would\n // not exist at all, so the faceted row models below are required, not\n // optional.\n columnFacetingFeature,\n // globalFilteringFeature requires columnFilteringFeature, declared above.\n globalFilteringFeature,\n rowSortingFeature,\n rowPaginationFeature,\n rowSelectionFeature,\n rowExpandingFeature,\n rowPinningFeature,\n // Registration alone is inert: it seeds a `cellSelection: []` slice and\n // prototype methods but binds no DOM handlers, so grids without\n // `tableLayout.cellSelection` render and behave exactly as before.\n cellSelectionFeature,\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n expandedRowModel: createExpandedRowModel(),\n facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(),\n // Every built-in v9 ships. A string `sortFn` resolves against this map\n // alone, and `sortFn: \"auto\"` infers a name (\"alphanumeric\", \"text\" or\n // \"datetime\") from the first row's value - so a partial map makes auto\n // sorting warn and silently fall back on ordinary string columns.\n sortFns: {\n alphanumeric: sortFn_alphanumeric,\n alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n textCaseSensitive: sortFn_textCaseSensitive,\n },\n // biome-ignore lint/suspicious/noExplicitAny: <>\n columnMeta: metaHelper<DataGridColumnMeta<any>>(),\n});\n\n/** The feature set `dataGridFeatures` registers. */\nexport type DataGridFeatures = typeof dataGridFeatures;\n\n/**\n * The grid's internal view of the table.\n *\n * `TFeatures` is invariant in v9 and an unresolved generic one collapses to a\n * union that includes the bare core arm, so no generic signature can call\n * `getVisibleCells()`, `getStartVisibleLeafColumns()` and friends. The public\n * components stay generic so consumers can pass any bundle they like; the\n * table is widened to this concrete type exactly once, on the way into\n * context, and every internal component reads it from there.\n */\nexport type DataGridTableInstance<TData extends object> = ReactTable<DataGridFeatures, TData>;\n\n/** Label for headers / column visibility: `meta.headerTitle`, string `columnDef.header`, or `column.id`. */\nexport function getColumnHeaderLabel<TData extends RowData, TValue>(\n column: Column<DataGridFeatures, TData, TValue>,\n): string {\n const meta = column.columnDef.meta as { headerTitle?: string } | undefined;\n if (typeof meta?.headerTitle === \"string\") return meta.headerTitle;\n const defHeader = column.columnDef.header;\n if (typeof defHeader === \"string\") return defHeader;\n return String(column.id);\n}\n\n/**\n * The td contract for spreadsheet selection. Call inside a\n * `Subscribe source={table.atoms.cellSelection}` render only: the reads are\n * builder calls whose state dependency React Compiler cannot see, exactly the\n * trap the row-selection checkbox documents.\n */\nexport function getDataGridCellSelectionCellAttrs<TData extends object>(\n cell: Cell<DataGridFeatures, TData, unknown>,\n): {\n \"aria-selected\": boolean;\n \"data-col-id\": string;\n \"data-cell-selected\": true | undefined;\n \"data-cell-focused\": true | undefined;\n \"data-cell-edge-top\": true | undefined;\n \"data-cell-edge-right\": true | undefined;\n \"data-cell-edge-bottom\": true | undefined;\n \"data-cell-edge-left\": true | undefined;\n} {\n const selected = cell.getIsSelected();\n const edges = cell.getSelectionEdges();\n return {\n \"aria-selected\": selected,\n \"data-col-id\": cell.column.id,\n \"data-cell-selected\": selected || undefined,\n \"data-cell-focused\": cell.getIsFocused() || undefined,\n \"data-cell-edge-top\": edges.top || undefined,\n \"data-cell-edge-right\": edges.right || undefined,\n \"data-cell-edge-bottom\": edges.bottom || undefined,\n \"data-cell-edge-left\": edges.left || undefined,\n };\n}\n\n/**\n * Selection chrome for a body td, activated by the data attributes above plus\n * the imperatively toggled `data-cell-fill-target` (fill-drag preview, written\n * outside React like the resize indicator). A ::before overlay, not outline\n * or box-shadow: an outline ring hugs the cell box and cannot line up with\n * the gridlines the perimeter paints on, and the pinned-column dividers\n * already own the cell's shadow slot (tailwind-merge would collapse a second\n * shadow-[...] into it).\n */\nexport const dataGridCellSelectionCellClasses = cn(\n \"relative select-none\",\n // A light tint: the selection must read as a range without drowning the\n // gridlines under a heavy fill. The focused cell stays unfilled. Pinned\n // cells must stay OPAQUE (they hide scrolled content), so they get the\n // tint pre-mixed over the background, and the focused pinned cell keeps\n // a solid background instead of turning transparent.\n \"data-[cell-selected]:bg-primary/4\",\n \"data-[cell-selected]:data-pinned:bg-[color-mix(in_oklab,var(--primary)_4%,var(--background))]\",\n \"data-[cell-focused]:bg-transparent!\",\n \"data-[cell-focused]:data-pinned:bg-background!\",\n // Every selection line is one layout-free ::before overlay per cell. It\n // reaches 1px BEYOND the cell so each line paints exactly ON the shared\n // gridline it replaces: the range perimeter and the interior dividers\n // share this geometry, so where they meet they coincide instead of\n // stacking into a wider edge, every side stays exactly 1px, and\n // selecting never adds real borders that shift layout. At the table's\n // own boundary there is no shared gridline and the overshoot leaves the\n // scrollable content box, where it is CLIPPED - the perimeter simply\n // vanished on the first column, last column and last row. So every\n // overshoot that can hit a boundary goes through a variable the\n // boundary cells zero out. Longhand inset utilities only, logical\n // start/end\n // so RTL mirrors for free; a separate override rule cannot do this,\n // equal-specificity variants leave shorthand-vs-longhand to sort order.\n \"data-[cell-selected]:before:pointer-events-none data-[cell-selected]:before:absolute data-[cell-selected]:before:start-[var(--data-grid-overlay-start,-1px)] data-[cell-selected]:before:end-[var(--data-grid-overlay-end,-1px)] data-[cell-selected]:before:top-[var(--data-grid-overlay-top,-1px)] data-[cell-selected]:before:bottom-[var(--data-grid-overlay-bottom,-1px)] data-[cell-selected]:before:border-primary data-[cell-selected]:before:content-['']\",\n \"data-[cell-focused]:before:pointer-events-none data-[cell-focused]:before:absolute data-[cell-focused]:before:start-[var(--data-grid-overlay-start,-1px)] data-[cell-focused]:before:end-[var(--data-grid-overlay-end,-1px)] data-[cell-focused]:before:top-[var(--data-grid-overlay-top,-1px)] data-[cell-focused]:before:bottom-[var(--data-grid-overlay-bottom,-1px)] data-[cell-focused]:before:border-primary data-[cell-focused]:before:content-['']\",\n // Interior dividers: selected cells repaint their own end and bottom\n // gridlines on the overlay, so gridline-less grids still divide a range.\n // The gray color is guarded by not- variants (higher specificity), so a\n // side that belongs to the range perimeter deterministically stays\n // primary.\n \"data-[cell-selected]:before:border-e data-[cell-selected]:before:border-b\",\n \"data-[cell-selected]:not-data-[cell-edge-right]:before:border-e-border\",\n \"data-[cell-selected]:not-data-[cell-edge-bottom]:before:border-b-border\",\n // The Sheets model: a single selected cell IS its own range, so the four\n // edge attributes below already draw its full primary box; inside a\n // larger range the anchor reads by its unfilled background alone. The\n // explicit ring only covers a focused cell with no selection at all.\n // Edge sides are logical (border-e/border-s): the feature derives edges\n // from display-order column indexes, which mirror in RTL.\n \"data-[cell-focused]:not-data-[cell-selected]:before:border\",\n \"data-[cell-edge-left]:before:border-s data-[cell-edge-right]:before:border-e data-[cell-edge-top]:before:border-t data-[cell-edge-bottom]:before:border-b\",\n // While a fill drag is live the preview border is the ONE painter for\n // the whole pending region, so the source cells' own chrome rests -\n // otherwise its lines double against the region border at every shared\n // edge. display is the no-cascade-fight switch (see below).\n \"in-data-[cell-filling]:data-[cell-selected]:before:hidden\",\n \"in-data-[cell-filling]:data-[cell-focused]:before:hidden\",\n // While the built-in editor is open its outline is the one border; the\n // edited cell's own overlay chrome hides so nothing peeks around the\n // flush editor. display is the switch because no other before: rule\n // sets it, so there is no cascade order to lose.\n \"in-data-[cell-editing]:data-[cell-focused]:before:hidden\",\n // Clamped to the cell edge at the grid's own boundary, the overlay's\n // lines sit flush against the container border instead of being clipped\n // away outside the scrollable content. A custom property has no cascade\n // fight to lose. First/last-child cover the boundary columns: when a\n // filler td follows the last data column, that cell's overshoot lands\n // INSIDE the table and needs no clamp, and the td:first/last-child of a\n // row are its logical start/end in RTL too.\n \"in-[tr:last-child]:[--data-grid-overlay-bottom:0px]\",\n // The top overshoot lands under a sticky header, which is positioned and\n // paints over it - so the first row's perimeter lost its top line. Clamp\n // inside the cell there, exactly like the other three boundaries.\n \"in-[tr:first-child]:[--data-grid-overlay-top:0px]\",\n \"first:[--data-grid-overlay-start:0px]\",\n \"last:[--data-grid-overlay-end:0px]\",\n // A pinned column is a boundary like the grid's own edges: the sticky\n // neighbor would cover an on-gridline overlay line, and re-painting it\n // from the pinned side doubles into a 2px blur whenever subpixel\n // positions disagree (browser zoom, fractional fill widths). One\n // painter instead: the overlay clamps inside its own cell there, the\n // same custom-property clamp the first and last cells use.\n \"[&:has(+td[data-pinned])]:[--data-grid-overlay-end:0px]\",\n \"[&:has(+[data-slot=data-grid-table-fill-body-cell]:last-child)]:[--data-grid-overlay-end:0px]\",\n \"[&:has(+[data-slot=data-grid-table-fill-body-cell]+td[data-pinned])]:[--data-grid-overlay-end:0px]\",\n \"[td[data-pinned]+&]:[--data-grid-overlay-start:0px]\",\n // Tint only: the dashed region outline is one overlay element drawn by\n // the fill session, so neighboring target cells never double their edges.\n \"data-[cell-fill-target]:bg-primary/4\",\n \"data-[cell-fill-target]:data-pinned:bg-[color-mix(in_oklab,var(--primary)_4%,var(--background))]\",\n);\n\nexport type DataGridApiFetchParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n filters?: ColumnFiltersState;\n searchQuery?: string;\n};\n\nexport type DataGridApiResponse<T> = {\n data: T[];\n empty: boolean;\n pagination: {\n total: number;\n page: number;\n };\n};\n\n/**\n * Everything `<DataGrid>` accepts except the two props the provider consumes\n * itself. Kept feature-agnostic: layout and messaging never depend on which\n * TanStack features the consumer registered.\n */\nexport type DataGridLayoutProps<TData extends object> = Omit<\n DataGridProps<TableFeatures, TData>,\n \"table\" | \"children\"\n>;\n\nexport interface DataGridContextProps<TData extends object> {\n props: DataGridLayoutProps<TData>;\n table: DataGridTableInstance<TData>;\n recordCount: number;\n isLoading: boolean;\n /** Stable per-grid prefix for the DOM ids ARIA relations point at. */\n gridId: string;\n /** The merged label set; components read `i18n.labels.<key>`. */\n i18n: DataGridI18nConfig;\n /**\n * Internal coordinator for `meta.autoSize` columns. Lives at the core level\n * so every table variant and viewport instance shares one application state.\n */\n autoSize?: DataGridAutoSizeController;\n}\n\n/**\n * Row and column ids are consumer strings; DOM ids cannot carry spaces or\n * quotes. One shared sanitizer so `aria-activedescendant` writers and the id\n * renderers always agree on the same encoding.\n */\nexport function toDataGridDomId(value: string): string {\n return value.replace(/[^\\w-]/g, \"_\");\n}\n\nexport type DataGridAutoSizeController = {\n /**\n * Feeds the controller one viewport measurement: the SIGNED free space\n * between the scroll container and the table, negative while the table\n * overflows. The first sight of a `meta.autoSize` column absorbs the\n * free space into its width; after that, every measurement REFLOWS the\n * same growth - a wider window widens the column, a narrower one gives\n * the space back down to the column's `minSize` (or its starting width\n * when none is set) - so the grid tracks its container live. Commits\n * are coalesced for performance: sub-pixel deltas are dropped, a\n * streaming resize gets one leading commit plus one trailing commit at\n * settle, and a width the user dragged is never touched. Safe to call\n * from every viewport measurement; returns true when a sizing update\n * was dispatched.\n */\n apply: (freeSpace: number) => boolean;\n};\n\ntype DataGridAutoSizeReflowState = {\n applied: { columnId: string; base: number; grown: number } | null;\n settleTimer: ReturnType<typeof setTimeout> | null;\n pendingFreeSpace: number;\n lastCommitAt: number;\n};\n\n/**\n * Bookkeeping keyed on the TABLE STORE, never on a React instance: dev\n * StrictMode double-mounts the tree, so two controller instances serve one\n * page and only the first would remember what it absorbed - the second\n * reads the grown width as a user drag and freezes the column. The store\n * object is the one identity that provably survives that dance (the\n * absorbed sizing rides inside it), and the WeakMap lets a discarded\n * table take its bookkeeping with it.\n */\nconst dataGridAutoSizeStates = new WeakMap<object, DataGridAutoSizeReflowState>();\n\nfunction getDataGridAutoSizeState(store: object): DataGridAutoSizeReflowState {\n let state = dataGridAutoSizeStates.get(store);\n if (!state) {\n state = {\n applied: null,\n settleTimer: null,\n pendingFreeSpace: 0,\n lastCommitAt: 0,\n };\n dataGridAutoSizeStates.set(store, state);\n }\n return state;\n}\n\nfunction createDataGridAutoSizeController<TData extends object>(\n /**\n * A getter, not the table itself.\n *\n * v8 handed back one stable table whose state mutated in place, so a\n * controller could close over it. v9 returns a NEW table wrapper on every\n * state change, and a captured one keeps reporting the state it was built\n * with - here that meant `columnSizing` looked permanently empty, the\n * applied-once guard re-armed on every measurement, and the fill overwrote\n * whatever width the user had just dragged the column to.\n */\n getTable: () => DataGridTableInstance<TData>,\n): DataGridAutoSizeController {\n // Reflow coalescing: a live window drag streams a measurement per frame,\n // and every accepted commit re-renders the table. One leading commit\n // keeps single snaps (a maximize) instant; the rest of the stream parks\n // its latest value behind one trailing timer, so a continuous drag costs\n // two commits instead of sixty a second. The trailing timer may fire\n // after the grid unmounts; it re-reads the table then, and a sizing\n // write to the consumer's store is inert once nothing renders it.\n const SETTLE_MS = 150;\n\n const reflow = (freeSpace: number): boolean => {\n const table = getTable();\n const state = getDataGridAutoSizeState(table.store);\n // LIVE state, never the render snapshot: a measurement can run between\n // our own sizing commit and React's re-render, and the stale snapshot\n // would hide the width this controller just wrote.\n const columnSizing = table.atoms.columnSizing?.get() ?? table.state.columnSizing;\n if (!state.applied) return false;\n const autoSizeColumn = table\n .getVisibleLeafColumns()\n .find((column) => column.columnDef.meta?.autoSize && column.getCanResize());\n if (!autoSizeColumn || autoSizeColumn.id !== state.applied.columnId) return false;\n // A width this coordinator did not write belongs to the user's drag;\n // reflow stands down until a reset re-arms the column.\n const currentSize = columnSizing[state.applied.columnId];\n if (currentSize !== undefined && currentSize !== state.applied.grown) {\n return false;\n }\n // The free space as it would measure with our growth removed; the\n // target re-absorbs exactly that, floored at minSize so a narrow\n // window hands space back without ever crushing the column (no\n // explicit minSize floors at the starting width instead).\n const freeAtBase = freeSpace + (state.applied.grown - state.applied.base);\n const floor = autoSizeColumn.columnDef.minSize ?? state.applied.base;\n const target = Math.max(floor, state.applied.base + freeAtBase);\n if (Math.abs(target - state.applied.grown) < 1) return false;\n state.applied = { ...state.applied, grown: target };\n table.setColumnSizing((old) => ({\n ...old,\n [state.applied!.columnId]: target,\n }));\n return true;\n };\n\n return {\n apply(freeSpace: number) {\n const table = getTable();\n const state = getDataGridAutoSizeState(table.store);\n // Same live read as `reflow`; the snapshot race is what made the\n // re-arm check clear the bookkeeping right after the first absorb.\n const columnSizing = table.atoms.columnSizing?.get() ?? table.state.columnSizing;\n\n // Re-arm after reset flows (double-click resetSize, resetColumnSizing,\n // controlled state replacement) so the column re-fills instead of\n // leaving a dead blank strip.\n if (state.applied && columnSizing[state.applied.columnId] === undefined) {\n state.applied = null;\n }\n\n const autoSizeColumn = table\n .getVisibleLeafColumns()\n .find((column) => column.columnDef.meta?.autoSize && column.getCanResize());\n\n if (autoSizeColumn && state.applied?.columnId === autoSizeColumn.id) {\n state.pendingFreeSpace = freeSpace;\n const now = Date.now();\n if (now - state.lastCommitAt > SETTLE_MS) {\n state.lastCommitAt = now;\n return reflow(freeSpace);\n }\n if (state.settleTimer !== null) clearTimeout(state.settleTimer);\n state.settleTimer = setTimeout(() => {\n state.settleTimer = null;\n state.lastCommitAt = Date.now();\n reflow(state.pendingFreeSpace);\n }, SETTLE_MS);\n return false;\n }\n\n const fillWidth = Math.max(0, freeSpace);\n if (fillWidth <= 0) return false;\n\n if (!autoSizeColumn) {\n return false;\n }\n\n // A width this coordinator did not write belongs to someone else -\n // almost always the user, who just dragged the column's resize handle.\n // Filling over it is what made a `meta.autoSize` column look\n // un-resizable: the drag committed, the next viewport measurement\n // stamped the fill back on top, and the column snapped to its old width.\n //\n // Deliberately keyed on observed state rather than on `state.applied`, which\n // is per-coordinator memory: anything that rebuilds the coordinator\n // (a remount, a new table store) forgets what it did, and the guard has\n // to survive that. An explicit reset clears the entry and re-arms the\n // fill, which is what makes double-click-to-reset still work.\n const currentSize = columnSizing[autoSizeColumn.id];\n if (currentSize !== undefined && currentSize !== state.applied?.grown) {\n return false;\n }\n\n // Candidate switched (e.g. the grown column was hidden and another\n // meta.autoSize column took over): revert the previous growth if the\n // user hasn't manually resized that column since, so visibility\n // toggles cannot ratchet the table wider than its container forever.\n const revert =\n state.applied && columnSizing[state.applied.columnId] === state.applied.grown\n ? state.applied\n : null;\n const base = columnSizing[autoSizeColumn.id] ?? autoSizeColumn.getSize();\n const grown = base + fillWidth;\n\n state.applied = { columnId: autoSizeColumn.id, base, grown };\n table.setColumnSizing((old) => {\n const next = { ...old, [autoSizeColumn.id]: grown };\n if (revert && next[revert.columnId] === revert.grown) {\n next[revert.columnId] = revert.base;\n }\n return next;\n });\n\n return true;\n },\n };\n}\n\nexport type DataGridRequestParams = {\n pageIndex: number;\n pageSize: number;\n sorting?: SortingState;\n columnFilters?: ColumnFiltersState;\n};\n\n/** Which spreadsheet operation produced a cell change batch. */\nexport type DataGridCellsChangeSource = \"paste\" | \"cut\" | \"clear\" | \"fill\" | \"edit\";\n\nexport interface DataGridCellChange<TData> {\n rowId: string;\n columnId: string;\n /** The consumer's row object, so immutable write-back needs no second lookup. */\n row: TData;\n /** Accessor value at dispatch time; enables consumer-side undo stacks. */\n previousValue: unknown;\n /** Typed value produced by `meta.cellEdit.parse`, or `clearValue` for clear/cut. */\n value: unknown;\n}\n\n/** What onCellsCopy receives after the grid writes the clipboard. */\nexport interface DataGridCopyDetails {\n /** The TSV text that reached the clipboard. */\n text: string;\n /** The same content as a row-major grid of formatted fields. */\n grid: string[][];\n /** True when the write came from a cut, which clears the region next. */\n cut: boolean;\n}\n\n/** One resolved positive region, in pre-paginated display indexes. */\nexport interface DataGridCellSelectionBound {\n minRowIndex: number;\n maxRowIndex: number;\n minColumnIndex: number;\n maxColumnIndex: number;\n}\n\n/** What onCellSelectionChange receives, resolved from the live selection. */\nexport interface DataGridCellSelectionSnapshot {\n /** The virtually focused cell, the active range's anchor. Null when clear. */\n focused: { rowId: string; columnId: string } | null;\n /** Every positive region, geometric order. */\n bounds: DataGridCellSelectionBound[];\n /** The most recent region, the one copy and paste act on. */\n activeBound: DataGridCellSelectionBound | null;\n /**\n * Cells of the selection the view can show - the count that matches the\n * painted range and what a batch will touch.\n */\n visibleCellCount: number;\n}\n\nexport interface DataGridCellRejection {\n rowId: string;\n columnId: string;\n raw: string;\n reason: \"readonly\" | \"invalid\";\n}\n\n/**\n * Lifecycle of a row for the optional CRUD indications: \"new\" and \"dirty\"\n * tint the row, \"deleted\" mutes and strikes it. Purely presentational - the\n * consumer's state stays the only owner of what the statuses mean.\n */\nexport type DataGridRowStatus = \"new\" | \"dirty\" | \"deleted\";\n\n/**\n * Lifecycle of a cell for the optional CRUD indications: a corner mark in\n * the amber tone for \"dirty\", the destructive tone for \"invalid\".\n */\nexport type DataGridCellStatus = \"dirty\" | \"invalid\";\n\n/**\n * Asks the consumer to open its editor for the focused cell: Enter or F2, or\n * a typed printable character (then `initialText` carries it, the\n * Notion/Airtable type-to-replace flow). Dispatched only for cells whose\n * column is writable via `meta.cellEdit`.\n */\nexport interface DataGridCellEditRequest<TData> {\n rowId: string;\n columnId: string;\n row: TData;\n previousValue: unknown;\n /** The typed character that started the edit; absent for Enter and F2. */\n initialText?: string;\n}\n\n/**\n * One batch per operation, however many cells it spans: a 10k-cell paste is\n * one callback, one consumer setState, one table rebuild. The grid never\n * writes data itself.\n */\nexport interface DataGridCellsChangeDetails<TData> {\n source: DataGridCellsChangeSource;\n changes: DataGridCellChange<TData>[];\n rejected: DataGridCellRejection[];\n}\n\nexport interface DataGridProps<TFeatures extends TableFeatures, TData extends object> {\n className?: string;\n table?: Table<TFeatures, TData>;\n recordCount: number;\n children?: ReactNode;\n onRowClick?: (row: TData) => void;\n /**\n * Receives every spreadsheet write batch (paste, cut, clear, fill, edit).\n * Served through the props getter like `onRowClick`, so an inline identity\n * never republishes the context. Absent: copy still works, writes no-op.\n */\n onCellsChange?: (details: DataGridCellsChangeDetails<TData>) => void;\n /**\n * Opens the consumer's editor from the keyboard: Enter, F2, or typing on\n * the focused cell. Absent: Enter keeps moving down, typing does nothing.\n */\n onCellEditRequest?: (request: DataGridCellEditRequest<TData>) => void;\n /**\n * Fires on every cell-selection change (focus moves, ranges grow or\n * clear) with a resolved snapshot, so a selection count, formula bar or\n * context panel needs no reach into TanStack internals.\n */\n onCellSelectionChange?: (snapshot: DataGridCellSelectionSnapshot) => void;\n /**\n * Fires after the grid writes the clipboard (Cmd/Ctrl+C or X, or the\n * native copy and cut events), e.g. to confirm with a toast.\n */\n onCellsCopy?: (details: DataGridCopyDetails) => void;\n /**\n * Renders an \"Add row\" affordance as the table body's last row; clicking\n * it is the consumer's cue to start creating a row. Absent: no row.\n */\n onRowCreate?: () => void;\n /** Label of the onRowCreate affordance. Defaults to \"Add row\". */\n rowCreateLabel?: ReactNode;\n /**\n * Rendered inside the table body after the data rows: the slot a DRAFT\n * row lives in while it is being created, before it joins `data` and the\n * pagination math. Supply a `<tr>` of cells; the colgroup sizes them.\n */\n appendRow?: ReactNode;\n /**\n * Optional CRUD indication per row. Return undefined for no indication;\n * omit the prop entirely to render none anywhere.\n */\n getRowStatus?: (row: TData) => DataGridRowStatus | undefined;\n /**\n * Optional CRUD indication per cell: the classic corner mark on cells the\n * consumer tracks as edited or invalid.\n */\n getCellStatus?: (row: TData, columnId: string) => DataGridCellStatus | undefined;\n isLoading?: boolean;\n /**\n * Overrides for every built-in string: menu items, aria labels,\n * pagination copy, state messages. Merged over the defaults; a more\n * specific component prop (`rowCreateLabel`, `loadingMessage`, the\n * pagination label props) still wins over its `i18n` counterpart.\n */\n i18n?: DataGridI18nOverrides;\n loadingMode?: \"skeleton\" | \"spinner\";\n loadingMessage?: ReactNode | string;\n fetchingMoreMessage?: ReactNode | string;\n allRowsLoadedMessage?: ReactNode | string;\n emptyMessage?: ReactNode | string;\n tableLayout?: {\n dense?: boolean;\n cellBorder?: boolean;\n rowBorder?: boolean;\n rowRounded?: boolean;\n stripped?: boolean;\n headerBackground?: boolean;\n footerBackground?: boolean;\n headerBorder?: boolean;\n headerSticky?: boolean;\n width?: \"auto\" | \"fixed\";\n columnsVisibility?: boolean;\n columnsResizable?: boolean;\n columnsResizeMode?: \"onChange\" | \"onEnd\";\n columnsPinnable?: boolean;\n columnsMovable?: boolean;\n columnsDraggable?: boolean;\n rowsDraggable?: boolean;\n rowsPinnable?: boolean;\n /** Spreadsheet cell range selection: mouse ranges, keyboard, clipboard chrome. */\n cellSelection?: boolean;\n /**\n * \"range\" (default): drag, Shift and Ctrl/Cmd gestures and Shift+keys\n * grow multi-cell regions. \"single\": one focused cell only - every\n * gesture collapses to it and Ctrl/Cmd+A is inert.\n */\n cellSelectionMode?: \"single\" | \"range\";\n /** Drag-to-fill handle on the selection corner. Requires cellSelection. */\n cellFillHandle?: boolean;\n /**\n * How a cell opens its editor from the mouse: \"dblclick\" (default,\n * the spreadsheet standard - first click focuses, second edits) or\n * \"click\", opening the editor as soon as a plain click lands on the\n * focused cell; modifier clicks and drags still select.\n */\n cellEditMode?: \"dblclick\" | \"click\";\n /**\n * When true, committing an edit with Enter moves focus down (Shift+Enter\n * up), the Sheets and Excel convention. Off by default: the commit keeps\n * focus on the edited cell. Tab always commits and moves across.\n */\n cellEditEnterAdvance?: boolean;\n /**\n * The handle's look: \"dot\" is a solid primary dot kept inside the\n * cell corner; \"ring\" is the Sheets-style hollow circle riding the\n * corner point, clamped at the grid's own boundary; \"square\" is the\n * Excel-style solid square inside the corner. Default \"dot\".\n */\n cellFillHandleVariant?: \"dot\" | \"ring\" | \"square\";\n };\n tableClassNames?: {\n base?: string;\n header?: string;\n headerRow?: string;\n headerSticky?: string;\n body?: string;\n bodyRow?: string;\n footer?: string;\n edgeCell?: string;\n /** Override the getRowStatus tints; defaults are the warning-muted set. */\n rowNew?: string;\n rowDirty?: string;\n rowDeleted?: string;\n /**\n * Override the pinned-row chrome (muted tint, boundary shadow). A grid\n * that pins a draft row for quick-create wants it to read as an active\n * row, not a muted one.\n */\n rowPinned?: string;\n /** The onRowCreate affordance row, e.g. to match the grid's row height. */\n rowCreate?: string;\n /** The fill handle, e.g. to restyle or resize it beyond the built-in variants. */\n cellFillHandle?: string;\n };\n}\n\nconst DataGridContext = createContext<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n DataGridContextProps<any> | undefined\n>(undefined);\n\n/**\n * Reads the grid context. Pass `TData` from the calling component when the\n * table, a row or a cell is handed on to something typed against that row\n * shape: v9 declares `TData` invariant, so the default `any` no longer\n * unifies with a concrete row type the way it did on v8.\n */\nfunction useDataGrid<\n // biome-ignore lint/suspicious/noExplicitAny: <>\n TData extends object = any,\n>(): DataGridContextProps<TData> {\n const context = useContext(DataGridContext) as DataGridContextProps<TData> | undefined;\n if (!context) {\n throw new Error(\"useDataGrid must be used within a DataGridProvider\");\n }\n return context;\n}\n\nfunction DataGridProvider<TData extends object>({\n children,\n table,\n ...props\n}: DataGridLayoutProps<TData> & {\n table: DataGridTableInstance<TData>;\n children?: ReactNode;\n}) {\n // Latest-props ref: context reads always resolve fresh props through the\n // getter below without the memoized context value depending on unstable\n // Stable for the grid's lifetime; ARIA ids and relations hang off it.\n const gridId = useId();\n // ReactNode/function prop identities (inline emptyMessage/onRowClick would\n // otherwise publish a new context value on every consumer render - at\n // mousemove rate during a resize drag, piercing the body-rows memo).\n const propsRef = useRef(props);\n propsRef.current = props;\n const i18n = mergeDataGridI18n(props.i18n);\n const i18nRef = useRef(i18n);\n i18nRef.current = i18n;\n\n // Same treatment for the table itself, which v9 - unlike v8 - re-creates on\n // every state change. Depending on it directly would republish the context\n // on each resize tick, which is exactly what the memo below exists to\n // prevent; the getter still hands every consumer the current instance.\n const tableRef = useRef(table);\n tableRef.current = table;\n\n // Re-assert an explicit tableLayout resize mode so consumer-level useTable\n // options cannot flip it back between drags. v9 makes `table.options`\n // readonly, so this goes through setOptions in an effect rather than a\n // render-phase mutation. Without an explicit mode, the consumer's own\n // tanstack columnResizeMode (default \"onEnd\") is honored.\n const resizeMode =\n props.tableLayout?.columnsResizable && props.tableLayout.columnsResizeMode\n ? props.tableLayout.columnsResizeMode\n : undefined;\n\n useEffect(() => {\n if (!resizeMode) return;\n if (table.options.columnResizeMode === resizeMode) return;\n table.setOptions((old) => ({ ...old, columnResizeMode: resizeMode }));\n }, [table, resizeMode]);\n\n // With the selection UI on, every paste/fill/clear batch replaces `data`,\n // and the feature's default autoResetCellSelection would wipe the selection\n // after each write. Ranges are row-id based and unresolvable ids drop out\n // of the bounds safely, so keeping state across data edits is the correct\n // default here.\n const cellSelectionOn = !!props.tableLayout?.cellSelection;\n useEffect(() => {\n if (!cellSelectionOn || table.atoms.cellSelection == null) return;\n if (table.options.autoResetCellSelection === false) return;\n table.setOptions((old) => ({ ...old, autoResetCellSelection: false }));\n }, [table, cellSelectionOn]);\n\n // Rendered row indexes re-base per page, so a range kept across a page flip\n // re-lights the same positions over different rows. A page change clears\n // the selection instead - the rule Excel-family grids apply to paginated\n // range selection.\n const pageKey = `${table.state.pagination?.pageIndex}:${table.state.pagination?.pageSize}`;\n const previousPageKeyRef = useRef(pageKey);\n useEffect(() => {\n if (previousPageKeyRef.current === pageKey) return;\n previousPageKeyRef.current = pageKey;\n if (!cellSelectionOn || table.atoms.cellSelection == null) return;\n tableRef.current.resetCellSelection(true);\n }, [pageKey, cellSelectionOn, table.atoms.cellSelection]);\n\n // One autoSize coordinator per table instance so split header/body viewports\n // cannot apply the growth twice. Keyed on `table.store`, which v9 keeps\n // stable for the life of the table, rather than on `table` itself: the\n // wrapper is re-created on every state change, and re-creating the\n // controller with it would reset its applied-once bookkeeping mid-drag.\n const autoSize = useMemo(() => createDataGridAutoSizeController(() => tableRef.current), []);\n\n // Memoize context value so consumers don't re-render during column resize.\n // Column sizing state is intentionally excluded from deps -- CSS variables\n // on the <table> element handle width updates without React re-renders.\n // ReactNode/function props (messages, onRowClick) are also excluded: they\n // are served fresh through the props getter, so unstable inline identities\n // cannot invalidate the context value.\n // `cellSelection` state is excluded on purpose too: a drag writes it once\n // per cell crossed, and nothing reads it through context - cells and the\n // selection bar subscribe to `table.atoms.cellSelection` directly.\n const value = useMemo(\n () => ({\n get props() {\n return propsRef.current;\n },\n get table() {\n return tableRef.current;\n },\n get i18n() {\n return i18nRef.current;\n },\n recordCount: props.recordCount,\n isLoading: props.isLoading || false,\n gridId,\n autoSize,\n }),\n [autoSize, props.recordCount, props.isLoading, gridId],\n );\n\n return (\n // One React context serves every TData, but v9 declares both TFeatures and\n // TData invariant, so a `DataGridContextProps<any>` context cannot accept a\n // `DataGridContextProps<TData>` value structurally. The erasure happens\n // here and is undone by the TData generic on each consumer component.\n <DataGridContext.Provider value={value as unknown as DataGridContextProps<TData>}>\n {children}\n </DataGridContext.Provider>\n );\n}\n\nfunction DataGrid<TFeatures extends TableFeatures, TData extends object>({\n children,\n table,\n ...props\n}: DataGridProps<TFeatures, TData>) {\n const defaultProps: Partial<DataGridProps<TFeatures, TData>> = {\n loadingMode: \"skeleton\",\n tableLayout: {\n dense: false,\n cellBorder: false,\n rowBorder: true,\n rowRounded: false,\n stripped: false,\n headerSticky: false,\n headerBackground: false,\n footerBackground: false,\n headerBorder: true,\n width: \"fixed\",\n columnsVisibility: false,\n columnsResizable: false,\n // columnsResizeMode has no default on purpose: when unset, the\n // consumer's tanstack columnResizeMode (default \"onEnd\") is honored.\n columnsPinnable: false,\n columnsMovable: false,\n columnsDraggable: false,\n rowsDraggable: false,\n rowsPinnable: false,\n cellSelection: false,\n cellFillHandle: false,\n },\n tableClassNames: {\n base: \"\",\n header: \"\",\n headerRow: \"\",\n // z-40 keeps the sticky header above pinned body cells (zIndex 30 in\n // getPinningStyles), which would otherwise paint over it while\n // scrolling vertically with columnsPinnable enabled.\n headerSticky: \"sticky top-0 z-40 bg-background/90 backdrop-blur-xs\",\n body: \"\",\n bodyRow: \"\",\n footer: \"\",\n edgeCell: \"\",\n },\n };\n\n const mergedProps: DataGridProps<TFeatures, TData> = {\n ...defaultProps,\n ...props,\n tableLayout: {\n ...defaultProps.tableLayout,\n ...(props.tableLayout || {}),\n },\n tableClassNames: {\n ...defaultProps.tableClassNames,\n ...(props.tableClassNames || {}),\n },\n };\n\n // Ensure table is provided\n if (!table) {\n throw new Error('DataGrid requires a \"table\" prop');\n }\n\n // The single widening point. Consumers own the TanStack core and may hand\n // over any feature bundle; internals need a concrete one to resolve the\n // feature-gated APIs they call, and v9's invariant TFeatures rules out\n // expressing that with a generic constraint.\n const internalTable = table as unknown as DataGridTableInstance<TData>;\n const internalProps = mergedProps as unknown as DataGridLayoutProps<TData>;\n\n return (\n <DataGridProvider table={internalTable} {...internalProps}>\n {children}\n </DataGridProvider>\n );\n}\n\nfunction DataGridContainer({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n /** Accepted for backwards compatibility; currently has no effect. */\n border?: boolean;\n}) {\n return (\n <div\n data-slot=\"data-grid\"\n // relative: anchors floating chrome composed inside the container,\n // like the fill-drag preview outline.\n className={cn(\"relative w-full overflow-hidden\", className)}\n >\n {children}\n </div>\n );\n}\n\nexport { DataGrid, DataGridContainer, DataGridProvider, useDataGrid };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0IA,MAAa,mBAAmB,cAAc;CAC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AS;EAEzD;CACE,CAAA;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-resource-view.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-resource-view.tsx"],"mappings":";;UA2CU,uCAAuC,UAAU;EACzD;EACA;EACA;;EAEA;;;iBAIO,4BACP,WACA,QACA,cACA,YACA,YACA,UAAU,iBACP,SACF,iDAA8B,IAAA"}
1
+ {"version":3,"file":"event-calendar-resource-view.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-resource-view.tsx"],"mappings":";;UA4CU,uCAAuC,UAAU;EACzD;EACA;EACA;;EAEA;;;iBAIO,4BACP,WACA,QACA,cACA,YACA,YACA,UAAU,iBACP,SACF,iDAA8B,IAAA"}
@@ -4,7 +4,7 @@ import { flattenResources, getDayKey, getDayTotalMinutes, packTimedSegments, res
4
4
  import { EventCalendarViewContext, useEventCalendar, useEventCalendarDay, useEventCalendarSelector, useEventCalendarSettings, useEventCalendarViewConfig, useEventCalendarViewSettings } from "./event-calendar.js";
5
5
  import { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from "./event-calendar-dnd.js";
6
6
  import { EVENT_CALENDAR_GHOST, EVENT_CALENDAR_SLOT_DRAFT, EventCalendarEvent } from "./event-calendar-event.js";
7
- import { EventCalendarNowIndicator, EventCalendarTimeGutter, minuteBlockStyle } from "./event-calendar-time-grid.js";
7
+ import { EVENT_TRACK_WIDTH, EventCalendarNowIndicator, EventCalendarTimeGutter, minuteBlockStyle } from "./event-calendar-time-grid.js";
8
8
  import { useEffect, useMemo, useRef } from "react";
9
9
  import { cn } from "@kumix/utils";
10
10
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -314,13 +314,12 @@ function EventCalendarResourceColumn({ resource, day, startHour, endHour, interv
314
314
  const column = segment.column ?? 0;
315
315
  const span = segment.columnSpan ?? 1;
316
316
  const zIndex = segment.occurrence.event.zIndex ?? 10 + column;
317
- const colPct = 100 / columnCount;
318
317
  return /* @__PURE__ */ jsx("div", {
319
318
  className: "absolute z-(--ec-z) min-h-(--ec-event-min-h,1.5rem) px-0.5 hover:z-40",
320
319
  style: {
321
320
  ...minuteBlockStyle(startMin, endMin, boundsStartMin),
322
- left: `${column * colPct}%`,
323
- width: `${span * colPct}%`,
321
+ left: `calc(${EVENT_TRACK_WIDTH} * ${column / columnCount})`,
322
+ width: `calc(${EVENT_TRACK_WIDTH} * ${span / columnCount})`,
324
323
  "--ec-z": zIndex
325
324
  },
326
325
  children: /* @__PURE__ */ jsx(EventCalendarEvent, {
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-resource-view.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-resource-view.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, useEffect, useMemo, useRef } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, addMinutes } from \"date-fns\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ScrollArea } from \"../../ui/scroll-area\";\nimport {\n EventCalendarViewContext,\n useEventCalendar,\n useEventCalendarDay,\n useEventCalendarSelector,\n useEventCalendarSettings,\n useEventCalendarViewConfig,\n useEventCalendarViewSettings,\n} from \"./event-calendar\";\nimport { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from \"./event-calendar-dnd\";\nimport {\n EVENT_CALENDAR_GHOST,\n EVENT_CALENDAR_SLOT_DRAFT,\n EventCalendarEvent,\n} from \"./event-calendar-event\";\nimport {\n flattenResources,\n getDayKey,\n getDayTotalMinutes,\n packTimedSegments,\n resolveOffDay,\n snapMinutes,\n toZoned,\n zonedStartOfDay,\n} from \"./event-calendar-lib\";\nimport {\n EventCalendarNowIndicator,\n EventCalendarTimeGutter,\n minuteBlockStyle,\n} from \"./event-calendar-time-grid\";\nimport type { EventCalendarResource, EventCalendarSegment } from \"./event-calendar-types\";\n\nconst EMPTY_ALL_DAY_SEGMENTS: EventCalendarSegment[] = [];\n\ninterface EventCalendarResourceViewProps extends useRender.ComponentProps<\"div\"> {\n dayStartHour?: number;\n dayEndHour?: number;\n showAllDay?: boolean;\n /** Gutter/gridline interval in minutes; defaults to the interval view config. */\n interval?: number;\n}\n\n/** Leaf resources become booking columns for the anchor day. */\nfunction EventCalendarResourceView({\n className,\n render,\n dayStartHour,\n dayEndHour,\n showAllDay = true,\n interval: intervalProp,\n ...props\n}: EventCalendarResourceViewProps) {\n const instance = useEventCalendar();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { effective } = useEventCalendarViewSettings();\n const anchorDate = useEventCalendarSelector((state) => state.date, {\n isEqual: (a, b) => a.getTime() === b.getTime(),\n });\n\n const startHour = dayStartHour ?? settings.dayStartHour;\n const endHour = dayEndHour ?? settings.dayEndHour;\n const interval = Math.min(Math.max(intervalProp ?? viewConfig.interval, 5), 240);\n const contained = viewConfig.scrollMode !== \"page\";\n const day = zonedStartOfDay(anchorDate, settings.timeZone);\n\n const resources = useMemo(\n () =>\n flattenResources(settings.resources)\n .filter(({ resource }) => !resource.children?.length)\n .map(({ resource }) => resource),\n [settings.resources],\n );\n\n // Initial scroll + api.scrollToTime (same contract as the time grid)\n const scrollRef = useRef<HTMLDivElement | null>(null);\n useEffect(() => {\n if (!contained) return;\n const el = scrollRef.current;\n if (!el) return;\n const viewport = el.querySelector<HTMLElement>(\"[data-slot=scroll-area-viewport]\");\n const slotRow = el.querySelector<HTMLElement>(\"[data-slot=event-calendar-time-gutter] > div\");\n const slotPx = slotRow?.getBoundingClientRect().height || 64;\n const pxPerMinute = slotPx / interval;\n const scrollTo = (minutes: number) => {\n // keep the hour label above the target line visible (it hangs -top-2)\n viewport?.scrollTo({\n top: Math.max(0, (minutes - startHour * 60) * pxPerMinute - 12),\n });\n };\n scrollTo(viewConfig.scrollToHour * 60);\n instance.internals.registerScrollHandler((time) => {\n const minutes =\n typeof time === \"number\"\n ? time\n : toZoned(time, settings.timeZone).getHours() * 60 +\n toZoned(time, settings.timeZone).getMinutes();\n scrollTo(minutes);\n });\n // Classic (width-consuming) scrollbars squeeze the scrolling track while\n // the header/all-day rows outside keep full width, drifting the column\n // borders. Mirror the measured gutter onto those rows via a CSS var -\n // 0px for overlay scrollbars and the custom ScrollArea, so both modes\n // lay out identically.\n const root = el.closest<HTMLElement>(\n \"[data-slot=event-calendar-time-grid], [data-slot=event-calendar-resource-view]\",\n );\n const syncScrollbarGutter = () => {\n root?.style.setProperty(\n \"--ec-scrollbar-w\",\n `${viewport ? viewport.offsetWidth - viewport.clientWidth : 0}px`,\n );\n };\n syncScrollbarGutter();\n const gutterObserver = viewport ? new ResizeObserver(syncScrollbarGutter) : null;\n if (viewport) gutterObserver?.observe(viewport);\n return () => {\n instance.internals.registerScrollHandler(null);\n gutterObserver?.disconnect();\n };\n }, [contained, instance, settings.timeZone, startHour, interval, viewConfig.scrollToHour]);\n\n const slots = useMemo(() => {\n const result: number[] = [];\n for (let m = startHour * 60; m < endHour * 60; m += interval) {\n result.push(m);\n }\n return result;\n }, [startHour, endHour, interval]);\n\n // All-day segments for renderAllDaySection - the same index bucket the\n // cells read; inert (stable empty array, so the subscription never\n // re-renders) while the override is unset.\n const allDaySegments = useEventCalendarSelector<unknown, EventCalendarSegment[]>(\n () =>\n viewConfig.renderAllDaySection\n ? (instance.internals.getIndex().byDay.get(getDayKey(day, settings.timeZone))?.allDay ??\n EMPTY_ALL_DAY_SEGMENTS)\n : EMPTY_ALL_DAY_SEGMENTS,\n {\n isEqual: (a, b) =>\n a === b || (a.length === b.length && a.every((segment, i) => segment === b[i])),\n },\n );\n\n const gridTemplateColumns = `repeat(${resources.length || 1}, minmax(var(--ec-resource-col-min,8rem), 1fr))`;\n\n const track = (\n <div className=\"relative flex\">\n {/* shared gutter component, so renderTimeGutterSlot and\n classNames.timeGutter customizations apply here too */}\n <EventCalendarTimeGutter\n days={[day]}\n slots={slots}\n startHour={startHour}\n interval={interval}\n />\n <div className=\"grid min-w-0 flex-1\" style={{ gridTemplateColumns }}>\n {resources.map((resource) => (\n <EventCalendarResourceColumn\n key={resource.id}\n resource={resource}\n day={day}\n startHour={startHour}\n endHour={endHour}\n interval={interval}\n />\n ))}\n </div>\n {effective.nowIndicator && (\n <EventCalendarNowIndicator days={[day]} startHour={startHour} endHour={endHour} />\n )}\n </div>\n );\n\n const defaultProps = {\n \"data-slot\": \"event-calendar-resource-view\",\n \"data-view\": \"resource\",\n className: cn(\n \"flex flex-col border-t\",\n contained && \"min-h-0 flex-1 overflow-hidden\",\n viewConfig.classNames?.timeGrid,\n className,\n ),\n style: { \"--ec-hour-height\": \"4rem\" } as CSSProperties,\n children: (\n <>\n {/* Resource header row */}\n <div\n className={cn(\n \"flex border-b pe-(--ec-scrollbar-w,0px)\",\n !contained && \"sticky top-(--ec-sticky-offset,0px) z-20 bg-background\",\n viewConfig.classNames?.timeGridHeader,\n )}\n >\n <div className=\"w-(--ec-gutter-width,4.5rem) shrink-0 border-e\" />\n <div className=\"grid min-w-0 flex-1\" style={{ gridTemplateColumns }}>\n {resources.map((resource) => (\n <div\n key={resource.id}\n data-slot=\"event-calendar-resource-header\"\n className={cn(\n \"min-w-0 truncate border-e px-2 py-1.5 text-center font-medium last:border-e-0\",\n viewConfig.classNames?.resourceHeader,\n )}\n >\n {viewConfig.renderResourceHeader?.({ resource }) ?? resource.title}\n </div>\n ))}\n </div>\n </div>\n {/* All-day row per resource */}\n {showAllDay && (\n <div\n data-slot=\"event-calendar-all-day-section\"\n className={cn(\n \"flex border-b pe-(--ec-scrollbar-w,0px)\",\n viewConfig.classNames?.allDaySection,\n )}\n >\n {viewConfig.renderAllDaySection?.({\n days: [day],\n segments: allDaySegments,\n }) ?? (\n <>\n <div\n className={cn(\n // pt-1.5 matches the all-day cell's top inset; the inner box is\n // one bar-row tall and centers the label so it sits on the SAME\n // baseline as the first all-day chip and stays top-aligned when\n // the chips wrap onto more lanes (mirrors the time-grid label)\n \"w-(--ec-gutter-width,4.5rem) shrink-0 border-e ps-2 pe-2.5 pt-1.5 text-muted-foreground\",\n viewConfig.classNames?.allDayLabel,\n )}\n >\n <span className=\"flex h-[calc(var(--ec-month-bar-h,1.625rem)-0.125rem)] items-center justify-end\">\n {settings.i18n.labels.allDay}\n </span>\n </div>\n <div className=\"grid min-w-0 flex-1\" style={{ gridTemplateColumns }}>\n {resources.map((resource) => (\n <EventCalendarResourceAllDayCell\n key={resource.id}\n resource={resource}\n day={day}\n />\n ))}\n </div>\n </>\n )}\n </div>\n )}\n {contained ? (\n <div ref={scrollRef} className=\"min-h-0 flex-1\">\n {viewConfig.scrollbars === \"native\" ? (\n <div\n data-slot=\"scroll-area-viewport\"\n data-ec-native-scroll=\"\"\n className=\"h-full overflow-y-auto\"\n >\n {track}\n </div>\n ) : (\n <ScrollArea className=\"h-full\">{track}</ScrollArea>\n )}\n </div>\n ) : (\n track\n )}\n </>\n ),\n };\n\n return (\n <EventCalendarViewContext.Provider value={{ view: \"resource\" }}>\n {useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n })}\n </EventCalendarViewContext.Provider>\n );\n}\n\nfunction EventCalendarResourceAllDayCell({\n resource,\n day,\n}: {\n resource: EventCalendarResource;\n day: Date;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { effective } = useEventCalendarViewSettings();\n const gestures = useEventCalendarGestures();\n const { segments } = useEventCalendarDay(day);\n const mine = segments.allDay.filter(\n (segment) => segment.occurrence.event.resourceId === resource.id,\n );\n const dayStart = zonedStartOfDay(day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const isOff = resolveOffDay(\n day,\n settings.timeZone,\n effective.offDays\n ? typeof viewConfig.offDays === \"object\"\n ? viewConfig.offDays\n : true\n : false,\n settings.weekendDays,\n );\n const offClassName =\n (typeof viewConfig.offDays === \"object\" && viewConfig.offDays.className) || \"bg-muted/25\";\n const isDropTarget = useEventCalendarSelector<unknown, \"valid\" | \"invalid\" | null>((state) => {\n const drag = state.drag;\n if (!drag?.proposedDayGranular) return null;\n const covered = drag.proposedStart < dayEnd && drag.proposedEnd > dayStart;\n if (!covered) return null;\n return drag.valid ? \"valid\" : \"invalid\";\n });\n // Slot-draft highlight, mirroring the time-grid all-day cell. The dnd\n // layer's all-day create branch does not plumb resourceId into the draft,\n // so every resource cell covering the day highlights together.\n const inDraft = useEventCalendarSelector<unknown, boolean>((state) => {\n const draft = state.slotDraft;\n if (!draft?.allDay) return false;\n return draft.start < dayEnd && draft.end > dayStart;\n });\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: pointer/gesture surface; keyboard via toolbar\n <div\n data-slot=\"event-calendar-all-day-cell\"\n // data-ec-day makes this a DnD day target: without it collectSurface()\n // finds no cells and dragging an all-day chip silently converts it to\n // a timed event via the column branch\n data-ec-day={dayStart.getTime()}\n data-drop-target={isDropTarget ?? undefined}\n data-off={isOff || undefined}\n className={cn(\n // reserve one bar row so the all-day row keeps the same height with or\n // without events, matching the time-grid all-day row (which reserves\n // the same via its bars-grid minHeight)\n \"relative flex min-h-[calc(var(--ec-month-bar-h,1.625rem)+0.625rem)] min-w-0 flex-col gap-0.5 border-e px-1 py-1.5 last:border-e-0\",\n isOff && offClassName,\n viewConfig.dayClassName?.(day),\n inDraft &&\n cn(\n EVENT_CALENDAR_SLOT_DRAFT.surface,\n EVENT_CALENDAR_SLOT_DRAFT.segment,\n EVENT_CALENDAR_SLOT_DRAFT.segmentStart,\n EVENT_CALENDAR_SLOT_DRAFT.segmentEnd,\n viewConfig.classNames?.slotDraft,\n ),\n viewConfig.classNames?.allDayCell,\n )}\n onPointerDown={(e) => {\n if (e.target === e.currentTarget) gestures.beginCreate(e, day, true);\n }}\n onClick={(e) => {\n if (e.target === e.currentTarget && !wasRecentDrag() && !wasRecentChipPress()) {\n settings.onSlotClick?.(\n {\n date: dayStart,\n allDay: true,\n view: \"resource\",\n resourceId: resource.id,\n },\n e,\n );\n }\n }}\n >\n {mine.map((segment) => (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n // one bar-row tall, matching the time-grid all-day bars so the row\n // height stays identical across views (and equals the reserved min)\n className=\"h-[calc(var(--ec-month-bar-h,1.625rem)-0.125rem)]\"\n />\n ))}\n {isDropTarget && (\n <span\n aria-hidden\n data-slot=\"event-calendar-drop-indicator\"\n data-drop-target={isDropTarget}\n className={cn(\n \"pointer-events-none absolute inset-0.5 z-10 rounded-sm border border-dashed\",\n isDropTarget === \"valid\" ? \"border-primary/50\" : \"border-destructive/60\",\n viewConfig.classNames?.dropIndicator,\n )}\n />\n )}\n </div>\n );\n}\n\nfunction EventCalendarResourceColumn({\n resource,\n day,\n startHour,\n endHour,\n interval,\n}: {\n resource: EventCalendarResource;\n day: Date;\n startHour: number;\n endHour: number;\n interval: number;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { effective } = useEventCalendarViewSettings();\n const gestures = useEventCalendarGestures();\n const { segments, isToday } = useEventCalendarDay(day);\n const isOff = resolveOffDay(\n day,\n settings.timeZone,\n effective.offDays\n ? typeof viewConfig.offDays === \"object\"\n ? viewConfig.offDays\n : true\n : false,\n settings.weekendDays,\n );\n const offClassName =\n (typeof viewConfig.offDays === \"object\" && viewConfig.offDays.className) || \"bg-muted/25\";\n\n const timeZone = settings.timeZone;\n const dayStart = zonedStartOfDay(day, timeZone);\n const totalMinutes = getDayTotalMinutes(day, timeZone);\n const boundsStartMin = startHour * 60;\n const boundsEndMin = Math.min(endHour * 60, totalMinutes);\n const boundsMinutes = Math.max(60, boundsEndMin - boundsStartMin);\n\n // Filter this resource's timed segments and repack per column.\n // Clones keep the shared index cache untouched. Segments the day bounds clip\n // away are dropped here too, otherwise they hold a column nobody can see and\n // leave a phantom empty half beside the first in-bounds chip.\n const packed = useMemo(() => {\n const mine = segments.timed\n .filter((segment) => {\n if (segment.occurrence.event.resourceId !== resource.id) return false;\n const startMin = Math.max(segment.startMin ?? 0, boundsStartMin);\n const endMin = Math.min(segment.endMin ?? startMin, boundsEndMin);\n return endMin > boundsStartMin && startMin < boundsEndMin;\n })\n .map((segment) => ({ ...segment }) as EventCalendarSegment);\n packTimedSegments(mine);\n return mine;\n }, [segments.timed, resource.id, boundsStartMin, boundsEndMin]);\n\n const dragGhost = useEventCalendarSelector<\n unknown,\n {\n window: [number, number];\n valid: boolean;\n kind: string;\n color?: string;\n title: string;\n occurrence: EventCalendarSegment[\"occurrence\"];\n proposedStart: Date;\n proposedEnd: Date;\n } | null\n >(\n (state) => {\n const drag = state.drag;\n if (!drag || drag.proposedDayGranular) return null;\n // Moves carry a proposedResourceId (they can cross columns); resizes stay\n // in place and leave it undefined, so fall back to the event's own\n // resource - otherwise the resize ghost is filtered out of every column.\n const targetResourceId = drag.proposedResourceId ?? drag.occurrence.event.resourceId;\n if (targetResourceId !== resource.id) return null;\n const from = Math.max(\n (drag.proposedStart.getTime() - dayStart.getTime()) / 60000,\n boundsStartMin,\n );\n const to = Math.min((drag.proposedEnd.getTime() - dayStart.getTime()) / 60000, boundsEndMin);\n if (to <= from) return null;\n return {\n window: [from, to] as [number, number],\n valid: drag.valid,\n kind: drag.kind,\n color: drag.occurrence.event.color,\n title: drag.occurrence.event.title,\n occurrence: drag.occurrence,\n proposedStart: drag.proposedStart,\n proposedEnd: drag.proposedEnd,\n };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null &&\n b !== null &&\n a.window[0] === b.window[0] &&\n a.window[1] === b.window[1] &&\n a.valid === b.valid &&\n a.proposedStart.getTime() === b.proposedStart.getTime() &&\n a.proposedEnd.getTime() === b.proposedEnd.getTime()),\n },\n );\n\n // Instants behind `draftWindow` below, for the range readout. Same\n // resource filter, so a draft on a neighbouring resource never labels this\n // column.\n const draftRange = useEventCalendarSelector<unknown, { start: Date; end: Date } | null>(\n (state) => {\n const draft = state.slotDraft;\n if (!draft || draft.allDay || draft.resourceId !== resource.id) {\n return null;\n }\n return { start: draft.start, end: draft.end };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null &&\n b !== null &&\n a.start.getTime() === b.start.getTime() &&\n a.end.getTime() === b.end.getTime()),\n },\n );\n\n const draftWindow = useEventCalendarSelector<unknown, [number, number] | null>(\n (state) => {\n const draft = state.slotDraft;\n if (!draft || draft.allDay || draft.resourceId !== resource.id) {\n return null;\n }\n const from = Math.max((draft.start.getTime() - dayStart.getTime()) / 60000, boundsStartMin);\n const to = Math.min((draft.end.getTime() - dayStart.getTime()) / 60000, boundsEndMin);\n return to > from ? [from, to] : null;\n },\n {\n isEqual: (a, b) => a === b || (a !== null && b !== null && a[0] === b[0] && a[1] === b[1]),\n },\n );\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: pointer/gesture surface; keyboard via toolbar\n <div\n data-slot=\"event-calendar-day-column\"\n data-today={isToday || undefined}\n data-off={isOff || undefined}\n data-ec-day={dayStart.getTime()}\n data-ec-bounds-start={boundsStartMin}\n data-ec-bounds-end={boundsEndMin}\n data-ec-resource={resource.id}\n data-drop-target={dragGhost ? (dragGhost.valid ? \"valid\" : \"invalid\") : undefined}\n role=\"group\"\n aria-label={resource.title}\n className={cn(\n \"relative min-w-0 border-e last:border-e-0\",\n isOff && offClassName,\n // the resource view is a single day, so today gets no column tint (the\n // header marks it); only a consumer todayClassName can tint it\n isToday && viewConfig.todayClassName,\n viewConfig.dayClassName?.(day),\n viewConfig.classNames?.dayColumn,\n )}\n style={{\n height: `calc(var(--ec-hour-height) * ${boundsMinutes / 60})`,\n backgroundImage: `repeating-linear-gradient(to bottom, transparent, transparent calc(var(--ec-hour-height) * ${interval / 60} - var(--ec-slot-line-width, 1px)), var(--ec-slot-line-color, var(--color-border)) calc(var(--ec-hour-height) * ${interval / 60} - var(--ec-slot-line-width, 1px)), var(--ec-slot-line-color, var(--color-border)) calc(var(--ec-hour-height) * ${interval / 60}))`,\n }}\n onPointerDown={(e) => {\n if (e.target === e.currentTarget) gestures.beginCreate(e, day, false);\n }}\n onClick={(e) => {\n if (e.target !== e.currentTarget || wasRecentDrag() || wasRecentChipPress()) return;\n const rect = e.currentTarget.getBoundingClientRect();\n const pxPerMinute = rect.height / boundsMinutes;\n const minutes = snapMinutes(\n boundsStartMin + (e.clientY - rect.top) / pxPerMinute,\n settings.snapDuration,\n );\n const clamped = Math.min(\n Math.max(minutes, boundsStartMin),\n boundsEndMin - settings.slotDuration,\n );\n settings.onSlotClick?.(\n {\n date: addMinutes(dayStart, clamped),\n end: addMinutes(dayStart, clamped + settings.slotDuration),\n allDay: false,\n view: \"resource\",\n resourceId: resource.id,\n },\n e,\n );\n }}\n >\n {packed.map((segment) => {\n const startMin = Math.max(segment.startMin ?? 0, boundsStartMin);\n const endMin = Math.min(segment.endMin ?? startMin, boundsEndMin);\n if (endMin <= boundsStartMin || startMin >= boundsEndMin) return null;\n const columnCount = segment.columnCount ?? 1;\n const column = segment.column ?? 0;\n const span = segment.columnSpan ?? 1;\n const zIndex = segment.occurrence.event.zIndex ?? 10 + column;\n // Strict side-by-side columns - no cascade overlap (fade-truncate +\n // hover reveal carry the legibility); the ring separates neighbors.\n const colPct = 100 / columnCount;\n return (\n <div\n key={segment.occurrence.key}\n // min-h keeps 15-min chips readable (Google-style: the block may\n // slightly outgrow its true window); hover raises a squeezed\n // cascade chip above its overlapping neighbors\n className=\"absolute z-(--ec-z) min-h-(--ec-event-min-h,1.5rem) px-0.5 hover:z-40\"\n style={\n {\n ...minuteBlockStyle(startMin, endMin, boundsStartMin),\n left: `${column * colPct}%`,\n width: `${span * colPct}%`,\n \"--ec-z\": zIndex,\n } as CSSProperties\n }\n >\n <EventCalendarEvent\n segment={segment}\n className={cn(\n columnCount > 1 && \"ring-1 ring-background\",\n // short chips: single centered row, exact-fit line height so\n // the title never slices mid-glyph\n endMin - startMin < viewConfig.compactEventMinutes\n ? \"h-full gap-1 py-0 leading-4\"\n : \"h-full flex-col items-start justify-start gap-0 py-1\",\n viewConfig.classNames?.timedChip,\n )}\n />\n </div>\n );\n })}\n {/* Standardized ghost (EVENT_CALENDAR_GHOST): faint drop placeholder\n for moves (the cursor-attached carry clone owns the visual), dashed\n clone for resizes, destructive marking when invalid. */}\n {dragGhost && (\n <div\n data-slot=\"event-calendar-drag-ghost\"\n data-kind={dragGhost.kind}\n data-drop-invalid={!dragGhost.valid || undefined}\n className={cn(\n \"pointer-events-none absolute inset-x-0.5 z-50 min-h-(--ec-event-min-h,1.5rem)\",\n dragGhost.kind === \"move\"\n ? cn(EVENT_CALENDAR_GHOST.move, !dragGhost.valid && EVENT_CALENDAR_GHOST.invalid)\n : cn(\n EVENT_CALENDAR_GHOST.resize,\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidResize,\n ),\n viewConfig.classNames?.dragGhost,\n )}\n style={\n {\n ...minuteBlockStyle(dragGhost.window[0], dragGhost.window[1], boundsStartMin),\n \"--ec-event-color\": dragGhost.color ?? \"var(--color-primary)\",\n } as CSSProperties\n }\n >\n {dragGhost.kind !== \"move\" && (\n <EventCalendarEvent\n preview\n segment={{\n occurrence: {\n ...dragGhost.occurrence,\n start: dragGhost.proposedStart,\n end: dragGhost.proposedEnd,\n allDay: false,\n },\n day,\n isStart: true,\n isEnd: true,\n continuesBefore: false,\n continuesAfter: false,\n startMin: dragGhost.window[0],\n endMin: dragGhost.window[1],\n }}\n className={cn(\n dragGhost.window[1] - dragGhost.window[0] < viewConfig.compactEventMinutes\n ? \"h-full gap-1 py-0 leading-4\"\n : \"h-full flex-col items-start justify-start gap-0 py-1\",\n viewConfig.classNames?.timedChip,\n \"inset-ring-0\",\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidContent,\n )}\n />\n )}\n </div>\n )}\n {draftWindow && (\n <div\n data-slot=\"event-calendar-slot-draft\"\n className={cn(\n EVENT_CALENDAR_SLOT_DRAFT.box,\n \"pointer-events-none absolute inset-x-0.5 z-40 overflow-hidden\",\n viewConfig.classNames?.slotDraft,\n )}\n style={minuteBlockStyle(draftWindow[0], draftWindow[1], boundsStartMin)}\n >\n {draftRange && (\n <span className={cn(\"block\", EVENT_CALENDAR_SLOT_DRAFT.label)}>\n {settings.i18n.functions.formatEventTime(\n toZoned(draftRange.start, settings.timeZone),\n toZoned(draftRange.end, settings.timeZone),\n false,\n { locale: settings.locale },\n )}\n </span>\n )}\n </div>\n )}\n </div>\n );\n}\n\nexport type { EventCalendarResourceViewProps };\nexport { EventCalendarResourceView };\n"],"mappings":";;;;;;;;;;;;;;AAyCA,MAAM,yBAAiD,CAAC;;AAWxD,SAAS,0BAA0B,EACjC,WACA,QACA,cACA,YACA,aAAa,MACb,UAAU,cACV,GAAG,SAC8B;CACjC,MAAM,WAAW,iBAAiB;CAClC,MAAM,WAAW,yBAAyB;CAC1C,MAAM,aAAa,2BAA2B;CAC9C,MAAM,EAAE,cAAc,6BAA6B;CACnD,MAAM,aAAa,0BAA0B,UAAU,MAAM,MAAM,EACjE,UAAU,GAAG,MAAM,EAAE,QAAQ,MAAM,EAAE,QAAQ,EAC/C,CAAC;CAED,MAAM,YAAY,gBAAgB,SAAS;CAC3C,MAAM,UAAU,cAAc,SAAS;CACvC,MAAM,WAAW,KAAK,IAAI,KAAK,IAAI,gBAAgB,WAAW,UAAU,CAAC,GAAG,GAAG;CAC/E,MAAM,YAAY,WAAW,eAAe;CAC5C,MAAM,MAAM,gBAAgB,YAAY,SAAS,QAAQ;CAEzD,MAAM,YAAY,cAEd,iBAAiB,SAAS,SAAS,CAAC,CACjC,QAAQ,EAAE,eAAe,CAAC,SAAS,UAAU,MAAM,CAAC,CACpD,KAAK,EAAE,eAAe,QAAQ,GACnC,CAAC,SAAS,SAAS,CACrB;CAGA,MAAM,YAAY,OAA8B,IAAI;CACpD,gBAAgB;EACd,IAAI,CAAC,WAAW;EAChB,MAAM,KAAK,UAAU;EACrB,IAAI,CAAC,IAAI;EACT,MAAM,WAAW,GAAG,cAA2B,kCAAkC;EAGjF,MAAM,eAFU,GAAG,cAA2B,8CACzB,CAAC,EAAE,sBAAsB,CAAC,CAAC,UAAU,MAC7B;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AU,OAAO,KAAK,UAAU,OAAO,KAAK,WAAW,sBACnD,gCACA,wDACJ,WAAW,YAAY,WACvB,gBACA,CAAC,UAAU,SAAS,qBAAqB,cAC3C;IACD,CAAA;GAEA,CAAA;GAEN,eACC,oBAAC,OAAD;IACE,aAAU;IACV,WAAW,GACT,0BAA0B,KAC1B,iEACA,WAAW,YAAY,SACzB;IACA,OAAO,iBAAiB,YAAY,IAAI,YAAY,IAAI,cAAc;IAErE,UAAA,cACC,oBAAC,QAAD;KAAM,WAAW,GAAG,SAAS,0BAA0B,KAAK;KACzD,UAAA,SAAS,KAAK,UAAU,gBACvB,QAAQ,WAAW,OAAO,SAAS,QAAQ,GAC3C,QAAQ,WAAW,KAAK,SAAS,QAAQ,GACzC,OACA,EAAE,QAAQ,SAAS,OAAO,CAC5B;IACI,CAAA;GAEL,CAAA;EAEJ;;AAET"}
1
+ {"version":3,"file":"event-calendar-resource-view.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-resource-view.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, useEffect, useMemo, useRef } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, addMinutes } from \"date-fns\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ScrollArea } from \"../../ui/scroll-area\";\nimport {\n EventCalendarViewContext,\n useEventCalendar,\n useEventCalendarDay,\n useEventCalendarSelector,\n useEventCalendarSettings,\n useEventCalendarViewConfig,\n useEventCalendarViewSettings,\n} from \"./event-calendar\";\nimport { useEventCalendarGestures, wasRecentChipPress, wasRecentDrag } from \"./event-calendar-dnd\";\nimport {\n EVENT_CALENDAR_GHOST,\n EVENT_CALENDAR_SLOT_DRAFT,\n EventCalendarEvent,\n} from \"./event-calendar-event\";\nimport {\n flattenResources,\n getDayKey,\n getDayTotalMinutes,\n packTimedSegments,\n resolveOffDay,\n snapMinutes,\n toZoned,\n zonedStartOfDay,\n} from \"./event-calendar-lib\";\nimport {\n EVENT_TRACK_WIDTH,\n EventCalendarNowIndicator,\n EventCalendarTimeGutter,\n minuteBlockStyle,\n} from \"./event-calendar-time-grid\";\nimport type { EventCalendarResource, EventCalendarSegment } from \"./event-calendar-types\";\n\nconst EMPTY_ALL_DAY_SEGMENTS: EventCalendarSegment[] = [];\n\ninterface EventCalendarResourceViewProps extends useRender.ComponentProps<\"div\"> {\n dayStartHour?: number;\n dayEndHour?: number;\n showAllDay?: boolean;\n /** Gutter/gridline interval in minutes; defaults to the interval view config. */\n interval?: number;\n}\n\n/** Leaf resources become booking columns for the anchor day. */\nfunction EventCalendarResourceView({\n className,\n render,\n dayStartHour,\n dayEndHour,\n showAllDay = true,\n interval: intervalProp,\n ...props\n}: EventCalendarResourceViewProps) {\n const instance = useEventCalendar();\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { effective } = useEventCalendarViewSettings();\n const anchorDate = useEventCalendarSelector((state) => state.date, {\n isEqual: (a, b) => a.getTime() === b.getTime(),\n });\n\n const startHour = dayStartHour ?? settings.dayStartHour;\n const endHour = dayEndHour ?? settings.dayEndHour;\n const interval = Math.min(Math.max(intervalProp ?? viewConfig.interval, 5), 240);\n const contained = viewConfig.scrollMode !== \"page\";\n const day = zonedStartOfDay(anchorDate, settings.timeZone);\n\n const resources = useMemo(\n () =>\n flattenResources(settings.resources)\n .filter(({ resource }) => !resource.children?.length)\n .map(({ resource }) => resource),\n [settings.resources],\n );\n\n // Initial scroll + api.scrollToTime (same contract as the time grid)\n const scrollRef = useRef<HTMLDivElement | null>(null);\n useEffect(() => {\n if (!contained) return;\n const el = scrollRef.current;\n if (!el) return;\n const viewport = el.querySelector<HTMLElement>(\"[data-slot=scroll-area-viewport]\");\n const slotRow = el.querySelector<HTMLElement>(\"[data-slot=event-calendar-time-gutter] > div\");\n const slotPx = slotRow?.getBoundingClientRect().height || 64;\n const pxPerMinute = slotPx / interval;\n const scrollTo = (minutes: number) => {\n // keep the hour label above the target line visible (it hangs -top-2)\n viewport?.scrollTo({\n top: Math.max(0, (minutes - startHour * 60) * pxPerMinute - 12),\n });\n };\n scrollTo(viewConfig.scrollToHour * 60);\n instance.internals.registerScrollHandler((time) => {\n const minutes =\n typeof time === \"number\"\n ? time\n : toZoned(time, settings.timeZone).getHours() * 60 +\n toZoned(time, settings.timeZone).getMinutes();\n scrollTo(minutes);\n });\n // Classic (width-consuming) scrollbars squeeze the scrolling track while\n // the header/all-day rows outside keep full width, drifting the column\n // borders. Mirror the measured gutter onto those rows via a CSS var -\n // 0px for overlay scrollbars and the custom ScrollArea, so both modes\n // lay out identically.\n const root = el.closest<HTMLElement>(\n \"[data-slot=event-calendar-time-grid], [data-slot=event-calendar-resource-view]\",\n );\n const syncScrollbarGutter = () => {\n root?.style.setProperty(\n \"--ec-scrollbar-w\",\n `${viewport ? viewport.offsetWidth - viewport.clientWidth : 0}px`,\n );\n };\n syncScrollbarGutter();\n const gutterObserver = viewport ? new ResizeObserver(syncScrollbarGutter) : null;\n if (viewport) gutterObserver?.observe(viewport);\n return () => {\n instance.internals.registerScrollHandler(null);\n gutterObserver?.disconnect();\n };\n }, [contained, instance, settings.timeZone, startHour, interval, viewConfig.scrollToHour]);\n\n const slots = useMemo(() => {\n const result: number[] = [];\n for (let m = startHour * 60; m < endHour * 60; m += interval) {\n result.push(m);\n }\n return result;\n }, [startHour, endHour, interval]);\n\n // All-day segments for renderAllDaySection - the same index bucket the\n // cells read; inert (stable empty array, so the subscription never\n // re-renders) while the override is unset.\n const allDaySegments = useEventCalendarSelector<unknown, EventCalendarSegment[]>(\n () =>\n viewConfig.renderAllDaySection\n ? (instance.internals.getIndex().byDay.get(getDayKey(day, settings.timeZone))?.allDay ??\n EMPTY_ALL_DAY_SEGMENTS)\n : EMPTY_ALL_DAY_SEGMENTS,\n {\n isEqual: (a, b) =>\n a === b || (a.length === b.length && a.every((segment, i) => segment === b[i])),\n },\n );\n\n const gridTemplateColumns = `repeat(${resources.length || 1}, minmax(var(--ec-resource-col-min,8rem), 1fr))`;\n\n const track = (\n <div className=\"relative flex\">\n {/* shared gutter component, so renderTimeGutterSlot and\n classNames.timeGutter customizations apply here too */}\n <EventCalendarTimeGutter\n days={[day]}\n slots={slots}\n startHour={startHour}\n interval={interval}\n />\n <div className=\"grid min-w-0 flex-1\" style={{ gridTemplateColumns }}>\n {resources.map((resource) => (\n <EventCalendarResourceColumn\n key={resource.id}\n resource={resource}\n day={day}\n startHour={startHour}\n endHour={endHour}\n interval={interval}\n />\n ))}\n </div>\n {effective.nowIndicator && (\n <EventCalendarNowIndicator days={[day]} startHour={startHour} endHour={endHour} />\n )}\n </div>\n );\n\n const defaultProps = {\n \"data-slot\": \"event-calendar-resource-view\",\n \"data-view\": \"resource\",\n className: cn(\n \"flex flex-col border-t\",\n contained && \"min-h-0 flex-1 overflow-hidden\",\n viewConfig.classNames?.timeGrid,\n className,\n ),\n style: { \"--ec-hour-height\": \"4rem\" } as CSSProperties,\n children: (\n <>\n {/* Resource header row */}\n <div\n className={cn(\n \"flex border-b pe-(--ec-scrollbar-w,0px)\",\n !contained && \"sticky top-(--ec-sticky-offset,0px) z-20 bg-background\",\n viewConfig.classNames?.timeGridHeader,\n )}\n >\n <div className=\"w-(--ec-gutter-width,4.5rem) shrink-0 border-e\" />\n <div className=\"grid min-w-0 flex-1\" style={{ gridTemplateColumns }}>\n {resources.map((resource) => (\n <div\n key={resource.id}\n data-slot=\"event-calendar-resource-header\"\n className={cn(\n \"min-w-0 truncate border-e px-2 py-1.5 text-center font-medium last:border-e-0\",\n viewConfig.classNames?.resourceHeader,\n )}\n >\n {viewConfig.renderResourceHeader?.({ resource }) ?? resource.title}\n </div>\n ))}\n </div>\n </div>\n {/* All-day row per resource */}\n {showAllDay && (\n <div\n data-slot=\"event-calendar-all-day-section\"\n className={cn(\n \"flex border-b pe-(--ec-scrollbar-w,0px)\",\n viewConfig.classNames?.allDaySection,\n )}\n >\n {viewConfig.renderAllDaySection?.({\n days: [day],\n segments: allDaySegments,\n }) ?? (\n <>\n <div\n className={cn(\n // pt-1.5 matches the all-day cell's top inset; the inner box is\n // one bar-row tall and centers the label so it sits on the SAME\n // baseline as the first all-day chip and stays top-aligned when\n // the chips wrap onto more lanes (mirrors the time-grid label)\n \"w-(--ec-gutter-width,4.5rem) shrink-0 border-e ps-2 pe-2.5 pt-1.5 text-muted-foreground\",\n viewConfig.classNames?.allDayLabel,\n )}\n >\n <span className=\"flex h-[calc(var(--ec-month-bar-h,1.625rem)-0.125rem)] items-center justify-end\">\n {settings.i18n.labels.allDay}\n </span>\n </div>\n <div className=\"grid min-w-0 flex-1\" style={{ gridTemplateColumns }}>\n {resources.map((resource) => (\n <EventCalendarResourceAllDayCell\n key={resource.id}\n resource={resource}\n day={day}\n />\n ))}\n </div>\n </>\n )}\n </div>\n )}\n {contained ? (\n <div ref={scrollRef} className=\"min-h-0 flex-1\">\n {viewConfig.scrollbars === \"native\" ? (\n <div\n data-slot=\"scroll-area-viewport\"\n data-ec-native-scroll=\"\"\n className=\"h-full overflow-y-auto\"\n >\n {track}\n </div>\n ) : (\n <ScrollArea className=\"h-full\">{track}</ScrollArea>\n )}\n </div>\n ) : (\n track\n )}\n </>\n ),\n };\n\n return (\n <EventCalendarViewContext.Provider value={{ view: \"resource\" }}>\n {useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n })}\n </EventCalendarViewContext.Provider>\n );\n}\n\nfunction EventCalendarResourceAllDayCell({\n resource,\n day,\n}: {\n resource: EventCalendarResource;\n day: Date;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { effective } = useEventCalendarViewSettings();\n const gestures = useEventCalendarGestures();\n const { segments } = useEventCalendarDay(day);\n const mine = segments.allDay.filter(\n (segment) => segment.occurrence.event.resourceId === resource.id,\n );\n const dayStart = zonedStartOfDay(day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const isOff = resolveOffDay(\n day,\n settings.timeZone,\n effective.offDays\n ? typeof viewConfig.offDays === \"object\"\n ? viewConfig.offDays\n : true\n : false,\n settings.weekendDays,\n );\n const offClassName =\n (typeof viewConfig.offDays === \"object\" && viewConfig.offDays.className) || \"bg-muted/25\";\n const isDropTarget = useEventCalendarSelector<unknown, \"valid\" | \"invalid\" | null>((state) => {\n const drag = state.drag;\n if (!drag?.proposedDayGranular) return null;\n const covered = drag.proposedStart < dayEnd && drag.proposedEnd > dayStart;\n if (!covered) return null;\n return drag.valid ? \"valid\" : \"invalid\";\n });\n // Slot-draft highlight, mirroring the time-grid all-day cell. The dnd\n // layer's all-day create branch does not plumb resourceId into the draft,\n // so every resource cell covering the day highlights together.\n const inDraft = useEventCalendarSelector<unknown, boolean>((state) => {\n const draft = state.slotDraft;\n if (!draft?.allDay) return false;\n return draft.start < dayEnd && draft.end > dayStart;\n });\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: pointer/gesture surface; keyboard via toolbar\n <div\n data-slot=\"event-calendar-all-day-cell\"\n // data-ec-day makes this a DnD day target: without it collectSurface()\n // finds no cells and dragging an all-day chip silently converts it to\n // a timed event via the column branch\n data-ec-day={dayStart.getTime()}\n data-drop-target={isDropTarget ?? undefined}\n data-off={isOff || undefined}\n className={cn(\n // reserve one bar row so the all-day row keeps the same height with or\n // without events, matching the time-grid all-day row (which reserves\n // the same via its bars-grid minHeight)\n \"relative flex min-h-[calc(var(--ec-month-bar-h,1.625rem)+0.625rem)] min-w-0 flex-col gap-0.5 border-e px-1 py-1.5 last:border-e-0\",\n isOff && offClassName,\n viewConfig.dayClassName?.(day),\n inDraft &&\n cn(\n EVENT_CALENDAR_SLOT_DRAFT.surface,\n EVENT_CALENDAR_SLOT_DRAFT.segment,\n EVENT_CALENDAR_SLOT_DRAFT.segmentStart,\n EVENT_CALENDAR_SLOT_DRAFT.segmentEnd,\n viewConfig.classNames?.slotDraft,\n ),\n viewConfig.classNames?.allDayCell,\n )}\n onPointerDown={(e) => {\n if (e.target === e.currentTarget) gestures.beginCreate(e, day, true);\n }}\n onClick={(e) => {\n if (e.target === e.currentTarget && !wasRecentDrag() && !wasRecentChipPress()) {\n settings.onSlotClick?.(\n {\n date: dayStart,\n allDay: true,\n view: \"resource\",\n resourceId: resource.id,\n },\n e,\n );\n }\n }}\n >\n {mine.map((segment) => (\n <EventCalendarEvent\n key={segment.occurrence.key}\n segment={segment}\n // one bar-row tall, matching the time-grid all-day bars so the row\n // height stays identical across views (and equals the reserved min)\n className=\"h-[calc(var(--ec-month-bar-h,1.625rem)-0.125rem)]\"\n />\n ))}\n {isDropTarget && (\n <span\n aria-hidden\n data-slot=\"event-calendar-drop-indicator\"\n data-drop-target={isDropTarget}\n className={cn(\n \"pointer-events-none absolute inset-0.5 z-10 rounded-sm border border-dashed\",\n isDropTarget === \"valid\" ? \"border-primary/50\" : \"border-destructive/60\",\n viewConfig.classNames?.dropIndicator,\n )}\n />\n )}\n </div>\n );\n}\n\nfunction EventCalendarResourceColumn({\n resource,\n day,\n startHour,\n endHour,\n interval,\n}: {\n resource: EventCalendarResource;\n day: Date;\n startHour: number;\n endHour: number;\n interval: number;\n}) {\n const settings = useEventCalendarSettings();\n const viewConfig = useEventCalendarViewConfig();\n const { effective } = useEventCalendarViewSettings();\n const gestures = useEventCalendarGestures();\n const { segments, isToday } = useEventCalendarDay(day);\n const isOff = resolveOffDay(\n day,\n settings.timeZone,\n effective.offDays\n ? typeof viewConfig.offDays === \"object\"\n ? viewConfig.offDays\n : true\n : false,\n settings.weekendDays,\n );\n const offClassName =\n (typeof viewConfig.offDays === \"object\" && viewConfig.offDays.className) || \"bg-muted/25\";\n\n const timeZone = settings.timeZone;\n const dayStart = zonedStartOfDay(day, timeZone);\n const totalMinutes = getDayTotalMinutes(day, timeZone);\n const boundsStartMin = startHour * 60;\n const boundsEndMin = Math.min(endHour * 60, totalMinutes);\n const boundsMinutes = Math.max(60, boundsEndMin - boundsStartMin);\n\n // Filter this resource's timed segments and repack per column.\n // Clones keep the shared index cache untouched. Segments the day bounds clip\n // away are dropped here too, otherwise they hold a column nobody can see and\n // leave a phantom empty half beside the first in-bounds chip.\n const packed = useMemo(() => {\n const mine = segments.timed\n .filter((segment) => {\n if (segment.occurrence.event.resourceId !== resource.id) return false;\n const startMin = Math.max(segment.startMin ?? 0, boundsStartMin);\n const endMin = Math.min(segment.endMin ?? startMin, boundsEndMin);\n return endMin > boundsStartMin && startMin < boundsEndMin;\n })\n .map((segment) => ({ ...segment }) as EventCalendarSegment);\n packTimedSegments(mine);\n return mine;\n }, [segments.timed, resource.id, boundsStartMin, boundsEndMin]);\n\n const dragGhost = useEventCalendarSelector<\n unknown,\n {\n window: [number, number];\n valid: boolean;\n kind: string;\n color?: string;\n title: string;\n occurrence: EventCalendarSegment[\"occurrence\"];\n proposedStart: Date;\n proposedEnd: Date;\n } | null\n >(\n (state) => {\n const drag = state.drag;\n if (!drag || drag.proposedDayGranular) return null;\n // Moves carry a proposedResourceId (they can cross columns); resizes stay\n // in place and leave it undefined, so fall back to the event's own\n // resource - otherwise the resize ghost is filtered out of every column.\n const targetResourceId = drag.proposedResourceId ?? drag.occurrence.event.resourceId;\n if (targetResourceId !== resource.id) return null;\n const from = Math.max(\n (drag.proposedStart.getTime() - dayStart.getTime()) / 60000,\n boundsStartMin,\n );\n const to = Math.min((drag.proposedEnd.getTime() - dayStart.getTime()) / 60000, boundsEndMin);\n if (to <= from) return null;\n return {\n window: [from, to] as [number, number],\n valid: drag.valid,\n kind: drag.kind,\n color: drag.occurrence.event.color,\n title: drag.occurrence.event.title,\n occurrence: drag.occurrence,\n proposedStart: drag.proposedStart,\n proposedEnd: drag.proposedEnd,\n };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null &&\n b !== null &&\n a.window[0] === b.window[0] &&\n a.window[1] === b.window[1] &&\n a.valid === b.valid &&\n a.proposedStart.getTime() === b.proposedStart.getTime() &&\n a.proposedEnd.getTime() === b.proposedEnd.getTime()),\n },\n );\n\n // Instants behind `draftWindow` below, for the range readout. Same\n // resource filter, so a draft on a neighbouring resource never labels this\n // column.\n const draftRange = useEventCalendarSelector<unknown, { start: Date; end: Date } | null>(\n (state) => {\n const draft = state.slotDraft;\n if (!draft || draft.allDay || draft.resourceId !== resource.id) {\n return null;\n }\n return { start: draft.start, end: draft.end };\n },\n {\n isEqual: (a, b) =>\n a === b ||\n (a !== null &&\n b !== null &&\n a.start.getTime() === b.start.getTime() &&\n a.end.getTime() === b.end.getTime()),\n },\n );\n\n const draftWindow = useEventCalendarSelector<unknown, [number, number] | null>(\n (state) => {\n const draft = state.slotDraft;\n if (!draft || draft.allDay || draft.resourceId !== resource.id) {\n return null;\n }\n const from = Math.max((draft.start.getTime() - dayStart.getTime()) / 60000, boundsStartMin);\n const to = Math.min((draft.end.getTime() - dayStart.getTime()) / 60000, boundsEndMin);\n return to > from ? [from, to] : null;\n },\n {\n isEqual: (a, b) => a === b || (a !== null && b !== null && a[0] === b[0] && a[1] === b[1]),\n },\n );\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents: pointer/gesture surface; keyboard via toolbar\n <div\n data-slot=\"event-calendar-day-column\"\n data-today={isToday || undefined}\n data-off={isOff || undefined}\n data-ec-day={dayStart.getTime()}\n data-ec-bounds-start={boundsStartMin}\n data-ec-bounds-end={boundsEndMin}\n data-ec-resource={resource.id}\n data-drop-target={dragGhost ? (dragGhost.valid ? \"valid\" : \"invalid\") : undefined}\n role=\"group\"\n aria-label={resource.title}\n className={cn(\n \"relative min-w-0 border-e last:border-e-0\",\n isOff && offClassName,\n // the resource view is a single day, so today gets no column tint (the\n // header marks it); only a consumer todayClassName can tint it\n isToday && viewConfig.todayClassName,\n viewConfig.dayClassName?.(day),\n viewConfig.classNames?.dayColumn,\n )}\n style={{\n height: `calc(var(--ec-hour-height) * ${boundsMinutes / 60})`,\n backgroundImage: `repeating-linear-gradient(to bottom, transparent, transparent calc(var(--ec-hour-height) * ${interval / 60} - var(--ec-slot-line-width, 1px)), var(--ec-slot-line-color, var(--color-border)) calc(var(--ec-hour-height) * ${interval / 60} - var(--ec-slot-line-width, 1px)), var(--ec-slot-line-color, var(--color-border)) calc(var(--ec-hour-height) * ${interval / 60}))`,\n }}\n onPointerDown={(e) => {\n if (e.target === e.currentTarget) gestures.beginCreate(e, day, false);\n }}\n onClick={(e) => {\n if (e.target !== e.currentTarget || wasRecentDrag() || wasRecentChipPress()) return;\n const rect = e.currentTarget.getBoundingClientRect();\n const pxPerMinute = rect.height / boundsMinutes;\n const minutes = snapMinutes(\n boundsStartMin + (e.clientY - rect.top) / pxPerMinute,\n settings.snapDuration,\n );\n const clamped = Math.min(\n Math.max(minutes, boundsStartMin),\n boundsEndMin - settings.slotDuration,\n );\n settings.onSlotClick?.(\n {\n date: addMinutes(dayStart, clamped),\n end: addMinutes(dayStart, clamped + settings.slotDuration),\n allDay: false,\n view: \"resource\",\n resourceId: resource.id,\n },\n e,\n );\n }}\n >\n {packed.map((segment) => {\n const startMin = Math.max(segment.startMin ?? 0, boundsStartMin);\n const endMin = Math.min(segment.endMin ?? startMin, boundsEndMin);\n if (endMin <= boundsStartMin || startMin >= boundsEndMin) return null;\n const columnCount = segment.columnCount ?? 1;\n const column = segment.column ?? 0;\n const span = segment.columnSpan ?? 1;\n const zIndex = segment.occurrence.event.zIndex ?? 10 + column;\n // Strict side-by-side columns - no cascade overlap (fade-truncate +\n // hover reveal carry the legibility); the ring separates neighbors.\n return (\n <div\n key={segment.occurrence.key}\n // min-h keeps 15-min chips readable (Google-style: the block may\n // slightly outgrow its true window); hover raises a squeezed\n // cascade chip above its overlapping neighbors\n className=\"absolute z-(--ec-z) min-h-(--ec-event-min-h,1.5rem) px-0.5 hover:z-40\"\n style={\n {\n ...minuteBlockStyle(startMin, endMin, boundsStartMin),\n left: `calc(${EVENT_TRACK_WIDTH} * ${column / columnCount})`,\n width: `calc(${EVENT_TRACK_WIDTH} * ${span / columnCount})`,\n \"--ec-z\": zIndex,\n } as CSSProperties\n }\n >\n <EventCalendarEvent\n segment={segment}\n className={cn(\n columnCount > 1 && \"ring-1 ring-background\",\n // short chips: single centered row, exact-fit line height so\n // the title never slices mid-glyph\n endMin - startMin < viewConfig.compactEventMinutes\n ? \"h-full gap-1 py-0 leading-4\"\n : \"h-full flex-col items-start justify-start gap-0 py-1\",\n viewConfig.classNames?.timedChip,\n )}\n />\n </div>\n );\n })}\n {/* Standardized ghost (EVENT_CALENDAR_GHOST): faint drop placeholder\n for moves (the cursor-attached carry clone owns the visual), dashed\n clone for resizes, destructive marking when invalid. */}\n {dragGhost && (\n <div\n data-slot=\"event-calendar-drag-ghost\"\n data-kind={dragGhost.kind}\n data-drop-invalid={!dragGhost.valid || undefined}\n className={cn(\n \"pointer-events-none absolute inset-x-0.5 z-50 min-h-(--ec-event-min-h,1.5rem)\",\n dragGhost.kind === \"move\"\n ? cn(EVENT_CALENDAR_GHOST.move, !dragGhost.valid && EVENT_CALENDAR_GHOST.invalid)\n : cn(\n EVENT_CALENDAR_GHOST.resize,\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidResize,\n ),\n viewConfig.classNames?.dragGhost,\n )}\n style={\n {\n ...minuteBlockStyle(dragGhost.window[0], dragGhost.window[1], boundsStartMin),\n \"--ec-event-color\": dragGhost.color ?? \"var(--color-primary)\",\n } as CSSProperties\n }\n >\n {dragGhost.kind !== \"move\" && (\n <EventCalendarEvent\n preview\n segment={{\n occurrence: {\n ...dragGhost.occurrence,\n start: dragGhost.proposedStart,\n end: dragGhost.proposedEnd,\n allDay: false,\n },\n day,\n isStart: true,\n isEnd: true,\n continuesBefore: false,\n continuesAfter: false,\n startMin: dragGhost.window[0],\n endMin: dragGhost.window[1],\n }}\n className={cn(\n dragGhost.window[1] - dragGhost.window[0] < viewConfig.compactEventMinutes\n ? \"h-full gap-1 py-0 leading-4\"\n : \"h-full flex-col items-start justify-start gap-0 py-1\",\n viewConfig.classNames?.timedChip,\n \"inset-ring-0\",\n !dragGhost.valid && EVENT_CALENDAR_GHOST.invalidContent,\n )}\n />\n )}\n </div>\n )}\n {draftWindow && (\n <div\n data-slot=\"event-calendar-slot-draft\"\n className={cn(\n EVENT_CALENDAR_SLOT_DRAFT.box,\n \"pointer-events-none absolute inset-x-0.5 z-40 overflow-hidden\",\n viewConfig.classNames?.slotDraft,\n )}\n style={minuteBlockStyle(draftWindow[0], draftWindow[1], boundsStartMin)}\n >\n {draftRange && (\n <span className={cn(\"block\", EVENT_CALENDAR_SLOT_DRAFT.label)}>\n {settings.i18n.functions.formatEventTime(\n toZoned(draftRange.start, settings.timeZone),\n toZoned(draftRange.end, settings.timeZone),\n false,\n { locale: settings.locale },\n )}\n </span>\n )}\n </div>\n )}\n </div>\n );\n}\n\nexport type { EventCalendarResourceViewProps };\nexport { EventCalendarResourceView };\n"],"mappings":";;;;;;;;;;;;;;AA0CA,MAAM,yBAAiD,CAAC;;AAWxD,SAAS,0BAA0B,EACjC,WACA,QACA,cACA,YACA,aAAa,MACb,UAAU,cACV,GAAG,SAC8B;CACjC,MAAM,WAAW,iBAAiB;CAClC,MAAM,WAAW,yBAAyB;CAC1C,MAAM,aAAa,2BAA2B;CAC9C,MAAM,EAAE,cAAc,6BAA6B;CACnD,MAAM,aAAa,0BAA0B,UAAU,MAAM,MAAM,EACjE,UAAU,GAAG,MAAM,EAAE,QAAQ,MAAM,EAAE,QAAQ,EAC/C,CAAC;CAED,MAAM,YAAY,gBAAgB,SAAS;CAC3C,MAAM,UAAU,cAAc,SAAS;CACvC,MAAM,WAAW,KAAK,IAAI,KAAK,IAAI,gBAAgB,WAAW,UAAU,CAAC,GAAG,GAAG;CAC/E,MAAM,YAAY,WAAW,eAAe;CAC5C,MAAM,MAAM,gBAAgB,YAAY,SAAS,QAAQ;CAEzD,MAAM,YAAY,cAEd,iBAAiB,SAAS,SAAS,CAAC,CACjC,QAAQ,EAAE,eAAe,CAAC,SAAS,UAAU,MAAM,CAAC,CACpD,KAAK,EAAE,eAAe,QAAQ,GACnC,CAAC,SAAS,SAAS,CACrB;CAGA,MAAM,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BAAD;KACE,SAAA;KACA,SAAS;MACP,YAAY;OACV,GAAG,UAAU;OACb,OAAO,UAAU;OACjB,KAAK,UAAU;OACf,QAAQ;MACV;MACA;MACA,SAAS;MACT,OAAO;MACP,iBAAiB;MACjB,gBAAgB;MAChB,UAAU,UAAU,OAAO;MAC3B,QAAQ,UAAU,OAAO;KAC3B;KACA,WAAW,GACT,UAAU,OAAO,KAAK,UAAU,OAAO,KAAK,WAAW,sBACnD,gCACA,wDACJ,WAAW,YAAY,WACvB,gBACA,CAAC,UAAU,SAAS,qBAAqB,cAC3C;IACD,CAAA;GAEA,CAAA;GAEN,eACC,oBAAC,OAAD;IACE,aAAU;IACV,WAAW,GACT,0BAA0B,KAC1B,iEACA,WAAW,YAAY,SACzB;IACA,OAAO,iBAAiB,YAAY,IAAI,YAAY,IAAI,cAAc;IAErE,UAAA,cACC,oBAAC,QAAD;KAAM,WAAW,GAAG,SAAS,0BAA0B,KAAK;KACzD,UAAA,SAAS,KAAK,UAAU,gBACvB,QAAQ,WAAW,OAAO,SAAS,QAAQ,GAC3C,QAAQ,WAAW,KAAK,SAAS,QAAQ,GACzC,OACA,EAAE,QAAQ,SAAS,OAAO,CAC5B;IACI,CAAA;GAEL,CAAA;EAEJ;;AAET"}
@@ -19,6 +19,14 @@ declare function EventCalendarTimeGutter({ days, slots, startHour, interval }: {
19
19
  startHour: number;
20
20
  interval: number;
21
21
  }): import("react").JSX.Element;
22
+ /**
23
+ * Inline size of the timed-block track. It stops short of the day column's end
24
+ * edge so the bare strip beside a full-width block is still the column itself,
25
+ * and a press there reaches the column's own create handler - the empty space
26
+ * Google Calendar and Notion Calendar both reserve for "new event next to this
27
+ * one". Consumers opt out with classNames.dayColumn: "[--ec-event-gutter:0px]".
28
+ */
29
+ declare const EVENT_TRACK_WIDTH = "(100% - var(--ec-event-gutter, 0.75rem))";
22
30
  /** Absolute overlay block positioned by minutes (ghosts + drafts). */
23
31
  declare function minuteBlockStyle(startMin: number, endMin: number, boundsStartMin: number): CSSProperties;
24
32
  declare function EventCalendarNowIndicator({ days, startHour, endHour }: {
@@ -31,5 +39,5 @@ declare function EventCalendarWeekView(props: TimeGridViewProps): import("react"
31
39
  declare function EventCalendarDayView(props: TimeGridViewProps): import("react").JSX.Element;
32
40
  declare function EventCalendarDaysView(props: TimeGridViewProps): import("react").JSX.Element;
33
41
  //#endregion
34
- export { EventCalendarDayView, EventCalendarDaysView, EventCalendarNowIndicator, EventCalendarTimeGrid, type EventCalendarTimeGridProps, EventCalendarTimeGutter, EventCalendarWeekView, minuteBlockStyle, useNow };
42
+ export { EVENT_TRACK_WIDTH, EventCalendarDayView, EventCalendarDaysView, EventCalendarNowIndicator, EventCalendarTimeGrid, type EventCalendarTimeGridProps, EventCalendarTimeGutter, EventCalendarWeekView, minuteBlockStyle, useNow };
35
43
  //# sourceMappingURL=event-calendar-time-grid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-time-grid.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-time-grid.tsx"],"mappings":";;;;;iBA2CS,OAAO,sBAAsB;UAkB5B,mCAAmC,UAAU;EACrD,MAAM,QAAQ;EACd;EACA;EACA;;EAEA;;iBAGO,wBACP,MACA,WACA,QACA,cACA,YACA,YACA,UAAU,iBACP,SACF,6CAA0B,IAAA;iBAkpBpB,0BACP,MACA,OACA,WACA;EAEA,MAAM;EACN;EACA;EACA;oBACD,IAAA;;iBAmDQ,iBAAiB,kBAAkB,gBAAgB,yBAAyB;iBAmV5E,4BACP,MACA,WACA;EAEA,MAAM;EACN;EACA;IACE;KAsDC,oBAAoB,KAAK;iBAErB,sBAAsB,OAAO,oCAAiB,IAAA;iBAI9C,qBAAqB,OAAO,oCAAiB,IAAA;iBAI7C,sBAAsB,OAAO,oCAAiB,IAAA"}
1
+ {"version":3,"file":"event-calendar-time-grid.d.ts","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-time-grid.tsx"],"mappings":";;;;;iBA2CS,OAAO,sBAAsB;UAkB5B,mCAAmC,UAAU;EACrD,MAAM,QAAQ;EACd;EACA;EACA;;EAEA;;iBAGO,wBACP,MACA,WACA,QACA,cACA,YACA,YACA,UAAU,iBACP,SACF,6CAA0B,IAAA;iBAkpBpB,0BACP,MACA,OACA,WACA;EAEA,MAAM;EACN;EACA;EACA;oBACD,IAAA;;;;;;;;cAyDK;;iBAGG,iBAAiB,kBAAkB,gBAAgB,yBAAyB;iBAkV5E,4BACP,MACA,WACA;EAEA,MAAM;EACN;EACA;IACE;KAsDC,oBAAoB,KAAK;iBAErB,sBAAsB,OAAO,oCAAiB,IAAA;iBAI9C,qBAAqB,OAAO,oCAAiB,IAAA;iBAI7C,sBAAsB,OAAO,oCAAiB,IAAA"}
@@ -456,6 +456,14 @@ function EventCalendarTimeGutter({ days, slots, startHour, interval }) {
456
456
  })
457
457
  });
458
458
  }
459
+ /**
460
+ * Inline size of the timed-block track. It stops short of the day column's end
461
+ * edge so the bare strip beside a full-width block is still the column itself,
462
+ * and a press there reaches the column's own create handler - the empty space
463
+ * Google Calendar and Notion Calendar both reserve for "new event next to this
464
+ * one". Consumers opt out with classNames.dayColumn: "[--ec-event-gutter:0px]".
465
+ */
466
+ const EVENT_TRACK_WIDTH = "(100% - var(--ec-event-gutter, 0.75rem))";
459
467
  /** Absolute overlay block positioned by minutes (ghosts + drafts). */
460
468
  function minuteBlockStyle(startMin, endMin, boundsStartMin) {
461
469
  const top = (startMin - boundsStartMin) / 60;
@@ -584,13 +592,12 @@ function EventCalendarDayColumn({ day, startHour, endHour, interval }) {
584
592
  const column = segment.column ?? 0;
585
593
  const span = segment.columnSpan ?? 1;
586
594
  const zIndex = segment.occurrence.event.zIndex ?? 10 + column;
587
- const colPct = 100 / columnCount;
588
595
  return /* @__PURE__ */ jsx("div", {
589
596
  className: "absolute z-(--ec-z) min-h-(--ec-event-min-h,1.5rem) px-0.5 hover:z-40",
590
597
  style: {
591
598
  ...minuteBlockStyle(startMin, endMin, boundsStartMin),
592
- left: `${column * colPct}%`,
593
- width: `${span * colPct}%`,
599
+ left: `calc(${EVENT_TRACK_WIDTH} * ${column / columnCount})`,
600
+ width: `calc(${EVENT_TRACK_WIDTH} * ${span / columnCount})`,
594
601
  "--ec-z": zIndex
595
602
  },
596
603
  children: /* @__PURE__ */ jsx(EventCalendarEvent, {
@@ -691,6 +698,6 @@ function EventCalendarDaysView(props) {
691
698
  });
692
699
  }
693
700
  //#endregion
694
- export { EventCalendarDayView, EventCalendarDaysView, EventCalendarNowIndicator, EventCalendarTimeGrid, EventCalendarTimeGutter, EventCalendarWeekView, minuteBlockStyle, useNow };
701
+ export { EVENT_TRACK_WIDTH, EventCalendarDayView, EventCalendarDaysView, EventCalendarNowIndicator, EventCalendarTimeGrid, EventCalendarTimeGutter, EventCalendarWeekView, minuteBlockStyle, useNow };
695
702
 
696
703
  //# sourceMappingURL=event-calendar-time-grid.js.map