Summary
The inline variant of the ProgressBar component will be added as part of T301275. This task covers implementing the inline ProgressBar within the TypeaheadSearch and Menu components.
Implementation details
When to display
- The progress bar should display when results are being fetched over a slow connection. This will be achieved by displaying the progress bar after a 1 second delay (this figure can be updated later if needed), then removing it once results are loaded and displayed.
- This will happen the first time results are fetched and on subsequent searches. The former means the menu will need to expand earlier than it currently does, to display the progress bar before results are received.
Where to display + loading message
- The progress bar will display at the top of the menu. It should be absolutely positioned so it does not increase the height of the first menu item (be it the "pending" slot or an actual menu item)
- When results are initially loaded, a message will be displayed to indicate that results are pending, styled similar to a menu item. The progress bar will display at the top of that item. This will only happen if the pending slot is filled with a message; otherwise the menu will not open and the progress bar will not be displayed.
- When there are already results (or a no-results message, or just a search footer), the progress bar will display at the top of the first item.
Updates needed for Menu
- A new pending prop will be added to allow parent components to indicate when results are pending (and opt in to showing the progress bar/loading message)
- A new pending slot will be added to house the loading message. This will be displayed when the pending prop is true and there are no menu items yet
- The ProgressBar component will be added and displayed when the pending prop is true
Updates needed TypeaheadSearch
- A search-results-pending slot will be added for the loading message
- A pending ref will be added to track when TypeaheadSearch should tell Menu that results are pending
- pending will be set to true when new, non-empty input is received, with a 1-second delay
- pending will be set to false when new results are received
Other updates
We might want to add something similar to Lookup and demonstrate how the pending feature within Menu can be used in other components.
Acceptance criteria
- TypeaheadSearch and Menu have been updated to achieve the aforementioned feature spec
- The TypeaheadSearch demos have been updated to demonstrate this new behavior
