feat: add Combobox component - #26
Open
patrickkuei wants to merge 1 commit into
Open
Conversation
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.
Closes #14
Summary
Comboboxcomponent: a cyberpunk-styled searchable dropdown for long option lists (country pickers, tag search, corporation lookup), extendingSelect's controlled-value pattern withInput's focus-glow styling.role="combobox"on the input + alistboxpopup witharia-activedescendant) so arrow keys move a highlight without moving DOM focus off the text input — same approach used forRadioGroup/Accordion's roving-tabindex widgets, adapted for a single focusable input.variantand responsivesizereuseInput/Select's exact vocabulary and shadow/glow classes rather than inventing new styling. The full option list stays visible immediately on focus (anisFilteringflag distinguishes "just opened, showing the selected label" from "actively typing") so opening a combobox that already has a value doesn't appear to filter itself down to one match.allowCustomValuelets typed text that doesn't match any option commit as-is on Enter/blur — text that exactly matches an option's label (case-insensitive) still resolves to that option instead of a raw string commit.options,value/onValueChange, text input filtering as you type, keyboard navigation with arrow keys/Enter/Escape, optionalallowCustomValue, cyberpunk styling matching Select/Input) is covered in this PR.Changes
Combobox(src/components/Combobox.tsx) —options,value/defaultValue/onValueChange,label,placeholder,variant, responsivesize,disabled,helperText,error,allowCustomValue,noOptionsText,ariaLabel,className,id,name. No new runtime dependencies — filtering is a plain case-insensitive substring match.Combobox/ComboboxProps/ComboboxOptionfromsrc/components/index.ts.Combobox.stories.tsx): Default, Secondary/Danger/Ghost variants, sizes (Small/Medium/Large), WithError, Disabled, AllowCustomValue, Controlled, and an AllVariants render story (cyberpunk copy throughout, e.g. "Target Sector", "Purge Target", "Ghost Protocol").Combobox.test.tsx, 19 cases): renders without crashing,role="combobox"/aria-expanded/aria-controls/aria-autocompletewiring, opens showing all options on focus, filters as you type, no-matches message, option selection via click, disabled options blocked, keyboard navigation (ArrowDown/ArrowUp/Home/End) skipping disabled options with correctaria-activedescendant, Escape reverting unmatched text, blur reverting (default) vs. committing (allowCustomValue) unmatched text, exact-label-match resolving to that option instead of a raw commit, controlledvaluewithout self-managing state,aria-selectedwiring, error state +aria-invalid, disabled state, responsive size.Comboboxintoscripts/generate-manifest.js(CATEGORY_MAP→ Forms, alongsideSelect/RadioGroup;DOC_SUMMARIES) and regenerated docs vianpm run docs:generate— diff reviewed, onlyCombobox-related lines changed.[Unreleased].Test plan
Generated by Claude Code