import React from "react";
import {
  _buildLegendItemsFromRange as buildLegendItemsFromRange,
  _getLegendOrientation as getLegendOrientation,
  _RangeLegend as RangeLegend,
  _useChartLayoutOrientation as useChartLayoutOrientation
} from "@dynatrace/strato-components-preview/charts";
import { DEFAULT_FORMATTER, DEFAULT_RANGE_COLOR } from "../../constants.js";
import { useMapConfig } from "../../hooks/use-map-config.js";
const ThresholdLegendRenderer = () => {
  const { orientation: layoutOrientation } = useChartLayoutOrientation();
  const { legend } = useMapConfig();
  const { ranges } = legend;
  const orientation = getLegendOrientation(layoutOrientation);
  const invertItems = orientation === "vertical";
  const items = buildLegendItemsFromRange(ranges, DEFAULT_RANGE_COLOR);
  invertItems && items.reverse();
  return /* @__PURE__ */ React.createElement(
    RangeLegend,
    {
      items,
      orientation,
      formatter: DEFAULT_FORMATTER
    }
  );
};
export {
  ThresholdLegendRenderer
};
//# sourceMappingURL=ThresholdLegendRenderer.js.map
