@itwin/core-react 4.0.0-dev.2 → 4.0.0-dev.20

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 (448) hide show
  1. package/CHANGELOG.md +144 -7
  2. package/ContributeGuidelines.md +17 -14
  3. package/LICENSE.md +1 -1
  4. package/README.md +2 -2
  5. package/lib/cjs/core-react/UiCore.js +1 -1
  6. package/lib/cjs/core-react/UiCore.js.map +1 -1
  7. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts +2 -2
  8. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  9. package/lib/cjs/core-react/autosuggest/AutoSuggest.js +1 -1
  10. package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
  11. package/lib/cjs/core-react/autosuggest/AutoSuggest.scss +5 -8
  12. package/lib/cjs/core-react/badge/BetaBadge.d.ts +0 -1
  13. package/lib/cjs/core-react/badge/BetaBadge.d.ts.map +1 -1
  14. package/lib/cjs/core-react/badge/BetaBadge.js +0 -1
  15. package/lib/cjs/core-react/badge/BetaBadge.js.map +1 -1
  16. package/lib/cjs/core-react/badge/NewBadge.scss +1 -1
  17. package/lib/cjs/core-react/base/Gap.js +1 -1
  18. package/lib/cjs/core-react/base/Gap.js.map +1 -1
  19. package/lib/cjs/core-react/checklistbox/CheckListBox.scss +1 -2
  20. package/lib/cjs/core-react/classes.scss +0 -3
  21. package/lib/cjs/core-react/colorthemes.scss +5 -34
  22. package/lib/cjs/core-react/colorvariables.scss +53 -76
  23. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts +1 -1
  24. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  25. package/lib/cjs/core-react/contextmenu/ContextMenu.js +2 -3
  26. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  27. package/lib/cjs/core-react/contextmenu/ContextMenu.scss +12 -13
  28. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +1 -1
  29. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  30. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts +1 -1
  31. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  32. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +5 -2
  33. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  34. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  35. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +6 -4
  36. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  37. package/lib/cjs/core-react/contextmenu/TildeFinder.js +1 -1
  38. package/lib/cjs/core-react/contextmenu/TildeFinder.js.map +1 -1
  39. package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
  40. package/lib/cjs/core-react/dialog/Dialog.js +18 -10
  41. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  42. package/lib/cjs/core-react/dialog/Dialog.scss +23 -22
  43. package/lib/cjs/core-react/dialog/GlobalDialog.js +1 -2
  44. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  45. package/lib/cjs/core-react/elementseparator/ElementSeparator.js +2 -2
  46. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  47. package/lib/cjs/core-react/elementseparator/ElementSeparator.scss +1 -1
  48. package/lib/cjs/core-react/expandable/ExpandableList.js +1 -1
  49. package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
  50. package/lib/cjs/core-react/expandable/list.scss +5 -5
  51. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts +1 -1
  52. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  53. package/lib/cjs/core-react/hocs/withOnOutsideClick.js +1 -2
  54. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  55. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts +27 -0
  56. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts.map +1 -0
  57. package/lib/cjs/core-react/icons/ConditionalIconItem.js +65 -0
  58. package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -0
  59. package/lib/cjs/core-react/icons/IconComponent.d.ts +3 -2
  60. package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
  61. package/lib/cjs/core-react/icons/IconComponent.js +1 -7
  62. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  63. package/lib/cjs/core-react/icons/SvgPath.d.ts +1 -1
  64. package/lib/cjs/core-react/icons/SvgPath.d.ts.map +1 -1
  65. package/lib/cjs/core-react/icons/SvgPath.js +2 -2
  66. package/lib/cjs/core-react/icons/SvgPath.js.map +1 -1
  67. package/lib/cjs/core-react/icons/{SvgSprite.scss → SvgPath.scss} +1 -1
  68. package/lib/cjs/core-react/icons/WebFontIcon.d.ts +0 -1
  69. package/lib/cjs/core-react/icons/WebFontIcon.d.ts.map +1 -1
  70. package/lib/cjs/core-react/icons/WebFontIcon.js +0 -1
  71. package/lib/cjs/core-react/icons/WebFontIcon.js.map +1 -1
  72. package/lib/cjs/core-react/icons/variables.scss +0 -9
  73. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.scss +2 -2
  74. package/lib/cjs/core-react/index.scss +0 -2
  75. package/lib/cjs/core-react/inputs/InputLabel.d.ts.map +1 -1
  76. package/lib/cjs/core-react/inputs/InputLabel.js +9 -1
  77. package/lib/cjs/core-react/inputs/InputLabel.js.map +1 -1
  78. package/lib/cjs/core-react/inputs/input-label.scss +2 -2
  79. package/lib/cjs/core-react/inputs/input.scss +7 -7
  80. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +6 -1
  81. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  82. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +13 -8
  83. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  84. package/lib/cjs/core-react/inputs/numberinput/NumberInput.scss +12 -13
  85. package/lib/cjs/core-react/inputs/variables.scss +4 -4
  86. package/lib/cjs/core-react/listbox/Listbox.d.ts +1 -1
  87. package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
  88. package/lib/cjs/core-react/listbox/Listbox.js +2 -3
  89. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  90. package/lib/cjs/core-react/listbox/Listbox.scss +8 -8
  91. package/lib/cjs/core-react/loading/LoadingBar.js +1 -1
  92. package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
  93. package/lib/cjs/core-react/loading/LoadingPrompt.js +1 -1
  94. package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
  95. package/lib/cjs/core-react/loading/LoadingPrompt.scss +2 -2
  96. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts +1 -1
  97. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  98. package/lib/cjs/core-react/loading/LoadingSpinner.js +1 -1
  99. package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
  100. package/lib/cjs/core-react/loading/LoadingSpinner.scss +1 -1
  101. package/lib/cjs/core-react/loading/LoadingStatus.js +1 -1
  102. package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
  103. package/lib/cjs/core-react/messagebox/MessageBox.d.ts +13 -1
  104. package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
  105. package/lib/cjs/core-react/messagebox/MessageBox.js +55 -11
  106. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  107. package/lib/cjs/core-react/messagebox/MessageBox.scss +24 -14
  108. package/lib/cjs/core-react/notification/MessageRenderer.js +1 -1
  109. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  110. package/lib/cjs/core-react/notification/MessageType.d.ts +1 -1
  111. package/lib/cjs/core-react/notification/MessageType.d.ts.map +1 -1
  112. package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
  113. package/lib/cjs/core-react/popup/Popup.js +7 -8
  114. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  115. package/lib/cjs/core-react/popup/Popup.scss +5 -5
  116. package/lib/cjs/core-react/radialmenu/RadialMenu.js +1 -1
  117. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  118. package/lib/cjs/core-react/radialmenu/RadialMenu.scss +1 -1
  119. package/lib/cjs/core-react/searchbox/SearchBox.d.ts.map +1 -1
  120. package/lib/cjs/core-react/searchbox/SearchBox.js +8 -6
  121. package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
  122. package/lib/cjs/core-react/searchbox/SearchBox.scss +5 -9
  123. package/lib/cjs/core-react/settings/SettingsContainer.js +1 -1
  124. package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
  125. package/lib/cjs/core-react/settings/SettingsContainer.scss +3 -1
  126. package/lib/cjs/core-react/style/index.scss +0 -7
  127. package/lib/cjs/core-react/style/mixins.scss +2 -2
  128. package/lib/cjs/core-react/style/themecolors.scss +0 -6
  129. package/lib/cjs/core-react/tabs/tabs.scss +10 -20
  130. package/lib/cjs/core-react/tabs/vertical.scss +6 -13
  131. package/lib/cjs/core-react/text/BlockText.d.ts.map +1 -1
  132. package/lib/cjs/core-react/text/BlockText.js +1 -0
  133. package/lib/cjs/core-react/text/BlockText.js.map +1 -1
  134. package/lib/cjs/core-react/text/BodyText.d.ts +1 -0
  135. package/lib/cjs/core-react/text/BodyText.d.ts.map +1 -1
  136. package/lib/cjs/core-react/text/BodyText.js +2 -0
  137. package/lib/cjs/core-react/text/BodyText.js.map +1 -1
  138. package/lib/cjs/core-react/text/DisabledText.d.ts.map +1 -1
  139. package/lib/cjs/core-react/text/DisabledText.js +1 -0
  140. package/lib/cjs/core-react/text/DisabledText.js.map +1 -1
  141. package/lib/cjs/core-react/text/FilteredText.js +3 -3
  142. package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
  143. package/lib/cjs/core-react/text/MutedText.d.ts +1 -0
  144. package/lib/cjs/core-react/text/MutedText.d.ts.map +1 -1
  145. package/lib/cjs/core-react/text/MutedText.js +2 -0
  146. package/lib/cjs/core-react/text/MutedText.js.map +1 -1
  147. package/lib/cjs/core-react/text/StyledText.d.ts +1 -0
  148. package/lib/cjs/core-react/text/StyledText.d.ts.map +1 -1
  149. package/lib/cjs/core-react/text/StyledText.js +1 -0
  150. package/lib/cjs/core-react/text/StyledText.js.map +1 -1
  151. package/lib/cjs/core-react/text/block.scss +9 -4
  152. package/lib/cjs/core-react/text/body.scss +7 -4
  153. package/lib/cjs/core-react/text/mixins.scss +3 -3
  154. package/lib/cjs/core-react/tree/ExpansionToggle.d.ts.map +1 -1
  155. package/lib/cjs/core-react/tree/ExpansionToggle.js +3 -1
  156. package/lib/cjs/core-react/tree/ExpansionToggle.js.map +1 -1
  157. package/lib/cjs/core-react/tree/ExpansionToggle.scss +9 -5
  158. package/lib/cjs/core-react/tree/Node.d.ts +2 -2
  159. package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
  160. package/lib/cjs/core-react/tree/Node.js +2 -3
  161. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  162. package/lib/cjs/core-react/tree/Node.scss +3 -19
  163. package/lib/cjs/core-react/tree/Placeholder.scss +1 -4
  164. package/lib/cjs/core-react/utils/IconWebComponent.js +1 -1
  165. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  166. package/lib/cjs/core-react/utils/Point.js +4 -4
  167. package/lib/cjs/core-react/utils/Point.js.map +1 -1
  168. package/lib/cjs/core-react/utils/Props.d.ts +1 -1
  169. package/lib/cjs/core-react/utils/Props.d.ts.map +1 -1
  170. package/lib/cjs/core-react/utils/Rectangle.js +7 -7
  171. package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
  172. package/lib/cjs/core-react/utils/Size.js +4 -4
  173. package/lib/cjs/core-react/utils/Size.js.map +1 -1
  174. package/lib/cjs/core-react/utils/Timer.d.ts +1 -1
  175. package/lib/cjs/core-react/utils/Timer.d.ts.map +1 -1
  176. package/lib/cjs/core-react/utils/getBestBWContrastColor.js +3 -3
  177. package/lib/cjs/core-react/utils/getBestBWContrastColor.js.map +1 -1
  178. package/lib/cjs/core-react/utils/getCssVariable.js +1 -1
  179. package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
  180. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +1 -1
  181. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  182. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
  183. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  184. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts +1 -1
  185. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
  186. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
  187. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js +2 -2
  188. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  189. package/lib/cjs/core-react/utils/hooks/useRefs.d.ts +1 -1
  190. package/lib/cjs/core-react/utils/hooks/useRefs.d.ts.map +1 -1
  191. package/lib/cjs/core-react/utils/hooks/useRefs.js.map +1 -1
  192. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +8 -13
  193. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  194. package/lib/cjs/core-react/utils/typeUtils.d.ts +1 -1
  195. package/lib/cjs/core-react/utils/typeUtils.d.ts.map +1 -1
  196. package/lib/cjs/core-react.d.ts +1 -1
  197. package/lib/cjs/core-react.d.ts.map +1 -1
  198. package/lib/cjs/core-react.js +6 -2
  199. package/lib/cjs/core-react.js.map +1 -1
  200. package/lib/esm/core-react/UiCore.js +2 -1
  201. package/lib/esm/core-react/UiCore.js.map +1 -1
  202. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts +2 -2
  203. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  204. package/lib/esm/core-react/autosuggest/AutoSuggest.js +1 -1
  205. package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
  206. package/lib/esm/core-react/autosuggest/AutoSuggest.scss +5 -8
  207. package/lib/esm/core-react/badge/BetaBadge.d.ts +0 -1
  208. package/lib/esm/core-react/badge/BetaBadge.d.ts.map +1 -1
  209. package/lib/esm/core-react/badge/BetaBadge.js +0 -1
  210. package/lib/esm/core-react/badge/BetaBadge.js.map +1 -1
  211. package/lib/esm/core-react/badge/NewBadge.scss +1 -1
  212. package/lib/esm/core-react/base/Gap.js +1 -1
  213. package/lib/esm/core-react/base/Gap.js.map +1 -1
  214. package/lib/esm/core-react/checklistbox/CheckListBox.scss +1 -2
  215. package/lib/esm/core-react/classes.scss +0 -3
  216. package/lib/esm/core-react/colorthemes.scss +5 -34
  217. package/lib/esm/core-react/colorvariables.scss +53 -76
  218. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts +1 -1
  219. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  220. package/lib/esm/core-react/contextmenu/ContextMenu.js +3 -3
  221. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  222. package/lib/esm/core-react/contextmenu/ContextMenu.scss +12 -13
  223. package/lib/esm/core-react/contextmenu/ContextMenuItem.js +2 -1
  224. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  225. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts +1 -1
  226. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  227. package/lib/esm/core-react/contextmenu/ContextSubMenu.js +6 -2
  228. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  229. package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  230. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +6 -4
  231. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  232. package/lib/esm/core-react/contextmenu/TildeFinder.js +2 -1
  233. package/lib/esm/core-react/contextmenu/TildeFinder.js.map +1 -1
  234. package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
  235. package/lib/esm/core-react/dialog/Dialog.js +19 -10
  236. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  237. package/lib/esm/core-react/dialog/Dialog.scss +23 -22
  238. package/lib/esm/core-react/dialog/GlobalDialog.js +1 -2
  239. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  240. package/lib/esm/core-react/elementseparator/ElementSeparator.js +2 -2
  241. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  242. package/lib/esm/core-react/elementseparator/ElementSeparator.scss +1 -1
  243. package/lib/esm/core-react/expandable/ExpandableList.js +2 -1
  244. package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
  245. package/lib/esm/core-react/expandable/list.scss +5 -5
  246. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts +1 -1
  247. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  248. package/lib/esm/core-react/hocs/withOnOutsideClick.js +1 -2
  249. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  250. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts +27 -0
  251. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts.map +1 -0
  252. package/lib/esm/core-react/icons/ConditionalIconItem.js +61 -0
  253. package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -0
  254. package/lib/esm/core-react/icons/IconComponent.d.ts +3 -2
  255. package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
  256. package/lib/esm/core-react/icons/IconComponent.js +1 -7
  257. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  258. package/lib/esm/core-react/icons/SvgPath.d.ts +1 -1
  259. package/lib/esm/core-react/icons/SvgPath.d.ts.map +1 -1
  260. package/lib/esm/core-react/icons/SvgPath.js +2 -2
  261. package/lib/esm/core-react/icons/SvgPath.js.map +1 -1
  262. package/lib/esm/core-react/icons/{SvgSprite.scss → SvgPath.scss} +1 -1
  263. package/lib/esm/core-react/icons/WebFontIcon.d.ts +0 -1
  264. package/lib/esm/core-react/icons/WebFontIcon.d.ts.map +1 -1
  265. package/lib/esm/core-react/icons/WebFontIcon.js +0 -1
  266. package/lib/esm/core-react/icons/WebFontIcon.js.map +1 -1
  267. package/lib/esm/core-react/icons/variables.scss +0 -9
  268. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.scss +2 -2
  269. package/lib/esm/core-react/index.scss +0 -2
  270. package/lib/esm/core-react/inputs/InputLabel.d.ts.map +1 -1
  271. package/lib/esm/core-react/inputs/InputLabel.js +9 -1
  272. package/lib/esm/core-react/inputs/InputLabel.js.map +1 -1
  273. package/lib/esm/core-react/inputs/input-label.scss +2 -2
  274. package/lib/esm/core-react/inputs/input.scss +7 -7
  275. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +6 -1
  276. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  277. package/lib/esm/core-react/inputs/numberinput/NumberInput.js +13 -8
  278. package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  279. package/lib/esm/core-react/inputs/numberinput/NumberInput.scss +12 -13
  280. package/lib/esm/core-react/inputs/variables.scss +4 -4
  281. package/lib/esm/core-react/listbox/Listbox.d.ts +1 -1
  282. package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
  283. package/lib/esm/core-react/listbox/Listbox.js +2 -3
  284. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  285. package/lib/esm/core-react/listbox/Listbox.scss +8 -8
  286. package/lib/esm/core-react/loading/LoadingBar.js +2 -1
  287. package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
  288. package/lib/esm/core-react/loading/LoadingPrompt.js +2 -1
  289. package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
  290. package/lib/esm/core-react/loading/LoadingPrompt.scss +2 -2
  291. package/lib/esm/core-react/loading/LoadingSpinner.d.ts +1 -1
  292. package/lib/esm/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  293. package/lib/esm/core-react/loading/LoadingSpinner.js +2 -1
  294. package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
  295. package/lib/esm/core-react/loading/LoadingSpinner.scss +1 -1
  296. package/lib/esm/core-react/loading/LoadingStatus.js +2 -1
  297. package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
  298. package/lib/esm/core-react/messagebox/MessageBox.d.ts +13 -1
  299. package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
  300. package/lib/esm/core-react/messagebox/MessageBox.js +56 -11
  301. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  302. package/lib/esm/core-react/messagebox/MessageBox.scss +24 -14
  303. package/lib/esm/core-react/notification/MessageRenderer.js +1 -1
  304. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  305. package/lib/esm/core-react/notification/MessageType.d.ts +1 -1
  306. package/lib/esm/core-react/notification/MessageType.d.ts.map +1 -1
  307. package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
  308. package/lib/esm/core-react/popup/Popup.js +8 -8
  309. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  310. package/lib/esm/core-react/popup/Popup.scss +5 -5
  311. package/lib/esm/core-react/radialmenu/RadialMenu.js +2 -1
  312. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  313. package/lib/esm/core-react/radialmenu/RadialMenu.scss +1 -1
  314. package/lib/esm/core-react/searchbox/SearchBox.d.ts.map +1 -1
  315. package/lib/esm/core-react/searchbox/SearchBox.js +8 -6
  316. package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
  317. package/lib/esm/core-react/searchbox/SearchBox.scss +5 -9
  318. package/lib/esm/core-react/settings/SettingsContainer.js +1 -1
  319. package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
  320. package/lib/esm/core-react/settings/SettingsContainer.scss +3 -1
  321. package/lib/esm/core-react/style/index.scss +0 -7
  322. package/lib/esm/core-react/style/mixins.scss +2 -2
  323. package/lib/esm/core-react/style/themecolors.scss +0 -6
  324. package/lib/esm/core-react/tabs/tabs.scss +10 -20
  325. package/lib/esm/core-react/tabs/vertical.scss +6 -13
  326. package/lib/esm/core-react/text/BlockText.d.ts.map +1 -1
  327. package/lib/esm/core-react/text/BlockText.js +1 -0
  328. package/lib/esm/core-react/text/BlockText.js.map +1 -1
  329. package/lib/esm/core-react/text/BodyText.d.ts +1 -0
  330. package/lib/esm/core-react/text/BodyText.d.ts.map +1 -1
  331. package/lib/esm/core-react/text/BodyText.js +2 -0
  332. package/lib/esm/core-react/text/BodyText.js.map +1 -1
  333. package/lib/esm/core-react/text/DisabledText.d.ts.map +1 -1
  334. package/lib/esm/core-react/text/DisabledText.js +1 -0
  335. package/lib/esm/core-react/text/DisabledText.js.map +1 -1
  336. package/lib/esm/core-react/text/FilteredText.js +3 -3
  337. package/lib/esm/core-react/text/FilteredText.js.map +1 -1
  338. package/lib/esm/core-react/text/MutedText.d.ts +1 -0
  339. package/lib/esm/core-react/text/MutedText.d.ts.map +1 -1
  340. package/lib/esm/core-react/text/MutedText.js +2 -0
  341. package/lib/esm/core-react/text/MutedText.js.map +1 -1
  342. package/lib/esm/core-react/text/StyledText.d.ts +1 -0
  343. package/lib/esm/core-react/text/StyledText.d.ts.map +1 -1
  344. package/lib/esm/core-react/text/StyledText.js +1 -0
  345. package/lib/esm/core-react/text/StyledText.js.map +1 -1
  346. package/lib/esm/core-react/text/block.scss +9 -4
  347. package/lib/esm/core-react/text/body.scss +7 -4
  348. package/lib/esm/core-react/text/mixins.scss +3 -3
  349. package/lib/esm/core-react/tree/ExpansionToggle.d.ts.map +1 -1
  350. package/lib/esm/core-react/tree/ExpansionToggle.js +3 -1
  351. package/lib/esm/core-react/tree/ExpansionToggle.js.map +1 -1
  352. package/lib/esm/core-react/tree/ExpansionToggle.scss +9 -5
  353. package/lib/esm/core-react/tree/Node.d.ts +2 -2
  354. package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
  355. package/lib/esm/core-react/tree/Node.js +2 -3
  356. package/lib/esm/core-react/tree/Node.js.map +1 -1
  357. package/lib/esm/core-react/tree/Node.scss +3 -19
  358. package/lib/esm/core-react/tree/Placeholder.scss +1 -4
  359. package/lib/esm/core-react/utils/IconWebComponent.js +1 -1
  360. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  361. package/lib/esm/core-react/utils/Point.js +4 -4
  362. package/lib/esm/core-react/utils/Point.js.map +1 -1
  363. package/lib/esm/core-react/utils/Props.d.ts +1 -1
  364. package/lib/esm/core-react/utils/Props.d.ts.map +1 -1
  365. package/lib/esm/core-react/utils/Rectangle.js +7 -7
  366. package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
  367. package/lib/esm/core-react/utils/Size.js +4 -4
  368. package/lib/esm/core-react/utils/Size.js.map +1 -1
  369. package/lib/esm/core-react/utils/Timer.d.ts +1 -1
  370. package/lib/esm/core-react/utils/Timer.d.ts.map +1 -1
  371. package/lib/esm/core-react/utils/getBestBWContrastColor.js +3 -3
  372. package/lib/esm/core-react/utils/getBestBWContrastColor.js.map +1 -1
  373. package/lib/esm/core-react/utils/getCssVariable.js +1 -1
  374. package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
  375. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +1 -1
  376. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  377. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
  378. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  379. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts +1 -1
  380. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
  381. package/lib/esm/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
  382. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js +2 -2
  383. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  384. package/lib/esm/core-react/utils/hooks/useRefs.d.ts +1 -1
  385. package/lib/esm/core-react/utils/hooks/useRefs.d.ts.map +1 -1
  386. package/lib/esm/core-react/utils/hooks/useRefs.js.map +1 -1
  387. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +8 -13
  388. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  389. package/lib/esm/core-react/utils/typeUtils.d.ts +1 -1
  390. package/lib/esm/core-react/utils/typeUtils.d.ts.map +1 -1
  391. package/lib/esm/core-react.d.ts +1 -1
  392. package/lib/esm/core-react.d.ts.map +1 -1
  393. package/lib/esm/core-react.js +1 -1
  394. package/lib/esm/core-react.js.map +1 -1
  395. package/package.json +26 -26
  396. package/ThirdPartyNotices.md +0 -28
  397. package/lib/cjs/core-react/badge/BetaBadge.scss +0 -9
  398. package/lib/cjs/core-react/button/blue-large.scss +0 -12
  399. package/lib/cjs/core-react/button/blue.scss +0 -25
  400. package/lib/cjs/core-react/button/button.scss +0 -70
  401. package/lib/cjs/core-react/button/classes.scss +0 -14
  402. package/lib/cjs/core-react/button/disabled-large.scss +0 -12
  403. package/lib/cjs/core-react/button/disabled.scss +0 -17
  404. package/lib/cjs/core-react/button/hollow-large.scss +0 -13
  405. package/lib/cjs/core-react/button/hollow.scss +0 -30
  406. package/lib/cjs/core-react/button/index.scss +0 -14
  407. package/lib/cjs/core-react/button/primary-large.scss +0 -12
  408. package/lib/cjs/core-react/button/primary.scss +0 -25
  409. package/lib/cjs/core-react/button/variables.scss +0 -22
  410. package/lib/cjs/core-react/checkbox/checkbox.scss +0 -124
  411. package/lib/cjs/core-react/checkbox/classes.scss +0 -8
  412. package/lib/cjs/core-react/checkbox/index.scss +0 -8
  413. package/lib/cjs/core-react/icons/SvgSprite.d.ts +0 -21
  414. package/lib/cjs/core-react/icons/SvgSprite.d.ts.map +0 -1
  415. package/lib/cjs/core-react/icons/SvgSprite.js +0 -27
  416. package/lib/cjs/core-react/icons/SvgSprite.js.map +0 -1
  417. package/lib/cjs/core-react/style/data-viz.scss +0 -20
  418. package/lib/cjs/core-react/style/itwinui-overrides.scss +0 -24
  419. package/lib/cjs/core-react/style/space.scss +0 -13
  420. package/lib/cjs/core-react/style/speed.scss +0 -12
  421. package/lib/cjs/core-react/style/typography.scss +0 -44
  422. package/lib/cjs/core-react/style/variables.scss +0 -12
  423. package/lib/esm/core-react/badge/BetaBadge.scss +0 -9
  424. package/lib/esm/core-react/button/blue-large.scss +0 -12
  425. package/lib/esm/core-react/button/blue.scss +0 -25
  426. package/lib/esm/core-react/button/button.scss +0 -70
  427. package/lib/esm/core-react/button/classes.scss +0 -14
  428. package/lib/esm/core-react/button/disabled-large.scss +0 -12
  429. package/lib/esm/core-react/button/disabled.scss +0 -17
  430. package/lib/esm/core-react/button/hollow-large.scss +0 -13
  431. package/lib/esm/core-react/button/hollow.scss +0 -30
  432. package/lib/esm/core-react/button/index.scss +0 -14
  433. package/lib/esm/core-react/button/primary-large.scss +0 -12
  434. package/lib/esm/core-react/button/primary.scss +0 -25
  435. package/lib/esm/core-react/button/variables.scss +0 -22
  436. package/lib/esm/core-react/checkbox/checkbox.scss +0 -124
  437. package/lib/esm/core-react/checkbox/classes.scss +0 -8
  438. package/lib/esm/core-react/checkbox/index.scss +0 -8
  439. package/lib/esm/core-react/icons/SvgSprite.d.ts +0 -21
  440. package/lib/esm/core-react/icons/SvgSprite.d.ts.map +0 -1
  441. package/lib/esm/core-react/icons/SvgSprite.js +0 -23
  442. package/lib/esm/core-react/icons/SvgSprite.js.map +0 -1
  443. package/lib/esm/core-react/style/data-viz.scss +0 -20
  444. package/lib/esm/core-react/style/itwinui-overrides.scss +0 -24
  445. package/lib/esm/core-react/style/space.scss +0 -13
  446. package/lib/esm/core-react/style/speed.scss +0 -12
  447. package/lib/esm/core-react/style/typography.scss +0 -44
  448. package/lib/esm/core-react/style/variables.scss +0 -12
@@ -2,14 +2,15 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/itwinui-css/scss/style/theme";
6
-
7
5
  // cspell:ignore colorvariables
8
6
 
9
7
  /** @note: This file should only be imported by UiCore.ts.
10
8
  * It should NOT be imported by any *.scss or other ui-core files.
11
9
  */
12
10
 
11
+ $background: var(--iui-color-background);
12
+ $accent: var(--iui-color-background-accent);
13
+
13
14
  @mixin light-theme {
14
15
  --buic-button-gradient1: rgba(
15
16
  var(--iui-color-foreground-body-invert-rgb),
@@ -17,22 +18,7 @@
17
18
  );
18
19
  --buic-button-gradient2: rgba(var(--iui-color-foreground-body-invert-rgb), 0);
19
20
 
20
- // TODO create new values just for them
21
- --buic-background-editable: #{mix(
22
- $iui-color-background-1--light,
23
- $iui-color-background-primary--light,
24
- 70%
25
- )};
26
- --buic-row-selection: #{mix(
27
- $iui-color-background-1--light,
28
- $iui-color-background-primary--light,
29
- 80%
30
- )};
31
- --buic-row-hover: #{mix(
32
- $iui-color-background-1--light,
33
- $iui-color-background-primary--light,
34
- 90%
35
- )};
21
+ --buic-background-editable: var(--iui-color-background);
36
22
  }
37
23
 
38
24
  @mixin dark-theme {
@@ -42,22 +28,7 @@
42
28
  0.25
43
29
  );
44
30
 
45
- // TODO create new values just for them
46
- --buic-background-editable: #{mix(
47
- $iui-color-background-1--dark,
48
- $iui-color-background-primary--dark,
49
- 70%
50
- )};
51
- --buic-row-selection: #{mix(
52
- $iui-color-background-1--dark,
53
- $iui-color-background-primary--dark,
54
- 80%
55
- )};
56
- --buic-row-hover: #{mix(
57
- $iui-color-background-1--dark,
58
- $iui-color-background-primary--dark,
59
- 90%
60
- )};
31
+ --buic-background-editable: var(--iui-color-background);
61
32
  }
62
33
 
63
34
  html,
@@ -2,8 +2,6 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- @import "~@itwin/itwinui-css/scss/style/theme";
6
- @import "~@itwin/itwinui-variables";
7
5
 
8
6
  // cspell:ignore mediumgray titlebar toolbutton outoffocus
9
7
 
@@ -11,7 +9,7 @@
11
9
  * It should NOT be imported by any *.scss or other ui-core files.
12
10
  */
13
11
 
14
- :root {
12
+ [data-root-container="iui-root-id"] {
15
13
  // NEEDSWORK - Need to deprecate these accessory colors
16
14
  --buic-accessory-hollow: rgb(255, 255, 255);
17
15
  --buic-accessory-primary: rgb(000, 139, 225);
@@ -23,99 +21,74 @@
23
21
  --buic-accessory-alert-tint: rgb(239, 169, 169);
24
22
  --buic-accessory-warning-tint: rgb(249, 215, 171);
25
23
 
26
- --buic-background-1-rgb: var(--iui-color-background-1-rgb);
27
- --buic-background-2-rgb: var(--iui-color-background-2-rgb);
28
- --buic-background-3-rgb: var(--iui-color-background-3-rgb);
29
- --buic-background-4-rgb: var(--iui-color-background-4-rgb);
30
- --buic-background-5-rgb: var(--iui-color-background-5-rgb);
31
-
32
- --buic-background-1: var(--iui-color-background-1);
33
- --buic-background-2: var(--iui-color-background-2);
34
- --buic-background-3: var(--iui-color-background-3);
35
- --buic-background-4: var(--iui-color-background-4);
36
- --buic-background-5: var(--iui-color-background-5);
37
- --buic-background-primary: var(--iui-color-background-primary);
38
- --buic-background-tooltip: rgba(var(--iui-color-background-5-rgb), 0.9);
39
- --buic-background-scrollbar: rgba(
40
- var(--iui-color-foreground-body-rgb),
41
- var(--iui-opacity-4)
24
+ --buic-background-1: var(--iui-color-background);
25
+ --buic-background-2: var(--iui-color-background-hover);
26
+ --buic-background-3: var(--iui-color-background-backdrop);
27
+ --buic-background-4: var(--iui-color-background-backdrop-hover);
28
+ --buic-background-5: var(--iui-color-background-disabled);
29
+ --buic-background-primary: var(--iui-color-background-accent);
30
+ --buic-background-tooltip: hsl(var(--iui-color-background-hsl) / 0.9);
31
+ --buic-background-scrollbar: hsl(
32
+ var(--iui-color-foreground-hsl) / var(--iui-opacity-4)
42
33
  );
43
- --buic-background-scrollbar-hover: rgba(
44
- var(--iui-color-foreground-body-rgb),
45
- var(--iui-opacity-3)
34
+ --buic-background-scrollbar-hover: hsl(
35
+ var(--iui-color-foreground-hsl) / var(--iui-opacity-3)
46
36
  );
47
37
 
48
- --buic-foreground-body-rgb: var(--iui-text-color-rgb);
49
- --buic-foreground-body: var(--iui-text-color);
50
- --buic-foreground-body-reverse-rgb: var(
51
- --iui-color-foreground-body-invert-rgb
52
- );
53
- --buic-foreground-body-reverse: rgba(
54
- var(--iui-color-foreground-body-invert-rgb),
55
- var(--iui-opacity-2)
38
+ --buic-foreground-body-rgb: var(--iui-color-foreground-hsl);
39
+ --buic-foreground-body: var(--iui-color-text);
40
+
41
+ --buic-foreground-body-reverse-rgb: var(--iui-color-foreground-hsl);
42
+ --buic-foreground-body-reverse: hsl(
43
+ var(--iui-color-background-hsl) / var(--iui-opacity-2)
56
44
  );
57
- --buic-foreground-muted: var(--iui-text-color-muted);
58
- --buic-foreground-disabled: var(--iui-text-color-placeholder);
59
- --buic-foreground-activehover: var(--iui-icons-color-actionable-hover);
45
+ --buic-foreground-muted: var(--iui-color-text-muted);
46
+ --buic-foreground-disabled: var(--iui-color-text-disabled);
47
+ --buic-foreground-activehover: var(--iui-color-text);
60
48
 
61
- --buic-inputs-border: rgba(
62
- var(--iui-color-foreground-body-rgb),
63
- var(--iui-opacity-4)
49
+ --buic-inputs-border: hsl(
50
+ var(--iui-color-foreground-hsl) / var(--iui-opacity-4)
64
51
  );
65
52
  --buic-inputs-boxshadow: var(--iui-focus-box-shadow);
66
53
  --buic-popup-boxshadow: var(--buic-inputs-boxshadow);
67
54
 
68
- --buic-foreground-primary: var(--iui-icons-color-primary);
69
- --buic-foreground-primary-tone: var(--iui-color-foreground-primary-overlay);
70
- --buic-foreground-focus: var(--iui-color-foreground-primary-overlay);
55
+ --buic-foreground-primary: var(--iui-color-icon-accent);
56
+ --buic-foreground-primary-tone: var(--iui-color-text-accent-hover);
57
+ --buic-foreground-focus: var(--iui-color-text-accent-hover);
71
58
  --buic-foreground-focus-border: var(--buic-inputs-border);
72
- --buic-focus-boxshadow: rgba(
73
- var(--iui-color-foreground-primary-rgb),
74
- var(--iui-opacity-4)
59
+ --buic-focus-boxshadow: hsl(
60
+ var(--iui-color-accent-hsl) / var(--iui-opacity-4)
75
61
  );
76
62
 
77
63
  // The following two are still in use by DatePicker and there is no itwinui equivalent
78
- --buic-focus-boxshadow-gradient1: rgba(
79
- var(--buic-foreground-primary-tone-rgb),
80
- 0
64
+ --buic-focus-boxshadow-gradient1: hsl(
65
+ var(--buic-foreground-primary-tone-rgb) / 0
81
66
  );
82
- --buic-focus-boxshadow-gradient2: rgba(
83
- var(--buic-foreground-primary-rgb),
84
- 0.65
67
+ --buic-focus-boxshadow-gradient2: hsl(
68
+ var(--buic-foreground-primary-rgb) / 0.65
85
69
  );
86
70
 
87
- --buic-foreground-accessory: var(--iui-color-foreground-accessory);
88
- --buic-foreground-success: var(--iui-color-foreground-positive);
89
- --buic-foreground-positive: var(--iui-color-foreground-positive);
90
- --buic-foreground-positive-rgb: var(--iui-color-foreground-positive-rgb);
91
- --buic-foreground-alert: var(--iui-color-foreground-negative);
92
- --buic-foreground-negative: var(--iui-color-foreground-negative);
93
- --buic-foreground-negative-rgb: var(--iui-color-foreground-negative-rgb);
94
- --buic-foreground-warning: var(--iui-color-foreground-warning);
95
- --buic-foreground-warning-rgb: var(--iui-color-foreground-warning-rgb);
96
-
97
- --buic-background-focus-overlay: rgba(
98
- var(--iui-color-foreground-primary-rgb),
99
- var(--iui-opacity-6)
100
- );
101
- --buic-background-hover-overlay: rgba(
102
- var(--iui-color-foreground-primary-rgb),
103
- var(--iui-opacity-5)
71
+ --buic-foreground-accessory: var(--iui-color-white);
72
+ --buic-foreground-success: var(--iui-color-text-positive);
73
+ --buic-foreground-positive: var(--iui-color-text-positive);
74
+ --buic-foreground-positive-rgb: var(--iui-color-positive-hsl);
75
+ --buic-foreground-alert: var(--iui-color-text-negative);
76
+ --buic-foreground-negative: var(--iui-color-text-negative);
77
+ --buic-foreground-negative-rgb: var(--iui-color-negative-hsl);
78
+ --buic-foreground-warning: var(--iui-color-text-warning);
79
+ --buic-foreground-warning-rgb: var(--iui-color-warning-hsl);
80
+
81
+ --buic-background-focus-overlay: hsl(var(--iui-opacity-6));
82
+ --buic-background-hover-overlay: hsl(
83
+ var(--iui-color-accent-hsl) / var(--iui-opacity-5)
104
84
  );
105
- --buic-background-active-overlay: rgba(
106
- var(--iui-color-foreground-primary-rgb),
107
- var(--iui-opacity-5)
108
- );
109
- --buic-background-pressed-overlay: rgba(
110
- var(--iui-color-foreground-primary-rgb),
111
- 0.3
85
+ --buic-background-active-overlay: hsl(
86
+ var(--iui-color-accent-hsl) / var(--iui-opacity-5)
112
87
  );
88
+ --buic-background-pressed-overlay: hsl(var(--iui-color-accent-hsl) / 0.3);
113
89
 
114
90
  --buic-background-card: var(--buic-background-tooltip);
115
- --buic-background-striped_row: rgba(
116
- var(--iui-color-foreground-body-rgb),
117
- 0.03
118
- );
91
+ --buic-background-striped_row: hsl(var(--iui-color-foreground-hsl) / 0.03);
119
92
 
120
93
  /** background.5 */
121
94
  --buic-background-titlebar: var(--buic-background-5);
@@ -151,4 +124,8 @@
151
124
 
152
125
  /** background.1 */
153
126
  --buic-background-control: var(--buic-background-1);
127
+
128
+ // Color variables
129
+ --buic-row-selection: var(--iui-color-background-accent-muted);
130
+ --buic-row-hover: var(--iui-color-background-hover);
154
131
  }
@@ -72,7 +72,7 @@ export declare class ContextMenu extends React.PureComponent<ContextMenuProps, C
72
72
  private _handleOnOutsideClick;
73
73
  render(): JSX.Element;
74
74
  /** @internal */
75
- static getCSSClassNameFromDirection: (direction?: ContextMenuDirection | undefined) => string;
75
+ static getCSSClassNameFromDirection: (direction?: ContextMenuDirection) => string;
76
76
  private _injectMenuItemProps;
77
77
  private _rootRef;
78
78
  private _menuRef;
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../../src/core-react/contextmenu/ContextMenu.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AAEvE;;IAEI;AACJ,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,+CAA+C;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,gFAAgF;IAChF,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,uDAAuD;IACvD,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAC;IAC5C,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/B,oCAAoC;IACpC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gFAAgF;IAChF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0IAA0I;IAC1I,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB;IAChB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,gBAAgB;IAChB,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,gBAAgB;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,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AM,CAyCrF;IAEF,OAAO,CAAC,oBAAoB,CAiC1B;IAEF,OAAO,CAAC,QAAQ,CAEd;IAEF,OAAO,CAAC,QAAQ,CAEd;IAEF,OAAO,CAAC,SAAS;IAOjB,gBAAgB;IACA,iBAAiB;IAWjC,gBAAgB;IACA,oBAAoB;IAMpC,OAAO,CAAC,oBAAoB;IAqBrB,KAAK,aAIV;IAEK,IAAI,aAIT;IAEK,OAAO,QAAO,OAAO,CAQ1B;IAEF,OAAO,CAAC,kBAAkB,CAIxB;IAEF,OAAO,CAAC,YAAY,CAGlB;IAEF,OAAO,CAAC,YAAY,CA6ElB;IAEc,kBAAkB,CAAC,SAAS,EAAE,gBAAgB;CAa/D"}
@@ -206,11 +206,10 @@ class ContextMenu extends React.PureComponent {
206
206
  React.createElement("div", { ref: this._menuRef, role: "menu", tabIndex: 0, "data-testid": "core-context-menu-container", className: (0, classnames_1.default)("core-context-menu-container", opened && "core-context-menu-opened", floating && "core-context-menu-floating", ContextMenu.getCSSClassNameFromDirection(renderDirection)) }, this._injectedChildren))));
207
207
  }
208
208
  getWindow() {
209
- var _a;
210
209
  const el = this._rootElement ? this._rootElement : /* istanbul ignore next */ this._menuElement;
211
210
  const parentDocument = el.ownerDocument;
212
211
  // istanbul ignore next
213
- return (_a = parentDocument.defaultView) !== null && _a !== void 0 ? _a : window;
212
+ return parentDocument.defaultView ?? window;
214
213
  }
215
214
  /** @internal */
216
215
  componentDidMount() {
@@ -258,7 +257,6 @@ class ContextMenu extends React.PureComponent {
258
257
  }
259
258
  }
260
259
  }
261
- exports.ContextMenu = ContextMenu;
262
260
  ContextMenu.defaultProps = {
263
261
  direction: ContextMenuDirection_1.ContextMenuDirection.BottomRight,
264
262
  autoflip: true,
@@ -362,4 +360,5 @@ ContextMenu.getCSSClassNameFromDirection = (direction) => {
362
360
  }
363
361
  return className;
364
362
  };
363
+ exports.ContextMenu = ContextMenu;
365
364
  //# sourceMappingURL=ContextMenu.js.map
@@ -1 +1 @@
1
- {"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K,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,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 \"./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,2CAAoC;AACpC,+BAA+B;AAC/B,0DAA4E;AAE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AAS,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"]}
@@ -24,10 +24,10 @@ $uicore-menu-top-bottom-padding: calc(#{$uicore-menu-padding} * 0.6667);
24
24
  }
25
25
 
26
26
  .core-context-menu {
27
- color: $buic-foreground-body;
27
+ color: var(--iui-color-text);
28
28
 
29
29
  &:hover {
30
- color: $buic-foreground-activehover;
30
+ color: var(--iui-color-text-hover);
31
31
  cursor: auto;
32
32
  }
33
33
 
@@ -41,16 +41,15 @@ $uicore-menu-top-bottom-padding: calc(#{$uicore-menu-padding} * 0.6667);
41
41
  position: absolute;
42
42
  border-radius: var(--iui-border-radius-1);
43
43
  padding: 4px 0;
44
- box-shadow: 0px 3px 5px 0 rgba(0, 0, 0, 0.2);
45
- background-color: $buic-background-1;
44
+ box-shadow: var(--iui-shadow-1);
45
+ background-color: var(--iui-color-background);
46
46
  text-overflow: ellipsis;
47
47
  min-width: max-content;
48
48
  max-width: 350px;
49
49
  visibility: hidden;
50
50
  transform: scaleY(0);
51
51
  display: table;
52
- border: 1px solid $buic-background-divider;
53
- box-shadow: rgba($uicore-black, 0.25) 0px 1px 1px;
52
+ border: 1px solid var(--iui-color-border);
54
53
 
55
54
  &.core-context-menu-floating {
56
55
  position: fixed;
@@ -108,15 +107,15 @@ $uicore-menu-top-bottom-padding: calc(#{$uicore-menu-padding} * 0.6667);
108
107
  box-sizing: content-box;
109
108
 
110
109
  &:hover {
111
- background-color: $buic-row-hover;
110
+ background-color: var(--iui-color-background-hover);
112
111
  }
113
112
 
114
113
  &.core-context-menu-is-selected {
115
- background-color: $buic-row-selection;
114
+ background-color: var(--iui-color-background-accent-muted);
116
115
  }
117
116
 
118
117
  &.core-context-menu-disabled {
119
- color: $buic-foreground-disabled;
118
+ color: var(--iui-color-text-disabled);
120
119
  }
121
120
 
122
121
  &.core-context-menu-hidden {
@@ -128,7 +127,7 @@ $uicore-menu-top-bottom-padding: calc(#{$uicore-menu-padding} * 0.6667);
128
127
  flex-grow: 0;
129
128
  width: $uicore-icons-small;
130
129
  height: var(--iui-size-l);
131
- font-size: $uicore-icons-small;
130
+ font-size: var(--iui-font-size-2);
132
131
  line-height: var(--iui-size-l);
133
132
  text-align: center;
134
133
  margin-right: $uicore-unbordered-padding;
@@ -160,7 +159,7 @@ $uicore-menu-top-bottom-padding: calc(#{$uicore-menu-padding} * 0.6667);
160
159
 
161
160
  &:focus {
162
161
  border: 1px solid $buic-background-divider;
163
- box-shadow: rgba($uicore-black, 0.25) 0px 1px 1px;
162
+ box-shadow: var(--iui-shadow-1);
164
163
  outline: 0px;
165
164
 
166
165
  > .core-context-menu-item.is-selected,
@@ -219,7 +218,7 @@ $uicore-menu-top-bottom-padding: calc(#{$uicore-menu-padding} * 0.6667);
219
218
  margin-left: $uicore-unbordered-padding;
220
219
  width: $uicore-icons-small;
221
220
  height: var(--iui-size-l);
222
- font-size: $uicore-icons-small * 0.5;
221
+ font-size: calc(var(--iui-font-size-2) * 0.5);
223
222
  line-height: var(--iui-size-l);
224
223
  text-align: center;
225
224
  }
@@ -227,7 +226,7 @@ $uicore-menu-top-bottom-padding: calc(#{$uicore-menu-padding} * 0.6667);
227
226
  }
228
227
 
229
228
  .core-context-menu-divider {
230
- border-bottom: 1px solid $buic-inputs-border;
229
+ border-bottom: 1px solid var(--iui-color-border-foreground);
231
230
  height: 0px;
232
231
  }
233
232
 
@@ -99,11 +99,11 @@ class ContextMenuItem extends React.PureComponent {
99
99
  }
100
100
  }
101
101
  }
102
- exports.ContextMenuItem = ContextMenuItem;
103
102
  /** @internal */
104
103
  ContextMenuItem.defaultProps = {
105
104
  disabled: false,
106
105
  hidden: false,
107
106
  isSelected: false,
108
107
  };
108
+ exports.ContextMenuItem = ContextMenuItem;
109
109
  //# sourceMappingURL=ContextMenuItem.js.map
@@ -1 +1 @@
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;AACpC,0DAAuF;AAGvF,4DAAyD;AACzD,+CAA4C;AAC5C,0DAAwD;AAkCxD;;;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,wCA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C,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;;AA5EH,0CAkIC;AA9HC,gBAAgB;AACF,4BAAY,GAAkC;IAC1D,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;CAClB,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 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;AACpC,0DAAuF;AAGvF,4DAAyD;AACzD,+CAA4C;AAC5C,0DAAwD;AAkCxD;;;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,CA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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"]}
@@ -43,7 +43,7 @@ export declare class ContextSubMenu extends React.Component<ContextSubMenuProps,
43
43
  private checkRenderDirection;
44
44
  private _updateHotkey;
45
45
  select: () => void;
46
- close: (propagate?: boolean | undefined) => void;
46
+ close: (propagate?: boolean) => void;
47
47
  private _handleMouseOver;
48
48
  private _handleClick;
49
49
  private _handleClickGlobal;
@@ -1 +1 @@
1
- {"version":3,"file":"ContextSub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