mirror of
https://github.com/temetro/temetro.git
synced 2026-08-18 14:23:14 +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
Forms and Inputs Rules (coss)
Use this when implementing fields, input groups, validation states, and form examples.
Core Rules
- For form-bound controls, default to
Fieldcomposition (Field,FieldLabel,FieldDescription,FieldError) instead of standalone inputs. - Always specify
typeon input-like controls where relevant (type="text",type="email", etc.). - Always specify
typeon buttons (button,submit, orreset) instead of relying on browser defaults. - Preserve accessible labelling:
- visible label association (
Label,htmlFor,id) aria-labelwhen there is no visible label.
- visible label association (
- Keep validation signaling aligned between container and control (
aria-invalid, related field semantics).
Input Group Rule
- In
InputGroup, placeInputGroupAddonafterInputGroupInputorInputGroupTextareain DOM order to preserve focus behavior.
Input OTP Rule
- Keep
lengthon the root synchronized with the number of renderedOTPFieldInputslots.
Textarea Rule
- coss
Textareaalready uses Base UI field control semantics internally; in normal form flows, useTextareadirectly insideFieldand avoid manualFieldControlrender wiring unless a custom control implementation is truly needed.
Do / Don't
// Do
<Field>
<FieldLabel>Email</FieldLabel>
<Input type="email" />
</Field>
<InputGroup>
<InputGroupInput type="text" />
<InputGroupAddon>{/* ... */}</InputGroupAddon>
</InputGroup>
// Don't
<Input placeholder="Email" />
<InputGroup>
<InputGroupAddon>{/* ... */}</InputGroupAddon>
<InputGroupInput type="text" />
</InputGroup>
Further reading
- Base UI Forms handbook:
https://base-ui.com/react/handbook/forms.md