@fluentui/react-utilities 9.0.0-nightly.b5b7401007.0 → 9.0.0-rc.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 (186) hide show
  1. package/CHANGELOG.json +180 -12
  2. package/CHANGELOG.md +54 -8
  3. package/dist/react-utilities.d.ts +232 -105
  4. package/lib/compose/getSlots.d.ts +11 -10
  5. package/lib/compose/getSlots.js +21 -30
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/index.d.ts +0 -1
  8. package/lib/compose/index.js +0 -1
  9. package/lib/compose/index.js.map +1 -1
  10. package/lib/compose/resolveShorthand.d.ts +10 -6
  11. package/lib/compose/resolveShorthand.js +13 -12
  12. package/lib/compose/resolveShorthand.js.map +1 -1
  13. package/lib/compose/types.d.ts +86 -35
  14. package/lib/compose/types.js.map +1 -1
  15. package/lib/hooks/index.d.ts +1 -1
  16. package/lib/hooks/index.js +1 -1
  17. package/lib/hooks/index.js.map +1 -1
  18. package/lib/hooks/useBoolean.js +10 -21
  19. package/lib/hooks/useBoolean.js.map +1 -1
  20. package/lib/hooks/useConst.js +1 -1
  21. package/lib/hooks/useConst.js.map +1 -1
  22. package/lib/hooks/useControllableState.d.ts +16 -6
  23. package/lib/hooks/useControllableState.js +26 -25
  24. package/lib/hooks/useControllableState.js.map +1 -1
  25. package/lib/hooks/useEventCallback.js +6 -12
  26. package/lib/hooks/useEventCallback.js.map +1 -1
  27. package/lib/hooks/useFirstMount.js +1 -1
  28. package/lib/hooks/useFirstMount.js.map +1 -1
  29. package/lib/hooks/useForceUpdate.js +1 -3
  30. package/lib/hooks/useForceUpdate.js.map +1 -1
  31. package/lib/hooks/useId.js +2 -4
  32. package/lib/hooks/useId.js.map +1 -1
  33. package/lib/hooks/useIsomorphicLayoutEffect.js +1 -1
  34. package/lib/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  35. package/lib/hooks/useMergedEventCallbacks.d.ts +18 -0
  36. package/lib/hooks/useMergedEventCallbacks.js +26 -0
  37. package/lib/hooks/useMergedEventCallbacks.js.map +1 -0
  38. package/lib/hooks/useMergedRefs.js +5 -13
  39. package/lib/hooks/useMergedRefs.js.map +1 -1
  40. package/lib/hooks/useMount.js +3 -3
  41. package/lib/hooks/useMount.js.map +1 -1
  42. package/lib/hooks/useOnClickOutside.js +30 -36
  43. package/lib/hooks/useOnClickOutside.js.map +1 -1
  44. package/lib/hooks/useOnScrollOutside.js +13 -15
  45. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  46. package/lib/hooks/usePrevious.js +3 -3
  47. package/lib/hooks/usePrevious.js.map +1 -1
  48. package/lib/hooks/useTimeout.js +13 -17
  49. package/lib/hooks/useTimeout.js.map +1 -1
  50. package/lib/hooks/useUnmount.js +5 -7
  51. package/lib/hooks/useUnmount.js.map +1 -1
  52. package/lib/index.js.map +1 -1
  53. package/lib/ssr/SSRContext.js +9 -15
  54. package/lib/ssr/SSRContext.js.map +1 -1
  55. package/lib/ssr/canUseDOM.js.map +1 -1
  56. package/lib/ssr/index.js.map +1 -1
  57. package/lib/utils/applyTriggerPropsToChildren.d.ts +1 -1
  58. package/lib/utils/applyTriggerPropsToChildren.js +24 -4
  59. package/lib/utils/applyTriggerPropsToChildren.js.map +1 -1
  60. package/lib/utils/clamp.js +1 -3
  61. package/lib/utils/clamp.js.map +1 -1
  62. package/lib/utils/getNativeElementProps.d.ts +22 -0
  63. package/lib/utils/getNativeElementProps.js +24 -2
  64. package/lib/utils/getNativeElementProps.js.map +1 -1
  65. package/lib/utils/getRTLSafeKey.js +1 -1
  66. package/lib/utils/getRTLSafeKey.js.map +1 -1
  67. package/lib/utils/getReactCallbackName.d.ts +25 -0
  68. package/lib/utils/getReactCallbackName.js +26 -0
  69. package/lib/utils/getReactCallbackName.js.map +1 -0
  70. package/lib/utils/getTriggerChild.d.ts +22 -0
  71. package/lib/utils/getTriggerChild.js +26 -0
  72. package/lib/utils/getTriggerChild.js.map +1 -0
  73. package/lib/utils/index.d.ts +2 -1
  74. package/lib/utils/index.js +2 -1
  75. package/lib/utils/index.js.map +1 -1
  76. package/lib/utils/isFluentTrigger.d.ts +22 -0
  77. package/lib/utils/isFluentTrigger.js +8 -0
  78. package/lib/utils/isFluentTrigger.js.map +1 -0
  79. package/lib/utils/omit.js +2 -2
  80. package/lib/utils/omit.js.map +1 -1
  81. package/lib/utils/properties.js +55 -44
  82. package/lib/utils/properties.js.map +1 -1
  83. package/lib/utils/shouldPreventDefaultOnKeyDown.js +4 -4
  84. package/lib/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  85. package/lib-commonjs/compose/getSlots.d.ts +11 -10
  86. package/lib-commonjs/compose/getSlots.js +23 -34
  87. package/lib-commonjs/compose/getSlots.js.map +1 -1
  88. package/lib-commonjs/compose/index.d.ts +0 -1
  89. package/lib-commonjs/compose/index.js +1 -3
  90. package/lib-commonjs/compose/index.js.map +1 -1
  91. package/lib-commonjs/compose/resolveShorthand.d.ts +10 -6
  92. package/lib-commonjs/compose/resolveShorthand.js +14 -14
  93. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  94. package/lib-commonjs/compose/types.d.ts +86 -35
  95. package/lib-commonjs/compose/types.js.map +1 -1
  96. package/lib-commonjs/hooks/index.d.ts +1 -1
  97. package/lib-commonjs/hooks/index.js +3 -3
  98. package/lib-commonjs/hooks/index.js.map +1 -1
  99. package/lib-commonjs/hooks/useBoolean.js +12 -23
  100. package/lib-commonjs/hooks/useBoolean.js.map +1 -1
  101. package/lib-commonjs/hooks/useConst.js +2 -2
  102. package/lib-commonjs/hooks/useConst.js.map +1 -1
  103. package/lib-commonjs/hooks/useControllableState.d.ts +16 -6
  104. package/lib-commonjs/hooks/useControllableState.js +28 -27
  105. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  106. package/lib-commonjs/hooks/useEventCallback.js +8 -14
  107. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  108. package/lib-commonjs/hooks/useFirstMount.js +2 -2
  109. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  110. package/lib-commonjs/hooks/useForceUpdate.js +2 -4
  111. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  112. package/lib-commonjs/hooks/useId.js +4 -6
  113. package/lib-commonjs/hooks/useId.js.map +1 -1
  114. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +2 -2
  115. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  116. package/lib-commonjs/hooks/useMergedEventCallbacks.d.ts +18 -0
  117. package/lib-commonjs/hooks/useMergedEventCallbacks.js +36 -0
  118. package/lib-commonjs/hooks/useMergedEventCallbacks.js.map +1 -0
  119. package/lib-commonjs/hooks/useMergedRefs.js +6 -15
  120. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  121. package/lib-commonjs/hooks/useMount.js +4 -4
  122. package/lib-commonjs/hooks/useMount.js.map +1 -1
  123. package/lib-commonjs/hooks/useOnClickOutside.js +32 -38
  124. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  125. package/lib-commonjs/hooks/useOnScrollOutside.js +15 -17
  126. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  127. package/lib-commonjs/hooks/usePrevious.js +4 -4
  128. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  129. package/lib-commonjs/hooks/useTimeout.js +15 -19
  130. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  131. package/lib-commonjs/hooks/useUnmount.js +6 -8
  132. package/lib-commonjs/hooks/useUnmount.js.map +1 -1
  133. package/lib-commonjs/index.js +1 -1
  134. package/lib-commonjs/index.js.map +1 -1
  135. package/lib-commonjs/ssr/SSRContext.js +9 -15
  136. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  137. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  138. package/lib-commonjs/ssr/index.js +1 -1
  139. package/lib-commonjs/ssr/index.js.map +1 -1
  140. package/lib-commonjs/utils/applyTriggerPropsToChildren.d.ts +1 -1
  141. package/lib-commonjs/utils/applyTriggerPropsToChildren.js +26 -6
  142. package/lib-commonjs/utils/applyTriggerPropsToChildren.js.map +1 -1
  143. package/lib-commonjs/utils/clamp.js +1 -3
  144. package/lib-commonjs/utils/clamp.js.map +1 -1
  145. package/lib-commonjs/utils/getNativeElementProps.d.ts +22 -0
  146. package/lib-commonjs/utils/getNativeElementProps.js +28 -4
  147. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  148. package/lib-commonjs/utils/getRTLSafeKey.js +1 -1
  149. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  150. package/lib-commonjs/utils/getReactCallbackName.d.ts +25 -0
  151. package/lib-commonjs/utils/getReactCallbackName.js +35 -0
  152. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -0
  153. package/lib-commonjs/utils/getTriggerChild.d.ts +22 -0
  154. package/lib-commonjs/utils/getTriggerChild.js +37 -0
  155. package/lib-commonjs/utils/getTriggerChild.js.map +1 -0
  156. package/lib-commonjs/utils/index.d.ts +2 -1
  157. package/lib-commonjs/utils/index.js +5 -3
  158. package/lib-commonjs/utils/index.js.map +1 -1
  159. package/lib-commonjs/utils/isFluentTrigger.d.ts +22 -0
  160. package/lib-commonjs/utils/isFluentTrigger.js +17 -0
  161. package/lib-commonjs/utils/isFluentTrigger.js.map +1 -0
  162. package/lib-commonjs/utils/omit.js +2 -2
  163. package/lib-commonjs/utils/omit.js.map +1 -1
  164. package/lib-commonjs/utils/properties.js +50 -39
  165. package/lib-commonjs/utils/properties.js.map +1 -1
  166. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js +5 -5
  167. package/lib-commonjs/utils/shouldPreventDefaultOnKeyDown.js.map +1 -1
  168. package/package.json +6 -11
  169. package/lib/compose/nullRender.d.ts +0 -4
  170. package/lib/compose/nullRender.js +0 -7
  171. package/lib/compose/nullRender.js.map +0 -1
  172. package/lib/hooks/useControllableValue.d.ts +0 -20
  173. package/lib/hooks/useControllableValue.js +0 -62
  174. package/lib/hooks/useControllableValue.js.map +0 -1
  175. package/lib/utils/onlyChild.d.ts +0 -5
  176. package/lib/utils/onlyChild.js +0 -13
  177. package/lib/utils/onlyChild.js.map +0 -1
  178. package/lib-commonjs/compose/nullRender.d.ts +0 -4
  179. package/lib-commonjs/compose/nullRender.js +0 -16
  180. package/lib-commonjs/compose/nullRender.js.map +0 -1
  181. package/lib-commonjs/hooks/useControllableValue.d.ts +0 -20
  182. package/lib-commonjs/hooks/useControllableValue.js +0 -73
  183. package/lib-commonjs/hooks/useControllableValue.js.map +0 -1
  184. package/lib-commonjs/utils/onlyChild.d.ts +0 -5
  185. package/lib-commonjs/utils/onlyChild.js +0 -23
  186. package/lib-commonjs/utils/onlyChild.js.map +0 -1
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useIsSSR = exports.SSRProvider = exports.useSSRContext = exports.SSRContext = exports.defaultSSRContextValue = void 0;
7
7
 
8
- var React = /*#__PURE__*/require("react");
8
+ const React = /*#__PURE__*/require("react");
9
9
 
10
- var canUseDOM_1 = /*#__PURE__*/require("./canUseDOM");
10
+ const canUseDOM_1 = /*#__PURE__*/require("./canUseDOM");
11
11
  /**
12
12
  * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.
13
13
  *
@@ -35,12 +35,10 @@ exports.useSSRContext = useSSRContext;
35
35
  * @public
36
36
  */
37
37
 
38
- var SSRProvider = function (props) {
39
- var value = React.useState(function () {
40
- return {
41
- current: 0
42
- };
43
- })[0];
38
+ const SSRProvider = props => {
39
+ const [value] = React.useState(() => ({
40
+ current: 0
41
+ }));
44
42
  return React.createElement(exports.SSRContext.Provider, {
45
43
  value: value
46
44
  }, props.children);
@@ -53,14 +51,10 @@ exports.SSRProvider = SSRProvider;
53
51
  */
54
52
 
55
53
  function useIsSSR() {
56
- var isInSSRContext = useSSRContext() !== exports.defaultSSRContextValue;
57
-
58
- var _a = React.useState(isInSSRContext),
59
- isSSR = _a[0],
60
- setIsSSR = _a[1]; // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
54
+ const isInSSRContext = useSSRContext() !== exports.defaultSSRContextValue;
55
+ const [isSSR, setIsSSR] = React.useState(isInSSRContext); // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the
61
56
  // developer to add one.
62
57
 
63
-
64
58
  if (process.env.NODE_ENV !== 'production') {
65
59
  if (!isInSSRContext && !canUseDOM_1.canUseDOM()) {
66
60
  // eslint-disable-next-line no-console
@@ -74,7 +68,7 @@ function useIsSSR() {
74
68
  // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after
75
69
  // mounting.
76
70
  // eslint-disable-next-line
77
- React.useLayoutEffect(function () {
71
+ React.useLayoutEffect(() => {
78
72
  setIsSSR(false);
79
73
  }, []);
80
74
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ssr/SSRContext.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAYA;;;;AAIG;;;AACU,OAAA,CAAA,sBAAA,GAA0C;AACrD,EAAA,OAAO,EAAE;AAD4C,CAA1C;AAIA,OAAA,CAAA,UAAA,gBAAa,KAAK,CAAC,aAAN,CAAqC,OAAA,CAAA,sBAArC,CAAb;AAEb;;AAEG;;AACH,SAAgB,aAAhB,GAA6B;AAC3B,SAAO,KAAK,CAAC,UAAN,CAAiB,OAAA,CAAA,UAAjB,CAAP;AACD;;AAFD,OAAA,CAAA,aAAA,GAAA,aAAA;AAIA;;;;;AAKG;;AACI,IAAM,WAAW,GAAa,UAAA,KAAA,EAAK;AACjC,MAAA,KAAK,GAAI,KAAK,CAAC,QAAN,CAAgC,YAAA;AAAM,WAAC;AAAE,MAAA,OAAO,EAAV;AAAC,KAAD;AAAgB,GAAtD,EAAJ,CAAI,CAAT;AAEP,SAAO,KAAA,CAAA,aAAA,CAAC,OAAA,CAAA,UAAA,CAAW,QAAZ,EAAoB;AAAC,IAAA,KAAK,EAAE;AAAR,GAApB,EAAoC,KAAK,CAAC,QAA1C,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX;AAMb;;;AAGG;;AACH,SAAgB,QAAhB,GAAwB;AACtB,MAAM,cAAc,GAAG,aAAa,OAAO,OAAA,CAAA,sBAA3C;;AACM,MAAA,EAAA,GAAoB,KAAK,CAAC,QAAN,CAAe,cAAf,CAApB;AAAA,MAAC,KAAK,GAAA,EAAA,CAAA,CAAA,CAAN;AAAA,MAAQ,QAAQ,GAAA,EAAA,CAAA,CAAA,CAAhB,CAFgB,CAItB;AACA;;;AACA,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,QAAI,CAAC,cAAD,IAAmB,CAAC,WAAA,CAAA,SAAA,EAAxB,EAAqC;AACnC;AACA,MAAA,OAAO,CAAC,KAAR,CACE,4GACE,0CAFJ;AAID;AACF,GAdqB,CAgBtB;AACA;;;AACA,MAAI,WAAA,CAAA,SAAA,MAAe,cAAnB,EAAmC;AACjC;AACA;AACA;AACA,IAAA,KAAK,CAAC,eAAN,CAAsB,YAAA;AACpB,MAAA,QAAQ,CAAC,KAAD,CAAR;AACD,KAFD,EAEG,EAFH;AAGD;;AAED,SAAO,KAAP;AACD;;AA5BD,OAAA,CAAA,QAAA,GAAA,QAAA","sourceRoot":""}
1
+ {"version":3,"sources":["ssr/SSRContext.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAYA;;;;AAIG;;;AACU,OAAA,CAAA,sBAAA,GAA0C;AACrD,EAAA,OAAO,EAAE;AAD4C,CAA1C;AAIA,OAAA,CAAA,UAAA,gBAAa,KAAK,CAAC,aAAN,CAAqC,OAAA,CAAA,sBAArC,CAAb;AAEb;;AAEG;;AACH,SAAgB,aAAhB,GAA6B;AAC3B,SAAO,KAAK,CAAC,UAAN,CAAiB,OAAA,CAAA,UAAjB,CAAP;AACD;;AAFD,OAAA,CAAA,aAAA,GAAA,aAAA;AAIA;;;;;AAKG;;AACI,MAAM,WAAW,GAAa,KAAK,IAAG;AAC3C,QAAM,CAAC,KAAD,IAAU,KAAK,CAAC,QAAN,CAAgC,OAAO;AAAE,IAAA,OAAO,EAAE;AAAX,GAAP,CAAhC,CAAhB;AAEA,SAAO,KAAA,CAAA,aAAA,CAAC,OAAA,CAAA,UAAA,CAAW,QAAZ,EAAoB;AAAC,IAAA,KAAK,EAAE;AAAR,GAApB,EAAoC,KAAK,CAAC,QAA1C,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,WAAA,GAAW,WAAX;AAMb;;;AAGG;;AACH,SAAgB,QAAhB,GAAwB;AACtB,QAAM,cAAc,GAAG,aAAa,OAAO,OAAA,CAAA,sBAA3C;AACA,QAAM,CAAC,KAAD,EAAQ,QAAR,IAAoB,KAAK,CAAC,QAAN,CAAe,cAAf,CAA1B,CAFsB,CAItB;AACA;;AACA,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,QAAI,CAAC,cAAD,IAAmB,CAAC,WAAA,CAAA,SAAA,EAAxB,EAAqC;AACnC;AACA,MAAA,OAAO,CAAC,KAAR,CACE,4GACE,0CAFJ;AAID;AACF,GAdqB,CAgBtB;AACA;;;AACA,MAAI,WAAA,CAAA,SAAA,MAAe,cAAnB,EAAmC;AACjC;AACA;AACA;AACA,IAAA,KAAK,CAAC,eAAN,CAAsB,MAAK;AACzB,MAAA,QAAQ,CAAC,KAAD,CAAR;AACD,KAFD,EAEG,EAFH;AAGD;;AAED,SAAO,KAAP;AACD;;AA5BD,OAAA,CAAA,QAAA,GAAA,QAAA","sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n\n/**\n * To support SSR, the auto incrementing id counter is stored in a context. This allows it to be reset on every request\n * to ensure the client and server are consistent.\n *\n * @internal\n */\nexport type SSRContextValue = {\n current: number;\n};\n\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */\nexport const defaultSSRContextValue: SSRContextValue = {\n current: 0,\n};\n\nexport const SSRContext = React.createContext<SSRContextValue>(defaultSSRContextValue);\n\n/**\n * @internal\n */\nexport function useSSRContext(): SSRContextValue {\n return React.useContext(SSRContext);\n}\n\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */\nexport const SSRProvider: React.FC = props => {\n const [value] = React.useState<SSRContextValue>(() => ({ current: 0 }));\n\n return <SSRContext.Provider value={value}>{props.children}</SSRContext.Provider>;\n};\n\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */\nexport function useIsSSR(): boolean {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' +\n 'generated between the client and server.',\n );\n }\n }\n\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(() => {\n setIsSSR(false);\n }, []);\n }\n\n return isSSR;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ssr/canUseDOM.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACH,SAAgB,SAAhB,GAAyB;AACvB,SACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;AACA,EAAA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD;;AATD,OAAA,CAAA,SAAA,GAAA,SAAA","sourceRoot":""}
1
+ {"version":3,"sources":["ssr/canUseDOM.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACH,SAAgB,SAAhB,GAAyB;AACvB,SACE,OAAO,MAAP,KAAkB,WAAlB,IACA,CAAC,EACC,MAAM,CAAC,QAAP,IACA;AACA,EAAA,MAAM,CAAC,QAAP,CAAgB,aAHjB,CAFH;AAQD;;AATD,OAAA,CAAA,SAAA,GAAA,SAAA","sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return (\n typeof window !== 'undefined' &&\n !!(\n window.document &&\n // eslint-disable-next-line deprecation/deprecation\n window.document.createElement\n )\n );\n}\n"],"sourceRoot":"../src/"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var tslib_1 = /*#__PURE__*/require("tslib");
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./canUseDOM"), exports);
10
10
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ssr/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["ssr/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n"],"sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ import * as React from 'react';
2
2
  /**
3
3
  * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
4
4
  */
5
- export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | ((props: TTriggerProps) => React.ReactNode) | null | undefined, triggerProps: TTriggerProps) => React.ReactNode;
5
+ export declare const applyTriggerPropsToChildren: <TTriggerProps>(children: React.ReactElement<any, string | React.JSXElementConstructor<any>> | ((props: TTriggerProps) => React.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React.ReactElement | null;
@@ -5,23 +5,43 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.applyTriggerPropsToChildren = void 0;
7
7
 
8
- var React = /*#__PURE__*/require("react");
8
+ const React = /*#__PURE__*/require("react");
9
9
 
10
- var onlyChild_1 = /*#__PURE__*/require("./onlyChild");
10
+ const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
11
11
  /**
12
12
  * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.
13
13
  */
14
14
 
15
15
 
16
- var applyTriggerPropsToChildren = function (children, triggerProps) {
16
+ const applyTriggerPropsToChildren = (children, triggerProps) => {
17
17
  if (typeof children === 'function') {
18
18
  return children(triggerProps);
19
19
  } else if (children) {
20
- return React.cloneElement(onlyChild_1.onlyChild(children), triggerProps);
21
- }
20
+ return cloneTriggerTree(children, triggerProps);
21
+ } // Components in React should return either JSX elements or "null", otherwise React will throw:
22
+ // Nothing was returned from render.
23
+ // This usually means a return statement is missing. Or, to render nothing, return null.
24
+
22
25
 
23
- return children;
26
+ return children || null;
24
27
  };
25
28
 
26
29
  exports.applyTriggerPropsToChildren = applyTriggerPropsToChildren;
30
+ /**
31
+ * Clones a React element tree, and applies the given props to the first grandchild that is not
32
+ * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).
33
+ */
34
+
35
+ const cloneTriggerTree = (child, triggerProps) => {
36
+ if (!React.isValidElement(child) || child.type === React.Fragment) {
37
+ throw new Error('A trigger element must be a single element for this component. ' + "Please ensure that you're not using React Fragments.");
38
+ }
39
+
40
+ if (isFluentTrigger_1.isFluentTrigger(child)) {
41
+ const grandchild = cloneTriggerTree(child.props.children, triggerProps);
42
+ return React.cloneElement(child, undefined, grandchild);
43
+ } else {
44
+ return React.cloneElement(child, triggerProps);
45
+ }
46
+ };
27
47
  //# sourceMappingURL=applyTriggerPropsToChildren.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/applyTriggerPropsToChildren.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAEA;;AAEG;;;AACI,IAAM,2BAA2B,GAAG,UACzC,QADyC,EAEzC,YAFyC,EAEd;AAE3B,MAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;AAClC,WAAO,QAAQ,CAAC,YAAD,CAAf;AACD,GAFD,MAEO,IAAI,QAAJ,EAAc;AACnB,WAAO,KAAK,CAAC,YAAN,CAAmB,WAAA,CAAA,SAAA,CAAU,QAAV,CAAnB,EAAwC,YAAxC,CAAP;AACD;;AAED,SAAO,QAAP;AACD,CAXM;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B","sourceRoot":""}
1
+ {"version":3,"sources":["utils/applyTriggerPropsToChildren.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;AAEG;;;AACI,MAAM,2BAA2B,GAAG,CACzC,QADyC,EAEzC,YAFyC,KAGZ;AAC7B,MAAI,OAAO,QAAP,KAAoB,UAAxB,EAAoC;AAClC,WAAO,QAAQ,CAAC,YAAD,CAAf;AACD,GAFD,MAEO,IAAI,QAAJ,EAAc;AACnB,WAAO,gBAAgB,CAAC,QAAD,EAAW,YAAX,CAAvB;AACD,GAL4B,CAO7B;AACA;AACA;;;AACA,SAAO,QAAQ,IAAI,IAAnB;AACD,CAdM;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B;AAgBb;;;AAGG;;AACH,MAAM,gBAAgB,GAAG,CAAgB,KAAhB,EAAwC,YAAxC,KAA2F;AAClH,MAAI,CAAC,KAAK,CAAC,cAAN,CAAqB,KAArB,CAAD,IAAgC,KAAK,CAAC,IAAN,KAAe,KAAK,CAAC,QAAzD,EAAmE;AACjE,UAAM,IAAI,KAAJ,CACJ,oEACE,sDAFE,CAAN;AAID;;AAED,MAAI,iBAAA,CAAA,eAAA,CAAgB,KAAhB,CAAJ,EAA4B;AAC1B,UAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAN,CAAY,QAAb,EAAuB,YAAvB,CAAnC;AACA,WAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,SAA1B,EAAqC,UAArC,CAAP;AACD,GAHD,MAGO;AACL,WAAO,KAAK,CAAC,YAAN,CAAmB,KAAnB,EAA0B,YAA1B,CAAP;AACD;AACF,CAdD","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n\n/**\n * Apply the trigger props to the children, either by calling the render function, or cloning with the new props.\n */\nexport const applyTriggerPropsToChildren = <TTriggerProps>(\n children: React.ReactElement | ((props: TTriggerProps) => React.ReactElement | null) | null | undefined,\n triggerProps: TTriggerProps,\n): React.ReactElement | null => {\n if (typeof children === 'function') {\n return children(triggerProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerProps);\n }\n\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n};\n\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */\nconst cloneTriggerTree = <TTriggerProps>(child: React.ReactNode, triggerProps: TTriggerProps): React.ReactElement => {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error(\n 'A trigger element must be a single element for this component. ' +\n \"Please ensure that you're not using React Fragments.\",\n );\n }\n\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps);\n }\n};\n"],"sourceRoot":"../src/"}
@@ -12,9 +12,7 @@ exports.clamp = void 0;
12
12
  * @param max - the highest valid value
13
13
  */
14
14
 
15
- var clamp = function (value, min, max) {
16
- return Math.max(min, Math.min(max, value || 0));
17
- };
15
+ const clamp = (value, min, max) => Math.max(min, Math.min(max, value || 0));
18
16
 
19
17
  exports.clamp = clamp;
20
18
  //# sourceMappingURL=clamp.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/clamp.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;;AACI,IAAM,KAAK,GAAG,UAAC,KAAD,EAAgB,GAAhB,EAA6B,GAA7B,EAAwC;AAAa,SAAA,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,KAAK,IAAjC,CAAc,CAAd,CAAA;AAAwC,CAA3G;;AAAM,OAAA,CAAA,KAAA,GAAK,KAAL","sourceRoot":""}
1
+ {"version":3,"sources":["utils/clamp.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;;AACI,MAAM,KAAK,GAAG,CAAC,KAAD,EAAgB,GAAhB,EAA6B,GAA7B,KAAqD,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,IAAI,CAAC,GAAL,CAAS,GAAT,EAAc,KAAK,IAAI,CAAvB,CAAd,CAAnE;;AAAM,OAAA,CAAA,KAAA,GAAK,KAAL","sourcesContent":["/**\n * Clamps `value` to a number between the min and max.\n *\n * @param value - the value to be clamped\n * @param min - the lowest valid value\n * @param max - the highest valid value\n */\nexport const clamp = (value: number, min: number, max: number): number => Math.max(min, Math.min(max, value || 0));\n"],"sourceRoot":"../src/"}
@@ -7,3 +7,25 @@ import * as React from 'react';
7
7
  * @param excludedPropNames - List of props to disallow
8
8
  */
9
9
  export declare function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;
10
+ /**
11
+ * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
12
+ *
13
+ * This function is only for use with components that have a primary slot other than `root`.
14
+ * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
15
+ *
16
+ * @returns An object containing the native props for the `root` and primary slots.
17
+ */
18
+ export declare const getPartitionedNativeProps: <Props extends Pick<React.HTMLAttributes<HTMLElement>, "style" | "className">, ExcludedPropKeys extends Extract<keyof Props, string> = never>({ primarySlotTagName, props, excludedPropNames, }: {
19
+ /** The primary slot's element type (e.g. 'div') */
20
+ primarySlotTagName: keyof JSX.IntrinsicElements;
21
+ /** The component's props object */
22
+ props: Props;
23
+ /** List of native props to exclude from the returned value */
24
+ excludedPropNames?: ExcludedPropKeys[] | undefined;
25
+ }) => {
26
+ root: {
27
+ style: React.CSSProperties | undefined;
28
+ className: string | undefined;
29
+ };
30
+ primary: Omit<Props, ExcludedPropKeys>;
31
+ };
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getNativeElementProps = void 0;
6
+ exports.getPartitionedNativeProps = exports.getNativeElementProps = void 0;
7
7
 
8
- var properties_1 = /*#__PURE__*/require("./properties");
8
+ const properties_1 = /*#__PURE__*/require("./properties");
9
9
 
10
- var nativeElementMap = {
10
+ const nativeElementMap = {
11
11
  label: properties_1.labelProperties,
12
12
  audio: properties_1.audioProperties,
13
13
  video: properties_1.videoProperties,
@@ -39,10 +39,34 @@ var nativeElementMap = {
39
39
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
40
 
41
41
  function getNativeElementProps(tagName, props, excludedPropNames) {
42
- var allowedPropNames = tagName && nativeElementMap[tagName] || properties_1.htmlElementProperties;
42
+ const allowedPropNames = tagName && nativeElementMap[tagName] || properties_1.htmlElementProperties;
43
43
  allowedPropNames.as = 1;
44
44
  return properties_1.getNativeProps(props, allowedPropNames, excludedPropNames);
45
45
  }
46
46
 
47
47
  exports.getNativeElementProps = getNativeElementProps;
48
+ /**
49
+ * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.
50
+ *
51
+ * This function is only for use with components that have a primary slot other than `root`.
52
+ * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.
53
+ *
54
+ * @returns An object containing the native props for the `root` and primary slots.
55
+ */
56
+
57
+ const getPartitionedNativeProps = ({
58
+ primarySlotTagName,
59
+ props,
60
+ excludedPropNames
61
+ }) => {
62
+ return {
63
+ root: {
64
+ style: props.style,
65
+ className: props.className
66
+ },
67
+ primary: getNativeElementProps(primarySlotTagName, props, [...(excludedPropNames || []), 'style', 'className'])
68
+ };
69
+ };
70
+
71
+ exports.getPartitionedNativeProps = getPartitionedNativeProps;
48
72
  //# sourceMappingURL=getNativeElementProps.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/getNativeElementProps.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AAyBA,IAAM,gBAAgB,GAA2C;AAC/D,EAAA,KAAK,EAAE,YAAA,CAAA,eADwD;AAE/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAFwD;AAG/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAHwD;AAI/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAJ2D;AAK/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAL2D;AAM/D,EAAA,CAAC,EAAE,YAAA,CAAA,gBAN4D;AAO/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAPuD;AAQ/D,EAAA,KAAK,EAAE,YAAA,CAAA,eARwD;AAS/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBATqD;AAU/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAVuD;AAW/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAXuD;AAY/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAZwD;AAa/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAb2D;AAc/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAd2D;AAe/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAf2D;AAgB/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBAhBqD;AAiB/D,EAAA,GAAG,EAAE,YAAA,CAAA,aAjB0D;AAkB/D,EAAA,IAAI,EAAE,YAAA,CAAA,cAlByD;AAmB/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAnBuD;AAoB/D,EAAA,GAAG,EAAE,YAAA,CAAA;AApB0D,CAAjE;AAuBA;;;;;;AAMG;AACH;;AACA,SAAgB,qBAAhB,CACE,OADF,EAEE,KAFF,EAGE,iBAHF,EAG8B;AAE5B,MAAM,gBAAgB,GAAI,OAAO,IAAI,gBAAgB,CAAC,OAAD,CAA5B,IAA0C,YAAA,CAAA,qBAAnE;AACA,EAAA,gBAAgB,CAAC,EAAjB,GAAsB,CAAtB;AAEA,SAAO,YAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,gBAAtB,EAAwC,iBAAxC,CAAP;AACD;;AATD,OAAA,CAAA,qBAAA,GAAA,qBAAA","sourceRoot":""}
1
+ {"version":3,"sources":["utils/getNativeElementProps.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AAyBA,MAAM,gBAAgB,GAA2C;AAC/D,EAAA,KAAK,EAAE,YAAA,CAAA,eADwD;AAE/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAFwD;AAG/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAHwD;AAI/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAJ2D;AAK/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAL2D;AAM/D,EAAA,CAAC,EAAE,YAAA,CAAA,gBAN4D;AAO/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAPuD;AAQ/D,EAAA,KAAK,EAAE,YAAA,CAAA,eARwD;AAS/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBATqD;AAU/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAVuD;AAW/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAXuD;AAY/D,EAAA,KAAK,EAAE,YAAA,CAAA,eAZwD;AAa/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAb2D;AAc/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAd2D;AAe/D,EAAA,EAAE,EAAE,YAAA,CAAA,YAf2D;AAgB/D,EAAA,QAAQ,EAAE,YAAA,CAAA,kBAhBqD;AAiB/D,EAAA,GAAG,EAAE,YAAA,CAAA,aAjB0D;AAkB/D,EAAA,IAAI,EAAE,YAAA,CAAA,cAlByD;AAmB/D,EAAA,MAAM,EAAE,YAAA,CAAA,gBAnBuD;AAoB/D,EAAA,GAAG,EAAE,YAAA,CAAA;AApB0D,CAAjE;AAuBA;;;;;;AAMG;AACH;;AACA,SAAgB,qBAAhB,CACE,OADF,EAEE,KAFF,EAGE,iBAHF,EAG8B;AAE5B,QAAM,gBAAgB,GAAI,OAAO,IAAI,gBAAgB,CAAC,OAAD,CAA5B,IAA0C,YAAA,CAAA,qBAAnE;AACA,EAAA,gBAAgB,CAAC,EAAjB,GAAsB,CAAtB;AAEA,SAAO,YAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,gBAAtB,EAAwC,iBAAxC,CAAP;AACD;;AATD,OAAA,CAAA,qBAAA,GAAA,qBAAA;AAWA;;;;;;;AAOG;;AACI,MAAM,yBAAyB,GAAG,CAGvC;AACA,EAAA,kBADA;AAEA,EAAA,KAFA;AAGA,EAAA;AAHA,CAHuC,KAgBpC;AACH,SAAO;AACL,IAAA,IAAI,EAAE;AAAE,MAAA,KAAK,EAAE,KAAK,CAAC,KAAf;AAAsB,MAAA,SAAS,EAAE,KAAK,CAAC;AAAvC,KADD;AAEL,IAAA,OAAO,EAAE,qBAAqB,CAAgC,kBAAhC,EAAoD,KAApD,EAA2D,CACvF,IAAI,iBAAiB,IAAI,EAAzB,CADuF,EAEvF,OAFuF,EAGvF,WAHuF,CAA3D;AAFzB,GAAP;AAQD,CAzBM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import * as React from 'react';\nimport {\n labelProperties,\n audioProperties,\n videoProperties,\n olProperties,\n liProperties,\n anchorProperties,\n buttonProperties,\n inputProperties,\n textAreaProperties,\n selectProperties,\n optionProperties,\n tableProperties,\n trProperties,\n thProperties,\n tdProperties,\n colGroupProperties,\n colProperties,\n formProperties,\n iframeProperties,\n imgProperties,\n htmlElementProperties,\n getNativeProps,\n} from './properties';\n\nconst nativeElementMap: Record<string, Record<string, number>> = {\n label: labelProperties,\n audio: audioProperties,\n video: videoProperties,\n ol: olProperties,\n li: liProperties,\n a: anchorProperties,\n button: buttonProperties,\n input: inputProperties,\n textarea: textAreaProperties,\n select: selectProperties,\n option: optionProperties,\n table: tableProperties,\n tr: trProperties,\n th: thProperties,\n td: tdProperties,\n colGroup: colGroupProperties,\n col: colProperties,\n form: formProperties,\n iframe: iframeProperties,\n img: imgProperties,\n};\n\n/**\n * Given an element tagname and user props, filters the props to only allowed props for the given\n * element type.\n * @param tagName - Tag name (e.g. \"div\")\n * @param props - Props object\n * @param excludedPropNames - List of props to disallow\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getNativeElementProps<TAttributes extends React.HTMLAttributes<any>>(\n tagName: string,\n props: {},\n excludedPropNames?: string[],\n): TAttributes {\n const allowedPropNames = (tagName && nativeElementMap[tagName]) || htmlElementProperties;\n allowedPropNames.as = 1;\n\n return getNativeProps(props, allowedPropNames, excludedPropNames);\n}\n\n/**\n * Splits the native props into ones that go to the `root` slot, and ones that go to the primary slot.\n *\n * This function is only for use with components that have a primary slot other than `root`.\n * Most components should use {@link getNativeElementProps} for their root slot if it is the primary slot.\n *\n * @returns An object containing the native props for the `root` and primary slots.\n */\nexport const getPartitionedNativeProps = <\n Props extends Pick<React.HTMLAttributes<HTMLElement>, 'style' | 'className'>,\n ExcludedPropKeys extends Extract<keyof Props, string> = never\n>({\n primarySlotTagName,\n props,\n excludedPropNames,\n}: {\n /** The primary slot's element type (e.g. 'div') */\n primarySlotTagName: keyof JSX.IntrinsicElements;\n\n /** The component's props object */\n props: Props;\n\n /** List of native props to exclude from the returned value */\n excludedPropNames?: ExcludedPropKeys[];\n}) => {\n return {\n root: { style: props.style, className: props.className },\n primary: getNativeElementProps<Omit<Props, ExcludedPropKeys>>(primarySlotTagName, props, [\n ...(excludedPropNames || []),\n 'style',\n 'className',\n ]),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -8,7 +8,7 @@ exports.getRTLSafeKey = void 0;
8
8
  * Finds and swaps a provided key for it's right to left format.
9
9
  */
10
10
 
11
- var getRTLSafeKey = function (key, dir) {
11
+ const getRTLSafeKey = (key, dir) => {
12
12
  if (dir === 'rtl') {
13
13
  switch (key) {
14
14
  case 'ArrowLeft':
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/getRTLSafeKey.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACI,IAAM,aAAa,GAAG,UAAC,GAAD,EAAc,GAAd,EAAgC;AAC3D,MAAI,GAAG,KAAK,KAAZ,EAAmB;AACjB,YAAQ,GAAR;AACE,WAAK,WAAL;AAAkB;AAChB,iBAAO,YAAP;AACD;;AAED,WAAK,YAAL;AAAmB;AACjB,iBAAO,WAAP;AACD;AAPH;AASD;;AAED,SAAO,GAAP;AACD,CAdM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourceRoot":""}
1
+ {"version":3,"sources":["utils/getRTLSafeKey.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACI,MAAM,aAAa,GAAG,CAAC,GAAD,EAAc,GAAd,KAAoC;AAC/D,MAAI,GAAG,KAAK,KAAZ,EAAmB;AACjB,YAAQ,GAAR;AACE,WAAK,WAAL;AAAkB;AAChB,iBAAO,YAAP;AACD;;AAED,WAAK,YAAL;AAAmB;AACjB,iBAAO,WAAP;AACD;AAPH;AASD;;AAED,SAAO,GAAP;AACD,CAdM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourcesContent":["/**\n * Finds and swaps a provided key for it's right to left format.\n */\nexport const getRTLSafeKey = (key: string, dir: 'ltr' | 'rtl') => {\n if (dir === 'rtl') {\n switch (key) {\n case 'ArrowLeft': {\n return 'ArrowRight';\n }\n\n case 'ArrowRight': {\n return 'ArrowLeft';\n }\n }\n }\n\n return key;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ interface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {
3
+ _reactName?: string;
4
+ dispatchConfig?: {
5
+ registrationName: string;
6
+ phasedRegistrationNames: {
7
+ bubbled: string;
8
+ captured: string;
9
+ };
10
+ };
11
+ }
12
+ declare type NonUndefined<A> = A extends undefined ? never : A;
13
+ declare type FunctionKeys<T extends object> = {
14
+ [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;
15
+ }[keyof T];
16
+ export declare type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;
17
+ /**
18
+ * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.
19
+ *
20
+ * Ideally, it should also distinguish regular and "capture" callbacks, but it's possible only with React 17 as
21
+ * ".eventPhase" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events
22
+ * are handled in bubble phase.
23
+ */
24
+ export declare function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined;
25
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getReactCallbackName = void 0;
7
+ /**
8
+ * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.
9
+ *
10
+ * Ideally, it should also distinguish regular and "capture" callbacks, but it's possible only with React 17 as
11
+ * ".eventPhase" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events
12
+ * are handled in bubble phase.
13
+ */
14
+
15
+ function getReactCallbackName(event) {
16
+ if (event._reactName) {
17
+ return event._reactName;
18
+ }
19
+
20
+ if (event.dispatchConfig) {
21
+ if (event.dispatchConfig.registrationName) {
22
+ return event.dispatchConfig.registrationName;
23
+ }
24
+
25
+ return event.dispatchConfig.phasedRegistrationNames.bubbled;
26
+ }
27
+
28
+ if (process.env.NODE_ENV !== 'production') {
29
+ // eslint-disable-next-line no-console
30
+ console.error(['Passed React.SyntheticEvent does not contain ".dispatchConfig" or "._reactName".', 'This should not happen, please report it to https://github.com/microsoft/fluentui']);
31
+ }
32
+ }
33
+
34
+ exports.getReactCallbackName = getReactCallbackName;
35
+ //# sourceMappingURL=getReactCallbackName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/getReactCallbackName.ts"],"names":[],"mappings":";;;;;;AAwBA;;;;;;AAMG;;AACH,SAAgB,oBAAhB,CAAqC,KAArC,EAA+D;AAC7D,MAAI,KAAK,CAAC,UAAV,EAAsB;AACpB,WAAO,KAAK,CAAC,UAAb;AACD;;AAED,MAAI,KAAK,CAAC,cAAV,EAA0B;AACxB,QAAI,KAAK,CAAC,cAAN,CAAqB,gBAAzB,EAA2C;AACzC,aAAO,KAAK,CAAC,cAAN,CAAqB,gBAA5B;AACD;;AAED,WAAO,KAAK,CAAC,cAAN,CAAqB,uBAArB,CAA6C,OAApD;AACD;;AAED,MAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;AACzC;AACA,IAAA,OAAO,CAAC,KAAR,CAAc,CACZ,kFADY,EAEZ,mFAFY,CAAd;AAID;AACF;;AApBD,OAAA,CAAA,oBAAA,GAAA,oBAAA","sourcesContent":["import * as React from 'react';\n\ninterface ReactSyntheticEvent extends React.SyntheticEvent<unknown> {\n // React 17/18\n // See https://github.com/facebook/react/pull/19236\n _reactName?: string;\n\n // React 16\n dispatchConfig?: {\n registrationName: string;\n phasedRegistrationNames: {\n bubbled: string;\n captured: string;\n };\n };\n}\n\ntype NonUndefined<A> = A extends undefined ? never : A;\ntype FunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends Function ? K : never;\n}[keyof T];\n\nexport type ReactCallbackName = FunctionKeys<React.DOMAttributes<unknown>>;\n\n/**\n * React.SyntheticEvent contains name of a callback that should be fired, this function returns it.\n *\n * Ideally, it should also distinguish regular and \"capture\" callbacks, but it's possible only with React 17 as\n * \".eventPhase\" there has proper value, see https://github.com/facebook/react/pull/19244. In React 16 all events\n * are handled in bubble phase.\n */\nexport function getReactCallbackName(event: ReactSyntheticEvent): ReactCallbackName | undefined {\n if (event._reactName) {\n return event._reactName as ReactCallbackName;\n }\n\n if (event.dispatchConfig) {\n if (event.dispatchConfig.registrationName) {\n return event.dispatchConfig.registrationName as ReactCallbackName;\n }\n\n return event.dispatchConfig.phasedRegistrationNames.bubbled as ReactCallbackName;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error([\n 'Passed React.SyntheticEvent does not contain \".dispatchConfig\" or \"._reactName\".',\n 'This should not happen, please report it to https://github.com/microsoft/fluentui',\n ]);\n }\n}\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
4
+ *
5
+ * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
6
+ * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.
7
+ * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.
8
+ *
9
+ * For example, the following returns `<div id="child" />`:
10
+ * ```jsx
11
+ * getTriggerChild(
12
+ * <Tooltip>
13
+ * <MenuTrigger>
14
+ * <div id="child" />
15
+ * </MenuTrigger>
16
+ * </Tooltip>
17
+ * );
18
+ * ```
19
+ */
20
+ export declare const getTriggerChild: (children: React.ReactNode) => React.ReactElement & {
21
+ ref?: React.Ref<unknown>;
22
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTriggerChild = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const isFluentTrigger_1 = /*#__PURE__*/require("./isFluentTrigger");
11
+ /**
12
+ * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger).
13
+ *
14
+ * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment,
15
+ * it returns the first descendant that is _not_ a FluentTriggerComponent or Fragment.
16
+ * This allows multiple triggers to be stacked, and still apply their props to the actual trigger element.
17
+ *
18
+ * For example, the following returns `<div id="child" />`:
19
+ * ```jsx
20
+ * getTriggerChild(
21
+ * <Tooltip>
22
+ * <MenuTrigger>
23
+ * <div id="child" />
24
+ * </MenuTrigger>
25
+ * </Tooltip>
26
+ * );
27
+ * ```
28
+ */
29
+
30
+
31
+ const getTriggerChild = children => {
32
+ const child = React.Children.only(children);
33
+ return isFluentTrigger_1.isFluentTrigger(child) ? exports.getTriggerChild(child.props.children) : child;
34
+ };
35
+
36
+ exports.getTriggerChild = getTriggerChild;
37
+ //# sourceMappingURL=getTriggerChild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/getTriggerChild.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;AAEA;;;;;;;;;;;;;;;;;AAiBG;;;AACI,MAAM,eAAe,GAAI,QAAD,IAAiF;AAC9G,QAAM,KAAK,GAAG,KAAK,CAAC,QAAN,CAAe,IAAf,CAAoB,QAApB,CAAd;AACA,SAAO,iBAAA,CAAA,eAAA,CAAgB,KAAhB,IAAyB,OAAA,CAAA,eAAA,CAAgB,KAAK,CAAC,KAAN,CAAY,QAA5B,CAAzB,GAAiE,KAAxE;AACD,CAHM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n\n/**\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 */\nexport const getTriggerChild = (children: React.ReactNode): React.ReactElement & { ref?: React.Ref<unknown> } => {\n const child = React.Children.only(children) as React.ReactElement;\n return isFluentTrigger(child) ? getTriggerChild(child.props.children) : child;\n};\n"],"sourceRoot":"../src/"}
@@ -2,7 +2,8 @@ export * from './applyTriggerPropsToChildren';
2
2
  export * from './clamp';
3
3
  export * from './getNativeElementProps';
4
4
  export * from './getRTLSafeKey';
5
+ export * from './getTriggerChild';
6
+ export * from './isFluentTrigger';
5
7
  export * from './omit';
6
- export * from './onlyChild';
7
8
  export * from './properties';
8
9
  export * from './shouldPreventDefaultOnKeyDown';
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var tslib_1 = /*#__PURE__*/require("tslib");
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
8
 
9
9
  tslib_1.__exportStar(require("./applyTriggerPropsToChildren"), exports);
10
10
 
@@ -14,9 +14,11 @@ tslib_1.__exportStar(require("./getNativeElementProps"), exports);
14
14
 
15
15
  tslib_1.__exportStar(require("./getRTLSafeKey"), exports);
16
16
 
17
- tslib_1.__exportStar(require("./omit"), exports);
17
+ tslib_1.__exportStar(require("./getTriggerChild"), exports);
18
+
19
+ tslib_1.__exportStar(require("./isFluentTrigger"), exports);
18
20
 
19
- tslib_1.__exportStar(require("./onlyChild"), exports);
21
+ tslib_1.__exportStar(require("./omit"), exports);
20
22
 
21
23
  tslib_1.__exportStar(require("./properties"), exports);
22
24
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,aAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './applyTriggerPropsToChildren';\nexport * from './clamp';\nexport * from './getNativeElementProps';\nexport * from './getRTLSafeKey';\nexport * from './getTriggerChild';\nexport * from './isFluentTrigger';\nexport * from './omit';\nexport * from './properties';\nexport * from './shouldPreventDefaultOnKeyDown';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Allows a component to be tagged as a FluentUI trigger component.
4
+ *
5
+ * Triggers are special-case components: they attach event listeners and other props on their child,
6
+ * and use them to trigger another component to show. Examples include `MenuTrigger` and `Tooltip`.
7
+ *
8
+ * A component can be tagged as a trigger as follows:
9
+ * ```ts
10
+ * const MyComponent: React.FC<MyComponentProps> & FluentTriggerComponent = ...;
11
+ *
12
+ * MyComponent.isFluentTriggerComponent = true; // MUST also set this to true
13
+ * ```
14
+ */
15
+ export declare type FluentTriggerComponent = {
16
+ isFluentTriggerComponent?: boolean;
17
+ };
18
+ /**
19
+ * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
20
+ * See the {@link FluentTriggerComponent} type for more info.
21
+ */
22
+ export declare const isFluentTrigger: (element: React.ReactElement) => boolean | undefined;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isFluentTrigger = void 0;
7
+ /**
8
+ * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).
9
+ * See the {@link FluentTriggerComponent} type for more info.
10
+ */
11
+
12
+ const isFluentTrigger = element => {
13
+ return element.type.isFluentTriggerComponent;
14
+ };
15
+
16
+ exports.isFluentTrigger = isFluentTrigger;
17
+ //# sourceMappingURL=isFluentTrigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/isFluentTrigger.ts"],"names":[],"mappings":";;;;;;AAmBA;;;AAGG;;AACI,MAAM,eAAe,GAAI,OAAD,IAAgC;AAC7D,SAAQ,OAAO,CAAC,IAAR,CAAwC,wBAAhD;AACD,CAFM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\n\n/**\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 * Checks if a given element is a FluentUI trigger (e.g. `MenuTrigger` or `Tooltip`).\n * See the {@link FluentTriggerComponent} type for more info.\n */\nexport const isFluentTrigger = (element: React.ReactElement) => {\n return (element.type as FluentTriggerComponent).isFluentTriggerComponent;\n};\n"],"sourceRoot":"../src/"}
@@ -21,9 +21,9 @@ exports.omit = void 0;
21
21
 
22
22
  function omit(obj, exclusions) {
23
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- var result = {};
24
+ const result = {};
25
25
 
26
- for (var key in obj) {
26
+ for (const key in obj) {
27
27
  if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {
28
28
  result[key] = obj[key];
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/omit.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;AAYG;AACH;;AACA,SAAgB,IAAhB,CACE,GADF,EAEE,UAFF,EAEwB;AAEtB;AACA,MAAM,MAAM,GAAwB,EAApC;;AAEA,OAAK,IAAM,GAAX,IAAkB,GAAlB,EAAuB;AACrB,QAAI,UAAU,CAAC,OAAX,CAAmB,GAAnB,MAA4B,CAAC,CAA7B,IAAkC,GAAG,CAAC,cAAJ,CAAmB,GAAnB,CAAtC,EAA+D;AAC7D,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,GAAG,CAAC,GAAD,CAAjB;AACD;AACF;;AAED,SAAO,MAAP;AACD;;AAdD,OAAA,CAAA,IAAA,GAAA,IAAA","sourceRoot":""}
1
+ {"version":3,"sources":["utils/omit.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;AAYG;AACH;;AACA,SAAgB,IAAhB,CACE,GADF,EAEE,UAFF,EAEwB;AAEtB;AACA,QAAM,MAAM,GAAwB,EAApC;;AAEA,OAAK,MAAM,GAAX,IAAkB,GAAlB,EAAuB;AACrB,QAAI,UAAU,CAAC,OAAX,CAAmB,GAAnB,MAA4B,CAAC,CAA7B,IAAkC,GAAG,CAAC,cAAJ,CAAmB,GAAnB,CAAtC,EAA+D;AAC7D,MAAA,MAAM,CAAC,GAAD,CAAN,GAAc,GAAG,CAAC,GAAD,CAAjB;AACD;AACF;;AAED,SAAO,MAAP;AACD;;AAdD,OAAA,CAAA,IAAA,GAAA,IAAA","sourcesContent":["/**\n * Tiny helper to do the minimal amount of work in duplicating an object but omitting some\n * props. This ends up faster than using object ...rest or reduce to filter.\n *\n * This behaves very much like filteredAssign, but does not merge many objects together,\n * uses an exclusion object map, and avoids spreads all for optimal performance.\n *\n * See perf test for background:\n * https://jsperf.com/omit-vs-rest-vs-reduce/1\n *\n * @param obj - The object to clone\n * @param exclusions - The array of keys to exclude\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function omit<TObj extends Record<string, any>, Exclusions extends (keyof TObj)[]>(\n obj: TObj,\n exclusions: Exclusions,\n): Omit<TObj, Exclusions[number]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: Record<string, any> = {};\n\n for (const key in obj) {\n if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) {\n result[key] = obj[key];\n }\n }\n\n return result as TObj;\n}\n"],"sourceRoot":"../src/"}