libs/barista-components/radio/src/radio.scss
@import '../../core/src/style/variables';
@import '../../core/src/style/interactive-common';
@import '../../core/src/style/transition';
@import '../../style/font-mixins';

$dt-radio-size: 20px;

:host {
  --dt-radio-default-color: var(--dt-accent-default-color);
  --dt-radio-hover-color: var(--dt-accent-hover-color);
  --dt-radio-active-color: var(--dt-accent-active-color);
  --dt-radio-disabled-color: #{$disabledcolor};
}

:host-context(.dt-theme-dark) {
  --dt-radio-default-color: #{$white};
  --dt-radio-hover-color: #{$white};
  --dt-radio-active-color: #{$white};
  --dt-radio-disabled-color: #{$gray-500};
}

.dt-radio-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;

  // Have the label span the rest of the radio button for
  // maximum clickable area.
  width: 100%;

  &:hover {
    cursor: pointer;
  }
}

.dt-radio-container {
  display: inline-block;
  position: relative;
  width: $dt-radio-size;
  height: $dt-radio-size;
  flex-shrink: 0;
}

.dt-radio-content {
  @include dt-main-font();
  display: inline-block;
  padding-left: 8px;
}

// The outer circle for the radio, always present.
.dt-radio-outer-circle {
  display: block;
  width: $dt-radio-size;
  height: $dt-radio-size;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: solid 2px var(--dt-radio-default-color);
  @include dt-form-input-color-transition();
}

.dt-radio-inner-circle {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: $dt-radio-size;
  height: $dt-radio-size;
  border-radius: 50%;
  background-color: var(--dt-radio-default-color);
  @include dt-form-input-color-transition();
  transition-property: transform, background-color;

  // Note: This starts from 0.001 instead of 0,
  // because transitioning from 0 to 0.5 causes
  // IE to flash the entire circle for a couple of frames,
  // throwing off the entire animation.
  transform: scale(0.001);
}

:host {
  display: inline-block;

  &:hover {
    .dt-radio-outer-circle {
      border-color: var(--dt-radio-hover-color);
    }

    .dt-radio-inner-circle {
      background-color: var(--dt-radio-hover-color);
    }
  }

  &:active {
    .dt-radio-outer-circle {
      border-color: var(--dt-radio-active-color);
    }

    .dt-radio-inner-circle {
      background-color: var(--dt-radio-active-color);
    }
  }

  &.dt-radio-focused .dt-radio-outer-circle {
    @include dt-focus-style();
  }

  &.dt-radio-checked .dt-radio-inner-circle {
    transform: scale(0.5);
  }

  &.dt-radio-disabled {
    .dt-radio-label {
      cursor: default;
    }

    .dt-radio-outer-circle {
      border-color: var(--dt-radio-disabled-color);
    }

    .dt-radio-inner-circle {
      background-color: var(--dt-radio-disabled-color);
    }
  }
}

:host-context(.dt-theme-dark) {
  .dt-radio-content {
    color: var(--dt-radio-default-color);
  }

  &:hover .dt-radio-outer-circle {
    background-color: rgba(255, 255, 255, 0.2);
  }

  &.dt-radio-disabled {
    .dt-radio-outer-circle {
      background-color: transparent;
    }
  }
}
