@itwin/imodel-components-react 4.1.0-dev.0 → 4.1.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.js +4 -2
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  4. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +1 -1
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
  8. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  12. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +90 -90
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  14. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  18. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +2 -2
  19. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  20. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  21. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  22. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +1 -1
  23. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  24. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  25. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  26. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +2 -2
  27. package/lib/cjs/imodel-components-react/color/Swatch.d.ts.map +1 -1
  28. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  29. package/lib/cjs/imodel-components-react/color/Swatch.scss +22 -22
  30. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +1 -1
  31. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
  32. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  33. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +3 -2
  34. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
  35. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  36. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  37. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +3 -2
  38. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  39. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  40. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  41. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +2 -2
  42. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  43. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  44. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +2 -2
  45. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  46. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  47. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  48. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  49. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +2 -2
  50. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
  51. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  52. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  53. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +2 -2
  54. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts.map +1 -1
  55. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  56. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  57. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +1 -1
  58. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
  59. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  60. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  61. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +3 -2
  62. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  63. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +50 -23
  64. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
  66. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +3 -2
  67. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  68. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  69. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
  70. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +3 -2
  71. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
  72. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  73. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +2 -2
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +3 -2
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +2 -2
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +2 -2
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +2 -2
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +2 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +2 -2
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +2 -1
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +2 -2
  92. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  93. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +9 -5
  94. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +2 -2
  96. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  97. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +4 -3
  98. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  99. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +3 -3
  100. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  101. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +1 -1
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +1 -1
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +1 -1
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +1 -1
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +1 -1
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +1 -1
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +1 -1
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +1 -1
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +2 -2
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  128. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +2 -1
  129. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  130. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +2 -2
  131. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
  132. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  133. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +2 -2
  134. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  135. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  136. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +2 -2
  137. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
  138. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  139. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +1 -1
  140. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
  141. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  142. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  143. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +1 -1
  144. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
  145. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  146. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +28 -28
  147. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +2 -2
  148. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  149. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  150. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +105 -105
  151. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +1 -1
  152. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  153. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  154. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  155. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +1 -1
  156. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
  157. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  158. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  159. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  160. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +2 -2
  161. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  162. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +0 -7
  163. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  164. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  165. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +3 -3
  166. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  167. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  168. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +4 -3
  169. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  170. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +9 -7
  171. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  172. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +1 -1
  173. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
  174. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  175. package/lib/cjs/imodel-components-react.js.map +1 -1
  176. package/lib/esm/imodel-components-react/UiIModelComponents.js +4 -2
  177. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  178. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +1 -1
  179. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  180. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  181. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  182. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
  183. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  184. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +1 -1
  185. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  186. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +90 -90
  187. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  188. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
  189. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  190. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  191. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +62 -62
  192. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +2 -2
  193. package/lib/esm/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  194. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  195. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  196. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +1 -1
  197. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  198. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  199. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  200. package/lib/esm/imodel-components-react/color/Swatch.d.ts +2 -2
  201. package/lib/esm/imodel-components-react/color/Swatch.d.ts.map +1 -1
  202. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  203. package/lib/esm/imodel-components-react/color/Swatch.scss +22 -22
  204. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +1 -1
  205. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
  206. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  207. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +3 -2
  208. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
  209. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  210. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  211. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +3 -2
  212. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
  213. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  214. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  215. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +2 -2
  216. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  217. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  218. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +2 -2
  219. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
  220. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  221. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
  223. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +2 -2
  224. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
  225. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  226. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  227. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +2 -2
  228. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts.map +1 -1
  229. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
  231. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +1 -1
  232. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
  233. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  234. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  235. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +3 -2
  236. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
  237. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +50 -23
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  239. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
  240. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +3 -2
  241. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  242. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  243. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
  244. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +3 -2
  245. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
  246. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +2 -2
  250. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
  251. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +3 -2
  252. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  253. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +2 -2
  254. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  255. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +2 -2
  256. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  257. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +2 -2
  258. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  259. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +2 -1
  260. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +2 -2
  262. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  263. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +2 -1
  264. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  265. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +2 -2
  266. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  267. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +9 -5
  268. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  269. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +2 -2
  270. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  271. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +4 -3
  272. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  273. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +3 -3
  274. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
  275. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  276. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +1 -1
  277. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  278. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  279. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +1 -1
  280. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  281. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  282. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +1 -1
  283. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  284. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  285. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +1 -1
  286. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  287. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  288. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +1 -1
  289. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  290. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  291. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +1 -1
  292. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  293. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  294. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +1 -1
  295. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  296. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  297. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +1 -1
  298. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  299. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  300. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +2 -2
  301. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  302. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +2 -1
  303. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  304. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +2 -2
  305. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
  306. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  307. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +2 -2
  308. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
  309. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  310. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +2 -2
  311. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
  312. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  313. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +1 -1
  314. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
  315. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  316. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  317. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +1 -1
  318. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
  319. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  320. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +28 -28
  321. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +2 -2
  322. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
  323. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  324. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +105 -105
  325. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +1 -1
  326. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  327. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  328. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +359 -359
  329. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +1 -1
  330. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
  331. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  332. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  333. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  334. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +2 -2
  335. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  336. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +0 -7
  337. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  338. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +177 -177
  339. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +3 -3
  340. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  341. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  342. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +4 -3
  343. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  344. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +9 -7
  345. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  346. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +1 -1
  347. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
  348. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  349. package/lib/esm/imodel-components-react.js.map +1 -1
  350. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  351. package/package.json +17 -12
@@ -44,7 +44,7 @@ const ViewportComponentEvents_1 = require("./ViewportComponentEvents");
44
44
  function ViewportComponent(props) {
45
45
  const { viewState, imodel, viewDefinitionId, getViewOverlay, viewManagerOverride, tentativePointOverride, onContextMenu, style, className, screenViewportOverride, controlId, viewportRef } = props;
46
46
  // istanbul ignore next
47
- const viewManagerRef = React.useRef(viewManagerOverride ?? core_frontend_1.IModelApp.viewManager);
47
+ const viewManagerRef = React.useRef(viewManagerOverride !== null && viewManagerOverride !== void 0 ? viewManagerOverride : core_frontend_1.IModelApp.viewManager);
48
48
  const tentativePointOverrideRef = React.useRef(tentativePointOverride);
49
49
  const screenViewportCreated = React.useRef(false);
50
50
  const viewportDiv = React.useRef(null);
@@ -90,9 +90,10 @@ function ViewportComponent(props) {
90
90
  };
91
91
  const targetPoint = React.useRef(null);
92
92
  const getRotatePoint = (vp) => {
93
+ var _a, _b;
93
94
  const lastTargetPoint = targetPoint.current;
94
95
  // istanbul ignore next
95
- const tentativePoint = tentativePointOverrideRef.current ?? core_frontend_1.IModelApp.tentativePoint;
96
+ const tentativePoint = (_a = tentativePointOverrideRef.current) !== null && _a !== void 0 ? _a : core_frontend_1.IModelApp.tentativePoint;
96
97
  // istanbul ignore else
97
98
  if (tentativePoint.isActive)
98
99
  return tentativePoint.getPoint();
@@ -117,7 +118,7 @@ function ViewportComponent(props) {
117
118
  const visiblePoint = vp.pickNearestVisibleGeometry(vp.npcToWorld(core_common_1.NpcCenter), vp.pixelsFromInches(core_frontend_1.ToolSettings.viewToolPickRadiusInches));
118
119
  targetPoint.current = (undefined !== visiblePoint ? visiblePoint : vp.view.getTargetPoint());
119
120
  // istanbul ignore next
120
- return targetPoint.current ?? vp.view.getCenter();
121
+ return (_b = targetPoint.current) !== null && _b !== void 0 ? _b : vp.view.getCenter();
121
122
  };
122
123
  const handleCubeRotationChangeEvent = (args) => {
123
124
  const viewManager = viewManagerRef.current;
@@ -225,8 +226,8 @@ function ViewportComponent(props) {
225
226
  core_bentley_1.Logger.logError("ViewportComponent", `A Viewstate or a viewId and imodel must be provided`);
226
227
  }
227
228
  // istanbul ignore next
228
- if (isMounted.current && (currentViewState?.iModel.isOpen || currentViewState?.iModel.isBlank)) {
229
- setInitialViewState(currentViewState?.clone());
229
+ if (isMounted.current && ((currentViewState === null || currentViewState === void 0 ? void 0 : currentViewState.iModel.isOpen) || (currentViewState === null || currentViewState === void 0 ? void 0 : currentViewState.iModel.isBlank))) {
230
+ setInitialViewState(currentViewState === null || currentViewState === void 0 ? void 0 : currentViewState.clone());
230
231
  }
231
232
  }
232
233
  if (undefined === initialViewState)
@@ -235,10 +236,11 @@ function ViewportComponent(props) {
235
236
  const [viewOverlay, setViewOverlay] = React.useState(null);
236
237
  // This useEffect connects to ViewManger as soon as initialViewState is available once component is mounted.
237
238
  React.useEffect(() => {
239
+ var _a;
238
240
  const parentDiv = viewportDiv.current;
239
241
  const viewManager = viewManagerRef.current;
240
242
  // istanbul ignore next
241
- if (parentDiv && initialViewState && (initialViewState?.iModel.isOpen || initialViewState?.iModel.isBlank)) {
243
+ if (parentDiv && initialViewState && ((initialViewState === null || initialViewState === void 0 ? void 0 : initialViewState.iModel.isOpen) || (initialViewState === null || initialViewState === void 0 ? void 0 : initialViewState.iModel.isBlank))) {
242
244
  if (!screenViewportCreated.current) {
243
245
  const screenViewport = getScreenViewport(parentDiv, initialViewState);
244
246
  screenViewportRef.current = screenViewport;
@@ -251,7 +253,7 @@ function ViewportComponent(props) {
251
253
  }
252
254
  else {
253
255
  // istanbul ignore next
254
- screenViewportRef.current?.changeView(initialViewState);
256
+ (_a = screenViewportRef.current) === null || _a === void 0 ? void 0 : _a.changeView(initialViewState);
255
257
  }
256
258
  }
257
259
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportComponent.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponent.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,sDAAyD;AACzD,wDAA0D;AAC1D,oDAA+C;AAC/C,wDAI8B;AAG9B,uEAEmC;AAkCnC;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAoB;IACpD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAC9E,sBAAsB,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACpH,uBAAuB;IACvB,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,mBAAmB,IAAI,yBAAS,CAAC,WAAW,CAAC,CAAC;IAClF,MAAM,yBAAyB,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAC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,EAAE,QAAQ,EAAE,UAAU;KACpD,CAAC;IAEF,MAAM,gBAAgB,GAAwB;QAC5C,GAAG,KAAK;QACR,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;KAC9B,CAAC;IAEF,OAAO,CACL,6BAAK,KAAK,EAAE,cAAc,kBAAgB,SAAS;QAEjD;YACE,6BACE,GAAG,EAAE,WAAW,iBACJ,oBAAoB,EAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,iBAAiB,GAChC;YACD,WAAW,CACX,CACC,CACP,CAAC;AACJ,CAAC;AAxQD,8CAwQC","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 Viewport\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Id64String, Logger } from \"@itwin/core-bentley\";\r\nimport { Point3d, Transform } from \"@itwin/core-geometry\";\r\nimport { NpcCenter } from \"@itwin/core-common\";\r\nimport {\r\n IModelApp, IModelConnection, ScreenViewport,\r\n TentativePoint, ToolSettings, ViewManager,\r\n Viewport, ViewState,\r\n} from \"@itwin/core-frontend\";\r\n\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport {\r\n CubeRotationChangeEventArgs, DrawingViewportChangeEventArgs, StandardRotationChangeEventArgs, ViewportComponentEvents,\r\n} from \"./ViewportComponentEvents\";\r\n\r\n/** Type for a ViewState prop\r\n * @public\r\n */\r\nexport type ViewStateProp = ViewState | (() => ViewState);\r\n\r\n/**\r\n * Properties for [[ViewportComponent]] component.\r\n * @public\r\n */\r\nexport interface ViewportProps extends CommonProps {\r\n /** IModel to display */\r\n imodel: IModelConnection;\r\n /** Id of a default view definition to load as a starting point */\r\n viewDefinitionId?: Id64String;\r\n /** ViewState to use as a starting point */\r\n viewState?: ViewStateProp;\r\n /** Function to get a reference to the ScreenViewport */\r\n viewportRef?: (v: ScreenViewport) => void;\r\n /** controlId for this content component @internal */\r\n controlId?: string;\r\n /** @internal */\r\n onContextMenu?: (e: React.MouseEvent) => boolean;\r\n /** @internal */\r\n getViewOverlay?: (viewport: ScreenViewport) => React.ReactNode;\r\n /** @internal used only for testing */\r\n viewManagerOverride?: ViewManager;\r\n /** @internal used only for testing */\r\n screenViewportOverride?: typeof ScreenViewport;\r\n /** @internal used only for testing */\r\n tentativePointOverride?: TentativePoint;\r\n}\r\n\r\n/**\r\n * A viewport React component that creates a ScreenViewport.\r\n * @public\r\n */\r\nexport function ViewportComponent(props: ViewportProps) {\r\n const { viewState, imodel, viewDefinitionId, getViewOverlay, viewManagerOverride,\r\n tentativePointOverride, onContextMenu, style, className, screenViewportOverride, controlId, viewportRef } = props;\r\n // istanbul ignore next\r\n const viewManagerRef = React.useRef(viewManagerOverride ?? IModelApp.viewManager);\r\n const tentativePointOverrideRef = React.useRef(tentativePointOverride);\r\n const screenViewportCreated = React.useRef(false);\r\n const viewportDiv = React.useRef<HTMLDivElement>(null);\r\n const screenViewportRef = React.useRef<ScreenViewport | null>(null);\r\n const isMounted = React.useRef(false);\r\n const viewClassFullName = React.useRef(\"\");\r\n const viewId = React.useRef(\"0\");\r\n\r\n // istanbul ignore next\r\n const handleViewChanged = (vp: Viewport) => {\r\n // istanbul ignore next\r\n if (!(vp.iModel.isOpen || vp.iModel.isBlank))\r\n return;\r\n ViewportComponentEvents.setViewMatrix(vp);\r\n if (viewClassFullName.current !== vp.view.classFullName) {\r\n setTimeout(() => {\r\n ViewportComponentEvents.onViewClassFullNameChangedEvent.emit({ viewport: vp, oldName: viewClassFullName.current, newName: vp.view.classFullName });\r\n viewClassFullName.current = vp.view.classFullName;\r\n });\r\n }\r\n if (viewId.current !== vp.view.id) {\r\n setTimeout(() => {\r\n ViewportComponentEvents.onViewIdChangedEvent.emit({ viewport: vp, oldId: viewId.current, newId: vp.view.id });\r\n viewId.current = vp.view.id;\r\n });\r\n }\r\n };\r\n\r\n const handleStandardRotationChangeEvent = (args: StandardRotationChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n currentScreenViewport.view.setRotationAboutPoint(ViewState.getStandardViewMatrix(args.standardRotation));\r\n currentScreenViewport.synchWithView();\r\n }\r\n };\r\n\r\n const handleDrawingViewportChangeEvent = (args: DrawingViewportChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n currentScreenViewport.view.setOrigin(args.origin);\r\n currentScreenViewport.view.setRotation(args.rotation);\r\n currentScreenViewport.synchWithView({ noSaveInUndo: args.complete !== true });\r\n }\r\n };\r\n\r\n const targetPoint = React.useRef<Point3d | null>(null);\r\n\r\n const getRotatePoint = (vp: ScreenViewport): Point3d => {\r\n const lastTargetPoint = targetPoint.current;\r\n // istanbul ignore next\r\n const tentativePoint = tentativePointOverrideRef.current ?? IModelApp.tentativePoint;\r\n // istanbul ignore else\r\n if (tentativePoint.isActive)\r\n return tentativePoint.getPoint();\r\n\r\n // istanbul ignore else\r\n if (undefined !== vp.viewCmdTargetCenter) {\r\n const testPt = vp.worldToView(vp.viewCmdTargetCenter);\r\n const viewRect = vp.viewRect;\r\n if (viewRect.containsPoint(testPt))\r\n return vp.viewCmdTargetCenter;\r\n vp.viewCmdTargetCenter = undefined;\r\n }\r\n\r\n // istanbul ignore else\r\n if (null !== lastTargetPoint) {\r\n const testPt = vp.worldToView(lastTargetPoint);\r\n const viewRect = vp.viewRect.clone();\r\n viewRect.scaleAboutCenter(0.25, 0.25);\r\n // istanbul ignore next hard to reach because of mocks\r\n if (viewRect.containsPoint(testPt))\r\n return lastTargetPoint;\r\n targetPoint.current = null;\r\n }\r\n\r\n const visiblePoint = vp.pickNearestVisibleGeometry(vp.npcToWorld(NpcCenter), vp.pixelsFromInches(ToolSettings.viewToolPickRadiusInches));\r\n targetPoint.current = (undefined !== visiblePoint ? visiblePoint : vp.view.getTargetPoint());\r\n // istanbul ignore next\r\n return targetPoint.current ?? vp.view.getCenter();\r\n };\r\n\r\n const handleCubeRotationChangeEvent = (args: CubeRotationChangeEventArgs) => {\r\n const viewManager = viewManagerRef.current;\r\n const currentScreenViewport = screenViewportRef.current;\r\n // istanbul ignore else\r\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\r\n const rotMatrix = args.rotMatrix;\r\n // istanbul ignore else\r\n if (currentScreenViewport.rotation !== rotMatrix) {\r\n const inverse = rotMatrix.transpose(); // rotation is from current nav cube state...\r\n const center = getRotatePoint(currentScreenViewport);\r\n const targetMatrix = inverse.multiplyMatrixMatrix(currentScreenViewport.view.getRotation());\r\n const worldTransform = Transform.createFixedPointAndMatrix(center, targetMatrix);\r\n const frustum = currentScreenViewport.getWorldFrustum();\r\n frustum.multiply(worldTransform);\r\n currentScreenViewport.view.setupFromFrustum(frustum);\r\n currentScreenViewport.synchWithView({ noSaveInUndo: !args.complete });\r\n }\r\n }\r\n };\r\n\r\n const handleDisconnectFromViewManager = () => {\r\n const screenViewport = screenViewportRef.current;\r\n if (screenViewport) {\r\n const viewManager = IModelApp.viewManager;\r\n screenViewport.onViewChanged.removeListener(handleViewChanged);\r\n screenViewportRef.current = null;\r\n screenViewportCreated.current = false;\r\n ViewportComponentEvents.onDrawingViewportChangeEvent.removeListener(handleDrawingViewportChangeEvent);\r\n ViewportComponentEvents.onCubeRotationChangeEvent.removeListener(handleCubeRotationChangeEvent);\r\n ViewportComponentEvents.onStandardRotationChangeEvent.removeListener(handleStandardRotationChangeEvent);\r\n viewManager.dropViewport(screenViewport, true);\r\n }\r\n };\r\n\r\n // istanbul ignore next\r\n const handleWindowUnload = () => {\r\n const parentDiv = viewportDiv.current;\r\n if (parentDiv) {\r\n const parentWindow = parentDiv.ownerDocument.defaultView as Window;\r\n if (parentWindow !== window) {\r\n handleDisconnectFromViewManager();\r\n }\r\n }\r\n };\r\n\r\n const getScreenViewport = (parentDiv: HTMLDivElement, inViewState: ViewState) => {\r\n // istanbul ignore next\r\n const screenViewportFactory = screenViewportOverride ? screenViewportOverride : ScreenViewport;\r\n const parentWindow = parentDiv.ownerDocument.defaultView as Window;\r\n parentWindow.addEventListener(\"unload\", handleWindowUnload, true); // listener clear after being called\r\n ViewportComponentEvents.initialize();\r\n ViewportComponentEvents.onDrawingViewportChangeEvent.addListener(handleDrawingViewportChangeEvent);\r\n ViewportComponentEvents.onCubeRotationChangeEvent.addListener(handleCubeRotationChangeEvent);\r\n ViewportComponentEvents.onStandardRotationChangeEvent.addListener(handleStandardRotationChangeEvent);\r\n const screenViewport = screenViewportFactory.create(parentDiv, inViewState);\r\n screenViewportCreated.current = true;\r\n viewClassFullName.current = screenViewport.view.classFullName;\r\n viewId.current = screenViewport.view.id;\r\n screenViewport.onViewChanged.addListener(handleViewChanged);\r\n return screenViewport;\r\n };\r\n\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n Logger.logInfo(\"ViewportComponent\", `mounting ViewportComponent for controlId=${controlId}`);\r\n\r\n return () => {\r\n isMounted.current = false;\r\n Logger.logInfo(\"ViewportComponent\", `un-mounting ViewportComponent for controlId=${controlId}`);\r\n handleDisconnectFromViewManager();\r\n };\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n const [initialViewState, setInitialViewState] = React.useState<ViewState | undefined>(() => {\r\n if (viewState) {\r\n if (typeof viewState === \"function\")\r\n return viewState().clone();\r\n else\r\n return viewState.clone();\r\n }\r\n return undefined;\r\n });\r\n\r\n React.useEffect(() => {\r\n setInitialViewState(undefined);\r\n }, [viewDefinitionId, viewState]);\r\n React.useEffect(() => {\r\n async function fetchInitialViewstate() {\r\n let currentViewState: ViewState | undefined;\r\n if (viewState) {\r\n if (typeof viewState === \"function\")\r\n currentViewState = viewState();\r\n else\r\n currentViewState = viewState;\r\n } else if (viewDefinitionId && imodel) {\r\n try {\r\n currentViewState = await imodel.views.load(viewDefinitionId);\r\n // istanbul ignore next\r\n if (!currentViewState) {\r\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\r\n }\r\n } catch (_e) {\r\n // istanbul ignore next\r\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\r\n }\r\n } else {\r\n Logger.logError(\"ViewportComponent\", `A Viewstate or a viewId and imodel must be provided`);\r\n }\r\n // istanbul ignore next\r\n if (isMounted.current && (currentViewState?.iModel.isOpen || currentViewState?.iModel.isBlank)) {\r\n setInitialViewState(currentViewState?.clone());\r\n }\r\n }\r\n if (undefined === initialViewState)\r\n fetchInitialViewstate(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [imodel, initialViewState, viewDefinitionId, viewState]);\r\n\r\n const [viewOverlay, setViewOverlay] = React.useState<React.ReactNode>(null);\r\n\r\n // This useEffect connects to ViewManger as soon as initialViewState is available once component is mounted.\r\n React.useEffect(() => {\r\n const parentDiv = viewportDiv.current;\r\n const viewManager = viewManagerRef.current;\r\n // istanbul ignore next\r\n if (parentDiv && initialViewState && (initialViewState?.iModel.isOpen || initialViewState?.iModel.isBlank)) {\r\n if (!screenViewportCreated.current) {\r\n const screenViewport = getScreenViewport(parentDiv, initialViewState);\r\n screenViewportRef.current = screenViewport;\r\n\r\n if (viewportRef)\r\n viewportRef(screenViewport);\r\n\r\n Logger.logInfo(\"ViewportComponent\", `processing viewManager.addViewport for controlId=${controlId}`);\r\n viewManager.addViewport(screenViewport);\r\n\r\n // overlay component is set up once a ScreenViewport is available. The overlay component must handle any view changes itself.\r\n setViewOverlay(getViewOverlay ? getViewOverlay(screenViewport) : null);\r\n } else {\r\n // istanbul ignore next\r\n screenViewportRef.current?.changeView(initialViewState);\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [controlId, initialViewState, viewportRef]);\r\n\r\n const handleContextMenu = React.useCallback((e: React.MouseEvent) => {\r\n e.preventDefault();\r\n if (onContextMenu)\r\n onContextMenu(e);\r\n }, [onContextMenu]);\r\n\r\n const parentDivStyle: React.CSSProperties = {\r\n height: \"100%\", width: \"100%\", position: \"relative\",\r\n };\r\n\r\n const viewportDivStyle: React.CSSProperties = {\r\n ...style,\r\n height: \"100%\", width: \"100%\",\r\n };\r\n\r\n return (\r\n <div style={parentDivStyle} data-item-id={controlId}\r\n >\r\n <>\r\n <div\r\n ref={viewportDiv}\r\n data-testid=\"viewport-component\"\r\n className={className}\r\n style={viewportDivStyle}\r\n onContextMenu={handleContextMenu}\r\n />\r\n {viewOverlay}\r\n </>\r\n </div>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"ViewportComponent.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponent.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,sDAA6C;AAE7C,wDAAiD;AACjD,oDAA+C;AAI/C,wDAE8B;AAK9B,uEACmC;AAkCnC;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAoB;IACpD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,mBAAmB,EAC9E,sBAAsB,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IACpH,uBAAuB;IACvB,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,yBAAS,CAAC,WAAW,CAAC,CAAC;IAClF,MAAM,yBAAyB,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;IACvE,MAAM,qBAAqB,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAi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AAa,CAAC,CAAC,CAAC;IAEpB,MAAM,cAAc,GAAwB;QAC1C,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU;KACpD,CAAC;IAEF,MAAM,gBAAgB,GAAwB;QAC5C,GAAG,KAAK;QACR,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;KAC9B,CAAC;IAEF,OAAO,CACL,6BAAK,KAAK,EAAE,cAAc,kBAAgB,SAAS;QAEjD;YACE,6BACE,GAAG,EAAE,WAAW,iBACJ,oBAAoB,EAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,iBAAiB,GAChC;YACD,WAAW,CACX,CACC,CACP,CAAC;AACJ,CAAC;AAxQD,8CAwQC","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 Viewport\n */\n\nimport * as React from \"react\";\nimport type { Id64String} from \"@itwin/core-bentley\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Point3d} from \"@itwin/core-geometry\";\nimport { Transform } from \"@itwin/core-geometry\";\nimport { NpcCenter } from \"@itwin/core-common\";\nimport type { IModelConnection,\n TentativePoint, ViewManager,\n Viewport} from \"@itwin/core-frontend\";\nimport {\n IModelApp, ScreenViewport, ToolSettings, ViewState,\n} from \"@itwin/core-frontend\";\n\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n CubeRotationChangeEventArgs, DrawingViewportChangeEventArgs, StandardRotationChangeEventArgs} from \"./ViewportComponentEvents\";\nimport { ViewportComponentEvents,\n} from \"./ViewportComponentEvents\";\n\n/** Type for a ViewState prop\n * @public\n */\nexport type ViewStateProp = ViewState | (() => ViewState);\n\n/**\n * Properties for [[ViewportComponent]] component.\n * @public\n */\nexport interface ViewportProps extends CommonProps {\n /** IModel to display */\n imodel: IModelConnection;\n /** Id of a default view definition to load as a starting point */\n viewDefinitionId?: Id64String;\n /** ViewState to use as a starting point */\n viewState?: ViewStateProp;\n /** Function to get a reference to the ScreenViewport */\n viewportRef?: (v: ScreenViewport) => void;\n /** controlId for this content component @internal */\n controlId?: string;\n /** @internal */\n onContextMenu?: (e: React.MouseEvent) => boolean;\n /** @internal */\n getViewOverlay?: (viewport: ScreenViewport) => React.ReactNode;\n /** @internal used only for testing */\n viewManagerOverride?: ViewManager;\n /** @internal used only for testing */\n screenViewportOverride?: typeof ScreenViewport;\n /** @internal used only for testing */\n tentativePointOverride?: TentativePoint;\n}\n\n/**\n * A viewport React component that creates a ScreenViewport.\n * @public\n */\nexport function ViewportComponent(props: ViewportProps) {\n const { viewState, imodel, viewDefinitionId, getViewOverlay, viewManagerOverride,\n tentativePointOverride, onContextMenu, style, className, screenViewportOverride, controlId, viewportRef } = props;\n // istanbul ignore next\n const viewManagerRef = React.useRef(viewManagerOverride ?? IModelApp.viewManager);\n const tentativePointOverrideRef = React.useRef(tentativePointOverride);\n const screenViewportCreated = React.useRef(false);\n const viewportDiv = React.useRef<HTMLDivElement>(null);\n const screenViewportRef = React.useRef<ScreenViewport | null>(null);\n const isMounted = React.useRef(false);\n const viewClassFullName = React.useRef(\"\");\n const viewId = React.useRef(\"0\");\n\n // istanbul ignore next\n const handleViewChanged = (vp: Viewport) => {\n // istanbul ignore next\n if (!(vp.iModel.isOpen || vp.iModel.isBlank))\n return;\n ViewportComponentEvents.setViewMatrix(vp);\n if (viewClassFullName.current !== vp.view.classFullName) {\n setTimeout(() => {\n ViewportComponentEvents.onViewClassFullNameChangedEvent.emit({ viewport: vp, oldName: viewClassFullName.current, newName: vp.view.classFullName });\n viewClassFullName.current = vp.view.classFullName;\n });\n }\n if (viewId.current !== vp.view.id) {\n setTimeout(() => {\n ViewportComponentEvents.onViewIdChangedEvent.emit({ viewport: vp, oldId: viewId.current, newId: vp.view.id });\n viewId.current = vp.view.id;\n });\n }\n };\n\n const handleStandardRotationChangeEvent = (args: StandardRotationChangeEventArgs) => {\n const viewManager = viewManagerRef.current;\n const currentScreenViewport = screenViewportRef.current;\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\n currentScreenViewport.view.setRotationAboutPoint(ViewState.getStandardViewMatrix(args.standardRotation));\n currentScreenViewport.synchWithView();\n }\n };\n\n const handleDrawingViewportChangeEvent = (args: DrawingViewportChangeEventArgs) => {\n const viewManager = viewManagerRef.current;\n const currentScreenViewport = screenViewportRef.current;\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\n currentScreenViewport.view.setOrigin(args.origin);\n currentScreenViewport.view.setRotation(args.rotation);\n currentScreenViewport.synchWithView({ noSaveInUndo: args.complete !== true });\n }\n };\n\n const targetPoint = React.useRef<Point3d | null>(null);\n\n const getRotatePoint = (vp: ScreenViewport): Point3d => {\n const lastTargetPoint = targetPoint.current;\n // istanbul ignore next\n const tentativePoint = tentativePointOverrideRef.current ?? IModelApp.tentativePoint;\n // istanbul ignore else\n if (tentativePoint.isActive)\n return tentativePoint.getPoint();\n\n // istanbul ignore else\n if (undefined !== vp.viewCmdTargetCenter) {\n const testPt = vp.worldToView(vp.viewCmdTargetCenter);\n const viewRect = vp.viewRect;\n if (viewRect.containsPoint(testPt))\n return vp.viewCmdTargetCenter;\n vp.viewCmdTargetCenter = undefined;\n }\n\n // istanbul ignore else\n if (null !== lastTargetPoint) {\n const testPt = vp.worldToView(lastTargetPoint);\n const viewRect = vp.viewRect.clone();\n viewRect.scaleAboutCenter(0.25, 0.25);\n // istanbul ignore next hard to reach because of mocks\n if (viewRect.containsPoint(testPt))\n return lastTargetPoint;\n targetPoint.current = null;\n }\n\n const visiblePoint = vp.pickNearestVisibleGeometry(vp.npcToWorld(NpcCenter), vp.pixelsFromInches(ToolSettings.viewToolPickRadiusInches));\n targetPoint.current = (undefined !== visiblePoint ? visiblePoint : vp.view.getTargetPoint());\n // istanbul ignore next\n return targetPoint.current ?? vp.view.getCenter();\n };\n\n const handleCubeRotationChangeEvent = (args: CubeRotationChangeEventArgs) => {\n const viewManager = viewManagerRef.current;\n const currentScreenViewport = screenViewportRef.current;\n // istanbul ignore else\n if (currentScreenViewport && viewManager.selectedView === currentScreenViewport) {\n const rotMatrix = args.rotMatrix;\n // istanbul ignore else\n if (currentScreenViewport.rotation !== rotMatrix) {\n const inverse = rotMatrix.transpose(); // rotation is from current nav cube state...\n const center = getRotatePoint(currentScreenViewport);\n const targetMatrix = inverse.multiplyMatrixMatrix(currentScreenViewport.view.getRotation());\n const worldTransform = Transform.createFixedPointAndMatrix(center, targetMatrix);\n const frustum = currentScreenViewport.getWorldFrustum();\n frustum.multiply(worldTransform);\n currentScreenViewport.view.setupFromFrustum(frustum);\n currentScreenViewport.synchWithView({ noSaveInUndo: !args.complete });\n }\n }\n };\n\n const handleDisconnectFromViewManager = () => {\n const screenViewport = screenViewportRef.current;\n if (screenViewport) {\n const viewManager = IModelApp.viewManager;\n screenViewport.onViewChanged.removeListener(handleViewChanged);\n screenViewportRef.current = null;\n screenViewportCreated.current = false;\n ViewportComponentEvents.onDrawingViewportChangeEvent.removeListener(handleDrawingViewportChangeEvent);\n ViewportComponentEvents.onCubeRotationChangeEvent.removeListener(handleCubeRotationChangeEvent);\n ViewportComponentEvents.onStandardRotationChangeEvent.removeListener(handleStandardRotationChangeEvent);\n viewManager.dropViewport(screenViewport, true);\n }\n };\n\n // istanbul ignore next\n const handleWindowUnload = () => {\n const parentDiv = viewportDiv.current;\n if (parentDiv) {\n const parentWindow = parentDiv.ownerDocument.defaultView as Window;\n if (parentWindow !== window) {\n handleDisconnectFromViewManager();\n }\n }\n };\n\n const getScreenViewport = (parentDiv: HTMLDivElement, inViewState: ViewState) => {\n // istanbul ignore next\n const screenViewportFactory = screenViewportOverride ? screenViewportOverride : ScreenViewport;\n const parentWindow = parentDiv.ownerDocument.defaultView as Window;\n parentWindow.addEventListener(\"unload\", handleWindowUnload, true); // listener clear after being called\n ViewportComponentEvents.initialize();\n ViewportComponentEvents.onDrawingViewportChangeEvent.addListener(handleDrawingViewportChangeEvent);\n ViewportComponentEvents.onCubeRotationChangeEvent.addListener(handleCubeRotationChangeEvent);\n ViewportComponentEvents.onStandardRotationChangeEvent.addListener(handleStandardRotationChangeEvent);\n const screenViewport = screenViewportFactory.create(parentDiv, inViewState);\n screenViewportCreated.current = true;\n viewClassFullName.current = screenViewport.view.classFullName;\n viewId.current = screenViewport.view.id;\n screenViewport.onViewChanged.addListener(handleViewChanged);\n return screenViewport;\n };\n\n React.useEffect(() => {\n isMounted.current = true;\n Logger.logInfo(\"ViewportComponent\", `mounting ViewportComponent for controlId=${controlId}`);\n\n return () => {\n isMounted.current = false;\n Logger.logInfo(\"ViewportComponent\", `un-mounting ViewportComponent for controlId=${controlId}`);\n handleDisconnectFromViewManager();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const [initialViewState, setInitialViewState] = React.useState<ViewState | undefined>(() => {\n if (viewState) {\n if (typeof viewState === \"function\")\n return viewState().clone();\n else\n return viewState.clone();\n }\n return undefined;\n });\n\n React.useEffect(() => {\n setInitialViewState(undefined);\n }, [viewDefinitionId, viewState]);\n React.useEffect(() => {\n async function fetchInitialViewstate() {\n let currentViewState: ViewState | undefined;\n if (viewState) {\n if (typeof viewState === \"function\")\n currentViewState = viewState();\n else\n currentViewState = viewState;\n } else if (viewDefinitionId && imodel) {\n try {\n currentViewState = await imodel.views.load(viewDefinitionId);\n // istanbul ignore next\n if (!currentViewState) {\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\n }\n } catch (_e) {\n // istanbul ignore next\n Logger.logError(\"ViewportComponent\", `Viewstate failed to load`);\n }\n } else {\n Logger.logError(\"ViewportComponent\", `A Viewstate or a viewId and imodel must be provided`);\n }\n // istanbul ignore next\n if (isMounted.current && (currentViewState?.iModel.isOpen || currentViewState?.iModel.isBlank)) {\n setInitialViewState(currentViewState?.clone());\n }\n }\n if (undefined === initialViewState)\n fetchInitialViewstate(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }, [imodel, initialViewState, viewDefinitionId, viewState]);\n\n const [viewOverlay, setViewOverlay] = React.useState<React.ReactNode>(null);\n\n // This useEffect connects to ViewManger as soon as initialViewState is available once component is mounted.\n React.useEffect(() => {\n const parentDiv = viewportDiv.current;\n const viewManager = viewManagerRef.current;\n // istanbul ignore next\n if (parentDiv && initialViewState && (initialViewState?.iModel.isOpen || initialViewState?.iModel.isBlank)) {\n if (!screenViewportCreated.current) {\n const screenViewport = getScreenViewport(parentDiv, initialViewState);\n screenViewportRef.current = screenViewport;\n\n if (viewportRef)\n viewportRef(screenViewport);\n\n Logger.logInfo(\"ViewportComponent\", `processing viewManager.addViewport for controlId=${controlId}`);\n viewManager.addViewport(screenViewport);\n\n // overlay component is set up once a ScreenViewport is available. The overlay component must handle any view changes itself.\n setViewOverlay(getViewOverlay ? getViewOverlay(screenViewport) : null);\n } else {\n // istanbul ignore next\n screenViewportRef.current?.changeView(initialViewState);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [controlId, initialViewState, viewportRef]);\n\n const handleContextMenu = React.useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n if (onContextMenu)\n onContextMenu(e);\n }, [onContextMenu]);\n\n const parentDivStyle: React.CSSProperties = {\n height: \"100%\", width: \"100%\", position: \"relative\",\n };\n\n const viewportDivStyle: React.CSSProperties = {\n ...style,\n height: \"100%\", width: \"100%\",\n };\n\n return (\n <div style={parentDivStyle} data-item-id={controlId}\n >\n <>\n <div\n ref={viewportDiv}\n data-testid=\"viewport-component\"\n className={className}\n style={viewportDivStyle}\n onContextMenu={handleContextMenu}\n />\n {viewOverlay}\n </>\n </div>\n );\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module Viewport
3
3
  */
4
4
  import { Matrix3d, Point3d, Vector3d } from "@itwin/core-geometry";
5
- import { StandardViewId, Viewport } from "@itwin/core-frontend";
5
+ import type { StandardViewId, Viewport } from "@itwin/core-frontend";
6
6
  import { UiEvent } from "@itwin/appui-abstract";
7
7
  import { Face } from "../navigationaids/Cube";
8
8
  /** Arguments for [[DrawingViewportChangeEvent]]
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportComponentEvents.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAA0C,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,OAAO,CAAC,8BAA8B,CAAC;CAAI;AAE3F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,QAAQ,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,2BAA2B,CAAC;CAAI;AAErF;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,EAAE,cAAc,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,OAAO,CAAC,+BAA+B,CAAC;CAAI;AAE7F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,2BAA2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E"}
1
+ {"version":3,"file":"ViewportComponentEvents.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAA+B,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAElG,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,OAAO,CAAC,8BAA8B,CAAC;CAAI;AAE3F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,QAAQ,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,2BAA2B,CAAC;CAAI;AAErF;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,EAAE,cAAc,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,OAAO,CAAC,+BAA+B,CAAC;CAAI;AAE7F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,OAAO,CAAC,2BAA2B,CAAC;CAAI;AAErF;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,MAA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AAI,0BAA0B,EAAE,CAAC;AAChE,iDAAyB,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAC1D,qDAA6B,GAAG,IAAI,2BAA2B,EAAE,CAAC;AAClE,iDAAyB,GAAG,IAAI,uBAAuB,EAAE,CAAC;AAC1D,uDAA+B,GAAG,IAAI,6BAA6B,EAAE,CAAC;AACtE,4CAAoB,GAAG,IAAI,kBAAkB,EAAE,CAAC;AA3B5D,0DAAuB","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 Viewport\r\n */\r\n\r\nimport { Matrix3d, Point3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { IModelApp, SelectedViewportChangedArgs, StandardViewId, Viewport } from \"@itwin/core-frontend\";\r\nimport { UiEvent } from \"@itwin/appui-abstract\";\r\nimport { Face } from \"../navigationaids/Cube\";\r\n\r\n/** Arguments for [[DrawingViewportChangeEvent]]\r\n * @public\r\n */\r\nexport interface DrawingViewportChangeEventArgs {\r\n rotation: Matrix3d;\r\n origin: Point3d;\r\n complete: boolean;\r\n}\r\n\r\n/** Drawing View Change event\r\n * @public\r\n */\r\nexport class DrawingViewportChangeEvent extends UiEvent<DrawingViewportChangeEventArgs> { }\r\n\r\n/** Arguments for [[CubeRotationChangeEvent]]\r\n * @public\r\n */\r\nexport interface CubeRotationChangeEventArgs {\r\n rotMatrix: Matrix3d;\r\n face: Face;\r\n complete?: boolean;\r\n}\r\n\r\n/** 3d Cube Rotation Change event\r\n * @public\r\n */\r\nexport class CubeRotationChangeEvent extends UiEvent<CubeRotationChangeEventArgs> { }\r\n\r\n/** Arguments for [[StandardRotationChangeEvent]]\r\n * @public\r\n */\r\nexport interface StandardRotationChangeEventArgs {\r\n standardRotation: StandardViewId;\r\n}\r\n\r\n/** Standard Rotation Change event\r\n * @public\r\n */\r\nexport class StandardRotationChangeEvent extends UiEvent<StandardRotationChangeEventArgs> { }\r\n\r\n/** Arguments for [[ViewRotationChangeEvent]]\r\n * @public\r\n */\r\nexport interface ViewRotationChangeEventArgs {\r\n viewport: Viewport;\r\n animationTime?: number;\r\n}\r\n\r\n/** View Rotation Change event\r\n * @public\r\n */\r\nexport class ViewRotationChangeEvent extends UiEvent<ViewRotationChangeEventArgs> { }\r\n\r\n/** Arguments for [[ViewClassFullNameChangedEvent]]\r\n * @public\r\n */\r\nexport interface ViewClassFullNameChangedEventArgs {\r\n viewport: Viewport;\r\n oldName: string;\r\n newName: string;\r\n}\r\n\r\n/** View Class Full Name Change event\r\n * @public\r\n */\r\nexport class ViewClassFullNameChangedEvent extends UiEvent<ViewClassFullNameChangedEventArgs> { }\r\n\r\n/** Arguments for [[ViewIdChangedEvent]]\r\n * @public\r\n */\r\nexport interface ViewIdChangedEventArgs {\r\n viewport: Viewport;\r\n oldId: string;\r\n newId: string;\r\n}\r\n\r\n/** View Id Change event\r\n * @public\r\n */\r\nexport class ViewIdChangedEvent extends UiEvent<ViewIdChangedEventArgs> { }\r\n\r\n/** Viewport Rotation events and methods\r\n * @public\r\n */\r\nexport class ViewportComponentEvents {\r\n private static _removeListener?: () => void;\r\n\r\n public static initialize() {\r\n if (undefined !== this._removeListener)\r\n return;\r\n\r\n this._removeListener = IModelApp.viewManager.onSelectedViewportChanged.addListener(ViewportComponentEvents.handleSelectedViewportChanged);\r\n }\r\n\r\n /** @internal - for unit testing */\r\n public static terminate() {\r\n if (this._removeListener) {\r\n this._removeListener();\r\n this._removeListener = undefined;\r\n }\r\n }\r\n\r\n public static face = Face.None;\r\n public static readonly origin = Point3d.createZero();\r\n public static readonly extents = Vector3d.createZero();\r\n public static readonly rotationMatrix = Matrix3d.createIdentity();\r\n public static readonly onDrawingViewportChangeEvent = new DrawingViewportChangeEvent();\r\n public static readonly onCubeRotationChangeEvent = new CubeRotationChangeEvent();\r\n public static readonly onStandardRotationChangeEvent = new StandardRotationChangeEvent();\r\n public static readonly onViewRotationChangeEvent = new ViewRotationChangeEvent();\r\n public static readonly onViewClassFullNameChangedEvent = new ViewClassFullNameChangedEvent();\r\n public static readonly onViewIdChangedEvent = new ViewIdChangedEvent();\r\n\r\n private static handleSelectedViewportChanged(args: SelectedViewportChangedArgs): void {\r\n if (args.current)\r\n ViewportComponentEvents.setViewMatrix(args.current);\r\n }\r\n\r\n public static setCubeMatrix(rotMatrix: Matrix3d, face = Face.None, complete: boolean = false): void {\r\n this.rotationMatrix.setFrom(rotMatrix);\r\n this.face = face;\r\n this.onCubeRotationChangeEvent.emit({ rotMatrix, complete, face });\r\n }\r\n\r\n public static setDrawingViewportState(origin: Point3d, rotation: Matrix3d, complete: boolean = false): void {\r\n this.onDrawingViewportChangeEvent.emit({ origin, rotation, complete });\r\n }\r\n\r\n public static setStandardRotation(standardRotation: StandardViewId): void {\r\n this.onStandardRotationChangeEvent.emit({ standardRotation });\r\n }\r\n\r\n public static setViewMatrix(viewport: Viewport, animationTime?: number): void {\r\n // When handling onViewChanged, use setTimeout\r\n setTimeout(() => {\r\n // istanbul ignore next\r\n if (viewport.view) {\r\n this.origin.setFrom(viewport.view.getOrigin());\r\n this.extents.setFrom(viewport.view.getExtents());\r\n }\r\n this.rotationMatrix.setFrom(viewport.rotation);\r\n\r\n this.onViewRotationChangeEvent.emit({ viewport, animationTime });\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ViewportComponentEvents.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponentEvents.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAmE;AAEnE,wDAAiD;AACjD,0DAAgD;AAChD,iDAA8C;AAW9C;;GAEG;AACH,MAAa,0BAA2B,SAAQ,wBAAuC;CAAI;AAA3F,gEAA2F;AAW3F;;GAEG;AACH,MAAa,uBAAwB,SAAQ,wBAAoC;CAAI;AAArF,0DAAqF;AASrF;;GAEG;AACH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;AA3B5D,0DAAuB","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 Viewport\n */\n\nimport { Matrix3d, Point3d, Vector3d } from \"@itwin/core-geometry\";\nimport type { SelectedViewportChangedArgs, StandardViewId, Viewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UiEvent } from \"@itwin/appui-abstract\";\nimport { Face } from \"../navigationaids/Cube\";\n\n/** Arguments for [[DrawingViewportChangeEvent]]\n * @public\n */\nexport interface DrawingViewportChangeEventArgs {\n rotation: Matrix3d;\n origin: Point3d;\n complete: boolean;\n}\n\n/** Drawing View Change event\n * @public\n */\nexport class DrawingViewportChangeEvent extends UiEvent<DrawingViewportChangeEventArgs> { }\n\n/** Arguments for [[CubeRotationChangeEvent]]\n * @public\n */\nexport interface CubeRotationChangeEventArgs {\n rotMatrix: Matrix3d;\n face: Face;\n complete?: boolean;\n}\n\n/** 3d Cube Rotation Change event\n * @public\n */\nexport class CubeRotationChangeEvent extends UiEvent<CubeRotationChangeEventArgs> { }\n\n/** Arguments for [[StandardRotationChangeEvent]]\n * @public\n */\nexport interface StandardRotationChangeEventArgs {\n standardRotation: StandardViewId;\n}\n\n/** Standard Rotation Change event\n * @public\n */\nexport class StandardRotationChangeEvent extends UiEvent<StandardRotationChangeEventArgs> { }\n\n/** Arguments for [[ViewRotationChangeEvent]]\n * @public\n */\nexport interface ViewRotationChangeEventArgs {\n viewport: Viewport;\n animationTime?: number;\n}\n\n/** View Rotation Change event\n * @public\n */\nexport class ViewRotationChangeEvent extends UiEvent<ViewRotationChangeEventArgs> { }\n\n/** Arguments for [[ViewClassFullNameChangedEvent]]\n * @public\n */\nexport interface ViewClassFullNameChangedEventArgs {\n viewport: Viewport;\n oldName: string;\n newName: string;\n}\n\n/** View Class Full Name Change event\n * @public\n */\nexport class ViewClassFullNameChangedEvent extends UiEvent<ViewClassFullNameChangedEventArgs> { }\n\n/** Arguments for [[ViewIdChangedEvent]]\n * @public\n */\nexport interface ViewIdChangedEventArgs {\n viewport: Viewport;\n oldId: string;\n newId: string;\n}\n\n/** View Id Change event\n * @public\n */\nexport class ViewIdChangedEvent extends UiEvent<ViewIdChangedEventArgs> { }\n\n/** Viewport Rotation events and methods\n * @public\n */\nexport class ViewportComponentEvents {\n private static _removeListener?: () => void;\n\n public static initialize() {\n if (undefined !== this._removeListener)\n return;\n\n this._removeListener = IModelApp.viewManager.onSelectedViewportChanged.addListener(ViewportComponentEvents.handleSelectedViewportChanged);\n }\n\n /** @internal - for unit testing */\n public static terminate() {\n if (this._removeListener) {\n this._removeListener();\n this._removeListener = undefined;\n }\n }\n\n public static face = Face.None;\n public static readonly origin = Point3d.createZero();\n public static readonly extents = Vector3d.createZero();\n public static readonly rotationMatrix = Matrix3d.createIdentity();\n public static readonly onDrawingViewportChangeEvent = new DrawingViewportChangeEvent();\n public static readonly onCubeRotationChangeEvent = new CubeRotationChangeEvent();\n public static readonly onStandardRotationChangeEvent = new StandardRotationChangeEvent();\n public static readonly onViewRotationChangeEvent = new ViewRotationChangeEvent();\n public static readonly onViewClassFullNameChangedEvent = new ViewClassFullNameChangedEvent();\n public static readonly onViewIdChangedEvent = new ViewIdChangedEvent();\n\n private static handleSelectedViewportChanged(args: SelectedViewportChangedArgs): void {\n if (args.current)\n ViewportComponentEvents.setViewMatrix(args.current);\n }\n\n public static setCubeMatrix(rotMatrix: Matrix3d, face = Face.None, complete: boolean = false): void {\n this.rotationMatrix.setFrom(rotMatrix);\n this.face = face;\n this.onCubeRotationChangeEvent.emit({ rotMatrix, complete, face });\n }\n\n public static setDrawingViewportState(origin: Point3d, rotation: Matrix3d, complete: boolean = false): void {\n this.onDrawingViewportChangeEvent.emit({ origin, rotation, complete });\n }\n\n public static setStandardRotation(standardRotation: StandardViewId): void {\n this.onStandardRotationChangeEvent.emit({ standardRotation });\n }\n\n public static setViewMatrix(viewport: Viewport, animationTime?: number): void {\n // When handling onViewChanged, use setTimeout\n setTimeout(() => {\n // istanbul ignore next\n if (viewport.view) {\n this.origin.setFrom(viewport.view.getOrigin());\n this.extents.setFrom(viewport.view.getExtents());\n }\n this.rotationMatrix.setFrom(viewport.rotation);\n\n this.onViewRotationChangeEvent.emit({ viewport, animationTime });\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"imodel-components-react.js","sourceRoot":"","sources":["../../src/imodel-components-react.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,qEAAqE;AAErE,mFAAkF;AAAzE,wHAAA,kBAAkB,OAAA;AAE3B,8EAA4D;AAC5D,oFAAkE;AAClE,oFAAkE;AAClE,mFAAiE;AACjE,qFAAmE;AACnE,4EAA0D;AAC1D,mFAAiE;AACjE,yEAAuD;AAEvD,gFAA8D;AAC9D,iFAA+D;AAE/D,iFAA+D;AAC/D,uFAAqE;AAErE,8EAA4D;AAC5D,0FAAwE;AAExE,gFAA8D;AAC9D,6FAA2E;AAC3E,gGAA8E;AAE9E,uFAAqE;AACrE,2FAAyE;AACzE,wFAAsE;AACtE,sFAAoE;AACpE,2FAAyE;AACzE,uFAAqE;AACrE,6FAA2E;AAC3E,+FAA6E;AAE7E,gFAA8D;AAC9D,8FAA4E;AAC5E,gFAA8D;AAC9D,kFAAgE;AAChE,8EAA4D;AAC5D,uFAAqE;AACrE,mFAAiE;AACjE,2FAAyE;AAEzE,uFAAqE;AACrE,6FAA2E;AAE3E;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\r\n// cSpell:ignore iconpicker lineweight hocs datepicker quantityformat\r\n\r\nexport { UiIModelComponents } from \"./imodel-components-react/UiIModelComponents\";\r\n\r\nexport * from \"./imodel-components-react/color/AlphaSlider\";\r\nexport * from \"./imodel-components-react/color/ColorPickerButton\";\r\nexport * from \"./imodel-components-react/color/ColorPickerDialog\";\r\nexport * from \"./imodel-components-react/color/ColorPickerPopup\";\r\nexport * from \"./imodel-components-react/color/getCSSColorFromDef\";\r\nexport * from \"./imodel-components-react/color/HueSlider\";\r\nexport * from \"./imodel-components-react/color/SaturationPicker\";\r\nexport * from \"./imodel-components-react/color/Swatch\";\r\n\r\nexport * from \"./imodel-components-react/editors/ColorEditor\";\r\nexport * from \"./imodel-components-react/editors/WeightEditor\";\r\n\r\nexport * from \"./imodel-components-react/inputs/QuantityInput\";\r\nexport * from \"./imodel-components-react/inputs/QuantityNumberInput\";\r\n\r\nexport * from \"./imodel-components-react/lineweight/Swatch\";\r\nexport * from \"./imodel-components-react/lineweight/WeightPickerButton\";\r\n\r\nexport * from \"./imodel-components-react/navigationaids/Cube\";\r\nexport * from \"./imodel-components-react/navigationaids/CubeNavigationAid\";\r\nexport * from \"./imodel-components-react/navigationaids/DrawingNavigationAid\";\r\n\r\nexport * from \"./imodel-components-react/quantityformat/FormatPanel\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatPrecision\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatSample\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatType\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatUnitLabel\";\r\nexport * from \"./imodel-components-react/quantityformat/FormatUnits\";\r\nexport * from \"./imodel-components-react/quantityformat/MiscFormatOptions\";\r\nexport * from \"./imodel-components-react/quantityformat/QuantityFormatPanel\";\r\n\r\nexport * from \"./imodel-components-react/timeline/interfaces\";\r\nexport * from \"./imodel-components-react/timeline/BaseTimelineDataProvider\";\r\nexport * from \"./imodel-components-react/timeline/InlineEdit\";\r\nexport * from \"./imodel-components-react/timeline/PlayerButton\";\r\nexport * from \"./imodel-components-react/timeline/Scrubber\";\r\nexport * from \"./imodel-components-react/timeline/TimelineComponent\";\r\nexport * from \"./imodel-components-react/timeline/SolarTimeline\";\r\nexport * from \"./imodel-components-react/timeline/BaseSolarDataProvider\";\r\n\r\nexport * from \"./imodel-components-react/viewport/ViewportComponent\";\r\nexport * from \"./imodel-components-react/viewport/ViewportComponentEvents\";\r\n\r\n/** @docs-package-description\r\n * The imodel-components-react package contains React components that depend on the core-frontend, core-common or core-quantity packages.\r\n * The components pertain to Color, Cube, LineWeight, Navigation Aids, Quantity Inputs, Timeline and Viewport.\r\n * For more information, see [learning about imodel-components-react]($docs/learning/ui/imodel-components/index.md).\r\n */\r\n/**\r\n * @docs-group-description Color\r\n * Classes and components for working with and picking a Color.\r\n */\r\n/**\r\n * @docs-group-description Common\r\n * Common classes used across various UI components.\r\n */\r\n/**\r\n * @docs-group-description Cube\r\n * Component for 3D Cube.\r\n */\r\n/**\r\n * @docs-group-description Inputs\r\n * Input Components that format and parse input for IModelApps.\r\n */\r\n/**\r\n * @docs-group-description LineWeight\r\n * Classes and components for working with and picking a Line Weight.\r\n */\r\n/**\r\n * @docs-group-description NavigationAids\r\n * Classes and components for working with Navigation Aids.\r\n */\r\n/**\r\n * @docs-group-description PropertyEditors\r\n * Classes and components for working with Property Editors.\r\n */\r\n/**\r\n * @docs-group-description QuantityFormat\r\n * Classes and components for working with a Quantity Formats.\r\n */\r\n/**\r\n * @docs-group-description Timeline\r\n * Classes and components that provide a timeline\r\n */\r\n/**\r\n * @docs-group-description Viewport\r\n * Classes and components for working with a Viewport.\r\n */\r\n"]}
1
+ {"version":3,"file":"imodel-components-react.js","sourceRoot":"","sources":["../../src/imodel-components-react.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;AAE/F,qEAAqE;AAErE,mFAAkF;AAAzE,wHAAA,kBAAkB,OAAA;AAE3B,8EAA4D;AAC5D,oFAAkE;AAClE,oFAAkE;AAClE,mFAAiE;AACjE,qFAAmE;AACnE,4EAA0D;AAC1D,mFAAiE;AACjE,yEAAuD;AAEvD,gFAA8D;AAC9D,iFAA+D;AAE/D,iFAA+D;AAC/D,uFAAqE;AAErE,8EAA4D;AAC5D,0FAAwE;AAExE,gFAA8D;AAC9D,6FAA2E;AAC3E,gGAA8E;AAE9E,uFAAqE;AACrE,2FAAyE;AACzE,wFAAsE;AACtE,sFAAoE;AACpE,2FAAyE;AACzE,uFAAqE;AACrE,6FAA2E;AAC3E,+FAA6E;AAE7E,gFAA8D;AAC9D,8FAA4E;AAC5E,gFAA8D;AAC9D,kFAAgE;AAChE,8EAA4D;AAC5D,uFAAqE;AACrE,mFAAiE;AACjE,2FAAyE;AAEzE,uFAAqE;AACrE,6FAA2E;AAE3E;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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\n// cSpell:ignore iconpicker lineweight hocs datepicker quantityformat\n\nexport { UiIModelComponents } from \"./imodel-components-react/UiIModelComponents\";\n\nexport * from \"./imodel-components-react/color/AlphaSlider\";\nexport * from \"./imodel-components-react/color/ColorPickerButton\";\nexport * from \"./imodel-components-react/color/ColorPickerDialog\";\nexport * from \"./imodel-components-react/color/ColorPickerPopup\";\nexport * from \"./imodel-components-react/color/getCSSColorFromDef\";\nexport * from \"./imodel-components-react/color/HueSlider\";\nexport * from \"./imodel-components-react/color/SaturationPicker\";\nexport * from \"./imodel-components-react/color/Swatch\";\n\nexport * from \"./imodel-components-react/editors/ColorEditor\";\nexport * from \"./imodel-components-react/editors/WeightEditor\";\n\nexport * from \"./imodel-components-react/inputs/QuantityInput\";\nexport * from \"./imodel-components-react/inputs/QuantityNumberInput\";\n\nexport * from \"./imodel-components-react/lineweight/Swatch\";\nexport * from \"./imodel-components-react/lineweight/WeightPickerButton\";\n\nexport * from \"./imodel-components-react/navigationaids/Cube\";\nexport * from \"./imodel-components-react/navigationaids/CubeNavigationAid\";\nexport * from \"./imodel-components-react/navigationaids/DrawingNavigationAid\";\n\nexport * from \"./imodel-components-react/quantityformat/FormatPanel\";\nexport * from \"./imodel-components-react/quantityformat/FormatPrecision\";\nexport * from \"./imodel-components-react/quantityformat/FormatSample\";\nexport * from \"./imodel-components-react/quantityformat/FormatType\";\nexport * from \"./imodel-components-react/quantityformat/FormatUnitLabel\";\nexport * from \"./imodel-components-react/quantityformat/FormatUnits\";\nexport * from \"./imodel-components-react/quantityformat/MiscFormatOptions\";\nexport * from \"./imodel-components-react/quantityformat/QuantityFormatPanel\";\n\nexport * from \"./imodel-components-react/timeline/interfaces\";\nexport * from \"./imodel-components-react/timeline/BaseTimelineDataProvider\";\nexport * from \"./imodel-components-react/timeline/InlineEdit\";\nexport * from \"./imodel-components-react/timeline/PlayerButton\";\nexport * from \"./imodel-components-react/timeline/Scrubber\";\nexport * from \"./imodel-components-react/timeline/TimelineComponent\";\nexport * from \"./imodel-components-react/timeline/SolarTimeline\";\nexport * from \"./imodel-components-react/timeline/BaseSolarDataProvider\";\n\nexport * from \"./imodel-components-react/viewport/ViewportComponent\";\nexport * from \"./imodel-components-react/viewport/ViewportComponentEvents\";\n\n/** @docs-package-description\n * The imodel-components-react package contains React components that depend on the core-frontend, core-common or core-quantity packages.\n * The components pertain to Color, Cube, LineWeight, Navigation Aids, Quantity Inputs, Timeline and Viewport.\n * For more information, see [learning about imodel-components-react]($docs/learning/ui/imodel-components/index.md).\n */\n/**\n * @docs-group-description Color\n * Classes and components for working with and picking a Color.\n */\n/**\n * @docs-group-description Common\n * Common classes used across various UI components.\n */\n/**\n * @docs-group-description Cube\n * Component for 3D Cube.\n */\n/**\n * @docs-group-description Inputs\n * Input Components that format and parse input for IModelApps.\n */\n/**\n * @docs-group-description LineWeight\n * Classes and components for working with and picking a Line Weight.\n */\n/**\n * @docs-group-description NavigationAids\n * Classes and components for working with Navigation Aids.\n */\n/**\n * @docs-group-description PropertyEditors\n * Classes and components for working with Property Editors.\n */\n/**\n * @docs-group-description QuantityFormat\n * Classes and components for working with a Quantity Formats.\n */\n/**\n * @docs-group-description Timeline\n * Classes and components that provide a timeline\n */\n/**\n * @docs-group-description Viewport\n * Classes and components for working with a Viewport.\n */\n"]}
@@ -19,11 +19,12 @@ class UiIModelComponents {
19
19
  * initialize UiIModelComponents.
20
20
  */
21
21
  static async initialize() {
22
+ var _a;
22
23
  if (UiIModelComponents._initialized) {
23
24
  Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);
24
25
  return;
25
26
  }
26
- await IModelApp.localization?.registerNamespace(UiIModelComponents.localizationNamespace);
27
+ await ((_a = IModelApp.localization) === null || _a === void 0 ? void 0 : _a.registerNamespace(UiIModelComponents.localizationNamespace));
27
28
  if (!IModelApp.localization) {
28
29
  // it should only get here in unit test where IModelApp is not setup
29
30
  const localization = new EmptyLocalization();
@@ -37,7 +38,8 @@ class UiIModelComponents {
37
38
  }
38
39
  /** Unregisters the UiIModelComponents localization namespace */
39
40
  static terminate() {
40
- IModelApp.localization?.unregisterNamespace(UiIModelComponents.localizationNamespace);
41
+ var _a;
42
+ (_a = IModelApp.localization) === null || _a === void 0 ? void 0 : _a.unregisterNamespace(UiIModelComponents.localizationNamespace);
41
43
  UiComponents.terminate();
42
44
  UiIModelComponents._initialized = false;
43
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC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,CAAC;IAC9B,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,kBAAkB,CAAC,WAAW,IAAI,0BAA0B,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE;YACzF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,+EAA+E,CAAC,CAAC;YAC1I,OAAO,EAAE,CAAC;SACX;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA7Dc,+BAAY,GAAG,KAAK,CAAC;SADzB,kBAAkB","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 { Logger } from \"@itwin/core-bentley\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { getClassName } from \"@itwin/appui-abstract\";\r\nimport { UiComponents } from \"@itwin/components-react\";\r\nimport { EmptyLocalization } from \"@itwin/core-common\";\r\n\r\n/**\r\n * Manages the localization service for the imodel-components-react package.\r\n * @public\r\n */\r\nexport class UiIModelComponents {\r\n private static _initialized = false;\r\n\r\n /**\r\n * initialize UiIModelComponents.\r\n */\r\n public static async initialize(): Promise<void> {\r\n if (UiIModelComponents._initialized) {\r\n Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);\r\n return;\r\n }\r\n\r\n await IModelApp.localization?.registerNamespace(UiIModelComponents.localizationNamespace);\r\n\r\n if (!IModelApp.localization) {\r\n // it should only get here in unit test where IModelApp is not setup\r\n const localization = new EmptyLocalization();\r\n await localization.initialize();\r\n await UiComponents.initialize(localization);\r\n } else {\r\n await UiComponents.initialize(IModelApp.localization);\r\n }\r\n\r\n UiIModelComponents._initialized = true;\r\n }\r\n\r\n /** Unregisters the UiIModelComponents localization namespace */\r\n public static terminate() {\r\n IModelApp.localization?.unregisterNamespace(UiIModelComponents.localizationNamespace);\r\n UiComponents.terminate();\r\n UiIModelComponents._initialized = false;\r\n }\r\n\r\n /** Determines if UiIModelComponents has been initialized */\r\n public static get initialized(): boolean { return UiIModelComponents._initialized; }\r\n\r\n /** The internationalization service namespace. */\r\n public static get localizationNamespace(): string {\r\n return \"UiIModelComponents\";\r\n }\r\n\r\n /** @internal */\r\n public static get packageName(): string {\r\n return \"imodel-components-react\";\r\n }\r\n\r\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiIModelComponents\" namespace. Do NOT include the namespace in the key.\r\n * @internal\r\n */\r\n public static translate(key: string | string[]): string {\r\n if (!UiIModelComponents.initialized || /* istanbul ignore next */ !IModelApp.localization) {\r\n Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);\r\n return \"\";\r\n }\r\n return IModelApp.localization.getLocalizedString(key, { ns: UiIModelComponents.localizationNamespace });\r\n }\r\n\r\n /** @internal */\r\n public static loggerCategory(obj: any): string {\r\n const className = getClassName(obj);\r\n const category = UiIModelComponents.packageName + (className ? `.${className}` : \"\");\r\n return category;\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"UiI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Y,GAAG,KAAK,CAAC;IAC1C,CAAC;IAED,4DAA4D;IACrD,MAAM,KAAK,WAAW,KAAc,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAAC;IAEpF,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,kBAAkB,CAAC,WAAW,IAAI,0BAA0B,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE;YACzF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,+EAA+E,CAAC,CAAC;YAC1I,OAAO,EAAE,CAAC;SACX;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrF,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA7Dc,+BAAY,GAAG,KAAK,CAAC;SADzB,kBAAkB","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 { Logger } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { getClassName } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"@itwin/components-react\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\n/**\n * Manages the localization service for the imodel-components-react package.\n * @public\n */\nexport class UiIModelComponents {\n private static _initialized = false;\n\n /**\n * initialize UiIModelComponents.\n */\n public static async initialize(): Promise<void> {\n if (UiIModelComponents._initialized) {\n Logger.logInfo(UiIModelComponents.loggerCategory(UiIModelComponents), `UiIModelComponents.initialize already called`);\n return;\n }\n\n await IModelApp.localization?.registerNamespace(UiIModelComponents.localizationNamespace);\n\n if (!IModelApp.localization) {\n // it should only get here in unit test where IModelApp is not setup\n const localization = new EmptyLocalization();\n await localization.initialize();\n await UiComponents.initialize(localization);\n } else {\n await UiComponents.initialize(IModelApp.localization);\n }\n\n UiIModelComponents._initialized = true;\n }\n\n /** Unregisters the UiIModelComponents localization namespace */\n public static terminate() {\n IModelApp.localization?.unregisterNamespace(UiIModelComponents.localizationNamespace);\n UiComponents.terminate();\n UiIModelComponents._initialized = false;\n }\n\n /** Determines if UiIModelComponents has been initialized */\n public static get initialized(): boolean { return UiIModelComponents._initialized; }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiIModelComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"imodel-components-react\";\n }\n\n /** Calls localization.getLocalizedStringWithNamespace with the \"UiIModelComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiIModelComponents.initialized || /* istanbul ignore next */ !IModelApp.localization) {\n Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);\n return \"\";\n }\n return IModelApp.localization.getLocalizedString(key, { ns: UiIModelComponents.localizationNamespace });\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getClassName(obj);\n const category = UiIModelComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import "./AlphaSlider.scss";
5
5
  import * as React from "react";
6
- import { CommonProps } from "@itwin/core-react";
6
+ import type { CommonProps } from "@itwin/core-react";
7
7
  /** Properties for the [[AlphaSlider]] React component
8
8
  * @public
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AlphaSlider.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW;IACzF,kFAAkF;IAClF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qDAAqD;IACrD,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACtD,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IACpE,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,kBAAkB,CAAsD;IAEhF,gBAAgB;gBACJ,KAAK,EAAE,gBAAgB;IAInC,OAAO,CAAC,gBAAgB,CA6DtB;IAEF,gBAAgB;IACA,oBAAoB;IAIpC,OAAO,CAAC,SAAS,CAMf;IAEF,OAAO,CAAC,YAAY,CAOlB;IAEF,OAAO,CAAC,UAAU,CA6BhB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,qBAAqB;IAK7B,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CA8B1C"}
1
+ {"version":3,"file":"AlphaSlider.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":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AAK,EAAE,YAAY,EAAE,SAAS,EAAC,0BAA0B,iBAAa,eAAe,GAAG,CACzF,CACF,CACP,CAAC;IACJ,CAAC;CAEF","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 Color\r\n */\r\n\r\nimport \"./AlphaSlider.scss\";\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\n\r\n/** Properties for the [[AlphaSlider]] React component\r\n * @public\r\n */\r\nexport interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {\r\n /** true if slider is oriented horizontal, else vertical orientation is assumed */\r\n isHorizontal?: boolean;\r\n /** function to run when user selects color swatch */\r\n onAlphaChange?: ((alpha: number) => void) | undefined;\r\n /** Alpha value between 0 (transparent) and 1 (opaque) */\r\n alpha: number;\r\n}\r\n\r\n/** AlphaSlider component used to set the alpha value.\r\n * @public\r\n */\r\nexport class AlphaSlider extends React.PureComponent<AlphaSliderProps> {\r\n private _container: HTMLDivElement | null = null;\r\n private _transparencyLabel = UiIModelComponents.translate(\"color.transparency\");\r\n\r\n /** @internal */\r\n constructor(props: AlphaSliderProps) {\r\n super(props);\r\n }\r\n\r\n private _calculateChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>, isHorizontal: boolean, alpha: number, container: HTMLDivElement): number | undefined => {\r\n e.preventDefault();\r\n const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();\r\n\r\n let x = 0;\r\n if (\"pageX\" in e) {\r\n x = e.pageX;\r\n } else {\r\n // istanbul ignore if\r\n if (undefined === e.touches)\r\n return undefined;\r\n x = e.touches[0].pageX;\r\n }\r\n // istanbul ignore if\r\n if (undefined === x)\r\n return undefined;\r\n\r\n let y = 0;\r\n if (\"pageY\" in e) {\r\n y = e.pageY;\r\n } else {\r\n // istanbul ignore if\r\n if (undefined === e.touches)\r\n return;\r\n y = e.touches[0].pageY;\r\n }\r\n // istanbul ignore if\r\n if (undefined === y)\r\n return undefined;\r\n\r\n const left = x - (container.getBoundingClientRect().left + window.scrollX);\r\n const top = y - (container.getBoundingClientRect().top + window.scrollY);\r\n\r\n let t = 0;\r\n\r\n if (!isHorizontal) {\r\n // istanbul ignore next\r\n if (top < 0) {\r\n t = 1;\r\n } else if (top > containerHeight) {\r\n t = 0;\r\n } else {\r\n t = 1 - (top / containerHeight);\r\n }\r\n } else { // horizontal\r\n // istanbul ignore next\r\n if (left < 0) {\r\n t = 0;\r\n } else if (left > containerWidth) {\r\n t = 1;\r\n } else {\r\n t = left / containerWidth;\r\n }\r\n }\r\n\r\n // istanbul ignore if\r\n if (t < 0) t = 0;\r\n // istanbul ignore if\r\n if (t > 1) t = 1;\r\n // istanbul ignore next\r\n return (alpha !== t) ? t : undefined;\r\n };\r\n\r\n /** @internal */\r\n public override componentWillUnmount() {\r\n this._unbindEventListeners();\r\n }\r\n\r\n private _onChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => {\r\n // istanbul ignore else\r\n if (this._container && this.props.onAlphaChange) {\r\n const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);\r\n undefined !== change && typeof this.props.onAlphaChange === \"function\" && this.props.onAlphaChange(change);\r\n }\r\n };\r\n\r\n private _onMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\r\n this._onChange(e);\r\n // istanbul ignore else\r\n if (this._container)\r\n this._container.focus();\r\n window.addEventListener(\"mousemove\", this._onChange as any);\r\n window.addEventListener(\"mouseup\", this._onMouseUp);\r\n };\r\n\r\n private _onKeyDown = (evt: React.KeyboardEvent<HTMLDivElement>) => {\r\n let newTransparency: number | undefined;\r\n if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {\r\n newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);\r\n } else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {\r\n newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);\r\n } else if (evt.key === SpecialKey.PageDown) {\r\n newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);\r\n } else if (evt.key === SpecialKey.PageUp) {\r\n newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);\r\n } else if (evt.key === SpecialKey.Home) {\r\n newTransparency = 0;\r\n } else {\r\n // istanbul ignore else\r\n if (evt.key === SpecialKey.End) {\r\n newTransparency = 1;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (undefined !== newTransparency) {\r\n // istanbul ignore if\r\n if (newTransparency > 1) newTransparency = 1;\r\n // istanbul ignore if\r\n if (newTransparency < 0) newTransparency = 0;\r\n // istanbul ignore else\r\n if (this.props.onAlphaChange)\r\n this.props.onAlphaChange(newTransparency);\r\n }\r\n };\r\n\r\n private _onMouseUp = () => {\r\n this._unbindEventListeners();\r\n };\r\n\r\n private _unbindEventListeners() {\r\n window.removeEventListener(\"mousemove\", this._onChange as any);\r\n window.removeEventListener(\"mouseup\", this._onMouseUp);\r\n }\r\n\r\n /** @internal */\r\n public override render(): React.ReactNode {\r\n const containerClasses = classnames(\r\n this.props.isHorizontal ? \"components-alpha-container-horizontal\" : \"components-alpha-container-vertical\",\r\n this.props.className,\r\n );\r\n\r\n const pointerStyle: React.CSSProperties = this.props.isHorizontal ?\r\n { left: `${(this.props.alpha * 100)}%` } :\r\n { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };\r\n\r\n return (\r\n <div className={containerClasses} style={this.props.style} data-testid=\"alpha-container\">\r\n <div\r\n data-testid=\"alpha-slider\"\r\n role=\"slider\" aria-label={this._transparencyLabel}\r\n aria-valuemin={0} aria-valuemax={1} aria-valuenow={this.props.alpha}\r\n className=\"components-alpha-slider\"\r\n ref={(container) => this._container = container}\r\n onMouseDown={this._onMouseDown}\r\n onTouchMove={this._onChange}\r\n onTouchStart={this._onChange}\r\n tabIndex={0}\r\n onKeyDown={this._onKeyDown}\r\n >\r\n <div style={pointerStyle} className=\"components-alpha-pointer\" data-testid=\"alpha-pointer\" />\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"AlphaSlider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAcnD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAA+B;IAIpE,gBAAgB;IAChB,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QALP,eAAU,GAA0B,IAAI,CAAC;QACzC,uBAAkB,GAAG,kBAAkB,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAOxE,qBAAgB,GAAG,CAAC,CAAsE,EAAE,YAAqB,EAAE,KAAa,EAAE,SAAyB,EAAsB,EAAE;YACzL,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;YAE7F,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,IAAI,OAAO,IAAI,CAAC,EAAE;gBAChB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;aACb;iBAAM;gBACL,qBAAqB;gBACrB,IAAI,SAAS,KA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G,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;QAE9D,OAAO,CACL,6BAAK,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAc,iBAAiB;YACtF,4CACc,cAAc,EAC1B,IAAI,EAAC,QAAQ,gBAAa,IAAI,CAAC,kBAAkB,mBAClC,CAAC,mBAAiB,CAAC,mBAAiB,IAAI,CAAC,KAAK,CAAC,KAAK,EACnE,SAAS,EAAC,yBAAyB,EACnC,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,EAC/C,WAAW,EAAE,IAAI,CAAC,YAAY,EAC9B,WAAW,EAAE,IAAI,CAAC,SAAS,EAC3B,YAAY,EAAE,IAAI,CAAC,SAAS,EAC5B,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,IAAI,CAAC,UAAU;gBAE1B,6BAAK,KAAK,EAAE,YAAY,EAAE,SAAS,EAAC,0BAA0B,iBAAa,eAAe,GAAG,CACzF,CACF,CACP,CAAC;IACJ,CAAC;CAEF","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 Color\n */\n\nimport \"./AlphaSlider.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\n\n/** Properties for the [[AlphaSlider]] React component\n * @public\n */\nexport interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {\n /** true if slider is oriented horizontal, else vertical orientation is assumed */\n isHorizontal?: boolean;\n /** function to run when user selects color swatch */\n onAlphaChange?: ((alpha: number) => void) | undefined;\n /** Alpha value between 0 (transparent) and 1 (opaque) */\n alpha: number;\n}\n\n/** AlphaSlider component used to set the alpha value.\n * @public\n */\nexport class AlphaSlider extends React.PureComponent<AlphaSliderProps> {\n private _container: HTMLDivElement | null = null;\n private _transparencyLabel = UiIModelComponents.translate(\"color.transparency\");\n\n /** @internal */\n constructor(props: AlphaSliderProps) {\n super(props);\n }\n\n private _calculateChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>, isHorizontal: boolean, alpha: number, container: HTMLDivElement): number | undefined => {\n e.preventDefault();\n const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();\n\n let x = 0;\n if (\"pageX\" in e) {\n x = e.pageX;\n } else {\n // istanbul ignore if\n if (undefined === e.touches)\n return undefined;\n x = e.touches[0].pageX;\n }\n // istanbul ignore if\n if (undefined === x)\n return undefined;\n\n let y = 0;\n if (\"pageY\" in e) {\n y = e.pageY;\n } else {\n // istanbul ignore if\n if (undefined === e.touches)\n return;\n y = e.touches[0].pageY;\n }\n // istanbul ignore if\n if (undefined === y)\n return undefined;\n\n const left = x - (container.getBoundingClientRect().left + window.scrollX);\n const top = y - (container.getBoundingClientRect().top + window.scrollY);\n\n let t = 0;\n\n if (!isHorizontal) {\n // istanbul ignore next\n if (top < 0) {\n t = 1;\n } else if (top > containerHeight) {\n t = 0;\n } else {\n t = 1 - (top / containerHeight);\n }\n } else { // horizontal\n // istanbul ignore next\n if (left < 0) {\n t = 0;\n } else if (left > containerWidth) {\n t = 1;\n } else {\n t = left / containerWidth;\n }\n }\n\n // istanbul ignore if\n if (t < 0) t = 0;\n // istanbul ignore if\n if (t > 1) t = 1;\n // istanbul ignore next\n return (alpha !== t) ? t : undefined;\n };\n\n /** @internal */\n public override componentWillUnmount() {\n this._unbindEventListeners();\n }\n\n private _onChange = (e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>) => {\n // istanbul ignore else\n if (this._container && this.props.onAlphaChange) {\n const change = this._calculateChange(e, this.props.isHorizontal ? this.props.isHorizontal : false, this.props.alpha, this._container);\n undefined !== change && typeof this.props.onAlphaChange === \"function\" && this.props.onAlphaChange(change);\n }\n };\n\n private _onMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\n this._onChange(e);\n // istanbul ignore else\n if (this._container)\n this._container.focus();\n window.addEventListener(\"mousemove\", this._onChange as any);\n window.addEventListener(\"mouseup\", this._onMouseUp);\n };\n\n private _onKeyDown = (evt: React.KeyboardEvent<HTMLDivElement>) => {\n let newTransparency: number | undefined;\n if (evt.key === SpecialKey.ArrowLeft || evt.key === SpecialKey.ArrowDown) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? .1 : .05);\n } else if (evt.key === SpecialKey.ArrowRight || evt.key === SpecialKey.ArrowUp) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? .1 : .05);\n } else if (evt.key === SpecialKey.PageDown) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? .5 : .25);\n } else if (evt.key === SpecialKey.PageUp) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? .5 : .25);\n } else if (evt.key === SpecialKey.Home) {\n newTransparency = 0;\n } else {\n // istanbul ignore else\n if (evt.key === SpecialKey.End) {\n newTransparency = 1;\n }\n }\n\n // istanbul ignore else\n if (undefined !== newTransparency) {\n // istanbul ignore if\n if (newTransparency > 1) newTransparency = 1;\n // istanbul ignore if\n if (newTransparency < 0) newTransparency = 0;\n // istanbul ignore else\n if (this.props.onAlphaChange)\n this.props.onAlphaChange(newTransparency);\n }\n };\n\n private _onMouseUp = () => {\n this._unbindEventListeners();\n };\n\n private _unbindEventListeners() {\n window.removeEventListener(\"mousemove\", this._onChange as any);\n window.removeEventListener(\"mouseup\", this._onMouseUp);\n }\n\n /** @internal */\n public override render(): React.ReactNode {\n const containerClasses = classnames(\n this.props.isHorizontal ? \"components-alpha-container-horizontal\" : \"components-alpha-container-vertical\",\n this.props.className,\n );\n\n const pointerStyle: React.CSSProperties = this.props.isHorizontal ?\n { left: `${(this.props.alpha * 100)}%` } :\n { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };\n\n return (\n <div className={containerClasses} style={this.props.style} data-testid=\"alpha-container\">\n <div\n data-testid=\"alpha-slider\"\n role=\"slider\" aria-label={this._transparencyLabel}\n aria-valuemin={0} aria-valuemax={1} aria-valuenow={this.props.alpha}\n className=\"components-alpha-slider\"\n ref={(container) => this._container = container}\n onMouseDown={this._onMouseDown}\n onTouchMove={this._onChange}\n onTouchStart={this._onChange}\n tabIndex={0}\n onKeyDown={this._onKeyDown}\n >\n <div style={pointerStyle} className=\"components-alpha-pointer\" data-testid=\"alpha-pointer\" />\n </div>\n </div>\n );\n }\n\n}\n"]}
@@ -1,63 +1,63 @@
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
- .components-alpha-pointer {
6
- position: absolute;
7
- width: 1.2rem;
8
- height: 1.2rem;
9
- border-radius: 50%;
10
- background-color: rgb(248, 248, 248);
11
- box-shadow: rgba(0, 0, 0, 0.37) 0px 1px 4px 0px;
12
-
13
- &:focus {
14
- outline: none;
15
- border: none;
16
- }
17
- }
18
-
19
- .components-alpha-container-horizontal {
20
- width: 100%;
21
- height: 1rem;
22
- display: flex;
23
- align-items: center;
24
- justify-content: center;
25
-
26
- .components-alpha-slider {
27
- position: relative;
28
- width: calc(100% - 1.2rem);
29
- height: 100%;
30
- background-color: linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
31
- background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
32
- linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
33
- background-size: 2rem 1rem, cover;
34
- background-repeat: repeat, no-repeat;
35
-
36
- .components-alpha-pointer {
37
- transform: translate(-.6rem, -.1rem);
38
- }
39
- }
40
- }
41
-
42
- .components-alpha-container-vertical {
43
- width: 1rem;
44
- display: flex;
45
- align-items: center;
46
- justify-content: center;
47
- height: 100%;
48
-
49
- .components-alpha-slider {
50
- position: relative;
51
- width: 100%;
52
- height: calc(100% - 1.2rem);
53
- background-color: linear-gradient(to bottom, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
54
- background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
55
- linear-gradient(to top, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
56
- background-size: 1rem 2rem, cover;
57
- background-repeat: repeat, no-repeat;
58
-
59
- .components-alpha-pointer {
60
- transform: translate(-.1rem, -.6rem);
61
- }
62
- }
63
- }
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
+ .components-alpha-pointer {
6
+ position: absolute;
7
+ width: 1.2rem;
8
+ height: 1.2rem;
9
+ border-radius: 50%;
10
+ background-color: rgb(248, 248, 248);
11
+ box-shadow: rgba(0, 0, 0, 0.37) 0px 1px 4px 0px;
12
+
13
+ &:focus {
14
+ outline: none;
15
+ border: none;
16
+ }
17
+ }
18
+
19
+ .components-alpha-container-horizontal {
20
+ width: 100%;
21
+ height: 1rem;
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+
26
+ .components-alpha-slider {
27
+ position: relative;
28
+ width: calc(100% - 1.2rem);
29
+ height: 100%;
30
+ background-color: linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
31
+ background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
32
+ linear-gradient(to right, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
33
+ background-size: 2rem 1rem, cover;
34
+ background-repeat: repeat, no-repeat;
35
+
36
+ .components-alpha-pointer {
37
+ transform: translate(-.6rem, -.1rem);
38
+ }
39
+ }
40
+ }
41
+
42
+ .components-alpha-container-vertical {
43
+ width: 1rem;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ height: 100%;
48
+
49
+ .components-alpha-slider {
50
+ position: relative;
51
+ width: 100%;
52
+ height: calc(100% - 1.2rem);
53
+ background-color: linear-gradient(to bottom, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
54
+ background-image: url('data:image/svg+xml, <svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".15"><rect x="200" width="200" height="200" /> <rect y="200" width="200" height="200" /></svg>'),
55
+ linear-gradient(to top, rgba(47, 37, 72, 0) 0%, rgb(47, 37, 72) 100%);
56
+ background-size: 1rem 2rem, cover;
57
+ background-repeat: repeat, no-repeat;
58
+
59
+ .components-alpha-pointer {
60
+ transform: translate(-.1rem, -.6rem);
61
+ }
62
+ }
63
+ }
@@ -4,7 +4,7 @@
4
4
  import "./ColorPickerButton.scss";
5
5
  import * as React from "react";
6
6
  import { ColorDef } from "@itwin/core-common";
7
- import { CommonProps } from "@itwin/core-react";
7
+ import type { CommonProps } from "@itwin/core-react";
8
8
  /** Properties for the [[ColorPickerButton]] React component
9
9
  * @beta
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerButton.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAoBtE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW;IAClG,mBAAmB;IACnB,YAAY,EAAE,QAAQ,CAAC;IACvB,uBAAuB;IACvB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACtD,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAyFD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,GAAG,CAAC,OAAO,GAAG,IAAkC,CAAC"}
1
+ {"version":3,"file":"ColorPickerButton.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAqBpD;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW;IAClG,mBAAmB;IACnB,YAAY,EAAE,QAAQ,CAAC;IACvB,uBAAuB;IACvB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,qDAAqD;IACrD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACtD,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAyFD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,GAAG,CAAC,OAAO,GAAG,IAAkC,CAAC"}
@@ -74,7 +74,7 @@ const ForwardRefColorPickerButton = React.forwardRef(function ForwardRefColorPic
74
74
  React.createElement("div", { className: "components-colorpicker-button-color-swatch", style: swatchStyle, "data-testid": showPopup ? "caret-up" : "caret-down" }),
75
75
  showCaret && React.createElement(Icon, { className: "components-caret", iconSpec: showPopup ? React.createElement(SvgCaretUpSmall, null) : React.createElement(SvgCaretDownSmall, null) }))),
76
76
  React.createElement(Popup, { className: "components-colorpicker-popup", isOpen: showPopup, position: RelativePosition.BottomLeft, onClose: closePopup, target: target.current, closeOnNestedPopupOutsideClick: true },
77
- React.createElement(ColorOptions, { handleColorPicked: handleColorPicked, options: colorOptions, numColumns: numColumns ?? 4, round: !!round, title: dropDownTitle }))));
77
+ React.createElement(ColorOptions, { handleColorPicked: handleColorPicked, options: colorOptions, numColumns: numColumns !== null && numColumns !== void 0 ? numColumns : 4, round: !!round, title: dropDownTitle }))));
78
78
  });
79
79
  /** ColorPickerButton component
80
80
  * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.