From 0620bb05a2cd27580ef699fd4f227217a9ad9bdf Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Fri, 19 Jan 2024 17:40:23 -0600 Subject: [PATCH 1/2] Add express.ui.panel_title --- docs/_quartodoc.yml | 1 + shiny/express/ui/__init__.py | 3 ++- shiny/express/ui/_cm_components.py | 35 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/_quartodoc.yml b/docs/_quartodoc.yml index e34ede0d8..f33556b4e 100644 --- a/docs/_quartodoc.yml +++ b/docs/_quartodoc.yml @@ -316,6 +316,7 @@ quartodoc: - express.ui.navset_tab - express.ui.navset_underline - express.ui.value_box + - express.ui.panel_title - express.ui.panel_well - express.ui.panel_conditional - express.ui.panel_fixed diff --git a/shiny/express/ui/__init__.py b/shiny/express/ui/__init__.py index eb0c63ba7..2b20c4c0e 100644 --- a/shiny/express/ui/__init__.py +++ b/shiny/express/ui/__init__.py @@ -123,6 +123,7 @@ navset_tab, navset_underline, value_box, + panel_title, panel_well, panel_conditional, panel_fixed, @@ -255,6 +256,7 @@ "navset_tab", "navset_underline", "value_box", + "panel_title", "panel_well", "panel_conditional", "panel_fixed", @@ -285,7 +287,6 @@ "page_output", "panel_main", # Deprecated "panel_sidebar", # Deprecated - "panel_title", "showcase_bottom", "showcase_left_center", "showcase_top_right", diff --git a/shiny/express/ui/_cm_components.py b/shiny/express/ui/_cm_components.py index 0fe85fee1..efc0b1bb4 100644 --- a/shiny/express/ui/_cm_components.py +++ b/shiny/express/ui/_cm_components.py @@ -28,6 +28,7 @@ "nav_panel", "nav_control", "nav_menu", + "panel_title", "panel_well", "panel_conditional", "panel_fixed", @@ -1199,6 +1200,40 @@ def value_box( # ====================================================================================== +def panel_title( + *, + title: str | Tag | TagList, + window_title: str | MISSING_TYPE = MISSING, +) -> RecallContextManager[TagList]: + """ + Context manager for a panel title + + This function wraps :func:`~shiny.ui.panel_title`. + + + Parameters + ---------- + title + A title to display in the app's UI. + window_title + A title to display on the browser tab. + + Note + ---- + This result of this function causes a side effect of adding a title tag to the head + of the document (this is necessary for the browser to display the title in the + browser window). You can also specify a page title explicitly using the title + parameter of the top-level page function (e.g., :func:`~shiny.ui.page_fluid`). + """ + return RecallContextManager( + ui.panel_title, + kwargs=dict( + title=title, + window_title=window_title, + ), + ) + + def panel_well(**kwargs: TagAttrValue) -> RecallContextManager[Tag]: """ Context manager for a well panel From 54110983ec44cca38266bfd0f64bd3ac196b02a7 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Tue, 23 Jan 2024 17:37:05 -0600 Subject: [PATCH 2/2] Import and re-export panel_title --- shiny/express/ui/__init__.py | 4 ++-- shiny/express/ui/_cm_components.py | 35 ------------------------------ 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/shiny/express/ui/__init__.py b/shiny/express/ui/__init__.py index 2b20c4c0e..c4b37a3d5 100644 --- a/shiny/express/ui/__init__.py +++ b/shiny/express/ui/__init__.py @@ -63,6 +63,7 @@ input_task_button, input_text, input_text_area, + panel_title, insert_accordion_panel, remove_accordion_panel, update_accordion, @@ -123,7 +124,6 @@ navset_tab, navset_underline, value_box, - panel_title, panel_well, panel_conditional, panel_fixed, @@ -197,6 +197,7 @@ "bind_task_button", "input_task_button", "input_text", + "panel_title", "input_text_area", "insert_accordion_panel", "remove_accordion_panel", @@ -256,7 +257,6 @@ "navset_tab", "navset_underline", "value_box", - "panel_title", "panel_well", "panel_conditional", "panel_fixed", diff --git a/shiny/express/ui/_cm_components.py b/shiny/express/ui/_cm_components.py index efc0b1bb4..0fe85fee1 100644 --- a/shiny/express/ui/_cm_components.py +++ b/shiny/express/ui/_cm_components.py @@ -28,7 +28,6 @@ "nav_panel", "nav_control", "nav_menu", - "panel_title", "panel_well", "panel_conditional", "panel_fixed", @@ -1200,40 +1199,6 @@ def value_box( # ====================================================================================== -def panel_title( - *, - title: str | Tag | TagList, - window_title: str | MISSING_TYPE = MISSING, -) -> RecallContextManager[TagList]: - """ - Context manager for a panel title - - This function wraps :func:`~shiny.ui.panel_title`. - - - Parameters - ---------- - title - A title to display in the app's UI. - window_title - A title to display on the browser tab. - - Note - ---- - This result of this function causes a side effect of adding a title tag to the head - of the document (this is necessary for the browser to display the title in the - browser window). You can also specify a page title explicitly using the title - parameter of the top-level page function (e.g., :func:`~shiny.ui.page_fluid`). - """ - return RecallContextManager( - ui.panel_title, - kwargs=dict( - title=title, - window_title=window_title, - ), - ) - - def panel_well(**kwargs: TagAttrValue) -> RecallContextManager[Tag]: """ Context manager for a well panel