@fluentui/react-utilities 9.13.0 → 9.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +55 -1
- package/CHANGELOG.md +24 -2
- package/lib/compose/assertSlots.js +8 -3
- package/lib/compose/assertSlots.js.map +1 -1
- package/lib/compose/getSlots.js +1 -1
- package/lib/compose/getSlots.js.map +1 -1
- package/lib/compose/getSlotsNext.js +1 -1
- package/lib/compose/getSlotsNext.js.map +1 -1
- package/lib/compose/isResolvedShorthand.js.map +1 -1
- package/lib/compose/isSlot.js +2 -1
- package/lib/compose/isSlot.js.map +1 -1
- package/lib/compose/resolveShorthand.js +2 -1
- package/lib/compose/resolveShorthand.js.map +1 -1
- package/lib/compose/slot.js +7 -7
- package/lib/compose/slot.js.map +1 -1
- package/lib/events/mouseTouchHelpers.js.map +1 -1
- package/lib/hooks/useAnimationFrame.js +10 -1
- package/lib/hooks/useAnimationFrame.js.map +1 -1
- package/lib/hooks/useBrowserTimer.js.map +1 -1
- package/lib/hooks/useControllableState.js +5 -8
- package/lib/hooks/useControllableState.js.map +1 -1
- package/lib/hooks/useEventCallback.js.map +1 -1
- package/lib/hooks/useFirstMount.js.map +1 -1
- package/lib/hooks/useForceUpdate.js.map +1 -1
- package/lib/hooks/useId.js.map +1 -1
- package/lib/hooks/useMergedRefs.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +25 -19
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnScrollOutside.js +12 -6
- package/lib/hooks/useOnScrollOutside.js.map +1 -1
- package/lib/hooks/usePrevious.js.map +1 -1
- package/lib/hooks/useScrollbarWidth.js +1 -1
- package/lib/hooks/useScrollbarWidth.js.map +1 -1
- package/lib/hooks/useTimeout.js.map +1 -1
- package/lib/selection/useSelection.js +2 -2
- package/lib/selection/useSelection.js.map +1 -1
- package/lib/ssr/SSRContext.js +5 -7
- package/lib/ssr/SSRContext.js.map +1 -1
- package/lib/ssr/canUseDOM.js.map +1 -1
- package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib/trigger/getTriggerChild.js.map +1 -1
- package/lib/trigger/isFluentTrigger.js.map +1 -1
- package/lib/utils/createSetFromIterable.js.map +1 -1
- package/lib/utils/getNativeElementProps.js +1 -1
- package/lib/utils/getNativeElementProps.js.map +1 -1
- package/lib/utils/getRTLSafeKey.js.map +1 -1
- package/lib/utils/getReactCallbackName.js +2 -4
- package/lib/utils/getReactCallbackName.js.map +1 -1
- package/lib/utils/isHTMLElement.js +2 -2
- package/lib/utils/isHTMLElement.js.map +1 -1
- package/lib/utils/isInteractiveHTMLElement.js +1 -1
- package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib/utils/mergeCallbacks.js +3 -2
- package/lib/utils/mergeCallbacks.js.map +1 -1
- package/lib/utils/omit.js.map +1 -1
- package/lib/utils/priorityQueue.js.map +1 -1
- package/lib/utils/properties.js +2 -1
- package/lib/utils/properties.js.map +1 -1
- package/lib-commonjs/compose/assertSlots.js +13 -6
- package/lib-commonjs/compose/assertSlots.js.map +1 -1
- package/lib-commonjs/compose/constants.js +6 -2
- package/lib-commonjs/compose/constants.js.map +1 -1
- package/lib-commonjs/compose/getSlots.js +6 -4
- package/lib-commonjs/compose/getSlots.js.map +1 -1
- package/lib-commonjs/compose/getSlotsNext.js +6 -4
- package/lib-commonjs/compose/getSlotsNext.js.map +1 -1
- package/lib-commonjs/compose/index.js +14 -12
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/compose/isResolvedShorthand.js +3 -1
- package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
- package/lib-commonjs/compose/isSlot.js +5 -2
- package/lib-commonjs/compose/isSlot.js.map +1 -1
- package/lib-commonjs/compose/resolveShorthand.js +7 -4
- package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
- package/lib-commonjs/compose/slot.js +18 -12
- package/lib-commonjs/compose/slot.js.map +1 -1
- package/lib-commonjs/compose/types.js +2 -2
- package/lib-commonjs/compose/types.js.map +1 -1
- package/lib-commonjs/events/index.js +2 -2
- package/lib-commonjs/events/index.js.map +1 -1
- package/lib-commonjs/events/mouseTouchHelpers.js +11 -5
- package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
- package/lib-commonjs/hooks/index.js +14 -14
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useAnimationFrame.js +13 -2
- package/lib-commonjs/hooks/useAnimationFrame.js.map +1 -1
- package/lib-commonjs/hooks/useBrowserTimer.js +5 -3
- package/lib-commonjs/hooks/useBrowserTimer.js.map +1 -1
- package/lib-commonjs/hooks/useControllableState.js +10 -11
- package/lib-commonjs/hooks/useControllableState.js.map +1 -1
- package/lib-commonjs/hooks/useEventCallback.js +5 -3
- package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
- package/lib-commonjs/hooks/useFirstMount.js +5 -3
- package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
- package/lib-commonjs/hooks/useForceUpdate.js +3 -1
- package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
- package/lib-commonjs/hooks/useId.js +11 -5
- package/lib-commonjs/hooks/useId.js.map +1 -1
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +5 -3
- package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/lib-commonjs/hooks/useMergedRefs.js +5 -3
- package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
- package/lib-commonjs/hooks/useOnClickOutside.js +29 -22
- package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
- package/lib-commonjs/hooks/useOnScrollOutside.js +16 -9
- package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
- package/lib-commonjs/hooks/usePrevious.js +5 -3
- package/lib-commonjs/hooks/usePrevious.js.map +1 -1
- package/lib-commonjs/hooks/useScrollbarWidth.js +6 -4
- package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
- package/lib-commonjs/hooks/useTimeout.js +3 -1
- package/lib-commonjs/hooks/useTimeout.js.map +1 -1
- package/lib-commonjs/index.js +129 -43
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/selection/index.js +3 -3
- package/lib-commonjs/selection/index.js.map +1 -1
- package/lib-commonjs/selection/types.js +2 -2
- package/lib-commonjs/selection/types.js.map +1 -1
- package/lib-commonjs/selection/useSelection.js +7 -5
- package/lib-commonjs/selection/useSelection.js.map +1 -1
- package/lib-commonjs/ssr/SSRContext.js +22 -14
- package/lib-commonjs/ssr/SSRContext.js.map +1 -1
- package/lib-commonjs/ssr/canUseDOM.js +3 -1
- package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
- package/lib-commonjs/ssr/index.js +3 -3
- package/lib-commonjs/ssr/index.js.map +1 -1
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +5 -3
- package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
- package/lib-commonjs/trigger/getTriggerChild.js +5 -3
- package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
- package/lib-commonjs/trigger/index.js +5 -5
- package/lib-commonjs/trigger/index.js.map +1 -1
- package/lib-commonjs/trigger/isFluentTrigger.js +5 -3
- package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
- package/lib-commonjs/trigger/types.js +2 -2
- package/lib-commonjs/trigger/types.js.map +1 -1
- package/lib-commonjs/utils/clamp.js +3 -1
- package/lib-commonjs/utils/clamp.js.map +1 -1
- package/lib-commonjs/utils/createSetFromIterable.js +3 -1
- package/lib-commonjs/utils/createSetFromIterable.js.map +1 -1
- package/lib-commonjs/utils/getNativeElementProps.js +9 -5
- package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
- package/lib-commonjs/utils/getRTLSafeKey.js +3 -1
- package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
- package/lib-commonjs/utils/getReactCallbackName.js +7 -7
- package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
- package/lib-commonjs/utils/index.js +10 -10
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/isHTMLElement.js +5 -3
- package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/isInteractiveHTMLElement.js +4 -2
- package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
- package/lib-commonjs/utils/mergeCallbacks.js +6 -3
- package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
- package/lib-commonjs/utils/omit.js +3 -1
- package/lib-commonjs/utils/omit.js.map +1 -1
- package/lib-commonjs/utils/priorityQueue.js +3 -1
- package/lib-commonjs/utils/priorityQueue.js.map +1 -1
- package/lib-commonjs/utils/properties.js +89 -30
- package/lib-commonjs/utils/properties.js.map +1 -1
- package/package.json +5 -5
@@ -9,12 +9,18 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
isTouchEvent: ()
|
13
|
-
|
14
|
-
|
12
|
+
isTouchEvent: function() {
|
13
|
+
return isTouchEvent;
|
14
|
+
},
|
15
|
+
isMouseEvent: function() {
|
16
|
+
return isMouseEvent;
|
17
|
+
},
|
18
|
+
getEventClientCoords: function() {
|
19
|
+
return getEventClientCoords;
|
20
|
+
}
|
15
21
|
});
|
16
|
-
const
|
17
|
-
const _react = /*#__PURE__*/
|
22
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
23
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
18
24
|
function isTouchEvent(event) {
|
19
25
|
return event.type.startsWith('touch');
|
20
26
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["mouseTouchHelpers.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.\n */ export function isTouchEvent(event) {\n return event.type.startsWith('touch');\n}\n/**\n * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.\n */ export function isMouseEvent(event) {\n return event.type.startsWith('mouse') || [\n 'click',\n 'contextmenu',\n 'dblclick'\n ].indexOf(event.type) > -1;\n}\n/**\n * Returns an object with clientX, clientY for TouchOrMouseEvent.\n * Returns zeros in case the event is not a mouse or a touch event.\n */ export function getEventClientCoords(event) {\n if (isMouseEvent(event)) {\n return {\n clientX: event.clientX,\n clientY: event.clientY\n };\n } else if (isTouchEvent(event)) {\n return {\n clientX: event.touches[0].clientX,\n clientY: event.touches[0].clientY\n };\n } else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');\n }\n return {\n clientX: 0,\n clientY: 0\n };\n }\n}\n"],"names":["isTouchEvent","isMouseEvent","getEventClientCoords","event","type","startsWith","indexOf","clientX","clientY","touches","process","env","NODE_ENV","Error"],"mappings":";;;;;;;;;;;IAGoBA,YAAY
|
1
|
+
{"version":3,"sources":["mouseTouchHelpers.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.\n */ export function isTouchEvent(event) {\n return event.type.startsWith('touch');\n}\n/**\n * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.\n */ export function isMouseEvent(event) {\n return event.type.startsWith('mouse') || [\n 'click',\n 'contextmenu',\n 'dblclick'\n ].indexOf(event.type) > -1;\n}\n/**\n * Returns an object with clientX, clientY for TouchOrMouseEvent.\n * Returns zeros in case the event is not a mouse or a touch event.\n */ export function getEventClientCoords(event) {\n if (isMouseEvent(event)) {\n return {\n clientX: event.clientX,\n clientY: event.clientY\n };\n } else if (isTouchEvent(event)) {\n return {\n clientX: event.touches[0].clientX,\n clientY: event.touches[0].clientY\n };\n } else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');\n }\n return {\n clientX: 0,\n clientY: 0\n };\n }\n}\n"],"names":["isTouchEvent","isMouseEvent","getEventClientCoords","event","type","startsWith","indexOf","clientX","clientY","touches","process","env","NODE_ENV","Error"],"mappings":";;;;;;;;;;;IAGoBA,YAAY;eAAZA;;IAKAC,YAAY;eAAZA;;IAUAC,oBAAoB;eAApBA;;;;iEAlBG;AAGZ,SAASF,aAAaG,KAAK;IAClC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC;AACjC;AAGW,SAASJ,aAAaE,KAAK;IAClC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC,YAAY;QACrC;QACA;QACA;KACH,CAACC,OAAO,CAACH,MAAMC,IAAI,IAAI,CAAC;AAC7B;AAIW,SAASF,qBAAqBC,KAAK;IAC1C,IAAIF,aAAaE,QAAQ;QACrB,OAAO;YACHI,SAASJ,MAAMI,OAAO;YACtBC,SAASL,MAAMK,OAAO;QAC1B;IACJ,OAAO,IAAIR,aAAaG,QAAQ;QAC5B,OAAO;YACHI,SAASJ,MAAMM,OAAO,CAAC,EAAE,CAACF,OAAO;YACjCC,SAASL,MAAMM,OAAO,CAAC,EAAE,CAACD,OAAO;QACrC;IACJ,OAAO;QACH,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACvC,MAAM,IAAIC,MAAM;QACpB;QACA,OAAO;YACHN,SAAS;YACTC,SAAS;QACb;IACJ;AACJ"}
|
@@ -2,17 +2,17 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./useAnimationFrame"), exports);
|
7
|
+
_export_star._(require("./useControllableState"), exports);
|
8
|
+
_export_star._(require("./useEventCallback"), exports);
|
9
|
+
_export_star._(require("./useFirstMount"), exports);
|
10
|
+
_export_star._(require("./useForceUpdate"), exports);
|
11
|
+
_export_star._(require("./useId"), exports);
|
12
|
+
_export_star._(require("./useIsomorphicLayoutEffect"), exports);
|
13
|
+
_export_star._(require("./useMergedRefs"), exports);
|
14
|
+
_export_star._(require("./useOnClickOutside"), exports);
|
15
|
+
_export_star._(require("./useOnScrollOutside"), exports);
|
16
|
+
_export_star._(require("./usePrevious"), exports);
|
17
|
+
_export_star._(require("./useScrollbarWidth"), exports);
|
18
|
+
_export_star._(require("./useTimeout"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './useAnimationFrame';\nexport * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useScrollbarWidth';\nexport * from './useTimeout';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './useAnimationFrame';\nexport * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useScrollbarWidth';\nexport * from './useTimeout';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
@@ -4,10 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useAnimationFrame", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useAnimationFrame;
|
9
|
+
}
|
8
10
|
});
|
11
|
+
const _canUseDOM = require("../ssr/canUseDOM");
|
9
12
|
const _useBrowserTimer = require("./useBrowserTimer");
|
13
|
+
const setAnimationFrameNoop = (callback)=>{
|
14
|
+
callback(0);
|
15
|
+
return 0;
|
16
|
+
};
|
17
|
+
const cancelAnimationFrameNoop = (handle)=>handle;
|
10
18
|
function useAnimationFrame() {
|
19
|
+
const isDOM = (0, _canUseDOM.canUseDOM)();
|
11
20
|
// TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context
|
12
|
-
|
21
|
+
const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;
|
22
|
+
const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;
|
23
|
+
return (0, _useBrowserTimer.useBrowserTimer)(setAnimationFrame, clearAnimationFrame);
|
13
24
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useAnimationFrame.js"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\n/**\n * @internal\n * Helper to manage a browser requestAnimationFrame.\n * Ensures that the requestAnimationFrame isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.\n */ export function useAnimationFrame() {\n // TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context\n return useBrowserTimer(
|
1
|
+
{"version":3,"sources":["useAnimationFrame.js"],"sourcesContent":["import { canUseDOM } from '../ssr/canUseDOM';\nimport { useBrowserTimer } from './useBrowserTimer';\nconst setAnimationFrameNoop = (callback)=>{\n callback(0);\n return 0;\n};\nconst cancelAnimationFrameNoop = (handle)=>handle;\n/**\n * @internal\n * Helper to manage a browser requestAnimationFrame.\n * Ensures that the requestAnimationFrame isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [requestAnimationFrame, cancelAnimationFrame] that are stable between renders.\n */ export function useAnimationFrame() {\n const isDOM = canUseDOM();\n // TODO: figure it out a way to not call global.requestAnimationFrame and instead infer window from some context\n const setAnimationFrame = isDOM ? requestAnimationFrame : setAnimationFrameNoop;\n const clearAnimationFrame = isDOM ? cancelAnimationFrame : cancelAnimationFrameNoop;\n return useBrowserTimer(setAnimationFrame, clearAnimationFrame);\n}\n"],"names":["useAnimationFrame","setAnimationFrameNoop","callback","cancelAnimationFrameNoop","handle","isDOM","canUseDOM","setAnimationFrame","requestAnimationFrame","clearAnimationFrame","cancelAnimationFrame","useBrowserTimer"],"mappings":";;;;+BAcoBA;;;eAAAA;;;2BAdM;iCACM;AAChC,MAAMC,wBAAwB,CAACC;IAC3BA,SAAS;IACT,OAAO;AACX;AACA,MAAMC,2BAA2B,CAACC,SAASA;AAQhC,SAASJ;IAChB,MAAMK,QAAQC,IAAAA,oBAAS;IACvB,gHAAgH;IAChH,MAAMC,oBAAoBF,QAAQG,wBAAwBP;IAC1D,MAAMQ,sBAAsBJ,QAAQK,uBAAuBP;IAC3D,OAAOQ,IAAAA,gCAAe,EAACJ,mBAAmBE;AAC9C"}
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useBrowserTimer", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useBrowserTimer;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
function useBrowserTimer(setTimer, cancelTimer) {
|
12
14
|
const id = _react.useRef(undefined);
|
13
15
|
const set = _react.useCallback((fn, delay)=>{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useBrowserTimer.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Helper to manage a browser timer.\n * Ensures that the timer isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @param setTimer - The timer setter function\n * @param cancelTimer - The timer cancel function\n * @returns A pair of [setTimer, cancelTimer] that are stable between renders.\n *\n * @example\n * const [setTimer, cancelTimer] = useBrowserTimer(setTimeout, cancelTimeout);\n *\n * setTimer(() => console.log('Hello world!'), 1000);\n * cancelTimer();\n */ export function useBrowserTimer(setTimer, cancelTimer) {\n const id = React.useRef(undefined);\n const set = React.useCallback((fn, delay)=>{\n if (id.current !== undefined) {\n cancelTimer(id.current);\n }\n id.current = setTimer(fn, delay);\n return id.current;\n }, [\n cancelTimer,\n setTimer\n ]);\n const cancel = React.useCallback(()=>{\n if (id.current !== undefined) {\n cancelTimer(id.current);\n id.current = undefined;\n }\n }, [\n cancelTimer\n ]);\n // Clean up the timeout when the component is unloaded\n React.useEffect(()=>cancel, [\n cancel\n ]);\n return [\n set,\n cancel\n ];\n}\n"],"names":["useBrowserTimer","setTimer","cancelTimer","id","React","useRef","undefined","set","useCallback","fn","delay","current","cancel","useEffect"],"mappings":";;;;+BAgBoBA
|
1
|
+
{"version":3,"sources":["useBrowserTimer.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Helper to manage a browser timer.\n * Ensures that the timer isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @param setTimer - The timer setter function\n * @param cancelTimer - The timer cancel function\n * @returns A pair of [setTimer, cancelTimer] that are stable between renders.\n *\n * @example\n * const [setTimer, cancelTimer] = useBrowserTimer(setTimeout, cancelTimeout);\n *\n * setTimer(() => console.log('Hello world!'), 1000);\n * cancelTimer();\n */ export function useBrowserTimer(setTimer, cancelTimer) {\n const id = React.useRef(undefined);\n const set = React.useCallback((fn, delay)=>{\n if (id.current !== undefined) {\n cancelTimer(id.current);\n }\n id.current = setTimer(fn, delay);\n return id.current;\n }, [\n cancelTimer,\n setTimer\n ]);\n const cancel = React.useCallback(()=>{\n if (id.current !== undefined) {\n cancelTimer(id.current);\n id.current = undefined;\n }\n }, [\n cancelTimer\n ]);\n // Clean up the timeout when the component is unloaded\n React.useEffect(()=>cancel, [\n cancel\n ]);\n return [\n set,\n cancel\n ];\n}\n"],"names":["useBrowserTimer","setTimer","cancelTimer","id","React","useRef","undefined","set","useCallback","fn","delay","current","cancel","useEffect"],"mappings":";;;;+BAgBoBA;;;eAAAA;;;;iEAhBG;AAgBZ,SAASA,gBAAgBC,QAAQ,EAAEC,WAAW;IACrD,MAAMC,KAAKC,OAAMC,MAAM,CAACC;IACxB,MAAMC,MAAMH,OAAMI,WAAW,CAAC,CAACC,IAAIC;QAC/B,IAAIP,GAAGQ,OAAO,KAAKL,WAAW;YAC1BJ,YAAYC,GAAGQ,OAAO;QAC1B;QACAR,GAAGQ,OAAO,GAAGV,SAASQ,IAAIC;QAC1B,OAAOP,GAAGQ,OAAO;IACrB,GAAG;QACCT;QACAD;KACH;IACD,MAAMW,SAASR,OAAMI,WAAW,CAAC;QAC7B,IAAIL,GAAGQ,OAAO,KAAKL,WAAW;YAC1BJ,YAAYC,GAAGQ,OAAO;YACtBR,GAAGQ,OAAO,GAAGL;QACjB;IACJ,GAAG;QACCJ;KACH;IACD,sDAAsD;IACtDE,OAAMS,SAAS,CAAC,IAAID,QAAQ;QACxBA;KACH;IACD,OAAO;QACHL;QACAK;KACH;AACL"}
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useControllableState", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useControllableState;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
function isFactoryDispatch(newState) {
|
12
14
|
return typeof newState === 'function';
|
13
15
|
}
|
@@ -57,14 +59,11 @@ function isInitializer(value) {
|
|
57
59
|
const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';
|
58
60
|
const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';
|
59
61
|
// eslint-disable-next-line no-console
|
60
|
-
console.error([
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
'More info: https://reactjs.org/link/controlled-components',
|
66
|
-
error.stack
|
67
|
-
].join(' '));
|
62
|
+
console.error(`@fluentui/react-utilities [${useControllableState.name}]:
|
63
|
+
A component is changing ${controlWarning}. This is likely caused by the value changing from ${undefinedWarning} value, which should not happen.
|
64
|
+
Decide between using a controlled or uncontrolled input element for the lifetime of the component.
|
65
|
+
More info: https://reactjs.org/link/controlled-components
|
66
|
+
${error.stack}`);
|
68
67
|
}
|
69
68
|
}, [
|
70
69
|
isControlled,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useControllableState.js"],"sourcesContent":["import * as React from 'react';\nfunction isFactoryDispatch(newState) {\n return typeof newState === 'function';\n}\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */ export const useControllableState = (options)=>{\n const [internalState, setInternalState] = React.useState(()=>{\n if (options.defaultState === undefined) {\n return options.initialState;\n }\n return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;\n });\n // Heads up!\n // This part is specific for controlled mode and mocks behavior of React dispatcher function.\n const stateValueRef = React.useRef(options.state);\n React.useEffect(()=>{\n stateValueRef.current = options.state;\n }, [\n options.state\n ]);\n const setControlledState = React.useCallback((newState)=>{\n if (isFactoryDispatch(newState)) {\n newState(stateValueRef.current);\n }\n }, []);\n return useIsControlled(options.state) ? [\n options.state,\n setControlledState\n ] : [\n internalState,\n setInternalState\n ];\n};\nfunction isInitializer(value) {\n return typeof value === 'function';\n}\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */ const useIsControlled = (controlledValue)=>{\n const [isControlled] = React.useState(()=>controlledValue !== undefined);\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(()=>{\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n // eslint-disable-next-line no-console\n console.error(
|
1
|
+
{"version":3,"sources":["useControllableState.js"],"sourcesContent":["import * as React from 'react';\nfunction isFactoryDispatch(newState) {\n return typeof newState === 'function';\n}\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */ export const useControllableState = (options)=>{\n const [internalState, setInternalState] = React.useState(()=>{\n if (options.defaultState === undefined) {\n return options.initialState;\n }\n return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;\n });\n // Heads up!\n // This part is specific for controlled mode and mocks behavior of React dispatcher function.\n const stateValueRef = React.useRef(options.state);\n React.useEffect(()=>{\n stateValueRef.current = options.state;\n }, [\n options.state\n ]);\n const setControlledState = React.useCallback((newState)=>{\n if (isFactoryDispatch(newState)) {\n newState(stateValueRef.current);\n }\n }, []);\n return useIsControlled(options.state) ? [\n options.state,\n setControlledState\n ] : [\n internalState,\n setInternalState\n ];\n};\nfunction isInitializer(value) {\n return typeof value === 'function';\n}\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */ const useIsControlled = (controlledValue)=>{\n const [isControlled] = React.useState(()=>controlledValue !== undefined);\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(()=>{\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n // eslint-disable-next-line no-console\n console.error(`@fluentui/react-utilities [${useControllableState.name}]:\nA component is changing ${controlWarning}. This is likely caused by the value changing from ${undefinedWarning} value, which should not happen.\nDecide between using a controlled or uncontrolled input element for the lifetime of the component.\nMore info: https://reactjs.org/link/controlled-components\n${error.stack}`);\n }\n }, [\n isControlled,\n controlledValue\n ]);\n }\n return isControlled;\n};\n"],"names":["useControllableState","isFactoryDispatch","newState","options","internalState","setInternalState","React","useState","defaultState","undefined","initialState","isInitializer","stateValueRef","useRef","state","useEffect","current","setControlledState","useCallback","useIsControlled","value","controlledValue","isControlled","process","env","NODE_ENV","error","Error","controlWarning","undefinedWarning","console","name","stack"],"mappings":";;;;+BAoBiBA;;;eAAAA;;;;iEApBM;AACvB,SAASC,kBAAkBC,QAAQ;IAC/B,OAAO,OAAOA,aAAa;AAC/B;AAiBW,MAAMF,uBAAuB,CAACG;IACrC,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,OAAMC,QAAQ,CAAC;QACrD,IAAIJ,QAAQK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-4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useEventCallback", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useEventCallback;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const _useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect");
|
12
14
|
const useEventCallback = (fn)=>{
|
13
15
|
const callbackRef = _react.useRef(()=>{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useEventCallback.js"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n/**\n * @internal\n * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n *\n * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when\n * e.g. user props are dependencies which could change on every render\n * e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently\n *\n * This should not be used often, but can be a useful re-render optimization since the callback is a ref and\n * will not be invalidated between re-renders\n *\n * @param fn - The callback function that will be used\n */ export const useEventCallback = (fn)=>{\n const callbackRef = React.useRef(()=>{\n throw new Error('Cannot call an event handler while rendering');\n });\n useIsomorphicLayoutEffect(()=>{\n callbackRef.current = fn;\n }, [\n fn\n ]);\n return React.useCallback((...args)=>{\n const callback = callbackRef.current;\n return callback(...args);\n }, [\n callbackRef\n ]);\n};\n"],"names":["useEventCallback","fn","callbackRef","React","useRef","Error","useIsomorphicLayoutEffect","current","useCallback","args","callback"],"mappings":";;;;+BAciBA
|
1
|
+
{"version":3,"sources":["useEventCallback.js"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n/**\n * @internal\n * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n *\n * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when\n * e.g. user props are dependencies which could change on every render\n * e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently\n *\n * This should not be used often, but can be a useful re-render optimization since the callback is a ref and\n * will not be invalidated between re-renders\n *\n * @param fn - The callback function that will be used\n */ export const useEventCallback = (fn)=>{\n const callbackRef = React.useRef(()=>{\n throw new Error('Cannot call an event handler while rendering');\n });\n useIsomorphicLayoutEffect(()=>{\n callbackRef.current = fn;\n }, [\n fn\n ]);\n return React.useCallback((...args)=>{\n const callback = callbackRef.current;\n return callback(...args);\n }, [\n callbackRef\n ]);\n};\n"],"names":["useEventCallback","fn","callbackRef","React","useRef","Error","useIsomorphicLayoutEffect","current","useCallback","args","callback"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;2CACmB;AAa/B,MAAMA,mBAAmB,CAACC;IACjC,MAAMC,cAAcC,OAAMC,MAAM,CAAC;QAC7B,MAAM,IAAIC,MAAM;IACpB;IACAC,IAAAA,oDAAyB,EAAC;QACtBJ,YAAYK,OAAO,GAAGN;IAC1B,GAAG;QACCA;KACH;IACD,OAAOE,OAAMK,WAAW,CAAC,CAAC,GAAGC;QACzB,MAAMC,WAAWR,YAAYK,OAAO;QACpC,OAAOG,YAAYD;IACvB,GAAG;QACCP;KACH;AACL"}
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useFirstMount", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useFirstMount;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
function useFirstMount() {
|
12
14
|
const isFirst = _react.useRef(true);
|
13
15
|
if (isFirst.current) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useFirstMount.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Since concurrent mode will be released in the future this needs to be verified\n * Currently (React 17) will always render the initial mount once\n * https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx\n * https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx\n *\n * @example\n * const isFirstMount = useFirstMount();\n */ export function useFirstMount() {\n const isFirst = React.useRef(true);\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n return isFirst.current;\n}\n"],"names":["useFirstMount","isFirst","React","useRef","current"],"mappings":";;;;+BAWoBA
|
1
|
+
{"version":3,"sources":["useFirstMount.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Since concurrent mode will be released in the future this needs to be verified\n * Currently (React 17) will always render the initial mount once\n * https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx\n * https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx\n *\n * @example\n * const isFirstMount = useFirstMount();\n */ export function useFirstMount() {\n const isFirst = React.useRef(true);\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n return isFirst.current;\n}\n"],"names":["useFirstMount","isFirst","React","useRef","current"],"mappings":";;;;+BAWoBA;;;eAAAA;;;;iEAXG;AAWZ,SAASA;IAChB,MAAMC,UAAUC,OAAMC,MAAM,CAAC;IAC7B,IAAIF,QAAQG,OAAO,EAAE;QACjBH,QAAQG,OAAO,GAAG;QAClB,OAAO;IACX;IACA,OAAOH,QAAQG,OAAO;AAC1B"}
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useForceUpdate", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useForceUpdate;
|
9
|
+
}
|
8
10
|
});
|
9
11
|
const _react = require("react");
|
10
12
|
function useForceUpdate() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useForceUpdate.js"],"sourcesContent":["import { useReducer } from 'react';\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */ export function useForceUpdate() {\n return useReducer((x)=>x + 1, 0)[1];\n}\n"],"names":["useForceUpdate","useReducer","x"],"mappings":";;;;+BAIoBA
|
1
|
+
{"version":3,"sources":["useForceUpdate.js"],"sourcesContent":["import { useReducer } from 'react';\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */ export function useForceUpdate() {\n return useReducer((x)=>x + 1, 0)[1];\n}\n"],"names":["useForceUpdate","useReducer","x"],"mappings":";;;;+BAIoBA;;;eAAAA;;;uBAJO;AAIhB,SAASA;IAChB,OAAOC,IAAAA,iBAAU,EAAC,CAACC,IAAIA,IAAI,GAAG,EAAE,CAAC,EAAE;AACvC"}
|
@@ -9,12 +9,18 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
IdPrefixProvider: ()
|
13
|
-
|
14
|
-
|
12
|
+
IdPrefixProvider: function() {
|
13
|
+
return IdPrefixProvider;
|
14
|
+
},
|
15
|
+
resetIdsForTests: function() {
|
16
|
+
return resetIdsForTests;
|
17
|
+
},
|
18
|
+
useId: function() {
|
19
|
+
return useId;
|
20
|
+
}
|
15
21
|
});
|
16
|
-
const
|
17
|
-
const _react = /*#__PURE__*/
|
22
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
23
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
18
24
|
const _index = require("../ssr/index");
|
19
25
|
const IdPrefixContext = /*#__PURE__*/ _react.createContext(undefined);
|
20
26
|
const IdPrefixProvider = IdPrefixContext.Provider;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useId.js"],"sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\nconst IdPrefixContext = React.createContext(undefined);\n/**\n * Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions\n * between different bundles.\n */ export const IdPrefixProvider = IdPrefixContext.Provider;\nfunction useIdPrefix() {\n return React.useContext(IdPrefixContext) || '';\n}\n/**\n * Resets generated IDs, should be used only in tests.\n */ export function resetIdsForTests() {\n defaultSSRContextValue.current = 0;\n}\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */ export function useId(prefix = 'fui-', providedId) {\n const contextValue = useSSRContext();\n const idPrefix = useIdPrefix();\n // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to\n // prevent bundlers from complaining with older versions of React.\n const _useId = React['use' + 'Id'];\n if (_useId) {\n const generatedId = _useId();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const escapedId = React.useMemo(()=>generatedId.replace(/:/g, ''), [\n generatedId\n ]);\n return providedId || `${idPrefix}${prefix}${escapedId}`;\n }\n // Hooks appear to be running conditionally, but they will always run in the same order since it's based on\n // the version of React being used. This is safe to ignore.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return React.useMemo(()=>{\n if (providedId) {\n return providedId;\n }\n return `${idPrefix}${prefix}${++contextValue.current}`;\n }, [\n idPrefix,\n prefix,\n providedId,\n contextValue\n ]);\n}\n"],"names":["IdPrefixProvider","resetIdsForTests","useId","IdPrefixContext","React","createContext","undefined","Provider","useIdPrefix","useContext","defaultSSRContextValue","current","prefix","providedId","contextValue","useSSRContext","idPrefix","_useId","generatedId","escapedId","useMemo","replace"],"mappings":";;;;;;;;;;;IAMiBA,gBAAgB
|
1
|
+
{"version":3,"sources":["useId.js"],"sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\nconst IdPrefixContext = React.createContext(undefined);\n/**\n * Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions\n * between different bundles.\n */ export const IdPrefixProvider = IdPrefixContext.Provider;\nfunction useIdPrefix() {\n return React.useContext(IdPrefixContext) || '';\n}\n/**\n * Resets generated IDs, should be used only in tests.\n */ export function resetIdsForTests() {\n defaultSSRContextValue.current = 0;\n}\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */ export function useId(prefix = 'fui-', providedId) {\n const contextValue = useSSRContext();\n const idPrefix = useIdPrefix();\n // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to\n // prevent bundlers from complaining with older versions of React.\n const _useId = React['use' + 'Id'];\n if (_useId) {\n const generatedId = _useId();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const escapedId = React.useMemo(()=>generatedId.replace(/:/g, ''), [\n generatedId\n ]);\n return providedId || `${idPrefix}${prefix}${escapedId}`;\n }\n // Hooks appear to be running conditionally, but they will always run in the same order since it's based on\n // the version of React being used. This is safe to ignore.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return React.useMemo(()=>{\n if (providedId) {\n return providedId;\n }\n return `${idPrefix}${prefix}${++contextValue.current}`;\n }, [\n idPrefix,\n prefix,\n providedId,\n contextValue\n ]);\n}\n"],"names":["IdPrefixProvider","resetIdsForTests","useId","IdPrefixContext","React","createContext","undefined","Provider","useIdPrefix","useContext","defaultSSRContextValue","current","prefix","providedId","contextValue","useSSRContext","idPrefix","_useId","generatedId","escapedId","useMemo","replace"],"mappings":";;;;;;;;;;;IAMiBA,gBAAgB;eAAhBA;;IAMGC,gBAAgB;eAAhBA;;IAUAC,KAAK;eAALA;;;;iEAtBG;uBAC+B;AACtD,MAAMC,gCAAkBC,OAAMC,aAAa,CAACC;AAIjC,MAAMN,mBAAmBG,gBAAgBI,QAAQ;AAC5D,SAASC;IACL,OAAOJ,OAAMK,UAAU,CAACN,oBAAoB;AAChD;AAGW,SAASF;IAChBS,6BAAsB,CAACC,OAAO,GAAG;AACrC;AAQW,SAAST,MAAMU,SAAS,MAAM,EAAEC,UAAU;IACjD,MAAMC,eAAeC,IAAAA,oBAAa;IAClC,MAAMC,WAAWR;IACjB,mHAAmH;IACnH,kEAAkE;IAClE,MAAMS,SAASb,MAAK,CAAC,QAAQ,KAAK;IAClC,IAAIa,QAAQ;QACR,MAAMC,cAAcD;QACpB,sDAAsD;QACtD,MAAME,YAAYf,OAAMgB,OAAO,CAAC,IAAIF,YAAYG,OAAO,CAAC,MAAM,KAAK;YAC/DH;SACH;QACD,OAAOL,cAAc,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAEO,UAAU,CAAC;IAC3D;IACA,2GAA2G;IAC3G,2DAA2D;IAC3D,sDAAsD;IACtD,OAAOf,OAAMgB,OAAO,CAAC;QACjB,IAAIP,YAAY;YACZ,OAAOA;QACX;QACA,OAAO,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAE,EAAEE,aAAaH,OAAO,CAAC,CAAC;IAC1D,GAAG;QACCK;QACAJ;QACAC;QACAC;KACH;AACL"}
|
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useIsomorphicLayoutEffect;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const _index = require("../ssr/index");
|
12
14
|
const useIsomorphicLayoutEffect = (0, _index.canUseDOM)() ? _react.useLayoutEffect : _react.useEffect;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useIsomorphicLayoutEffect.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n/**\n * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally\n * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also need affected components to render on\n * the server.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n */ // eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n"],"names":["useIsomorphicLayoutEffect","canUseDOM","React","useLayoutEffect","useEffect"],"mappings":";;;;+BAWaA
|
1
|
+
{"version":3,"sources":["useIsomorphicLayoutEffect.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n/**\n * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally\n * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also need affected components to render on\n * the server.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n */ // eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n"],"names":["useIsomorphicLayoutEffect","canUseDOM","React","useLayoutEffect","useEffect"],"mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;uBACG;AAUnB,MAAMA,4BAA4BC,IAAAA,gBAAS,MAAKC,OAAMC,eAAe,GAAGD,OAAME,SAAS"}
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useMergedRefs", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useMergedRefs;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
function useMergedRefs(...refs) {
|
12
14
|
const mergedCallback = _react.useCallback((value)=>{
|
13
15
|
// Update the "current" prop hanging on the function.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useMergedRefs.js"],"sourcesContent":["import * as React from 'react';\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */ export function useMergedRefs(...refs) {\n const mergedCallback = React.useCallback((value)=>{\n // Update the \"current\" prop hanging on the function.\n mergedCallback.current = value;\n for (const ref of refs){\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n ref.current = value;\n }\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [\n ...refs\n ]);\n return mergedCallback;\n}\n"],"names":["useMergedRefs","refs","mergedCallback","React","useCallback","value","current","ref"],"mappings":";;;;+BAMoBA
|
1
|
+
{"version":3,"sources":["useMergedRefs.js"],"sourcesContent":["import * as React from 'react';\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */ export function useMergedRefs(...refs) {\n const mergedCallback = React.useCallback((value)=>{\n // Update the \"current\" prop hanging on the function.\n mergedCallback.current = value;\n for (const ref of refs){\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n ref.current = value;\n }\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [\n ...refs\n ]);\n return mergedCallback;\n}\n"],"names":["useMergedRefs","refs","mergedCallback","React","useCallback","value","current","ref"],"mappings":";;;;+BAMoBA;;;eAAAA;;;;iEANG;AAMZ,SAASA,cAAc,GAAGC,IAAI;IACrC,MAAMC,iBAAiBC,OAAMC,WAAW,CAAC,CAACC;QACtC,qDAAqD;QACrDH,eAAeI,OAAO,GAAGD;QACzB,KAAK,MAAME,OAAON,KAAK;YACnB,IAAI,OAAOM,QAAQ,YAAY;gBAC3BA,IAAIF;YACR,OAAO,IAAIE,KAAK;gBACZ,qDAAqD;gBACrDA,IAAID,OAAO,GAAGD;YAClB;QACJ;IACJ,GACA;WACOJ;KACN;IACD,OAAOC;AACX"}
|
@@ -4,16 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useOnClickOutside", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useOnClickOutside;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const _useEventCallback = require("./useEventCallback");
|
12
14
|
const DEFAULT_CONTAINS = (parent, child)=>{
|
13
|
-
|
15
|
+
var _parent;
|
16
|
+
return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));
|
14
17
|
};
|
15
18
|
const useOnClickOutside = (options)=>{
|
16
|
-
const { refs
|
19
|
+
const { refs, callback, element, disabled, disabledFocusOnIframe, contains = DEFAULT_CONTAINS } = options;
|
17
20
|
const timeoutId = _react.useRef(undefined);
|
18
21
|
useIFrameFocus({
|
19
22
|
element,
|
@@ -41,6 +44,7 @@ const useOnClickOutside = (options)=>{
|
|
41
44
|
isMouseDownInsideRef.current = refs.some((ref)=>contains(ref.current || null, ev.target));
|
42
45
|
});
|
43
46
|
_react.useEffect(()=>{
|
47
|
+
var _element, _element1, _element2;
|
44
48
|
if (disabled) {
|
45
49
|
return;
|
46
50
|
}
|
@@ -56,18 +60,18 @@ const useOnClickOutside = (options)=>{
|
|
56
60
|
}
|
57
61
|
listener(event);
|
58
62
|
};
|
59
|
-
|
60
|
-
element === null ||
|
61
|
-
element === null ||
|
62
|
-
element === null || element === void 0 ? void 0 : element.addEventListener('mousedown', handleMouseDown, true);
|
63
|
+
(_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('touchstart', conditionalHandler, true);
|
64
|
+
(_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('mouseup', conditionalHandler, true);
|
65
|
+
(_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('mousedown', handleMouseDown, true);
|
63
66
|
// Garbage collect this event after it's no longer useful to avoid memory leaks
|
64
67
|
timeoutId.current = window.setTimeout(()=>{
|
65
68
|
currentEvent = undefined;
|
66
69
|
}, 1);
|
67
70
|
return ()=>{
|
68
|
-
|
69
|
-
element === null ||
|
70
|
-
element === null ||
|
71
|
+
var _element, _element1, _element2;
|
72
|
+
(_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('touchstart', conditionalHandler, true);
|
73
|
+
(_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('mouseup', conditionalHandler, true);
|
74
|
+
(_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('mousedown', handleMouseDown, true);
|
71
75
|
clearTimeout(timeoutId.current);
|
72
76
|
currentEvent = undefined;
|
73
77
|
};
|
@@ -80,7 +84,7 @@ const useOnClickOutside = (options)=>{
|
|
80
84
|
};
|
81
85
|
const getWindowEvent = (target)=>{
|
82
86
|
if (target) {
|
83
|
-
var
|
87
|
+
var _target_ownerDocument_defaultView, _target_ownerDocument;
|
84
88
|
if (typeof target.window === 'object' && target.window === target) {
|
85
89
|
// eslint-disable-next-line deprecation/deprecation
|
86
90
|
return target.event;
|
@@ -102,7 +106,7 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
|
|
102
106
|
* Polls the value of `document.activeElement`. If it is an iframe, then dispatch
|
103
107
|
* a custom DOM event. When the custom event is received call the provided callback
|
104
108
|
*/ const useIFrameFocus = (options)=>{
|
105
|
-
const { disabled
|
109
|
+
const { disabled, element: targetDocument, callback, contains = DEFAULT_CONTAINS, pollDuration = 1000, refs } = options;
|
106
110
|
const timeoutRef = _react.useRef();
|
107
111
|
const listener = (0, _useEventCallback.useEventCallback)((e)=>{
|
108
112
|
const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));
|
@@ -112,12 +116,14 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
|
|
112
116
|
});
|
113
117
|
// Adds listener to the custom iframe focus event
|
114
118
|
_react.useEffect(()=>{
|
119
|
+
var _targetDocument;
|
115
120
|
if (disabled) {
|
116
121
|
return;
|
117
122
|
}
|
118
|
-
targetDocument === null ||
|
123
|
+
(_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
|
119
124
|
return ()=>{
|
120
|
-
|
125
|
+
var _targetDocument;
|
126
|
+
(_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
|
121
127
|
};
|
122
128
|
}, [
|
123
129
|
targetDocument,
|
@@ -126,13 +132,14 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
|
|
126
132
|
]);
|
127
133
|
// Starts polling for the active element
|
128
134
|
_react.useEffect(()=>{
|
129
|
-
var _targetDocument_defaultView;
|
135
|
+
var _targetDocument_defaultView, _targetDocument;
|
130
136
|
if (disabled) {
|
131
137
|
return;
|
132
138
|
}
|
133
|
-
timeoutRef.current = targetDocument === null ||
|
134
|
-
|
135
|
-
|
139
|
+
timeoutRef.current = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{
|
140
|
+
var _targetDocument, _activeElement, _activeElement1;
|
141
|
+
const activeElement = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.activeElement;
|
142
|
+
if (((_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.tagName) === 'IFRAME' || ((_activeElement1 = activeElement) === null || _activeElement1 === void 0 ? void 0 : _activeElement1.tagName) === 'WEBVIEW') {
|
136
143
|
const event = new CustomEvent(FUI_FRAME_EVENT, {
|
137
144
|
bubbles: true
|
138
145
|
});
|
@@ -140,8 +147,8 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
|
|
140
147
|
}
|
141
148
|
}, pollDuration);
|
142
149
|
return ()=>{
|
143
|
-
var _targetDocument_defaultView;
|
144
|
-
targetDocument === null ||
|
150
|
+
var _targetDocument_defaultView, _targetDocument;
|
151
|
+
(_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);
|
145
152
|
};
|
146
153
|
}, [
|
147
154
|
targetDocument,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nconst DEFAULT_CONTAINS = (parent, child)=>{\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n};\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnClickOutside = (options)=>{\n const { refs , callback , element , disabled , disabledFocusOnIframe , contains =DEFAULT_CONTAINS } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus({\n element,\n disabled: disabledFocusOnIframe || disabled,\n callback,\n refs,\n contains\n });\n const isMouseDownInsideRef = React.useRef(false);\n const listener = useEventCallback((ev)=>{\n if (isMouseDownInsideRef.current) {\n isMouseDownInsideRef.current = false;\n return;\n }\n const target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n const handleMouseDown = useEventCallback((ev)=>{\n // Selecting text from inside to outside will rigger click event.\n // In this case click event target is outside but mouse down event target is inside.\n // And this click event should be considered as inside click.\n isMouseDownInsideRef.current = refs.some((ref)=>contains(ref.current || null, ev.target));\n });\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n const conditionalHandler = (event)=>{\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n listener(event);\n };\n // use capture phase because React can update DOM before the event bubbles to the document\n element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('mouseup', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('mousedown', handleMouseDown, true);\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(()=>{\n currentEvent = undefined;\n }, 1);\n return ()=>{\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('mouseup', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('mousedown', handleMouseDown, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [\n listener,\n element,\n disabled,\n handleMouseDown\n ]);\n};\nconst getWindowEvent = (target)=>{\n if (target) {\n var _target_ownerDocument, _target_ownerDocument_defaultView;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */ const useIFrameFocus = (options)=>{\n const { disabled , element: targetDocument , callback , contains =DEFAULT_CONTAINS , pollDuration =1000 , refs } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback((e)=>{\n const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return ()=>{\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [\n targetDocument,\n disabled,\n listener\n ]);\n // Starts polling for the active element\n React.useEffect(()=>{\n var _targetDocument_defaultView;\n if (disabled) {\n return;\n }\n timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n return ()=>{\n var _targetDocument_defaultView;\n targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [\n targetDocument,\n disabled,\n pollDuration\n ]);\n};\n"],"names":["useOnClickOutside","DEFAULT_CONTAINS","parent","child","contains","options","refs","callback","element","disabled","disabledFocusOnIframe","timeoutId","React","useRef","undefined","useIFrameFocus","isMouseDownInsideRef","listener","useEventCallback","ev","current","target","composedPath","isOutside","every","ref","handleMouseDown","some","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument","_target_ownerDocument_defaultView","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BAQiBA;;aAAAA;;;6DARM;kCACU;AACjC,MAAMC,mBAAmB,CAACC,QAAQC,QAAQ;IACtC,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOE,QAAQ,CAACD,MAAM,AAAD;AACnF;AAIW,MAAMH,oBAAoB,CAACK,UAAU;IAC5C,MAAM,EAAEC,KAAI,EAAGC,SAAQ,EAAGC,QAAO,EAAGC,SAAQ,EAAGC,sBAAqB,EAAGN,UAAUH,iBAAgB,EAAG,GAAGI;IACvG,MAAMM,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAe;QACXP;QACAC,UAAUC,yBAAyBD;QACnCF;QACAD;QACAF;IACJ;IACA,MAAMY,u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D,MAAO,YAAY,AAACD,CAAAA,kBAAkB,IAAI,IAAIA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcC,OAAO,AAAD,MAAO,WAAW;gBAC3M,MAAMlB,QAAQ,IAAImB,YAAYT,iBAAiB;oBAC3CU,SAAS,IAAI;gBACjB;gBACAH,cAAcI,aAAa,CAACrB;YAChC,CAAC;QACL,GAAGY,aAAa;QAChB,OAAO,IAAI;YACP,IAAIG;YACJJ,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAI,AAACI,CAAAA,8BAA8BJ,eAAeF,WAAW,AAAD,MAAO,IAAI,IAAIM,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BX,YAAY,CAACS,WAAW1B,OAAO,CAAC;QACzP;IACJ,GAAG;QACCwB;QACAnC;QACAoC;KACH;AACL"}
|
1
|
+
{"version":3,"sources":["useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nconst DEFAULT_CONTAINS = (parent, child)=>{\n var _parent;\n return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));\n};\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnClickOutside = (options)=>{\n const { refs, callback, element, disabled, disabledFocusOnIframe, contains = DEFAULT_CONTAINS } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus({\n element,\n disabled: disabledFocusOnIframe || disabled,\n callback,\n refs,\n contains\n });\n const isMouseDownInsideRef = React.useRef(false);\n const listener = useEventCallback((ev)=>{\n if (isMouseDownInsideRef.current) {\n isMouseDownInsideRef.current = false;\n return;\n }\n const target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n const handleMouseDown = useEventCallback((ev)=>{\n // Selecting text from inside to outside will rigger click event.\n // In this case click event target is outside but mouse down event target is inside.\n // And this click event should be considered as inside click.\n isMouseDownInsideRef.current = refs.some((ref)=>contains(ref.current || null, ev.target));\n });\n React.useEffect(()=>{\n var // use capture phase because React can update DOM before the event bubbles to the document\n _element, _element1, _element2;\n if (disabled) {\n return;\n }\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n const conditionalHandler = (event)=>{\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n listener(event);\n };\n (_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('touchstart', conditionalHandler, true);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('mouseup', conditionalHandler, true);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('mousedown', handleMouseDown, true);\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(()=>{\n currentEvent = undefined;\n }, 1);\n return ()=>{\n var _element, _element1, _element2;\n (_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('touchstart', conditionalHandler, true);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('mouseup', conditionalHandler, true);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('mousedown', handleMouseDown, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [\n listener,\n element,\n disabled,\n handleMouseDown\n ]);\n};\nconst getWindowEvent = (target)=>{\n if (target) {\n var _target_ownerDocument_defaultView, _target_ownerDocument;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */ const useIFrameFocus = (options)=>{\n const { disabled, element: targetDocument, callback, contains = DEFAULT_CONTAINS, pollDuration = 1000, refs } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback((e)=>{\n const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(()=>{\n var _targetDocument;\n if (disabled) {\n return;\n }\n (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return ()=>{\n var _targetDocument;\n (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [\n targetDocument,\n disabled,\n listener\n ]);\n // Starts polling for the active element\n React.useEffect(()=>{\n var _targetDocument_defaultView, _targetDocument;\n if (disabled) {\n return;\n }\n timeoutRef.current = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{\n var _targetDocument, _activeElement, _activeElement1;\n const activeElement = (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.activeElement;\n if (((_activeElement = activeElement) === null || _activeElement === void 0 ? void 0 : _activeElement.tagName) === 'IFRAME' || ((_activeElement1 = activeElement) === null || _activeElement1 === void 0 ? void 0 : _activeElement1.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n return ()=>{\n var _targetDocument_defaultView, _targetDocument;\n (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = _targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [\n targetDocument,\n disabled,\n pollDuration\n ]);\n};\n"],"names":["useOnClickOutside","DEFAULT_CONTAINS","parent","child","_parent","contains","options","refs","callback","element","disabled","disabledFocusOnIframe","timeoutId","React","useRef","undefined","useIFrameFocus","isMouseDownInsideRef","listener","useEventCallback","ev","current","target","composedPath","isOutside","every","ref","handleMouseDown","some","useEffect","_element","_element1","_element2","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument_defaultView","_target_ownerDocument","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument","_targetDocument_defaultView","setInterval","_activeElement","_activeElement1","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BASiBA;;;eAAAA;;;;iEATM;kCACU;AACjC,MAAMC,mBAAmB,CAACC,QAAQC;IAC9B,IAAIC;IACJ,OAAO,CAAC,CAAE,CAAA,AAACA,CAAAA,UAAUF,MAAK,MAAO,QAAQE,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQC,QAAQ,CAACF,MAAK;AACjG;AAIW,MAAMH,oBAAoB,CAACM;IAClC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,qBAAqB,EAAEN,WAAWJ,gBAAgB,EAAE,GAAGK;IAClG,MAAMM,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAe;QACXP;QACAC,UAAUC,yBAAyBD;QACnCF;QACAD;Q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