-
Notifications
You must be signed in to change notification settings - Fork 117
Sync with latest bslib sidebar and card changes #1129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
7b4f323
`shiny.ui.sidebar` supports `SidebarOpen` and is now a thin wrapper a…
gadenbuie 40b8425
`sidebar(open=)` might not be user-provided
gadenbuie e1c408a
layout_sidebar: Update to use new bslib features and improved Sidebar…
gadenbuie ebc2198
export ui.SidebarOpen
gadenbuie e534609
Add a dynamic example (currently unused)
gadenbuie ada1d63
Use `render.code` in Express example
gadenbuie fe912c0
Update shiny.express.ui.sidebar signature
gadenbuie dbd7fa7
`shiny.express.ui.sidebar()` now takes kwargs
gadenbuie 2a189f9
update bslib again
gadenbuie a5e8b04
sidebar: Validate `open` on init, if provided
gadenbuie 4053bd1
docs(sidebar): Update `open`, `max_height_mobile`
gadenbuie 0dfb030
fix(sidebar): Fix logic for auto-generated sidebar id
gadenbuie 48f5b13
refactor: Match color parameters of `sidebar` and `Sidebar`
gadenbuie 342502f
docs(Sidebar): Update for new signature
gadenbuie 2e2b674
docs(SidebarOpen): Finish docs
gadenbuie 0531a98
re-export SidebarOpen from shiny.express.ui
gadenbuie a18f8bd
docs(SidebarOpen): Add to Core doc listing
gadenbuie 66601b2
page-level sidebar default to mobile="always"
gadenbuie 8de875d
express(sidebar): `open` is now `None` by default
gadenbuie fea04fb
sidebar params: position, open, width
gadenbuie 18321d6
remove unused import
gadenbuie 8f13804
sidebar: Improve setting default open value, get/set open and max_hei…
gadenbuie e3e2045
typo: resolve -> render
gadenbuie b9612b1
fix shiny.experimental.ui._deprecated.Sidebar
gadenbuie a70d9fc
a11y(card): Improve accessibility of full-screen card button
gadenbuie 9a5cece
fix DeprecatedPanelSidebar
gadenbuie 34f927a
tests: Improve `compare_annotations()` failure message
gadenbuie 219280e
fix(sidebar): Fix open type and default value
gadenbuie ddb5e9a
tests(sidebar): Fix sidebar test
gadenbuie ab1eceb
docs: Add changelog notes
gadenbuie 8847f2e
tests: Fix tests/playwright/shiny/bugs/0666-sidebar/test_sidebar_colo…
gadenbuie 9a3a226
typo: adjust hypenation of full-screen
gadenbuie 6ec7fa3
feat(resolve_id): add ID validations
gadenbuie 330ad1c
fix(sidebar): resolve ID earlier
gadenbuie 9ad19a1
chore: make format
gadenbuie 416fe4c
Merge branch 'main' into sync-bslib-0-6-1-dev
gadenbuie d8c7abb
Apply suggestions from code review
gadenbuie 5f2a99a
chore: make format
gadenbuie 905f6b8
refactor: Apply review suggestions
gadenbuie 3425044
fix: Don't need to unpack attrs
gadenbuie 9d27f50
refactor(card): Fix types so that `str(attr["id"])` isn't required
gadenbuie 9667eeb
refactor: Simplify nzchar check
gadenbuie a9d83c9
chore: make format
gadenbuie 79fbb45
refactor: Use private_random_id() to create randomized IDs
gadenbuie dceb169
one more random id and remove unused import
gadenbuie 3cb4fd1
feat(sidebar): Users supply SidebarOpenSpec dict, we upgrade to Sideb…
gadenbuie 7323f81
Fix `Sidebar._as_open(open=)` type annotation
gadenbuie 3e7eac3
don't need to export `SidebarOpen` from `express.ui`
gadenbuie b393eb4
Hide `SidebarOpen._VALUES` from print method
gadenbuie b598542
Merge branch 'main' into sync-bslib-0-6-1-dev
schloerke d4b42b1
Merge branch 'main' into sync-bslib-0-6-1-dev
gadenbuie b727b6f
refactor(Sidebar): open is now a method that gets/sets initial open s…
gadenbuie ff8ed30
refactor(Sidebar): Return self early if new default same as current
gadenbuie 2d6c1b4
chore(Sidebar): Add comments about `_open` and `_default_open`
gadenbuie d066fa1
chore(Sidebar): Explicit default open value
gadenbuie 3a82783
fix(Sidebar): Need same `id` for collapse/sidebar tags
gadenbuie 3b95018
chore: make format
gadenbuie d4d5c5a
docs(Sidebar): Add some method docs
gadenbuie 1df1010
chore(Sidebar.open): Let `None` also be valid to set `.open`
gadenbuie 7a02069
chore(Sidebar): Improve validation error messages
gadenbuie 6ab8af6
fix(Sidebar): no aria expanded/controls if always open
gadenbuie b8d26f1
refactor(Sidebar): Consolidate str/dict upgrade to SidebarOpen in _as…
gadenbuie a9b3203
tests(Sidebar): Add tests for Sidebar class
gadenbuie ea2ab21
chore: make format
gadenbuie 4c4da4b
tests(sidebar): Fix type issues
gadenbuie c68456d
test(sidebar): from future...
gadenbuie 06809b8
chore: Apply changes from code review
gadenbuie 1d118bf
Merge branch 'main' into sync-bslib-0-6-1-dev
gadenbuie aa8374d
refactor(Sidebar): Rename `._get_sidebar_id()` method
gadenbuie 65ebb93
refactor(Sidebar): remove `_set_default_open()` method, copy the side…
gadenbuie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| from shiny import App, Inputs, Outputs, Session, render, ui | ||
|
|
||
| app_ui = ui.page_fluid( | ||
| ui.card( | ||
| ui.card_header("ui.sidebar() Settings"), | ||
| ui.layout_column_wrap( | ||
| ui.input_select( | ||
| "desktop", | ||
| label="Desktop", | ||
| choices=["open", "closed", "always"], | ||
| selected="open", | ||
| ), | ||
| ui.input_select( | ||
| "mobile", | ||
| label="Mobile", | ||
| choices=["open", "closed", "always"], | ||
| selected="closed", | ||
| ), | ||
| ui.input_select( | ||
| "position", label="Position", choices=["left", "right"], selected="left" | ||
| ), | ||
| width="100px", | ||
| ), | ||
| ), | ||
| ui.layout_column_wrap( | ||
| ui.card( | ||
| ui._card.card_body( | ||
| ui.output_ui("sidebar_dynamic", fill=True, fillable=True), class_="p-0" | ||
| ), | ||
| ), | ||
| ui.card( | ||
| ui.card_header("Sidebar Layout Code"), | ||
| ui.output_code("sidebar_code"), | ||
| ), | ||
| width="500px", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def server(input: Inputs, output: Outputs, session: Session): | ||
| @render.ui | ||
| def sidebar_dynamic(): | ||
| return ui.layout_sidebar( | ||
| ui.sidebar( | ||
| ui.markdown( | ||
| f""" | ||
| **Desktop**: {input.desktop()} | ||
|
|
||
| **Mobile**: {input.mobile()} | ||
|
|
||
| **Position**: {input.position()} | ||
| """ | ||
| ), | ||
| title="Settings", | ||
| id="sidebar_dynamic", | ||
| open={"desktop": input.desktop(), "mobile": input.mobile()}, | ||
| position=input.position(), | ||
| ), | ||
| ui.h2("Dynamic sidebar"), | ||
| ui.output_text_verbatim("state_dynamic"), | ||
| ) | ||
|
|
||
| @render.text | ||
| def state_dynamic(): | ||
| return f"input.sidebar_dynamic(): {input.sidebar_dynamic()}" | ||
|
|
||
| @render.code | ||
| def sidebar_code(): | ||
| if input.desktop() == input.mobile(): | ||
| open = f'"{input.desktop()}"' | ||
| elif input.desktop() == "open" and input.mobile() == "closed": | ||
| open = '{"desktop": "open", "mobile": "closed"}' | ||
| else: | ||
| open = f'{{"desktop": "{input.desktop()}", "mobile": "{input.mobile()}}}' | ||
|
|
||
| return f"""\ | ||
| ui.layout_sidebar( | ||
| ui.sidebar( | ||
| "Sidebar content...", | ||
| title="Sidebar title", | ||
| id="sidebar_id", | ||
| open={open}, | ||
| position="{input.position()}" | ||
| ), | ||
| "Main content...", | ||
| ) | ||
| """ | ||
|
|
||
|
|
||
| app = App(app_ui, server) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we are wanting to support
**kwargs, should we add*args: TagAttrsto the definition?Running
argsthroughconsolidate_attrs(), we could verify that length ofchildrenis 0.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This upgrading / check could be done with UI (not express) section of code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure if you're suggesting we use
consolidate_attrs()inshiny.ui.sidebar()(like you suggested later) or if you have something else in mind?