UNPKG

@uifabric/experiments

Version:

Experimental React components for building experiences for Microsoft 365.

17 lines 765 B
import { __assign } from "tslib"; import * as React from 'react'; // `extends any` to trick the parser into parsing as a type decl instead of a jsx tag export var TriggerOnContextMenu = function (ItemComponent) { return function (props) { var onTrigger = props.onTrigger; // eslint-disable-next-line react-hooks/rules-of-hooks -- this is a component var trigger = React.useCallback(function (e) { var _a; e.preventDefault(); e.stopPropagation(); (_a = onTrigger) === null || _a === void 0 ? void 0 : _a(); }, [onTrigger]); return React.createElement(ItemComponent, __assign({}, props, { onContextMenu: trigger })); }; }; //# sourceMappingURL=TriggerOnContextMenu.js.map