_grouped.scss 9.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/** @TODO: use JS Toolkit to create individual SASS files for
***        existing PS components
**/
@use "sass:math" as math;


/// FormInput
///-----------------------------------------------------------------------------

.b-form-input {

  &[type=password] {
    letter-spacing: space-x(1);
    font-weight: 700;
  }
16 17 18 19 20 21 22

  // remove "bootstrap" focus ring for this state
  &--idled:active,
  &--idled:focus {
    border-color: $input-border-color;
    box-shadow: unset;
  }
23 24
}

25 26 27 28 29 30 31 32 33 34 35 36 37
/// Checkbox
///-----------------------------------------------------------------------------

.b-form-checkbox {
  @include clickable();

  &--disabled,
  &--deferred,
  &--idled {
    @include unclickable();
  }
}

38 39 40 41 42 43 44 45 46
/// Modal
///-----------------------------------------------------------------------------

.b-modal {
  $self: &;
  $wrapper-margin: 1.75rem; // from "_modal.scss"

  &__content {
    background-color: $modal-content-bg;
47 48
    margin-left: $wrapper-margin;
    margin-right: $wrapper-margin;
49 50 51 52
  }

  &__header {
    background-color: $card-cap-bg;
53
    align-items: center;
54

55
    &__title {
56 57 58
      color: $primary;
      font-size: 21px;
    }
59 60 61 62 63 64

    &__close {
      // better positioning due to button overlay
      $offset-x: 8px;
      margin-right: $offset-x;
    }
65 66
  }

67 68 69 70
  // @XXX Bootstrap not removing some modal elements on "hide" method
  //      Adding an overlay that the user could click to synchronise the hide
  //      cinematic
  // @https://stackoverflow.com/questions/50168312/bootstrap-4-close-modal-backdrop-doesnt-disappear
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
  &__overlay {
    width: 100%;
    height: 100%;
    position: absolute;
  }
}

/// Spinner
///-----------------------------------------------------------------------------

.b-spinner {
  // regarding sizing, Bootstrap set a default `2rem ^ 2rem`
  // (cf. "_spinners.scss")
  font-size: inherit;
}


/// Button
///-----------------------------------------------------------------------------


.b-button {
  $spinner-size: 20px;
  $self: &;

  @include clickable();

  position: relative;

  // (!) `translate` CSS modifiers won't work with bootstrap spinner
  &__spinner {
    position: absolute;
    left: calc(50% - #{ math.div($spinner-size, 2) });
    top: calc(50% - #{ math.div($spinner-size, 2) });
    width: $spinner-size;
    height: $spinner-size;
  }

  &--disabled,
  &--deferred,
  &--idled {
    @include unclickable();
  }

  &--deferred {

    #{ $self }__inner {
      visibility: hidden;
    }
  }

  // icon alignement
  .b-icon::before {
    line-height: $btn-line-height;
  }
}

arturo's avatar
arturo committed
128 129 130 131 132
/// Icon Button
///-----------------------------------------------------------------------------

.b-icon-button {
  $self: &;
arturo's avatar
arturo committed
133 134
  $overlay-offset-y: -6px;
  $overlay-offset-x: -10px;
arturo's avatar
arturo committed
135 136 137 138 139

  transition: color 0.2s;
  position: relative;
  transition: color 150ms ease-in-out;

arturo's avatar
arturo committed
140 141 142 143 144
  &__inner {
    // (due to overlay via pseudo element)
    z-index: 1;
    position: relative;
  }
arturo's avatar
arturo committed
145

arturo's avatar
arturo committed
146 147 148 149 150 151 152 153 154 155 156 157
  // overlay preparation
  &::before {
    left: $overlay-offset-x;
    right: $overlay-offset-x;
    top: $overlay-offset-y;
    bottom: $overlay-offset-y;
    border-radius: $overlay-radius;
    position: absolute;
    transition:
      background-color 150ms ease-in-out,
      box-shadow 150ms ease-in-out;
  }
arturo's avatar
arturo committed
158

arturo's avatar
arturo committed
159 160 161
  &--overlay::before {
    content: "";
  }
arturo's avatar
arturo committed
162

arturo's avatar
arturo committed
163 164 165 166
  // elevation levels
  &--level-1:hover::before {
    background-color: $gray-100;
  }
arturo's avatar
arturo committed
167

arturo's avatar
arturo committed
168 169 170 171 172
  &--level-2::before {
    background-color: $gray-100;
  }
  &--level-2:hover::before {
    background-color: darken($gray-100, 10%);
arturo's avatar
arturo committed
173 174
  }

arturo's avatar
arturo committed
175
  // component status UI changes
arturo's avatar
arturo committed
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
  &--enabled,
  &--muted,
  &--idled {
    @include clickable;

    &#{ $self }--warning    { color: $warning; }
    &#{ $self }--success    { color: $success; }
    &#{ $self }--danger     { color: $danger; }
    &#{ $self }--info       { color: $info; }
    &#{ $self }--primary    { color: $primary; }
    &#{ $self }--secondary  { color: $secondary; }
    &#{ $self }--dark       { color: $body-color; }
  }

  &--enabled,
  &--muted {
    &#{ $self }--warning:hover    { color: darken($warning, 10%); }
    &#{ $self }--success:hover    { color: darken($success, 10%); }
    &#{ $self }--danger:hover     { color: darken($danger, 10%); }
    &#{ $self }--info:hover       { color: darken($info, 10%); }
    &#{ $self }--primary:hover    { color: darken($primary, 10%); }
    &#{ $self }--secondary:hover  { color: darken($secondary, 10%); }
    &#{ $self }--dark:hover       { color: darken($body-color, 10%); }
arturo's avatar
arturo committed
199
  }
arturo's avatar
arturo committed
200

arturo's avatar
arturo committed
201 202
  &--enabled#{ $self }--focus-ring,
  &--muted#{ $self }--focus-ring {
arturo's avatar
arturo committed
203 204 205 206 207 208 209
    &#{ $self }:active,
    &#{ $self }--active {

      &::before {
        box-shadow: 0 0 0 0.2rem mix-alpha($gray-200, 50%);
      }
    }
arturo's avatar
arturo committed
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
  }

  &--idled:hover {
    @include unclickable();
  }

  &--disabled,
  &--deferred {
    @include unclickable();

    &#{ $self }--warning    { color: lighten($warning, 15%); }
    &#{ $self }--success    { color: lighten($success, 15%); }
    &#{ $self }--danger     { color: lighten($danger, 15%); }
    &#{ $self }--info       { color: lighten($info, 15%); }
    &#{ $self }--primary    { color: lighten($primary, 15%); }
    &#{ $self }--secondary  { color: lighten($secondary, 15%); }
    &#{ $self }--dark       { color: lighten($body-color, 15%); }
  }
228 229 230 231 232 233 234 235 236 237
  &--disabled#{$self}--level-1:hover::before,
  &--deferred#{$self}--level-2:hover::before {
    background-color: initial;
  }
  &--disabled#{$self}--level-2::before,
  &--disabled#{$self}--level-2:hover::before,
  &--deferred#{$self}--level-2::before,
  &--deferred#{$self}--level-2:hover::before {
    background-color: lighten($gray-100, 15%);
  }
arturo's avatar
arturo committed
238
}
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281

/// Fieldset
///-----------------------------------------------------------------------------

.b-fieldset {
  $margin: space-x(2);

  position: relative;
  border: $card-border-width solid $card-border-color;
  border-radius: $card-border-radius;
  padding-left: $margin;
  padding-right: $margin;
  padding-bottom: $margin;
  padding-top: calc( #{ $margin } + #{ $headings-margin-bottom } );
  background-color: inherit;

  &__legend {
    position: absolute;
    top: 0;
    font-size: $headings-font-family;
    font-weight: $headings-font-weight;
    color: $gray-600;
    line-height: $headings-line-height;
    margin: #{ - $headings-margin-bottom } 0 0;
    padding-left: $margin / 2;
    padding-right: $margin / 2;
    background-color: inherit;
  }
}

/// PhyloExplorer.ConfigForm
///-----------------------------------------------------------------------------

.phylo-config-form {


  &__row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
  }

  &__group {
arturo's avatar
arturo committed
282
    margin-bottom: $form-group-margin-bottom;
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
  }

  .b-fieldset {
    margin-left: $card-spacer-x;
    margin-right: $card-spacer-x;
  }

  &__col {
    width: 50%;

    &:first-child {
      padding-right: space-x(1);
    }

    &:last-child {
      padding-left: space-x(1);
    }
  }

  &__submit {
    text-align: center;
  }
}
arturo's avatar
arturo committed
306 307 308 309 310 311 312 313 314 315 316 317 318

/// Tabs
///-----------------------------------------------------------------------------

.b-tabs {

  .nav-item:first-child {
    margin-left: space-x(2);
  }
  .nav-item:last-child {
    margin-right: space-x(2);
  }
}
arturo's avatar
arturo committed
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353

/// Ripple
///-----------------------------------------------------------------------------

.b-ripple {
  @include fit-positions;

  position: absolute;
  overflow: hidden;

  &:after {
    @include fit-positions;

    content: "";
    position: absolute;
    pointer-events: none;
    background-image:
      radial-gradient(
        circle,
        #000 10%,
        transparent 10%
      );
    background-repeat: no-repeat;
    background-position: 50%;
    opacity: 0;
    transition: transform 0.6s, opacity 0.6s;
    transform: scale(10);
  }

  &:active:after {
    transform: scale(0);
    opacity: 0.2;
    transition: transform 0s, opacity 0s;
  }

arturo's avatar
arturo committed
354
  @each $name, $value in $palette-semantic {
arturo's avatar
arturo committed
355 356 357 358 359 360 361 362 363 364

    &--#{ $name }:after {
      background-image:
        radial-gradient(
          circle,
          #{ $value } 10%,
          transparent 10%
        );
    }
  }
arturo's avatar
arturo committed
365 366 367 368 369 370

  &--disabled:after,
  &--deferred:after,
  &--muted:after {
    content: none;
  }
arturo's avatar
arturo committed
371
}
arturo's avatar
arturo committed
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393

/// Preloader
///-----------------------------------------------------------------------------

.b-preloader {
  width: 100%;
  height: 100%;

  &__spinner {
    $size: 100px;
    $weight: 6px;

    position: absolute;
    font-size: $weight;
    height: $size;
    width: $size;
    // (?) `centered` mixin will not work here, due to Bootstrap process
    //     interfering with the transform rule
    top: calc( 50% - #{ $size / 2 } );
    left: calc( 50% - #{ $size / 2 } );
  }
}
arturo's avatar
arturo committed
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458


/// Context Menu
///-----------------------------------------------------------------------------

.b-context-menu {
  $minimum-width: 280px;

  @include fit-positions();

  position: fixed;
  z-index: z-index('main', 'floaty');
  background-color: transparent;

  &__inner {
    position: fixed;
    box-shadow: $box-shadow-lg;
    border: 1px solid $gray-100;
    word-wrap: break-word;
    background-color: $body-bg;
    border-radius: $card-border-radius;
    min-width: $minimum-width;
  }
}

.b-context-menu-item {
  @include clickable();

  position: relative;
  background-color: $body-bg;
  padding: $list-group-item-padding-y $list-group-item-padding-x;
  font-size: 15px;

  &--disabled,
  &--deferred,
  &--idled {
    @include unclickable();

    color: $list-group-disabled-color;
  }

  &--enabled:hover,
  &--muted:hover {
    background-color: $list-group-hover-bg;
  }
}


/// Button Group
///-----------------------------------------------------------------------------

.b-button-group {
  $gutter: 2px;

  &--no-collapse {

    .btn:not(:first-child) {
      margin-left: calc( #{ $gutter } / 2 );
    }

    .btn:not(:last-child) {
      margin-right: calc( #{ $gutter } / 2 );
    }
  }
}