{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "author": "Lopifi (https://lopifi.com)",
  "categories": [
    "close-controls-consolidation",
    "finance",
    "accounting"
  ],
  "dependencies": [],
  "description": "Inline, with both legitimate remedies named.",
  "files": [
    {
      "content": "import * as React from \"react\";\nimport { cn } from \"@/lib/ledger/cn\";\nimport { formatDate } from \"@/lib/ledger/fiscal-period\";\nimport { ExclamationTriangleIcon } from \"@/components/ledger/icons\";\n\nexport interface CutoffWarningProps extends React.ComponentPropsWithoutRef<\"div\"> {\n  closedThrough: Date;\n  entryDate: Date;\n  onPostAccrual?: () => void;\n  onRequestReopen?: () => void;\n}\n\n/**\n * Inline at the date field, never a toast. States the consequence **and both\n * legitimate remedies** — a bare rejection leaves the user with no path.\n */\nexport const CutoffWarning = React.forwardRef<HTMLDivElement, CutoffWarningProps>(\n  ({ className, entryDate, closedThrough, onRequestReopen, onPostAccrual, ...props }, ref) => {\n    const postingPeriod = new Date(closedThrough.getFullYear(), closedThrough.getMonth() + 1, 1);\n    return (\n      <div\n        className={cn(\"flex items-start gap-2 rounded-sm bg-warning-subtle px-3 py-2\", className)}\n        ref={ref}\n        role=\"alert\"\n        {...props}\n      >\n        <ExclamationTriangleIcon aria-hidden=\"true\" className=\"mt-0.5 size-4 shrink-0 text-warning\" />\n        <p className=\"text-body text-text-primary\">\n          This is dated {formatDate(entryDate)}, in a closed period. It will post to{\" \"}\n          {postingPeriod.toLocaleDateString(\"en-GB\", { month: \"long\", year: \"numeric\" })} and be flagged for\n          cutoff review. If it belongs in the earlier period,{\" \"}\n          <button\n            className=\"text-accent underline underline-offset-2\"\n            onClick={onRequestReopen}\n            type=\"button\"\n          >\n            request a reopen\n          </button>{\" \"}\n          or{\" \"}\n          <button className=\"text-accent underline underline-offset-2\" onClick={onPostAccrual} type=\"button\">\n            post an accrual\n          </button>\n          .\n        </p>\n      </div>\n    );\n  },\n);\nCutoffWarning.displayName = \"CutoffWarning\";\n",
      "path": "components/ledger/cutoff-warning.tsx",
      "target": "components/ledger/cutoff-warning.tsx",
      "type": "registry:component"
    }
  ],
  "name": "cutoff-warning",
  "registryDependencies": [
    "@lopifi/theme",
    "@lopifi/cn",
    "@lopifi/fiscal-period",
    "@lopifi/icons"
  ],
  "title": "CutoffWarning",
  "type": "registry:component"
}
