feat(clay): CommandInputControl for the detached command mode - #41
Merged
Conversation
Command keeps its palette mode (Command + CommandInput + CommandList in one panel) unchanged. Add CommandInputControl: the bare cmdk text input (no wrapper box) so the command field can be embedded in an InputGroup (or any container) while the CommandList renders detached as an absolute dropdown - the navbar-search pattern used by the Brika store. It carries data-slot="input-group-control" so a wrapping InputGroup's focus halo fires. New navbar-search demo shows the detached usage. Claude-Session: https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM
Clicking a prefix InputGroupAddon (its label htmlFor) did not focus a CommandInputControl, unlike InputGroupInput, because the bare cmdk input never picked up the group's control id. Export InputGroupControlIdContext and have CommandInputControl read it (id = id ?? controlId), mirroring InputGroupInput, so addon-click-to-focus works in the detached mode too. Claude-Session: https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM
…mdk) The previous controlId approach was ineffective: cmdk's CommandPrimitive.Input forces its own internal id on the <input> (spreads user props first, then sets id), so a label htmlFor can never match a CommandInputControl. Instead, InputGroupAddon now focuses the sibling [data-slot=input-group-control] on mousedown (skipping interactive children), which works for InputGroupInput, InputGroupTextarea, AND the cmdk-backed CommandInputControl. Revert the now- useless InputGroupControlIdContext export and the id wiring on CommandInputControl. Claude-Session: https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM
|
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.



Two command modes
The Command component now supports two usages:
1. Palette (unchanged, "comme avant") -
Command+CommandInput+CommandListtogether in one panel. The classic keyboard palette. Untouched.2. Detached ("déporté") - new
CommandInputControl: the barecmdktext input with no wrapper box, so the command field plugs into anInputGroup(or any container) while theCommandListrenders detached as an absolute dropdown. This is the navbar-search pattern used by the Brika store.CommandInputControlsetsdata-slot="input-group-control"so the wrappingInputGroup's focus halo fires, and is borderless/transparent (h-full flex-1) to fill the group.Notes
navbar-searchdemo (auto-registered) shows the detached usage.Checks
bun run typecheck,bun run build,bun test(390 pass),biome check- all green.https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM