mirror of
https://github.com/temetro/temetro.git
synced 2026-08-25 09:56:56 +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>
1.7 KiB
1.7 KiB
coss Toggle
When to use
- Pressable two-state commands (formatting/tool modes).
- Single-command active/inactive interactions without group state.
When NOT to use
- If the control is a binary preference setting -> use Switch instead.
- If multiple toggles share state -> use ToggleGroup instead.
Install
npx shadcn@latest add @coss/toggle
Manual deps from docs:
npm install @base-ui/react
Canonical imports
import { Toggle } from "@/components/ui/toggle"
Minimal pattern
<Toggle>Toggle</Toggle>
Patterns from coss particles
Key patterns
Icon toggle with aria-label (always required for icon-only):
<Toggle aria-label="Toggle bold" value="bold">
<BoldIcon />
</Toggle>
ToggleGroup with icon toggles:
<ToggleGroup defaultValue={["bold"]}>
<Toggle aria-label="Toggle bold" value="bold">
<BoldIcon />
</Toggle>
<Toggle aria-label="Toggle italic" value="italic">
<ItalicIcon />
</Toggle>
<Toggle aria-label="Toggle underline" value="underline">
<UnderlineIcon />
</Toggle>
</ToggleGroup>
Variants: default, outline. Sizes: sm, default, lg.
More examples
- outline:
p-toggle-2 - with icon:
p-toggle-3 - small / large size:
p-toggle-4,p-toggle-5 - disabled:
p-toggle-6 - icon group:
p-toggle-7
Common pitfalls
- Using toggle for destructive/submit actions better represented by
Button. - Missing pressed-state semantics in controlled toggle flows.
- Using standalone toggles when mutually exclusive behavior needs
ToggleGroup.
Useful particle references
See p-toggle-1 through p-toggle-7 for variants, sizes, and icon group patterns.