4.0 KiB
4.0 KiB
Task UX.2: CRM Form Design System Standardization
Objective
Establish one reusable CRM form design foundation for shared controls, field behaviors, filter bars, textarea sizing, and select trigger stability across the CRM surface.
Files Added
docs/implementation/task-ux2-crm-form-design-system-standardization.mdsrc/features/crm/shared/formats.tssrc/features/crm/components/crm-form-controls.tsxsrc/components/forms/fields/currency-field.tsxsrc/components/forms/fields/percentage-field.tsx
Files Modified
docs/standards/project-foundations.mdsrc/components/forms/fields/date-picker-field.tsxsrc/components/forms/fields/index.tsxsrc/components/forms/fields/textarea-field.tsxsrc/components/ui/select.tsxsrc/components/ui/tanstack-form.tsxsrc/features/crm/customers/components/contact-form-sheet.tsxsrc/features/crm/customers/components/contact-share-sheet.tsxsrc/features/crm/customers/components/customer-form-sheet.tsxsrc/features/crm/customers/components/customer-owner-card.tsxsrc/features/crm/dashboard/components/dashboard-filters.tsxsrc/features/crm/enquiries/components/enquiry-form-sheet.tsxsrc/features/crm/enquiries/components/enquiry-outcome-card.tsxsrc/features/crm/enquiries/components/followup-form-sheet.tsxsrc/features/crm/quotations/components/quotation-approval-tab.tsxsrc/features/crm/quotations/components/quotation-detail.tsxsrc/features/crm/quotations/components/quotation-form-sheet.tsxsrc/features/crm/reports/components/report-filter-bar.tsx
Drift Inventory
Before this task, CRM forms and filters had multiple inconsistent patterns:
- raw
type="date"inputs mixed with a calendar button pattern - numeric commercial fields implemented as generic text or bare number inputs
- long select values stretching trigger width in customer and project-party flows
- arbitrary textarea heights across dialogs, forms, and approval panels
- report and dashboard filters using different control families from CRM forms
- manual quotation dialogs bypassing the shared TanStack field wrappers
Foundation Created
New reusable CRM form foundation now standardizes:
- date input behavior through
CrmDateInput - number, currency, and percentage behavior through
CrmNumberInput,CrmCurrencyInput, andCrmPercentageInput - textarea sizes through
CrmTextareawithsm | md | lg - display formatting helpers through
formatCrmDate()andformatCrmNumber() - TanStack form wrappers through
FormCurrencyFieldandFormPercentageField - select trigger width stability through the shared
SelectTriggerprimitive
Module Coverage
The standardization was applied where CRM already had production form or filter surfaces:
- Customers: customer form, contact form, owner assignment dialog, contact sharing dialog
- Enquiries and leads: enquiry form, follow-up form, outcome dialogs
- Quotations: quotation header form, approval submit panel, item/topic/follow-up/attachment dialogs
- Reports and dashboard: shared date filter behavior for dashboard and report filter bars
UX Decisions Frozen
- Date selection uses a calendar picker
- User-facing date display uses
DD/MM/YYYY - Select triggers stay
w-full max-w-fulland truncate long selected labels - Desktop CRM form layout remains primarily
md:grid-cols-2 - Textareas use named sizes instead of arbitrary heights
- Report and dashboard filters reuse the same CRM date control family
- Required field display continues to use the existing label
*indicator pattern
Verification
- Ran
npm exec tsc --noEmit - Verified no remaining raw CRM
type="date"or ad hoc textarea usage outside the shared CRM controls file itself
Remaining Notes
- Some older dialogs still use direct
Inputfor plain text fields, which is acceptable because the drift for this task was primarily around date, numeric, textarea, and select behavior. - Several legacy files still contain mojibake in Thai strings. This task avoided rewriting business copy unless required for control standardization.