All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.scss.forms._form-check.scss Maven / Gradle / Ivy

Go to download

Orange Boosted with Bootstrap is a Bootstrap based, Orange branded accessible and ergonomic components library.

The newest version!
//
// Check/radio
//

.form-check {
  display: block;
  min-height: $form-check-min-height;
  padding-left: $form-check-padding-start;
  margin-bottom: $form-check-margin-bottom;

  .form-check-input {
    float: left;
    margin-left: $form-check-padding-start * -1;
  }
}

.form-check-reverse {
  padding-right: $form-check-padding-start;
  padding-left: 0;
  text-align: right;

  .form-check-input {
    float: right;
    margin-right: $form-check-padding-start * -1;
    margin-left: 0;
  }
}

.form-check-input {
  --#{$prefix}form-check-bg: #{$form-check-input-bg};

  flex-shrink: 0;
  width: $form-check-input-width;
  height: $form-check-input-width;
  margin-top: ($input-btn-line-height - $form-check-input-width) * .5; // line-height minus check height
  vertical-align: top;
  appearance: none;
  background-color: var(--#{$prefix}form-check-bg);
  background-image: var(--#{$prefix}form-check-bg-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: $form-check-input-border;
  print-color-adjust: exact; // Keep themed appearance for print
  @include transition($form-check-transition);

  &[type="checkbox"] {
    @include border-radius($form-check-input-border-radius, $form-check-input-border-radius); // Boosted mod
  }

  &[type="radio"] {
    // stylelint-disable-next-line property-disallowed-list
    border-radius: $form-check-radio-border-radius;
  }

  &:active {
    background-color: $form-check-input-active-bg-color; // Boosted mod
    filter: $form-check-input-active-filter;
    border-color: $form-check-input-active-bg-color; // Boosted mod
  }

  &:focus {
    border-color: $form-check-input-focus-border;
    // Boosted mod: default outline
    box-shadow: $form-check-input-focus-box-shadow;
  }

  &:checked {
    background-color: $form-check-input-checked-bg-color;
    border-color: $form-check-input-checked-border-color;

    &[type="checkbox"] {
      @if $enable-gradients {
        --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-checked-bg-image)}, var(--#{$prefix}gradient);
      } @else {
        --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-checked-bg-image)};
      }
    }

    &[type="radio"] {
      @if $enable-gradients {
        --#{$prefix}form-check-bg-image: #{escape-svg($form-check-radio-checked-bg-image)}, var(--#{$prefix}gradient);
      } @else {
        --#{$prefix}form-check-bg-image: #{escape-svg($form-check-radio-checked-bg-image)};
      }
    }
  }

  &[type="checkbox"]:indeterminate {
    background-color: $form-check-input-indeterminate-bg-color;
    border-color: $form-check-input-indeterminate-border-color;

    @if $enable-gradients {
      --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-indeterminate-bg-image)}, var(--#{$prefix}gradient);
      // stylelint-disable-next-line function-disallowed-list
      background-position: 50% add(50%, calc(var(--#{$prefix}border-width) * .25)), center; // Boosted mod
      // stylelint-disable-next-line function-disallowed-list
      background-size: map-get($spacers, 2) calc(var(--#{$prefix}border-width) * 1.5), auto; // Boosted mod
    } @else {
      --#{$prefix}form-check-bg-image: #{escape-svg($form-check-input-indeterminate-bg-image)};
      // stylelint-disable-next-line function-disallowed-list
      background-position: 50% add(50%, calc(var(--#{$prefix}border-width) * .25)); // Boosted mod
      // stylelint-disable-next-line function-disallowed-list
      background-size: map-get($spacers, 2) calc(var(--#{$prefix}border-width) * 1.5); // Boosted mod
    }
  }

  &:disabled {
    pointer-events: none;
    background-color: $input-disabled-bg; // Boosted mod
    filter: none;
    opacity: $form-check-input-disabled-opacity;

    // Boosted mod
    &:checked,
    &[type="checkbox"]:indeterminate {
      background-color: var(--#{$prefix}form-check-input-disabled-color);
      filter: $form-check-input-disabled-filter;
      border-color: var(--#{$prefix}form-check-input-disabled-color);
    }
    // End mod
  }

  // Use disabled attribute in addition of :disabled pseudo-class
  // See: https://github.com/twbs/bootstrap/issues/28247
  &[disabled],
  &:disabled {
    ~ .form-check-label {
      color: $form-label-disabled-color; // Boosted mod
      pointer-events: none;
      cursor: default;
      opacity: $form-check-label-disabled-opacity;
    }
  }

  // Boosted mod: required symbol
  &:required {
    ~ .form-check-label::after {
      margin-left: $form-label-required-margin-left;
      color: $form-label-required-color;
      content: "*";
    }
  }
}

.form-check-label {
  color: $form-check-label-color;
  cursor: $form-check-label-cursor;
}

//
// Switch
//

.form-switch {
  // Boosted mod
  --#{$prefix}switch-gradient: #{linear-gradient(to right, var(--#{$prefix}form-switch-square-bg) $form-switch-bg-square-size, transparent)};

  min-height: $form-switch-width * .5;
  padding-left: $form-switch-padding-start;
  background-color: transparent;

  .form-check-input {
    --#{$prefix}form-switch-bg: #{escape-svg($form-switch-bg-image)};

    position: relative; // Boosted mod: needed because of filter property
    width: $form-switch-width;
    height: $form-switch-width * .5;
    margin-left: $form-switch-padding-start * -1;
    background-color: $form-switch-bg; // Boosted mod
    background-image: var(--#{$prefix}form-switch-bg), var(--#{$prefix}switch-gradient); // Boosted mod: extra param `var(--#{$prefix}switch-gradient)`
    filter: $form-switch-filter; // Boosted mod
    background-position: $form-switch-bg-position, 0 0;
    background-size: $form-switch-bg-size, $form-switch-bg-square-size 100%; // Get a 1px separation
    border-color: $form-switch-border-color; // Boosted mod
    @include border-radius($form-switch-border-radius, 0);
    @include transition($form-switch-transition);

    &:focus {
      &[data-focus-visible-added] {
        @include focus-visible($color: $form-switch-focus-visible-outer, $box-color: $form-switch-focus-visible-inner);
      }
    }

    &:checked {
      background-color: $form-switch-checked-bg;
      filter: $form-switch-checked-filter; // Boosted mod
      border-color: $form-switch-checked-border-color;

      &:focus {
        &[data-focus-visible-added] {
          @include focus-visible($color: $form-switch-checked-focus-outer, $box-color: $form-switch-checked-focus-inner);
        }
      }

      @if $enable-gradients {
        --#{$prefix}form-switch-bg: #{escape-svg($form-switch-checked-bg-image)}, var(--#{$prefix}gradient);
        background-position: $form-switch-checked-bg-position, 100%, 100% 0;
        background-size: $form-switch-checked-bg-size, auto, $form-switch-bg-square-size 100%;
      } @else {
        --#{$prefix}form-switch-bg: #{escape-svg($form-switch-checked-bg-image)};
        background-position: $form-switch-checked-bg-position, 100% 0;
        background-size: $form-switch-checked-bg-size, $form-switch-bg-square-size 100%;
      }

      &:not(:disabled) {
        --#{$prefix}switch-gradient: #{linear-gradient(to right, $form-switch-checked-square-bg $form-switch-bg-square-size, transparent)};
      }
    }

    &:active {
      background-color: $form-check-input-active-bg-color;
      filter: none;
      border-color: $form-check-input-active-bg-color;
    }

    &:disabled {
      background-color: var(--#{$prefix}form-check-input-disabled-color);
      filter: $form-check-input-disabled-filter;
      border-color: var(--#{$prefix}form-check-input-disabled-color);
    }
  }

  .form-check-label {
    padding-top: $form-check-label-padding-top;
  }
  // End mod

  &.form-check-reverse {
    padding-right: $form-switch-padding-start;
    padding-left: 0;

    .form-check-input {
      margin-right: $form-switch-padding-start * -1;
      margin-left: 0;
    }
  }
}

.form-check-inline {
  display: inline-block;
  margin-right: $form-check-inline-margin-end;
}

.btn-check {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;

  &[disabled],
  &:disabled {
    + .btn {
      // Boosted mod: no pointer-events
      // Boosted mod: no filter
      opacity: $form-check-btn-check-disabled-opacity;
    }
  }

  // Boosted mod
  &[data-focus-visible-added]:focus {
    + .btn,
    + .tag {
      @include focus-visible();
    }
  }
  // End mod
}

// Boosted mod: no `@if enable-dark-mode`




© 2015 - 2025 Weber Informatics LLC | Privacy Policy