Skip to content

The Open Standard for Generative UI

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

@include base.chart-base("bar-chart");

// (No data-change transition on the bar-chart-bar class: the old
// `height/y 0.3s` rule was inert — bars render as <path d=roundedBarPath(…)>,
// and height/y are rect geometry properties — so bars have always snapped.
// Removed rather than ported to the spring morph: no behavior to preserve.)

.#{brand.$prefix}-bar-chart-hover-highlight {
  fill: cssUtils.$text-neutral-primary;
  opacity: 0.04;
  pointer-events: none;
}

.#{brand.$prefix}-bar-chart-internal-line {
  pointer-events: none;
}

// 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}-bar-chart-bar--animated {
    transform-box: fill-box;
    transform-origin: center bottom;
    animation: #{brand.$prefix}-bar-grow 0.6s ease-out both;
  }
  // A negative bar's zero-line edge is its TOP — grow downward from there.
  .#{brand.$prefix}-bar-chart-bar--animated.#{brand.$prefix}-bar-chart-bar--negative {
    transform-origin: center top;
  }
}

@keyframes #{brand.$prefix}-bar-grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}