"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./utils.mjs.js"),t=require("react");require("../../utils/dist/useId.mjs.js");var s=require("../../utils/dist/DOMFunctions.mjs.js"),r=require("../../utils/dist/domHelpers.mjs.js");require("../../utils/dist/platform.mjs.js"),require("../../utils/dist/runAfterTransition.mjs.js"),require("../../utils/dist/useLayoutEffect.mjs.js"),require("../../utils/dist/useEffectEvent.mjs.js"),require("react-dom"),exports.useFocus=function(u){let{isDisabled:i,onFocus:n,onBlur:o,onFocusChange:c}=u;const l=t.useCallback((e=>{if(e.target===e.currentTarget)return o&&o(e),c&&c(!1),!0}),[o,c]),a=e.useSyntheticBlurEvent(l),j=t.useCallback((e=>{const t=r.getOwnerDocument(e.target),u=t?s.getActiveElement(t):s.getActiveElement();e.target===e.currentTarget&&u===s.getEventTarget(e.nativeEvent)&&(n&&n(e),c&&c(!0),a(e))}),[c,n,a]);return{focusProps:{onFocus:!i&&(n||c||o)?j:void 0,onBlur:i||!o&&!c?void 0:l}}};
//# sourceMappingURL=useFocus.mjs.js.map
