From 9f068a81b71088e20b7bd1336edc798dd1b9debd Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 8 Aug 2023 20:18:56 -0400 Subject: [PATCH 1/2] Add tooltip section --- docs/_quartodoc.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/_quartodoc.yml b/docs/_quartodoc.yml index d1387b9db..77e5d0a15 100644 --- a/docs/_quartodoc.yml +++ b/docs/_quartodoc.yml @@ -280,6 +280,16 @@ quartodoc: - experimental.ui.value_box - experimental.ui.showcase_left_center - experimental.ui.showcase_top_right + - kind: page + path: ExTooltip + summary: + name: "Tooltips" + desc: "Display additional information when focusing (or hovering over) a UI element." + flatten: true + contents: + - experimental.ui.tooltip + - experimental.ui.tooltip_toggle + - experimental.ui.update_tooltip - kind: page path: ExFillingLayout summary: From fe03bbad75cd222905b40370cd3c96076c673488 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Tue, 8 Aug 2023 20:51:05 -0400 Subject: [PATCH 2/2] Fix bad documentation links or rendering --- shiny/experimental/ui/_card.py | 10 +++++----- shiny/experimental/ui/_fill.py | 13 +++++++++---- shiny/experimental/ui/_page.py | 2 +- shiny/experimental/ui/_sidebar.py | 10 +++++----- shiny/experimental/ui/_tooltip.py | 3 ++- shiny/session/_session.py | 6 +++--- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/shiny/experimental/ui/_card.py b/shiny/experimental/ui/_card.py index 1f7d5e964..47a1acbb6 100644 --- a/shiny/experimental/ui/_card.py +++ b/shiny/experimental/ui/_card.py @@ -86,7 +86,7 @@ def card( Returns ------- : - An :func:`~htmltools.div` tag. + An :func:`~shiny.ui.tags.div` tag. See Also -------- @@ -314,12 +314,12 @@ def card_body( # https://mypy.readthedocs.io/en/stable/protocols.html#callback-protocols class WrapperCallable(Protocol): """ - A callable that wraps children into a :func:`~shiny.experimental.ui.CardItem`. + A callable that wraps children into a :class:`~shiny.experimental.ui.CardItem`. """ def __call__(self, *args: TagChild) -> CardItem: """ - Wraps children into a :func:`~shiny.experimental.ui.CardItem`. + Wraps children into a :class:`~shiny.experimental.ui.CardItem`. Parameters ---------- @@ -554,7 +554,7 @@ def card_footer( class ImgContainer(Protocol): """ - A callable that wraps the return value of `card_image()`. To isolate your object in a card, return a :func:`~shiny.experimental.ui.CardItem`. + A callable that wraps the return value of `card_image()`. To isolate your object in a card, return a :class:`~shiny.experimental.ui.CardItem`. """ def __call__(self, *args: Tag) -> Tagifiable: @@ -628,7 +628,7 @@ def card_image( If :func:`~shiny.experimental.ui.card_body` is used, each image will be in separate cards. If the `container` method does not return a :class:`~shiny.experimental.ui.CardItem`, it allows for consecutive non-`CardItem` objects to be bundled into a single - :func:`~.shiny.experimental.card_body` within :func:`~shiny.experimental.ui.card`. + :func:`~shiny.experimental.ui.card_body` within :func:`~shiny.experimental.ui.card`. **kwargs Additional HTML attributes for the resolved Tag. """ diff --git a/shiny/experimental/ui/_fill.py b/shiny/experimental/ui/_fill.py index 6f13b92b0..cf8e90f05 100644 --- a/shiny/experimental/ui/_fill.py +++ b/shiny/experimental/ui/_fill.py @@ -31,6 +31,11 @@ ) TagFillingLayoutT = TypeVar("TagFillingLayoutT", bound="Tag | FillingLayout") +""" +A :class:`~htmltools.Tag` object or an object that implements the +:class:`~shiny.experimental.ui.FillingLayout` protocol. +""" + TagT = TypeVar("TagT", bound="Tag") @@ -103,7 +108,7 @@ def bind_fill_role( ------- : The original :class:`~htmltools.Tag` object (`tag`) with additional attributes - (and an :class:`~htmltools.HtmlDependency`). + (and an :class:`~htmltools.HTMLDependency`). """ tag = _add_role( tag, @@ -166,7 +171,7 @@ def as_fill_carrier( ------- : The original :class:`~htmltools.Tag` object (`tag`) with additional attributes - (and an :class:`~htmltools.HtmlDependency`). + (and an :class:`~htmltools.HTMLDependency`). See Also -------- @@ -220,7 +225,7 @@ def as_fillable_container( ------- : The original :class:`~htmltools.Tag` object (`tag`) with additional attributes - (and an :class:`~htmltools.HtmlDependency`). + (and an :class:`~htmltools.HTMLDependency`). See Also -------- @@ -273,7 +278,7 @@ def as_fill_item( ------- : The original :class:`~htmltools.Tag` object (`tag`) with additional attributes - (and an :class:`~htmltools.HtmlDependency`). + (and an :class:`~htmltools.HTMLDependency`). See Also -------- diff --git a/shiny/experimental/ui/_page.py b/shiny/experimental/ui/_page.py index d11683ef9..677327c53 100644 --- a/shiny/experimental/ui/_page.py +++ b/shiny/experimental/ui/_page.py @@ -131,7 +131,7 @@ def page_navbar( Choose a particular nav item to select by default value (should match it's ``value``). sidebar - A :func:`~shiny.ui.sidebar` component to display on every page. + A :func:`~shiny.experimental.ui.sidebar` component to display on every page. fillable Whether or not the main content area should be considered a fillable (i.e., flexbox) container. diff --git a/shiny/experimental/ui/_sidebar.py b/shiny/experimental/ui/_sidebar.py index 245e436f0..3933154a9 100644 --- a/shiny/experimental/ui/_sidebar.py +++ b/shiny/experimental/ui/_sidebar.py @@ -132,8 +132,7 @@ def sidebar( `sidebar=` argument of: * :func:`~shiny.experimental.ui.layout_sidebar` - * Creates a sidebar layout component which can be dropped inside any - :func:`~shiny.ui.page` or :func:`~shiny.experimental.ui.card` context. + * Creates a sidebar layout component which can be dropped inside any Shiny UI page method (e.g. :func:`~shiny.experimental.ui.page_fillable`) or :func:`~shiny.experimental.ui.card` context. * :func:`~shiny.experimental.ui.navset_bar`, :func:`~shiny.experimental.ui.navset_tab_card`, and :func:`~shiny.experimental.ui.navset_pill_card` * Creates a multi page/tab UI with a singular `sidebar()` (which is shown on every page/tab). @@ -164,7 +163,7 @@ def sidebar( title A character title to be used as the sidebar title, which will be wrapped in a `
` element with class `sidebar-title`. You can also provide a custom - :func:`~shiny.htmltools.tag` for the title element, in which case you'll + :class:`~htmltools.Tag` for the title element, in which case you'll likely want to give this element `class = "sidebar-title"`. bg,fg A background or foreground color. @@ -259,8 +258,9 @@ def layout_sidebar( """ Sidebar layout - Create a sidebar layout component which can be dropped inside any - :func:`~shiny.ui.page` or :func:`~shiny.experimental.ui.card` context. + Create a sidebar layout component which can be dropped inside any Shiny UI page + method (e.g. :func:`~shiny.experimental.ui.page_fillable`) or + :func:`~shiny.experimental.ui.card` context. Parameters ---------- diff --git a/shiny/experimental/ui/_tooltip.py b/shiny/experimental/ui/_tooltip.py index 12532bc9b..00c2804ed 100644 --- a/shiny/experimental/ui/_tooltip.py +++ b/shiny/experimental/ui/_tooltip.py @@ -54,7 +54,8 @@ def tooltip( If `trigger` yields multiple HTML elements (e.g., a :class:`~htmltools.TagList` or complex [`shinywidgets`](https://github.com/rstudio/py-shinywidgets) object), the last HTML element is used as the trigger. If the `trigger` should contain all of - those elements, wrap the object in a :func:`~htmltools.div` or :func:`~htmltools.span`. + those elements, wrap the object in a :func:`~shiny.ui.tags.div` or + :func:`~shiny.ui.tags.span`. See Also -------- diff --git a/shiny/session/_session.py b/shiny/session/_session.py index 5db4d7a18..d1ade535b 100644 --- a/shiny/session/_session.py +++ b/shiny/session/_session.py @@ -880,10 +880,10 @@ class Inputs: """ A class representing Shiny input values. - This class provides access to a :class:`~shiny.session.Session`'s input values. The - input values are reactive :class:`~shiny.reactive.Values`, and can be accessed with + This class provides access to a :class:`~shiny.Session`'s input values. The + input values are reactive :class:`~shiny.reactive.Value`s, and can be accessed with the ``[]`` operator, or with ``.``. For example, if there is an input named ``x``, - it can be accessed via ``input["x"]()`` or ``input.x()``. + it can be accessed via `input["x"]()` or ``input.x()``. """ def __init__(