Skip to content

refactor(forms): migrate Input to TS#7762

Draft
talissoncosta wants to merge 7 commits into
feat/label-variant-key-uifrom
feat/input-ts-7758
Draft

refactor(forms): migrate Input to TS#7762
talissoncosta wants to merge 7 commits into
feat/label-variant-key-uifrom
feat/input-ts-7758

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 #7758

Migrates the Input base component (behind ~94 call sites) from Input.js to a typed function component, Input.tsx. Stacked on #7745 (base branch feat/label-variant-key-ui) — will retarget to main once that merges.

  • Typed FC. React 19 ref-as-prop + useImperativeHandle exposing the E2E-guarded focus() (no-op under E2E, matching the original).
  • Drops the unused react-maskedinput dependency and the checkbox/radio delegation (the one caller renders <Checkbox> directly).
  • Unifies the password/search icon widths via one size map; the invalid password icon uses the colorIconDanger token instead of a hardcoded hex.
  • Updates ~17 call sites: removes bogus DOM InputEvent/KeyboardEvent annotations on Input handlers (React infers the synthetic events) and fixes a few loose usages typing surfaced (JSX in the string title, readonlyreadOnly, non-boolean isValid, a boolean value).

Out of scope (follow-ups): the wrapper-less redesign with PasswordInput/SearchInput, an Input variant API, the autocompleteautoComplete alias removal, and the repo-wide InputEvent-annotation cleanup.

How did you test this code?

  • npm run typecheck: 0 new errors vs the base branch (the typed Input removed one pre-existing error; 976 → 975).
  • npm run lint: clean on all changed files.
  • Opened as draft to validate the CI lint gate, typecheck and E2E. Manual in-app verification (light/dark, password reveal, search, underline variant) still pending.

talissoncosta and others added 3 commits June 11, 2026 14:23
Convert Input.js to a typed function component (Input.tsx). React 19
ref-as-prop + useImperativeHandle for the E2E-guarded focus(); drop the
unused react-maskedinput dependency and the checkbox/radio delegation.
Unify the password/search icon widths and use the colorIconDanger token.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Input no longer delegates type='checkbox' to Checkbox, so the single
caller uses <Checkbox> directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the bogus DOM InputEvent/KeyboardEvent annotations on Input
handlers (React infers the correct synthetic events) and fix a few
loose call sites surfaced by typing: JSX passed to the string title,
readonly->readOnly, non-boolean isValid, and a boolean value.

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 12, 2026 11:50am
flagsmith-frontend-staging Ready Ready Preview, Comment Jun 12, 2026 11:50am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 12, 2026 11:50am

Request Review

@talissoncosta talissoncosta changed the title Migrate Input to TS refactor(forms): migrate Input to TS Jun 11, 2026
@talissoncosta talissoncosta marked this pull request as ready for review June 11, 2026 17:53
@talissoncosta talissoncosta requested a review from a team as a code owner June 11, 2026 17:53
@talissoncosta talissoncosta requested review from kyle-ssg and removed request for a team June 11, 2026 17:53
@talissoncosta talissoncosta removed the request for review from kyle-ssg June 11, 2026 17:54
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api:pr-7762 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7762 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7762 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-e2e:pr-7762 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-7762 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7762 Finished ✅ Results

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  35.5 seconds
commit  34e9558
info  🔄 Run: #17442 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.6 seconds
commit  34e9558
info  🔄 Run: #17442 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  1 minute
commit  34e9558
info  🔄 Run: #17442 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  55.5 seconds
commit  34e9558
info  🔄 Run: #17442 (attempt 1)

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

talissoncosta and others added 3 commits June 12, 2026 08:32
Use the named React KeyboardEvent (matching Input.tsx) instead of the
React.KeyboardEvent namespace form.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
FieldLabel wires a label to its control (+ required indicator + an info
tooltip via the shared LabelWithTooltip); FieldError renders an inline
per-field message (counterpart to the ErrorMessage banner). Widen
LabelWithTooltip's label to ReactNode. With Storybook stories.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the legacy SCSS colour vars on the input field rules with semantic
tokens that flip per theme: borders -> --color-border-default/strong/action/
danger/disabled, text -> --color-text-default/secondary/tertiary/disabled,
backgrounds -> --color-surface-default. Datepicker/checkbox colours and the
_forms.scss input rules are left for the follow-up decomposition.

Note: the hover border now maps to --color-border-strong (.24) where it was
$basic-alpha-48 (.48) — slightly subtler; no exact .48 token exists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The active .input-container input.input rule (light + dark override) lived in
_forms.scss, so tokenise it to match _input.scss: borders ->
--color-border-default/strong/action/danger/success/disabled, text ->
--color-text-default/tertiary/disabled, bg -> --color-surface-default.

The dark override is kept (not removed) so dark hover/focus stay action-
coloured as before, rather than inheriting the light rule's --color-border-
strong hover. Non-input rules in this file (.label-switch, label) are untouched
pending the _forms.scss decomposition.

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

front-end Issue related to the React Front End Dashboard refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants