Skip to content

feat: InputText v2 + FieldText composition#648

Draft
isaquebock wants to merge 3 commits into
mainfrom
feat/inputs-text-v2-and-field
Draft

feat: InputText v2 + FieldText composition#648
isaquebock wants to merge 3 commits into
mainfrom
feat/inputs-text-v2-and-field

Conversation

@isaquebock

Copy link
Copy Markdown
Contributor

Summary

Redesign the InputText field around the new --ring-color token, raise the spec to v2, and introduce a sibling FieldText wrapper that composes Label + InputText + HelperText into a single vertical stack with consistent spacing.

InputText changes (v1 → v2)

  • Restrict type to plain-text variants ('text' | 'email').
  • Add maxLength, required, invalid props.
  • Add iconLeft / iconRight slots.
  • Drive visual states (hover, focus, filled) via native CSS pseudo-classes instead of props; data-* attrs mirror the props for data-[attr]: Tailwind variants.

FieldText (new)

  • useId()-backed inputId wired through Label for + input id + aria-describedby → HelperText.
  • helperKind switches between helper, required, invalid, disabled based on prop state; falls back to a default 'This field is locked.' copy when disabled is true and helperText is empty.
  • Forwards iconLeft / iconRight slots to the underlying InputText.

Stacking

This PR is stacked on top of the Label + HelperText work and currently includes those commits in its diff. Once #645 (Label) and #646 (HelperText) merge to main, the rebase will drop the cherry-picked commits and this PR's diff will narrow to the InputText v2 + FieldText changes only.

Blocked by:

Test plan

  • pnpm --filter @aziontech/webkit lint — clean.
  • Storybook → Webkit/Inputs/InputText → Default + Sizes + Filled + Invalid + Disabled + Icons render with the new tokens.
  • Storybook → Webkit/Inputs/FieldText → Default + Sizes + Required + Invalid + Disabled + Icons render and the helper line picks up the right kind per state.
  • Tab focus shows the dimmer ring (PR feat: dim focus ring color to reduce visual weight #644) instead of the max-contrast ring.
  • In FieldText, clicking the label text focuses the input (manual a11y check).

Introduce `@aziontech/webkit/inputs/label` — a thin `<label>` wrapper that
renders the field text, supports a default slot, and appends a `Required`
tag when the field is required. Wires `for` to the underlying input id so
clicking the label focuses the control.

The component is the label only — helper text, error messages, and the
input itself live in sibling primitives composed by the form-field layer.
Introduce `@aziontech/webkit/inputs/helper-text` — a small text element
that renders auxiliary copy below a form field. The `kind` prop drives
the visual tone:

- `helper` (default): muted token, neutral copy.
- `required`: warning-tone copy paired with the Required tag treatment.
- `invalid`: danger-tone copy for validation errors; usually wired to
  `aria-describedby` on the input.
- `disabled`: muted with a leading lock icon.

The component is the helper line only — wrapping form-field components
own the wiring of `aria-describedby` and the conditional rendering.
Redesign the `InputText` field around the new `--ring-color` token, raise
the spec to v2, and introduce a sibling `FieldText` wrapper that composes
`Label` + `InputText` + `HelperText` into a single vertical stack with
consistent spacing.

InputText changes:
- Restrict `type` to plain-text variants (`'text' | 'email'`).
- Add `maxLength`, `required`, `invalid` props.
- Add `iconLeft` / `iconRight` slots.
- Drive visual states (hover, focus, filled) via native CSS pseudo-classes
  instead of props; `data-size`, `data-disabled`, `data-invalid`,
  `data-required` mirror the props for `data-[attr]:` Tailwind variants.

FieldText:
- `useId()`-backed `inputId` wired through Label `for` + input `id` +
  `aria-describedby` -> HelperText.
- `helperKind` switches between `helper`, `required`, `invalid`,
  `disabled` based on prop state; falls back to a default `'This field
  is locked.'` copy when `disabled` is true and `helperText` is empty.
- Forwards `iconLeft` / `iconRight` slots to the underlying InputText.
@isaquebock isaquebock requested a review from a team as a code owner June 17, 2026 17:52
@isaquebock isaquebock marked this pull request as draft June 17, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant