CloseChecklist
- Status
- Implemented
- Family
- 6 of 13
- Registry
- @lopifi/close-checklist
npx shadcn@latest add @lopifi/theme @lopifi/close-checklistThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Tasks, owners, dependencies, blockers, sign-off. Progress by section. Overdue items flagged with day counts. Sign-off is an AlertDialog with a hold-to-confirm — signing off a close is irreversible.
Lifted verbatim from Statements. The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/close-checklist.tsx
- Lopifi dependencies · 6
- buttoncnfiscal-periodhold-to-confirmiconsuse-media-query
- npm packages
- class-variance-authorityclsxtailwind-merge
- Registry entry
- /r/close-checklist.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
"use client";
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
import { daysBetween, formatDate } from "@/lib/ledger/fiscal-period";
import { Button } from "@/components/ledger/button";
import { HoldToConfirm } from "@/components/ledger/hold-to-confirm";
import { CheckIcon, ExclamationTriangleIcon, LockClosedIcon } from "@/components/ledger/icons";
export type CloseTask = {
id: string;
section: string;
label: string;
owner: string;
dueDate: Date;
state: "todo" | "in-progress" | "done" | "blocked";
blockedBy?: string;
/** Weighted, because ten trivial checks and one bank rec is not 91% done. */
weight: number;
};
export interface CloseChecklistProps {
className?: string;
onSignOff?: () => void;
onToggle?: (id: string) => void;
tasks: CloseTask[];
today?: Date;
}
/** Progress is by weighted check, not count. Sign-off is irreversible. */
export function CloseChecklist({
tasks,
today = new Date(),
onToggle,
onSignOff,
className,
}: CloseChecklistProps) {
const sections = React.useMemo(() => {
const map = new Map<string, CloseTask[]>();
for (const t of tasks) {
const list = map.get(t.section) ?? [];
list.push(t);
map.set(t.section, list);
}
return [...map.entries()];
}, [tasks]);
const totalWeight = tasks.reduce((s, t) => s + t.weight, 0);
const doneWeight = tasks.filter((t) => t.state === "done").reduce((s, t) => s + t.weight, 0);
const percent = totalWeight === 0 ? 0 : Math.round((doneWeight / totalWeight) * 100);
const allDone = doneWeight === totalWeight;
return (
<div className={cn("space-y-4", className)}>
<div className="rounded-md border border-border bg-surface p-4">
<div className="flex items-baseline justify-between">
<span className="text-label font-medium">Close progress</span>
<span className="numeric text-figure-md font-medium">{percent}%</span>
</div>
<div
aria-label="Close progress, weighted"
aria-valuemax={100}
aria-valuemin={0}
aria-valuenow={percent}
className="mt-2 h-[3px] w-full bg-border-subtle"
role="progressbar"
>
<div className="h-full bg-accent" style={{ width: `${percent}%` }} />
</div>
<p className="mt-2 text-caption text-text-tertiary">Weighted by effort, not by task count.</p>
</div>
{sections.map(([section, items]) => (
<section className="overflow-hidden rounded-xl border border-border bg-surface" key={section}>
<h3 className="border-b border-border-subtle px-4 py-3 text-label font-medium text-text-secondary">
{section}
</h3>
<ul>
{items.map((t) => {
const overdueDays = daysBetween(t.dueDate, today);
const overdue = overdueDays > 0 && t.state !== "done";
return (
<li
className="flex items-center gap-3 border-b border-border-subtle px-4 py-3 last:border-b-0"
key={t.id}
>
<button
aria-label={`Mark ${t.label} ${t.state === "done" ? "not done" : "done"}`}
aria-pressed={t.state === "done"}
className="grid size-5 shrink-0 place-items-center rounded-full border border-border-strong disabled:opacity-40"
disabled={t.state === "blocked"}
onClick={() => onToggle?.(t.id)}
type="button"
>
{t.state === "done" ? (
<CheckIcon aria-hidden="true" className="size-3 text-positive" />
) : t.state === "blocked" ? (
<LockClosedIcon aria-hidden="true" className="size-3 text-text-tertiary" />
) : (
<span
aria-hidden="true"
className="size-2 rounded-full bg-current text-text-disabled"
/>
)}
</button>
<span className="min-w-0 flex-1">
<span
className={cn(
"block text-body",
t.state === "done" && "text-text-secondary line-through",
)}
>
{t.label}
</span>
{t.blockedBy ? (
<span className="block text-caption text-warning">Blocked by: {t.blockedBy}</span>
) : null}
</span>
<span className="shrink-0 text-caption text-text-secondary">{t.owner}</span>
<span
className={cn(
"numeric w-28 shrink-0 text-right text-caption",
overdue ? "text-negative" : "text-text-tertiary",
)}
>
{overdue ? (
<span className="inline-flex items-center gap-1">
<ExclamationTriangleIcon aria-hidden="true" className="size-3" />
{overdueDays}d overdue
</span>
) : (
formatDate(t.dueDate)
)}
</span>
</li>
);
})}
</ul>
</section>
))}
<div className="rounded-md border border-border bg-surface p-4">
<p className="mb-3 text-body">
Signing off a close is irreversible. Statements generated after sign-off are marked final.
</p>
{allDone ? (
<HoldToConfirm
label="Hold to sign off the close"
onConfirm={() => onSignOff?.()}
typedConfirmation="SIGN OFF"
/>
) : (
<Button disabled variant="primary">
Sign off — {tasks.filter((t) => t.state !== "done").length} tasks remain
</Button>
)}
</div>
</div>
);
}
The accounting it encodes
Concepts this component renders. Each one is defined once, in the lexicon, and used identically in the code and the copy.
Also in Statements
- StatementTableThe shared shell: hierarchy, periods, rules.
- StatementRowIndent level, subtotal, total, expand.
- ProfitAndLossP&L with period comparison and variance.
- BalanceSheetAssets / liabilities / equity, with the balance check.
- CashFlowStatementOperating / investing / financing.
- StatementToolbarBasis, period, comparison, currency, consolidation.
- PeriodPickerFiscal-aware. Never assumes January.
- VarianceCellAbsolute + percent + significance flag.
- FluxAnalysisPeriod-over-period explanations.
- DrilldownSheetStatement line → the GL entries behind it.
- TrialBalanceAll accounts with the debit=credit proof.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Statements — the family specThe four-layer specification this component was built against, before it was written.Doc
- Financial statement componentsThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
- CloseThe process of finalizing a periodTerm
Elsewhere in the system
Where CloseChecklist sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
- CloseChecklist, runningThe close showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Periods, locking and the closeWhat stops someone posting into a closed month?API
- StatementsThe largest gap in the market. No component library ships a <BalanceSheet />. This family is the reason Lopifi exists. Specs for 12 React components: StatementTable, StatementRow, ProfitAndLoss, BalanceSheet and 8 more.Doc
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when Statements changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.