@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
@@ -31,6 +31,7 @@ function getSlotNext(state, slotName) {
31
31
  undefined
32
32
  ];
33
33
  }
34
+ // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)
34
35
  const { as: asProp , ...propsWithoutAs } = props;
35
36
  const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];
36
37
  const shouldOmitAsProp = typeof slot === 'string' && asProp;
@@ -39,6 +40,4 @@ function getSlotNext(state, slotName) {
39
40
  slot,
40
41
  slotProps
41
42
  ];
42
- } //# sourceMappingURL=getSlotsNext.js.map
43
-
44
- //# sourceMappingURL=getSlotsNext.js.map
43
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n */\nexport function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [null, undefined];\n }\n const {\n as: asProp,\n ...propsWithoutAs\n } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [slot, slotProps];\n}\n//# sourceMappingURL=getSlotsNext.js.map"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAIgBA;;aAAAA;;;6DAJO;AAIhB,SAASA,aAAaC,KAAK,EAAE;IAClC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QACLR;QACAC,WAAWA;IACb;AACF;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ,EAAE;IACpC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACvB,OAAO;YAAC,IAAI;YAAEA;SAAU;IAC1B,CAAC;IACD,MAAM,EACJC,IAAIC,OAAM,EACV,GAAGC,gBACJ,GAAGP;IACJ,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP,KAAK;IAC3D,OAAO;QAACD;QAAMN;KAAU;AAC1B,EACA,wCAAwC"}
1
+ {"version":3,"sources":["getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n */ export function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp , ...propsWithoutAs } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAGoBA;;aAAAA;;;6DAHG;AAGZ,SAASA,aAAaC,KAAK,EAAE;IACpC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ,EAAE;IAClC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH,IAAI;YACJA;SACH;IACL,CAAC;IACD,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,OAAM,EAAG,GAAGC,gBAAgB,GAAGP;IAC3C,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,IAAI,IAAIM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP,KAAK;IAC3D,OAAO;QACHD;QACAN;KACH;AACL"}
@@ -9,6 +9,3 @@ _exportStar(require("./types"), exports);
9
9
  _exportStar(require("./isResolvedShorthand"), exports);
10
10
  _exportStar(require("./constants"), exports);
11
11
  _exportStar(require("./getSlotsNext"), exports);
12
- //# sourceMappingURL=index.js.map
13
-
14
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/index.js"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './getSlots';\nexport * from './resolveShorthand';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './getSlotsNext';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA"}
@@ -9,6 +9,4 @@ Object.defineProperty(exports, "isResolvedShorthand", {
9
9
  const _react = require("react");
10
10
  function isResolvedShorthand(shorthand) {
11
11
  return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !/*#__PURE__*/ (0, _react.isValidElement)(shorthand);
12
- } //# sourceMappingURL=isResolvedShorthand.js.map
13
-
14
- //# sourceMappingURL=isResolvedShorthand.js.map
12
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/isResolvedShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */\nexport function isResolvedShorthand(shorthand) {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && ! /*#__PURE__*/isValidElement(shorthand);\n}\n//# sourceMappingURL=isResolvedShorthand.js.map"],"names":["isResolvedShorthand","shorthand","Array","isArray","isValidElement"],"mappings":";;;;+BA+BgBA;;aAAAA;;uBA/Be;AA+BxB,SAASA,oBAAoBC,SAAS,EAAE;IAC7C,OAAOA,cAAc,IAAI,IAAI,OAAOA,cAAc,YAAY,CAACC,MAAMC,OAAO,CAACF,cAAc,CAAE,WAAW,GAAEG,IAAAA,qBAAc,EAACH;AAC3H,EACA,+CAA+C"}
1
+ {"version":3,"sources":["isResolvedShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\n/**\n * Guard method that validates if a shorthand is a slot\n * can be used to extends properties provided by a slot\n *\n * @example\n * ```\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(event => {\n * if (isResolvedShorthand(backdrop)) {\n * backdrop.onClick?.(event)\n * }\n * // do something after passing click down the line\n * }),\n * },\n * })\n * ```\n * @example\n * ```\n * const handleBackDropClick = (event) => {\n * // do your thing\n * }\n * const backdropSlot = resolveShorthand(backdrop, {\n * defaultProps: {\n * onClick: useEventCallback(\n * mergeCallbacks(isResolvedShorthand(backdrop) ? backdrop.onClick : undefined, handleBackdropClick)\n * )\n * })\n * ```\n */ export function isResolvedShorthand(shorthand) {\n return shorthand !== null && typeof shorthand === 'object' && !Array.isArray(shorthand) && !isValidElement(shorthand);\n}\n"],"names":["isResolvedShorthand","shorthand","Array","isArray","isValidElement"],"mappings":";;;;+BA8BoBA;;aAAAA;;uBA9BW;AA8BpB,SAASA,oBAAoBC,SAAS,EAAE;IAC/C,OAAOA,cAAc,IAAI,IAAI,OAAOA,cAAc,YAAY,CAACC,MAAMC,OAAO,CAACF,cAAc,eAACG,IAAAA,qBAAc,EAACH;AAC/G"}
@@ -29,6 +29,4 @@ const resolveShorthand = (value, options)=>{
29
29
  resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;
30
30
  }
31
31
  return resolvedShorthand;
32
- }; //# sourceMappingURL=resolveShorthand.js.map
33
-
34
- //# sourceMappingURL=resolveShorthand.js.map
32
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/resolveShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand = (value, options) => {\n const {\n required = false,\n defaultProps\n } = options || {};\n if (value === null || value === undefined && !required) {\n return undefined;\n }\n let resolvedShorthand = {};\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || /*#__PURE__*/isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = value;\n }\n resolvedShorthand = {\n ...defaultProps,\n ...resolvedShorthand\n };\n if (typeof resolvedShorthand.children === 'function') {\n resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children;\n resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;\n }\n return resolvedShorthand;\n};\n//# sourceMappingURL=resolveShorthand.js.map"],"names":["resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","isValidElement","children","SLOT_RENDER_FUNCTION_SYMBOL"],"mappings":";;;;+BAQaA;;aAAAA;;uBARkB;2BACa;AAOrC,MAAMA,mBAAmB,CAACC,OAAOC,UAAY;IAClD,MAAM,EACJC,UAAW,KAAK,CAAA,EAChBC,aAAY,EACb,GAAGF,WAAW,CAAC;IAChB,IAAID,UAAU,IAAI,IAAIA,UAAUI,aAAa,CAACF,UAAU;QACtD,OAAOE;IACT,CAAC;IACD,IAAIC,oBAAoB,CAAC;IACzB,8DAA8D;IAC9D,IAAI,OAAOL,UAAU,YAAY,OAAOA,UAAU,YAAYM,MAAMC,OAAO,CAACP,UAAU,WAAW,GAAEQ,IAAAA,qBAAc,EAACR,QAAQ;QACxHK,kBAAkBI,QAAQ,GAAGT;IAC/B,OAAO,IAAI,OAAOA,UAAU,UAAU;QACpCK,oBAAoBL;IACtB,CAAC;IACDK,oBAAoB;QAClB,GAAGF,YAAY;QACf,GAAGE,iBAAiB;IACtB;IACA,IAAI,OAAOA,kBAAkBI,QAAQ,KAAK,YAAY;QACpDJ,iBAAiB,CAACK,sCAA2B,CAAC,GAAGL,kBAAkBI,QAAQ;QAC3EJ,kBAAkBI,QAAQ,GAAGN,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaM,QAAQ;IAChH,CAAC;IACD,OAAOJ;AACT,GACA,4CAA4C"}
1
+ {"version":3,"sources":["resolveShorthand.js"],"sourcesContent":["import { isValidElement } from 'react';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */ export const resolveShorthand = (value, options)=>{\n const { required =false , defaultProps } = options || {};\n if (value === null || value === undefined && !required) {\n return undefined;\n }\n let resolvedShorthand = {};\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value) || isValidElement(value)) {\n resolvedShorthand.children = value;\n } else if (typeof value === 'object') {\n resolvedShorthand = value;\n }\n resolvedShorthand = {\n ...defaultProps,\n ...resolvedShorthand\n };\n if (typeof resolvedShorthand.children === 'function') {\n resolvedShorthand[SLOT_RENDER_FUNCTION_SYMBOL] = resolvedShorthand.children;\n resolvedShorthand.children = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.children;\n }\n return resolvedShorthand;\n};\n"],"names":["resolveShorthand","value","options","required","defaultProps","undefined","resolvedShorthand","Array","isArray","isValidElement","children","SLOT_RENDER_FUNCTION_SYMBOL"],"mappings":";;;;+BAOiBA;;aAAAA;;uBAPc;2BACa;AAMjC,MAAMA,mBAAmB,CAACC,OAAOC,UAAU;IAClD,MAAM,EAAEC,UAAU,KAAK,CAAA,EAAGC,aAAY,EAAG,GAAGF,WAAW,CAAC;IACxD,IAAID,UAAU,IAAI,IAAIA,UAAUI,aAAa,CAACF,UAAU;QACpD,OAAOE;IACX,CAAC;IACD,IAAIC,oBAAoB,CAAC;IACzB,8DAA8D;IAC9D,IAAI,OAAOL,UAAU,YAAY,OAAOA,UAAU,YAAYM,MAAMC,OAAO,CAACP,wBAAUQ,IAAAA,qBAAc,EAACR,QAAQ;QACzGK,kBAAkBI,QAAQ,GAAGT;IACjC,OAAO,IAAI,OAAOA,UAAU,UAAU;QAClCK,oBAAoBL;IACxB,CAAC;IACDK,oBAAoB;QAChB,GAAGF,YAAY;QACf,GAAGE,iBAAiB;IACxB;IACA,IAAI,OAAOA,kBAAkBI,QAAQ,KAAK,YAAY;QAClDJ,iBAAiB,CAACK,sCAA2B,CAAC,GAAGL,kBAAkBI,QAAQ;QAC3EJ,kBAAkBI,QAAQ,GAAGN,iBAAiB,IAAI,IAAIA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaM,QAAQ;IAClH,CAAC;IACD,OAAOJ;AACX"}
@@ -4,6 +4,3 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
6
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
- //# sourceMappingURL=types.js.map
8
-
9
- //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/compose/types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,iCAAiC"}
1
+ {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
@@ -4,6 +4,3 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
6
  _exportStar(require("./mouseTouchHelpers"), exports);
7
- //# sourceMappingURL=index.js.map
8
-
9
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/events/index.js"],"sourcesContent":["export * from './mouseTouchHelpers';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;CACd,iCAAiC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './mouseTouchHelpers';\n"],"names":[],"mappings":";;;;;oBAAc"}
@@ -45,6 +45,4 @@ function getEventClientCoords(event) {
45
45
  clientY: 0
46
46
  };
47
47
  }
48
- } //# sourceMappingURL=mouseTouchHelpers.js.map
49
-
50
- //# sourceMappingURL=mouseTouchHelpers.js.map
48
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/events/mouseTouchHelpers.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isTouchEvent(event) {\n return event.type.startsWith('touch');\n}\n/**\n * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.\n */\nexport function isMouseEvent(event) {\n return event.type.startsWith('mouse') || ['click', 'contextmenu', 'dblclick'].indexOf(event.type) > -1;\n}\n/**\n * Returns an object with clientX, clientY for TouchOrMouseEvent.\n * Returns zeros in case the event is not a mouse or a touch event.\n */\nexport function getEventClientCoords(event) {\n if (isMouseEvent(event)) {\n return {\n clientX: event.clientX,\n clientY: event.clientY\n };\n } else if (isTouchEvent(event)) {\n return {\n clientX: event.touches[0].clientX,\n clientY: event.touches[0].clientY\n };\n } else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');\n }\n return {\n clientX: 0,\n clientY: 0\n };\n }\n}\n//# sourceMappingURL=mouseTouchHelpers.js.map"],"names":["isTouchEvent","isMouseEvent","getEventClientCoords","event","type","startsWith","indexOf","clientX","clientY","touches","process","env","NODE_ENV","Error"],"mappings":";;;;;;;;;;;IAIgBA,YAAY,MAAZA;IAMAC,YAAY,MAAZA;IAOAC,oBAAoB,MAApBA;;;6DAjBO;AAIhB,SAASF,aAAaG,KAAK,EAAE;IAClC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC;AAC/B;AAIO,SAASJ,aAAaE,KAAK,EAAE;IAClC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC,YAAY;QAAC;QAAS;QAAe;KAAW,CAACC,OAAO,CAACH,MAAMC,IAAI,IAAI,CAAC;AACvG;AAKO,SAASF,qBAAqBC,KAAK,EAAE;IAC1C,IAAIF,aAAaE,QAAQ;QACvB,OAAO;YACLI,SAASJ,MAAMI,OAAO;YACtBC,SAASL,MAAMK,OAAO;QACxB;IACF,OAAO,IAAIR,aAAaG,QAAQ;QAC9B,OAAO;YACLI,SAASJ,MAAMM,OAAO,CAAC,EAAE,CAACF,OAAO;YACjCC,SAASL,MAAMM,OAAO,CAAC,EAAE,CAACD,OAAO;QACnC;IACF,OAAO;QACL,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,MAAM,IAAIC,MAAM,0EAA0E;QAC5F,CAAC;QACD,OAAO;YACLN,SAAS;YACTC,SAAS;QACX;IACF,CAAC;AACH,EACA,6CAA6C"}
1
+ {"version":3,"sources":["mouseTouchHelpers.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Returns true if event is a touch event. Useful when sharing logic between touch and mouse interactions.\n */ export function isTouchEvent(event) {\n return event.type.startsWith('touch');\n}\n/**\n * Returns true if event is a mouse event. Useful when sharing logic between touch and mouse interactions.\n */ export function isMouseEvent(event) {\n return event.type.startsWith('mouse') || [\n 'click',\n 'contextmenu',\n 'dblclick'\n ].indexOf(event.type) > -1;\n}\n/**\n * Returns an object with clientX, clientY for TouchOrMouseEvent.\n * Returns zeros in case the event is not a mouse or a touch event.\n */ export function getEventClientCoords(event) {\n if (isMouseEvent(event)) {\n return {\n clientX: event.clientX,\n clientY: event.clientY\n };\n } else if (isTouchEvent(event)) {\n return {\n clientX: event.touches[0].clientX,\n clientY: event.touches[0].clientY\n };\n } else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('@fluentui/react-utilities]: Unable to get clientX. Unknown event type.');\n }\n return {\n clientX: 0,\n clientY: 0\n };\n }\n}\n"],"names":["isTouchEvent","isMouseEvent","getEventClientCoords","event","type","startsWith","indexOf","clientX","clientY","touches","process","env","NODE_ENV","Error"],"mappings":";;;;;;;;;;;IAGoBA,YAAY,MAAZA;IAKAC,YAAY,MAAZA;IAUAC,oBAAoB,MAApBA;;;6DAlBG;AAGZ,SAASF,aAAaG,KAAK,EAAE;IACpC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC;AACjC;AAGW,SAASJ,aAAaE,KAAK,EAAE;IACpC,OAAOA,MAAMC,IAAI,CAACC,UAAU,CAAC,YAAY;QACrC;QACA;QACA;KACH,CAACC,OAAO,CAACH,MAAMC,IAAI,IAAI,CAAC;AAC7B;AAIW,SAASF,qBAAqBC,KAAK,EAAE;IAC5C,IAAIF,aAAaE,QAAQ;QACrB,OAAO;YACHI,SAASJ,MAAMI,OAAO;YACtBC,SAASL,MAAMK,OAAO;QAC1B;IACJ,OAAO,IAAIR,aAAaG,QAAQ;QAC5B,OAAO;YACHI,SAASJ,MAAMM,OAAO,CAAC,EAAE,CAACF,OAAO;YACjCC,SAASL,MAAMM,OAAO,CAAC,EAAE,CAACD,OAAO;QACrC;IACJ,OAAO;QACH,IAAIE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACvC,MAAM,IAAIC,MAAM,0EAA0E;QAC9F,CAAC;QACD,OAAO;YACHN,SAAS;YACTC,SAAS;QACb;IACJ,CAAC;AACL"}
@@ -15,6 +15,3 @@ _exportStar(require("./useOnScrollOutside"), exports);
15
15
  _exportStar(require("./usePrevious"), exports);
16
16
  _exportStar(require("./useScrollbarWidth"), exports);
17
17
  _exportStar(require("./useTimeout"), exports);
18
- //# sourceMappingURL=index.js.map
19
-
20
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/index.js"],"sourcesContent":["export * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useScrollbarWidth';\nexport * from './useTimeout';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './useControllableState';\nexport * from './useEventCallback';\nexport * from './useFirstMount';\nexport * from './useForceUpdate';\nexport * from './useId';\nexport * from './useIsomorphicLayoutEffect';\nexport * from './useMergedRefs';\nexport * from './useOnClickOutside';\nexport * from './useOnScrollOutside';\nexport * from './usePrevious';\nexport * from './useScrollbarWidth';\nexport * from './useTimeout';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA"}
@@ -72,6 +72,4 @@ function isInitializer(value) {
72
72
  ]);
73
73
  }
74
74
  return isControlled;
75
- }; //# sourceMappingURL=useControllableState.js.map
76
-
77
- //# sourceMappingURL=useControllableState.js.map
75
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useControllableState.js"],"sourcesContent":["import * as React from 'react';\nfunction isFactoryDispatch(newState) {\n return typeof newState === 'function';\n}\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */\nexport const useControllableState = options => {\n const [internalState, setInternalState] = React.useState(() => {\n if (options.defaultState === undefined) {\n return options.initialState;\n }\n return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;\n });\n // Heads up!\n // This part is specific for controlled mode and mocks behavior of React dispatcher function.\n const stateValueRef = React.useRef(options.state);\n React.useEffect(() => {\n stateValueRef.current = options.state;\n }, [options.state]);\n const setControlledState = React.useCallback(newState => {\n if (isFactoryDispatch(newState)) {\n newState(stateValueRef.current);\n }\n }, []);\n return useIsControlled(options.state) ? [options.state, setControlledState] : [internalState, setInternalState];\n};\nfunction isInitializer(value) {\n return typeof value === 'function';\n}\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */\nconst useIsControlled = controlledValue => {\n const [isControlled] = React.useState(() => controlledValue !== undefined);\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n // eslint-disable-next-line no-console\n console.error([\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value', 'changing from ' + undefinedWarning + ' value, which should not happen.', 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.', 'More info: https://reactjs.org/link/controlled-components', error.stack].join(' '));\n }\n }, [isControlled, controlledValue]);\n }\n return isControlled;\n};\n//# sourceMappingURL=useControllableState.js.map"],"names":["useControllableState","isFactoryDispatch","newState","options","internalState","setInternalState","React","useState","defaultState","undefined","initialState","isInitializer","stateValueRef","useRef","state","useEffect","current","setControlledState","useCallback","useIsControlled","value","controlledValue","isControlled","process","env","NODE_ENV","error","Error","controlWarning","undefinedWarning","console","stack","join"],"mappings":";;;;+BAqBaA;;aAAAA;;;6DArBU;AACvB,SAASC,kBAAkBC,QAAQ,EAAE;IACnC,OAAO,OAAOA,aAAa;AAC7B;AAkBO,MAAMF,uBAAuBG,CAAAA,UAAW;IAC7C,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,OAAMC,QAAQ,CAAC,IAAM;QAC7D,IAAIJ,QAAQK,YAAY,KAAKC,WAAW;YACtC,OAAON,QA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YAAcD;SAAgB;IACpC,CAAC;IACD,OAAOC;AACT,GACA,gDAAgD"}
1
+ {"version":3,"sources":["useControllableState.js"],"sourcesContent":["import * as React from 'react';\nfunction isFactoryDispatch(newState) {\n return typeof newState === 'function';\n}\n/**\n * @internal\n *\n * A [`useState`](https://reactjs.org/docs/hooks-reference.html#usestate)-like hook\n * to manage a value that could be either `controlled` or `uncontrolled`,\n * such as a checked state or text input string.\n *\n * @see https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components for more details on `controlled`/`uncontrolled`\n *\n * @returns an array of the current value and an updater (dispatcher) function.\n * The updater function is referentially stable (won't change during the component's lifecycle).\n * It can take either a new value, or a function which is passed the previous value and returns the new value.\n *\n * ❗️❗️ Calls to the dispatcher will only modify the state if the state is `uncontrolled`.\n * Meaning that if a state is `controlled`, calls to the dispatcher do not modify the state.\n *\n */ export const useControllableState = (options)=>{\n const [internalState, setInternalState] = React.useState(()=>{\n if (options.defaultState === undefined) {\n return options.initialState;\n }\n return isInitializer(options.defaultState) ? options.defaultState() : options.defaultState;\n });\n // Heads up!\n // This part is specific for controlled mode and mocks behavior of React dispatcher function.\n const stateValueRef = React.useRef(options.state);\n React.useEffect(()=>{\n stateValueRef.current = options.state;\n }, [\n options.state\n ]);\n const setControlledState = React.useCallback((newState)=>{\n if (isFactoryDispatch(newState)) {\n newState(stateValueRef.current);\n }\n }, []);\n return useIsControlled(options.state) ? [\n options.state,\n setControlledState\n ] : [\n internalState,\n setInternalState\n ];\n};\nfunction isInitializer(value) {\n return typeof value === 'function';\n}\n/**\n * Helper hook to handle previous comparison of controlled/uncontrolled\n * Prints an error when isControlled value switches between subsequent renders\n * @returns - whether the value is controlled\n */ const useIsControlled = (controlledValue)=>{\n const [isControlled] = React.useState(()=>controlledValue !== undefined);\n if (process.env.NODE_ENV !== 'production') {\n // We don't want these warnings in production even though it is against native behaviour\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(()=>{\n if (isControlled !== (controlledValue !== undefined)) {\n const error = new Error();\n const controlWarning = isControlled ? 'a controlled value to be uncontrolled' : 'an uncontrolled value to be controlled';\n const undefinedWarning = isControlled ? 'defined to an undefined' : 'undefined to a defined';\n // eslint-disable-next-line no-console\n console.error([\n // Default react error\n 'A component is changing ' + controlWarning + '. This is likely caused by the value',\n 'changing from ' + undefinedWarning + ' value, which should not happen.',\n 'Decide between using a controlled or uncontrolled input element for the lifetime of the component.',\n 'More info: https://reactjs.org/link/controlled-components',\n error.stack\n ].join(' '));\n }\n }, [\n isControlled,\n controlledValue\n ]);\n }\n return isControlled;\n};\n"],"names":["useControllableState","isFactoryDispatch","newState","options","internalState","setInternalState","React","useState","defaultState","undefined","initialState","isInitializer","stateValueRef","useRef","state","useEffect","current","setControlledState","useCallback","useIsControlled","value","controlledValue","isControlled","process","env","NODE_ENV","error","Error","controlWarning","undefinedWarning","console","stack","join"],"mappings":";;;;+BAoBiBA;;aAAAA;;;6DApBM;AACvB,SAASC,kBAAkBC,QAAQ,EAAE;IACjC,OAAO,OAAOA,aAAa;AAC/B;AAiBW,MAAMF,uBAAuB,CAACG,UAAU;IAC/C,MAAM,CAACC,eAAeC,iBAAiB,GAAGC,OAAMC,QAAQ,CAAC,IAAI;QACzD,IAAIJ,QAAQK,YAAY,KAAKC,WAAW;YACpC,OAAON,QAAQO,YAAY;QAC/B,CAAC;QACD,OAAOC,cAAcR,QAAQK,YAAY,IAAIL,QAAQK,YAAY,KAAKL,QAAQK,YAAY;IAC9F;IACA,YAAY;IACZ,6FAA6F;IAC7F,MAAMI,gBAAgBN,OAAMO,MAAM,CAACV,QAAQW,KAAK;IAChDR,OAAMS,SAAS,CAAC,IAAI;QAChBH,cAAcI,OAAO,GAAGb,QAAQW,KAAK;IACzC,GAAG;QACCX,QAAQW,KAAK;KAChB;IACD,MAAMG,qBAAqBX,OAAMY,WAAW,CAAC,CAAChB,WAAW;QACrD,IAAID,kBAAkBC,WAAW;YAC7BA,SAASU,cAAcI,OAAO;QAClC,CAAC;IACL,GAAG,EAAE;IACL,OAAOG,gBAAgBhB,QAAQW,KAAK,IAAI;QACpCX,QAAQW,KAAK;QACbG;KACH,GAAG;QACAb;QACAC;KACH;AACL;AACA,SAASM,cAAcS,KAAK,EAAE;IAC1B,OAAO,OAAOA,UAAU;AAC5B;AACA;;;;CAIC,GAAG,MAAMD,kBAAkB,CAACE,kBAAkB;IAC3C,MAAM,CAACC,aAAa,GAAGhB,OAAMC,QAAQ,CAAC,IAAIc,oBAAoBZ;IAC9D,IAAIc,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACvC,wFAAwF;QACxF,sDAAsD;QACtDnB,OAAMS,SAAS,CAAC,IAAI;YAChB,IAAIO,iBAAkBD,CAAAA,oBAAoBZ,SAAQ,GAAI;gBAClD,MAAMiB,QAAQ,IAAIC;gBAClB,MAAMC,iBAAiBN,eAAe,0CAA0C,wCAAwC;gBACxH,MAAMO,mBAAmBP,eAAe,4BAA4B,wBAAwB;gBAC5F,sCAAsC;gBACtCQ,QAAQJ,KAAK,CAAC;oBACV,sBAAsB;oBACtB,6BAA6BE,iBAAiB;oBAC9C,mBAAmBC,mBAAmB;oBACtC;oBACA;oBACAH,MAAMK,KAAK;iBACd,CAACC,IAAI,CAAC;YACX,CAAC;QACL,GAAG;YACCV;YACAD;SACH;IACL,CAAC;IACD,OAAOC;AACX"}
@@ -24,6 +24,4 @@ const useEventCallback = (fn)=>{
24
24
  }, [
25
25
  callbackRef
26
26
  ]);
27
- }; //# sourceMappingURL=useEventCallback.js.map
28
-
29
- //# sourceMappingURL=useEventCallback.js.map
27
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useEventCallback.js"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n/**\n * @internal\n * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n *\n * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when\n * e.g. user props are dependencies which could change on every render\n * e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently\n *\n * This should not be used often, but can be a useful re-render optimization since the callback is a ref and\n * will not be invalidated between re-renders\n *\n * @param fn - The callback function that will be used\n */\nexport const useEventCallback = fn => {\n const callbackRef = React.useRef(() => {\n throw new Error('Cannot call an event handler while rendering');\n });\n useIsomorphicLayoutEffect(() => {\n callbackRef.current = fn;\n }, [fn]);\n return React.useCallback((...args) => {\n const callback = callbackRef.current;\n return callback(...args);\n }, [callbackRef]);\n};\n//# sourceMappingURL=useEventCallback.js.map"],"names":["useEventCallback","fn","callbackRef","React","useRef","Error","useIsomorphicLayoutEffect","current","useCallback","args","callback"],"mappings":";;;;+BAeaA;;aAAAA;;;6DAfU;2CACmB;AAcnC,MAAMA,mBAAmBC,CAAAA,KAAM;IACpC,MAAMC,cAAcC,OAAMC,MAAM,CAAC,IAAM;QACrC,MAAM,IAAIC,MAAM,gDAAgD;IAClE;IACAC,IAAAA,oDAAyB,EAAC,IAAM;QAC9BJ,YAAYK,OAAO,GAAGN;IACxB,GAAG;QAACA;KAAG;IACP,OAAOE,OAAMK,WAAW,CAAC,CAAC,GAAGC,OAAS;QACpC,MAAMC,WAAWR,YAAYK,OAAO;QACpC,OAAOG,YAAYD;IACrB,GAAG;QAACP;KAAY;AAClB,GACA,4CAA4C"}
1
+ {"version":3,"sources":["useEventCallback.js"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\n/**\n * @internal\n * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n *\n * Modified `useCallback` that can be used when dependencies change too frequently. Can occur when\n * e.g. user props are dependencies which could change on every render\n * e.g. volatile values (i.e. useState/useDispatch) are dependencies which could change frequently\n *\n * This should not be used often, but can be a useful re-render optimization since the callback is a ref and\n * will not be invalidated between re-renders\n *\n * @param fn - The callback function that will be used\n */ export const useEventCallback = (fn)=>{\n const callbackRef = React.useRef(()=>{\n throw new Error('Cannot call an event handler while rendering');\n });\n useIsomorphicLayoutEffect(()=>{\n callbackRef.current = fn;\n }, [\n fn\n ]);\n return React.useCallback((...args)=>{\n const callback = callbackRef.current;\n return callback(...args);\n }, [\n callbackRef\n ]);\n};\n"],"names":["useEventCallback","fn","callbackRef","React","useRef","Error","useIsomorphicLayoutEffect","current","useCallback","args","callback"],"mappings":";;;;+BAciBA;;aAAAA;;;6DAdM;2CACmB;AAa/B,MAAMA,mBAAmB,CAACC,KAAK;IACtC,MAAMC,cAAcC,OAAMC,MAAM,CAAC,IAAI;QACjC,MAAM,IAAIC,MAAM,gDAAgD;IACpE;IACAC,IAAAA,oDAAyB,EAAC,IAAI;QAC1BJ,YAAYK,OAAO,GAAGN;IAC1B,GAAG;QACCA;KACH;IACD,OAAOE,OAAMK,WAAW,CAAC,CAAC,GAAGC,OAAO;QAChC,MAAMC,WAAWR,YAAYK,OAAO;QACpC,OAAOG,YAAYD;IACvB,GAAG;QACCP;KACH;AACL"}
@@ -15,6 +15,4 @@ function useFirstMount() {
15
15
  return true;
16
16
  }
17
17
  return isFirst.current;
18
- } //# sourceMappingURL=useFirstMount.js.map
19
-
20
- //# sourceMappingURL=useFirstMount.js.map
18
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useFirstMount.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Since concurrent mode will be released in the future this needs to be verified\n * Currently (React 17) will always render the initial mount once\n * https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx\n * https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx\n *\n * @example\n * const isFirstMount = useFirstMount();\n */\nexport function useFirstMount() {\n const isFirst = React.useRef(true);\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n return isFirst.current;\n}\n//# sourceMappingURL=useFirstMount.js.map"],"names":["useFirstMount","isFirst","React","useRef","current"],"mappings":";;;;+BAYgBA;;aAAAA;;;6DAZO;AAYhB,SAASA,gBAAgB;IAC9B,MAAMC,UAAUC,OAAMC,MAAM,CAAC,IAAI;IACjC,IAAIF,QAAQG,OAAO,EAAE;QACnBH,QAAQG,OAAO,GAAG,KAAK;QACvB,OAAO,IAAI;IACb,CAAC;IACD,OAAOH,QAAQG,OAAO;AACxB,EACA,yCAAyC"}
1
+ {"version":3,"sources":["useFirstMount.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Checks if components was mounted the first time.\n * Since concurrent mode will be released in the future this needs to be verified\n * Currently (React 17) will always render the initial mount once\n * https://codesandbox.io/s/heuristic-brook-s4w0q?file=/src/App.jsx\n * https://codesandbox.io/s/holy-grass-8nieu?file=/src/App.jsx\n *\n * @example\n * const isFirstMount = useFirstMount();\n */ export function useFirstMount() {\n const isFirst = React.useRef(true);\n if (isFirst.current) {\n isFirst.current = false;\n return true;\n }\n return isFirst.current;\n}\n"],"names":["useFirstMount","isFirst","React","useRef","current"],"mappings":";;;;+BAWoBA;;aAAAA;;;6DAXG;AAWZ,SAASA,gBAAgB;IAChC,MAAMC,UAAUC,OAAMC,MAAM,CAAC,IAAI;IACjC,IAAIF,QAAQG,OAAO,EAAE;QACjBH,QAAQG,OAAO,GAAG,KAAK;QACvB,OAAO,IAAI;IACf,CAAC;IACD,OAAOH,QAAQG,OAAO;AAC1B"}
@@ -9,6 +9,4 @@ Object.defineProperty(exports, "useForceUpdate", {
9
9
  const _react = require("react");
10
10
  function useForceUpdate() {
11
11
  return (0, _react.useReducer)((x)=>x + 1, 0)[1];
12
- } //# sourceMappingURL=useForceUpdate.js.map
13
-
14
- //# sourceMappingURL=useForceUpdate.js.map
12
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useForceUpdate.js"],"sourcesContent":["import { useReducer } from 'react';\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */\nexport function useForceUpdate() {\n return useReducer(x => x + 1, 0)[1];\n}\n//# sourceMappingURL=useForceUpdate.js.map"],"names":["useForceUpdate","useReducer","x"],"mappings":";;;;+BAKgBA;;aAAAA;;uBALW;AAKpB,SAASA,iBAAiB;IAC/B,OAAOC,IAAAA,iBAAU,EAACC,CAAAA,IAAKA,IAAI,GAAG,EAAE,CAAC,EAAE;AACrC,EACA,0CAA0C"}
1
+ {"version":3,"sources":["useForceUpdate.js"],"sourcesContent":["import { useReducer } from 'react';\n/**\n * @internal\n * Forces a re-render, similar to `forceUpdate` in class components.\n */ export function useForceUpdate() {\n return useReducer((x)=>x + 1, 0)[1];\n}\n"],"names":["useForceUpdate","useReducer","x"],"mappings":";;;;+BAIoBA;;aAAAA;;uBAJO;AAIhB,SAASA,iBAAiB;IACjC,OAAOC,IAAAA,iBAAU,EAAC,CAACC,IAAIA,IAAI,GAAG,EAAE,CAAC,EAAE;AACvC"}
@@ -52,6 +52,4 @@ function useId(prefix = 'fui-', providedId) {
52
52
  providedId,
53
53
  contextValue
54
54
  ]);
55
- } //# sourceMappingURL=useId.js.map
56
-
57
- //# sourceMappingURL=useId.js.map
55
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useId.js"],"sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\nconst IdPrefixContext = /*#__PURE__*/React.createContext(undefined);\n/**\n * Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions\n * between different bundles.\n */\nexport const IdPrefixProvider = IdPrefixContext.Provider;\nfunction useIdPrefix() {\n return React.useContext(IdPrefixContext) || '';\n}\n/**\n * Resets generated IDs, should be used only in tests.\n */\nexport function resetIdsForTests() {\n defaultSSRContextValue.current = 0;\n}\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */\nexport function useId(prefix = 'fui-', providedId) {\n const contextValue = useSSRContext();\n const idPrefix = useIdPrefix();\n // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to\n // prevent bundlers from complaining with older versions of React.\n const _useId = React['use' + 'Id'];\n if (_useId) {\n const generatedId = _useId();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const escapedId = React.useMemo(() => generatedId.replace(/:/g, ''), [generatedId]);\n return providedId || `${idPrefix}${prefix}${escapedId}`;\n }\n // Hooks appear to be running conditionally, but they will always run in the same order since it's based on\n // the version of React being used. This is safe to ignore.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return React.useMemo(() => {\n if (providedId) {\n return providedId;\n }\n return `${idPrefix}${prefix}${++contextValue.current}`;\n }, [idPrefix, prefix, providedId, contextValue]);\n}\n//# sourceMappingURL=useId.js.map"],"names":["IdPrefixProvider","resetIdsForTests","useId","IdPrefixContext","React","createContext","undefined","Provider","useIdPrefix","useContext","defaultSSRContextValue","current","prefix","providedId","contextValue","useSSRContext","idPrefix","_useId","generatedId","escapedId","useMemo","replace"],"mappings":";;;;;;;;;;;IAOaA,gBAAgB,MAAhBA;IAOGC,gBAAgB,MAAhBA;IAWAC,KAAK,MAALA;;;6DAzBO;uBAC+B;AACtD,MAAMC,kBAAkB,WAAW,GAAEC,OAAMC,aAAa,CAACC;AAKlD,MAAMN,mBAAmBG,gBAAgBI,QAAQ;AACxD,SAASC,cAAc;IACrB,OAAOJ,OAAMK,UAAU,CAACN,oBAAoB;AAC9C;AAIO,SAASF,mBAAmB;IACjCS,6BAAsB,CAACC,OAAO,GAAG;AACnC;AASO,SAAST,MAAMU,SAAS,MAAM,EAAEC,UAAU,EAAE;IACjD,MAAMC,eAAeC,IAAAA,oBAAa;IAClC,MAAMC,WAAWR;IACjB,mHAAmH;IACnH,kEAAkE;IAClE,MAAMS,SAASb,MAAK,CAAC,QAAQ,KAAK;IAClC,IAAIa,QAAQ;QACV,MAAMC,cAAcD;QACpB,sDAAsD;QACtD,MAAME,YAAYf,OAAMgB,OAAO,CAAC,IAAMF,YAAYG,OAAO,CAAC,MAAM,KAAK;YAACH;SAAY;QAClF,OAAOL,cAAc,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAEO,UAAU,CAAC;IACzD,CAAC;IACD,2GAA2G;IAC3G,2DAA2D;IAC3D,sDAAsD;IACtD,OAAOf,OAAMgB,OAAO,CAAC,IAAM;QACzB,IAAIP,YAAY;YACd,OAAOA;QACT,CAAC;QACD,OAAO,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAE,EAAEE,aAAaH,OAAO,CAAC,CAAC;IACxD,GAAG;QAACK;QAAUJ;QAAQC;QAAYC;KAAa;AACjD,EACA,iCAAiC"}
1
+ {"version":3,"sources":["useId.js"],"sourcesContent":["import * as React from 'react';\nimport { defaultSSRContextValue, useSSRContext } from '../ssr/index';\nconst IdPrefixContext = React.createContext(undefined);\n/**\n * Allows to define a prefix that will be used for all IDs generated by useId() hook. It's useful to avoid collisions\n * between different bundles.\n */ export const IdPrefixProvider = IdPrefixContext.Provider;\nfunction useIdPrefix() {\n return React.useContext(IdPrefixContext) || '';\n}\n/**\n * Resets generated IDs, should be used only in tests.\n */ export function resetIdsForTests() {\n defaultSSRContextValue.current = 0;\n}\n/**\n * Hook to generate a unique ID.\n *\n * @param prefix - Optional prefix for the ID. Defaults to 'fui-'.\n * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present,\n * without conditioning the hook call\n * @returns The ID\n */ export function useId(prefix = 'fui-', providedId) {\n const contextValue = useSSRContext();\n const idPrefix = useIdPrefix();\n // Checking if useId is available on React, if it is, we use it to generate the id. String concatenation is used to\n // prevent bundlers from complaining with older versions of React.\n const _useId = React['use' + 'Id'];\n if (_useId) {\n const generatedId = _useId();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const escapedId = React.useMemo(()=>generatedId.replace(/:/g, ''), [\n generatedId\n ]);\n return providedId || `${idPrefix}${prefix}${escapedId}`;\n }\n // Hooks appear to be running conditionally, but they will always run in the same order since it's based on\n // the version of React being used. This is safe to ignore.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return React.useMemo(()=>{\n if (providedId) {\n return providedId;\n }\n return `${idPrefix}${prefix}${++contextValue.current}`;\n }, [\n idPrefix,\n prefix,\n providedId,\n contextValue\n ]);\n}\n"],"names":["IdPrefixProvider","resetIdsForTests","useId","IdPrefixContext","React","createContext","undefined","Provider","useIdPrefix","useContext","defaultSSRContextValue","current","prefix","providedId","contextValue","useSSRContext","idPrefix","_useId","generatedId","escapedId","useMemo","replace"],"mappings":";;;;;;;;;;;IAMiBA,gBAAgB,MAAhBA;IAMGC,gBAAgB,MAAhBA;IAUAC,KAAK,MAALA;;;6DAtBG;uBAC+B;AACtD,MAAMC,gCAAkBC,OAAMC,aAAa,CAACC;AAIjC,MAAMN,mBAAmBG,gBAAgBI,QAAQ;AAC5D,SAASC,cAAc;IACnB,OAAOJ,OAAMK,UAAU,CAACN,oBAAoB;AAChD;AAGW,SAASF,mBAAmB;IACnCS,6BAAsB,CAACC,OAAO,GAAG;AACrC;AAQW,SAAST,MAAMU,SAAS,MAAM,EAAEC,UAAU,EAAE;IACnD,MAAMC,eAAeC,IAAAA,oBAAa;IAClC,MAAMC,WAAWR;IACjB,mHAAmH;IACnH,kEAAkE;IAClE,MAAMS,SAASb,MAAK,CAAC,QAAQ,KAAK;IAClC,IAAIa,QAAQ;QACR,MAAMC,cAAcD;QACpB,sDAAsD;QACtD,MAAME,YAAYf,OAAMgB,OAAO,CAAC,IAAIF,YAAYG,OAAO,CAAC,MAAM,KAAK;YAC/DH;SACH;QACD,OAAOL,cAAc,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAEO,UAAU,CAAC;IAC3D,CAAC;IACD,2GAA2G;IAC3G,2DAA2D;IAC3D,sDAAsD;IACtD,OAAOf,OAAMgB,OAAO,CAAC,IAAI;QACrB,IAAIP,YAAY;YACZ,OAAOA;QACX,CAAC;QACD,OAAO,CAAC,EAAEG,SAAS,EAAEJ,OAAO,EAAE,EAAEE,aAAaH,OAAO,CAAC,CAAC;IAC1D,GAAG;QACCK;QACAJ;QACAC;QACAC;KACH;AACL"}
@@ -9,6 +9,4 @@ Object.defineProperty(exports, "useIsomorphicLayoutEffect", {
9
9
  const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
10
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
11
  const _index = require("../ssr/index");
12
- const useIsomorphicLayoutEffect = /*#__PURE__*/ (0, _index.canUseDOM)() ? _react.useLayoutEffect : _react.useEffect; //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
13
-
14
- //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
12
+ const useIsomorphicLayoutEffect = (0, _index.canUseDOM)() ? _react.useLayoutEffect : _react.useEffect;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useIsomorphicLayoutEffect.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n/**\n * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally\n * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also need affected components to render on\n * the server.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n */ // eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect = /*#__PURE__*/canUseDOM() ? React.useLayoutEffect : React.useEffect;\n//# sourceMappingURL=useIsomorphicLayoutEffect.js.map"],"names":["useIsomorphicLayoutEffect","canUseDOM","React","useLayoutEffect","useEffect"],"mappings":";;;;+BAWaA;;aAAAA;;;6DAXU;uBACG;AAUnB,MAAMA,4BAA4B,WAAW,GAAEC,IAAAA,gBAAS,MAAKC,OAAMC,eAAe,GAAGD,OAAME,SAAS,EAC3G,qDAAqD"}
1
+ {"version":3,"sources":["useIsomorphicLayoutEffect.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '../ssr/index';\n/**\n * React currently throws a warning when using useLayoutEffect on the server. To get around it, we can conditionally\n * useEffect on the server (no-op) and useLayoutEffect in the browser. We occasionally need useLayoutEffect to\n * ensure we don't get a render flash for certain operations, but we may also need affected components to render on\n * the server.\n *\n * https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85\n * https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.js\n */ // eslint-disable-next-line no-restricted-properties\nexport const useIsomorphicLayoutEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n"],"names":["useIsomorphicLayoutEffect","canUseDOM","React","useLayoutEffect","useEffect"],"mappings":";;;;+BAWaA;;aAAAA;;;6DAXU;uBACG;AAUnB,MAAMA,4BAA4BC,IAAAA,gBAAS,MAAKC,OAAMC,eAAe,GAAGD,OAAME,SAAS"}
@@ -20,11 +20,8 @@ function useMergedRefs(...refs) {
20
20
  ref.current = value;
21
21
  }
22
22
  }
23
- }, // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive
24
- [
23
+ }, [
25
24
  ...refs
26
25
  ]);
27
26
  return mergedCallback;
28
- } //# sourceMappingURL=useMergedRefs.js.map
29
-
30
- //# sourceMappingURL=useMergedRefs.js.map
27
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useMergedRefs.js"],"sourcesContent":["import * as React from 'react';\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */\nexport function useMergedRefs(...refs) {\n const mergedCallback = React.useCallback(value => {\n // Update the \"current\" prop hanging on the function.\n mergedCallback.current = value;\n for (const ref of refs) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n ref.current = value;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [...refs]);\n return mergedCallback;\n}\n//# sourceMappingURL=useMergedRefs.js.map"],"names":["useMergedRefs","refs","mergedCallback","React","useCallback","value","current","ref"],"mappings":";;;;+BAOgBA;;aAAAA;;;6DAPO;AAOhB,SAASA,cAAc,GAAGC,IAAI,EAAE;IACrC,MAAMC,iBAAiBC,OAAMC,WAAW,CAACC,CAAAA,QAAS;QAChD,qDAAqD;QACrDH,eAAeI,OAAO,GAAGD;QACzB,KAAK,MAAME,OAAON,KAAM;YACtB,IAAI,OAAOM,QAAQ,YAAY;gBAC7BA,IAAIF;YACN,OAAO,IAAIE,KAAK;gBACd,qDAAqD;gBACrDA,IAAID,OAAO,GAAGD;YAChB,CAAC;QACH;IACF,GACA,6EAA6E;IAC7E;WAAIJ;KAAK;IACT,OAAOC;AACT,EACA,yCAAyC"}
1
+ {"version":3,"sources":["useMergedRefs.js"],"sourcesContent":["import * as React from 'react';\n/**\n * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that\n * updates all provided refs\n * @param refs - Refs to collectively update with one ref value.\n * @returns A function with an attached \"current\" prop, so that it can be treated like a RefObject.\n */ export function useMergedRefs(...refs) {\n const mergedCallback = React.useCallback((value)=>{\n // Update the \"current\" prop hanging on the function.\n mergedCallback.current = value;\n for (const ref of refs){\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref) {\n // work around the immutability of the React.Ref type\n ref.current = value;\n }\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps -- already exhaustive\n [\n ...refs\n ]);\n return mergedCallback;\n}\n"],"names":["useMergedRefs","refs","mergedCallback","React","useCallback","value","current","ref"],"mappings":";;;;+BAMoBA;;aAAAA;;;6DANG;AAMZ,SAASA,cAAc,GAAGC,IAAI,EAAE;IACvC,MAAMC,iBAAiBC,OAAMC,WAAW,CAAC,CAACC,QAAQ;QAC9C,qDAAqD;QACrDH,eAAeI,OAAO,GAAGD;QACzB,KAAK,MAAME,OAAON,KAAK;YACnB,IAAI,OAAOM,QAAQ,YAAY;gBAC3BA,IAAIF;YACR,OAAO,IAAIE,KAAK;gBACZ,qDAAqD;gBACrDA,IAAID,OAAO,GAAGD;YAClB,CAAC;QACL;IACJ,GACA;WACOJ;KACN;IACD,OAAOC;AACX"}
@@ -134,6 +134,4 @@ const FUI_FRAME_EVENT = 'fuiframefocus';
134
134
  disabled,
135
135
  pollDuration
136
136
  ]);
137
- }; //# sourceMappingURL=useOnClickOutside.js.map
138
-
139
- //# sourceMappingURL=useOnClickOutside.js.map
137
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnClickOutside = options => {\n const {\n refs,\n callback,\n element,\n disabled,\n contains: containsProp\n } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus(options);\n const listener = useEventCallback(ev => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n const conditionalHandler = event => {\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n listener(event);\n };\n // use capture phase because React can update DOM before the event bubbles to the document\n element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(() => {\n currentEvent = undefined;\n }, 1);\n return () => {\n element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [listener, element, disabled]);\n};\nconst getWindowEvent = target => {\n if (target) {\n var _target_ownerDocument, _target_ownerDocument_defaultView;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */\nconst useIFrameFocus = options => {\n const {\n disabled,\n element: targetDocument,\n callback,\n contains: containsProp = (parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n },\n pollDuration = 1000,\n refs\n } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback(e => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return () => {\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [targetDocument, disabled, listener]);\n // Starts polling for the active element\n React.useEffect(() => {\n var _targetDocument_defaultView;\n if (disabled) {\n return;\n }\n timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(() => {\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n return () => {\n var _targetDocument_defaultView;\n targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [targetDocument, disabled, pollDuration]);\n};\n//# sourceMappingURL=useOnClickOutside.js.map"],"names":["useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","React","useRef","undefined","useIFrameFocus","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument","_target_ownerDocument_defaultView","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;kCACU;AAK1B,MAAMA,oBAAoBC,CAAAA,UAAW;IAC1C,MAAM,EACJC,KAAI,EACJC,SAAQ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AAI,KAAK,IAAIA,4BAA4BC,WAAW,CAAC,IAAM;YAC1P,MAAMC,gBAAgBN,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeM,aAAa;YAClH,IAAI,AAACA,CAAAA,kBAAkB,IAAI,IAAIA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcC,OAAO,AAAD,MAAO,YAAY,AAACD,CAAAA,kBAAkB,IAAI,IAAIA,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcC,OAAO,AAAD,MAAO,WAAW;gBAC7M,MAAMlB,QAAQ,IAAImB,YAAYT,iBAAiB;oBAC7CU,SAAS,IAAI;gBACf;gBACAH,cAAcI,aAAa,CAACrB;YAC9B,CAAC;QACH,GAAGY,aAAa;QAChB,OAAO,IAAM;YACX,IAAIG;YACJJ,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAI,AAACI,CAAAA,8BAA8BJ,eAAeF,WAAW,AAAD,MAAO,IAAI,IAAIM,gCAAgC,KAAK,IAAI,KAAK,IAAIA,4BAA4BX,YAAY,CAACS,WAAWpB,OAAO,CAAC;QACvP;IACF,GAAG;QAACkB;QAAgBlC;QAAUmC;KAAa;AAC7C,GACA,6CAA6C"}
1
+ {"version":3,"sources":["useOnClickOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnClickOutside = (options)=>{\n const { refs , callback , element , disabled , contains: containsProp } = options;\n const timeoutId = React.useRef(undefined);\n useIFrameFocus(options);\n const listener = useEventCallback((ev)=>{\n const contains = containsProp || ((parent, child)=>{\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every((ref)=>!contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\n // Store the current event to avoid triggering handlers immediately\n // Note this depends on a deprecated but extremely well supported quirk of the web platform\n // https://github.com/facebook/react/issues/20074\n let currentEvent = getWindowEvent(window);\n const conditionalHandler = (event)=>{\n // Skip if this event is the same as the one running when we added the handlers\n if (event === currentEvent) {\n currentEvent = undefined;\n return;\n }\n listener(event);\n };\n // use capture phase because React can update DOM before the event bubbles to the document\n element === null || element === void 0 ? void 0 : element.addEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.addEventListener('contextmenu', conditionalHandler, true);\n // Garbage collect this event after it's no longer useful to avoid memory leaks\n timeoutId.current = window.setTimeout(()=>{\n currentEvent = undefined;\n }, 1);\n return ()=>{\n element === null || element === void 0 ? void 0 : element.removeEventListener('click', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchstart', conditionalHandler, true);\n element === null || element === void 0 ? void 0 : element.removeEventListener('contextmenu', conditionalHandler, true);\n clearTimeout(timeoutId.current);\n currentEvent = undefined;\n };\n }, [\n listener,\n element,\n disabled\n ]);\n};\nconst getWindowEvent = (target)=>{\n if (target) {\n var _target_ownerDocument, _target_ownerDocument_defaultView;\n if (typeof target.window === 'object' && target.window === target) {\n // eslint-disable-next-line deprecation/deprecation\n return target.event;\n }\n var _target_ownerDocument_defaultView_event;\n // eslint-disable-next-line deprecation/deprecation\n return (_target_ownerDocument_defaultView_event = (_target_ownerDocument = target.ownerDocument) === null || _target_ownerDocument === void 0 ? void 0 : (_target_ownerDocument_defaultView = _target_ownerDocument.defaultView) === null || _target_ownerDocument_defaultView === void 0 ? void 0 : _target_ownerDocument_defaultView.event) !== null && _target_ownerDocument_defaultView_event !== void 0 ? _target_ownerDocument_defaultView_event : undefined;\n }\n return undefined;\n};\nconst FUI_FRAME_EVENT = 'fuiframefocus';\n/**\n * Since click events do not propagate past iframes, we use focus to detect if a\n * click has happened inside an iframe, since the only ways of focusing inside an\n * iframe are:\n * - clicking inside\n * - tabbing inside\n *\n * Polls the value of `document.activeElement`. If it is an iframe, then dispatch\n * a custom DOM event. When the custom event is received call the provided callback\n */ const useIFrameFocus = (options)=>{\n const { disabled , element: targetDocument , callback , contains: containsProp = (parent, child)=>{\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n } , pollDuration =1000 , refs } = options;\n const timeoutRef = React.useRef();\n const listener = useEventCallback((e)=>{\n const contains = containsProp || ((parent, child)=>{\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every((ref)=>!contains(ref.current || null, e.target));\n if (isOutside && !disabled) {\n callback(e);\n }\n });\n // Adds listener to the custom iframe focus event\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener(FUI_FRAME_EVENT, listener, true);\n return ()=>{\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener(FUI_FRAME_EVENT, listener, true);\n };\n }, [\n targetDocument,\n disabled,\n listener\n ]);\n // Starts polling for the active element\n React.useEffect(()=>{\n var _targetDocument_defaultView;\n if (disabled) {\n return;\n }\n timeoutRef.current = targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.setInterval(()=>{\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'WEBVIEW') {\n const event = new CustomEvent(FUI_FRAME_EVENT, {\n bubbles: true\n });\n activeElement.dispatchEvent(event);\n }\n }, pollDuration);\n return ()=>{\n var _targetDocument_defaultView;\n targetDocument === null || targetDocument === void 0 ? void 0 : (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.clearTimeout(timeoutRef.current);\n };\n }, [\n targetDocument,\n disabled,\n pollDuration\n ]);\n};\n"],"names":["useOnClickOutside","options","refs","callback","element","disabled","contains","containsProp","timeoutId","React","useRef","undefined","useIFrameFocus","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","useEffect","currentEvent","getWindowEvent","window","conditionalHandler","event","addEventListener","setTimeout","removeEventListener","clearTimeout","_target_ownerDocument","_target_ownerDocument_defaultView","_target_ownerDocument_defaultView_event","ownerDocument","defaultView","FUI_FRAME_EVENT","targetDocument","pollDuration","timeoutRef","e","_targetDocument_defaultView","setInterval","activeElement","tagName","CustomEvent","bubbles","dispatchEvent"],"mappings":";;;;+BAKiBA;;aAAAA;;;6DALM;kCACU;AAItB,MAAMA,oBAAoB,CAACC,UAAU;IAC5C,MAAM,EAAEC,KAAI,EAAGC,SAAQ,EAAGC,QAAO,EAAGC,SAAQ,EAAGC,UAAUC,aAAY,EAAG,GAAGN;IAC3E,MAAMO,YAAYC,OAAMC,MAAM,CAACC;IAC/BC,eAAeX;IACf,MAAMY,WAAWC,IAAAA,kCAAgB,EAAC,CAACC,KAAK;QACpC,MAAMT,WAAWC,gBAAiB,CAAA,CAACS,QAAQC,QAAQ;YAC/C,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOV,QAAQ,CAACW,MAAM,AAAD;QACnF,CAAA;QACA,MAAMC,YAAYhB,KAAKiB,KAAK,CAAC,CAACC,MAAM,CAACd,SAASc,IAAIC,OAAO,IAAI,IAAI,EAAEN,GAAGO,MAAM;QAC5E,IAAIJ,aAAa,CAACb,UAAU;YACxBF,SAASY;QACb,CAAC;IACL;IACAN,OAAMc,SAAS,CAAC,IAAI;QAChB,IAAIlB,UAAU;YACV;QACJ,CAAC;QACD,mEAAmE;QACnE,2FAA2F;QAC3F,iDAAiD;QACjD,IAAImB,eAAeC,eAAeC;QAClC,MAAMC,qBAAqB,CAACC,QAAQ;YAChC,+EAA+E;YAC/E,IAAIA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kB;QACAlC;QACAmC;KACH;AACL"}
@@ -35,6 +35,4 @@ const useOnScrollOutside = (options)=>{
35
35
  element,
36
36
  disabled
37
37
  ]);
38
- }; //# sourceMappingURL=useOnScrollOutside.js.map
39
-
40
- //# sourceMappingURL=useOnScrollOutside.js.map
38
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useOnScrollOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */\nexport const useOnScrollOutside = options => {\n const {\n refs,\n callback,\n element,\n disabled,\n contains: containsProp\n } = options;\n const listener = useEventCallback(ev => {\n const contains = containsProp || ((parent, child) => {\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every(ref => !contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);\n return () => {\n element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);\n };\n }, [listener, element, disabled]);\n};\n//# sourceMappingURL=useOnScrollOutside.js.map"],"names":["useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","React","useEffect","addEventListener","removeEventListener"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;kCACU;AAK1B,MAAMA,qBAAqBC,CAAAA,UAAW;IAC3C,MAAM,EACJC,KAAI,EACJC,SAAQ,EACRC,QAAO,EACPC,SAAQ,EACRC,UAAUC,aAAY,EACvB,GAAGN;IACJ,MAAMO,WAAWC,IAAAA,kCAAgB,EAACC,CAAAA,KAAM;QACtC,MAAMJ,WAAWC,gBAAiB,CAAA,CAACI,QAAQC,QAAU;YACnD,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOL,QAAQ,CAACM,MAAM,AAAD;QACjF,CAAA;QACA,MAAMC,YAAYX,KAAKY,KAAK,CAACC,CAAAA,MAAO,CAACT,SAASS,IAAIC,OAAO,IAAI,IAAI,EAAEN,GAAGO,MAAM;QAC5E,IAAIJ,aAAa,CAACR,UAAU;YAC1BF,SAASO;QACX,CAAC;IACH;IACAQ,OAAMC,SAAS,CAAC,IAAM;QACpB,IAAId,UAAU;YACZ;QACF,CAAC;QACDD,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,SAASZ,SAAS;QAC7FJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,aAAaZ,SAAS;QACjG,OAAO,IAAM;YACXJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,SAASb,SAAS;YAChGJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,aAAab,SAAS;QACtG;IACF,GAAG;QAACA;QAAUJ;QAASC;KAAS;AAClC,GACA,8CAA8C"}
1
+ {"version":3,"sources":["useOnScrollOutside.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from './useEventCallback';\n/**\n * @internal\n * Utility to perform checks where a click/touch event was made outside a component\n */ export const useOnScrollOutside = (options)=>{\n const { refs , callback , element , disabled , contains: containsProp } = options;\n const listener = useEventCallback((ev)=>{\n const contains = containsProp || ((parent, child)=>{\n return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));\n });\n const isOutside = refs.every((ref)=>!contains(ref.current || null, ev.target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(()=>{\n if (disabled) {\n return;\n }\n element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);\n return ()=>{\n element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);\n element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);\n };\n }, [\n listener,\n element,\n disabled\n ]);\n};\n"],"names":["useOnScrollOutside","options","refs","callback","element","disabled","contains","containsProp","listener","useEventCallback","ev","parent","child","isOutside","every","ref","current","target","React","useEffect","addEventListener","removeEventListener"],"mappings":";;;;+BAKiBA;;aAAAA;;;6DALM;kCACU;AAItB,MAAMA,qBAAqB,CAACC,UAAU;IAC7C,MAAM,EAAEC,KAAI,EAAGC,SAAQ,EAAGC,QAAO,EAAGC,SAAQ,EAAGC,UAAUC,aAAY,EAAG,GAAGN;IAC3E,MAAMO,WAAWC,IAAAA,kCAAgB,EAAC,CAACC,KAAK;QACpC,MAAMJ,WAAWC,gBAAiB,CAAA,CAACI,QAAQC,QAAQ;YAC/C,OAAO,CAAC,CAAED,CAAAA,WAAW,IAAI,IAAIA,WAAW,KAAK,IAAI,KAAK,IAAIA,OAAOL,QAAQ,CAACM,MAAM,AAAD;QACnF,CAAA;QACA,MAAMC,YAAYX,KAAKY,KAAK,CAAC,CAACC,MAAM,CAACT,SAASS,IAAIC,OAAO,IAAI,IAAI,EAAEN,GAAGO,MAAM;QAC5E,IAAIJ,aAAa,CAACR,UAAU;YACxBF,SAASO;QACb,CAAC;IACL;IACAQ,OAAMC,SAAS,CAAC,IAAI;QAChB,IAAId,UAAU;YACV;QACJ,CAAC;QACDD,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,SAASZ,SAAS;QAC7FJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQgB,gBAAgB,CAAC,aAAaZ,SAAS;QACjG,OAAO,IAAI;YACPJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,SAASb,SAAS;YAChGJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,mBAAmB,CAAC,aAAab,SAAS;QACxG;IACJ,GAAG;QACCA;QACAJ;QACAC;KACH;AACL"}
@@ -16,6 +16,4 @@ const usePrevious = (value)=>{
16
16
  value
17
17
  ]);
18
18
  return ref.current;
19
- }; //# sourceMappingURL=usePrevious.js.map
20
-
21
- //# sourceMappingURL=usePrevious.js.map
19
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/usePrevious.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n */\nexport const usePrevious = value => {\n const ref = React.useRef(null);\n React.useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current;\n};\n//# sourceMappingURL=usePrevious.js.map"],"names":["usePrevious","value","ref","React","useRef","useEffect","current"],"mappings":";;;;+BAIaA;;aAAAA;;;6DAJU;AAIhB,MAAMA,cAAcC,CAAAA,QAAS;IAClC,MAAMC,MAAMC,OAAMC,MAAM,CAAC,IAAI;IAC7BD,OAAME,SAAS,CAAC,IAAM;QACpBH,IAAII,OAAO,GAAGL;IAChB,GAAG;QAACA;KAAM;IACV,OAAOC,IAAII,OAAO;AACpB,GACA,uCAAuC"}
1
+ {"version":3,"sources":["usePrevious.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n */ export const usePrevious = (value)=>{\n const ref = React.useRef(null);\n React.useEffect(()=>{\n ref.current = value;\n }, [\n value\n ]);\n return ref.current;\n};\n"],"names":["usePrevious","value","ref","React","useRef","useEffect","current"],"mappings":";;;;+BAGiBA;;aAAAA;;;6DAHM;AAGZ,MAAMA,cAAc,CAACC,QAAQ;IACpC,MAAMC,MAAMC,OAAMC,MAAM,CAAC,IAAI;IAC7BD,OAAME,SAAS,CAAC,IAAI;QAChBH,IAAII,OAAO,GAAGL;IAClB,GAAG;QACCA;KACH;IACD,OAAOC,IAAII,OAAO;AACtB"}
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "useScrollbarWidth", {
8
8
  });
9
9
  const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
10
  const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const cache = /*#__PURE__*/ new WeakMap();
11
+ const cache = new WeakMap();
12
12
  function useScrollbarWidth(options) {
13
13
  const { targetDocument , force } = options;
14
14
  return _react.useMemo(()=>{
@@ -32,6 +32,4 @@ function useScrollbarWidth(options) {
32
32
  targetDocument,
33
33
  force
34
34
  ]);
35
- } //# sourceMappingURL=useScrollbarWidth.js.map
36
-
37
- //# sourceMappingURL=useScrollbarWidth.js.map
35
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useScrollbarWidth.js"],"sourcesContent":["import * as React from 'react';\nconst cache = /*#__PURE__*/new WeakMap();\n/**\n * @returns The width in pixels of the scrollbar in the user agent\n */\nexport function useScrollbarWidth(options) {\n const {\n targetDocument,\n force\n } = options;\n return React.useMemo(() => {\n if (!targetDocument) {\n return 0;\n }\n if (!force && cache.has(targetDocument)) {\n return cache.get(targetDocument);\n }\n const outer = targetDocument.createElement('div');\n outer.style.visibility = 'hidden';\n outer.style.overflow = 'scroll';\n const inner = targetDocument.createElement('div');\n outer.appendChild(inner);\n targetDocument.body.appendChild(outer);\n const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;\n outer.remove();\n cache.set(targetDocument, scrollbarWidth);\n return scrollbarWidth;\n }, [targetDocument, force]);\n}\n//# sourceMappingURL=useScrollbarWidth.js.map"],"names":["useScrollbarWidth","cache","WeakMap","options","targetDocument","force","React","useMemo","has","get","outer","createElement","style","visibility","overflow","inner","appendChild","body","scrollbarWidth","offsetWidth","remove","set"],"mappings":";;;;+BAKgBA;;aAAAA;;;6DALO;AACvB,MAAMC,QAAQ,WAAW,GAAE,IAAIC;AAIxB,SAASF,kBAAkBG,OAAO,EAAE;IACzC,MAAM,EACJC,eAAc,EACdC,MAAK,EACN,GAAGF;IACJ,OAAOG,OAAMC,OAAO,CAAC,IAAM;QACzB,IAAI,CAACH,gBAAgB;YACnB,OAAO;QACT,CAAC;QACD,IAAI,CAACC,SAASJ,MAAMO,GAAG,CAACJ,iBAAiB;YACvC,OAAOH,MAAMQ,GAAG,CAACL;QACnB,CAAC;QACD,MAAMM,QAAQN,eAAeO,aAAa,CAAC;QAC3CD,MAAME,KAAK,CAACC,UAAU,GAAG;QACzBH,MAAME,KAAK,CAACE,QAAQ,GAAG;QACvB,MAAMC,QAAQX,eAAeO,aAAa,CAAC;QAC3CD,MAAMM,WAAW,CAACD;QAClBX,eAAea,IAAI,CAACD,WAAW,CAACN;QAChC,MAAMQ,iBAAiBR,MAAMS,WAAW,GAAGJ,MAAMI,WAAW;QAC5DT,MAAMU,MAAM;QACZnB,MAAMoB,GAAG,CAACjB,gBAAgBc;QAC1B,OAAOA;IACT,GAAG;QAACd;QAAgBC;KAAM;AAC5B,EACA,6CAA6C"}
1
+ {"version":3,"sources":["useScrollbarWidth.js"],"sourcesContent":["import * as React from 'react';\nconst cache = new WeakMap();\n/**\n * @returns The width in pixels of the scrollbar in the user agent\n */ export function useScrollbarWidth(options) {\n const { targetDocument , force } = options;\n return React.useMemo(()=>{\n if (!targetDocument) {\n return 0;\n }\n if (!force && cache.has(targetDocument)) {\n return cache.get(targetDocument);\n }\n const outer = targetDocument.createElement('div');\n outer.style.visibility = 'hidden';\n outer.style.overflow = 'scroll';\n const inner = targetDocument.createElement('div');\n outer.appendChild(inner);\n targetDocument.body.appendChild(outer);\n const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;\n outer.remove();\n cache.set(targetDocument, scrollbarWidth);\n return scrollbarWidth;\n }, [\n targetDocument,\n force\n ]);\n}\n"],"names":["useScrollbarWidth","cache","WeakMap","options","targetDocument","force","React","useMemo","has","get","outer","createElement","style","visibility","overflow","inner","appendChild","body","scrollbarWidth","offsetWidth","remove","set"],"mappings":";;;;+BAIoBA;;aAAAA;;;6DAJG;AACvB,MAAMC,QAAQ,IAAIC;AAGP,SAASF,kBAAkBG,OAAO,EAAE;IAC3C,MAAM,EAAEC,eAAc,EAAGC,MAAK,EAAG,GAAGF;IACpC,OAAOG,OAAMC,OAAO,CAAC,IAAI;QACrB,IAAI,CAACH,gBAAgB;YACjB,OAAO;QACX,CAAC;QACD,IAAI,CAACC,SAASJ,MAAMO,GAAG,CAACJ,iBAAiB;YACrC,OAAOH,MAAMQ,GAAG,CAACL;QACrB,CAAC;QACD,MAAMM,QAAQN,eAAeO,aAAa,CAAC;QAC3CD,MAAME,KAAK,CAACC,UAAU,GAAG;QACzBH,MAAME,KAAK,CAACE,QAAQ,GAAG;QACvB,MAAMC,QAAQX,eAAeO,aAAa,CAAC;QAC3CD,MAAMM,WAAW,CAACD;QAClBX,eAAea,IAAI,CAACD,WAAW,CAACN;QAChC,MAAMQ,iBAAiBR,MAAMS,WAAW,GAAGJ,MAAMI,WAAW;QAC5DT,MAAMU,MAAM;QACZnB,MAAMoB,GAAG,CAACjB,gBAAgBc;QAC1B,OAAOA;IACX,GAAG;QACCd;QACAC;KACH;AACL"}
@@ -30,6 +30,4 @@ function useTimeout() {
30
30
  timeout.set,
31
31
  timeout.clear
32
32
  ];
33
- } //# sourceMappingURL=useTimeout.js.map
34
-
35
- //# sourceMappingURL=useTimeout.js.map
33
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/hooks/useTimeout.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTimeout() {\n const [timeout] = React.useState(() => ({\n id: undefined,\n set: (fn, delay) => {\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: () => {\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n }\n }));\n // Clean up the timeout when the component is unloaded\n React.useEffect(() => timeout.clear, [timeout]);\n return [timeout.set, timeout.clear];\n}\n//# sourceMappingURL=useTimeout.js.map"],"names":["useTimeout","timeout","React","useState","id","undefined","set","fn","delay","clear","setTimeout","clearTimeout","useEffect"],"mappings":";;;;+BASgBA;;aAAAA;;;6DATO;AAShB,SAASA,aAAa;IAC3B,MAAM,CAACC,QAAQ,GAAGC,OAAMC,QAAQ,CAAC,IAAO,CAAA;YACtCC,IAAIC;YACJC,KAAK,CAACC,IAAIC,QAAU;gBAClBP,QAAQQ,KAAK;gBACbR,QAAQG,EAAE,GAAGM,WAAWH,IAAIC;YAC9B;YACAC,OAAO,IAAM;gBACX,IAAIR,QAAQG,EAAE,KAAKC,WAAW;oBAC5BM,aAAaV,QAAQG,EAAE;oBACvBH,QAAQG,EAAE,GAAGC;gBACf,CAAC;YACH;QACF,CAAA;IACA,sDAAsD;IACtDH,OAAMU,SAAS,CAAC,IAAMX,QAAQQ,KAAK,EAAE;QAACR;KAAQ;IAC9C,OAAO;QAACA,QAAQK,GAAG;QAAEL,QAAQQ,KAAK;KAAC;AACrC,EACA,sCAAsC"}
1
+ {"version":3,"sources":["useTimeout.js"],"sourcesContent":["import * as React from 'react';\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once,\n * and is cleaned up when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */ export function useTimeout() {\n const [timeout] = React.useState(()=>({\n id: undefined,\n set: (fn, delay)=>{\n timeout.clear();\n timeout.id = setTimeout(fn, delay);\n },\n clear: ()=>{\n if (timeout.id !== undefined) {\n clearTimeout(timeout.id);\n timeout.id = undefined;\n }\n }\n }));\n // Clean up the timeout when the component is unloaded\n React.useEffect(()=>timeout.clear, [\n timeout\n ]);\n return [\n timeout.set,\n timeout.clear\n ];\n}\n"],"names":["useTimeout","timeout","React","useState","id","undefined","set","fn","delay","clear","setTimeout","clearTimeout","useEffect"],"mappings":";;;;+BAQoBA;;aAAAA;;;6DARG;AAQZ,SAASA,aAAa;IAC7B,MAAM,CAACC,QAAQ,GAAGC,OAAMC,QAAQ,CAAC,IAAK,CAAA;YAC9BC,IAAIC;YACJC,KAAK,CAACC,IAAIC,QAAQ;gBACdP,QAAQQ,KAAK;gBACbR,QAAQG,EAAE,GAAGM,WAAWH,IAAIC;YAChC;YACAC,OAAO,IAAI;gBACP,IAAIR,QAAQG,EAAE,KAAKC,WAAW;oBAC1BM,aAAaV,QAAQG,EAAE;oBACvBH,QAAQG,EAAE,GAAGC;gBACjB,CAAC;YACL;QACJ,CAAA;IACJ,sDAAsD;IACtDH,OAAMU,SAAS,CAAC,IAAIX,QAAQQ,KAAK,EAAE;QAC/BR;KACH;IACD,OAAO;QACHA,QAAQK,GAAG;QACXL,QAAQQ,KAAK;KAChB;AACL"}
@@ -53,6 +53,3 @@ const _index2 = require("./ssr/index");
53
53
  const _index3 = require("./utils/index");
54
54
  const _index4 = require("./trigger/index");
55
55
  const _index5 = require("./events/index");
56
- //# sourceMappingURL=index.js.map
57
-
58
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n//# sourceMappingURL=index.js.map"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"mappings":";;;;;;;;;;;IAASA,QAAQ,MAARA,eAAQ;IAAEC,YAAY,MAAZA,mBAAY;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAAEC,2BAA2B,MAA3BA,kCAA2B;IAC1FC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,oBAAoB,MAApBA,4BAAoB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,KAAK,MAALA,aAAK;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,kBAAkB,MAAlBA,0BAAkB;IAAEC,WAAW,MAAXA,mBAAW;IAAEC,iBAAiB,MAAjBA,yBAAiB;IAAEC,UAAU,MAAVA,kBAAU;IAC7OC,SAAS,MAATA,iBAAS;IAAEC,QAAQ,MAARA,gBAAQ;IAAEC,WAAW,MAAXA,mBAAW;IAChCC,KAAK,MAALA,aAAK;IAAEC,qBAAqB,MAArBA,6BAAqB;IAAEC,yBAAyB,MAAzBA,iCAAyB;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,cAAc,MAAdA,sBAAc;IAAEC,aAAa,MAAbA,qBAAa;IAAEC,wBAAwB,MAAxBA,gCAAwB;IAAEC,IAAI,MAAJA,YAAI;IAAEC,mBAAmB,MAAnBA,2BAAmB;IAC1JC,2BAA2B,MAA3BA,mCAA2B;IAAEC,eAAe,MAAfA,uBAAe;IAAEC,eAAe,MAAfA,uBAAe;IAC7DC,YAAY,MAAZA,oBAAY;IAAEC,YAAY,MAAZA,oBAAY;IAAEC,oBAAoB,MAApBA,4BAAoB;;uBALkD;wBACmJ;wBAC7M;wBAC0H;wBAC7F;wBACb;CACjE,iCAAiC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { getSlots, getSlotsNext, resolveShorthand, isResolvedShorthand, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, getNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n"],"names":["getSlots","getSlotsNext","resolveShorthand","isResolvedShorthand","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords"],"m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