@itwin/imodel-components-react 4.10.0 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +1 -1
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js +6 -6
  4. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +2 -1
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +4 -2
  8. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +2 -0
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +5 -2
  12. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +2 -0
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
  15. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +1 -1
  16. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +2 -0
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +5 -5
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  21. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +2 -0
  22. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  23. package/lib/cjs/imodel-components-react/color/HueSlider.js +4 -3
  24. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  25. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +2 -0
  26. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  27. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +4 -3
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  29. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +2 -0
  30. package/lib/cjs/imodel-components-react/color/Swatch.d.ts.map +1 -1
  31. package/lib/cjs/imodel-components-react/color/Swatch.js +2 -0
  32. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  33. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +2 -1
  34. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  35. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  36. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +5 -4
  37. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  38. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  39. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  40. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
  41. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  42. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  43. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +1 -2
  44. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  45. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  46. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  47. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +5 -4
  48. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  49. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  50. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +6 -7
  51. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  52. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  53. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +10 -10
  54. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  55. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  56. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -14
  57. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  58. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  59. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +13 -9
  60. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  61. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  62. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +21 -28
  63. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  64. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  65. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +18 -17
  66. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  67. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  68. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +7 -6
  69. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  70. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  71. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +14 -13
  72. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  73. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  74. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +7 -6
  75. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  76. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  77. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +9 -8
  78. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  79. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  80. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +23 -22
  81. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  82. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  83. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +7 -6
  84. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  85. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  86. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +15 -14
  87. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  88. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  89. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +6 -6
  90. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  91. package/lib/cjs/imodel-components-react/timeline/PlayButton.d.ts +3 -15
  92. package/lib/cjs/imodel-components-react/timeline/PlayButton.d.ts.map +1 -1
  93. package/lib/cjs/imodel-components-react/timeline/PlayButton.js +12 -42
  94. package/lib/cjs/imodel-components-react/timeline/PlayButton.js.map +1 -1
  95. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +1 -1
  96. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  97. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +2 -20
  98. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  99. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +111 -202
  100. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  101. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +25 -333
  102. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +5 -1
  103. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  104. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +39 -30
  105. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  106. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +2 -2
  107. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  108. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  109. package/lib/cjs/imodel-components-react/useTranslation.d.ts +10 -0
  110. package/lib/cjs/imodel-components-react/useTranslation.d.ts.map +1 -0
  111. package/lib/cjs/imodel-components-react/useTranslation.js +20 -0
  112. package/lib/cjs/imodel-components-react/useTranslation.js.map +1 -0
  113. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  114. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +13 -8
  115. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  116. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +1 -1
  117. package/lib/esm/imodel-components-react/UiIModelComponents.js +6 -6
  118. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  119. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +2 -1
  120. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
  121. package/lib/esm/imodel-components-react/color/AlphaSlider.js +4 -2
  122. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  123. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +2 -0
  124. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
  125. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +5 -2
  126. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  127. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +2 -0
  128. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
  129. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +1 -1
  130. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  131. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +2 -0
  132. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
  133. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +5 -5
  134. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  135. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +2 -0
  136. package/lib/esm/imodel-components-react/color/HueSlider.d.ts.map +1 -1
  137. package/lib/esm/imodel-components-react/color/HueSlider.js +4 -3
  138. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  139. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +2 -0
  140. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
  141. package/lib/esm/imodel-components-react/color/SaturationPicker.js +4 -3
  142. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  143. package/lib/esm/imodel-components-react/color/Swatch.d.ts +2 -0
  144. package/lib/esm/imodel-components-react/color/Swatch.d.ts.map +1 -1
  145. package/lib/esm/imodel-components-react/color/Swatch.js +2 -0
  146. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  147. package/lib/esm/imodel-components-react/editors/ColorEditor.js +2 -1
  148. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  149. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
  150. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +5 -4
  151. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  152. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  153. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  154. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
  155. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  156. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
  157. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +1 -2
  158. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  159. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  160. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  161. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +5 -4
  162. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  163. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
  164. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +6 -7
  165. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  166. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
  167. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +10 -10
  168. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  169. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
  170. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -14
  171. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  172. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
  173. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +13 -9
  174. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  175. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
  176. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +21 -28
  177. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  178. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
  179. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +18 -17
  180. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  181. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
  182. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +7 -6
  183. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  184. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
  185. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +14 -13
  186. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  187. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
  188. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +7 -6
  189. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  190. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
  191. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +9 -8
  192. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  193. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
  194. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +23 -22
  195. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  196. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
  197. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +7 -6
  198. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  199. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
  200. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +15 -14
  201. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  202. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
  203. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +6 -6
  204. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  205. package/lib/esm/imodel-components-react/timeline/PlayButton.d.ts +3 -15
  206. package/lib/esm/imodel-components-react/timeline/PlayButton.d.ts.map +1 -1
  207. package/lib/esm/imodel-components-react/timeline/PlayButton.js +12 -39
  208. package/lib/esm/imodel-components-react/timeline/PlayButton.js.map +1 -1
  209. package/lib/esm/imodel-components-react/timeline/Scrubber.js +1 -1
  210. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  211. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +2 -20
  212. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
  213. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +112 -203
  214. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  215. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +25 -333
  216. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +5 -1
  217. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
  218. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +40 -31
  219. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  220. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +2 -2
  221. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
  222. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  223. package/lib/esm/imodel-components-react/useTranslation.d.ts +10 -0
  224. package/lib/esm/imodel-components-react/useTranslation.d.ts.map +1 -0
  225. package/lib/esm/imodel-components-react/useTranslation.js +16 -0
  226. package/lib/esm/imodel-components-react/useTranslation.js.map +1 -0
  227. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
  228. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +13 -8
  229. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  230. package/lib/public/locales/en/UiIModelComponents.json +14 -3
  231. package/package.json +10 -10
  232. package/lib/cjs/imodel-components-react/timeline/PlayButton.scss +0 -28
  233. package/lib/esm/imodel-components-react/timeline/PlayButton.scss +0 -28
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportComponent.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,sDAA6C;AAE7C,wDAAiD;AACjD,oDAA+C;AAQ/C,wDAK8B;AAQ9B,uEAAoE;AAkCpE;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAoB;IACpD,MAAM,EACJ,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,KAAK,EACL,SAAS,EACT,sBAAsB,EACtB,SAAS,EACT,WAAW,GACZ,GAAG,KAAK,CAAC;IACV,uBAAuB;IACvB,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CACjC,mBAAmB,IAAI,yBAAS,CAAC,WAAW,CAC7C,CAAC;IACF,MAAM,yBAAyB,GAAG,KAAK,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B,oDAAoD,SAAS,EAAE,CAChE,CAAC;gBACF,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;gBAExC,6HAA6H;gBAC7H,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACxE;iBAAM;gBACL,uBAAuB;gBACvB,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;aACzD;SACF;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC;IAE/C,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,CAAC,CAAmB,EAAE,EAAE;QACtB,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,IAAI,aAAa;YAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,cAAc,GAAwB;QAC1C,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,UAAU;KACrB,CAAC;IAEF,MAAM,gBAAgB,GAAwB;QAC5C,GAAG,KAAK;QACR,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACd,CAAC;IAEF,OAAO,CACL,6BAAK,KAAK,EAAE,cAAc,kBAAgB,SAAS;QACjD,6BACE,GAAG,EAAE,WAAW,iBACJ,oBAAoB,EAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,iBAAiB,GAChC;QACD,WAAW,CACR,CACP,CAAC;AACJ,CAAC;AAxUD,8CAwUC","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 {\n IModelConnection,\n TentativePoint,\n ViewManager,\n Viewport,\n ViewState,\n} from \"@itwin/core-frontend\";\nimport {\n IModelApp,\n ScreenViewport,\n StandardView,\n ToolSettings,\n} from \"@itwin/core-frontend\";\n\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n CubeRotationChangeEventArgs,\n DrawingViewportChangeEventArgs,\n StandardRotationChangeEventArgs,\n} from \"./ViewportComponentEvents\";\nimport { ViewportComponentEvents } 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 {\n viewState,\n imodel,\n viewDefinitionId,\n getViewOverlay,\n viewManagerOverride,\n tentativePointOverride,\n onContextMenu,\n style,\n className,\n screenViewportOverride,\n controlId,\n viewportRef,\n } = props;\n // istanbul ignore next\n const viewManagerRef = React.useRef(\n viewManagerOverride ?? IModelApp.viewManager\n );\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)) return;\n ViewportComponentEvents.setViewMatrix(vp);\n if (viewClassFullName.current !== vp.view.classFullName) {\n setTimeout(() => {\n ViewportComponentEvents.onViewClassFullNameChangedEvent.emit({\n viewport: vp,\n oldName: viewClassFullName.current,\n newName: vp.view.classFullName,\n });\n viewClassFullName.current = vp.view.classFullName;\n });\n }\n if (viewId.current !== vp.view.id) {\n setTimeout(() => {\n ViewportComponentEvents.onViewIdChangedEvent.emit({\n viewport: vp,\n oldId: viewId.current,\n newId: vp.view.id,\n });\n viewId.current = vp.view.id;\n });\n }\n };\n\n const handleStandardRotationChangeEvent = (\n args: StandardRotationChangeEventArgs\n ) => {\n const viewManager = viewManagerRef.current;\n const currentScreenViewport = screenViewportRef.current;\n if (\n currentScreenViewport &&\n viewManager.selectedView === currentScreenViewport\n ) {\n currentScreenViewport.view.setRotationAboutPoint(\n StandardView.getStandardRotation(args.standardRotation)\n );\n currentScreenViewport.synchWithView();\n }\n };\n\n const handleDrawingViewportChangeEvent = (\n args: DrawingViewportChangeEventArgs\n ) => {\n const viewManager = viewManagerRef.current;\n const currentScreenViewport = screenViewportRef.current;\n if (\n currentScreenViewport &&\n viewManager.selectedView === currentScreenViewport\n ) {\n currentScreenViewport.view.setOrigin(args.origin);\n currentScreenViewport.view.setRotation(args.rotation);\n currentScreenViewport.synchWithView({\n noSaveInUndo: args.complete !== true,\n });\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 =\n tentativePointOverrideRef.current ?? IModelApp.tentativePoint;\n // istanbul ignore else\n if (tentativePoint.isActive) return tentativePoint.getPoint();\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)) return lastTargetPoint;\n targetPoint.current = null;\n }\n\n const visiblePoint = vp.pickNearestVisibleGeometry(\n vp.npcToWorld(NpcCenter),\n vp.pixelsFromInches(ToolSettings.viewToolPickRadiusInches)\n );\n targetPoint.current =\n 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 (\n currentScreenViewport &&\n viewManager.selectedView === currentScreenViewport\n ) {\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(\n currentScreenViewport.view.getRotation()\n );\n const worldTransform = Transform.createFixedPointAndMatrix(\n center,\n targetMatrix\n );\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(\n handleDrawingViewportChangeEvent\n );\n ViewportComponentEvents.onCubeRotationChangeEvent.removeListener(\n handleCubeRotationChangeEvent\n );\n ViewportComponentEvents.onStandardRotationChangeEvent.removeListener(\n handleStandardRotationChangeEvent\n );\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 = (\n parentDiv: HTMLDivElement,\n inViewState: ViewState\n ) => {\n // istanbul ignore next\n const screenViewportFactory = screenViewportOverride\n ? screenViewportOverride\n : 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(\n handleDrawingViewportChangeEvent\n );\n ViewportComponentEvents.onCubeRotationChangeEvent.addListener(\n handleCubeRotationChangeEvent\n );\n ViewportComponentEvents.onStandardRotationChangeEvent.addListener(\n handleStandardRotationChangeEvent\n );\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(\n \"ViewportComponent\",\n `mounting ViewportComponent for controlId=${controlId}`\n );\n\n return () => {\n isMounted.current = false;\n Logger.logInfo(\n \"ViewportComponent\",\n `un-mounting ViewportComponent for controlId=${controlId}`\n );\n handleDisconnectFromViewManager();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const [initialViewState, setInitialViewState] = React.useState<\n ViewState | undefined\n >(undefined);\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\") currentViewState = viewState();\n else 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(\n \"ViewportComponent\",\n `A Viewstate or a viewId and imodel must be provided`\n );\n }\n // istanbul ignore next\n if (\n isMounted.current &&\n (currentViewState?.iModel.isOpen || currentViewState?.iModel.isBlank)\n ) {\n setInitialViewState(currentViewState?.clone());\n }\n }\n if (undefined === initialViewState) void fetchInitialViewstate();\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 (\n parentDiv &&\n initialViewState &&\n (initialViewState?.iModel.isOpen || initialViewState?.iModel.isBlank)\n ) {\n if (!screenViewportCreated.current) {\n const screenViewport = getScreenViewport(parentDiv, initialViewState);\n screenViewportRef.current = screenViewport;\n\n if (viewportRef) viewportRef(screenViewport);\n\n Logger.logInfo(\n \"ViewportComponent\",\n `processing viewManager.addViewport for controlId=${controlId}`\n );\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(\n (e: React.MouseEvent) => {\n e.preventDefault();\n if (onContextMenu) onContextMenu(e);\n },\n [onContextMenu]\n );\n\n const parentDivStyle: React.CSSProperties = {\n height: \"100%\",\n width: \"100%\",\n position: \"relative\",\n };\n\n const viewportDivStyle: React.CSSProperties = {\n ...style,\n height: \"100%\",\n width: \"100%\",\n };\n\n return (\n <div style={parentDivStyle} data-item-id={controlId}>\n <div\n ref={viewportDiv}\n data-testid=\"viewport-component\"\n className={className}\n style={viewportDivStyle}\n onContextMenu={handleContextMenu}\n />\n {viewOverlay}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ViewportComponent.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/viewport/ViewportComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,sDAA6C;AAE7C,wDAAiD;AACjD,oDAA+C;AAQ/C,wDAK8B;AAQ9B,uEAAoE;AAkCpE;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAoB;IACpD,MAAM,EACJ,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,KAAK,EACL,SAAS,EACT,sBAAsB,EACtB,SAAS,EACT,WAAW,GACZ,GAAG,KAAK,CAAC;IACV,uBAAuB;IACvB,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CACjC,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,GAAI,yBAAS,CAAC,WAAW,CAC7C,CAAC;IACF,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,CAAiB,IAAI,CAAC,CAAC;IACvD,MAAM,iBAAiB,GAAG,KAAK,CAA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7C,qBAAM,CAAC,OAAO,CACZ,mBAAmB,EACnB,oDAAoD,SAAS,EAAE,CAChE,CAAC;gBACF,WAAW,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;gBAExC,6HAA6H;gBAC7H,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACxE;iBAAM;gBACL,uBAAuB;gBACvB,MAAA,iBAAiB,CAAC,OAAO,0CAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;aACzD;SACF;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC;IAE/C,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,CAAC,CAAmB,EAAE,EAAE;QACtB,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,IAAI,aAAa;YAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,cAAc,GAAwB;QAC1C,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,UAAU;KACrB,CAAC;IAEF,MAAM,gBAAgB,GAAwB;QAC5C,GAAG,KAAK;QACR,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KACd,CAAC;IAEF,OAAO,CACL,6BAAK,KAAK,EAAE,cAAc,kBAAgB,SAAS;QACjD,6BACE,GAAG,EAAE,WAAW,iBACJ,oBAAoB,EAChC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,gBAAgB,EACvB,aAAa,EAAE,iBAAiB,GAChC;QACD,WAAW,CACR,CACP,CAAC;AACJ,CAAC;AA3UD,8CA2UC","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 {\n IModelConnection,\n TentativePoint,\n ViewManager,\n Viewport,\n ViewState,\n} from \"@itwin/core-frontend\";\nimport {\n IModelApp,\n ScreenViewport,\n StandardView,\n ToolSettings,\n} from \"@itwin/core-frontend\";\n\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n CubeRotationChangeEventArgs,\n DrawingViewportChangeEventArgs,\n StandardRotationChangeEventArgs,\n} from \"./ViewportComponentEvents\";\nimport { ViewportComponentEvents } 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 {\n viewState,\n imodel,\n viewDefinitionId,\n getViewOverlay,\n viewManagerOverride,\n tentativePointOverride,\n onContextMenu,\n style,\n className,\n screenViewportOverride,\n controlId,\n viewportRef,\n } = props;\n // istanbul ignore next\n const viewManagerRef = React.useRef(\n viewManagerOverride ?? IModelApp.viewManager\n );\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)) return;\n ViewportComponentEvents.setViewMatrix(vp);\n if (viewClassFullName.current !== vp.view.classFullName) {\n setTimeout(() => {\n ViewportComponentEvents.onViewClassFullNameChangedEvent.emit({\n viewport: vp,\n oldName: viewClassFullName.current,\n newName: vp.view.classFullName,\n });\n viewClassFullName.current = vp.view.classFullName;\n });\n }\n if (viewId.current !== vp.view.id) {\n setTimeout(() => {\n ViewportComponentEvents.onViewIdChangedEvent.emit({\n viewport: vp,\n oldId: viewId.current,\n newId: vp.view.id,\n });\n viewId.current = vp.view.id;\n });\n }\n };\n\n const handleStandardRotationChangeEvent = (\n args: StandardRotationChangeEventArgs\n ) => {\n const viewManager = viewManagerRef.current;\n const currentScreenViewport = screenViewportRef.current;\n if (\n currentScreenViewport &&\n viewManager.selectedView === currentScreenViewport\n ) {\n currentScreenViewport.view.setRotationAboutPoint(\n StandardView.getStandardRotation(args.standardRotation)\n );\n currentScreenViewport.synchWithView();\n }\n };\n\n const handleDrawingViewportChangeEvent = (\n args: DrawingViewportChangeEventArgs\n ) => {\n const viewManager = viewManagerRef.current;\n const currentScreenViewport = screenViewportRef.current;\n if (\n currentScreenViewport &&\n viewManager.selectedView === currentScreenViewport\n ) {\n currentScreenViewport.view.setOrigin(args.origin);\n currentScreenViewport.view.setRotation(args.rotation);\n currentScreenViewport.synchWithView({\n noSaveInUndo: args.complete !== true,\n });\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 =\n tentativePointOverrideRef.current ?? IModelApp.tentativePoint;\n // istanbul ignore else\n if (tentativePoint.isActive) return tentativePoint.getPoint();\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)) return lastTargetPoint;\n targetPoint.current = null;\n }\n\n const visiblePoint = vp.pickNearestVisibleGeometry(\n vp.npcToWorld(NpcCenter),\n vp.pixelsFromInches(ToolSettings.viewToolPickRadiusInches)\n );\n targetPoint.current =\n 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 (\n currentScreenViewport &&\n viewManager.selectedView === currentScreenViewport\n ) {\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(\n currentScreenViewport.view.getRotation()\n );\n const worldTransform = Transform.createFixedPointAndMatrix(\n center,\n targetMatrix\n );\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(\n handleDrawingViewportChangeEvent\n );\n ViewportComponentEvents.onCubeRotationChangeEvent.removeListener(\n handleCubeRotationChangeEvent\n );\n ViewportComponentEvents.onStandardRotationChangeEvent.removeListener(\n handleStandardRotationChangeEvent\n );\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 = (\n parentDiv: HTMLDivElement,\n inViewState: ViewState\n ) => {\n // istanbul ignore next\n const screenViewportFactory = screenViewportOverride\n ? screenViewportOverride\n : ScreenViewport;\n const parentWindow = parentDiv.ownerDocument.defaultView as Window;\n parentWindow.addEventListener(\"unload\", handleWindowUnload, {\n once: true,\n capture: true,\n }); // by specifying 'once', listener clears after being called\n ViewportComponentEvents.initialize();\n ViewportComponentEvents.onDrawingViewportChangeEvent.addListener(\n handleDrawingViewportChangeEvent\n );\n ViewportComponentEvents.onCubeRotationChangeEvent.addListener(\n handleCubeRotationChangeEvent\n );\n ViewportComponentEvents.onStandardRotationChangeEvent.addListener(\n handleStandardRotationChangeEvent\n );\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(\n \"ViewportComponent\",\n `mounting ViewportComponent for controlId=${controlId}`\n );\n\n return () => {\n isMounted.current = false;\n Logger.logInfo(\n \"ViewportComponent\",\n `un-mounting ViewportComponent for controlId=${controlId}`\n );\n handleDisconnectFromViewManager();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const [initialViewState, setInitialViewState] = React.useState<\n ViewState | undefined\n >(undefined);\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\") currentViewState = viewState();\n else 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(\n \"ViewportComponent\",\n `A Viewstate or a viewId and imodel must be provided`\n );\n }\n // istanbul ignore next\n if (\n isMounted.current &&\n (currentViewState?.iModel.isOpen || currentViewState?.iModel.isBlank)\n ) {\n setInitialViewState(currentViewState?.clone());\n }\n }\n if (undefined === initialViewState) void fetchInitialViewstate();\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 (\n parentDiv &&\n initialViewState &&\n (initialViewState?.iModel.isOpen || initialViewState?.iModel.isBlank)\n ) {\n if (!screenViewportCreated.current) {\n const screenViewport = getScreenViewport(parentDiv, initialViewState);\n screenViewportRef.current = screenViewport;\n\n if (viewportRef) viewportRef(screenViewport);\n\n Logger.logInfo(\n \"ViewportComponent\",\n `processing viewManager.addViewport for controlId=${controlId}`\n );\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(\n (e: React.MouseEvent) => {\n e.preventDefault();\n if (onContextMenu) onContextMenu(e);\n },\n [onContextMenu]\n );\n\n const parentDivStyle: React.CSSProperties = {\n height: \"100%\",\n width: \"100%\",\n position: \"relative\",\n };\n\n const viewportDivStyle: React.CSSProperties = {\n ...style,\n height: \"100%\",\n width: \"100%\",\n };\n\n return (\n <div style={parentDivStyle} data-item-id={controlId}>\n <div\n ref={viewportDiv}\n data-testid=\"viewport-component\"\n className={className}\n style={viewportDivStyle}\n onContextMenu={handleContextMenu}\n />\n {viewOverlay}\n </div>\n );\n}\n"]}
@@ -19,7 +19,7 @@ export declare class UiIModelComponents {
19
19
  static get localizationNamespace(): string;
20
20
  /** @internal */
21
21
  static get packageName(): string;
22
- /** Calls localization.getLocalizedStringWithNamespace with the "UiIModelComponents" namespace. Do NOT include the namespace in the key.
22
+ /** Calls localization.getLocalizedString with the "UiIModelComponents" namespace. Do NOT include the namespace in the key.
23
23
  * @internal
24
24
  */
25
25
  static translate(key: string | string[]): string;
@@ -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
  }
@@ -53,7 +55,7 @@ class UiIModelComponents {
53
55
  static get packageName() {
54
56
  return "imodel-components-react";
55
57
  }
56
- /** Calls localization.getLocalizedStringWithNamespace with the "UiIModelComponents" namespace. Do NOT include the namespace in the key.
58
+ /** Calls localization.getLocalizedString with the "UiIModelComponents" namespace. Do NOT include the namespace in the key.
57
59
  * @internal
58
60
  */
59
61
  static translate(key) {
@@ -62,9 +64,7 @@ class UiIModelComponents {
62
64
  Logger.logError(UiIModelComponents.loggerCategory(this), `translate: IModelApp.localization has not been setup. Returning blank string.`);
63
65
  return "";
64
66
  }
65
- return IModelApp.localization.getLocalizedString(key, {
66
- ns: UiIModelComponents.localizationNamespace,
67
- });
67
+ return IModelApp.localization.getLocalizedString(`${UiIModelComponents.localizationNamespace}:${key}`);
68
68
  }
69
69
  /** @internal */
70
70
  static loggerCategory(obj) {
@@ -1 +1 @@
1
- {"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD;;;GAGG;AACH,MAAa,kBAAkB;IAG7B;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU;QAC5B,IAAI,kBAAkB,CAAC,YAAY,EAAE;YACnC,MAAM,CAAC,OAAO,CACZ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QACD,OAAO,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE;YACpD,EAAE,EAAE,kBAAkB,CAAC,qBAAqB;SAC7C,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GACZ,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA/Ec,+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 { UiComponents } from \"@itwin/components-react\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport { getObjectClassName } from \"@itwin/core-react\";\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(\n UiIModelComponents.loggerCategory(UiIModelComponents),\n `UiIModelComponents.initialize already called`\n );\n return;\n }\n\n await IModelApp.localization?.registerNamespace(\n UiIModelComponents.localizationNamespace\n );\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(\n UiIModelComponents.localizationNamespace\n );\n UiComponents.terminate();\n UiIModelComponents._initialized = false;\n }\n\n /** Determines if UiIModelComponents has been initialized */\n public static get initialized(): boolean {\n return UiIModelComponents._initialized;\n }\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 (\n !UiIModelComponents.initialized ||\n /* istanbul ignore next */ !IModelApp.localization\n ) {\n Logger.logError(\n UiIModelComponents.loggerCategory(this),\n `translate: IModelApp.localization has not been setup. Returning blank string.`\n );\n return \"\";\n }\n return IModelApp.localization.getLocalizedString(key, {\n ns: UiIModelComponents.localizationNamespace,\n });\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category =\n UiIModelComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
1
+ {"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD;;;GAGG;AACH,MAAa,kBAAkB;IAG7B;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU;;QAC5B,IAAI,kBAAkB,CAAC,YAAY,EAAE;YACnC,MAAM,CAAC,OAAO,CACZ,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F,OAAO,EAAE,CAAC;SACX;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAC9C,GAAG,kBAAkB,CAAC,qBAAqB,IAAI,GAAG,EAAE,CACrD,CAAC;IACJ,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GACZ,kBAAkB,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA/Ec,+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 { UiComponents } from \"@itwin/components-react\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\nimport { getObjectClassName } from \"@itwin/core-react\";\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(\n UiIModelComponents.loggerCategory(UiIModelComponents),\n `UiIModelComponents.initialize already called`\n );\n return;\n }\n\n await IModelApp.localization?.registerNamespace(\n UiIModelComponents.localizationNamespace\n );\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(\n UiIModelComponents.localizationNamespace\n );\n UiComponents.terminate();\n UiIModelComponents._initialized = false;\n }\n\n /** Determines if UiIModelComponents has been initialized */\n public static get initialized(): boolean {\n return UiIModelComponents._initialized;\n }\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.getLocalizedString 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 (\n !UiIModelComponents.initialized ||\n /* istanbul ignore next */ !IModelApp.localization\n ) {\n Logger.logError(\n UiIModelComponents.loggerCategory(this),\n `translate: IModelApp.localization has not been setup. Returning blank string.`\n );\n return \"\";\n }\n return IModelApp.localization.getLocalizedString(\n `${UiIModelComponents.localizationNamespace}:${key}`\n );\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category =\n UiIModelComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
@@ -6,6 +6,7 @@ import * as React from "react";
6
6
  import type { CommonProps } from "@itwin/core-react";
7
7
  /** Properties for the [[AlphaSlider]] React component
8
8
  * @public
9
+ * @deprecated in 4.11.x. Props of deprecated component {@link AlphaSlider}.
9
10
  */
10
11
  export interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {
11
12
  /** true if slider is oriented horizontal, else vertical orientation is assumed */
@@ -17,10 +18,10 @@ export interface AlphaSliderProps extends React.HTMLAttributes<HTMLDivElement>,
17
18
  }
18
19
  /** AlphaSlider component used to set the alpha value.
19
20
  * @public
21
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
20
22
  */
21
23
  export declare class AlphaSlider extends React.PureComponent<AlphaSliderProps> {
22
24
  private _container;
23
- private _transparencyLabel;
24
25
  /** @internal */
25
26
  constructor(props: AlphaSliderProps);
26
27
  private _calculateChange;
@@ -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;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;GAEG;AACH,MAAM,WAAW,gBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,WAAW;IACb,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,CAC2B;IAErD,gBAAgB;gBACJ,KAAK,EAAE,gBAAgB;IAInC,OAAO,CAAC,gBAAgB,CAgEtB;IAEF,gBAAgB;IACA,oBAAoB;IAIpC,OAAO,CAAC,SAAS,CAef;IAEF,OAAO,CAAC,YAAY,CAMlB;IAEF,OAAO,CAAC,UAAU,CAkChB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,qBAAqB;IAK7B,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CA0C1C"}
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;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;GAGG;AACH,MAAM,WAAW,gBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,WAAW;IACb,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;;;GAGG;AAEH,qBAAa,WAAY,SAAQ,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IACpE,OAAO,CAAC,UAAU,CAA+B;IAEjD,gBAAgB;gBAEJ,KAAK,EAAE,gBAAgB;IAInC,OAAO,CAAC,gBAAgB,CAgEtB;IAEF,gBAAgB;IACA,oBAAoB;IAIpC,OAAO,CAAC,SAAS,CAef;IAEF,OAAO,CAAC,YAAY,CAMlB;IAEF,OAAO,CAAC,UAAU,CAkChB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,qBAAqB;IAK7B,gBAAgB;IACA,MAAM,IAAI,KAAK,CAAC,SAAS;CA0C1C"}
@@ -12,13 +12,15 @@ import { Key } from "ts-key-enum";
12
12
  import { UiIModelComponents } from "../UiIModelComponents";
13
13
  /** AlphaSlider component used to set the alpha value.
14
14
  * @public
15
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
15
16
  */
17
+ // eslint-disable-next-line deprecation/deprecation
16
18
  export class AlphaSlider extends React.PureComponent {
17
19
  /** @internal */
20
+ // eslint-disable-next-line deprecation/deprecation
18
21
  constructor(props) {
19
22
  super(props);
20
23
  this._container = null;
21
- this._transparencyLabel = UiIModelComponents.translate("color.transparency");
22
24
  this._calculateChange = (e, isHorizontal, alpha, container) => {
23
25
  e.preventDefault();
24
26
  const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();
@@ -161,7 +163,7 @@ export class AlphaSlider extends React.PureComponent {
161
163
  ? { left: `${this.props.alpha * 100}%` }
162
164
  : { left: `0px`, top: `${-(this.props.alpha * 100) + 100}%` };
163
165
  return (React.createElement("div", { className: containerClasses, style: this.props.style, "data-testid": "alpha-container" },
164
- React.createElement("div", { "data-testid": "alpha-slider", role: "slider", "aria-label": this._transparencyLabel, "aria-valuemin": 0, "aria-valuemax": 1, "aria-valuenow": this.props.alpha, className: "components-alpha-slider", ref: (container) => (this._container = container), onMouseDown: this._onMouseDown, onTouchMove: this._onChange, onTouchStart: this._onChange, tabIndex: 0, onKeyDown: this._onKeyDown },
166
+ React.createElement("div", { "data-testid": "alpha-slider", role: "slider", "aria-label": UiIModelComponents.translate("color.transparency"), "aria-valuemin": 0, "aria-valuemax": 1, "aria-valuenow": this.props.alpha, className: "components-alpha-slider", ref: (container) => (this._container = container), onMouseDown: this._onMouseDown, onTouchMove: this._onChange, onTouchStart: this._onChange, tabIndex: 0, onKeyDown: this._onKeyDown },
165
167
  React.createElement("div", { style: pointerStyle, className: "components-alpha-pointer", "data-testid": "alpha-pointer" }))));
166
168
  }
167
169
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AlphaSlider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAgB3D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,aAA+B;IAKpE,gBAAgB;IAChB,YAAY,KAAuB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QANP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,CACF,CACP,CAAC;IACJ,CAAC;CACF","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 { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties for the [[AlphaSlider]] React component\n * @public\n */\nexport interface AlphaSliderProps\n extends React.HTMLAttributes<HTMLDivElement>,\n 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 =\n UiIModelComponents.translate(\"color.transparency\");\n\n /** @internal */\n constructor(props: AlphaSliderProps) {\n super(props);\n }\n\n private _calculateChange = (\n e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n isHorizontal: boolean,\n alpha: number,\n container: HTMLDivElement\n ): number | undefined => {\n e.preventDefault();\n const { width: containerWidth, height: containerHeight } =\n 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) return undefined;\n x = e.touches[0].pageX;\n }\n // istanbul ignore if\n if (undefined === x) 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) return;\n y = e.touches[0].pageY;\n }\n // istanbul ignore if\n if (undefined === y) 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 {\n // 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 = (\n e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>\n ) => {\n // istanbul ignore else\n if (this._container && this.props.onAlphaChange) {\n const change = this._calculateChange(\n e,\n this.props.isHorizontal ? this.props.isHorizontal : false,\n this.props.alpha,\n this._container\n );\n undefined !== change &&\n typeof this.props.onAlphaChange === \"function\" &&\n 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) 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 (\n evt.key === Key.ArrowLeft.valueOf() ||\n evt.key === Key.ArrowDown.valueOf()\n ) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? 0.1 : 0.05);\n } else if (\n evt.key === Key.ArrowRight.valueOf() ||\n evt.key === Key.ArrowUp.valueOf()\n ) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? 0.1 : 0.05);\n } else if (evt.key === Key.PageDown.valueOf()) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? 0.5 : 0.25);\n } else if (evt.key === Key.PageUp.valueOf()) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? 0.5 : 0.25);\n } else if (evt.key === Key.Home.valueOf()) {\n newTransparency = 0;\n } else {\n // istanbul ignore else\n if (evt.key === Key.End.valueOf()) {\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) 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\n ? \"components-alpha-container-horizontal\"\n : \"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\n className={containerClasses}\n style={this.props.style}\n data-testid=\"alpha-container\"\n >\n <div\n data-testid=\"alpha-slider\"\n role=\"slider\"\n aria-label={this._transparencyLabel}\n aria-valuemin={0}\n aria-valuemax={1}\n 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\n style={pointerStyle}\n className=\"components-alpha-pointer\"\n data-testid=\"alpha-pointer\"\n />\n </div>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"AlphaSlider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/AlphaSlider.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,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,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,EACjD,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,6BACE,KAAK,EAAE,YAAY,EACnB,SAAS,EAAC,0BAA0B,iBACxB,eAAe,GAC3B,CACE,CACF,CACP,CAAC;IACJ,CAAC;CACF","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 { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties for the [[AlphaSlider]] React component\n * @public\n * @deprecated in 4.11.x. Props of deprecated component {@link AlphaSlider}.\n */\nexport interface AlphaSliderProps\n extends React.HTMLAttributes<HTMLDivElement>,\n 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 * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport class AlphaSlider extends React.PureComponent<AlphaSliderProps> {\n private _container: HTMLDivElement | null = null;\n\n /** @internal */\n // eslint-disable-next-line deprecation/deprecation\n constructor(props: AlphaSliderProps) {\n super(props);\n }\n\n private _calculateChange = (\n e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n isHorizontal: boolean,\n alpha: number,\n container: HTMLDivElement\n ): number | undefined => {\n e.preventDefault();\n const { width: containerWidth, height: containerHeight } =\n 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) return undefined;\n x = e.touches[0].pageX;\n }\n // istanbul ignore if\n if (undefined === x) 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) return;\n y = e.touches[0].pageY;\n }\n // istanbul ignore if\n if (undefined === y) 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 {\n // 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 = (\n e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>\n ) => {\n // istanbul ignore else\n if (this._container && this.props.onAlphaChange) {\n const change = this._calculateChange(\n e,\n this.props.isHorizontal ? this.props.isHorizontal : false,\n this.props.alpha,\n this._container\n );\n undefined !== change &&\n typeof this.props.onAlphaChange === \"function\" &&\n 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) 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 (\n evt.key === Key.ArrowLeft.valueOf() ||\n evt.key === Key.ArrowDown.valueOf()\n ) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? 0.1 : 0.05);\n } else if (\n evt.key === Key.ArrowRight.valueOf() ||\n evt.key === Key.ArrowUp.valueOf()\n ) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? 0.1 : 0.05);\n } else if (evt.key === Key.PageDown.valueOf()) {\n newTransparency = this.props.alpha - (evt.ctrlKey ? 0.5 : 0.25);\n } else if (evt.key === Key.PageUp.valueOf()) {\n newTransparency = this.props.alpha + (evt.ctrlKey ? 0.5 : 0.25);\n } else if (evt.key === Key.Home.valueOf()) {\n newTransparency = 0;\n } else {\n // istanbul ignore else\n if (evt.key === Key.End.valueOf()) {\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) 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\n ? \"components-alpha-container-horizontal\"\n : \"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\n className={containerClasses}\n style={this.props.style}\n data-testid=\"alpha-container\"\n >\n <div\n data-testid=\"alpha-slider\"\n role=\"slider\"\n aria-label={UiIModelComponents.translate(\"color.transparency\")}\n aria-valuemin={0}\n aria-valuemax={1}\n 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\n style={pointerStyle}\n className=\"components-alpha-pointer\"\n data-testid=\"alpha-pointer\"\n />\n </div>\n </div>\n );\n }\n}\n"]}
@@ -7,6 +7,7 @@ import { ColorDef } from "@itwin/core-common";
7
7
  import type { CommonProps } from "@itwin/core-react";
8
8
  /** Properties for the [[ColorPickerButton]] React component
9
9
  * @beta
10
+ * @deprecated in 4.11.x. Props of deprecated component {@link ColorPickerButton}.
10
11
  */
11
12
  export interface ColorPickerProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
12
13
  /** Active color */
@@ -33,6 +34,7 @@ export interface ColorPickerProps extends React.ButtonHTMLAttributes<HTMLButtonE
33
34
  /** ColorPickerButton component
34
35
  * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
35
36
  * @beta
37
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
36
38
  */
37
39
  export declare const ColorPickerButton: (props: ColorPickerProps) => React.ReactElement | null;
38
40
  //# sourceMappingURL=ColorPickerButton.d.ts.map
@@ -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,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8CrD;;GAEG;AACH,MAAM,WAAW,gBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,WAAW;IACb,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;AAmID;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAC9B,KAAK,EAAE,gBAAgB,KACpB,KAAK,CAAC,YAAY,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,EAAE,MAAM,mBAAmB,CAAC;AA+CrD;;;GAGG;AACH,MAAM,WAAW,gBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,WAAW;IACb,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;AAoID;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAE9B,KAAK,EAAE,gBAAgB,KACpB,KAAK,CAAC,YAAY,GAAG,IAAkC,CAAC"}
@@ -21,7 +21,9 @@ function ColorOptions({ handleColorPicked, options, numColumns, round, title, })
21
21
  };
22
22
  return (React.createElement("div", { className: "components-colorpicker-popup-container" },
23
23
  title && React.createElement("h4", null, title),
24
- React.createElement("div", { "data-testid": "components-colorpicker-popup-colors", className: "components-colorpicker-popup-colors", style: containerStyle }, options.map((color, index) => (React.createElement(ColorSwatch, { className: "components-colorpicker-swatch", key: index, colorDef: color, onColorPick: handleColorPicked, round: round }))))));
24
+ React.createElement("div", { "data-testid": "components-colorpicker-popup-colors", className: "components-colorpicker-popup-colors", style: containerStyle }, options.map((color, index) => (
25
+ // eslint-disable-next-line deprecation/deprecation
26
+ React.createElement(ColorSwatch, { className: "components-colorpicker-swatch", key: index, colorDef: color, onColorPick: handleColorPicked, round: round }))))));
25
27
  }
26
28
  // Defined using following pattern (const ColorPickerButton at bottom) to ensure useful API documentation is extracted
27
29
  const ForwardRefColorPickerButton = React.forwardRef(function ForwardRefColorPickerButton({ className, colorDefs, disabled, dropDownTitle, initialColor, numColumns, onColorPick, readonly, round, showCaret, style, }, ref) {
@@ -76,11 +78,12 @@ const ForwardRefColorPickerButton = React.forwardRef(function ForwardRefColorPic
76
78
  React.createElement("div", { className: "components-colorpicker-button-color-swatch", style: swatchStyle, "data-testid": showPopup ? "caret-up" : "caret-down" }),
77
79
  showCaret && (React.createElement(Icon, { className: "components-caret", iconSpec: showPopup ? React.createElement(SvgCaretUpSmall, null) : React.createElement(SvgCaretDownSmall, null) })))),
78
80
  React.createElement(Popup, { className: "components-colorpicker-popup", isOpen: showPopup, position: RelativePosition.BottomLeft, onClose: closePopup, target: target.current, closeOnNestedPopupOutsideClick: true },
79
- React.createElement(ColorOptions, { handleColorPicked: handleColorPicked, options: colorOptions, numColumns: numColumns ?? 4, round: !!round, title: dropDownTitle }))));
81
+ React.createElement(ColorOptions, { handleColorPicked: handleColorPicked, options: colorOptions, numColumns: numColumns !== null && numColumns !== void 0 ? numColumns : 4, round: !!round, title: dropDownTitle }))));
80
82
  });
81
83
  /** ColorPickerButton component
82
84
  * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
83
85
  * @beta
86
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
84
87
  */
85
88
  export const ColorPickerButton = ForwardRefColorPickerButton;
86
89
  //# sourceMappingURL=ColorPickerButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE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GAAG,EAAE,IAAI;YAET,6BAAK,SAAS,EAAC,yCAAyC;gBACtD,6BACE,SAAS,EAAC,4CAA4C,EACtD,KAAK,EAAE,WAAW,iBACL,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,GAClD;gBACD,SAAS,IAAI,CACZ,oBAAC,IAAI,IACH,SAAS,EAAC,kBAAkB,EAC5B,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAC,eAAe,OAAG,CAAC,CAAC,CAAC,oBAAC,iBAAiB,OAAG,GACjE,CACH,CACG,CACC;QACT,oBAAC,KAAK,IACJ,SAAS,EAAC,8BAA8B,EACxC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,CAAC,OAAO,EACtB,8BAA8B;YAE9B,oBAAC,YAAY,IACX,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,UAAU,IAAI,CAAC,EAC3B,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,KAAK,EAAE,aAAa,GACpB,CACI,CACP,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAEG,2BAA2B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Color\n */\n\nimport \"./ColorPickerButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon, Popup, useRefs } from \"@itwin/core-react\";\nimport { ColorSwatch } from \"./Swatch\";\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\nimport { SvgCaretDownSmall, SvgCaretUpSmall } from \"@itwin/itwinui-icons-react\";\n\n// cSpell:ignore colorpicker\n\nfunction ColorOptions({\n handleColorPicked,\n options,\n numColumns,\n round,\n title,\n}: {\n handleColorPicked: (color: ColorDef) => void;\n options: ColorDef[];\n numColumns: number;\n round: boolean;\n title?: string;\n}) {\n const containerStyle: React.CSSProperties = {\n gridTemplateColumns: `repeat(${numColumns}, 1fr)`,\n };\n return (\n <div className=\"components-colorpicker-popup-container\">\n {title && <h4>{title}</h4>}\n <div\n data-testid=\"components-colorpicker-popup-colors\"\n className=\"components-colorpicker-popup-colors\"\n style={containerStyle}\n >\n {options.map((color, index) => (\n <ColorSwatch\n className=\"components-colorpicker-swatch\"\n key={index}\n colorDef={color}\n onColorPick={handleColorPicked}\n round={round}\n />\n ))}\n </div>\n </div>\n );\n}\n\n/** Properties for the [[ColorPickerButton]] React component\n * @beta\n */\nexport interface ColorPickerProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n CommonProps {\n /** Active color */\n initialColor: ColorDef;\n /** Available colors */\n colorDefs?: ColorDef[];\n /** Function to run when user selects color swatch */\n onColorPick?: ((color: ColorDef) => void) | undefined;\n /** Show swatches as squares unless round is set to true */\n round?: boolean;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n /** Title to show at top of DropDown */\n dropDownTitle?: string;\n /** Number of columns */\n numColumns?: number;\n /** Provides ability to return reference to HTMLButtonElement */\n ref?: React.Ref<HTMLButtonElement>;\n /** If true show up/down caret next to color */\n showCaret?: boolean;\n}\n\n// Defined using following pattern (const ColorPickerButton at bottom) to ensure useful API documentation is extracted\nconst ForwardRefColorPickerButton = React.forwardRef<\n HTMLButtonElement,\n ColorPickerProps\n>(function ForwardRefColorPickerButton(\n {\n className,\n colorDefs,\n disabled,\n dropDownTitle,\n initialColor,\n numColumns,\n onColorPick,\n readonly,\n round,\n showCaret,\n style,\n },\n ref\n) {\n const target = React.useRef<HTMLButtonElement>(null);\n const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.\n const [showPopup, setShowPopup] = React.useState(false);\n const [colorDef, setColorDef] = React.useState(initialColor);\n\n // See if new initialColor props have changed since component mounted\n React.useEffect(() => {\n setColorDef(initialColor);\n }, [initialColor]);\n\n const defaultColors = React.useRef([\n ColorDef.create(ColorByName.red),\n ColorDef.create(ColorByName.orange),\n ColorDef.create(ColorByName.yellow),\n ColorDef.create(ColorByName.green),\n ColorDef.create(ColorByName.blue),\n ColorDef.create(ColorByName.indigo),\n ColorDef.create(ColorByName.violet),\n ColorDef.create(ColorByName.black),\n ColorDef.create(ColorByName.white),\n ColorDef.create(ColorByName.cyan),\n ColorDef.create(ColorByName.fuchsia),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.gray),\n ColorDef.create(ColorByName.brown),\n ColorDef.create(ColorByName.purple),\n ColorDef.create(ColorByName.olive),\n ]);\n\n const closePopup = React.useCallback(() => {\n setShowPopup(false);\n }, []);\n\n const togglePopup = React.useCallback(() => {\n setShowPopup(!showPopup);\n }, [showPopup]);\n\n const handleColorPicked = React.useCallback(\n (color: ColorDef) => {\n closePopup();\n\n // istanbul ignore else\n if (!color.equals(colorDef)) {\n setColorDef(color);\n onColorPick && onColorPick(color);\n }\n },\n [closePopup, colorDef, onColorPick]\n );\n\n const rgbaString = getCSSColorFromDef(colorDef);\n\n const buttonStyle = { ...style } as React.CSSProperties;\n const swatchStyle = { backgroundColor: rgbaString } as React.CSSProperties;\n\n const buttonClassNames = classnames(\n \"components-colorpicker-button\",\n round && \"round\",\n readonly && \"readonly\",\n className\n );\n\n const colorOptions =\n colorDefs && colorDefs.length ? colorDefs : defaultColors.current;\n return (\n <>\n <button\n data-testid=\"components-colorpicker-button\"\n data-value={rgbaString}\n onClick={togglePopup}\n className={buttonClassNames}\n style={buttonStyle}\n disabled={disabled}\n ref={refs}\n >\n <div className=\"components-colorpicker-button-container\">\n <div\n className=\"components-colorpicker-button-color-swatch\"\n style={swatchStyle}\n data-testid={showPopup ? \"caret-up\" : \"caret-down\"}\n />\n {showCaret && (\n <Icon\n className=\"components-caret\"\n iconSpec={showPopup ? <SvgCaretUpSmall /> : <SvgCaretDownSmall />}\n />\n )}\n </div>\n </button>\n <Popup\n className=\"components-colorpicker-popup\"\n isOpen={showPopup}\n position={RelativePosition.BottomLeft}\n onClose={closePopup}\n target={target.current}\n closeOnNestedPopupOutsideClick\n >\n <ColorOptions\n handleColorPicked={handleColorPicked}\n options={colorOptions}\n numColumns={numColumns ?? 4}\n round={!!round}\n title={dropDownTitle}\n />\n </Popup>\n </>\n );\n});\n\n/** ColorPickerButton component\n * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.\n * @beta\n */\nexport const ColorPickerButton: (\n props: ColorPickerProps\n) => React.ReactElement | null = ForwardRefColorPickerButton;\n"]}
1
+ {"version":3,"file":"ColorPickerButton.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEhF,4BAA4B;AAE5B,SAAS,YAAY,CAAC,EACpB,iBAAiB,EACjB,OAAO,EACP,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AG,CAAC,CAAC,CAAC,oBAAC,iBAAiB,OAAG,GACjE,CACH,CACG,CACC;QACT,oBAAC,KAAK,IACJ,SAAS,EAAC,8BAA8B,EACxC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,CAAC,OAAO,EACtB,8BAA8B;YAE9B,oBAAC,YAAY,IACX,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CAAC,EAC3B,KAAK,EAAE,CAAC,CAAC,KAAK,EACd,KAAK,EAAE,aAAa,GACpB,CACI,CACP,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAGG,2BAA2B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Color\n */\n\nimport \"./ColorPickerButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { ColorByName, ColorDef } from \"@itwin/core-common\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon, Popup, useRefs } from \"@itwin/core-react\";\nimport { ColorSwatch } from \"./Swatch\";\nimport { getCSSColorFromDef } from \"./getCSSColorFromDef\";\nimport { SvgCaretDownSmall, SvgCaretUpSmall } from \"@itwin/itwinui-icons-react\";\n\n// cSpell:ignore colorpicker\n\nfunction ColorOptions({\n handleColorPicked,\n options,\n numColumns,\n round,\n title,\n}: {\n handleColorPicked: (color: ColorDef) => void;\n options: ColorDef[];\n numColumns: number;\n round: boolean;\n title?: string;\n}) {\n const containerStyle: React.CSSProperties = {\n gridTemplateColumns: `repeat(${numColumns}, 1fr)`,\n };\n return (\n <div className=\"components-colorpicker-popup-container\">\n {title && <h4>{title}</h4>}\n <div\n data-testid=\"components-colorpicker-popup-colors\"\n className=\"components-colorpicker-popup-colors\"\n style={containerStyle}\n >\n {options.map((color, index) => (\n // eslint-disable-next-line deprecation/deprecation\n <ColorSwatch\n className=\"components-colorpicker-swatch\"\n key={index}\n colorDef={color}\n onColorPick={handleColorPicked}\n round={round}\n />\n ))}\n </div>\n </div>\n );\n}\n\n/** Properties for the [[ColorPickerButton]] React component\n * @beta\n * @deprecated in 4.11.x. Props of deprecated component {@link ColorPickerButton}.\n */\nexport interface ColorPickerProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n CommonProps {\n /** Active color */\n initialColor: ColorDef;\n /** Available colors */\n colorDefs?: ColorDef[];\n /** Function to run when user selects color swatch */\n onColorPick?: ((color: ColorDef) => void) | undefined;\n /** Show swatches as squares unless round is set to true */\n round?: boolean;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n /** Title to show at top of DropDown */\n dropDownTitle?: string;\n /** Number of columns */\n numColumns?: number;\n /** Provides ability to return reference to HTMLButtonElement */\n ref?: React.Ref<HTMLButtonElement>;\n /** If true show up/down caret next to color */\n showCaret?: boolean;\n}\n\n// Defined using following pattern (const ColorPickerButton at bottom) to ensure useful API documentation is extracted\nconst ForwardRefColorPickerButton = React.forwardRef<\n HTMLButtonElement,\n // eslint-disable-next-line deprecation/deprecation\n ColorPickerProps\n>(function ForwardRefColorPickerButton(\n {\n className,\n colorDefs,\n disabled,\n dropDownTitle,\n initialColor,\n numColumns,\n onColorPick,\n readonly,\n round,\n showCaret,\n style,\n },\n ref\n) {\n const target = React.useRef<HTMLButtonElement>(null);\n const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.\n const [showPopup, setShowPopup] = React.useState(false);\n const [colorDef, setColorDef] = React.useState(initialColor);\n\n // See if new initialColor props have changed since component mounted\n React.useEffect(() => {\n setColorDef(initialColor);\n }, [initialColor]);\n\n const defaultColors = React.useRef([\n ColorDef.create(ColorByName.red),\n ColorDef.create(ColorByName.orange),\n ColorDef.create(ColorByName.yellow),\n ColorDef.create(ColorByName.green),\n ColorDef.create(ColorByName.blue),\n ColorDef.create(ColorByName.indigo),\n ColorDef.create(ColorByName.violet),\n ColorDef.create(ColorByName.black),\n ColorDef.create(ColorByName.white),\n ColorDef.create(ColorByName.cyan),\n ColorDef.create(ColorByName.fuchsia),\n ColorDef.create(ColorByName.tan),\n ColorDef.create(ColorByName.gray),\n ColorDef.create(ColorByName.brown),\n ColorDef.create(ColorByName.purple),\n ColorDef.create(ColorByName.olive),\n ]);\n\n const closePopup = React.useCallback(() => {\n setShowPopup(false);\n }, []);\n\n const togglePopup = React.useCallback(() => {\n setShowPopup(!showPopup);\n }, [showPopup]);\n\n const handleColorPicked = React.useCallback(\n (color: ColorDef) => {\n closePopup();\n\n // istanbul ignore else\n if (!color.equals(colorDef)) {\n setColorDef(color);\n onColorPick && onColorPick(color);\n }\n },\n [closePopup, colorDef, onColorPick]\n );\n\n const rgbaString = getCSSColorFromDef(colorDef);\n\n const buttonStyle = { ...style } as React.CSSProperties;\n const swatchStyle = { backgroundColor: rgbaString } as React.CSSProperties;\n\n const buttonClassNames = classnames(\n \"components-colorpicker-button\",\n round && \"round\",\n readonly && \"readonly\",\n className\n );\n\n const colorOptions =\n colorDefs && colorDefs.length ? colorDefs : defaultColors.current;\n return (\n <>\n <button\n data-testid=\"components-colorpicker-button\"\n data-value={rgbaString}\n onClick={togglePopup}\n className={buttonClassNames}\n style={buttonStyle}\n disabled={disabled}\n ref={refs}\n >\n <div className=\"components-colorpicker-button-container\">\n <div\n className=\"components-colorpicker-button-color-swatch\"\n style={swatchStyle}\n data-testid={showPopup ? \"caret-up\" : \"caret-down\"}\n />\n {showCaret && (\n <Icon\n className=\"components-caret\"\n iconSpec={showPopup ? <SvgCaretUpSmall /> : <SvgCaretDownSmall />}\n />\n )}\n </div>\n </button>\n <Popup\n className=\"components-colorpicker-popup\"\n isOpen={showPopup}\n position={RelativePosition.BottomLeft}\n onClose={closePopup}\n target={target.current}\n closeOnNestedPopupOutsideClick\n >\n <ColorOptions\n handleColorPicked={handleColorPicked}\n options={colorOptions}\n numColumns={numColumns ?? 4}\n round={!!round}\n title={dropDownTitle}\n />\n </Popup>\n </>\n );\n});\n\n/** ColorPickerButton component\n * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.\n * @beta\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.\n */\nexport const ColorPickerButton: (\n // eslint-disable-next-line deprecation/deprecation\n props: ColorPickerProps\n) => React.ReactElement | null = ForwardRefColorPickerButton;\n"]}
@@ -5,6 +5,7 @@ import * as React from "react";
5
5
  import { ColorDef } from "@itwin/core-common";
6
6
  /** Properties for the [[ColorPickerDialog]] React component
7
7
  * @beta
8
+ * @deprecated in 4.11.x. Props of deprecated component {@link ColorPickerDialog}.
8
9
  */
9
10
  export interface ColorPickerDialogProps {
10
11
  dialogTitle: string;
@@ -19,6 +20,7 @@ export interface ColorPickerDialogProps {
19
20
  /**
20
21
  * Color Picker Dialog to use as modal dialog.
21
22
  * @beta
23
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
22
24
  */
23
25
  export declare function ColorPickerDialog({ dialogTitle, color, onOkResult, onCancelResult, colorPresets, colorInputType, }: ColorPickerDialogProps): React.JSX.Element;
24
26
  //# sourceMappingURL=ColorPickerDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerDialog.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerDialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAS9C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,UAAU,EAAE,CAAC,aAAa,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC9C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mCAAmC;IACnC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC1B,6FAA6F;IAC7F,cAAc,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,KAAK,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,GACf,EAAE,sBAAsB,qBA0DxB"}
1
+ {"version":3,"file":"ColorPickerDialog.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerDialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAS9C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,UAAU,EAAE,CAAC,aAAa,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC9C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mCAAmC;IACnC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC1B,6FAA6F;IAC7F,cAAc,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,KAAK,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,GACf,EACD,sBAAsB,qBA0DrB"}
@@ -5,7 +5,6 @@
5
5
  /** @packageDocumentation
6
6
  * @module Color
7
7
  */
8
- // cSpell:ignore colorpicker
9
8
  import * as React from "react";
10
9
  import { DialogButtonType } from "@itwin/appui-abstract";
11
10
  import { Dialog } from "@itwin/core-react";
@@ -14,6 +13,7 @@ import { ColorBuilder, ColorInputPanel, ColorPalette, ColorPicker, ColorValue, }
14
13
  /**
15
14
  * Color Picker Dialog to use as modal dialog.
16
15
  * @beta
16
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
17
17
  */
18
18
  export function ColorPickerDialog({ dialogTitle, color, onOkResult, onCancelResult, colorPresets, colorInputType, }) {
19
19
  const [activeColor, setActiveColor] = React.useState(color);
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerDialog.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerDialog.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,4BAA4B;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,sBAAsB,CAAC;AAgB9B;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,WAAW,EACX,KAAK,EACL,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,GACS;IACvB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE3D,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACtC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC1B,CAAC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AE,YAAY,EACrB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,GAAG;YAEb,oBAAC,WAAW,IACV,aAAa,EAAE,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EACpD,gBAAgB,EAAE,kBAAkB;gBAEpC,oBAAC,YAAY,OAAG;gBACf,cAAc,IAAI,CACjB,oBAAC,eAAe,IAAC,kBAAkB,EAAE,cAAc,GAAI,CACxD;gBACA,YAAY,IAAI,oBAAC,YAAY,IAAC,MAAM,EAAE,YAAY,GAAI,CAC3C,CACP,CACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Color\n */\n\n// cSpell:ignore colorpicker\n\nimport * as React from \"react\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { Dialog } from \"@itwin/core-react\";\nimport { ColorDef } from \"@itwin/core-common\";\nimport {\n ColorBuilder,\n ColorInputPanel,\n ColorPalette,\n ColorPicker,\n ColorValue,\n} from \"@itwin/itwinui-react\";\n\n/** Properties for the [[ColorPickerDialog]] React component\n * @beta\n */\nexport interface ColorPickerDialogProps {\n dialogTitle: string;\n color: ColorDef;\n onOkResult: (selectedColor: ColorDef) => void;\n onCancelResult: () => void;\n /** displayed in rows of 9 items */\n colorPresets?: ColorDef[];\n /** If set show either HSL, RGB, or HEX input values. If undefined no input value is shown */\n colorInputType?: \"hsl\" | \"rgb\" | \"hex\";\n}\n\n/**\n * Color Picker Dialog to use as modal dialog.\n * @beta\n */\nexport function ColorPickerDialog({\n dialogTitle,\n color,\n onOkResult,\n onCancelResult,\n colorPresets,\n colorInputType,\n}: ColorPickerDialogProps) {\n const [activeColor, setActiveColor] = React.useState(color);\n const dialogContainer = React.useRef<HTMLDivElement>(null);\n\n const handleOk = React.useCallback(() => {\n onOkResult(activeColor);\n }, [onOkResult, activeColor]);\n const handleCancel = React.useCallback(() => {\n // istanbul ignore else\n if (onCancelResult) onCancelResult();\n }, [onCancelResult]);\n\n const handleColorChanged = React.useCallback((newColorValue: ColorValue) => {\n const newColorDef = ColorDef.fromTbgr(newColorValue.toTbgr());\n setActiveColor(newColorDef);\n }, []);\n\n const buttonCluster = React.useMemo(\n () => [\n { type: DialogButtonType.OK, onClick: handleOk },\n { type: DialogButtonType.Cancel, onClick: handleCancel },\n ],\n [handleCancel, handleOk]\n );\n\n const colorOptions = React.useMemo(() => {\n if (colorPresets) {\n return colorPresets.map((def) => ColorValue.fromTbgr(def.tbgr));\n }\n return undefined;\n }, [colorPresets]);\n\n return (\n <div ref={dialogContainer}>\n <Dialog\n title={dialogTitle}\n opened={true}\n resizable={false}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={handleCancel}\n onEscape={handleCancel}\n maxWidth={320}\n >\n <ColorPicker\n selectedColor={ColorValue.fromTbgr(activeColor.tbgr)}\n onChangeComplete={handleColorChanged}\n >\n <ColorBuilder />\n {colorInputType && (\n <ColorInputPanel defaultColorFormat={colorInputType} />\n )}\n {colorOptions && <ColorPalette colors={colorOptions} />}\n </ColorPicker>\n </Dialog>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ColorPickerDialog.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerDialog.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,GACX,MAAM,sBAAsB,CAAC;AAiB9B;;;;GAIG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,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;SACjE;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,6BAAK,GAAG,EAAE,eAAe;QACvB,oBAAC,MAAM,IACL,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,KAAK,EAChB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,IAAI,EACX,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,GAAG;YAEb,oBAAC,WAAW,IACV,aAAa,EAAE,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EACpD,gBAAgB,EAAE,kBAAkB;gBAEpC,oBAAC,YAAY,OAAG;gBACf,cAAc,IAAI,CACjB,oBAAC,eAAe,IAAC,kBAAkB,EAAE,cAAc,GAAI,CACxD;gBACA,YAAY,IAAI,oBAAC,YAAY,IAAC,MAAM,EAAE,YAAY,GAAI,CAC3C,CACP,CACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Color\n */\n\nimport * as React from \"react\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\nimport { Dialog } from \"@itwin/core-react\";\nimport { ColorDef } from \"@itwin/core-common\";\nimport {\n ColorBuilder,\n ColorInputPanel,\n ColorPalette,\n ColorPicker,\n ColorValue,\n} from \"@itwin/itwinui-react\";\n\n/** Properties for the [[ColorPickerDialog]] React component\n * @beta\n * @deprecated in 4.11.x. Props of deprecated component {@link ColorPickerDialog}.\n */\nexport interface ColorPickerDialogProps {\n dialogTitle: string;\n color: ColorDef;\n onOkResult: (selectedColor: ColorDef) => void;\n onCancelResult: () => void;\n /** displayed in rows of 9 items */\n colorPresets?: ColorDef[];\n /** If set show either HSL, RGB, or HEX input values. If undefined no input value is shown */\n colorInputType?: \"hsl\" | \"rgb\" | \"hex\";\n}\n\n/**\n * Color Picker Dialog to use as modal dialog.\n * @beta\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.\n */\nexport function ColorPickerDialog({\n dialogTitle,\n color,\n onOkResult,\n onCancelResult,\n colorPresets,\n colorInputType,\n}: // eslint-disable-next-line deprecation/deprecation\nColorPickerDialogProps) {\n const [activeColor, setActiveColor] = React.useState(color);\n const dialogContainer = React.useRef<HTMLDivElement>(null);\n\n const handleOk = React.useCallback(() => {\n onOkResult(activeColor);\n }, [onOkResult, activeColor]);\n const handleCancel = React.useCallback(() => {\n // istanbul ignore else\n if (onCancelResult) onCancelResult();\n }, [onCancelResult]);\n\n const handleColorChanged = React.useCallback((newColorValue: ColorValue) => {\n const newColorDef = ColorDef.fromTbgr(newColorValue.toTbgr());\n setActiveColor(newColorDef);\n }, []);\n\n const buttonCluster = React.useMemo(\n () => [\n { type: DialogButtonType.OK, onClick: handleOk },\n { type: DialogButtonType.Cancel, onClick: handleCancel },\n ],\n [handleCancel, handleOk]\n );\n\n const colorOptions = React.useMemo(() => {\n if (colorPresets) {\n return colorPresets.map((def) => ColorValue.fromTbgr(def.tbgr));\n }\n return undefined;\n }, [colorPresets]);\n\n return (\n <div ref={dialogContainer}>\n <Dialog\n title={dialogTitle}\n opened={true}\n resizable={false}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={handleCancel}\n onEscape={handleCancel}\n maxWidth={320}\n >\n <ColorPicker\n selectedColor={ColorValue.fromTbgr(activeColor.tbgr)}\n onChangeComplete={handleColorChanged}\n >\n <ColorBuilder />\n {colorInputType && (\n <ColorInputPanel defaultColorFormat={colorInputType} />\n )}\n {colorOptions && <ColorPalette colors={colorOptions} />}\n </ColorPicker>\n </Dialog>\n </div>\n );\n}\n"]}
@@ -8,6 +8,7 @@ import type { CommonProps } from "@itwin/core-react";
8
8
  import "./ColorPickerPopup.scss";
9
9
  /** Properties for the [[ColorPickerPopup]] React component
10
10
  * @public
11
+ * @deprecated in 4.11.x. Props of deprecated component {@link ColorPickerPopup}.
11
12
  */
12
13
  export interface ColorPickerPopupProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonProps {
13
14
  /** Current color */
@@ -40,6 +41,7 @@ export interface ColorPickerPopupProps extends React.ButtonHTMLAttributes<HTMLBu
40
41
  * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.
41
42
  * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
42
43
  * @public
44
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
43
45
  */
44
46
  export declare const ColorPickerPopup: (props: ColorPickerPopupProps) => React.ReactElement | null;
45
47
  //# sourceMappingURL=ColorPickerPopup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerPopup.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/color/ColorPickerPopup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAe,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUrD,OAAO,yBAAyB,CAAC;AASjC;;GAEG;AACH,MAAM,WAAW,qBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,WAAW;IACb,oBAAoB;IACpB,YAAY,EAAE,QAAQ,CAAC;IACvB;uCACmC;IACnC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,uDAAuD;IACv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WAAW;IACb,oBAAoB;IACpB,YAAY,EAAE,QAAQ,CAAC;IACvB;uCACmC;IACnC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,uDAAuD;IACvD,aAAa,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC3D,gDAAgD;IAChD,OAAO,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACvD,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,gEAAgE;IAChE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+BAA+B;IAC/B,cAAc,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CACxC;AAiKD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAE7B,KAAK,EAAE,qBAAqB,KACzB,KAAK,CAAC,YAAY,GAAG,IAAiC,CAAC"}
@@ -5,20 +5,19 @@
5
5
  /** @packageDocumentation
6
6
  * @module Color
7
7
  */
8
- // cSpell:ignore colorpicker
9
8
  import * as React from "react";
10
9
  import classnames from "classnames";
11
10
  import { ColorByName, ColorDef } from "@itwin/core-common";
12
11
  import { RelativePosition } from "@itwin/appui-abstract";
13
12
  import { Icon, Popup, useRefs } from "@itwin/core-react";
14
- // import { ColorPickerPanel } from "./ColorPickerPanel";
15
13
  import { ColorBuilder, ColorInputPanel, ColorPalette, ColorPicker, ColorValue, } from "@itwin/itwinui-react";
16
14
  import "./ColorPickerPopup.scss";
17
15
  import { getCSSColorFromDef } from "./getCSSColorFromDef";
18
- import { UiIModelComponents } from "../UiIModelComponents";
19
16
  import { SvgCaretDownSmall, SvgCaretUpSmall, SvgClose, } from "@itwin/itwinui-icons-react";
17
+ import { useTranslation } from "../useTranslation";
20
18
  // Defined using following pattern (const ColorPickerPopup at bottom) to ensure useful API documentation is extracted
21
19
  const ForwardRefColorPickerPopup = React.forwardRef(function ForwardRefColorPickerPopup(props, ref) {
20
+ const { translate } = useTranslation();
22
21
  const target = React.useRef(null);
23
22
  const refs = useRefs(target, ref); // combine ref needed for target with the forwardRef needed by the Parent when parent is a Type Editor.
24
23
  const [showPopup, setShowPopup] = React.useState(false);
@@ -87,8 +86,8 @@ const ForwardRefColorPickerPopup = React.forwardRef(function ForwardRefColorPick
87
86
  const popupPosition = undefined !== props.popupPosition
88
87
  ? props.popupPosition
89
88
  : RelativePosition.BottomLeft;
90
- const [closeLabel] = React.useState(() => UiIModelComponents.translate("color.close"));
91
- const [togglePopupLabel] = React.useState(() => UiIModelComponents.translate("color.toggleColorPopup"));
89
+ const closeLabel = translate("color.close");
90
+ const togglePopupLabel = translate("color.toggleColorPopup");
92
91
  return (
93
92
  /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
94
93
  React.createElement("div", { onClick: clickHandler },
@@ -109,6 +108,7 @@ const ForwardRefColorPickerPopup = React.forwardRef(function ForwardRefColorPick
109
108
  * ColorPickerButton component that allows user to select a color from a set of color swatches or to define a new color.
110
109
  * @note Using forwardRef so the ColorEditor (Type Editor) can access the ref of the button element inside this component.
111
110
  * @public
111
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/colorpicker iTwinUI color picker} instead.
112
112
  */
113
113
  export const ColorPickerPopup = ForwardRefColorPickerPopup;
114
114
  //# sourceMappingURL=ColorPickerPopup.js.map