@fluentui/react-utilities 0.0.0-nightly-20230316-0427.1 → 0.0.0-nightly-20230317-1454.1

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.
Files changed (161) hide show
  1. package/.swcrc +39 -0
  2. package/CHANGELOG.json +20 -5
  3. package/CHANGELOG.md +14 -5
  4. package/dist/index.d.ts +16 -4
  5. package/lib/compose/getSlots.js +6 -7
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.js +4 -4
  8. package/lib/compose/index.js.map +1 -1
  9. package/lib/compose/isResolvedShorthand.js +2 -2
  10. package/lib/compose/isResolvedShorthand.js.map +1 -1
  11. package/lib/compose/resolveShorthand.js +3 -3
  12. package/lib/compose/resolveShorthand.js.map +1 -1
  13. package/lib/compose/types.js +1 -1
  14. package/lib/compose/types.js.map +1 -1
  15. package/lib/events/index.js +1 -1
  16. package/lib/events/index.js.map +1 -1
  17. package/lib/events/mouseTouchHelpers.js +5 -4
  18. package/lib/events/mouseTouchHelpers.js.map +1 -1
  19. package/lib/hooks/index.js +12 -12
  20. package/lib/hooks/index.js.map +1 -1
  21. package/lib/hooks/useControllableState.js +7 -7
  22. package/lib/hooks/useControllableState.js.map +1 -1
  23. package/lib/hooks/useEventCallback.js +3 -3
  24. package/lib/hooks/useEventCallback.js.map +1 -1
  25. package/lib/hooks/useFirstMount.js +1 -1
  26. package/lib/hooks/useFirstMount.js.map +1 -1
  27. package/lib/hooks/useForceUpdate.js +1 -1
  28. package/lib/hooks/useForceUpdate.js.map +1 -1
  29. package/lib/hooks/useId.js +6 -6
  30. package/lib/hooks/useId.js.map +1 -1
  31. package/lib/hooks/useIsomorphicLayoutEffect.js +3 -4
  32. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  33. package/lib/hooks/useMergedRefs.js +2 -2
  34. package/lib/hooks/useMergedRefs.js.map +1 -1
  35. package/lib/hooks/useOnClickOutside.js +20 -23
  36. package/lib/hooks/useOnClickOutside.js.map +1 -1
  37. package/lib/hooks/useOnScrollOutside.js +7 -7
  38. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  39. package/lib/hooks/usePrevious.js +1 -1
  40. package/lib/hooks/usePrevious.js.map +1 -1
  41. package/lib/hooks/useScrollbarWidth.js +5 -5
  42. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  43. package/lib/hooks/useTimeout.js +1 -1
  44. package/lib/hooks/useTimeout.js.map +1 -1
  45. package/lib/index.js +6 -6
  46. package/lib/index.js.map +1 -1
  47. package/lib/ssr/SSRContext.js +5 -6
  48. package/lib/ssr/SSRContext.js.map +1 -1
  49. package/lib/ssr/canUseDOM.js +2 -3
  50. package/lib/ssr/canUseDOM.js.map +1 -1
  51. package/lib/ssr/index.js +2 -2
  52. package/lib/ssr/index.js.map +1 -1
  53. package/lib/trigger/applyTriggerPropsToChildren.js +4 -4
  54. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  55. package/lib/trigger/getTriggerChild.js +2 -2
  56. package/lib/trigger/getTriggerChild.js.map +1 -1
  57. package/lib/trigger/index.js +4 -4
  58. package/lib/trigger/index.js.map +1 -1
  59. package/lib/trigger/isFluentTrigger.js +1 -0
  60. package/lib/trigger/isFluentTrigger.js.map +1 -1
  61. package/lib/trigger/types.js +1 -1
  62. package/lib/trigger/types.js.map +1 -1
  63. package/lib/utils/clamp.js +1 -2
  64. package/lib/utils/clamp.js.map +1 -1
  65. package/lib/utils/getNativeElementProps.js +4 -4
  66. package/lib/utils/getNativeElementProps.js.map +1 -1
  67. package/lib/utils/getRTLSafeKey.js +6 -7
  68. package/lib/utils/getRTLSafeKey.js.map +1 -1
  69. package/lib/utils/getReactCallbackName.js +3 -2
  70. package/lib/utils/getReactCallbackName.js.map +1 -1
  71. package/lib/utils/index.js +8 -8
  72. package/lib/utils/index.js.map +1 -1
  73. package/lib/utils/isHTMLElement.js +10 -7
  74. package/lib/utils/isHTMLElement.js.map +1 -1
  75. package/lib/utils/isInteractiveHTMLElement.js +5 -5
  76. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  77. package/lib/utils/mergeCallbacks.js +3 -4
  78. package/lib/utils/mergeCallbacks.js.map +1 -1
  79. package/lib/utils/omit.js +1 -2
  80. package/lib/utils/omit.js.map +1 -1
  81. package/lib/utils/properties.js +28 -55
  82. package/lib/utils/properties.js.map +1 -1
  83. package/lib-commonjs/compose/getSlots.js +47 -55
  84. package/lib-commonjs/compose/getSlots.js.map +1 -1
  85. package/lib-commonjs/compose/index.js +8 -7
  86. package/lib-commonjs/compose/index.js.map +1 -1
  87. package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
  88. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  89. package/lib-commonjs/compose/resolveShorthand.js +25 -32
  90. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  91. package/lib-commonjs/compose/types.js +5 -2
  92. package/lib-commonjs/compose/types.js.map +1 -1
  93. package/lib-commonjs/events/index.js +5 -4
  94. package/lib-commonjs/events/index.js.map +1 -1
  95. package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
  96. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  97. package/lib-commonjs/hooks/index.js +16 -15
  98. package/lib-commonjs/hooks/index.js.map +1 -1
  99. package/lib-commonjs/hooks/useControllableState.js +63 -64
  100. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  101. package/lib-commonjs/hooks/useEventCallback.js +25 -31
  102. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  103. package/lib-commonjs/hooks/useFirstMount.js +15 -23
  104. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  105. package/lib-commonjs/hooks/useForceUpdate.js +9 -11
  106. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  107. package/lib-commonjs/hooks/useId.js +48 -47
  108. package/lib-commonjs/hooks/useId.js.map +1 -1
  109. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
  110. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  111. package/lib-commonjs/hooks/useMergedRefs.js +25 -27
  112. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  113. package/lib-commonjs/hooks/useOnClickOutside.js +109 -115
  114. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  115. package/lib-commonjs/hooks/useOnScrollOutside.js +33 -36
  116. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  117. package/lib-commonjs/hooks/usePrevious.js +17 -15
  118. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  119. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  120. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  121. package/lib-commonjs/hooks/useTimeout.js +30 -30
  122. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  123. package/lib-commonjs/index.js +52 -214
  124. package/lib-commonjs/index.js.map +1 -1
  125. package/lib-commonjs/ssr/SSRContext.js +56 -59
  126. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  127. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  128. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  129. package/lib-commonjs/ssr/index.js +6 -5
  130. package/lib-commonjs/ssr/index.js.map +1 -1
  131. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
  132. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  133. package/lib-commonjs/trigger/getTriggerChild.js +16 -36
  134. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  135. package/lib-commonjs/trigger/index.js +8 -7
  136. package/lib-commonjs/trigger/index.js.map +1 -1
  137. package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
  138. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  139. package/lib-commonjs/trigger/types.js +5 -2
  140. package/lib-commonjs/trigger/types.js.map +1 -1
  141. package/lib-commonjs/utils/clamp.js +10 -9
  142. package/lib-commonjs/utils/clamp.js.map +1 -1
  143. package/lib-commonjs/utils/getNativeElementProps.js +54 -61
  144. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  145. package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
  146. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  147. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  148. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  149. package/lib-commonjs/utils/index.js +12 -11
  150. package/lib-commonjs/utils/index.js.map +1 -1
  151. package/lib-commonjs/utils/isHTMLElement.js +20 -15
  152. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  153. package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
  154. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  155. package/lib-commonjs/utils/mergeCallbacks.js +14 -13
  156. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  157. package/lib-commonjs/utils/omit.js +18 -17
  158. package/lib-commonjs/utils/omit.js.map +1 -1
  159. package/lib-commonjs/utils/properties.js +327 -223
  160. package/lib-commonjs/utils/properties.js.map +1 -1
  161. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","useFirstMount","isFirst","useRef","current","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useFirstMount.ts"],"sourcesContent":["import * as React from 'react';\n\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 */\nexport function useFirstMount(): boolean {\n const isFirst = React.useRef(true);\n\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n\n return isFirst.current;\n}\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AAEA;;;;;;;;;;;AAWA,SAAgBC,aAAaA,CAAA;EAC3B,MAAMC,OAAO,GAAGH,KAAK,CAACI,MAAM,CAAC,IAAI,CAAC;EAElC,IAAID,OAAO,CAACE,OAAO,EAAE;IACnBF,OAAO,CAACE,OAAO,GAAG,KAAK;IACvB,OAAO,IAAI;;EAGb,OAAOF,OAAO,CAACE,OAAO;AACxB;AATAC,OAAA,CAAAJ,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"sources":["../../lib/hooks/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 */\nexport 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//# sourceMappingURL=useFirstMount.js.map"],"names":["useFirstMount","isFirst","React","useRef","current"],"mappings":";;;;+BAYgBA;;aAAAA;;;6DAZO;AAYhB,SAASA,gBAAgB;IAC9B,MAAMC,UAAUC,OAAMC,MAAM,CAAC,IAAI;IACjC,IAAIF,QAAQG,OAAO,EAAE;QACnBH,QAAQG,OAAO,GAAG,KAAK;QACvB,OAAO,IAAI;IACb,CAAC;IACD,OAAOH,QAAQG,OAAO;AACxB,EACA,yCAAyC"}
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useForceUpdate", {
6
+ enumerable: true,
7
+ get: ()=>useForceUpdate
5
8
  });
6
- exports.useForceUpdate = void 0;
7
- const react_1 = /*#__PURE__*/require("react");
8
- /**
9
- * @internal
10
- * Forces a re-render, similar to `forceUpdate` in class components.
11
- */
9
+ const _react = require("react");
12
10
  function useForceUpdate() {
13
- return react_1.useReducer(x => x + 1, 0)[1];
14
- }
15
- exports.useForceUpdate = useForceUpdate;
11
+ return (0, _react.useReducer)((x)=>x + 1, 0)[1];
12
+ } //# sourceMappingURL=useForceUpdate.js.map
13
+
16
14
  //# sourceMappingURL=useForceUpdate.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["react_1","require","useForceUpdate","useReducer","x","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useForceUpdate.ts"],"sourcesContent":["import { useReducer } from 'react';\n\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */\nexport function useForceUpdate() {\n return useReducer(x => x + 1, 0)[1];\n}\n"],"mappings":";;;;;;AAAA,MAAAA,OAAA,gBAAAC,OAAA;AAEA;;;;AAIA,SAAgBC,cAAcA,CAAA;EAC5B,OAAOF,OAAA,CAAAG,UAAU,CAACC,CAAC,IAAIA,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC;AAFAC,OAAA,CAAAH,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"sources":["../../lib/hooks/useForceUpdate.js"],"sourcesContent":["import { useReducer } from \"react\";\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */\nexport function useForceUpdate() {\n return useReducer(x => x + 1, 0)[1];\n}\n//# sourceMappingURL=useForceUpdate.js.map"],"names":["useForceUpdate","useReducer","x"],"mappings":";;;;+BAKgBA;;aAAAA;;uBALW;AAKpB,SAASA,iBAAiB;IAC/B,OAAOC,IAAAA,iBAAU,EAACC,CAAAA,IAAKA,IAAI,GAAG,EAAE,CAAC,EAAE;AACrC,EACA,0CAA0C"}
@@ -1,56 +1,57 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ IdPrefixProvider: ()=>IdPrefixProvider,
13
+ resetIdsForTests: ()=>resetIdsForTests,
14
+ useId: ()=>useId
5
15
  });
6
- exports.useId = exports.resetIdsForTests = exports.IdPrefixProvider = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const index_1 = /*#__PURE__*/require("../ssr/index");
9
- const IdPrefixContext = /*#__PURE__*/React.createContext(undefined);
10
- /**
11
- * Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions
12
- * between different bundles.
13
- */
14
- exports.IdPrefixProvider = IdPrefixContext.Provider;
16
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
17
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
18
+ const _index = require("../ssr/index");
19
+ const IdPrefixContext = /*#__PURE__*/ _react.createContext(undefined);
20
+ const IdPrefixProvider = IdPrefixContext.Provider;
15
21
  function useIdPrefix() {
16
- return React.useContext(IdPrefixContext) || '';
22
+ return _react.useContext(IdPrefixContext) || "";
17
23
  }
18
- /**
19
- * Resets generated IDs, should be used only in tests.
20
- */
21
24
  function resetIdsForTests() {
22
- index_1.defaultSSRContextValue.current = 0;
25
+ _index.defaultSSRContextValue.current = 0;
23
26
  }
24
- exports.resetIdsForTests = resetIdsForTests;
25
- /**
26
- * Hook to generate a unique ID.
27
- *
28
- * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.
29
- * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,
30
- * without conditioning the hook call
31
- * @returns The ID
32
- */
33
- function useId(prefix = 'fui-', providedId) {
34
- const contextValue = index_1.useSSRContext();
35
- const idPrefix = useIdPrefix();
36
- // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to
37
- // prevent bundlers from complaining with older versions of React.
38
- const _useId = React['use' + 'Id'];
39
- if (_useId) {
40
- const generatedId = _useId();
41
- // eslint-disable-next-line react-hooks/rules-of-hooks
42
- const escapedId = React.useMemo(() => generatedId.replace(/:/g, ''), [generatedId]);
43
- return providedId || `${idPrefix}${prefix}${escapedId}`;
44
- }
45
- // Hooks appear to be running conditionally, but they will always run in the same order since it's based on
46
- // the version of React being used. This is safe to ignore.
47
- // eslint-disable-next-line react-hooks/rules-of-hooks
48
- return React.useMemo(() => {
49
- if (providedId) {
50
- return providedId;
27
+ function useId(prefix = "fui-", providedId) {
28
+ const contextValue = (0, _index.useSSRContext)();
29
+ const idPrefix = useIdPrefix();
30
+ // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to
31
+ // prevent bundlers from complaining with older versions of React.
32
+ const _useId = _react["use" + "Id"];
33
+ if (_useId) {
34
+ const generatedId = _useId();
35
+ // eslint-disable-next-line react-hooks/rules-of-hooks
36
+ const escapedId = _react.useMemo(()=>generatedId.replace(/:/g, ""), [
37
+ generatedId
38
+ ]);
39
+ return providedId || `${idPrefix}${prefix}${escapedId}`;
51
40
  }
52
- return `${idPrefix}${prefix}${++contextValue.current}`;
53
- }, [idPrefix, prefix, providedId, contextValue]);
54
- }
55
- exports.useId = useId;
41
+ // Hooks appear to be running conditionally, but they will always run in the same order since it's based on
42
+ // the version of React being used. This is safe to ignore.
43
+ // eslint-disable-next-line react-hooks/rules-of-hooks
44
+ return _react.useMemo(()=>{
45
+ if (providedId) {
46
+ return providedId;
47
+ }
48
+ return `${idPrefix}${prefix}${++contextValue.current}`;
49
+ }, [
50
+ idPrefix,
51
+ prefix,
52
+ providedId,
53
+ contextValue
54
+ ]);
55
+ } //# sourceMappingURL=useId.js.map
56
+
56
57
  //# sourceMappingURL=useId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","index_1","IdPrefixContext","createContext","undefined","exports","IdPrefixProvider","Provider","useIdPrefix","useContext","resetIdsForTests","defaultSSRContextValue","current","useId","prefix","providedId","contextValue","useSSRContext","idPrefix","_useId","generatedId","escapedId","useMemo","replace"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useId.ts"],"sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\n\nconst IdPrefixContext = React.createContext<string | undefined>(undefined);\n\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 */\nexport const IdPrefixProvider = IdPrefixContext.Provider;\n\nfunction useIdPrefix(): string {\n return React.useContext(IdPrefixContext) || '';\n}\n\n/**\n * Resets generated IDs, should be used only in tests.\n */\nexport function resetIdsForTests(): void {\n defaultSSRContextValue.current = 0;\n}\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 */\nexport function useId(prefix: string = 'fui-', providedId?: string): string {\n const contextValue = useSSRContext();\n const idPrefix = useIdPrefix();\n\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 as never)['use' + 'Id'] as (() => string) | undefined;\n\n if (_useId) {\n const generatedId = _useId();\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const escapedId = React.useMemo(() => generatedId.replace(/:/g, ''), [generatedId]);\n\n return providedId || `${idPrefix}${prefix}${escapedId}`;\n }\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\n return `${idPrefix}${prefix}${++contextValue.current}`;\n }, [idPrefix, prefix, providedId, contextValue]);\n}\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,OAAA,gBAAAD,OAAA;AAEA,MAAME,eAAe,gBAAGH,KAAK,CAACI,aAAa,CAAqBC,SAAS,CAAC;AAE1E;;;;AAIaC,OAAA,CAAAC,gBAAgB,GAAGJ,eAAe,CAACK,QAAQ;AAExD,SAASC,WAAWA,CAAA;EAClB,OAAOT,KAAK,CAACU,UAAU,CAACP,eAAe,CAAC,IAAI,EAAE;AAChD;AAEA;;;AAGA,SAAgBQ,gBAAgBA,CAAA;EAC9BT,OAAA,CAAAU,sBAAsB,CAACC,OAAO,GAAG,CAAC;AACpC;AAFAP,OAAA,CAAAK,gBAAA,GAAAA,gBAAA;AAIA;;;;;;;;AAQA,SAAgBG,KAAKA,CAACC,MAAA,GAAiB,MAAM,EAAEC,UAAmB;EAChE,MAAMC,YAAY,GAAGf,OAAA,CAAAgB,aAAa,EAAE;EACpC,MAAMC,QAAQ,GAAGV,WAAW,EAAE;EAE9B;EACA;EACA,MAAMW,MAAM,GAAIpB,KAAe,CAAC,KAAK,GAAG,IAAI,CAA+B;EAE3E,IAAIoB,MAAM,EAAE;IACV,MAAMC,WAAW,GAAGD,MAAM,EAAE;IAE5B;IACA,MAAME,SAAS,GAAGtB,KAAK,CAACuB,OAAO,CAAC,MAAMF,WAAW,CAACG,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAACH,WAAW,CAAC,CAAC;IAEnF,OAAOL,UAAU,IAAI,GAAGG,QAAQ,GAAGJ,MAAM,GAAGO,SAAS,EAAE;;EAGzD;EACA;EACA;EACA,OAAOtB,KAAK,CAACuB,OAAO,CAAC,MAAK;IACxB,IAAIP,UAAU,EAAE;MACd,OAAOA,UAAU;;IAGnB,OAAO,GAAGG,QAAQ,GAAGJ,MAAM,GAAG,EAAEE,YAAY,CAACJ,OAAO,EAAE;EACxD,CAAC,EAAE,CAACM,QAAQ,EAAEJ,MAAM,EAAEC,UAAU,EAAEC,YAAY,CAAC,CAAC;AAClD;AA3BAX,OAAA,CAAAQ,KAAA,GAAAA,KAAA"}
1
+ {"version":3,"sources":["../../lib/hooks/useId.js"],"sourcesContent":["import * as React from \"react\";\nimport { defaultSSRContextValue, useSSRContext } from \"../ssr/index\";\nconst IdPrefixContext = /*#__PURE__*/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 */\nexport const IdPrefixProvider = IdPrefixContext.Provider;\nfunction useIdPrefix() {\n return React.useContext(IdPrefixContext) || \"\";\n}\n/**\n * Resets generated IDs, should be used only in tests.\n */\nexport 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 */\nexport 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, \"\"), [generatedId]);\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 }, [idPrefix, prefix, providedId, contextValue]);\n}\n//# sourceMappingURL=useId.js.map"],"names":["IdPrefixProvider","resetIdsForTests","useId","IdPrefixContext","React","createContext","undefined","Provider","useIdPrefix","useContext","defaultSSRContextValue","current","prefix","providedId","contextValue","useSSRContext","idPrefix","_useId","generatedId","escapedId","useMemo","replace"],"mappings":";;;;;;;;;;;IAOaA,gBAAgB,MAAhBA;IAOGC,gBAAgB,MAAhBA;IAWAC,KAAK,MAALA;;;6DAzBO;uBAC+B;AACtD,MAAMC,kBAAkB,WAAW,GAAEC,OAAMC,aAAa,CAACC;AAKlD,MAAMN,mBAAmBG,gBAAgBI,QAAQ;AACxD,SAASC,cAAc;IACrB,OAAOJ,OAAMK,UAAU,CAACN,oBAAoB;AAC9C;AAIO,SAASF,mBAAmB;IACjCS,6BAAsB,CAACC,OAAO,GAAG;AACnC;AASO,SAAST,MAAMU,SAAS,MAAM,EAAEC,UAAU,EAAE;IACjD,MAAMC,eAAeC,IAAAA,oBAAa;IAClC,MAAMC,WAAWR;IACjB,mHAAmH;IACnH,kEAAkE;IAClE,MAAMS,SAASb,MAAK,CAAC,QAAQ,KAAK;IAClC,IAAIa,QAAQ;QACV,MAAMC,cAAcD;QACpB,sDAAsD;QACtD,MAAME,YAAYf,OAAMgB,OAAO,CAAC,IAAMF,YAAYG,OAAO,CAAC,MAAM,KAAK;YAACH;SAAY;QAClF,OAAOL,cAAc,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAEO,UAAU,CAAC;IACzD,CAAC;IACD,2GAA2G;IAC3G,2DAA2D;IAC3D,sDAAsD;IACtD,OAAOf,OAAMgB,OAAO,CAAC,IAAM;QACzB,IAAIP,YAAY;YACd,OAAOA;QACT,CAAC;QACD,OAAO,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAE,EAAEE,aAAaH,OAAO,CAAC,CAAC;IACxD,GAAG;QAACK;QAAUJ;QAAQC;QAAYC;KAAa;AACjD,EACA,iCAAiC"}
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
6
+ enumerable: true,
7
+ get: ()=>useIsomorphicLayoutEffect
5
8
  });
6
- exports.useIsomorphicLayoutEffect = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const index_1 = /*#__PURE__*/require("../ssr/index");
9
- /**
10
- * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally
11
- * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to
12
- * ensure we don't get a render flash for certain operations, but we may also need affected components to render on
13
- * the server.
14
- *
15
- * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
16
- * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js
17
- */
18
- // eslint-disable-next-line no-restricted-properties
19
- exports.useIsomorphicLayoutEffect = /*#__PURE__*/index_1.canUseDOM() ? React.useLayoutEffect : React.useEffect;
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _index = require("../ssr/index");
12
+ const useIsomorphicLayoutEffect = /*#__PURE__*/ (0, _index.canUseDOM)() ? _react.useLayoutEffect : _react.useEffect; //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
13
+
20
14
  //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","index_1","exports","useIsomorphicLayoutEffect","canUseDOM","useLayoutEffect","useEffect"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useIsomorphicLayoutEffect.ts"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n\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 */\n// eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect: typeof React.useEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,OAAA,gBAAAD,OAAA;AAEA;;;;;;;;;AASA;AACaE,OAAA,CAAAC,yBAAyB,GAA2B,aAAAF,OAAA,CAAAG,SAAS,EAAE,GAAGL,KAAK,CAACM,eAAe,GAAGN,KAAK,CAACO,SAAS"}
1
+ {"version":3,"sources":["../../lib/hooks/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 = /*#__PURE__*/canUseDOM() ? React.useLayoutEffect : React.useEffect;\n//# sourceMappingURL=useIsomorphicLayoutEffect.js.map"],"names":["useIsomorphicLayoutEffect","canUseDOM","React","useLayoutEffect","useEffect"],"mappings":";;;;+BAWaA;;aAAAA;;;6DAXU;uBACG;AAUnB,MAAMA,4BAA4B,WAAW,GAAEC,IAAAA,gBAAS,MAAKC,OAAMC,eAAe,GAAGD,OAAME,SAAS,EAC3G,qDAAqD"}
@@ -1,32 +1,30 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useMergedRefs", {
6
+ enumerable: true,
7
+ get: ()=>useMergedRefs
5
8
  });
6
- exports.useMergedRefs = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- /**
9
- * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that
10
- * updates all provided refs
11
- * @param refs - Refs to collectively update with one ref value.
12
- * @returns A function with an attached "current" prop, so that it can be treated like a RefObject.
13
- */
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
14
11
  function useMergedRefs(...refs) {
15
- const mergedCallback = React.useCallback(value => {
16
- // Update the "current" prop hanging on the function.
17
- mergedCallback.current = value;
18
- for (const ref of refs) {
19
- if (typeof ref === 'function') {
20
- ref(value);
21
- } else if (ref) {
22
- // work around the immutability of the React.Ref type
23
- ref.current = value;
24
- }
25
- }
26
- },
27
- // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive
28
- [...refs]);
29
- return mergedCallback;
30
- }
31
- exports.useMergedRefs = useMergedRefs;
12
+ const mergedCallback = _react.useCallback((value)=>{
13
+ // Update the "current" prop hanging on the function.
14
+ mergedCallback.current = value;
15
+ for (const ref of refs){
16
+ if (typeof ref === "function") {
17
+ ref(value);
18
+ } else if (ref) {
19
+ // work around the immutability of the React.Ref type
20
+ ref.current = value;
21
+ }
22
+ }
23
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive
24
+ [
25
+ ...refs
26
+ ]);
27
+ return mergedCallback;
28
+ } //# sourceMappingURL=useMergedRefs.js.map
29
+
32
30
  //# sourceMappingURL=useMergedRefs.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","useMergedRefs","refs","mergedCallback","useCallback","value","current","ref","exports"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useMergedRefs.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * A Ref function which can be treated like a ref object in that it has an attached\n * current property, which will be updated as the ref is evaluated.\n */\nexport type RefObjectFunction<T> = React.RefObject<T> & ((value: T) => void);\n\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 */\nexport function useMergedRefs<T>(...refs: (React.Ref<T> | undefined)[]): RefObjectFunction<T> {\n const mergedCallback: RefObjectFunction<T> = React.useCallback(\n (value: T) => {\n // Update the \"current\" prop hanging on the function.\n (mergedCallback as unknown as React.MutableRefObject<T>).current = value;\n\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 as unknown as React.MutableRefObject<T>).current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs],\n ) as unknown as RefObjectFunction<T>;\n\n return mergedCallback;\n}\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AAQA;;;;;;AAMA,SAAgBC,aAAaA,CAAI,GAAGC,IAAkC;EACpE,MAAMC,cAAc,GAAyBJ,KAAK,CAACK,WAAW,CAC3DC,KAAQ,IAAI;IACX;IACCF,cAAuD,CAACG,OAAO,GAAGD,KAAK;IAExE,KAAK,MAAME,GAAG,IAAIL,IAAI,EAAE;MACtB,IAAI,OAAOK,GAAG,KAAK,UAAU,EAAE;QAC7BA,GAAG,CAACF,KAAK,CAAC;OACX,MAAM,IAAIE,GAAG,EAAE;QACd;QACCA,GAA4C,CAACD,OAAO,GAAGD,KAAK;;;EAGnE,CAAC;EACD;EACA,CAAC,GAAGH,IAAI,CAAC,CACyB;EAEpC,OAAOC,cAAc;AACvB;AApBAK,OAAA,CAAAP,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"sources":["../../lib/hooks/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 */\nexport 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 },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs]);\n return mergedCallback;\n}\n//# sourceMappingURL=useMergedRefs.js.map"],"names":["useMergedRefs","refs","mergedCallback","React","useCallback","value","current","ref"],"mappings":";;;;+BAOgBA;;aAAAA;;;6DAPO;AAOhB,SAASA,cAAc,GAAGC,IAAI,EAAE;IACrC,MAAMC,iBAAiBC,OAAMC,WAAW,CAACC,CAAAA,QAAS;QAChD,qDAAqD;QACrDH,eAAeI,OAAO,GAAGD;QACzB,KAAK,MAAME,OAAON,KAAM;YACtB,IAAI,OAAOM,QAAQ,YAAY;gBAC7BA,IAAIF;YACN,OAAO,IAAIE,KAAK;gBACd,qDAAqD;gBACrDA,IAAID,OAAO,GAAGD;YAChB,CAAC;QACH;IACF,GACA,6EAA6E;IAC7E;WAAIJ;KAAK;IACT,OAAOC;AACT,EACA,yCAAyC"}
@@ -1,78 +1,73 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.useOnClickOutside = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const useEventCallback_1 = /*#__PURE__*/require("./useEventCallback");
9
- /**
10
- * @internal
11
- * Utility to perform checks where a click/touch event was made outside a component
12
- */
13
- const useOnClickOutside = options => {
14
- const {
15
- refs,
16
- callback,
17
- element,
18
- disabled,
19
- contains: containsProp
20
- } = options;
21
- const timeoutId = React.useRef(undefined);
22
- useIFrameFocus(options);
23
- const listener = useEventCallback_1.useEventCallback(ev => {
24
- const contains = containsProp || ((parent, child) => !!(parent === null || parent === void 0 ? void 0 : parent.contains(child)));
25
- const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));
26
- if (isOutside && !disabled) {
27
- callback(ev);
28
- }
29
- });
30
- React.useEffect(() => {
31
- // Store the current event to avoid triggering handlers immediately
32
- // Note this depends on a deprecated but extremely well supported quirk of the web platform
33
- // https://github.com/facebook/react/issues/20074
34
- let currentEvent = getWindowEvent(window);
35
- const conditionalHandler = event => {
36
- // Skip if this event is the same as the one running when we added the handlers
37
- if (event === currentEvent) {
38
- currentEvent = undefined;
39
- return;
40
- }
41
- listener(event);
42
- };
43
- if (!disabled) {
44
- // use capture phase because React can update DOM before the event bubbles to the document
45
- element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);
46
- element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);
47
- element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);
48
- }
49
- // Garbage collect this event after it's no longer useful to avoid memory leaks
50
- timeoutId.current = window.setTimeout(() => {
51
- currentEvent = undefined;
52
- }, 1);
53
- return () => {
54
- element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);
55
- element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);
56
- element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);
57
- clearTimeout(timeoutId.current);
58
- currentEvent = undefined;
59
- };
60
- }, [listener, element, disabled]);
5
+ Object.defineProperty(exports, "useOnClickOutside", {
6
+ enumerable: true,
7
+ get: ()=>useOnClickOutside
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _useEventCallback = require("./useEventCallback");
12
+ const useOnClickOutside = (options)=>{
13
+ const { refs , callback , element , disabled , contains: containsProp } = options;
14
+ const timeoutId = _react.useRef(undefined);
15
+ useIFrameFocus(options);
16
+ const listener = (0, _useEventCallback.useEventCallback)((ev)=>{
17
+ const contains = containsProp || ((parent, child)=>!!parent?.contains(child));
18
+ const isOutside = refs.every((ref)=>!contains(ref.current || null, ev.target));
19
+ if (isOutside && !disabled) {
20
+ callback(ev);
21
+ }
22
+ });
23
+ _react.useEffect(()=>{
24
+ // Store the current event to avoid triggering handlers immediately
25
+ // Note this depends on a deprecated but extremely well supported quirk of the web platform
26
+ // https://github.com/facebook/react/issues/20074
27
+ let currentEvent = getWindowEvent(window);
28
+ const conditionalHandler = (event)=>{
29
+ // Skip if this event is the same as the one running when we added the handlers
30
+ if (event === currentEvent) {
31
+ currentEvent = undefined;
32
+ return;
33
+ }
34
+ listener(event);
35
+ };
36
+ if (!disabled) {
37
+ // use capture phase because React can update DOM before the event bubbles to the document
38
+ element?.addEventListener("click", conditionalHandler, true);
39
+ element?.addEventListener("touchstart", conditionalHandler, true);
40
+ element?.addEventListener("contextmenu", conditionalHandler, true);
41
+ }
42
+ // Garbage collect this event after it's no longer useful to avoid memory leaks
43
+ timeoutId.current = window.setTimeout(()=>{
44
+ currentEvent = undefined;
45
+ }, 1);
46
+ return ()=>{
47
+ element?.removeEventListener("click", conditionalHandler, true);
48
+ element?.removeEventListener("touchstart", conditionalHandler, true);
49
+ element?.removeEventListener("contextmenu", conditionalHandler, true);
50
+ clearTimeout(timeoutId.current);
51
+ currentEvent = undefined;
52
+ };
53
+ }, [
54
+ listener,
55
+ element,
56
+ disabled
57
+ ]);
61
58
  };
62
- exports.useOnClickOutside = useOnClickOutside;
63
- const getWindowEvent = target => {
64
- var _a, _b, _c;
65
- if (target) {
66
- if (typeof target.window === 'object' && target.window === target) {
67
- // eslint-disable-next-line deprecation/deprecation
68
- return target.event;
59
+ const getWindowEvent = (target)=>{
60
+ if (target) {
61
+ if (typeof target.window === "object" && target.window === target) {
62
+ // eslint-disable-next-line deprecation/deprecation
63
+ return target.event;
64
+ }
65
+ // eslint-disable-next-line deprecation/deprecation
66
+ return target.ownerDocument?.defaultView?.event ?? undefined;
69
67
  }
70
- // eslint-disable-next-line deprecation/deprecation
71
- return (_c = (_b = (_a = target.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) === null || _b === void 0 ? void 0 : _b.event) !== null && _c !== void 0 ? _c : undefined;
72
- }
73
- return undefined;
68
+ return undefined;
74
69
  };
75
- const FUI_FRAME_EVENT = 'fuiframefocus';
70
+ const FUI_FRAME_EVENT = "fuiframefocus";
76
71
  /**
77
72
  * Since click events do not propagate past iframes, we use focus to detect if a
78
73
  * click has happened inside an iframe, since the only ways of focusing inside an
@@ -82,51 +77,50 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
82
77
  *
83
78
  * Polls the value of `document.activeElement`. If it is an iframe, then dispatch
84
79
  * a custom DOM event. When the custom event is received call the provided callback
85
- */
86
- const useIFrameFocus = options => {
87
- const {
88
- disabled,
89
- element: targetDocument,
90
- callback,
91
- contains: containsProp = (parent, child) => !!(parent === null || parent === void 0 ? void 0 : parent.contains(child)),
92
- pollDuration = 1000,
93
- refs
94
- } = options;
95
- const timeoutRef = React.useRef();
96
- const listener = useEventCallback_1.useEventCallback(e => {
97
- const contains = containsProp || ((parent, child) => !!(parent === null || parent === void 0 ? void 0 : parent.contains(child)));
98
- const isOutside = refs.every(ref => !contains(ref.current || null, e.target));
99
- if (isOutside && !disabled) {
100
- callback(e);
101
- }
102
- });
103
- // Adds listener to the custom iframe focus event
104
- React.useEffect(() => {
105
- if (!disabled) {
106
- targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
107
- return () => {
108
- targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
109
- };
110
- }
111
- }, [targetDocument, disabled, listener]);
112
- // Starts polling for the active element
113
- React.useEffect(() => {
114
- var _a;
115
- if (!disabled) {
116
- timeoutRef.current = (_a = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) === null || _a === void 0 ? void 0 : _a.setInterval(() => {
117
- const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
118
- if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
119
- const event = new CustomEvent(FUI_FRAME_EVENT, {
120
- bubbles: true
121
- });
122
- activeElement.dispatchEvent(event);
80
+ */ const useIFrameFocus = (options)=>{
81
+ const { disabled , element: targetDocument , callback , contains: containsProp = (parent, child)=>!!parent?.contains(child) , pollDuration =1000 , refs } = options;
82
+ const timeoutRef = _react.useRef();
83
+ const listener = (0, _useEventCallback.useEventCallback)((e)=>{
84
+ const contains = containsProp || ((parent, child)=>!!parent?.contains(child));
85
+ const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));
86
+ if (isOutside && !disabled) {
87
+ callback(e);
123
88
  }
124
- }, pollDuration);
125
- }
126
- return () => {
127
- var _a;
128
- (_a = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) === null || _a === void 0 ? void 0 : _a.clearTimeout(timeoutRef.current);
129
- };
130
- }, [targetDocument, disabled, pollDuration]);
131
- };
89
+ });
90
+ // Adds listener to the custom iframe focus event
91
+ _react.useEffect(()=>{
92
+ if (!disabled) {
93
+ targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);
94
+ return ()=>{
95
+ targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);
96
+ };
97
+ }
98
+ }, [
99
+ targetDocument,
100
+ disabled,
101
+ listener
102
+ ]);
103
+ // Starts polling for the active element
104
+ _react.useEffect(()=>{
105
+ if (!disabled) {
106
+ timeoutRef.current = targetDocument?.defaultView?.setInterval(()=>{
107
+ const activeElement = targetDocument?.activeElement;
108
+ if (activeElement?.tagName === "IFRAME" || activeElement?.tagName === "WEBVIEW") {
109
+ const event = new CustomEvent(FUI_FRAME_EVENT, {
110
+ bubbles: true
111
+ });
112
+ activeElement.dispatchEvent(event);
113
+ }
114
+ }, pollDuration);
115
+ }
116
+ return ()=>{
117
+ targetDocument?.defaultView?.clearTimeout(timeoutRef.current);
118
+ };
119
+ }, [
120
+ targetDocument,
121
+ disabled,
122
+ pollDuration
123
+ ]);
124
+ }; //# sourceMappingURL=useOnClickOutside.js.map
125
+
132
126
  //# sourceMappingURL=useOnClickOutside.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","useEventCallback_1","useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","useRef","undefined","useIFrameFocus","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","exports","_c","_b","_a","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useOnClickOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n\n/**\n * @internal\n */\nexport type UseOnClickOrScrollOutsideOptions = {\n /**\n * The element to listen for the click event\n */\n element: Document | undefined;\n /**\n * Refs to elements that check if the click is outside\n */\n refs: React.MutableRefObject<HTMLElement | undefined | null>[];\n\n /**\n * By default uses element.contains, but custom contain function can be provided\n * @param parentRef - provided parent ref\n * @param child - event target element\n */\n contains?(parent: HTMLElement | null, child: HTMLElement): boolean;\n\n /**\n * Disables event listeners\n */\n disabled?: boolean;\n\n /**\n * Called if the click is outside the element refs\n */\n callback: (ev: MouseEvent | TouchEvent) => void;\n};\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const timeoutId = React.useRef<number | undefined>(undefined);\n useIFrameFocus(options);\n\n const listener = useEventCallback((ev: MouseEvent | TouchEvent) => {\n const contains: UseOnClickOrScrollOutsideOptions['contains'] =\n containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\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\n const conditionalHandler = (event: MouseEvent | TouchEvent) => {\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\n listener(event);\n };\n\n if (!disabled) {\n // use capture phase because React can update DOM before the event bubbles to the document\n element?.addEventListener('click', conditionalHandler, true);\n element?.addEventListener('touchstart', conditionalHandler, true);\n element?.addEventListener('contextmenu', conditionalHandler, true);\n }\n\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\n return () => {\n element?.removeEventListener('click', conditionalHandler, true);\n element?.removeEventListener('touchstart', conditionalHandler, true);\n element?.removeEventListener('contextmenu', conditionalHandler, true);\n\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\n\nconst getWindowEvent = (target: Node | Window): Event | undefined => {\n if (target) {\n if (typeof (target as Window).window === 'object' && (target as Window).window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return (target as Node).ownerDocument?.defaultView?.event ?? undefined;\n }\n\n return undefined;\n};\n\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n\ninterface UseIFrameFocusOptions extends UseOnClickOrScrollOutsideOptions {\n /**\n * Millisecond duration to poll\n */\n pollDuration?: number;\n}\n\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 */\nconst useIFrameFocus = (options: UseIFrameFocusOptions) => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => !!parent?.contains(child),\n pollDuration = 1000,\n refs,\n } = options;\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n const contains = containsProp || ((parent, child) => !!parent?.contains(child));\n\n const isOutside = refs.every(ref => !contains(ref.current || null, e.target as HTMLElement));\n if (isOutside && !disabled) {\n callback(e as MouseEvent);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (!disabled) {\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }\n }, [targetDocument, disabled, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (!disabled) {\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement?.tagName === 'IFRAME' || activeElement?.tagName === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, { bubbles: true });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n }\n return () => {\n targetDocument?.defaultView?.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, disabled, pollDuration]);\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,kBAAA,gBAAAD,OAAA;AAiCA;;;;AAIO,MAAME,iBAAiB,GAAIC,OAAyC,IAAI;EAC7E,MAAM;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,QAAQ,EAAEC;EAAY,CAAE,GAAGN,OAAO;EAC7E,MAAMO,SAAS,GAAGX,KAAK,CAACY,MAAM,CAAqBC,SAAS,CAAC;EAC7DC,cAAc,CAACV,OAAO,CAAC;EAEvB,MAAMW,QAAQ,GAAGb,kBAAA,CAAAc,gBAAgB,CAAEC,EAA2B,IAAI;IAChE,MAAMR,QAAQ,GACZC,YAAY,KAAK,CAACQ,MAAM,EAAEC,KAAK,KAAK,CAAC,EAACD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAET,QAAQ,CAACU,KAAK,CAAC,EAAC;IAEhE,MAAMC,SAAS,GAAGf,IAAI,CAACgB,KAAK,CAACC,GAAG,IAAI,CAACb,QAAQ,CAACa,GAAG,CAACC,OAAO,IAAI,IAAI,EAAEN,EAAE,CAACO,MAAqB,CAAC,CAAC;IAC7F,IAAIJ,SAAS,IAAI,CAACZ,QAAQ,EAAE;MAC1BF,QAAQ,CAACW,EAAE,CA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AAK;;MACV,CAAAL,EAAA,GAAAI,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEF,WAAW,cAAAF,EAAA,uBAAAA,EAAA,CAAEJ,YAAY,CAACU,UAAU,CAACrB,OAAO,CAAC;IAC/D,CAAC;EACH,CAAC,EAAE,CAACmB,cAAc,EAAElC,QAAQ,EAAEmC,YAAY,CAAC,CAAC;AAC9C,CAAC"}
1
+ {"version":3,"sources":["../../lib/hooks/useOnClickOutside.js"],"sourcesContent":["import * as React from \"react\";\nimport { useEventCallback } from \"./useEventCallback\";\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = options => {\n const {\n refs,\n callback,\n element,\n disabled,\n contains: containsProp\n } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus(options);\n const listener = useEventCallback(ev => {\n const contains = containsProp || ((parent, child) => !!parent?.contains(child));\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(() => {\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 if (!disabled) {\n // use capture phase because React can update DOM before the event bubbles to the document\n element?.addEventListener(\"click\", conditionalHandler, true);\n element?.addEventListener(\"touchstart\", conditionalHandler, true);\n element?.addEventListener(\"contextmenu\", conditionalHandler, true);\n }\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?.removeEventListener(\"click\", conditionalHandler, true);\n element?.removeEventListener(\"touchstart\", conditionalHandler, true);\n element?.removeEventListener(\"contextmenu\", conditionalHandler, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\nconst getWindowEvent = target => {\n if (target) {\n if (typeof target.window === \"object\" && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n // eslint-disable-next-line deprecation/deprecation\n return 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 */\nconst useIFrameFocus = options => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => !!parent?.contains(child),\n pollDuration = 1000,\n refs\n } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback(e => {\n const contains = containsProp || ((parent, child) => !!parent?.contains(child));\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 targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }\n }, [targetDocument, disabled, listener]);\n // Starts polling for the active element\n React.useEffect(() => {\n if (!disabled) {\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement?.tagName === \"IFRAME\" || activeElement?.tagName === \"WEBVIEW\") {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n }\n return () => {\n targetDocument?.defaultView?.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, disabled, pollDuration]);\n};\n//# sourceMappingURL=useOnClickOutside.js.map"],"names":["useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","React","useRef","undefined","useIFrameFocus","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;kCACU;AAK1B,MAAMA,oBAAoBC,CAAAA,UAAW;IAC1C,MAAM,EACJC,KAAI,EACJC,SAAQ,EACRC,QAAO,EACPC,SAAQ,EACRC,UAAUC,aAAY,EACvB,GAAGN;IACJ,MAAMO,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAeX;IACf,MAAMY,WAAWC,IAAAA,kCAAgB,EAACC,CAAAA,KAAM;QACtC,MAAMT,WAAWC,gBAAiB,CAAA,CAACS,QAAQC,QAAU,CAAC,CAACD,QAAQV,SAASW,MAAK;QAC7E,MAAMC,YAAYhB,KAAKiB,KAAK,CAACC,CAAAA,MAAO,CAACd,SAASc,IAAIC,OAAO,IAAI,IAAI,EAAEN,GAAGO,MAAM;QAC5E,IAAIJ,aAAa,CAACb,UAAU;YAC1BF,SAASY;QACX,CAAC;IACH;IACAN,OAAMc,SAAS,CAAC,IAAM;QACpB,mEAAmE;QACnE,2FAA2F;QAC3F,iDAAiD;QACjD,IAAIC,eAAeC,eAAeC;QAClC,MAAMC,qBAAqBC,CAAAA,QAAS;YAClC,+EAA+E;YAC/E,IAAIA,UAAUJ,cAAc;gBAC1BA,eAAeb;gBACf;YACF,CAAC;YACDE,SAASe;QACX;QACA,IAAI,CAACvB,UAAU;YACb,0FAA0F;YAC1FD,SAASyB,iBAAiB,SAASF,oBAAoB,IAAI;YAC3DvB,SAASyB,iBAAiB,cAAcF,oBAAoB,IAAI;YAChEvB,SAASyB,iBAAiB,eAAeF,oBAAoB,IAAI;QACnE,CAAC;QACD,+EAA+E;QAC/EnB,UAAUa,OAAO,GAAGK,OAA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