feat: Add country selection props and search functionality to InputPhoneNumber component
Overview
Enhanced the bds-input-phone-number component to provide better country selection capabilities and search functionality, addressing user requests for easier flag changing and country code searching.
โจ New Features
๐ณ๏ธ Enhanced Initial Country Selection
Added new props to set the initial country in multiple ways:
-
initialCountryFlag- Set country by flag name (e.g., "brazil-flag", "united-states-flag") -
initialIsoCode- Set country by ISO code (e.g., "BR", "US", "GB")
Priority order: initialCountryFlag > initialIsoCode > value prop > default
<!-- Set initial country by flag name -->
<bds-input-phone-number initial-country-flag="united-states-flag"></bds-input-phone-number>
<!-- Set initial country by ISO code -->
<bds-input-phone-number initial-iso-code="GB"></bds-input-phone-number>
๐ Search Functionality
Added comprehensive search capabilities to the country dropdown:
-
enableSearch- Enable/disable search functionality (default: false) -
searchPlaceholder- Custom search placeholder text (default: "Search countries...") - Real-time filtering by country name, code, or ISO code
- Sticky search input at top of dropdown
<!-- Enable search with custom placeholder -->
<bds-input-phone-number
enable-search="true"
search-placeholder="Find your country...">
</bds-input-phone-number>
๐ ๏ธ Implementation Details
- Architecture: Follows existing autocomplete component pattern for consistency
- Backward Compatibility: Zero breaking changes - all existing functionality preserved
- Performance: Efficient real-time filtering with proper state management
- Styling: Consistent with design system, sticky search input positioning
๐งช Testing
- Comprehensive test coverage for all new props and functionality
- 747/747 tests passing โ
- Build successful โ
- Property validation, priority order testing, search functionality verification
๐ Documentation
- Auto-generated documentation updated with new props
-
New Storybook stories demonstrating all features:
- WithSearch
- InitialCountryByFlag
- InitialCountryByIsoCode
- SearchWithInitialCountry
๐ฏ Resolves User Request
"Is it possible to change the flag of the inputPhoneNumber through props or give the user the possibility to search by country code?"
Answer: YES! Both capabilities are now fully implemented:
- โ Change flag through props - Multiple options with priority handling
- โ Search by country code - Plus country name and ISO code filtering
The implementation provides even more functionality than requested, offering multiple ways to set the initial country and comprehensive search capabilities.
Fixes #817.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com
- Triggering command:
/home/REDACTED/work/blip-ds/blip-ds/node_modules/puppeteer/.local-chromium/linux-1002410/chrome-linux/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --disable-dev-shm-usage --use-angle=swiftshader-webgl --use-gl=angle --mute-audio --headless --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,4850787935678578506,17339950920984909433,131072 --enable-features=NetworkServiceInProcess2 --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BackForwardCache,PaintHolding,Translate(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to my firewall allow list
๐ก 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.