[WIP]: refactor(forms): migrate Input to TS#7762
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Docker builds report
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Failed testsfirefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
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>
InputGroup now renders FieldLabel (label + info-icon tooltip) and FieldError instead of hand-rolling them, and wires label -> control -> error off the useId id: htmlFor / id / aria-describedby + aria-invalid, so screen readers announce the field's error (previously the error id was name-based and nothing pointed at it). FieldLabel gains a tooltipPlace prop so InputGroup's tooltipPlace survives. Intentional behaviour changes across ~62 fields (Chromatic is skipped on the draft, so these are unverified visually): - tooltip hover target is the info icon only (was the whole label) - field errors restyle via FieldError (text-small, d-block, mt-1, role=alert) - errors are now associated with the control via aria-describedby/aria-invalid Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
InputGroup never forwarded top-level props (only inputProps), so name, autocomplete, autoFocus, autoValidate, search and rows passed at the top level were always ignored. Remove them from InputGroupProps and strip the ~32 dead occurrences across the consumers. Behaviour-preserving — these props had no effect; the real values come from inputProps. Slims the interface back down after the migration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Tooltip wraps the icon in an inline span, so align-items-center on the label centred the span but not the 12px svg inside it (control-label's svg vertical-align + line-height pushed it off-centre). Make the trigger span a centred flex box so the icon sits centred against the label text.
Variant stories (default, tooltip, single/multiple errors, disabled, textarea, unsaved, sizes, right component) for Chromatic coverage in light + dark — this would have caught the tooltip-icon alignment regression. To render in Storybook, import Row/Flex in InputGroup rather than relying on the runtime globals (both are .tsx now), which also drops a legacy global dependency per the standing TODO in .storybook/preview.js.
FieldLabel was using d-flex on the label, which re-aligned the inline content
(unsaved badge sat off vs prod's baseline-inline placement). Drop flex from the
label so children flow inline like the original control-label, and centre the
tooltip icon via d-inline-flex on its trigger (stays inline + centred). Restore
the title->badge gap (ml-1) that the original {' '} provided.
Verified in Storybook (light + dark) against the prod look.
Mirror the login form's actual rightComponent usage (Forgot password link next to the Password field) instead of a made-up API key example.
…htComponent The login form placed 'Forgot password' in the password field's label row via InputGroup's rightComponent escape hatch — an uncommon pattern. Move it to a right-aligned link below the field (the conventional placement). HomePage was the sole rightComponent consumer, so remove the prop from InputGroup entirely and its Storybook story. Behaviour: same link/handler, just relocated. No E2E selects it by position.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #7758
Migrates the
Inputbase component (behind ~94 call sites) fromInput.jsto a typed function component,Input.tsx. Stacked on #7745 (base branchfeat/label-variant-key-ui) — will retarget tomainonce that merges.useImperativeHandleexposing the E2E-guardedfocus()(no-op under E2E, matching the original).react-maskedinputdependency and the checkbox/radio delegation (the one caller renders<Checkbox>directly).colorIconDangertoken instead of a hardcoded hex.InputEvent/KeyboardEventannotations onInputhandlers (React infers the synthetic events) and fixes a few loose usages typing surfaced (JSX in the stringtitle,readonly→readOnly, non-booleanisValid, a booleanvalue).Out of scope (follow-ups): the wrapper-less redesign with
PasswordInput/SearchInput, anInputvariantAPI, theautocomplete→autoCompletealias removal, and the repo-wideInputEvent-annotation cleanup.How did you test this code?
npm run typecheck: 0 new errors vs the base branch (the typedInputremoved one pre-existing error; 976 → 975).npm run lint: clean on all changed files.