{
  "name": "spreadsheet-context-menu-cell-items",
  "type": "registry:component",
  "dependencies": [
    "@unsanity/spreadsheet"
  ],
  "registryDependencies": [
    "context-menu"
  ],
  "files": [
    {
      "path": "components/spreadsheet/spreadsheet-context-menu-cell-items.tsx",
      "content": "\"use client\";\n\nimport {\n  fromActive,\n  getSelectionBounds,\n  type SelectionMode,\n  useSpreadsheetStore,\n} from \"@unsanity/spreadsheet\";\nimport { ContextMenuItem } from \"@/components/ui/context-menu\";\n\nexport function SpreadsheetContextMenuCellItems({\n  selectionMode,\n}: {\n  selectionMode: SelectionMode;\n}) {\n  const selection = useSpreadsheetStore(fromActive((sh) => sh.selection));\n  const setCells = useSpreadsheetStore((s) => s.setCells);\n\n  if (selectionMode === \"row\" || selectionMode === \"col\") return null;\n\n  function clearContents() {\n    if (!selection) return;\n    const bounds = getSelectionBounds(selection);\n    const changes = [];\n    for (let r = bounds.minRow; r <= bounds.maxRow; r++)\n      for (let c = bounds.minCol; c <= bounds.maxCol; c++)\n        changes.push({ row: r, col: c, value: \"\" });\n    setCells(changes);\n  }\n\n  return (\n    <ContextMenuItem disabled={!selection} onClick={clearContents}>\n      Clear contents\n      <span className=\"ml-auto text-xs text-muted-foreground\">Del</span>\n    </ContextMenuItem>\n  );\n}\n",
      "type": "registry:component"
    }
  ]
}
