Files
ETB/ETB-FrontEnd/node_modules/@mui/x-charts/esm/hooks/useItemHighlightedGetter.js
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

23 lines
981 B
JavaScript

'use client';
import { useSelector } from "../internals/store/useSelector.js";
import { useStore } from "../internals/store/useStore.js";
import { selectorChartsIsFadedCallback, selectorChartsIsHighlightedCallback } from "../internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js";
/**
* A hook to check the highlighted state of multiple items.
* If you're interested by a single one, consider using `useItemHighlighted`.
*
* Warning: highlighted and faded can both be true at the same time.
* We recommend to first test if item is highlighted: `const faded = !highlighted && isFaded(item)`
* @returns {{ isHighlighted, isFaded }} callbacks to get the state of the item.
*/
export function useItemHighlightedGetter() {
const store = useStore();
const isHighlighted = useSelector(store, selectorChartsIsHighlightedCallback);
const isFaded = useSelector(store, selectorChartsIsFadedCallback);
return {
isHighlighted,
isFaded
};
}