Skip to content

The Open Standard for Generative UI

2.0 KB
Raw Blame
@use "../../../cssUtils" as cssUtils;
@use "../shared/cartesian/chartBase" as base;
@use "../prefix" as brand;

@include base.centered-container("radar-chart");
@include base.centered-svg-wrapper("radar-chart");

// Labels are budgeted against the CONTAINER width (radarLabelLayout.ts) and
// legitimately paint outside the square svg viewport; the polar container
// column deliberately does not clip (chartBase.scss centered-container).
// Vertical extent stays inside the svg via radarLabelPadding + line caps.
.#{brand.$prefix}-radar-chart-svg-wrapper > svg {
  overflow: visible;
}

// Solid rings and spokes in the interactive border tone.
.#{brand.$prefix}-radar-chart-grid-ring {
  stroke: cssUtils.$border-interactive;
  stroke-width: 1;
}

.#{brand.$prefix}-radar-chart-grid-spoke {
  stroke: cssUtils.$border-interactive;
  stroke-width: 1;
}

.#{brand.$prefix}-radar-chart-polygon-area {
  transition: opacity 0.2s ease;
}

.#{brand.$prefix}-radar-chart-polygon-stroke {
  fill: none;
  stroke-width: 2;
}

.#{brand.$prefix}-radar-chart-dot {
  stroke: cssUtils.$foreground;
  stroke-width: 1.5;
  transition:
    r 0.15s ease,
    opacity 0.15s ease;
}

@include base.active-dot-styles("radar-chart");

.#{brand.$prefix}-radar-chart-active-dots {
  pointer-events: none;
}

.#{brand.$prefix}-radar-chart-axis-label {
  @include base.svg-tick-label;
}

// Entrances are decorative: gate the whole rule (pre-state included) behind
// reduced-motion so users who opt out get the natural static state immediately
// — gating only the animation would strand elements at the opacity: 0 start.
@media (prefers-reduced-motion: no-preference) {
  .#{brand.$prefix}-radar-chart-polygon--animated {
    opacity: 0;
    transform-origin: center center;
    animation: #{brand.$prefix}-radar-polygon-appear 0.5s ease-out forwards;
  }
}

@keyframes #{brand.$prefix}-radar-polygon-appear {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}