@engie-group/fluid-design-system-react
Version:
Fluid Design System React
38 lines (35 loc) • 1.71 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import { useHover, useFocus, useClick, useRole, useDismiss, useListNavigation, useTypeahead, useClientPoint, useInteractions } from '../../../node_modules/.pnpm/@floating-ui_react@0.27.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.js';
import { usePopoverContext } from '../NJPopoverContext.js';
import { NJPopoverInteractionContext } from '../NJPopoverInteractionContext.js';
const NJPopoverInteractions = (props) => {
const { context } = usePopoverContext();
const interactions = [];
if (props.hover) {
interactions.push(useHover(context, typeof props.hover === 'object' ? props.hover : {}));
}
if (props.focus) {
interactions.push(useFocus(context, typeof props.focus === 'object' ? props.focus : {}));
}
if (props.click) {
interactions.push(useClick(context, typeof props.click === 'object' ? props.click : {}));
}
if (props.role) {
interactions.push(useRole(context, props.role));
}
if (props.dismiss) {
interactions.push(useDismiss(context, typeof props.dismiss === 'object' ? props.dismiss : {}));
}
if (props.listNavigation) {
interactions.push(useListNavigation(context, props.listNavigation));
}
if (props.typeahead) {
interactions.push(useTypeahead(context, props.typeahead));
}
if (props.clientPoint) {
interactions.push(useClientPoint(context, props.clientPoint));
}
const interaction = useInteractions(interactions);
return (jsx(NJPopoverInteractionContext.Provider, { value: interaction, children: props.children }));
};
export { NJPopoverInteractions };