Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion R/data-apps-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ apps_deps_map <- list(`001-hello` = "rsconnect", `012-datatables` = "ggplot2",
"rversions"), `305-bslib-value-box` = c("rlang", "rversions"
), `309-flexdashboard-tabs-navs` = "rmarkdown", `310-bslib-sidebar-dynamic` = c("rversions",
"testthat"), `311-bslib-sidebar-toggle-methods` = c("rversions",
"testthat"))
"testthat"), `313-bslib-card-tab-focus` = c("rversions",
"testthat", "withr"))
86 changes: 42 additions & 44 deletions inst/apps/311-bslib-sidebar-toggle-methods/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,59 +17,57 @@ animals <- c(
"otter", "panda", "panther", "penguin", "zebra"
)

sb <- layout_column_wrap(
width = 500,
id = "sidebar-here",
layout_sidebar(
id = "main_outer",
sidebar = sidebar(
"Outer Sidebar",
id = "sidebar_outer",
width = 150,
bg = color_pairs[[1]]$dark,
open = "desktop",
max_height_mobile = "300px",
selectInput(
"adjective",
"Adjective",
choices = adjectives,
selected = adjectives[1]
)
),
height = 300,
class = "p-0",
fillable = TRUE,
ui <- page_fixed(
h1("Dynamic Sidebars"),
tags$head(tags$title("bslib | Tests | Dynamic Sidebars")),
p(
"Test tab focus order: main, inner sidebar, outer sidebar.",
"Test server-side open and close of sidebars."
),
layout_column_wrap(
width = 500,
id = "sidebar-here",
layout_sidebar(
id = "main_inner",
id = "main_outer",
sidebar = sidebar(
"Inner Sidebar",
id = "sidebar_inner",
"Outer Sidebar",
id = "sidebar_outer",
width = 150,
bg = color_pairs[[1]]$light,
bg = color_pairs[[1]]$dark,
open = "desktop",
max_height_mobile = "300px",
selectInput(
"animal",
"Animal",
choices = animals,
selected = animals[1]
"adjective",
"Adjective",
choices = adjectives,
selected = adjectives[1]
)
),
border = FALSE,
border_radius = FALSE,
h2("Sidebar Layout"),
uiOutput("ui_content", tabindex = 0)
height = 300,
class = "p-0",
fillable = TRUE,
layout_sidebar(
id = "main_inner",
sidebar = sidebar(
"Inner Sidebar",
id = "sidebar_inner",
width = 150,
bg = color_pairs[[1]]$light,
open = "desktop",
selectInput(
"animal",
"Animal",
choices = animals,
selected = animals[1]
)
),
border = FALSE,
border_radius = FALSE,
h2("Sidebar Layout"),
uiOutput("ui_content", tabindex = 0),
)
)
)
)

ui <- page_fixed(
h1("Dynamic Sidebars"),
tags$head(tags$title("bslib | Tests | Dynamic Sidebars")),
p(
"Test tab focus order: main, inner sidebar, outer sidebar.",
"Test server-side open and close of sidebars."
),
tagAppendAttributes(sb, class = "mb-4", id = "layout"),
div(
class = "my-2",
actionButton("show_all", "Show all"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 0,
"sidebar_inner": true,
"sidebar_outer": false,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 0,
"sidebar_inner": true,
"sidebar_outer": true,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 1,
"sidebar_inner": false,
"sidebar_outer": false,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 1,
"sidebar_inner": true,
"sidebar_outer": false,
"toggle_inner": 1,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 1,
"sidebar_inner": true,
"sidebar_outer": true,
"toggle_inner": 1,
"toggle_outer": 1
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 0,
"sidebar_inner": true,
"sidebar_outer": false,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 0,
"sidebar_inner": true,
"sidebar_outer": true,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 1,
"sidebar_inner": false,
"sidebar_outer": false,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 1,
"sidebar_inner": true,
"sidebar_outer": false,
"toggle_inner": 1,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 1,
"sidebar_inner": true,
"sidebar_outer": true,
"toggle_inner": 1,
"toggle_outer": 1
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 0,
"sidebar_inner": true,
"sidebar_outer": false,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"input": {
"adjective": "charming",
"animal": "elephant",
"show_all": 0,
"sidebar_inner": true,
"sidebar_outer": true,
"toggle_inner": 0,
"toggle_outer": 0
},
"output": {
"ui_content": {
"html": "<p>Hello, charming elephant!<\/p>",
"deps": [

]
}
},
"export": {

}
}
Loading