@fluentui/react-utilities 0.0.0-nightlyff78d1e27a20220217.1 → 0.0.0

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 (215) hide show
  1. package/CHANGELOG.json +232 -7
  2. package/CHANGELOG.md +159 -73
  3. package/dist/{react-utilities.d.ts → index.d.ts} +39 -272
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/compose/getSlots.js.map +1 -1
  6. package/lib/compose/resolveShorthand.js.map +1 -1
  7. package/lib/compose/types.js +1 -5
  8. package/lib/compose/types.js.map +1 -1
  9. package/lib/hooks/index.js +1 -5
  10. package/lib/hooks/index.js.map +1 -1
  11. package/lib/hooks/useControllableState.js +3 -2
  12. package/lib/hooks/useControllableState.js.map +1 -1
  13. package/lib/hooks/useEventCallback.js +1 -0
  14. package/lib/hooks/useEventCallback.js.map +1 -1
  15. package/lib/hooks/useFirstMount.js +1 -0
  16. package/lib/hooks/useFirstMount.js.map +1 -1
  17. package/lib/hooks/useForceUpdate.js +1 -0
  18. package/lib/hooks/useForceUpdate.js.map +1 -1
  19. package/lib/hooks/useId.js +9 -5
  20. package/lib/hooks/useId.js.map +1 -1
  21. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -0
  22. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  23. package/lib/hooks/useMergedEventCallbacks.js +1 -0
  24. package/lib/hooks/useMergedEventCallbacks.js.map +1 -1
  25. package/lib/hooks/useMergedRefs.js +1 -0
  26. package/lib/hooks/useMergedRefs.js.map +1 -1
  27. package/lib/hooks/useOnClickOutside.js +2 -1
  28. package/lib/hooks/useOnClickOutside.js.map +1 -1
  29. package/lib/hooks/useOnScrollOutside.js +1 -0
  30. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  31. package/lib/hooks/usePrevious.js +4 -0
  32. package/lib/hooks/usePrevious.js.map +1 -1
  33. package/lib/hooks/useTimeout.js +2 -2
  34. package/lib/hooks/useTimeout.js.map +1 -1
  35. package/lib/index.js +5 -4
  36. package/lib/index.js.map +1 -1
  37. package/lib/ssr/SSRContext.js.map +1 -1
  38. package/lib/ssr/canUseDOM.js.map +1 -1
  39. package/lib/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
  40. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -0
  41. package/lib/{utils → trigger}/getTriggerChild.js +2 -0
  42. package/lib/trigger/getTriggerChild.js.map +1 -0
  43. package/lib/trigger/index.js +5 -0
  44. package/lib/trigger/index.js.map +1 -0
  45. package/lib/{utils → trigger}/isFluentTrigger.js +0 -0
  46. package/lib/trigger/isFluentTrigger.js.map +1 -0
  47. package/lib/trigger/types.js +2 -0
  48. package/lib/trigger/types.js.map +1 -0
  49. package/lib/utils/clamp.js +1 -0
  50. package/lib/utils/clamp.js.map +1 -1
  51. package/lib/utils/getNativeElementProps.js +4 -2
  52. package/lib/utils/getNativeElementProps.js.map +1 -1
  53. package/lib/utils/getRTLSafeKey.js +1 -0
  54. package/lib/utils/getRTLSafeKey.js.map +1 -1
  55. package/lib/utils/getReactCallbackName.js.map +1 -1
  56. package/lib/utils/index.js +0 -3
  57. package/lib/utils/index.js.map +1 -1
  58. package/lib/utils/omit.js.map +1 -1
  59. package/lib/utils/properties.js +18 -6
  60. package/lib/utils/properties.js.map +1 -1
  61. package/lib/utils/shouldPreventDefaultOnKeyDown.js +5 -0
  62. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  63. package/lib-commonjs/compose/getSlots.js.map +1 -1
  64. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  65. package/lib-commonjs/compose/types.js +1 -5
  66. package/lib-commonjs/compose/types.js.map +1 -1
  67. package/lib-commonjs/hooks/index.js +2 -10
  68. package/lib-commonjs/hooks/index.js.map +1 -1
  69. package/lib-commonjs/hooks/useControllableState.js +3 -3
  70. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  71. package/lib-commonjs/hooks/useEventCallback.js +1 -0
  72. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  73. package/lib-commonjs/hooks/useFirstMount.js +1 -0
  74. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  75. package/lib-commonjs/hooks/useForceUpdate.js +1 -0
  76. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  77. package/lib-commonjs/hooks/useId.js +9 -5
  78. package/lib-commonjs/hooks/useId.js.map +1 -1
  79. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +1 -0
  80. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  81. package/lib-commonjs/hooks/useMergedEventCallbacks.js +1 -0
  82. package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -1
  83. package/lib-commonjs/hooks/useMergedRefs.js +1 -0
  84. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  85. package/lib-commonjs/hooks/useOnClickOutside.js +2 -1
  86. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  87. package/lib-commonjs/hooks/useOnScrollOutside.js +1 -0
  88. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  89. package/lib-commonjs/hooks/usePrevious.js +4 -0
  90. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  91. package/lib-commonjs/hooks/useTimeout.js +2 -3
  92. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  93. package/lib-commonjs/index.js +161 -5
  94. package/lib-commonjs/index.js.map +1 -1
  95. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  96. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  97. package/lib-commonjs/{utils → trigger}/applyTriggerPropsToChildren.js +1 -0
  98. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -0
  99. package/lib-commonjs/{utils → trigger}/getTriggerChild.js +2 -0
  100. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -0
  101. package/lib-commonjs/trigger/index.js +16 -0
  102. package/lib-commonjs/trigger/index.js.map +1 -0
  103. package/lib-commonjs/{utils → trigger}/isFluentTrigger.js +0 -0
  104. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -0
  105. package/lib-commonjs/trigger/types.js +6 -0
  106. package/lib-commonjs/trigger/types.js.map +1 -0
  107. package/lib-commonjs/utils/clamp.js +1 -0
  108. package/lib-commonjs/utils/clamp.js.map +1 -1
  109. package/lib-commonjs/utils/getNativeElementProps.js +3 -1
  110. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  111. package/lib-commonjs/utils/getRTLSafeKey.js +1 -0
  112. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  113. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  114. package/lib-commonjs/utils/index.js +0 -6
  115. package/lib-commonjs/utils/index.js.map +1 -1
  116. package/lib-commonjs/utils/omit.js.map +1 -1
  117. package/lib-commonjs/utils/properties.js +19 -7
  118. package/lib-commonjs/utils/properties.js.map +1 -1
  119. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +5 -0
  120. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  121. package/package.json +13 -13
  122. package/lib/compose/getSlots.d.ts +0 -30
  123. package/lib/compose/index.d.ts +0 -3
  124. package/lib/compose/resolveShorthand.d.ts +0 -16
  125. package/lib/compose/types.d.ts +0 -155
  126. package/lib/hooks/index.d.ts +0 -16
  127. package/lib/hooks/useBoolean.d.ts +0 -17
  128. package/lib/hooks/useBoolean.js +0 -28
  129. package/lib/hooks/useBoolean.js.map +0 -1
  130. package/lib/hooks/useConst.d.ts +0 -12
  131. package/lib/hooks/useConst.js +0 -30
  132. package/lib/hooks/useConst.js.map +0 -1
  133. package/lib/hooks/useControllableState.d.ts +0 -31
  134. package/lib/hooks/useEventCallback.d.ts +0 -13
  135. package/lib/hooks/useFirstMount.d.ts +0 -11
  136. package/lib/hooks/useForceUpdate.d.ts +0 -4
  137. package/lib/hooks/useId.d.ts +0 -15
  138. package/lib/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
  139. package/lib/hooks/useMergedEventCallbacks.d.ts +0 -18
  140. package/lib/hooks/useMergedRefs.d.ts +0 -13
  141. package/lib/hooks/useMount.d.ts +0 -6
  142. package/lib/hooks/useMount.js +0 -17
  143. package/lib/hooks/useMount.js.map +0 -1
  144. package/lib/hooks/useOnClickOutside.d.ts +0 -29
  145. package/lib/hooks/useOnScrollOutside.d.ts +0 -5
  146. package/lib/hooks/usePrevious.d.ts +0 -1
  147. package/lib/hooks/useTimeout.d.ts +0 -8
  148. package/lib/hooks/useUnmount.d.ts +0 -6
  149. package/lib/hooks/useUnmount.js +0 -17
  150. package/lib/hooks/useUnmount.js.map +0 -1
  151. package/lib/index.d.ts +0 -4
  152. package/lib/ssr/SSRContext.d.ts +0 -33
  153. package/lib/ssr/canUseDOM.d.ts +0 -4
  154. package/lib/ssr/index.d.ts +0 -2
  155. package/lib/utils/applyTriggerPropsToChildren.d.ts +0 -5
  156. package/lib/utils/applyTriggerPropsToChildren.js.map +0 -1
  157. package/lib/utils/clamp.d.ts +0 -8
  158. package/lib/utils/getNativeElementProps.d.ts +0 -31
  159. package/lib/utils/getRTLSafeKey.d.ts +0 -4
  160. package/lib/utils/getReactCallbackName.d.ts +0 -25
  161. package/lib/utils/getTriggerChild.d.ts +0 -22
  162. package/lib/utils/getTriggerChild.js.map +0 -1
  163. package/lib/utils/index.d.ts +0 -9
  164. package/lib/utils/isFluentTrigger.d.ts +0 -22
  165. package/lib/utils/isFluentTrigger.js.map +0 -1
  166. package/lib/utils/omit.d.ts +0 -14
  167. package/lib/utils/properties.d.ts +0 -148
  168. package/lib/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
  169. package/lib-commonjs/compose/getSlots.d.ts +0 -30
  170. package/lib-commonjs/compose/index.d.ts +0 -3
  171. package/lib-commonjs/compose/resolveShorthand.d.ts +0 -16
  172. package/lib-commonjs/compose/types.d.ts +0 -155
  173. package/lib-commonjs/hooks/index.d.ts +0 -16
  174. package/lib-commonjs/hooks/useBoolean.d.ts +0 -17
  175. package/lib-commonjs/hooks/useBoolean.js +0 -39
  176. package/lib-commonjs/hooks/useBoolean.js.map +0 -1
  177. package/lib-commonjs/hooks/useConst.d.ts +0 -12
  178. package/lib-commonjs/hooks/useConst.js +0 -40
  179. package/lib-commonjs/hooks/useConst.js.map +0 -1
  180. package/lib-commonjs/hooks/useControllableState.d.ts +0 -31
  181. package/lib-commonjs/hooks/useEventCallback.d.ts +0 -13
  182. package/lib-commonjs/hooks/useFirstMount.d.ts +0 -11
  183. package/lib-commonjs/hooks/useForceUpdate.d.ts +0 -4
  184. package/lib-commonjs/hooks/useId.d.ts +0 -15
  185. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.d.ts +0 -11
  186. package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +0 -18
  187. package/lib-commonjs/hooks/useMergedRefs.d.ts +0 -13
  188. package/lib-commonjs/hooks/useMount.d.ts +0 -6
  189. package/lib-commonjs/hooks/useMount.js +0 -27
  190. package/lib-commonjs/hooks/useMount.js.map +0 -1
  191. package/lib-commonjs/hooks/useOnClickOutside.d.ts +0 -29
  192. package/lib-commonjs/hooks/useOnScrollOutside.d.ts +0 -5
  193. package/lib-commonjs/hooks/usePrevious.d.ts +0 -1
  194. package/lib-commonjs/hooks/useTimeout.d.ts +0 -8
  195. package/lib-commonjs/hooks/useUnmount.d.ts +0 -6
  196. package/lib-commonjs/hooks/useUnmount.js +0 -27
  197. package/lib-commonjs/hooks/useUnmount.js.map +0 -1
  198. package/lib-commonjs/index.d.ts +0 -4
  199. package/lib-commonjs/ssr/SSRContext.d.ts +0 -33
  200. package/lib-commonjs/ssr/canUseDOM.d.ts +0 -4
  201. package/lib-commonjs/ssr/index.d.ts +0 -2
  202. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +0 -5
  203. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +0 -1
  204. package/lib-commonjs/utils/clamp.d.ts +0 -8
  205. package/lib-commonjs/utils/getNativeElementProps.d.ts +0 -31
  206. package/lib-commonjs/utils/getRTLSafeKey.d.ts +0 -4
  207. package/lib-commonjs/utils/getReactCallbackName.d.ts +0 -25
  208. package/lib-commonjs/utils/getTriggerChild.d.ts +0 -22
  209. package/lib-commonjs/utils/getTriggerChild.js.map +0 -1
  210. package/lib-commonjs/utils/index.d.ts +0 -9
  211. package/lib-commonjs/utils/isFluentTrigger.d.ts +0 -22
  212. package/lib-commonjs/utils/isFluentTrigger.js.map +0 -1
  213. package/lib-commonjs/utils/omit.d.ts +0 -14
  214. package/lib-commonjs/utils/properties.d.ts +0 -148
  215. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.d.ts +0 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useMergedRefs.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAQA;;;;;AAKG;;;AACH,SAAgB,aAAhB,CAAiC,GAAG,IAApC,EAAsE;AACpE,QAAM,cAAc,GAA0B,KAAK,CAAC,WAAN,CAC3C,KAAD,IAAa;AACX;AACE,IAAA,cAAwD,CAAC,OAAzD,GAAmE,KAAnE;;AAEF,SAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,UAAI,OAAO,GAAP,KAAe,UAAnB,EAA+B;AAC7B,QAAA,GAAG,CAAC,KAAD,CAAH;AACD,OAFD,MAEO,IAAI,GAAJ,EAAS;AACd;AACE,QAAA,GAA6C,CAAC,OAA9C,GAAwD,KAAxD;AACH;AACF;AACF,GAb2C,EAc5C;AACA,GAAC,GAAG,IAAJ,CAf4C,CAA9C;AAkBA,SAAO,cAAP;AACD;;AApBD,OAAA,CAAA,aAAA,GAAA,aAAA","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"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useMergedRefs.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AASA;;;;;;AAMG;;;AACH,SAAgB,aAAhB,CAAiC,GAAG,IAApC,EAAsE;EACpE,MAAM,cAAc,GAA0B,KAAK,CAAC,WAAN,CAC3C,KAAD,IAAa;IACX;IACE,cAAwD,CAAC,OAAzD,GAAmE,KAAnE;;IAEF,KAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;MACtB,IAAI,OAAO,GAAP,KAAe,UAAnB,EAA+B;QAC7B,GAAG,CAAC,KAAD,CAAH;MACD,CAFD,MAEO,IAAI,GAAJ,EAAS;QACd;QACE,GAA6C,CAAC,OAA9C,GAAwD,KAAxD;MACH;IACF;EACF,CAb2C,EAc5C;EACA,CAAC,GAAG,IAAJ,CAf4C,CAA9C;EAkBA,OAAO,cAAP;AACD;;AApBD,OAAA,CAAA,aAAA,GAAA,aAAA","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\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 * @internal\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"],"sourceRoot":"../src/"}
@@ -9,6 +9,7 @@ const React = /*#__PURE__*/require("react");
9
9
 
10
10
  const useEventCallback_1 = /*#__PURE__*/require("./useEventCallback");
11
11
  /**
12
+ * @internal
12
13
  * Utility to perform checks where a click/touch event was made outside a component
13
14
  */
14
15
 
@@ -128,7 +129,7 @@ const useIFrameFocus = (enableFrameFocusDispatch, targetDocument, callback, poll
128
129
  timeoutRef.current = (_a = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.defaultView) === null || _a === void 0 ? void 0 : _a.setInterval(() => {
129
130
  const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;
130
131
 
131
- if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME') {
132
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {
132
133
  const event = new CustomEvent(FUI_FRAME_EVENT, {
133
134
  bubbles: true
134
135
  });
@@ -1 +1 @@
1
- {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,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,UAAU,CAAC,OAA1B,CAA3B;AACD,KAFD;AAGD,GAbD,EAaG,CAAC,cAAD,EAAiB,wBAAjB,EAA2C,YAA3C,CAbH;AAcD,CAvCD","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\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 * 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(!disabled, element, callback as (e: Event) => void);\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\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 *\n * @param enableFrameFocusDispatch - boolean flag to start dispatching events\n * @param targetDocument - the document to dispatch events and set timeouts\n * @param pollDuration - in milliseconds\n */\nconst useIFrameFocus = (\n enableFrameFocusDispatch: boolean,\n targetDocument: Document | undefined,\n callback: (e: Event) => void,\n pollDuration: number = 1000,\n) => {\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n if (callback) {\n callback(e);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n }\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, enableFrameFocusDispatch, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n timeoutRef.current = targetDocument?.defaultView?.setInterval(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement?.tagName === 'IFRAME') {\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, enableFrameFocusDispatch, pollDuration]);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useOnClickOutside.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAiCA;;;AAGG;;;AACI,MAAM,iBAAiB,GAAI,OAAD,IAA8C;EAC7E,MAAM;IAAE,IAAF;IAAQ,QAAR;IAAkB,OAAlB;IAA2B,QAA3B;IAAqC,QAAQ,EAAE;EAA/C,IAAgE,OAAtE;EACA,MAAM,SAAS,GAAG,KAAK,CAAC,MAAN,CAAiC,SAAjC,CAAlB;EACA,cAAc,CAAC,CAAC,QAAF,EAAY,OAAZ,EAAqB,QAArB,CAAd;EAEA,MAAM,QAAQ,GAAG,kBAAA,CAAA,gBAAA,CAAkB,EAAD,IAAgC;IAChE,MAAM,QAAQ,GACZ,YAAY,KAAK,CAAC,MAAD,EAAS,KAAT,KAAmB,CAAC,EAAC,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,QAAR,CAAiB,KAAjB,CAAD,CAAzB,CADd;;IAGA,MAAM,SAAS,GAAG,IAAI,CAAC,KAAL,CAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAJ,IAAe,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IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,OAAf,MAA2B,SAAtE,EAAiF;UAC/E,MAAM,KAAK,GAAG,IAAI,WAAJ,CAAgB,eAAhB,EAAiC;YAAE,OAAO,EAAE;UAAX,CAAjC,CAAd;UACA,aAAa,CAAC,aAAd,CAA4B,KAA5B;QACD;MACF,CAN+C,EAM7C,YAN6C,CAAhD;IAOD;;IACD,OAAO,MAAK;;;MACV,CAAA,EAAA,GAAA,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,YAAF,CAAe,UAAU,CAAC,OAA1B,CAA3B;IACD,CAFD;EAGD,CAbD,EAaG,CAAC,cAAD,EAAiB,wBAAjB,EAA2C,YAA3C,CAbH;AAcD,CAvCD","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(!disabled, element, callback as (e: Event) => void);\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\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 *\n * @param enableFrameFocusDispatch - boolean flag to start dispatching events\n * @param targetDocument - the document to dispatch events and set timeouts\n * @param pollDuration - in milliseconds\n */\nconst useIFrameFocus = (\n enableFrameFocusDispatch: boolean,\n targetDocument: Document | undefined,\n callback: (e: Event) => void,\n pollDuration: number = 1000,\n) => {\n const timeoutRef = React.useRef<number>();\n\n const listener = useEventCallback((e: Event) => {\n if (callback) {\n callback(e);\n }\n });\n\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\n targetDocument?.addEventListener(FUI_FRAME_EVENT, listener, true);\n }\n return () => {\n targetDocument?.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, enableFrameFocusDispatch, listener]);\n\n // Starts polling for the active element\n React.useEffect(() => {\n if (enableFrameFocusDispatch) {\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, enableFrameFocusDispatch, pollDuration]);\n};\n"],"sourceRoot":"../src/"}
@@ -9,6 +9,7 @@ const React = /*#__PURE__*/require("react");
9
9
 
10
10
  const useEventCallback_1 = /*#__PURE__*/require("./useEventCallback");
11
11
  /**
12
+ * @internal
12
13
  * Utility to perform checks where a click/touch event was made outside a component
13
14
  */
14
15
 
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useOnScrollOutside.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,kBAAkB,GAAI,OAAD,IAA8C;AAC9E,QAAM;AAAE,IAA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AAA,OAAO,CAAE,mBAAT,CAA6B,WAA7B,EAA0C,QAA1C,CAAA;AACD,KAHD;AAID,GAVD,EAUG,CAAC,QAAD,EAAW,OAAX,EAAoB,QAApB,CAVH;AAWD,CAxBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = 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 if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useOnScrollOutside.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAGA;;;AAGG;;;AACI,MAAM,kBAAkB,GAAI,OAAD,IAA8C;EAC9E,MAAM;IAAE,IAAF;IAAQ,QAAR;IAAkB,OAAlB;IAA2B,QAA3B;IAAqC,QAAQ,EAAE;EAA/C,IAAgE,OAAtE;EAEA,MAAM,QAAQ,GAAG,kBAAA,CAAA,gBAAA,CAAkB,EAAD,IAAgC;IAChE,MAAM,QAAQ,GACZ,YAAY,KAAK,CAAC,MAAD,EAAS,KAAT,KAAmB,CAAC,EAAC,MAAM,KAAA,IAAN,IAAA,MAAM,KAAA,KAAA,CAAN,GAAM,KAAA,CAAN,GAAA,MAAM,CAAE,QAAR,CAAiB,KAAjB,CAAD,CAAzB,CADd;;IAGA,MAAM,SAAS,GAAG,IAAI,CAAC,KAAL,CAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAJ,IAAe,IAAhB,EAAsB,EAAE,CAAC,MAAzB,CAA3B,CAAlB;;IACA,IAAI,SAAS,IAAI,CAAC,QAAlB,EAA4B;MAC1B,QAAQ,CAAC,EAAD,CAAR;IACD;EACF,CARgB,CAAjB;EAUA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,IAAI,CAAC,QAAL,EAAe;MACb,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,gBAAT,CAA0B,OAA1B,EAAmC,QAAnC,CAAA;MACA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,gBAAT,CAA0B,WAA1B,EAAuC,QAAvC,CAAA;IACD;;IAED,OAAO,MAAK;MACV,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,mBAAT,CAA6B,OAA7B,EAAsC,QAAtC,CAAA;MACA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,mBAAT,CAA6B,WAA7B,EAA0C,QAA1C,CAAA;IACD,CAHD;EAID,CAVD,EAUG,CAAC,QAAD,EAAW,OAAX,EAAoB,QAApB,CAVH;AAWD,CAxBM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\nimport type { UseOnClickOrScrollOutsideOptions } from './useOnClickOutside';\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = 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 if (!disabled) {\n element?.addEventListener('wheel', listener);\n element?.addEventListener('touchmove', listener);\n }\n\n return () => {\n element?.removeEventListener('wheel', listener);\n element?.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n"],"sourceRoot":"../src/"}
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.usePrevious = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
+ /**
10
+ * @internal
11
+ */
12
+
9
13
 
10
14
  const usePrevious = value => {
11
15
  const ref = React.useRef(null);
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/usePrevious.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEO,MAAM,WAAW,GAAyB,KAAtB,IAA0C;AACnE,QAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAA+B,IAA/B,CAAZ;AACA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAK;AACnB,IAAA,GAAG,CAAC,OAAJ,GAAc,KAAd;AACD,GAFD,EAEG,CAAC,KAAD,CAFH;AAGA,SAAO,GAAG,CAAC,OAAX;AACD,CANM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX","sourcesContent":["import * as React from 'react';\n\nexport const usePrevious = <ValueType = unknown>(value: ValueType) => {\n const ref = React.useRef<ValueType | null>(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/usePrevious.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,WAAW,GAAyB,KAAtB,IAA0C;EACnE,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAA+B,IAA/B,CAAZ;EACA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,GAAG,CAAC,OAAJ,GAAc,KAAd;EACD,CAFD,EAEG,CAAC,KAAD,CAFH;EAGA,OAAO,GAAG,CAAC,OAAX;AACD,CANM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n */\nexport const usePrevious = <ValueType = unknown>(value: ValueType) => {\n const ref = React.useRef<ValueType | null>(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n};\n"],"sourceRoot":"../src/"}
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useTimeout = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
-
10
- const useConst_1 = /*#__PURE__*/require("./useConst");
11
9
  /**
10
+ * @internal
12
11
  * Helper to manage a browser timeout.
13
12
  * Ensures that the timeout isn't set multiple times at once,
14
13
  * and is cleaned up when the component is unloaded.
@@ -18,7 +17,7 @@ const useConst_1 = /*#__PURE__*/require("./useConst");
18
17
 
19
18
 
20
19
  function useTimeout() {
21
- const timeout = useConst_1.useConst(() => ({
20
+ const [timeout] = React.useState(() => ({
22
21
  id: undefined,
23
22
  set: (fn, delay) => {
24
23
  timeout.clear();
@@ -1 +1 @@
1
- {"version":3,"sources":["hooks/useTimeout.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;AAEA;;;;;;AAMG;;;AACH,SAAgB,UAAhB,GAA0B;AACxB,QAAM,OAAO,GAAG,UAAA,CAAA,QAAA,CAAS,OAAO;AAC9B,IAAA,EAAE,EAAE,SAD0B;AAE9B,IAAA,GAAG,EAAE,CAAC,EAAD,EAAiB,KAAjB,KAAkC;AACrC,MAAA,OAAO,CAAC,KAAR;AACA,MAAA,OAAO,CAAC,EAAR,GAAa,UAAU,CAAC,EAAD,EAAK,KAAL,CAAvB;AACD,KAL6B;AAM9B,IAAA,KAAK,EAAE,MAAK;AACV,UAAI,OAAO,CAAC,EAAR,KAAe,SAAnB,EAA8B;AAC5B,QAAA,YAAY,CAAC,OAAO,CAAC,EAAT,CAAZ;AACA,QAAA,OAAO,CAAC,EAAR,GAAa,SAAb;AACD;AACF;AAX6B,GAAP,CAAT,CAAhB,CADwB,CAexB;;AACA,EAAA,KAAK,CAAC,SAAN,CAAgB,MAAM,OAAO,CAAC,KAA9B,EAAqC,CAAC,OAAD,CAArC;AAEA,SAAO,CAAC,OAAO,CAAC,GAAT,EAAc,OAAO,CAAC,KAAtB,CAAP;AACD;;AAnBD,OAAA,CAAA,UAAA,GAAA,UAAA","sourcesContent":["import * as React from 'react';\nimport { useConst } from './useConst';\n\n/**\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const timeout = useConst(() => ({\n id: undefined as ReturnType<typeof setTimeout> | undefined,\n set: (fn: () => void, delay: number) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n },\n }));\n\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n\n return [timeout.set, timeout.clear] as const;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["hooks/useTimeout.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;AAEA;;;;;;;AAOG;;;AACH,SAAgB,UAAhB,GAA0B;EACxB,MAAM,CAAC,OAAD,IAAY,KAAK,CAAC,QAAN,CAAe,OAAO;IACtC,EAAE,EAAE,SADkC;IAEtC,GAAG,EAAE,CAAC,EAAD,EAAiB,KAAjB,KAAkC;MACrC,OAAO,CAAC,KAAR;MACA,OAAO,CAAC,EAAR,GAAa,UAAU,CAAC,EAAD,EAAK,KAAL,CAAvB;IACD,CALqC;IAMtC,KAAK,EAAE,MAAK;MACV,IAAI,OAAO,CAAC,EAAR,KAAe,SAAnB,EAA8B;QAC5B,YAAY,CAAC,OAAO,CAAC,EAAT,CAAZ;QACA,OAAO,CAAC,EAAR,GAAa,SAAb;MACD;IACF;EAXqC,CAAP,CAAf,CAAlB,CADwB,CAexB;;EACA,KAAK,CAAC,SAAN,CAAgB,MAAM,OAAO,CAAC,KAA9B,EAAqC,CAAC,OAAD,CAArC;EAEA,OAAO,CAAC,OAAO,CAAC,GAAT,EAAc,OAAO,CAAC,KAAtB,CAAP;AACD;;AAnBD,OAAA,CAAA,UAAA,GAAA,UAAA","sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const [timeout] = React.useState(() => ({\n id: undefined as ReturnType<typeof setTimeout> | undefined,\n set: (fn: () => void, delay: number) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n },\n }));\n\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n\n return [timeout.set, timeout.clear] as const;\n}\n"],"sourceRoot":"../src/"}
@@ -3,14 +3,170 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.getTriggerChild = exports.applyTriggerPropsToChildren = exports.shouldPreventDefaultOnKeyDown = exports.getRTLSafeKey = exports.getPartitionedNativeProps = exports.getNativeElementProps = exports.clamp = exports.SSRProvider = exports.useIsSSR = exports.canUseDOM = exports.useTimeout = exports.usePrevious = exports.useOnScrollOutside = exports.useOnClickOutside = exports.useMergedRefs = exports.useMergedEventCallbacks = exports.useIsomorphicLayoutEffect = exports.useId = exports.useForceUpdate = exports.useFirstMount = exports.useEventCallback = exports.useControllableState = exports.resetIdsForTests = exports.resolveShorthand = exports.getSlots = void 0;
6
7
 
7
- const tslib_1 = /*#__PURE__*/require("tslib");
8
+ var index_1 = /*#__PURE__*/require("./compose/index");
8
9
 
9
- tslib_1.__exportStar(require("./compose/index"), exports);
10
+ Object.defineProperty(exports, "getSlots", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return index_1.getSlots;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "resolveShorthand", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return index_1.resolveShorthand;
20
+ }
21
+ });
22
+
23
+ var index_2 = /*#__PURE__*/require("./hooks/index");
24
+
25
+ Object.defineProperty(exports, "resetIdsForTests", {
26
+ enumerable: true,
27
+ get: function () {
28
+ return index_2.resetIdsForTests;
29
+ }
30
+ });
31
+ Object.defineProperty(exports, "useControllableState", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return index_2.useControllableState;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, "useEventCallback", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return index_2.useEventCallback;
41
+ }
42
+ });
43
+ Object.defineProperty(exports, "useFirstMount", {
44
+ enumerable: true,
45
+ get: function () {
46
+ return index_2.useFirstMount;
47
+ }
48
+ });
49
+ Object.defineProperty(exports, "useForceUpdate", {
50
+ enumerable: true,
51
+ get: function () {
52
+ return index_2.useForceUpdate;
53
+ }
54
+ });
55
+ Object.defineProperty(exports, "useId", {
56
+ enumerable: true,
57
+ get: function () {
58
+ return index_2.useId;
59
+ }
60
+ });
61
+ Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
62
+ enumerable: true,
63
+ get: function () {
64
+ return index_2.useIsomorphicLayoutEffect;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, "useMergedEventCallbacks", {
68
+ enumerable: true,
69
+ get: function () {
70
+ return index_2.useMergedEventCallbacks;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, "useMergedRefs", {
74
+ enumerable: true,
75
+ get: function () {
76
+ return index_2.useMergedRefs;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, "useOnClickOutside", {
80
+ enumerable: true,
81
+ get: function () {
82
+ return index_2.useOnClickOutside;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, "useOnScrollOutside", {
86
+ enumerable: true,
87
+ get: function () {
88
+ return index_2.useOnScrollOutside;
89
+ }
90
+ });
91
+ Object.defineProperty(exports, "usePrevious", {
92
+ enumerable: true,
93
+ get: function () {
94
+ return index_2.usePrevious;
95
+ }
96
+ });
97
+ Object.defineProperty(exports, "useTimeout", {
98
+ enumerable: true,
99
+ get: function () {
100
+ return index_2.useTimeout;
101
+ }
102
+ });
10
103
 
11
- tslib_1.__exportStar(require("./hooks/index"), exports);
104
+ var index_3 = /*#__PURE__*/require("./ssr/index");
105
+
106
+ Object.defineProperty(exports, "canUseDOM", {
107
+ enumerable: true,
108
+ get: function () {
109
+ return index_3.canUseDOM;
110
+ }
111
+ });
112
+ Object.defineProperty(exports, "useIsSSR", {
113
+ enumerable: true,
114
+ get: function () {
115
+ return index_3.useIsSSR;
116
+ }
117
+ });
118
+ Object.defineProperty(exports, "SSRProvider", {
119
+ enumerable: true,
120
+ get: function () {
121
+ return index_3.SSRProvider;
122
+ }
123
+ });
12
124
 
13
- tslib_1.__exportStar(require("./ssr/index"), exports);
125
+ var index_4 = /*#__PURE__*/require("./utils/index");
14
126
 
15
- tslib_1.__exportStar(require("./utils/index"), exports);
127
+ Object.defineProperty(exports, "clamp", {
128
+ enumerable: true,
129
+ get: function () {
130
+ return index_4.clamp;
131
+ }
132
+ });
133
+ Object.defineProperty(exports, "getNativeElementProps", {
134
+ enumerable: true,
135
+ get: function () {
136
+ return index_4.getNativeElementProps;
137
+ }
138
+ });
139
+ Object.defineProperty(exports, "getPartitionedNativeProps", {
140
+ enumerable: true,
141
+ get: function () {
142
+ return index_4.getPartitionedNativeProps;
143
+ }
144
+ });
145
+ Object.defineProperty(exports, "getRTLSafeKey", {
146
+ enumerable: true,
147
+ get: function () {
148
+ return index_4.getRTLSafeKey;
149
+ }
150
+ });
151
+ Object.defineProperty(exports, "shouldPreventDefaultOnKeyDown", {
152
+ enumerable: true,
153
+ get: function () {
154
+ return index_4.shouldPreventDefaultOnKeyDown;
155
+ }
156
+ });
157
+
158
+ var index_5 = /*#__PURE__*/require("./trigger/index");
159
+
160
+ Object.defineProperty(exports, "applyTriggerPropsToChildren", {
161
+ enumerable: true,
162
+ get: function () {
163
+ return index_5.applyTriggerPropsToChildren;
164
+ }
165
+ });
166
+ Object.defineProperty(exports, "getTriggerChild", {
167
+ enumerable: true,
168
+ get: function () {
169
+ return index_5.getTriggerChild;
170
+ }
171
+ });
16
172
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './compose/index';\nexport * from './hooks/index';\nexport * from './ssr/index';\nexport * from './utils/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,OAAA,gBAAA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,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,6BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,2BAAA;EAA2B;AAA3B,CAAA;AAA6B,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,iBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,OAAA,CAAA,eAAA;EAAe;AAAf,CAAA","sourcesContent":["export { getSlots, resolveShorthand } from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n} from './compose/index';\n\nexport {\n resetIdsForTests,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedEventCallbacks,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n shouldPreventDefaultOnKeyDown,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild } from './trigger/index';\n\nexport type { FluentTriggerComponent } from './trigger/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["ssr/SSRContext.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAYA;;;;AAIG;;;AACU,OAAA,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AGD;;AAED,SAAO,KAAP;AACD;;AA5BD,OAAA,CAAA,QAAA,GAAA,QAAA","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue>(defaultSSRContextValue);\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext);\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\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;EACF,CAdqB,CAgBtB;EACA;;;EACA,IAAI,WAAA,CAAA,SAAA,MAAe,cAAnB,EAAmC;IACjC;IACA;IACA;IACA,KAAK,CAAC,eAAN,CAAsB,MAAK;MACzB,QAAQ,CAAC,KAAD,CAAR;IACD,CAFD,EAEG,EAFH;EAGD;;EAED,OAAO,KAAP;AACD;;AA5BD,OAAA,CAAA,QAAA,GAAA,QAAA","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue>(defaultSSRContextValue);\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext);\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["ssr/canUseDOM.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACH,SAAgB,SAAhB,GAAyB;AACvB,SACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;AACA,EAAA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD;;AATD,OAAA,CAAA,SAAA,GAAA,SAAA","sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement\n )\n );\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["ssr/canUseDOM.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACH,SAAgB,SAAhB,GAAyB;EACvB,OACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;EACA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD;;AATD,OAAA,CAAA,SAAA,GAAA,SAAA","sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement\n )\n );\n}\n"],"sourceRoot":"../src/"}
@@ -9,6 +9,7 @@ const React = /*#__PURE__*/require("react");
9
9
 
10
10
  const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
11
11
  /**
12
+ * @internal
12
13
  * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
13
14
  */
14
15
 
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["trigger/applyTriggerPropsToChildren.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;AAGG;;;AACI,MAAM,2BAA2B,GAAG,CACzC,QADyC,EAEzC,YAFyC,KAGZ;EAC7B,IAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;IAClC,OAAO,QAAQ,CAAC,YAAD,CAAf;EACD,CAFD,MAEO,IAAI,QAAJ,EAAc;IACnB,OAAO,gBAAgB,CAAC,QAAD,EAAW,YAAX,CAAvB;EACD,CAL4B,CAO7B;EACA;EACA;;;EACA,OAAO,QAAQ,IAAI,IAAnB;AACD,CAdM;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B;AAgBb;;;AAGG;;AACH,MAAM,gBAAgB,GAAG,CAAgB,KAAhB,EAAwC,YAAxC,KAA2F;EAClH,IAAI,CAAC,KAAK,CAAC,cAAN,CAAqB,KAArB,CAAD,IAAgC,KAAK,CAAC,IAAN,KAAe,KAAK,CAAC,QAAzD,EAAmE;IACjE,MAAM,IAAI,KAAJ,CACJ,oEACE,sDAFE,CAAN;EAID;;EAED,IAAI,iBAAA,CAAA,eAAA,CAAgB,KAAhB,CAAJ,EAA4B;IAC1B,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAN,CAAY,QAAb,EAAuB,YAAvB,CAAnC;IACA,OAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,SAA1B,EAAqC,UAArC,CAAP;EACD,CAHD,MAGO;IACL,OAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,YAA1B,CAAP;EACD;AACF,CAdD","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n\n/**\n * @internal\n * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport const applyTriggerPropsToChildren = <TTriggerProps>(\n children: React.ReactElement | ((props: TTriggerProps) => React.ReactElement | null) | null | undefined,\n triggerProps: TTriggerProps,\n): React.ReactElement | null => {\n if (typeof children === 'function') {\n return children(triggerProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerProps);\n }\n\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n};\n\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */\nconst cloneTriggerTree = <TTriggerProps>(child: React.ReactNode, triggerProps: TTriggerProps): React.ReactElement => {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error(\n 'A trigger element must be a single element for this component. ' +\n \"Please ensure that you're not using React Fragments.\",\n );\n }\n\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps);\n }\n};\n"],"sourceRoot":"../src/"}
@@ -9,6 +9,7 @@ const React = /*#__PURE__*/require("react");
9
9
 
10
10
  const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
11
11
  /**
12
+ * @internal
12
13
  * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
13
14
  *
14
15
  * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
@@ -26,6 +27,7 @@ const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
26
27
  * );
27
28
  * ```
28
29
  */
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
31
 
30
32
 
31
33
  const getTriggerChild = children => {
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["trigger/getTriggerChild.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;;;;;;;;;;;;;;;;AAkBG;AACH;;;AACO,MAAM,eAAe,GAC1B,QAD6B,IAE2B;EACxD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAN,CAAe,IAAf,CAAoB,QAApB,CAAd;EACA,OAAO,iBAAA,CAAA,eAAA,CAAgB,KAAhB,IAAyB,OAAA,CAAA,eAAA,CAAgB,KAAK,CAAC,KAAN,CAAY,QAA5B,CAAzB,GAAiE,KAAxE;AACD,CALM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n\n/**\n * @internal\n * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).\n *\n * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,\n * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.\n * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.\n *\n * For example, the following returns `<div id=\"child\" />`:\n * ```jsx\n * getTriggerChild(\n * <Tooltip>\n * <MenuTrigger>\n * <div id=\"child\" />\n * </MenuTrigger>\n * </Tooltip>\n * );\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const getTriggerChild = <P = any>(\n children: React.ReactNode,\n): React.ReactElement<P> & { ref?: React.Ref<unknown> } => {\n const child = React.Children.only(children) as React.ReactElement;\n return isFluentTrigger(child) ? getTriggerChild(child.props.children) : child;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./applyTriggerPropsToChildren"), exports);
10
+
11
+ tslib_1.__exportStar(require("./getTriggerChild"), exports);
12
+
13
+ tslib_1.__exportStar(require("./isFluentTrigger"), exports);
14
+
15
+ tslib_1.__exportStar(require("./types"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["trigger/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["trigger/isFluentTrigger.ts"],"names":[],"mappings":";;;;;;AAGA;;;AAGG;;AACI,MAAM,eAAe,GAAI,OAAD,IAAgC;EAC7D,OAAQ,OAAO,CAAC,IAAR,CAAwC,wBAAhD;AACD,CAFM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\nimport { FluentTriggerComponent } from './types';\n\n/**\n * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n */\nexport const isFluentTrigger = (element: React.ReactElement) => {\n return (element.type as FluentTriggerComponent).isFluentTriggerComponent;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.clamp = void 0;
7
7
  /**
8
+ * @internal
8
9
  * Clamps `value` to a number between the min and max.
9
10
  *
10
11
  * @param value - the value to be clamped
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/clamp.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;;AACI,MAAM,KAAK,GAAG,CAAC,KAAD,EAAgB,GAAhB,EAA6B,GAA7B,KAAqD,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,KAAK,IAAI,CAAvB,CAAd,CAAnE;;AAAM,OAAA,CAAA,KAAA,GAAK,KAAL","sourcesContent":["/**\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/clamp.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAOG;;AACI,MAAM,KAAK,GAAG,CAAC,KAAD,EAAgB,GAAhB,EAA6B,GAA7B,KAAqD,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,KAAK,IAAI,CAAvB,CAAd,CAAnE;;AAAM,OAAA,CAAA,KAAA,GAAK,KAAL","sourcesContent":["/**\n * @internal\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"],"sourceRoot":"../src/"}
@@ -25,9 +25,11 @@ const nativeElementMap = {
25
25
  td: properties_1.tdProperties,
26
26
  colGroup: properties_1.colGroupProperties,
27
27
  col: properties_1.colProperties,
28
+ fieldset: properties_1.fieldsetProperties,
28
29
  form: properties_1.formProperties,
29
30
  iframe: properties_1.iframeProperties,
30
- img: properties_1.imgProperties
31
+ img: properties_1.imgProperties,
32
+ time: properties_1.timeProperties
31
33
  };
32
34
  /**
33
35
  * Given an element tagname and user props, filters the props to only allowed props for the given
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getNativeElementProps.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AAyBA,MAAM,gBAAgB,GAA2C;AAC/D,EAAA,KAAK,EAAE,YAAA,CAAA,eADwD;AAE/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAFwD;AAG/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAHwD;AAI/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAJ2D;AAK/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAL2D;AAM/D,EAAA,CAAC,EAAE,YAAA,CAAA,gBAN4D;AAO/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAPuD;AAQ/D,EAAA,KAAK,EAAE,YAAA,CAAA,eARwD;AAS/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBATqD;AAU/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAVuD;AAW/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAXuD;AAY/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAZwD;AAa/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAb2D;AAc/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAd2D;AAe/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAf2D;AAgB/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBAhBqD;AAiB/D,EAAA,GAAG,EAAE,YAAA,CAAA,aAjB0D;AAkB/D,EAAA,IAAI,EAAE,YAAA,CAAA,cAlByD;AAmB/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAnBuD;AAoB/D,EAAA,GAAG,EAAE,YAAA,CAAA;AApB0D,CAAjE;AAuBA;;;;;;AAMG;AACH;;AACA,SAAgB,qBAAhB,CACE,OADF,EAEE,KAFF,EAGE,iBAHF,EAG8B;AAE5B,QAAM,gBAAgB,GAAI,OAAO,IAAI,gBAAgB,CAAC,OAAD,CAA5B,IAA0C,YAAA,CAAA,qBAAnE;AACA,EAAA,gBAAgB,CAAC,EAAjB,GAAsB,CAAtB;AAEA,SAAO,YAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,gBAAtB,EAAwC,iBAAxC,CAAP;AACD;;AATD,OAAA,CAAA,qBAAA,GAAA,qBAAA;AAWA;;;;;;;AAOG;;AACI,MAAM,yBAAyB,GAAG,CAGvC;AACA,EAAA,kBADA;AAEA,EAAA,KAFA;AAGA,EAAA;AAHA,CAHuC,KAgBpC;AACH,SAAO;AACL,IAAA,IAAI,EAAE;AAAE,MAAA,KAAK,EAAE,KAAK,CAAC,KAAf;AAAsB,MAAA,SAAS,EAAE,KAAK,CAAC;AAAvC,KADD;AAEL,IAAA,OAAO,EAAE,qBAAqB,CAAgC,kBAAhC,EAAoD,KAApD,EAA2D,CACvF,IAAI,iBAAiB,IAAI,EAAzB,CADuF,EAEvF,OAFuF,EAGvF,WAHuF,CAA3D;AAFzB,GAAP;AAQD,CAzBM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/getNativeElementProps.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AA2BA,MAAM,gBAAgB,GAA2C;EAC/D,KAAK,EAAE,YAAA,CAAA,eADwD;EAE/D,KAAK,EAAE,YAAA,CAAA,eAFwD;EAG/D,KAAK,EAAE,YAAA,CAAA,eAHwD;EAI/D,EAAE,EAAE,YAAA,CAAA,YAJ2D;EAK/D,EAAE,EAAE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,EAAE,KAAK,CAAC;IAAvC,CADD;IAEL,OAAO,EAAE,qBAAqB,CAAgC,kBAAhC,EAAoD,KAApD,EAA2D,CACvF,IAAI,iBAAiB,IAAI,EAAzB,CADuF,EAEvF,OAFuF,EAGvF,WAHuF,CAA3D;EAFzB,CAAP;AAQD,CAzBM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n fieldsetProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n timeProperties,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n fieldset: fieldsetProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n time: timeProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getRTLSafeKey = void 0;
7
7
  /**
8
+ * @internal
8
9
  * Finds and swaps a provided key for it's right to left format.
9
10
  */
10
11
 
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getRTLSafeKey.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACI,MAAM,aAAa,GAAG,CAAC,GAAD,EAAc,GAAd,KAAoC;AAC/D,MAAI,GAAG,KAAK,KAAZ,EAAmB;AACjB,YAAQ,GAAR;AACE,WAAK,WAAL;AAAkB;AAChB,iBAAO,YAAP;AACD;;AAED,WAAK,YAAL;AAAmB;AACjB,iBAAO,WAAP;AACD;AAPH;AASD;;AAED,SAAO,GAAP;AACD,CAdM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourcesContent":["/**\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/getRTLSafeKey.ts"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;;AACI,MAAM,aAAa,GAAG,CAAC,GAAD,EAAc,GAAd,KAAoC;EAC/D,IAAI,GAAG,KAAK,KAAZ,EAAmB;IACjB,QAAQ,GAAR;MACE,KAAK,WAAL;QAAkB;UAChB,OAAO,YAAP;QACD;;MAED,KAAK,YAAL;QAAmB;UACjB,OAAO,WAAP;QACD;IAPH;EASD;;EAED,OAAO,GAAP;AACD,CAdM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourcesContent":["/**\n * @internal\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/getReactCallbackName.ts"],"names":[],"mappings":";;;;;;AAwBA;;;;;;AAMG;;AACH,SAAgB,oBAAhB,CAAqC,KAArC,EAA+D;AAC7D,MAAI,KAAK,CAAC,UAAV,EAAsB;AACpB,WAAO,KAAK,CAAC,UAAb;AACD;;AAED,MAAI,KAAK,CAAC,cAAV,EAA0B;AACxB,QAAI,KAAK,CAAC,cAAN,CAAqB,gBAAzB,EAA2C;AACzC,aAAO,KAAK,CAAC,cAAN,CAAqB,gBAA5B;AACD;;AAED,WAAO,KAAK,CAAC,cAAN,CAAqB,uBAArB,CAA6C,OAApD;AACD;;AAED,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC;AACA,IAAA,OAAO,CAAC,KAAR,CAAc,CACZ,kFADY,EAEZ,mFAFY,CAAd;AAID;AACF;;AApBD,OAAA,CAAA,oBAAA,GAAA,oBAAA","sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error([\n 'Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\".',\n 'This should not happen, please report it to https://github.com/microsoft/fluentui',\n ]);\n }\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/getReactCallbackName.ts"],"names":[],"mappings":";;;;;;AAwBA;;;;;;AAMG;;AACH,SAAgB,oBAAhB,CAAqC,KAArC,EAA+D;EAC7D,IAAI,KAAK,CAAC,UAAV,EAAsB;IACpB,OAAO,KAAK,CAAC,UAAb;EACD;;EAED,IAAI,KAAK,CAAC,cAAV,EAA0B;IACxB,IAAI,KAAK,CAAC,cAAN,CAAqB,gBAAzB,EAA2C;MACzC,OAAO,KAAK,CAAC,cAAN,CAAqB,gBAA5B;IACD;;IAED,OAAO,KAAK,CAAC,cAAN,CAAqB,uBAArB,CAA6C,OAApD;EACD;;EAED,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;IACzC;IACA,OAAO,CAAC,KAAR,CAAc,CACZ,kFADY,EAEZ,mFAFY,CAAd;EAID;AACF;;AApBD,OAAA,CAAA,oBAAA,GAAA,oBAAA","sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error([\n 'Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\".',\n 'This should not happen, please report it to https://github.com/microsoft/fluentui',\n ]);\n }\n}\n"],"sourceRoot":"../src/"}
@@ -6,18 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
- tslib_1.__exportStar(require("./applyTriggerPropsToChildren"), exports);
10
-
11
9
  tslib_1.__exportStar(require("./clamp"), exports);
12
10
 
13
11
  tslib_1.__exportStar(require("./getNativeElementProps"), exports);
14
12
 
15
13
  tslib_1.__exportStar(require("./getRTLSafeKey"), exports);
16
14
 
17
- tslib_1.__exportStar(require("./getTriggerChild"), exports);
18
-
19
- tslib_1.__exportStar(require("./isFluentTrigger"), exports);
20
-
21
15
  tslib_1.__exportStar(require("./omit"), exports);
22
16
 
23
17
  tslib_1.__exportStar(require("./properties"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './omit';\nexport * from './properties';\nexport * from './shouldPreventDefaultOnKeyDown';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './omit';\nexport * from './properties';\nexport * from './shouldPreventDefaultOnKeyDown';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/omit.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;AAYG;AACH;;AACA,SAAgB,IAAhB,CACE,GADF,EAEE,UAFF,EAEwB;AAEtB;AACA,QAAM,MAAM,GAAwB,EAApC;;AAEA,OAAK,MAAM,GAAX,IAAkB,GAAlB,EAAuB;AACrB,QAAI,UAAU,CAAC,OAAX,CAAmB,GAAnB,MAA4B,CAAC,CAA7B,IAAkC,GAAG,CAAC,cAAJ,CAAmB,GAAnB,CAAtC,EAA+D;AAC7D,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,GAAG,CAAC,GAAD,CAAjB;AACD;AACF;;AAED,SAAO,MAAP;AACD;;AAdD,OAAA,CAAA,IAAA,GAAA,IAAA","sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["utils/omit.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;AAYG;AACH;;AACA,SAAgB,IAAhB,CACE,GADF,EAEE,UAFF,EAEwB;EAEtB;EACA,MAAM,MAAM,GAAwB,EAApC;;EAEA,KAAK,MAAM,GAAX,IAAkB,GAAlB,EAAuB;IACrB,IAAI,UAAU,CAAC,OAAX,CAAmB,GAAnB,MAA4B,CAAC,CAA7B,IAAkC,GAAG,CAAC,cAAJ,CAAmB,GAAnB,CAAtC,EAA+D;MAC7D,MAAM,CAAC,GAAD,CAAN,GAAc,GAAG,CAAC,GAAD,CAAjB;IACD;EACF;;EAED,OAAO,MAAP;AACD;;AAdD,OAAA,CAAA,IAAA,GAAA,IAAA","sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"],"sourceRoot":"../src/"}