Skip to content

feat(forms): add InputField + field components (Phase 1)#7768

Closed
talissoncosta wants to merge 13 commits into
feat/input-ts-7758from
feat/input-field-components
Closed

feat(forms): add InputField + field components (Phase 1)#7768
talissoncosta wants to merge 13 commits into
feat/input-ts-7758from
feat/input-field-components

Conversation

@talissoncosta

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #5746

Phase 1 of the form-component redesign — purely additive (no existing component or consumer changes). Stacked on #7762 (Input → TS); base feat/input-ts-7758.

New components (each with Storybook stories under Components/Forms):

  • FieldLabel — label wired to its control via htmlFor, with an optional required indicator.
  • FieldError — inline per-field validation message. The small-text counterpart to the ErrorMessage banner (different jobs); standardises the text-danger text-small span hand-rolled today.
  • InputField — composes FieldLabel + Input + FieldError into one labelled, validated field. Controlled and library-agnostic (takes error); the typed successor to the untyped InputGroup.
  • PasswordInput / SearchInput — composed inputs that will own the password-reveal / search adornments. Phase 1 delegates to Input; the adornment logic moves into them when Input is slimmed.

The redesign, phased

  1. This PR — new components (additive).
  2. Migrate consumers: searchSearchInput (~26), type='password'PasswordInput (~14), isValid/InputGroupInputField (~50/~62).
  3. Slim Input to a dumb primitive (drop search + the password toggle; controlled invalid), retire InputGroup.

No form-state library introduced — InputField is controlled, so it works with manual state today and is drop-in for react-hook-form later if ever adopted.

How did you test this code?

  • npm run typecheck: new component files are clean; stories carry only the pre-existing storybook-module note shared by all 58 existing stories.
  • npm run lint: clean on all new files.
  • Storybook: each component has variant stories (Default, Required, WithError, Sizes, …) for visual coverage. Draft to validate the lint gate / Unit Tests / E2E in CI.

talissoncosta and others added 3 commits June 11, 2026 17:47
FieldLabel wires a label to its control (+ required indicator); FieldError
renders an inline per-field validation message (the small-text counterpart
to the ErrorMessage banner). With Storybook stories.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Composes FieldLabel + Input + FieldError into one labelled, validated
field. Controlled and library-agnostic (takes `error`); the typed
successor to InputGroup. With Storybook stories.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Composed inputs that will own the password reveal / search adornments.
Phase 1 delegates to Input; the adornment logic moves here when Input is
slimmed. With Storybook stories.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@talissoncosta talissoncosta added the front-end Issue related to the React Front End Dashboard label Jun 11, 2026
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jun 11, 2026 9:48pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jun 11, 2026 9:48pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 11, 2026 9:48pm

Request Review

PasswordInput sizes, SearchInput disabled, and InputField read-only +
no-label states. Dark mode is covered automatically by Chromatic's
global light/dark modes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
FieldLabel shows an info icon with a hover tooltip when `tooltip` is
passed (the recurring InputGroup pattern); InputField forwards it. With
Storybook stories.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Tooltip's children is a string; match it (and LabelWithTooltip).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 11, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 11, 2026
Field composes FieldLabel (+ tooltip/required) + any control + FieldError —
the control-agnostic foundation that replaces InputGroup's component slot.
InputField is now Field specialised to Input.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Field specialised to a textarea (label + error + tooltip). With Storybook
stories.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 11, 2026
Replace <Input search /> with <SearchInput /> across 16 files (18 sites).
Behaviour-identical; SearchInput fixes type='text' + the search icon.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace <Input type='password' /> with <PasswordInput /> in Token,
CreateWebhook and CreateAuditLogWebhook. Behaviour-identical.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- FieldError renders block below the control (was inline, beside it)
- FieldLabel flex-centres the tooltip icon with the label text
- Wire aria-describedby + aria-invalid so screen readers announce the
  error and its association with the control (FieldError gets a stable id)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Omit Input props that don't belong on a labelled, validated field:
autoValidate/isValid (controlled via error), search (use SearchInput),
underline (inline-edit variant), centered, showSuccess, enableAutoComplete.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- FieldLabel now composes the shared LabelWithTooltip (DS Tooltip) instead
  of hand-rolling Tooltip+Icon; widen LabelWithTooltip's label to ReactNode.
- InputField: drop wrapperClassName; the standard className now styles the
  field wrapper (no longer leaked to Input's inner container), inputClassName
  styles the input.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant