{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "author": "Lopifi (https://lopifi.com)",
  "categories": [
    "accounting-core-gl",
    "finance",
    "accounting"
  ],
  "dependencies": [],
  "description": "With the methodology shown, not just the number.",
  "files": [
    {
      "content": "import * as React from \"react\";\nimport { cn } from \"@/lib/ledger/cn\";\nimport type { MoneyValue } from \"@/lib/ledger/money.types\";\nimport { Money } from \"@/components/ledger/money\";\nimport { RollForward } from \"@/components/ledger/roll-forward\";\n\nexport type AllowanceMethodologyInput = {\n  bucket: string;\n  rate: number;\n  base: MoneyValue;\n  computed: MoneyValue;\n};\n\nexport interface AllowanceRollForwardProps extends React.ComponentPropsWithoutRef<\"div\"> {\n  closing: MoneyValue;\n  glBalance: MoneyValue;\n  methodology: AllowanceMethodologyInput[];\n  opening: MoneyValue;\n  periodLabel: string;\n  /** Provision and write-off are named as distinct actions — they have\n      different P&L effects. */\n  provision: MoneyValue;\n  recoveries: MoneyValue;\n  writeOffs: MoneyValue;\n}\n\n/** The methodology is displayed, each input traceable to the aging. */\nexport const AllowanceRollForward = React.forwardRef<HTMLDivElement, AllowanceRollForwardProps>(\n  (\n    {\n      className,\n      periodLabel,\n      opening,\n      provision,\n      writeOffs,\n      recoveries,\n      closing,\n      glBalance,\n      methodology,\n      ...props\n    },\n    ref,\n  ) => (\n    <div className={cn(\"space-y-4\", className)} ref={ref} {...props}>\n      <RollForward\n        additions={provision}\n        adjustments={recoveries}\n        closing={closing}\n        glBalance={glBalance}\n        opening={opening}\n        periodLabel={periodLabel}\n        releases={writeOffs}\n        title=\"Allowance for credit losses\"\n      />\n\n      <div className=\"rounded-xl border border-border bg-surface p-6\">\n        <h3 className=\"text-title-sm font-medium\">Methodology</h3>\n        <p className=\"mt-1 text-caption text-text-secondary\">Each input traces to a bucket in the aging.</p>\n        <table className=\"mt-3 w-full\">\n          <caption className=\"sr-only\">Allowance methodology inputs</caption>\n          <thead>\n            <tr className=\"border-b border-border-subtle\">\n              <th className=\"py-2 text-left text-label font-medium text-text-secondary\" scope=\"col\">\n                Bucket\n              </th>\n              <th className=\"py-2 text-right text-label font-medium text-text-secondary\" scope=\"col\">\n                Rate\n              </th>\n              <th className=\"py-2 text-right text-label font-medium text-text-secondary\" scope=\"col\">\n                Base\n              </th>\n              <th className=\"py-2 text-right text-label font-medium text-text-secondary\" scope=\"col\">\n                Allowance\n              </th>\n            </tr>\n          </thead>\n          <tbody>\n            {methodology.map((m) => (\n              <tr className=\"border-b border-border-subtle\" key={m.bucket}>\n                <th className=\"py-2 text-left text-body font-normal\" scope=\"row\">\n                  {m.bucket}\n                </th>\n                <td className=\"numeric py-2 text-right text-figure-sm\">{m.rate}%</td>\n                <td className=\"py-2 text-right\">\n                  <Money accounting tone=\"secondary\" value={m.base} />\n                </td>\n                <td className=\"py-2 text-right\">\n                  <Money accounting value={m.computed} />\n                </td>\n              </tr>\n            ))}\n          </tbody>\n        </table>\n        <p className=\"mt-3 text-caption text-text-secondary\">\n          {methodology.map((m) => `${m.rate}% of ${m.bucket}`).join(\" + \")}\n        </p>\n      </div>\n    </div>\n  ),\n);\nAllowanceRollForward.displayName = \"AllowanceRollForward\";\n",
      "path": "components/ledger/allowance-roll-forward.tsx",
      "target": "components/ledger/allowance-roll-forward.tsx",
      "type": "registry:component"
    }
  ],
  "name": "allowance-roll-forward",
  "registryDependencies": [
    "@lopifi/theme",
    "@lopifi/cn",
    "@lopifi/money",
    "@lopifi/money.types",
    "@lopifi/roll-forward"
  ],
  "title": "AllowanceRollForward",
  "type": "registry:component"
}
