@fluentui/react-utilities 9.7.1 → 9.7.3

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 (216) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +49 -1
  3. package/CHANGELOG.md +23 -2
  4. package/dist/index.d.ts +16 -4
  5. package/lib/compose/getSlots.js +3 -3
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.js.map +1 -1
  8. package/lib/compose/isResolvedShorthand.js.map +1 -1
  9. package/lib/compose/resolveShorthand.js.map +1 -1
  10. package/lib/compose/types.js +1 -1
  11. package/lib/compose/types.js.map +1 -1
  12. package/lib/events/index.js.map +1 -1
  13. package/lib/events/mouseTouchHelpers.js +1 -0
  14. package/lib/events/mouseTouchHelpers.js.map +1 -1
  15. package/lib/hooks/index.js.map +1 -1
  16. package/lib/hooks/useControllableState.js.map +1 -1
  17. package/lib/hooks/useEventCallback.js.map +1 -1
  18. package/lib/hooks/useFirstMount.js.map +1 -1
  19. package/lib/hooks/useForceUpdate.js.map +1 -1
  20. package/lib/hooks/useId.js.map +1 -1
  21. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -2
  22. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  23. package/lib/hooks/useMergedRefs.js.map +1 -1
  24. package/lib/hooks/useOnClickOutside.js +16 -9
  25. package/lib/hooks/useOnClickOutside.js.map +1 -1
  26. package/lib/hooks/useOnScrollOutside.js +3 -1
  27. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  28. package/lib/hooks/usePrevious.js.map +1 -1
  29. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  30. package/lib/hooks/useTimeout.js.map +1 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib/ssr/SSRContext.js +2 -2
  33. package/lib/ssr/SSRContext.js.map +1 -1
  34. package/lib/ssr/canUseDOM.js +1 -2
  35. package/lib/ssr/canUseDOM.js.map +1 -1
  36. package/lib/ssr/index.js.map +1 -1
  37. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  38. package/lib/trigger/getTriggerChild.js.map +1 -1
  39. package/lib/trigger/index.js.map +1 -1
  40. package/lib/trigger/isFluentTrigger.js +1 -0
  41. package/lib/trigger/isFluentTrigger.js.map +1 -1
  42. package/lib/trigger/types.js +1 -1
  43. package/lib/trigger/types.js.map +1 -1
  44. package/lib/utils/clamp.js +1 -2
  45. package/lib/utils/clamp.js.map +1 -1
  46. package/lib/utils/getNativeElementProps.js +2 -2
  47. package/lib/utils/getNativeElementProps.js.map +1 -1
  48. package/lib/utils/getRTLSafeKey.js +1 -2
  49. package/lib/utils/getRTLSafeKey.js.map +1 -1
  50. package/lib/utils/getReactCallbackName.js +1 -0
  51. package/lib/utils/getReactCallbackName.js.map +1 -1
  52. package/lib/utils/index.js.map +1 -1
  53. package/lib/utils/isHTMLElement.js +12 -7
  54. package/lib/utils/isHTMLElement.js.map +1 -1
  55. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  56. package/lib/utils/mergeCallbacks.js +1 -2
  57. package/lib/utils/mergeCallbacks.js.map +1 -1
  58. package/lib/utils/omit.js +1 -2
  59. package/lib/utils/omit.js.map +1 -1
  60. package/lib/utils/properties.js +24 -51
  61. package/lib/utils/properties.js.map +1 -1
  62. package/lib-commonjs/compose/getSlots.js +48 -55
  63. package/lib-commonjs/compose/getSlots.js.map +1 -1
  64. package/lib-commonjs/compose/index.js +8 -7
  65. package/lib-commonjs/compose/index.js.map +1 -1
  66. package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
  67. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  68. package/lib-commonjs/compose/resolveShorthand.js +25 -32
  69. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  70. package/lib-commonjs/compose/types.js +5 -2
  71. package/lib-commonjs/compose/types.js.map +1 -1
  72. package/lib-commonjs/events/index.js +5 -4
  73. package/lib-commonjs/events/index.js.map +1 -1
  74. package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
  75. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  76. package/lib-commonjs/hooks/index.js +16 -15
  77. package/lib-commonjs/hooks/index.js.map +1 -1
  78. package/lib-commonjs/hooks/useControllableState.js +63 -64
  79. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  80. package/lib-commonjs/hooks/useEventCallback.js +25 -31
  81. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  82. package/lib-commonjs/hooks/useFirstMount.js +15 -23
  83. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  84. package/lib-commonjs/hooks/useForceUpdate.js +9 -11
  85. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  86. package/lib-commonjs/hooks/useId.js +47 -46
  87. package/lib-commonjs/hooks/useId.js.map +1 -1
  88. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
  89. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  90. package/lib-commonjs/hooks/useMergedRefs.js +25 -27
  91. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  92. package/lib-commonjs/hooks/useOnClickOutside.js +118 -114
  93. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  94. package/lib-commonjs/hooks/useOnScrollOutside.js +35 -36
  95. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  96. package/lib-commonjs/hooks/usePrevious.js +17 -15
  97. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  98. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  99. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  100. package/lib-commonjs/hooks/useTimeout.js +30 -30
  101. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  102. package/lib-commonjs/index.js +52 -214
  103. package/lib-commonjs/index.js.map +1 -1
  104. package/lib-commonjs/ssr/SSRContext.js +57 -59
  105. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  106. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  107. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  108. package/lib-commonjs/ssr/index.js +6 -5
  109. package/lib-commonjs/ssr/index.js.map +1 -1
  110. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
  111. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  112. package/lib-commonjs/trigger/getTriggerChild.js +16 -36
  113. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  114. package/lib-commonjs/trigger/index.js +8 -7
  115. package/lib-commonjs/trigger/index.js.map +1 -1
  116. package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
  117. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  118. package/lib-commonjs/trigger/types.js +5 -2
  119. package/lib-commonjs/trigger/types.js.map +1 -1
  120. package/lib-commonjs/utils/clamp.js +10 -9
  121. package/lib-commonjs/utils/clamp.js.map +1 -1
  122. package/lib-commonjs/utils/getNativeElementProps.js +54 -61
  123. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  124. package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
  125. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  126. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  127. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  128. package/lib-commonjs/utils/index.js +12 -11
  129. package/lib-commonjs/utils/index.js.map +1 -1
  130. package/lib-commonjs/utils/isHTMLElement.js +22 -15
  131. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  132. package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
  133. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  134. package/lib-commonjs/utils/mergeCallbacks.js +14 -13
  135. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  136. package/lib-commonjs/utils/omit.js +18 -17
  137. package/lib-commonjs/utils/omit.js.map +1 -1
  138. package/lib-commonjs/utils/properties.js +327 -223
  139. package/lib-commonjs/utils/properties.js.map +1 -1
  140. package/package.json +5 -4
  141. package/lib-amd/compose/getSlots.js +0 -58
  142. package/lib-amd/compose/getSlots.js.map +0 -1
  143. package/lib-amd/compose/index.js +0 -9
  144. package/lib-amd/compose/index.js.map +0 -1
  145. package/lib-amd/compose/isResolvedShorthand.js +0 -40
  146. package/lib-amd/compose/isResolvedShorthand.js.map +0 -1
  147. package/lib-amd/compose/resolveShorthand.js +0 -27
  148. package/lib-amd/compose/resolveShorthand.js.map +0 -1
  149. package/lib-amd/compose/types.js +0 -5
  150. package/lib-amd/compose/types.js.map +0 -1
  151. package/lib-amd/events/index.js +0 -6
  152. package/lib-amd/events/index.js.map +0 -1
  153. package/lib-amd/events/mouseTouchHelpers.js +0 -39
  154. package/lib-amd/events/mouseTouchHelpers.js.map +0 -1
  155. package/lib-amd/hooks/index.js +0 -17
  156. package/lib-amd/hooks/index.js.map +0 -1
  157. package/lib-amd/hooks/useControllableState.js +0 -81
  158. package/lib-amd/hooks/useControllableState.js.map +0 -1
  159. package/lib-amd/hooks/useEventCallback.js +0 -36
  160. package/lib-amd/hooks/useEventCallback.js.map +0 -1
  161. package/lib-amd/hooks/useFirstMount.js +0 -26
  162. package/lib-amd/hooks/useFirstMount.js.map +0 -1
  163. package/lib-amd/hooks/useForceUpdate.js +0 -14
  164. package/lib-amd/hooks/useForceUpdate.js.map +0 -1
  165. package/lib-amd/hooks/useId.js +0 -54
  166. package/lib-amd/hooks/useId.js.map +0 -1
  167. package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -17
  168. package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
  169. package/lib-amd/hooks/useMergedRefs.js +0 -34
  170. package/lib-amd/hooks/useMergedRefs.js.map +0 -1
  171. package/lib-amd/hooks/useOnClickOutside.js +0 -114
  172. package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
  173. package/lib-amd/hooks/useOnScrollOutside.js +0 -31
  174. package/lib-amd/hooks/useOnScrollOutside.js.map +0 -1
  175. package/lib-amd/hooks/usePrevious.js +0 -17
  176. package/lib-amd/hooks/usePrevious.js.map +0 -1
  177. package/lib-amd/hooks/useScrollbarWidth.js +0 -32
  178. package/lib-amd/hooks/useScrollbarWidth.js.map +0 -1
  179. package/lib-amd/hooks/useTimeout.js +0 -33
  180. package/lib-amd/hooks/useTimeout.js.map +0 -1
  181. package/lib-amd/index.js +0 -40
  182. package/lib-amd/index.js.map +0 -1
  183. package/lib-amd/ssr/SSRContext.js +0 -69
  184. package/lib-amd/ssr/SSRContext.js.map +0 -1
  185. package/lib-amd/ssr/canUseDOM.js +0 -16
  186. package/lib-amd/ssr/canUseDOM.js.map +0 -1
  187. package/lib-amd/ssr/index.js +0 -7
  188. package/lib-amd/ssr/index.js.map +0 -1
  189. package/lib-amd/trigger/applyTriggerPropsToChildren.js +0 -40
  190. package/lib-amd/trigger/applyTriggerPropsToChildren.js.map +0 -1
  191. package/lib-amd/trigger/getTriggerChild.js +0 -40
  192. package/lib-amd/trigger/getTriggerChild.js.map +0 -1
  193. package/lib-amd/trigger/index.js +0 -9
  194. package/lib-amd/trigger/index.js.map +0 -1
  195. package/lib-amd/trigger/isFluentTrigger.js +0 -15
  196. package/lib-amd/trigger/isFluentTrigger.js.map +0 -1
  197. package/lib-amd/trigger/types.js +0 -5
  198. package/lib-amd/trigger/types.js.map +0 -1
  199. package/lib-amd/utils/clamp.js +0 -16
  200. package/lib-amd/utils/clamp.js.map +0 -1
  201. package/lib-amd/utils/getNativeElementProps.js +0 -64
  202. package/lib-amd/utils/getNativeElementProps.js.map +0 -1
  203. package/lib-amd/utils/getRTLSafeKey.js +0 -24
  204. package/lib-amd/utils/getRTLSafeKey.js.map +0 -1
  205. package/lib-amd/utils/index.js +0 -13
  206. package/lib-amd/utils/index.js.map +0 -1
  207. package/lib-amd/utils/isHTMLElement.js +0 -22
  208. package/lib-amd/utils/isHTMLElement.js.map +0 -1
  209. package/lib-amd/utils/isInteractiveHTMLElement.js +0 -25
  210. package/lib-amd/utils/isInteractiveHTMLElement.js.map +0 -1
  211. package/lib-amd/utils/mergeCallbacks.js +0 -40
  212. package/lib-amd/utils/mergeCallbacks.js.map +0 -1
  213. package/lib-amd/utils/omit.js +0 -31
  214. package/lib-amd/utils/omit.js.map +0 -1
  215. package/lib-amd/utils/properties.js +0 -450
  216. package/lib-amd/utils/properties.js.map +0 -1
@@ -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
27
  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;
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":["../src/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":["../src/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":["../src/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,76 +1,75 @@
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)=>{
18
+ return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
19
+ });
20
+ const isOutside = refs.every((ref)=>!contains(ref.current || null, ev.target));
21
+ if (isOutside && !disabled) {
22
+ callback(ev);
23
+ }
24
+ });
25
+ _react.useEffect(()=>{
26
+ // Store the current event to avoid triggering handlers immediately
27
+ // Note this depends on a deprecated but extremely well supported quirk of the web platform
28
+ // https://github.com/facebook/react/issues/20074
29
+ let currentEvent = getWindowEvent(window);
30
+ const conditionalHandler = (event)=>{
31
+ // Skip if this event is the same as the one running when we added the handlers
32
+ if (event === currentEvent) {
33
+ currentEvent = undefined;
34
+ return;
35
+ }
36
+ listener(event);
37
+ };
38
+ if (!disabled) {
39
+ // use capture phase because React can update DOM before the event bubbles to the document
40
+ element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);
41
+ element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);
42
+ element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);
43
+ }
44
+ // Garbage collect this event after it's no longer useful to avoid memory leaks
45
+ timeoutId.current = window.setTimeout(()=>{
46
+ currentEvent = undefined;
47
+ }, 1);
48
+ return ()=>{
49
+ element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);
50
+ element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);
51
+ element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);
52
+ clearTimeout(timeoutId.current);
53
+ currentEvent = undefined;
54
+ };
55
+ }, [
56
+ listener,
57
+ element,
58
+ disabled
59
+ ]);
61
60
  };
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;
61
+ const getWindowEvent = (target)=>{
62
+ if (target) {
63
+ var _target_ownerDocument, _target_ownerDocument_defaultView;
64
+ if (typeof target.window === 'object' && target.window === target) {
65
+ // eslint-disable-next-line deprecation/deprecation
66
+ return target.event;
67
+ }
68
+ var _target_ownerDocument_defaultView_event;
69
+ // eslint-disable-next-line deprecation/deprecation
70
+ 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;
69
71
  }
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;
72
+ return undefined;
74
73
  };
75
74
  const FUI_FRAME_EVENT = 'fuiframefocus';
76
75
  /**
@@ -82,51 +81,56 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
82
81
  *
83
82
  * Polls the value of `document.activeElement`. If it is an iframe, then dispatch
84
83
  * 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);
84
+ */ const useIFrameFocus = (options)=>{
85
+ const { disabled , element: targetDocument , callback , contains: containsProp = (parent, child)=>{
86
+ return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
87
+ } , pollDuration =1000 , refs } = options;
88
+ const timeoutRef = _react.useRef();
89
+ const listener = (0, _useEventCallback.useEventCallback)((e)=>{
90
+ const contains = containsProp || ((parent, child)=>{
91
+ return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
92
+ });
93
+ const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));
94
+ if (isOutside && !disabled) {
95
+ callback(e);
123
96
  }
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
- };
97
+ });
98
+ // Adds listener to the custom iframe focus event
99
+ _react.useEffect(()=>{
100
+ if (!disabled) {
101
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);
102
+ return ()=>{
103
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);
104
+ };
105
+ }
106
+ }, [
107
+ targetDocument,
108
+ disabled,
109
+ listener
110
+ ]);
111
+ // Starts polling for the active element
112
+ _react.useEffect(()=>{
113
+ if (!disabled) {
114
+ var _targetDocument_defaultView;
115
+ timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{
116
+ const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
117
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
118
+ const event = new CustomEvent(FUI_FRAME_EVENT, {
119
+ bubbles: true
120
+ });
121
+ activeElement.dispatchEvent(event);
122
+ }
123
+ }, pollDuration);
124
+ }
125
+ return ()=>{
126
+ var _targetDocument_defaultView;
127
+ targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);
128
+ };
129
+ }, [
130
+ targetDocument,
131
+ disabled,
132
+ pollDuration
133
+ ]);
134
+ }; //# sourceMappingURL=useOnClickOutside.js.map
135
+
132
136
  //# 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":["../src/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,CAAC;;EAEhB,CAAC,CAAC;EAEFjB,KAAK,CAACyB,SAAS,CAAC,MAAK;IACnB;IACA;IACA;IACA,IAAIC,YAAY,GA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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) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\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 === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : 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 === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : 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 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 */\nconst useIFrameFocus = options => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n },\n pollDuration = 1000,\n refs\n } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback(e => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\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 === 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, disabled, listener]);\n // Starts polling for the active element\n React.useEffect(() => {\n if (!disabled) {\n var _targetDocument_defaultView;\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 }\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 }, [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","_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":";;;;+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,k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