feat: Add global navigation search component with i18n and keyboard shortcuts#1108
feat: Add global navigation search component with i18n and keyboard shortcuts#1108Copilot wants to merge 11 commits into
Conversation
- Created bds-search-anywhere component with modal, keyboard shortcuts - Implemented search filtering, keyboard navigation (↑↓ Enter Escape) - Added comprehensive unit and E2E tests (all passing) - Component supports custom options, icons, descriptions - Exposes events for search changes and option selection Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
- Created MDX documentation with usage examples - Added multiple story variants: Properties, DynamicFiltering, StorybookComponentsSearch - Included examples for different option formats (with/without icons/descriptions) - Added Events and Methods demos - Included React integration example Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
|
check storybook build => Failed to build the preview |
Changed import from '@storybook/blocks' to '@storybook/addon-docs/blocks' to match the existing pattern used by other components in the project Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
|
|
@copilot here are some issues that need to be fixed:
|
- Changed title from "Components/Search Anywhere" to "Components/Search" for proper alphabetical ordering - Fixed Storybook navigation to detect and handle different URL patterns (PR preview, v2 branch, main) - Navigation now works correctly in all environments with proper base URL detection Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
Fixed in commit 6a3d43d:
Navigation now works correctly in all environments with both same-tab and new-tab (Ctrl+Click) support. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot in the overview of the component, the props, events and methods are bad formatted:
|
- Changed all non-existent icons to valid blip-ds icons (analytics, dolar, contact, message-ballon, etc) - Fixed Storybook title from "Components/Search" to "Components/SearchAnywhere" for proper alphabetical ordering after RichText and Select - Removed duplicate Meta tag in MDX that was causing build errors - All icons now use valid blip-ds icon names from the available icon set Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
Fixed in commit 9ff467a. Updated the MDX file to use Storybook's Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
eab6411 to
5abf6f3
Compare
|
@copilot the component should only display a “selected” item after the user presses the arrow up or down for the first time. By default, there’s no need to show any selected state, users will typically interact with the list using the mouse, and the hover state will already provide the necessary visual feedback. |
- Added language support (pt_BR, en_US, es_ES) with translation files - Implemented accent-insensitive search using Intl.Collator with sensitivity: 'base' - No initial selection - only shows selected state after arrow key press - Fixed all tests to work with new selection behavior - All 73 tests passing (39 unit + 34 E2E) Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
Fixed in commit 4f04f6e. The component now starts with selectedIndex = -1 (no selection). Users must press ↑ or ↓ to activate selection. Hover still provides visual feedback without needing arrow keys. |
|
@copilot guarantee that in the storybook for this component contains all possible properties available. For example language property is not shown in the storybook:
|
- Added language prop to Properties story args and argTypes - Language selector now appears in Storybook controls with options: pt_BR, en_US, es_ES - Default language set to pt_BR - Property is properly wired to component in story template Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>
Fixed in commit a8eed04. Added the |
|
@copilot if user press enter without any item selected, just select the first element of the list |
- Modified Enter key handler to automatically select first option if no item is selected - Added E2E test to verify Enter key selects first option when no selection exists - All 74 tests passing (39 unit + 35 E2E) Co-authored-by: lucasoares <10624972+lucasoares@users.noreply.github.com>





✅ Global Navigation System - Production Ready
🎯 Summary
Successfully implemented a production-ready Search Anywhere component (
bds-search-anywhere) for the Blip Design System using only blip-ds components. This component provides a global navigation system inspired by Notion and Linear, with full keyboard support, real-time filtering, internationalization, accent-insensitive search, and comprehensive documentation.📦 Deliverables
Component Files
search-anywhere.tsx- Main component using blip-ds components (470 lines)search-anywhere.scss- Styling with design tokens (228 lines)search-anywhere-interface.ts- TypeScript interfacessearch-anywhere.mdx- Comprehensive documentationsearch-anywhere.stories.jsx- 10 Storybook stories with all properties exposedreadme.md- Auto-generated API documentationlanguages/- Translation files (pt_BR, en_US, es_ES)Component Architecture - Using Only blip-ds Components ✅
Tests - All 74 Passing ✅
✨ Key Features Implemented
1️⃣ Keyboard Shortcuts
2️⃣ Search Functionality
Intl.Collatorwithsensitivity: 'base'3️⃣ Internationalization (i18n)
pt_BR(default),en_US,es_ES4️⃣ Improved Selection Behavior
5️⃣ Flexible Options System
6️⃣ Events for Integration
bdsSearchOpen- Modal openedbdsSearchClose- Modal closedbdsSearchChange- Search text changed (enables dynamic filtering)bdsSearchSelect- Option selected (with newTab flag)7️⃣ Programmatic Control
open()- Open modal programmaticallyclose()- Close modal programmaticallygetIsOpen(),getSearchText(),getSelectedIndex()🎯 Acceptance Criteria - All Met ✅
onSearchChangedelivers user input to the parent component🏗️ Build Status
✅ All builds successful
24.11s✅📊 Test Coverage
74 Tests - 100% Passing
Unit Tests (39 tests):
E2E Tests (35 tests):
🌍 Internationalization
Language Prop:
Storybook Controls: Language selector available in Controls panel with dropdown showing all 3 options.
Translated Terms:
🔍 Accent-Insensitive Search
Uses
Intl.Collatorwithsensitivity: 'base'for proper internationalization:How it works:
bdsSearchChangeeventNote: When using dynamic search (via
bdsSearchChangeevent), the parent component controls filtering and can implement its own search logic (e.g., server-side search).🎨 Design Implementation
Uses Only blip-ds Components:
bds-paper- Modal container with elevationbds-input- All input fields (trigger and search)bds-icon- All iconsbds-typo- All typography$color-surface-*,$color-content-*,$color-border-*,$color-primaryVisual Quality:
🔧 Technical Stack
Intl.Collatorfor accent-insensitive matching🎓 Component Properties
All properties are now exposed in Storybook controls:
language'pt_BR' | 'en_US' | 'es_ES''pt_BR'optionsSearchAnywhereOption[][]placeholderstringtriggerPlaceholderstringshowShortcutbooleantruemaxResultsnumber10💡 Enhanced UX Features
Smart Enter Key Behavior:
✅ Ready for Production
The Search Anywhere component is production-ready with enhanced keyboard navigation! 🎉
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.