Skip to content

Revamp CMS form fields with new UX and 11 new field types#11

Open
rafavalls wants to merge 4 commits intomainfrom
rafavalls/list-form-components
Open

Revamp CMS form fields with new UX and 11 new field types#11
rafavalls wants to merge 4 commits intomainfrom
rafavalls/list-form-components

Conversation

@rafavalls
Copy link
Copy Markdown
Contributor

@rafavalls rafavalls commented May 7, 2026

Summary

  • Existing field UX overhaul: inputs to h-10, RichText toolbar no-wrap with overflow menu, ObjectField as input-styled row with proper nesting indent, ImageField/MediaField fixed h-48 with hover actions, ColorInputField with react-colorful + presets + eyedropper, DateField with shadcn Calendar+Popover, custom typeable TimeField with hour/minute popover columns, dropdown rows stay highlighted while menu open, Select dropdown text-sm with breathing room.
  • 11 new field components (cms-form-extras.tsx) wired by schemaFormat: SwitchField, TagsField, MultiSelectField, SlugField, UrlField, MarkdownField (lazy-loaded preview), ReferenceField (searchable picker), IconField (Lucide), TimeField, DateRangeField, RangeField.
  • Bundle: explicit Lucide imports + ICON_MAP (no wildcard); marked dynamic import on first preview tab open.

New deps: react-colorful (~3KB), marked (~30KB, code-split).

Test plan

  • Open CMS form on a page with image/video fields — verify h-48 preview, hover actions, click-to-upload empty state
  • Edit a color field — verify popover with picker, hex input, presets, eyedropper (Chrome/Edge)
  • Edit a date field — verify shadcn calendar popover; date-time mode shows compact TimeField next to it
  • Edit a TimeField — type `9:3` or `1430`, blur, verify normalizes to `09:30` / `14:30`
  • Open object field — verify h-10 input-styled row, chevron rotates, children indent + left rule
  • Open RichText editor — toolbar doesn't wrap; "More" menu shows lists/quote/code-block; menu trigger highlights when one of those is active
  • Click "..." on an array row — row stays visually highlighted while menu is open
  • Trigger a schema using `format: "switch" / "tags" / "url" / "markdown" / "reference" / "icon" / "time" / "range" / "date-range" / "multi-select"` — verify the right new component renders
  • Open MarkdownField, switch to Preview tab — verify "Loading preview…" briefly, then rendered HTML
  • `bun run check` passes; `bun run ci:check` shows no new lint errors

🤖 Generated with Claude Code


Summary by cubic

Revamps the CMS form UI and wires 10 new schema.format field types for faster, clearer editing with modern pickers.

  • New Features

    • Adds 10 formats: switch, tags, multi-select, url, markdown (lazy preview), reference (searchable picker), icon (Lucide), time, date-range, range.
    • New extras module with explicit Lucide ICON_MAP; marked is dynamically imported on first preview; color picking via react-colorful.
  • UI Improvements

    • Inputs standardized to h-10; Select menus use text-sm with more space; RichText toolbar doesn’t wrap with a “More” menu and larger buttons.
    • Dates/times: Calendar in a popover; compact TimeField next to date; typed times normalize (e.g., 9:3 → 09:30).
    • Colors: Popover picker with presets and an eyedropper.
    • Media: Image/Video fields use fixed h-48 previews, cleaner empty states, and hover actions.
    • Object/Array: Object rows styled like inputs with an indent + left rule; array rows stay highlighted while their menu is open.

Written for commit da1810d. Summary will update on new commits.

rafavalls and others added 4 commits May 8, 2026 17:20
Existing-field UX:
- inputs to h-10 (40px); RichText toolbar buttons + CodeField header bigger
- RichText toolbar no longer wraps — secondary buttons in a "More" menu
- ObjectField is a proper input-styled row; nested children get an indent + rule
- ImageField/MediaField fixed h-48 with cleaner empty state and hover actions
- ColorInputField now react-colorful in a popover with 12 presets + eyedropper
- DateField now shadcn Calendar+Popover; embedded TimeField in compact mode
- TimeField is typeable HH:MM with hour/minute popover columns
- Array rows + section rows stay highlighted while their dropdown menu is open
- Select dropdown items use text-sm with breathing room

New components (cms-form-extras.tsx) wired by schemaFormat:
- SwitchField (boolean, format=switch)
- TagsField (array, format=tags)
- MultiSelectField (array, format=multi-select with items.enum)
- SlugField (string, format=slug)
- UrlField (string, format=url) with favicon + validity badge
- MarkdownField (string, format=markdown) with write/preview tabs
- ReferenceField (string, format=reference) with searchable picker
- IconField (string, format=icon) Lucide picker
- TimeField (string, format=time)
- DateRangeField (object, format=date-range)
- RangeField (number, format=range) slider

deps: react-colorful, marked
- IconField: drop import * as LucideIcons (full lib in bundle); use a typed
  ICON_MAP with explicit imports, and POPULAR_ICONS = Object.keys(ICON_MAP)
- MarkdownField: lazy-load marked on first preview tab open instead of static
  import; show a brief "Loading preview…" while the chunk arrives
- UrlField, MarkdownField: drop redundant `local` mirror state — these are
  not typing buffers; just bind input value to value/onChange directly
- SwitchField: use shared FieldLabel (now accepts className) instead of
  hand-rolled label/description div
- Drop two narrating comments from TimeField helpers
- MultiSelectField branch: extract `itemSchema?.enum` to a local so
  Array.isArray narrows it; drops a redundant `as unknown[]` cast
- nestClass: trim 3-line comment to 2 lines focused on the WHY of the
  spacing values
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@guitavano guitavano force-pushed the rafavalls/list-form-components branch from 71b9c39 to da1810d Compare May 8, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants