| 1 |
/*-- scss:rules --*/ |
| 2 |
@import "ionrangeslider/_rules.scss"; |
| 3 |
@import "tables/_rules.scss"; |
| 4 |
|
| 5 |
$web-font-path: "https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&family=Source+Code+Pro:ital,wght@0,400;0,600;1,400;1,600&display=swap" !default; |
| 6 |
@if $web-font-path { |
| 7 |
@import url($web-font-path); |
| 8 |
} |
| 9 |
|
| 10 |
// Variables |
| 11 |
:root { |
| 12 |
--bslib-box-shadow-color-rgb: #{$bslib-box-shadow-color-rgb}; |
| 13 |
} |
| 14 |
|
| 15 |
@include color-mode(dark) { |
| 16 |
--bslib-box-shadow-color-rgb: #{$bslib-box-shadow-color-rgb-dark}; |
| 17 |
} |
| 18 |
|
| 19 |
// For radioButtons()/checkboxGroupInput(), move text slightly to the right |
| 20 |
$bslib-checkbox-radio-margin-right: 0.35em !default; |
| 21 |
.checkbox, |
| 22 |
.radio { |
| 23 |
input { |
| 24 |
margin-right: $bslib-checkbox-radio-margin-right; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
// Alignment fixes for radioButtons(inline=TRUE)/checkboxGroupInput(inline=TRUE) |
| 29 |
// TODO: It would be nice to do this for all inline groups, but that would |
| 30 |
// require updating the input markup to use <fieldset> and <legend>. |
| 31 |
.shiny-input-container-inline { |
| 32 |
.shiny-options-group { |
| 33 |
display: flex; |
| 34 |
flex-wrap: wrap; |
| 35 |
flex-direction: row; |
| 36 |
column-gap: 1em; |
| 37 |
|
| 38 |
.checkbox-inline, .radio-inline { |
| 39 |
position: relative; |
| 40 |
padding-left: calc(#{$form-check-input-width} + #{$bslib-checkbox-radio-margin-right} * 2); |
| 41 |
|
| 42 |
input { |
| 43 |
position: absolute; |
| 44 |
margin-top: 0; |
| 45 |
left: 0; |
| 46 |
top: calc(#{($line-height-base - $form-check-input-width) * .5} + #{$input-btn-border-width}); |
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
// For shiny::dateRangeInput(), fix "to" width in the middle of the date picker |
| 53 |
.shiny-date-range-input .input-daterange .input-group-addon { |
| 54 |
margin-right: -1px; |
| 55 |
} |
| 56 |
|
| 57 |
// Make the default shiny::actionButton() an outline variant, but not others |
| 58 |
.btn-outline-default, |
| 59 |
.btn-default:not(.btn-primary, .btn-secondary, .btn-info, .btn-success, .btn-danger, .btn-warning, .btn-light, .btn-dark, .btn-link, [class*="btn-outline-"]) { |
| 60 |
@include button-outline-variant($secondary); |
| 61 |
} |
| 62 |
|
| 63 |
// ... and make it look better in dark mode |
| 64 |
@if $enable-dark-mode { |
| 65 |
@include color-mode(dark) { |
| 66 |
.btn-outline-default, |
| 67 |
.btn-default:not(.btn-primary, .btn-secondary, .btn-info, .btn-success, .btn-danger, .btn-warning, .btn-light, .btn-dark, .btn-link, [class*="btn-outline-"]) { |
| 68 |
@include button-outline-variant($dark-text-emphasis-dark); |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
// For selectizeInput(options = list(plugins = "remove_button")) |
| 74 |
// TODO: we should probably make this the default behavior in shiny |
| 75 |
.selectize-control.plugin-remove_button .item { |
| 76 |
align-items: flex-start !important; |
| 77 |
.remove { |
| 78 |
border-left: none !important; |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
@if ($bslib-enable-shadows) { |
| 84 |
// These shadows are disabled because we use `enable-shadows: false` in the |
| 85 |
// theme to avoid enabling *all* shadows. This is why we can't use the |
| 86 |
// built-in `@include box-shadow()` mixin. |
| 87 |
|
| 88 |
// Add box-shadow & remove border from 'top-level' card()/layout_sidebar() |
| 89 |
.bslib-card { |
| 90 |
// BS doesn't include a box-shadow rule for .card when `enable-shadows: false` |
| 91 |
box-shadow: var(--bslib-card-box-shadow, #{$box-shadow-sm}); |
| 92 |
border-color: var(--bslib-card-border-color, transparent); |
| 93 |
&.bslib-value-box.default { |
| 94 |
--bslib-value-box-border-color-default: var(--bslib-card-border-color, transparent); |
| 95 |
} |
| 96 |
|
| 97 |
// Restore borders without shadows for nested cards/value boxes |
| 98 |
.bslib-card { |
| 99 |
--bslib-card-box-shadow: ; // unset our shadow |
| 100 |
--bslib-card-border-color: var(--#{$prefix}card-border-color); |
| 101 |
|
| 102 |
&.bslib-value-box.default { |
| 103 |
--bslib-value-box-border-color-default: var(--#{$prefix}card-border-color, #{$card-border-color}); |
| 104 |
} |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
.bslib-card-box-shadow-sm { |
| 109 |
--bslib-card-box-shadow: var(--bslib-card-box-shadow-sm, #{$box-shadow-sm}); |
| 110 |
} |
| 111 |
.bslib-card-box-shadow-md { |
| 112 |
--bslib-card-box-shadow: var(--bslib-card-box-shadow-md, #{$box-shadow}); |
| 113 |
} |
| 114 |
.bslib-card-box-shadow-lg { |
| 115 |
--bslib-card-box-shadow: var(--bslib-card-box-shadow-lg, #{$box-shadow-lg}); |
| 116 |
} |
| 117 |
.bslib-card-box-shadow-none { |
| 118 |
--bslib-card-box-shadow: none; |
| 119 |
--bslib-card-border-color: var(--#{$prefix}card-border-color); |
| 120 |
} |
| 121 |
|
| 122 |
.popover { |
| 123 |
--#{$prefix}popover-shadow: #{$popover-box-shadow}; |
| 124 |
box-shadow: var(--#{$prefix}popover-shadow); |
| 125 |
} |
| 126 |
} |
| 127 |
|
| 128 |
// TODO: move this logic into a "core" bundle that comes with any theme |
| 129 |
// (but you only get the shadows by default in the preset theme) |
| 130 |
@if $bslib-dashboard-design { |
| 131 |
|
| 132 |
:root { |
| 133 |
--bslib-dashboard-main-bg: rgb(247, 247, 247); |
| 134 |
--#{$prefix}card-border-color: var(--bslib-dashboard-border-color-translucent, var(--#{$prefix}border-color-translucent)); |
| 135 |
--bslib-dashboard-card-header-font-weight: #{$font-weight-semibold}; |
| 136 |
} |
| 137 |
|
| 138 |
@include color-mode(dark) { |
| 139 |
--bslib-dashboard-main-bg: rgb(20, 20, 24); |
| 140 |
} |
| 141 |
|
| 142 |
.bslib-card { |
| 143 |
// We don't want to get in the way of $card-cap-bg, which is used by the shiny preset |
| 144 |
// when the dashboard design is disabled. This next line disables the default background |
| 145 |
// color of the card header, giving us the white card headers we want, without also |
| 146 |
// blocking inheritence via `.text-bg-{theme}` classes or others. |
| 147 |
--#{$prefix}card-cap-bg: ; |
| 148 |
|
| 149 |
.card-header, |
| 150 |
.card-footer { |
| 151 |
font-size: 0.9rem; |
| 152 |
} |
| 153 |
|
| 154 |
.card-header { |
| 155 |
font-weight: var(--bslib-dashboard-card-header-font-weight); |
| 156 |
line-height: 1.375rem; |
| 157 |
} |
| 158 |
} |
| 159 |
|
| 160 |
// Set the background color of page dashboard class with a sidebar layout... |
| 161 |
.bslib-sidebar-layout { |
| 162 |
&:has(> .bslib-page-dashboard), |
| 163 |
// or of global main content area in a page_navbar() with a global sidebar |
| 164 |
&:has(.tab-content > .bslib-page-dashboard.active) { |
| 165 |
// or of main area of a page_sidebar() |
| 166 |
--_main-bg: var(--bslib-dashboard-main-bg); |
| 167 |
; |
| 168 |
} |
| 169 |
} |
| 170 |
|
| 171 |
// ... or `page_navbar(nav_panel(class = "bslib-page-dashboard"), sidebar = NULL)` |
| 172 |
.bslib-page-navbar .tab-content > .bslib-page-dashboard.active { |
| 173 |
background-color: var(--bslib-dashboard-main-bg); |
| 174 |
} |
| 175 |
|
| 176 |
.navbar { |
| 177 |
// Add border-bottom for general navbars (primarily in non-bslib contexts) |
| 178 |
border-bottom: $card-border-width solid $card-border-color; |
| 179 |
} |
| 180 |
|
| 181 |
.bslib-page-navbar, .bslib-page-dashboard { |
| 182 |
// Inside bslib we only add the border on the top-level navbar |
| 183 |
.navbar { |
| 184 |
border-bottom: none; |
| 185 |
} |
| 186 |
|
| 187 |
> .navbar + div { |
| 188 |
// Since we're using a transparent navbar, we need to (generally) add a border-top |
| 189 |
border-top: $card-border-width solid $card-border-color; |
| 190 |
|
| 191 |
// Case 1: page_navbar(sidebar = ...) |
| 192 |
// Case 2: page_navbar(nav_panel(layout_sidebar())) |
| 193 |
> .bslib-sidebar-layout, |
| 194 |
> .tab-content > .tab-pane.active.html-fill-container > .bslib-sidebar-layout.html-fill-item { |
| 195 |
border-top: none !important; // Make sure we don't end up w/ a double border |
| 196 |
} |
| 197 |
} |
| 198 |
} |
| 199 |
|
| 200 |
.bslib-page-sidebar { |
| 201 |
@if not $navbar-bg { |
| 202 |
--bslib-page-sidebar-title-bg: var(--#{$prefix}body-bg); |
| 203 |
--bslib-page-sidebar-title-color: var(--#{$prefix}body-color); |
| 204 |
} |
| 205 |
|
| 206 |
.bslib-page-title { |
| 207 |
border-color: var(--#{$prefix}border-color-translucent); |
| 208 |
} |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
// By default, non-active .nav links reflect the primary color. This styling |
| 213 |
// tweak brings them closer to how they'll appear in a navbar. |
| 214 |
.nav-underline { |
| 215 |
--#{$prefix}link-color: rgba(var(--bs-body-color-rgb), 0.65); |
| 216 |
--#{$prefix}link-hover-color: rgba(var(--bs-body-color-rgb), 0.8); |
| 217 |
--#{$prefix}nav-link-font-size: 0.875rem; |
| 218 |
|
| 219 |
.nav-link:not(:empty) { |
| 220 |
padding-left: 5px !important; |
| 221 |
padding-right: 5px !important; |
| 222 |
|
| 223 |
&.active { |
| 224 |
font-weight: 500; |
| 225 |
} |
| 226 |
} |
| 227 |
} |
| 228 |
|
| 229 |
// When the navbar is collapsed (or collapsing) on mobile, remove the |
| 230 |
// .nav-underline border |
| 231 |
.navbar-collapse.show, .navbar-collapse.collapsing { |
| 232 |
.nav-underline { |
| 233 |
--#{$prefix}nav-underline-border-width: 0; |
| 234 |
--#{$prefix}nav-underline-gap: 0; |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
// Align the bottom of .nav-link w/ the bottom of the navbar (when underlined) |
| 239 |
.navbar .nav-underline .nav-link { |
| 240 |
padding-bottom: calc(var(--#{$prefix}navbar-padding-y, #{$navbar-padding-y}) * 2); |
| 241 |
margin-bottom: calc(var(--#{$prefix}navbar-padding-y, #{$navbar-padding-y}) * -1); |
| 242 |
} |
| 243 |
|
| 244 |
// For value_box(), apply a gradient to the icon (by default) |
| 245 |
$icon-classes: ("bi", "fa", "fas", "far", "fab", "material-icons") !default; |
| 246 |
.bslib-value-box.default .value-box-showcase { |
| 247 |
> i { |
| 248 |
@each $icon-class in $icon-classes { |
| 249 |
&.#{$icon-class} { |
| 250 |
background: linear-gradient(140deg, $blue 36%, $purple 180%) $blue; |
| 251 |
-webkit-background-clip: text; |
| 252 |
-webkit-text-fill-color: transparent; |
| 253 |
} |
| 254 |
} |
| 255 |
} |
| 256 |
> svg { |
| 257 |
@each $icon-class in $icon-classes { |
| 258 |
&.#{$icon-class} { |
| 259 |
// Requires icon-gradient.svg which is added in the value_box() dependency |
| 260 |
fill: url('#bslib---icon-gradient') $blue !important; |
| 261 |
} |
| 262 |
} |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
// For value_box(), improve contrast of text colors |
| 267 |
.bslib-value-box { |
| 268 |
$cyan: #028097; // Contrast 4.63 |
| 269 |
$warning: #A87600; // Contrast 4 (okay for 16px+ text) |
| 270 |
|
| 271 |
&.text-info { |
| 272 |
&, &.text-cyan { |
| 273 |
--bslib-color-fg: $cyan !important; |
| 274 |
} |
| 275 |
color: $cyan !important; |
| 276 |
} |
| 277 |
|
| 278 |
&.text-light { |
| 279 |
--bslib-color-fg: $gray-600 !important; |
| 280 |
} |
| 281 |
|
| 282 |
&.text-warning { |
| 283 |
&, &.text-yellow { |
| 284 |
--bslib-color-fg: $warning !important; |
| 285 |
} |
| 286 |
color: $warning !important; |
| 287 |
} |
| 288 |
|
| 289 |
&.text-teal.text-teal { |
| 290 |
--bslib-color-fg: #008558; // Contrast 4.67 |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
// Modals |
| 295 |
.modal-body, .modal-footer { |
| 296 |
padding: 1.5rem; |
| 297 |
} |
| 298 |
.modal-header .btn-close { |
| 299 |
align-self: start; |
| 300 |
display: flex; |
| 301 |
} |
| 302 |
#shiny-modal-wrapper:has( ~ .modal-backdrop) .modal { |
| 303 |
// Blur the background when the modal has a backdrop |
| 304 |
backdrop-filter: blur(2px); |
| 305 |
-webkit-backdrop-filter: blur(2px); |
| 306 |
} |
| 307 |
|
| 308 |
// Progress Bars & Notifications |
| 309 |
// FIXME: Use css layers (dynamic themeing issue) |
| 310 |
#shiny-notification-panel#shiny-notification-panel { |
| 311 |
position: fixed; |
| 312 |
bottom: calc(var(--bslib-spacer, 1rem) / 2); |
| 313 |
right: calc(var(--bslib-spacer, 1rem) / 2); |
| 314 |
width: 450px; |
| 315 |
z-index: $zindex-toast; |
| 316 |
} |
| 317 |
|
| 318 |
.progress-message { |
| 319 |
margin-right: .6rem; |
| 320 |
} |
| 321 |
|
| 322 |
// FIXME: Use css layers (dynamic themeing issue) |
| 323 |
.shiny-notification.shiny-notification { |
| 324 |
position: relative; |
| 325 |
opacity: 0.96; |
| 326 |
padding: 2rem; |
| 327 |
margin: var(--bslib-spacer, 1rem); |
| 328 |
border: $border-width solid var(--#{$prefix}border-color-translucent); |
| 329 |
border-radius: $card-border-radius; |
| 330 |
box-shadow: $box-shadow; |
| 331 |
|
| 332 |
.shiny-notification-close { |
| 333 |
position: absolute; |
| 334 |
font-size: 1.5em; |
| 335 |
width: 2rem; |
| 336 |
height: 2rem; |
| 337 |
top: 0; |
| 338 |
right: 0; |
| 339 |
bottom: unset; |
| 340 |
display: flex; |
| 341 |
align-items: center; |
| 342 |
justify-content: center; |
| 343 |
padding: 0.25rem; |
| 344 |
cursor: pointer; |
| 345 |
font-weight: 200; |
| 346 |
color: currentColor; |
| 347 |
|
| 348 |
&:hover { |
| 349 |
font-weight: normal; |
| 350 |
} |
| 351 |
} |
| 352 |
|
| 353 |
.shiny-notification-content-text :last-child { |
| 354 |
margin-bottom: 0; |
| 355 |
} |
| 356 |
} |