feat(components): Autocomplete V2
Motivations
- Needed a v2 automplete, along with the ability to trigger a 'setOptions' from the menu.
Changes
- Added support for v2 autocomplete, and the ability to trigger a 'setOptions' from the composed menu.
What to look out for
-
updateOptionsdoesn't expect a string like getOptions does, it expects an arbitrary object which can contain just about anything. This allows a consumer to send specific requests up from the menu. This allows instructing a parent component to load a different list for instance to query the existing options against. Triggering 'updateOptions' is typically done in a header/footer within the Autocomplete.
Testing
- Everything should still work as-is with no changes across all apps.
- Adding
version={2}to an Autocomplete should now not render a react-hook-form controller. - There is a new
updateOptionsfunction prop that can be passed to Autocomplete which will be accessible via the menu.
Changes can be tested via Pre-release
Deploying atlantis with Â
 Cloudflare Pages
| Latest commit: |
dd5932b
|
| Status: |  ✅ Deploy successful! |
| Preview URL: | https://c1467b41.atlantis.pages.dev |
| Branch Preview URL: | https://scott-t-autocomplete-2-updat.atlantis.pages.dev |
Published Pre-release for 4f995b8d294a9bf50f7986c62e4e1db8f8d059fa with versions:
- @jobber/[email protected]+4f995b8d
To install the new version(s) for Web run:
npm install @jobber/[email protected]+4f995b8d
as an aside, the lines of code changed in this PR is really big. it's all coming from the package-lock where it looks like react-aria-components was added to site
it doesn't seem like we need that, right?
if you change the standard options, it works as I'd expect. however if you change the group section names at all, it causes the menu to close. the values will have been replaced though.
another couple scenarios that are behaving unexpectedly related to the above
if I keep the headers the same only swapping out the actual options, and I click the footer button (both footer buttons have the same onclick calling handleUpdateOptions) in Invoices, it also closes the menu
then weridly, with that exact same data if I click the footer button in the Quotes section, it doesn't close 🤔
as an aside, the lines of code changed in this PR is really big. it's all coming from the package-lock where it looks like
react-aria-componentswas added tositeit doesn't seem like we need that, right?
Nope, I might just need to re-run the install. I accidentally added it in there at one point in my exploration and then removed it.