mirror of
https://github.com/temetro/temetro.git
synced 2026-08-30 04:09:05 +00:00
929bec8f31
Stop blocking AI imports/proposals on missing non-critical fields. Records the chat agent drafts now save with safe placeholders, auto-generated file numbers, and a source="ai" marker that surfaces an "Added by AI" badge so a clinician can review/edit them later. Backend: - add `source` (manual|ai) column to patients/appointments/prescriptions (migration 0014) + canonical types, services, validation schemas - relax patient/appointment validation: empty file number allowed, demographic + type/provider/initials fall back to placeholders (initials derived from name) - patients.generateFileNumber() auto-assigns an MRN when one is missing - proposeAppointment accepts a name when no file number resolves; AI commits + /api/ai/import stamp source="ai" Frontend: - `source` on Appointment/Patient/Prescription types; AI commits send source="ai" - reusable <AiBadge> shown on the Patients table/detail and prescriptions list Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.0 KiB
2.0 KiB
coss Checkbox
When to use
- Single boolean consent/selection controls.
- Standalone yes/no options with explicit labeling.
When NOT to use
- If the control is a preference toggle (on/off) in settings -> use Switch instead.
- If selecting from mutually exclusive options -> use RadioGroup instead.
- If multiple checkboxes share grouped state -> use CheckboxGroup instead.
Install
npx shadcn@latest add @coss/checkbox
Manual deps from docs:
npm install @base-ui/react
Canonical imports
import { Checkbox } from "@/components/ui/checkbox"
Minimal pattern
<Label>
<Checkbox value="terms" />
Accept terms and conditions
</Label>
Patterns from coss particles
Key patterns
CheckboxGroup with label-wrapped options:
<CheckboxGroup aria-label="Select frameworks" defaultValue={["next"]}>
<Label>
<Checkbox value="next" />
Next.js
</Label>
<Label>
<Checkbox value="vite" />
Vite
</Label>
<Label>
<Checkbox value="astro" />
Astro
</Label>
</CheckboxGroup>
Checkbox with description text (use id/htmlFor):
const id = useId()
<div className="flex items-start gap-2">
<Checkbox id={id} />
<div className="flex flex-col gap-1">
<Label htmlFor={id}>Accept terms and conditions</Label>
<p className="text-muted-foreground text-xs">
By clicking this checkbox, you agree to the terms.
</p>
</div>
</div>
More examples
- disabled:
p-checkbox-2 - with description:
p-checkbox-3 - card style:
p-checkbox-4 - form integration:
p-checkbox-5
Common pitfalls
- Using checkbox for exclusive single-choice options that should be radios.
- Missing visible label association (
LabelorFieldLabel) for each checkbox. - Treating
onCheckedChangevalues as plain boolean without handling indeterminate where relevant.
Useful particle references
See p-checkbox-1 through p-checkbox-5 for label wrapping, disabled, description, card, and form patterns.