@fluentui/react-utilities 9.9.1 → 9.9.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 (172) hide show
  1. package/CHANGELOG.json +31 -1
  2. package/CHANGELOG.md +20 -2
  3. package/dist/index.d.ts +1 -1
  4. package/lib/compose/constants.js +1 -2
  5. package/lib/compose/constants.js.map +1 -1
  6. package/lib/compose/getSlots.js +40 -36
  7. package/lib/compose/getSlots.js.map +1 -1
  8. package/lib/compose/getSlotsNext.js +30 -28
  9. package/lib/compose/getSlotsNext.js.map +1 -1
  10. package/lib/compose/index.js +0 -1
  11. package/lib/compose/index.js.map +1 -1
  12. package/lib/compose/isResolvedShorthand.js +2 -4
  13. package/lib/compose/isResolvedShorthand.js.map +1 -1
  14. package/lib/compose/resolveShorthand.js +21 -26
  15. package/lib/compose/resolveShorthand.js.map +1 -1
  16. package/lib/compose/types.js +0 -1
  17. package/lib/compose/types.js.map +1 -1
  18. package/lib/events/index.js +0 -1
  19. package/lib/events/index.js.map +1 -1
  20. package/lib/events/mouseTouchHelpers.js +27 -27
  21. package/lib/events/mouseTouchHelpers.js.map +1 -1
  22. package/lib/hooks/index.js +0 -1
  23. package/lib/hooks/index.js.map +1 -1
  24. package/lib/hooks/useControllableState.js +55 -42
  25. package/lib/hooks/useControllableState.js.map +1 -1
  26. package/lib/hooks/useEventCallback.js +15 -13
  27. package/lib/hooks/useEventCallback.js.map +1 -1
  28. package/lib/hooks/useFirstMount.js +7 -9
  29. package/lib/hooks/useFirstMount.js.map +1 -1
  30. package/lib/hooks/useForceUpdate.js +2 -4
  31. package/lib/hooks/useForceUpdate.js.map +1 -1
  32. package/lib/hooks/useId.js +32 -29
  33. package/lib/hooks/useId.js.map +1 -1
  34. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -2
  35. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  36. package/lib/hooks/useMergedRefs.js +17 -18
  37. package/lib/hooks/useMergedRefs.js.map +1 -1
  38. package/lib/hooks/useOnClickOutside.js +110 -114
  39. package/lib/hooks/useOnClickOutside.js.map +1 -1
  40. package/lib/hooks/useOnScrollOutside.js +25 -29
  41. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  42. package/lib/hooks/usePrevious.js +8 -8
  43. package/lib/hooks/usePrevious.js.map +1 -1
  44. package/lib/hooks/useScrollbarWidth.js +24 -26
  45. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  46. package/lib/hooks/useTimeout.js +22 -19
  47. package/lib/hooks/useTimeout.js.map +1 -1
  48. package/lib/index.js +0 -1
  49. package/lib/index.js.map +1 -1
  50. package/lib/ssr/SSRContext.js +40 -39
  51. package/lib/ssr/SSRContext.js.map +1 -1
  52. package/lib/ssr/canUseDOM.js +3 -5
  53. package/lib/ssr/canUseDOM.js.map +1 -1
  54. package/lib/ssr/index.js +0 -1
  55. package/lib/ssr/index.js.map +1 -1
  56. package/lib/trigger/applyTriggerPropsToChildren.js +20 -23
  57. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  58. package/lib/trigger/getTriggerChild.js +7 -10
  59. package/lib/trigger/getTriggerChild.js.map +1 -1
  60. package/lib/trigger/index.js +0 -1
  61. package/lib/trigger/index.js.map +1 -1
  62. package/lib/trigger/isFluentTrigger.js +2 -4
  63. package/lib/trigger/isFluentTrigger.js.map +1 -1
  64. package/lib/trigger/types.js +0 -1
  65. package/lib/trigger/types.js.map +1 -1
  66. package/lib/utils/clamp.js +1 -2
  67. package/lib/utils/clamp.js.map +1 -1
  68. package/lib/utils/getNativeElementProps.js +38 -40
  69. package/lib/utils/getNativeElementProps.js.map +1 -1
  70. package/lib/utils/getRTLSafeKey.js +12 -13
  71. package/lib/utils/getRTLSafeKey.js.map +1 -1
  72. package/lib/utils/getReactCallbackName.js +16 -15
  73. package/lib/utils/getReactCallbackName.js.map +1 -1
  74. package/lib/utils/index.js +0 -1
  75. package/lib/utils/index.js.map +1 -1
  76. package/lib/utils/isHTMLElement.js +5 -6
  77. package/lib/utils/isHTMLElement.js.map +1 -1
  78. package/lib/utils/isInteractiveHTMLElement.js +13 -17
  79. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  80. package/lib/utils/mergeCallbacks.js +5 -6
  81. package/lib/utils/mergeCallbacks.js.map +1 -1
  82. package/lib/utils/omit.js +7 -8
  83. package/lib/utils/omit.js.map +1 -1
  84. package/lib/utils/priorityQueue.js +85 -86
  85. package/lib/utils/priorityQueue.js.map +1 -1
  86. package/lib/utils/properties.js +292 -80
  87. package/lib/utils/properties.js.map +1 -1
  88. package/lib-commonjs/compose/constants.js +1 -3
  89. package/lib-commonjs/compose/constants.js.map +1 -1
  90. package/lib-commonjs/compose/getSlots.js +1 -3
  91. package/lib-commonjs/compose/getSlots.js.map +1 -1
  92. package/lib-commonjs/compose/getSlotsNext.js +2 -3
  93. package/lib-commonjs/compose/getSlotsNext.js.map +1 -1
  94. package/lib-commonjs/compose/index.js +0 -3
  95. package/lib-commonjs/compose/index.js.map +1 -1
  96. package/lib-commonjs/compose/isResolvedShorthand.js +1 -3
  97. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  98. package/lib-commonjs/compose/resolveShorthand.js +1 -3
  99. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  100. package/lib-commonjs/compose/types.js +0 -3
  101. package/lib-commonjs/compose/types.js.map +1 -1
  102. package/lib-commonjs/events/index.js +0 -3
  103. package/lib-commonjs/events/index.js.map +1 -1
  104. package/lib-commonjs/events/mouseTouchHelpers.js +1 -3
  105. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  106. package/lib-commonjs/hooks/index.js +0 -3
  107. package/lib-commonjs/hooks/index.js.map +1 -1
  108. package/lib-commonjs/hooks/useControllableState.js +1 -3
  109. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  110. package/lib-commonjs/hooks/useEventCallback.js +1 -3
  111. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  112. package/lib-commonjs/hooks/useFirstMount.js +1 -3
  113. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  114. package/lib-commonjs/hooks/useForceUpdate.js +1 -3
  115. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  116. package/lib-commonjs/hooks/useId.js +1 -3
  117. package/lib-commonjs/hooks/useId.js.map +1 -1
  118. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +1 -3
  119. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  120. package/lib-commonjs/hooks/useMergedRefs.js +2 -5
  121. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  122. package/lib-commonjs/hooks/useOnClickOutside.js +1 -3
  123. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  124. package/lib-commonjs/hooks/useOnScrollOutside.js +1 -3
  125. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  126. package/lib-commonjs/hooks/usePrevious.js +1 -3
  127. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  128. package/lib-commonjs/hooks/useScrollbarWidth.js +2 -4
  129. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  130. package/lib-commonjs/hooks/useTimeout.js +1 -3
  131. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  132. package/lib-commonjs/index.js +0 -3
  133. package/lib-commonjs/index.js.map +1 -1
  134. package/lib-commonjs/ssr/SSRContext.js +1 -3
  135. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  136. package/lib-commonjs/ssr/canUseDOM.js +1 -3
  137. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  138. package/lib-commonjs/ssr/index.js +0 -3
  139. package/lib-commonjs/ssr/index.js.map +1 -1
  140. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +1 -3
  141. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  142. package/lib-commonjs/trigger/getTriggerChild.js +2 -5
  143. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  144. package/lib-commonjs/trigger/index.js +0 -3
  145. package/lib-commonjs/trigger/index.js.map +1 -1
  146. package/lib-commonjs/trigger/isFluentTrigger.js +1 -3
  147. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  148. package/lib-commonjs/trigger/types.js +0 -3
  149. package/lib-commonjs/trigger/types.js.map +1 -1
  150. package/lib-commonjs/utils/clamp.js +1 -3
  151. package/lib-commonjs/utils/clamp.js.map +1 -1
  152. package/lib-commonjs/utils/getNativeElementProps.js +1 -3
  153. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  154. package/lib-commonjs/utils/getRTLSafeKey.js +1 -3
  155. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  156. package/lib-commonjs/utils/getReactCallbackName.js +1 -3
  157. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  158. package/lib-commonjs/utils/index.js +0 -3
  159. package/lib-commonjs/utils/index.js.map +1 -1
  160. package/lib-commonjs/utils/isHTMLElement.js +1 -3
  161. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  162. package/lib-commonjs/utils/isInteractiveHTMLElement.js +1 -3
  163. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  164. package/lib-commonjs/utils/mergeCallbacks.js +1 -3
  165. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  166. package/lib-commonjs/utils/omit.js +1 -3
  167. package/lib-commonjs/utils/omit.js.map +1 -1
  168. package/lib-commonjs/utils/priorityQueue.js +5 -7
  169. package/lib-commonjs/utils/priorityQueue.js.map +1 -1
  170. package/lib-commonjs/utils/properties.js +30 -31
  171. package/lib-commonjs/utils/properties.js.map +1 -1
  172. package/package.json +1 -1
@@ -4,57 +4,58 @@ import { canUseDOM } from './canUseDOM';
4
4
  * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
5
5
  *
6
6
  * @internal
7
- */
8
- export const defaultSSRContextValue = {
9
- current: 0
7
+ */ export const defaultSSRContextValue = {
8
+ current: 0
10
9
  };
11
- export const SSRContext = /*#__PURE__*/React.createContext(undefined);
10
+ export const SSRContext = /*#__PURE__*/ React.createContext(undefined);
12
11
  /**
13
12
  * @internal
14
- */
15
- export function useSSRContext() {
16
- var _React_useContext;
17
- return (_React_useContext = React.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;
13
+ */ export function useSSRContext() {
14
+ var _React_useContext;
15
+ return (_React_useContext = React.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;
18
16
  }
19
17
  /**
20
18
  * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids
21
19
  * are consistent between the client and server.
22
20
  *
23
21
  * @public
24
- */
25
- export const SSRProvider = props => {
26
- const [value] = React.useState(() => ({
27
- current: 0
28
- }));
29
- return /*#__PURE__*/React.createElement(SSRContext.Provider, {
30
- value: value
31
- }, props.children);
22
+ */ export const SSRProvider = (props)=>{
23
+ const [value] = React.useState(()=>({
24
+ current: 0
25
+ }));
26
+ return /*#__PURE__*/ React.createElement(SSRContext.Provider, {
27
+ value: value
28
+ }, props.children);
32
29
  };
33
30
  /**
34
31
  * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay
35
32
  * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.
36
- */
37
- export function useIsSSR() {
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 && !canUseDOM()) {
44
- // eslint-disable-next-line no-console
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(''));
33
+ */ export function useIsSSR() {
34
+ const isInSSRContext = useSSRContext() !== defaultSSRContextValue;
35
+ const [isSSR, setIsSSR] = React.useState(isInSSRContext);
36
+ // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
37
+ // developer to add one.
38
+ if (process.env.NODE_ENV !== 'production') {
39
+ if (!isInSSRContext && !canUseDOM()) {
40
+ // eslint-disable-next-line no-console
41
+ console.error([
42
+ '@fluentui/react-components: ',
43
+ 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.',
44
+ '\n',
45
+ '\n',
46
+ 'Check documentation at https://aka.ms/fluentui-ssr'
47
+ ].join(''));
48
+ }
49
+ }
50
+ // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
51
+ // component after hydration.
52
+ if (canUseDOM() && isInSSRContext) {
53
+ // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
54
+ // mounting.
55
+ // eslint-disable-next-line
56
+ React.useLayoutEffect(()=>{
57
+ setIsSSR(false);
58
+ }, []);
46
59
  }
47
- }
48
- // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
49
- // component after hydration.
50
- if (canUseDOM() && isInSSRContext) {
51
- // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
52
- // mounting.
53
- // eslint-disable-next-line
54
- React.useLayoutEffect(() => {
55
- setIsSSR(false);
56
- }, []);
57
- }
58
- return isSSR;
60
+ return isSSR;
59
61
  }
60
- //# sourceMappingURL=SSRContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","canUseDOM","defaultSSRContextValue","current","SSRContext","createContext","undefined","useSSRContext","_React_useContext","useContext","SSRProvider","props","value","useState","createElement","Provider","children","useIsSSR","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","console","error","join","useLayoutEffect"],"sources":["../../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,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,QAAQ;AAY1B;;;;;AAKA,OAAO,MAAMC,sBAAA,GAA0C;EACrDC,OAAA,EAAS;AACX;AAEA,OAAO,MAAMC,UAAA,gBAAaJ,KAAA,CAAMK,aAAa,CAA8BC,SAAA;AAE3E;;;AAGA,OAAO,SAASC,cAAA,EAAiC;MACxCC,iBAAA;EAAP,OAAO,CAAAA,iBAAA,GAAAR,KAAA,CAAMS,UAAU,CAACL,UAAA,eAAjBI,iBAAA,cAAAA,iBAAA,GAAgCN,sBAAsB;AAC/D;AAEA;;;;;;AAMA,OAAO,MAAMQ,WAAA,GAAuDC,KAAA,IAAS;EAC3E,MAAM,CAACC,KAAA,CAAM,GAAGZ,KAAA,CAAMa,QAAQ,CAAkB,OAAO;IAAEV,OAAA,EAAS;EAAE;EAEpE,oBAAOH,KAAA,CAAAc,aAAA,CAACV,UAAA,CAAWW,QAAQ;IAACH,KAAA,EAAOA;KAAQD,KAAA,CAAMK,QAAQ;AAC3D;AAEA;;;;AAIA,OAAO,SAASC,SAAA,EAAoB;EAClC,MAAMC,cAAA,GAAiBX,aAAA,OAAoBL,sBAAA;EAC3C,MAAM,CAACiB,KAAA,EAAOC,QAAA,CAAS,GAAGpB,KAAA,CAAMa,QAAQ,CAACK,cAAA;EAEzC;EACA;EACA,IAAIG,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC,IAAI,CAACL,cAAA,IAAkB,CAACjB,SAAA,IAAa;MACnC;MACAuB,OAAA,CAAQC,KAAK,CACX,CACE,gCACA,4GACE,4CACF,MACA,MACA,qDACD,CAACC,IAAI,CAAC;IAEX;EACF;EAEA;EACA;EACA,IAAIzB,SAAA,MAAeiB,cAAA,EAAgB;IACjC;IACA;IACA;IACAlB,KAAA,CAAM2B,eAAe,CAAC,MAAM;MAC1BP,QAAA,CAAS,KAAK;IAChB,GAAG,EAAE;EACP;EAEA,OAAOD,KAAA;AACT"}
1
+ {"version":3,"sources":["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"],"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"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,QAAQ,cAAc;AAYxC;;;;CAIC,GACD,OAAO,MAAMC,yBAA0C;IACrDC,SAAS;AACX,EAAE;AAEF,OAAO,MAAMC,2BAAaJ,MAAMK,aAAa,CAA8BC,WAA6C;AAExH;;CAEC,GACD,OAAO,SAASC,gBAAiC;QACxCP;IAAP,OAAOA,CAAAA,oBAAAA,MAAMQ,UAAU,CAACJ,yBAAjBJ,+BAAAA,oBAAgCE,sBAAsB;AAC/D,CAAC;AAED;;;;;CAKC,GACD,OAAO,MAAMO,cAAuDC,CAAAA,QAAS;IAC3E,MAAM,CAACC,MAAM,GAAGX,MAAMY,QAAQ,CAAkB,IAAO,CAAA;YAAET,SAAS;QAAE,CAAA;IAEpE,qBAAO,oBAACC,WAAWS,QAAQ;QAACF,OAAOA;OAAQD,MAAMI,QAAQ;AAC3D,EAAE;AAEF;;;CAGC,GACD,OAAO,SAASC,WAAoB;IAClC,MAAMC,iBAAiBT,oBAAoBL;IAC3C,MAAM,CAACe,OAAOC,SAAS,GAAGlB,MAAMY,QAAQ,CAACI;IAEzC,6GAA6G;IAC7G,wBAAwB;IACxB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,CAACL,kBAAkB,CAACf,aAAa;YACnC,sCAAsC;YACtCqB,QAAQC,KAAK,CACX;gBACE;gBACA,4GACE;gBACF;gBACA;gBACA;aACD,CAACC,IAAI,CAAC;QAEX,CAAC;IACH,CAAC;IAED,iHAAiH;IACjH,6BAA6B;IAC7B,IAAIvB,eAAee,gBAAgB;QACjC,iHAAiH;QACjH,YAAY;QACZ,2BAA2B;QAC3BhB,MAAMyB,eAAe,CAAC,IAAM;YAC1BP,SAAS,KAAK;QAChB,GAAG,EAAE;IACP,CAAC;IAED,OAAOD;AACT,CAAC"}
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * Verifies if an application can use DOM.
3
- */export function canUseDOM() {
4
- return typeof window !== 'undefined' && !!(window.document &&
5
- // eslint-disable-next-line deprecation/deprecation
6
- window.document.createElement);
3
+ */ export function canUseDOM() {
4
+ return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation
5
+ window.document.createElement);
7
6
  }
8
- //# sourceMappingURL=canUseDOM.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["canUseDOM","window","document","createElement"],"sources":["../../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;;GAGA,OAAO,SAASA,UAAA,EAAqB;EACnC,OACE,OAAOC,MAAA,KAAW,eAClB,CAAC,EACCA,MAAA,CAAOC,QAAQ;EACf;EACAD,MAAA,CAAOC,QAAQ,CAACC,aAAa,CAAD;AAGlC"}
1
+ {"version":3,"sources":["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"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,YAAqB;IACnC,OACE,OAAOC,WAAW,eAClB,CAAC,CACCA,CAAAA,OAAOC,QAAQ,IACf,mDAAmD;IACnDD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAGlC,CAAC"}
package/lib/ssr/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './canUseDOM';
2
2
  export * from './SSRContext';
3
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/ssr/index.ts"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n"],"mappings":"AAAA,cAAc;AACd,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,eAAe"}
@@ -3,31 +3,28 @@ import { isFluentTrigger } from './isFluentTrigger';
3
3
  /**
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
- */
7
- export function applyTriggerPropsToChildren(children, triggerChildProps) {
8
- if (typeof children === 'function') {
9
- return children(triggerChildProps);
10
- } else if (children) {
11
- return cloneTriggerTree(children, triggerChildProps);
12
- }
13
- // Components in React should return either JSX elements or "null", otherwise React will throw:
14
- // Nothing was returned from render.
15
- // This usually means a return statement is missing. Or, to render nothing, return null.
16
- return children || null;
6
+ */ export function applyTriggerPropsToChildren(children, triggerChildProps) {
7
+ if (typeof children === 'function') {
8
+ return children(triggerChildProps);
9
+ } else if (children) {
10
+ return cloneTriggerTree(children, triggerChildProps);
11
+ }
12
+ // Components in React should return either JSX elements or "null", otherwise React will throw:
13
+ // Nothing was returned from render.
14
+ // This usually means a return statement is missing. Or, to render nothing, return null.
15
+ return children || null;
17
16
  }
18
17
  /**
19
18
  * Clones a React element tree, and applies the given props to the first grandchild that is not
20
19
  * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
21
- */
22
- function cloneTriggerTree(child, triggerProps) {
23
- if (! /*#__PURE__*/React.isValidElement(child) || child.type === React.Fragment) {
24
- throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
25
- }
26
- if (isFluentTrigger(child)) {
27
- const grandchild = cloneTriggerTree(child.props.children, triggerProps);
28
- return /*#__PURE__*/React.cloneElement(child, undefined, grandchild);
29
- } else {
30
- return /*#__PURE__*/React.cloneElement(child, triggerProps);
31
- }
20
+ */ function cloneTriggerTree(child, triggerProps) {
21
+ if (!React.isValidElement(child) || child.type === React.Fragment) {
22
+ throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
23
+ }
24
+ if (isFluentTrigger(child)) {
25
+ const grandchild = cloneTriggerTree(child.props.children, triggerProps);
26
+ return React.cloneElement(child, undefined, grandchild);
27
+ } else {
28
+ return React.cloneElement(child, triggerProps);
29
+ }
32
30
  }
33
- //# sourceMappingURL=applyTriggerPropsToChildren.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","isFluentTrigger","applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","isValidElement","type","Fragment","Error","grandchild","props","cloneElement","undefined"],"sources":["../../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,YAAYA,KAAA,MAAW;AACvB,SAASC,eAAe,QAAQ;AAGhC;;;;AAIA,OAAO,SAASC,4BACdC,QAAqD,EACrDC,iBAAoC,EACT;EAC3B,IAAI,OAAOD,QAAA,KAAa,YAAY;IAClC,OAAOA,QAAA,CAASC,iBAAA;EAClB,OAAO,IAAID,QAAA,EAAU;IACnB,OAAOE,gBAAA,CAAiBF,QAAA,EAAUC,iBAAA;EACpC;EAEA;EACA;EACA;EACA,OAAOD,QAAA,IAAY,IAAI;AACzB;AAEA;;;;AAIA,SAASE,iBACPC,KAAsB,EACtBC,YAA+B,EACX;EACpB,IAAI,eAACP,KAAA,CAAMQ,cAAc,CAACF,KAAA,KAAUA,KAAA,CAAMG,IAAI,KAAKT,KAAA,CAAMU,QAAQ,EAAE;IACjE,MAAM,IAAIC,KAAA,CACR,oEACE;EAEN;EAEA,IAAIV,eAAA,CAAgBK,KAAA,GAAQ;IAC1B,MAAMM,UAAA,GAAaP,gBAAA,CAAiBC,KAAA,CAAMO,KAAK,CAACV,QAAQ,EAAEI,YAAA;IAC1D,oBAAOP,KAAA,CAAMc,YAAY,CAACR,KAAA,EAAOS,SAAA,EAAWH,UAAA;EAC9C,OAAO;IACL,oBAAOZ,KAAA,CAAMc,YAAY,CAACR,KAAA,EAAOC,YAAA;EACnC;AACF"}
1
+ {"version":3,"sources":["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"],"names":["React","isFluentTrigger","applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","isValidElement","type","Fragment","Error","grandchild","props","cloneElement","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,eAAe,QAAQ,oBAAoB;AAGpD;;;CAGC,GACD,OAAO,SAASC,4BACdC,QAAqD,EACrDC,iBAAoC,EACT;IAC3B,IAAI,OAAOD,aAAa,YAAY;QAClC,OAAOA,SAASC;IAClB,OAAO,IAAID,UAAU;QACnB,OAAOE,iBAAiBF,UAAUC;IACpC,CAAC;IAED,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY,IAAI;AACzB,CAAC;AAED;;;CAGC,GACD,SAASE,iBACPC,KAAsB,EACtBC,YAA+B,EACX;IACpB,IAAI,CAACP,MAAMQ,cAAc,CAACF,UAAUA,MAAMG,IAAI,KAAKT,MAAMU,QAAQ,EAAE;QACjE,MAAM,IAAIC,MACR,oEACE,wDACF;IACJ,CAAC;IAED,IAAIV,gBAAgBK,QAAQ;QAC1B,MAAMM,aAAaP,iBAAiBC,MAAMO,KAAK,CAACV,QAAQ,EAAEI;QAC1D,OAAOP,MAAMc,YAAY,CAACR,OAAOS,WAAWH;IAC9C,OAAO;QACL,OAAOZ,MAAMc,YAAY,CAACR,OAAOC;IACnC,CAAC;AACH"}
@@ -21,14 +21,11 @@ import { isFluentTrigger } from './isFluentTrigger';
21
21
  *
22
22
  * In the case where the immediate child is not a valid element,
23
23
  * null is returned
24
- */
25
- export function getTriggerChild(children) {
26
- if (! /*#__PURE__*/React.isValidElement(children)) {
27
- return null;
28
- }
29
- return isFluentTrigger(children) ? getTriggerChild(
30
- // FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
31
- // but for some reason it's failing on build
32
- children.props.children) : children;
24
+ */ export function getTriggerChild(children) {
25
+ if (!React.isValidElement(children)) {
26
+ return null;
27
+ }
28
+ return isFluentTrigger(children) ? getTriggerChild(// FIXME: This casting should be unnecessary as isFluentTrigger is a guard type method,
29
+ // but for some reason it's failing on build
30
+ children.props.children) : children;
33
31
  }
34
- //# sourceMappingURL=getTriggerChild.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","isFluentTrigger","getTriggerChild","children","isValidElement","props"],"sources":["../../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,YAAYA,KAAA,MAAW;AACvB,SAASC,eAAe,QAAQ;AAGhC;;;;;;;;;;;;;;;;;;;;;;AAsBA,OAAO,SAASC,gBACdC,QAAqD,EAE+B;EACpF,IAAI,eAACH,KAAA,CAAMI,cAAc,CAAoBD,QAAA,GAAW;IACtD,OAAO,IAAI;EACb;EACA,OAAOF,eAAA,CAAgBE,QAAA,IACnBD,eAAA;EAGE;EADA;EACCC,QAAA,CAASE,KAAK,CAAkBF,QAAQ,IAE3CA,QAAQ;AACd"}
1
+ {"version":3,"sources":["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"],"names":["React","isFluentTrigger","getTriggerChild","children","isValidElement","props"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,eAAe,QAAQ,oBAAoB;AAGpD;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,SAASC,gBACdC,QAAqD,EAE+B;IACpF,IAAI,CAACH,MAAMI,cAAc,CAAoBD,WAAW;QACtD,OAAO,IAAI;IACb,CAAC;IACD,OAAOF,gBAAgBE,YACnBD,gBAGE,AAFA,uFAAuF;IACvF,4CAA4C;IAC3CC,SAASE,KAAK,CAAkBF,QAAQ,IAE3CA,QAAQ;AACd,CAAC"}
@@ -2,4 +2,3 @@ export * from './applyTriggerPropsToChildren';
2
2
  export * from './getTriggerChild';
3
3
  export * from './isFluentTrigger';
4
4
  export * from './types';
5
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/trigger/index.ts"],"sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,cAAc,gCAAgC;AAC9C,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,UAAU"}
@@ -3,8 +3,6 @@ import * as React from 'react';
3
3
  * @internal
4
4
  * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
5
5
  * See the {@link FluentTriggerComponent} type for more info.
6
- */
7
- export function isFluentTrigger(element) {
8
- return Boolean(element.type.isFluentTriggerComponent);
6
+ */ export function isFluentTrigger(element) {
7
+ return Boolean(element.type.isFluentTriggerComponent);
9
8
  }
10
- //# sourceMappingURL=isFluentTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"sources":["../../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":"AAAA,YAAYA,KAAA,MAAW;AAGvB;;;;;AAKA,OAAO,SAASC,gBAAgBC,OAA2B,EAA+C;EACxG,OAAOC,OAAA,CAAQD,OAAC,CAAQE,IAAI,CAA4BC,wBAAwB;AAClF"}
1
+ {"version":3,"sources":["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"],"names":["React","isFluentTrigger","element","Boolean","type","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B;;;;CAIC,GACD,OAAO,SAASC,gBAAgBC,OAA2B,EAA+C;IACxG,OAAOC,QAAQ,AAACD,QAAQE,IAAI,CAA4BC,wBAAwB;AAClF,CAAC"}
@@ -1,2 +1 @@
1
1
  import * as React from 'react';
2
- //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React"],"sources":["../../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":"AAAA,YAAYA,KAAA,MAAW"}
1
+ {"version":3,"sources":["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"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -5,5 +5,4 @@
5
5
  * @param value - the value to be clamped
6
6
  * @param min - the lowest valid value
7
7
  * @param max - the highest valid value
8
- */export const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
9
- //# sourceMappingURL=clamp.js.map
8
+ */ export const clamp = (value, min, max)=>Math.max(min, Math.min(max, value || 0));
@@ -1 +1 @@
1
- {"version":3,"names":["clamp","value","min","max","Math"],"sources":["../../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;;;;;;;GAQA,OAAO,MAAMA,KAAA,GAAQA,CAACC,KAAA,EAAeC,GAAA,EAAaC,GAAA,KAAwBC,IAAA,CAAKD,GAAG,CAACD,GAAA,EAAKE,IAAA,CAAKF,GAAG,CAACC,GAAA,EAAKF,KAAA,IAAS"}
1
+ {"version":3,"sources":["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"],"names":["clamp","value","min","max","Math"],"mappings":"AAAA;;;;;;;CAOC,GACD,OAAO,MAAMA,QAAQ,CAACC,OAAeC,KAAaC,MAAwBC,KAAKD,GAAG,CAACD,KAAKE,KAAKF,GAAG,CAACC,KAAKF,SAAS,IAAI"}
@@ -1,29 +1,29 @@
1
1
  import * as React from 'react';
2
2
  import { 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 } from './properties';
3
3
  const nativeElementMap = {
4
- label: labelProperties,
5
- audio: audioProperties,
6
- video: videoProperties,
7
- ol: olProperties,
8
- li: liProperties,
9
- a: anchorProperties,
10
- button: buttonProperties,
11
- input: inputProperties,
12
- textarea: textAreaProperties,
13
- select: selectProperties,
14
- option: optionProperties,
15
- table: tableProperties,
16
- tr: trProperties,
17
- th: thProperties,
18
- td: tdProperties,
19
- colGroup: colGroupProperties,
20
- col: colProperties,
21
- fieldset: fieldsetProperties,
22
- form: formProperties,
23
- iframe: iframeProperties,
24
- img: imgProperties,
25
- time: timeProperties,
26
- dialog: dialogProperties
4
+ label: labelProperties,
5
+ audio: audioProperties,
6
+ video: videoProperties,
7
+ ol: olProperties,
8
+ li: liProperties,
9
+ a: anchorProperties,
10
+ button: buttonProperties,
11
+ input: inputProperties,
12
+ textarea: textAreaProperties,
13
+ select: selectProperties,
14
+ option: optionProperties,
15
+ table: tableProperties,
16
+ tr: trProperties,
17
+ th: thProperties,
18
+ td: tdProperties,
19
+ colGroup: colGroupProperties,
20
+ col: colProperties,
21
+ fieldset: fieldsetProperties,
22
+ form: formProperties,
23
+ iframe: iframeProperties,
24
+ img: imgProperties,
25
+ time: timeProperties,
26
+ dialog: dialogProperties
27
27
  };
28
28
  /**
29
29
  * Given an element tagname and user props, filters the props to only allowed props for the given
@@ -33,9 +33,9 @@ const nativeElementMap = {
33
33
  * @param excludedPropNames - List of props to disallow
34
34
  */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
35
  export function getNativeElementProps(tagName, props, excludedPropNames) {
36
- const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;
37
- allowedPropNames.as = 1;
38
- return getNativeProps(props, allowedPropNames, excludedPropNames);
36
+ const allowedPropNames = tagName && nativeElementMap[tagName] || htmlElementProperties;
37
+ allowedPropNames.as = 1;
38
+ return getNativeProps(props, allowedPropNames, excludedPropNames);
39
39
  }
40
40
  /**
41
41
  * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
@@ -44,18 +44,16 @@ export function getNativeElementProps(tagName, props, excludedPropNames) {
44
44
  * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
45
45
  *
46
46
  * @returns An object containing the native props for the `root` and primary slots.
47
- */
48
- export const getPartitionedNativeProps = ({
49
- primarySlotTagName,
50
- props,
51
- excludedPropNames
52
- }) => {
53
- return {
54
- root: {
55
- style: props.style,
56
- className: props.className
57
- },
58
- primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
59
- };
47
+ */ export const getPartitionedNativeProps = ({ primarySlotTagName , props , excludedPropNames })=>{
48
+ return {
49
+ root: {
50
+ style: props.style,
51
+ className: props.className
52
+ },
53
+ primary: getNativeElementProps(primarySlotTagName, props, [
54
+ ...excludedPropNames || [],
55
+ 'style',
56
+ 'className'
57
+ ])
58
+ };
60
59
  };
61
- //# sourceMappingURL=getNativeElementProps.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","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"],"sources":["../../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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,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;AAEP,MAAMC,gBAAA,GAA2D;EAC/DC,KAAA,EAAO1B,eAAA;EACP2B,KAAA,EAAO1B,eAAA;EACP2B,KAAA,EAAO1B,eAAA;EACP2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,CAAA,EAAG1B,gBAAA;EACH2B,MAAA,EAAQ1B,gBAAA;EACR2B,KAAA,EAAO1B,eAAA;EACP2B,QAAA,EAAU1B,kBAAA;EACV2B,MAAA,EAAQ1B,gBAAA;EACR2B,MAAA,EAAQ1B,gBAAA;EACR2B,KAAA,EAAO1B,eAAA;EACP2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,EAAA,EAAI1B,YAAA;EACJ2B,QAAA,EAAU1B,kBAAA;EACV2B,GAAA,EAAK1B,aAAA;EACL2B,QAAA,EAAU1B,kBAAA;EACV2B,IAAA,EAAM1B,cAAA;EACN2B,MAAA,EAAQ1B,gBAAA;EACR2B,GAAA,EAAK1B,aAAA;EACL2B,IAAA,EAAMxB,cAAA;EACNyB,MAAA,EAAQxB;AACV;AAEA;;;;;;GAAA,CAOA;AACA,OAAO,SAASyB,sBACdC,OAAe,EACfC,KAAS,EACTC,iBAA4B,EACf;EACb,MAAMC,gBAAA,GAAmBH,OAAC,IAAWzB,gBAAgB,CAACyB,OAAA,CAAQ,IAAK7B,qBAAA;EACnEgC,gBAAA,CAAiBC,EAAE,GAAG;EAEtB,OAAOhC,cAAA,CAAe6B,KAAA,EAAOE,gBAAA,EAAkBD,iBAAA;AACjD;AAEA;;;;;;;;AAQA,OAAO,MAAMG,yBAAA,GAA4BA,CAGvC;EACAC,kBAAA;EACAL,KAAA;EACAC;AAAiB,CAUlB,KAAK;EACJ,OAAO;IACLK,IAAA,EAAM;MAAEC,KAAA,EAAOP,KAAA,CAAMO,KAAK;MAAEC,SAAA,EAAWR,KAAA,CAAMQ;IAAU;IACvDC,OAAA,EAASX,qBAAA,CAAqDO,kBAAA,EAAoBL,KAAA,EAAO,C,IACnFC,iBAAA,IAAqB,EAAE,GAC3B,SACA,YACD;EACH;AACF"}
1
+ {"version":3,"sources":["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"],"names":["React","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"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,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,eAAe;AAEtB,MAAMC,mBAA2D;IAC/DC,OAAO1B;IACP2B,OAAO1B;IACP2B,OAAO1B;IACP2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,GAAG1B;IACH2B,QAAQ1B;IACR2B,OAAO1B;IACP2B,UAAU1B;IACV2B,QAAQ1B;IACR2B,QAAQ1B;IACR2B,OAAO1B;IACP2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,IAAI1B;IACJ2B,UAAU1B;IACV2B,KAAK1B;IACL2B,UAAU1B;IACV2B,MAAM1B;IACN2B,QAAQ1B;IACR2B,KAAK1B;IACL2B,MAAMxB;IACNyB,QAAQxB;AACV;AAEA;;;;;;CAMC,GACD,8DAA8D;AAC9D,OAAO,SAASyB,sBACdC,OAAe,EACfC,KAAS,EACTC,iBAA4B,EACf;IACb,MAAMC,mBAAmB,AAACH,WAAWzB,gBAAgB,CAACyB,QAAQ,IAAK7B;IACnEgC,iBAAiBC,EAAE,GAAG;IAEtB,OAAOhC,eAAe6B,OAAOE,kBAAkBD;AACjD,CAAC;AAED;;;;;;;CAOC,GACD,OAAO,MAAMG,4BAA4B,CAGvC,EACAC,mBAAkB,EAClBL,MAAK,EACLC,kBAAiB,EAUlB,GAAK;IACJ,OAAO;QACLK,MAAM;YAAEC,OAAOP,MAAMO,KAAK;YAAEC,WAAWR,MAAMQ,SAAS;QAAC;QACvDC,SAASX,sBAAqDO,oBAAoBL,OAAO;eACnFC,qBAAqB,EAAE;YAC3B;YACA;SACD;IACH;AACF,EAAE"}
@@ -1,19 +1,18 @@
1
1
  /**
2
2
  * @internal
3
3
  * Finds and swaps a provided key for it's right to left format.
4
- */export const getRTLSafeKey = (key, dir) => {
5
- if (dir === 'rtl') {
6
- switch (key) {
7
- case 'ArrowLeft':
8
- {
9
- return 'ArrowRight';
10
- }
11
- case 'ArrowRight':
12
- {
13
- return 'ArrowLeft';
4
+ */ export const getRTLSafeKey = (key, dir)=>{
5
+ if (dir === 'rtl') {
6
+ switch(key){
7
+ case 'ArrowLeft':
8
+ {
9
+ return 'ArrowRight';
10
+ }
11
+ case 'ArrowRight':
12
+ {
13
+ return 'ArrowLeft';
14
+ }
14
15
  }
15
16
  }
16
- }
17
- return key;
17
+ return key;
18
18
  };
19
- //# sourceMappingURL=getRTLSafeKey.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getRTLSafeKey","key","dir"],"sources":["../../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"],"mappings":"AAAA;;;GAIA,OAAO,MAAMA,aAAA,GAAgBA,CAACC,GAAA,EAAaC,GAAA,KAAuB;EAChE,IAAIA,GAAA,KAAQ,OAAO;IACjB,QAAQD,GAAA;MACN,KAAK;QAAa;UAChB,OAAO;QACT;MAEA,KAAK;QAAc;UACjB,OAAO;QACT;IAAA;EAEJ;EAEA,OAAOA,GAAA;AACT"}
1
+ {"version":3,"sources":["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"],"names":["getRTLSafeKey","key","dir"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,gBAAgB,CAACC,KAAaC,MAAuB;IAChE,IAAIA,QAAQ,OAAO;QACjB,OAAQD;YACN,KAAK;gBAAa;oBAChB,OAAO;gBACT;YAEA,KAAK;gBAAc;oBACjB,OAAO;gBACT;QACF;IACF,CAAC;IAED,OAAOA;AACT,EAAE"}
@@ -5,20 +5,21 @@ import * as React from 'react';
5
5
  * Ideally, it should also distinguish regular and "capture" callbacks, but it's possible only with React 17 as
6
6
  * ".eventPhase" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events
7
7
  * are handled in bubble phase.
8
- */
9
- export function getReactCallbackName(event) {
10
- if (event._reactName) {
11
- return event._reactName;
12
- }
13
- if (event.dispatchConfig) {
14
- if (event.dispatchConfig.registrationName) {
15
- return event.dispatchConfig.registrationName;
8
+ */ export function getReactCallbackName(event) {
9
+ if (event._reactName) {
10
+ return event._reactName;
11
+ }
12
+ if (event.dispatchConfig) {
13
+ if (event.dispatchConfig.registrationName) {
14
+ return event.dispatchConfig.registrationName;
15
+ }
16
+ return event.dispatchConfig.phasedRegistrationNames.bubbled;
17
+ }
18
+ if (process.env.NODE_ENV !== 'production') {
19
+ // eslint-disable-next-line no-console
20
+ console.error([
21
+ 'Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".',
22
+ 'This should not happen, please report it to https://github.com/microsoft/fluentui'
23
+ ]);
16
24
  }
17
- return event.dispatchConfig.phasedRegistrationNames.bubbled;
18
- }
19
- if (process.env.NODE_ENV !== 'production') {
20
- // eslint-disable-next-line no-console
21
- console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', 'This should not happen, please report it to https://github.com/microsoft/fluentui']);
22
- }
23
25
  }
24
- //# sourceMappingURL=getReactCallbackName.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"sources":["../../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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAwBvB;;;;;;;AAOA,OAAO,SAASC,qBAAqBC,KAA0B,EAAiC;EAC9F,IAAIA,KAAA,CAAMC,UAAU,EAAE;IACpB,OAAOD,KAAA,CAAMC,UAAU;EACzB;EAEA,IAAID,KAAA,CAAME,cAAc,EAAE;IACxB,IAAIF,KAAA,CAAME,cAAc,CAACC,gBAAgB,EAAE;MACzC,OAAOH,KAAA,CAAME,cAAc,CAACC,gBAAgB;IAC9C;IAEA,OAAOH,KAAA,CAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;EAC7D;EAEA,IAAIC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;IACzC;IACAC,OAAA,CAAQC,KAAK,CAAC,CACZ,oFACA,oFACD;EACH;AACF"}
1
+ {"version":3,"sources":["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"],"names":["React","getReactCallbackName","event","_reactName","dispatchConfig","registrationName","phasedRegistrationNames","bubbled","process","env","NODE_ENV","console","error"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAwB/B;;;;;;CAMC,GACD,OAAO,SAASC,qBAAqBC,KAA0B,EAAiC;IAC9F,IAAIA,MAAMC,UAAU,EAAE;QACpB,OAAOD,MAAMC,UAAU;IACzB,CAAC;IAED,IAAID,MAAME,cAAc,EAAE;QACxB,IAAIF,MAAME,cAAc,CAACC,gBAAgB,EAAE;YACzC,OAAOH,MAAME,cAAc,CAACC,gBAAgB;QAC9C,CAAC;QAED,OAAOH,MAAME,cAAc,CAACE,uBAAuB,CAACC,OAAO;IAC7D,CAAC;IAED,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sCAAsC;QACtCC,QAAQC,KAAK,CAAC;YACZ;YACA;SACD;IACH,CAAC;AACH,CAAC"}
@@ -7,4 +7,3 @@ export * from './properties';
7
7
  export * from './isHTMLElement';
8
8
  export * from './isInteractiveHTMLElement';
9
9
  export * from './priorityQueue';
10
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\nexport * from './priorityQueue';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './mergeCallbacks';\nexport * from './omit';\nexport * from './properties';\nexport * from './isHTMLElement';\nexport * from './isInteractiveHTMLElement';\nexport * from './priorityQueue';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,0BAA0B;AACxC,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,6BAA6B;AAC3C,cAAc,kBAAkB"}
@@ -11,10 +11,9 @@
11
11
  * isHTMLElement(event.target, {constructorName: 'HTMLInputElement'}) && event.target.value // some value
12
12
  * ```
13
13
  *
14
- */export function isHTMLElement(element, options) {
15
- var _typedElement_ownerDocument;
16
- const typedElement = element;
17
- var _options_constructorName;
18
- return Boolean((typedElement === null || typedElement === void 0 ? void 0 : (_typedElement_ownerDocument = typedElement.ownerDocument) === null || _typedElement_ownerDocument === void 0 ? void 0 : _typedElement_ownerDocument.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_options_constructorName = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _options_constructorName !== void 0 ? _options_constructorName : 'HTMLElement']);
14
+ */ export function isHTMLElement(element, options) {
15
+ var _typedElement_ownerDocument;
16
+ const typedElement = element;
17
+ var _options_constructorName;
18
+ return Boolean((typedElement === null || typedElement === void 0 ? void 0 : (_typedElement_ownerDocument = typedElement.ownerDocument) === null || _typedElement_ownerDocument === void 0 ? void 0 : _typedElement_ownerDocument.defaultView) && typedElement instanceof typedElement.ownerDocument.defaultView[(_options_constructorName = options === null || options === void 0 ? void 0 : options.constructorName) !== null && _options_constructorName !== void 0 ? _options_constructorName : 'HTMLElement']);
19
19
  }
20
- //# sourceMappingURL=isHTMLElement.js.map