refactor: [M3-6922] - Add Autocomplete Component#9497
refactor: [M3-6922] - Add Autocomplete Component#9497jaalah-akamai merged 28 commits intolinode:developfrom
Conversation
abailly-akamai
left a comment
There was a problem hiding this comment.
This is really nice and clean. Great work!
Added some comments to clean things up.
Also, have we discussed the use of the "Autocomplete" VS "Select" nomenclature. I don't think it is a crucial discussion but I'd be curious to know why gearing towards the MUI naming convention rather than keeping our existing one
There was a problem hiding this comment.
You are overriding a lot of MUI Autocomplete props which I think we should avoid to prevent breaking changes when updating MUI. Rather we should extend the MUI component's props and only declare our custom props. (same with other interfaces below)
They will be automatically picked up by storybook
There was a problem hiding this comment.
Consider this done!
There was a problem hiding this comment.
Out of curiosity, can the value be an object if (for instance) there's an icon to be displayed with the label and in the selected state? I assume this could be also an iteration
There was a problem hiding this comment.
I'm assuming you mean like Regions selector? If so, I added an example of how to do that via the optional data property
There was a problem hiding this comment.
To clarify, this should already be working for the selected option too? I might be missing something but in Storybook it doesn't seem like the flag gets displayed upon selecting an option.
There was a problem hiding this comment.
Could we just pass the props we need here?
There was a problem hiding this comment.
We're type-checking that only list item properties are applied here, I'd rather keep it for flexibility.
packages/manager/src/components/Autocomplete/Autocomplete.stories.tsx
Outdated
Show resolved
Hide resolved
Yes, I thought about this too! The existing |
|
Great work! |
|
Sorry @tyler-akamai been making major changes to this PR, I'm going to close out-of-date comments, but looking forward to your review when I put it up again! |
packages/manager/src/features/Linodes/LinodeSelect/LinodeSelect.tsx
Outdated
Show resolved
Hide resolved
|
There's still a lot more unit tests we can write for this. I may tackle writing them in a separate PR due to my time constraints or someone on the team can pick that up. Ready for review again! 🚀 |
25f5e57 to
b89430d
Compare
dwiley-akamai
left a comment
There was a problem hiding this comment.
This is looking good based on my testing 🎉
We discussed on Friday during the group review/testing that some improvements can be made for the types (e.g. the one marked TODO in Autocomplete.tsx), but I think that could be done in a follow-up PR or iteratively as we implement this component in the app.
There was a problem hiding this comment.
To clarify, this should already be working for the selected option too? I might be missing something but in Storybook it doesn't seem like the flag gets displayed upon selecting an option.
|
Added a storybook example for having separate options as opposed to using @dwiley-akamai Adding flags to the value is not something we can do easily given the types we're restricted to. This may be one tradeoff unless we do a customized input. |
|
Looks great but I have some general concerns about the typesafety of this component.
None of this stuff is easy but I propose we try to align our component more with MUI's implementation
|
| backgroundColor: 'transparent', | ||
| color: primaryColors.main, | ||
| }, | ||
| padding: 12, |
There was a problem hiding this comment.
This was a bug that prevented the IconButton size prop from working properly. There should be no regressions since we default to the large size which has a padding of 12 by default. https://github.com/linode/manager/pull/9497/files#diff-f767369a01cd40921dc0da8dac44cf6777e3c155f3680aa2990be0da93c2dc48R659
|
Thanks @bnussman-akamai for the review and providing an alternative solution 🎉 |
bnussman-akamai
left a comment
There was a problem hiding this comment.
I think this is a great starting point! 🎉 We can refine this component as we use it and see what changes it may need

Description 📝
We want to enhance accessibility and streamline our use of third-party libraries by eliminating our reliance on
react-select. This leverages a customized version of MUI Autocomplete which will enable us to gradually replace occurrences ofEnhancedSelectacross our entire codebase.Major Changes 🔄
BackupsandClone LinodeUI to an Autocomplete.LinodeSelect.stylestoAutocomplete.stylessince they made more sense there.Select AllfeatureTODO
renderOptionsby maybe being more explicit as to what can be passed inPreview 📷
autocomplete-multiple.mov
How to test 🧪