Skip to content

feat(prompt-input): add PromptInput with token highlighting - #3

Closed
pratikbuilds wants to merge 1 commit into
conversation/05-conversationfrom
conversation/08-prompt-input
Closed

pratikbuilds wants to merge 1 commit into
conversation/05-conversationfrom
conversation/08-prompt-input

Conversation

@pratikbuilds

Copy link
Copy Markdown
Owner

PromptInput is a fully controlled form. PromptInputTextarea draws @mention and /command tokens on an aria-hidden mirror beneath transparent native text, grows through field-sizing with a measured fallback, and never submits during IME composition. usePromptInput drives PromptInputSuggestions from the keyboard, and PromptInputSubmit turns Send into Stop while a reply is running.

Stacked on #2: review only this commit. Part of corbitsdev#94.

Notes for review

  • status lives on PromptInput (root), not PromptInputSubmit: Enter must see the status so it never sends mid-reply; PromptInputSubmit takes only onStop.
  • Fixed while building: Stop could also send the draft when the host flipped status to ready inside onStop; the Stop click now cancels that (e2e covers it).
  • Sizing fallback is covered by e2e only (happy-dom reports field-sizing as supported and has no layout).
  • Not shared with ChatInput/Textarea sizing to keep existing modules untouched; a follow-up could consolidate after the old family is removed.
  • canSubmit on PromptInput (default value.trim() !== "") lets a host send attachments with no text, e.g. canSubmit={value.trim() !== "" || files.length > 0}; Enter and Send both honour it; disabled, busy status and IME composition still block.

Verification

  • This commit passes bun run typecheck and bun run lint on its own (the stack is checked commit by commit).
  • At the top of the stack: bun run check, bun run build, bun run dep-guard, bun run contrast-test and bun run test:e2e (Playwright specs and the Storybook axe sweep in light and dark) pass.

Closes corbitsdev#102

PromptInput is a fully controlled form. PromptInputTextarea draws
@mention and /command tokens on an aria-hidden mirror beneath transparent
native text, grows through field-sizing with a measured fallback, and
never submits during IME composition. usePromptInput drives
PromptInputSuggestions from the keyboard, and PromptInputSubmit turns
Send into Stop while a reply is running.
@pratikbuilds

Copy link
Copy Markdown
Owner Author

Moved upstream: corbitsdev#115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant