@itwin/core-react 4.0.0-dev.16 → 4.0.0-dev.17

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 (384) hide show
  1. package/lib/cjs/core-react/UiCore.js.map +1 -1
  2. package/lib/cjs/core-react/_geometry.scss +70 -70
  3. package/lib/cjs/core-react/_helpers.scss +51 -51
  4. package/lib/cjs/core-react/_math.scss +13 -13
  5. package/lib/cjs/core-react/_scrollbar.scss +51 -51
  6. package/lib/cjs/core-react/_typography.scss +44 -44
  7. package/lib/cjs/core-react/_z-index.scss +65 -65
  8. package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
  9. package/lib/cjs/core-react/autosuggest/AutoSuggest.scss +79 -79
  10. package/lib/cjs/core-react/badge/Badge.js.map +1 -1
  11. package/lib/cjs/core-react/badge/Badge.scss +13 -13
  12. package/lib/cjs/core-react/badge/BadgeUtilities.js.map +1 -1
  13. package/lib/cjs/core-react/badge/BetaBadge.js.map +1 -1
  14. package/lib/cjs/core-react/badge/NewBadge.js.map +1 -1
  15. package/lib/cjs/core-react/badge/NewBadge.scss +9 -9
  16. package/lib/cjs/core-react/base/Centered.js.map +1 -1
  17. package/lib/cjs/core-react/base/Div.js.map +1 -1
  18. package/lib/cjs/core-react/base/DivWithOutsideClick.js.map +1 -1
  19. package/lib/cjs/core-react/base/FillCentered.js.map +1 -1
  20. package/lib/cjs/core-react/base/FlexWrapContainer.js.map +1 -1
  21. package/lib/cjs/core-react/base/Gap.js.map +1 -1
  22. package/lib/cjs/core-react/base/PointerEvents.js.map +1 -1
  23. package/lib/cjs/core-react/base/ScrollView.js.map +1 -1
  24. package/lib/cjs/core-react/base/base.scss +42 -42
  25. package/lib/cjs/core-react/base/classes.scss +13 -13
  26. package/lib/cjs/core-react/base/index.scss +5 -5
  27. package/lib/cjs/core-react/button/UnderlinedButton.js.map +1 -1
  28. package/lib/cjs/core-react/button/UnderlinedButton.scss +32 -32
  29. package/lib/cjs/core-react/checklistbox/CheckListBox.js.map +1 -1
  30. package/lib/cjs/core-react/checklistbox/CheckListBox.scss +21 -21
  31. package/lib/cjs/core-react/classes.scss +11 -11
  32. package/lib/cjs/core-react/colorthemes.scss +61 -61
  33. package/lib/cjs/core-react/colorvariables.scss +131 -131
  34. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  35. package/lib/cjs/core-react/contextmenu/ContextMenu.scss +236 -236
  36. package/lib/cjs/core-react/contextmenu/ContextMenuDirection.js.map +1 -1
  37. package/lib/cjs/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
  38. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  39. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  40. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  41. package/lib/cjs/core-react/contextmenu/PopupContextMenu.js.map +1 -1
  42. package/lib/cjs/core-react/contextmenu/TildeFinder.js.map +1 -1
  43. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  44. package/lib/cjs/core-react/dialog/Dialog.scss +245 -245
  45. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  46. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  47. package/lib/cjs/core-react/elementseparator/ElementSeparator.scss +85 -85
  48. package/lib/cjs/core-react/enums/Alignment.js.map +1 -1
  49. package/lib/cjs/core-react/enums/CheckBoxState.js.map +1 -1
  50. package/lib/cjs/core-react/enums/Orientation.js.map +1 -1
  51. package/lib/cjs/core-react/enums/SortDirection.js.map +1 -1
  52. package/lib/cjs/core-react/enums/TimeFormat.js.map +1 -1
  53. package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
  54. package/lib/cjs/core-react/expandable/ExpandableList.scss +8 -8
  55. package/lib/cjs/core-react/expandable/classes.scss +7 -7
  56. package/lib/cjs/core-react/expandable/index.scss +5 -5
  57. package/lib/cjs/core-react/expandable/list.scss +35 -35
  58. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  59. package/lib/cjs/core-react/focustrap/FocusTrap.js.map +1 -1
  60. package/lib/cjs/core-react/hocs/withIsPressed.js.map +1 -1
  61. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  62. package/lib/cjs/core-react/hocs/withTimeout.js.map +1 -1
  63. package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -1
  64. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  65. package/lib/cjs/core-react/icons/IconComponent.scss +20 -20
  66. package/lib/cjs/core-react/icons/SvgPath.js.map +1 -1
  67. package/lib/cjs/core-react/icons/SvgPath.scss +15 -15
  68. package/lib/cjs/core-react/icons/WebFontIcon.js.map +1 -1
  69. package/lib/cjs/core-react/icons/WebFontIcon.scss +17 -17
  70. package/lib/cjs/core-react/icons/classes.scss +10 -10
  71. package/lib/cjs/core-react/icons/index.scss +6 -6
  72. package/lib/cjs/core-react/icons/mixins.scss +25 -25
  73. package/lib/cjs/core-react/icons/variables.scss +12 -12
  74. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  75. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.scss +54 -54
  76. package/lib/cjs/core-react/index.scss +21 -21
  77. package/lib/cjs/core-react/inputs/Input.js.map +1 -1
  78. package/lib/cjs/core-react/inputs/InputLabel.js.map +1 -1
  79. package/lib/cjs/core-react/inputs/InputStatus.js.map +1 -1
  80. package/lib/cjs/core-react/inputs/LabeledComponentProps.js.map +1 -1
  81. package/lib/cjs/core-react/inputs/classes.scss +8 -8
  82. package/lib/cjs/core-react/inputs/iconinput/IconInput.js.map +1 -1
  83. package/lib/cjs/core-react/inputs/iconinput/IconInput.scss +35 -35
  84. package/lib/cjs/core-react/inputs/index.scss +9 -9
  85. package/lib/cjs/core-react/inputs/input-label.scss +90 -90
  86. package/lib/cjs/core-react/inputs/input.scss +58 -58
  87. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  88. package/lib/cjs/core-react/inputs/numberinput/NumberInput.scss +88 -88
  89. package/lib/cjs/core-react/inputs/variables.scss +38 -38
  90. package/lib/cjs/core-react/layout-variables.scss +17 -17
  91. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  92. package/lib/cjs/core-react/listbox/Listbox.scss +54 -54
  93. package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
  94. package/lib/cjs/core-react/loading/LoadingBar.scss +29 -29
  95. package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
  96. package/lib/cjs/core-react/loading/LoadingPrompt.scss +33 -33
  97. package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
  98. package/lib/cjs/core-react/loading/LoadingSpinner.scss +26 -26
  99. package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
  100. package/lib/cjs/core-react/loading/LoadingStatus.scss +20 -20
  101. package/lib/cjs/core-react/loading/index.scss +5 -5
  102. package/lib/cjs/core-react/loading/mixins.scss +57 -57
  103. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  104. package/lib/cjs/core-react/messagebox/MessageBox.scss +56 -56
  105. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  106. package/lib/cjs/core-react/notification/MessageType.js.map +1 -1
  107. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  108. package/lib/cjs/core-react/popup/Popup.scss +240 -240
  109. package/lib/cjs/core-react/radialmenu/Annulus.js.map +1 -1
  110. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  111. package/lib/cjs/core-react/radialmenu/RadialMenu.scss +55 -55
  112. package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
  113. package/lib/cjs/core-react/searchbox/SearchBox.scss +47 -47
  114. package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
  115. package/lib/cjs/core-react/settings/SettingsContainer.scss +68 -68
  116. package/lib/cjs/core-react/settings/SettingsManager.js.map +1 -1
  117. package/lib/cjs/core-react/style/baseline.scss +11 -11
  118. package/lib/cjs/core-react/style/breakpoints.scss +41 -41
  119. package/lib/cjs/core-react/style/colors.scss +77 -77
  120. package/lib/cjs/core-react/style/index.scss +10 -10
  121. package/lib/cjs/core-react/style/mixins.scss +27 -27
  122. package/lib/cjs/core-react/style/opacity.scss +16 -16
  123. package/lib/cjs/core-react/style/themecolors.scss +123 -123
  124. package/lib/cjs/core-react/tabs/Tabs.js.map +1 -1
  125. package/lib/cjs/core-react/tabs/VerticalTabs.js.map +1 -1
  126. package/lib/cjs/core-react/tabs/classes.scss +7 -7
  127. package/lib/cjs/core-react/tabs/index.scss +5 -5
  128. package/lib/cjs/core-react/tabs/tabs.scss +96 -96
  129. package/lib/cjs/core-react/tabs/vertical.scss +51 -51
  130. package/lib/cjs/core-react/text/BlockText.js.map +1 -1
  131. package/lib/cjs/core-react/text/BodyText.js.map +1 -1
  132. package/lib/cjs/core-react/text/DisabledText.js.map +1 -1
  133. package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
  134. package/lib/cjs/core-react/text/FilteredText.scss +10 -10
  135. package/lib/cjs/core-react/text/MutedText.js.map +1 -1
  136. package/lib/cjs/core-react/text/StyledText.js.map +1 -1
  137. package/lib/cjs/core-react/text/TextProps.js.map +1 -1
  138. package/lib/cjs/core-react/text/block.scss +15 -15
  139. package/lib/cjs/core-react/text/body.scss +13 -13
  140. package/lib/cjs/core-react/text/classes.scss +10 -10
  141. package/lib/cjs/core-react/text/disabled.scss +10 -10
  142. package/lib/cjs/core-react/text/index.scss +10 -10
  143. package/lib/cjs/core-react/text/mixins.scss +24 -24
  144. package/lib/cjs/core-react/text/muted.scss +10 -10
  145. package/lib/cjs/core-react/tree/Branch.js.map +1 -1
  146. package/lib/cjs/core-react/tree/Branch.scss +12 -12
  147. package/lib/cjs/core-react/tree/ExpansionToggle.js.map +1 -1
  148. package/lib/cjs/core-react/tree/ExpansionToggle.scss +32 -32
  149. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  150. package/lib/cjs/core-react/tree/Node.scss +68 -68
  151. package/lib/cjs/core-react/tree/Placeholder.js.map +1 -1
  152. package/lib/cjs/core-react/tree/Placeholder.scss +17 -17
  153. package/lib/cjs/core-react/tree/Tree.js.map +1 -1
  154. package/lib/cjs/core-react/tree/Tree.scss +21 -21
  155. package/lib/cjs/core-react/uistate/LocalStateStorage.js.map +1 -1
  156. package/lib/cjs/core-react/uistate/UiStateEntry.js.map +1 -1
  157. package/lib/cjs/core-react/uistate/UiStateStorage.js.map +1 -1
  158. package/lib/cjs/core-react/utils/IconHelper.js.map +1 -1
  159. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  160. package/lib/cjs/core-react/utils/Point.js.map +1 -1
  161. package/lib/cjs/core-react/utils/Props.js.map +1 -1
  162. package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
  163. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  164. package/lib/cjs/core-react/utils/Size.js.map +1 -1
  165. package/lib/cjs/core-react/utils/Timer.js.map +1 -1
  166. package/lib/cjs/core-react/utils/UiGeometry.js.map +1 -1
  167. package/lib/cjs/core-react/utils/flattenChildren.js.map +1 -1
  168. package/lib/cjs/core-react/utils/getBestBWContrastColor.js.map +1 -1
  169. package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
  170. package/lib/cjs/core-react/utils/getDisplayName.js.map +1 -1
  171. package/lib/cjs/core-react/utils/getUserColor.js.map +1 -1
  172. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.js.map +1 -1
  173. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  174. package/lib/cjs/core-react/utils/hooks/useDisposable.js.map +1 -1
  175. package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.js.map +1 -1
  176. package/lib/cjs/core-react/utils/hooks/useEventListener.js.map +1 -1
  177. package/lib/cjs/core-react/utils/hooks/useInterval.js.map +1 -1
  178. package/lib/cjs/core-react/utils/hooks/useLifecycleLogging.js.map +1 -1
  179. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.js.map +1 -1
  180. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  181. package/lib/cjs/core-react/utils/hooks/useRefEffect.js.map +1 -1
  182. package/lib/cjs/core-react/utils/hooks/useRefState.js.map +1 -1
  183. package/lib/cjs/core-react/utils/hooks/useRefs.js.map +1 -1
  184. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  185. package/lib/cjs/core-react/utils/hooks/useTargeted.js.map +1 -1
  186. package/lib/cjs/core-react/utils/hooks/useThrottledFn.js.map +1 -1
  187. package/lib/cjs/core-react/utils/hooks/useWidgetOpacityContext.js.map +1 -1
  188. package/lib/cjs/core-react/utils/isPromiseLike.js.map +1 -1
  189. package/lib/cjs/core-react/utils/shallowDiffers.js.map +1 -1
  190. package/lib/cjs/core-react/utils/typeUtils.js.map +1 -1
  191. package/lib/cjs/core-react.js.map +1 -1
  192. package/lib/esm/core-react/UiCore.js.map +1 -1
  193. package/lib/esm/core-react/_geometry.scss +70 -70
  194. package/lib/esm/core-react/_helpers.scss +51 -51
  195. package/lib/esm/core-react/_math.scss +13 -13
  196. package/lib/esm/core-react/_scrollbar.scss +51 -51
  197. package/lib/esm/core-react/_typography.scss +44 -44
  198. package/lib/esm/core-react/_z-index.scss +65 -65
  199. package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
  200. package/lib/esm/core-react/autosuggest/AutoSuggest.scss +79 -79
  201. package/lib/esm/core-react/badge/Badge.js.map +1 -1
  202. package/lib/esm/core-react/badge/Badge.scss +13 -13
  203. package/lib/esm/core-react/badge/BadgeUtilities.js.map +1 -1
  204. package/lib/esm/core-react/badge/BetaBadge.js.map +1 -1
  205. package/lib/esm/core-react/badge/NewBadge.js.map +1 -1
  206. package/lib/esm/core-react/badge/NewBadge.scss +9 -9
  207. package/lib/esm/core-react/base/Centered.js.map +1 -1
  208. package/lib/esm/core-react/base/Div.js.map +1 -1
  209. package/lib/esm/core-react/base/DivWithOutsideClick.js.map +1 -1
  210. package/lib/esm/core-react/base/FillCentered.js.map +1 -1
  211. package/lib/esm/core-react/base/FlexWrapContainer.js.map +1 -1
  212. package/lib/esm/core-react/base/Gap.js.map +1 -1
  213. package/lib/esm/core-react/base/PointerEvents.js.map +1 -1
  214. package/lib/esm/core-react/base/ScrollView.js.map +1 -1
  215. package/lib/esm/core-react/base/base.scss +42 -42
  216. package/lib/esm/core-react/base/classes.scss +13 -13
  217. package/lib/esm/core-react/base/index.scss +5 -5
  218. package/lib/esm/core-react/button/UnderlinedButton.js.map +1 -1
  219. package/lib/esm/core-react/button/UnderlinedButton.scss +32 -32
  220. package/lib/esm/core-react/checklistbox/CheckListBox.js.map +1 -1
  221. package/lib/esm/core-react/checklistbox/CheckListBox.scss +21 -21
  222. package/lib/esm/core-react/classes.scss +11 -11
  223. package/lib/esm/core-react/colorthemes.scss +61 -61
  224. package/lib/esm/core-react/colorvariables.scss +131 -131
  225. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  226. package/lib/esm/core-react/contextmenu/ContextMenu.scss +236 -236
  227. package/lib/esm/core-react/contextmenu/ContextMenuDirection.js.map +1 -1
  228. package/lib/esm/core-react/contextmenu/ContextMenuDivider.js.map +1 -1
  229. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  230. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  231. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  232. package/lib/esm/core-react/contextmenu/PopupContextMenu.js.map +1 -1
  233. package/lib/esm/core-react/contextmenu/TildeFinder.js.map +1 -1
  234. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  235. package/lib/esm/core-react/dialog/Dialog.scss +245 -245
  236. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  237. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  238. package/lib/esm/core-react/elementseparator/ElementSeparator.scss +85 -85
  239. package/lib/esm/core-react/enums/Alignment.js.map +1 -1
  240. package/lib/esm/core-react/enums/CheckBoxState.js.map +1 -1
  241. package/lib/esm/core-react/enums/Orientation.js.map +1 -1
  242. package/lib/esm/core-react/enums/SortDirection.js.map +1 -1
  243. package/lib/esm/core-react/enums/TimeFormat.js.map +1 -1
  244. package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
  245. package/lib/esm/core-react/expandable/ExpandableList.scss +8 -8
  246. package/lib/esm/core-react/expandable/classes.scss +7 -7
  247. package/lib/esm/core-react/expandable/index.scss +5 -5
  248. package/lib/esm/core-react/expandable/list.scss +35 -35
  249. package/lib/esm/core-react/focus/ItemKeyboardNavigator.js.map +1 -1
  250. package/lib/esm/core-react/focustrap/FocusTrap.js.map +1 -1
  251. package/lib/esm/core-react/hocs/withIsPressed.js.map +1 -1
  252. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  253. package/lib/esm/core-react/hocs/withTimeout.js.map +1 -1
  254. package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -1
  255. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  256. package/lib/esm/core-react/icons/IconComponent.scss +20 -20
  257. package/lib/esm/core-react/icons/SvgPath.js.map +1 -1
  258. package/lib/esm/core-react/icons/SvgPath.scss +15 -15
  259. package/lib/esm/core-react/icons/WebFontIcon.js.map +1 -1
  260. package/lib/esm/core-react/icons/WebFontIcon.scss +17 -17
  261. package/lib/esm/core-react/icons/classes.scss +10 -10
  262. package/lib/esm/core-react/icons/index.scss +6 -6
  263. package/lib/esm/core-react/icons/mixins.scss +25 -25
  264. package/lib/esm/core-react/icons/variables.scss +12 -12
  265. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js.map +1 -1
  266. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.scss +54 -54
  267. package/lib/esm/core-react/index.scss +21 -21
  268. package/lib/esm/core-react/inputs/Input.js.map +1 -1
  269. package/lib/esm/core-react/inputs/InputLabel.js.map +1 -1
  270. package/lib/esm/core-react/inputs/InputStatus.js.map +1 -1
  271. package/lib/esm/core-react/inputs/LabeledComponentProps.js.map +1 -1
  272. package/lib/esm/core-react/inputs/classes.scss +8 -8
  273. package/lib/esm/core-react/inputs/iconinput/IconInput.js.map +1 -1
  274. package/lib/esm/core-react/inputs/iconinput/IconInput.scss +35 -35
  275. package/lib/esm/core-react/inputs/index.scss +9 -9
  276. package/lib/esm/core-react/inputs/input-label.scss +90 -90
  277. package/lib/esm/core-react/inputs/input.scss +58 -58
  278. package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  279. package/lib/esm/core-react/inputs/numberinput/NumberInput.scss +88 -88
  280. package/lib/esm/core-react/inputs/variables.scss +38 -38
  281. package/lib/esm/core-react/layout-variables.scss +17 -17
  282. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  283. package/lib/esm/core-react/listbox/Listbox.scss +54 -54
  284. package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
  285. package/lib/esm/core-react/loading/LoadingBar.scss +29 -29
  286. package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
  287. package/lib/esm/core-react/loading/LoadingPrompt.scss +33 -33
  288. package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
  289. package/lib/esm/core-react/loading/LoadingSpinner.scss +26 -26
  290. package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
  291. package/lib/esm/core-react/loading/LoadingStatus.scss +20 -20
  292. package/lib/esm/core-react/loading/index.scss +5 -5
  293. package/lib/esm/core-react/loading/mixins.scss +57 -57
  294. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  295. package/lib/esm/core-react/messagebox/MessageBox.scss +56 -56
  296. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  297. package/lib/esm/core-react/notification/MessageType.js.map +1 -1
  298. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  299. package/lib/esm/core-react/popup/Popup.scss +240 -240
  300. package/lib/esm/core-react/radialmenu/Annulus.js.map +1 -1
  301. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  302. package/lib/esm/core-react/radialmenu/RadialMenu.scss +55 -55
  303. package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
  304. package/lib/esm/core-react/searchbox/SearchBox.scss +47 -47
  305. package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
  306. package/lib/esm/core-react/settings/SettingsContainer.scss +68 -68
  307. package/lib/esm/core-react/settings/SettingsManager.js.map +1 -1
  308. package/lib/esm/core-react/style/baseline.scss +11 -11
  309. package/lib/esm/core-react/style/breakpoints.scss +41 -41
  310. package/lib/esm/core-react/style/colors.scss +77 -77
  311. package/lib/esm/core-react/style/index.scss +10 -10
  312. package/lib/esm/core-react/style/mixins.scss +27 -27
  313. package/lib/esm/core-react/style/opacity.scss +16 -16
  314. package/lib/esm/core-react/style/themecolors.scss +123 -123
  315. package/lib/esm/core-react/tabs/Tabs.js.map +1 -1
  316. package/lib/esm/core-react/tabs/VerticalTabs.js.map +1 -1
  317. package/lib/esm/core-react/tabs/classes.scss +7 -7
  318. package/lib/esm/core-react/tabs/index.scss +5 -5
  319. package/lib/esm/core-react/tabs/tabs.scss +96 -96
  320. package/lib/esm/core-react/tabs/vertical.scss +51 -51
  321. package/lib/esm/core-react/text/BlockText.js.map +1 -1
  322. package/lib/esm/core-react/text/BodyText.js.map +1 -1
  323. package/lib/esm/core-react/text/DisabledText.js.map +1 -1
  324. package/lib/esm/core-react/text/FilteredText.js.map +1 -1
  325. package/lib/esm/core-react/text/FilteredText.scss +10 -10
  326. package/lib/esm/core-react/text/MutedText.js.map +1 -1
  327. package/lib/esm/core-react/text/StyledText.js.map +1 -1
  328. package/lib/esm/core-react/text/TextProps.js.map +1 -1
  329. package/lib/esm/core-react/text/block.scss +15 -15
  330. package/lib/esm/core-react/text/body.scss +13 -13
  331. package/lib/esm/core-react/text/classes.scss +10 -10
  332. package/lib/esm/core-react/text/disabled.scss +10 -10
  333. package/lib/esm/core-react/text/index.scss +10 -10
  334. package/lib/esm/core-react/text/mixins.scss +24 -24
  335. package/lib/esm/core-react/text/muted.scss +10 -10
  336. package/lib/esm/core-react/tree/Branch.js.map +1 -1
  337. package/lib/esm/core-react/tree/Branch.scss +12 -12
  338. package/lib/esm/core-react/tree/ExpansionToggle.js.map +1 -1
  339. package/lib/esm/core-react/tree/ExpansionToggle.scss +32 -32
  340. package/lib/esm/core-react/tree/Node.js.map +1 -1
  341. package/lib/esm/core-react/tree/Node.scss +68 -68
  342. package/lib/esm/core-react/tree/Placeholder.js.map +1 -1
  343. package/lib/esm/core-react/tree/Placeholder.scss +17 -17
  344. package/lib/esm/core-react/tree/Tree.js.map +1 -1
  345. package/lib/esm/core-react/tree/Tree.scss +21 -21
  346. package/lib/esm/core-react/uistate/LocalStateStorage.js.map +1 -1
  347. package/lib/esm/core-react/uistate/UiStateEntry.js.map +1 -1
  348. package/lib/esm/core-react/uistate/UiStateStorage.js.map +1 -1
  349. package/lib/esm/core-react/utils/IconHelper.js.map +1 -1
  350. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  351. package/lib/esm/core-react/utils/Point.js.map +1 -1
  352. package/lib/esm/core-react/utils/Props.js.map +1 -1
  353. package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
  354. package/lib/esm/core-react/utils/ScrollPositionMaintainer.js.map +1 -1
  355. package/lib/esm/core-react/utils/Size.js.map +1 -1
  356. package/lib/esm/core-react/utils/Timer.js.map +1 -1
  357. package/lib/esm/core-react/utils/UiGeometry.js.map +1 -1
  358. package/lib/esm/core-react/utils/flattenChildren.js.map +1 -1
  359. package/lib/esm/core-react/utils/getBestBWContrastColor.js.map +1 -1
  360. package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
  361. package/lib/esm/core-react/utils/getDisplayName.js.map +1 -1
  362. package/lib/esm/core-react/utils/getUserColor.js.map +1 -1
  363. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.js.map +1 -1
  364. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  365. package/lib/esm/core-react/utils/hooks/useDisposable.js.map +1 -1
  366. package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.js.map +1 -1
  367. package/lib/esm/core-react/utils/hooks/useEventListener.js.map +1 -1
  368. package/lib/esm/core-react/utils/hooks/useInterval.js.map +1 -1
  369. package/lib/esm/core-react/utils/hooks/useLifecycleLogging.js.map +1 -1
  370. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.js.map +1 -1
  371. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  372. package/lib/esm/core-react/utils/hooks/useRefEffect.js.map +1 -1
  373. package/lib/esm/core-react/utils/hooks/useRefState.js.map +1 -1
  374. package/lib/esm/core-react/utils/hooks/useRefs.js.map +1 -1
  375. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  376. package/lib/esm/core-react/utils/hooks/useTargeted.js.map +1 -1
  377. package/lib/esm/core-react/utils/hooks/useThrottledFn.js.map +1 -1
  378. package/lib/esm/core-react/utils/hooks/useWidgetOpacityContext.js.map +1 -1
  379. package/lib/esm/core-react/utils/isPromiseLike.js.map +1 -1
  380. package/lib/esm/core-react/utils/shallowDiffers.js.map +1 -1
  381. package/lib/esm/core-react/utils/typeUtils.js.map +1 -1
  382. package/lib/esm/core-react.js.map +1 -1
  383. package/lib/public/locales/en/UiCore.json +30 -30
  384. package/package.json +1 -1
@@ -1,85 +1,85 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "../style/themecolors";
6
- @import "../z-index";
7
-
8
- @function background-line($orientation) {
9
- @return linear-gradient(
10
- $orientation,
11
- transparent calc(50% - 1px),
12
- var(--iui-color-icon-accent) calc(50%),
13
- transparent calc(50% + 1px));
14
- }
15
-
16
- @mixin keyframes($animation-name) {
17
- @-webkit-keyframes #{$animation-name} {
18
- @content;
19
- }
20
- @-moz-keyframes #{$animation-name} {
21
- @content;
22
- }
23
- @-ms-keyframes #{$animation-name} {
24
- @content;
25
- }
26
- @-o-keyframes #{$animation-name} {
27
- @content;
28
- }
29
- @keyframes #{$animation-name} {
30
- @content;
31
- }
32
- }
33
-
34
- @mixin animation($str) {
35
- -webkit-animation: #{$str};
36
- -moz-animation: #{$str};
37
- -ms-animation: #{$str};
38
- -o-animation: #{$str};
39
- animation: #{$str};
40
- }
41
-
42
- @include keyframes(fade-in) {
43
- from { opacity: 0; }
44
- to { opacity: 1; }
45
- }
46
-
47
- @include keyframes(fade-out) {
48
- from { opacity: 1; }
49
- to { opacity: 0; }
50
- }
51
-
52
- .core-element-separator {
53
- touch-action: none;
54
- display: inline-block;
55
- border-style: none;
56
- padding: 0px;
57
- opacity: 0;
58
- z-index: 1;
59
-
60
- &--vertical {
61
- width: 100%;
62
- cursor: row-resize;
63
- background: background-line(to bottom);
64
- }
65
-
66
- &--horizontal {
67
- height: 100%;
68
- cursor: col-resize;
69
- background: background-line(to right);
70
- }
71
-
72
- &.core-element-separator-group-hovered {
73
- @include animation('fade-in 0.2s');
74
- opacity: 1;
75
- }
76
-
77
- &.core-element-separator-group-unhovered {
78
- @include animation('fade-out 0.2s');
79
- opacity: 0;
80
- }
81
-
82
- &:focus {
83
- outline: none;
84
- }
85
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "../style/themecolors";
6
+ @import "../z-index";
7
+
8
+ @function background-line($orientation) {
9
+ @return linear-gradient(
10
+ $orientation,
11
+ transparent calc(50% - 1px),
12
+ var(--iui-color-icon-accent) calc(50%),
13
+ transparent calc(50% + 1px));
14
+ }
15
+
16
+ @mixin keyframes($animation-name) {
17
+ @-webkit-keyframes #{$animation-name} {
18
+ @content;
19
+ }
20
+ @-moz-keyframes #{$animation-name} {
21
+ @content;
22
+ }
23
+ @-ms-keyframes #{$animation-name} {
24
+ @content;
25
+ }
26
+ @-o-keyframes #{$animation-name} {
27
+ @content;
28
+ }
29
+ @keyframes #{$animation-name} {
30
+ @content;
31
+ }
32
+ }
33
+
34
+ @mixin animation($str) {
35
+ -webkit-animation: #{$str};
36
+ -moz-animation: #{$str};
37
+ -ms-animation: #{$str};
38
+ -o-animation: #{$str};
39
+ animation: #{$str};
40
+ }
41
+
42
+ @include keyframes(fade-in) {
43
+ from { opacity: 0; }
44
+ to { opacity: 1; }
45
+ }
46
+
47
+ @include keyframes(fade-out) {
48
+ from { opacity: 1; }
49
+ to { opacity: 0; }
50
+ }
51
+
52
+ .core-element-separator {
53
+ touch-action: none;
54
+ display: inline-block;
55
+ border-style: none;
56
+ padding: 0px;
57
+ opacity: 0;
58
+ z-index: 1;
59
+
60
+ &--vertical {
61
+ width: 100%;
62
+ cursor: row-resize;
63
+ background: background-line(to bottom);
64
+ }
65
+
66
+ &--horizontal {
67
+ height: 100%;
68
+ cursor: col-resize;
69
+ background: background-line(to right);
70
+ }
71
+
72
+ &.core-element-separator-group-hovered {
73
+ @include animation('fade-in 0.2s');
74
+ opacity: 1;
75
+ }
76
+
77
+ &.core-element-separator-group-unhovered {
78
+ @include animation('fade-out 0.2s');
79
+ opacity: 0;
80
+ }
81
+
82
+ &:focus {
83
+ outline: none;
84
+ }
85
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"Alignment.js","sourceRoot":"","sources":["../../../../src/core-react/enums/Alignment.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,wCAAiB,CAAA;IACjB,sCAAe,CAAA;IACf,0CAAmB,CAAA;AACrB,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B;AAED;;;GAGG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,uDAAO,CAAA;IACP,6DAAU,CAAA;IACV,6DAAU,CAAA;AACZ,CAAC,EAJW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAI5B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\n/**\r\n * Enumeration for horizontal alignment.\r\n * @public\r\n */\r\nexport enum HorizontalAlignment {\r\n Left = \"left\",\r\n Center = \"center\",\r\n Right = \"right\",\r\n Justify = \"justify\",\r\n}\r\n\r\n/**\r\n * Enumeration for vertical alignment.\r\n * @public\r\n */\r\nexport enum VerticalAlignment {\r\n Top = 1,\r\n Middle = 2,\r\n Bottom = 3,\r\n}\r\n"]}
1
+ {"version":3,"file":"Alignment.js","sourceRoot":"","sources":["../../../../src/core-react/enums/Alignment.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,wCAAiB,CAAA;IACjB,sCAAe,CAAA;IACf,0CAAmB,CAAA;AACrB,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B;AAED;;;GAGG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,uDAAO,CAAA;IACP,6DAAU,CAAA;IACV,6DAAU,CAAA;AACZ,CAAC,EAJW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAI5B","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 Common\n */\n\n/**\n * Enumeration for horizontal alignment.\n * @public\n */\nexport enum HorizontalAlignment {\n Left = \"left\",\n Center = \"center\",\n Right = \"right\",\n Justify = \"justify\",\n}\n\n/**\n * Enumeration for vertical alignment.\n * @public\n */\nexport enum VerticalAlignment {\n Top = 1,\n Middle = 2,\n Bottom = 3,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBoxState.js","sourceRoot":"","sources":["../../../../src/core-react/enums/CheckBoxState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,+CAAG,CAAA;IACH,6CAAE,CAAA;IACF,uDAAO,CAAA;AACT,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\n/** State of a checkbox\r\n * @public\r\n */\r\nexport enum CheckBoxState {\r\n Off,\r\n On,\r\n Partial,\r\n}\r\n\r\n/** A data type that holds all the checkbox display attributes\r\n * @public\r\n */\r\nexport interface CheckBoxInfo {\r\n isVisible?: boolean;\r\n isDisabled?: boolean;\r\n state?: CheckBoxState;\r\n tooltip?: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"CheckBoxState.js","sourceRoot":"","sources":["../../../../src/core-react/enums/CheckBoxState.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,+CAAG,CAAA;IACH,6CAAE,CAAA;IACF,uDAAO,CAAA;AACT,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB","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 Common\n */\n\n/** State of a checkbox\n * @public\n */\nexport enum CheckBoxState {\n Off,\n On,\n Partial,\n}\n\n/** A data type that holds all the checkbox display attributes\n * @public\n */\nexport interface CheckBoxInfo {\n isVisible?: boolean;\n isDisabled?: boolean;\n state?: CheckBoxState;\n tooltip?: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Orientation.js","sourceRoot":"","sources":["../../../../src/core-react/enums/Orientation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,yDAAU,CAAA;IACV,qDAAQ,CAAA;AACV,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\n/**\r\n * Enumeration of orientation.\r\n * @public\r\n */\r\nexport enum Orientation {\r\n Horizontal,\r\n Vertical,\r\n}\r\n"]}
1
+ {"version":3,"file":"Orientation.js","sourceRoot":"","sources":["../../../../src/core-react/enums/Orientation.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,yDAAU,CAAA;IACV,qDAAQ,CAAA;AACV,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB","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 Common\n */\n\n/**\n * Enumeration of orientation.\n * @public\n */\nexport enum Orientation {\n Horizontal,\n Vertical,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SortDirection.js","sourceRoot":"","sources":["../../../../src/core-react/enums/SortDirection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,qDAAM,CAAA;IACN,2DAAS,CAAA;IACT,6DAAU,CAAA;AACZ,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\n/**\r\n * Enumeration for sorting direction.\r\n * @public\r\n */\r\nexport enum SortDirection {\r\n NoSort,\r\n Ascending,\r\n Descending,\r\n}\r\n"]}
1
+ {"version":3,"file":"SortDirection.js","sourceRoot":"","sources":["../../../../src/core-react/enums/SortDirection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;GAGG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,qDAAM,CAAA;IACN,2DAAS,CAAA;IACT,6DAAU,CAAA;AACZ,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB","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 Common\n */\n\n/**\n * Enumeration for sorting direction.\n * @public\n */\nexport enum SortDirection {\n NoSort,\n Ascending,\n Descending,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TimeFormat.js","sourceRoot":"","sources":["../../../../src/core-react/enums/TimeFormat.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,2CAA2C;IAC3C,2CAAQ,CAAA;IACR,yCAAyC;IACzC,6CAAK,CAAA;IACL,0CAA0C;IAC1C,2CAAI,CAAA;AACN,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\n/** Enumeration of time formats.\r\n * @public\r\n */\r\nexport enum TimeFormat {\r\n /** Show Date and time using toISOString */\r\n None = 0,\r\n /** Show Date using toLocaleDateString */\r\n Short,\r\n /** Show Date Time using toLocaleString */\r\n Long,\r\n}\r\n"]}
1
+ {"version":3,"file":"TimeFormat.js","sourceRoot":"","sources":["../../../../src/core-react/enums/TimeFormat.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,2CAA2C;IAC3C,2CAAQ,CAAA;IACR,yCAAyC;IACzC,6CAAK,CAAA;IACL,0CAA0C;IAC1C,2CAAI,CAAA;AACN,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB","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 Common\n */\n\n/** Enumeration of time formats.\n * @public\n */\nexport enum TimeFormat {\n /** Show Date and time using toISOString */\n None = 0,\n /** Show Date using toLocaleDateString */\n Short,\n /** Show Date Time using to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AAU;gBACjG,QAAQ,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;aACtE,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IACA,kBAAkB,CAAC,SAA8B;QAC/D,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,KAAK,SAAS,CAAC,kBAAkB,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9H,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,kBAAmB,EAAE,CAAC,CAAC,CAAC;SAC3E;IACH,CAAC;IAEe,MAAM;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,IAAA,oBAAU,EAAC,+BAA+B,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IACvG,IAAI,CAAC,YAAY,EAAE,CAChB,CACP,CAAC;IACJ,CAAC;;AA3Ca,2BAAY,GAAiC;IACzD,gBAAgB,EAAE,KAAK;IACvB,kBAAkB,EAAE,CAAC;CACtB,AAHyB,CAGxB;AAXS,wCAAc","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Expandable\r\n */\r\n\r\nimport \"./ExpandableList.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"../utils/Props\";\r\n\r\n/** Properties for [[ExpandableList]] component\r\n * @public\r\n */\r\nexport interface ExpandableListProps extends CommonProps {\r\n /** Index of the default active block */\r\n defaultActiveBlock?: number;\r\n /** Indicates whether to allow only one expanded block */\r\n singleExpandOnly?: boolean;\r\n /** Indicates whether the single expanded block is collapsible */\r\n singleIsCollapsible?: boolean;\r\n /** Content */\r\n children?: React.ReactNode;\r\n}\r\n\r\n/** @internal */\r\ninterface ExpandableListState {\r\n activeBlock: number;\r\n}\r\n\r\n/**\r\n * ExpandableList React component is a container for ExpandableBlock components.\r\n * @public\r\n */\r\nexport class ExpandableList extends React.PureComponent<ExpandableListProps, ExpandableListState> {\r\n\r\n constructor(props: ExpandableListProps) {\r\n super(props);\r\n\r\n this.state = { activeBlock: this.props.defaultActiveBlock! };\r\n }\r\n\r\n public static defaultProps: Partial<ExpandableListProps> = {\r\n singleExpandOnly: false,\r\n defaultActiveBlock: 0,\r\n };\r\n\r\n // set active block\r\n private _handleBlockToggle = (index: number, onToggle: (isExpanding: boolean) => any) => {\r\n let activeBlock = index;\r\n\r\n if (this.props.singleIsCollapsible && index === this.state.activeBlock)\r\n activeBlock = -1;\r\n\r\n this.setState({ activeBlock });\r\n\r\n // istanbul ignore else\r\n if (onToggle) {\r\n onToggle(activeBlock === index); // fire the ExpandableBlock onToggle\r\n }\r\n };\r\n\r\n private renderBlocks() {\r\n return React.Children.map(this.props.children, (child: any, i) => {\r\n return React.cloneElement(child, {\r\n key: i,\r\n isExpanded: (this.props.singleExpandOnly) ? i === this.state.activeBlock : child.props.isExpanded,\r\n onToggle: this._handleBlockToggle.bind(this, i, child.props.onToggle),\r\n });\r\n });\r\n }\r\n\r\n /** @internal */\r\n public override componentDidUpdate(prevProps: ExpandableListProps) {\r\n if (this.props.defaultActiveBlock !== prevProps.defaultActiveBlock && this.props.defaultActiveBlock !== this.state.activeBlock) {\r\n this.setState((_, props) => ({ activeBlock: props.defaultActiveBlock! }));\r\n }\r\n }\r\n\r\n public override render(): JSX.Element {\r\n return (\r\n <div className={classnames(\"uicore-expandable-blocks-list\", this.props.className)} style={this.props.style}>\r\n {this.renderBlocks()}\r\n </div>\r\n );\r\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EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;aACtE,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IACA,kBAAkB,CAAC,SAA8B;QAC/D,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,KAAK,SAAS,CAAC,kBAAkB,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9H,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,kBAAmB,EAAE,CAAC,CAAC,CAAC;SAC3E;IACH,CAAC;IAEe,MAAM;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,IAAA,oBAAU,EAAC,+BAA+B,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IACvG,IAAI,CAAC,YAAY,EAAE,CAChB,CACP,CAAC;IACJ,CAAC;;AA3Ca,2BAAY,GAAiC;IACzD,gBAAgB,EAAE,KAAK;IACvB,kBAAkB,EAAE,CAAC;CACtB,AAHyB,CAGxB;AAXS,wCAAc","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Expandable\n */\n\nimport \"./ExpandableList.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { CommonProps } from \"../utils/Props\";\n\n/** Properties for [[ExpandableList]] component\n * @public\n */\nexport interface ExpandableListProps extends CommonProps {\n /** Index of the default active block */\n defaultActiveBlock?: number;\n /** Indicates whether to allow only one expanded block */\n singleExpandOnly?: boolean;\n /** Indicates whether the single expanded block is collapsible */\n singleIsCollapsible?: boolean;\n /** Content */\n children?: React.ReactNode;\n}\n\n/** @internal */\ninterface ExpandableListState {\n activeBlock: number;\n}\n\n/**\n * ExpandableList React component is a container for ExpandableBlock components.\n * @public\n */\nexport class ExpandableList extends React.PureComponent<ExpandableListProps, ExpandableListState> {\n\n constructor(props: ExpandableListProps) {\n super(props);\n\n this.state = { activeBlock: this.props.defaultActiveBlock! };\n }\n\n public static defaultProps: Partial<ExpandableListProps> = {\n singleExpandOnly: false,\n defaultActiveBlock: 0,\n };\n\n // set active block\n private _handleBlockToggle = (index: number, onToggle: (isExpanding: boolean) => any) => {\n let activeBlock = index;\n\n if (this.props.singleIsCollapsible && index === this.state.activeBlock)\n activeBlock = -1;\n\n this.setState({ activeBlock });\n\n // istanbul ignore else\n if (onToggle) {\n onToggle(activeBlock === index); // fire the ExpandableBlock onToggle\n }\n };\n\n private renderBlocks() {\n return React.Children.map(this.props.children, (child: any, i) => {\n return React.cloneElement(child, {\n key: i,\n isExpanded: (this.props.singleExpandOnly) ? i === this.state.activeBlock : child.props.isExpanded,\n onToggle: this._handleBlockToggle.bind(this, i, child.props.onToggle),\n });\n });\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: ExpandableListProps) {\n if (this.props.defaultActiveBlock !== prevProps.defaultActiveBlock && this.props.defaultActiveBlock !== this.state.activeBlock) {\n this.setState((_, props) => ({ activeBlock: props.defaultActiveBlock! }));\n }\n }\n\n public override render(): JSX.Element {\n return (\n <div className={classnames(\"uicore-expandable-blocks-list\", this.props.className)} style={this.props.style}>\n {this.renderBlocks()}\n </div>\n );\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "./list.scss";
6
-
7
- .uicore-expandable-blocks-list {
8
- @include uicore-expandable-blocks-list;
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "./list.scss";
6
+
7
+ .uicore-expandable-blocks-list {
8
+ @include uicore-expandable-blocks-list;
9
9
  }
@@ -1,7 +1,7 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "./index";
6
-
7
- .uicore-expandable-blocks-list { @include uicore-expandable-blocks-list; }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "./index";
6
+
7
+ .uicore-expandable-blocks-list { @include uicore-expandable-blocks-list; }
@@ -1,5 +1,5 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "./list";
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "./list";
@@ -1,35 +1,35 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- @import "../style/index";
6
-
7
- @mixin uicore-expandable-blocks-list {
8
- > div {
9
- transition: margin var(--iui-duration-1) ease-in-out;
10
-
11
- > .iui-header {
12
- border-color: var(--iui-color-border);
13
- }
14
-
15
- &:first-child {
16
- > .iui-header {
17
- border-top-color: var(--iui-color-border);
18
- }
19
- }
20
- }
21
-
22
- > .iui-expanded + div {
23
- > .iui-header {
24
- border-top-color: var(--iui-color-border);
25
- }
26
-
27
- &.iui-expanded > .iui-header {
28
- border-top-color: var(--iui-color-border-accent);
29
- }
30
- }
31
-
32
- > .iui-expanded + .iui-expanded {
33
- margin-top: 0;
34
- }
35
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "../style/index";
6
+
7
+ @mixin uicore-expandable-blocks-list {
8
+ > div {
9
+ transition: margin var(--iui-duration-1) ease-in-out;
10
+
11
+ > .iui-header {
12
+ border-color: var(--iui-color-border);
13
+ }
14
+
15
+ &:first-child {
16
+ > .iui-header {
17
+ border-top-color: var(--iui-color-border);
18
+ }
19
+ }
20
+ }
21
+
22
+ > .iui-expanded + div {
23
+ > .iui-header {
24
+ border-top-color: var(--iui-color-border);
25
+ }
26
+
27
+ &.iui-expanded > .iui-header {
28
+ border-top-color: var(--iui-color-border-accent);
29
+ }
30
+ }
31
+
32
+ > .iui-expanded + .iui-expanded {
33
+ margin-top: 0;
34
+ }
35
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ItemKeyboardNavigator.js","sourceRoot":"","sources":["../../../../src/core-react/focus/ItemKeyboardNavigator.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0DAA+D;AAC/D,sDAAmD;AAOnD;;GAEG;AACH,MAAa,qBAAqB;IAOhC,YAAmB,WAAoC,EAAS,cAAuC;QAApF,gBAAW,GAAX,WAAW,CAAyB;QAAS,mBAAc,GAAd,cAAc,CAAyB;QAL/F,eAAU,GAAG,CAAC,CAAC;QACf,iBAAY,GAAG,yBAAW,CAAC,UAAU,CAAC;QACtC,eAAU,GAAG,IAAI,CAAC;QAIxB,IAAI,CAAC,UAA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EAAE;oBACnB,IAAI,OAAO,KAAK,2BAAU,CAAC,SAAS,IAAI,OAAO,KAAK,2BAAU,CAAC,OAAO,EAAE;wBACtE,IAAI,CAAC,aAAa,EAAE,CAAC;qBACtB;yBAAM;wBACL,IAAI,CAAC,cAAc,EAAE,CAAC;qBACvB;iBACF;aACF;SACF;IACH,CAAC;IAEO,YAAY,CAAC,KAAa;QAChC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF;AA7ID,sDA6IC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,CAAC,IAAA,2BAAU,EAAC,GAAG,CAAC,IAAI,GAAG,KAAK,2BAAU,CAAC,IAAI,IAAI,GAAG,KAAK,2BAAU,CAAC,GAAG,IAAI,GAAG,KAAK,2BAAU,CAAC,KAAK,IAAI,GAAG,KAAK,2BAAU,CAAC,KAAK,CAAC,CAAC;AACxI,CAAC;AAFD,0CAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Focus\r\n */\r\n\r\nimport { isArrowKey, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { Orientation } from \"../enums/Orientation\";\r\n\r\n/** Cross-Axis Arrow Key Callback\r\n * @internal\r\n */\r\nexport type CrossAxisArrowKeyFunc = (forward: boolean) => void;\r\n\r\n/** Keyboard Navigator for parent components\r\n * @internal\r\n */\r\nexport class ItemKeyboardNavigator {\r\n private _direction: Map<string, number>;\r\n private _itemCount = 0;\r\n private _orientation = Orientation.Horizontal;\r\n private _allowWrap = true;\r\n private _crossAxisArrowKeyHandler?: CrossAxisArrowKeyFunc;\r\n\r\n constructor(public onFocusItem: (index: number) => void, public onActivateItem: (index: number) => void) {\r\n this._direction = new Map<string, number>([\r\n [SpecialKey.ArrowLeft, -1],\r\n [SpecialKey.ArrowUp, -1],\r\n [SpecialKey.ArrowRight, 1],\r\n [SpecialKey.ArrowDown, 1],\r\n ]);\r\n }\r\n\r\n /** The item count */\r\n public get itemCount(): number { return this._itemCount; }\r\n public set itemCount(count: number) { this._itemCount = count; }\r\n\r\n /** The primary orientation */\r\n public get orientation(): Orientation { return this._orientation; }\r\n public set orientation(orientation: Orientation) { this._orientation = orientation; }\r\n\r\n /** The allow wrap property controls whether the movement will stop at the first and last items or wrap */\r\n public get allowWrap(): boolean { return this._allowWrap; }\r\n public set allowWrap(v: boolean) { this._allowWrap = v; }\r\n\r\n /** Called when the arrow keys that run perpendicular to the primary orientation are pressed */\r\n public get crossAxisArrowKeyHandler(): CrossAxisArrowKeyFunc | undefined { return this._crossAxisArrowKeyHandler; }\r\n public set crossAxisArrowKeyHandler(v: CrossAxisArrowKeyFunc | undefined) { this._crossAxisArrowKeyHandler = v; }\r\n\r\n /** Handle KeyDown on items */\r\n public handleKeyDownEvent(event: React.KeyboardEvent, index: number): void {\r\n const key = event.key;\r\n\r\n switch (key) {\r\n case SpecialKey.Home:\r\n event.preventDefault();\r\n // Activate first item\r\n this.focusFirstItem();\r\n break;\r\n case SpecialKey.End:\r\n event.preventDefault();\r\n // Activate last item\r\n this.focusLastItem();\r\n break;\r\n\r\n // Up and down are in keydown\r\n // because we need to prevent page scroll >:)\r\n case SpecialKey.ArrowUp:\r\n case SpecialKey.ArrowDown:\r\n this.determineOrientation(event, index);\r\n break;\r\n\r\n case SpecialKey.Enter:\r\n case SpecialKey.Space:\r\n this.activateItem(index);\r\n break;\r\n }\r\n }\r\n\r\n /** Handle KeyUp on items */\r\n public handleKeyUpEvent(event: React.KeyboardEvent, index: number): void {\r\n const key = event.key;\r\n\r\n switch (key) {\r\n case SpecialKey.ArrowLeft:\r\n case SpecialKey.ArrowRight:\r\n this.determineOrientation(event, index);\r\n break;\r\n }\r\n }\r\n\r\n private focusFirstItem(): void {\r\n this.onFocusItem(0);\r\n }\r\n\r\n private focusLastItem(): void {\r\n const index = this._itemCount - 1;\r\n this.onFocusItem(index);\r\n }\r\n\r\n /** When an item list's orientation is set to vertical,\r\n * only up and down arrow should function.\r\n * In all other cases only left and right arrow function.\r\n */\r\n private determineOrientation(event: React.KeyboardEvent, index: number): void {\r\n const key = event.key;\r\n const vertical = this._orientation === Orientation.Vertical;\r\n let proceed = false;\r\n\r\n if (vertical) {\r\n if (key === SpecialKey.ArrowUp || key === SpecialKey.ArrowDown) {\r\n event.preventDefault();\r\n proceed = true;\r\n } else if (this.crossAxisArrowKeyHandler && (key === SpecialKey.ArrowLeft || key === SpecialKey.ArrowRight)) {\r\n this.crossAxisArrowKeyHandler(key === SpecialKey.ArrowRight);\r\n }\r\n } else {\r\n if (key === SpecialKey.ArrowLeft || key === SpecialKey.ArrowRight) {\r\n proceed = true;\r\n } else if (this.crossAxisArrowKeyHandler && (key === SpecialKey.ArrowUp || key === SpecialKey.ArrowDown)) {\r\n this.crossAxisArrowKeyHandler(key === SpecialKey.ArrowDown);\r\n }\r\n }\r\n\r\n if (proceed) {\r\n this.switchItemOnArrowPress(event, index);\r\n }\r\n }\r\n\r\n /** Either focus the next, previous, first, or last item depending on key pressed\r\n */\r\n private switchItemOnArrowPress(event: React.KeyboardEvent, index: number): void {\r\n // Add or subtract depending on key pressed\r\n const pressed = event.key;\r\n const targetDirection = this._direction.get(pressed);\r\n\r\n // istanbul ignore else\r\n if (targetDirection) {\r\n const newIndex = index + targetDirection;\r\n\r\n if (0 <= newIndex && newIndex < this._itemCount) {\r\n this.onFocusItem(newIndex);\r\n } else {\r\n // istanbul ignore else\r\n if (this._allowWrap) {\r\n if (pressed === SpecialKey.ArrowLeft || pressed === SpecialKey.ArrowUp) {\r\n this.focusLastItem();\r\n } else {\r\n this.focusFirstItem();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private activateItem(index: number): void {\r\n this.onActivateItem(index);\r\n }\r\n}\r\n\r\n/** Determines if a KeyboardEvent.key is an Item Navigation key\r\n * @internal\r\n */\r\nexport function isNavigationKey(key: string): boolean {\r\n return (isArrowKey(key) || key === SpecialKey.Home || key === SpecialKey.End || key === SpecialKey.Space || key === SpecialKey.Enter);\r\n}\r\n"]}
1
+ {"version":3,"file":"ItemKeyboardNavigator.js","sourceRoot":"","sources":["../../../../src/core-react/focus/ItemKeyboardNavigator.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0DAA+D;AAC/D,sDAAmD;AAOnD;;GAEG;AACH,MAAa,qBAAqB;IAOhC,YAAmB,WAAoC,EAAS,cAAuC;QAApF,gBAAW,GAAX,WAAW,CAAyB;QAAS,mBAAc,GAAd,cAAc,CAAyB;QAL/F,eAAU,GAAG,CAAC,CAAC;QACf,iBAAY,GAAG,yBAAW,CAAC,UAAU,CAAC;QACtC,eAAU,GAAG,IAAI,CAAC;QAIxB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,CAAiB;YACxC,CAAC,2BAAU,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YAC1B,CAAC,2BAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACxB,CAAC,2BAAU,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1B,CAAC,2BAAU,CAAC,SAAS,EAAE,CAAC,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB;IACrB,IAAW,SAAS,KAAa,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1D,IAAW,SAAS,CAAC,KAAa,IAAI,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC;IAEhE,8BAA8B;IAC9B,IAAW,WAAW,KAAkB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACnE,IAAW,WAAW,CAAC,WAAwB,IAAI,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC;IAErF,2GAA2G;IAC3G,IAAW,SAAS,KAAc,OAAO,IAAI,CAAC,UAAU,CAA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I,OAAO,EAAE;YACX,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SAC3C;IACH,CAAC;IAED;OACG;IACK,sBAAsB,CAAC,KAA0B,EAAE,KAAa;QACtE,2CAA2C;QAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC;QAC1B,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAErD,uBAAuB;QACvB,IAAI,eAAe,EAAE;YACnB,MAAM,QAAQ,GAAG,KAAK,GAAG,eAAe,CAAC;YAEzC,IAAI,CAAC,IAAI,QAAQ,IAAI,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE;gBAC/C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;aAC5B;iBAAM;gBACL,uBAAuB;gBACvB,IAAI,IAAI,CAAC,UAAU,EAAE;oBACnB,IAAI,OAAO,KAAK,2BAAU,CAAC,SAAS,IAAI,OAAO,KAAK,2BAAU,CAAC,OAAO,EAAE;wBACtE,IAAI,CAAC,aAAa,EAAE,CAAC;qBACtB;yBAAM;wBACL,IAAI,CAAC,cAAc,EAAE,CAAC;qBACvB;iBACF;aACF;SACF;IACH,CAAC;IAEO,YAAY,CAAC,KAAa;QAChC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF;AA7ID,sDA6IC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,CAAC,IAAA,2BAAU,EAAC,GAAG,CAAC,IAAI,GAAG,KAAK,2BAAU,CAAC,IAAI,IAAI,GAAG,KAAK,2BAAU,CAAC,GAAG,IAAI,GAAG,KAAK,2BAAU,CAAC,KAAK,IAAI,GAAG,KAAK,2BAAU,CAAC,KAAK,CAAC,CAAC;AACxI,CAAC;AAFD,0CAEC","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 Focus\n */\n\nimport { isArrowKey, SpecialKey } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"../enums/Orientation\";\n\n/** Cross-Axis Arrow Key Callback\n * @internal\n */\nexport type CrossAxisArrowKeyFunc = (forward: boolean) => void;\n\n/** Keyboard Navigator for parent components\n * @internal\n */\nexport class ItemKeyboardNavigator {\n private _direction: Map<string, number>;\n private _itemCount = 0;\n private _orientation = Orientation.Horizontal;\n private _allowWrap = true;\n private _crossAxisArrowKeyHandler?: CrossAxisArrowKeyFunc;\n\n constructor(public onFocusItem: (index: number) => void, public onActivateItem: (index: number) => void) {\n this._direction = new Map<string, number>([\n [SpecialKey.ArrowLeft, -1],\n [SpecialKey.ArrowUp, -1],\n [SpecialKey.ArrowRight, 1],\n [SpecialKey.ArrowDown, 1],\n ]);\n }\n\n /** The item count */\n public get itemCount(): number { return this._itemCount; }\n public set itemCount(count: number) { this._itemCount = count; }\n\n /** The primary orientation */\n public get orientation(): Orientation { return this._orientation; }\n public set orientation(orientation: Orientation) { this._orientation = orientation; }\n\n /** The allow wrap property controls whether the movement will stop at the first and last items or wrap */\n public get allowWrap(): boolean { return this._allowWrap; }\n public set allowWrap(v: boolean) { this._allowWrap = v; }\n\n /** Called when the arrow keys that run perpendicular to the primary orientation are pressed */\n public get crossAxisArrowKeyHandler(): CrossAxisArrowKeyFunc | undefined { return this._crossAxisArrowKeyHandler; }\n public set crossAxisArrowKeyHandler(v: CrossAxisArrowKeyFunc | undefined) { this._crossAxisArrowKeyHandler = v; }\n\n /** Handle KeyDown on items */\n public handleKeyDownEvent(event: React.KeyboardEvent, index: number): void {\n const key = event.key;\n\n switch (key) {\n case SpecialKey.Home:\n event.preventDefault();\n // Activate first item\n this.focusFirstItem();\n break;\n case SpecialKey.End:\n event.preventDefault();\n // Activate last item\n this.focusLastItem();\n break;\n\n // Up and down are in keydown\n // because we need to prevent page scroll >:)\n case SpecialKey.ArrowUp:\n case SpecialKey.ArrowDown:\n this.determineOrientation(event, index);\n break;\n\n case SpecialKey.Enter:\n case SpecialKey.Space:\n this.activateItem(index);\n break;\n }\n }\n\n /** Handle KeyUp on items */\n public handleKeyUpEvent(event: React.KeyboardEvent, index: number): void {\n const key = event.key;\n\n switch (key) {\n case SpecialKey.ArrowLeft:\n case SpecialKey.ArrowRight:\n this.determineOrientation(event, index);\n break;\n }\n }\n\n private focusFirstItem(): void {\n this.onFocusItem(0);\n }\n\n private focusLastItem(): void {\n const index = this._itemCount - 1;\n this.onFocusItem(index);\n }\n\n /** When an item list's orientation is set to vertical,\n * only up and down arrow should function.\n * In all other cases only left and right arrow function.\n */\n private determineOrientation(event: React.KeyboardEvent, index: number): void {\n const key = event.key;\n const vertical = this._orientation === Orientation.Vertical;\n let proceed = false;\n\n if (vertical) {\n if (key === SpecialKey.ArrowUp || key === SpecialKey.ArrowDown) {\n event.preventDefault();\n proceed = true;\n } else if (this.crossAxisArrowKeyHandler && (key === SpecialKey.ArrowLeft || key === SpecialKey.ArrowRight)) {\n this.crossAxisArrowKeyHandler(key === SpecialKey.ArrowRight);\n }\n } else {\n if (key === SpecialKey.ArrowLeft || key === SpecialKey.ArrowRight) {\n proceed = true;\n } else if (this.crossAxisArrowKeyHandler && (key === SpecialKey.ArrowUp || key === SpecialKey.ArrowDown)) {\n this.crossAxisArrowKeyHandler(key === SpecialKey.ArrowDown);\n }\n }\n\n if (proceed) {\n this.switchItemOnArrowPress(event, index);\n }\n }\n\n /** Either focus the next, previous, first, or last item depending on key pressed\n */\n private switchItemOnArrowPress(event: React.KeyboardEvent, index: number): void {\n // Add or subtract depending on key pressed\n const pressed = event.key;\n const targetDirection = this._direction.get(pressed);\n\n // istanbul ignore else\n if (targetDirection) {\n const newIndex = index + targetDirection;\n\n if (0 <= newIndex && newIndex < this._itemCount) {\n this.onFocusItem(newIndex);\n } else {\n // istanbul ignore else\n if (this._allowWrap) {\n if (pressed === SpecialKey.ArrowLeft || pressed === SpecialKey.ArrowUp) {\n this.focusLastItem();\n } else {\n this.focusFirstItem();\n }\n }\n }\n }\n }\n\n private activateItem(index: number): void {\n this.onActivateItem(index);\n }\n}\n\n/** Determines if a KeyboardEvent.key is an Item Navigation key\n * @internal\n */\nexport function isNavigationKey(key: string): boolean {\n return (isArrowKey(key) || key === SpecialKey.Home || key === SpecialKey.End || key === SpecialKey.Space || key === SpecialKey.Enter);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FocusTrap.js","sourceRoot":"","sources":["../../../../src/core-react/focustrap/FocusTrap.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,sDAA6C;AAC7C,sCAAmC;AAEnC,0BAA0B;AAE1B,SAAS,WAAW,CAAC,OAAoB;IACvC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC;QAClC,OAAO,KAAK,CAAC;IAEf,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,gCAAgC,CAAC;QACnF,OAAO,KAAK,CAAC;IAEf,IAAI,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,OAAO,CAAC,YAAY,KAAK,UAAU,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI;QACnH,OAAO,KAAK,CAAC;IAEf,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;QAC/F,OAAO,IAAI,CAAC;IAEd,QAAQ,OAAO,CAAC,QAAQ,EAAE;QACxB,KAAK,GAAG;YACN,MAAM,aAAa,GAAG,OAA4B,CAAC;YACnD,OAAO,CAAC,CAAC,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC,GAAG,KAAK,QAAQ,CAAC;Q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KAAuC,EAAE,EAAE;QACtF,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC,MAAM;YACf,OAAO;QAET,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,uBAAuB;QACvB,IAAI,mBAAmB,CAAC,OAAO,IAAI,mBAAmB,CAAC,OAAO,KAAK,QAAQ,CAAC,aAAa;YACtF,mBAAmB,CAAC,OAAuB,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnB,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,IAAI,CAAC;IACd,OAAO,CACL;QAEE,4CAAiB,gBAAgB,EAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;YAC1F,gEAAgE;YAChE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,IACnE,KAAK,CAAC,QAAQ,CACX;QAEN,4CAAiB,sBAAsB,EAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,GAAI,CAClF,CACJ,CAAC;AACJ,CAAC;AApFD,8BAoFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Popup\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { UiCore } from \"../UiCore\";\r\n\r\n// cSpell:ignore focusable\r\n\r\nfunction isFocusable(element: HTMLElement): boolean {\r\n if (!element || element.tabIndex < 0)\r\n return false;\r\n\r\n if (element.classList && element.classList.contains(\"core-focus-trap-ignore-initial\"))\r\n return false;\r\n\r\n if (element.getAttribute && (typeof element.getAttribute === \"function\") && element.getAttribute(\"disabled\") !== null)\r\n return false;\r\n\r\n if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute(\"tabIndex\") !== null))\r\n return true;\r\n\r\n switch (element.nodeName) {\r\n case \"A\":\r\n const anchorElement = element as HTMLAnchorElement;\r\n return !!anchorElement.href && anchorElement.rel !== \"ignore\";\r\n case \"INPUT\":\r\n const inputElement = element as HTMLInputElement;\r\n return inputElement.type !== \"hidden\" && inputElement.type !== \"file\";\r\n case \"BUTTON\":\r\n case \"SELECT\":\r\n case \"TEXTAREA\":\r\n return true;\r\n default:\r\n return false;\r\n }\r\n}\r\n\r\nfunction processFindFocusableDescendant(element: HTMLElement | null): HTMLElement | null {\r\n // istanbul ignore next\r\n if (!element)\r\n return null;\r\n\r\n for (const child of element.childNodes) {\r\n // istanbul ignore else\r\n if (isFocusable(child as HTMLElement))\r\n return child as HTMLElement;\r\n\r\n const focusable = processFindFocusableDescendant(child as HTMLElement);\r\n if (focusable)\r\n return focusable;\r\n }\r\n return null;\r\n}\r\n\r\nfunction findFirstFocusableDescendant(focusContainer: HTMLDivElement | null): HTMLElement | null {\r\n return processFindFocusableDescendant(focusContainer);\r\n}\r\n\r\nfunction processFindLastFocusableDescendant(element: HTMLElement): HTMLElement | null {\r\n for (let i = element.childNodes.length - 1; i >= 0; i--) {\r\n const child = element.childNodes[i] as HTMLElement;\r\n\r\n const focusable = processFindLastFocusableDescendant(child);\r\n // istanbul ignore else\r\n if (focusable)\r\n return focusable;\r\n\r\n // istanbul ignore else\r\n if (isFocusable(child))\r\n return child;\r\n }\r\n return null;\r\n}\r\n\r\nfunction findLastFocusableDescendant(focusContainer: HTMLDivElement): HTMLElement | null {\r\n return processFindLastFocusableDescendant(focusContainer);\r\n}\r\n\r\nfunction getInitialFocusElement(focusContainer: HTMLDivElement | null, initialFocusSpec: React.RefObject<HTMLElement> | string | undefined): HTMLElement | null {\r\n // istanbul ignore next\r\n if (!focusContainer)\r\n return null;\r\n\r\n if (initialFocusSpec) {\r\n if (typeof initialFocusSpec === \"string\") {\r\n const node = focusContainer.querySelector(initialFocusSpec);\r\n if (node) {\r\n return node as HTMLElement;\r\n } else {\r\n Logger.logError(`${UiCore.packageName}.FocusTrap`, `Unable to locate element via selector ${initialFocusSpec}`);\r\n }\r\n } else {\r\n return initialFocusSpec.current;\r\n }\r\n }\r\n return findFirstFocusableDescendant(focusContainer);\r\n}\r\n\r\nfunction attemptFocus(element: HTMLElement, preventScroll: boolean): boolean {\r\n // istanbul ignore next\r\n if (!isFocusable(element))\r\n return false;\r\n\r\n try {\r\n // istanbul ignore else\r\n if (document.activeElement !== element)\r\n element.focus({ preventScroll: preventScroll ? true : /* istanbul ignore next */ false });\r\n } catch (e) {\r\n // istanbul ignore next\r\n return false;\r\n }\r\n return (document.activeElement === element);\r\n} // end attemptFocus\r\n\r\n/** Focus into first focusable element of a container.\r\n * @internal\r\n */\r\nexport function focusIntoContainer(focusContainer: HTMLDivElement, initialFocusElement?: React.RefObject<HTMLElement> | string): boolean {\r\n let result = false;\r\n const focusElement = getInitialFocusElement(focusContainer, initialFocusElement);\r\n if (focusElement) {\r\n // delay setting focus immediately because in some browsers other focus events happen when popup is initially opened.\r\n setTimeout(() => {\r\n attemptFocus(focusElement, true);\r\n }, 60);\r\n result = true;\r\n }\r\n return result;\r\n}\r\n\r\n/** Properties supported by [[FocusTrap]] component.\r\n * @internal\r\n */\r\nexport interface FocusTrapProps extends React.AllHTMLAttributes<any> {\r\n /** child components */\r\n children: React.ReactNode;\r\n /** if active is not true then no trapping of focus is attempted. */\r\n active?: boolean;\r\n /** restore focus to element that had focus before trap was activated */\r\n returnFocusOnDeactivate: boolean;\r\n /** Optional reference to element to receive focus when trap is activated. Optionally a CSS Selector\r\n * string can be supplied to locate an element in the FocusTrap container. If no specification is defined\r\n * the first focusable element is used.\r\n */\r\n initialFocusElement?: React.RefObject<HTMLElement> | string;\r\n}\r\n\r\n/** Trap Focus in container while trap is active.\r\n * @internal\r\n */\r\nexport function FocusTrap(props: FocusTrapProps) {\r\n const restoreFocusElement = React.useRef<Element | null>(null);\r\n const initialFocusElement = React.useRef<Element | null>(null);\r\n const focusContainer = React.useRef<HTMLDivElement | null>(null);\r\n const isInitialMount = React.useRef(true);\r\n const timeoutRef = React.useRef<number | undefined>();\r\n\r\n // Run on initial mount and when dependencies change. which could happen often.\r\n React.useEffect(() => {\r\n // istanbul ignore else\r\n if (isInitialMount.current) {\r\n isInitialMount.current = false;\r\n if (props.active) {\r\n if (props.returnFocusOnDeactivate) {\r\n restoreFocusElement.current = document.activeElement;\r\n }\r\n\r\n initialFocusElement.current = getInitialFocusElement(focusContainer.current, props.initialFocusElement);\r\n if (initialFocusElement.current) {\r\n // delay setting focus immediately because in some browsers other focus events happen when popup is initially opened.\r\n timeoutRef.current = window.setTimeout(() => {\r\n attemptFocus((initialFocusElement.current as HTMLElement), true);\r\n }, 60);\r\n }\r\n }\r\n }\r\n }, [props.children, props.initialFocusElement, props.active, props.returnFocusOnDeactivate]);\r\n\r\n // Return function to run only when FocusTrap is unmounted to restore focus\r\n React.useEffect(() => {\r\n return () => {\r\n window.clearTimeout(timeoutRef.current);\r\n if (restoreFocusElement.current)\r\n (restoreFocusElement.current as HTMLElement).focus({ preventScroll: true });\r\n };\r\n }, []);\r\n\r\n // this is hit if Shift tab is used.\r\n const cycleFocusToEnd = React.useCallback((event: React.FocusEvent<HTMLDivElement>) => {\r\n // istanbul ignore next\r\n if (!props.active)\r\n return;\r\n\r\n if (focusContainer.current && event.target === focusContainer.current) {\r\n event.stopPropagation();\r\n event.preventDefault();\r\n const focusable = findLastFocusableDescendant(focusContainer.current);\r\n\r\n // istanbul ignore else\r\n if (focusable) {\r\n focusable.focus();\r\n } else {\r\n if (initialFocusElement.current && initialFocusElement.current !== document.activeElement)\r\n attemptFocus((initialFocusElement.current as HTMLElement), true);\r\n }\r\n }\r\n }, [props.active]);\r\n\r\n // this is hit if tab is used on last focusable item in child container.\r\n const cycleFocusToStart = React.useCallback((event: React.FocusEvent<HTMLDivElement>) => {\r\n // istanbul ignore next\r\n if (!props.active)\r\n return;\r\n\r\n event.stopPropagation();\r\n // istanbul ignore else\r\n if (initialFocusElement.current && initialFocusElement.current !== document.activeElement)\r\n (initialFocusElement.current as HTMLElement).focus();\r\n }, [props.active]);\r\n\r\n if (!props.children)\r\n return null;\r\n return (\r\n <>\r\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\r\n <div data-testid=\"focus-trap-div\" onFocus={cycleFocusToEnd} ref={focusContainer} tabIndex={0}\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n style={{ outline: \"none\", WebkitTapHighlightColor: \"rgba(0,0,0,0)\" }}>\r\n {props.children}\r\n </div>\r\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\r\n <div data-testid=\"focus-trap-limit-div\" onFocus={cycleFocusToStart} tabIndex={0} />\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"FocusTrap.js","sourceRoot":"","sources":["../../../../src/core-react/focustrap/FocusTrap.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,sDAA6C;AAC7C,sCAAmC;AAEnC,0BAA0B;AAE1B,SAAS,WAAW,CAAC,OAAoB;IACvC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC;QAClC,OAAO,KAAK,CAAC;IAEf,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,gCAAgC,CAAC;QACnF,OAAO,KAAK,CAAC;IAEf,IAAI,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,OAAO,CAAC,YAAY,KAAK,UAAU,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI;QACnH,OAAO,KAAK,CAAC;IAEf,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU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AK,QAAQ,CAAC,aAAa;oBACvF,YAAY,CAAE,mBAAmB,CAAC,OAAuB,EAAE,IAAI,CAAC,CAAC;aACpE;SACF;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnB,wEAAwE;IACxE,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAuC,EAAE,EAAE;QACtF,uBAAuB;QACvB,IAAI,CAAC,KAAK,CAAC,MAAM;YACf,OAAO;QAET,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,uBAAuB;QACvB,IAAI,mBAAmB,CAAC,OAAO,IAAI,mBAAmB,CAAC,OAAO,KAAK,QAAQ,CAAC,aAAa;YACtF,mBAAmB,CAAC,OAAuB,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnB,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,IAAI,CAAC;IACd,OAAO,CACL;QAEE,4CAAiB,gBAAgB,EAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;YAC1F,gEAAgE;YAChE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,eAAe,EAAE,IACnE,KAAK,CAAC,QAAQ,CACX;QAEN,4CAAiB,sBAAsB,EAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,GAAI,CAClF,CACJ,CAAC;AACJ,CAAC;AApFD,8BAoFC","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 Popup\n */\n\nimport * as React from \"react\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport { UiCore } from \"../UiCore\";\n\n// cSpell:ignore focusable\n\nfunction isFocusable(element: HTMLElement): boolean {\n if (!element || element.tabIndex < 0)\n return false;\n\n if (element.classList && element.classList.contains(\"core-focus-trap-ignore-initial\"))\n return false;\n\n if (element.getAttribute && (typeof element.getAttribute === \"function\") && element.getAttribute(\"disabled\") !== null)\n return false;\n\n if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute(\"tabIndex\") !== null))\n return true;\n\n switch (element.nodeName) {\n case \"A\":\n const anchorElement = element as HTMLAnchorElement;\n return !!anchorElement.href && anchorElement.rel !== \"ignore\";\n case \"INPUT\":\n const inputElement = element as HTMLInputElement;\n return inputElement.type !== \"hidden\" && inputElement.type !== \"file\";\n case \"BUTTON\":\n case \"SELECT\":\n case \"TEXTAREA\":\n return true;\n default:\n return false;\n }\n}\n\nfunction processFindFocusableDescendant(element: HTMLElement | null): HTMLElement | null {\n // istanbul ignore next\n if (!element)\n return null;\n\n for (const child of element.childNodes) {\n // istanbul ignore else\n if (isFocusable(child as HTMLElement))\n return child as HTMLElement;\n\n const focusable = processFindFocusableDescendant(child as HTMLElement);\n if (focusable)\n return focusable;\n }\n return null;\n}\n\nfunction findFirstFocusableDescendant(focusContainer: HTMLDivElement | null): HTMLElement | null {\n return processFindFocusableDescendant(focusContainer);\n}\n\nfunction processFindLastFocusableDescendant(element: HTMLElement): HTMLElement | null {\n for (let i = element.childNodes.length - 1; i >= 0; i--) {\n const child = element.childNodes[i] as HTMLElement;\n\n const focusable = processFindLastFocusableDescendant(child);\n // istanbul ignore else\n if (focusable)\n return focusable;\n\n // istanbul ignore else\n if (isFocusable(child))\n return child;\n }\n return null;\n}\n\nfunction findLastFocusableDescendant(focusContainer: HTMLDivElement): HTMLElement | null {\n return processFindLastFocusableDescendant(focusContainer);\n}\n\nfunction getInitialFocusElement(focusContainer: HTMLDivElement | null, initialFocusSpec: React.RefObject<HTMLElement> | string | undefined): HTMLElement | null {\n // istanbul ignore next\n if (!focusContainer)\n return null;\n\n if (initialFocusSpec) {\n if (typeof initialFocusSpec === \"string\") {\n const node = focusContainer.querySelector(initialFocusSpec);\n if (node) {\n return node as HTMLElement;\n } else {\n Logger.logError(`${UiCore.packageName}.FocusTrap`, `Unable to locate element via selector ${initialFocusSpec}`);\n }\n } else {\n return initialFocusSpec.current;\n }\n }\n return findFirstFocusableDescendant(focusContainer);\n}\n\nfunction attemptFocus(element: HTMLElement, preventScroll: boolean): boolean {\n // istanbul ignore next\n if (!isFocusable(element))\n return false;\n\n try {\n // istanbul ignore else\n if (document.activeElement !== element)\n element.focus({ preventScroll: preventScroll ? true : /* istanbul ignore next */ false });\n } catch (e) {\n // istanbul ignore next\n return false;\n }\n return (document.activeElement === element);\n} // end attemptFocus\n\n/** Focus into first focusable element of a container.\n * @internal\n */\nexport function focusIntoContainer(focusContainer: HTMLDivElement, initialFocusElement?: React.RefObject<HTMLElement> | string): boolean {\n let result = false;\n const focusElement = getInitialFocusElement(focusContainer, initialFocusElement);\n if (focusElement) {\n // delay setting focus immediately because in some browsers other focus events happen when popup is initially opened.\n setTimeout(() => {\n attemptFocus(focusElement, true);\n }, 60);\n result = true;\n }\n return result;\n}\n\n/** Properties supported by [[FocusTrap]] component.\n * @internal\n */\nexport interface FocusTrapProps extends React.AllHTMLAttributes<any> {\n /** child components */\n children: React.ReactNode;\n /** if active is not true then no trapping of focus is attempted. */\n active?: boolean;\n /** restore focus to element that had focus before trap was activated */\n returnFocusOnDeactivate: boolean;\n /** Optional reference to element to receive focus when trap is activated. Optionally a CSS Selector\n * string can be supplied to locate an element in the FocusTrap container. If no specification is defined\n * the first focusable element is used.\n */\n initialFocusElement?: React.RefObject<HTMLElement> | string;\n}\n\n/** Trap Focus in container while trap is active.\n * @internal\n */\nexport function FocusTrap(props: FocusTrapProps) {\n const restoreFocusElement = React.useRef<Element | null>(null);\n const initialFocusElement = React.useRef<Element | null>(null);\n const focusContainer = React.useRef<HTMLDivElement | null>(null);\n const isInitialMount = React.useRef(true);\n const timeoutRef = React.useRef<number | undefined>();\n\n // Run on initial mount and when dependencies change. which could happen often.\n React.useEffect(() => {\n // istanbul ignore else\n if (isInitialMount.current) {\n isInitialMount.current = false;\n if (props.active) {\n if (props.returnFocusOnDeactivate) {\n restoreFocusElement.current = document.activeElement;\n }\n\n initialFocusElement.current = getInitialFocusElement(focusContainer.current, props.initialFocusElement);\n if (initialFocusElement.current) {\n // delay setting focus immediately because in some browsers other focus events happen when popup is initially opened.\n timeoutRef.current = window.setTimeout(() => {\n attemptFocus((initialFocusElement.current as HTMLElement), true);\n }, 60);\n }\n }\n }\n }, [props.children, props.initialFocusElement, props.active, props.returnFocusOnDeactivate]);\n\n // Return function to run only when FocusTrap is unmounted to restore focus\n React.useEffect(() => {\n return () => {\n window.clearTimeout(timeoutRef.current);\n if (restoreFocusElement.current)\n (restoreFocusElement.current as HTMLElement).focus({ preventScroll: true });\n };\n }, []);\n\n // this is hit if Shift tab is used.\n const cycleFocusToEnd = React.useCallback((event: React.FocusEvent<HTMLDivElement>) => {\n // istanbul ignore next\n if (!props.active)\n return;\n\n if (focusContainer.current && event.target === focusContainer.current) {\n event.stopPropagation();\n event.preventDefault();\n const focusable = findLastFocusableDescendant(focusContainer.current);\n\n // istanbul ignore else\n if (focusable) {\n focusable.focus();\n } else {\n if (initialFocusElement.current && initialFocusElement.current !== document.activeElement)\n attemptFocus((initialFocusElement.current as HTMLElement), true);\n }\n }\n }, [props.active]);\n\n // this is hit if tab is used on last focusable item in child container.\n const cycleFocusToStart = React.useCallback((event: React.FocusEvent<HTMLDivElement>) => {\n // istanbul ignore next\n if (!props.active)\n return;\n\n event.stopPropagation();\n // istanbul ignore else\n if (initialFocusElement.current && initialFocusElement.current !== document.activeElement)\n (initialFocusElement.current as HTMLElement).focus();\n }, [props.active]);\n\n if (!props.children)\n return null;\n return (\n <>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div data-testid=\"focus-trap-div\" onFocus={cycleFocusToEnd} ref={focusContainer} tabIndex={0}\n // eslint-disable-next-line @typescript-eslint/naming-convention\n style={{ outline: \"none\", WebkitTapHighlightColor: \"rgba(0,0,0,0)\" }}>\n {props.children}\n </div>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div data-testid=\"focus-trap-limit-div\" onFocus={cycleFocusToStart} tabIndex={0} />\n </>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withIsPressed.js","sourceRoot":"","sources":["../../../../src/core-react/hocs/withIsPressed.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAY/B;;GAEG;AACI,MAAM,aAAa,GAAG;AAC3B,gEAAgE;AAChE,SAA8C,EAC9C,EAAE;IACF,OAAO,MAAM,aAAc,SAAQ,KAAK,CAAC,aAAkD;QAApF;;YACE,wBAAmB,GAAG,GAAG,EAAE;gBAChC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC,CAAC;YAEK,sBAAiB,GAAG,GAAG,EAAE;gBAC9B,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC;YAEK,uBAAkB,GAAG,GAAG,EAAE;gBAC/B,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC;YAEK,oBAAe,GAAG,CAAC,SAAkB,EAAE,EAAE;gBAC9C,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS;oBACpC,OAAO;gBAET,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAC1E,CAAC,CAAC;QAkBJ,CAAC;QAhBiB,MAAM;YACpB,6DAA6D;YAC7D,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,2DAA2D;YAC1H,OAAO;YACL,mEAAmE;YACnE,6BAAK,SAAS,EAAC,uBAAuB,EACpC,WAAW,EAAE,IAAI,CAAC,mBAAmB,EACrC,SAAS,EAAE,IAAI,CAAC,iBAAiB,EACjC,YAAY,EAAE,IAAI,CAAC,mBAAmB,EACtC,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAClC,YAAY,EAAE,IAAI,CAAC,kBAAkB;gBAErC,oBAAC,SAAS,OAAK,KAAuB,KAAM,IAAI,CAAC,KAAK,GAAI,CACtD,CACP,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAzCW,QAAA,aAAa,iBAyCxB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\n/** Properties for [[withIsPressed]] React higher-order component\r\n * @public\r\n */\r\nexport interface WithIsPressedProps {\r\n /** initial value for pressed status */\r\n isPressed?: boolean;\r\n /** callback function for [isPressed] change */\r\n onIsPressedChange?: (isPressed: boolean) => void;\r\n}\r\n\r\n/** withIsPressed is a React higher-order component that adds pointer and mouse events.\r\n * @public\r\n */\r\nexport const withIsPressed = <ComponentProps extends {}>(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Component: React.ComponentType<ComponentProps>,\r\n) => {\r\n return class WithIsPressed extends React.PureComponent<ComponentProps & WithIsPressedProps> {\r\n public handleOnPointerDown = () => {\r\n this.changeIsPressed(true);\r\n };\r\n\r\n public handleOnPointerUp = () => {\r\n this.changeIsPressed(false);\r\n };\r\n\r\n public handleOnMouseLeave = () => {\r\n this.changeIsPressed(false);\r\n };\r\n\r\n public changeIsPressed = (isPressed: boolean) => {\r\n if (this.props.isPressed === isPressed)\r\n return;\r\n\r\n this.props.onIsPressedChange && this.props.onIsPressedChange(isPressed);\r\n };\r\n\r\n public override render() {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const { isPressed, onIsPressedChange, ...props } = this.props; // todo: better solution to rest object of intersected type\r\n return (\r\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\r\n <div className=\"withispressed-wrapper\"\r\n onMouseDown={this.handleOnPointerDown}\r\n onMouseUp={this.handleOnPointerUp}\r\n onTouchStart={this.handleOnPointerDown}\r\n onTouchEnd={this.handleOnPointerUp}\r\n onMouseLeave={this.handleOnMouseLeave}\r\n >\r\n <Component {...props as ComponentProps} {...this.state} />\r\n </div>\r\n );\r\n }\r\n };\r\n};\r\n"]}
1
+ {"version":3,"file":"withIsPressed.js","sourceRoot":"","sources":["../../../../src/core-react/hocs/withIsPressed.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAY/B;;GAEG;AACI,MAAM,aAAa,GAAG;AAC3B,gEAAgE;AAChE,SAA8C,EAC9C,EAAE;IACF,OAAO,MAAM,aAAc,SAAQ,KAAK,CAAC,aAAkD;QAApF;;YACE,wBAAmB,GAAG,GAAG,EAAE;gBAChC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC,CAAC;YAEK,sBAAiB,GAAG,GAAG,EAAE;gBAC9B,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC;YAEK,uBAAkB,GAAG,GAAG,EAAE;gBAC/B,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC;YAEK,oBAAe,GAAG,CAAC,SAAkB,EAAE,EAAE;gBAC9C,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS;oBACpC,OAAO;gBAET,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;YAC1E,CAAC,CAAC;QAkBJ,CAAC;QAhBiB,MAAM;YACpB,6DAA6D;YAC7D,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,2DAA2D;YAC1H,OAAO;YACL,mEAAmE;YACnE,6BAAK,SAAS,EAAC,uBAAuB,EACpC,WAAW,EAAE,IAAI,CAAC,mBAAmB,EACrC,SAAS,EAAE,IAAI,CAAC,iBAAiB,EACjC,YAAY,EAAE,IAAI,CAAC,mBAAmB,EACtC,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAClC,YAAY,EAAE,IAAI,CAAC,kBAAkB;gBAErC,oBAAC,SAAS,OAAK,KAAuB,KAAM,IAAI,CAAC,KAAK,GAAI,CACtD,CACP,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAzCW,QAAA,aAAa,iBAyCxB","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 Common\n */\n\nimport * as React from \"react\";\n\n/** Properties for [[withIsPressed]] React higher-order component\n * @public\n */\nexport interface WithIsPressedProps {\n /** initial value for pressed status */\n isPressed?: boolean;\n /** callback function for [isPressed] change */\n onIsPressedChange?: (isPressed: boolean) => void;\n}\n\n/** withIsPressed is a React higher-order component that adds pointer and mouse events.\n * @public\n */\nexport const withIsPressed = <ComponentProps extends {}>(\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Component: React.ComponentType<ComponentProps>,\n) => {\n return class WithIsPressed extends React.PureComponent<ComponentProps & WithIsPressedProps> {\n public handleOnPointerDown = () => {\n this.changeIsPressed(true);\n };\n\n public handleOnPointerUp = () => {\n this.changeIsPressed(false);\n };\n\n public handleOnMouseLeave = () => {\n this.changeIsPressed(false);\n };\n\n public changeIsPressed = (isPressed: boolean) => {\n if (this.props.isPressed === isPressed)\n return;\n\n this.props.onIsPressedChange && this.props.onIsPressedChange(isPressed);\n };\n\n public override render() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { isPressed, onIsPressedChange, ...props } = this.props; // todo: better solution to rest object of intersected type\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div className=\"withispressed-wrapper\"\n onMouseDown={this.handleOnPointerDown}\n onMouseUp={this.handleOnPointerUp}\n onTouchStart={this.handleOnPointerDown}\n onTouchEnd={this.handleOnPointerUp}\n onMouseLeave={this.handleOnMouseLeave}\n >\n <Component {...props as ComponentProps} {...this.state} />\n </div>\n );\n }\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"withOnOutsideClick.js","sourceRoot":"","sources":["../../../../src/core-react/hocs/withOnOutsideClick.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAY/B;;GAEG;AACI,MAAM,kBAAkB,GAAG;AAChC,gEAAgE;AAChE,SAA8C,EAC9C,qBAAkD,EAClD,aAAsB,IAAI,EAC1B,mBAA4B,IAAI,EAChC,EAAE;IACF,OAAO,MAAM,kBAAmB,SAAQ,KAAK,CAAC,aAAuD;QAA9F;;YACL,gBAAgB;YACT,6BAAwB,GAA2B,IAAI,CAAC;YAC/D,gBAAgB;YACT,kBAAa,GAAG,KAAK,CAAC;YAgC7B,gBAAgB;YACT,wBAAmB,GAAG,CAAC,CAAa,EAAE,EAAE;gBAC7C,IAAI,CAAC,IAAI,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;oBACnH,OAAO;gBAET,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC,CAAC;YAEF,gBAAgB;YACT,8BAAyB,GAAG,CAAC,CAAe,EAAE,EAAE;gBACrD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;gBAC1B,uBAAuB;gBACvB,IAAI,IAAI,CAAC,wBAAwB,EAAE;oB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BAAyB,EAAE,UAAU,CAAC,CAAC;gBAC1G,0BAA0B,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;aACvG;;gBACC,0BAA0B,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QAClG,CAAC;QAEe,MAAM;YACpB,MAAM,EAAE,cAAc,EAAE,8BAA8B,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,wDAAwD;YACzI,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,iCAAiC;gBAC9C,oBAAC,SAAS,OAAK,KAAuB,GAAI,CACtC,CACP,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAhHW,QAAA,kBAAkB,sBAgH7B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\n/** Properties for [[withOnOutsideClick]] React higher-order component\r\n * @public\r\n */\r\nexport interface WithOnOutsideClickProps {\r\n /** Outside click callback function */\r\n onOutsideClick?: (event: MouseEvent) => any;\r\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\r\n closeOnNestedPopupOutsideClick?: boolean;\r\n}\r\n\r\n/** withOnOutsideClick is a React higher-order component that adds outside click support.\r\n * @public\r\n */\r\nexport const withOnOutsideClick = <ComponentProps extends {}>(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Component: React.ComponentType<ComponentProps>,\r\n defaultOnOutsideClick?: (event: MouseEvent) => any,\r\n useCapture: boolean = true,\r\n usePointerEvents: boolean = true,\r\n) => {\r\n return class WithOnOutsideClick extends React.PureComponent<ComponentProps & WithOnOutsideClickProps> {\r\n /** @internal */\r\n public outsideClickContainerDiv?: HTMLDivElement | null = null;\r\n /** @internal */\r\n public isDownOutside = false;\r\n\r\n /** @internal */\r\n public isInCorePopup(element: HTMLElement): boolean {\r\n if (element.nodeName === \"DIV\") {\r\n if (element.classList && element.classList.contains(\"core-popup\"))\r\n return true;\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n } else {\r\n // istanbul ignore else\r\n if (element.parentElement && this.isInCorePopup(element.parentElement))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public onOutsideClick(e: MouseEvent) {\r\n // istanbul ignore else\r\n if (e.target instanceof Node && e.target.nodeType === Node.ELEMENT_NODE) {\r\n // istanbul ignore else\r\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(e.target as HTMLElement))\r\n return;\r\n }\r\n\r\n if (this.props.onOutsideClick)\r\n return this.props.onOutsideClick(e);\r\n else if (defaultOnOutsideClick)\r\n return defaultOnOutsideClick(e);\r\n }\r\n\r\n /** @internal */\r\n public handleDocumentClick = (e: MouseEvent) => {\r\n if (!this.outsideClickContainerDiv || !(e.target instanceof Node) || this.outsideClickContainerDiv.contains(e.target))\r\n return;\r\n\r\n return this.onOutsideClick(e);\r\n };\r\n\r\n /** @internal */\r\n public handleDocumentPointerDown = (e: PointerEvent) => {\r\n this.isDownOutside = true;\r\n // istanbul ignore else\r\n if (this.outsideClickContainerDiv) {\r\n // typically e.target test for instance of Node, but this is not working from pop out windows\r\n this.isDownOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\r\n }\r\n };\r\n\r\n /** @internal */\r\n public handleDocumentPointerUp = (e: PointerEvent) => {\r\n let isUpOutside = true;\r\n // istanbul ignore else\r\n if (this.outsideClickContainerDiv) {\r\n // typically e.target test for instance of Node, but this is not working from pop out windows\r\n isUpOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\r\n }\r\n\r\n const isOutsideClick = isUpOutside && this.isDownOutside;\r\n this.isDownOutside = false;\r\n isOutsideClick && this.onOutsideClick(e);\r\n };\r\n\r\n public handleOutsideClickContainerDivSet = (outsideClickContainerDiv: HTMLDivElement | null) => {\r\n this.outsideClickContainerDiv = outsideClickContainerDiv;\r\n };\r\n\r\n public getParentDocument() {\r\n // istanbul ignore next\r\n return this.outsideClickContainerDiv?.ownerDocument ?? document;\r\n }\r\n\r\n public override componentDidMount() {\r\n const outsideClickParentDocument = this.getParentDocument();\r\n if (usePointerEvents) {\r\n outsideClickParentDocument.addEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\r\n outsideClickParentDocument.addEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\r\n } else\r\n outsideClickParentDocument.addEventListener(\"click\", this.handleDocumentClick, useCapture);\r\n }\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n const outsideClickParentDocument = this.getParentDocument();\r\n if (usePointerEvents) {\r\n outsideClickParentDocument.removeEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\r\n outsideClickParentDocument.removeEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\r\n } else\r\n outsideClickParentDocument.removeEventListener(\"click\", this.handleDocumentClick, useCapture);\r\n }\r\n\r\n public override render() {\r\n const { onOutsideClick, closeOnNestedPopupOutsideClick, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n return (\r\n <div ref={this.handleOutsideClickContainerDivSet}>\r\n <Component {...props as ComponentProps} />\r\n </div>\r\n );\r\n }\r\n };\r\n};\r\n"]}
1
+ {"version":3,"file":"withOnOutsideClick.js","sourceRoot":"","sources":["../../../../src/core-react/hocs/withOnOutsideClick.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAY/B;;GAEG;AACI,MAAM,kBAAkB,GAAG;AAChC,gEAAgE;AAChE,SAA8C,EAC9C,qBAAkD,EAClD,aAAsB,IAAI,EAC1B,mBAA4B,IAAI,EAChC,EAAE;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AwB,EAAE,aAAa,IAAI,QAAQ,CAAC;QAClE,CAAC;QAEe,iBAAiB;YAC/B,MAAM,0BAA0B,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5D,IAAI,gBAAgB,EAAE;gBACpB,0BAA0B,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC,CAAC;gBACvG,0BAA0B,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;aACpG;;gBACC,0BAA0B,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QAC/F,CAAC;QAED,gBAAgB;QACA,oBAAoB;YAClC,MAAM,0BAA0B,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC5D,IAAI,gBAAgB,EAAE;gBACpB,0BAA0B,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC,CAAC;gBAC1G,0BAA0B,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;aACvG;;gBACC,0BAA0B,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;QAClG,CAAC;QAEe,MAAM;YACpB,MAAM,EAAE,cAAc,EAAE,8BAA8B,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,wDAAwD;YACzI,OAAO,CACL,6BAAK,GAAG,EAAE,IAAI,CAAC,iCAAiC;gBAC9C,oBAAC,SAAS,OAAK,KAAuB,GAAI,CACtC,CACP,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAhHW,QAAA,kBAAkB,sBAgH7B","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 Common\n */\n\nimport * as React from \"react\";\n\n/** Properties for [[withOnOutsideClick]] React higher-order component\n * @public\n */\nexport interface WithOnOutsideClickProps {\n /** Outside click callback function */\n onOutsideClick?: (event: MouseEvent) => any;\n /** If false outside click processing and closing are skipped if click occurs in another Popup component, default to false. */\n closeOnNestedPopupOutsideClick?: boolean;\n}\n\n/** withOnOutsideClick is a React higher-order component that adds outside click support.\n * @public\n */\nexport const withOnOutsideClick = <ComponentProps extends {}>(\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Component: React.ComponentType<ComponentProps>,\n defaultOnOutsideClick?: (event: MouseEvent) => any,\n useCapture: boolean = true,\n usePointerEvents: boolean = true,\n) => {\n return class WithOnOutsideClick extends React.PureComponent<ComponentProps & WithOnOutsideClickProps> {\n /** @internal */\n public outsideClickContainerDiv?: HTMLDivElement | null = null;\n /** @internal */\n public isDownOutside = false;\n\n /** @internal */\n public isInCorePopup(element: HTMLElement): boolean {\n if (element.nodeName === \"DIV\") {\n if (element.classList && element.classList.contains(\"core-popup\"))\n return true;\n if (element.parentElement && this.isInCorePopup(element.parentElement))\n return true;\n } else {\n // istanbul ignore else\n if (element.parentElement && this.isInCorePopup(element.parentElement))\n return true;\n }\n return false;\n }\n\n /** @internal */\n public onOutsideClick(e: MouseEvent) {\n // istanbul ignore else\n if (e.target instanceof Node && e.target.nodeType === Node.ELEMENT_NODE) {\n // istanbul ignore else\n if (!this.props.closeOnNestedPopupOutsideClick && this.isInCorePopup(e.target as HTMLElement))\n return;\n }\n\n if (this.props.onOutsideClick)\n return this.props.onOutsideClick(e);\n else if (defaultOnOutsideClick)\n return defaultOnOutsideClick(e);\n }\n\n /** @internal */\n public handleDocumentClick = (e: MouseEvent) => {\n if (!this.outsideClickContainerDiv || !(e.target instanceof Node) || this.outsideClickContainerDiv.contains(e.target))\n return;\n\n return this.onOutsideClick(e);\n };\n\n /** @internal */\n public handleDocumentPointerDown = (e: PointerEvent) => {\n this.isDownOutside = true;\n // istanbul ignore else\n if (this.outsideClickContainerDiv) {\n // typically e.target test for instance of Node, but this is not working from pop out windows\n this.isDownOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\n }\n };\n\n /** @internal */\n public handleDocumentPointerUp = (e: PointerEvent) => {\n let isUpOutside = true;\n // istanbul ignore else\n if (this.outsideClickContainerDiv) {\n // typically e.target test for instance of Node, but this is not working from pop out windows\n isUpOutside = !!e.target && !this.outsideClickContainerDiv.contains(e.target as any);\n }\n\n const isOutsideClick = isUpOutside && this.isDownOutside;\n this.isDownOutside = false;\n isOutsideClick && this.onOutsideClick(e);\n };\n\n public handleOutsideClickContainerDivSet = (outsideClickContainerDiv: HTMLDivElement | null) => {\n this.outsideClickContainerDiv = outsideClickContainerDiv;\n };\n\n public getParentDocument() {\n // istanbul ignore next\n return this.outsideClickContainerDiv?.ownerDocument ?? document;\n }\n\n public override componentDidMount() {\n const outsideClickParentDocument = this.getParentDocument();\n if (usePointerEvents) {\n outsideClickParentDocument.addEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\n outsideClickParentDocument.addEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\n } else\n outsideClickParentDocument.addEventListener(\"click\", this.handleDocumentClick, useCapture);\n }\n\n /** @internal */\n public override componentWillUnmount() {\n const outsideClickParentDocument = this.getParentDocument();\n if (usePointerEvents) {\n outsideClickParentDocument.removeEventListener(\"pointerdown\", this.handleDocumentPointerDown, useCapture);\n outsideClickParentDocument.removeEventListener(\"pointerup\", this.handleDocumentPointerUp, useCapture);\n } else\n outsideClickParentDocument.removeEventListener(\"click\", this.handleDocumentClick, useCapture);\n }\n\n public override render() {\n const { onOutsideClick, closeOnNestedPopupOutsideClick, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n return (\n <div ref={this.handleOutsideClickContainerDivSet}>\n <Component {...props as ComponentProps} />\n </div>\n );\n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AC;AACJ,CAAC,CAAC;AAnCW,QAAA,WAAW,eAmCtB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Common\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Timer } from \"../utils/Timer\";\r\n\r\n/** Properties for [[withTimeout]] React higher-order component\r\n * @public\r\n */\r\nexport interface WithTimeoutProps {\r\n /** Timeout duration in milliseconds */\r\n timeout: number;\r\n /** Callback function for timeout */\r\n onTimeout?: () => void;\r\n}\r\n\r\n/** withTimeout is a React higher-order component that adds timeout support.\r\n * @public\r\n */\r\nexport const withTimeout = <ComponentProps extends {}>(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n Component: React.ComponentType<ComponentProps>,\r\n) => {\r\n return class WithTimeout extends React.PureComponent<ComponentProps & WithTimeoutProps> {\r\n public timer: Timer = new Timer(0);\r\n\r\n public override componentDidMount(): void {\r\n this.timer.setOnExecute(() => this.props.onTimeout && this.props.onTimeout());\r\n this.startTimer(this.props.timeout);\r\n }\r\n\r\n public override componentDidUpdate(_prevProps: Readonly<ComponentProps & WithTimeoutProps>): void {\r\n this.startTimer(this.props.timeout);\r\n }\r\n\r\n public override componentWillUnmount(): void {\r\n this.timer.stop();\r\n }\r\n\r\n public override render() {\r\n const { timeout, onTimeout, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n return (\r\n <Component {...props as any} {...this.state} />\r\n );\r\n }\r\n\r\n public startTimer(timeout: number) {\r\n if (this.timer.isRunning)\r\n return;\r\n\r\n this.timer.delay = timeout;\r\n this.timer.start();\r\n }\r\n };\r\n};\r\n"]}
1
+ {"version":3,"file":"withTimeout.js","sourceRoot":"","sources":["../../../../src/core-react/hocs/withTimeout.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAC/B,0CAAuC;AAYvC;;GAEG;AACI,MAAM,WAAW,GAAG;AACzB,gEAAgE;AAChE,SAA8C,EAC9C,EAAE;IACF,OAAO,MAAM,WAAY,SAAQ,KAAK,CAAC,aAAgD;QAAhF;;YACE,UAAK,GAAU,IAAI,aAAK,CAAC,CAAC,CAAC,CAAC;QA6BrC,CAAC;QA3BiB,iBAAiB;YAC/B,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;YAC9E,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAEe,kBAAkB,CAAC,UAAuD;YACxF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAEe,oBAAoB;YAClC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC;QAEe,MAAM;YACpB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,wDAAwD;YAC7G,OAAO,CACL,oBAAC,SAAS,OAAK,KAAY,KAAM,IAAI,CAAC,KAAK,GAAI,CAChD,CAAC;QACJ,CAAC;QAEM,UAAU,CAAC,OAAe;YAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;gBACtB,OAAO;YAET,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC;YAC3B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,WAAW,eAmCtB","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 Common\n */\n\nimport * as React from \"react\";\nimport { Timer } from \"../utils/Timer\";\n\n/** Properties for [[withTimeout]] React higher-order component\n * @public\n */\nexport interface WithTimeoutProps {\n /** Timeout duration in milliseconds */\n timeout: number;\n /** Callback function for timeout */\n onTimeout?: () => void;\n}\n\n/** withTimeout is a React higher-order component that adds timeout support.\n * @public\n */\nexport const withTimeout = <ComponentProps extends {}>(\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Component: React.ComponentType<ComponentProps>,\n) => {\n return class WithTimeout extends React.PureComponent<ComponentProps & WithTimeoutProps> {\n public timer: Timer = new Timer(0);\n\n public override componentDidMount(): void {\n this.timer.setOnExecute(() => this.props.onTimeout && this.props.onTimeout());\n this.startTimer(this.props.timeout);\n }\n\n public override componentDidUpdate(_prevProps: Readonly<ComponentProps & WithTimeoutProps>): void {\n this.startTimer(this.props.timeout);\n }\n\n public override componentWillUnmount(): void {\n this.timer.stop();\n }\n\n public override render() {\n const { timeout, onTimeout, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n return (\n <Component {...props as any} {...this.state} />\n );\n }\n\n public startTimer(timeout: number) {\n if (this.timer.isRunning)\n return;\n\n this.timer.delay = timeout;\n this.timer.start();\n }\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionalIconItem.js","sourceRoot":"","sources":["../../../../src/core-react/icons/ConditionalIconItem.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;GAEG;AACH,MAAa,mBAAmB;IAG9B;;;;MAIE;IACF,YAA4B,UAA0B,EAAkB,YAAsB,EAAE,KAAgB;QAApF,eAAU,GAAV,UAAU,CAAgB;QAAkB,iBAAY,GAAZ,YAAY,CAAU;QAC5F,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,mDAAmD;IACnD,IAAW,KAAK;QACd,0BAA0B;QAC1B,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,2DAA2D;IACpD,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACnC,0BAA0B;QAC1B,IAAI,QAAQ,KAAK,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;YACvB,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gGAAgG;IACzF,MAAM,CAAC,YAAY,CAAC,gBAA0D,EAAE,QAAqB;QAC1G,0BAA0B;QAC1B,IAAI,SAAS,KAAK,gBAAgB,IAAI,CAAC,CAAC,gBAAgB,YAAY,mBAAmB,CAAC;YACtF,OAAO,KAAK,CAAC;QAEf,0BAA0B;QAC1B,IAAI,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAa,EAAW,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;YACnG,OAAO,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAEpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0FAA0F;IACnF,MAAM,CAAC,QAAQ,CAAC,gBAA0D;QAC/E,0BAA0B;QAC1B,IAAI,SAAS,KAAK,gBAAgB;YAChC,OAAO,SAAS,CAAC;QAEnB,0BAA0B;QAC1B,IAAI,gBAAgB,YAAY,mBAAmB;YACjD,OAAO,gBAAgB,CAAC,KAAK,CAAC;QAEhC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAzDD,kDAyDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Icon\r\n */\r\n\r\nimport { IconSpec } from \"./IconComponent\";\r\n\r\n/** Class used to return an icon. The icon is variable and can be changed in response to subscribed event ids.\r\n * @public\r\n */\r\nexport class ConditionalIconItem {\r\n private _value?: IconSpec;\r\n\r\n /** Constructor for ConditionalIconItem\r\n * @param iconGetter Function to retrieve the icon that matches the condition. Returns an IconSpec.\r\n * @param syncEventIds The array of event ids to be monitored. These events are triggered when the condition(s) that control the icon change.\r\n * @param value The default IconSpec. If this is not specified, the function is run to get the initial value.\r\n */\r\n constructor(public readonly iconGetter: () => IconSpec, public readonly syncEventIds: string[], value?: IconSpec) {\r\n this._value = value;\r\n }\r\n\r\n /** The current IconSpec according to conditions */\r\n public get value(): IconSpec {\r\n /* istanbul ignore else */\r\n if (undefined !== this._value)\r\n return this._value;\r\n this._value = this.iconGetter();\r\n return this._value;\r\n }\r\n\r\n /** Called to update the value by running the iconGetter */\r\n public refresh(): boolean {\r\n const newValue = this.iconGetter();\r\n /* istanbul ignore else */\r\n if (newValue !== this._value) {\r\n this._value = newValue;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** A helper function that updates the IconSpec value when the specified events are triggered */\r\n public static refreshValue(conditionalValue: ConditionalIconItem | string | undefined, eventIds: Set<string>): boolean {\r\n /* istanbul ignore else */\r\n if (undefined === conditionalValue || !(conditionalValue instanceof ConditionalIconItem))\r\n return false;\r\n\r\n /* istanbul ignore else */\r\n if (conditionalValue.syncEventIds.some((value: string): boolean => eventIds.has(value.toLowerCase())))\r\n return conditionalValue.refresh();\r\n\r\n return false;\r\n }\r\n\r\n /** helper function to get the iconSpec from a ConditionIconItem as IconSpec | undefined*/\r\n public static getValue(conditionalValue: ConditionalIconItem | string | undefined): IconSpec | undefined {\r\n /* istanbul ignore else */\r\n if (undefined === conditionalValue)\r\n return undefined;\r\n\r\n /* istanbul ignore else */\r\n if (conditionalValue instanceof ConditionalIconItem)\r\n return conditionalValue.value;\r\n\r\n return conditionalValue;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ConditionalIconItem.js","sourceRoot":"","sources":["../../../../src/core-react/icons/ConditionalIconItem.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAIH;;GAEG;AACH,MAAa,mBAAmB;IAG9B;;;;MAIE;IACF,YAA4B,UAA0B,EAAkB,YAAsB,EAAE,KAAgB;QAApF,eAAU,GAAV,UAAU,CAAgB;QAAkB,iBAAY,GAAZ,YAAY,CAAU;QAC5F,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,mDAAmD;IACnD,IAAW,KAAK;QACd,0BAA0B;QAC1B,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM;YAC3B,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,2DAA2D;IACpD,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACnC,0BAA0B;QAC1B,IAAI,QAAQ,KAAK,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;YACvB,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gGAAgG;IACzF,MAAM,CAAC,YAAY,CAAC,gBAA0D,EAAE,QAAqB;QAC1G,0BAA0B;QAC1B,IAAI,SAAS,KAAK,gBAAgB,IAAI,CAAC,CAAC,gBAAgB,YAAY,mBAAmB,CAAC;YACtF,OAAO,KAAK,CAAC;QAEf,0BAA0B;QAC1B,IAAI,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAa,EAAW,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;YACnG,OAAO,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAEpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0FAA0F;IACnF,MAAM,CAAC,QAAQ,CAAC,gBAA0D;QAC/E,0BAA0B;QAC1B,IAAI,SAAS,KAAK,gBAAgB;YAChC,OAAO,SAAS,CAAC;QAEnB,0BAA0B;QAC1B,IAAI,gBAAgB,YAAY,mBAAmB;YACjD,OAAO,gBAAgB,CAAC,KAAK,CAAC;QAEhC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAzDD,kDAyDC","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 Icon\n */\n\nimport { IconSpec } from \"./IconComponent\";\n\n/** Class used to return an icon. The icon is variable and can be changed in response to subscribed event ids.\n * @public\n */\nexport class ConditionalIconItem {\n private _value?: IconSpec;\n\n /** Constructor for ConditionalIconItem\n * @param iconGetter Function to retrieve the icon that matches the condition. Returns an IconSpec.\n * @param syncEventIds The array of event ids to be monitored. These events are triggered when the condition(s) that control the icon change.\n * @param value The default IconSpec. If this is not specified, the function is run to get the initial value.\n */\n constructor(public readonly iconGetter: () => IconSpec, public readonly syncEventIds: string[], value?: IconSpec) {\n this._value = value;\n }\n\n /** The current IconSpec according to conditions */\n public get value(): IconSpec {\n /* istanbul ignore else */\n if (undefined !== this._value)\n return this._value;\n this._value = this.iconGetter();\n return this._value;\n }\n\n /** Called to update the value by running the iconGetter */\n public refresh(): boolean {\n const newValue = this.iconGetter();\n /* istanbul ignore else */\n if (newValue !== this._value) {\n this._value = newValue;\n return true;\n }\n return false;\n }\n\n /** A helper function that updates the IconSpec value when the specified events are triggered */\n public static refreshValue(conditionalValue: ConditionalIconItem | string | undefined, eventIds: Set<string>): boolean {\n /* istanbul ignore else */\n if (undefined === conditionalValue || !(conditionalValue instanceof ConditionalIconItem))\n return false;\n\n /* istanbul ignore else */\n if (conditionalValue.syncEventIds.some((value: string): boolean => eventIds.has(value.toLowerCase())))\n return conditionalValue.refresh();\n\n return false;\n }\n\n /** helper function to get the iconSpec from a ConditionIconItem as IconSpec | undefined*/\n public static getValue(conditionalValue: ConditionalIconItem | string | undefined): IconSpec | undefined {\n /* istanbul ignore else */\n if (undefined === conditionalValue)\n return undefined;\n\n /* istanbul ignore else */\n if (conditionalValue instanceof ConditionalIconItem)\n return conditionalValue.value;\n\n return conditionalValue;\n }\n}\n"]}