import React from "react";
import {
  _ChartLegend as ChartLegend,
  _useChartLayoutOrientation as useChartLayoutOrientation,
  _getLegendOrientation as getLegendOrientation,
  _buildCategoricalItemsFromScale as buildCategoricalItemsFromScale
} from "@dynatrace/strato-components-preview/charts";
import { useColorScale } from "../../hooks/use-color-scale.js";
import { useSetStateSelection } from "../../store/store.js";
const CategoricalLegendRenderer = () => {
  const { orientation: layoutOrientation } = useChartLayoutOrientation();
  const scale = useColorScale();
  const updateStateSelection = useSetStateSelection();
  const orientation = getLegendOrientation(layoutOrientation);
  const items = buildCategoricalItemsFromScale(scale);
  const handleHover = (items2) => {
    updateStateSelection({ highlightedSeries: items2 });
  };
  function handleClick(items2) {
    updateStateSelection({ visible: items2 });
  }
  return /* @__PURE__ */ React.createElement(
    ChartLegend,
    {
      items,
      orientation,
      onClick: handleClick,
      onHover: handleHover
    }
  );
};
export {
  CategoricalLegendRenderer
};
//# sourceMappingURL=CategoricalLegendRenderer.js.map
