Skip to content
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

feat(shiny-preset): Notifications, progress bars, and modals #754

Merged
merged 27 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bdaa901
feat(shiny-preset): Notifications and progress bars
gadenbuie Aug 17, 2023
fd647d7
feat(themer-demo): Update the progress detail dynamically
gadenbuie Aug 17, 2023
f26f787
feat(shiny-preset): Update modal styles
gadenbuie Aug 17, 2023
4b550f9
feat(modals): Add small amount of blur to backdrop
gadenbuie Aug 17, 2023
d85a223
chore: Use bootstrap `#{prefix}`
gadenbuie Sep 12, 2023
d557f7d
Merge 'origin/main' into branch refresh/notifications
gadenbuie Sep 12, 2023
ca08d06
feat: Use BS 5.3 variables
gadenbuie Sep 12, 2023
1e017bc
feat: Add bs5-specific shiny defaults
gadenbuie Sep 12, 2023
6f2ee40
Resave distributed files (GitHub Action)
gadenbuie Sep 12, 2023
d27520f
chore: Rename file
gadenbuie Sep 13, 2023
7fb3df0
Resave distributed files (GitHub Action)
gadenbuie Sep 13, 2023
c4c1990
Merge 'origin/main' into branch refresh/notifications
gadenbuie Oct 6, 2023
9fe0c81
fix: Sass usage in `var()`
gadenbuie Oct 6, 2023
8bfc74b
chore: Use `--#{prefix}` in all the places
gadenbuie Oct 10, 2023
b6e84b6
fix: Use CSS variable for notification border color
gadenbuie Oct 10, 2023
62158d6
fix: Use tricks to ensure shiny-preset notification rules prevail
gadenbuie Oct 10, 2023
5682482
Resave distributed files (GitHub Action)
gadenbuie Oct 10, 2023
c4418a0
chore: Remove `inst/shiny-scss` files; these are now in {shiny}
gadenbuie Oct 11, 2023
7d02beb
fix: Remove lines from bad merge commit
gadenbuie Oct 11, 2023
54cc759
`devtools::document()` (GitHub Actions)
gadenbuie Oct 11, 2023
05a15f1
Resave distributed files (GitHub Action)
gadenbuie Oct 11, 2023
d1a326c
chore: Move sass variable from mixins to variables
gadenbuie Oct 11, 2023
597417e
feat(shiny-preset): Use $box-shadow and $box-shadow-dark
gadenbuie Oct 11, 2023
89978c4
chore(shiny-preset): Use more sass variables where possible
gadenbuie Oct 11, 2023
31c7e55
Resave distributed files (GitHub Action)
gadenbuie Oct 11, 2023
3889471
Revert "chore: Use `--#{prefix}` in all the places"
gadenbuie Oct 12, 2023
caa0586
Resave distributed files (GitHub Action)
gadenbuie Oct 12, 2023
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
83 changes: 76 additions & 7 deletions inst/builtin/bs5/shiny/_rules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ $bslib-checkbox-radio-margin-right: 0.35em !default;
@if $bslib-enable-shadows {

:root {
--bslib-shiny-preset-main-bg: rgba(var(--bs-emphasis-color-rgb, 0,0,0), 0.05);
--bslib-shiny-preset-main-bg: rgba(var(--#{prefix}emphasis-color-rgb, 0,0,0), 0.05);
}

.bslib-page-sidebar {
--bslib-page-sidebar-title-color: var(--bs-body-color);
--bslib-page-sidebar-title-bg: var(--bs-body-bg);
--bslib-page-sidebar-title-color: var(--#{prefix}body-color);
--bslib-page-sidebar-title-bg: var(--#{prefix}body-bg);

> .bslib-sidebar-layout:first-of-type > .main {
background-color: var(--bslib-shiny-preset-main-bg);
Expand All @@ -118,15 +118,15 @@ $bslib-checkbox-radio-margin-right: 0.35em !default;
}

.bslib-sidebar-layout.bslib-sidebar-layout {
--bslib-sidebar-bg: var(--bs-body-bg);
--bslib-sidebar-bg: var(--#{prefix}body-bg);
}
}

// By default, non-active .nav links reflect the primary color. This styling
// tweak brings them closer to how they'll appear in a navbar.
// tweak brings them closer to how they'll appear in a navbar.
.nav-underline {
--#{$prefix}link-color: rgba(var(--bs-body-color-rgb), 0.65);
--#{$prefix}link-hover-color: rgba(var(--bs-body-color-rgb), 0.8);
--#{$prefix}link-color: rgba(var(--#{prefix}body-color-rgb), 0.65);
--#{$prefix}link-hover-color: rgba(var(--#{prefix}body-color-rgb), 0.8);
--#{$prefix}nav-link-font-size: 0.875rem;

.nav-link {
Expand Down Expand Up @@ -189,3 +189,72 @@ $icon-classes: ("bi", "fa", "fas", "far", "fab", "material-icons") !default;
--bslib-color-fg: #008558; // Contrast 4.67
}
}

// Modals
.modal-body, .modal-footer {
padding: 1.5rem;
}
.modal-header .btn-close {
align-self: start;
display: flex;
}
#shiny-modal-wrapper:has( ~ .modal-backdrop) .modal {
// Blur the background when the modal has a backdrop
backdrop-filter: blur(2px);
}

// Progress Bars & Notifications
// FIXME: Use css layers (dynamic themeing issue)
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
#shiny-notification-panel#shiny-notification-panel {
position: fixed;
bottom: calc(var(--bslib-spacer, 1rem) / 2);
right: calc(var(--bslib-spacer, 1rem) / 2);
width: 450px;
z-index: $zindex-toast;
}

.progress-message {
margin-right: .6rem;
}

// FIXME: Use css layers (dynamic themeing issue)
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
.shiny-notification.shiny-notification {
position: relative;
opacity: 0.96;
padding: calc(var(--bslib-spacer, 1rem) * 2);
margin: var(--bslib-spacer, 1rem);
border: $border-width solid rgba(var(--#{prefix}emphasis-color-rgb), 0.8);
border-radius: $card-border-radius;
box-shadow: $box-shadow;

.shiny-notification-close {
position: absolute;
font-size: 1.5em;
width: 2rem;
height: 2rem;
top: 0;
right: 0;
bottom: unset;
display: flex;
align-items: center;
justify-content: center;
padding: 0.25rem;
cursor: pointer;
font-weight: 200;
color: currentColor;

&:hover {
font-weight: normal;
}
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
}

.shiny-notification-content-text :last-child {
margin-bottom: 0;
}
}

@include color-mode(dark) {
.shiny-notification.shiny-notification {
box-shadow: $box-shadow-dark;
}
}
11 changes: 10 additions & 1 deletion inst/builtin/bs5/shiny/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,13 @@ $card-border-radius: 8px !default;

// bslib variables
$bslib-enable-shadows: true !default;
$bslib-value-box-enable-shadow: $bslib-enable-shadows !default;
$bslib-value-box-enable-shadow: $bslib-enable-shadows !default;

// Modals
$modal-dialog-margin-y-sm-up: 10% !default;
$modal-header-border-width: none !default;
$modal-header-padding: 1.5rem !default;
$modal-backdrop-bg: #464646 !default;

// Shiny: Base shiny.scss variables
$notification-close-color: currentColor !default;
2 changes: 1 addition & 1 deletion inst/css-precompiled/5/bootstrap.min.css

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion inst/themer-demo/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ shinyApp(
style = style,
{
for (i in 1:15) {
incProgress(1/15)
incProgress(
amount = 1/15,
detail = paste("Step", i, "of", 15)
)
Sys.sleep(0.25)
}
})
Expand Down
Binary file modified man/figures/navset-card-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/navset-underline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.