@itwin/core-react 4.13.2 → 4.13.4

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 (197) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/lib/cjs/core-react/UiCore.js +1 -1
  3. package/lib/cjs/core-react/UiCore.js.map +1 -1
  4. package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
  5. package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts +5 -9
  6. package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts.map +1 -1
  7. package/lib/cjs/core-react/button/UnderlinedButton.js.map +1 -1
  8. package/lib/cjs/core-react/contextmenu/ContextMenu.js +1 -1
  9. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  10. package/lib/cjs/core-react/contextmenu/ContextMenuDirection.js +1 -1
  11. package/lib/cjs/core-react/contextmenu/ContextMenuDirection.js.map +1 -1
  12. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +1 -1
  13. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  14. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +1 -1
  15. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  16. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  17. package/lib/cjs/core-react/contextmenu/PopupContextMenu.js.map +1 -1
  18. package/lib/cjs/core-react/contextmenu/TildeFinder.js +1 -1
  19. package/lib/cjs/core-react/contextmenu/TildeFinder.js.map +1 -1
  20. package/lib/cjs/core-react/dialog/Dialog.js +2 -2
  21. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  22. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  23. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  24. package/lib/cjs/core-react/enums/Alignment.js +2 -2
  25. package/lib/cjs/core-react/enums/Alignment.js.map +1 -1
  26. package/lib/cjs/core-react/enums/CheckBoxState.js +1 -1
  27. package/lib/cjs/core-react/enums/CheckBoxState.js.map +1 -1
  28. package/lib/cjs/core-react/enums/Orientation.js +1 -1
  29. package/lib/cjs/core-react/enums/Orientation.js.map +1 -1
  30. package/lib/cjs/core-react/enums/SortDirection.js +1 -1
  31. package/lib/cjs/core-react/enums/SortDirection.js.map +1 -1
  32. package/lib/cjs/core-react/enums/TimeFormat.js +1 -1
  33. package/lib/cjs/core-react/enums/TimeFormat.js.map +1 -1
  34. package/lib/cjs/core-react/expandable/ExpandableList.js +1 -1
  35. package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
  36. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  37. package/lib/cjs/core-react/focustrap/FocusTrap.js.map +1 -1
  38. package/lib/cjs/core-react/hocs/withIsPressed.d.ts +5 -9
  39. package/lib/cjs/core-react/hocs/withIsPressed.d.ts.map +1 -1
  40. package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts +5 -9
  41. package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
  42. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  43. package/lib/cjs/core-react/hocs/withTimeout.d.ts +5 -9
  44. package/lib/cjs/core-react/hocs/withTimeout.d.ts.map +1 -1
  45. package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -1
  46. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  47. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  48. package/lib/cjs/core-react/inputs/Input.d.ts +1 -1
  49. package/lib/cjs/core-react/inputs/Input.d.ts.map +1 -1
  50. package/lib/cjs/core-react/inputs/Input.js.map +1 -1
  51. package/lib/cjs/core-react/inputs/InputStatus.js +1 -1
  52. package/lib/cjs/core-react/inputs/InputStatus.js.map +1 -1
  53. package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts +1 -1
  54. package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts.map +1 -1
  55. package/lib/cjs/core-react/inputs/iconinput/IconInput.js.map +1 -1
  56. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +1 -1
  57. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  58. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  59. package/lib/cjs/core-react/l10n/usePackageTranslation.js.map +1 -1
  60. package/lib/cjs/core-react/l10n/useTranslation.js.map +1 -1
  61. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  62. package/lib/cjs/core-react/loading/LoadingBar.js +1 -1
  63. package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
  64. package/lib/cjs/core-react/loading/LoadingPrompt.js +1 -1
  65. package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
  66. package/lib/cjs/core-react/loading/LoadingSpinner.js +1 -1
  67. package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
  68. package/lib/cjs/core-react/loading/LoadingStatus.js +1 -1
  69. package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
  70. package/lib/cjs/core-react/messagebox/MessageBox.js +1 -1
  71. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  72. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  73. package/lib/cjs/core-react/popup/Popup.js +1 -1
  74. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  75. package/lib/cjs/core-react/radialmenu/RadialMenu.js +2 -2
  76. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  77. package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
  78. package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
  79. package/lib/cjs/core-react/settings/SettingsManager.js.map +1 -1
  80. package/lib/cjs/core-react/tabs/Tabs.js.map +1 -1
  81. package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
  82. package/lib/cjs/core-react/tree/Node.d.ts +1 -1
  83. package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
  84. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  85. package/lib/cjs/core-react/tree/Tree.js.map +1 -1
  86. package/lib/cjs/core-react/uistate/UiStateEntry.js.map +1 -1
  87. package/lib/cjs/core-react/uistate/UiStateStorage.js +1 -1
  88. package/lib/cjs/core-react/uistate/UiStateStorage.js.map +1 -1
  89. package/lib/cjs/core-react/utils/IconHelper.js.map +1 -1
  90. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  91. package/lib/cjs/core-react/utils/Rectangle.js +1 -1
  92. package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
  93. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  94. package/lib/cjs/core-react/utils/flattenChildren.js.map +1 -1
  95. package/lib/cjs/core-react/utils/getUserColor.js.map +1 -1
  96. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  97. package/lib/cjs/core-react/utils/hooks/useDisposable.js.map +1 -1
  98. package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.js.map +1 -1
  99. package/lib/cjs/core-react/utils/hooks/useEventListener.js.map +1 -1
  100. package/lib/cjs/core-react/utils/hooks/useInterval.js.map +1 -1
  101. package/lib/cjs/core-react/utils/hooks/useLifecycleLogging.js.map +1 -1
  102. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.js.map +1 -1
  103. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  104. package/lib/cjs/core-react/utils/hooks/useRefs.js.map +1 -1
  105. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  106. package/lib/cjs/core-react/utils/reuseOrCreatePromise.js.map +1 -1
  107. package/lib/cjs/core-react/utils/shallowDiffers.js.map +1 -1
  108. package/lib/esm/core-react/UiCore.js +1 -2
  109. package/lib/esm/core-react/UiCore.js.map +1 -1
  110. package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
  111. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts +5 -9
  112. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts.map +1 -1
  113. package/lib/esm/core-react/button/UnderlinedButton.js.map +1 -1
  114. package/lib/esm/core-react/contextmenu/ContextMenu.js +1 -2
  115. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  116. package/lib/esm/core-react/contextmenu/ContextMenuItem.js +1 -2
  117. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  118. package/lib/esm/core-react/contextmenu/ContextSubMenu.js +1 -2
  119. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  120. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  121. package/lib/esm/core-react/contextmenu/PopupContextMenu.js.map +1 -1
  122. package/lib/esm/core-react/contextmenu/TildeFinder.js +1 -2
  123. package/lib/esm/core-react/contextmenu/TildeFinder.js.map +1 -1
  124. package/lib/esm/core-react/dialog/Dialog.js +1 -2
  125. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  126. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  127. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  128. package/lib/esm/core-react/expandable/ExpandableList.js +1 -2
  129. package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
  130. package/lib/esm/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  131. package/lib/esm/core-react/focustrap/FocusTrap.js.map +1 -1
  132. package/lib/esm/core-react/hocs/withIsPressed.d.ts +5 -9
  133. package/lib/esm/core-react/hocs/withIsPressed.d.ts.map +1 -1
  134. package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts +5 -9
  135. package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
  136. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  137. package/lib/esm/core-react/hocs/withTimeout.d.ts +5 -9
  138. package/lib/esm/core-react/hocs/withTimeout.d.ts.map +1 -1
  139. package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -1
  140. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  141. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  142. package/lib/esm/core-react/inputs/Input.d.ts +1 -1
  143. package/lib/esm/core-react/inputs/Input.d.ts.map +1 -1
  144. package/lib/esm/core-react/inputs/Input.js.map +1 -1
  145. package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts +1 -1
  146. package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts.map +1 -1
  147. package/lib/esm/core-react/inputs/iconinput/IconInput.js.map +1 -1
  148. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +1 -1
  149. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  150. package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  151. package/lib/esm/core-react/l10n/usePackageTranslation.js.map +1 -1
  152. package/lib/esm/core-react/l10n/useTranslation.js.map +1 -1
  153. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  154. package/lib/esm/core-react/loading/LoadingBar.js +1 -2
  155. package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
  156. package/lib/esm/core-react/loading/LoadingPrompt.js +1 -2
  157. package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
  158. package/lib/esm/core-react/loading/LoadingSpinner.js +1 -2
  159. package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
  160. package/lib/esm/core-react/loading/LoadingStatus.js +1 -2
  161. package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
  162. package/lib/esm/core-react/messagebox/MessageBox.js +1 -2
  163. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  164. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  165. package/lib/esm/core-react/popup/Popup.js +1 -2
  166. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  167. package/lib/esm/core-react/radialmenu/RadialMenu.js +2 -3
  168. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  169. package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
  170. package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
  171. package/lib/esm/core-react/settings/SettingsManager.js.map +1 -1
  172. package/lib/esm/core-react/tabs/Tabs.js.map +1 -1
  173. package/lib/esm/core-react/text/FilteredText.js.map +1 -1
  174. package/lib/esm/core-react/tree/Node.d.ts +1 -1
  175. package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
  176. package/lib/esm/core-react/tree/Node.js.map +1 -1
  177. package/lib/esm/core-react/tree/Tree.js.map +1 -1
  178. package/lib/esm/core-react/uistate/UiStateEntry.js.map +1 -1
  179. package/lib/esm/core-react/utils/IconHelper.js.map +1 -1
  180. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  181. package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
  182. package/lib/esm/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  183. package/lib/esm/core-react/utils/flattenChildren.js.map +1 -1
  184. package/lib/esm/core-react/utils/getUserColor.js.map +1 -1
  185. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  186. package/lib/esm/core-react/utils/hooks/useDisposable.js.map +1 -1
  187. package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.js.map +1 -1
  188. package/lib/esm/core-react/utils/hooks/useEventListener.js.map +1 -1
  189. package/lib/esm/core-react/utils/hooks/useInterval.js.map +1 -1
  190. package/lib/esm/core-react/utils/hooks/useLifecycleLogging.js.map +1 -1
  191. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.js.map +1 -1
  192. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  193. package/lib/esm/core-react/utils/hooks/useRefs.js.map +1 -1
  194. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  195. package/lib/esm/core-react/utils/reuseOrCreatePromise.js.map +1 -1
  196. package/lib/esm/core-react/utils/shallowDiffers.js.map +1 -1
  197. package/package.json +11 -13
@@ -1 +1 @@
1
- {"version":3,"file":"getUserColor.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getUserColor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,MAAM,MAAM,GAAG;IACb,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,wBAAwB;QACxB,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IAEnB,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE/C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;KAC1C;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nconst COLORS = [\n \"#6ab9ec\",\n \"#b1c854\",\n \"#f7706c\",\n \"#4585a5\",\n \"#ffc335\",\n \"#f7963e\",\n \"#73c7c1\",\n \"#85a9cf\",\n \"#a3779f\",\n \"#c8c2b4\",\n \"#a47854\",\n];\n\n/** Gets a color based on a given email address. This color is usually displayed in an avatar component.\n * @internal\n */\nexport function getUserColor(email: string): string {\n if (typeof email !== \"string\")\n // Test for invalid data\n return COLORS[0];\n\n const cleanString = email.trim().toLowerCase();\n\n let hash = 0;\n for (let i = 0; i < cleanString.length; i++) {\n const charCode = cleanString.charCodeAt(i);\n hash = (hash + charCode) % COLORS.length;\n }\n return COLORS[hash];\n}\n"]}
1
+ {"version":3,"file":"getUserColor.js","sourceRoot":"","sources":["../../../../src/core-react/utils/getUserColor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,MAAM,MAAM,GAAG;IACb,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,wBAAwB;QACxB,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IAEnB,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE/C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nconst COLORS = [\n \"#6ab9ec\",\n \"#b1c854\",\n \"#f7706c\",\n \"#4585a5\",\n \"#ffc335\",\n \"#f7963e\",\n \"#73c7c1\",\n \"#85a9cf\",\n \"#a3779f\",\n \"#c8c2b4\",\n \"#a47854\",\n];\n\n/** Gets a color based on a given email address. This color is usually displayed in an avatar component.\n * @internal\n */\nexport function getUserColor(email: string): string {\n if (typeof email !== \"string\")\n // Test for invalid data\n return COLORS[0];\n\n const cleanString = email.trim().toLowerCase();\n\n let hash = 0;\n for (let i = 0; i < cleanString.length; i++) {\n const charCode = cleanString.charCodeAt(i);\n hash = (hash + charCode) % COLORS.length;\n }\n return COLORS[hash];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useCrossOriginPopup.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useCrossOriginPopup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,GAAuB,EACvB,KAAa,EACb,KAAa,EACb,MAAc,EACd,OAAmB;IAEnB,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAEnE,CAAC;IAEJ,gHAAgH;IAChH,oCAAoC;IACpC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,EAAU,CAAC;IAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,YAAY,GAAG,KAAK,CAAC,M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;QACtE,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE;YACjD,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAE5B,iBAAiB,EAAE,CAAC;SACrB;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\nimport { useInterval } from \"./useInterval\";\n\n/** Hook that will show a popup window\n * @public\n */\nexport function useCrossOriginPopup(\n visible: boolean,\n url: string | undefined,\n title: string,\n width: number,\n height: number,\n onClose: () => void\n) {\n const [checkPopupAliveDelay, setCheckPopupAliveDelay] = React.useState<\n number | undefined\n >();\n\n // ONLY re-render the popup when visibility changes, any other changes get deferred until next visibility change\n // hence the massive use of 'useRef'\n const popupWindow = React.useRef<Window>();\n const savedUrl = React.useRef(url);\n const savedTitle = React.useRef(title);\n const savedWidth = React.useRef(width);\n const savedHeight = React.useRef(height);\n const savedOnClose = React.useRef(onClose);\n\n React.useEffect(() => {\n savedUrl.current = url;\n }, [url]);\n React.useEffect(() => {\n savedTitle.current = title;\n }, [title]);\n React.useEffect(() => {\n savedWidth.current = width;\n }, [width]);\n React.useEffect(() => {\n savedHeight.current = height;\n }, [height]);\n React.useEffect(() => {\n savedOnClose.current = onClose;\n }, [onClose]);\n\n // Cleanup method after a popup closure. Also calls the OnClose callback.\n const handleClosedPopup = React.useCallback(() => {\n savedOnClose.current();\n setCheckPopupAliveDelay(undefined);\n popupWindow.current = undefined;\n }, []);\n\n const closePopup = React.useCallback(() => {\n if (popupWindow.current !== undefined) {\n popupWindow.current.close(); // Manually close the popup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n const checkPopupClosed = React.useCallback(() => {\n if (popupWindow.current?.closed) {\n // Popup has been closed by end-user, inform our host and cleanup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n // Close popup when parent window get closed\n React.useEffect(() => {\n window.onbeforeunload = (_event) => {\n closePopup();\n };\n return () => {\n window.onbeforeunload = null;\n };\n }, [closePopup]);\n\n // Whenever the hook is unloaded, make sure the underlying popup get closed.\n // Note: An interval is used to check if popup was closed by user: because we access\n // a cross domain resource inside the popup, we don't have access to popup window events.\n // As a workaround, we periodically check if popup is still alive.\n // Reference: https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128\n React.useEffect(() => {\n return () => {\n closePopup();\n };\n }, [closePopup]);\n\n // Timer that checks if popup was closed by end-user\n useInterval(checkPopupClosed, checkPopupAliveDelay);\n\n // ==> Main render effect\n // Monitors visibility changes and open/close the popup accordingly.\n React.useEffect(() => {\n // If visible and a popup window is not already open, open a new popup window\n if (visible && popupWindow.current === undefined) {\n const popup = window.open(\n savedUrl.current,\n savedTitle.current,\n `width=${savedWidth.current},height=${savedHeight.current}`\n );\n if (popup) {\n popup.focus();\n popupWindow.current = popup;\n\n // Start and interval that will check if popup got closed by user\n setCheckPopupAliveDelay(1000);\n }\n }\n\n // If not visible but a previous popup window is still open, close it.\n if (!visible && popupWindow.current !== undefined) {\n popupWindow.current.close();\n\n handleClosedPopup();\n }\n }, [handleClosedPopup, visible]);\n}\n"]}
1
+ {"version":3,"file":"useCrossOriginPopup.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useCrossOriginPopup.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,GAAuB,EACvB,KAAa,EACb,KAAa,EACb,MAAc,EACd,OAAmB;IAEnB,MAAM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BAAyB;IACzB,oEAAoE;IACpE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,6EAA6E;QAC7E,IAAI,OAAO,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YACjD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CACvB,QAAQ,CAAC,OAAO,EAChB,UAAU,CAAC,OAAO,EAClB,SAAS,UAAU,CAAC,OAAO,WAAW,WAAW,CAAC,OAAO,EAAE,CAC5D,CAAC;YACF,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;gBAE5B,iEAAiE;gBACjE,uBAAuB,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAED,sEAAsE;QACtE,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClD,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAE5B,iBAAiB,EAAE,CAAC;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\nimport { useInterval } from \"./useInterval\";\n\n/** Hook that will show a popup window\n * @public\n */\nexport function useCrossOriginPopup(\n visible: boolean,\n url: string | undefined,\n title: string,\n width: number,\n height: number,\n onClose: () => void\n) {\n const [checkPopupAliveDelay, setCheckPopupAliveDelay] = React.useState<\n number | undefined\n >();\n\n // ONLY re-render the popup when visibility changes, any other changes get deferred until next visibility change\n // hence the massive use of 'useRef'\n const popupWindow = React.useRef<Window>();\n const savedUrl = React.useRef(url);\n const savedTitle = React.useRef(title);\n const savedWidth = React.useRef(width);\n const savedHeight = React.useRef(height);\n const savedOnClose = React.useRef(onClose);\n\n React.useEffect(() => {\n savedUrl.current = url;\n }, [url]);\n React.useEffect(() => {\n savedTitle.current = title;\n }, [title]);\n React.useEffect(() => {\n savedWidth.current = width;\n }, [width]);\n React.useEffect(() => {\n savedHeight.current = height;\n }, [height]);\n React.useEffect(() => {\n savedOnClose.current = onClose;\n }, [onClose]);\n\n // Cleanup method after a popup closure. Also calls the OnClose callback.\n const handleClosedPopup = React.useCallback(() => {\n savedOnClose.current();\n setCheckPopupAliveDelay(undefined);\n popupWindow.current = undefined;\n }, []);\n\n const closePopup = React.useCallback(() => {\n if (popupWindow.current !== undefined) {\n popupWindow.current.close(); // Manually close the popup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n const checkPopupClosed = React.useCallback(() => {\n if (popupWindow.current?.closed) {\n // Popup has been closed by end-user, inform our host and cleanup\n handleClosedPopup();\n }\n }, [handleClosedPopup]);\n\n // Close popup when parent window get closed\n React.useEffect(() => {\n window.onbeforeunload = (_event) => {\n closePopup();\n };\n return () => {\n window.onbeforeunload = null;\n };\n }, [closePopup]);\n\n // Whenever the hook is unloaded, make sure the underlying popup get closed.\n // Note: An interval is used to check if popup was closed by user: because we access\n // a cross domain resource inside the popup, we don't have access to popup window events.\n // As a workaround, we periodically check if popup is still alive.\n // Reference: https://stackoverflow.com/questions/9388380/capture-the-close-event-of-popup-window-in-javascript/48240128#48240128\n React.useEffect(() => {\n return () => {\n closePopup();\n };\n }, [closePopup]);\n\n // Timer that checks if popup was closed by end-user\n useInterval(checkPopupClosed, checkPopupAliveDelay);\n\n // ==> Main render effect\n // Monitors visibility changes and open/close the popup accordingly.\n React.useEffect(() => {\n // If visible and a popup window is not already open, open a new popup window\n if (visible && popupWindow.current === undefined) {\n const popup = window.open(\n savedUrl.current,\n savedTitle.current,\n `width=${savedWidth.current},height=${savedHeight.current}`\n );\n if (popup) {\n popup.focus();\n popupWindow.current = popup;\n\n // Start and interval that will check if popup got closed by user\n setCheckPopupAliveDelay(1000);\n }\n }\n\n // If not visible but a previous popup window is still open, close it.\n if (!visible && popupWindow.current !== undefined) {\n popupWindow.current.close();\n\n handleClosedPopup();\n }\n }, [handleClosedPopup, visible]);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useDisposable.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGpD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,gBAAmC;IAEnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7D,0FAA0F;IAC1F,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,qFAAqF;QACrF,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;YAC5B,SAAS,CAAC,OAAO,GAAG,gBAAgB,EAAE,CAAC;YACvC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SAC7B;QAED,eAAe,CAAC,OAAO,GAAG,KAAK,CAAC;QAChC,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,gBAA+C;IAE/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAA2B,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;QACtC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACrB,OAAO,GAAG,EAAE;YACV,UAAU,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACrC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { useEffect, useRef, useState } from \"react\";\nimport type { IDisposable } from \"@itwin/core-bentley\";\n\n/**\n * A custom hook which creates a disposable object and manages its disposal on unmount\n * or factory method change.\n * @public\n * @deprecated in 4.9.0. This hook is not compatible with React 18 Strict mode. Use [[useOptionalDisposable]] or `useState` + `useEffect` for\n * creating and disposing disposable resources.\n */\nexport function useDisposable<TDisposable extends IDisposable>(\n createDisposable: () => TDisposable\n): TDisposable {\n const [value, setValue] = useState(() => createDisposable());\n // need to capture initial disposable created during render loop in order to dispose later\n const prevValue = useRef(value);\n const useInitialValue = useRef(true);\n\n useEffect(() => {\n // do not create new disposable on initial render. It was created during render loop.\n if (!useInitialValue.current) {\n prevValue.current = createDisposable();\n setValue(prevValue.current);\n }\n\n useInitialValue.current = false;\n return () => {\n prevValue.current.dispose();\n };\n }, [createDisposable]);\n\n return value;\n}\n\n/**\n * A custom hook which calls the factory method to create a disposable object\n * which might as well be undefined. If the result was a disposable object, the\n * hook takes care of disposing it when necessary.\n * @public\n */\nexport function useOptionalDisposable<TDisposable extends IDisposable>(\n createDisposable: () => TDisposable | undefined\n): TDisposable | undefined {\n const [value, setValue] = useState<TDisposable | undefined>();\n\n useEffect(() => {\n const disposable = createDisposable();\n setValue(disposable);\n return () => {\n disposable && disposable.dispose();\n };\n }, [createDisposable]);\n\n return value;\n}\n"]}
1
+ {"version":3,"file":"useDisposable.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useDisposable.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGpD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,gBAAmC;IAEnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7D,0FAA0F;IAC1F,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,qFAAqF;QACrF,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;YAC7B,SAAS,CAAC,OAAO,GAAG,gBAAgB,EAAE,CAAC;YACvC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QAED,eAAe,CAAC,OAAO,GAAG,KAAK,CAAC;QAChC,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,gBAA+C;IAE/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAA2B,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;QACtC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACrB,OAAO,GAAG,EAAE;YACV,UAAU,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACrC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { useEffect, useRef, useState } from \"react\";\nimport type { IDisposable } from \"@itwin/core-bentley\";\n\n/**\n * A custom hook which creates a disposable object and manages its disposal on unmount\n * or factory method change.\n * @public\n * @deprecated in 4.9.0. This hook is not compatible with React 18 Strict mode. Use [[useOptionalDisposable]] or `useState` + `useEffect` for\n * creating and disposing disposable resources.\n */\nexport function useDisposable<TDisposable extends IDisposable>(\n createDisposable: () => TDisposable\n): TDisposable {\n const [value, setValue] = useState(() => createDisposable());\n // need to capture initial disposable created during render loop in order to dispose later\n const prevValue = useRef(value);\n const useInitialValue = useRef(true);\n\n useEffect(() => {\n // do not create new disposable on initial render. It was created during render loop.\n if (!useInitialValue.current) {\n prevValue.current = createDisposable();\n setValue(prevValue.current);\n }\n\n useInitialValue.current = false;\n return () => {\n prevValue.current.dispose();\n };\n }, [createDisposable]);\n\n return value;\n}\n\n/**\n * A custom hook which calls the factory method to create a disposable object\n * which might as well be undefined. If the result was a disposable object, the\n * hook takes care of disposing it when necessary.\n * @public\n */\nexport function useOptionalDisposable<TDisposable extends IDisposable>(\n createDisposable: () => TDisposable | undefined\n): TDisposable | undefined {\n const [value, setValue] = useState<TDisposable | undefined>();\n\n useEffect(() => {\n const disposable = createDisposable();\n setValue(disposable);\n return () => {\n disposable && disposable.dispose();\n };\n }, [createDisposable]);\n\n return value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useEffectSkipFirst.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useEffectSkipFirst.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAwD,EACxD,IAAY;IAEZ,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,CAAC,OAAO,EAAE;YACrB,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;YAC1B,OAAO;SACR;QAED,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,kDAAkD;AAC9D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { useEffect, useRef } from \"react\";\n\n/**\n * Custom hook which works like useEffect hook, but does not invoke callback when effect is triggered for the first time.\n * @public\n */\nexport function useEffectSkipFirst(\n callback: () => (void | (() => void | undefined)) | void,\n deps?: any[]\n) {\n const skipFirst = useRef(true);\n\n useEffect(() => {\n if (skipFirst.current) {\n skipFirst.current = false;\n return;\n }\n\n return callback();\n }, deps); // eslint-disable-line react-hooks/exhaustive-deps\n}\n"]}
1
+ {"version":3,"file":"useEffectSkipFirst.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useEffectSkipFirst.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAwD,EACxD,IAAY;IAEZ,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,kDAAkD;AAC9D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport { useEffect, useRef } from \"react\";\n\n/**\n * Custom hook which works like useEffect hook, but does not invoke callback when effect is triggered for the first time.\n * @public\n */\nexport function useEffectSkipFirst(\n callback: () => (void | (() => void | undefined)) | void,\n deps?: any[]\n) {\n const skipFirst = useRef(true);\n\n useEffect(() => {\n if (skipFirst.current) {\n skipFirst.current = false;\n return;\n }\n\n return callback();\n }, deps); // eslint-disable-line react-hooks/exhaustive-deps\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useEventListener.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useEventListener.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,OAA+B,EAC/B,OAA2C;IAE3C,kEAAkE;IAClE,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA0B,CAAC;IAE5D,uEAAuE;IACvE,+EAA+E;IAC/E,uDAAuD;IACvD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IACjC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,MAAM,aAAa,GAAG,CAAC,KAAY,EAAE,EAAE;YACrC,uBAAuB;YACvB,IAAI,YAAY,CAAC,OAAO;gBAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACxD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\n\n/**\n * Hook that adds and removes Event listeners.\n * @example\n * useEventListener(\n * 'pointerup',\n * handlePointerUp,\n * containerRef.current?.ownerDocument,\n * );\n * @internal\n */\nexport function useEventListener(\n eventName: string,\n handler: (event: Event) => void,\n element: HTMLElement | Document | undefined\n) {\n // Based on published hook https://usehooks.com/useEventListener/.\n const savedHandler = React.useRef<(event: Event) => void>();\n\n // Update reference if handler changes. This allows our effect below to\n // always use latest handler without us needing to pass it in effect deps array\n // and potentially cause effect to re-run every render.\n React.useEffect(() => {\n savedHandler.current = handler;\n }, [handler]);\n\n React.useEffect(() => {\n if (!element) {\n return;\n }\n\n const eventListener = (event: Event) => {\n // istanbul ignore else\n if (savedHandler.current) savedHandler.current(event);\n };\n element.addEventListener(eventName, eventListener);\n return () => {\n element.removeEventListener(eventName, eventListener);\n };\n }, [eventName, element]);\n}\n"]}
1
+ {"version":3,"file":"useEventListener.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useEventListener.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,OAA+B,EAC/B,OAA2C;IAE3C,kEAAkE;IAClE,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA0B,CAAC;IAE5D,uEAAuE;IACvE,+EAA+E;IAC/E,uDAAuD;IACvD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IACjC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAAG,CAAC,KAAY,EAAE,EAAE;YACrC,uBAAuB;YACvB,IAAI,YAAY,CAAC,OAAO;gBAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;QACF,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACxD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\n\n/**\n * Hook that adds and removes Event listeners.\n * @example\n * useEventListener(\n * 'pointerup',\n * handlePointerUp,\n * containerRef.current?.ownerDocument,\n * );\n * @internal\n */\nexport function useEventListener(\n eventName: string,\n handler: (event: Event) => void,\n element: HTMLElement | Document | undefined\n) {\n // Based on published hook https://usehooks.com/useEventListener/.\n const savedHandler = React.useRef<(event: Event) => void>();\n\n // Update reference if handler changes. This allows our effect below to\n // always use latest handler without us needing to pass it in effect deps array\n // and potentially cause effect to re-run every render.\n React.useEffect(() => {\n savedHandler.current = handler;\n }, [handler]);\n\n React.useEffect(() => {\n if (!element) {\n return;\n }\n\n const eventListener = (event: Event) => {\n // istanbul ignore else\n if (savedHandler.current) savedHandler.current(event);\n };\n element.addEventListener(eventName, eventListener);\n return () => {\n element.removeEventListener(eventName, eventListener);\n };\n }, [eventName, element]);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useInterval.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useInterval.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,QAAkC,EAClC,KAAyB;IAEzB,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA2B,QAAQ,CAAC,CAAC;IAEvE,gCAAgC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAC;IACnC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,uBAAuB;IACvB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,SAAS,IAAI;YACX,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACpC,OAAO,GAAG,EAAE;gBACV,aAAa,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC,CAAC;SACH;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\nimport * as React from \"react\";\n\n/** Hook that create an interval and clears it when unloaded\n * Reference: https://github.com/gaearon/overreacted.io/blob/master/src/pages/making-setinterval-declarative-with-react-hooks/index.md\n * @beta\n */\nexport function useInterval(\n callback: (...args: any[]) => void,\n delay: number | undefined\n) {\n const savedCallback = React.useRef<(...args: any[]) => void>(callback);\n\n // Remember the latest function.\n React.useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n // Set up the interval.\n React.useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== undefined) {\n const id = setInterval(tick, delay);\n return () => {\n clearInterval(id);\n };\n } else {\n return undefined;\n }\n }, [delay]);\n}\n"]}
1
+ {"version":3,"file":"useInterval.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useInterval.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,QAAkC,EAClC,KAAyB;IAEzB,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA2B,QAAQ,CAAC,CAAC;IAEvE,gCAAgC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAC;IACnC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,uBAAuB;IACvB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,SAAS,IAAI;YACX,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACpC,OAAO,GAAG,EAAE;gBACV,aAAa,CAAC,EAAE,CAAC,CAAC;YACpB,CAAC,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\nimport * as React from \"react\";\n\n/** Hook that create an interval and clears it when unloaded\n * Reference: https://github.com/gaearon/overreacted.io/blob/master/src/pages/making-setinterval-declarative-with-react-hooks/index.md\n * @beta\n */\nexport function useInterval(\n callback: (...args: any[]) => void,\n delay: number | undefined\n) {\n const savedCallback = React.useRef<(...args: any[]) => void>(callback);\n\n // Remember the latest function.\n React.useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n // Set up the interval.\n React.useEffect(() => {\n function tick() {\n savedCallback.current();\n }\n if (delay !== undefined) {\n const id = setInterval(tick, delay);\n return () => {\n clearInterval(id);\n };\n } else {\n return undefined;\n }\n }, [delay]);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useLifecycleLogging.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useLifecycleLogging.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,KAA0B,EAC1B,OAA6B;IAE7B,SAAS,CAAC,GAAG,EAAE;QACb,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,sBAAsB,CAAC,CAAC;QAEnE,OAAO,GAAG,EAAE;YACV,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,wBAAwB,CAAC,CAAC;QACvE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kDAAkD;IAE1D,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IA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I,mBAAmB,EAClD,SAAS,CACV,CAAC;SACH;aAAM,IAAI,WAAW,CAAC,OAAO,KAAK,OAAO,EAAE;YAC1C,sCAAsC;YACtC,OAAO,CAAC,GAAG,CACT,2BAA2B,IAAI,qBAAqB,EACpD,WAAW,CACZ,CAAC;SACH;aAAM;YACL,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,0BAA0B,CAAC,CAAC;SACxE;QAED,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { useEffect, useRef } from \"react\";\n\n/**\n * Logs to console information about component lifecycle: mounting, re-rendering and unmounting.\n * @internal\n */\nexport function useLifecycleLogging(\n name: string,\n props: Record<string, any>,\n context?: Record<string, any>\n) {\n useEffect(() => {\n // eslint-disable-next-line no-console\n console.log(`[useLifecycleLogging]: '${name}' Component mounted.`);\n\n return () => {\n // eslint-disable-next-line no-console\n console.log(`[useLifecycleLogging]: '${name}' Component unmounted.`);\n };\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const prevProps = useRef(props);\n const prevContext = useRef(context);\n const firstRun = useRef(true);\n useEffect(() => {\n if (firstRun.current) {\n firstRun.current = false;\n return;\n }\n\n function getDiff(\n prev: Record<string, any>,\n current: Record<string, any>\n ): Record<string, any> {\n const diff: Record<string, { from: any; to: any }> = {};\n for (const key of Object.keys(current)) {\n if (prev[key] !== current[key]) {\n diff[key] = {\n from: prev[key],\n to: current[key],\n };\n }\n }\n\n return diff;\n }\n\n const propsDiff = getDiff(prevProps.current, props);\n const contextDiff = {\n from: context === undefined ? context : prevContext.current,\n to: context,\n };\n\n if (Object.keys(propsDiff).length > 0 && prevContext.current !== context) {\n // eslint-disable-next-line no-console\n console.log(\n `[useLifecycleLogging]: '${name}' Props and context changed: `,\n propsDiff,\n contextDiff\n );\n } else if (Object.keys(propsDiff).length > 0) {\n // eslint-disable-next-line no-console\n console.log(\n `[useLifecycleLogging]: '${name}' Props changed: `,\n propsDiff\n );\n } else if (prevContext.current !== context) {\n // eslint-disable-next-line no-console\n console.log(\n `[useLifecycleLogging]: '${name}' Context changed: `,\n contextDiff\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(`[useLifecycleLogging]: '${name}' Component re-rendered.`);\n }\n\n prevProps.current = props;\n prevContext.current = context;\n });\n}\n"]}
1
+ {"version":3,"file":"useLifecycleLogging.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useLifecycleLogging.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,KAA0B,EAC1B,OAA6B;IAE7B,SAAS,CAAC,GAAG,EAAE;QACb,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,sBAAsB,CAAC,CAAC;QAEnE,OAAO,GAAG,EAAE;YACV,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,wBAAwB,CAAC,CAAC;QACvE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kDAAkD;IAE1D,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;YACzB,OAAO;QACT,CAAC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C;QACJ,CAAC;aAAM,CAAC;YACN,sCAAsC;YACtC,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,0BAA0B,CAAC,CAAC;QACzE,CAAC;QAED,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { useEffect, useRef } from \"react\";\n\n/**\n * Logs to console information about component lifecycle: mounting, re-rendering and unmounting.\n * @internal\n */\nexport function useLifecycleLogging(\n name: string,\n props: Record<string, any>,\n context?: Record<string, any>\n) {\n useEffect(() => {\n // eslint-disable-next-line no-console\n console.log(`[useLifecycleLogging]: '${name}' Component mounted.`);\n\n return () => {\n // eslint-disable-next-line no-console\n console.log(`[useLifecycleLogging]: '${name}' Component unmounted.`);\n };\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const prevProps = useRef(props);\n const prevContext = useRef(context);\n const firstRun = useRef(true);\n useEffect(() => {\n if (firstRun.current) {\n firstRun.current = false;\n return;\n }\n\n function getDiff(\n prev: Record<string, any>,\n current: Record<string, any>\n ): Record<string, any> {\n const diff: Record<string, { from: any; to: any }> = {};\n for (const key of Object.keys(current)) {\n if (prev[key] !== current[key]) {\n diff[key] = {\n from: prev[key],\n to: current[key],\n };\n }\n }\n\n return diff;\n }\n\n const propsDiff = getDiff(prevProps.current, props);\n const contextDiff = {\n from: context === undefined ? context : prevContext.current,\n to: context,\n };\n\n if (Object.keys(propsDiff).length > 0 && prevContext.current !== context) {\n // eslint-disable-next-line no-console\n console.log(\n `[useLifecycleLogging]: '${name}' Props and context changed: `,\n propsDiff,\n contextDiff\n );\n } else if (Object.keys(propsDiff).length > 0) {\n // eslint-disable-next-line no-console\n console.log(\n `[useLifecycleLogging]: '${name}' Props changed: `,\n propsDiff\n );\n } else if (prevContext.current !== context) {\n // eslint-disable-next-line no-console\n console.log(\n `[useLifecycleLogging]: '${name}' Context changed: `,\n contextDiff\n );\n } else {\n // eslint-disable-next-line no-console\n console.log(`[useLifecycleLogging]: '${name}' Component re-rendered.`);\n }\n\n prevProps.current = props;\n prevContext.current = context;\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useOnOutsideClick.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useOnOutsideClick.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,cAA2B;AAC3B,gFAAgF;AAChF,qBAAyD;IAEzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAI,IAAI,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,QAAQ,GAAG,CAAC,CAAoB,EAAE,EAAE;YACxC,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,EAAE;gBAC3B,+CAA+C;gBAC/C,iBAAiB,CAAC,OAAO,GAAG,KAAK,CAAC;gBAClC,sBAAsB,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;aACxC;iBAAM,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,iBAAiB,C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,CAAC,CAAC,MAAM,YAAY,IAAI;gBACxB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;gBAC/B,cAAc,EAAE,CAAC;YACnB,aAAa,CAAC,OAAO,GAAG,KAAK,CAAC;QAChC,CAAC,CAAC;QACF,IAAI,uBAAuB,EAAE,EAAE;YAC7B,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;SAClD;aAAM;YACL,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC/C,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;SACjD;QACD,OAAO,GAAG,EAAE;YACV,IAAI,uBAAuB,EAAE,EAAE;gBAC7B,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;aACrD;iBAAM;gBACL,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAClD,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;aACpD;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC5C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,QAAQ,GAAG,GAAG,EAAE;YACpB,iBAAiB,CAAC,OAAO,GAAG,IAAI,CAAC;QACnC,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,sBAAsB,CAAC,OAAO,CAAC;QAC7C,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\nimport { hasPointerEventsSupport } from \"../../base/PointerEvents\";\nimport { Timer } from \"../Timer\";\n\n/** @public */\nexport type OutsideClickEvent = PointerEvent | MouseEvent | TouchEvent;\n\n/** Invokes onOutsideClick handler when user clicks outside of referenced element.\n * @public\n */\nexport function useOnOutsideClick<T extends Element>(\n onOutsideClick?: () => void,\n /** Invoked for intermediate events. Return `false` to prevent outside click. */\n outsideEventPredicate?: (e: OutsideClickEvent) => boolean\n) {\n const handleMouseEvents = React.useRef(true);\n const handleMouseEventsTimer = React.useRef(new Timer(1000));\n const ref = React.useRef<T>(null);\n const isDownOutside = React.useRef(false);\n React.useEffect(() => {\n const listener = (e: OutsideClickEvent) => {\n if (e.type === \"touchstart\") {\n // Skip mouse event handlers after touch event.\n handleMouseEvents.current = false;\n handleMouseEventsTimer.current.start();\n } else if (e.type === \"mousedown\" && !handleMouseEvents.current) {\n return;\n }\n const isOutsideEvent = !outsideEventPredicate || outsideEventPredicate(e);\n isDownOutside.current =\n !!ref.current &&\n e.target instanceof Node &&\n !ref.current.contains(e.target) &&\n isOutsideEvent;\n };\n if (hasPointerEventsSupport()) {\n document.addEventListener(\"pointerdown\", listener);\n } else {\n document.addEventListener(\"mousedown\", listener);\n document.addEventListener(\"touchstart\", listener);\n }\n return () => {\n if (hasPointerEventsSupport()) {\n document.removeEventListener(\"pointerdown\", listener);\n } else {\n document.removeEventListener(\"mousedown\", listener);\n document.removeEventListener(\"touchstart\", listener);\n }\n };\n }, [outsideEventPredicate]);\n React.useEffect(() => {\n const listener = (e: OutsideClickEvent) => {\n if (e.type === \"mouseup\" && !handleMouseEvents.current) {\n return;\n }\n onOutsideClick &&\n isDownOutside.current &&\n (!outsideEventPredicate || outsideEventPredicate(e)) &&\n ref.current &&\n e.target instanceof Node &&\n !ref.current.contains(e.target) &&\n onOutsideClick();\n isDownOutside.current = false;\n };\n if (hasPointerEventsSupport()) {\n document.addEventListener(\"pointerup\", listener);\n } else {\n document.addEventListener(\"mouseup\", listener);\n document.addEventListener(\"touchend\", listener);\n }\n return () => {\n if (hasPointerEventsSupport()) {\n document.removeEventListener(\"pointerup\", listener);\n } else {\n document.removeEventListener(\"mouseup\", listener);\n document.removeEventListener(\"touchend\", listener);\n }\n };\n }, [onOutsideClick, outsideEventPredicate]);\n React.useEffect(() => {\n const listener = () => {\n handleMouseEvents.current = true;\n };\n const timer = handleMouseEventsTimer.current;\n timer.setOnExecute(listener);\n return () => {\n timer.setOnExecute(undefined);\n };\n }, []);\n return ref;\n}\n"]}
1
+ {"version":3,"file":"useOnOutsideClick.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useOnOutsideClick.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,cAA2B;AAC3B,gFAAgF;AAChF,qBAAyD;IAEzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAI,IAAI,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,QAAQ,GAAG,CAAC,CAAoB,EAAE,EAAE;YACxC,IAAI,CAAC,CAAC,IAAI,KAAK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,IAAI,CAAC;QACnC,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,sBAAsB,CAAC,OAAO,CAAC;QAC7C,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE;YACV,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\nimport { hasPointerEventsSupport } from \"../../base/PointerEvents\";\nimport { Timer } from \"../Timer\";\n\n/** @public */\nexport type OutsideClickEvent = PointerEvent | MouseEvent | TouchEvent;\n\n/** Invokes onOutsideClick handler when user clicks outside of referenced element.\n * @public\n */\nexport function useOnOutsideClick<T extends Element>(\n onOutsideClick?: () => void,\n /** Invoked for intermediate events. Return `false` to prevent outside click. */\n outsideEventPredicate?: (e: OutsideClickEvent) => boolean\n) {\n const handleMouseEvents = React.useRef(true);\n const handleMouseEventsTimer = React.useRef(new Timer(1000));\n const ref = React.useRef<T>(null);\n const isDownOutside = React.useRef(false);\n React.useEffect(() => {\n const listener = (e: OutsideClickEvent) => {\n if (e.type === \"touchstart\") {\n // Skip mouse event handlers after touch event.\n handleMouseEvents.current = false;\n handleMouseEventsTimer.current.start();\n } else if (e.type === \"mousedown\" && !handleMouseEvents.current) {\n return;\n }\n const isOutsideEvent = !outsideEventPredicate || outsideEventPredicate(e);\n isDownOutside.current =\n !!ref.current &&\n e.target instanceof Node &&\n !ref.current.contains(e.target) &&\n isOutsideEvent;\n };\n if (hasPointerEventsSupport()) {\n document.addEventListener(\"pointerdown\", listener);\n } else {\n document.addEventListener(\"mousedown\", listener);\n document.addEventListener(\"touchstart\", listener);\n }\n return () => {\n if (hasPointerEventsSupport()) {\n document.removeEventListener(\"pointerdown\", listener);\n } else {\n document.removeEventListener(\"mousedown\", listener);\n document.removeEventListener(\"touchstart\", listener);\n }\n };\n }, [outsideEventPredicate]);\n React.useEffect(() => {\n const listener = (e: OutsideClickEvent) => {\n if (e.type === \"mouseup\" && !handleMouseEvents.current) {\n return;\n }\n onOutsideClick &&\n isDownOutside.current &&\n (!outsideEventPredicate || outsideEventPredicate(e)) &&\n ref.current &&\n e.target instanceof Node &&\n !ref.current.contains(e.target) &&\n onOutsideClick();\n isDownOutside.current = false;\n };\n if (hasPointerEventsSupport()) {\n document.addEventListener(\"pointerup\", listener);\n } else {\n document.addEventListener(\"mouseup\", listener);\n document.addEventListener(\"touchend\", listener);\n }\n return () => {\n if (hasPointerEventsSupport()) {\n document.removeEventListener(\"pointerup\", listener);\n } else {\n document.removeEventListener(\"mouseup\", listener);\n document.removeEventListener(\"touchend\", listener);\n }\n };\n }, [onOutsideClick, outsideEventPredicate]);\n React.useEffect(() => {\n const listener = () => {\n handleMouseEvents.current = true;\n };\n const timer = handleMouseEventsTimer.current;\n timer.setOnExecute(listener);\n return () => {\n timer.setOnExecute(undefined);\n };\n }, []);\n return ref;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useProximityToMouse.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useProximityToMouse.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,gBAAgB;AAChB,MAAM,OAAO,gBAAiB,SAAQ,GAA6B;CAAG;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,UAA4B,EAC5B,OAAgB,KAAK,EACrB,SAAS,GAAG,2BAA2B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,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAAkB,EAAU,EAAE;IACrE,OAAO,QAAQ,UAAU,KAAK,CAAC;AACjC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\nimport { Point } from \"../Point\";\nimport { Rectangle } from \"../Rectangle\";\n\n/** @internal */\nexport class WidgetElementSet extends Set<React.RefObject<Element>> {}\n\n/** Returns the proximity scale associated with the shortest distance from the element(s) to the mouse.\n * @internal\n */\nexport const useProximityToMouse = (\n elementSet: WidgetElementSet,\n snap: boolean = false,\n threshold = PROXIMITY_THRESHOLD_DEFAULT\n) => {\n const [proximityScale, setProximityScale] = React.useState(1.0);\n\n React.useEffect(() => {\n const handleDocumentPointerMove = (e: PointerEvent) => {\n let shortestProximity = Number.MAX_SAFE_INTEGER;\n\n for (const ref of elementSet) {\n // istanbul ignore else\n if (ref.current) {\n const clientRect = ref.current.getBoundingClientRect();\n const rectangle = Rectangle.create(clientRect);\n const point = new Point(e.pageX, e.pageY);\n shortestProximity = Math.min(\n rectangle.getShortestDistanceToPoint(point),\n shortestProximity\n );\n }\n }\n\n const scale = calculateProximityScale(shortestProximity, snap, threshold);\n if (scale !== proximityScale) setProximityScale(scale);\n };\n\n document.addEventListener(\"pointermove\", handleDocumentPointerMove);\n\n return () => {\n document.removeEventListener(\"pointermove\", handleDocumentPointerMove);\n };\n }, [elementSet, proximityScale, snap, threshold]);\n\n return proximityScale;\n};\n\n/** Default proximity threshold.\n * @internal\n */\nexport const PROXIMITY_THRESHOLD_DEFAULT = 100;\n\n/** Default toolbar opacity.\n * @internal\n */\nexport const TOOLBAR_OPACITY_DEFAULT = 0.5;\n\n/** Default toolbar box-shadow opacity.\n * @internal\n */\nexport const TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT = 0.35;\n\n/** Default toolbar backdrop-filter blur.\n * @internal\n */\nexport const TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT = 10;\n\n/** Calculates a proximity scale for further calculations given the proximity and threshold.\n * @internal\n */\nexport const calculateProximityScale = (\n proximity: number,\n snap: boolean = false,\n threshold = PROXIMITY_THRESHOLD_DEFAULT\n): number => {\n let scale = (proximity < threshold ? threshold - proximity : 0) / threshold;\n if (snap && scale > 0) scale = 1.0;\n return scale;\n};\n\n/** Calculates a toolbar opacity based on a given proximity scale.\n * @internal\n */\nexport const calculateToolbarOpacity = (proximityScale: number): number => {\n return TOOLBAR_OPACITY_DEFAULT * proximityScale;\n};\n\n/** Calculates a box-shadow opacity based on a given proximity scale.\n * @internal\n */\nexport const calculateBoxShadowOpacity = (proximityScale: number): number => {\n return TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT * proximityScale;\n};\n\n/** Calculates a backdrop-filter blur based on a given proximity scale.\n * @internal\n */\nexport const calculateBackdropFilterBlur = (proximityScale: number): number => {\n return TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT * proximityScale;\n};\n\n/** Gets the Toolbar background-color based on a given opacity.\n * @internal\n */\nexport const getToolbarBackgroundColor = (opacity: number): string => {\n return `hsl(var(--iui-color-background-hsl) / ${opacity})`;\n};\n\n/** Gets the Toolbar box-shadow based on a given opacity.\n * @internal\n */\nexport const getToolbarBoxShadow = (opacity: number): string => {\n return `0 1px 3px 0 rgba(0, 0, 0, ${opacity})`;\n};\n\n/** Gets the Toolbar backdrop-filter based on a given blur amount.\n * @internal\n */\nexport const getToolbarBackdropFilter = (filterBlur: number): string => {\n return `blur(${filterBlur}px)`;\n};\n"]}
1
+ {"version":3,"file":"useProximityToMouse.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useProximityToMouse.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,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AC5E,OAAO,oCAAoC,GAAG,cAAc,CAAC;AAC/D,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAe,EAAU,EAAE;IACnE,OAAO,yCAAyC,OAAO,GAAG,CAAC;AAC7D,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAU,EAAE;IAC7D,OAAO,6BAA6B,OAAO,GAAG,CAAC;AACjD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAAkB,EAAU,EAAE;IACrE,OAAO,QAAQ,UAAU,KAAK,CAAC;AACjC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\nimport { Point } from \"../Point\";\nimport { Rectangle } from \"../Rectangle\";\n\n/** @internal */\nexport class WidgetElementSet extends Set<React.RefObject<Element>> {}\n\n/** Returns the proximity scale associated with the shortest distance from the element(s) to the mouse.\n * @internal\n */\nexport const useProximityToMouse = (\n elementSet: WidgetElementSet,\n snap: boolean = false,\n threshold = PROXIMITY_THRESHOLD_DEFAULT\n) => {\n const [proximityScale, setProximityScale] = React.useState(1.0);\n\n React.useEffect(() => {\n const handleDocumentPointerMove = (e: PointerEvent) => {\n let shortestProximity = Number.MAX_SAFE_INTEGER;\n\n for (const ref of elementSet) {\n // istanbul ignore else\n if (ref.current) {\n const clientRect = ref.current.getBoundingClientRect();\n const rectangle = Rectangle.create(clientRect);\n const point = new Point(e.pageX, e.pageY);\n shortestProximity = Math.min(\n rectangle.getShortestDistanceToPoint(point),\n shortestProximity\n );\n }\n }\n\n const scale = calculateProximityScale(shortestProximity, snap, threshold);\n if (scale !== proximityScale) setProximityScale(scale);\n };\n\n document.addEventListener(\"pointermove\", handleDocumentPointerMove);\n\n return () => {\n document.removeEventListener(\"pointermove\", handleDocumentPointerMove);\n };\n }, [elementSet, proximityScale, snap, threshold]);\n\n return proximityScale;\n};\n\n/** Default proximity threshold.\n * @internal\n */\nexport const PROXIMITY_THRESHOLD_DEFAULT = 100;\n\n/** Default toolbar opacity.\n * @internal\n */\nexport const TOOLBAR_OPACITY_DEFAULT = 0.5;\n\n/** Default toolbar box-shadow opacity.\n * @internal\n */\nexport const TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT = 0.35;\n\n/** Default toolbar backdrop-filter blur.\n * @internal\n */\nexport const TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT = 10;\n\n/** Calculates a proximity scale for further calculations given the proximity and threshold.\n * @internal\n */\nexport const calculateProximityScale = (\n proximity: number,\n snap: boolean = false,\n threshold = PROXIMITY_THRESHOLD_DEFAULT\n): number => {\n let scale = (proximity < threshold ? threshold - proximity : 0) / threshold;\n if (snap && scale > 0) scale = 1.0;\n return scale;\n};\n\n/** Calculates a toolbar opacity based on a given proximity scale.\n * @internal\n */\nexport const calculateToolbarOpacity = (proximityScale: number): number => {\n return TOOLBAR_OPACITY_DEFAULT * proximityScale;\n};\n\n/** Calculates a box-shadow opacity based on a given proximity scale.\n * @internal\n */\nexport const calculateBoxShadowOpacity = (proximityScale: number): number => {\n return TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT * proximityScale;\n};\n\n/** Calculates a backdrop-filter blur based on a given proximity scale.\n * @internal\n */\nexport const calculateBackdropFilterBlur = (proximityScale: number): number => {\n return TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT * proximityScale;\n};\n\n/** Gets the Toolbar background-color based on a given opacity.\n * @internal\n */\nexport const getToolbarBackgroundColor = (opacity: number): string => {\n return `hsl(var(--iui-color-background-hsl) / ${opacity})`;\n};\n\n/** Gets the Toolbar box-shadow based on a given opacity.\n * @internal\n */\nexport const getToolbarBoxShadow = (opacity: number): string => {\n return `0 1px 3px 0 rgba(0, 0, 0, ${opacity})`;\n};\n\n/** Gets the Toolbar backdrop-filter based on a given blur amount.\n * @internal\n */\nexport const getToolbarBackdropFilter = (filterBlur: number): string => {\n return `blur(${filterBlur}px)`;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useRefs.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useRefs.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,+BAA+B;AAC/B,SAAS,aAAa,CAAI,GAAiB;IACzC,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAI,GAAG,IAA6C;IACzE,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,QAAkB,EAAE,EAAE;QACrB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,uBAAuB;YACvB,IAAI,GAAG,EAAE;gBACP,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE;oBACtB,GAAG,CAAC,QAAQ,CAAC,CAAC;iBACf;qBAAM;oBACJ,GAAwC,CAAC,OAAO,GAAG,QAAQ,CAAC;iBAC9D;aACF;SACF;IACH,CAAC;IACD,uDAAuD;IACvD,CAAC,GAAG,IAAI,CAAC,CACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAI,GAAG,IAAiC;IAC/D,OAAO,CAAC,QAAkB,EAAE,EAAE;QAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,uBAAuB;YACvB,IAAI,GAAG,EAAE;gBACP,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE;oBACtB,GAAG,CAAC,QAAQ,CAAC,CAAC;iBACf;qBAAM;oBACJ,GAAwC,CAAC,OAAO,GAAG,QAAQ,CAAC;iBAC9D;aACF;SACF;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\n\n/** Callback ref type guard. */\nfunction isRefCallback<T>(ref: React.Ref<T>): ref is (_: T | null) => void {\n return typeof ref === \"function\";\n}\n\n/** Hook used to combine multiple refs.\n * @internal\n */\nexport function useRefs<T>(...refs: ReadonlyArray<React.Ref<T> | undefined>) {\n return React.useCallback(\n (instance: T | null) => {\n for (const ref of refs) {\n // istanbul ignore else\n if (ref) {\n if (isRefCallback(ref)) {\n ref(instance);\n } else {\n (ref as React.MutableRefObject<T | null>).current = instance;\n }\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [...refs]\n );\n}\n\n/** Used to combine multiple refs for a class component.\n * @internal\n */\nexport function mergeRefs<T>(...refs: ReadonlyArray<React.Ref<T>>) {\n return (instance: T | null) => {\n for (const ref of refs) {\n // istanbul ignore else\n if (ref) {\n if (isRefCallback(ref)) {\n ref(instance);\n } else {\n (ref as React.MutableRefObject<T | null>).current = instance;\n }\n }\n }\n };\n}\n"]}
1
+ {"version":3,"file":"useRefs.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useRefs.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,+BAA+B;AAC/B,SAAS,aAAa,CAAI,GAAiB;IACzC,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAI,GAAG,IAA6C;IACzE,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,QAAkB,EAAE,EAAE;QACrB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,uBAAuB;YACvB,IAAI,GAAG,EAAE,CAAC;gBACR,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;oBACvB,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACL,GAAwC,CAAC,OAAO,GAAG,QAAQ,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,uDAAuD;IACvD,CAAC,GAAG,IAAI,CAAC,CACV,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAI,GAAG,IAAiC;IAC/D,OAAO,CAAC,QAAkB,EAAE,EAAE;QAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,uBAAuB;YACvB,IAAI,GAAG,EAAE,CAAC;gBACR,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;oBACvB,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACL,GAAwC,CAAC,OAAO,GAAG,QAAQ,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\nimport * as React from \"react\";\n\n/** Callback ref type guard. */\nfunction isRefCallback<T>(ref: React.Ref<T>): ref is (_: T | null) => void {\n return typeof ref === \"function\";\n}\n\n/** Hook used to combine multiple refs.\n * @internal\n */\nexport function useRefs<T>(...refs: ReadonlyArray<React.Ref<T> | undefined>) {\n return React.useCallback(\n (instance: T | null) => {\n for (const ref of refs) {\n // istanbul ignore else\n if (ref) {\n if (isRefCallback(ref)) {\n ref(instance);\n } else {\n (ref as React.MutableRefObject<T | null>).current = instance;\n }\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [...refs]\n );\n}\n\n/** Used to combine multiple refs for a class component.\n * @internal\n */\nexport function mergeRefs<T>(...refs: ReadonlyArray<React.Ref<T>>) {\n return (instance: T | null) => {\n for (const ref of refs) {\n // istanbul ignore else\n if (ref) {\n if (isRefCallback(ref)) {\n ref(instance);\n } else {\n (ref as React.MutableRefObject<T | null>).current = instance;\n }\n }\n }\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAkD;IAElD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,kEAAkE;IAClG,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAM,IAAI,CAAC,CAAC;IAEhD,uBAAuB;IACvB,MAAM,qBAAqB,GAAG,GAAG,EAAE;QACjC,IAAI,MAAM,CAAC,OAAO;YAChB,eAAe,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE/D,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;QACrC,cAAc,CAAC,OAAO,GAA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AAS,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC;YACvD,mBAAmB,CACjB,WAAW,IAAI,SAAS;gBACtB,CAAC,CAAC,YAAY,CAAC,OAAO;gBACtB,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CACvC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACrC,CAAC,KAAc,EAAE,MAAe,EAAE,EAAE;QAClC,uBAAuB;QACvB,QAAQ,CAAC,KAAK,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,uBAAuB,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IACzD,MAAM,KAAK,GAAwB,WAAW;QAC5C,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;QACnC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAExB,OAAO,CACL,6BACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE,KAAK,IAEX,WAAW,IAAI,QAAQ,CACpB,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\nimport * as React from \"react\";\nimport { getResizeObserver } from \"./ResizeObserverPolyfill\";\nimport { useRefEffect } from \"./useRefEffect\";\nimport { useRefs } from \"./useRefs\";\n\n/** Uses ResizeObserver API to notify about element bound changes.\n * @internal\n */\nexport function useResizeObserver<T extends Element>(\n onResize?: (width: number, height: number) => void\n) {\n const bounds = React.useRef({ width: 0, height: 0 });\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current?.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, []);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore else\n if (\n isMountedRef.current &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore if\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n const observerRef = useRefEffect(\n (instance: T | null) => {\n const RO = getResizeObserver();\n resizeObserver.current = new RO(handleResize);\n if (instance) {\n resizeObserver.current.observe(instance);\n const newBounds = instance.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n bounds.current = newBounds;\n }\n\n return () => {\n instance &&\n /* istanbul ignore next */ resizeObserver.current?.unobserve(\n instance\n );\n resizeObserver.current = null;\n };\n },\n [handleResize, onResize]\n );\n\n const handleRef = React.useCallback(\n (instance: Element | null) => {\n const newBounds = instance && instance.getBoundingClientRect();\n // istanbul ignore if\n if (\n newBounds &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const ref = useRefs(handleRef, observerRef);\n return ref;\n}\n\n/** React hook that uses ResizeObserver API to notify about element bound changes. Note: to work similar to ReactResizeDetector\n * width and height are initialized as undefined and only set during after mount if bounds are non-zero. This implementation properly\n * handles observing element in pop-out/child windows.\n * @internal\n */\nexport function useLayoutResizeObserver(\n inElement: HTMLElement | null,\n onResize?: (width?: number, height?: number) => void\n) {\n const inBoundingRect = inElement?.getBoundingClientRect();\n const [bounds, setBounds] = React.useState<{\n width?: number;\n height?: number;\n }>({ width: inBoundingRect?.width, height: inBoundingRect?.height });\n const [watchedElement, setWatchedElement] = React.useState(inElement);\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n setWatchedElement(inElement);\n\n // istanbul ignore next\n if (inElement) {\n const newBounds = inElement.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n\n return () => {\n isMountedRef.current = false;\n rafRef.current &&\n owningWindowRef.current &&\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, [onResize, inElement]);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore next\n if (\n isMountedRef.current &&\n (bounds.width !== newBounds.width || bounds.height !== newBounds.height)\n ) {\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n },\n [bounds.height, bounds.width, onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore next\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n if (owningWindowRef.current)\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n React.useLayoutEffect(() => {\n if (!watchedElement) {\n return;\n }\n const RO = getResizeObserver();\n resizeObserver.current = new RO(handleResize);\n resizeObserver.current.observe(watchedElement);\n return () => {\n // istanbul ignore next\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n }, [handleResize, watchedElement]);\n\n return [bounds.width, bounds.height];\n}\n\n/** Prop the ElementResizeObserver sends to the render function.\n * @public\n */\nexport interface RenderPropsArgs {\n width?: number;\n height?: number;\n}\n\n/** ElementResizeObserver provides functionality similar to ReactResizeDetector when a render function is specified. This implementation properly handles\n * observing element in pop-out/child windows.\n * @public\n */\nexport function ElementResizeObserver({\n watchedElement,\n render,\n}: {\n watchedElement: HTMLElement | null;\n render: (props: RenderPropsArgs) => React.ReactElement;\n}) {\n const [width, height] = useLayoutResizeObserver(watchedElement);\n return render({ width, height });\n}\n\n/** ResizableContainerObserver is a component that provides the functionality similar to the ReactResizeDetector option that call a function when\n * the observed element is resized. This implementation properly handles observing element in pop-out/child windows. If children nodes are defined then\n * the div added by the component is considered the container whose size will be observed. If no children are provided then the component will report\n * size changes from its parent container.\n * @public\n */\nexport function ResizableContainerObserver({\n onResize,\n children,\n}: {\n onResize: (width: number, height: number) => void;\n children?: React.ReactNode;\n}) {\n const containerRef = React.useRef<HTMLDivElement>(null); // set to non-zero when requestAnimationFrame processing is active\n const [containerElement, setContainerElement] =\n React.useState<HTMLElement | null>(null);\n const isMountedRef = React.useRef(false);\n const hasChildren = React.Children.count(children) !== 0;\n\n // if no children are specified then monitor size of parent element.\n React.useEffect(() => {\n // istanbul ignore next\n if (!isMountedRef.current && containerRef.current) {\n isMountedRef.current = true;\n const hasParent = !!containerRef.current.parentElement;\n setContainerElement(\n hasChildren && hasParent\n ? containerRef.current\n : containerRef.current.parentElement\n );\n }\n }, [hasChildren]);\n\n const processResize = React.useCallback(\n (width?: number, height?: number) => {\n // istanbul ignore next\n onResize(width ?? 0, height ?? 0);\n },\n [onResize]\n );\n\n useLayoutResizeObserver(containerElement, processResize);\n const style: React.CSSProperties = hasChildren\n ? { width: \"100%\", height: \"100%\" }\n : { display: \"none\" };\n\n return (\n <div\n ref={containerRef}\n className=\"uicore-resizable-container\"\n style={style}\n >\n {hasChildren && children}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"useResizeObserver.js","sourceRoot":"","sources":["../../../../../src/core-react/utils/hooks/useResizeObserver.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAg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QAAQ,CAAC,KAAK,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,uBAAuB,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IACzD,MAAM,KAAK,GAAwB,WAAW;QAC5C,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;QACnC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAExB,OAAO,CACL,6BACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE,KAAK,IAEX,WAAW,IAAI,QAAQ,CACpB,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\nimport * as React from \"react\";\nimport { getResizeObserver } from \"./ResizeObserverPolyfill\";\nimport { useRefEffect } from \"./useRefEffect\";\nimport { useRefs } from \"./useRefs\";\n\n/** Uses ResizeObserver API to notify about element bound changes.\n * @internal\n */\nexport function useResizeObserver<T extends Element>(\n onResize?: (width: number, height: number) => void\n) {\n const bounds = React.useRef({ width: 0, height: 0 });\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current?.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, []);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore else\n if (\n isMountedRef.current &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore if\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n const observerRef = useRefEffect(\n (instance: T | null) => {\n const RO = getResizeObserver();\n resizeObserver.current = new RO(handleResize);\n if (instance) {\n resizeObserver.current.observe(instance);\n const newBounds = instance.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n bounds.current = newBounds;\n }\n\n return () => {\n instance &&\n /* istanbul ignore next */ resizeObserver.current?.unobserve(\n instance\n );\n resizeObserver.current = null;\n };\n },\n [handleResize, onResize]\n );\n\n const handleRef = React.useCallback(\n (instance: Element | null) => {\n const newBounds = instance && instance.getBoundingClientRect();\n // istanbul ignore if\n if (\n newBounds &&\n (bounds.current.width !== newBounds.width ||\n bounds.current.height !== newBounds.height)\n ) {\n bounds.current = newBounds;\n onResize && onResize(newBounds.width, newBounds.height);\n }\n },\n [onResize]\n );\n\n const ref = useRefs(handleRef, observerRef);\n return ref;\n}\n\n/** React hook that uses ResizeObserver API to notify about element bound changes. Note: to work similar to ReactResizeDetector\n * width and height are initialized as undefined and only set during after mount if bounds are non-zero. This implementation properly\n * handles observing element in pop-out/child windows.\n * @internal\n */\nexport function useLayoutResizeObserver(\n inElement: HTMLElement | null,\n onResize?: (width?: number, height?: number) => void\n) {\n const inBoundingRect = inElement?.getBoundingClientRect();\n const [bounds, setBounds] = React.useState<{\n width?: number;\n height?: number;\n }>({ width: inBoundingRect?.width, height: inBoundingRect?.height });\n const [watchedElement, setWatchedElement] = React.useState(inElement);\n const resizeObserver = React.useRef<ResizeObserver | null>(null);\n const rafRef = React.useRef(0); // set to non-zero when requestAnimationFrame processing is active\n const isMountedRef = React.useRef(false);\n const owningWindowRef = React.useRef<any>(null);\n\n // istanbul ignore next\n const resizeObserverCleanup = () => {\n if (rafRef.current)\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n\n React.useEffect(() => {\n isMountedRef.current = true;\n setWatchedElement(inElement);\n\n // istanbul ignore next\n if (inElement) {\n const newBounds = inElement.getBoundingClientRect();\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n\n return () => {\n isMountedRef.current = false;\n rafRef.current &&\n owningWindowRef.current &&\n owningWindowRef.current.cancelAnimationFrame(rafRef.current);\n owningWindowRef.current &&\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n };\n }, [onResize, inElement]);\n\n const processResize = React.useCallback(\n (target: HTMLElement) => {\n const newBounds = target.getBoundingClientRect();\n // istanbul ignore next\n if (\n isMountedRef.current &&\n (bounds.width !== newBounds.width || bounds.height !== newBounds.height)\n ) {\n onResize && onResize(newBounds.width, newBounds.height);\n setBounds(newBounds);\n }\n },\n [bounds.height, bounds.width, onResize]\n );\n\n const handleResize = React.useCallback(\n (entries: any[]) => {\n // istanbul ignore next\n if (\n !isMountedRef.current ||\n !Array.isArray(entries) ||\n 0 === entries.length\n ) {\n return;\n }\n const target = entries[0].target as HTMLElement;\n // istanbul ignore next\n if (owningWindowRef.current)\n owningWindowRef.current.removeEventListener(\n \"beforeunload\",\n resizeObserverCleanup\n );\n\n owningWindowRef.current = target.ownerDocument.defaultView;\n // istanbul ignore else\n if (owningWindowRef.current) {\n owningWindowRef.current.addEventListener(\n \"unload\",\n resizeObserverCleanup\n );\n\n // using requestAnimationFrame to stop the \"ResizeObserver loop completed with undelivered notifications.\" and\n // \"ResizeObserver loop limit exceeded\" messages reported to window.onError\n rafRef.current = owningWindowRef.current.requestAnimationFrame(() =>\n processResize(target)\n );\n }\n },\n [processResize]\n );\n\n React.useLayoutEffect(() => {\n if (!watchedElement) {\n return;\n }\n const RO = getResizeObserver();\n resizeObserver.current = new RO(handleResize);\n resizeObserver.current.observe(watchedElement);\n return () => {\n // istanbul ignore next\n resizeObserver.current?.disconnect();\n resizeObserver.current = null;\n };\n }, [handleResize, watchedElement]);\n\n return [bounds.width, bounds.height];\n}\n\n/** Prop the ElementResizeObserver sends to the render function.\n * @public\n */\nexport interface RenderPropsArgs {\n width?: number;\n height?: number;\n}\n\n/** ElementResizeObserver provides functionality similar to ReactResizeDetector when a render function is specified. This implementation properly handles\n * observing element in pop-out/child windows.\n * @public\n */\nexport function ElementResizeObserver({\n watchedElement,\n render,\n}: {\n watchedElement: HTMLElement | null;\n render: (props: RenderPropsArgs) => React.ReactElement;\n}) {\n const [width, height] = useLayoutResizeObserver(watchedElement);\n return render({ width, height });\n}\n\n/** ResizableContainerObserver is a component that provides the functionality similar to the ReactResizeDetector option that call a function when\n * the observed element is resized. This implementation properly handles observing element in pop-out/child windows. If children nodes are defined then\n * the div added by the component is considered the container whose size will be observed. If no children are provided then the component will report\n * size changes from its parent container.\n * @public\n */\nexport function ResizableContainerObserver({\n onResize,\n children,\n}: {\n onResize: (width: number, height: number) => void;\n children?: React.ReactNode;\n}) {\n const containerRef = React.useRef<HTMLDivElement>(null); // set to non-zero when requestAnimationFrame processing is active\n const [containerElement, setContainerElement] =\n React.useState<HTMLElement | null>(null);\n const isMountedRef = React.useRef(false);\n const hasChildren = React.Children.count(children) !== 0;\n\n // if no children are specified then monitor size of parent element.\n React.useEffect(() => {\n // istanbul ignore next\n if (!isMountedRef.current && containerRef.current) {\n isMountedRef.current = true;\n const hasParent = !!containerRef.current.parentElement;\n setContainerElement(\n hasChildren && hasParent\n ? containerRef.current\n : containerRef.current.parentElement\n );\n }\n }, [hasChildren]);\n\n const processResize = React.useCallback(\n (width?: number, height?: number) => {\n // istanbul ignore next\n onResize(width ?? 0, height ?? 0);\n },\n [onResize]\n );\n\n useLayoutResizeObserver(containerElement, processResize);\n const style: React.CSSProperties = hasChildren\n ? { width: \"100%\", height: \"100%\" }\n : { display: \"none\" };\n\n return (\n <div\n ref={containerRef}\n className=\"uicore-resizable-container\"\n style={style}\n >\n {hasChildren && children}\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reuseOrCreatePromise.js","sourceRoot":"","sources":["../../../../src/core-react/utils/reuseOrCreatePromise.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,EAAU,EACV,aAA+B,EAC/B,KAA8B;IAE9B,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,CAAC,UAAU,EAAE;QACf,UAAU,GAAG,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACvC,uEAAuE;YACvE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACjB,MAAM,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;KAC3B;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\n/**\n * Return promise if created for the id, otherwise, create a new one and save it.\n * if the promise fail, remove it from cache so we'll try again.\n * @param id Identification for the promise\n * @param createPromise Function to create the promise if not already running.\n * @param cache Map<string, Promise<K>> object that will contain the cache. (Should be local to the file using this function, not global to the app)\n * @returns created promise\n * @internal\n */\nexport async function reuseOrCreatePromise<T>(\n id: string,\n createPromise: () => Promise<T>,\n cache: Map<string, Promise<T>>\n): Promise<T> {\n let getPromise = cache.get(id);\n if (!getPromise) {\n getPromise = createPromise().catch((e) => {\n // Don't keep the cache if we fail, could be a temporary network error.\n cache.delete(id);\n throw e;\n });\n cache.set(id, getPromise);\n }\n\n return getPromise;\n}\n"]}
1
+ {"version":3,"file":"reuseOrCreatePromise.js","sourceRoot":"","sources":["../../../../src/core-react/utils/reuseOrCreatePromise.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,EAAU,EACV,aAA+B,EAC/B,KAA8B;IAE9B,IAAI,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACvC,uEAAuE;YACvE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACjB,MAAM,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\n/**\n * Return promise if created for the id, otherwise, create a new one and save it.\n * if the promise fail, remove it from cache so we'll try again.\n * @param id Identification for the promise\n * @param createPromise Function to create the promise if not already running.\n * @param cache Map<string, Promise<K>> object that will contain the cache. (Should be local to the file using this function, not global to the app)\n * @returns created promise\n * @internal\n */\nexport async function reuseOrCreatePromise<T>(\n id: string,\n createPromise: () => Promise<T>,\n cache: Map<string, Promise<T>>\n): Promise<T> {\n let getPromise = cache.get(id);\n if (!getPromise) {\n getPromise = createPromise().catch((e) => {\n // Don't keep the cache if we fail, could be a temporary network error.\n cache.delete(id);\n throw e;\n });\n cache.set(id, getPromise);\n }\n\n return getPromise;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"shallowDiffers.js","sourceRoot":"","sources":["../../../../src/core-react/utils/shallowDiffers.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,CAAqC,EACrC,CAAqC,EAC5B,EAAE;IACX,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpD,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;KAC5B;IACD,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;KAChC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\n/** Performs a shallow difference check on two objects.\n * @internal\n */\nexport const shallowDiffers = (\n a: { [key: string]: any } | undefined,\n b: { [key: string]: any } | undefined\n): boolean => {\n if (a === b) return false;\n if (a === undefined || b === undefined) return true;\n for (const i in a) {\n if (!(i in b)) return true;\n }\n for (const i in b) {\n if (a[i] !== b[i]) return true;\n }\n return false;\n};\n"]}
1
+ {"version":3,"file":"shallowDiffers.js","sourceRoot":"","sources":["../../../../src/core-react/utils/shallowDiffers.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,CAAqC,EACrC,CAAqC,EAC5B,EAAE;IACX,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACpD,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IAC7B,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IACjC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utilities\n */\n\n/** Performs a shallow difference check on two objects.\n * @internal\n */\nexport const shallowDiffers = (\n a: { [key: string]: any } | undefined,\n b: { [key: string]: any } | undefined\n): boolean => {\n if (a === b) return false;\n if (a === undefined || b === undefined) return true;\n for (const i in a) {\n if (!(i in b)) return true;\n }\n for (const i in b) {\n if (a[i] !== b[i]) return true;\n }\n return false;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-react",
3
- "version": "4.13.2",
3
+ "version": "4.13.4",
4
4
  "description": "iTwin.js UI core components",
5
5
  "main": "lib/cjs/core-react.js",
6
6
  "module": "lib/esm/core-react.js",
@@ -35,38 +35,36 @@
35
35
  ],
36
36
  "devDependencies": {
37
37
  "@itwin/appui-abstract": "^3.7.0 || ^4.0.0",
38
- "@itwin/build-tools": "^3.7.0 || ^4.0.0",
38
+ "@itwin/build-tools": "^3.7.0 || ^4.6.0-dev.27",
39
39
  "@itwin/core-bentley": "^3.7.0 || ^4.0.0",
40
40
  "@itwin/core-common": "^3.7.0 || ^4.0.0",
41
41
  "@itwin/core-i18n": "^3.7.0 || ^4.0.0",
42
42
  "@itwin/eslint-plugin": "^4.0.0-dev.52",
43
- "@testing-library/dom": "^8.11.2",
44
- "@testing-library/react": "^12.0.0",
45
- "@testing-library/react-hooks": "^7.0.2",
46
- "@testing-library/user-event": "^14.4.2",
43
+ "@testing-library/dom": "^10.1.0",
44
+ "@testing-library/react": "^15.0.7",
45
+ "@testing-library/user-event": "^14.5.2",
47
46
  "@types/dompurify": "^2.0.3",
48
47
  "@types/lodash": "^4.14.0",
49
48
  "@types/node": "18.11.5",
50
- "@types/react": "^17.0.37",
49
+ "@types/react": "^18.3.2",
51
50
  "@types/react-autosuggest": "10.1.2",
52
- "@types/react-dom": "^17.0.0",
51
+ "@types/react-dom": "^18.3.0",
53
52
  "@vitest/coverage-v8": "^1.4.0",
54
53
  "cpx2": "^3.0.0",
55
54
  "eslint": "^8.44.0",
56
55
  "eslint-config-prettier": "~8.8.0",
57
56
  "ignore-styles": "^5.0.1",
58
57
  "jsdom": "^24.0.0",
59
- "jsdom-global": "3.0.2",
60
58
  "npm-run-all": "^4.1.5",
61
59
  "raf": "^3.4.0",
62
- "react": "^17.0.0",
63
- "react-dom": "^17.0.0",
60
+ "react": "^18.3.1",
61
+ "react-dom": "^18.3.1",
64
62
  "rimraf": "^3.0.2",
65
63
  "ts-node": "^10.8.2",
66
64
  "typemoq": "^2.1.0",
67
- "typescript": "~5.0.2",
65
+ "typescript": "~5.3.3",
68
66
  "upath": "^2.0.1",
69
- "vitest": "^1.4.0"
67
+ "vitest": "^1.6.0"
70
68
  },
71
69
  "//dependencies": [
72
70
  "NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API",