@fluentui/react-utilities 9.7.1 → 9.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +49 -1
  3. package/CHANGELOG.md +23 -2
  4. package/dist/index.d.ts +16 -4
  5. package/lib/compose/getSlots.js +3 -3
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.js.map +1 -1
  8. package/lib/compose/isResolvedShorthand.js.map +1 -1
  9. package/lib/compose/resolveShorthand.js.map +1 -1
  10. package/lib/compose/types.js +1 -1
  11. package/lib/compose/types.js.map +1 -1
  12. package/lib/events/index.js.map +1 -1
  13. package/lib/events/mouseTouchHelpers.js +1 -0
  14. package/lib/events/mouseTouchHelpers.js.map +1 -1
  15. package/lib/hooks/index.js.map +1 -1
  16. package/lib/hooks/useControllableState.js.map +1 -1
  17. package/lib/hooks/useEventCallback.js.map +1 -1
  18. package/lib/hooks/useFirstMount.js.map +1 -1
  19. package/lib/hooks/useForceUpdate.js.map +1 -1
  20. package/lib/hooks/useId.js.map +1 -1
  21. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -2
  22. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  23. package/lib/hooks/useMergedRefs.js.map +1 -1
  24. package/lib/hooks/useOnClickOutside.js +16 -9
  25. package/lib/hooks/useOnClickOutside.js.map +1 -1
  26. package/lib/hooks/useOnScrollOutside.js +3 -1
  27. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  28. package/lib/hooks/usePrevious.js.map +1 -1
  29. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  30. package/lib/hooks/useTimeout.js.map +1 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib/ssr/SSRContext.js +2 -2
  33. package/lib/ssr/SSRContext.js.map +1 -1
  34. package/lib/ssr/canUseDOM.js +1 -2
  35. package/lib/ssr/canUseDOM.js.map +1 -1
  36. package/lib/ssr/index.js.map +1 -1
  37. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  38. package/lib/trigger/getTriggerChild.js.map +1 -1
  39. package/lib/trigger/index.js.map +1 -1
  40. package/lib/trigger/isFluentTrigger.js +1 -0
  41. package/lib/trigger/isFluentTrigger.js.map +1 -1
  42. package/lib/trigger/types.js +1 -1
  43. package/lib/trigger/types.js.map +1 -1
  44. package/lib/utils/clamp.js +1 -2
  45. package/lib/utils/clamp.js.map +1 -1
  46. package/lib/utils/getNativeElementProps.js +2 -2
  47. package/lib/utils/getNativeElementProps.js.map +1 -1
  48. package/lib/utils/getRTLSafeKey.js +1 -2
  49. package/lib/utils/getRTLSafeKey.js.map +1 -1
  50. package/lib/utils/getReactCallbackName.js +1 -0
  51. package/lib/utils/getReactCallbackName.js.map +1 -1
  52. package/lib/utils/index.js.map +1 -1
  53. package/lib/utils/isHTMLElement.js +12 -7
  54. package/lib/utils/isHTMLElement.js.map +1 -1
  55. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  56. package/lib/utils/mergeCallbacks.js +1 -2
  57. package/lib/utils/mergeCallbacks.js.map +1 -1
  58. package/lib/utils/omit.js +1 -2
  59. package/lib/utils/omit.js.map +1 -1
  60. package/lib/utils/properties.js +24 -51
  61. package/lib/utils/properties.js.map +1 -1
  62. package/lib-commonjs/compose/getSlots.js +48 -55
  63. package/lib-commonjs/compose/getSlots.js.map +1 -1
  64. package/lib-commonjs/compose/index.js +8 -7
  65. package/lib-commonjs/compose/index.js.map +1 -1
  66. package/lib-commonjs/compose/isResolvedShorthand.js +9 -37
  67. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  68. package/lib-commonjs/compose/resolveShorthand.js +25 -32
  69. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  70. package/lib-commonjs/compose/types.js +5 -2
  71. package/lib-commonjs/compose/types.js.map +1 -1
  72. package/lib-commonjs/events/index.js +5 -4
  73. package/lib-commonjs/events/index.js.map +1 -1
  74. package/lib-commonjs/events/mouseTouchHelpers.js +40 -37
  75. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  76. package/lib-commonjs/hooks/index.js +16 -15
  77. package/lib-commonjs/hooks/index.js.map +1 -1
  78. package/lib-commonjs/hooks/useControllableState.js +63 -64
  79. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  80. package/lib-commonjs/hooks/useEventCallback.js +25 -31
  81. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  82. package/lib-commonjs/hooks/useFirstMount.js +15 -23
  83. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  84. package/lib-commonjs/hooks/useForceUpdate.js +9 -11
  85. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  86. package/lib-commonjs/hooks/useId.js +47 -46
  87. package/lib-commonjs/hooks/useId.js.map +1 -1
  88. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +10 -16
  89. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  90. package/lib-commonjs/hooks/useMergedRefs.js +25 -27
  91. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  92. package/lib-commonjs/hooks/useOnClickOutside.js +118 -114
  93. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  94. package/lib-commonjs/hooks/useOnScrollOutside.js +35 -36
  95. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  96. package/lib-commonjs/hooks/usePrevious.js +17 -15
  97. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  98. package/lib-commonjs/hooks/useScrollbarWidth.js +32 -32
  99. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  100. package/lib-commonjs/hooks/useTimeout.js +30 -30
  101. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  102. package/lib-commonjs/index.js +52 -214
  103. package/lib-commonjs/index.js.map +1 -1
  104. package/lib-commonjs/ssr/SSRContext.js +57 -59
  105. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  106. package/lib-commonjs/ssr/canUseDOM.js +12 -12
  107. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  108. package/lib-commonjs/ssr/index.js +6 -5
  109. package/lib-commonjs/ssr/index.js.map +1 -1
  110. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +29 -31
  111. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  112. package/lib-commonjs/trigger/getTriggerChild.js +16 -36
  113. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  114. package/lib-commonjs/trigger/index.js +8 -7
  115. package/lib-commonjs/trigger/index.js.map +1 -1
  116. package/lib-commonjs/trigger/isFluentTrigger.js +10 -11
  117. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  118. package/lib-commonjs/trigger/types.js +5 -2
  119. package/lib-commonjs/trigger/types.js.map +1 -1
  120. package/lib-commonjs/utils/clamp.js +10 -9
  121. package/lib-commonjs/utils/clamp.js.map +1 -1
  122. package/lib-commonjs/utils/getNativeElementProps.js +54 -61
  123. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  124. package/lib-commonjs/utils/getRTLSafeKey.js +22 -21
  125. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  126. package/lib-commonjs/utils/getReactCallbackName.js +24 -24
  127. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  128. package/lib-commonjs/utils/index.js +12 -11
  129. package/lib-commonjs/utils/index.js.map +1 -1
  130. package/lib-commonjs/utils/isHTMLElement.js +22 -15
  131. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  132. package/lib-commonjs/utils/isInteractiveHTMLElement.js +20 -24
  133. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  134. package/lib-commonjs/utils/mergeCallbacks.js +14 -13
  135. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  136. package/lib-commonjs/utils/omit.js +18 -17
  137. package/lib-commonjs/utils/omit.js.map +1 -1
  138. package/lib-commonjs/utils/properties.js +327 -223
  139. package/lib-commonjs/utils/properties.js.map +1 -1
  140. package/package.json +5 -4
  141. package/lib-amd/compose/getSlots.js +0 -58
  142. package/lib-amd/compose/getSlots.js.map +0 -1
  143. package/lib-amd/compose/index.js +0 -9
  144. package/lib-amd/compose/index.js.map +0 -1
  145. package/lib-amd/compose/isResolvedShorthand.js +0 -40
  146. package/lib-amd/compose/isResolvedShorthand.js.map +0 -1
  147. package/lib-amd/compose/resolveShorthand.js +0 -27
  148. package/lib-amd/compose/resolveShorthand.js.map +0 -1
  149. package/lib-amd/compose/types.js +0 -5
  150. package/lib-amd/compose/types.js.map +0 -1
  151. package/lib-amd/events/index.js +0 -6
  152. package/lib-amd/events/index.js.map +0 -1
  153. package/lib-amd/events/mouseTouchHelpers.js +0 -39
  154. package/lib-amd/events/mouseTouchHelpers.js.map +0 -1
  155. package/lib-amd/hooks/index.js +0 -17
  156. package/lib-amd/hooks/index.js.map +0 -1
  157. package/lib-amd/hooks/useControllableState.js +0 -81
  158. package/lib-amd/hooks/useControllableState.js.map +0 -1
  159. package/lib-amd/hooks/useEventCallback.js +0 -36
  160. package/lib-amd/hooks/useEventCallback.js.map +0 -1
  161. package/lib-amd/hooks/useFirstMount.js +0 -26
  162. package/lib-amd/hooks/useFirstMount.js.map +0 -1
  163. package/lib-amd/hooks/useForceUpdate.js +0 -14
  164. package/lib-amd/hooks/useForceUpdate.js.map +0 -1
  165. package/lib-amd/hooks/useId.js +0 -54
  166. package/lib-amd/hooks/useId.js.map +0 -1
  167. package/lib-amd/hooks/useIsomorphicLayoutEffect.js +0 -17
  168. package/lib-amd/hooks/useIsomorphicLayoutEffect.js.map +0 -1
  169. package/lib-amd/hooks/useMergedRefs.js +0 -34
  170. package/lib-amd/hooks/useMergedRefs.js.map +0 -1
  171. package/lib-amd/hooks/useOnClickOutside.js +0 -114
  172. package/lib-amd/hooks/useOnClickOutside.js.map +0 -1
  173. package/lib-amd/hooks/useOnScrollOutside.js +0 -31
  174. package/lib-amd/hooks/useOnScrollOutside.js.map +0 -1
  175. package/lib-amd/hooks/usePrevious.js +0 -17
  176. package/lib-amd/hooks/usePrevious.js.map +0 -1
  177. package/lib-amd/hooks/useScrollbarWidth.js +0 -32
  178. package/lib-amd/hooks/useScrollbarWidth.js.map +0 -1
  179. package/lib-amd/hooks/useTimeout.js +0 -33
  180. package/lib-amd/hooks/useTimeout.js.map +0 -1
  181. package/lib-amd/index.js +0 -40
  182. package/lib-amd/index.js.map +0 -1
  183. package/lib-amd/ssr/SSRContext.js +0 -69
  184. package/lib-amd/ssr/SSRContext.js.map +0 -1
  185. package/lib-amd/ssr/canUseDOM.js +0 -16
  186. package/lib-amd/ssr/canUseDOM.js.map +0 -1
  187. package/lib-amd/ssr/index.js +0 -7
  188. package/lib-amd/ssr/index.js.map +0 -1
  189. package/lib-amd/trigger/applyTriggerPropsToChildren.js +0 -40
  190. package/lib-amd/trigger/applyTriggerPropsToChildren.js.map +0 -1
  191. package/lib-amd/trigger/getTriggerChild.js +0 -40
  192. package/lib-amd/trigger/getTriggerChild.js.map +0 -1
  193. package/lib-amd/trigger/index.js +0 -9
  194. package/lib-amd/trigger/index.js.map +0 -1
  195. package/lib-amd/trigger/isFluentTrigger.js +0 -15
  196. package/lib-amd/trigger/isFluentTrigger.js.map +0 -1
  197. package/lib-amd/trigger/types.js +0 -5
  198. package/lib-amd/trigger/types.js.map +0 -1
  199. package/lib-amd/utils/clamp.js +0 -16
  200. package/lib-amd/utils/clamp.js.map +0 -1
  201. package/lib-amd/utils/getNativeElementProps.js +0 -64
  202. package/lib-amd/utils/getNativeElementProps.js.map +0 -1
  203. package/lib-amd/utils/getRTLSafeKey.js +0 -24
  204. package/lib-amd/utils/getRTLSafeKey.js.map +0 -1
  205. package/lib-amd/utils/index.js +0 -13
  206. package/lib-amd/utils/index.js.map +0 -1
  207. package/lib-amd/utils/isHTMLElement.js +0 -22
  208. package/lib-amd/utils/isHTMLElement.js.map +0 -1
  209. package/lib-amd/utils/isInteractiveHTMLElement.js +0 -25
  210. package/lib-amd/utils/isInteractiveHTMLElement.js.map +0 -1
  211. package/lib-amd/utils/mergeCallbacks.js +0 -40
  212. package/lib-amd/utils/mergeCallbacks.js.map +0 -1
  213. package/lib-amd/utils/omit.js +0 -31
  214. package/lib-amd/utils/omit.js.map +0 -1
  215. package/lib-amd/utils/properties.js +0 -450
  216. package/lib-amd/utils/properties.js.map +0 -1
@@ -1,69 +1,67 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ defaultSSRContextValue: ()=>defaultSSRContextValue,
13
+ SSRContext: ()=>SSRContext,
14
+ useSSRContext: ()=>useSSRContext,
15
+ SSRProvider: ()=>SSRProvider,
16
+ useIsSSR: ()=>useIsSSR
5
17
  });
6
- exports.useIsSSR = exports.SSRProvider = exports.useSSRContext = exports.SSRContext = exports.defaultSSRContextValue = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const canUseDOM_1 = /*#__PURE__*/require("./canUseDOM");
9
- /**
10
- * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
11
- *
12
- * @internal
13
- */
14
- exports.defaultSSRContextValue = {
15
- current: 0
18
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
19
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
20
+ const _canUseDOM = require("./canUseDOM");
21
+ const defaultSSRContextValue = {
22
+ current: 0
16
23
  };
17
- exports.SSRContext = /*#__PURE__*/React.createContext(undefined);
18
- /**
19
- * @internal
20
- */
24
+ const SSRContext = /*#__PURE__*/ _react.createContext(undefined);
21
25
  function useSSRContext() {
22
- var _a;
23
- return (_a = React.useContext(exports.SSRContext)) !== null && _a !== void 0 ? _a : exports.defaultSSRContextValue;
26
+ var _React_useContext;
27
+ return (_React_useContext = _react.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;
24
28
  }
25
- exports.useSSRContext = useSSRContext;
26
- /**
27
- * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids
28
- * are consistent between the client and server.
29
- *
30
- * @public
31
- */
32
- const SSRProvider = props => {
33
- const [value] = React.useState(() => ({
34
- current: 0
35
- }));
36
- return React.createElement(exports.SSRContext.Provider, {
37
- value: value
38
- }, props.children);
29
+ const SSRProvider = (props)=>{
30
+ const [value] = _react.useState(()=>({
31
+ current: 0
32
+ }));
33
+ return /*#__PURE__*/ _react.createElement(SSRContext.Provider, {
34
+ value: value
35
+ }, props.children);
39
36
  };
40
- exports.SSRProvider = SSRProvider;
41
- /**
42
- * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay
43
- * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.
44
- */
45
37
  function useIsSSR() {
46
- const isInSSRContext = useSSRContext() !== exports.defaultSSRContextValue;
47
- const [isSSR, setIsSSR] = React.useState(isInSSRContext);
48
- // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
49
- // developer to add one.
50
- if (process.env.NODE_ENV !== 'production') {
51
- if (!isInSSRContext && !canUseDOM_1.canUseDOM()) {
52
- // eslint-disable-next-line no-console
53
- 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(''));
38
+ const isInSSRContext = useSSRContext() !== defaultSSRContextValue;
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
41
+ // developer to add one.
42
+ if (process.env.NODE_ENV !== 'production') {
43
+ if (!isInSSRContext && !(0, _canUseDOM.canUseDOM)()) {
44
+ // eslint-disable-next-line no-console
45
+ console.error([
46
+ '@fluentui/react-components: ',
47
+ 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.',
48
+ '\n',
49
+ '\n',
50
+ 'Check documentation at https://aka.ms/fluentui-ssr'
51
+ ].join(''));
52
+ }
54
53
  }
55
- }
56
- // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
57
- // component after hydration.
58
- if (canUseDOM_1.canUseDOM() && isInSSRContext) {
59
- // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
60
- // mounting.
61
- // eslint-disable-next-line
62
- React.useLayoutEffect(() => {
63
- setIsSSR(false);
64
- }, []);
65
- }
66
- return isSSR;
67
- }
68
- exports.useIsSSR = useIsSSR;
54
+ // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
55
+ // component after hydration.
56
+ if ((0, _canUseDOM.canUseDOM)() && isInSSRContext) {
57
+ // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
58
+ // mounting.
59
+ // eslint-disable-next-line
60
+ _react.useLayoutEffect(()=>{
61
+ setIsSSR(false);
62
+ }, []);
63
+ }
64
+ return isSSR;
65
+ } //# sourceMappingURL=SSRContext.js.map
66
+
69
67
  //# sourceMappingURL=SSRContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","canUseDOM_1","exports","defaultSSRContextValue","current","SSRContext","createContext","undefined","useSSRContext","_a","useContext","SSRProvider","props","value","useState","createElement","Provider","children","useIsSSR","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","join","useLayoutEffect"],"sources":["../src/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<{ children: React.ReactNode }> = 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"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,WAAA,gBAAAD,OAAA;AAYA;;;;;AAKaE,OAAA,CAAAC,sBAAsB,GAAoB;EACrDC,OAAO,EAAE;CACV;AAEYF,OAAA,CAAAG,UAAU,gBAAGN,KAAK,CAACO,aAAa,CAA8BC,SAAS,CAAmC;AAEvH;;;AAGA,SAAgBC,aAAaA,CAAA;;EAC3B,OAAO,CAAAC,EAAA,GAAAV,KAAK,CAACW,UAAU,CAACR,OAAA,CAAAG,UAAU,CAAC,cAAAI,EAAA,cAAAA,EAAA,GAAIP,OAAA,CAAAC,sBAAsB;AAC/D;AAFAD,OAAA,CAAAM,aAAA,GAAAA,aAAA;AAIA;;;;;;AAMO,MAAMG,WAAW,GAA4CC,KAAK,IAAG;EAC1E,MAAM,CAACC,KAAK,CAAC,GAAGd,KAAK,CAACe,QAAQ,CAAkB,OAAO;IAAEV,OAAO,EAAE;EAAC,CAAE,CAAC,CAAC;EAEvE,OAAOL,KAAA,CAAAgB,aAAA,CAACb,OAAA,CAAAG,UAAU,CAACW,QAAQ;IAACH,KAAK,EAAEA;EAAK,GAAGD,KAAK,CAACK,QAAQ,CAAuB;AAClF,CAAC;AAJYf,OAAA,CAAAS,WAAW,GAAAA,WAAA;AAMxB;;;;AAIA,SAAgBO,QAAQA,CAAA;EACtB,MAAMC,cAAc,GAAGX,aAAa,EAAE,KAAKN,OAAA,CAAAC,sBAAsB;EACjE,MAAM,CAACiB,KAAK,EAAEC,QAAQ,CAAC,GAAGtB,KAAK,CAACe,QAAQ,CAACK,cAAc,CAAC;EAExD;EACA;EACA,IAAIG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI,CAACL,cAAc,IAAI,CAAClB,WAAA,CAAAwB,SAAS,EAAE,EAAE;MACnC;MACAC,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,IAAI3B,WAAA,CAAAwB,SAAS,EAAE,IAAIN,cAAc,EAAE;IACjC;IACA;IACA;IACApB,KAAK,CAAC8B,eAAe,CAAC,MAAK;MACzBR,QAAQ,CAAC,KAAK,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC;;EAGR,OAAOD,KAAK;AACd;AAlCAlB,OAAA,CAAAgB,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"sources":["../../lib/ssr/SSRContext.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\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 = {\n current: 0\n};\nexport const SSRContext = /*#__PURE__*/React.createContext(undefined);\n/**\n * @internal\n */\nexport function useSSRContext() {\n var _React_useContext;\n return (_React_useContext = React.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;\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 = props => {\n const [value] = React.useState(() => ({\n current: 0\n }));\n return /*#__PURE__*/React.createElement(SSRContext.Provider, {\n value: value\n }, props.children);\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() {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\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(['@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(''));\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 return isSSR;\n}\n//# sourceMappingURL=SSRContext.js.map"],"names":["defaultSSRContextValue","SSRContext","useSSRContext","SSRProvider","useIsSSR","current","React","createContext","undefined","_React_useContext","useContext","props","value","useState","createElement","Provider","children","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","join","useLayoutEffect"],"mappings":";;;;;;;;;;;IAOaA,sBAAsB,MAAtBA;IAGAC,UAAU,MAAVA;IAIGC,aAAa,MAAbA;IAUHC,WAAW,MAAXA;IAYGC,QAAQ,MAARA;;;6DApCO;2BACG;AAMnB,MAAMJ,yBAAyB;IACpCK,SAAS;AACX;AACO,MAAMJ,aAAa,WAAW,GAAEK,OAAMC,aAAa,CAACC;AAIpD,SAASN,gBAAgB;IAC9B,IAAIO;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACT,WAAU,MAAO,IAAI,IAAIQ,sBAAsB,KAAK,IAAIA,oBAAoBT,sBAAsB;AACjJ;AAOO,MAAMG,cAAcQ,CAAAA,QAAS;IAClC,MAAM,CAACC,MAAM,GAAGN,OAAMO,QAAQ,CAAC,IAAO,CAAA;YACpCR,SAAS;QACX,CAAA;IACA,OAAO,WAAW,GAAEC,OAAMQ,aAAa,CAACb,WAAWc,QAAQ,EAAE;QAC3DH,OAAOA;IACT,GAAGD,MAAMK,QAAQ;AACnB;AAKO,SAASZ,WAAW;IACzB,MAAMa,iBAAiBf,oBAAoBF;IAC3C,MAAM,CAACkB,OAAOC,SAAS,GAAGb,OAAMO,QAAQ,CAACI;IACzC,6GAA6G;IAC7G,wBAAwB;IACxB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,CAACL,kBAAkB,CAACM,IAAAA,oBAAS,KAAI;YACnC,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;gBAAC;gBAAgC,4GAA4G;gBAA4C;gBAAM;gBAAM;aAAqD,CAACC,IAAI,CAAC;QAChR,CAAC;IACH,CAAC;IACD,iHAAiH;IACjH,6BAA6B;IAC7B,IAAIH,IAAAA,oBAAS,OAAMN,gBAAgB;QACjC,iHAAiH;QACjH,YAAY;QACZ,2BAA2B;QAC3BX,OAAMqB,eAAe,CAAC,IAAM;YAC1BR,SAAS,KAAK;QAChB,GAAG,EAAE;IACP,CAAC;IACD,OAAOD;AACT,EACA,sCAAsC"}
@@ -1,16 +1,16 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.canUseDOM = void 0;
7
1
  /**
8
2
  * Verifies if an application can use DOM.
9
- */
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "canUseDOM", {
8
+ enumerable: true,
9
+ get: ()=>canUseDOM
10
+ });
10
11
  function canUseDOM() {
11
- return typeof window !== 'undefined' && !!(window.document &&
12
- // eslint-disable-next-line deprecation/deprecation
13
- window.document.createElement);
14
- }
15
- exports.canUseDOM = canUseDOM;
12
+ return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation
13
+ window.document.createElement);
14
+ } //# sourceMappingURL=canUseDOM.js.map
15
+
16
16
  //# sourceMappingURL=canUseDOM.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["canUseDOM","window","document","createElement","exports"],"sources":["../src/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"],"mappings":";;;;;;AAAA;;;AAGA,SAAgBA,SAASA,CAAA;EACvB,OACE,OAAOC,MAAM,KAAK,WAAW,IAC7B,CAAC,EACCA,MAAM,CAACC,QAAQ;EACf;EACAD,MAAM,CAACC,QAAQ,CAACC,aAAa,CAC9B;AAEL;AATAC,OAAA,CAAAJ,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"sources":["../../lib/ssr/canUseDOM.js"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */export function canUseDOM() {\n return typeof window !== 'undefined' && !!(window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement);\n}\n//# sourceMappingURL=canUseDOM.js.map"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;CAEC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,YAAY;IAC7B,OAAO,OAAOC,WAAW,eAAe,CAAC,CAAEA,CAAAA,OAAOC,QAAQ,IAC1D,mDAAmD;IACnDD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAC9B,EACA,qCAAqC"}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./canUseDOM"), exports);
8
- tslib_1.__exportStar(require("./SSRContext"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./canUseDOM"), exports);
7
+ _exportStar(require("./SSRContext"), exports);
8
+ //# sourceMappingURL=index.js.map
9
+
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-utilities/src/ssr/index.ts"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,iBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,kBAAAC,OAAA"}
1
+ {"version":3,"sources":["../../lib/ssr/index.js"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;CACd,iCAAiC"}
@@ -1,40 +1,38 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.applyTriggerPropsToChildren = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
9
- /**
10
- * @internal
11
- * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.
12
- */
5
+ Object.defineProperty(exports, "applyTriggerPropsToChildren", {
6
+ enumerable: true,
7
+ get: ()=>applyTriggerPropsToChildren
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _isFluentTrigger = require("./isFluentTrigger");
13
12
  function applyTriggerPropsToChildren(children, triggerChildProps) {
14
- if (typeof children === 'function') {
15
- return children(triggerChildProps);
16
- } else if (children) {
17
- return cloneTriggerTree(children, triggerChildProps);
18
- }
19
- // Components in React should return either JSX elements or "null", otherwise React will throw:
20
- // Nothing was returned from render.
21
- // This usually means a return statement is missing. Or, to render nothing, return null.
22
- return children || null;
13
+ if (typeof children === 'function') {
14
+ return children(triggerChildProps);
15
+ } else if (children) {
16
+ return cloneTriggerTree(children, triggerChildProps);
17
+ }
18
+ // Components in React should return either JSX elements or "null", otherwise React will throw:
19
+ // Nothing was returned from render.
20
+ // This usually means a return statement is missing. Or, to render nothing, return null.
21
+ return children || null;
23
22
  }
24
- exports.applyTriggerPropsToChildren = applyTriggerPropsToChildren;
25
23
  /**
26
24
  * Clones a React element tree, and applies the given props to the first grandchild that is not
27
25
  * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
28
- */
29
- function cloneTriggerTree(child, triggerProps) {
30
- if (!React.isValidElement(child) || child.type === React.Fragment) {
31
- throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
32
- }
33
- if (isFluentTrigger_1.isFluentTrigger(child)) {
34
- const grandchild = cloneTriggerTree(child.props.children, triggerProps);
35
- return React.cloneElement(child, undefined, grandchild);
36
- } else {
37
- return React.cloneElement(child, triggerProps);
38
- }
39
- }
26
+ */ function cloneTriggerTree(child, triggerProps) {
27
+ if (!/*#__PURE__*/ _react.isValidElement(child) || child.type === _react.Fragment) {
28
+ throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
29
+ }
30
+ if ((0, _isFluentTrigger.isFluentTrigger)(child)) {
31
+ const grandchild = cloneTriggerTree(child.props.children, triggerProps);
32
+ return /*#__PURE__*/ _react.cloneElement(child, undefined, grandchild);
33
+ } else {
34
+ return /*#__PURE__*/ _react.cloneElement(child, triggerProps);
35
+ }
36
+ } //# sourceMappingURL=applyTriggerPropsToChildren.js.map
37
+
40
38
  //# sourceMappingURL=applyTriggerPropsToChildren.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","isFluentTrigger_1","applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","exports","child","triggerProps","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"sources":["../src/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"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;;AAIA,SAAgBE,2BAA2BA,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;AAdAG,OAAA,CAAAJ,2BAAA,GAAAA,2BAAA;AAgBA;;;;AAIA,SAASG,gBAAgBA,CACvBE,KAAsB,EACtBC,YAA+B;EAE/B,IAAI,CAACT,KAAK,CAACU,cAAc,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,KAAKX,KAAK,CAACY,QAAQ,EAAE;IACjE,MAAM,IAAIC,KAAK,CACb,iEAAiE,GAC/D,sDAAsD,CACzD;;EAGH,IAAIX,iBAAA,CAAAY,eAAe,CAACN,KAAK,CAAC,EAAE;IAC1B,MAAMO,UAAU,GAAGT,gBAAgB,CAACE,KAAK,CAACQ,KAAK,CAACZ,QAAQ,EAAEK,YAAY,CAAC;IACvE,OAAOT,KAAK,CAACiB,YAAY,CAACT,KAAK,EAAEU,SAAS,EAAEH,UAAU,CAAC;GACxD,MAAM;IACL,OAAOf,KAAK,CAACiB,YAAY,CAACT,KAAK,EAAEC,YAAoD,CAAC;;AAE1F"}
1
+ {"version":3,"sources":["../../lib/trigger/applyTriggerPropsToChildren.js"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\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(children, triggerChildProps) {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\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 * 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(child, triggerProps) {\n if (! /*#__PURE__*/React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error('A trigger element must be a single element for this component. ' + \"Please ensure that you're not using React Fragments.\");\n }\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return /*#__PURE__*/React.cloneElement(child, undefined, grandchild);\n } else {\n return /*#__PURE__*/React.cloneElement(child, triggerProps);\n }\n}\n//# sourceMappingURL=applyTriggerPropsToChildren.js.map"],"names":["applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","React","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"mappings":";;;;+BAMgBA;;aAAAA;;;6DANO;iCACS;AAKzB,SAASA,4BAA4BC,QAAQ,EAAEC,iBAAiB,EAAE;IACvE,IAAI,OAAOD,aAAa,YAAY;QAClC,OAAOA,SAASC;IAClB,OAAO,IAAID,UAAU;QACnB,OAAOE,iBAAiBF,UAAUC;IACpC,CAAC;IACD,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY,IAAI;AACzB;AACA;;;CAGC,GACD,SAASE,iBAAiBC,KAAK,EAAEC,YAAY,EAAE;IAC7C,IAAI,CAAE,WAAW,GAAEC,OAAMC,cAAc,CAACH,UAAUA,MAAMI,IAAI,KAAKF,OAAMG,QAAQ,EAAE;QAC/E,MAAM,IAAIC,MAAM,oEAAoE,wDAAwD;IAC9I,CAAC;IACD,IAAIC,IAAAA,gCAAe,EAACP,QAAQ;QAC1B,MAAMQ,aAAaT,iBAAiBC,MAAMS,KAAK,CAACZ,QAAQ,EAAEI;QAC1D,OAAO,WAAW,GAAEC,OAAMQ,YAAY,CAACV,OAAOW,WAAWH;IAC3D,OAAO;QACL,OAAO,WAAW,GAAEN,OAAMQ,YAAY,CAACV,OAAOC;IAChD,CAAC;AACH,EACA,uDAAuD"}
@@ -1,41 +1,21 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getTriggerChild", {
6
+ enumerable: true,
7
+ get: ()=>getTriggerChild
5
8
  });
6
- exports.getTriggerChild = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
9
- /**
10
- * @internal
11
- * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
12
- *
13
- * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
14
- * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.
15
- * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.
16
- *
17
- * For example, the following returns `<div id="child" />`:
18
- * ```jsx
19
- * getTriggerChild(
20
- * <Tooltip>
21
- * <MenuTrigger>
22
- * <div id="child" />
23
- * </MenuTrigger>
24
- * </Tooltip>
25
- * );
26
- * ```
27
- *
28
- * In the case where the immediate child is not a valid element,
29
- * null is returned
30
- */
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _isFluentTrigger = require("./isFluentTrigger");
31
12
  function getTriggerChild(children) {
32
- if (!React.isValidElement(children)) {
33
- return null;
34
- }
35
- return isFluentTrigger_1.isFluentTrigger(children) ? getTriggerChild(
36
- // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
37
- // but for some reason it's failing on build
38
- children.props.children) : children;
39
- }
40
- exports.getTriggerChild = getTriggerChild;
13
+ if (!/*#__PURE__*/ _react.isValidElement(children)) {
14
+ return null;
15
+ }
16
+ return (0, _isFluentTrigger.isFluentTrigger)(children) ? getTriggerChild(// FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
17
+ // but for some reason it's failing on build
18
+ children.props.children) : children;
19
+ } //# sourceMappingURL=getTriggerChild.js.map
20
+
41
21
  //# sourceMappingURL=getTriggerChild.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","isFluentTrigger_1","getTriggerChild","children","isValidElement","isFluentTrigger","props","exports"],"sources":["../src/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"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGA;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgBE,eAAeA,CAC7BC,QAAqD;EAGrD,IAAI,CAACJ,KAAK,CAACK,cAAc,CAAoBD,QAAQ,CAAC,EAAE;IACtD,OAAO,IAAI;;EAEb,OAAOF,iBAAA,CAAAI,eAAe,CAACF,QAAQ,CAAC,GAC5BD,eAAe;EACb;EACA;EACCC,QAAQ,CAACG,KAAsB,CAACH,QAAQ,CAC1C,GACDA,QAAQ;AACd;AAdAI,OAAA,CAAAL,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"sources":["../../lib/trigger/getTriggerChild.js"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\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(children) {\n if (! /*#__PURE__*/React.isValidElement(children)) {\n return null;\n }\n return isFluentTrigger(children) ? 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.children) : children;\n}\n//# sourceMappingURL=getTriggerChild.js.map"],"names":["getTriggerChild","children","React","isValidElement","isFluentTrigger","props"],"mappings":";;;;+BAwBgBA;;aAAAA;;;6DAxBO;iCACS;AAuBzB,SAASA,gBAAgBC,QAAQ,EAAE;IACxC,IAAI,CAAE,WAAW,GAAEC,OAAMC,cAAc,CAACF,WAAW;QACjD,OAAO,IAAI;IACb,CAAC;IACD,OAAOG,IAAAA,gCAAe,EAACH,YAAYD,gBACnC,uFAAuF;IACvF,4CAA4C;IAC5CC,SAASI,KAAK,CAACJ,QAAQ,IAAIA,QAAQ;AACrC,EACA,2CAA2C"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./applyTriggerPropsToChildren"), exports);
8
- tslib_1.__exportStar(require("./getTriggerChild"), exports);
9
- tslib_1.__exportStar(require("./isFluentTrigger"), exports);
10
- tslib_1.__exportStar(require("./types"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./applyTriggerPropsToChildren"), exports);
7
+ _exportStar(require("./getTriggerChild"), exports);
8
+ _exportStar(require("./isFluentTrigger"), exports);
9
+ _exportStar(require("./types"), exports);
10
+ //# sourceMappingURL=index.js.map
11
+
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-utilities/src/trigger/index.ts"],"sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mCAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,uBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,uBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,aAAAC,OAAA"}
1
+ {"version":3,"sources":["../../lib/trigger/index.js"],"sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;CACd,iCAAiC"}
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "isFluentTrigger", {
6
+ enumerable: true,
7
+ get: ()=>isFluentTrigger
5
8
  });
6
- exports.isFluentTrigger = void 0;
7
- /**
8
- * @internal
9
- * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
10
- * See the {@link FluentTriggerComponent} type for more info.
11
- */
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
12
11
  function isFluentTrigger(element) {
13
- return Boolean(element.type.isFluentTriggerComponent);
14
- }
15
- exports.isFluentTrigger = isFluentTrigger;
12
+ return Boolean(element.type.isFluentTriggerComponent);
13
+ } //# sourceMappingURL=isFluentTrigger.js.map
14
+
16
15
  //# sourceMappingURL=isFluentTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent","exports"],"sources":["../src/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"],"mappings":";;;;;;AAGA;;;;;AAKA,SAAgBA,eAAeA,CAACC,OAA2B;EACzD,OAAOC,OAAO,CAAED,OAAO,CAACE,IAA+B,CAACC,wBAAwB,CAAC;AACnF;AAFAC,OAAA,CAAAL,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"sources":["../../lib/trigger/isFluentTrigger.js"],"sourcesContent":["import * as React from 'react';\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) {\n return Boolean(element.type.isFluentTriggerComponent);\n}\n//# sourceMappingURL=isFluentTrigger.js.map"],"names":["isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"mappings":";;;;+BAMgBA;;aAAAA;;;6DANO;AAMhB,SAASA,gBAAgBC,OAAO,EAAE;IACvC,OAAOC,QAAQD,QAAQE,IAAI,CAACC,wBAAwB;AACtD,EACA,2CAA2C"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
5
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
+ //# sourceMappingURL=types.js.map
8
+
6
9
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/packages/react-components/react-utilities/src/trigger/types.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * @internal\n * Allows a component to be tagged as a FluentUI trigger component.\n *\n * Triggers are special-case components: they attach event listeners and other props on their child,\n * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.\n *\n * A component can be tagged as a trigger as follows:\n * ```ts\n * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;\n *\n * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true\n * ```\n */\nexport type FluentTriggerComponent = {\n isFluentTriggerComponent?: boolean;\n};\n\n/**\n * A trigger may have a children that could be either:\n * 1. A single element\n * 2. A render function that will receive properties and must return a valid element or null\n * 3. null or undefined\n */\nexport type TriggerProps<TriggerChildProps = unknown> = {\n children?: React.ReactElement | ((props: TriggerChildProps) => React.ReactElement | null) | null;\n};\n"],"mappings":""}
1
+ {"version":3,"sources":["../../lib/trigger/types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,iCAAiC"}
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.clamp = void 0;
7
1
  /**
8
2
  * @internal
9
3
  * Clamps `value` to a number between the min and max.
@@ -11,7 +5,14 @@ exports.clamp = void 0;
11
5
  * @param value - the value to be clamped
12
6
  * @param min - the lowest valid value
13
7
  * @param max - the highest valid value
14
- */
15
- const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
16
- exports.clamp = clamp;
8
+ */ "use strict";
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+ Object.defineProperty(exports, "clamp", {
13
+ enumerable: true,
14
+ get: ()=>clamp
15
+ });
16
+ const clamp = (value, min, max)=>Math.max(min, Math.min(max, value || 0)); //# sourceMappingURL=clamp.js.map
17
+
17
18
  //# sourceMappingURL=clamp.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["clamp","value","min","max","Math","exports"],"sources":["../src/packages/react-components/react-utilities/src/utils/clamp.ts"],"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"],"mappings":";;;;;;AAAA;;;;;;;;AAQO,MAAMA,KAAK,GAAGA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,KAAaC,IAAI,CAACD,GAAG,CAACD,GAAG,EAAEE,IAAI,CAACF,GAAG,CAACC,GAAG,EAAEF,KAAK,IAAI,CAAC,CAAC,CAAC;AAArGI,OAAA,CAAAL,KAAK,GAAAA,KAAA"}
1
+ {"version":3,"sources":["../../lib/utils/clamp.js"],"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 */export const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));\n//# sourceMappingURL=clamp.js.map"],"names":["clamp","value","min","max","Math"],"mappings":"AAAA;;;;;;;CAOC;;;;+BAAeA;;aAAAA;;AAAN,MAAMA,QAAQ,CAACC,OAAOC,KAAKC,MAAQC,KAAKD,GAAG,CAACD,KAAKE,KAAKF,GAAG,CAACC,KAAKF,SAAS,KAClF,iCAAiC"}