@itwin/core-react 4.0.1 → 4.1.0-dev.1

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 (451) hide show
  1. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts +1 -1
  2. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  3. package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
  4. package/lib/cjs/core-react/badge/Badge.d.ts +1 -1
  5. package/lib/cjs/core-react/badge/Badge.d.ts.map +1 -1
  6. package/lib/cjs/core-react/badge/Badge.js.map +1 -1
  7. package/lib/cjs/core-react/badge/BetaBadge.d.ts +1 -1
  8. package/lib/cjs/core-react/badge/BetaBadge.d.ts.map +1 -1
  9. package/lib/cjs/core-react/badge/BetaBadge.js.map +1 -1
  10. package/lib/cjs/core-react/badge/NewBadge.d.ts +1 -1
  11. package/lib/cjs/core-react/badge/NewBadge.d.ts.map +1 -1
  12. package/lib/cjs/core-react/badge/NewBadge.js.map +1 -1
  13. package/lib/cjs/core-react/base/Centered.d.ts +1 -1
  14. package/lib/cjs/core-react/base/Centered.d.ts.map +1 -1
  15. package/lib/cjs/core-react/base/Centered.js.map +1 -1
  16. package/lib/cjs/core-react/base/Div.d.ts +1 -1
  17. package/lib/cjs/core-react/base/Div.d.ts.map +1 -1
  18. package/lib/cjs/core-react/base/Div.js.map +1 -1
  19. package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts +1 -1
  20. package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts.map +1 -1
  21. package/lib/cjs/core-react/base/DivWithOutsideClick.js.map +1 -1
  22. package/lib/cjs/core-react/base/FillCentered.d.ts +1 -1
  23. package/lib/cjs/core-react/base/FillCentered.d.ts.map +1 -1
  24. package/lib/cjs/core-react/base/FillCentered.js.map +1 -1
  25. package/lib/cjs/core-react/base/FlexWrapContainer.d.ts +1 -1
  26. package/lib/cjs/core-react/base/FlexWrapContainer.d.ts.map +1 -1
  27. package/lib/cjs/core-react/base/FlexWrapContainer.js.map +1 -1
  28. package/lib/cjs/core-react/base/Gap.d.ts +1 -1
  29. package/lib/cjs/core-react/base/Gap.d.ts.map +1 -1
  30. package/lib/cjs/core-react/base/Gap.js +1 -1
  31. package/lib/cjs/core-react/base/Gap.js.map +1 -1
  32. package/lib/cjs/core-react/base/ScrollView.d.ts +1 -1
  33. package/lib/cjs/core-react/base/ScrollView.d.ts.map +1 -1
  34. package/lib/cjs/core-react/base/ScrollView.js.map +1 -1
  35. package/lib/cjs/core-react/checklistbox/CheckListBox.d.ts +1 -1
  36. package/lib/cjs/core-react/checklistbox/CheckListBox.d.ts.map +1 -1
  37. package/lib/cjs/core-react/checklistbox/CheckListBox.js.map +1 -1
  38. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts +1 -1
  39. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  40. package/lib/cjs/core-react/contextmenu/ContextMenu.js +2 -1
  41. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  42. package/lib/cjs/core-react/contextmenu/ContextMenuDivider.d.ts +1 -1
  43. package/lib/cjs/core-react/contextmenu/ContextMenuDivider.d.ts.map +1 -1
  44. package/lib/cjs/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
  45. package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts +5 -4
  46. package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
  47. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  48. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts +3 -3
  49. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  50. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  51. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts +1 -1
  52. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  53. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +5 -3
  54. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  55. package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts +1 -1
  56. package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
  57. package/lib/cjs/core-react/contextmenu/PopupContextMenu.js.map +1 -1
  58. package/lib/cjs/core-react/dialog/Dialog.d.ts +3 -3
  59. package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
  60. package/lib/cjs/core-react/dialog/Dialog.js +2 -1
  61. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  62. package/lib/cjs/core-react/dialog/GlobalDialog.d.ts +1 -1
  63. package/lib/cjs/core-react/dialog/GlobalDialog.d.ts.map +1 -1
  64. package/lib/cjs/core-react/dialog/GlobalDialog.js +2 -1
  65. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  66. package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts +1 -1
  67. package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  68. package/lib/cjs/core-react/elementseparator/ElementSeparator.js +2 -2
  69. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  70. package/lib/cjs/core-react/expandable/ExpandableList.d.ts +1 -1
  71. package/lib/cjs/core-react/expandable/ExpandableList.d.ts.map +1 -1
  72. package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
  73. package/lib/cjs/core-react/hocs/withOnOutsideClick.js +2 -1
  74. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  75. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts +1 -1
  76. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
  77. package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -1
  78. package/lib/cjs/core-react/icons/IconComponent.d.ts +2 -2
  79. package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
  80. package/lib/cjs/core-react/icons/IconComponent.js +1 -1
  81. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  82. package/lib/cjs/core-react/icons/SvgPath.d.ts +1 -1
  83. package/lib/cjs/core-react/icons/SvgPath.d.ts.map +1 -1
  84. package/lib/cjs/core-react/icons/SvgPath.js.map +1 -1
  85. package/lib/cjs/core-react/icons/WebFontIcon.d.ts +1 -1
  86. package/lib/cjs/core-react/icons/WebFontIcon.d.ts.map +1 -1
  87. package/lib/cjs/core-react/icons/WebFontIcon.js.map +1 -1
  88. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts +1 -1
  89. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
  90. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  91. package/lib/cjs/core-react/inputs/Input.d.ts +1 -1
  92. package/lib/cjs/core-react/inputs/Input.d.ts.map +1 -1
  93. package/lib/cjs/core-react/inputs/Input.js.map +1 -1
  94. package/lib/cjs/core-react/inputs/InputLabel.d.ts +2 -2
  95. package/lib/cjs/core-react/inputs/InputLabel.d.ts.map +1 -1
  96. package/lib/cjs/core-react/inputs/InputLabel.js.map +1 -1
  97. package/lib/cjs/core-react/inputs/LabeledComponentProps.d.ts +2 -2
  98. package/lib/cjs/core-react/inputs/LabeledComponentProps.d.ts.map +1 -1
  99. package/lib/cjs/core-react/inputs/LabeledComponentProps.js.map +1 -1
  100. package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts +1 -1
  101. package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts.map +1 -1
  102. package/lib/cjs/core-react/inputs/iconinput/IconInput.js.map +1 -1
  103. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +1 -1
  104. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  105. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  106. package/lib/cjs/core-react/listbox/Listbox.js +3 -2
  107. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  108. package/lib/cjs/core-react/loading/LoadingBar.d.ts +1 -1
  109. package/lib/cjs/core-react/loading/LoadingBar.d.ts.map +1 -1
  110. package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
  111. package/lib/cjs/core-react/loading/LoadingPrompt.d.ts +1 -1
  112. package/lib/cjs/core-react/loading/LoadingPrompt.d.ts.map +1 -1
  113. package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
  114. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts +1 -1
  115. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  116. package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
  117. package/lib/cjs/core-react/loading/LoadingStatus.d.ts +1 -1
  118. package/lib/cjs/core-react/loading/LoadingStatus.d.ts.map +1 -1
  119. package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
  120. package/lib/cjs/core-react/messagebox/MessageBox.d.ts +4 -3
  121. package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
  122. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  123. package/lib/cjs/core-react/notification/MessageRenderer.d.ts +2 -2
  124. package/lib/cjs/core-react/notification/MessageRenderer.d.ts.map +1 -1
  125. package/lib/cjs/core-react/notification/MessageRenderer.js +1 -1
  126. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  127. package/lib/cjs/core-react/notification/MessageType.d.ts +1 -1
  128. package/lib/cjs/core-react/notification/MessageType.d.ts.map +1 -1
  129. package/lib/cjs/core-react/notification/MessageType.js.map +1 -1
  130. package/lib/cjs/core-react/popup/Popup.d.ts +1 -1
  131. package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
  132. package/lib/cjs/core-react/popup/Popup.js +8 -4
  133. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  134. package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts +2 -2
  135. package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
  136. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  137. package/lib/cjs/core-react/searchbox/SearchBox.d.ts +1 -1
  138. package/lib/cjs/core-react/searchbox/SearchBox.d.ts.map +1 -1
  139. package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
  140. package/lib/cjs/core-react/settings/SettingsContainer.d.ts +1 -1
  141. package/lib/cjs/core-react/settings/SettingsContainer.d.ts.map +1 -1
  142. package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
  143. package/lib/cjs/core-react/settings/SettingsManager.d.ts +1 -1
  144. package/lib/cjs/core-react/settings/SettingsManager.d.ts.map +1 -1
  145. package/lib/cjs/core-react/settings/SettingsManager.js.map +1 -1
  146. package/lib/cjs/core-react/tabs/Tabs.d.ts +1 -1
  147. package/lib/cjs/core-react/tabs/Tabs.d.ts.map +1 -1
  148. package/lib/cjs/core-react/tabs/Tabs.js.map +1 -1
  149. package/lib/cjs/core-react/tabs/VerticalTabs.d.ts +1 -1
  150. package/lib/cjs/core-react/tabs/VerticalTabs.d.ts.map +1 -1
  151. package/lib/cjs/core-react/tabs/VerticalTabs.js.map +1 -1
  152. package/lib/cjs/core-react/text/BlockText.d.ts +1 -1
  153. package/lib/cjs/core-react/text/BlockText.d.ts.map +1 -1
  154. package/lib/cjs/core-react/text/BlockText.js.map +1 -1
  155. package/lib/cjs/core-react/text/BodyText.d.ts +1 -1
  156. package/lib/cjs/core-react/text/BodyText.d.ts.map +1 -1
  157. package/lib/cjs/core-react/text/BodyText.js.map +1 -1
  158. package/lib/cjs/core-react/text/DisabledText.d.ts +1 -1
  159. package/lib/cjs/core-react/text/DisabledText.d.ts.map +1 -1
  160. package/lib/cjs/core-react/text/DisabledText.js.map +1 -1
  161. package/lib/cjs/core-react/text/FilteredText.d.ts +2 -2
  162. package/lib/cjs/core-react/text/FilteredText.d.ts.map +1 -1
  163. package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
  164. package/lib/cjs/core-react/text/MutedText.d.ts +1 -1
  165. package/lib/cjs/core-react/text/MutedText.d.ts.map +1 -1
  166. package/lib/cjs/core-react/text/MutedText.js.map +1 -1
  167. package/lib/cjs/core-react/text/StyledText.d.ts +1 -1
  168. package/lib/cjs/core-react/text/StyledText.d.ts.map +1 -1
  169. package/lib/cjs/core-react/text/StyledText.js.map +1 -1
  170. package/lib/cjs/core-react/text/TextProps.d.ts +2 -2
  171. package/lib/cjs/core-react/text/TextProps.d.ts.map +1 -1
  172. package/lib/cjs/core-react/text/TextProps.js.map +1 -1
  173. package/lib/cjs/core-react/tree/Branch.d.ts +1 -1
  174. package/lib/cjs/core-react/tree/Branch.d.ts.map +1 -1
  175. package/lib/cjs/core-react/tree/Branch.js.map +1 -1
  176. package/lib/cjs/core-react/tree/ExpansionToggle.d.ts +1 -1
  177. package/lib/cjs/core-react/tree/ExpansionToggle.d.ts.map +1 -1
  178. package/lib/cjs/core-react/tree/ExpansionToggle.js.map +1 -1
  179. package/lib/cjs/core-react/tree/Node.d.ts +3 -3
  180. package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
  181. package/lib/cjs/core-react/tree/Node.js +2 -1
  182. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  183. package/lib/cjs/core-react/tree/Node.scss +7 -7
  184. package/lib/cjs/core-react/tree/Placeholder.d.ts +1 -1
  185. package/lib/cjs/core-react/tree/Placeholder.d.ts.map +1 -1
  186. package/lib/cjs/core-react/tree/Placeholder.js.map +1 -1
  187. package/lib/cjs/core-react/tree/Tree.d.ts +1 -1
  188. package/lib/cjs/core-react/tree/Tree.d.ts.map +1 -1
  189. package/lib/cjs/core-react/tree/Tree.js.map +1 -1
  190. package/lib/cjs/core-react/uistate/LocalStateStorage.d.ts +1 -1
  191. package/lib/cjs/core-react/uistate/LocalStateStorage.d.ts.map +1 -1
  192. package/lib/cjs/core-react/uistate/LocalStateStorage.js.map +1 -1
  193. package/lib/cjs/core-react/uistate/UiStateEntry.d.ts +1 -1
  194. package/lib/cjs/core-react/uistate/UiStateEntry.d.ts.map +1 -1
  195. package/lib/cjs/core-react/uistate/UiStateEntry.js.map +1 -1
  196. package/lib/cjs/core-react/utils/IconHelper.d.ts +1 -1
  197. package/lib/cjs/core-react/utils/IconHelper.d.ts.map +1 -1
  198. package/lib/cjs/core-react/utils/IconHelper.js.map +1 -1
  199. package/lib/cjs/core-react/utils/IconWebComponent.js +1 -1
  200. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  201. package/lib/cjs/core-react/utils/Point.d.ts +1 -1
  202. package/lib/cjs/core-react/utils/Point.d.ts.map +1 -1
  203. package/lib/cjs/core-react/utils/Point.js.map +1 -1
  204. package/lib/cjs/core-react/utils/Props.d.ts +2 -2
  205. package/lib/cjs/core-react/utils/Props.d.ts.map +1 -1
  206. package/lib/cjs/core-react/utils/Props.js.map +1 -1
  207. package/lib/cjs/core-react/utils/Rectangle.d.ts +3 -2
  208. package/lib/cjs/core-react/utils/Rectangle.d.ts.map +1 -1
  209. package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
  210. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.d.ts +1 -1
  211. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.d.ts.map +1 -1
  212. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  213. package/lib/cjs/core-react/utils/getCssVariable.js +1 -1
  214. package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
  215. package/lib/cjs/core-react/utils/getDisplayName.d.ts +1 -1
  216. package/lib/cjs/core-react/utils/getDisplayName.d.ts.map +1 -1
  217. package/lib/cjs/core-react/utils/getDisplayName.js.map +1 -1
  218. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.js.map +1 -1
  219. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +2 -1
  220. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  221. package/lib/cjs/core-react/utils/hooks/useDisposable.d.ts +1 -1
  222. package/lib/cjs/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
  223. package/lib/cjs/core-react/utils/hooks/useDisposable.js.map +1 -1
  224. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +13 -8
  225. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  226. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts +1 -1
  227. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  228. package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
  229. package/lib/esm/core-react/badge/Badge.d.ts +1 -1
  230. package/lib/esm/core-react/badge/Badge.d.ts.map +1 -1
  231. package/lib/esm/core-react/badge/Badge.js.map +1 -1
  232. package/lib/esm/core-react/badge/BetaBadge.d.ts +1 -1
  233. package/lib/esm/core-react/badge/BetaBadge.d.ts.map +1 -1
  234. package/lib/esm/core-react/badge/BetaBadge.js.map +1 -1
  235. package/lib/esm/core-react/badge/NewBadge.d.ts +1 -1
  236. package/lib/esm/core-react/badge/NewBadge.d.ts.map +1 -1
  237. package/lib/esm/core-react/badge/NewBadge.js.map +1 -1
  238. package/lib/esm/core-react/base/Centered.d.ts +1 -1
  239. package/lib/esm/core-react/base/Centered.d.ts.map +1 -1
  240. package/lib/esm/core-react/base/Centered.js.map +1 -1
  241. package/lib/esm/core-react/base/Div.d.ts +1 -1
  242. package/lib/esm/core-react/base/Div.d.ts.map +1 -1
  243. package/lib/esm/core-react/base/Div.js.map +1 -1
  244. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts +1 -1
  245. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts.map +1 -1
  246. package/lib/esm/core-react/base/DivWithOutsideClick.js.map +1 -1
  247. package/lib/esm/core-react/base/FillCentered.d.ts +1 -1
  248. package/lib/esm/core-react/base/FillCentered.d.ts.map +1 -1
  249. package/lib/esm/core-react/base/FillCentered.js.map +1 -1
  250. package/lib/esm/core-react/base/FlexWrapContainer.d.ts +1 -1
  251. package/lib/esm/core-react/base/FlexWrapContainer.d.ts.map +1 -1
  252. package/lib/esm/core-react/base/FlexWrapContainer.js.map +1 -1
  253. package/lib/esm/core-react/base/Gap.d.ts +1 -1
  254. package/lib/esm/core-react/base/Gap.d.ts.map +1 -1
  255. package/lib/esm/core-react/base/Gap.js +1 -1
  256. package/lib/esm/core-react/base/Gap.js.map +1 -1
  257. package/lib/esm/core-react/base/ScrollView.d.ts +1 -1
  258. package/lib/esm/core-react/base/ScrollView.d.ts.map +1 -1
  259. package/lib/esm/core-react/base/ScrollView.js.map +1 -1
  260. package/lib/esm/core-react/checklistbox/CheckListBox.d.ts +1 -1
  261. package/lib/esm/core-react/checklistbox/CheckListBox.d.ts.map +1 -1
  262. package/lib/esm/core-react/checklistbox/CheckListBox.js.map +1 -1
  263. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts +1 -1
  264. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  265. package/lib/esm/core-react/contextmenu/ContextMenu.js +2 -1
  266. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  267. package/lib/esm/core-react/contextmenu/ContextMenuDivider.d.ts +1 -1
  268. package/lib/esm/core-react/contextmenu/ContextMenuDivider.d.ts.map +1 -1
  269. package/lib/esm/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
  270. package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts +5 -4
  271. package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts.map +1 -1
  272. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  273. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts +3 -3
  274. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  275. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  276. package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts +1 -1
  277. package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  278. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +5 -3
  279. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  280. package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts +1 -1
  281. package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts.map +1 -1
  282. package/lib/esm/core-react/contextmenu/PopupContextMenu.js.map +1 -1
  283. package/lib/esm/core-react/dialog/Dialog.d.ts +3 -3
  284. package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
  285. package/lib/esm/core-react/dialog/Dialog.js +2 -1
  286. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  287. package/lib/esm/core-react/dialog/GlobalDialog.d.ts +1 -1
  288. package/lib/esm/core-react/dialog/GlobalDialog.d.ts.map +1 -1
  289. package/lib/esm/core-react/dialog/GlobalDialog.js +2 -1
  290. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  291. package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts +1 -1
  292. package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts.map +1 -1
  293. package/lib/esm/core-react/elementseparator/ElementSeparator.js +2 -2
  294. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  295. package/lib/esm/core-react/expandable/ExpandableList.d.ts +1 -1
  296. package/lib/esm/core-react/expandable/ExpandableList.d.ts.map +1 -1
  297. package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
  298. package/lib/esm/core-react/hocs/withOnOutsideClick.js +2 -1
  299. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  300. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts +1 -1
  301. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts.map +1 -1
  302. package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -1
  303. package/lib/esm/core-react/icons/IconComponent.d.ts +2 -2
  304. package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
  305. package/lib/esm/core-react/icons/IconComponent.js +1 -1
  306. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  307. package/lib/esm/core-react/icons/SvgPath.d.ts +1 -1
  308. package/lib/esm/core-react/icons/SvgPath.d.ts.map +1 -1
  309. package/lib/esm/core-react/icons/SvgPath.js.map +1 -1
  310. package/lib/esm/core-react/icons/WebFontIcon.d.ts +1 -1
  311. package/lib/esm/core-react/icons/WebFontIcon.d.ts.map +1 -1
  312. package/lib/esm/core-react/icons/WebFontIcon.js.map +1 -1
  313. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts +1 -1
  314. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts.map +1 -1
  315. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  316. package/lib/esm/core-react/inputs/Input.d.ts +1 -1
  317. package/lib/esm/core-react/inputs/Input.d.ts.map +1 -1
  318. package/lib/esm/core-react/inputs/Input.js.map +1 -1
  319. package/lib/esm/core-react/inputs/InputLabel.d.ts +2 -2
  320. package/lib/esm/core-react/inputs/InputLabel.d.ts.map +1 -1
  321. package/lib/esm/core-react/inputs/InputLabel.js.map +1 -1
  322. package/lib/esm/core-react/inputs/LabeledComponentProps.d.ts +2 -2
  323. package/lib/esm/core-react/inputs/LabeledComponentProps.d.ts.map +1 -1
  324. package/lib/esm/core-react/inputs/LabeledComponentProps.js.map +1 -1
  325. package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts +1 -1
  326. package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts.map +1 -1
  327. package/lib/esm/core-react/inputs/iconinput/IconInput.js.map +1 -1
  328. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +1 -1
  329. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  330. package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  331. package/lib/esm/core-react/listbox/Listbox.js +3 -2
  332. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  333. package/lib/esm/core-react/loading/LoadingBar.d.ts +1 -1
  334. package/lib/esm/core-react/loading/LoadingBar.d.ts.map +1 -1
  335. package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
  336. package/lib/esm/core-react/loading/LoadingPrompt.d.ts +1 -1
  337. package/lib/esm/core-react/loading/LoadingPrompt.d.ts.map +1 -1
  338. package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
  339. package/lib/esm/core-react/loading/LoadingSpinner.d.ts +1 -1
  340. package/lib/esm/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  341. package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
  342. package/lib/esm/core-react/loading/LoadingStatus.d.ts +1 -1
  343. package/lib/esm/core-react/loading/LoadingStatus.d.ts.map +1 -1
  344. package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
  345. package/lib/esm/core-react/messagebox/MessageBox.d.ts +4 -3
  346. package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
  347. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  348. package/lib/esm/core-react/notification/MessageRenderer.d.ts +2 -2
  349. package/lib/esm/core-react/notification/MessageRenderer.d.ts.map +1 -1
  350. package/lib/esm/core-react/notification/MessageRenderer.js +1 -1
  351. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  352. package/lib/esm/core-react/notification/MessageType.d.ts +1 -1
  353. package/lib/esm/core-react/notification/MessageType.d.ts.map +1 -1
  354. package/lib/esm/core-react/notification/MessageType.js.map +1 -1
  355. package/lib/esm/core-react/popup/Popup.d.ts +1 -1
  356. package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
  357. package/lib/esm/core-react/popup/Popup.js +8 -4
  358. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  359. package/lib/esm/core-react/radialmenu/RadialMenu.d.ts +2 -2
  360. package/lib/esm/core-react/radialmenu/RadialMenu.d.ts.map +1 -1
  361. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  362. package/lib/esm/core-react/searchbox/SearchBox.d.ts +1 -1
  363. package/lib/esm/core-react/searchbox/SearchBox.d.ts.map +1 -1
  364. package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
  365. package/lib/esm/core-react/settings/SettingsContainer.d.ts +1 -1
  366. package/lib/esm/core-react/settings/SettingsContainer.d.ts.map +1 -1
  367. package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
  368. package/lib/esm/core-react/settings/SettingsManager.d.ts +1 -1
  369. package/lib/esm/core-react/settings/SettingsManager.d.ts.map +1 -1
  370. package/lib/esm/core-react/settings/SettingsManager.js.map +1 -1
  371. package/lib/esm/core-react/tabs/Tabs.d.ts +1 -1
  372. package/lib/esm/core-react/tabs/Tabs.d.ts.map +1 -1
  373. package/lib/esm/core-react/tabs/Tabs.js.map +1 -1
  374. package/lib/esm/core-react/tabs/VerticalTabs.d.ts +1 -1
  375. package/lib/esm/core-react/tabs/VerticalTabs.d.ts.map +1 -1
  376. package/lib/esm/core-react/tabs/VerticalTabs.js.map +1 -1
  377. package/lib/esm/core-react/text/BlockText.d.ts +1 -1
  378. package/lib/esm/core-react/text/BlockText.d.ts.map +1 -1
  379. package/lib/esm/core-react/text/BlockText.js.map +1 -1
  380. package/lib/esm/core-react/text/BodyText.d.ts +1 -1
  381. package/lib/esm/core-react/text/BodyText.d.ts.map +1 -1
  382. package/lib/esm/core-react/text/BodyText.js.map +1 -1
  383. package/lib/esm/core-react/text/DisabledText.d.ts +1 -1
  384. package/lib/esm/core-react/text/DisabledText.d.ts.map +1 -1
  385. package/lib/esm/core-react/text/DisabledText.js.map +1 -1
  386. package/lib/esm/core-react/text/FilteredText.d.ts +2 -2
  387. package/lib/esm/core-react/text/FilteredText.d.ts.map +1 -1
  388. package/lib/esm/core-react/text/FilteredText.js.map +1 -1
  389. package/lib/esm/core-react/text/MutedText.d.ts +1 -1
  390. package/lib/esm/core-react/text/MutedText.d.ts.map +1 -1
  391. package/lib/esm/core-react/text/MutedText.js.map +1 -1
  392. package/lib/esm/core-react/text/StyledText.d.ts +1 -1
  393. package/lib/esm/core-react/text/StyledText.d.ts.map +1 -1
  394. package/lib/esm/core-react/text/StyledText.js.map +1 -1
  395. package/lib/esm/core-react/text/TextProps.d.ts +2 -2
  396. package/lib/esm/core-react/text/TextProps.d.ts.map +1 -1
  397. package/lib/esm/core-react/text/TextProps.js.map +1 -1
  398. package/lib/esm/core-react/tree/Branch.d.ts +1 -1
  399. package/lib/esm/core-react/tree/Branch.d.ts.map +1 -1
  400. package/lib/esm/core-react/tree/Branch.js.map +1 -1
  401. package/lib/esm/core-react/tree/ExpansionToggle.d.ts +1 -1
  402. package/lib/esm/core-react/tree/ExpansionToggle.d.ts.map +1 -1
  403. package/lib/esm/core-react/tree/ExpansionToggle.js.map +1 -1
  404. package/lib/esm/core-react/tree/Node.d.ts +3 -3
  405. package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
  406. package/lib/esm/core-react/tree/Node.js +2 -1
  407. package/lib/esm/core-react/tree/Node.js.map +1 -1
  408. package/lib/esm/core-react/tree/Node.scss +7 -7
  409. package/lib/esm/core-react/tree/Placeholder.d.ts +1 -1
  410. package/lib/esm/core-react/tree/Placeholder.d.ts.map +1 -1
  411. package/lib/esm/core-react/tree/Placeholder.js.map +1 -1
  412. package/lib/esm/core-react/tree/Tree.d.ts +1 -1
  413. package/lib/esm/core-react/tree/Tree.d.ts.map +1 -1
  414. package/lib/esm/core-react/tree/Tree.js.map +1 -1
  415. package/lib/esm/core-react/uistate/LocalStateStorage.d.ts +1 -1
  416. package/lib/esm/core-react/uistate/LocalStateStorage.d.ts.map +1 -1
  417. package/lib/esm/core-react/uistate/LocalStateStorage.js.map +1 -1
  418. package/lib/esm/core-react/uistate/UiStateEntry.d.ts +1 -1
  419. package/lib/esm/core-react/uistate/UiStateEntry.d.ts.map +1 -1
  420. package/lib/esm/core-react/uistate/UiStateEntry.js.map +1 -1
  421. package/lib/esm/core-react/utils/IconHelper.d.ts +1 -1
  422. package/lib/esm/core-react/utils/IconHelper.d.ts.map +1 -1
  423. package/lib/esm/core-react/utils/IconHelper.js.map +1 -1
  424. package/lib/esm/core-react/utils/IconWebComponent.js +1 -1
  425. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  426. package/lib/esm/core-react/utils/Point.d.ts +1 -1
  427. package/lib/esm/core-react/utils/Point.d.ts.map +1 -1
  428. package/lib/esm/core-react/utils/Point.js.map +1 -1
  429. package/lib/esm/core-react/utils/Props.d.ts +2 -2
  430. package/lib/esm/core-react/utils/Props.d.ts.map +1 -1
  431. package/lib/esm/core-react/utils/Props.js.map +1 -1
  432. package/lib/esm/core-react/utils/Rectangle.d.ts +3 -2
  433. package/lib/esm/core-react/utils/Rectangle.d.ts.map +1 -1
  434. package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
  435. package/lib/esm/core-react/utils/ScrollPositionMaintainer.d.ts +1 -1
  436. package/lib/esm/core-react/utils/ScrollPositionMaintainer.d.ts.map +1 -1
  437. package/lib/esm/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  438. package/lib/esm/core-react/utils/getCssVariable.js +1 -1
  439. package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
  440. package/lib/esm/core-react/utils/getDisplayName.d.ts +1 -1
  441. package/lib/esm/core-react/utils/getDisplayName.d.ts.map +1 -1
  442. package/lib/esm/core-react/utils/getDisplayName.js.map +1 -1
  443. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.js.map +1 -1
  444. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +2 -1
  445. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  446. package/lib/esm/core-react/utils/hooks/useDisposable.d.ts +1 -1
  447. package/lib/esm/core-react/utils/hooks/useDisposable.d.ts.map +1 -1
  448. package/lib/esm/core-react/utils/hooks/useDisposable.js.map +1 -1
  449. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +13 -8
  450. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  451. package/package.json +7 -2
@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MAAM;QACR,KAAK,2CAAoB,CAAC,KAAK;YAC7B,SAAS,GAAG,yBAAyB,CAAC;YACtC,MAAM;QACR,KAAK,2CAAoB,CAAC,UAAU;YAClC,SAAS,GAAG,iDAAiD,CAAC;YAC9D,MAAM;QACR,KAAK,2CAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,2CAAoB,CAAC,WAAW;YACnC,SAAS,GAAG,kDAAkD,CAAC;YAC/D,MAAM;KACT;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,AAzCyC,CAyCxC;AA1LS,kCAAW","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 \"./ContextMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ConditionalBooleanValue, SpecialKey } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"../utils/Props\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport { ContextMenuItem, ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextSubMenu, ContextSubMenuProps } from \"./ContextSubMenu\";\n\n/** Properties for the [[ContextMenu]] component\n * @public\n */\nexport interface ContextMenuProps extends CommonProps {\n /** Whether ContextMenu is currently opened. */\n opened: boolean;\n /** Which direction the menu opens. Default: ContextMenuDirection.BottomRight */\n direction?: ContextMenuDirection;\n /** When click is registered outside of ContextMenu. */\n onOutsideClick?: (event: MouseEvent) => any;\n /** When list item or submenu is selected */\n onSelect?: (event: any) => any;\n /** when Escape button is pressed */\n onEsc?: (data: any) => any;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n /** whether menu floats on the viewport, or the page. When false, container elements can clip menu with overflow: hidden; Default: true */\n floating?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n /** @internal */\n parentSubmenu?: ContextSubMenu;\n /** @internal */\n ignoreNextKeyUp?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\ninterface ContextMenuState {\n selectedIndex: number;\n direction: ContextMenuDirection;\n ignoreNextKeyUp: boolean;\n}\n\n/**\n * A context menu populated with [[ContextMenuItem]] components.\n * Can be nested using [[ContextSubMenu]] component.\n * @public\n */\nexport class ContextMenu extends React.PureComponent<ContextMenuProps, ContextMenuState> {\n private _rootElement: HTMLElement | null = null;\n private _menuElement: HTMLElement | null = null;\n private _selectedElement: ContextMenuItem | ContextSubMenu | null = null;\n private _length: number = 0;\n private _hotKeyMap: Map<number, string> = new Map();\n\n private _lastChildren: React.ReactNode;\n private _lastDirection: ContextMenuDirection | undefined = ContextMenuDirection.BottomRight;\n private _lastSelectedIndex: number = 0;\n private _injectedChildren: React.ReactNode;\n private _parentWindowHeight: number = 0;\n private _parentWindowWidth: number = 0;\n\n public static defaultProps: Partial<ContextMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n autoflip: true,\n edgeLimit: true,\n hotkeySelect: true,\n selectedIndex: -1,\n floating: true,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextMenuState>;\n constructor(props: ContextMenuProps) {\n super(props);\n this.state = {\n selectedIndex: this.props.selectedIndex!,\n direction: props.direction!,\n ignoreNextKeyUp: props.ignoreNextKeyUp!,\n };\n }\n\n /** @internal */\n public static autoFlip = (dir: ContextMenuDirection, rect: DOMRectReadOnly, windowWidth: number, windowHeight: number): ContextMenuDirection => {\n if (rect.right > windowWidth) {\n switch (dir) {\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Right:\n dir = ContextMenuDirection.Left;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.BottomLeft;\n break;\n }\n }\n if (rect.left < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.TopRight;\n break;\n case ContextMenuDirection.Left:\n dir = ContextMenuDirection.Right;\n break;\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n if (rect.bottom > windowHeight) {\n switch (dir) {\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Bottom:\n dir = ContextMenuDirection.Top;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.TopRight;\n break;\n }\n }\n if (rect.top < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.BottomLeft;\n break;\n case ContextMenuDirection.Top:\n dir = ContextMenuDirection.Bottom;\n break;\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n return dir;\n };\n\n private _handleHotKeyParsed = (index: number, hotKey: string) => {\n this._hotKeyMap.set(index, hotKey);\n };\n\n // istanbul ignore next\n private _handleOnOutsideClick = (event: MouseEvent): void => {\n if (this.props.opened && this.props.onOutsideClick)\n this.props.onOutsideClick(event);\n };\n\n public override render(): JSX.Element {\n const {\n opened, direction, onOutsideClick, onSelect, onEsc, autoflip, edgeLimit, hotkeySelect, // eslint-disable-line @typescript-eslint/no-unused-vars\n selectedIndex, floating, parentMenu, parentSubmenu, children, className, ignoreNextKeyUp, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...props } = this.props;\n const renderDirection = parentMenu === undefined ? this.state.direction : direction;\n\n if (this._lastChildren !== children || this._lastDirection !== renderDirection || this._lastSelectedIndex !== this.state.selectedIndex) {\n this._injectedChildren = this._injectMenuItemProps(children, renderDirection, this.state.selectedIndex);\n this._lastChildren = children;\n this._lastDirection = renderDirection;\n this._lastSelectedIndex = this.state.selectedIndex;\n }\n\n const classNames = classnames(\"core-context-menu\", className);\n\n return (\n <div\n role=\"presentation\"\n className={classNames}\n onKeyUp={this._handleKeyUp}\n onClick={this._handleClick}\n data-testid=\"core-context-menu-root\"\n {...props}\n ref={this._rootRef}>\n <DivWithOutsideClick onOutsideClick={this._handleOnOutsideClick}>\n <div\n ref={this._menuRef}\n role=\"menu\"\n tabIndex={0}\n data-testid=\"core-context-menu-container\"\n className={classnames(\"core-context-menu-container\",\n opened && \"core-context-menu-opened\",\n floating && \"core-context-menu-floating\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection),\n )}>\n {this._injectedChildren}\n </div>\n </DivWithOutsideClick>\n </div>\n );\n }\n\n /** @internal */\n public static getCSSClassNameFromDirection = (direction?: ContextMenuDirection): string => {\n let className = \"\";\n\n // istanbul ignore next\n if (direction === undefined)\n direction = ContextMenuDirection.BottomRight;\n\n if (direction === ContextMenuDirection.None)\n return \"\";\n\n switch (direction) {\n case ContextMenuDirection.TopLeft:\n className = \"core-context-menu-top core-context-menu-left\";\n break;\n case ContextMenuDirection.Top:\n className = \"core-context-menu-top\";\n break;\n case ContextMenuDirection.TopRight:\n className = \"core-context-menu-top core-context-menu-right\";\n break;\n case ContextMenuDirection.Left:\n className = \"core-context-menu-left\";\n break;\n case ContextMenuDirection.Center:\n className = \"core-context-menu-center\";\n break;\n case ContextMenuDirection.Right:\n className = \"core-context-menu-right\";\n break;\n case ContextMenuDirection.BottomLeft:\n className = \"core-context-menu-bottom core-context-menu-left\";\n break;\n case ContextMenuDirection.Bottom:\n className = \"core-context-menu-bottom\";\n break;\n case ContextMenuDirection.BottomRight:\n className = \"core-context-menu-bottom core-context-menu-right\";\n break;\n }\n\n return className;\n };\n\n private _injectMenuItemProps = (children: React.ReactNode, direction: ContextMenuDirection | undefined, selectedIndex: number) => {\n let index = 0;\n // add inheritance data to submenu children\n const ch = React.Children.map(children, (child: React.ReactNode) => {\n // Capture only ContextSubMenus and ContextMenuItems.\n if (child && typeof child === \"object\" && \"props\" in child && (child.type === ContextSubMenu || child.type === ContextMenuItem) &&\n !ConditionalBooleanValue.getValue(child.props.disabled) && !ConditionalBooleanValue.getValue(child.props.hidden)) {\n const id = index; // get separate id variable so value stays the same when onHover is called later.\n const onHover = () => {\n this.setState({ selectedIndex: id });\n this.focus();\n };\n const ref = (el: ContextSubMenu | ContextMenuItem | null) => {\n if (selectedIndex === id) // only save to this._selectedElement if previously captured bool is true\n this._selectedElement = el;\n };\n const boundHandleHotKeyParse = this._handleHotKeyParsed.bind(this, id); // bind local callback for specific index\n const childProps: Partial<ContextSubMenuProps & ContextMenuItemProps & { ref: typeof ref }> = {\n parentMenu: this,\n ref,\n onHover,\n isSelected: selectedIndex === id,\n onHotKeyParsed: boundHandleHotKeyParse,\n };\n if (child.type === ContextSubMenu) { // add direction only to sub-menus\n childProps.direction = child.props.direction || /* istanbul ignore next */ direction;\n }\n index++;\n return React.cloneElement(child, childProps);\n } else return child; // Else, pass through unmodified\n });\n this._length = index;\n return ch;\n };\n\n private _rootRef = (el: HTMLDivElement | null) => {\n this._rootElement = el;\n };\n\n private _menuRef = (el: HTMLDivElement | null) => {\n this._menuElement = el;\n };\n\n private getWindow() {\n const el = this._rootElement ? this._rootElement : /* istanbul ignore next */ this._menuElement;\n const parentDocument = el!.ownerDocument;\n // istanbul ignore next\n return parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidMount() {\n const parentWindow = this.getWindow();\n parentWindow.addEventListener(\"focus\", this._handleFocusChange);\n parentWindow.addEventListener(\"mouseup\", this._handleFocusChange);\n\n this.checkRenderDirection();\n\n if (this.props.opened)\n this.focus();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n const parentWindow = this.getWindow();\n parentWindow.removeEventListener(\"focus\", this._handleFocusChange);\n parentWindow.removeEventListener(\"mouseup\", this._handleFocusChange);\n }\n\n private checkRenderDirection() {\n const { direction, autoflip, parentMenu } = this.props;\n const parentWindow = this.getWindow();\n\n let renderDirection = parentMenu === undefined ? this.state.direction : direction;\n\n if (parentWindow.innerHeight === this._parentWindowHeight && parentWindow.innerWidth === this._parentWindowWidth)\n return;\n this._parentWindowHeight = parentWindow.innerHeight;\n this._parentWindowWidth = parentWindow.innerWidth;\n\n // check if menu should flip\n if (parentWindow && autoflip && parentMenu === undefined) {\n const menuRect = this.getRect();\n renderDirection = ContextMenu.autoFlip(renderDirection!, menuRect, parentWindow.innerWidth, parentWindow.innerHeight);\n // istanbul ignore next\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n public focus = () => {\n // istanbul ignore else\n if (this._menuElement)\n this._menuElement.focus();\n };\n\n public blur = () => {\n // istanbul ignore else\n if (this._menuElement)\n this._menuElement.blur();\n };\n\n public getRect = (): DOMRect => {\n let clientRect = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0});\n\n // istanbul ignore else\n if (this._menuElement) {\n clientRect = this._menuElement.getBoundingClientRect();\n }\n return clientRect;\n };\n\n private _handleFocusChange = (event: any): void => {\n // istanbul ignore else\n if (this._rootElement && this.props.opened && event.target instanceof Node && this.props.onOutsideClick && !this._rootElement.contains(event.target))\n this.props.onOutsideClick(event);\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n if (this.props.onSelect)\n this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (this.state.ignoreNextKeyUp) {\n this.setState({ ignoreNextKeyUp: false });\n return;\n }\n\n // istanbul ignore else\n if (event.key) {\n for (const [key, value] of this._hotKeyMap) {\n if (!this.props.hotkeySelect! && key > this.state.selectedIndex) { // Start search at current index.\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key });\n return;\n }\n }\n }\n for (const [key, value] of this._hotKeyMap) {\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key }, () => {\n if (this.props.hotkeySelect && this._selectedElement) {\n this._selectedElement.select();\n }\n });\n event.stopPropagation();\n return;\n }\n }\n }\n\n if (event.key === SpecialKey.ArrowLeft) {\n event.stopPropagation();\n if (this.props.parentMenu && this.props.parentSubmenu) {\n this.props.parentSubmenu.close();\n this.props.parentMenu.focus();\n }\n if (this.props.onEsc)\n this.props.onEsc(event);\n }\n\n if (event.key === SpecialKey.Escape) {\n // istanbul ignore else\n if (this.props.onEsc)\n this.props.onEsc(event);\n }\n\n if ((event.key === SpecialKey.Enter || event.key === SpecialKey.ArrowRight) && this._selectedElement) {\n event.stopPropagation();\n\n // istanbul ignore else\n if (event.key === SpecialKey.Enter || /* istanbul ignore next */ this._selectedElement instanceof ContextSubMenu) {\n // istanbul ignore else\n if (this._selectedElement.select)\n this._selectedElement.select();\n }\n }\n\n let { selectedIndex } = this.state;\n if (event.key === SpecialKey.ArrowUp || event.key === SpecialKey.ArrowDown) {\n event.stopPropagation();\n if (selectedIndex === -1) {\n selectedIndex = 0;\n } else {\n if (event.key === SpecialKey.ArrowUp) {\n if (this.state.selectedIndex === 0)\n selectedIndex = this._length - 1;\n else\n selectedIndex--;\n }\n if (event.key === SpecialKey.ArrowDown) {\n if (this.state.selectedIndex === this._length - 1)\n selectedIndex = 0;\n else\n selectedIndex++;\n }\n }\n }\n this.setState({ selectedIndex });\n };\n\n public override componentDidUpdate(prevProps: ContextMenuProps) {\n if (prevProps.selectedIndex !== this.props.selectedIndex) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!prevProps.opened && this.props.opened) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!this.props.parentMenu) {\n // const direction = this.props.direction!;\n // if ((!this.props.opened && prevProps.opened && direction !== this.state.direction) || prevProps.direction !== direction)\n this.checkRenderDirection();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenu.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,8BAA4B;AAC5B,2C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D,MAAM;QACR,KAAK,2CAAoB,CAAC,MAAM;YAC9B,SAAS,GAAG,0BAA0B,CAAC;YACvC,MAAM;QACR,KAAK,2CAAoB,CAAC,WAAW;YACnC,SAAS,GAAG,kDAAkD,CAAC;YAC/D,MAAM;KACT;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,AAzCyC,CAyCxC;AA1LS,kCAAW","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 \"./ContextMenu.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ConditionalBooleanValue, SpecialKey } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { DivWithOutsideClick } from \"../base/DivWithOutsideClick\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenuItem } from \"./ContextMenuItem\";\nimport type { ContextSubMenuProps } from \"./ContextSubMenu\";\nimport { ContextSubMenu } from \"./ContextSubMenu\";\n\n/** Properties for the [[ContextMenu]] component\n * @public\n */\nexport interface ContextMenuProps extends CommonProps {\n /** Whether ContextMenu is currently opened. */\n opened: boolean;\n /** Which direction the menu opens. Default: ContextMenuDirection.BottomRight */\n direction?: ContextMenuDirection;\n /** When click is registered outside of ContextMenu. */\n onOutsideClick?: (event: MouseEvent) => any;\n /** When list item or submenu is selected */\n onSelect?: (event: any) => any;\n /** when Escape button is pressed */\n onEsc?: (data: any) => any;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n /** whether menu floats on the viewport, or the page. When false, container elements can clip menu with overflow: hidden; Default: true */\n floating?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n /** @internal */\n parentSubmenu?: ContextSubMenu;\n /** @internal */\n ignoreNextKeyUp?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\ninterface ContextMenuState {\n selectedIndex: number;\n direction: ContextMenuDirection;\n ignoreNextKeyUp: boolean;\n}\n\n/**\n * A context menu populated with [[ContextMenuItem]] components.\n * Can be nested using [[ContextSubMenu]] component.\n * @public\n */\nexport class ContextMenu extends React.PureComponent<ContextMenuProps, ContextMenuState> {\n private _rootElement: HTMLElement | null = null;\n private _menuElement: HTMLElement | null = null;\n private _selectedElement: ContextMenuItem | ContextSubMenu | null = null;\n private _length: number = 0;\n private _hotKeyMap: Map<number, string> = new Map();\n\n private _lastChildren: React.ReactNode;\n private _lastDirection: ContextMenuDirection | undefined = ContextMenuDirection.BottomRight;\n private _lastSelectedIndex: number = 0;\n private _injectedChildren: React.ReactNode;\n private _parentWindowHeight: number = 0;\n private _parentWindowWidth: number = 0;\n\n public static defaultProps: Partial<ContextMenuProps> = {\n direction: ContextMenuDirection.BottomRight,\n autoflip: true,\n edgeLimit: true,\n hotkeySelect: true,\n selectedIndex: -1,\n floating: true,\n };\n\n /** @internal */\n public override readonly state: Readonly<ContextMenuState>;\n constructor(props: ContextMenuProps) {\n super(props);\n this.state = {\n selectedIndex: this.props.selectedIndex!,\n direction: props.direction!,\n ignoreNextKeyUp: props.ignoreNextKeyUp!,\n };\n }\n\n /** @internal */\n public static autoFlip = (dir: ContextMenuDirection, rect: DOMRectReadOnly, windowWidth: number, windowHeight: number): ContextMenuDirection => {\n if (rect.right > windowWidth) {\n switch (dir) {\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Right:\n dir = ContextMenuDirection.Left;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.BottomLeft;\n break;\n }\n }\n if (rect.left < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.TopRight;\n break;\n case ContextMenuDirection.Left:\n dir = ContextMenuDirection.Right;\n break;\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n if (rect.bottom > windowHeight) {\n switch (dir) {\n case ContextMenuDirection.BottomLeft:\n dir = ContextMenuDirection.TopLeft;\n break;\n case ContextMenuDirection.Bottom:\n dir = ContextMenuDirection.Top;\n break;\n case ContextMenuDirection.BottomRight:\n dir = ContextMenuDirection.TopRight;\n break;\n }\n }\n if (rect.top < 0) {\n switch (dir) {\n case ContextMenuDirection.TopLeft:\n dir = ContextMenuDirection.BottomLeft;\n break;\n case ContextMenuDirection.Top:\n dir = ContextMenuDirection.Bottom;\n break;\n case ContextMenuDirection.TopRight:\n dir = ContextMenuDirection.BottomRight;\n break;\n }\n }\n return dir;\n };\n\n private _handleHotKeyParsed = (index: number, hotKey: string) => {\n this._hotKeyMap.set(index, hotKey);\n };\n\n // istanbul ignore next\n private _handleOnOutsideClick = (event: MouseEvent): void => {\n if (this.props.opened && this.props.onOutsideClick)\n this.props.onOutsideClick(event);\n };\n\n public override render(): JSX.Element {\n const {\n opened, direction, onOutsideClick, onSelect, onEsc, autoflip, edgeLimit, hotkeySelect, // eslint-disable-line @typescript-eslint/no-unused-vars\n selectedIndex, floating, parentMenu, parentSubmenu, children, className, ignoreNextKeyUp, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...props } = this.props;\n const renderDirection = parentMenu === undefined ? this.state.direction : direction;\n\n if (this._lastChildren !== children || this._lastDirection !== renderDirection || this._lastSelectedIndex !== this.state.selectedIndex) {\n this._injectedChildren = this._injectMenuItemProps(children, renderDirection, this.state.selectedIndex);\n this._lastChildren = children;\n this._lastDirection = renderDirection;\n this._lastSelectedIndex = this.state.selectedIndex;\n }\n\n const classNames = classnames(\"core-context-menu\", className);\n\n return (\n <div\n role=\"presentation\"\n className={classNames}\n onKeyUp={this._handleKeyUp}\n onClick={this._handleClick}\n data-testid=\"core-context-menu-root\"\n {...props}\n ref={this._rootRef}>\n <DivWithOutsideClick onOutsideClick={this._handleOnOutsideClick}>\n <div\n ref={this._menuRef}\n role=\"menu\"\n tabIndex={0}\n data-testid=\"core-context-menu-container\"\n className={classnames(\"core-context-menu-container\",\n opened && \"core-context-menu-opened\",\n floating && \"core-context-menu-floating\",\n ContextMenu.getCSSClassNameFromDirection(renderDirection),\n )}>\n {this._injectedChildren}\n </div>\n </DivWithOutsideClick>\n </div>\n );\n }\n\n /** @internal */\n public static getCSSClassNameFromDirection = (direction?: ContextMenuDirection): string => {\n let className = \"\";\n\n // istanbul ignore next\n if (direction === undefined)\n direction = ContextMenuDirection.BottomRight;\n\n if (direction === ContextMenuDirection.None)\n return \"\";\n\n switch (direction) {\n case ContextMenuDirection.TopLeft:\n className = \"core-context-menu-top core-context-menu-left\";\n break;\n case ContextMenuDirection.Top:\n className = \"core-context-menu-top\";\n break;\n case ContextMenuDirection.TopRight:\n className = \"core-context-menu-top core-context-menu-right\";\n break;\n case ContextMenuDirection.Left:\n className = \"core-context-menu-left\";\n break;\n case ContextMenuDirection.Center:\n className = \"core-context-menu-center\";\n break;\n case ContextMenuDirection.Right:\n className = \"core-context-menu-right\";\n break;\n case ContextMenuDirection.BottomLeft:\n className = \"core-context-menu-bottom core-context-menu-left\";\n break;\n case ContextMenuDirection.Bottom:\n className = \"core-context-menu-bottom\";\n break;\n case ContextMenuDirection.BottomRight:\n className = \"core-context-menu-bottom core-context-menu-right\";\n break;\n }\n\n return className;\n };\n\n private _injectMenuItemProps = (children: React.ReactNode, direction: ContextMenuDirection | undefined, selectedIndex: number) => {\n let index = 0;\n // add inheritance data to submenu children\n const ch = React.Children.map(children, (child: React.ReactNode) => {\n // Capture only ContextSubMenus and ContextMenuItems.\n if (child && typeof child === \"object\" && \"props\" in child && (child.type === ContextSubMenu || child.type === ContextMenuItem) &&\n !ConditionalBooleanValue.getValue(child.props.disabled) && !ConditionalBooleanValue.getValue(child.props.hidden)) {\n const id = index; // get separate id variable so value stays the same when onHover is called later.\n const onHover = () => {\n this.setState({ selectedIndex: id });\n this.focus();\n };\n const ref = (el: ContextSubMenu | ContextMenuItem | null) => {\n if (selectedIndex === id) // only save to this._selectedElement if previously captured bool is true\n this._selectedElement = el;\n };\n const boundHandleHotKeyParse = this._handleHotKeyParsed.bind(this, id); // bind local callback for specific index\n const childProps: Partial<ContextSubMenuProps & ContextMenuItemProps & { ref: typeof ref }> = {\n parentMenu: this,\n ref,\n onHover,\n isSelected: selectedIndex === id,\n onHotKeyParsed: boundHandleHotKeyParse,\n };\n if (child.type === ContextSubMenu) { // add direction only to sub-menus\n childProps.direction = child.props.direction || /* istanbul ignore next */ direction;\n }\n index++;\n return React.cloneElement(child, childProps);\n } else return child; // Else, pass through unmodified\n });\n this._length = index;\n return ch;\n };\n\n private _rootRef = (el: HTMLDivElement | null) => {\n this._rootElement = el;\n };\n\n private _menuRef = (el: HTMLDivElement | null) => {\n this._menuElement = el;\n };\n\n private getWindow() {\n const el = this._rootElement ? this._rootElement : /* istanbul ignore next */ this._menuElement;\n const parentDocument = el!.ownerDocument;\n // istanbul ignore next\n return parentDocument.defaultView ?? window;\n }\n\n /** @internal */\n public override componentDidMount() {\n const parentWindow = this.getWindow();\n parentWindow.addEventListener(\"focus\", this._handleFocusChange);\n parentWindow.addEventListener(\"mouseup\", this._handleFocusChange);\n\n this.checkRenderDirection();\n\n if (this.props.opened)\n this.focus();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n const parentWindow = this.getWindow();\n parentWindow.removeEventListener(\"focus\", this._handleFocusChange);\n parentWindow.removeEventListener(\"mouseup\", this._handleFocusChange);\n }\n\n private checkRenderDirection() {\n const { direction, autoflip, parentMenu } = this.props;\n const parentWindow = this.getWindow();\n\n let renderDirection = parentMenu === undefined ? this.state.direction : direction;\n\n if (parentWindow.innerHeight === this._parentWindowHeight && parentWindow.innerWidth === this._parentWindowWidth)\n return;\n this._parentWindowHeight = parentWindow.innerHeight;\n this._parentWindowWidth = parentWindow.innerWidth;\n\n // check if menu should flip\n if (parentWindow && autoflip && parentMenu === undefined) {\n const menuRect = this.getRect();\n renderDirection = ContextMenu.autoFlip(renderDirection!, menuRect, parentWindow.innerWidth, parentWindow.innerHeight);\n // istanbul ignore next\n if (renderDirection !== this.state.direction)\n this.setState({ direction: renderDirection });\n }\n }\n\n public focus = () => {\n // istanbul ignore else\n if (this._menuElement)\n this._menuElement.focus();\n };\n\n public blur = () => {\n // istanbul ignore else\n if (this._menuElement)\n this._menuElement.blur();\n };\n\n public getRect = (): DOMRect => {\n let clientRect = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0});\n\n // istanbul ignore else\n if (this._menuElement) {\n clientRect = this._menuElement.getBoundingClientRect();\n }\n return clientRect;\n };\n\n private _handleFocusChange = (event: any): void => {\n // istanbul ignore else\n if (this._rootElement && this.props.opened && event.target instanceof Node && this.props.onOutsideClick && !this._rootElement.contains(event.target))\n this.props.onOutsideClick(event);\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n if (this.props.onSelect)\n this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (this.state.ignoreNextKeyUp) {\n this.setState({ ignoreNextKeyUp: false });\n return;\n }\n\n // istanbul ignore else\n if (event.key) {\n for (const [key, value] of this._hotKeyMap) {\n if (!this.props.hotkeySelect! && key > this.state.selectedIndex) { // Start search at current index.\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key });\n return;\n }\n }\n }\n for (const [key, value] of this._hotKeyMap) {\n if (event.key.toUpperCase() === value) {\n this.setState({ selectedIndex: key }, () => {\n if (this.props.hotkeySelect && this._selectedElement) {\n this._selectedElement.select();\n }\n });\n event.stopPropagation();\n return;\n }\n }\n }\n\n if (event.key === SpecialKey.ArrowLeft) {\n event.stopPropagation();\n if (this.props.parentMenu && this.props.parentSubmenu) {\n this.props.parentSubmenu.close();\n this.props.parentMenu.focus();\n }\n if (this.props.onEsc)\n this.props.onEsc(event);\n }\n\n if (event.key === SpecialKey.Escape) {\n // istanbul ignore else\n if (this.props.onEsc)\n this.props.onEsc(event);\n }\n\n if ((event.key === SpecialKey.Enter || event.key === SpecialKey.ArrowRight) && this._selectedElement) {\n event.stopPropagation();\n\n // istanbul ignore else\n if (event.key === SpecialKey.Enter || /* istanbul ignore next */ this._selectedElement instanceof ContextSubMenu) {\n // istanbul ignore else\n if (this._selectedElement.select)\n this._selectedElement.select();\n }\n }\n\n let { selectedIndex } = this.state;\n if (event.key === SpecialKey.ArrowUp || event.key === SpecialKey.ArrowDown) {\n event.stopPropagation();\n if (selectedIndex === -1) {\n selectedIndex = 0;\n } else {\n if (event.key === SpecialKey.ArrowUp) {\n if (this.state.selectedIndex === 0)\n selectedIndex = this._length - 1;\n else\n selectedIndex--;\n }\n if (event.key === SpecialKey.ArrowDown) {\n if (this.state.selectedIndex === this._length - 1)\n selectedIndex = 0;\n else\n selectedIndex++;\n }\n }\n }\n this.setState({ selectedIndex });\n };\n\n public override componentDidUpdate(prevProps: ContextMenuProps) {\n if (prevProps.selectedIndex !== this.props.selectedIndex) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!prevProps.opened && this.props.opened) {\n this.setState((_, props) => ({ selectedIndex: props.selectedIndex! }));\n }\n if (!this.props.parentMenu) {\n // const direction = this.props.direction!;\n // if ((!this.props.opened && prevProps.opened && direction !== this.state.direction) || prevProps.direction !== direction)\n this.checkRenderDirection();\n }\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module ContextMenu
3
3
  */
4
4
  import * as React from "react";
5
- import { CommonProps } from "../utils/Props";
5
+ import type { CommonProps } from "../utils/Props";
6
6
  /**
7
7
  * Menu Divider for [[ContextMenu]]. Inserts a line between items, used for list item grouping.
8
8
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuDivider.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuDivider.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC;IACtD,MAAM,IAAI,GAAG,CAAC,OAAO;CAMtC"}
1
+ {"version":3,"file":"ContextMenuDivider.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuDivider.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC;IACtD,MAAM,IAAI,GAAG,CAAC,OAAO;CAMtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuDivider.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuDivider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AAGpC;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,KAAK,CAAC,aAA0B;IACtD,MAAM;QACpB,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3C,OAAO,CACL,gCAAS,KAAK,iBAAc,2BAA2B,EAAC,SAAS,EAAE,IAAA,oBAAU,EAAC,2BAA2B,EAAE,SAAS,CAAC,GAAI,CAC1H,CAAC;IACJ,CAAC;CACF;AAPD,gDAOC","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 { CommonProps } from \"../utils/Props\";\n\n/**\n * Menu Divider for [[ContextMenu]]. Inserts a line between items, used for list item grouping.\n * @public\n */\nexport class ContextMenuDivider extends React.PureComponent<CommonProps> {\n public override render(): JSX.Element {\n const { className, ...props } = this.props;\n return (\n <div {...props} data-testid=\"core-context-menu-divider\" className={classnames(\"core-context-menu-divider\", className)} />\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ContextMenuDivider.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuDivider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AAGpC;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,KAAK,CAAC,aAA0B;IACtD,MAAM;QACpB,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3C,OAAO,CACL,gCAAS,KAAK,iBAAc,2BAA2B,EAAC,SAAS,EAAE,IAAA,oBAAU,EAAC,2BAA2B,EAAE,SAAS,CAAC,GAAI,CAC1H,CAAC;IACJ,CAAC;CACF;AAPD,gDAOC","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 type { CommonProps } from \"../utils/Props\";\n\n/**\n * Menu Divider for [[ContextMenu]]. Inserts a line between items, used for list item grouping.\n * @public\n */\nexport class ContextMenuDivider extends React.PureComponent<CommonProps> {\n public override render(): JSX.Element {\n const { className, ...props } = this.props;\n return (\n <div {...props} data-testid=\"core-context-menu-divider\" className={classnames(\"core-context-menu-divider\", className)} />\n );\n }\n}\n"]}
@@ -2,10 +2,11 @@
2
2
  * @module ContextMenu
3
3
  */
4
4
  import * as React from "react";
5
- import { BadgeType, ConditionalBooleanValue } from "@itwin/appui-abstract";
6
- import { CommonProps } from "../utils/Props";
7
- import { ContextMenu } from "./ContextMenu";
8
- import { IconSpec } from "../icons/IconComponent";
5
+ import type { BadgeType } from "@itwin/appui-abstract";
6
+ import { ConditionalBooleanValue } from "@itwin/appui-abstract";
7
+ import type { CommonProps } from "../utils/Props";
8
+ import type { ContextMenu } from "./ContextMenu";
9
+ import type { IconSpec } from "../icons/IconComponent";
9
10
  /** Properties for the [[ContextMenuItem]] component
10
11
  * @public
11
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuItem.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuItem.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAc,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAQ,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC,EAAE,WAAW;IAC7H,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/B,gBAAgB;IAChB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,0CAA0C;IAC1C,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC7C,kGAAkG;IAClG,MAAM,CAAC,EAAE,O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AAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEe,kBAAkB,CAAC,SAA+B;QAChE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAAE;YAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACzC;IACH,CAAC;;AAxED,gBAAgB;AACF,4BAAY,GAAkC;IAC1D,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;CAClB,AAJyB,CAIxB;AATS,0CAAe","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 { BadgeType, ConditionalBooleanValue, SpecialKey } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"../utils/Props\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport { Icon, IconSpec } from \"../icons/IconComponent\";\n\n/** Properties for the [[ContextMenuItem]] component\n * @public\n */\nexport interface ContextMenuItemProps extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"disabled\" | \"hidden\">, CommonProps {\n onSelect?: (event: any) => any;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n /** Icon to display in the left margin. */\n icon?: IconSpec;\n /** Disables any onSelect calls, hover/keyboard highlighting, and grays item. */\n disabled?: boolean | ConditionalBooleanValue;\n /** Indicates whether the item is visible or hidden. The default is for the item to be visible. */\n hidden?: boolean | ConditionalBooleanValue;\n /** Badge to be overlaid on the item. */\n badgeType?: BadgeType;\n /** Icon to display in the right margin. */\n iconRight?: IconSpec;\n /** Hide the icon container. This can be used to eliminate space used to display an icon at the left of the menu item. */\n hideIconContainer?: boolean;\n /** @internal */\n onHover?: () => any;\n /* @internal */\n isSelected?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n}\n\n/** @internal */\ninterface ContextMenuItemState {\n hotKey?: string;\n}\n\n/**\n * Menu Item class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextMenuItem extends React.PureComponent<ContextMenuItemProps, ContextMenuItemState> {\n private _root: HTMLElement | null = null;\n private _lastChildren: React.ReactNode;\n private _parsedChildren: React.ReactNode;\n /** @internal */\n public static defaultProps: Partial<ContextMenuItemProps> = {\n disabled: false,\n hidden: false,\n isSelected: false,\n };\n constructor(props: ContextMenuItemProps) {\n super(props);\n }\n /** @internal */\n public override readonly state: Readonly<ContextMenuItemState> = {};\n public override render(): JSX.Element {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onClick, className, style, onSelect, icon, disabled, hidden, onHover, isSelected, parentMenu, onHotKeyParsed, badgeType, iconRight,\n hideIconContainer, ...props } = this.props;\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastChildren !== this.props.children) {\n this._parsedChildren = TildeFinder.findAfterTilde(this.props.children).node;\n this._lastChildren = this.props.children;\n }\n\n return (\n <div\n {...props}\n ref={(el) => { this._root = el; }}\n onClick={this._handleClick}\n style={style}\n onFocus={this._handleFocus}\n onKeyUp={this._handleKeyUp}\n onMouseOver={this._handleMouseOver}\n data-testid={\"core-context-menu-item\"}\n className={classnames(\"core-context-menu-item\", className,\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\")\n }\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n >\n {!hideIconContainer && <div className=\"core-context-menu-icon\">\n {icon !== undefined && <Icon iconSpec={icon} />}\n </div>}\n <div className={\"core-context-menu-content\"}>\n {this._parsedChildren}\n </div>\n {iconRight &&\n <div className={classnames(\"core-context-menu-icon\", \"core-context-menu-icon-right\")}>\n <Icon iconSpec={iconRight} />\n </div>\n }\n {badge &&\n <div className=\"core-context-menu-badge\">\n {badge}\n </div>\n }\n </div>\n );\n }\n\n public override componentDidMount() {\n this._updateHotkey(this.props.children);\n }\n\n public override componentDidUpdate(prevProps: ContextMenuItemProps) {\n if (this.props.children !== prevProps.children) {\n this._updateHotkey(this.props.children);\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\n hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed)\n this.props.onHotKeyParsed(hotKey);\n }\n };\n\n private _handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (this._root && this._root.style.visibility !== \"hidden\" && this.props.onHover) {\n this.props.onHover();\n }\n };\n\n public select = () => {\n // istanbul ignore else\n if (this._root) {\n this._root.click();\n if (this.props.parentMenu && this.props.parentMenu.props.parentSubmenu)\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (isDisabled)\n return;\n\n if (this.props.onClick)\n this.props.onClick(event);\n if (this.props.onSelect)\n this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (event.key === SpecialKey.Enter && this.props.onSelect !== undefined && !isDisabled) {\n this.props.onSelect(event);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"ContextMenuItem.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenuItem.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AAEpC,0DAA4E;AAG5E,4DAAyD;AACzD,+CAA4C;AAE5C,0DAA8C;AAkC9C;;;GAGG;AACH,MAAa,eAAgB,SAAQ,KAAK,CAAC,aAAyD;IAUlG,YAAY,KAA2B;QACrC,KAAK,CAAC,KAAK,CAAC,CAAC;QAVP,UAAK,GAAuB,IAAI,CAAC;QAYzC,gBAAgB;QACS,UAAK,GAAmC,EAAE,CAAC;QAgE5D,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;;gBAEpD,MAAM,GAAG,SAAS,CAAC;YACrB,IAAI,MAAM,IAAI,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC1B,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc;oBAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;aACrC;QACH,CAAC,CAAC;QAEM,iBAAY,GAAG,CAAC,KAAuC,EAAE,EAAE;YACjE,KAAK,CAAC,eAAe,EAAE,CAAC;Q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,SAAS,EAAE,IAAA,oBAAU,EAAC,wBAAwB,EAAE,SAAS,EACvD,UAAU,IAAI,4BAA4B,EAC1C,QAAQ,IAAI,0BAA0B,EACtC,UAAU,IAAI,+BAA+B,CAAC,EAEhD,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mBACd,UAAU,iBACZ,QAAQ;YAEpB,CAAC,iBAAiB,IAAI,6BAAK,SAAS,EAAC,wBAAwB,IAC3D,IAAI,KAAK,SAAS,IAAI,oBAAC,oBAAI,IAAC,QAAQ,EAAE,IAAI,GAAI,CAC3C;YACN,6BAAK,SAAS,EAAE,2BAA2B,IACxC,IAAI,CAAC,eAAe,CACjB;YACL,SAAS;gBACR,6BAAK,SAAS,EAAE,IAAA,oBAAU,EAAC,wBAAwB,EAAE,8BAA8B,CAAC;oBAClF,oBAAC,oBAAI,IAAC,QAAQ,EAAE,SAAS,GAAI,CACzB;YAEP,KAAK;gBACJ,6BAAK,SAAS,EAAC,yBAAyB,IACrC,KAAK,CACF,CAEJ,CACP,CAAC;IACJ,CAAC;IAEe,iBAAiB;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEe,kBAAkB,CAAC,SAA+B;QAChE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAAE;YAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACzC;IACH,CAAC;;AAxED,gBAAgB;AACF,4BAAY,GAAkC;IAC1D,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;CAClB,AAJyB,CAIxB;AATS,0CAAe","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 type { BadgeType} from \"@itwin/appui-abstract\";\nimport { ConditionalBooleanValue, SpecialKey } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport type { ContextMenu } from \"./ContextMenu\";\nimport { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport type { IconSpec } from \"../icons/IconComponent\";\nimport { Icon } from \"../icons/IconComponent\";\n\n/** Properties for the [[ContextMenuItem]] component\n * @public\n */\nexport interface ContextMenuItemProps extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"disabled\" | \"hidden\">, CommonProps {\n onSelect?: (event: any) => any;\n /** @internal */\n onHotKeyParsed?: (hotKey: string) => void;\n /** Icon to display in the left margin. */\n icon?: IconSpec;\n /** Disables any onSelect calls, hover/keyboard highlighting, and grays item. */\n disabled?: boolean | ConditionalBooleanValue;\n /** Indicates whether the item is visible or hidden. The default is for the item to be visible. */\n hidden?: boolean | ConditionalBooleanValue;\n /** Badge to be overlaid on the item. */\n badgeType?: BadgeType;\n /** Icon to display in the right margin. */\n iconRight?: IconSpec;\n /** Hide the icon container. This can be used to eliminate space used to display an icon at the left of the menu item. */\n hideIconContainer?: boolean;\n /** @internal */\n onHover?: () => any;\n /* @internal */\n isSelected?: boolean;\n /** @internal */\n parentMenu?: ContextMenu;\n}\n\n/** @internal */\ninterface ContextMenuItemState {\n hotKey?: string;\n}\n\n/**\n * Menu Item class for use within a [[ContextMenu]] component.\n * @public\n */\nexport class ContextMenuItem extends React.PureComponent<ContextMenuItemProps, ContextMenuItemState> {\n private _root: HTMLElement | null = null;\n private _lastChildren: React.ReactNode;\n private _parsedChildren: React.ReactNode;\n /** @internal */\n public static defaultProps: Partial<ContextMenuItemProps> = {\n disabled: false,\n hidden: false,\n isSelected: false,\n };\n constructor(props: ContextMenuItemProps) {\n super(props);\n }\n /** @internal */\n public override readonly state: Readonly<ContextMenuItemState> = {};\n public override render(): JSX.Element {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onClick, className, style, onSelect, icon, disabled, hidden, onHover, isSelected, parentMenu, onHotKeyParsed, badgeType, iconRight,\n hideIconContainer, ...props } = this.props;\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\n const isDisabled = ConditionalBooleanValue.getValue(disabled);\n const isHidden = ConditionalBooleanValue.getValue(hidden);\n\n if (this._lastChildren !== this.props.children) {\n this._parsedChildren = TildeFinder.findAfterTilde(this.props.children).node;\n this._lastChildren = this.props.children;\n }\n\n return (\n <div\n {...props}\n ref={(el) => { this._root = el; }}\n onClick={this._handleClick}\n style={style}\n onFocus={this._handleFocus}\n onKeyUp={this._handleKeyUp}\n onMouseOver={this._handleMouseOver}\n data-testid={\"core-context-menu-item\"}\n className={classnames(\"core-context-menu-item\", className,\n isDisabled && \"core-context-menu-disabled\",\n isHidden && \"core-context-menu-hidden\",\n isSelected && \"core-context-menu-is-selected\")\n }\n role=\"menuitem\"\n tabIndex={isSelected ? 0 : -1}\n aria-disabled={isDisabled}\n aria-hidden={isHidden}\n >\n {!hideIconContainer && <div className=\"core-context-menu-icon\">\n {icon !== undefined && <Icon iconSpec={icon} />}\n </div>}\n <div className={\"core-context-menu-content\"}>\n {this._parsedChildren}\n </div>\n {iconRight &&\n <div className={classnames(\"core-context-menu-icon\", \"core-context-menu-icon-right\")}>\n <Icon iconSpec={iconRight} />\n </div>\n }\n {badge &&\n <div className=\"core-context-menu-badge\">\n {badge}\n </div>\n }\n </div>\n );\n }\n\n public override componentDidMount() {\n this._updateHotkey(this.props.children);\n }\n\n public override componentDidUpdate(prevProps: ContextMenuItemProps) {\n if (this.props.children !== prevProps.children) {\n this._updateHotkey(this.props.children);\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\n hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed)\n this.props.onHotKeyParsed(hotKey);\n }\n };\n\n private _handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n event.stopPropagation();\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (this._root && this._root.style.visibility !== \"hidden\" && this.props.onHover) {\n this.props.onHover();\n }\n };\n\n public select = () => {\n // istanbul ignore else\n if (this._root) {\n this._root.click();\n if (this.props.parentMenu && this.props.parentMenu.props.parentSubmenu)\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (isDisabled)\n return;\n\n if (this.props.onClick)\n this.props.onClick(event);\n if (this.props.onSelect)\n this.props.onSelect(event);\n };\n\n private _handleKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const isDisabled = ConditionalBooleanValue.getValue(this.props.disabled);\n if (event.key === SpecialKey.Enter && this.props.onSelect !== undefined && !isDisabled) {\n this.props.onSelect(event);\n }\n };\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * @module ContextMenu
3
3
  */
4
4
  import * as React from "react";
5
- import { ContextMenuItemProps } from "./ContextMenuItem";
6
- import { ContextMenuProps } from "./ContextMenu";
7
- import { CommonProps } from "../utils/Props";
5
+ import type { ContextMenuItemProps } from "./ContextMenuItem";
6
+ import type { ContextMenuProps } from "./ContextMenu";
7
+ import type { CommonProps } from "../utils/Props";
8
8
  import { ContextMenuDirection } from "./ContextMenuDirection";
9
9
  /** Properties for the [[ContextSubMenu]] component
10
10
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"ContextSubMenu.d.ts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AM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACtC,IAAI,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QAC3C,uBAAuB;QACvB,IAAI,YAAY,IAAI,QAAQ,IAAI,IAAI,CAAC,YAAY,EAAE;YACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC7C,eAAe,GAAG,yBAAW,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,EAAE,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;YACrH,uBAAuB;YACvB,IAAI,eAAe,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;gBAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;SACjD;IACH,CAAC;;AAtHa,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;AAfS,wCAAc","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 { ContextMenuItemProps } from \"./ContextMenuItem\";\nimport { ContextMenu, ContextMenuProps } from \"./ContextMenu\";\nimport { CommonProps } from \"../utils/Props\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\nimport { TildeFinder } from \"./TildeFinder\";\nimport { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { SvgCaretRight } from \"@itwin/itwinui-icons-react\";\n\n/** Properties for the [[ContextSubMenu]] component\n * @public\n */\nexport interface ContextSubMenuProps extends Omit<ContextMenuItemProps, \"label\">, Omit<ContextMenuProps, \"label\">, CommonProps {\n /** Text/jsx to display in the list item */\n label: string | JSX.Element;\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<ContextSubMenuProps, ContextSubMenuState> {\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(): JSX.Element {\n const {\n label,\n opened, direction, onOutsideClick, onEsc, autoflip, edgeLimit, selectedIndex, floating, parentMenu, parentSubmenu, // eslint-disable-line @typescript-eslint/no-unused-vars\n onSelect, icon, disabled, hidden, onHover, isSelected, onHotKeyParsed, // eslint-disable-line @typescript-eslint/no-unused-vars\n children, onClick, className, badgeType, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n const contextMenuProps = { onOutsideClick, onSelect, onEsc, autoflip, edgeLimit, selectedIndex, floating, parentMenu };\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\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 // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events\n <div className={classnames(\"core-context-submenu\", ContextMenu.getCSSClassNameFromDirection(renderDirection), className)}\n onMouseOver={this._handleMouseOver}\n ref={(el) => { this._subMenuElement = el; }}\n data-testid=\"core-context-submenu\"\n {...props} >\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n onClick={this._handleClick}\n ref={(el) => { this._menuButtonElement = el; }}\n className={classnames(\"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 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\")}><Icon iconSpec={<SvgCaretRight />} /></div>\n {badge &&\n <div className=\"core-context-menu-badge\">\n {badge}\n </div>\n }\n </div>\n <ContextMenu\n ref={(el) => { this._menuElement = el; }}\n className=\"core-context-submenu-popup\"\n opened={this.state.opened}\n direction={renderDirection}\n parentSubmenu={this}\n {...contextMenuProps} >\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(prevProps: ContextSubMenuProps, prevState: ContextSubMenuState) {\n const direction = this.props.direction!;\n if ((this.state.opened !== prevState.opened && direction !== this.state.direction) || prevProps.direction !== direction)\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(renderDirection, menuRect, parentWindow.innerWidth, parentWindow.innerHeight);\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\n hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed)\n this.props.onHotKeyParsed(hotKey);\n }\n };\n\n public select = () => {\n this.setState({ opened: true }, () => {\n // istanbul ignore else\n if (this._menuElement)\n this._menuElement.focus();\n if (this.props.onSelect !== undefined)\n 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)\n this._menuElement.blur();\n });\n // istanbul ignore next\n if (propagate && this.props.parentMenu && this.props.parentMenu.props.parentSubmenu) {\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (this._menuButtonElement && this._menuButtonElement.style.visibility !== \"hidden\" && this.props.onHover) {\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)\n this.props.onClick(event);\n // istanbul ignore next\n if (this.props.opened)\n this.close();\n else\n 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;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,2CAAoC;AACpC,0DAAgE;AAGhE,+CAA4C;AAE5C,iEAA8D;AAC9D,+CAA4C;AAC5C,4DAAyD;AACzD,0DAA8C;AAC9C,oEAA2D;AAmB3D;;;GAGG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,SAAmD;IAmB3F,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAnBP,iBAAY,GAAuB,IAAI,CAAC;QACxC,oBAAe,GAAuB,IAAI,CAAC;QAC3C,uBAAkB,GAAuB,IAAI,CAAC;QA6H9C,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;;gBAEpD,MAAM,GAAG,SAAS,CAAC;YACrB,IAAI,MAAM,IAAI,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBAC1C,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC1B,IAAI,IAAI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AiC;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;AAfS,wCAAc","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 { BadgeUtilities } from \"../badge/BadgeUtilities\";\nimport { Icon } from \"../icons/IconComponent\";\nimport { SvgCaretRight } from \"@itwin/itwinui-icons-react\";\n\n/** Properties for the [[ContextSubMenu]] component\n * @public\n */\nexport interface ContextSubMenuProps extends Omit<ContextMenuItemProps, \"label\">, Omit<ContextMenuProps, \"label\">, CommonProps {\n /** Text/jsx to display in the list item */\n label: string | JSX.Element;\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<ContextSubMenuProps, ContextSubMenuState> {\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(): JSX.Element {\n const {\n label,\n opened, direction, onOutsideClick, onEsc, autoflip, edgeLimit, selectedIndex, floating, parentMenu, parentSubmenu, // eslint-disable-line @typescript-eslint/no-unused-vars\n onSelect, icon, disabled, hidden, onHover, isSelected, onHotKeyParsed, // eslint-disable-line @typescript-eslint/no-unused-vars\n children, onClick, className, badgeType, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n const contextMenuProps = { onOutsideClick, onSelect, onEsc, autoflip, edgeLimit, selectedIndex, floating, parentMenu };\n const badge = BadgeUtilities.getComponentForBadgeType(badgeType);\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 // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events\n <div className={classnames(\"core-context-submenu\", ContextMenu.getCSSClassNameFromDirection(renderDirection), className)}\n onMouseOver={this._handleMouseOver}\n ref={(el) => { this._subMenuElement = el; }}\n data-testid=\"core-context-submenu\"\n {...props} >\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}\n <div\n onClick={this._handleClick}\n ref={(el) => { this._menuButtonElement = el; }}\n className={classnames(\"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 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\")}><Icon iconSpec={<SvgCaretRight />} /></div>\n {badge &&\n <div className=\"core-context-menu-badge\">\n {badge}\n </div>\n }\n </div>\n <ContextMenu\n ref={(el) => { this._menuElement = el; }}\n className=\"core-context-submenu-popup\"\n opened={this.state.opened}\n direction={renderDirection}\n parentSubmenu={this}\n {...contextMenuProps} >\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(prevProps: ContextSubMenuProps, prevState: ContextSubMenuState) {\n const direction = this.props.direction!;\n if ((this.state.opened !== prevState.opened && direction !== this.state.direction) || prevProps.direction !== direction)\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(renderDirection, menuRect, parentWindow.innerWidth, parentWindow.innerHeight);\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\n hotKey = undefined;\n if (hotKey && hotKey !== this.state.hotKey) {\n this.setState({ hotKey });\n if (this.props.onHotKeyParsed)\n this.props.onHotKeyParsed(hotKey);\n }\n };\n\n public select = () => {\n this.setState({ opened: true }, () => {\n // istanbul ignore else\n if (this._menuElement)\n this._menuElement.focus();\n if (this.props.onSelect !== undefined)\n 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)\n this._menuElement.blur();\n });\n // istanbul ignore next\n if (propagate && this.props.parentMenu && this.props.parentMenu.props.parentSubmenu) {\n this.props.parentMenu.props.parentSubmenu.close(true);\n }\n };\n\n private _handleMouseOver = (_event: React.MouseEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (this._menuButtonElement && this._menuButtonElement.style.visibility !== \"hidden\" && this.props.onHover) {\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)\n this.props.onClick(event);\n // istanbul ignore next\n if (this.props.opened)\n this.close();\n else\n 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"]}
@@ -2,7 +2,7 @@
2
2
  * @module ContextMenu
3
3
  */
4
4
  import * as React from "react";
5
- import { ContextMenuProps } from "./ContextMenu";
5
+ import type { ContextMenuProps } from "./ContextMenu";
6
6
  /** Properties for the [[GlobalContextMenu]] component
7
7
  * @public
8
8
  */
@@ -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,O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AAa,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,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IACxG,OAAO,CAAC,UAAU,CAAC,CAAiB;IAEpC,SAAyB,KAAK,EAAE,sBAAsB,CAEpD;gBAEU,KAAK,EAAE,sBAAsB;IAIzB,oBAAoB;IAOpC,OAAO,CAAC,aAAa,CAiBnB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;CAuB1C"}
@@ -21,7 +21,8 @@ class GlobalContextMenu extends React.PureComponent {
21
21
  parentDocument: null,
22
22
  };
23
23
  this._handleRefSet = (popupDiv) => {
24
- const parentDocument = popupDiv?.ownerDocument ?? null;
24
+ var _a, _b;
25
+ const parentDocument = (_a = popupDiv === null || popupDiv === void 0 ? void 0 : popupDiv.ownerDocument) !== null && _a !== void 0 ? _a : null;
25
26
  if (parentDocument) {
26
27
  this._container = parentDocument.createElement("div");
27
28
  this._container.id = this.props.identifier !== undefined ? `dialog-${this.props.identifier}` : "core-global-context-menu";
@@ -30,7 +31,7 @@ class GlobalContextMenu extends React.PureComponent {
30
31
  rt = parentDocument.createElement("div");
31
32
  rt.id = "core-global-context-menu-root";
32
33
  // istanbul ignore next
33
- (parentDocument.body.querySelector('[data-root-container="iui-root-id"]') ?? parentDocument.body).appendChild(rt);
34
+ ((_b = parentDocument.body.querySelector('[data-root-container="iui-root-id"]')) !== null && _b !== void 0 ? _b : parentDocument.body).appendChild(rt);
34
35
  }
35
36
  rt.appendChild(this._container);
36
37
  // used to support component rendering in pop-out window
@@ -45,6 +46,7 @@ class GlobalContextMenu extends React.PureComponent {
45
46
  }
46
47
  }
47
48
  render() {
49
+ var _a;
48
50
  const { x, y, identifier, contextMenuComponent, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars
49
51
  const positioningStyle = {
50
52
  left: x,
@@ -55,7 +57,7 @@ class GlobalContextMenu extends React.PureComponent {
55
57
  ReactDOM.createPortal(React.createElement("div", { className: "core-context-menu-global", style: positioningStyle },
56
58
  React.createElement(CtxMenu, { ...props })),
57
59
  // istanbul ignore next
58
- this.state.parentDocument.body.querySelector('[data-root-container="iui-root-id"]') ?? this.state.parentDocument.body)));
60
+ (_a = this.state.parentDocument.body.querySelector('[data-root-container="iui-root-id"]')) !== null && _a !== void 0 ? _a : this.state.parentDocument.body)));
59
61
  }
60
62
  }
61
63
  exports.GlobalContextMenu = GlobalContextMenu;
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/GlobalContextMenu.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,sCAAsC;AACtC,+CAA8D;AAqB9D;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK,CAAC,aAA6D;IAOxG,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;gBAClB,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC;gBAC1H,IAAI,EAAE,GAAG,cAAc,CAAC,cAAc,CAAC,+BAA+B,CAAmB,CAAC;gBAC1F,IAAI,CAAC,EAAE,EA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YACvB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,qCAAqC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAEtH,CACP,CAAC;IACJ,CAAC;CACF;AA5DD,8CA4DC","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 { ContextMenu, ContextMenuProps } 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<GlobalContextMenuProps, GlobalContextMenuState> {\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) { // 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 = this.props.identifier !== undefined ? `dialog-${this.props.identifier}` : \"core-global-context-menu\";\n let rt = parentDocument.getElementById(\"core-global-context-menu-root\") as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-global-context-menu-root\";\n // istanbul ignore next\n (parentDocument.body.querySelector('[data-root-container=\"iui-root-id\"]') ?? 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 render(): React.ReactNode {\n const { x, y, identifier, contextMenuComponent, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n const positioningStyle: React.CSSProperties = {\n left: x,\n top: y,\n };\n\n const CtxMenu = contextMenuComponent || ContextMenu; // eslint-disable-line @typescript-eslint/naming-convention\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\n {...props} />\n </div >,\n // istanbul ignore next\n this.state.parentDocument.body.querySelector('[data-root-container=\"iui-root-id\"]') ?? 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;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,sCAAsC;AAEtC,+CAA4C;AAqB5C;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK,CAAC,aAA6D;IAOxG,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,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,mCAAI,IAAI,CAAC;YACvD,IAAI,cAAc,EAAE;gBAClB,IAAI,CAAC,UAAU,GA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AO,GAAG,oBAAoB,IAAI,yBAAW,CAAC,CAAC,2DAA2D;QAEhH,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,OACF,KAAK,GAAI,CACV;YACP,uBAAuB;YACvB,MAAA,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,qCAAqC,CAAC,mCAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAEtH,CACP,CAAC;IACJ,CAAC;CACF;AA5DD,8CA4DC","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<GlobalContextMenuProps, GlobalContextMenuState> {\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) { // 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 = this.props.identifier !== undefined ? `dialog-${this.props.identifier}` : \"core-global-context-menu\";\n let rt = parentDocument.getElementById(\"core-global-context-menu-root\") as HTMLDivElement;\n if (!rt) {\n rt = parentDocument.createElement(\"div\");\n rt.id = \"core-global-context-menu-root\";\n // istanbul ignore next\n (parentDocument.body.querySelector('[data-root-container=\"iui-root-id\"]') ?? 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 render(): React.ReactNode {\n const { x, y, identifier, contextMenuComponent, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n const positioningStyle: React.CSSProperties = {\n left: x,\n top: y,\n };\n\n const CtxMenu = contextMenuComponent || ContextMenu; // eslint-disable-line @typescript-eslint/naming-convention\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\n {...props} />\n </div >,\n // istanbul ignore next\n this.state.parentDocument.body.querySelector('[data-root-container=\"iui-root-id\"]') ?? this.state.parentDocument.body)\n }\n </div>\n );\n }\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as React from "react";
5
5
  import { RelativePosition } from "@itwin/appui-abstract";
6
- import { CommonProps } from "../utils/Props";
6
+ import type { CommonProps } from "../utils/Props";
7
7
  /** Properties for [[PopupContextMenu]] component
8
8
  * @public
9
9
  */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cesContent":["/*---------------------------------------------------------------------------------------------\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 { Popup } from \"../popup/Popup\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"../utils/Props\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\n\n/** Properties for [[PopupContextMenu]] component\n * @public\n */\nexport interface PopupContextMenuProps extends CommonProps {\n /** Indicates whether the popup is shown or not (defaults to false) */\n isOpen: boolean;\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\n position?: RelativePosition;\n /** Target element to position popup */\n target?: HTMLElement | null;\n /** Function called when the popup is opened */\n onOpen?: () => void;\n /** Function called when user clicks outside the popup */\n onOutsideClick?: (e: MouseEvent) => void;\n /** Function called when the popup is closed */\n onClose?: () => void;\n /** Function called when the popup is closed on Enter */\n onEnter?: () => void;\n /** Top position (absolute positioning - defaults to 0) */\n top?: number;\n /** Left position (absolute positioning - defaults to 0) */\n left?: number;\n /** Offset from the parent (defaults to 4) */\n offset?: number;\n /** accessibility label */\n ariaLabel?: string;\n /** Indicates whether to use animation for open/close (defaults to true) */\n animate?: boolean;\n\n /** When list item or submenu is selected */\n onSelect?: (event: React.MouseEvent | undefined) => void;\n /** when Escape button is pressed */\n onEsc?: (event: React.KeyboardEvent) => void;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n\n /** ContextMenu items */\n children?: React.ReactNode;\n}\n\n/** Component that displays a ContextMenu within a Popup component, allowing the target element to be specified.\n * @public\n */\nexport function PopupContextMenu(props: PopupContextMenuProps) {\n const { style, onSelect, onEsc, autoflip, edgeLimit, hotkeySelect, selectedIndex, children, ...popupProps } = props;\n const menuDirection = getContextMenuDirectionFromRelativePosition(popupProps.position);\n return (\n <Popup {...popupProps} closeOnNestedPopupOutsideClick\n showShadow={false} showArrow={false} moveFocus={true}\n style={{ ...style, border: \"none\" }}>\n <ContextMenu\n opened={true} onSelect={onSelect} onEsc={onEsc}\n autoflip={autoflip} edgeLimit={edgeLimit}\n hotkeySelect={hotkeySelect} selectedIndex={selectedIndex}\n direction={menuDirection}\n >\n {children}\n </ContextMenu>\n </Popup >\n );\n}\n\nfunction getContextMenuDirectionFromRelativePosition(relativePosition?: RelativePosition): ContextMenuDirection {\n let menuDirection = ContextMenuDirection.Bottom;\n switch (relativePosition) {\n case RelativePosition.Top:\n menuDirection = ContextMenuDirection.Top;\n break;\n case RelativePosition.TopLeft:\n menuDirection = ContextMenuDirection.TopRight;\n break;\n case RelativePosition.TopRight:\n menuDirection = ContextMenuDirection.TopLeft;\n break;\n case RelativePosition.Left:\n menuDirection = ContextMenuDirection.Left;\n break;\n case RelativePosition.Right:\n menuDirection = ContextMenuDirection.Right;\n break;\n case RelativePosition.Bottom:\n menuDirection = ContextMenuDirection.Bottom;\n break;\n case RelativePosition.BottomLeft:\n menuDirection = ContextMenuDirection.BottomRight;\n break;\n case RelativePosition.BottomRight:\n menuDirection = ContextMenuDirection.BottomLeft;\n break;\n }\n return menuDirection;\n}\n"]}
1
+ {"version":3,"file":"PopupContextMenu.js","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/PopupContextMenu.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,0CAAuC;AACvC,+CAA4C;AAC5C,0DAAyD;AAEzD,iEAA8D;AAgD9D;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAA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;YAC1B,aAAa,GAAG,2CAAoB,CAAC,MAAM,CAAC;YAC5C,MAAM;QACR,KAAK,iCAAgB,CAAC,UAAU;YAC9B,aAAa,GAAG,2CAAoB,CAAC,WAAW,CAAC;YACjD,MAAM;QACR,KAAK,iCAAgB,CAAC,WAAW;YAC/B,aAAa,GAAG,2CAAoB,CAAC,UAAU,CAAC;YAChD,MAAM;KACT;IACD,OAAO,aAAa,CAAC;AACvB,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 ContextMenu\n */\n\nimport * as React from \"react\";\nimport { Popup } from \"../popup/Popup\";\nimport { ContextMenu } from \"./ContextMenu\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"../utils/Props\";\nimport { ContextMenuDirection } from \"./ContextMenuDirection\";\n\n/** Properties for [[PopupContextMenu]] component\n * @public\n */\nexport interface PopupContextMenuProps extends CommonProps {\n /** Indicates whether the popup is shown or not (defaults to false) */\n isOpen: boolean;\n /** Direction (relative to the target) to which the popup is expanded (defaults to Bottom) */\n position?: RelativePosition;\n /** Target element to position popup */\n target?: HTMLElement | null;\n /** Function called when the popup is opened */\n onOpen?: () => void;\n /** Function called when user clicks outside the popup */\n onOutsideClick?: (e: MouseEvent) => void;\n /** Function called when the popup is closed */\n onClose?: () => void;\n /** Function called when the popup is closed on Enter */\n onEnter?: () => void;\n /** Top position (absolute positioning - defaults to 0) */\n top?: number;\n /** Left position (absolute positioning - defaults to 0) */\n left?: number;\n /** Offset from the parent (defaults to 4) */\n offset?: number;\n /** accessibility label */\n ariaLabel?: string;\n /** Indicates whether to use animation for open/close (defaults to true) */\n animate?: boolean;\n\n /** When list item or submenu is selected */\n onSelect?: (event: React.MouseEvent | undefined) => void;\n /** when Escape button is pressed */\n onEsc?: (event: React.KeyboardEvent) => void;\n /** Whether menu flips directions based on screen edge. Default: true */\n autoflip?: boolean;\n /** Whether menu hugs screen edge when autoflip is off. Default: true */\n edgeLimit?: boolean;\n /** Whether Hotkey press selects item, or just highlights item. Default: true */\n hotkeySelect?: boolean;\n /** starting menu item selected index Default: -1 */\n selectedIndex?: number;\n\n /** ContextMenu items */\n children?: React.ReactNode;\n}\n\n/** Component that displays a ContextMenu within a Popup component, allowing the target element to be specified.\n * @public\n */\nexport function PopupContextMenu(props: PopupContextMenuProps) {\n const { style, onSelect, onEsc, autoflip, edgeLimit, hotkeySelect, selectedIndex, children, ...popupProps } = props;\n const menuDirection = getContextMenuDirectionFromRelativePosition(popupProps.position);\n return (\n <Popup {...popupProps} closeOnNestedPopupOutsideClick\n showShadow={false} showArrow={false} moveFocus={true}\n style={{ ...style, border: \"none\" }}>\n <ContextMenu\n opened={true} onSelect={onSelect} onEsc={onEsc}\n autoflip={autoflip} edgeLimit={edgeLimit}\n hotkeySelect={hotkeySelect} selectedIndex={selectedIndex}\n direction={menuDirection}\n >\n {children}\n </ContextMenu>\n </Popup >\n );\n}\n\nfunction getContextMenuDirectionFromRelativePosition(relativePosition?: RelativePosition): ContextMenuDirection {\n let menuDirection = ContextMenuDirection.Bottom;\n switch (relativePosition) {\n case RelativePosition.Top:\n menuDirection = ContextMenuDirection.Top;\n break;\n case RelativePosition.TopLeft:\n menuDirection = ContextMenuDirection.TopRight;\n break;\n case RelativePosition.TopRight:\n menuDirection = ContextMenuDirection.TopLeft;\n break;\n case RelativePosition.Left:\n menuDirection = ContextMenuDirection.Left;\n break;\n case RelativePosition.Right:\n menuDirection = ContextMenuDirection.Right;\n break;\n case RelativePosition.Bottom:\n menuDirection = ContextMenuDirection.Bottom;\n break;\n case RelativePosition.BottomLeft:\n menuDirection = ContextMenuDirection.BottomRight;\n break;\n case RelativePosition.BottomRight:\n menuDirection = ContextMenuDirection.BottomLeft;\n break;\n }\n return menuDirection;\n}\n"]}
@@ -3,9 +3,9 @@
3
3
  */
4
4
  import "./Dialog.scss";
5
5
  import * as React from "react";
6
- import { DialogButtonDef } from "@itwin/appui-abstract";
7
- import { CommonProps } from "../utils/Props";
8
- import { Omit } from "../utils/typeUtils";
6
+ import type { DialogButtonDef } from "@itwin/appui-abstract";
7
+ import type { CommonProps } from "../utils/Props";
8
+ import type { Omit } from "../utils/typeUtils";
9
9
  /** Enum for dialog alignment
10
10
  * @public
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/core-react/dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,eAAe,CAAC;AAEvB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAgC,MAAM,uBAAuB,CAAC;AAGtF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAQ1C;;GAEG;AACH,oBAAY,eAAe;IACzB,OAAO,aAAa;IAAE,GAAG,QAAQ;IAAE,QAAQ,cAAc;IACzD,IAAI,SAAS;IAAE,MAAM,WAAW;IAAE,KAAK,UAAU;IACjD,UAAU,gBAAgB;IAAE,MAAM,WAAW;IAAE,WAAW,iBAAiB;CAC5E;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW;IACtG,8CAA8C;IAC9C,MAAM,EAAE,OAAO,CAAC;IAEhB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB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AAC,4BAA4B;IA4CpC,OAAO,CAAC,gBAAgB;IAkExB,OAAO,CAAC,YAAY,CAIlB;IAEF,OAAO,CAAC,2BAA2B,CAKjC;IAEF,OAAO,CAAC,uBAAuB,CAK7B;IAEF,OAAO,CAAC,sBAAsB,CAK5B;IAEF,OAAO,CAAC,2BAA2B,CAKjC;IAEF,OAAO,CAAC,gBAAgB,CAmBtB;IAEF,OAAO,CAAC,kBAAkB,CAwDxB;IAEF,OAAO,CAAC,gBAAgB,CAiBtB;CACH"}
@@ -188,8 +188,9 @@ class Dialog extends React.Component {
188
188
  };
189
189
  }
190
190
  getParentWindow() {
191
+ var _a;
191
192
  // istanbul ignore next
192
- return this._parentDocument.defaultView ?? window;
193
+ return (_a = this._parentDocument.defaultView) !== null && _a !== void 0 ? _a : window;
193
194
  }
194
195
  componentWillUnmount() {
195
196
  const parentWindow = this.getParentWindow();