mirror of
https://github.com/temetro/temetro.git
synced 2026-09-04 14:55:28 +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.5 KiB
2.5 KiB
coss Popover
When to use
- Contextual floating content near a trigger.
- Inline editing/help panels without full modal lock.
When NOT to use
- If the content requires user focus/action before dismissal -> use Dialog instead.
- If the content is just a short text hint -> use Tooltip instead.
- If it's a list of actions -> use Menu instead.
Install
npx shadcn@latest add @coss/popover
Manual deps from docs:
npm install @base-ui/react
Canonical imports
import {
Popover,
PopoverClose,
PopoverCreateHandle,
PopoverDescription,
PopoverPopup,
PopoverTitle,
PopoverTrigger,
} from "@/components/ui/popover"
Minimal pattern
<Popover>
<PopoverTrigger render={<Button variant="outline" />}>Open Popover</PopoverTrigger>
<PopoverPopup>
<PopoverTitle>Popover Title</PopoverTitle>
<PopoverDescription>Popover Description</PopoverDescription>
<PopoverClose render={<Button variant="outline" />}>Close</PopoverClose>
</PopoverPopup>
</Popover>
Patterns from coss particles
- Portal forwarding: optional
portalPropsonPopoverPopup→ Base UIPopover.Portal(keepMounted,container, …). See portal-props.md. - Form-in-popover: use
PopoverPopupas a lightweight form container (for example feedback forms withForm+Field+Textarea). - Dismiss controls: use
PopoverCloseboth for footer actions and icon close buttons (aria-label+render={<Button size="icon" .../>}). - Tooltip-like popovers: use
tooltipStylefor info-icon helper content where tooltip density is preferred. - Detached triggers: use
PopoverCreateHandle+ sharedhandle/payloadon multiplePopoverTriggers to animate one popup across triggers. - Position tuning: only add
side,align,sideOffset,alignOffsetwhen default anchoring is not sufficient.
Common pitfalls
- Treating Popover as a modal replacement when the flow needs full modal behavior (use Dialog/AlertDialog instead).
- Forgetting
rendercomposition on trigger/close when using coss buttons. - Missing accessible names on icon-only triggers or close controls.
- Using detached trigger handles without stable payload/content mapping.
- Copying Tooltip patterns directly without checking
tooltipStyleand popover semantics.
Useful particle references
- baseline popover with form content:
p-popover-1 - close controls (icon + action button):
p-popover-2 - detached trigger handle pattern:
p-popover-3 - tooltip-style popover usage example:
p-input-group-7