# Input Group Component

## Objective

Join prefixes, suffixes, and buttons to an input so they read as one control.

A composite control binding an input to adjoining affixes and buttons within a single visual frame.

## Before You Begin

This feature is being added to an application that already exists and already
works. Do not scaffold a new project, and do not assume a blank slate.

Inspect the codebase first and establish:

- The existing application structure and where code of this kind already lives.
- The framework and version in use.
- The existing design system — colours, spacing, typography, and component conventions.
- Existing UI components you can reuse instead of writing new ones.
- The existing database structure, if this feature needs to persist anything.
- The existing authentication and authorization system, if this feature is user-scoped.
- Dependencies already installed, so you don't add a library that duplicates one.
- The existing test setup and conventions.

Only start writing code once you understand the above. If the application
already implements part of this feature, extend it rather than replacing it.

## Implementation Instructions

1. Find the places the app already fakes this — a currency symbol floating beside a number field, a copy button jammed next to a token, a domain suffix drawn as separate text — and rebuild them as one group.
2. Draw the focus treatment around the whole group when any child inside it holds focus, so the composite reads as one control rather than a box beside a button.
3. Give the group one accessible name from the field's label and describe affixes separately; a currency symbol or a unit must be exposed as description, not as a second label.
4. Manage borders and corner radii from the group so the first and last visible children round correctly no matter which affixes are present, including when one is conditionally hidden.
5. Do not let a button inside the group become the form's default submit by accident. Declare each embedded button's behaviour explicitly, because a reveal or copy control that submits the form on Enter is a data-loss bug.

## UI and UX Requirements

Match the application's existing design system exactly. Reuse its components,
spacing, and typography. This feature should look like it was always there.

## Responsive Requirements

Works on mobile, tablet, and desktop. Touch targets are large enough to hit on a
phone, and nothing overflows horizontally at 320px.

## Accessibility Requirements

- Fully keyboard navigable.
- Correct semantic elements and ARIA roles.
- Visible focus states.
- Meets WCAG AA contrast.
- Dynamic changes are announced to screen readers.
- Respects prefers-reduced-motion.

## Edge Cases

- Focus lives on exactly one child at a time, but the invalid, disabled, and focused treatments belong to the frame — a ring drawn only around the inner input looks like a rendering fault.
- The affix must not repeat the label; a field labelled Amount in USD with a dollar prefix announces the currency twice to a screen reader.
- A group containing more than one control needs per-child validity — a disabled or invalid button inside the group must not make the text input unusable, and vice versa.
- Radii and borders must be recomputed when an affix appears or disappears at runtime, or the group will render with a square corner in the middle of a rounded frame.
- Long affix content and long input values must not push the group past its container; the input should shrink and the affixes hold their intrinsic width.
- Every embedded icon-only button needs an accessible name and a hit area meeting the minimum touch target, even when the group is rendered at compact density.
- The label, description, and error text around the group are owned by Form Field Shell — this component owns the inside of the frame only.

## Testing

Exercise the feature end to end in the running application. Cover every edge case
above, then run the existing test suite and confirm nothing regressed.

## Acceptance Criteria

- [ ] Grouped affixes, inputs, and buttons render inside a single continuous frame.
- [ ] Focus on any child produces one focus treatment on the whole group.
- [ ] The group carries one accessible name, with affixes exposed as description.
- [ ] Corner radii and borders remain correct when affixes are added or removed at runtime.
- [ ] Embedded buttons have explicit behaviour and never submit the form unintentionally.
- [ ] Icon-only buttons in the group have accessible names and adequate touch targets.
- [ ] The feature matches the existing design system.
- [ ] No existing functionality is broken.

## Adaptation Rules

- Match the existing design system. Do not introduce a new colour palette,
  spacing scale, or component library.
- Reuse existing components and utilities wherever they fit.
- Follow the naming, file layout, and code style already present.
- Do not upgrade, replace, or remove existing dependencies to make this
  feature fit. Adapt the feature to the app, not the app to the feature.
- Do not break existing functionality. If a change is genuinely required in
  existing code, make the smallest one that works and say so.
- If something in these instructions conflicts with how the application is
  built, follow the application and explain the deviation.

## Final Verification

Before you report the work as done:

1. Re-read the acceptance criteria above and check each one against what you
   actually built.
2. Run the application and exercise the feature end to end.
3. Run the existing test suite and confirm you have broken nothing.
4. Check the feature on mobile, tablet, and desktop widths.
5. Check keyboard navigation and focus handling.
6. Summarize what changed: files added, files modified, and anything you
   deliberately did differently because of how this application is built.

If any acceptance criterion is unmet, fix it before reporting completion.
