<!-- source-hash: 4488babe1708a2df7fd49ce4d01e1ce8 -->
A client-side React component for managing a list of allowed domains, supporting add/remove operations with optional validation, duplicate prevention, and error display.

## Key Components

### `AllowedDomainsInputProps`

| Prop | Type | Description |
|------|------|-------------|
| `value` | `string[]` | Controlled list of current domains |
| `onChange` | `(domains: string[]) => void` | Callback when domain list changes |
| `onValidate` | `(domain: string) => { valid, error?, cleanedDomain? }` | Optional custom domain validator |
| `label` | `string` | Field label (default: `"Allowed Domains"`) |
| `placeholder` | `string` | Input placeholder (default: `"example.com"`) |
| `disabled` | `boolean` | Disables all interactions |
| `error` | `string \| null` | External error message |
| `helperText` | `string` | Helper text shown when no error is present |

### `AllowedDomainsInput`

A `forwardRef` component that renders:
- **Existing domain rows** — each as a disabled `Input` with an `X` remove button
- **New domain input** — accepts `Enter` key or "Add Domain" button to submit
- **Validation feedback** — displays external `error` or internal `localError`

## Usage Example

```typescript
import { AllowedDomainsInput } from "@/components/ui/allowed-domains-input"

function SettingsForm() {
  const [domains, setDomains] = React.useState<string[]>(["flamingo.run"])

  const validateDomain = (domain: string) => {
    const cleaned = domain.toLowerCase().replace(/^https?:\/\//, "")
    const valid = /^[a-z0-9.-]+\.[a-z]{2,}$/.test(cleaned)
    return { valid, error: valid ? undefined : "Enter a valid domain", cleanedDomain: cleaned }
  }

  return (
    <AllowedDomainsInput
      value={domains}
      onChange={setDomains}
      onValidate={validateDomain}
      helperText="Only users from these domains can sign in."
    />
  )
}
```

> **Note:** Duplicate domains are silently ignored. If `onValidate` returns a `cleanedDomain`, that normalized value is stored instead of the raw input.