Files
formipay/node_modules/reakit/es/Tooltip/TooltipState.js
dwindown e8fbfb14c1 fix: prevent asset conflicts between React and Grid.js versions
Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:02:14 +07:00

106 lines
3.7 KiB
JavaScript

import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';
import 'reakit-utils/shallowEqual';
import { useState, useRef, useCallback, useEffect } from 'react';
import 'reakit-warning';
import 'reakit-utils/useIsomorphicEffect';
import 'reakit-utils/dom';
import { useSealedState } from 'reakit-utils/useSealedState';
import '../Id/IdProvider.js';
import '../Id/IdState.js';
import '@popperjs/core';
import '../Disclosure/DisclosureState.js';
import '../Dialog/DialogState.js';
import { usePopoverState } from '../Popover/PopoverState.js';
import { g as globalState } from '../__globalState-300469f0.js';
function useTooltipState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$place = _useSealedState.placement,
placement = _useSealedState$place === void 0 ? "top" : _useSealedState$place,
_useSealedState$unsta = _useSealedState.unstable_timeout,
initialTimeout = _useSealedState$unsta === void 0 ? 0 : _useSealedState$unsta,
sealed = _objectWithoutPropertiesLoose(_useSealedState, ["placement", "unstable_timeout"]);
var _React$useState = useState(initialTimeout),
timeout = _React$useState[0],
setTimeout = _React$useState[1];
var showTimeout = useRef(null);
var hideTimeout = useRef(null);
var _usePopoverState = usePopoverState(_objectSpread2(_objectSpread2({}, sealed), {}, {
placement: placement
})),
modal = _usePopoverState.modal,
setModal = _usePopoverState.setModal,
popover = _objectWithoutPropertiesLoose(_usePopoverState, ["modal", "setModal"]);
var clearTimeouts = useCallback(function () {
if (showTimeout.current !== null) {
window.clearTimeout(showTimeout.current);
}
if (hideTimeout.current !== null) {
window.clearTimeout(hideTimeout.current);
}
}, []);
var hide = useCallback(function () {
clearTimeouts();
popover.hide(); // Let's give some time so people can move from a reference to another
// and still show tooltips immediately
hideTimeout.current = window.setTimeout(function () {
globalState.hide(popover.baseId);
}, timeout);
}, [clearTimeouts, popover.hide, timeout, popover.baseId]);
var show = useCallback(function () {
clearTimeouts();
if (!timeout || globalState.currentTooltipId) {
// If there's no timeout or a tooltip visible already, we can show this
// immediately
globalState.show(popover.baseId);
popover.show();
} else {
// There may be a reference with focus whose tooltip is still not visible
// In this case, we want to update it before it gets shown.
globalState.show(null); // Otherwise, wait a little bit to show the tooltip
showTimeout.current = window.setTimeout(function () {
globalState.show(popover.baseId);
popover.show();
}, timeout);
}
}, [clearTimeouts, timeout, popover.show, popover.baseId]);
useEffect(function () {
return globalState.subscribe(function (id) {
if (id !== popover.baseId) {
clearTimeouts();
if (popover.visible) {
// Make sure there will be only one tooltip visible
popover.hide();
}
}
});
}, [popover.baseId, clearTimeouts, popover.visible, popover.hide]);
useEffect(function () {
return function () {
clearTimeouts();
globalState.hide(popover.baseId);
};
}, [clearTimeouts, popover.baseId]);
return _objectSpread2(_objectSpread2({}, popover), {}, {
hide: hide,
show: show,
unstable_timeout: timeout,
unstable_setTimeout: setTimeout
});
}
export { useTooltipState };