@fluentui/react-utilities 0.0.0-nightly-20221228-0425.1 → 0.0.0-nightly-20221229-0425.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.json +5 -5
  2. package/CHANGELOG.md +5 -5
  3. package/lib/compose/getSlots.js +0 -8
  4. package/lib/compose/getSlots.js.map +1 -1
  5. package/lib/compose/isResolvedShorthand.js +0 -1
  6. package/lib/compose/isResolvedShorthand.js.map +1 -1
  7. package/lib/compose/resolveShorthand.js +2 -6
  8. package/lib/compose/resolveShorthand.js.map +1 -1
  9. package/lib/hooks/useControllableState.js +6 -12
  10. package/lib/hooks/useControllableState.js.map +1 -1
  11. package/lib/hooks/useEventCallback.js +0 -1
  12. package/lib/hooks/useEventCallback.js.map +1 -1
  13. package/lib/hooks/useFirstMount.js +0 -3
  14. package/lib/hooks/useFirstMount.js.map +1 -1
  15. package/lib/hooks/useForceUpdate.js +0 -1
  16. package/lib/hooks/useForceUpdate.js.map +1 -1
  17. package/lib/hooks/useId.js +0 -3
  18. package/lib/hooks/useId.js.map +1 -1
  19. package/lib/hooks/useIsomorphicLayoutEffect.js +0 -1
  20. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  21. package/lib/hooks/useMergedRefs.js +2 -3
  22. package/lib/hooks/useMergedRefs.js.map +1 -1
  23. package/lib/hooks/useOnClickOutside.js +8 -26
  24. package/lib/hooks/useOnClickOutside.js.map +1 -1
  25. package/lib/hooks/useOnScrollOutside.js +0 -4
  26. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  27. package/lib/hooks/usePrevious.js +0 -1
  28. package/lib/hooks/usePrevious.js.map +1 -1
  29. package/lib/hooks/useTimeout.js +2 -3
  30. package/lib/hooks/useTimeout.js.map +1 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib/ssr/SSRContext.js +4 -11
  33. package/lib/ssr/SSRContext.js.map +1 -1
  34. package/lib/ssr/canUseDOM.js +2 -1
  35. package/lib/ssr/canUseDOM.js.map +1 -1
  36. package/lib/trigger/applyTriggerPropsToChildren.js +2 -6
  37. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  38. package/lib/trigger/getTriggerChild.js +2 -3
  39. package/lib/trigger/getTriggerChild.js.map +1 -1
  40. package/lib/trigger/isFluentTrigger.js.map +1 -1
  41. package/lib/utils/getNativeElementProps.js +0 -2
  42. package/lib/utils/getNativeElementProps.js.map +1 -1
  43. package/lib/utils/getRTLSafeKey.js +0 -2
  44. package/lib/utils/getRTLSafeKey.js.map +1 -1
  45. package/lib/utils/getReactCallbackName.js +0 -3
  46. package/lib/utils/getReactCallbackName.js.map +1 -1
  47. package/lib/utils/isHTMLElement.js +0 -1
  48. package/lib/utils/isHTMLElement.js.map +1 -1
  49. package/lib/utils/isInteractiveHTMLElement.js +0 -4
  50. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  51. package/lib/utils/mergeCallbacks.js.map +1 -1
  52. package/lib/utils/omit.js +0 -2
  53. package/lib/utils/omit.js.map +1 -1
  54. package/lib/utils/properties.js +7 -36
  55. package/lib/utils/properties.js.map +1 -1
  56. package/lib-commonjs/compose/getSlots.js +0 -12
  57. package/lib-commonjs/compose/getSlots.js.map +1 -1
  58. package/lib-commonjs/compose/index.js +0 -5
  59. package/lib-commonjs/compose/index.js.map +1 -1
  60. package/lib-commonjs/compose/isResolvedShorthand.js +0 -4
  61. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  62. package/lib-commonjs/compose/resolveShorthand.js +2 -9
  63. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  64. package/lib-commonjs/compose/types.js.map +1 -1
  65. package/lib-commonjs/hooks/index.js +0 -12
  66. package/lib-commonjs/hooks/index.js.map +1 -1
  67. package/lib-commonjs/hooks/useControllableState.js +6 -14
  68. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  69. package/lib-commonjs/hooks/useEventCallback.js +0 -5
  70. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  71. package/lib-commonjs/hooks/useFirstMount.js +0 -6
  72. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  73. package/lib-commonjs/hooks/useForceUpdate.js +0 -4
  74. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  75. package/lib-commonjs/hooks/useId.js +0 -8
  76. package/lib-commonjs/hooks/useId.js.map +1 -1
  77. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +0 -4
  78. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  79. package/lib-commonjs/hooks/useMergedRefs.js +2 -6
  80. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  81. package/lib-commonjs/hooks/useOnClickOutside.js +8 -30
  82. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  83. package/lib-commonjs/hooks/useOnScrollOutside.js +0 -8
  84. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  85. package/lib-commonjs/hooks/usePrevious.js +0 -4
  86. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  87. package/lib-commonjs/hooks/useTimeout.js +2 -6
  88. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  89. package/lib-commonjs/index.js +0 -10
  90. package/lib-commonjs/index.js.map +1 -1
  91. package/lib-commonjs/ssr/SSRContext.js +4 -17
  92. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  93. package/lib-commonjs/ssr/canUseDOM.js +2 -3
  94. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  95. package/lib-commonjs/ssr/index.js +0 -3
  96. package/lib-commonjs/ssr/index.js.map +1 -1
  97. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +2 -10
  98. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  99. package/lib-commonjs/trigger/getTriggerChild.js +2 -7
  100. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  101. package/lib-commonjs/trigger/index.js +0 -5
  102. package/lib-commonjs/trigger/index.js.map +1 -1
  103. package/lib-commonjs/trigger/isFluentTrigger.js +0 -2
  104. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  105. package/lib-commonjs/trigger/types.js.map +1 -1
  106. package/lib-commonjs/utils/clamp.js +0 -2
  107. package/lib-commonjs/utils/clamp.js.map +1 -1
  108. package/lib-commonjs/utils/getNativeElementProps.js +0 -6
  109. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  110. package/lib-commonjs/utils/getRTLSafeKey.js +0 -4
  111. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  112. package/lib-commonjs/utils/getReactCallbackName.js +0 -5
  113. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  114. package/lib-commonjs/utils/index.js +0 -9
  115. package/lib-commonjs/utils/index.js.map +1 -1
  116. package/lib-commonjs/utils/isHTMLElement.js +0 -3
  117. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  118. package/lib-commonjs/utils/isInteractiveHTMLElement.js +0 -7
  119. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  120. package/lib-commonjs/utils/mergeCallbacks.js +0 -2
  121. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  122. package/lib-commonjs/utils/omit.js +0 -4
  123. package/lib-commonjs/utils/omit.js.map +1 -1
  124. package/lib-commonjs/utils/properties.js +7 -38
  125. package/lib-commonjs/utils/properties.js.map +1 -1
  126. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useOnClickOutside.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AAiCA;;;AAGG;;AACH,OAAO,MAAM,iBAAiB,GAAI,OAAD,IAA8C;EAC7E,MAAM;IAAE,IAAF;IAAQ,QAAR;IAAkB,OAAlB;IAA2B,QAA3B;IAAqC,QAAQ,EAAE;EAA/C,IAAgE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AA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,WAAhB,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,WAAF,CAAc,MAAK;QACjE,MAAM,aAAa,GAAG,cAAc,KAAA,IAAd,IAAA,cAAc,KAAA,KAAA,CAAd,GAAc,KAAA,CAAd,GAAA,cAAc,CAAE,aAAtC;;QACA,IAAI,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,OAAf,MAA2B,QAA3B,IAAuC,CAAA,aAAa,KAAA,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]);\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AAa,CAAClB,KAAK,CAAC;;MAEtC,CAAC,EAAEU,YAAY,CAAC;;IAElB,OAAO,MAAK;;MACV,oBAAc,aAAdD,cAAc,uBAAdA,cAAc,CAAEH,WAAW,0CAAEF,YAAY,CAACO,UAAU,CAAClB,OAAO,CAAC;IAC/D,CAAC;EACH,CAAC,EAAE,CAACgB,cAAc,EAAED,wBAAwB,EAAEE,YAAY,CAAC,CAAC;AAC9D,CAAC","names":["React","useEventCallback","useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","useRef","undefined","useIFrameFocus","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","ownerDocument","defaultView","FUI_FRAME_EVENT","enableFrameFocusDispatch","targetDocument","pollDuration","timeoutRef","e","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useOnClickOutside.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n\n/**\n * @internal\n */\nexport type UseOnClickOrScrollOutsideOptions = {\n /**\n * The element to listen for the click event\n */\n element: Document | undefined;\n /**\n * Refs to elements that check if the click is outside\n */\n refs: React.MutableRefObject<HTMLElement | undefined | null>[];\n\n /**\n * By default uses element.contains, but custom contain function can be provided\n * @param parentRef - provided parent ref\n * @param child - event target element\n */\n contains?(parent: HTMLElement | null, child: HTMLElement): boolean;\n\n /**\n * Disables event listeners\n */\n disabled?: boolean;\n\n /**\n * Called if the click is outside the element refs\n */\n callback: (ev: MouseEvent | TouchEvent) => void;\n};\n\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled, contains: containsProp } = options;\n const timeoutId = React.useRef<number | undefined>(undefined);\n useIFrameFocus(!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"]}
@@ -4,7 +4,6 @@ import { useEventCallback } from './useEventCallback';
4
4
  * @internal
5
5
  * Utility to perform checks where a click/touch event was made outside a component
6
6
  */
7
-
8
7
  export const useOnScrollOutside = options => {
9
8
  const {
10
9
  refs,
@@ -15,9 +14,7 @@ export const useOnScrollOutside = options => {
15
14
  } = options;
16
15
  const listener = useEventCallback(ev => {
17
16
  const contains = containsProp || ((parent, child) => !!(parent === null || parent === void 0 ? void 0 : parent.contains(child)));
18
-
19
17
  const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));
20
-
21
18
  if (isOutside && !disabled) {
22
19
  callback(ev);
23
20
  }
@@ -27,7 +24,6 @@ export const useOnScrollOutside = options => {
27
24
  element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
28
25
  element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
29
26
  }
30
-
31
27
  return () => {
32
28
  element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);
33
29
  element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useOnScrollOutside.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AAGA;;;AAGG;;AACH,OAAO,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,gBAAgB,CAAE,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,CARgC,CAAjC;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","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":""}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,gBAAgB,QAAQ,oBAAoB;AAGrD;;;;AAIA,OAAO,MAAMC,kBAAkB,GAAIC,OAAyC,IAAI;EAC9E,MAAM;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,QAAQ,EAAEC;EAAY,CAAE,GAAGN,OAAO;EAE7E,MAAMO,QAAQ,GAAGT,gBAAgB,CAAEU,EAA2B,IAAI;IAChE,MAAMH,QAAQ,GACZC,YAAY,KAAK,CAACG,MAAM,EAAEC,KAAK,KAAK,CAAC,EAACD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEJ,QAAQ,CAACK,KAAK,CAAC,EAAC;IAEhE,MAAMC,SAAS,GAAGV,IAAI,CAACW,KAAK,CAACC,GAAG,IAAI,CAACR,QAAQ,CAACQ,GAAG,CAACC,OAAO,IAAI,IAAI,EAAEN,EAAE,CAACO,MAAqB,CAAC,CAAC;IAC7F,IAAIJ,SAAS,IAAI,CAACP,QAAQ,EAAE;MAC1BF,QAAQ,CAACM,EAAE,CAAC;;EAEhB,CAAC,CAAC;EAEFX,KAAK,CAACmB,SAAS,CAAC,MAAK;IACnB,IAAI,CAACZ,QAAQ,EAAE;MACbD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEc,gBAAgB,CAAC,OAAO,EAAEV,QAAQ,CAAC;MAC5CJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEc,gBAAgB,CAAC,WAAW,EAAEV,QAAQ,CAAC;;IAGlD,OAAO,MAAK;MACVJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEe,mBAAmB,CAAC,OAAO,EAAEX,QAAQ,CAAC;MAC/CJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEe,mBAAmB,CAAC,WAAW,EAAEX,QAAQ,CAAC;IACrD,CAAC;EACH,CAAC,EAAE,CAACA,QAAQ,EAAEJ,OAAO,EAAEC,QAAQ,CAAC,CAAC;AACnC,CAAC","names":["React","useEventCallback","useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","ev","parent","child","isOutside","every","ref","current","target","useEffect","addEventListener","removeEventListener"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useOnScrollOutside.ts"],"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"]}
@@ -2,7 +2,6 @@ import * as React from 'react';
2
2
  /**
3
3
  * @internal
4
4
  */
5
-
6
5
  export const usePrevious = value => {
7
6
  const ref = React.useRef(null);
8
7
  React.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/usePrevious.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;AAEG;;AACH,OAAO,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","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":""}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B;;;AAGA,OAAO,MAAMC,WAAW,GAAyBC,KAAgB,IAAI;EACnE,MAAMC,GAAG,GAAGH,KAAK,CAACI,MAAM,CAAmB,IAAI,CAAC;EAChDJ,KAAK,CAACK,SAAS,CAAC,MAAK;IACnBF,GAAG,CAACG,OAAO,GAAGJ,KAAK;EACrB,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EACX,OAAOC,GAAG,CAACG,OAAO;AACpB,CAAC","names":["React","usePrevious","value","ref","useRef","useEffect","current"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/usePrevious.ts"],"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"]}
@@ -7,7 +7,6 @@ import * as React from 'react';
7
7
  *
8
8
  * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.
9
9
  */
10
-
11
10
  export function useTimeout() {
12
11
  const [timeout] = React.useState(() => ({
13
12
  id: undefined,
@@ -21,8 +20,8 @@ export function useTimeout() {
21
20
  timeout.id = undefined;
22
21
  }
23
22
  }
24
- })); // Clean up the timeout when the component is unloaded
25
-
23
+ }));
24
+ // Clean up the timeout when the component is unloaded
26
25
  React.useEffect(() => timeout.clear, [timeout]);
27
26
  return [timeout.set, timeout.clear];
28
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;;;;;;AAOG;;AACH,OAAM,SAAU,UAAV,GAAoB;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","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":""}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B;;;;;;;;AAQA,OAAM,SAAUC,UAAU;EACxB,MAAM,CAACC,OAAO,CAAC,GAAGF,KAAK,CAACG,QAAQ,CAAC,OAAO;IACtCC,EAAE,EAAEC,SAAsD;IAC1DC,GAAG,EAAE,CAACC,EAAc,EAAEC,KAAa,KAAI;MACrCN,OAAO,CAACO,KAAK,EAAE;MACfP,OAAO,CAACE,EAAE,GAAGM,UAAU,CAACH,EAAE,EAAEC,KAAK,CAAC;IACpC,CAAC;IACDC,KAAK,EAAE,MAAK;MACV,IAAIP,OAAO,CAACE,EAAE,KAAKC,SAAS,EAAE;QAC5BM,YAAY,CAACT,OAAO,CAACE,EAAE,CAAC;QACxBF,OAAO,CAACE,EAAE,GAAGC,SAAS;;IAE1B;GACD,CAAC,CAAC;EAEH;EACAL,KAAK,CAACY,SAAS,CAAC,MAAMV,OAAO,CAACO,KAAK,EAAE,CAACP,OAAO,CAAC,CAAC;EAE/C,OAAO,CAACA,OAAO,CAACI,GAAG,EAAEJ,OAAO,CAACO,KAAK,CAAU;AAC9C","names":["React","useTimeout","timeout","useState","id","undefined","set","fn","delay","clear","setTimeout","clearTimeout","useEffect"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/hooks/useTimeout.ts"],"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"]}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,QAAT,EAAmB,gBAAnB,EAAqC,mBAArC,QAAgE,iBAAhE;AAgBA,SACE,gBADF,EAEE,oBAFF,EAGE,gBAHF,EAIE,aAJF,EAKE,cALF,EAME,KANF,EAOE,yBAPF,EAQE,aARF,EASE,iBATF,EAUE,kBAVF,EAWE,WAXF,EAYE,UAZF,QAaO,eAbP;AAgBA,SAAS,SAAT,EAAoB,QAApB,EAA8B,WAA9B,QAAiD,aAAjD;AAEA,SACE,KADF,EAEE,qBAFF,EAGE,yBAHF,EAIE,aAJF,EAKE,cALF,EAME,aANF,EAOE,wBAPF,QAQO,eARP;AAUA,SAAS,2BAAT,EAAsC,eAAtC,EAAuD,eAAvD,QAA8E,iBAA9E","sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } 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 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 mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,mBAAmB,QAAQ,iBAAiB;AAgBjF,SACEC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,UAAU,QACL,eAAe;AAGtB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,aAAa;AAE9D,SACEC,KAAK,EACLC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,QACnB,eAAe;AAEtB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,iBAAiB","names":["getSlots","resolveShorthand","isResolvedShorthand","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-utilities/src/index.ts"],"sourcesContent":["export { getSlots, resolveShorthand, isResolvedShorthand } 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 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 mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n} from './utils/index';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n"]}
@@ -5,7 +5,6 @@ import { canUseDOM } from './canUseDOM';
5
5
  *
6
6
  * @internal
7
7
  */
8
-
9
8
  export const defaultSSRContextValue = {
10
9
  current: 0
11
10
  };
@@ -13,10 +12,8 @@ export const SSRContext = /*#__PURE__*/React.createContext(undefined);
13
12
  /**
14
13
  * @internal
15
14
  */
16
-
17
15
  export function useSSRContext() {
18
16
  var _a;
19
-
20
17
  return (_a = React.useContext(SSRContext)) !== null && _a !== void 0 ? _a : defaultSSRContextValue;
21
18
  }
22
19
  /**
@@ -25,7 +22,6 @@ export function useSSRContext() {
25
22
  *
26
23
  * @public
27
24
  */
28
-
29
25
  export const SSRProvider = props => {
30
26
  const [value] = React.useState(() => ({
31
27
  current: 0
@@ -38,21 +34,19 @@ export const SSRProvider = props => {
38
34
  * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay
39
35
  * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.
40
36
  */
41
-
42
37
  export function useIsSSR() {
43
38
  const isInSSRContext = useSSRContext() !== defaultSSRContextValue;
44
- const [isSSR, setIsSSR] = React.useState(isInSSRContext); // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
39
+ const [isSSR, setIsSSR] = React.useState(isInSSRContext);
40
+ // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
45
41
  // developer to add one.
46
-
47
42
  if (process.env.NODE_ENV !== 'production') {
48
43
  if (!isInSSRContext && !canUseDOM()) {
49
44
  // eslint-disable-next-line no-console
50
45
  console.error(['@fluentui/react-components: ', 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.', '\n', '\n', 'Check documentation at https://aka.ms/fluentui-ssr'].join(''));
51
46
  }
52
- } // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
47
+ }
48
+ // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
53
49
  // component after hydration.
54
-
55
-
56
50
  if (canUseDOM() && isInSSRContext) {
57
51
  // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
58
52
  // mounting.
@@ -61,7 +55,6 @@ export function useIsSSR() {
61
55
  setIsSSR(false);
62
56
  }, []);
63
57
  }
64
-
65
58
  return isSSR;
66
59
  }
67
60
  //# sourceMappingURL=SSRContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/ssr/SSRContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,QAA0B,aAA1B;AAYA;;;;AAIG;;AACH,OAAO,MAAM,sBAAsB,GAAoB;EACrD,OAAO,EAAE;AAD4C,CAAhD;AAIP,OAAO,MAAM,UAAU,gBAAG,KAAK,CAAC,aAAN,CAAiD,SAAjD,CAAnB;AAEP;;AAEG;;AACH,OAAM,SAAU,aAAV,GAAuB;;;EAC3B,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,CAAiB,UAAjB,CAAA,MAA4B,IAA5B,IAA4B,EAAA,KAAA,KAAA,CAA5B,GAA4B,EAA5B,GAAgC,sBAAvC;AACD;AAED;;;;;AAKG;;AACH,OAAO,MAAM,WAAW,GAAa,KAAK,IAAG;EAC3C,MAAM,CAAC,KAAD,IAAU,KAAK,CAAC,QAAN,CAAgC,OAAO;IAAE,OAAO,EAAE;EAAX,CAAP,CAAhC,CAAhB;EAEA,oBAAO,KAAA,CAAA,aAAA,CAAC,UAAU,CAAC,QAAZ,EAAoB;IAAC,KAAK,EAAE;EAAR,CAApB,EAAoC,KAAK,CAAC,QAA1C,CAAP;AACD,CAJM;AAMP;;;AAGG;;AACH,OAAM,SAAU,QAAV,GAAkB;EACtB,MAAM,cAAc,GAAG,aAAa,OAAO,sBAA3C;EACA,MAAM,CAAC,KAAD,EAAQ,QAAR,IAAoB,KAAK,CAAC,QAAN,CAAe,cAAf,CAA1B,CAFsB,CAItB;EACA;;EACA,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;IACzC,IAAI,CAAC,cAAD,IAAmB,CAAC,SAAS,EAAjC,EAAqC;MACnC;MACA,OAAO,CAAC,KAAR,CACE,CACE,8BADF,EAEE,4GACE,0CAHJ,EAIE,IAJF,EAKE,IALF,EAME,oDANF,EAOE,IAPF,CAOO,EAPP,CADF;IAUD;EACF,CApBqB,CAsBtB;EACA;;;EACA,IAAI,SAAS,MAAM,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","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 | undefined>(undefined) as React.Context<SSRContextValue>;\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\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 [\n '@fluentui/react-components: ',\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 'Check documentation at https://aka.ms/fluentui-ssr',\n ].join(''),\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":""}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,QAAQ,aAAa;AAYvC;;;;;AAKA,OAAO,MAAMC,sBAAsB,GAAoB;EACrDC,OAAO,EAAE;CACV;AAED,OAAO,MAAMC,UAAU,gBAAGJ,KAAK,CAACK,aAAa,CAA8BC,SAAS,CAAmC;AAEvH;;;AAGA,OAAM,SAAUC,aAAa;;EAC3B,OAAO,WAAK,CAACC,UAAU,CAACJ,UAAU,CAAC,mCAAIF,sBAAsB;AAC/D;AAEA;;;;;;AAMA,OAAO,MAAMO,WAAW,GAAaC,KAAK,IAAG;EAC3C,MAAM,CAACC,KAAK,CAAC,GAAGX,KAAK,CAACY,QAAQ,CAAkB,OAAO;IAAET,OAAO,EAAE;EAAC,CAAE,CAAC,CAAC;EAEvE,oBAAOH,oBAACI,UAAU,CAACS,QAAQ;IAACF,KAAK,EAAEA;EAAK,GAAGD,KAAK,CAACI,QAAQ,CAAuB;AAClF,CAAC;AAED;;;;AAIA,OAAM,SAAUC,QAAQ;EACtB,MAAMC,cAAc,GAAGT,aAAa,EAAE,KAAKL,sBAAsB;EACjE,MAAM,CAACe,KAAK,EAAEC,QAAQ,CAAC,GAAGlB,KAAK,CAACY,QAAQ,CAACI,cAAc,CAAC;EAExD;EACA;EACA,IAAIG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI,CAACL,cAAc,IAAI,CAACf,SAAS,EAAE,EAAE;MACnC;MACAqB,OAAO,CAACC,KAAK,CACX,CACE,8BAA8B,EAC9B,yGAAyG,GACvG,0CAA0C,EAC5C,IAAI,EACJ,IAAI,EACJ,oDAAoD,CACrD,CAACC,IAAI,CAAC,EAAE,CAAC,CACX;;;EAIL;EACA;EACA,IAAIvB,SAAS,EAAE,IAAIe,cAAc,EAAE;IACjC;IACA;IACA;IACAhB,KAAK,CAACyB,eAAe,CAAC,MAAK;MACzBP,QAAQ,CAAC,KAAK,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC;;EAGR,OAAOD,KAAK;AACd","names":["React","canUseDOM","defaultSSRContextValue","current","SSRContext","createContext","undefined","useSSRContext","useContext","SSRProvider","props","value","useState","Provider","children","useIsSSR","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","console","error","join","useLayoutEffect"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/ssr/SSRContext.tsx"],"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 | undefined>(undefined) as React.Context<SSRContextValue>;\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext) ?? defaultSSRContextValue;\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 [\n '@fluentui/react-components: ',\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 'Check documentation at https://aka.ms/fluentui-ssr',\n ].join(''),\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"]}
@@ -2,7 +2,8 @@
2
2
  * Verifies if an application can use DOM.
3
3
  */
4
4
  export function canUseDOM() {
5
- return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation
5
+ return typeof window !== 'undefined' && !!(window.document &&
6
+ // eslint-disable-next-line deprecation/deprecation
6
7
  window.document.createElement);
7
8
  }
8
9
  //# sourceMappingURL=canUseDOM.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/ssr/canUseDOM.ts"],"names":[],"mappings":"AAAA;;AAEG;AACH,OAAM,SAAU,SAAV,GAAmB;EACvB,OACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;EACA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD","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":""}
1
+ {"version":3,"mappings":"AAAA;;;AAGA,OAAM,SAAUA,SAAS;EACvB,OACE,OAAOC,MAAM,KAAK,WAAW,IAC7B,CAAC,EACCA,MAAM,CAACC,QAAQ;EACf;EACAD,MAAM,CAACC,QAAQ,CAACC,aAAa,CAC9B;AAEL","names":["canUseDOM","window","document","createElement"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/ssr/canUseDOM.ts"],"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"]}
@@ -4,29 +4,25 @@ import { isFluentTrigger } from './isFluentTrigger';
4
4
  * @internal
5
5
  * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.
6
6
  */
7
-
8
7
  export function applyTriggerPropsToChildren(children, triggerChildProps) {
9
8
  if (typeof children === 'function') {
10
9
  return children(triggerChildProps);
11
10
  } else if (children) {
12
11
  return cloneTriggerTree(children, triggerChildProps);
13
- } // Components in React should return either JSX elements or "null", otherwise React will throw:
12
+ }
13
+ // Components in React should return either JSX elements or "null", otherwise React will throw:
14
14
  // Nothing was returned from render.
15
15
  // This usually means a return statement is missing. Or, to render nothing, return null.
16
-
17
-
18
16
  return children || null;
19
17
  }
20
18
  /**
21
19
  * Clones a React element tree, and applies the given props to the first grandchild that is not
22
20
  * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
23
21
  */
24
-
25
22
  function cloneTriggerTree(child, triggerProps) {
26
23
  if (! /*#__PURE__*/React.isValidElement(child) || child.type === React.Fragment) {
27
24
  throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
28
25
  }
29
-
30
26
  if (isFluentTrigger(child)) {
31
27
  const grandchild = cloneTriggerTree(child.props.children, triggerProps);
32
28
  return /*#__PURE__*/React.cloneElement(child, undefined, grandchild);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,eAAT,QAAgC,mBAAhC;AAGA;;;AAGG;;AACH,OAAM,SAAU,2BAAV,CACJ,QADI,EAEJ,iBAFI,EAEgC;EAEpC,IAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;IAClC,OAAO,QAAQ,CAAC,iBAAD,CAAf;EACD,CAFD,MAEO,IAAI,QAAJ,EAAc;IACnB,OAAO,gBAAgB,CAAC,QAAD,EAAW,iBAAX,CAAvB;EACD,CANmC,CAQpC;EACA;EACA;;;EACA,OAAO,QAAQ,IAAI,IAAnB;AACD;AAED;;;AAGG;;AACH,SAAS,gBAAT,CACE,KADF,EAEE,YAFF,EAEiC;EAE/B,IAAI,eAAC,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,eAAe,CAAC,KAAD,CAAnB,EAA4B;IAC1B,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAN,CAAY,QAAb,EAAuB,YAAvB,CAAnC;IACA,oBAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,SAA1B,EAAqC,UAArC,CAAP;EACD,CAHD,MAGO;IACL,oBAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,YAA1B,CAAP;EACD;AACF","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport function applyTriggerPropsToChildren<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n triggerChildProps: TriggerChildProps,\n): React.ReactElement | null {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\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 */\nfunction cloneTriggerTree<TriggerChildProps>(\n child: React.ReactNode,\n triggerProps: TriggerChildProps,\n): 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 as TriggerChildProps & React.Attributes);\n }\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,QAAQ,mBAAmB;AAGnD;;;;AAIA,OAAM,SAAUC,2BAA2B,CACzCC,QAAqD,EACrDC,iBAAoC;EAEpC,IAAI,OAAOD,QAAQ,KAAK,UAAU,EAAE;IAClC,OAAOA,QAAQ,CAACC,iBAAiB,CAAC;GACnC,MAAM,IAAID,QAAQ,EAAE;IACnB,OAAOE,gBAAgB,CAACF,QAAQ,EAAEC,iBAAiB,CAAC;;EAGtD;EACA;EACA;EACA,OAAOD,QAAQ,IAAI,IAAI;AACzB;AAEA;;;;AAIA,SAASE,gBAAgB,CACvBC,KAAsB,EACtBC,YAA+B;EAE/B,IAAI,eAACP,KAAK,CAACQ,cAAc,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,KAAKT,KAAK,CAACU,QAAQ,EAAE;IACjE,MAAM,IAAIC,KAAK,CACb,iEAAiE,GAC/D,sDAAsD,CACzD;;EAGH,IAAIV,eAAe,CAACK,KAAK,CAAC,EAAE;IAC1B,MAAMM,UAAU,GAAGP,gBAAgB,CAACC,KAAK,CAACO,KAAK,CAACV,QAAQ,EAAEI,YAAY,CAAC;IACvE,oBAAOP,KAAK,CAACc,YAAY,CAACR,KAAK,EAAES,SAAS,EAAEH,UAAU,CAAC;GACxD,MAAM;IACL,oBAAOZ,KAAK,CAACc,YAAY,CAACR,KAAK,EAAEC,YAAoD,CAAC;;AAE1F","names":["React","isFluentTrigger","applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","isValidElement","type","Fragment","Error","grandchild","props","cloneElement","undefined"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\n\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport function applyTriggerPropsToChildren<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n triggerChildProps: TriggerChildProps,\n): React.ReactElement | null {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\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 */\nfunction cloneTriggerTree<TriggerChildProps>(\n child: React.ReactNode,\n triggerProps: TriggerChildProps,\n): 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 as TriggerChildProps & React.Attributes);\n }\n}\n"]}
@@ -22,13 +22,12 @@ import { isFluentTrigger } from './isFluentTrigger';
22
22
  * In the case where the immediate child is not a valid element,
23
23
  * null is returned
24
24
  */
25
-
26
25
  export function getTriggerChild(children) {
27
26
  if (! /*#__PURE__*/React.isValidElement(children)) {
28
27
  return null;
29
28
  }
30
-
31
- return isFluentTrigger(children) ? getTriggerChild( // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
29
+ return isFluentTrigger(children) ? getTriggerChild(
30
+ // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
32
31
  // but for some reason it's failing on build
33
32
  children.props.children) : children;
34
33
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/getTriggerChild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,eAAT,QAAgC,mBAAhC;AAGA;;;;;;;;;;;;;;;;;;;;;AAqBG;;AACH,OAAM,SAAU,eAAV,CACJ,QADI,EACiD;EAGrD,IAAI,eAAC,KAAK,CAAC,cAAN,CAAwC,QAAxC,CAAL,EAAwD;IACtD,OAAO,IAAP;EACD;;EACD,OAAO,eAAe,CAAC,QAAD,CAAf,GACH,eAAe,EACb;EACA;EACC,QAAQ,CAAC,KAAT,CAAgC,QAHpB,CADZ,GAMH,QANJ;AAOD","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\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 * In the case where the immediate child is not a valid element,\n * null is returned\n */\nexport function getTriggerChild<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (React.ReactElement<Partial<TriggerChildProps>> & { ref?: React.Ref<any> }) | null {\n if (!React.isValidElement<TriggerChildProps>(children)) {\n return null;\n }\n return isFluentTrigger(children)\n ? getTriggerChild(\n // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,\n // but for some reason it's failing on build\n (children.props as TriggerProps).children,\n )\n : children;\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,QAAQ,mBAAmB;AAGnD;;;;;;;;;;;;;;;;;;;;;;AAsBA,OAAM,SAAUC,eAAe,CAC7BC,QAAqD;EAGrD,IAAI,eAACH,KAAK,CAACI,cAAc,CAAoBD,QAAQ,CAAC,EAAE;IACtD,OAAO,IAAI;;EAEb,OAAOF,eAAe,CAACE,QAAQ,CAAC,GAC5BD,eAAe;EACb;EACA;EACCC,QAAQ,CAACE,KAAsB,CAACF,QAAQ,CAC1C,GACDA,QAAQ;AACd","names":["React","isFluentTrigger","getTriggerChild","children","isValidElement","props"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/getTriggerChild.ts"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\nimport type { TriggerProps } from './types';\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 * In the case where the immediate child is not a valid element,\n * null is returned\n */\nexport function getTriggerChild<TriggerChildProps>(\n children: TriggerProps<TriggerChildProps>['children'],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): (React.ReactElement<Partial<TriggerChildProps>> & { ref?: React.Ref<any> }) | null {\n if (!React.isValidElement<TriggerChildProps>(children)) {\n return null;\n }\n return isFluentTrigger(children)\n ? getTriggerChild(\n // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,\n // but for some reason it's failing on build\n (children.props as TriggerProps).children,\n )\n : children;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/isFluentTrigger.ts"],"names":[],"mappings":"AAGA;;;;AAIG;AACH,OAAM,SAAU,eAAV,CAA0B,OAA1B,EAAqD;EACzD,OAAO,OAAO,CAAE,OAAO,CAAC,IAAR,CAAwC,wBAA1C,CAAd;AACD","sourcesContent":["import * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * @internal\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 function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAGA;;;;;AAKA,OAAM,SAAUA,eAAe,CAACC,OAA2B;EACzD,OAAOC,OAAO,CAAED,OAAO,CAACE,IAA+B,CAACC,wBAAwB,CAAC;AACnF","names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/trigger/isFluentTrigger.ts"],"sourcesContent":["import * as React from 'react';\nimport type { FluentTriggerComponent, TriggerProps } from './types';\n\n/**\n * @internal\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 function isFluentTrigger(element: React.ReactElement): element is React.ReactElement<TriggerProps> {\n return Boolean((element.type as FluentTriggerComponent).isFluentTriggerComponent);\n}\n"]}
@@ -32,7 +32,6 @@ const nativeElementMap = {
32
32
  * @param excludedPropNames - List of props to disallow
33
33
  */
34
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
-
36
35
  export function getNativeElementProps(tagName, props, excludedPropNames) {
37
36
  const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;
38
37
  allowedPropNames.as = 1;
@@ -46,7 +45,6 @@ export function getNativeElementProps(tagName, props, excludedPropNames) {
46
45
  *
47
46
  * @returns An object containing the native props for the `root` and primary slots.
48
47
  */
49
-
50
48
  export const getPartitionedNativeProps = ({
51
49
  primarySlotTagName,
52
50
  props,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getNativeElementProps.ts"],"names":[],"mappings":"AACA,SACE,eADF,EAEE,eAFF,EAGE,eAHF,EAIE,YAJF,EAKE,YALF,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,CAArB;AACD;AAED;;;;;;;AAOG;;AACH,OAAO,MAAM,yBAAyB,GAAG,CAGvC;EACA,kBADA;EAEA,KAFA;EAGA;AAHA,CAHuC,KAgBpC;EACH,OAAO;IACL,IAAI,EAAE;MAAE,KAAK,EAAE,KAAK,CAAC,KAAf;MAAsB,SAAS,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","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 dialogProperties,\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 dialog: dialogProperties,\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":""}
1
+ {"version":3,"mappings":"AACA,SACEA,eAAe,EACfC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,EAChBC,aAAa,EACbC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,gBAAgB,QACX,cAAc;AAErB,MAAMC,gBAAgB,GAA2C;EAC/DC,KAAK,EAAE1B,eAAe;EACtB2B,KAAK,EAAE1B,eAAe;EACtB2B,KAAK,EAAE1B,eAAe;EACtB2B,EAAE,EAAE1B,YAAY;E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C","names":["labelProperties","audioProperties","videoProperties","olProperties","liProperties","anchorProperties","buttonProperties","inputProperties","textAreaProperties","selectProperties","optionProperties","tableProperties","trProperties","thProperties","tdProperties","colGroupProperties","colProperties","fieldsetProperties","formProperties","iframeProperties","imgProperties","htmlElementProperties","getNativeProps","timeProperties","dialogProperties","nativeElementMap","label","audio","video","ol","li","a","button","input","textarea","select","option","table","tr","th","td","colGroup","col","fieldset","form","iframe","img","time","dialog","getNativeElementProps","tagName","props","excludedPropNames","allowedPropNames","as","getPartitionedNativeProps","primarySlotTagName","root","style","className","primary"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getNativeElementProps.ts"],"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 dialogProperties,\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 dialog: dialogProperties,\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"]}
@@ -9,14 +9,12 @@ export const getRTLSafeKey = (key, dir) => {
9
9
  {
10
10
  return 'ArrowRight';
11
11
  }
12
-
13
12
  case 'ArrowRight':
14
13
  {
15
14
  return 'ArrowLeft';
16
15
  }
17
16
  }
18
17
  }
19
-
20
18
  return key;
21
19
  };
22
20
  //# sourceMappingURL=getRTLSafeKey.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getRTLSafeKey.ts"],"names":[],"mappings":"AAAA;;;AAGG;AACH,OAAO,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","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":""}
1
+ {"version":3,"mappings":"AAAA;;;;AAIA,OAAO,MAAMA,aAAa,GAAG,CAACC,GAAW,EAAEC,GAAkB,KAAI;EAC/D,IAAIA,GAAG,KAAK,KAAK,EAAE;IACjB,QAAQD,GAAG;MACT,KAAK,WAAW;QAAE;UAChB,OAAO,YAAY;;MAGrB,KAAK,YAAY;QAAE;UACjB,OAAO,WAAW;;IACnB;;EAIL,OAAOA,GAAG;AACZ,CAAC","names":["getRTLSafeKey","key","dir"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getRTLSafeKey.ts"],"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"]}
@@ -9,15 +9,12 @@ export function getReactCallbackName(event) {
9
9
  if (event._reactName) {
10
10
  return event._reactName;
11
11
  }
12
-
13
12
  if (event.dispatchConfig) {
14
13
  if (event.dispatchConfig.registrationName) {
15
14
  return event.dispatchConfig.registrationName;
16
15
  }
17
-
18
16
  return event.dispatchConfig.phasedRegistrationNames.bubbled;
19
17
  }
20
-
21
18
  if (process.env.NODE_ENV !== 'production') {
22
19
  // eslint-disable-next-line no-console
23
20
  console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', 'This should not happen, please report it to https://github.com/microsoft/fluentui']);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getReactCallbackName.ts"],"names":[],"mappings":"AAwBA;;;;;;AAMG;AACH,OAAM,SAAU,oBAAV,CAA+B,KAA/B,EAAyD;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","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":""}
1
+ {"version":3,"mappings":"AAwBA;;;;;;;AAOA,OAAM,SAAUA,oBAAoB,CAACC,KAA0B;EAC7D,IAAIA,KAAK,CAACC,UAAU,EAAE;IACpB,OAAOD,KAAK,CAACC,UAA+B;;EAG9C,IAAID,KAAK,CAACE,cAAc,EAAE;IACxB,IAAIF,KAAK,CAACE,cAAc,CAACC,gBAAgB,EAAE;MACzC,OAAOH,KAAK,CAACE,cAAc,CAACC,gBAAqC;;IAGnE,OAAOH,KAAK,CAACE,cAAc,CAACE,uBAAuB,CAACC,OAA4B;;EAGlF,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,KAAK,CAAC,CACZ,kFAAkF,EAClF,mFAAmF,CACpF,CAAC;;AAEN","names":["getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/getReactCallbackName.ts"],"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"]}
@@ -9,7 +9,6 @@
9
9
  */
10
10
  export function isHTMLElement(element) {
11
11
  var _a;
12
-
13
12
  const typedElement = element;
14
13
  return Boolean(typedElement !== null && ((_a = typedElement === null || typedElement === void 0 ? void 0 : typedElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView.HTMLElement);
15
14
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AACH,OAAM,SAAU,aAAV,CAAwB,OAAxB,EAAyC;;;EAC7C,MAAM,YAAY,GAAG,OAArB;EACA,OAAO,OAAO,CACZ,YAAY,KAAK,IAAjB,KACE,CAAA,EAAA,GAAA,YAAY,KAAA,IAAZ,IAAA,YAAY,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAA,YAAY,CAAE,aAAd,MAA2B,IAA3B,IAA2B,EAAA,KAAA,KAAA,CAA3B,GAA2B,KAAA,CAA3B,GAA2B,EAAA,CAAE,WAD/B,KAEE,YAAY,YAAY,YAAY,CAAC,aAAb,CAA2B,WAA3B,CAAuC,WAHrD,CAAd;AAKD","sourcesContent":["/**\n * @internal\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is required as simply using `instanceof`\n * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n */\nexport function isHTMLElement(element?: unknown): element is HTMLElement {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement !== null &&\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView.HTMLElement,\n );\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA;;;;;;;;;AASA,OAAM,SAAUA,aAAa,CAACC,OAAiB;;EAC7C,MAAMC,YAAY,GAAGD,OAAkC;EACvD,OAAOE,OAAO,CACZD,YAAY,KAAK,IAAI,KACnB,kBAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,aAAa,0CAAEC,WAAW,KACxCH,YAAY,YAAYA,YAAY,CAACE,aAAa,CAACC,WAAW,CAACC,WAAW,CAC7E;AACH","names":["isHTMLElement","element","typedElement","Boolean","ownerDocument","defaultView","HTMLElement"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isHTMLElement.ts"],"sourcesContent":["/**\n * @internal\n * Verifies if a given node is an HTMLElement,\n * this method works seamlessly with frames and elements from different documents\n *\n * This is required as simply using `instanceof`\n * might be problematic while operating with [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms)\n *\n */\nexport function isHTMLElement(element?: unknown): element is HTMLElement {\n const typedElement = element as Node | null | undefined;\n return Boolean(\n typedElement !== null &&\n typedElement?.ownerDocument?.defaultView &&\n typedElement instanceof typedElement.ownerDocument.defaultView.HTMLElement,\n );\n}\n"]}
@@ -3,16 +3,13 @@ import { isHTMLElement } from './isHTMLElement';
3
3
  * @internal
4
4
  * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys
5
5
  */
6
-
7
6
  export function isInteractiveHTMLElement(element) {
8
7
  if (!isHTMLElement(element)) {
9
8
  return false;
10
9
  }
11
-
12
10
  const {
13
11
  tagName
14
12
  } = element;
15
-
16
13
  switch (tagName) {
17
14
  case 'BUTTON':
18
15
  case 'A':
@@ -20,7 +17,6 @@ export function isInteractiveHTMLElement(element) {
20
17
  case 'TEXTAREA':
21
18
  return true;
22
19
  }
23
-
24
20
  return element.isContentEditable;
25
21
  }
26
22
  //# sourceMappingURL=isInteractiveHTMLElement.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,QAA8B,iBAA9B;AAEA;;;AAGG;;AACH,OAAM,SAAU,wBAAV,CAAmC,OAAnC,EAAmD;EACvD,IAAI,CAAC,aAAa,CAAC,OAAD,CAAlB,EAA6B;IAC3B,OAAO,KAAP;EACD;;EAED,MAAM;IAAE;EAAF,IAAc,OAApB;;EACA,QAAQ,OAAR;IACE,KAAK,QAAL;IACA,KAAK,GAAL;IACA,KAAK,OAAL;IACA,KAAK,UAAL;MACE,OAAO,IAAP;EALJ;;EAQA,OAAO,OAAO,CAAC,iBAAf;AACD","sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: unknown) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,aAAa,QAAQ,iBAAiB;AAE/C;;;;AAIA,OAAM,SAAUC,wBAAwB,CAACC,OAAgB;EACvD,IAAI,CAACF,aAAa,CAACE,OAAO,CAAC,EAAE;IAC3B,OAAO,KAAK;;EAGd,MAAM;IAAEC;EAAO,CAAE,GAAGD,OAAO;EAC3B,QAAQC,OAAO;IACb,KAAK,QAAQ;IACb,KAAK,GAAG;IACR,KAAK,OAAO;IACZ,KAAK,UAAU;MACb,OAAO,IAAI;EAAC;EAGhB,OAAOD,OAAO,CAACE,iBAAiB;AAClC","names":["isHTMLElement","isInteractiveHTMLElement","element","tagName","isContentEditable"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/isInteractiveHTMLElement.ts"],"sourcesContent":["import { isHTMLElement } from './isHTMLElement';\n\n/**\n * @internal\n * Checks that the element has default behaviour from user input on click or 'Enter'/'Space' keys\n */\nexport function isInteractiveHTMLElement(element: unknown) {\n if (!isHTMLElement(element)) {\n return false;\n }\n\n const { tagName } = element;\n switch (tagName) {\n case 'BUTTON':\n case 'A':\n case 'INPUT':\n case 'TEXTAREA':\n return true;\n }\n\n return element.isContentEditable;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/mergeCallbacks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACH,OAAM,SAAU,cAAV,CACJ,SADI,EAEJ,SAFI,EAE4C;EAEhD,OAAO,CAAC,GAAG,IAAJ,KAAkB;IACvB,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;IACA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,GAAG,IAAN,CAAT;EACD,CAHD;AAID","sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAM,SAAUA,cAAc,CAC5BC,SAAgD,EAChDC,SAAgD;EAEhD,OAAO,CAAC,GAAGC,IAAU,KAAI;IACvBF,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,GAAGE,IAAI,CAAC;IACpBD,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,GAAGC,IAAI,CAAC;EACtB,CAAC;AACH","names":["mergeCallbacks","callback1","callback2","args"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/mergeCallbacks.ts"],"sourcesContent":["/**\n * @internal\n * Combine two event callbacks into a single callback function that calls each one in order.\n *\n * Usage example:\n * ```ts\n * state.slot.onChange = mergeCallbacks(state.slot.onChange, ev => {\n * // Handle onChange\n * });\n * ```\n *\n * The primary use is to avoid the need to capture an existing callback (`state.slot.onChange` in the example) to a\n * local variable before replacing with a new listener that calls the existing one. This helps avoid bugs like:\n * * Infinite recursion by calling the re-assigned state.slot.onChange if it's not captured to a local variable.\n * * Missing a call to the original onChange due to an early return or other conditional.\n *\n * If you need a callback that is stable between renders, wrap the result in {@link useEventCallback}.\n *\n * @param callback1 - The first callback to be called, or undefined\n * @param callback2 - The second callback to be called, or undefined\n *\n * @returns A function that that calls the provided functions in order\n */\nexport function mergeCallbacks<Args extends unknown[]>(\n callback1: ((...args: Args) => void) | undefined,\n callback2: ((...args: Args) => void) | undefined,\n) {\n return (...args: Args) => {\n callback1?.(...args);\n callback2?.(...args);\n };\n}\n"]}
package/lib/utils/omit.js CHANGED
@@ -15,13 +15,11 @@
15
15
  export function omit(obj, exclusions) {
16
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
17
  const result = {};
18
-
19
18
  for (const key in obj) {
20
19
  if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {
21
20
  result[key] = obj[key];
22
21
  }
23
22
  }
24
-
25
23
  return result;
26
24
  }
27
25
  //# sourceMappingURL=omit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/omit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;AAYG;AACH;AACA,OAAM,SAAU,IAAV,CACJ,GADI,EAEJ,UAFI,EAEkB;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","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":""}
1
+ {"version":3,"mappings":"AAAA;;;;;;;;;;;;;AAaA;AACA,OAAM,SAAUA,IAAI,CAClBC,GAAS,EACTC,UAAsB;EAEtB;EACA,MAAMC,MAAM,GAAwB,EAAE;EAEtC,KAAK,MAAMC,GAAG,IAAIH,GAAG,EAAE;IACrB,IAAIC,UAAU,CAACG,OAAO,CAACD,GAAG,CAAC,KAAK,CAAC,CAAC,IAAIH,GAAG,CAACK,cAAc,CAACF,GAAG,CAAC,EAAE;MAC7DD,MAAM,CAACC,GAAG,CAAC,GAAGH,GAAG,CAACG,GAAG,CAAC;;;EAI1B,OAAOD,MAAc;AACvB","names":["omit","obj","exclusions","result","key","indexOf","hasOwnProperty"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-utilities/src/utils/omit.ts"],"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"]}