Repository navigation
U06: Form primitives: Field, Input, Textarea, Select, Switch, Checkbox - #804
Merged
Merged
Conversation
…witch, Checkbox React wrappers around the existing .field/.input/.select/.textarea/.switch classes so screens stop hand-wiring ids, aria-describedby, aria-invalid and switch semantics; plus a styled Checkbox and a 28px (sm) control size. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
New form primitives in
apps/agent-forge/src/ui/:Field.tsx—Fieldwrapper (label / hint / error / required / inline) that publishesFieldIdsthroughFieldContext;useFieldIds()exposes them to controls.div.field[.field-inline][.field-invalid]withlabel.field-label,p.hintandp.hint.field-error.controls.tsx—Input,Textarea(prose,autoGrow),Select(data-drivenoptions, disabledplaceholderfirst option),Switch(button[role=switch],stateLabelOn/Off overline,size="sm"26×14 track) andCheckbox(styled box with tick/indeterminate drawn in CSS, whole row a<label>). All butSwitchareforwardRefand spread native props. Inside aField, controls defaultidto the Field id, joinhintId/errorIdintoaria-describedby, takearia-invalidfrom the Field error andaria-requiredfromrequired; explicit props win.form.css—.field-label,.field-inline,.input-sm/.select-sm(28px),[aria-invalid]danger border + ring,.textarea-prose/.textarea-autogrow,.switch-wrap/.switch-sm/.switch:disabled,.checkbox*styles. Tokens only, reduced-motion honoured.__tests__/controls.test.tsx— 9 tests covering the Field a11y wiring, explicit-prop overrides, placeholder/options/sm select, prose/autoGrow textarea, switch toggle/disabled/stateLabel/sm, indeterminate + label-click checkbox and the inline-Field switch naming.base.cssand existing screens (Inspector, SettingsPanel) are untouched per the ticket's scope.The four
*Propsinterfaces carryfallow-ignore-next-line unused-typesuppressions: they are the public contract adopted by the form screens in the follow-up tickets.How it was tested
npm test --workspace apps/agent-forge -- --run— 79 files / 858 tests passed (9 new)npm run typecheck --workspace apps/agent-forge— cleannpm run typecheck:server --workspace apps/agent-forge— cleannpm run test:server --workspace apps/agent-forge— 24 files / 337 tests passednpm run lint --workspace apps/agent-forge— 0 errors (30 pre-existing warnings elsewhere)npx tsc --noEmit— cleannpm run lint— cleannpm run test:coverage— 438 files / 6718 tests passed (first run needednpm run build -w create-lousho-agentin the fresh worktree; green after)npm run fallow— pass (0 dead-code issues; the pre-existing.ev-switch/.pg-switchCSS clone from earlier PRs is reported but non-gating)Acceptance criteria
<Field label hint error required>is labelled, described by hint+error,aria-invalid,aria-required.Switchis abutton[role=switch]witharia-checked, toggles on click/Enter/Space, and does nothing when disabled.Checkboxsupports checked, indeterminate and disabled; the tick is drawn with tokens only.controlSize="sm"gives 28px controls; default stays 32px.form.css.Generated with Devin