Commit Graph

19 Commits

Author SHA1 Message Date
Aman Agrawal 7997af675b recent_view: Fix filter dropdown enabled after search for spectators.
This is because we render the filters again after search and
hence any events or classes that were attached to widget were reset.
2023-11-29 21:47:36 -08:00
Aman Agrawal ff19dda71c dropdown_widget: Style cannot view stream similar to disabled state. 2023-11-23 09:09:58 -08:00
Aman Agrawal 2acf3cbfa4 dropdown_widget: Allow showing custom text if value is not in options.
If the current value is not in the calculated options,
`text_if_current_value_not_in_options` can be provided to
the widget to show custom text in that case.

Used by stream / user announcement settings if user doesn't
have access to information about the currently selected stream.
2023-11-23 09:09:58 -08:00
Aman Agrawal a872dbb260 recent_view: Disable dropdown widget for spectators. 2023-11-22 23:38:52 -08:00
Aman Agrawal 69d59acc5a inbox: Focus currently selected option in dropdown. 2023-11-10 10:22:18 -08:00
Aman Agrawal 03dcb9c0e4 dropdown_widget: Add option to hide search box. 2023-11-10 10:22:18 -08:00
Anders Kaseorg 88e9320fa5 list_widget: Rename unsafe modifier parameter to modifier_html.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-15 18:11:50 -07:00
Aman Agrawal 6321ab54ce dropdown_widget: Show empty list text without initiating search.
Fixes #26649

If there are no items for dropdown widget to display, show empty
search result text.
2023-09-10 11:20:15 -07:00
Aman Agrawal 3303b5ab72 dropdown_widget: Show disabled if value not in options.
It is possible that the current value of a dropdown widget is
valid but not present in options since the current user doesn't
have access it. So, we show [disabled] as value in that case.

This can be reproduced by setting a private stream for
notifications in org settings and then opening org settings
as a user which doesn't have access to the private stream.
2023-08-06 14:18:51 -07:00
Aman Agrawal 6efcb7a349 dropdown_widget: Refactor to use Class. 2023-07-27 14:10:08 -07:00
Lalit 3720fd5c76 list_widget: Make `get_item` option required and pass a default where needed.
This is a prep commit for moving towards typescript migration of this module.
We should make `get_item` required on `list_widget` because its intended to be
used with a set of keys and then hydrate the keys lazily. Also this will help
us to avoid writing messy if-conditions while filtering and sorting and make
our life much easier when we migrate to TypeScript.

I added a `default_get_item` function which is just n identity function and
also refactored some code to make use of default get item.
2023-07-17 11:31:51 -07:00
Aman Agrawal f3aeabaeec dropdown_widget: Add a on_hidden_callback. 2023-05-29 08:59:18 -07:00
Aman Agrawal 012f91eaba dropdown_widget: Show "No search results" instead of an empty list. 2023-05-10 12:00:18 -07:00
Aman Agrawal 0e79689c72 dropdown_widget: Move to last item on arrow up on search box. 2023-05-10 12:00:18 -07:00
Aman Agrawal 5156f465ef css: Increase max-height so that no element is partially visible.
I didn't want to use JS for it since calculating height based on
item height before rendering the dropdown is expensive and after
rendering the dropdown will cause it jump.
2023-05-10 12:00:18 -07:00
Aman Agrawal 79b00d3c2a minor: Correct comments. 2023-05-10 12:00:18 -07:00
Aman Agrawal 781a22bf81 dropdown_widget: Improve arrow navigation experience.
After `ArrowDown` on the last visible, don't jump the next item
into the center of the view, instead align the bottom of the item,
to the bottom of the visible container.
2023-05-10 12:00:18 -07:00
Tim Abbott 77ac1a10de compose: Collapse recipient widget with few options.
This looks visually nicer, and I think is necessary to merge it for
now, but I'm doing this as a separate commit so it's easy to revert if
we change our mind.
2023-05-09 14:11:26 -07:00
Aman Agrawal a196b949f7 dropdown_widget: Implement dropdown widget using tippy.
This will soon replace DropdownListWidget.
2023-05-09 14:11:26 -07:00