@fluentui/react-utilities 9.13.0 → 9.13.2

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 (161) hide show
  1. package/CHANGELOG.json +55 -1
  2. package/CHANGELOG.md +24 -2
  3. package/lib/compose/assertSlots.js +8 -3
  4. package/lib/compose/assertSlots.js.map +1 -1
  5. package/lib/compose/getSlots.js +1 -1
  6. package/lib/compose/getSlots.js.map +1 -1
  7. package/lib/compose/getSlotsNext.js +1 -1
  8. package/lib/compose/getSlotsNext.js.map +1 -1
  9. package/lib/compose/isResolvedShorthand.js.map +1 -1
  10. package/lib/compose/isSlot.js +2 -1
  11. package/lib/compose/isSlot.js.map +1 -1
  12. package/lib/compose/resolveShorthand.js +2 -1
  13. package/lib/compose/resolveShorthand.js.map +1 -1
  14. package/lib/compose/slot.js +7 -7
  15. package/lib/compose/slot.js.map +1 -1
  16. package/lib/events/mouseTouchHelpers.js.map +1 -1
  17. package/lib/hooks/useAnimationFrame.js +10 -1
  18. package/lib/hooks/useAnimationFrame.js.map +1 -1
  19. package/lib/hooks/useBrowserTimer.js.map +1 -1
  20. package/lib/hooks/useControllableState.js +5 -8
  21. package/lib/hooks/useControllableState.js.map +1 -1
  22. package/lib/hooks/useEventCallback.js.map +1 -1
  23. package/lib/hooks/useFirstMount.js.map +1 -1
  24. package/lib/hooks/useForceUpdate.js.map +1 -1
  25. package/lib/hooks/useId.js.map +1 -1
  26. package/lib/hooks/useMergedRefs.js.map +1 -1
  27. package/lib/hooks/useOnClickOutside.js +25 -19
  28. package/lib/hooks/useOnClickOutside.js.map +1 -1
  29. package/lib/hooks/useOnScrollOutside.js +12 -6
  30. package/lib/hooks/useOnScrollOutside.js.map +1 -1
  31. package/lib/hooks/usePrevious.js.map +1 -1
  32. package/lib/hooks/useScrollbarWidth.js +1 -1
  33. package/lib/hooks/useScrollbarWidth.js.map +1 -1
  34. package/lib/hooks/useTimeout.js.map +1 -1
  35. package/lib/selection/useSelection.js +2 -2
  36. package/lib/selection/useSelection.js.map +1 -1
  37. package/lib/ssr/SSRContext.js +5 -7
  38. package/lib/ssr/SSRContext.js.map +1 -1
  39. package/lib/ssr/canUseDOM.js.map +1 -1
  40. package/lib/trigger/applyTriggerPropsToChildren.js.map +1 -1
  41. package/lib/trigger/getTriggerChild.js.map +1 -1
  42. package/lib/trigger/isFluentTrigger.js.map +1 -1
  43. package/lib/utils/createSetFromIterable.js.map +1 -1
  44. package/lib/utils/getNativeElementProps.js +1 -1
  45. package/lib/utils/getNativeElementProps.js.map +1 -1
  46. package/lib/utils/getRTLSafeKey.js.map +1 -1
  47. package/lib/utils/getReactCallbackName.js +2 -4
  48. package/lib/utils/getReactCallbackName.js.map +1 -1
  49. package/lib/utils/isHTMLElement.js +2 -2
  50. package/lib/utils/isHTMLElement.js.map +1 -1
  51. package/lib/utils/isInteractiveHTMLElement.js +1 -1
  52. package/lib/utils/isInteractiveHTMLElement.js.map +1 -1
  53. package/lib/utils/mergeCallbacks.js +3 -2
  54. package/lib/utils/mergeCallbacks.js.map +1 -1
  55. package/lib/utils/omit.js.map +1 -1
  56. package/lib/utils/priorityQueue.js.map +1 -1
  57. package/lib/utils/properties.js +2 -1
  58. package/lib/utils/properties.js.map +1 -1
  59. package/lib-commonjs/compose/assertSlots.js +13 -6
  60. package/lib-commonjs/compose/assertSlots.js.map +1 -1
  61. package/lib-commonjs/compose/constants.js +6 -2
  62. package/lib-commonjs/compose/constants.js.map +1 -1
  63. package/lib-commonjs/compose/getSlots.js +6 -4
  64. package/lib-commonjs/compose/getSlots.js.map +1 -1
  65. package/lib-commonjs/compose/getSlotsNext.js +6 -4
  66. package/lib-commonjs/compose/getSlotsNext.js.map +1 -1
  67. package/lib-commonjs/compose/index.js +14 -12
  68. package/lib-commonjs/compose/index.js.map +1 -1
  69. package/lib-commonjs/compose/isResolvedShorthand.js +3 -1
  70. package/lib-commonjs/compose/isResolvedShorthand.js.map +1 -1
  71. package/lib-commonjs/compose/isSlot.js +5 -2
  72. package/lib-commonjs/compose/isSlot.js.map +1 -1
  73. package/lib-commonjs/compose/resolveShorthand.js +7 -4
  74. package/lib-commonjs/compose/resolveShorthand.js.map +1 -1
  75. package/lib-commonjs/compose/slot.js +18 -12
  76. package/lib-commonjs/compose/slot.js.map +1 -1
  77. package/lib-commonjs/compose/types.js +2 -2
  78. package/lib-commonjs/compose/types.js.map +1 -1
  79. package/lib-commonjs/events/index.js +2 -2
  80. package/lib-commonjs/events/index.js.map +1 -1
  81. package/lib-commonjs/events/mouseTouchHelpers.js +11 -5
  82. package/lib-commonjs/events/mouseTouchHelpers.js.map +1 -1
  83. package/lib-commonjs/hooks/index.js +14 -14
  84. package/lib-commonjs/hooks/index.js.map +1 -1
  85. package/lib-commonjs/hooks/useAnimationFrame.js +13 -2
  86. package/lib-commonjs/hooks/useAnimationFrame.js.map +1 -1
  87. package/lib-commonjs/hooks/useBrowserTimer.js +5 -3
  88. package/lib-commonjs/hooks/useBrowserTimer.js.map +1 -1
  89. package/lib-commonjs/hooks/useControllableState.js +10 -11
  90. package/lib-commonjs/hooks/useControllableState.js.map +1 -1
  91. package/lib-commonjs/hooks/useEventCallback.js +5 -3
  92. package/lib-commonjs/hooks/useEventCallback.js.map +1 -1
  93. package/lib-commonjs/hooks/useFirstMount.js +5 -3
  94. package/lib-commonjs/hooks/useFirstMount.js.map +1 -1
  95. package/lib-commonjs/hooks/useForceUpdate.js +3 -1
  96. package/lib-commonjs/hooks/useForceUpdate.js.map +1 -1
  97. package/lib-commonjs/hooks/useId.js +11 -5
  98. package/lib-commonjs/hooks/useId.js.map +1 -1
  99. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js +5 -3
  100. package/lib-commonjs/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  101. package/lib-commonjs/hooks/useMergedRefs.js +5 -3
  102. package/lib-commonjs/hooks/useMergedRefs.js.map +1 -1
  103. package/lib-commonjs/hooks/useOnClickOutside.js +29 -22
  104. package/lib-commonjs/hooks/useOnClickOutside.js.map +1 -1
  105. package/lib-commonjs/hooks/useOnScrollOutside.js +16 -9
  106. package/lib-commonjs/hooks/useOnScrollOutside.js.map +1 -1
  107. package/lib-commonjs/hooks/usePrevious.js +5 -3
  108. package/lib-commonjs/hooks/usePrevious.js.map +1 -1
  109. package/lib-commonjs/hooks/useScrollbarWidth.js +6 -4
  110. package/lib-commonjs/hooks/useScrollbarWidth.js.map +1 -1
  111. package/lib-commonjs/hooks/useTimeout.js +3 -1
  112. package/lib-commonjs/hooks/useTimeout.js.map +1 -1
  113. package/lib-commonjs/index.js +129 -43
  114. package/lib-commonjs/index.js.map +1 -1
  115. package/lib-commonjs/selection/index.js +3 -3
  116. package/lib-commonjs/selection/index.js.map +1 -1
  117. package/lib-commonjs/selection/types.js +2 -2
  118. package/lib-commonjs/selection/types.js.map +1 -1
  119. package/lib-commonjs/selection/useSelection.js +7 -5
  120. package/lib-commonjs/selection/useSelection.js.map +1 -1
  121. package/lib-commonjs/ssr/SSRContext.js +22 -14
  122. package/lib-commonjs/ssr/SSRContext.js.map +1 -1
  123. package/lib-commonjs/ssr/canUseDOM.js +3 -1
  124. package/lib-commonjs/ssr/canUseDOM.js.map +1 -1
  125. package/lib-commonjs/ssr/index.js +3 -3
  126. package/lib-commonjs/ssr/index.js.map +1 -1
  127. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js +5 -3
  128. package/lib-commonjs/trigger/applyTriggerPropsToChildren.js.map +1 -1
  129. package/lib-commonjs/trigger/getTriggerChild.js +5 -3
  130. package/lib-commonjs/trigger/getTriggerChild.js.map +1 -1
  131. package/lib-commonjs/trigger/index.js +5 -5
  132. package/lib-commonjs/trigger/index.js.map +1 -1
  133. package/lib-commonjs/trigger/isFluentTrigger.js +5 -3
  134. package/lib-commonjs/trigger/isFluentTrigger.js.map +1 -1
  135. package/lib-commonjs/trigger/types.js +2 -2
  136. package/lib-commonjs/trigger/types.js.map +1 -1
  137. package/lib-commonjs/utils/clamp.js +3 -1
  138. package/lib-commonjs/utils/clamp.js.map +1 -1
  139. package/lib-commonjs/utils/createSetFromIterable.js +3 -1
  140. package/lib-commonjs/utils/createSetFromIterable.js.map +1 -1
  141. package/lib-commonjs/utils/getNativeElementProps.js +9 -5
  142. package/lib-commonjs/utils/getNativeElementProps.js.map +1 -1
  143. package/lib-commonjs/utils/getRTLSafeKey.js +3 -1
  144. package/lib-commonjs/utils/getRTLSafeKey.js.map +1 -1
  145. package/lib-commonjs/utils/getReactCallbackName.js +7 -7
  146. package/lib-commonjs/utils/getReactCallbackName.js.map +1 -1
  147. package/lib-commonjs/utils/index.js +10 -10
  148. package/lib-commonjs/utils/index.js.map +1 -1
  149. package/lib-commonjs/utils/isHTMLElement.js +5 -3
  150. package/lib-commonjs/utils/isHTMLElement.js.map +1 -1
  151. package/lib-commonjs/utils/isInteractiveHTMLElement.js +4 -2
  152. package/lib-commonjs/utils/isInteractiveHTMLElement.js.map +1 -1
  153. package/lib-commonjs/utils/mergeCallbacks.js +6 -3
  154. package/lib-commonjs/utils/mergeCallbacks.js.map +1 -1
  155. package/lib-commonjs/utils/omit.js +3 -1
  156. package/lib-commonjs/utils/omit.js.map +1 -1
  157. package/lib-commonjs/utils/priorityQueue.js +3 -1
  158. package/lib-commonjs/utils/priorityQueue.js.map +1 -1
  159. package/lib-commonjs/utils/properties.js +89 -30
  160. package/lib-commonjs/utils/properties.js.map +1 -1
  161. package/package.json +5 -5
@@ -4,16 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useOnScrollOutside", {
6
6
  enumerable: true,
7
- get: ()=>useOnScrollOutside
7
+ get: function() {
8
+ return useOnScrollOutside;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _useEventCallback = require("./useEventCallback");
12
14
  const useOnScrollOutside = (options)=>{
13
- const { refs , callback , element , disabled , contains: containsProp } = options;
15
+ const { refs, callback, element, disabled, contains: containsProp } = options;
14
16
  const listener = (0, _useEventCallback.useEventCallback)((ev)=>{
15
17
  const contains = containsProp || ((parent, child)=>{
16
- return !!(parent === null || parent === void 0 ? void 0 : parent.contains(child));
18
+ var _parent;
19
+ return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));
17
20
  });
18
21
  const target = ev.composedPath()[0];
19
22
  const isOutside = refs.every((ref)=>!contains(ref.current || null, target));
@@ -22,14 +25,18 @@ const useOnScrollOutside = (options)=>{
22
25
  }
23
26
  });
24
27
  _react.useEffect(()=>{
28
+ var _element, _element1, _element2;
25
29
  if (disabled) {
26
30
  return;
27
31
  }
28
- element === null || element === void 0 ? void 0 : element.addEventListener('wheel', listener);
29
- element === null || element === void 0 ? void 0 : element.addEventListener('touchmove', listener);
32
+ (_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('wheel', listener);
33
+ (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('touchmove', listener);
34
+ (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('scroll', listener, true);
30
35
  return ()=>{
31
- element === null || element === void 0 ? void 0 : element.removeEventListener('wheel', listener);
32
- element === null || element === void 0 ? void 0 : element.removeEventListener('touchmove', listener);
36
+ var _element, _element1, _element2;
37
+ (_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('wheel', listener);
38
+ (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('touchmove', listener);
39
+ (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('scroll', listener, true);
33
40
  };
34
41
  }, [
35
42
  listener,
@@ -1 +1 @@
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 target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, 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","target","composedPath","isOutside","every","ref","current","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,SAASH,GAAGI,YAAY,EAAE,CAAC,EAAE;QACnC,MAAMC,YAAYb,KAAKc,KAAK,CAAC,CAACC,MAAM,CAACX,SAASW,IAAIC,OAAO,IAAI,IAAI,EAAEL;QACnE,IAAIE,aAAa,CAACV,UAAU;YACxBF,SAASO;QACb,CAAC;IACL;IACAS,OAAMC,SAAS,CAAC,IAAI;QAChB,IAAIf,UAAU;YACV;QACJ,CAAC;QACDD,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,gBAAgB,CAAC,SAASb,SAAS;QAC7FJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQiB,gBAAgB,CAAC,aAAab,SAAS;QACjG,OAAO,IAAI;YACPJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQkB,mBAAmB,CAAC,SAASd,SAAS;YAChGJ,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQkB,mBAAmB,CAAC,aAAad,SAAS;QACxG;IACJ,GAAG;QACCA;QACAJ;QACAC;KACH;AACL"}
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 var _parent;\n return !!((_parent = parent) === null || _parent === void 0 ? void 0 : _parent.contains(child));\n });\n const target = ev.composedPath()[0];\n const isOutside = refs.every((ref)=>!contains(ref.current || null, target));\n if (isOutside && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(()=>{\n var _element, _element1, // use capture phase because scroll does not bubble\n _element2;\n if (disabled) {\n return;\n }\n (_element = element) === null || _element === void 0 ? void 0 : _element.addEventListener('wheel', listener);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.addEventListener('touchmove', listener);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.addEventListener('scroll', listener, true);\n return ()=>{\n var _element, _element1, _element2;\n (_element = element) === null || _element === void 0 ? void 0 : _element.removeEventListener('wheel', listener);\n (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.removeEventListener('touchmove', listener);\n (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.removeEventListener('scroll', listener, true);\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","_parent","target","composedPath","isOutside","every","ref","current","React","useEffect","_element","_element1","_element2","addEventListener","removeEventListener"],"mappings":";;;;+BAKiBA;;;eAAAA;;;;iEALM;kCACU;AAItB,MAAMA,qBAAqB,CAACC;IACnC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,UAAUC,YAAY,EAAE,GAAGN;IACtE,MAAMO,WAAWC,IAAAA,kCAAgB,EAAC,CAACC;QAC/B,MAAMJ,WAAWC,gBAAiB,CAAA,CAACI,QAAQC;YACvC,IAAIC;YACJ,OAAO,CAAC,CAAE,CAAA,AAACA,CAAAA,UAAUF,MAAK,MAAO,QAAQE,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQP,QAAQ,CAACM,MAAK;QACjG,CAAA;QACA,MAAME,SAASJ,GAAGK,YAAY,EAAE,CAAC,EAAE;QACnC,MAAMC,YAAYd,KAAKe,KAAK,CAAC,CAACC,MAAM,CAACZ,SAASY,IAAIC,OAAO,IAAI,MAAML;QACnE,IAAIE,aAAa,CAACX,UAAU;YACxBF,SAASO;QACb;IACJ;IACAU,OAAMC,SAAS,CAAC;QACZ,IAAIC,UAAUC,WACdC;QACA,IAAInB,UAAU;YACV;QACJ;QACCiB,CAAAA,WAAWlB,OAAM,MAAO,QAAQkB,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASG,gBAAgB,CAAC,SAASjB;QAClGe,CAAAA,YAAYnB,OAAM,MAAO,QAAQmB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUE,gBAAgB,CAAC,aAAajB;QACzGgB,CAAAA,YAAYpB,OAAM,MAAO,QAAQoB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUC,gBAAgB,CAAC,UAAUjB,UAAU;QACjH,OAAO;YACH,IAAIc,UAAUC,WAAWC;YACxBF,CAAAA,WAAWlB,OAAM,MAAO,QAAQkB,aAAa,KAAK,IAAI,KAAK,IAAIA,SAASI,mBAAmB,CAAC,SAASlB;YACrGe,CAAAA,YAAYnB,OAAM,MAAO,QAAQmB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUG,mBAAmB,CAAC,aAAalB;YAC5GgB,CAAAA,YAAYpB,OAAM,MAAO,QAAQoB,cAAc,KAAK,IAAI,KAAK,IAAIA,UAAUE,mBAAmB,CAAC,UAAUlB,UAAU;QACxH;IACJ,GAAG;QACCA;QACAJ;QACAC;KACH;AACL"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "usePrevious", {
6
6
  enumerable: true,
7
- get: ()=>usePrevious
7
+ get: function() {
8
+ return usePrevious;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const usePrevious = (value)=>{
12
14
  const ref = _react.useRef(null);
13
15
  _react.useEffect(()=>{
@@ -1 +1 @@
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"}
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;;;eAAAA;;;;iEAHM;AAGZ,MAAMA,cAAc,CAACC;IAC5B,MAAMC,MAAMC,OAAMC,MAAM,CAAC;IACzBD,OAAME,SAAS,CAAC;QACZH,IAAII,OAAO,GAAGL;IAClB,GAAG;QACCA;KACH;IACD,OAAOC,IAAII,OAAO;AACtB"}
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useScrollbarWidth", {
6
6
  enumerable: true,
7
- get: ()=>useScrollbarWidth
7
+ get: function() {
8
+ return useScrollbarWidth;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const cache = new WeakMap();
12
14
  function useScrollbarWidth(options) {
13
- const { targetDocument , force } = options;
15
+ const { targetDocument, force } = options;
14
16
  return _react.useMemo(()=>{
15
17
  if (!targetDocument) {
16
18
  return 0;
@@ -1 +1 @@
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"}
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;;;eAAAA;;;;iEAJG;AACvB,MAAMC,QAAQ,IAAIC;AAGP,SAASF,kBAAkBG,OAAO;IACzC,MAAM,EAAEC,cAAc,EAAEC,KAAK,EAAE,GAAGF;IAClC,OAAOG,OAAMC,OAAO,CAAC;QACjB,IAAI,CAACH,gBAAgB;YACjB,OAAO;QACX;QACA,IAAI,CAACC,SAASJ,MAAMO,GAAG,CAACJ,iBAAiB;YACrC,OAAOH,MAAMQ,GAAG,CAACL;QACrB;QACA,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"}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useTimeout", {
6
6
  enumerable: true,
7
- get: ()=>useTimeout
7
+ get: function() {
8
+ return useTimeout;
9
+ }
8
10
  });
9
11
  const _useBrowserTimer = require("./useBrowserTimer");
10
12
  function useTimeout() {
@@ -1 +1 @@
1
- {"version":3,"sources":["useTimeout.js"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */ export function useTimeout() {\n // TODO: figure it out a way to not call global.setTimeout and instead infer window from some context\n return useBrowserTimer(setTimeout, clearTimeout);\n}\n"],"names":["useTimeout","useBrowserTimer","setTimeout","clearTimeout"],"mappings":";;;;+BAQoBA;;aAAAA;;iCARY;AAQrB,SAASA,aAAa;IAC7B,qGAAqG;IACrG,OAAOC,IAAAA,gCAAe,EAACC,YAAYC;AACvC"}
1
+ {"version":3,"sources":["useTimeout.js"],"sourcesContent":["import { useBrowserTimer } from './useBrowserTimer';\n/**\n * @internal\n * Helper to manage a browser timeout.\n * Ensures that the timeout isn't set multiple times at once and is cleaned up\n * when the component is unloaded.\n *\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */ export function useTimeout() {\n // TODO: figure it out a way to not call global.setTimeout and instead infer window from some context\n return useBrowserTimer(setTimeout, clearTimeout);\n}\n"],"names":["useTimeout","useBrowserTimer","setTimeout","clearTimeout"],"mappings":";;;;+BAQoBA;;;eAAAA;;;iCARY;AAQrB,SAASA;IAChB,qGAAqG;IACrG,OAAOC,IAAAA,gCAAe,EAACC,YAAYC;AACvC"}
@@ -9,49 +9,135 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- slot: ()=>_index.slot,
13
- isSlot: ()=>_index.isSlot,
14
- getSlots: ()=>_index.getSlots,
15
- getSlotsNext: ()=>_index.getSlotsNext,
16
- assertSlots: ()=>_index.assertSlots,
17
- resolveShorthand: ()=>_index.resolveShorthand,
18
- isResolvedShorthand: ()=>_index.isResolvedShorthand,
19
- SLOT_ELEMENT_TYPE_SYMBOL: ()=>_index.SLOT_ELEMENT_TYPE_SYMBOL,
20
- SLOT_RENDER_FUNCTION_SYMBOL: ()=>_index.SLOT_RENDER_FUNCTION_SYMBOL,
21
- IdPrefixProvider: ()=>_index1.IdPrefixProvider,
22
- resetIdsForTests: ()=>_index1.resetIdsForTests,
23
- useAnimationFrame: ()=>_index1.useAnimationFrame,
24
- useControllableState: ()=>_index1.useControllableState,
25
- useEventCallback: ()=>_index1.useEventCallback,
26
- useFirstMount: ()=>_index1.useFirstMount,
27
- useForceUpdate: ()=>_index1.useForceUpdate,
28
- useId: ()=>_index1.useId,
29
- useIsomorphicLayoutEffect: ()=>_index1.useIsomorphicLayoutEffect,
30
- useMergedRefs: ()=>_index1.useMergedRefs,
31
- useOnClickOutside: ()=>_index1.useOnClickOutside,
32
- useOnScrollOutside: ()=>_index1.useOnScrollOutside,
33
- usePrevious: ()=>_index1.usePrevious,
34
- useScrollbarWidth: ()=>_index1.useScrollbarWidth,
35
- useTimeout: ()=>_index1.useTimeout,
36
- canUseDOM: ()=>_index2.canUseDOM,
37
- useIsSSR: ()=>_index2.useIsSSR,
38
- SSRProvider: ()=>_index2.SSRProvider,
39
- clamp: ()=>_index3.clamp,
40
- getNativeElementProps: ()=>_index3.getNativeElementProps,
41
- getPartitionedNativeProps: ()=>_index3.getPartitionedNativeProps,
42
- getRTLSafeKey: ()=>_index3.getRTLSafeKey,
43
- mergeCallbacks: ()=>_index3.mergeCallbacks,
44
- isHTMLElement: ()=>_index3.isHTMLElement,
45
- isInteractiveHTMLElement: ()=>_index3.isInteractiveHTMLElement,
46
- omit: ()=>_index3.omit,
47
- createPriorityQueue: ()=>_index3.createPriorityQueue,
48
- applyTriggerPropsToChildren: ()=>_index4.applyTriggerPropsToChildren,
49
- getTriggerChild: ()=>_index4.getTriggerChild,
50
- isFluentTrigger: ()=>_index4.isFluentTrigger,
51
- isTouchEvent: ()=>_index5.isTouchEvent,
52
- isMouseEvent: ()=>_index5.isMouseEvent,
53
- getEventClientCoords: ()=>_index5.getEventClientCoords,
54
- useSelection: ()=>_index6.useSelection
12
+ slot: function() {
13
+ return _index.slot;
14
+ },
15
+ isSlot: function() {
16
+ return _index.isSlot;
17
+ },
18
+ getSlots: function() {
19
+ return _index.getSlots;
20
+ },
21
+ getSlotsNext: function() {
22
+ return _index.getSlotsNext;
23
+ },
24
+ assertSlots: function() {
25
+ return _index.assertSlots;
26
+ },
27
+ resolveShorthand: function() {
28
+ return _index.resolveShorthand;
29
+ },
30
+ isResolvedShorthand: function() {
31
+ return _index.isResolvedShorthand;
32
+ },
33
+ SLOT_ELEMENT_TYPE_SYMBOL: function() {
34
+ return _index.SLOT_ELEMENT_TYPE_SYMBOL;
35
+ },
36
+ SLOT_RENDER_FUNCTION_SYMBOL: function() {
37
+ return _index.SLOT_RENDER_FUNCTION_SYMBOL;
38
+ },
39
+ IdPrefixProvider: function() {
40
+ return _index1.IdPrefixProvider;
41
+ },
42
+ resetIdsForTests: function() {
43
+ return _index1.resetIdsForTests;
44
+ },
45
+ useAnimationFrame: function() {
46
+ return _index1.useAnimationFrame;
47
+ },
48
+ useControllableState: function() {
49
+ return _index1.useControllableState;
50
+ },
51
+ useEventCallback: function() {
52
+ return _index1.useEventCallback;
53
+ },
54
+ useFirstMount: function() {
55
+ return _index1.useFirstMount;
56
+ },
57
+ useForceUpdate: function() {
58
+ return _index1.useForceUpdate;
59
+ },
60
+ useId: function() {
61
+ return _index1.useId;
62
+ },
63
+ useIsomorphicLayoutEffect: function() {
64
+ return _index1.useIsomorphicLayoutEffect;
65
+ },
66
+ useMergedRefs: function() {
67
+ return _index1.useMergedRefs;
68
+ },
69
+ useOnClickOutside: function() {
70
+ return _index1.useOnClickOutside;
71
+ },
72
+ useOnScrollOutside: function() {
73
+ return _index1.useOnScrollOutside;
74
+ },
75
+ usePrevious: function() {
76
+ return _index1.usePrevious;
77
+ },
78
+ useScrollbarWidth: function() {
79
+ return _index1.useScrollbarWidth;
80
+ },
81
+ useTimeout: function() {
82
+ return _index1.useTimeout;
83
+ },
84
+ canUseDOM: function() {
85
+ return _index2.canUseDOM;
86
+ },
87
+ useIsSSR: function() {
88
+ return _index2.useIsSSR;
89
+ },
90
+ SSRProvider: function() {
91
+ return _index2.SSRProvider;
92
+ },
93
+ clamp: function() {
94
+ return _index3.clamp;
95
+ },
96
+ getNativeElementProps: function() {
97
+ return _index3.getNativeElementProps;
98
+ },
99
+ getPartitionedNativeProps: function() {
100
+ return _index3.getPartitionedNativeProps;
101
+ },
102
+ getRTLSafeKey: function() {
103
+ return _index3.getRTLSafeKey;
104
+ },
105
+ mergeCallbacks: function() {
106
+ return _index3.mergeCallbacks;
107
+ },
108
+ isHTMLElement: function() {
109
+ return _index3.isHTMLElement;
110
+ },
111
+ isInteractiveHTMLElement: function() {
112
+ return _index3.isInteractiveHTMLElement;
113
+ },
114
+ omit: function() {
115
+ return _index3.omit;
116
+ },
117
+ createPriorityQueue: function() {
118
+ return _index3.createPriorityQueue;
119
+ },
120
+ applyTriggerPropsToChildren: function() {
121
+ return _index4.applyTriggerPropsToChildren;
122
+ },
123
+ getTriggerChild: function() {
124
+ return _index4.getTriggerChild;
125
+ },
126
+ isFluentTrigger: function() {
127
+ return _index4.isFluentTrigger;
128
+ },
129
+ isTouchEvent: function() {
130
+ return _index5.isTouchEvent;
131
+ },
132
+ isMouseEvent: function() {
133
+ return _index5.isMouseEvent;
134
+ },
135
+ getEventClientCoords: function() {
136
+ return _index5.getEventClientCoords;
137
+ },
138
+ useSelection: function() {
139
+ return _index6.useSelection;
140
+ }
55
141
  });
56
142
  const _index = require("./compose/index");
57
143
  const _index1 = require("./hooks/index");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export { slot, isSlot, getSlots, getSlotsNext, assertSlots, resolveShorthand, isResolvedShorthand, SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useAnimationFrame, 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';\nexport { useSelection } from './selection/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","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","useSelection"],"mappings":";;;;;;;;;;;IAASA,IAAI,MAAJA,WAAI;IAAEC,MAAM,MAANA,aAAM;IAAEC,QAAQ,MAARA,eAAQ;IAAEC,YAAY,MAAZA,mBAAY;IAAEC,WAAW,MAAXA,kBAAW;IAAEC,gBAAgB,MAAhBA,uBAAgB;IAAEC,mBAAmB,MAAnBA,0BAAmB;IAAEC,wBAAwB,MAAxBA,+BAAwB;IAAEC,2BAA2B,MAA3BA,kCAA2B;IAC/IC,gBAAgB,MAAhBA,wBAAgB;IAAEC,gBAAgB,MAAhBA,wBAAgB;IAAEC,iBAAiB,MAAjBA,yBAAiB;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;IAChQC,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;IAChDC,YAAY,MAAZA,oBAAY;;uBAN2I;wBACiH;wBAChO;wBAC0H;wBAC7F;wBACb;wBACpC"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export { slot, isSlot, getSlots, getSlotsNext, assertSlots, resolveShorthand, isResolvedShorthand, SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useAnimationFrame, 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';\nexport { useSelection } from './selection/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","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","useSelection"],"mappings":";;;;;;;;;;;IAASA,IAAI;eAAJA,WAAI;;IAAEC,MAAM;eAANA,aAAM;;IAAEC,QAAQ;eAARA,eAAQ;;IAAEC,YAAY;eAAZA,mBAAY;;IAAEC,WAAW;eAAXA,kBAAW;;IAAEC,gBAAgB;eAAhBA,uBAAgB;;IAAEC,mBAAmB;eAAnBA,0BAAmB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,2BAA2B;eAA3BA,kCAA2B;;IAC/IC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,KAAK;eAALA,aAAK;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,kBAAkB;eAAlBA,0BAAkB;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,UAAU;eAAVA,kBAAU;;IAChQC,SAAS;eAATA,iBAAS;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,WAAW;eAAXA,mBAAW;;IAChCC,KAAK;eAALA,aAAK;;IAAEC,qBAAqB;eAArBA,6BAAqB;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,wBAAwB;eAAxBA,gCAAwB;;IAAEC,IAAI;eAAJA,YAAI;;IAAEC,mBAAmB;eAAnBA,2BAAmB;;IAC1JC,2BAA2B;eAA3BA,mCAA2B;;IAAEC,eAAe;eAAfA,uBAAe;;IAAEC,eAAe;eAAfA,uBAAe;;IAC7DC,YAAY;eAAZA,oBAAY;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAChDC,YAAY;eAAZA,oBAAY;;;uBAN2I;wBACiH;wBAChO;wBAC0H;wBAC7F;wBACb;wBACpC"}
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./types"), exports);
7
- _exportStar(require("./useSelection"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./types"), exports);
7
+ _export_star._(require("./useSelection"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useSelection';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './types';\nexport * from './useSelection';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA"}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -1 +1 @@
1
- {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;6DAAuB"}
1
+ {"version":3,"sources":["types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "useSelection", {
6
6
  enumerable: true,
7
- get: ()=>useSelection
7
+ get: function() {
8
+ return useSelection;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _useControllableState = require("../hooks/useControllableState");
12
14
  const _createSetFromIterable = require("../utils/createSetFromIterable");
13
15
  function useSelectionState(params) {
@@ -21,8 +23,8 @@ function useSelectionState(params) {
21
23
  ])
22
24
  });
23
25
  const changeSelection = (event, nextSelectedItems)=>{
24
- var _params_onSelectionChange;
25
- (_params_onSelectionChange = params.onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(params, event, {
26
+ var _params_onSelectionChange, _params;
27
+ (_params_onSelectionChange = (_params = params).onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(_params, event, {
26
28
  selectedItems: nextSelectedItems
27
29
  });
28
30
  setSelected(nextSelectedItems);
@@ -1 +1 @@
1
- {"version":3,"sources":["useSelection.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState } from '../hooks/useControllableState';\nimport { createSetFromIterable } from '../utils/createSetFromIterable';\nfunction useSelectionState(params) {\n const [selected, setSelected] = useControllableState({\n initialState: new Set(),\n defaultState: React.useMemo(()=>params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems), [\n params.defaultSelectedItems\n ]),\n state: React.useMemo(()=>params.selectedItems && createSetFromIterable(params.selectedItems), [\n params.selectedItems\n ])\n });\n const changeSelection = (event, nextSelectedItems)=>{\n var _params_onSelectionChange;\n (_params_onSelectionChange = params.onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(params, event, {\n selectedItems: nextSelectedItems\n });\n setSelected(nextSelectedItems);\n };\n return [\n selected,\n changeSelection\n ];\n}\nfunction useSingleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n var _selected_has;\n const methods = {\n deselectItem: (event)=>changeSelection(event, new Set()),\n selectItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n toggleAllItems: ()=>{\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');\n }\n },\n toggleItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n clearItems: (event)=>changeSelection(event, new Set()),\n isSelected: (itemId)=>(_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false\n };\n return [\n selected,\n methods\n ];\n}\nfunction useMultipleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods = {\n toggleItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n if (selected.has(itemId)) {\n nextSelectedItems.delete(itemId);\n } else {\n nextSelectedItems.add(itemId);\n }\n changeSelection(event, nextSelectedItems);\n },\n selectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.add(itemId);\n changeSelection(event, nextSelectedItems);\n },\n deselectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.delete(itemId);\n changeSelection(event, nextSelectedItems);\n },\n clearItems: (event)=>{\n changeSelection(event, new Set());\n },\n isSelected: (itemId)=>selected.has(itemId),\n toggleAllItems: (event, itemIds)=>{\n const allItemsSelected = itemIds.every((itemId)=>selected.has(itemId));\n const nextSelectedItems = new Set(selected);\n if (allItemsSelected) {\n nextSelectedItems.clear();\n } else {\n itemIds.forEach((itemId)=>nextSelectedItems.add(itemId));\n }\n changeSelection(event, nextSelectedItems);\n }\n };\n return [\n selected,\n methods\n ];\n}\nexport function useSelection(params) {\n if (params.selectionMode === 'multiselect') {\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMultipleSelection(params);\n }\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSingleSelection(params);\n}\n"],"names":["useSelection","useSelectionState","params","selected","setSelected","useControllableState","initialState","Set","defaultState","React","useMemo","defaultSelectedItems","createSetFromIterable","state","selectedItems","changeSelection","event","nextSelectedItems","_params_onSelectionChange","onSelectionChange","call","useSingleSelection","_selected_has","methods","deselectItem","selectItem","itemId","toggleAllItems","process","env","NODE_ENV","Error","toggleItem","clearItems","isSelected","has","useMultipleSelection","delete","add","itemIds","allItemsSelected","every","clear","forEach","selectionMode"],"mappings":";;;;+BA2FgBA;;aAAAA;;;6DA3FO;sCACc;uCACC;AACtC,SAASC,kBAAkBC,MAAM,EAAE;IAC/B,MAAM,CAACC,UAAUC,YAAY,GAA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EAA0E;IAC1E,sDAAsD;IACtD,OAAOmB,mBAAmBnB;AAC9B"}
1
+ {"version":3,"sources":["useSelection.js"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState } from '../hooks/useControllableState';\nimport { createSetFromIterable } from '../utils/createSetFromIterable';\nfunction useSelectionState(params) {\n const [selected, setSelected] = useControllableState({\n initialState: new Set(),\n defaultState: React.useMemo(()=>params.defaultSelectedItems && createSetFromIterable(params.defaultSelectedItems), [\n params.defaultSelectedItems\n ]),\n state: React.useMemo(()=>params.selectedItems && createSetFromIterable(params.selectedItems), [\n params.selectedItems\n ])\n });\n const changeSelection = (event, nextSelectedItems)=>{\n var _params_onSelectionChange, _params;\n (_params_onSelectionChange = (_params = params).onSelectionChange) === null || _params_onSelectionChange === void 0 ? void 0 : _params_onSelectionChange.call(_params, event, {\n selectedItems: nextSelectedItems\n });\n setSelected(nextSelectedItems);\n };\n return [\n selected,\n changeSelection\n ];\n}\nfunction useSingleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n var _selected_has;\n const methods = {\n deselectItem: (event)=>changeSelection(event, new Set()),\n selectItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n toggleAllItems: ()=>{\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-utilities]: `toggleAllItems` should not be used in single selection mode');\n }\n },\n toggleItem: (event, itemId)=>changeSelection(event, new Set([\n itemId\n ])),\n clearItems: (event)=>changeSelection(event, new Set()),\n isSelected: (itemId)=>(_selected_has = selected.has(itemId)) !== null && _selected_has !== void 0 ? _selected_has : false\n };\n return [\n selected,\n methods\n ];\n}\nfunction useMultipleSelection(params) {\n const [selected, changeSelection] = useSelectionState(params);\n const methods = {\n toggleItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n if (selected.has(itemId)) {\n nextSelectedItems.delete(itemId);\n } else {\n nextSelectedItems.add(itemId);\n }\n changeSelection(event, nextSelectedItems);\n },\n selectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.add(itemId);\n changeSelection(event, nextSelectedItems);\n },\n deselectItem: (event, itemId)=>{\n const nextSelectedItems = new Set(selected);\n nextSelectedItems.delete(itemId);\n changeSelection(event, nextSelectedItems);\n },\n clearItems: (event)=>{\n changeSelection(event, new Set());\n },\n isSelected: (itemId)=>selected.has(itemId),\n toggleAllItems: (event, itemIds)=>{\n const allItemsSelected = itemIds.every((itemId)=>selected.has(itemId));\n const nextSelectedItems = new Set(selected);\n if (allItemsSelected) {\n nextSelectedItems.clear();\n } else {\n itemIds.forEach((itemId)=>nextSelectedItems.add(itemId));\n }\n changeSelection(event, nextSelectedItems);\n }\n };\n return [\n selected,\n methods\n ];\n}\nexport function useSelection(params) {\n if (params.selectionMode === 'multiselect') {\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMultipleSelection(params);\n }\n // selectionMode is a static value, so we can safely ignore rules-of-hooks\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useSingleSelection(params);\n}\n"],"names":["useSelection","useSelectionState","params","selected","setSelected","useControllableState","initialState","Set","defaultState","React","useMemo","defaultSelectedItems","createSetFromIterable","state","selectedItems","changeSelection","event","nextSelectedItems","_params_onSelectionChange","_params","onSelectionChange","call","useSingleSelection","_selected_has","methods","deselectItem","selectItem","itemId","toggleAllItems","process","env","NODE_ENV","Error","toggleItem","clearItems","isSelected","has","useMultipleSelection","delete","add","itemIds","allItemsSelected","every","clear","forEach","selectionMode"],"mappings":";;;;+BA2FgBA;;;eAAAA;;;;iEA3FO;sCACc;uCACC;AACtC,SAASC,kBAAkBC,MAAM;IAC7B,MAAM,CAACC,UAAUC,YAAY,GAAGC,IAAAA,0CAAoB,EAAC;QACjDC,cAAc,IAAIC;QAClBC,cAAcC,OAAMC,OAAO,CAAC,IAAIR,OAAOS,oBAAoB,IAAIC,IAAAA,4CAAqB,EAACV,OAAOS,oBAAoB,GAAG;YAC/GT,OAAOS,oBAAoB;SAC9B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SAASiC,GAAG,CAACT,SAAS;gBACtBV,kBAAkBqB,MAAM,CAACX;YAC7B,OAAO;gBACHV,kBAAkBsB,GAAG,CAACZ;YAC1B;YACAZ,gBAAgBC,OAAOC;QAC3B;QACAS,YAAY,CAACV,OAAOW;YAChB,MAAMV,oBAAoB,IAAIV,IAAIJ;YAClCc,kBAAkBsB,GAAG,CAACZ;YACtBZ,gBAAgBC,OAAOC;QAC3B;QACAQ,cAAc,CAACT,OAAOW;YAClB,MAAMV,oBAAoB,IAAIV,IAAIJ;YAClCc,kBAAkBqB,MAAM,CAACX;YACzBZ,gBAAgBC,OAAOC;QAC3B;QACAiB,YAAY,CAAClB;YACTD,gBAAgBC,OAAO,IAAIT;QAC/B;QACA4B,YAAY,CAACR,SAASxB,SAASiC,GAAG,CAACT;QACnCC,gBAAgB,CAACZ,OAAOwB;YACpB,MAAMC,mBAAmBD,QAAQE,KAAK,CAAC,CAACf,SAASxB,SAASiC,GAAG,CAACT;YAC9D,MAAMV,oBAAoB,IAAIV,IAAIJ;YAClC,IAAIsC,kBAAkB;gBAClBxB,kBAAkB0B,KAAK;YAC3B,OAAO;gBACHH,QAAQI,OAAO,CAAC,CAACjB,SAASV,kBAAkBsB,GAAG,CAACZ;YACpD;YACAZ,gBAAgBC,OAAOC;QAC3B;IACJ;IACA,OAAO;QACHd;QACAqB;KACH;AACL;AACO,SAASxB,aAAaE,MAAM;IAC/B,IAAIA,OAAO2C,aAAa,KAAK,eAAe;QACxC,0EAA0E;QAC1E,sDAAsD;QACtD,OAAOR,qBAAqBnC;IAChC;IACA,0EAA0E;IAC1E,sDAAsD;IACtD,OAAOoB,mBAAmBpB;AAC9B"}
@@ -9,14 +9,24 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- defaultSSRContextValue: ()=>defaultSSRContextValue,
13
- SSRContext: ()=>SSRContext,
14
- useSSRContext: ()=>useSSRContext,
15
- SSRProvider: ()=>SSRProvider,
16
- useIsSSR: ()=>useIsSSR
12
+ defaultSSRContextValue: function() {
13
+ return defaultSSRContextValue;
14
+ },
15
+ SSRContext: function() {
16
+ return SSRContext;
17
+ },
18
+ useSSRContext: function() {
19
+ return useSSRContext;
20
+ },
21
+ SSRProvider: function() {
22
+ return SSRProvider;
23
+ },
24
+ useIsSSR: function() {
25
+ return useIsSSR;
26
+ }
17
27
  });
18
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
19
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
28
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
29
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
20
30
  const _canUseDOM = require("./canUseDOM");
21
31
  const defaultSSRContextValue = {
22
32
  current: 0
@@ -42,13 +52,11 @@ function useIsSSR() {
42
52
  if (process.env.NODE_ENV !== 'production') {
43
53
  if (!isInSSRContext && !(0, _canUseDOM.canUseDOM)()) {
44
54
  // eslint-disable-next-line no-console
45
- console.error([
46
- '@fluentui/react-components: ',
47
- 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.',
48
- '\n',
49
- '\n',
50
- 'Check documentation at https://aka.ms/fluentui-ssr'
51
- ].join(''));
55
+ console.error(`@fluentui/react-components [${useIsSSR.name}]:
56
+ When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.
57
+
58
+
59
+ Check documentation at https://aka.ms/fluentui-ssr.`);
52
60
  }
53
61
  }
54
62
  // If on the client, and the component was initially server rendered, then schedule a layout effect to update the
@@ -1 +1 @@
1
- {"version":3,"sources":["SSRContext.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */ export const defaultSSRContextValue = {\n current: 0\n};\nexport const SSRContext = /*#__PURE__*/ React.createContext(undefined);\n/**\n * @internal\n */ export function useSSRContext() {\n var _React_useContext;\n return (_React_useContext = React.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;\n}\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */ export const SSRProvider = (props)=>{\n const [value] = React.useState(()=>({\n current: 0\n }));\n return /*#__PURE__*/ React.createElement(SSRContext.Provider, {\n value: value\n }, props.children);\n};\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */ export function useIsSSR() {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error([\n '@fluentui/react-components: ',\n 'When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are ' + 'generated between the client and server.',\n '\\n',\n '\\n',\n 'Check documentation at https://aka.ms/fluentui-ssr'\n ].join(''));\n }\n }\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(()=>{\n setIsSSR(false);\n }, []);\n }\n return isSSR;\n}\n"],"names":["defaultSSRContextValue","SSRContext","useSSRContext","SSRProvider","useIsSSR","current","React","createContext","undefined","_React_useContext","useContext","props","value","useState","createElement","Provider","children","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","join","useLayoutEffect"],"mappings":";;;;;;;;;;;IAMiBA,sBAAsB,MAAtBA;IAGJC,UAAU,MAAVA;IAGOC,aAAa,MAAbA;IASHC,WAAW,MAAXA;IAWGC,QAAQ,MAARA;;;6DAhCG;2BACG;AAKf,MAAMJ,yBAAyB;IACtCK,SAAS;AACb;AACO,MAAMJ,aAAa,WAAW,GAAGK,OAAMC,aAAa,CAACC;AAGjD,SAASN,gBAAgB;IAChC,IAAIO;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACT,WAAU,MAAO,IAAI,IAAIQ,sBAAsB,KAAK,IAAIA,oBAAoBT,sBAAsB;AACnJ;AAMW,MAAMG,cAAc,CAACQ,QAAQ;IACpC,MAAM,CAACC,MAAM,GAAGN,OAAMO,QAAQ,CAAC,IAAK,CAAA;YAC5BR,SAAS;QACb,CAAA;IACJ,OAAO,WAAW,GAAGC,OAAMQ,aAAa,CAACb,WAAWc,QAAQ,EAAE;QAC1DH,OAAOA;IACX,GAAGD,MAAMK,QAAQ;AACrB;AAIW,SAASZ,WAAW;IAC3B,MAAMa,iBAAiBf,oBAAoBF;IAC3C,MAAM,CAACkB,OAAOC,SAAS,GAAGb,OAAMO,QAAQ,CAACI;IACzC,6GAA6G;IAC7G,wBAAwB;IACxB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACvC,IAAI,CAACL,kBAAkB,CAACM,IAAAA,oBAAS,KAAI;YACjC,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;gBACV;gBACA,4GAA4G;gBAC5G;gBACA;gBACA;aACH,CAACC,IAAI,CAAC;QACX,CAAC;IACL,CAAC;IACD,iHAAiH;IACjH,6BAA6B;IAC7B,IAAIH,IAAAA,oBAAS,OAAMN,gBAAgB;QAC/B,iHAAiH;QACjH,YAAY;QACZ,2BAA2B;QAC3BX,OAAMqB,eAAe,CAAC,IAAI;YACtBR,SAAS,KAAK;QAClB,GAAG,EAAE;IACT,CAAC;IACD,OAAOD;AACX"}
1
+ {"version":3,"sources":["SSRContext.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from './canUseDOM';\n/**\n * Default context value to use in case there is no SSRProvider. This is fine for client-only apps.\n *\n * @internal\n */ export const defaultSSRContextValue = {\n current: 0\n};\nexport const SSRContext = /*#__PURE__*/ React.createContext(undefined);\n/**\n * @internal\n */ export function useSSRContext() {\n var _React_useContext;\n return (_React_useContext = React.useContext(SSRContext)) !== null && _React_useContext !== void 0 ? _React_useContext : defaultSSRContextValue;\n}\n/**\n * When using SSR with Fluent UI, applications must be wrapped in an SSRProvider. This ensures that auto generated ids\n * are consistent between the client and server.\n *\n * @public\n */ export const SSRProvider = (props)=>{\n const [value] = React.useState(()=>({\n current: 0\n }));\n return /*#__PURE__*/ React.createElement(SSRContext.Provider, {\n value: value\n }, props.children);\n};\n/**\n * Returns whether the component is currently being server side rendered or hydrated on the client. Can be used to delay\n * browser-specific rendering until after hydration. May cause re-renders on a client when is used within SSRProvider.\n */ export function useIsSSR() {\n const isInSSRContext = useSSRContext() !== defaultSSRContextValue;\n const [isSSR, setIsSSR] = React.useState(isInSSRContext);\n // If we are rendering in a non-DOM environment, and there's no SSRProvider, provide a warning to hint to the\n // developer to add one.\n if (process.env.NODE_ENV !== 'production') {\n if (!isInSSRContext && !canUseDOM()) {\n // eslint-disable-next-line no-console\n console.error(`@fluentui/react-components [${useIsSSR.name}]:\nWhen server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.\n\n\nCheck documentation at https://aka.ms/fluentui-ssr.`);\n }\n }\n // If on the client, and the component was initially server rendered, then schedule a layout effect to update the\n // component after hydration.\n if (canUseDOM() && isInSSRContext) {\n // This if statement technically breaks the rules of hooks, but is safe because the condition never changes after\n // mounting.\n // eslint-disable-next-line\n React.useLayoutEffect(()=>{\n setIsSSR(false);\n }, []);\n }\n return isSSR;\n}\n"],"names":["defaultSSRContextValue","SSRContext","useSSRContext","SSRProvider","useIsSSR","current","React","createContext","undefined","_React_useContext","useContext","props","value","useState","createElement","Provider","children","isInSSRContext","isSSR","setIsSSR","process","env","NODE_ENV","canUseDOM","console","error","name","useLayoutEffect"],"mappings":";;;;;;;;;;;IAMiBA,sBAAsB;eAAtBA;;IAGJC,U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 get: function() {
10
+ return canUseDOM;
11
+ }
10
12
  });
11
13
  function canUseDOM() {
12
14
  return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation
@@ -1 +1 @@
1
- {"version":3,"sources":["canUseDOM.js"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */ export function canUseDOM() {\n return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation\n window.document.createElement);\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;CAEC;;;;+BAAmBA;;aAAAA;;AAAT,SAASA,YAAY;IAC5B,OAAO,OAAOC,WAAW,eAAe,CAAC,CAAEA,CAAAA,OAAOC,QAAQ,IAAI,mDAAmD;IACjHD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAChC"}
1
+ {"version":3,"sources":["canUseDOM.js"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */ export function canUseDOM() {\n return typeof window !== 'undefined' && !!(window.document && // eslint-disable-next-line deprecation/deprecation\n window.document.createElement);\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;CAEC;;;;+BAAmBA;;;eAAAA;;;AAAT,SAASA;IAChB,OAAO,OAAOC,WAAW,eAAe,CAAC,CAAEA,CAAAA,OAAOC,QAAQ,IAAI,mDAAmD;IACjHD,OAAOC,QAAQ,CAACC,aAAa,AAAD;AAChC"}
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
- _exportStar(require("./canUseDOM"), exports);
7
- _exportStar(require("./SSRContext"), exports);
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./canUseDOM"), exports);
7
+ _export_star._(require("./SSRContext"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA"}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './canUseDOM';\nexport * from './SSRContext';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "applyTriggerPropsToChildren", {
6
6
  enumerable: true,
7
- get: ()=>applyTriggerPropsToChildren
7
+ get: function() {
8
+ return applyTriggerPropsToChildren;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _isFluentTrigger = require("./isFluentTrigger");
12
14
  function applyTriggerPropsToChildren(children, triggerChildProps) {
13
15
  if (typeof children === 'function') {
@@ -1 +1 @@
1
- {"version":3,"sources":["applyTriggerPropsToChildren.js"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */ export function applyTriggerPropsToChildren(children, triggerChildProps) {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\n }\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n}\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */ function cloneTriggerTree(child, triggerProps) {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error('A trigger element must be a single element for this component. ' + \"Please ensure that you're not using React Fragments.\");\n }\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps);\n }\n}\n"],"names":["applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","React","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"mappings":";;;;+BAKoBA;;aAAAA;;;6DALG;iCACS;AAIrB,SAASA,4BAA4BC,QAAQ,EAAEC,iBAAiB,EAAE;IACzE,IAAI,OAAOD,aAAa,YAAY;QAChC,OAAOA,SAASC;IACpB,OAAO,IAAID,UAAU;QACjB,OAAOE,iBAAiBF,UAAUC;IACtC,CAAC;IACD,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY,IAAI;AAC3B;AACA;;;CAGC,GAAG,SAASE,iBAAiBC,KAAK,EAAEC,YAAY,EAAE;IAC/C,IAAI,eAACC,OAAMC,cAAc,CAACH,UAAUA,MAAMI,IAAI,KAAKF,OAAMG,QAAQ,EAAE;QAC/D,MAAM,IAAIC,MAAM,oEAAoE,wDAAwD;IAChJ,CAAC;IACD,IAAIC,IAAAA,gCAAe,EAACP,QAAQ;QACxB,MAAMQ,aAAaT,iBAAiBC,MAAMS,KAAK,CAACZ,QAAQ,EAAEI;QAC1D,qBAAOC,OAAMQ,YAAY,CAACV,OAAOW,WAAWH;IAChD,OAAO;QACH,qBAAON,OAAMQ,YAAY,CAACV,OAAOC;IACrC,CAAC;AACL"}
1
+ {"version":3,"sources":["applyTriggerPropsToChildren.js"],"sourcesContent":["import * as React from 'react';\nimport { isFluentTrigger } from './isFluentTrigger';\n/**\n * @internal\n * resolve the trigger props to the children, either by calling the render function, or cloning with the new props.\n */ export function applyTriggerPropsToChildren(children, triggerChildProps) {\n if (typeof children === 'function') {\n return children(triggerChildProps);\n } else if (children) {\n return cloneTriggerTree(children, triggerChildProps);\n }\n // Components in React should return either JSX elements or \"null\", otherwise React will throw:\n // Nothing was returned from render.\n // This usually means a return statement is missing. Or, to render nothing, return null.\n return children || null;\n}\n/**\n * Clones a React element tree, and applies the given props to the first grandchild that is not\n * a FluentTriggerComponent or React Fragment (the same element returned by {@link getTriggerChild}).\n */ function cloneTriggerTree(child, triggerProps) {\n if (!React.isValidElement(child) || child.type === React.Fragment) {\n throw new Error('A trigger element must be a single element for this component. ' + \"Please ensure that you're not using React Fragments.\");\n }\n if (isFluentTrigger(child)) {\n const grandchild = cloneTriggerTree(child.props.children, triggerProps);\n return React.cloneElement(child, undefined, grandchild);\n } else {\n return React.cloneElement(child, triggerProps);\n }\n}\n"],"names":["applyTriggerPropsToChildren","children","triggerChildProps","cloneTriggerTree","child","triggerProps","React","isValidElement","type","Fragment","Error","isFluentTrigger","grandchild","props","cloneElement","undefined"],"mappings":";;;;+BAKoBA;;;eAAAA;;;;iEALG;iCACS;AAIrB,SAASA,4BAA4BC,QAAQ,EAAEC,iBAAiB;IACvE,IAAI,OAAOD,aAAa,YAAY;QAChC,OAAOA,SAASC;IACpB,OAAO,IAAID,UAAU;QACjB,OAAOE,iBAAiBF,UAAUC;IACtC;IACA,+FAA+F;IAC/F,sCAAsC;IACtC,0FAA0F;IAC1F,OAAOD,YAAY;AACvB;AACA;;;CAGC,GAAG,SAASE,iBAAiBC,KAAK,EAAEC,YAAY;IAC7C,IAAI,eAACC,OAAMC,cAAc,CAACH,UAAUA,MAAMI,IAAI,KAAKF,OAAMG,QAAQ,EAAE;QAC/D,MAAM,IAAIC,MAAM,oEAAoE;IACxF;IACA,IAAIC,IAAAA,gCAAe,EAACP,QAAQ;QACxB,MAAMQ,aAAaT,iBAAiBC,MAAMS,KAAK,CAACZ,QAAQ,EAAEI;QAC1D,qBAAOC,OAAMQ,YAAY,CAACV,OAAOW,WAAWH;IAChD,OAAO;QACH,qBAAON,OAAMQ,YAAY,CAACV,OAAOC;IACrC;AACJ"}
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "getTriggerChild", {
6
6
  enumerable: true,
7
- get: ()=>getTriggerChild
7
+ get: function() {
8
+ return getTriggerChild;
9
+ }
8
10
  });
9
- const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
11
13
  const _isFluentTrigger = require("./isFluentTrigger");
12
14
  function getTriggerChild(children) {
13
15
  if (!/*#__PURE__*/ _react.isValidElement(children)) {