import { isUndefined } from "lodash-es";
import React from "react";
import {
  _buildQuantizedRangeItems as buildQuantizedRangeItems,
  _getLegendOrientation as getLegendOrientation,
  _RangeLegend as RangeLegend,
  _useChartLayoutOrientation as useChartLayoutOrientation
} from "@dynatrace/strato-components-preview/charts";
import { DEFAULT_FORMATTER } from "../../constants.js";
import { useColorScale } from "../../hooks/use-color-scale.js";
const SequentialLegendRenderer = () => {
  const { orientation: layoutOrientation } = useChartLayoutOrientation();
  const scale = useColorScale();
  if (isUndefined(scale)) {
    return null;
  }
  const orientation = getLegendOrientation(layoutOrientation);
  const invertItems = orientation === "vertical";
  const items = buildQuantizedRangeItems(scale, invertItems);
  return /* @__PURE__ */ React.createElement(
    RangeLegend,
    {
      items,
      orientation,
      formatter: DEFAULT_FORMATTER
    }
  );
};
export {
  SequentialLegendRenderer
};
//# sourceMappingURL=SequentialLegendRenderer.js.map
