-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating MUI Autocomplete for searching and filtering countries #54
base: master
Are you sure you want to change the base?
Conversation
src/index.tsx
Outdated
@@ -214,6 +216,20 @@ const MuiTelInput = React.forwardRef( | |||
{...MenuProps} | |||
/> | |||
) : null} | |||
{!disableDropdown && allowSearch ? ( | |||
<FlagsAutocomplete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much duplications.. Would be nice to keep everything less verbose, and having only a logic for the visibility of the autocomplete (visible or not visible).
<ClickAwayListener onClickAway={onClose}> | ||
<Autocomplete | ||
autoHighlight | ||
filterOptions={(options, { inputValue }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this out of the JSX plz
@viclafouch Thanks for looking through! I'll make the updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having all styles "hardcoded", please make them optional / customisable and provide the possibility to add custom CSS classes to each element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emkayy I think there needs to be baseline styling so that it matches the current FlagMenu
. Do you have components of the autocomplete in mind that you'd think would benefit from making it optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Baseline styling yes, but I think it's important to be able to customize it. Unfortunately I don't know what you mean by "Do you have components of the autocomplete in mind ...".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you read the source code for FlagsAutocomplete
there are different components in there that would require some styling. I'm asking which ones you would actually consider important to have customized styling for.
It might be a good idea for you to clone my fork and see what might be important for you to have some control over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for the input it would be better to have a plain input without a label that spans across the whole popper width.
However, for complete customization, the renderInput prop for Autocomplete would be great, like
<MuiTelInput flagPopupProps={{ AutocompleteProps: {renderInput: ()=> MyCustomInput }}} />
For the popper I would use the theme default style and not do any custom styling. But if you do, you should also provide props to override them.
1. Fixing the issue with getting the appropriate option label 2. Moving logic out of jsx for readability
i need this feature 🥲 |
@viclafouch I've addressed your initial concerns. Let me know if there's anything else you want me to consider looking into. |
Let me take a look this weekend ;) ty !! |
@ja153903 Hey! I just noticed we're using this library on one of our projects and I'm being asked to add this feature. Do you think this will be implemented any time soon or should I look for something else/build something from scratch? |
Hello ! We need this feature 🙏 |
Would love to use this library, just need that search ability added! |
Hey ! Please resolve conflict and then I will merge the PR ! Sorry for the delay ! Ty ! |
we need this feature please when this feature is available ? |
Would love to get this in as well! Let me know if there is a way to help. |
Looks like just a few conflicts from getting this merged. Would be a great addition to the library. Following for release! 😄 |
+1 |
2 similar comments
+1 |
+1 |
This PR integrates an alternative modal to the
FlagsMenu
that allows for the selection of a calling code via countries. This method integrates MUI'sAutocomplete
component to allow users to type and filter the list of countries to easily find their desired calling code.Comments are appreciated!