Skip to content

Commit 0053329

Browse files
authored
api(ui): Drop toggle_ methods. Consolidate update accordion methods. Stronger typing for layout_sidebar(sidebar) and page_sidebar(sidebar) (#788)
1 parent 20d7c7a commit 0053329

File tree

35 files changed

+443
-692
lines changed

35 files changed

+443
-692
lines changed

CHANGELOG.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3535
* Added `shiny.ui.navset_underline()` and `shiny.ui.navset_card_underline()` whose navigation container is similar to `shiny.ui.navset_tab()` and `shiny.ui.navset_card_tab()` respectively, but its active/focused navigation links are styled with an underline. (#772)
3636
* `shiny.ui.layout_column_wrap(width, *args)` was rearranged to `shiny.ui.layout_column_wrap(*args, width)`. Now, `width` will default to `200px` is no value is provided. (#772)
3737
* `shiny.ui.showcase_left_center()` and `shiny.ui.showcase_top_right()` no longer take two values for the `width` argument. Instead, they now take a single value (e.g., `width = "30%"`) representing the width of the showcase are in the value box. Furthermore, they've both gained `width_full_screen` arguments that determine the width of the showcase area when the value box is expanded to fill the screen. (#772)
38-
39-
40-
* TODO-barret-API; `shiny.ui.panel_main()` and `shiny.ui.panel_sidebar()` are deprecated in favor of new API for `shiny.ui.layout_sidebar()`. Please use `shiny.ui.sidebar()` to construct a sidebar and supply it (along with the main content) to `shiny.ui.layout_sidebar(*args, **kwargs)`. (#680)
38+
* `shiny.ui.panel_main()` and `shiny.ui.panel_sidebar()` are deprecated in favor of new API for `shiny.ui.layout_sidebar()`. Please use `shiny.ui.sidebar()` to construct a `sidebar=` and supply it to `shiny.ui.layout_sidebar(sidebar, *args, **kwargs)`. (#788)
39+
* `shiny.experimental.ui.toggle_sidebar()` has been renamed to `shiny.ui.update_sidebar()`. It's `open` value now only supports `bool` values. (#788)
4140

4241
#### API relocations
4342

@@ -46,18 +45,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4645
The following methods have been moved from `shiny.experimental.ui` and integrated into `shiny.ui` (final locations under `shiny.ui` are displayed) (#680):
4746

4847
* Sidebar - Sidebar layout or manipulation
49-
* `sidebar()`, `page_sidebar()`, `toggle_sidebar()`, `layout_sidebar()`, `Sidebar`
48+
* `sidebar()`, `page_sidebar()`, `update_sidebar()`, `layout_sidebar()`, `Sidebar`
5049
* Filling layout - Allow UI components to expand into the parent container and/or allow its content to expand
51-
* `page_fillable()`, `fill.as_fillable_container()`, `fill.as_fill_item()`, `fill.is_fillable_container()`, `fill.is_fill_item()`, `fill.remove_all_fill()`
50+
* `page_fillable()`, `fill.as_fillable_container()`, `fill.as_fill_item()`, `fill.remove_all_fill()`
5251
* `output_plot(fill=)`, `output_image(fill=)`, `output_ui(fill=, fillable=)`
5352
* CSS units - CSS units and padding
5453
* `css.as_css_unit()`, `css.as_css_padding()`, `css.CssUnit`
5554
* Tooltip - Hover-based context UI element
56-
* `tooltip()`, `toggle_tooltip()`, `update_tooltip()`
55+
* `tooltip()`, `update_tooltip()`
5756
* Popover - Click-based context UI element
58-
* `popover()`, `toggle_popover()`, `update_popover()`
57+
* `popover()`, `update_popover()`
5958
* Accordion - Vertically collapsible UI element
60-
* `accordion()`, `accordion_panel()`, `accordion_panel_close()`, `accordion_panel_insert()`, `accordion_panel_open()`, `accordion_panel_remove()`, `accordion_panel_set()`, `update_accordion_panel()`, `Accordion`, `AccordionPanel`
59+
* `accordion()`, `accordion_panel()`, `insert_accordion_panel()`, `remove_accordion_panel()`, `update_accordion()`, `update_accordion_panel()`, `Accordion`, `AccordionPanel`
6160
* Card - A general purpose container for grouping related UI elements together
6261
* `card()`, `card_header()`, `card_footer()`, `CardItem`
6362
* Valuebox - Opinionated container for displaying a value and title
@@ -70,7 +69,6 @@ The following methods have been moved from `shiny.experimental.ui` and integrate
7069
* Layout - Layout of UI elements
7170
* `layout_column_wrap()`
7271
* Inputs - UI elements for user input
73-
* `toggle_switch()`
7472
* `input_text_area(autoresize=)`
7573

7674
If a ported method is called from `shiny.experimental.ui`, a deprecation warning will be displayed.
@@ -84,10 +82,11 @@ Methods still under consideration in `shiny.experimental.ui`:
8482
#### API removals
8583

8684
* `shiny.experimental.ui.FillingLayout` has been removed. (#481)
85+
* `shiny.experimental.ui.toggle_switch()` has been made defunct. Please remove it from your code and use `shiny.ui.update_switch()` instead. (#772)
8786
* `shiny.experimental.ui.as_width_unit()` has been made defunct. Please remove it from your code. (#772)
87+
* `shiny.experimental.ui`' `as_fill_carrier()`, `is_fill_carrier()`, `is_fillable_container()`, and `is_fill_item()` have been made defunct. Remove them from your code. (#680, #788)
8888
* Support for `min_height=`, `max_height=`, and `gap=` in `shiny.experimental.ui.as_fillable_container()` and `as_fill_item()` has been removed. (#481)
89-
* `shiny.experimental.ui.TagCallable` has been deprecated. Its type is equivalent to `htmltools.TagFunction`. (#680)
90-
* `shiny.experimental.ui.as_fill_carrier()` and `shiny.experimental.ui.is_fill_carrier()` have been deprecated. Please use `shiny.ui.fill.as_fill_item()` and `shiny.ui.fill.as_fillable_container()` or `shiny.ui.fill.is_fill_item()` and `shiny.ui.fill.is_fillable_container()` respectively in combination to achieve similar behavior. (#680)
89+
* `shiny.experimental.ui.TagCallable` has been made defunct. Please use its type is equivalent to `htmltools.TagFunction`. (#680)
9190

9291
### Bug fixes
9392

docs/_quartodoc.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ quartodoc:
106106
- ui.fill.as_fillable_container
107107
- ui.fill.as_fill_item
108108
- ui.fill.remove_all_fill
109-
- ui.fill.is_fillable_container
110-
- ui.fill.is_fill_item
109+
# - ui.fill.is_fillable_container
110+
# - ui.fill.is_fill_item
111111
- ui.css.as_css_unit
112112
- ui.css.as_css_padding
113113
- title: Update inputs
@@ -140,13 +140,13 @@ quartodoc:
140140
- title: Update UI Layouts
141141
desc: ""
142142
contents:
143-
- ui.toggle_sidebar
144-
- ui.toggle_switch
145-
- ui.toggle_tooltip
146-
- ui.toggle_popover
143+
- ui.update_sidebar
147144
- ui.update_tooltip
148145
- ui.update_popover
146+
- ui.update_accordion
149147
- ui.update_accordion_panel
148+
- ui.insert_accordion_panel
149+
- ui.remove_accordion_panel
150150
- title: Rendering outputs
151151
desc: "UI (output_*()) and server (render)ing functions for generating content server-side."
152152
contents:

shiny/api-examples/accordion_panel_close/app.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

shiny/api-examples/accordion_panel_open/app.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

shiny/api-examples/accordion_panel_insert/app.py renamed to shiny/api-examples/insert_accordion_panel/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def server(input: Inputs, output: Outputs, session: Session):
2121
@reactive.Effect
2222
@reactive.event(input.add_panel)
2323
def _():
24-
ui.accordion_panel_insert("acc", make_panel(str(random.randint(0, 10000))))
24+
ui.insert_accordion_panel("acc", make_panel(str(random.randint(0, 10000))))
2525

2626

2727
app = App(app_ui, server)

shiny/api-examples/accordion_panel_remove/app.py renamed to shiny/api-examples/remove_accordion_panel/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _():
3737
return
3838

3939
# Remove panel
40-
ui.accordion_panel_remove("acc", f"Section { user_choices.pop() }")
40+
ui.remove_accordion_panel("acc", f"Section { user_choices.pop() }")
4141

4242
label = "No more panels to remove!"
4343
if len(user_choices) > 0:

shiny/api-examples/toggle_sidebar/app.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

shiny/api-examples/toggle_switch/app.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

shiny/api-examples/toggle_tooltip/app.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

shiny/api-examples/accordion_panel_set/app.py renamed to shiny/api-examples/update_accordion/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def server(input: Inputs, output: Outputs, session: Session):
1616
@reactive.Effect
1717
@reactive.event(input.set_acc)
1818
def _():
19-
ui.accordion_panel_set("acc", ["Section A", "Section C", "Section E"])
19+
ui.update_accordion("acc", show=["Section A", "Section C", "Section E"])
2020

2121

2222
app = App(app_ui, server)

0 commit comments

Comments
 (0)