Auto-Fill Field Indicators
Author: Seb
Date: 2026-05-11
Status: Implemented — the auto-fill indicators feature described here is delivered and shipped; this document stays under roadmap/in-progress/ because the parent “Add Items from Amazon” project is still active (e.g. free-text search and mobile follow-ups). It moves to roadmap/completed/ when the parent project closes.
Related Issue: Add Items from Amazon project
Summary
Section titled “Summary”Visual indicators for form fields that have been auto-filled from an external source (e.g. Amazon product import, AI-assisted fill, CSV import). Fields show a collapsible sparkle badge that expands on hover to reveal the source name. The indicator auto-dismisses when the user edits the field, providing confidence about what was auto-filled versus manually entered.
Context
Section titled “Context”- The “Add from Amazon” feature pre-fills item form fields from Amazon product data. Users need to know which fields came from Amazon and which they entered themselves.
- This pattern is reusable for any auto-fill source: AI assistants, CSV imports, clipboard paste, etc.
- The solution uses a wrapper component (
AutoFillField) that works with any child field without modifying its API.
What Was Built
Section titled “What Was Built”Design system components (ux-prototype)
Section titled “Design system components (ux-prototype)”AutoFillField molecule — a wrapper component that adds a collapsible badge indicator to any form field:
<AutoFillField source="Amazon" iconColor="text-primary" onClear={() => clearAutoFill('sku')}> <label>SKU</label> <InputGroup> <InputGroupInput value={sku} onChange={handleChange} /> </InputGroup></AutoFillField>Key design decisions:
- Wrapper, not props — works with any component (InputGroup, TypeaheadInput, ArdaSelect, custom organisms) without modifying their API
- Zero extra height — badge sits absolutely positioned at the top-right of the wrapper, inline with the field label
- Collapsible badge — collapsed: small sparkle icon circle; hover: expands to pill showing “Filled by {source}”
- Three dismiss modes —
input(default, text inputs),change(native selects/checkboxes),manual(Radix Select, image uploads, custom components)
Badge atom enhancements:
- Added
sizevariant (sm= h-4, default = h-5) - Added
iconprop for leading icon - Added
iconColorprop for icon color class - Added
collapsiblemode (circle that expands to pill on hover) - Single-character badges render as circles automatically
Other design system additions:
ArdaSelectatom — Radix Select wrapper with standard form field styling- Select primitive — Shadcn-style Radix Select components
InputGroupmuted addon variant — for currency select addons with proper rounded cornersSplitButtoncontrolled menu —menuOpen/onMenuOpenChangeprops--accent-lightdesign token —oklch(0.98 0.015 28)for secondary badge background
Frontend app (arda-frontend-app)
Section titled “Frontend app (arda-frontend-app)”useAutoFilledFields hook — generic reusable hook for tracking auto-fill state:
const { autoFilledFields, setAutoFilledFields, clearAutoFill, clearAllAutoFill } = useAutoFilledFields();Returns a Record<string, string> mapping field keys to source names, plus helpers for clearing individual fields or all at once.
ItemFormPanel integration:
- Wraps each auto-fillable field with
AutoFillField - Populates auto-fill state from Amazon import data via
initialFormDataprop - Clears all auto-fill state when opening a blank form
- Each field clears independently on user edit
ItemCardEditor organism integration:
- Map-based
autoFillprop for organism-internal fields (name, image):
<ItemCardEditor autoFill={{ source: 'Amazon', iconColor: 'text-primary', fields: { title: () => clearAutoFill('name'), imageUrl: () => clearAutoFill('imageUrl'), }, }}/>Amazon import field mapping
Section titled “Amazon import field mapping”| Amazon response field | Form field | Component | Dismiss mode |
|---|---|---|---|
name | Item name | ItemCardEditor (internal) | input |
image.url | Image | ItemCardEditor (internal) | manual |
price.amount / price.currency | Unit cost | InputGroup + currency Select | input |
asin | Supplier SKU | InputGroup + InputGroupInput | input |
productUrl | Supplier URL | InputGroup + InputGroupInput | input |
| (hardcoded “Amazon”) | Supplier | TypeaheadInput | input |
Implementation Details
Section titled “Implementation Details”Phase 1: Design system (completed)
Section titled “Phase 1: Design system (completed)”- Created
AutoFillFieldwrapper molecule with collapsible badge - Enhanced
Badgeatom withsize,icon,iconColor,collapsibleprops - Created
ArdaSelectatom and Select primitives - Added muted addon variant to
InputGroup - Added
--accent-lighttoken totokens.css - Added
menuOpen/onMenuOpenChangetoSplitButton - Added Storybook stories for all new components
- Exported all new types and components from canary entry point
Phase 2: Frontend app (completed)
Section titled “Phase 2: Frontend app (completed)”- Created
useAutoFilledFieldshook for state management - Wrapped all auto-fillable fields with
AutoFillField - Added map-based
autoFillprop toItemCardEditor - Created
lookupAdapters.tsfor TypeaheadOption conversion - Migrated supplier to canary TypeaheadInput
- Migrated order method to ArdaSelect
- Migrated unit price to InputGroup with currency Select addon
- Connected Amazon import flow to auto-fill state
Unit tests (ardaClient.amazonImport.test.ts)
Section titled “Unit tests (ardaClient.amazonImport.test.ts)”- Returns success DTO on 200 and 206 responses
- Returns typed error codes on failure (UNRECOGNIZED_AMAZON_URL, UNSUPPORTED_SHORT_LINK, UNSUPPORTED_AMAZON_LOCALE)
- Calls handleAuthError on 401
- Sends correct headers (Content-Type, Authorization, X-ID-Token)
- Passes input as-is (caller trims)
E2E tests (amazon-import.spec.ts)
Section titled “E2E tests (amazon-import.spec.ts)”- Sub-menu opens and contains URL input field
- Submitting a URL pre-fills form fields
- Auto-fill badges appear on pre-filled fields
- Badges dismiss on user edit
- Error messages display for invalid URLs
- Cancel button works during import
- Normal “Add item” flow has no auto-fill indicators (regression guard)
Future Enhancements
Section titled “Future Enhancements”- AutoFillProvider context — form-level provider that manages the field-to-source map, eliminating prop-drilling:
<AutoFillProvider fields={autoFilledFields} onClear={clearAutoFill}> <AutoFillField name="primarySupply.sku"> <InputGroup>...</InputGroup> </AutoFillField></AutoFillProvider>- Approval workflow — optional
onApprovecallback + approve button on badge for AI-assisted fills - AI-assisted fill — apply the same indicator pattern for Claude-generated field suggestions
- CSV import — bulk auto-fill indicators for imported spreadsheet data
Copyright: © Arda Systems 2025-2026, All rights reserved