@itwin/core-react 4.13.3 → 4.14.0

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 (262) hide show
  1. package/CHANGELOG.md +5 -3
  2. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  3. package/lib/cjs/core-react/autosuggest/AutoSuggest.js +1 -5
  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/contextmenu/ContextMenu.d.ts.map +1 -1
  8. package/lib/cjs/core-react/contextmenu/ContextMenu.js +4 -21
  9. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  10. package/lib/cjs/core-react/contextmenu/ContextMenu.scss +2 -0
  11. package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
  12. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +0 -2
  13. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  14. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  15. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +2 -11
  16. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  17. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  18. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +1 -5
  19. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  20. package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
  21. package/lib/cjs/core-react/dialog/Dialog.js +1 -3
  22. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  23. package/lib/cjs/core-react/dialog/GlobalDialog.d.ts.map +1 -1
  24. package/lib/cjs/core-react/dialog/GlobalDialog.js +0 -1
  25. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  26. package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  27. package/lib/cjs/core-react/elementseparator/ElementSeparator.js +1 -5
  28. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  29. package/lib/cjs/core-react/elementseparator/ElementSeparator.scss +1 -0
  30. package/lib/cjs/core-react/expandable/ExpandableList.d.ts.map +1 -1
  31. package/lib/cjs/core-react/expandable/ExpandableList.js +0 -1
  32. package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
  33. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  34. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js +0 -2
  35. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  36. package/lib/cjs/core-react/focustrap/FocusTrap.d.ts.map +1 -1
  37. package/lib/cjs/core-react/focustrap/FocusTrap.js +1 -14
  38. package/lib/cjs/core-react/focustrap/FocusTrap.js.map +1 -1
  39. package/lib/cjs/core-react/hocs/withIsPressed.d.ts +5 -9
  40. package/lib/cjs/core-react/hocs/withIsPressed.d.ts.map +1 -1
  41. package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts +5 -9
  42. package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
  43. package/lib/cjs/core-react/hocs/withOnOutsideClick.js +0 -6
  44. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  45. package/lib/cjs/core-react/hocs/withTimeout.d.ts +5 -9
  46. package/lib/cjs/core-react/hocs/withTimeout.d.ts.map +1 -1
  47. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
  48. package/lib/cjs/core-react/icons/ConditionalIconItem.js +0 -8
  49. package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -1
  50. package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
  51. package/lib/cjs/core-react/icons/IconComponent.js +0 -1
  52. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  53. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
  54. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js +0 -4
  55. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  56. package/lib/cjs/core-react/inputs/Input.d.ts +1 -1
  57. package/lib/cjs/core-react/inputs/Input.d.ts.map +1 -1
  58. package/lib/cjs/core-react/inputs/Input.js.map +1 -1
  59. package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts +1 -1
  60. package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts.map +1 -1
  61. package/lib/cjs/core-react/inputs/iconinput/IconInput.js.map +1 -1
  62. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +1 -1
  63. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  64. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +0 -1
  65. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  66. package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
  67. package/lib/cjs/core-react/listbox/Listbox.js +0 -11
  68. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  69. package/lib/cjs/core-react/messagebox/MessageBox.js +0 -2
  70. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  71. package/lib/cjs/core-react/notification/MessageRenderer.d.ts.map +1 -1
  72. package/lib/cjs/core-react/notification/MessageRenderer.js +0 -3
  73. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  74. package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
  75. package/lib/cjs/core-react/popup/Popup.js +2 -14
  76. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  77. package/lib/cjs/core-react/radialmenu/Annulus.d.ts.map +1 -1
  78. package/lib/cjs/core-react/radialmenu/Annulus.js +1 -1
  79. package/lib/cjs/core-react/radialmenu/Annulus.js.map +1 -1
  80. package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts +6 -5
  81. package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
  82. package/lib/cjs/core-react/radialmenu/RadialMenu.js +4 -9
  83. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  84. package/lib/cjs/core-react/searchbox/SearchBox.d.ts.map +1 -1
  85. package/lib/cjs/core-react/searchbox/SearchBox.js +0 -7
  86. package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
  87. package/lib/cjs/core-react/settings/SettingsContainer.d.ts.map +1 -1
  88. package/lib/cjs/core-react/settings/SettingsContainer.js +0 -1
  89. package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
  90. package/lib/cjs/core-react/tabs/Tabs.d.ts.map +1 -1
  91. package/lib/cjs/core-react/tabs/Tabs.js +0 -4
  92. package/lib/cjs/core-react/tabs/Tabs.js.map +1 -1
  93. package/lib/cjs/core-react/text/FilteredText.d.ts.map +1 -1
  94. package/lib/cjs/core-react/text/FilteredText.js +0 -3
  95. package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
  96. package/lib/cjs/core-react/tree/Node.d.ts +1 -1
  97. package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
  98. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  99. package/lib/cjs/core-react/tree/Tree.d.ts.map +1 -1
  100. package/lib/cjs/core-react/tree/Tree.js +0 -3
  101. package/lib/cjs/core-react/tree/Tree.js.map +1 -1
  102. package/lib/cjs/core-react/utils/IconHelper.d.ts.map +1 -1
  103. package/lib/cjs/core-react/utils/IconHelper.js +0 -8
  104. package/lib/cjs/core-react/utils/IconHelper.js.map +1 -1
  105. package/lib/cjs/core-react/utils/IconWebComponent.d.ts.map +1 -1
  106. package/lib/cjs/core-react/utils/IconWebComponent.js +0 -1
  107. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  108. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.d.ts.map +1 -1
  109. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js +0 -2
  110. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  111. package/lib/cjs/core-react/utils/flattenChildren.d.ts.map +1 -1
  112. package/lib/cjs/core-react/utils/flattenChildren.js +0 -1
  113. package/lib/cjs/core-react/utils/flattenChildren.js.map +1 -1
  114. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  115. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.js +0 -1
  116. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.js.map +1 -1
  117. package/lib/cjs/core-react/utils/hooks/useEventListener.d.ts.map +1 -1
  118. package/lib/cjs/core-react/utils/hooks/useEventListener.js +0 -1
  119. package/lib/cjs/core-react/utils/hooks/useEventListener.js.map +1 -1
  120. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
  121. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js +0 -1
  122. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  123. package/lib/cjs/core-react/utils/hooks/useRefs.d.ts.map +1 -1
  124. package/lib/cjs/core-react/utils/hooks/useRefs.js +0 -2
  125. package/lib/cjs/core-react/utils/hooks/useRefs.js.map +1 -1
  126. package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
  127. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +1 -17
  128. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  129. package/lib/cjs/core-react/utils/hooks/useWidgetOpacityContext.d.ts.map +1 -1
  130. package/lib/cjs/core-react/utils/hooks/useWidgetOpacityContext.js +1 -1
  131. package/lib/cjs/core-react/utils/hooks/useWidgetOpacityContext.js.map +1 -1
  132. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  133. package/lib/esm/core-react/autosuggest/AutoSuggest.js +1 -5
  134. package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
  135. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts +5 -9
  136. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts.map +1 -1
  137. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  138. package/lib/esm/core-react/contextmenu/ContextMenu.js +4 -21
  139. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  140. package/lib/esm/core-react/contextmenu/ContextMenu.scss +2 -0
  141. package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
  142. package/lib/esm/core-react/contextmenu/ContextMenuItem.js +0 -2
  143. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  144. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  145. package/lib/esm/core-react/contextmenu/ContextSubMenu.js +2 -11
  146. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  147. package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  148. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +1 -5
  149. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  150. package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
  151. package/lib/esm/core-react/dialog/Dialog.js +1 -3
  152. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  153. package/lib/esm/core-react/dialog/GlobalDialog.d.ts.map +1 -1
  154. package/lib/esm/core-react/dialog/GlobalDialog.js +0 -1
  155. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  156. package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  157. package/lib/esm/core-react/elementseparator/ElementSeparator.js +1 -5
  158. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  159. package/lib/esm/core-react/elementseparator/ElementSeparator.scss +1 -0
  160. package/lib/esm/core-react/expandable/ExpandableList.d.ts.map +1 -1
  161. package/lib/esm/core-react/expandable/ExpandableList.js +0 -1
  162. package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
  163. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  164. package/lib/esm/core-react/focus/ItemKeyboardNavigator.js +0 -2
  165. package/lib/esm/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  166. package/lib/esm/core-react/focustrap/FocusTrap.d.ts.map +1 -1
  167. package/lib/esm/core-react/focustrap/FocusTrap.js +1 -14
  168. package/lib/esm/core-react/focustrap/FocusTrap.js.map +1 -1
  169. package/lib/esm/core-react/hocs/withIsPressed.d.ts +5 -9
  170. package/lib/esm/core-react/hocs/withIsPressed.d.ts.map +1 -1
  171. package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts +5 -9
  172. package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts.map +1 -1
  173. package/lib/esm/core-react/hocs/withOnOutsideClick.js +0 -6
  174. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  175. package/lib/esm/core-react/hocs/withTimeout.d.ts +5 -9
  176. package/lib/esm/core-react/hocs/withTimeout.d.ts.map +1 -1
  177. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
  178. package/lib/esm/core-react/icons/ConditionalIconItem.js +0 -8
  179. package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -1
  180. package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
  181. package/lib/esm/core-react/icons/IconComponent.js +0 -1
  182. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  183. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
  184. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js +0 -4
  185. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  186. package/lib/esm/core-react/inputs/Input.d.ts +1 -1
  187. package/lib/esm/core-react/inputs/Input.d.ts.map +1 -1
  188. package/lib/esm/core-react/inputs/Input.js.map +1 -1
  189. package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts +1 -1
  190. package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts.map +1 -1
  191. package/lib/esm/core-react/inputs/iconinput/IconInput.js.map +1 -1
  192. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +1 -1
  193. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  194. package/lib/esm/core-react/inputs/numberinput/NumberInput.js +0 -1
  195. package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  196. package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
  197. package/lib/esm/core-react/listbox/Listbox.js +0 -11
  198. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  199. package/lib/esm/core-react/messagebox/MessageBox.js +0 -2
  200. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  201. package/lib/esm/core-react/notification/MessageRenderer.d.ts.map +1 -1
  202. package/lib/esm/core-react/notification/MessageRenderer.js +0 -3
  203. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  204. package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
  205. package/lib/esm/core-react/popup/Popup.js +2 -14
  206. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  207. package/lib/esm/core-react/radialmenu/Annulus.d.ts.map +1 -1
  208. package/lib/esm/core-react/radialmenu/Annulus.js +1 -1
  209. package/lib/esm/core-react/radialmenu/Annulus.js.map +1 -1
  210. package/lib/esm/core-react/radialmenu/RadialMenu.d.ts +6 -5
  211. package/lib/esm/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
  212. package/lib/esm/core-react/radialmenu/RadialMenu.js +4 -9
  213. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  214. package/lib/esm/core-react/searchbox/SearchBox.d.ts.map +1 -1
  215. package/lib/esm/core-react/searchbox/SearchBox.js +0 -7
  216. package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
  217. package/lib/esm/core-react/settings/SettingsContainer.d.ts.map +1 -1
  218. package/lib/esm/core-react/settings/SettingsContainer.js +0 -1
  219. package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
  220. package/lib/esm/core-react/tabs/Tabs.d.ts.map +1 -1
  221. package/lib/esm/core-react/tabs/Tabs.js +0 -4
  222. package/lib/esm/core-react/tabs/Tabs.js.map +1 -1
  223. package/lib/esm/core-react/text/FilteredText.d.ts.map +1 -1
  224. package/lib/esm/core-react/text/FilteredText.js +0 -3
  225. package/lib/esm/core-react/text/FilteredText.js.map +1 -1
  226. package/lib/esm/core-react/tree/Node.d.ts +1 -1
  227. package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
  228. package/lib/esm/core-react/tree/Node.js.map +1 -1
  229. package/lib/esm/core-react/tree/Tree.d.ts.map +1 -1
  230. package/lib/esm/core-react/tree/Tree.js +0 -3
  231. package/lib/esm/core-react/tree/Tree.js.map +1 -1
  232. package/lib/esm/core-react/utils/IconHelper.d.ts.map +1 -1
  233. package/lib/esm/core-react/utils/IconHelper.js +0 -8
  234. package/lib/esm/core-react/utils/IconHelper.js.map +1 -1
  235. package/lib/esm/core-react/utils/IconWebComponent.d.ts.map +1 -1
  236. package/lib/esm/core-react/utils/IconWebComponent.js +0 -1
  237. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  238. package/lib/esm/core-react/utils/ScrollPositionMaintainer.d.ts.map +1 -1
  239. package/lib/esm/core-react/utils/ScrollPositionMaintainer.js +0 -2
  240. package/lib/esm/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  241. package/lib/esm/core-react/utils/flattenChildren.d.ts.map +1 -1
  242. package/lib/esm/core-react/utils/flattenChildren.js +0 -1
  243. package/lib/esm/core-react/utils/flattenChildren.js.map +1 -1
  244. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  245. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.js +0 -1
  246. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.js.map +1 -1
  247. package/lib/esm/core-react/utils/hooks/useEventListener.d.ts.map +1 -1
  248. package/lib/esm/core-react/utils/hooks/useEventListener.js +0 -1
  249. package/lib/esm/core-react/utils/hooks/useEventListener.js.map +1 -1
  250. package/lib/esm/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
  251. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js +0 -1
  252. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  253. package/lib/esm/core-react/utils/hooks/useRefs.d.ts.map +1 -1
  254. package/lib/esm/core-react/utils/hooks/useRefs.js +0 -2
  255. package/lib/esm/core-react/utils/hooks/useRefs.js.map +1 -1
  256. package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts.map +1 -1
  257. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +1 -17
  258. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  259. package/lib/esm/core-react/utils/hooks/useWidgetOpacityContext.d.ts.map +1 -1
  260. package/lib/esm/core-react/utils/hooks/useWidgetOpacityContext.js +1 -1
  261. package/lib/esm/core-react/utils/hooks/useWidgetOpacityContext.js.map +1 -1
  262. package/package.json +9 -11
@@ -43,7 +43,6 @@ class ContextSubMenu extends React.Component {
43
43
  };
44
44
  this.select = () => {
45
45
  this.setState({ opened: true }, () => {
46
- // istanbul ignore else
47
46
  if (this._menuElement)
48
47
  this._menuElement.focus();
49
48
  if (this.props.onSelect !== undefined)
@@ -52,11 +51,9 @@ class ContextSubMenu extends React.Component {
52
51
  };
53
52
  this.close = (propagate) => {
54
53
  this.setState({ opened: false }, () => {
55
- // istanbul ignore else
56
54
  if (this._menuElement)
57
55
  this._menuElement.blur();
58
56
  });
59
- // istanbul ignore next
60
57
  if (propagate &&
61
58
  this.props.parentMenu &&
62
59
  this.props.parentMenu.props.parentSubmenu) {
@@ -64,7 +61,6 @@ class ContextSubMenu extends React.Component {
64
61
  }
65
62
  };
66
63
  this._handleMouseOver = (_event) => {
67
- // istanbul ignore else
68
64
  if (this._menuButtonElement &&
69
65
  this._menuButtonElement.style.visibility !== "hidden" &&
70
66
  this.props.onHover) {
@@ -74,12 +70,9 @@ class ContextSubMenu extends React.Component {
74
70
  this._handleClick = (event) => {
75
71
  event.stopPropagation();
76
72
  const isDisabled = appui_abstract_1.ConditionalBooleanValue.getValue(this.props.disabled);
77
- // istanbul ignore else
78
73
  if (!isDisabled) {
79
- // istanbul ignore else
80
74
  if (this.props.onClick !== undefined)
81
75
  this.props.onClick(event);
82
- // istanbul ignore next
83
76
  if (this.props.opened)
84
77
  this.close();
85
78
  else
@@ -96,7 +89,7 @@ class ContextSubMenu extends React.Component {
96
89
  };
97
90
  }
98
91
  render() {
99
- const { label, opened, direction, onOutsideClick, onEsc, autoflip, edgeLimit, selectedIndex, floating, parentMenu, parentSubmenu, onSelect, icon, disabled, hidden, onHover, isSelected, onHotKeyParsed, children, onClick, className, badgeType, ...props } = this.props;
92
+ const { label, opened, direction, onOutsideClick, onEsc, autoflip, edgeLimit, selectedIndex, floating, parentMenu, parentSubmenu, onSelect, icon, disabled, hidden, onHover, isSelected, onHotKeyParsed, children, onClick, className, badgeType, hideIconContainer, ...props } = this.props;
100
93
  const onOutsideClickWrapper = (event) => {
101
94
  this.close();
102
95
  onOutsideClick && onOutsideClick(event);
@@ -126,7 +119,7 @@ class ContextSubMenu extends React.Component {
126
119
  React.createElement("div", { onClick: this._handleClick, ref: (el) => {
127
120
  this._menuButtonElement = el;
128
121
  }, className: (0, classnames_1.default)("core-context-menu-item", "core-context-submenu-container", isDisabled && "core-context-menu-disabled", isHidden && "core-context-menu-hidden", isSelected && "core-context-menu-is-selected"), "data-testid": "core-context-submenu-container", role: "menuitem", tabIndex: isSelected ? 0 : -1, "aria-disabled": isDisabled, "aria-hidden": isHidden, "aria-haspopup": true },
129
- React.createElement("div", { className: (0, classnames_1.default)("core-context-menu-icon", "icon", icon) }),
122
+ !hideIconContainer && (React.createElement("div", { className: "core-context-menu-icon" }, icon !== undefined && React.createElement(IconComponent_1.Icon, { iconSpec: icon }))),
130
123
  React.createElement("div", { className: "core-context-menu-content" }, this._parsedLabel),
131
124
  React.createElement("div", { className: (0, classnames_1.default)("core-context-submenu-arrow", "icon") },
132
125
  React.createElement(IconComponent_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgCaretRightSmall, null) })),
@@ -163,11 +156,9 @@ class ContextSubMenu extends React.Component {
163
156
  const { autoflip } = this.props;
164
157
  const parentWindow = this.getWindow();
165
158
  let renderDirection = this.state.direction;
166
- // istanbul ignore else
167
159
  if (parentWindow && autoflip && this._menuElement) {
168
160
  const menuRect = this._menuElement.getRect();
169
161
  renderDirection = ContextMenu_1.ContextMenu.autoFlip(renderDirection, menuRect, parentWindow.innerWidth, parentWindow.innerHeight);
170
- // istanbul ignore next
171
162
  if (renderDirection !== this.state.direction)
172
163
  this.setState({ direction: renderDirection });
173
164
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContextSubMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextSubMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AACpC,0DAAgE;AAGhE,+CAA4C;AAE5C,iEAA8D;AAC9D,+CAA4C;AAC5C,0DAA8C;AAC9C,oEAAgE;AAChE,0CAAuC;AAsBvC;;;GAGG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,SAGzC;IAmBC,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAnBP,iBAAY,GAAuB,IAAI,CAAC;QACxC,oBAAe,GAAuB,IAAI,CAAC;QAC3C,uBAAkB,GAAuB,IAAI,CAAC;QA2L9C,kBAAa,GAAG,CAAC,IAAqB,EAAE,EAAE;YAChD,IAAI,MAA0B,CAAC;YAC/B,MAAM,UAAU,GAAG,wCAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACzE,MAA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EAAE,CAAC;QACtC,IAAI,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC3C,uBAAuB;QACvB,IAAI,YAAY,IAAI,QAAQ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC7C,eAAe,GAAG,yBAAW,CAAC,QAAQ,CACpC,eAAe,EACf,QAAQ,EACR,YAAY,CAAC,UAAU,EACvB,YAAY,CAAC,WAAW,CACzB,CAAC;YACF,uBAAuB;YACvB,IAAI,eAAe,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;gBAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;;AA/LH,wCAmQC;AAxPe,2BAAY,GAAiC;IACzD,SAAS,EAAE,2CAAoB,CAAC,WAAW;IAC3C,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,CAAC;CACjB,AAPyB,CAOxB","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport type { ContextMenuProps } from \"./ContextMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { SvgCaretRightSmall } from \"@itwin/itwinui-icons-react\";\nimport { Badge } from \"../badge/Badge\";\n\n/** Properties for the [[ContextSubMenu]] component\n * @public\n */\nexport interface ContextSubMenuProps\n extends Omit<ContextMenuItemProps, \"label\">,\n Omit<ContextMenuProps, \"label\">,\n CommonProps {\n /** Text/jsx to display in the list item */\n label: string | React.ReactElement;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n}\n\n/** @internal */\ninterface ContextSubMenuState {\n opened: boolean;\n direction: ContextMenuDirection;\n hotKey?: string;\n}\n\n/**\n * Submenu wrapper class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextSubMenu extends React.Component<\n ContextSubMenuProps,\n ContextSubMenuState\n> {\n private _menuElement: ContextMenu | null = null;\n private _subMenuElement: HTMLElement | null = null;\n private _menuButtonElement: HTMLElement | null = null;\n\n private _lastLabel: React.ReactNode;\n private _parsedLabel: React.ReactNode;\n\n public static defaultProps: Partial<ContextSubMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n disabled: false,\n hidden: false,\n autoflip: true,\n isSelected: false,\n selectedIndex: 0,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextSubMenuState>;\n constructor(props: ContextSubMenuProps) {\n super(props);\n this.state = {\n opened: false,\n direction: props.direction!,\n };\n }\n\n public override render(): React.ReactElement {\n const {\n label,\n opened,\n direction,\n onOutsideClick,\n onEsc,\n autoflip,\n edgeLimit,\n selectedIndex,\n floating,\n parentMenu,\n parentSubmenu,\n onSelect,\n icon,\n disabled,\n hidden,\n onHover,\n isSelected,\n onHotKeyParsed,\n children,\n onClick,\n className,\n badgeType,\n ...props\n } = this.props;\n\n const onOutsideClickWrapper = (event: MouseEvent) => {\n this.close();\n onOutsideClick && onOutsideClick(event);\n };\n const contextMenuProps = {\n onOutsideClick: onOutsideClickWrapper,\n onSelect,\n onEsc,\n autoflip,\n edgeLimit,\n selectedIndex,\n floating,\n parentMenu,\n };\n const renderDirection = this.state.direction;\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastLabel !== label) {\n this._parsedLabel = TildeFinder.findAfterTilde(label).node;\n this._lastLabel = label;\n }\n return (\n <div\n className={classnames(\n \"core-context-submenu\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection),\n className\n )}\n // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events\n onMouseOver={this._handleMouseOver}\n ref={(el) => {\n this._subMenuElement = el;\n }}\n data-testid=\"core-context-submenu\"\n {...props}\n >\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n onClick={this._handleClick}\n ref={(el) => {\n this._menuButtonElement = el;\n }}\n className={classnames(\n \"core-context-menu-item\",\n \"core-context-submenu-container\",\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\"\n )}\n data-testid=\"core-context-submenu-container\"\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n aria-haspopup={true}\n >\n <div className={classnames(\"core-context-menu-icon\", \"icon\", icon)} />\n <div className={\"core-context-menu-content\"}>{this._parsedLabel}</div>\n <div className={classnames(\"core-context-submenu-arrow\", \"icon\")}>\n <Icon iconSpec={<SvgCaretRightSmall />} />\n </div>\n {badgeType && (\n <div className=\"core-context-menu-badge\">\n <Badge type={badgeType} />\n </div>\n )}\n </div>\n <ContextMenu\n ref={(el) => {\n this._menuElement = el;\n }}\n className=\"core-context-submenu-popup\"\n opened={this.state.opened}\n direction={renderDirection}\n parentSubmenu={this}\n {...contextMenuProps}\n >\n {children}\n </ContextMenu>\n </div>\n );\n }\n\n public override componentDidMount() {\n document.addEventListener(\"click\", this._handleClickGlobal);\n this._updateHotkey(this.props.label);\n\n this.checkRenderDirection();\n }\n\n public override componentWillUnmount() {\n document.removeEventListener(\"click\", this._handleClickGlobal);\n }\n\n public override componentDidUpdate(\n prevProps: ContextSubMenuProps,\n prevState: ContextSubMenuState\n ) {\n const direction = this.props.direction!;\n if (\n (this.state.opened !== prevState.opened &&\n direction !== this.state.direction) ||\n prevProps.direction !== direction\n )\n this.checkRenderDirection();\n if (this.props.label !== prevProps.label) {\n this._updateHotkey(this.props.label);\n }\n }\n\n private getWindow() {\n const el = this._subMenuElement;\n const parentDocument = el!.ownerDocument;\n return parentDocument.defaultView;\n }\n\n private checkRenderDirection() {\n const { autoflip } = this.props;\n const parentWindow = this.getWindow();\n let renderDirection = this.state.direction;\n // istanbul ignore else\n if (parentWindow && autoflip && this._menuElement) {\n const menuRect = this._menuElement.getRect();\n renderDirection = ContextMenu.autoFlip(\n renderDirection,\n menuRect,\n parentWindow.innerWidth,\n parentWindow.innerHeight\n );\n // istanbul ignore next\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n private _updateHotkey = (node: React.ReactNode) => {\n let hotKey: string | undefined;\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n const isHidden = ConditionalBooleanValue.getValue(this.props.hidden);\n if (!isDisabled && !isHidden)\n hotKey = TildeFinder.findAfterTilde(node).character;\n else hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed) this.props.onHotKeyParsed(hotKey);\n }\n };\n\n public select = () => {\n this.setState({ opened: true }, () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.focus();\n if (this.props.onSelect !== undefined) this.props.onSelect(undefined);\n });\n };\n\n public close = (propagate?: boolean) => {\n this.setState({ opened: false }, () => {\n // istanbul ignore else\n if (this._menuElement) this._menuElement.blur();\n });\n // istanbul ignore next\n if (\n propagate &&\n this.props.parentMenu &&\n this.props.parentMenu.props.parentSubmenu\n ) {\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (\n this._menuButtonElement &&\n this._menuButtonElement.style.visibility !== \"hidden\" &&\n this.props.onHover\n ) {\n this.props.onHover();\n }\n };\n\n private _handleClick = (event: any) => {\n event.stopPropagation();\n\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n\n // istanbul ignore else\n if (!isDisabled) {\n // istanbul ignore else\n if (this.props.onClick !== undefined) this.props.onClick(event);\n // istanbul ignore next\n if (this.props.opened) this.close();\n else this.select();\n }\n };\n\n private _handleClickGlobal = (event: any) => {\n if (this._subMenuElement && !this._subMenuElement.contains(event.target))\n this.setState((_prevState) => ({ opened: false }));\n };\n}\n"]}
1
+ {"version":3,"file":"ContextSubMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextSubMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AACpC,0DAAgE;AAGhE,+CAA4C;AAE5C,iEAA8D;AAC9D,+CAA4C;AAC5C,0DAA8C;AAC9C,oEAAgE;AAChE,0CAAuC;AAsBvC;;;GAGG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,SAGzC;IAmBC,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAnBP,iBAAY,GAAuB,IAAI,CAAC;QACxC,oBAAe,GAAuB,IAAI,CAAC;QAC3C,uBAAkB,GAAuB,IAAI,CAAC;QA8L9C,kBAAa,GAAG,CAAC,IAAqB,EAAE,EAAE;YAChD,IAAI,MAA0B,CAAC;YAC/B,MAAM,UAAU,GAAG,wCAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACzE,MAAM,QAAQ,GAAG,wCAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACrE,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ;gBAC1B,MAAM,GAAG,yBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;;gBACjD,MAAM,GAAG,SAAS,CAAC;YACxB,IAAI,MAAM,IAA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,EACvB,YAAY,CAAC,WAAW,CACzB,CAAC;YACF,IAAI,eAAe,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;gBAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;;AAlMH,wCA+PC;AApPe,2BAAY,GAAiC;IACzD,SAAS,EAAE,2CAAoB,CAAC,WAAW;IAC3C,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,CAAC;CACjB,AAPyB,CAOxB","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport type { ContextMenuProps } from \"./ContextMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { SvgCaretRightSmall } from \"@itwin/itwinui-icons-react\";\nimport { Badge } from \"../badge/Badge\";\n\n/** Properties for the [[ContextSubMenu]] component\n * @public\n */\nexport interface ContextSubMenuProps\n extends Omit<ContextMenuItemProps, \"label\">,\n Omit<ContextMenuProps, \"label\">,\n CommonProps {\n /** Text/jsx to display in the list item */\n label: string | React.ReactElement;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n}\n\n/** @internal */\ninterface ContextSubMenuState {\n opened: boolean;\n direction: ContextMenuDirection;\n hotKey?: string;\n}\n\n/**\n * Submenu wrapper class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextSubMenu extends React.Component<\n ContextSubMenuProps,\n ContextSubMenuState\n> {\n private _menuElement: ContextMenu | null = null;\n private _subMenuElement: HTMLElement | null = null;\n private _menuButtonElement: HTMLElement | null = null;\n\n private _lastLabel: React.ReactNode;\n private _parsedLabel: React.ReactNode;\n\n public static defaultProps: Partial<ContextSubMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n disabled: false,\n hidden: false,\n autoflip: true,\n isSelected: false,\n selectedIndex: 0,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextSubMenuState>;\n constructor(props: ContextSubMenuProps) {\n super(props);\n this.state = {\n opened: false,\n direction: props.direction!,\n };\n }\n\n public override render(): React.ReactElement {\n const {\n label,\n opened,\n direction,\n onOutsideClick,\n onEsc,\n autoflip,\n edgeLimit,\n selectedIndex,\n floating,\n parentMenu,\n parentSubmenu,\n onSelect,\n icon,\n disabled,\n hidden,\n onHover,\n isSelected,\n onHotKeyParsed,\n children,\n onClick,\n className,\n badgeType,\n hideIconContainer,\n ...props\n } = this.props;\n\n const onOutsideClickWrapper = (event: MouseEvent) => {\n this.close();\n onOutsideClick && onOutsideClick(event);\n };\n const contextMenuProps = {\n onOutsideClick: onOutsideClickWrapper,\n onSelect,\n onEsc,\n autoflip,\n edgeLimit,\n selectedIndex,\n floating,\n parentMenu,\n };\n const renderDirection = this.state.direction;\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastLabel !== label) {\n this._parsedLabel = TildeFinder.findAfterTilde(label).node;\n this._lastLabel = label;\n }\n return (\n <div\n className={classnames(\n \"core-context-submenu\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection),\n className\n )}\n // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events\n onMouseOver={this._handleMouseOver}\n ref={(el) => {\n this._subMenuElement = el;\n }}\n data-testid=\"core-context-submenu\"\n {...props}\n >\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n onClick={this._handleClick}\n ref={(el) => {\n this._menuButtonElement = el;\n }}\n className={classnames(\n \"core-context-menu-item\",\n \"core-context-submenu-container\",\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\"\n )}\n data-testid=\"core-context-submenu-container\"\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n aria-haspopup={true}\n >\n {!hideIconContainer && (\n <div className=\"core-context-menu-icon\">\n {icon !== undefined && <Icon iconSpec={icon} />}\n </div>\n )}\n <div className={\"core-context-menu-content\"}>{this._parsedLabel}</div>\n <div className={classnames(\"core-context-submenu-arrow\", \"icon\")}>\n <Icon iconSpec={<SvgCaretRightSmall />} />\n </div>\n {badgeType && (\n <div className=\"core-context-menu-badge\">\n <Badge type={badgeType} />\n </div>\n )}\n </div>\n <ContextMenu\n ref={(el) => {\n this._menuElement = el;\n }}\n className=\"core-context-submenu-popup\"\n opened={this.state.opened}\n direction={renderDirection}\n parentSubmenu={this}\n {...contextMenuProps}\n >\n {children}\n </ContextMenu>\n </div>\n );\n }\n\n public override componentDidMount() {\n document.addEventListener(\"click\", this._handleClickGlobal);\n this._updateHotkey(this.props.label);\n\n this.checkRenderDirection();\n }\n\n public override componentWillUnmount() {\n document.removeEventListener(\"click\", this._handleClickGlobal);\n }\n\n public override componentDidUpdate(\n prevProps: ContextSubMenuProps,\n prevState: ContextSubMenuState\n ) {\n const direction = this.props.direction!;\n if (\n (this.state.opened !== prevState.opened &&\n direction !== this.state.direction) ||\n prevProps.direction !== direction\n )\n this.checkRenderDirection();\n if (this.props.label !== prevProps.label) {\n this._updateHotkey(this.props.label);\n }\n }\n\n private getWindow() {\n const el = this._subMenuElement;\n const parentDocument = el!.ownerDocument;\n return parentDocument.defaultView;\n }\n\n private checkRenderDirection() {\n const { autoflip } = this.props;\n const parentWindow = this.getWindow();\n let renderDirection = this.state.direction;\n if (parentWindow && autoflip && this._menuElement) {\n const menuRect = this._menuElement.getRect();\n renderDirection = ContextMenu.autoFlip(\n renderDirection,\n menuRect,\n parentWindow.innerWidth,\n parentWindow.innerHeight\n );\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n private _updateHotkey = (node: React.ReactNode) => {\n let hotKey: string | undefined;\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n const isHidden = ConditionalBooleanValue.getValue(this.props.hidden);\n if (!isDisabled && !isHidden)\n hotKey = TildeFinder.findAfterTilde(node).character;\n else hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed) this.props.onHotKeyParsed(hotKey);\n }\n };\n\n public select = () => {\n this.setState({ opened: true }, () => {\n if (this._menuElement) this._menuElement.focus();\n if (this.props.onSelect !== undefined) this.props.onSelect(undefined);\n });\n };\n\n public close = (propagate?: boolean) => {\n this.setState({ opened: false }, () => {\n if (this._menuElement) this._menuElement.blur();\n });\n if (\n propagate &&\n this.props.parentMenu &&\n this.props.parentMenu.props.parentSubmenu\n ) {\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n if (\n this._menuButtonElement &&\n this._menuButtonElement.style.visibility !== \"hidden\" &&\n this.props.onHover\n ) {\n this.props.onHover();\n }\n };\n\n private _handleClick = (event: any) => {\n event.stopPropagation();\n\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n\n if (!isDisabled) {\n if (this.props.onClick !== undefined) this.props.onClick(event);\n if (this.props.opened) this.close();\n else this.select();\n }\n };\n\n private _handleClickGlobal = (event: any) => {\n if (this._subMenuElement && !this._subMenuElement.contains(event.target))\n this.setState((_prevState) => ({ opened: false }));\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalContextMenu.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/GlobalContextMenu.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,qJAAqJ;IACrJ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,yDAAyD;IACzD,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAC9D;AAED,gBAAgB;AAChB,UAAU,sBAAsB;IAC9B,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAC;CACjC;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,aAAa,CACxD,sBAAsB,EACtB,sBAAsB,CACvB;IACC,OAAO,CAAC,UAAU,CAAC,CAAiB;IAEpC,SAAyB,KAAK,EAAE,sBAAsB,CAEpD;gBAEU,KAAK,EAAE,sBAAsB;IAIzB,oBAAoB;IAQpC,OAAO,CAAC,aAAa,CA0BnB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;CAwB1C"}
1
+ {"version":3,"file":"GlobalContextMenu.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/GlobalContextMenu.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,qJAAqJ;IACrJ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,yDAAyD;IACzD,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAC9D;AAED,gBAAgB;AAChB,UAAU,sBAAsB;IAC9B,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAC;CACjC;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK,CAAC,aAAa,CACxD,sBAAsB,EACtB,sBAAsB,CACvB;IACC,OAAO,CAAC,UAAU,CAAC,CAAiB;IAEpC,SAAyB,KAAK,EAAE,sBAAsB,CAEpD;gBAEU,KAAK,EAAE,sBAAsB;IAIzB,oBAAoB;IAOpC,OAAO,CAAC,aAAa,CAyBnB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;CAuB1C"}
@@ -32,7 +32,6 @@ class GlobalContextMenu extends React.PureComponent {
32
32
  if (!rt) {
33
33
  rt = parentDocument.createElement("div");
34
34
  rt.id = "core-global-context-menu-root";
35
- // istanbul ignore next
36
35
  (parentDocument.body.querySelector('[data-root-container="appui-root-id"]') ?? parentDocument.body).appendChild(rt);
37
36
  }
38
37
  rt.appendChild(this._container);
@@ -42,7 +41,6 @@ class GlobalContextMenu extends React.PureComponent {
42
41
  };
43
42
  }
44
43
  componentWillUnmount() {
45
- // istanbul ignore else
46
44
  if (this._container && this._container.parentElement) {
47
45
  // cleanup
48
46
  this._container.parentElement.removeChild(this._container);
@@ -57,9 +55,7 @@ class GlobalContextMenu extends React.PureComponent {
57
55
  const CtxMenu = contextMenuComponent || ContextMenu_1.ContextMenu;
58
56
  return (React.createElement("div", { ref: this._handleRefSet, style: { display: "none" } }, this.state.parentDocument &&
59
57
  ReactDOM.createPortal(React.createElement("div", { className: "core-context-menu-global", style: positioningStyle },
60
- React.createElement(CtxMenu, { ...props })),
61
- // istanbul ignore next
62
- this.state.parentDocument.body.querySelector('[data-root-container="appui-root-id"]') ?? this.state.parentDocument.body)));
58
+ React.createElement(CtxMenu, { ...props })), this.state.parentDocument.body.querySelector('[data-root-container="appui-root-id"]') ?? this.state.parentDocument.body)));
63
59
  }
64
60
  }
65
61
  exports.GlobalContextMenu = GlobalContextMenu;
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/GlobalContextMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,sCAAsC;AAEtC,+CAA4C;AAqB5C;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK,CAAC,aAG5C;IAOC,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QALU,UAAK,GAA2B;YACvD,cAAc,EAAE,IAAI;SACrB,CAAC;QAcM,kBAAa,GAAG,CAAC,QAA4B,EAAE,EAAE;YACvD,MAAM,cAAc,GAAG,QAAQ,EAAE,aAAa,IAAI,IAAI,CAAC;YACvD,IAAI,cAAc,EAAE,CAAC;gBACnB,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,CAAC,UAAU,CAAC,EAAE;oBAChB,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS;wBACjC,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;wBACnC,CAAC,CAAC,0BAA0B,CAAC;gBACjC,IAAI,EAAE,GAAG,cAAc,CAAC,cAAc,CACpC,+BAA+B,CACd,CAAC;gBACpB,IAAI,CAAC,EAAE,EAAE,CAAC;oBACR,EAAE,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;oBACzC,EAAE,CAAC,EAAE,GAAG,+BAA+B,CAAC;oBACxC,uBAAuB;oBACvB,CACE,cAAc,CAAC,IAAI,CAAC,aAAa,CAC/B,uCAAuC,CACxC,IAAI,cAAc,CAAC,IAAI,CACzB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;gBACpB,CAAC;gBACD,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAEhC,wDAAwD;gBACxD,IAAI,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC;IApCF,CAAC;IAEe,oBAAoB;QAClC,uBAAuB;QACvB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;YACrD,UAAU;YACV,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IA8Be,MAAM;QACpB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxE,MAAM,gBAAgB,GAAwB;YAC5C,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;SACP,CAAC;QAEF,MAAM,OAAO,GAAG,oBAAoB,IAAI,yBAAW,CAAC;QAEpD,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IACrD,IAAI,CAAC,KAAK,CAAC,cAAc;YACxB,QAAQ,CAAC,YAAY,CACnB,6BAAK,SAAS,EAAC,0BAA0B,EAAC,KAAK,EAAE,gBAAgB;gBAC/D,oBAAC,OAAO,OAAK,KAAK,GAAI,CAClB;YACN,uBAAuB;YACvB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAC1C,uCAAuC,CACxC,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CACpC,CACC,CACP,CAAC;IACJ,CAAC;CACF;AA1ED,8CA0EC","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport type { ContextMenuProps } from \"./ContextMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\n\n/** Properties for the [[GlobalContextMenu]] component\n * @public\n */\nexport interface GlobalContextMenuProps extends ContextMenuProps {\n /** Unique identifier, to distinguish from other GlobalContextMenu components. Needed only if multiple GlobalContextMenus are used simultaneously. */\n identifier?: string;\n /** Specifies the x/horizontal position on the viewport. */\n x: number | string;\n /** Specifies the y/vertical position on the viewport. */\n y: number | string;\n /** Context menu element. Default: ContextMenu */\n contextMenuComponent?: React.ComponentType<ContextMenuProps>;\n}\n\n/** @internal */\ninterface GlobalContextMenuState {\n parentDocument: Document | null;\n}\n\n/** GlobalContextMenu React component used to display a [[ContextMenu]] at the cursor\n * @public\n */\nexport class GlobalContextMenu extends React.PureComponent<\n GlobalContextMenuProps,\n GlobalContextMenuState\n> {\n private _container?: HTMLDivElement;\n\n public override readonly state: GlobalContextMenuState = {\n parentDocument: null,\n };\n\n constructor(props: GlobalContextMenuProps) {\n super(props);\n }\n\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._container && this._container.parentElement) {\n // cleanup\n this._container.parentElement.removeChild(this._container);\n }\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n const parentDocument = popupDiv?.ownerDocument ?? null;\n if (parentDocument) {\n this._container = parentDocument.createElement(\"div\");\n this._container.id =\n this.props.identifier !== undefined\n ? `dialog-${this.props.identifier}`\n : \"core-global-context-menu\";\n let rt = parentDocument.getElementById(\n \"core-global-context-menu-root\"\n ) as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-global-context-menu-root\";\n // istanbul ignore next\n (\n parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? parentDocument.body\n ).appendChild(rt);\n }\n rt.appendChild(this._container);\n\n // used to support component rendering in pop-out window\n this.setState({ parentDocument });\n }\n };\n\n public override render(): React.ReactNode {\n const { x, y, identifier, contextMenuComponent, ...props } = this.props;\n const positioningStyle: React.CSSProperties = {\n left: x,\n top: y,\n };\n\n const CtxMenu = contextMenuComponent || ContextMenu;\n\n return (\n <div ref={this._handleRefSet} style={{ display: \"none\" }}>\n {this.state.parentDocument &&\n ReactDOM.createPortal(\n <div className=\"core-context-menu-global\" style={positioningStyle}>\n <CtxMenu {...props} />\n </div>,\n // istanbul ignore next\n this.state.parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? this.state.parentDocument.body\n )}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"GlobalContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/GlobalContextMenu.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,sCAAsC;AAEtC,+CAA4C;AAqB5C;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK,CAAC,aAG5C;IAOC,YAAY,KAA6B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QALU,UAAK,GAA2B;YACvD,cAAc,EAAE,IAAI;SACrB,CAAC;QAaM,kBAAa,GAAG,CAAC,QAA4B,EAAE,EAAE;YACvD,MAAM,cAAc,GAAG,QAAQ,EAAE,aAAa,IAAI,IAAI,CAAC;YACvD,IAAI,cAAc,EAAE,CAAC;gBACnB,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,CAAC,UAAU,CAAC,EAAE;oBAChB,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS;wBACjC,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;wBACnC,CAAC,CAAC,0BAA0B,CAAC;gBACjC,IAAI,EAAE,GAAG,cAAc,CAAC,cAAc,C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AAI,CAClB,EACN,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAC1C,uCAAuC,CACxC,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CACpC,CACC,CACP,CAAC;IACJ,CAAC;CACF;AAvED,8CAuEC","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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport type { ContextMenuProps } from \"./ContextMenu\";\nimport { ContextMenu } from \"./ContextMenu\";\n\n/** Properties for the [[GlobalContextMenu]] component\n * @public\n */\nexport interface GlobalContextMenuProps extends ContextMenuProps {\n /** Unique identifier, to distinguish from other GlobalContextMenu components. Needed only if multiple GlobalContextMenus are used simultaneously. */\n identifier?: string;\n /** Specifies the x/horizontal position on the viewport. */\n x: number | string;\n /** Specifies the y/vertical position on the viewport. */\n y: number | string;\n /** Context menu element. Default: ContextMenu */\n contextMenuComponent?: React.ComponentType<ContextMenuProps>;\n}\n\n/** @internal */\ninterface GlobalContextMenuState {\n parentDocument: Document | null;\n}\n\n/** GlobalContextMenu React component used to display a [[ContextMenu]] at the cursor\n * @public\n */\nexport class GlobalContextMenu extends React.PureComponent<\n GlobalContextMenuProps,\n GlobalContextMenuState\n> {\n private _container?: HTMLDivElement;\n\n public override readonly state: GlobalContextMenuState = {\n parentDocument: null,\n };\n\n constructor(props: GlobalContextMenuProps) {\n super(props);\n }\n\n public override componentWillUnmount() {\n if (this._container && this._container.parentElement) {\n // cleanup\n this._container.parentElement.removeChild(this._container);\n }\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n const parentDocument = popupDiv?.ownerDocument ?? null;\n if (parentDocument) {\n this._container = parentDocument.createElement(\"div\");\n this._container.id =\n this.props.identifier !== undefined\n ? `dialog-${this.props.identifier}`\n : \"core-global-context-menu\";\n let rt = parentDocument.getElementById(\n \"core-global-context-menu-root\"\n ) as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-global-context-menu-root\";\n (\n parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? parentDocument.body\n ).appendChild(rt);\n }\n rt.appendChild(this._container);\n\n // used to support component rendering in pop-out window\n this.setState({ parentDocument });\n }\n };\n\n public override render(): React.ReactNode {\n const { x, y, identifier, contextMenuComponent, ...props } = this.props;\n const positioningStyle: React.CSSProperties = {\n left: x,\n top: y,\n };\n\n const CtxMenu = contextMenuComponent || ContextMenu;\n\n return (\n <div ref={this._handleRefSet} style={{ display: \"none\" }}>\n {this.state.parentDocument &&\n ReactDOM.createPortal(\n <div className=\"core-context-menu-global\" style={positioningStyle}>\n <CtxMenu {...props} />\n </div>,\n this.state.parentDocument.body.querySelector(\n '[data-root-container=\"appui-root-id\"]'\n ) ?? this.state.parentDocument.body\n )}\n </div>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAwB,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,eAAe,CAAC;AAGvB,KAAK,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,MAAM,CAAC,CAAC;AAEjE;;;GAGG;AACH,oBAAY,eAAe;IACzB,OAAO,aAAa;IACpB,GAAG,QAAQ;IACX,QAAQ,cA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AClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAExE,mCAAmC;IACnC,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACtC,iCAAiC;IACjC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,kCAAkC;IAClC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACpC;AAED;;;GAGG;AAEH,qBAAa,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACtD,OAAO,CAAC,eAAe,CAAY;IAEnC,OAAc,YAAY,EAAE,OAAO,CAAC,WAAW,CAAC,CAS9C;gBAGU,KAAK,EAAE,WAAW;IAId,oBAAoB,IAAI,IAAI;IAI5B,iBAAiB,IAAI,IAAI;IAIlC,YAAY,iBAAkB,cAAc,GAAG,IAAI,UAExD;IAEc,MAAM,IAAI,KAAK,CAAC,YAAY;IA8H5C,OAAO,CAAC,4BAA4B;IAgCpC,yDAAyD;IACzD,SAAS,CAAC,gBAAgB,CACxB,aAAa,EAAE,eAAe,EAAE,GAAG,SAAS,EAC5C,gBAAgB,GAAE,WAAW,CAAC,WAAW,CAAS,EAClD,mBAAmB,GAAE,OAAe,GACnC,KAAK,CAAC,SAAS,EAAE,GAAG,SAAS;IAiBhC,OAAO,CAAC,YAAY,CAQlB;IAEF,SAAS,CAAC,2BAA2B,UAAW,kBAAkB,KAAG,IAAI,CAKvE;CACH"}
@@ -42,7 +42,6 @@ class Dialog extends React.Component {
42
42
  constructor(props) {
43
43
  super(props);
44
44
  this._parentDocument = document;
45
- // istanbul ignore next
46
45
  this.handleRefSet = (containerDiv) => {
47
46
  if (containerDiv)
48
47
  this._parentDocument = containerDiv.ownerDocument;
@@ -55,7 +54,6 @@ class Dialog extends React.Component {
55
54
  }
56
55
  };
57
56
  this._handleContainerPointerDown = (event) => {
58
- // istanbul ignore next
59
57
  if (!this.props.modal) {
60
58
  if (this.props.onModelessPointerDown && this.props.modelessId)
61
59
  this.props.onModelessPointerDown(event, this.props.modelessId);
@@ -96,7 +94,7 @@ class Dialog extends React.Component {
96
94
  };
97
95
  // eslint-disable-next-line deprecation/deprecation
98
96
  const buttons = this.getFooterButtons(buttonCluster, "high-visibility", true);
99
- return (React.createElement(itwinui_react_1.Dialog, { isOpen: opened, onClose: onClose, closeOnExternalClick: false, closeOnEsc: false, style: style, className: (0, classnames_1.default)("core-dialog", className), isDraggable: movable, isResizable: resizable, trapFocus: trapFocus && /* istanbul ignore next */ modal, preventDocumentScroll: true, "data-testid": "core-dialog-root", ...props },
97
+ return (React.createElement(itwinui_react_1.Dialog, { isOpen: opened, onClose: onClose, closeOnExternalClick: false, closeOnEsc: false, style: style, className: (0, classnames_1.default)("core-dialog", className), isDraggable: movable, isResizable: resizable, trapFocus: trapFocus && modal, preventDocumentScroll: true, "data-testid": "core-dialog-root", ...props },
100
98
  modal && React.createElement(itwinui_react_1.Dialog.Backdrop, { style: backgroundStyle }),
101
99
  React.createElement(DivWithOutsideClick_1.DivWithOutsideClick, { onOutsideClick: onOutsideClick },
102
100
  React.createElement(itwinui_react_1.Dialog.Main, { className: (0, classnames_1.default)("core-dialog-main", alignment && this.getCSSClassNameFromAlignment(alignment)), "data-testid": "core-dialog-container", style: dialogBaseContainerStyle, onPointerDown: this._handleContainerPointerDown },
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAElC,0DAAyD;AACzD,wD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BAAM,IACL,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAC7D,OAAO,EAAE,MAAM,CAAC,OAAO,IAEtB,UAAU,CACJ,CACV,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 Dialog\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { Dialog as BaseDialog, Button } from \"@itwin/itwinui-react\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { Omit } from \"../utils/typeUtils\";\nimport \"./Dialog.scss\";\nimport { useTranslation } from \"../l10n/useTranslation\";\n\ntype ButtonProps = React.ComponentPropsWithoutRef<typeof Button>;\n\n/** Enum for dialog alignment\n * @public\n * @deprecated in 4.12.x. Enum used in a deprecated component {@link Dialog}.\n */\nexport enum DialogAlignment {\n TopLeft = \"top-left\",\n Top = \"top\",\n TopRight = \"top-right\",\n Left = \"left\",\n Center = \"center\",\n Right = \"right\",\n BottomLeft = \"bottom-left\",\n Bottom = \"bottom\",\n BottomRight = \"bottom-right\",\n}\n\n/** Properties for the [[Dialog]] component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link Dialog}.\n */\nexport interface DialogProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"title\">,\n CommonProps {\n /** Indicates whether to show dialog or not */\n opened: boolean;\n\n /** Indicates whether the user can resize dialog with cursor. Default: false */\n resizable?: boolean;\n /** Indicates whether the user can move dialog with cursor. Default: false */\n movable?: boolean;\n /** Indicates whether the content should be inset. Default: true */\n inset?: boolean;\n /** Indicates whether the focus should be trapped within the dialog. Default: false */\n trapFocus?: boolean;\n\n /** Whether the hide the header. Default: false */\n hideHeader?: boolean;\n /** Override for the header */\n header?: React.ReactNode;\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** Footer to show at bottom of dialog. Note: will override buttonCluster */\n footer?: string | React.ReactElement;\n /** List of DialogButtonDef objects specifying buttons and associated onClick events */\n buttonCluster?: DialogButtonDef[];\n\n /** Default alignment of dialog. */\n // eslint-disable-next-line deprecation/deprecation\n alignment?: DialogAlignment;\n /** Initial x/left position of dialog in px. */\n x?: number;\n /** Initial y/top position of dialog in px. */\n y?: number;\n\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for Esc key */\n onEscape?: () => void;\n /** Triggered when a click is triggered outside of this dialog. */\n onOutsideClick?: (event: MouseEvent) => any;\n\n /** Initial width of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: \"50%\" */\n width?: string | number;\n /** Initial height of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n height?: string | number;\n /** Minimum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 300px */\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 135px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100% */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n\n /** Whether to show background overlay. Default: true.\n * @note Modeless dialogs require an id and an implementation of onModelessPointerDown.\n */\n modal?: boolean;\n /** An id for a modeless dialog */\n modelessId?: string;\n /** Pointer Down event handler when modeless (modal = false) */\n onModelessPointerDown?: (event: React.PointerEvent, id: string) => void;\n\n /** Custom CSS Style for overlay */\n backgroundStyle?: React.CSSProperties;\n /** Custom CSS Style for title */\n titleStyle?: React.CSSProperties;\n /** Custom CSS Style for footer */\n footerStyle?: React.CSSProperties;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n}\n\n/** Dialog React component with optional resizing and dragging functionality\n * @public\n * @deprecated in 4.12.x. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI dialog} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class Dialog extends React.Component<DialogProps> {\n private _parentDocument = document;\n // eslint-disable-next-line deprecation/deprecation\n public static defaultProps: Partial<DialogProps> = {\n maxWidth: \"100%\",\n width: \"50%\",\n hideHeader: false,\n resizable: false,\n movable: false,\n modal: true,\n inset: true,\n trapFocus: false,\n };\n\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: DialogProps) {\n super(props);\n }\n\n public override componentWillUnmount(): void {\n this._parentDocument.removeEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n public override componentDidMount(): void {\n this._parentDocument.addEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n // istanbul ignore next\n public handleRefSet = (containerDiv: HTMLDivElement | null) => {\n if (containerDiv) this._parentDocument = containerDiv.ownerDocument;\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n title,\n footer,\n buttonCluster,\n onClose,\n onEscape,\n onOutsideClick,\n minWidth,\n minHeight,\n x,\n y,\n width,\n height,\n maxHeight,\n maxWidth,\n backgroundStyle,\n titleStyle,\n footerStyle,\n style,\n contentStyle,\n contentClassName,\n modal,\n resizable,\n movable,\n className,\n alignment,\n inset,\n trapFocus,\n modelessId,\n onModelessPointerDown,\n hideHeader,\n header,\n as,\n ...props\n } = this.props;\n\n let initialOffset: React.CSSProperties = {};\n if (x || y) {\n initialOffset = {\n left: x ?? 0,\n top: y ?? 0,\n transform: \"none\",\n };\n }\n\n const containerStyle: React.CSSProperties = {\n ...initialOffset,\n margin: \"\",\n width,\n height,\n };\n\n const minMaxStyle: React.CSSProperties = {\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n };\n const dialogBaseContainerStyle: React.CSSProperties = {\n ...containerStyle,\n ...minMaxStyle,\n };\n\n // eslint-disable-next-line deprecation/deprecation\n const buttons = this.getFooterButtons(\n buttonCluster,\n \"high-visibility\",\n true\n );\n\n return (\n <BaseDialog\n isOpen={opened}\n onClose={onClose}\n closeOnExternalClick={false}\n closeOnEsc={false}\n style={style}\n className={classnames(\"core-dialog\", className)}\n isDraggable={movable}\n isResizable={resizable}\n trapFocus={trapFocus && /* istanbul ignore next */ modal}\n preventDocumentScroll={true}\n data-testid=\"core-dialog-root\"\n {...props}\n >\n {modal && <BaseDialog.Backdrop style={backgroundStyle} />}\n {/* eslint-disable-next-line deprecation/deprecation */}\n <DivWithOutsideClick onOutsideClick={onOutsideClick}>\n <BaseDialog.Main\n className={classnames(\n \"core-dialog-main\",\n alignment && this.getCSSClassNameFromAlignment(alignment)\n )}\n data-testid=\"core-dialog-container\"\n style={dialogBaseContainerStyle}\n onPointerDown={this._handleContainerPointerDown}\n >\n {!hideHeader &&\n (header || (\n <BaseDialog.TitleBar\n titleText={title}\n style={titleStyle}\n data-testid=\"core-dialog-head\"\n />\n ))}\n <BaseDialog.Content\n className={contentClassName}\n style={{ padding: inset ? undefined : 0, ...contentStyle }}\n >\n {this.props.children}\n </BaseDialog.Content>\n {footer ||\n (buttons && (\n <BaseDialog.ButtonBar style={footerStyle}>\n {buttons}\n </BaseDialog.ButtonBar>\n ))}\n </BaseDialog.Main>\n </DivWithOutsideClick>\n </BaseDialog>\n );\n }\n\n // eslint-disable-next-line deprecation/deprecation\n private getCSSClassNameFromAlignment(alignment: DialogAlignment): string {\n switch (alignment) {\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.TopLeft:\n return \"core-align-top-left\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Top:\n return \"core-align-top\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.TopRight:\n return \"core-align-top-right\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Left:\n return \"core-align-left\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Center:\n return \"core-align-center\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Right:\n return \"core-align-right\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.BottomLeft:\n return \"core-align-bottom-left\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Bottom:\n return \"core-align-bottom\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.BottomRight:\n return \"core-align-bottom-right\";\n }\n }\n\n /** @deprecated in 4.12.x. Use iTwinUI Button instead. */\n protected getFooterButtons(\n buttonCluster: DialogButtonDef[] | undefined,\n primaryStyleType: ButtonProps[\"styleType\"] = \"cta\",\n noCoreButtonClasses: boolean = false\n ): React.ReactNode[] | undefined {\n if (buttonCluster === undefined) return undefined;\n\n const buttons: React.ReactNode[] = [];\n buttonCluster.forEach((button: DialogButtonDef, index: number) => {\n buttons.push(\n <DialogButton\n key={index.toString()}\n button={button}\n primaryStyleType={primaryStyleType}\n noCoreButtonClasses={noCoreButtonClasses}\n />\n );\n });\n return buttons;\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (\n event.key === Key.Escape.valueOf() &&\n this.props.opened &&\n this.props.onEscape\n ) {\n this.props.onEscape();\n }\n };\n\n protected _handleContainerPointerDown = (event: React.PointerEvent): void => {\n // istanbul ignore next\n if (!this.props.modal) {\n if (this.props.onModelessPointerDown && this.props.modelessId)\n this.props.onModelessPointerDown(event, this.props.modelessId);\n }\n };\n}\n\nfunction DialogButton({\n button,\n primaryStyleType,\n noCoreButtonClasses,\n}: {\n button: DialogButtonDef;\n primaryStyleType: ButtonProps[\"styleType\"];\n noCoreButtonClasses: boolean;\n}) {\n const { translate } = useTranslation();\n\n let buttonText = \"\";\n\n let buttonClass = classnames(\n !noCoreButtonClasses && \"core-dialog-button\",\n !noCoreButtonClasses && `dialog-button-${button.type}`,\n button.className\n );\n let usePrimaryStyleType = false;\n\n switch (button.type) {\n case DialogButtonType.OK:\n buttonText = translate(\"dialog.ok\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Retry:\n buttonText = translate(\"dialog.retry\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Yes:\n buttonText = translate(\"dialog.yes\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.No:\n buttonText = translate(\"dialog.no\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Cancel:\n buttonText = translate(\"dialog.cancel\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Close:\n buttonText = translate(\"dialog.close\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Next:\n buttonText = translate(\"dialog.next\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Previous:\n buttonText = translate(\"dialog.previous\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n }\n\n buttonText = button.label || buttonText;\n\n return (\n <Button\n className={buttonClass}\n disabled={button.disabled}\n styleType={usePrimaryStyleType ? primaryStyleType : undefined}\n onClick={button.onClick}\n >\n {buttonText}\n </Button>\n );\n}\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2CAAoC;AACpC,+BAA+B;AAC/B,6CAAkC;AAElC,0DAAyD;AACzD,wDAAoE;AACpE,qEAAkE;AAGlE,yBAAuB;AACvB,2DAAwD;AAIxD;;;GAGG;AACH,IAAY,eAUX;AAVD,WAA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AC,SAAS,EAC7D,OAAO,EAAE,MAAM,CAAC,OAAO,IAEtB,UAAU,CACJ,CACV,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 Dialog\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { DialogButtonDef } from \"@itwin/appui-abstract\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { Dialog as BaseDialog, Button } from \"@itwin/itwinui-react\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { Omit } from \"../utils/typeUtils\";\nimport \"./Dialog.scss\";\nimport { useTranslation } from \"../l10n/useTranslation\";\n\ntype ButtonProps = React.ComponentPropsWithoutRef<typeof Button>;\n\n/** Enum for dialog alignment\n * @public\n * @deprecated in 4.12.x. Enum used in a deprecated component {@link Dialog}.\n */\nexport enum DialogAlignment {\n TopLeft = \"top-left\",\n Top = \"top\",\n TopRight = \"top-right\",\n Left = \"left\",\n Center = \"center\",\n Right = \"right\",\n BottomLeft = \"bottom-left\",\n Bottom = \"bottom\",\n BottomRight = \"bottom-right\",\n}\n\n/** Properties for the [[Dialog]] component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link Dialog}.\n */\nexport interface DialogProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"title\">,\n CommonProps {\n /** Indicates whether to show dialog or not */\n opened: boolean;\n\n /** Indicates whether the user can resize dialog with cursor. Default: false */\n resizable?: boolean;\n /** Indicates whether the user can move dialog with cursor. Default: false */\n movable?: boolean;\n /** Indicates whether the content should be inset. Default: true */\n inset?: boolean;\n /** Indicates whether the focus should be trapped within the dialog. Default: false */\n trapFocus?: boolean;\n\n /** Whether the hide the header. Default: false */\n hideHeader?: boolean;\n /** Override for the header */\n header?: React.ReactNode;\n /** Title to show in title bar of dialog */\n title?: string | React.ReactElement;\n /** Footer to show at bottom of dialog. Note: will override buttonCluster */\n footer?: string | React.ReactElement;\n /** List of DialogButtonDef objects specifying buttons and associated onClick events */\n buttonCluster?: DialogButtonDef[];\n\n /** Default alignment of dialog. */\n // eslint-disable-next-line deprecation/deprecation\n alignment?: DialogAlignment;\n /** Initial x/left position of dialog in px. */\n x?: number;\n /** Initial y/top position of dialog in px. */\n y?: number;\n\n /** onClick event for X button for dialog */\n onClose?: () => void;\n /** 'keyup' event for Esc key */\n onEscape?: () => void;\n /** Triggered when a click is triggered outside of this dialog. */\n onOutsideClick?: (event: MouseEvent) => any;\n\n /** Initial width of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: \"50%\" */\n width?: string | number;\n /** Initial height of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n height?: string | number;\n /** Minimum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 300px */\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 135px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100% */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n\n /** Whether to show background overlay. Default: true.\n * @note Modeless dialogs require an id and an implementation of onModelessPointerDown.\n */\n modal?: boolean;\n /** An id for a modeless dialog */\n modelessId?: string;\n /** Pointer Down event handler when modeless (modal = false) */\n onModelessPointerDown?: (event: React.PointerEvent, id: string) => void;\n\n /** Custom CSS Style for overlay */\n backgroundStyle?: React.CSSProperties;\n /** Custom CSS Style for title */\n titleStyle?: React.CSSProperties;\n /** Custom CSS Style for footer */\n footerStyle?: React.CSSProperties;\n /** Custom CSS class name for the content */\n contentClassName?: string;\n /** Custom CSS Style for the content */\n contentStyle?: React.CSSProperties;\n}\n\n/** Dialog React component with optional resizing and dragging functionality\n * @public\n * @deprecated in 4.12.x. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI dialog} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class Dialog extends React.Component<DialogProps> {\n private _parentDocument = document;\n // eslint-disable-next-line deprecation/deprecation\n public static defaultProps: Partial<DialogProps> = {\n maxWidth: \"100%\",\n width: \"50%\",\n hideHeader: false,\n resizable: false,\n movable: false,\n modal: true,\n inset: true,\n trapFocus: false,\n };\n\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: DialogProps) {\n super(props);\n }\n\n public override componentWillUnmount(): void {\n this._parentDocument.removeEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n public override componentDidMount(): void {\n this._parentDocument.addEventListener(\"keyup\", this._handleKeyUp, true);\n }\n\n public handleRefSet = (containerDiv: HTMLDivElement | null) => {\n if (containerDiv) this._parentDocument = containerDiv.ownerDocument;\n };\n\n public override render(): React.ReactElement {\n const {\n opened,\n title,\n footer,\n buttonCluster,\n onClose,\n onEscape,\n onOutsideClick,\n minWidth,\n minHeight,\n x,\n y,\n width,\n height,\n maxHeight,\n maxWidth,\n backgroundStyle,\n titleStyle,\n footerStyle,\n style,\n contentStyle,\n contentClassName,\n modal,\n resizable,\n movable,\n className,\n alignment,\n inset,\n trapFocus,\n modelessId,\n onModelessPointerDown,\n hideHeader,\n header,\n as,\n ...props\n } = this.props;\n\n let initialOffset: React.CSSProperties = {};\n if (x || y) {\n initialOffset = {\n left: x ?? 0,\n top: y ?? 0,\n transform: \"none\",\n };\n }\n\n const containerStyle: React.CSSProperties = {\n ...initialOffset,\n margin: \"\",\n width,\n height,\n };\n\n const minMaxStyle: React.CSSProperties = {\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n };\n const dialogBaseContainerStyle: React.CSSProperties = {\n ...containerStyle,\n ...minMaxStyle,\n };\n\n // eslint-disable-next-line deprecation/deprecation\n const buttons = this.getFooterButtons(\n buttonCluster,\n \"high-visibility\",\n true\n );\n\n return (\n <BaseDialog\n isOpen={opened}\n onClose={onClose}\n closeOnExternalClick={false}\n closeOnEsc={false}\n style={style}\n className={classnames(\"core-dialog\", className)}\n isDraggable={movable}\n isResizable={resizable}\n trapFocus={trapFocus && modal}\n preventDocumentScroll={true}\n data-testid=\"core-dialog-root\"\n {...props}\n >\n {modal && <BaseDialog.Backdrop style={backgroundStyle} />}\n {/* eslint-disable-next-line deprecation/deprecation */}\n <DivWithOutsideClick onOutsideClick={onOutsideClick}>\n <BaseDialog.Main\n className={classnames(\n \"core-dialog-main\",\n alignment && this.getCSSClassNameFromAlignment(alignment)\n )}\n data-testid=\"core-dialog-container\"\n style={dialogBaseContainerStyle}\n onPointerDown={this._handleContainerPointerDown}\n >\n {!hideHeader &&\n (header || (\n <BaseDialog.TitleBar\n titleText={title}\n style={titleStyle}\n data-testid=\"core-dialog-head\"\n />\n ))}\n <BaseDialog.Content\n className={contentClassName}\n style={{ padding: inset ? undefined : 0, ...contentStyle }}\n >\n {this.props.children}\n </BaseDialog.Content>\n {footer ||\n (buttons && (\n <BaseDialog.ButtonBar style={footerStyle}>\n {buttons}\n </BaseDialog.ButtonBar>\n ))}\n </BaseDialog.Main>\n </DivWithOutsideClick>\n </BaseDialog>\n );\n }\n\n // eslint-disable-next-line deprecation/deprecation\n private getCSSClassNameFromAlignment(alignment: DialogAlignment): string {\n switch (alignment) {\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.TopLeft:\n return \"core-align-top-left\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Top:\n return \"core-align-top\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.TopRight:\n return \"core-align-top-right\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Left:\n return \"core-align-left\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Center:\n return \"core-align-center\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Right:\n return \"core-align-right\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.BottomLeft:\n return \"core-align-bottom-left\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.Bottom:\n return \"core-align-bottom\";\n // eslint-disable-next-line deprecation/deprecation\n case DialogAlignment.BottomRight:\n return \"core-align-bottom-right\";\n }\n }\n\n /** @deprecated in 4.12.x. Use iTwinUI Button instead. */\n protected getFooterButtons(\n buttonCluster: DialogButtonDef[] | undefined,\n primaryStyleType: ButtonProps[\"styleType\"] = \"cta\",\n noCoreButtonClasses: boolean = false\n ): React.ReactNode[] | undefined {\n if (buttonCluster === undefined) return undefined;\n\n const buttons: React.ReactNode[] = [];\n buttonCluster.forEach((button: DialogButtonDef, index: number) => {\n buttons.push(\n <DialogButton\n key={index.toString()}\n button={button}\n primaryStyleType={primaryStyleType}\n noCoreButtonClasses={noCoreButtonClasses}\n />\n );\n });\n return buttons;\n }\n\n private _handleKeyUp = (event: KeyboardEvent) => {\n if (\n event.key === Key.Escape.valueOf() &&\n this.props.opened &&\n this.props.onEscape\n ) {\n this.props.onEscape();\n }\n };\n\n protected _handleContainerPointerDown = (event: React.PointerEvent): void => {\n if (!this.props.modal) {\n if (this.props.onModelessPointerDown && this.props.modelessId)\n this.props.onModelessPointerDown(event, this.props.modelessId);\n }\n };\n}\n\nfunction DialogButton({\n button,\n primaryStyleType,\n noCoreButtonClasses,\n}: {\n button: DialogButtonDef;\n primaryStyleType: ButtonProps[\"styleType\"];\n noCoreButtonClasses: boolean;\n}) {\n const { translate } = useTranslation();\n\n let buttonText = \"\";\n\n let buttonClass = classnames(\n !noCoreButtonClasses && \"core-dialog-button\",\n !noCoreButtonClasses && `dialog-button-${button.type}`,\n button.className\n );\n let usePrimaryStyleType = false;\n\n switch (button.type) {\n case DialogButtonType.OK:\n buttonText = translate(\"dialog.ok\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Retry:\n buttonText = translate(\"dialog.retry\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Yes:\n buttonText = translate(\"dialog.yes\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.No:\n buttonText = translate(\"dialog.no\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Cancel:\n buttonText = translate(\"dialog.cancel\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Close:\n buttonText = translate(\"dialog.close\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n break;\n case DialogButtonType.Next:\n buttonText = translate(\"dialog.next\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n case DialogButtonType.Previous:\n buttonText = translate(\"dialog.previous\");\n buttonClass = classnames(buttonClass, button.buttonStyle);\n usePrimaryStyleType = true;\n break;\n }\n\n buttonText = button.label || buttonText;\n\n return (\n <Button\n className={buttonClass}\n disabled={button.disabled}\n styleType={usePrimaryStyleType ? primaryStyleType : undefined}\n onClick={button.onClick}\n >\n {buttonText}\n </Button>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalDialog.d.ts","sourceRoot":"","sources":["../../../../src/core-react/dialog/GlobalDialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C;;;GAGG;AAEH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,SAAS,CAE/C,iBAAiB,EAEjB,iBAAiB,CAClB;IACC,OAAO,CAAC,UAAU,CAAC,CAAiB;IAGpC,SAAyB,KAAK,EAAE,iBAAiB,CAE/C;gBAGU,KAAK,EAAE,iBAAiB;IAIpC,OAAO,CAAC,aAAa,CAqBnB;IAEc,oBAAoB;IAQpB,MAAM,IAAI,KAAK,CAAC,SAAS;CAa1C"}
1
+ {"version":3,"file":"GlobalDialog.d.ts","sourceRoot":"","sources":["../../../../src/core-react/dialog/GlobalDialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C;;;GAGG;AAEH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,QAAQ,GAAG,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,SAAS,CAE/C,iBAAiB,EAEjB,iBAAiB,CAClB;IACC,OAAO,CAAC,UAAU,CAAC,CAAiB;IAGpC,SAAyB,KAAK,EAAE,iBAAiB,CAE/C;gBAGU,KAAK,EAAE,iBAAiB;IAIpC,OAAO,CAAC,aAAa,CAqBnB;IAEc,oBAAoB;IAOpB,MAAM,IAAI,KAAK,CAAC,SAAS;CAa1C"}
@@ -44,7 +44,6 @@ class GlobalDialog extends React.Component {
44
44
  };
45
45
  }
46
46
  componentWillUnmount() {
47
- // istanbul ignore else
48
47
  if (this._container && this._container.parentElement) {
49
48
  // cleanup
50
49
  this._container.parentElement.removeChild(this._container);
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalDialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/GlobalDialog.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,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AC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAEe,MAAM;QACpB,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5C,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,aAAa,IACzB,IAAI,CAAC,KAAK,CAAC,cAAc;YACxB,QAAQ,CAAC,YAAY;YACnB,mDAAmD;YACnD,oBAAC,eAAM,OAAK,KAAK,GAAI,EACrB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAC/B,CACC,CACP,CAAC;IACJ,CAAC;CACF;AA9DD,oCA8DC","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 Dialog\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport type { DialogProps } from \"./Dialog\";\nimport { Dialog } from \"./Dialog\";\n\n/** Properties for the [[GlobalDialog]] component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link GlobalDialog}.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface GlobalDialogProps extends DialogProps {\n identifier?: string;\n}\n\n/** State properties for the [[GlobalDialog]] component\n * @public\n * @deprecated in 4.12.x. State of deprecated component {@link GlobalDialog}.\n */\nexport interface GlobalDialogState {\n parentDocument: Document | null;\n}\n\n/** GlobalDialog React component used to display a [[Dialog]] on the top of screen\n * @public\n * @deprecated in 4.12.x. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI dialog} instead.\n */\nexport class GlobalDialog extends React.Component<\n // eslint-disable-next-line deprecation/deprecation\n GlobalDialogProps,\n // eslint-disable-next-line deprecation/deprecation\n GlobalDialogState\n> {\n private _container?: HTMLDivElement;\n\n // eslint-disable-next-line deprecation/deprecation\n public override readonly state: GlobalDialogState = {\n parentDocument: null,\n };\n\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: GlobalDialogProps) {\n super(props);\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n const parentDocument = popupDiv?.ownerDocument ?? null;\n if (parentDocument) {\n this._container = parentDocument.createElement(\"div\");\n this._container.id =\n this.props.identifier !== undefined\n ? `dialog-${this.props.identifier}`\n : \"core-dialog\";\n let rt = parentDocument.getElementById(\n \"core-dialog-root\"\n ) as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-dialog-root\";\n parentDocument.body.appendChild(rt);\n }\n rt.appendChild(this._container);\n\n // used to support component rendering in pop-out window\n this.setState({ parentDocument });\n }\n };\n\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._container && this._container.parentElement) {\n // cleanup\n this._container.parentElement.removeChild(this._container);\n }\n }\n\n public override render(): React.ReactNode {\n const { identifier, ...props } = this.props;\n return (\n <div ref={this._handleRefSet}>\n {this.state.parentDocument &&\n ReactDOM.createPortal(\n // eslint-disable-next-line deprecation/deprecation\n <Dialog {...props} />,\n this.state.parentDocument.body\n )}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"GlobalDialog.js","sourceRoot":"","sources":["../../../../src/core-react/dialog/GlobalDialog.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAA+B;AAC/B,sCAAsC;AAEtC,qCAAkC;AAmBlC;;;GAGG;AACH,MAAa,YAAa,SAAQ,KAAK,CAAC,SAKvC;IAQC,mDAAmD;IACnD,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QAPf,mDAAmD;QAC1B,UAAK,GAAsB;YAClD,cAAc,EAAE,IAAI;SACrB,CAAC;QAOM,kBAAa,GAAG,CAAC,QAA4B,EAAE,EAAE;YACvD,MAAM,cAAc,GAAG,QAAQ,EAAE,aAAa,IAAI,IAAI,CAAC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AAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAC/B,CACC,CACP,CAAC;IACJ,CAAC;CACF;AA7DD,oCA6DC","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 Dialog\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport type { DialogProps } from \"./Dialog\";\nimport { Dialog } from \"./Dialog\";\n\n/** Properties for the [[GlobalDialog]] component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link GlobalDialog}.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface GlobalDialogProps extends DialogProps {\n identifier?: string;\n}\n\n/** State properties for the [[GlobalDialog]] component\n * @public\n * @deprecated in 4.12.x. State of deprecated component {@link GlobalDialog}.\n */\nexport interface GlobalDialogState {\n parentDocument: Document | null;\n}\n\n/** GlobalDialog React component used to display a [[Dialog]] on the top of screen\n * @public\n * @deprecated in 4.12.x. Use {@link https://itwinui.bentley.com/docs/dialog iTwinUI dialog} instead.\n */\nexport class GlobalDialog extends React.Component<\n // eslint-disable-next-line deprecation/deprecation\n GlobalDialogProps,\n // eslint-disable-next-line deprecation/deprecation\n GlobalDialogState\n> {\n private _container?: HTMLDivElement;\n\n // eslint-disable-next-line deprecation/deprecation\n public override readonly state: GlobalDialogState = {\n parentDocument: null,\n };\n\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: GlobalDialogProps) {\n super(props);\n }\n\n private _handleRefSet = (popupDiv: HTMLElement | null) => {\n const parentDocument = popupDiv?.ownerDocument ?? null;\n if (parentDocument) {\n this._container = parentDocument.createElement(\"div\");\n this._container.id =\n this.props.identifier !== undefined\n ? `dialog-${this.props.identifier}`\n : \"core-dialog\";\n let rt = parentDocument.getElementById(\n \"core-dialog-root\"\n ) as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-dialog-root\";\n parentDocument.body.appendChild(rt);\n }\n rt.appendChild(this._container);\n\n // used to support component rendering in pop-out window\n this.setState({ parentDocument });\n }\n };\n\n public override componentWillUnmount() {\n if (this._container && this._container.parentElement) {\n // cleanup\n this._container.parentElement.removeChild(this._container);\n }\n }\n\n public override render(): React.ReactNode {\n const { identifier, ...props } = this.props;\n return (\n <div ref={this._handleRefSet}>\n {this.state.parentDocument &&\n ReactDOM.createPortal(\n // eslint-disable-next-line deprecation/deprecation\n <Dialog {...props} />,\n this.state.parentDocument.body\n )}\n </div>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ElementSeparator.d.ts","sourceRoot":"","sources":["../../../../src/core-react/elementseparator/ElementSeparator.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,4BAA4B;IAC5B,WAAW,EAAE,WAAW,CAAC;IACzB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IAEtC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,iBAAiB,CAAC;IAC7D,+BAA+B;IAC/B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qCAAqC;IACrC,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,qCAAqC;IACrC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,oCAAoC;IACpC,yBAAyB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D;AAkLD;;;GAGG;AAEH,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,sBA6C5D,CAAC"}
1
+ {"version":3,"file":"ElementSeparator.d.ts","sourceRoot":"","sources":["../../../../src/core-react/elementseparator/ElementSeparator.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,4BAA4B;IAC5B,WAAW,EAAE,WAAW,CAAC;IACzB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IAEtC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,iBAAiB,CAAC;IAC7D,+BAA+B;IAC/B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qCAAqC;IACrC,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,qCAAqC;IACrC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,oCAAoC;IACpC,yBAAyB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D;AA8KD;;;GAGG;AAEH,eAAO,MAAM,gBAAgB,UAAW,qBAAqB,sBA8C5D,CAAC"}
@@ -42,7 +42,6 @@ const useElementSeparatorPointerHandler = ({ onResizeHandleDragChanged, onResize
42
42
  if (isGroupHovered && pointerOutOfBounds.current)
43
43
  pointerOutOfBounds.current = false;
44
44
  const stopDrag = (0, react_1.useCallback)(() => {
45
- // istanbul ignore else
46
45
  if (isGroupDragged) {
47
46
  setIsDragged(false);
48
47
  if (onResizeHandleDragChanged)
@@ -51,7 +50,6 @@ const useElementSeparatorPointerHandler = ({ onResizeHandleDragChanged, onResize
51
50
  }, [isGroupDragged, onResizeHandleDragChanged]);
52
51
  const startDrag = (0, react_1.useCallback)((e) => {
53
52
  globalPosition.current = getCurrentGlobalPosition(orientation, e);
54
- // istanbul ignore else
55
53
  if (!isGroupDragged) {
56
54
  setIsDragged(true);
57
55
  if (onResizeHandleDragChanged)
@@ -105,7 +103,6 @@ const useElementSeparatorPointerHandler = ({ onResizeHandleDragChanged, onResize
105
103
  }
106
104
  }, [isGroupDragged, startDrag, stopDrag]);
107
105
  const onPointerOver = (0, react_1.useCallback)(() => {
108
- // istanbul ignore next
109
106
  if (isGroupHovered)
110
107
  return;
111
108
  setIsHovered(true);
@@ -113,7 +110,6 @@ const useElementSeparatorPointerHandler = ({ onResizeHandleDragChanged, onResize
113
110
  onResizeHandleHoverChanged(true);
114
111
  }, [isGroupHovered, onResizeHandleHoverChanged]);
115
112
  const onPointerOut = (0, react_1.useCallback)(() => {
116
- // istanbul ignore next
117
113
  if (!isGroupHovered)
118
114
  return;
119
115
  setIsHovered(false);
@@ -166,7 +162,7 @@ const ElementSeparator = (props) => {
166
162
  ...style,
167
163
  ...props.style,
168
164
  };
169
- return (React.createElement("button", { style: styles, className: classNames, onPointerDown: onPointerDown, onPointerOver: onPointerOver, onPointerOut: onPointerOut, "aria-label": translate("elementSeparator.label") }));
165
+ return (React.createElement("button", { style: styles, className: classNames, onPointerDown: onPointerDown, onPointerOver: onPointerOver, onPointerOut: onPointerOut, "aria-label": translate("elementSeparator.label"), tabIndex: -1 }));
170
166
  };
171
167
  exports.ElementSeparator = ElementSeparator;
172
168
  //# sourceMappingURL=ElementSeparator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElementSeparator.js","sourceRoot":"","sources":["../../../../src/core-react/elementseparator/ElementSeparator.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,mCAAiC;AACjC,+BAA+B;AAC/B,iCAOe;AACf,2CAAoC;AACpC,sDAAmD;AAEnD,kEAA+D;AAC/D,2DAAwD;AAoCxD,SAAS,wBAAwB,CAC/B,WAAwB,EACxB,CAAoC;IAEpC,OAAO,WAAW,KAAK,yBAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,qBAAqB,GAAG,CAAC,SAAkB,EAAE,OAAmB,EAAE,EAAE;IACxE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAC,SAAS,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,CAAC;IAEnC,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAE7B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,IAAI,YAAY,CAAC,OAAO;gBAAE,UAAU,CAAC,OAAO,EAAE,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,iCAAiC,GAAG,CAAC,EACzC,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,WAAW,EACX,KAAK,EACL,WAAW,EACX,cAAc,GAEK,EAAE,EAAE;IACvB,MAAM,cAAc,GAAG,IAAA,cAAM,EAAC,CAAC,CAAC,CAAC;IACjC,MAA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AwB,EACxB,KAAK,CAAC,WAAW,KAAK,yBAAW,CAAC,UAAU;QAC1C,CAAC,CAAC,oCAAoC;QACtC,CAAC,CAAC,kCAAkC,EACtC,KAAK,CAAC,SAAS,EACf,aAAa,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,YAAY,CACtE,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACtC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,EAC1C,CAAC,WAAW,EAAE,aAAa,CAAC,CAC7B,CAAC;IACF,MAAM,MAAM,GAAwB;QAClC,GAAG,KAAK;QACR,GAAG,KAAK,CAAC,KAAK;KACf,CAAC;IAEF,OAAO,CACL,gCACE,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,gBACd,SAAS,CAAC,wBAAwB,CAAC,GAC/C,CACH,CAAC;AACJ,CAAC,CAAC;AA7CW,QAAA,gBAAgB,oBA6C3B","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 ElementSeparator\n */\n\nimport \"./ElementSeparator.scss\";\nimport * as React from \"react\";\nimport {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport classnames from \"classnames\";\nimport { Orientation } from \"../enums/Orientation\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { useThrottledFn } from \"../utils/hooks/useThrottledFn\";\nimport { useTranslation } from \"../l10n/useTranslation\";\n\n/** Results returned by onRatioChanged callback for determining new ratio and whether the ratio was updated.\n * @public\n * @deprecated in 4.12.x. Interface used in a deprecated component {@link ElementSeparator}.\n */\nexport interface RatioChangeResult {\n ratio: number;\n}\n\n/** Properties of [[ElementSeparator]] React component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link ElementSeparator}.\n */\nexport interface ElementSeparatorProps extends CommonProps {\n /** Separator orientation */\n orientation: Orientation;\n /** Ratio between left cell and right cell */\n ratio: number;\n /** Area width or height (depending on orientation) in pixels */\n movableArea?: number;\n /** Separator width or height in pixels. 30 by default */\n separatorSize?: number;\n /** Callback to ratio changed event */\n // eslint-disable-next-line deprecation/deprecation\n onRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n}\n\nfunction getCurrentGlobalPosition(\n orientation: Orientation,\n e: PointerEvent | React.PointerEvent\n) {\n return orientation === Orientation.Horizontal ? e.clientX : e.clientY;\n}\n\nconst useConditionalCleanup = (condition: boolean, cleanup: () => void) => {\n const conditionRef = useRef(condition);\n const cleanupRef = useRef(cleanup);\n\n conditionRef.current = condition;\n cleanupRef.current = cleanup;\n\n useEffect(() => {\n return () => {\n if (conditionRef.current) cleanupRef.current();\n };\n }, []);\n};\n\nconst useElementSeparatorPointerHandler = ({\n onResizeHandleDragChanged,\n onResizeHandleHoverChanged,\n isResizeHandleBeingDragged,\n isResizeHandleHovered,\n movableArea,\n ratio,\n orientation,\n onRatioChanged,\n}: // eslint-disable-next-line deprecation/deprecation\nElementSeparatorProps) => {\n const globalPosition = useRef(0);\n const pointerOutOfBounds = useRef(false);\n\n const [isElementDragged, setIsDragged] = useState(false);\n const [isElementHovered, setIsHovered] = useState(false);\n const isGroupDragged = isResizeHandleBeingDragged ?? isElementDragged;\n const isGroupHovered = isResizeHandleHovered ?? isElementHovered;\n\n useConditionalCleanup(isElementDragged && !!onResizeHandleDragChanged, () =>\n onResizeHandleDragChanged!(false)\n );\n useConditionalCleanup(isElementHovered && !!onResizeHandleHoverChanged, () =>\n onResizeHandleHoverChanged!(false)\n );\n\n if (isGroupHovered && pointerOutOfBounds.current)\n pointerOutOfBounds.current = false;\n\n const stopDrag = useCallback(() => {\n // istanbul ignore else\n if (isGroupDragged) {\n setIsDragged(false);\n if (onResizeHandleDragChanged) onResizeHandleDragChanged(false);\n }\n }, [isGroupDragged, onResizeHandleDragChanged]);\n\n const startDrag = useCallback(\n (e: PointerEvent | React.PointerEvent) => {\n globalPosition.current = getCurrentGlobalPosition(orientation, e);\n\n // istanbul ignore else\n if (!isGroupDragged) {\n setIsDragged(true);\n if (onResizeHandleDragChanged) onResizeHandleDragChanged(true);\n }\n },\n [isGroupDragged, orientation, onResizeHandleDragChanged]\n );\n\n const onPointerUp = useCallback(() => {\n stopDrag();\n }, [stopDrag]);\n\n const onThrottledPointerMove = useThrottledFn(\n (e: PointerEvent | React.PointerEvent) => {\n if (!movableArea) {\n stopDrag();\n return;\n }\n\n const currentPosition = getCurrentGlobalPosition(orientation, e);\n const positionChange = currentPosition - globalPosition.current;\n\n // Should not need to recalculate if position on our movement axis does not change\n if (Math.abs(positionChange) < 1) return;\n\n const currentLocalPosition = movableArea * ratio + positionChange;\n const newRatio = currentLocalPosition / movableArea;\n\n globalPosition.current = currentPosition;\n if (pointerOutOfBounds.current || !onRatioChanged) return;\n\n const result = onRatioChanged(newRatio);\n if (\n result &&\n result.ratio === ratio &&\n !isGroupHovered &&\n !pointerOutOfBounds.current\n )\n pointerOutOfBounds.current = true;\n },\n 16,\n [stopDrag, isGroupHovered, ratio, movableArea, onRatioChanged, orientation]\n );\n\n useEffect(() => {\n return () => onThrottledPointerMove.cancel();\n }, [onThrottledPointerMove]);\n\n useLayoutEffect(() => {\n if (isElementDragged) {\n document.addEventListener(\"pointerup\", onPointerUp);\n document.addEventListener(\"pointermove\", onThrottledPointerMove);\n }\n\n return () => {\n document.removeEventListener(\"pointerup\", onPointerUp);\n document.removeEventListener(\"pointermove\", onThrottledPointerMove);\n };\n }, [isElementDragged, onPointerUp, onThrottledPointerMove]);\n\n const onPointerDown = useCallback(\n (e: PointerEvent | React.PointerEvent) => {\n if (!isGroupDragged) {\n startDrag(e);\n } else {\n stopDrag();\n }\n },\n [isGroupDragged, startDrag, stopDrag]\n );\n\n const onPointerOver = useCallback(() => {\n // istanbul ignore next\n if (isGroupHovered) return;\n\n setIsHovered(true);\n if (onResizeHandleHoverChanged) onResizeHandleHoverChanged(true);\n }, [isGroupHovered, onResizeHandleHoverChanged]);\n\n const onPointerOut = useCallback(() => {\n // istanbul ignore next\n if (!isGroupHovered) return;\n\n setIsHovered(false);\n if (onResizeHandleHoverChanged) onResizeHandleHoverChanged(false);\n }, [isGroupHovered, onResizeHandleHoverChanged]);\n\n return {\n isHovered: isGroupHovered,\n isDragged: isGroupDragged,\n onPointerDown,\n onPointerOver,\n onPointerOut,\n };\n};\n\nfunction getStyle(\n orientation: Orientation,\n separatorSize?: number\n): React.CSSProperties {\n separatorSize = separatorSize || 30;\n\n if (orientation === Orientation.Horizontal)\n return {\n width: separatorSize,\n margin: `0px ${-Math.floor(separatorSize / 2)}px`,\n };\n return {\n height: separatorSize,\n margin: `${-Math.floor(separatorSize / 2)}px 1px`,\n };\n}\n\n/** A movable button, which allows to change the ratio between left element and right element\n * @public\n * @deprecated in 4.12.x. Basic components that need to be user-resized support this out of the box. Use {@link https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent pointer events} API to implement a custom resizer.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const ElementSeparator = (props: ElementSeparatorProps) => {\n const { translate } = useTranslation();\n\n const [hasHoverHappened, setHasHoverHappened] = useState(false);\n const { isDragged, isHovered, onPointerDown, onPointerOver, onPointerOut } =\n useElementSeparatorPointerHandler(props);\n\n const isHoverNeeded = isHovered || isDragged;\n if (!hasHoverHappened && isHoverNeeded) setHasHoverHappened(isHoverNeeded);\n\n // This is done to avoid fade-out animation when first rendering.\n const unhoverClass = hasHoverHappened\n ? \"core-element-separator-group-unhovered\"\n : \"\";\n\n const classNames = classnames(\n \"core-element-separator\",\n props.orientation === Orientation.Horizontal\n ? \"core-element-separator--horizontal\"\n : \"core-element-separator--vertical\",\n props.className,\n isHoverNeeded ? \"core-element-separator-group-hovered\" : unhoverClass\n );\n\n const orientation = props.orientation;\n const separatorSize = props.separatorSize;\n const style = useMemo(\n () => getStyle(orientation, separatorSize),\n [orientation, separatorSize]\n );\n const styles: React.CSSProperties = {\n ...style,\n ...props.style,\n };\n\n return (\n <button\n style={styles}\n className={classNames}\n onPointerDown={onPointerDown}\n onPointerOver={onPointerOver}\n onPointerOut={onPointerOut}\n aria-label={translate(\"elementSeparator.label\")}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"ElementSeparator.js","sourceRoot":"","sources":["../../../../src/core-react/elementseparator/ElementSeparator.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,mCAAiC;AACjC,+BAA+B;AAC/B,iCAOe;AACf,2CAAoC;AACpC,sDAAmD;AAEnD,kEAA+D;AAC/D,2DAAwD;AAoCxD,SAAS,wBAAwB,CAC/B,WAAwB,EACxB,CAAoC;IAEpC,OAAO,WAAW,KAAK,yBAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,qBAAqB,GAAG,CAAC,SAAkB,EAAE,OAAmB,EAAE,EAAE;IACxE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAC,SAAS,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,CAAC;IAEnC,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAE7B,IAAA,i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,EAAE,aAAa,EAAE,YAAY,EAAE,GACxE,iCAAiC,CAAC,KAAK,CAAC,CAAC;IAE3C,MAAM,aAAa,GAAG,SAAS,IAAI,SAAS,CAAC;IAC7C,IAAI,CAAC,gBAAgB,IAAI,aAAa;QAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAE3E,iEAAiE;IACjE,MAAM,YAAY,GAAG,gBAAgB;QACnC,CAAC,CAAC,wCAAwC;QAC1C,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,UAAU,GAAG,IAAA,oBAAU,EAC3B,wBAAwB,EACxB,KAAK,CAAC,WAAW,KAAK,yBAAW,CAAC,UAAU;QAC1C,CAAC,CAAC,oCAAoC;QACtC,CAAC,CAAC,kCAAkC,EACtC,KAAK,CAAC,SAAS,EACf,aAAa,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,YAAY,CACtE,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACtC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAA,eAAO,EACnB,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,EAC1C,CAAC,WAAW,EAAE,aAAa,CAAC,CAC7B,CAAC;IACF,MAAM,MAAM,GAAwB;QAClC,GAAG,KAAK;QACR,GAAG,KAAK,CAAC,KAAK;KACf,CAAC;IAEF,OAAO,CACL,gCACE,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,gBACd,SAAS,CAAC,wBAAwB,CAAC,EAC/C,QAAQ,EAAE,CAAC,CAAC,GACZ,CACH,CAAC;AACJ,CAAC,CAAC;AA9CW,QAAA,gBAAgB,oBA8C3B","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 ElementSeparator\n */\n\nimport \"./ElementSeparator.scss\";\nimport * as React from \"react\";\nimport {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport classnames from \"classnames\";\nimport { Orientation } from \"../enums/Orientation\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { useThrottledFn } from \"../utils/hooks/useThrottledFn\";\nimport { useTranslation } from \"../l10n/useTranslation\";\n\n/** Results returned by onRatioChanged callback for determining new ratio and whether the ratio was updated.\n * @public\n * @deprecated in 4.12.x. Interface used in a deprecated component {@link ElementSeparator}.\n */\nexport interface RatioChangeResult {\n ratio: number;\n}\n\n/** Properties of [[ElementSeparator]] React component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link ElementSeparator}.\n */\nexport interface ElementSeparatorProps extends CommonProps {\n /** Separator orientation */\n orientation: Orientation;\n /** Ratio between left cell and right cell */\n ratio: number;\n /** Area width or height (depending on orientation) in pixels */\n movableArea?: number;\n /** Separator width or height in pixels. 30 by default */\n separatorSize?: number;\n /** Callback to ratio changed event */\n // eslint-disable-next-line deprecation/deprecation\n onRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n}\n\nfunction getCurrentGlobalPosition(\n orientation: Orientation,\n e: PointerEvent | React.PointerEvent\n) {\n return orientation === Orientation.Horizontal ? e.clientX : e.clientY;\n}\n\nconst useConditionalCleanup = (condition: boolean, cleanup: () => void) => {\n const conditionRef = useRef(condition);\n const cleanupRef = useRef(cleanup);\n\n conditionRef.current = condition;\n cleanupRef.current = cleanup;\n\n useEffect(() => {\n return () => {\n if (conditionRef.current) cleanupRef.current();\n };\n }, []);\n};\n\nconst useElementSeparatorPointerHandler = ({\n onResizeHandleDragChanged,\n onResizeHandleHoverChanged,\n isResizeHandleBeingDragged,\n isResizeHandleHovered,\n movableArea,\n ratio,\n orientation,\n onRatioChanged,\n}: // eslint-disable-next-line deprecation/deprecation\nElementSeparatorProps) => {\n const globalPosition = useRef(0);\n const pointerOutOfBounds = useRef(false);\n\n const [isElementDragged, setIsDragged] = useState(false);\n const [isElementHovered, setIsHovered] = useState(false);\n const isGroupDragged = isResizeHandleBeingDragged ?? isElementDragged;\n const isGroupHovered = isResizeHandleHovered ?? isElementHovered;\n\n useConditionalCleanup(isElementDragged && !!onResizeHandleDragChanged, () =>\n onResizeHandleDragChanged!(false)\n );\n useConditionalCleanup(isElementHovered && !!onResizeHandleHoverChanged, () =>\n onResizeHandleHoverChanged!(false)\n );\n\n if (isGroupHovered && pointerOutOfBounds.current)\n pointerOutOfBounds.current = false;\n\n const stopDrag = useCallback(() => {\n if (isGroupDragged) {\n setIsDragged(false);\n if (onResizeHandleDragChanged) onResizeHandleDragChanged(false);\n }\n }, [isGroupDragged, onResizeHandleDragChanged]);\n\n const startDrag = useCallback(\n (e: PointerEvent | React.PointerEvent) => {\n globalPosition.current = getCurrentGlobalPosition(orientation, e);\n\n if (!isGroupDragged) {\n setIsDragged(true);\n if (onResizeHandleDragChanged) onResizeHandleDragChanged(true);\n }\n },\n [isGroupDragged, orientation, onResizeHandleDragChanged]\n );\n\n const onPointerUp = useCallback(() => {\n stopDrag();\n }, [stopDrag]);\n\n const onThrottledPointerMove = useThrottledFn(\n (e: PointerEvent | React.PointerEvent) => {\n if (!movableArea) {\n stopDrag();\n return;\n }\n\n const currentPosition = getCurrentGlobalPosition(orientation, e);\n const positionChange = currentPosition - globalPosition.current;\n\n // Should not need to recalculate if position on our movement axis does not change\n if (Math.abs(positionChange) < 1) return;\n\n const currentLocalPosition = movableArea * ratio + positionChange;\n const newRatio = currentLocalPosition / movableArea;\n\n globalPosition.current = currentPosition;\n if (pointerOutOfBounds.current || !onRatioChanged) return;\n\n const result = onRatioChanged(newRatio);\n if (\n result &&\n result.ratio === ratio &&\n !isGroupHovered &&\n !pointerOutOfBounds.current\n )\n pointerOutOfBounds.current = true;\n },\n 16,\n [stopDrag, isGroupHovered, ratio, movableArea, onRatioChanged, orientation]\n );\n\n useEffect(() => {\n return () => onThrottledPointerMove.cancel();\n }, [onThrottledPointerMove]);\n\n useLayoutEffect(() => {\n if (isElementDragged) {\n document.addEventListener(\"pointerup\", onPointerUp);\n document.addEventListener(\"pointermove\", onThrottledPointerMove);\n }\n\n return () => {\n document.removeEventListener(\"pointerup\", onPointerUp);\n document.removeEventListener(\"pointermove\", onThrottledPointerMove);\n };\n }, [isElementDragged, onPointerUp, onThrottledPointerMove]);\n\n const onPointerDown = useCallback(\n (e: PointerEvent | React.PointerEvent) => {\n if (!isGroupDragged) {\n startDrag(e);\n } else {\n stopDrag();\n }\n },\n [isGroupDragged, startDrag, stopDrag]\n );\n\n const onPointerOver = useCallback(() => {\n if (isGroupHovered) return;\n\n setIsHovered(true);\n if (onResizeHandleHoverChanged) onResizeHandleHoverChanged(true);\n }, [isGroupHovered, onResizeHandleHoverChanged]);\n\n const onPointerOut = useCallback(() => {\n if (!isGroupHovered) return;\n\n setIsHovered(false);\n if (onResizeHandleHoverChanged) onResizeHandleHoverChanged(false);\n }, [isGroupHovered, onResizeHandleHoverChanged]);\n\n return {\n isHovered: isGroupHovered,\n isDragged: isGroupDragged,\n onPointerDown,\n onPointerOver,\n onPointerOut,\n };\n};\n\nfunction getStyle(\n orientation: Orientation,\n separatorSize?: number\n): React.CSSProperties {\n separatorSize = separatorSize || 30;\n\n if (orientation === Orientation.Horizontal)\n return {\n width: separatorSize,\n margin: `0px ${-Math.floor(separatorSize / 2)}px`,\n };\n return {\n height: separatorSize,\n margin: `${-Math.floor(separatorSize / 2)}px 1px`,\n };\n}\n\n/** A movable button, which allows to change the ratio between left element and right element\n * @public\n * @deprecated in 4.12.x. Basic components that need to be user-resized support this out of the box. Use {@link https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent pointer events} API to implement a custom resizer.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const ElementSeparator = (props: ElementSeparatorProps) => {\n const { translate } = useTranslation();\n\n const [hasHoverHappened, setHasHoverHappened] = useState(false);\n const { isDragged, isHovered, onPointerDown, onPointerOver, onPointerOut } =\n useElementSeparatorPointerHandler(props);\n\n const isHoverNeeded = isHovered || isDragged;\n if (!hasHoverHappened && isHoverNeeded) setHasHoverHappened(isHoverNeeded);\n\n // This is done to avoid fade-out animation when first rendering.\n const unhoverClass = hasHoverHappened\n ? \"core-element-separator-group-unhovered\"\n : \"\";\n\n const classNames = classnames(\n \"core-element-separator\",\n props.orientation === Orientation.Horizontal\n ? \"core-element-separator--horizontal\"\n : \"core-element-separator--vertical\",\n props.className,\n isHoverNeeded ? \"core-element-separator-group-hovered\" : unhoverClass\n );\n\n const orientation = props.orientation;\n const separatorSize = props.separatorSize;\n const style = useMemo(\n () => getStyle(orientation, separatorSize),\n [orientation, separatorSize]\n );\n const styles: React.CSSProperties = {\n ...style,\n ...props.style,\n };\n\n return (\n <button\n style={styles}\n className={classNames}\n onPointerDown={onPointerDown}\n onPointerOver={onPointerOver}\n onPointerOut={onPointerOut}\n aria-label={translate(\"elementSeparator.label\")}\n tabIndex={-1}\n />\n );\n};\n"]}
@@ -65,6 +65,7 @@
65
65
  padding: 0px;
66
66
  opacity: 0;
67
67
  z-index: 1;
68
+ user-select: none;
68
69
 
69
70
  &--vertical {
70
71
  width: 100%;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandableList.d.ts","sourceRoot":"","sources":["../../../../src/core-react/expandable/ExpandableList.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;GAGG;AACH,M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AAQ,KAAK,CAAC,aAAa,CAErD,mBAAmB,EACnB,mBAAmB,CACpB;gBAEa,KAAK,EAAE,mBAAmB;IAOtC,OAAc,YAAY,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAGtD;IAGF,OAAO,CAAC,kBAAkB,CAcxB;IAEF,OAAO,CAAC,YAAY;IAYpB,gBAAgB;IAEA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IASjD,MAAM,IAAI,KAAK,CAAC,YAAY;CAa7C"}
@@ -24,7 +24,6 @@ class ExpandableList extends React.PureComponent {
24
24
  if (this.props.singleIsCollapsible && index === this.state.activeBlock)
25
25
  activeBlock = -1;
26
26
  this.setState({ activeBlock });
27
- // istanbul ignore else
28
27
  if (onToggle) {
29
28
  onToggle(activeBlock === index); // fire the ExpandableBlock onToggle
30
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandableList.js","sourceRoot":"","sources":["../../../../src/core-react/expandable/ExpandableList.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2CAAoC;AACpC,+BAA+B;AAsB/B;;;GAGG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAIzC;IACC,mDAAmD;IACnD,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAWf,mBAAmB;QACX,uBAAkB,GAAG,CAC3B,KAAa,EACb,QAAuC,EACvC,EAAE;YACF,IAAI,WAAW,GAAG,KAAK,CAAC;YAExB,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW;gBACpE,WAAW,GAAG,CAAC,CAAC,CAAC;YAEnB,IAAI,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YAE/B,uBAAuB;YACvB,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,oCAAoC;YACvE,CAAC;QACH,CAAC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AAE,CAChB,CACP,CAAC;IACJ,CAAC;;AAvEH,wCAwEC;AA5DC,mDAAmD;AACrC,2BAAY,GAAiC;IACzD,gBAAgB,EAAE,KAAK;IACvB,kBAAkB,EAAE,CAAC;CACtB,AAHyB,CAGxB","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 Expandable\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"../utils/Props\";\n\n/** Properties for [[ExpandableList]] component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link ExpandableList}.\n */\nexport interface ExpandableListProps extends CommonProps {\n /** Index of the default active block */\n defaultActiveBlock?: number;\n /** Indicates whether to allow only one expanded block */\n singleExpandOnly?: boolean;\n /** Indicates whether the single expanded block is collapsible */\n singleIsCollapsible?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\ninterface ExpandableListState {\n activeBlock: number;\n}\n\n/** ExpandableList React component is a container for ExpandableBlock components.\n * @public\n * @deprecated in 4.12.x. Use a custom container and manage {@link https://itwinui.bentley.com/docs/expandableblock expandable block} state manually.\n */\nexport class ExpandableList extends React.PureComponent<\n // eslint-disable-next-line deprecation/deprecation\n ExpandableListProps,\n ExpandableListState\n> {\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: ExpandableListProps) {\n super(props);\n\n this.state = { activeBlock: this.props.defaultActiveBlock! };\n }\n\n // eslint-disable-next-line deprecation/deprecation\n public static defaultProps: Partial<ExpandableListProps> = {\n singleExpandOnly: false,\n defaultActiveBlock: 0,\n };\n\n // set active block\n private _handleBlockToggle = (\n index: number,\n onToggle: (isExpanding: boolean) => any\n ) => {\n let activeBlock = index;\n\n if (this.props.singleIsCollapsible && index === this.state.activeBlock)\n activeBlock = -1;\n\n this.setState({ activeBlock });\n\n // istanbul ignore else\n if (onToggle) {\n onToggle(activeBlock === index); // fire the ExpandableBlock onToggle\n }\n };\n\n private renderBlocks() {\n return React.Children.map(this.props.children, (child: any, i) => {\n return React.cloneElement(child, {\n key: i,\n isExpanded: this.props.singleExpandOnly\n ? i === this.state.activeBlock\n : child.props.isExpanded,\n onToggle: this._handleBlockToggle.bind(this, i, child.props.onToggle),\n });\n });\n }\n\n /** @internal */\n // eslint-disable-next-line deprecation/deprecation\n public override componentDidUpdate(prevProps: ExpandableListProps) {\n if (\n this.props.defaultActiveBlock !== prevProps.defaultActiveBlock &&\n this.props.defaultActiveBlock !== this.state.activeBlock\n ) {\n this.setState((_, props) => ({ activeBlock: props.defaultActiveBlock! }));\n }\n }\n\n public override render(): React.ReactElement {\n return (\n <div\n className={classnames(\n \"uicore-expandable-blocks-list\",\n this.props.className\n )}\n style={this.props.style}\n >\n {this.renderBlocks()}\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ExpandableList.js","sourceRoot":"","sources":["../../../../src/core-react/expandable/ExpandableList.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,2CAAoC;AACpC,+BAA+B;AAsB/B;;;GAGG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAIzC;IACC,mDAAmD;IACnD,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAWf,mBAAmB;QACX,uBAAkB,GAAG,CAC3B,KAAa,EACb,QAAuC,EACvC,EAAE;YACF,IAAI,WAAW,GAAG,KAAK,CAAC;YAExB,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW;gBACpE,WAAW,GAAG,CAAC,CAAC,CAAC;YAEnB,IAAI,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YAE/B,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,oCAAoC;YACvE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AI,CAAC,YAAY,EAAE,CAChB,CACP,CAAC;IACJ,CAAC;;AAtEH,wCAuEC;AA3DC,mDAAmD;AACrC,2BAAY,GAAiC;IACzD,gBAAgB,EAAE,KAAK;IACvB,kBAAkB,EAAE,CAAC;CACtB,AAHyB,CAGxB","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 Expandable\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"../utils/Props\";\n\n/** Properties for [[ExpandableList]] component\n * @public\n * @deprecated in 4.12.x. Props of deprecated component {@link ExpandableList}.\n */\nexport interface ExpandableListProps extends CommonProps {\n /** Index of the default active block */\n defaultActiveBlock?: number;\n /** Indicates whether to allow only one expanded block */\n singleExpandOnly?: boolean;\n /** Indicates whether the single expanded block is collapsible */\n singleIsCollapsible?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\ninterface ExpandableListState {\n activeBlock: number;\n}\n\n/** ExpandableList React component is a container for ExpandableBlock components.\n * @public\n * @deprecated in 4.12.x. Use a custom container and manage {@link https://itwinui.bentley.com/docs/expandableblock expandable block} state manually.\n */\nexport class ExpandableList extends React.PureComponent<\n // eslint-disable-next-line deprecation/deprecation\n ExpandableListProps,\n ExpandableListState\n> {\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: ExpandableListProps) {\n super(props);\n\n this.state = { activeBlock: this.props.defaultActiveBlock! };\n }\n\n // eslint-disable-next-line deprecation/deprecation\n public static defaultProps: Partial<ExpandableListProps> = {\n singleExpandOnly: false,\n defaultActiveBlock: 0,\n };\n\n // set active block\n private _handleBlockToggle = (\n index: number,\n onToggle: (isExpanding: boolean) => any\n ) => {\n let activeBlock = index;\n\n if (this.props.singleIsCollapsible && index === this.state.activeBlock)\n activeBlock = -1;\n\n this.setState({ activeBlock });\n\n if (onToggle) {\n onToggle(activeBlock === index); // fire the ExpandableBlock onToggle\n }\n };\n\n private renderBlocks() {\n return React.Children.map(this.props.children, (child: any, i) => {\n return React.cloneElement(child, {\n key: i,\n isExpanded: this.props.singleExpandOnly\n ? i === this.state.activeBlock\n : child.props.isExpanded,\n onToggle: this._handleBlockToggle.bind(this, i, child.props.onToggle),\n });\n });\n }\n\n /** @internal */\n // eslint-disable-next-line deprecation/deprecation\n public override componentDidUpdate(prevProps: ExpandableListProps) {\n if (\n this.props.defaultActiveBlock !== prevProps.defaultActiveBlock &&\n this.props.defaultActiveBlock !== this.state.activeBlock\n ) {\n this.setState((_, props) => ({ activeBlock: props.defaultActiveBlock! }));\n }\n }\n\n public override render(): React.ReactElement {\n return (\n <div\n className={classnames(\n \"uicore-expandable-blocks-list\",\n this.props.className\n )}\n style={this.props.style}\n >\n {this.renderBlocks()}\n </div>\n );\n }\n}\n"]}